selectModules.vue 10 KB

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