selectModules.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <template>
  2. <view>
  3. <form @submit="add">
  4. <view class="body">
  5. <input class="input" style="display:none;" name="coding" :value=coding />
  6. 编码:<input class="input" v-model="coding" />
  7. <button type="primary" @click="saoma()" class="button1">
  8. <p class="p">扫码</p>
  9. </button>
  10. <button type="primary" @click="getMessage(coding)" class="button1">
  11. <p class="p">获取</p>
  12. </button>
  13. </view>
  14. <view class="">
  15. <t-table>
  16. <t-tr class="tr">
  17. 名称:{{name}}
  18. </t-tr>
  19. <t-tr class="tr">
  20. 所属机器编码:<input class="input" v-model="machineCoding" />
  21. </t-tr>
  22. <t-tr class="tr">
  23. 版本号:{{versions}}
  24. </t-tr>
  25. <t-tr class="tr">
  26. 生产人员:{{producePersonnel}}
  27. </t-tr>
  28. <t-tr class="tr">
  29. 生产日期:{{produceDate}}
  30. </t-tr>
  31. <t-tr class="tr">
  32. 出货日期:{{shipmentDate}}
  33. <button v-show="shipmentDate==''" type="primary" @click="chuhuo(coding)"
  34. class="button1">
  35. <p class="p">出货</p>
  36. </button>
  37. </t-tr>
  38. <view class="" v-if="installPersonnel!=''&&installPersonnel!=null">
  39. <t-tr class="tr">
  40. 装配人员:{{installPersonnel}}
  41. </t-tr>
  42. <t-tr class="tr">
  43. 装配日期:{{installDate}}
  44. </t-tr>
  45. </view>
  46. <view class="" v-if="replateDate!=''&&replateDate!=null">
  47. <!-- <view class="" v-if="replacePersonnel!=''&&replacePersonnel!=null"> -->
  48. <t-tr class="tr">
  49. 本模块更换人员:{{replacePersonnel}}
  50. </t-tr>
  51. <t-tr class="tr">
  52. 本模块更换原因:<input class="input" v-model="replaceReason" />
  53. <button type="primary" @click="updateReplaceReason()" class="button1">
  54. <p class="p">更正</p>
  55. </button>
  56. </t-tr>
  57. <t-tr class="tr">
  58. 本模块更换日期:{{replateDate}}
  59. </t-tr>
  60. </view>
  61. <view class="" v-if="oldReplateDate!=''&&oldReplateDate!=null">
  62. <!-- <view class="" v-if="replacePersonnel!=''&&replacePersonnel!=null"> -->
  63. <t-tr class="tr">
  64. 旧模块更换人员:{{oldReplacePersonnel}}
  65. </t-tr>
  66. <t-tr class="tr">
  67. 旧模块更换原因:{{oldReplaceReason}}
  68. </t-tr>
  69. <t-tr class="tr" v-if="oldCoding!=null">
  70. 旧模块编号:{{oldCoding}}
  71. </t-tr>
  72. <t-tr class="tr">
  73. 旧模块更换日期:{{oldReplateDate}}
  74. </t-tr>
  75. </view>
  76. <t-tr class="tr">
  77. 状态:{{status}}
  78. </t-tr>
  79. <t-tr class="ttr">
  80. 操作:
  81. <button v-show="status!=''" type="primary" @click="change(coding,machineCoding)"
  82. class="button1">
  83. <p class="p">更换</p>
  84. </button>
  85. <button v-if="level>2" type="primary" @click="del(coding)" class="button1">
  86. <p class="p">删除</p>
  87. </button>
  88. </t-tr>
  89. </t-table>
  90. </view>
  91. <view class="title">配件</view>
  92. <!-- <view class="lis" v-for="item in desList">
  93. {{item}}
  94. </view> -->
  95. <view class="lis" v-for="(item,index) in desList" :key="index">
  96. {{item}}
  97. </view>
  98. </form>
  99. </view>
  100. </template>
  101. <script>
  102. import {
  103. mapState,
  104. mapActions,
  105. mapMutations
  106. } from 'vuex';
  107. import timeSelector from '@/components/wing-time-selector/wing-time-selector.vue';
  108. export default {
  109. components: {
  110. timeSelector
  111. },
  112. data() {
  113. return {
  114. oldCoding: '',
  115. replateDate: '',
  116. replaceReason: '',
  117. replacePersonnel: '',
  118. shipmentDate:'',
  119. oldReplateDate: '',
  120. oldReplaceReason: '',
  121. oldReplacePersonnel: '',
  122. installDate: '',
  123. installPersonnel: '',
  124. produceDate: '',
  125. coding: '',
  126. name: '',
  127. versions: '',
  128. producePersonnel: '',
  129. machineCoding: '',
  130. status: '',
  131. level: 0,
  132. desList: {}
  133. }
  134. },
  135. onShow() {
  136. var token = uni.getStorageSync("token");
  137. if (token.length > 2) {
  138. var coding = uni.getStorageSync("selectCoding");
  139. if (coding.length > 2) {
  140. this.coding = coding;
  141. this.getMessage(coding);
  142. }
  143. }
  144. var level = uni.getStorageSync("level");
  145. this.level = level;
  146. },
  147. methods: {
  148. saoma() {
  149. var that = this;
  150. // 允许从相机和相册扫码
  151. uni.scanCode({
  152. success(res) {
  153. that.coding = res.result;
  154. }
  155. });
  156. },
  157. del(coding) {
  158. uni.showModal({
  159. title: '删除',
  160. content: '确定执行操作?',
  161. success: (res) => {
  162. if (res.confirm) {
  163. var that = this;
  164. var serverUrl = that.serverurl;
  165. var token = uni.getStorageSync("token");
  166. uni.request({
  167. url: serverUrl + "/TModules/deleteModules?coding=" + coding,
  168. method: "GET",
  169. header: {
  170. 'token': token
  171. },
  172. success: (Result) => {
  173. // console.log(Result);
  174. var res = Result;
  175. uni.showModal({
  176. title: '提示',
  177. content: res.data.message,
  178. });
  179. }
  180. });
  181. }
  182. }
  183. });
  184. },
  185. chuhuo(coding){
  186. uni.showModal({
  187. title: '出货',
  188. content: '确定执行操作?',
  189. success: (res) => {
  190. if (res.confirm) {
  191. var that = this;
  192. var serverUrl = that.serverurl;
  193. var token = uni.getStorageSync("token");
  194. uni.request({
  195. url: serverUrl + "/TModules/chuhuo?coding=" + coding,
  196. method: "GET",
  197. header: {
  198. 'token': token
  199. },
  200. success: (Result) => {
  201. // console.log(Result);
  202. var res = Result;
  203. uni.showModal({
  204. title: '提示',
  205. content: res.data.message,
  206. });
  207. }
  208. });
  209. }
  210. }
  211. });
  212. },
  213. updateReplaceReason(){
  214. var that = this;
  215. var serverUrl = that.serverurl;
  216. var token = uni.getStorageSync("token");
  217. uni.request({
  218. url: serverUrl + "/TModules/updateReplaceReason",
  219. method: "POST",
  220. header: {
  221. 'token': token
  222. },
  223. data:{
  224. "coding":that.coding,
  225. "replaceReason":that.replaceReason
  226. },
  227. success: (Result) => {
  228. // console.log(Result);
  229. var res = Result;
  230. uni.showModal({
  231. title: '提示',
  232. content: res.data.message,
  233. });
  234. }
  235. });
  236. },
  237. change(coding, machineCoding) {
  238. uni.navigateTo({
  239. url: '/pages/select/update?coding=' + coding + '&machineCoding=' + machineCoding,
  240. });
  241. },
  242. getMessage(coding) {
  243. var that = this;
  244. var serverUrl = that.serverurl;
  245. var token = uni.getStorageSync("token");
  246. uni.request({
  247. url: serverUrl + "/TModules/getModules?coding=" + coding,
  248. method: "GET",
  249. header: {
  250. 'token': token
  251. },
  252. success: (Result) => {
  253. console.log("1");
  254. var res = Result;
  255. if (res.data.code == true) {
  256. var codes = res.data.data;
  257. that.name = codes.name;
  258. var co = codes.coding;
  259. if (co.substring(0, 4) != '1000') {
  260. that.versions = co.substring(8, 10);
  261. that.producePersonnel = codes.producePersonnel;
  262. that.produceDate = codes.createDate;
  263. var sta = codes.status;
  264. if (sta == '0') {
  265. that.status = "未安装";
  266. }
  267. if (sta == '1') {
  268. that.status = "已安装";
  269. }
  270. if (sta == '2') {
  271. that.status = "已替换";
  272. }
  273. that.machineCoding = codes.machineCoding;
  274. } else {
  275. that.versions = co.substring(co.length - 3, co.length);
  276. // that.producePersonnel = "";
  277. // that.produceDate = "";
  278. var sta = codes.status;
  279. if (sta == '0') {
  280. that.status = "未安装";
  281. }
  282. if (sta == '1') {
  283. that.status = "已安装";
  284. }
  285. if (sta == '2') {
  286. that.status = "已替换";
  287. }
  288. that.producePersonnel = codes.producePersonnel;
  289. that.produceDate = codes.createDate;
  290. if (codes.machineCoding != null) {
  291. that.machineCoding = codes.machineCoding;
  292. }
  293. }
  294. if (codes.flagCode.length > 1) {
  295. that.desList = codes.flagCode.split(",");
  296. }
  297. if (codes.shipmentDate != null) {
  298. that.shipmentDate = codes.shipmentDate;
  299. }
  300. that.installDate = codes.installDate;
  301. that.installPersonnel = codes.installPersonnel;
  302. that.replateDate = codes.replateDate;
  303. that.replaceReason = codes.replaceReason;
  304. that.replacePersonnel = codes.replacePersonnel;
  305. that.oldCoding = codes.oldCoding;
  306. that.oldReplateDate = codes.oldReplateDate;
  307. that.oldReplaceReason = codes.oldReplaceReason;
  308. that.oldReplacePersonnel = codes.oldReplacePersonnel;
  309. // if (co.substring(0, 4) != '1000') {
  310. // that.oldCoding = codes.oldCoding;
  311. // } else {
  312. // that.oldCoding = '';
  313. // }
  314. } else {
  315. uni.showModal({
  316. content: res.data.message,
  317. });
  318. }
  319. }
  320. });
  321. }
  322. }
  323. }
  324. </script>
  325. <style>
  326. .body {
  327. background-color: #FFFFFF;
  328. padding: 20upx 20upx 20upx 20upx;
  329. font-size: 30upx;
  330. display: flex;
  331. flex-direction: row;
  332. justify-content: flex-start;
  333. }
  334. .ttr {
  335. padding-left: 30upx;
  336. padding-top: 13upx;
  337. font-size: 30upx;
  338. padding-bottom: 13upx;
  339. display: flex;
  340. flex-direction: row;
  341. justify-content: flex-start;
  342. }
  343. .tr {
  344. padding-left: 30upx;
  345. padding-top: 13upx;
  346. font-size: 30upx;
  347. padding-bottom: 13upx;
  348. }
  349. .input {
  350. /* padding: 10upx 20upx 10upx 0upx; */
  351. padding-left: 20upx;
  352. padding-top: 10upx;
  353. background-color: #FFFFFF;
  354. width: 400upx;
  355. height: 50upx;
  356. box-shadow: 0upx 0upx 20upx #D3D3D3;
  357. border-radius: 5upx;
  358. }
  359. .button {
  360. margin: auto;
  361. width: 60%;
  362. height: 100upx;
  363. }
  364. .button1 {
  365. margin: auto;
  366. width: 75upx;
  367. height: 50upx;
  368. }
  369. .p {
  370. /* #ifdef H5 */
  371. top: -13%;
  372. /* #endif */
  373. width: 50upx;
  374. height: 30upx;
  375. font-size: 25upx;
  376. padding-right: 9upx;
  377. padding-top: 6upx;
  378. /* #ifndef H5 */
  379. /* padding-top: 10upx; */
  380. /* #endif */
  381. position: absolute;
  382. /* 水平居中 */
  383. left: 50%;
  384. -webkit-transform: translateX(-50%);
  385. transform: translateX(-50%);
  386. }
  387. .p1 {
  388. /* #ifdef H5 */
  389. top: -13%;
  390. /* #endif */
  391. width: 80upx;
  392. height: 60upx;
  393. font-size: 40upx;
  394. padding-top: 6upx;
  395. /* #ifndef H5 */
  396. padding-top: 10upx;
  397. /* #endif */
  398. position: absolute;
  399. /* 水平居中 */
  400. left: 50%;
  401. -webkit-transform: translateX(-50%);
  402. transform: translateX(-50%);
  403. }
  404. .radio {
  405. padding-top: 20upx;
  406. padding-left: 30upx;
  407. }
  408. .lis {
  409. padding-left: 90upx;
  410. font-size: 30upx;
  411. padding-top: 5upx;
  412. }
  413. .title {
  414. padding-left: 20upx;
  415. font-size: 35upx;
  416. }
  417. </style>