addMachine.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167
  1. <template>
  2. <view>
  3. <form @submit="submit">
  4. <form @submit="addMachine">
  5. <view class="title">机器</view>
  6. <view class="body">
  7. <input class="input" style="display:none;" name="coding" :value=coding />
  8. 机器编码:<input class="input" v-model="coding" />
  9. <button type="primary" @click="saoma('coding')" class="button1">
  10. <p class="p">扫码</p>
  11. </button>
  12. <button type="primary" @click="getMachine(coding)" class="button1">
  13. <p class="p">确认</p>
  14. </button>
  15. </view>
  16. <view class="bodyname">
  17. 名称:<input class="input" name="name" :value="name" />
  18. <button type="primary" form-type="submit" class="button1">
  19. <p class="p">确认</p>
  20. </button>
  21. </view>
  22. <view class="body">
  23. 机身铭牌:<input class="input" name="nameplate" :value="nameplate" />
  24. <button type="primary" form-type="submit" class="button1">
  25. <p class="p">确认</p>
  26. </button>
  27. </view>
  28. </form>
  29. <view class="line"></view>
  30. <form @submit="jike" @reset="jikeReset">
  31. <view class="modules">
  32. <view class="title">机壳</view>
  33. <view class="body">
  34. <input class="input" style="display:none;" name="jikeCoding" :value=jikeCoding />
  35. 编码:<input class="input" v-model="jikeCoding" />
  36. <button type="primary" @click="saoma('jikeCoding')" class="button1">
  37. <p class="p">扫码</p>
  38. </button>
  39. <button type="primary" @click="getMessage(jikeCoding)" class="button1">
  40. <p class="p">获取</p>
  41. </button>
  42. </view>
  43. <view class="body">
  44. 名称:<input class="input" name="jikeName" :value="jikeName" />
  45. </view>
  46. <view class="body">
  47. 版本:<input class="input" name="jikeVersion" :value="jikeVersion" />
  48. </view>
  49. <view class="modulesButton">
  50. <button type="primary" form-type="submit" class="button1">
  51. <p class="p">确认</p>
  52. </button>
  53. <button type="primary" @click="updateModules(jikeCoding,'jike')" class="button1">
  54. <p class="p">更换</p>
  55. </button>
  56. </view>
  57. </view>
  58. </form>
  59. <view class="line"></view>
  60. <form @submit="lutou" @reset="lutouReset">
  61. <view class="modules">
  62. <view class="title">炉头</view>
  63. <view class="body">
  64. <input class="input" style="display:none;" name="lutouCoding" :value=lutouCoding />
  65. 编码:<input class="input" v-model="lutouCoding" />
  66. <button type="primary" @click="saoma('lutouCoding')" class="button1">
  67. <p class="p">扫码</p>
  68. </button>
  69. <button type="primary" @click="getMessage(lutouCoding)" class="button1">
  70. <p class="p">获取</p>
  71. </button>
  72. </view>
  73. <view class="body">
  74. 名称:<input class="input" name="lutouName" :value="lutouName" />
  75. </view>
  76. <view class="body">
  77. 版本:<input class="input" name="lutouVersion" :value="lutouVersion" />
  78. </view>
  79. <view class="modulesButton">
  80. <button type="primary" form-type="submit" class="button1">
  81. <p class="p">确认</p>
  82. </button>
  83. <button type="primary" @click="updateModules(lutouCoding,'lutou')" class="button1">
  84. <p class="p">更换</p>
  85. </button>
  86. </view>
  87. </view>
  88. </form>
  89. <view class="line"></view>
  90. <form @submit="jiashiqi" @reset="jiashiqiReset">
  91. <view class="modules">
  92. <view class="title">加湿器</view>
  93. <view class="body">
  94. <input class="input" style="display:none;" name="jiashiqiCoding" :value=jiashiqiCoding />
  95. 编码:<input class="input" v-model="jiashiqiCoding" />
  96. <button type="primary" @click="saoma('jiashiqiCoding')" class="button1">
  97. <p class="p">扫码</p>
  98. </button>
  99. <button type="primary" @click="getMessage(jiashiqiCoding)" class="button1">
  100. <p class="p">获取</p>
  101. </button>
  102. </view>
  103. <view class="body">
  104. 名称:<input class="input" name="jiashiqiName" :value="jiashiqiName" />
  105. </view>
  106. <view class="body">
  107. 版本:<input class="input" name="jiashiqiVersion" :value="jiashiqiVersion" />
  108. </view>
  109. <view class="modulesButton">
  110. <button type="primary" form-type="submit" class="button1">
  111. <p class="p">确认</p>
  112. </button>
  113. <button type="primary" @click="updateModules(jiashiqiCoding,'jiashiqi')" class="button1">
  114. <p class="p">更换</p>
  115. </button>
  116. </view>
  117. </view>
  118. </form>
  119. <view class="line"></view>
  120. <form @submit="shuibeng" @reset="shuibengReset">
  121. <view class="modules">
  122. <view class="title">水泵</view>
  123. <view class="body">
  124. <input class="input" style="display:none;" name="shuibengCoding" :value=shuibengCoding />
  125. 编码:<input class="input" v-model="shuibengCoding" />
  126. <button type="primary" @click="saoma('shuibengCoding')" class="button1">
  127. <p class="p">扫码</p>
  128. </button>
  129. <button type="primary" @click="getMessage(shuibengCoding)" class="button1">
  130. <p class="p">获取</p>
  131. </button>
  132. </view>
  133. <view class="body">
  134. 名称:<input class="input" name="shuibengName" :value="shuibengName" />
  135. </view>
  136. <view class="body">
  137. 版本:<input class="input" name="shuibengVersion" :value="shuibengVersion" />
  138. </view>
  139. <view class="modulesButton">
  140. <button type="primary" form-type="submit" class="button1">
  141. <p class="p">确认</p>
  142. </button>
  143. <button type="primary" @click="updateModules(shuibengCoding,'shuibeng')" class="button1">
  144. <p class="p">更换</p>
  145. </button>
  146. </view>
  147. </view>
  148. </form>
  149. <view class="line"></view>
  150. <form @submit="chugun" @reset="chugunReset">
  151. <view class="modules">
  152. <view class="title">出棍模块</view>
  153. <view class="body">
  154. <input class="input" style="display:none;" name="chugunCoding" :value=chugunCoding />
  155. 编码:<input class="input" v-model="chugunCoding" />
  156. <button type="primary" @click="saoma('chugunCoding')" class="button1">
  157. <p class="p">扫码</p>
  158. </button>
  159. <button type="primary" @click="getMessage(chugunCoding)" class="button1">
  160. <p class="p">获取</p>
  161. </button>
  162. </view>
  163. <view class="body">
  164. 名称:<input class="input" name="chugunName" :value="chugunName" />
  165. </view>
  166. <view class="body">
  167. 版本:<input class="input" name="chugunVersion" :value="chugunVersion" />
  168. </view>
  169. <view class="modulesButton">
  170. <button type="primary" form-type="submit" class="button1">
  171. <p class="p">确认</p>
  172. </button>
  173. <button type="primary" @click="updateModules(chugunCoding,'chugun')" class="button1">
  174. <p class="p">更换</p>
  175. </button>
  176. </view>
  177. </view>
  178. </form>
  179. <view class="line"></view>
  180. <form @submit="diangui" @reset="dianguiReset">
  181. <view class="modules">
  182. <view class="title">电柜模块</view>
  183. <view class="body">
  184. <input class="input" style="display:none;" name="dianguiCoding" :value=dianguiCoding />
  185. 编码:<input class="input" v-model="dianguiCoding" />
  186. <button type="primary" @click="saoma('dianguiCoding')" class="button1">
  187. <p class="p">扫码</p>
  188. </button>
  189. <button type="primary" @click="getMessage(dianguiCoding)" class="button1">
  190. <p class="p">获取</p>
  191. </button>
  192. </view>
  193. <view class="body">
  194. 名称:<input class="input" name="dianguiName" :value="dianguiName" />
  195. </view>
  196. <view class="body">
  197. 版本:<input class="input" name="dianguiVersion" :value="dianguiVersion" />
  198. </view>
  199. <view class="modulesButton">
  200. <button type="primary" form-type="submit" class="button1">
  201. <p class="p">确认</p>
  202. </button>
  203. <button type="primary" @click="updateModules(dianguiCoding,'diangui')" class="button1">
  204. <p class="p">更换</p>
  205. </button>
  206. </view>
  207. </view>
  208. </form>
  209. <view class="line"></view>
  210. <form @submit="zidongdoor" @reset="zidongdoorReset">
  211. <view class="modules">
  212. <view class="title">自动门</view>
  213. <view class="body">
  214. <input class="input" style="display:none;" name="zidongdoorCoding" :value=zidongdoorCoding />
  215. 编码:<input class="input" v-model="zidongdoorCoding" />
  216. <button type="primary" @click="saoma('zidongdoorCoding')" class="button1">
  217. <p class="p">扫码</p>
  218. </button>
  219. <button type="primary" @click="getMessage(zidongdoorCoding)" class="button1">
  220. <p class="p">获取</p>
  221. </button>
  222. </view>
  223. <view class="body">
  224. 名称:<input class="input" name="zidongdoorName" :value="zidongdoorName" />
  225. </view>
  226. <view class="body">
  227. 版本:<input class="input" name="zidongdoorVersion" :value="zidongdoorVersion" />
  228. </view>
  229. <view class="modulesButton">
  230. <button type="primary" form-type="submit" class="button1">
  231. <p class="p">确认</p>
  232. </button>
  233. <button type="primary" @click="updateModules(zidongdoorCoding,'zidongdoor')" class="button1">
  234. <p class="p">更换</p>
  235. </button>
  236. </view>
  237. </view>
  238. </form>
  239. <view class="line"></view>
  240. <form @submit="shoudongdoor" @reset="shoudongdoorReset">
  241. <view class="modules">
  242. <view class="title">手动门</view>
  243. <view class="body">
  244. <input class="input" style="display:none;" name="shoudongdoorCoding" :value=shoudongdoorCoding />
  245. 编码:<input class="input" v-model="shoudongdoorCoding" />
  246. <button type="primary" @click="saoma('shoudongdoorCoding')" class="button1">
  247. <p class="p">扫码</p>
  248. </button>
  249. <button type="primary" @click="getMessage(shoudongdoorCoding)" class="button1">
  250. <p class="p">获取</p>
  251. </button>
  252. </view>
  253. <view class="body">
  254. 名称:<input class="input" name="shoudongdoorName" :value="shoudongdoorName" />
  255. </view>
  256. <view class="body">
  257. 版本:<input class="input" name="shoudongdoorVersion" :value="shoudongdoorVersion" />
  258. </view>
  259. <view class="modulesButton">
  260. <button type="primary" form-type="submit" class="button1">
  261. <p class="p">确认</p>
  262. </button>
  263. <button type="primary" @click="updateModules(shoudongdoorCoding,'shoudongdoor')" class="button1">
  264. <p class="p">更换</p>
  265. </button>
  266. </view>
  267. </view>
  268. </form>
  269. <view class="line"></view>
  270. <form @submit="jixieshou" @reset="jixieshouReset">
  271. <view class="modules">
  272. <view class="title">机械手</view>
  273. <view class="body">
  274. <input class="input" style="display:none;" name="jixieshouCoding" :value=jixieshouCoding />
  275. 编码:<input class="input" v-model="jixieshouCoding" />
  276. <button type="primary" @click="saoma('jixieshouCoding')" class="button1">
  277. <p class="p">扫码</p>
  278. </button>
  279. <button type="primary" @click="getMessage(jixieshouCoding)" class="button1">
  280. <p class="p">获取</p>
  281. </button>
  282. </view>
  283. <view class="body">
  284. 名称:<input class="input" name="jixieshouName" :value="jixieshouName" />
  285. </view>
  286. <view class="body">
  287. 版本:<input class="input" name="jixieshouVersion" :value="jixieshouVersion" />
  288. </view>
  289. <view class="modulesButton">
  290. <button type="primary" form-type="submit" class="button1">
  291. <p class="p">确认</p>
  292. </button>
  293. <button type="primary" @click="updateModules(jixieshouCoding,'jixieshou')" class="button1">
  294. <p class="p">更换</p>
  295. </button>
  296. </view>
  297. </view>
  298. </form>
  299. <view class="line"></view>
  300. <form @submit="yaxingdao" @reset="yaxingdaoReset">
  301. <view class="modules">
  302. <view class="title">压型刀</view>
  303. <view class="body">
  304. <input class="input" style="display:none;" name="yaxingdaoCoding" :value=yaxingdaoCoding />
  305. 编码:<input class="input" v-model="yaxingdaoCoding" />
  306. <button type="primary" @click="saoma('yaxingdaoCoding')" class="button1">
  307. <p class="p">扫码</p>
  308. </button>
  309. <button type="primary" @click="getMessage(yaxingdaoCoding)" class="button1">
  310. <p class="p">获取</p>
  311. </button>
  312. </view>
  313. <view class="body">
  314. 名称:<input class="input" name="yaxingdaoName" :value="yaxingdaoName" />
  315. </view>
  316. <view class="body">
  317. 版本:<input class="input" name="yaxingdaoVersion" :value="yaxingdaoVersion" />
  318. </view>
  319. <view class="modulesButton">
  320. <button type="primary" form-type="submit" class="button1">
  321. <p class="p">确认</p>
  322. </button>
  323. <button type="primary" @click="updateModules(yaxingdaoCoding,'yaxingdao')" class="button1">
  324. <p class="p">更换</p>
  325. </button>
  326. </view>
  327. </view>
  328. </form>
  329. <view class="line"></view>
  330. <form @submit="songtang" @reset="yaxingdaoReset">
  331. <view class="modules">
  332. <view class="title">送糖模块</view>
  333. <view class="body">
  334. <input class="input" style="display:none;" name="songtangCoding" :value=songtangCoding />
  335. 编码:<input class="input" v-model="songtangCoding" />
  336. <button type="primary" @click="saoma('songtangCoding')" class="button1">
  337. <p class="p">扫码</p>
  338. </button>
  339. <button type="primary" @click="getMessage(songtangCoding)" class="button1">
  340. <p class="p">获取</p>
  341. </button>
  342. </view>
  343. <view class="body">
  344. 名称:<input class="input" name="songtangName" :value="songtangName" />
  345. </view>
  346. <view class="body">
  347. 版本:<input class="input" name="songtangVersion" :value="songtangVersion" />
  348. </view>
  349. <view class="modulesButton">
  350. <button type="primary" form-type="submit" class="button1">
  351. <p class="p">确认</p>
  352. </button>
  353. <button type="primary" @click="updateModules(songtangCoding,'songtang')" class="button1">
  354. <p class="p">更换</p>
  355. </button>
  356. </view>
  357. </view>
  358. </form>
  359. <view class="line"></view>
  360. <form @submit="anzhuoping" @reset="anzhuopingReset">
  361. <view class="modules">
  362. <view class="title">安卓屏</view>
  363. <view class="body">
  364. <input class="input" style="display:none;" name="anzhuopingCoding" :value=anzhuopingCoding />
  365. 编码:<input class="input" v-model="anzhuopingCoding" />
  366. <button type="primary" @click="saoma('anzhuopingCoding')" class="button1">
  367. <p class="p">扫码</p>
  368. </button>
  369. <button type="primary" @click="getMessage(anzhuopingCoding)" class="button1">
  370. <p class="p">获取</p>
  371. </button>
  372. </view>
  373. <view class="body">
  374. 名称:<input class="input" name="anzhuopingName" :value="anzhuopingName" />
  375. </view>
  376. <view class="body">
  377. 版本:<input class="input" name="anzhuopingVersion" :value="anzhuopingVersion" />
  378. </view>
  379. <view class="modulesButton">
  380. <button type="primary" form-type="submit" class="button1">
  381. <p class="p">确认</p>
  382. </button>
  383. <button type="primary" @click="updateModules(anzhuopingCoding,'anzhuoping')" class="button1">
  384. <p class="p">更换</p>
  385. </button>
  386. </view>
  387. </view>
  388. </form>
  389. <view class="line"></view>
  390. <form @submit="qibeng" @reset="yaxingdaoReset">
  391. <view class="modules">
  392. <view class="title">气泵</view>
  393. <view class="body">
  394. <input class="input" style="display:none;" name="qibengCoding" :value=qibengCoding />
  395. 编码:<input class="input" v-model="qibengCoding" />
  396. <button type="primary" @click="saoma('qibengCoding')" class="button1">
  397. <p class="p">扫码</p>
  398. </button>
  399. <button type="primary" @click="getMessage(qibengCoding)" class="button1">
  400. <p class="p">获取</p>
  401. </button>
  402. </view>
  403. <view class="body">
  404. 名称:<input class="input" name="qibengName" :value="qibengName" />
  405. </view>
  406. <view class="body">
  407. 版本:<input class="input" name="qibengVersion" :value="qibengVersion" />
  408. </view>
  409. <view class="modulesButton">
  410. <button type="primary" form-type="submit" class="button1">
  411. <p class="p">确认</p>
  412. </button>
  413. <button type="primary" @click="updateModules(qibengCoding,'qibeng')" class="button1">
  414. <p class="p">更换</p>
  415. </button>
  416. </view>
  417. </view>
  418. </form>
  419. <view class="">
  420. <button type="primary" formType="submit" class="button">
  421. <p class="p1">提交</p>
  422. </button>
  423. </view>
  424. </form>
  425. <view class="line"></view>
  426. </view>
  427. </template>
  428. <script>
  429. import {
  430. mapState,
  431. mapActions,
  432. mapMutations
  433. } from 'vuex';
  434. import timeSelector from '@/components/wing-time-selector/wing-time-selector.vue';
  435. export default {
  436. components: {
  437. timeSelector
  438. },
  439. data() {
  440. return {
  441. produceDate: '',
  442. coding: null,
  443. lutouCoding: null,
  444. jiashiqiCoding: null,
  445. name: null,
  446. jiashiqiName: null,
  447. lutouName: null,
  448. nameplate: null,
  449. producePersonnel: null,
  450. jiashiqiVersion: null,
  451. lutouVersion: null,
  452. jikeCoding:null,
  453. jikeName: null,
  454. jikeVersion: null,
  455. shuibengCoding:null,
  456. shuibengName: null,
  457. shuibengVersion: null,
  458. chugunCoding:null,
  459. chugunName: null,
  460. chugunVersion: null,
  461. dianguiCoding:null,
  462. dianguiName: null,
  463. dianguiVersion: null,
  464. zidongdoorCoding:null,
  465. zidongdoorName: null,
  466. zidongdoorVersion: null,
  467. jixieshouCoding:null,
  468. jixieshouName: null,
  469. jixieshouVersion: null,
  470. yaxingdaoCoding:null,
  471. yaxingdaoName: null,
  472. yaxingdaoVersion: null,
  473. qibengCoding:null,
  474. qibengName: null,
  475. qibengVersion: null,
  476. songtangCoding:null,
  477. songtangName: null,
  478. songtangVersion: null,
  479. shoudongdoorCoding:null,
  480. shoudongdoorName: null,
  481. shoudongdoorVersion: null,
  482. anzhuopingCoding:null,
  483. anzhuopingName: null,
  484. anzhuopingVersion: null
  485. }
  486. },
  487. methods: {
  488. btnConfirm0(e) {
  489. // console.log('确定时间为:', e);
  490. this.produceDate = e.key;
  491. },
  492. btnCancel0() {
  493. this.produceDate = '';
  494. },
  495. saoma(cod) {
  496. var that = this;
  497. // 允许从相机和相册扫码
  498. uni.scanCode({
  499. success(res) {
  500. // console.log('条码类型:' + res.scanType);
  501. // console.log('条码内容:' + res.result);
  502. if (cod == 'coding') {
  503. that.coding = res.result;
  504. }
  505. if (cod == 'lutouCoding') {
  506. that.lutouCoding = res.result;
  507. }
  508. if (cod == 'jiashiqiCoding') {
  509. that.jiashiqiCoding = res.result;
  510. }
  511. if (cod == 'shuibengCoding') {
  512. that.shuibengCoding = res.result;
  513. }
  514. if (cod == 'chugunCoding') {
  515. that.chugunCoding = res.result;
  516. }
  517. if (cod == 'dianguiCoding') {
  518. that.dianguiCoding = res.result;
  519. }
  520. if (cod == 'zidongdoorCoding') {
  521. that.zidongdoorCoding = res.result;
  522. }
  523. if (cod == 'jixieshouCoding') {
  524. that.jixieshouCoding = res.result;
  525. }
  526. if (cod == 'yaxingdaoCoding') {
  527. that.yaxingdaoCoding = res.result;
  528. }
  529. if (cod == 'qibengCoding') {
  530. that.qibengCoding = res.result;
  531. }
  532. if (cod == 'songtangCoding') {
  533. that.songtangCoding = res.result;
  534. }
  535. if (cod == 'shoudongdoorCoding') {
  536. that.shoudongdoorCoding = res.result;
  537. }
  538. if (cod == 'anzhuopingCoding') {
  539. that.anzhuopingCoding = res.result;
  540. }
  541. if (cod == 'jikeCoding') {
  542. that.jikeCoding = res.result;
  543. }
  544. }
  545. });
  546. },
  547. //获取机器详细信息
  548. getMachine(coding) {
  549. // console.log("a");
  550. var that = this;
  551. var serverUrl = that.serverurl;
  552. var token = uni.getStorageSync("token");
  553. uni.request({
  554. url: serverUrl + "/TMachine/getMachine?coding=" + coding,
  555. method: "GET",
  556. header: {
  557. 'token': token
  558. },
  559. success: (Result) => {
  560. console.log(Result);
  561. var res = Result;
  562. if (res.data.code == true) {
  563. //当机器已录入时,会先把所有录入模块给列出来
  564. if (res.data.message == 'all') {
  565. var tmachine = res.data.data.tmachine;
  566. that.name = tmachine.name;
  567. that.nameplate = tmachine.nameplate;
  568. // that.producePersonnel = uni.getStorageSync("name");
  569. var modulesList = res.data.data.modulesList;
  570. var modules;
  571. for (var i = 0; i < modulesList.length; i++) {
  572. // console.log(modulesList[i]);
  573. var coding = modulesList[i].coding;
  574. //排除标准件
  575. if (coding.substring(0, 4) != '1000') {
  576. //半成品
  577. if (coding.substring(0, 2) == '15') {
  578. //"加湿器"
  579. if (coding.substring(5, 7) == '07') {
  580. that.lutouName = modulesList[i].name;
  581. that.jiashiqiName = modulesList[i].name;
  582. that.jiashiqiCoding = modulesList[i].coding;
  583. that.jiashiqiVersion = modulesList[i].coding.substring(8, 10);
  584. }
  585. //炉头
  586. if (coding.substring(5, 7) == '04') {
  587. that.lutouName = modulesList[i].name;
  588. that.lutouCoding = modulesList[i].coding;
  589. that.lutouVersion = modulesList[i].coding.substring(8, 10);
  590. }
  591. //水泵
  592. if (coding.substring(5, 7) == '08') {
  593. that.shuibengName = modulesList[i].name;
  594. that.shuibengCoding = modulesList[i].coding;
  595. that.shuibengVersion = modulesList[i].coding.substring(8, 10);
  596. }
  597. //出棍模块
  598. if (coding.substring(5, 7) == '06') {
  599. that.chugunName = modulesList[i].name;
  600. that.chugunCoding = modulesList[i].coding;
  601. that.chugunVersion = modulesList[i].coding.substring(8, 10);
  602. }
  603. //电柜模块
  604. if (coding.substring(5, 7) == '01') {
  605. that.dianguiName = modulesList[i].name;
  606. that.dianguiCoding = modulesList[i].coding;
  607. that.dianguiVersion = modulesList[i].coding.substring(8, 10);
  608. }
  609. //机壳
  610. if (coding.substring(5, 7) == '09') {
  611. that.jikeName = modulesList[i].name;
  612. that.jikeCoding = modulesList[i].coding;
  613. that.jikeVersion = modulesList[i].coding.substring(8, 10);
  614. }
  615. //自动门
  616. if (coding.substring(5, 7) == '11') {
  617. that.zidongdoorName = modulesList[i].name;
  618. that.zidongdoorCoding = modulesList[i].coding;
  619. that.zidongdoorVersion = modulesList[i].coding.substring(8, 10);
  620. }
  621. //手动门
  622. if (coding.substring(5, 7) == '12') {
  623. that.shoudongdoorName = modulesList[i].name;
  624. that.shoudongdoorCoding = modulesList[i].coding;
  625. that.shoudongdoorVersion = modulesList[i].coding.substring(8, 10);
  626. }
  627. //机械手
  628. if (coding.substring(5, 7) == '02') {
  629. that.jixieshouName = modulesList[i].name;
  630. that.jixieshouCoding = modulesList[i].coding;
  631. that.jixieshouVersion = modulesList[i].coding.substring(8, 10);
  632. }
  633. //压型刀
  634. if (coding.substring(5, 7) == '03') {
  635. that.yaxingdaoName = modulesList[i].name;
  636. that.yaxingdaoCoding = modulesList[i].coding;
  637. that.yaxingdaoVersion = modulesList[i].coding.substring(8, 10);
  638. }
  639. //送糖
  640. if (coding.substring(5, 7) == '05') {
  641. that.songtangName = modulesList[i].name;
  642. that.songtangCoding = modulesList[i].coding;
  643. that.songtangVersion = modulesList[i].coding.substring(8, 10);
  644. }
  645. }
  646. }else{
  647. //气泵
  648. if (coding.substring(8, 10) == '39') {
  649. that.qibengName = modulesList[i].name;
  650. that.qibengCoding = modulesList[i].coding.substring(0, 10);
  651. that.qibengVersion = modulesList[i].coding.substring(8, 10);
  652. }
  653. //安卓屏
  654. if (coding.substring(8, 10) == '71'||coding.substring(8, 10) == '72') {
  655. that.anzhuopingName = modulesList[i].name;
  656. that.anzhuopingCoding = modulesList[i].coding.substring(0, 10);
  657. that.anzhuopingVersion = modulesList[i].coding.substring(8, 10);
  658. }
  659. }
  660. }
  661. } else {
  662. var codes = res.data.data;
  663. that.name = codes.name;
  664. that.nameplate = codes.nameplate;
  665. that.producePersonnel = uni.getStorageSync("name");
  666. }
  667. } else {
  668. uni.showModal({
  669. title: '提示',
  670. content: res.data.message,
  671. });
  672. }
  673. }
  674. });
  675. },
  676. getMessage(coding) {
  677. var that = this;
  678. var serverUrl = that.serverurl;
  679. var token = uni.getStorageSync("token");
  680. uni.request({
  681. url: serverUrl + "/TModules/getMessage?coding=" + coding,
  682. method: "GET",
  683. header: {
  684. 'token': token
  685. },
  686. success: (Result) => {
  687. console.log("1");
  688. var res = Result;
  689. if (res.data.code == true) {
  690. var codes = res.data.data;
  691. var coding = codes.code;
  692. //排除标准件
  693. if (coding.substring(0, 4) != '1000') {
  694. //半成品
  695. if (coding.substring(0, 2) == '15') {
  696. //"加湿器"
  697. if (coding.substring(5, 7) == '07') {
  698. that.lutouName = codes.name;
  699. that.jiashiqiName = codes.name;
  700. that.jiashiqiCoding = codes.coding;
  701. that.jiashiqiVersion = codes.code.substring(8, 10);
  702. }
  703. //炉头
  704. if (coding.substring(5, 7) == '04') {
  705. that.lutouName = codes.name;
  706. that.lutouCoding = codes.coding;
  707. that.lutouVersion = codes.code.substring(8, 10);
  708. }
  709. //水泵
  710. if (coding.substring(5, 7) == '08') {
  711. that.shuibengName = codes.name;
  712. that.shuibengCoding = codes.coding;
  713. that.shuibengVersion = codes.code.substring(8, 10);
  714. }
  715. //出棍模块
  716. if (coding.substring(5, 7) == '06') {
  717. that.chugunName = codes.name;
  718. that.chugunCoding = codes.coding;
  719. that.chugunVersion = codes.code.substring(8, 10);
  720. }
  721. //电柜模块
  722. if (coding.substring(5, 7) == '01') {
  723. that.dianguiName = codes.name;
  724. that.dianguiCoding = codes.coding;
  725. that.dianguiVersion = codes.code.substring(8, 10);
  726. }
  727. //机壳
  728. if (coding.substring(5, 7) == '09') {
  729. that.jikeName = codes.name;
  730. that.jikeCoding = codes.coding;
  731. that.jikeVersion = codes.code.substring(8, 10);
  732. }
  733. //自动门
  734. if (coding.substring(5, 7) == '11') {
  735. that.zidongdoorName = codes.name;
  736. that.zidongdoorCoding = codes.coding;
  737. that.zidongdoorVersion = codes.code.substring(8, 10);
  738. }
  739. //手动门
  740. if (coding.substring(5, 7) == '12') {
  741. that.shoudongdoorName = codes.name;
  742. that.shoudongdoorCoding = codes.coding;
  743. that.shoudongdoorVersion = codes.code.substring(8, 10);
  744. }
  745. //机械手
  746. if (coding.substring(5, 7) == '02') {
  747. that.jixieshouName = codes.name;
  748. that.jixieshouCoding = codes.coding;
  749. that.jixieshouVersion = codes.code.substring(8, 10);
  750. }
  751. //压型刀
  752. if (coding.substring(5, 7) == '03') {
  753. that.yaxingdaoName = codes.name;
  754. that.yaxingdaoCoding = codes.coding;
  755. that.yaxingdaoVersion = codes.code.substring(8, 10);
  756. }
  757. //送糖
  758. if (coding.substring(5, 7) == '05') {
  759. that.songtangName = codes.name;
  760. that.songtangCoding = codes.coding;
  761. that.songtangVersion = codes.code.substring(8, 10);
  762. }
  763. }
  764. }else{
  765. //安卓屏
  766. if (coding.substring(8, 10) == '71'||coding.substring(8, 10) == '72') {
  767. debugger;
  768. that.anzhuopingName = codes.name;
  769. that.anzhuopingCoding = codes.coding;
  770. that.anzhuopingVersion = codes.versions;
  771. }
  772. //气泵
  773. if (coding.substring(8, 10) == '39') {
  774. that.qibengName = codes.name;
  775. that.qibengCoding = codes.coding;
  776. that.qibengVersion = codes.versions;
  777. }
  778. }
  779. } else {
  780. uni.showModal({
  781. title: '提示',
  782. content: res.data.message,
  783. });
  784. }
  785. }
  786. });
  787. },
  788. //机器修改
  789. addMachine(event) {
  790. var serverUrl = this.serverurl;
  791. const {
  792. value: modules
  793. } = event.detail;
  794. // console.log("3");
  795. var token = uni.getStorageSync("token");
  796. var createPersonnel = uni.getStorageSync("name");
  797. uni.request({
  798. url: serverUrl + "/TMachine/add",
  799. method: "POST",
  800. data: {
  801. "coding": modules.coding,
  802. "name": modules.name,
  803. "nameplate": modules.nameplate,
  804. "createPersonnel": createPersonnel
  805. },
  806. header: {
  807. 'token': token
  808. },
  809. success: (Result) => {
  810. var res = Result;
  811. uni.showModal({
  812. title: '提示',
  813. content: res.data.message,
  814. });
  815. }
  816. });
  817. },
  818. lutou(event) {
  819. var serverUrl = this.serverurl;
  820. var machineCoding = this.coding;
  821. const {
  822. value: modules
  823. } = event.detail;
  824. console.log(event.detail.value);
  825. var token = uni.getStorageSync("token");
  826. var createPersonnel = uni.getStorageSync("name");
  827. uni.request({
  828. url: serverUrl + "/TModules/update",
  829. method: "POST",
  830. data: {
  831. "machineCoding": machineCoding,
  832. "coding": modules.lutouCoding,
  833. "name": modules.lutouName,
  834. "installPersonnel": createPersonnel
  835. },
  836. header: {
  837. 'token': token
  838. },
  839. success: (Result) => {
  840. var res = Result;
  841. if (res.data.code == true) {
  842. }
  843. uni.showModal({
  844. title: '提示',
  845. content: res.data.message,
  846. });
  847. }
  848. });
  849. },
  850. objToStrMap(obj) {
  851. let strMap = new Map();
  852. for (let k of Object.keys(obj)) {
  853. strMap.set(k, obj[k]);
  854. }
  855. return strMap;
  856. },
  857. jiashiqi(event) {
  858. this.tijiao(event,"jiashiqi");
  859. },
  860. shuibeng(event) {
  861. this.tijiao(event,"shuibeng");
  862. },
  863. chugun(event){
  864. this.tijiao(event,"chugun");
  865. },
  866. diangui(event){
  867. this.tijiao(event,"diangui");
  868. },
  869. zidongdoor(event){
  870. this.tijiao(event,"zidongdoor");
  871. },
  872. shoudongdoor(event){
  873. this.tijiao(event,"shoudongdoor");
  874. },
  875. jixieshou(event){
  876. this.tijiao(event,"jixieshou");
  877. },
  878. yaxingdao(event){
  879. this.tijiao(event,"yaxingdao");
  880. },
  881. qibeng(event){
  882. this.tijiao(event,"qibeng");
  883. },
  884. songtang(event){
  885. this.tijiao(event,"songtang");
  886. },
  887. anzhuoping(event){
  888. this.tijiao(event,"anzhuoping");
  889. },
  890. jike(event){
  891. this.tijiao(event,"jike");
  892. },
  893. tijiao(event,sname){
  894. var serverUrl = this.serverurl;
  895. var machineCoding = this.coding;
  896. const {
  897. value: modules
  898. } = event.detail;
  899. var eValue = event.detail.value;
  900. //将value对象转为map
  901. var mapValue = this.objToStrMap(eValue);
  902. var coding = mapValue.get(sname+"Coding");
  903. var name = mapValue.get(sname+"Name");
  904. console.log(coding+"---"+name);
  905. var token = uni.getStorageSync("token");
  906. var createPersonnel = uni.getStorageSync("name");
  907. uni.request({
  908. url: serverUrl + "/TModules/update",
  909. method: "POST",
  910. data: {
  911. "machineCoding": machineCoding,
  912. "coding": coding,
  913. "name": name,
  914. "installPersonnel": createPersonnel
  915. },
  916. header: {
  917. 'token': token
  918. },
  919. success: (Result) => {
  920. var res = Result;
  921. if (res.data.code == true) {
  922. }
  923. uni.showModal({
  924. title: '提示',
  925. content: res.data.message,
  926. });
  927. }
  928. });
  929. },
  930. updateModules(code, name) {
  931. var that = this;
  932. uni.setStorageSync("updateModules", code);
  933. uni.setStorageSync("updateMachineCode", that.coding);
  934. uni.showModal({
  935. title: '提示',
  936. content: '是否要更换?',
  937. success: function(res) {
  938. if (res.confirm) {
  939. uni.navigateTo({
  940. url: 'updateModules',
  941. });
  942. if (name == "lutou") {
  943. that.lutouName = null;
  944. that.lutouCoding = null;
  945. that.lutouVersion = null;
  946. }
  947. if (name == "jiashiqi") {
  948. that.jiashiqiName = null;
  949. that.jiashiqiCoding = null;
  950. that.jiashiqiVersion = null;
  951. }
  952. if (name == "shuibeng") {
  953. that.shuibengName = null;
  954. that.shuibengCoding = null;
  955. that.shuibengVersion = null;
  956. }
  957. if (name == "chugun") {
  958. that.chugunName = null;
  959. that.chugunCoding = null;
  960. that.chugunVersion = null;
  961. }
  962. if (name == "diangui") {
  963. that.dianguiName = null;
  964. that.dianguiCoding = null;
  965. that.dianguiVersion = null;
  966. }
  967. if (name == "zidongdoor") {
  968. that.zidongdoorName = null;
  969. that.zidongdoorCoding = null;
  970. that.zidongdoorVersion = null;
  971. }
  972. if (name == "shoudongdoor") {
  973. that.shoudongdoorName = null;
  974. that.shoudongdoorCoding = null;
  975. that.shoudongdoorVersion = null;
  976. }
  977. if (name == "jixieshou") {
  978. that.jixieshouName = null;
  979. that.jixieshouCoding = null;
  980. that.jixieshouVersion = null;
  981. }
  982. if (name == "yaxingdao") {
  983. that.yaxingdaoName = null;
  984. that.yaxingdaoCoding = null;
  985. that.yaxingdaoVersion = null;
  986. }
  987. if (name == "qibeng") {
  988. that.qibengName = null;
  989. that.qibengCoding = null;
  990. that.qibengVersion = null;
  991. }
  992. if (name == "songtang") {
  993. that.songtangName = null;
  994. that.songtangCoding = null;
  995. that.songtangVersion = null;
  996. }
  997. if (name == "anzhuoping") {
  998. that.anzhuopingName = null;
  999. that.anzhuopingCoding = null;
  1000. that.anzhuopingVersion = null;
  1001. }
  1002. if (name == "jike") {
  1003. that.jikeName = null;
  1004. that.jikeCoding = null;
  1005. that.jikeVersion = null;
  1006. }
  1007. } else if (res.cancel) {}
  1008. }
  1009. });
  1010. },
  1011. submit(event){
  1012. var serverUrl = this.serverurl;
  1013. var machineCoding = this.coding;
  1014. console.log("3");
  1015. const {
  1016. value: modules
  1017. } = event.detail;
  1018. var token = uni.getStorageSync("token");
  1019. var createPersonnel = uni.getStorageSync("name");
  1020. uni.request({
  1021. url: serverUrl + "/TMachine/submit",
  1022. method: "POST",
  1023. data: {
  1024. "coding": machineCoding,
  1025. checkPersonnel:createPersonnel
  1026. },
  1027. header: {
  1028. 'token': token
  1029. },
  1030. success: (Result) => {
  1031. var res = Result;
  1032. if (res.data.code == true) {
  1033. }
  1034. uni.showModal({
  1035. title: '提示',
  1036. content: res.data.message,
  1037. });
  1038. }
  1039. });
  1040. }
  1041. }
  1042. }
  1043. </script>
  1044. <style>
  1045. .body {
  1046. background-color: #FFFFFF;
  1047. padding: 20upx 20upx 20upx 20upx;
  1048. display: flex;
  1049. flex-direction: row;
  1050. justify-content: flex-start;
  1051. }
  1052. .bodyname {
  1053. background-color: #FFFFFF;
  1054. padding: 20upx 20upx 20upx 70upx;
  1055. display: flex;
  1056. flex-direction: row;
  1057. justify-content: flex-start;
  1058. }
  1059. .input {
  1060. /* padding: 10upx 20upx 10upx 0upx; */
  1061. padding-left: 20upx;
  1062. padding-top: 10upx;
  1063. background-color: #FFFFFF;
  1064. width: 400upx;
  1065. height: 50upx;
  1066. box-shadow: 0upx 0upx 20upx #D3D3D3;
  1067. border-radius: 5upx;
  1068. }
  1069. .button {
  1070. margin: auto;
  1071. width: 60%;
  1072. height: 100upx;
  1073. }
  1074. .button1 {
  1075. margin: auto;
  1076. width: 75upx;
  1077. height: 50upx;
  1078. }
  1079. .p {
  1080. /* #ifdef H5 */
  1081. top: -13%;
  1082. /* #endif */
  1083. width: 50upx;
  1084. height: 30upx;
  1085. font-size: 25upx;
  1086. padding-right: 9upx;
  1087. padding-top: 6upx;
  1088. /* #ifndef H5 */
  1089. /* padding-top: 10upx; */
  1090. /* #endif */
  1091. position: absolute;
  1092. /* 水平居中 */
  1093. left: 50%;
  1094. -webkit-transform: translateX(-50%);
  1095. transform: translateX(-50%);
  1096. }
  1097. .p1 {
  1098. /* #ifdef H5 */
  1099. top: -13%;
  1100. /* #endif */
  1101. width: 80upx;
  1102. height: 60upx;
  1103. font-size: 40upx;
  1104. padding-top: 6upx;
  1105. /* #ifndef H5 */
  1106. padding-top: 10upx;
  1107. /* #endif */
  1108. position: absolute;
  1109. /* 水平居中 */
  1110. left: 50%;
  1111. -webkit-transform: translateX(-50%);
  1112. transform: translateX(-50%);
  1113. }
  1114. .radio {
  1115. padding-top: 20upx;
  1116. padding-left: 30upx;
  1117. }
  1118. .line {
  1119. background: #ECECEC;
  1120. height: 10upx;
  1121. }
  1122. .title {
  1123. font-size: 35upx;
  1124. }
  1125. .modulesButton {
  1126. background-color: #FFFFFF;
  1127. padding: 20upx 20upx 20upx 20upx;
  1128. display: flex;
  1129. width: 250upx;
  1130. margin: auto;
  1131. flex-direction: row;
  1132. justify-content: flex-start;
  1133. }
  1134. .modules {
  1135. width: 95%;
  1136. margin: auto;
  1137. }
  1138. </style>