selectModules.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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. 所属机器编码:{{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. <view class="" v-if="installPersonnel!=''&&installPersonnel!=null">
  32. <t-tr class="tr">
  33. 装配人员:{{installPersonnel}}
  34. </t-tr>
  35. <t-tr class="tr">
  36. 装配日期:{{installDate}}
  37. </t-tr>
  38. </view>
  39. <view class="" v-if="replacePersonnel!=''&&replacePersonnel!=null">
  40. <t-tr class="tr">
  41. 更换人员:{{replacePersonnel}}
  42. </t-tr>
  43. <t-tr class="tr">
  44. 更换原因:{{replaceReason}}
  45. </t-tr>
  46. <t-tr class="tr">
  47. 原模板编号:{{oldCoding}}
  48. </t-tr>
  49. <t-tr class="tr">
  50. 更换日期:{{replateDate}}
  51. </t-tr>
  52. </view>
  53. <t-tr class="tr">
  54. 状态:{{status}}
  55. </t-tr>
  56. </t-table>
  57. </view>
  58. <view class="title">配件</view>
  59. <!-- <view class="lis" v-for="item in desList">
  60. {{item}}
  61. </view> -->
  62. <view class="lis" v-for="(item,index) in desList" :key="index">
  63. {{item}}
  64. </view>
  65. </form>
  66. </view>
  67. </template>
  68. <script>
  69. import {
  70. mapState,
  71. mapActions,
  72. mapMutations
  73. } from 'vuex';
  74. import timeSelector from '@/components/wing-time-selector/wing-time-selector.vue';
  75. export default {
  76. components: {
  77. timeSelector
  78. },
  79. data() {
  80. return {
  81. oldCoding: '',
  82. replateDate: '',
  83. replaceReason: '',
  84. replacePersonnel: '',
  85. installDate: '',
  86. installPersonnel: '',
  87. produceDate: '',
  88. coding: '',
  89. name: '',
  90. versions: '',
  91. producePersonnel: '',
  92. machineCoding: '',
  93. status: '',
  94. desList: {}
  95. }
  96. },
  97. onShow() {
  98. var token = uni.getStorageSync("token");
  99. if (token.length > 2) {
  100. var coding = uni.getStorageSync("selectCoding");
  101. if (coding.length > 2) {
  102. this.coding = coding;
  103. this.getMessage(coding);
  104. }
  105. }
  106. },
  107. methods: {
  108. saoma() {
  109. var that = this;
  110. // 允许从相机和相册扫码
  111. uni.scanCode({
  112. success(res) {
  113. that.coding = res.result;
  114. }
  115. });
  116. },
  117. getMessage(coding) {
  118. var that = this;
  119. var serverUrl = that.serverurl;
  120. var token = uni.getStorageSync("token");
  121. uni.request({
  122. url: serverUrl + "/TModules/getModules?coding=" + coding,
  123. method: "GET",
  124. header: {
  125. 'token': token
  126. },
  127. success: (Result) => {
  128. console.log("1");
  129. var res = Result;
  130. if (res.data.code == true) {
  131. var codes = res.data.data;
  132. that.name = codes.name;
  133. var co = codes.coding;
  134. if (co.substring(0, 4) != '1000') {
  135. that.versions = co.substring(8, 10);
  136. that.producePersonnel = codes.producePersonnel;
  137. that.produceDate = codes.createDate;
  138. var sta = codes.status;
  139. if (sta == '0') {
  140. that.status = "未安装";
  141. }
  142. if (sta == '1') {
  143. that.status = "已安装";
  144. }
  145. if (sta == '2') {
  146. that.status = "已替换";
  147. }
  148. that.machineCoding = codes.machineCoding;
  149. } else {
  150. that.versions = co.substring(co.length - 3, co.length);
  151. that.producePersonnel = "";
  152. that.produceDate = "";
  153. that.status = "";
  154. that.machineCoding = "";
  155. }
  156. if(codes.flagCode.length>1){
  157. that.desList = codes.flagCode.split(",");
  158. }
  159. that.installDate = codes.installDate;
  160. that.installPersonnel = codes.installPersonnel;
  161. that.replateDate = codes.replateDate;
  162. that.replaceReason = codes.replaceReason;
  163. that.replacePersonnel = codes.replacePersonnel;
  164. if (co.substring(0, 4) != '1000') {
  165. that.oldCoding = "";
  166. }else{
  167. that.oldCoding = "";
  168. }
  169. } else {
  170. uni.showModal({
  171. content: res.data.message,
  172. });
  173. }
  174. }
  175. });
  176. }
  177. }
  178. }
  179. </script>
  180. <style>
  181. .body {
  182. background-color: #FFFFFF;
  183. padding: 20upx 20upx 20upx 20upx;
  184. font-size: 30upx;
  185. display: flex;
  186. flex-direction: row;
  187. justify-content: flex-start;
  188. }
  189. .tr {
  190. padding-left: 30upx;
  191. padding-top: 13upx;
  192. font-size: 30upx;
  193. padding-bottom: 13upx;
  194. }
  195. .input {
  196. /* padding: 10upx 20upx 10upx 0upx; */
  197. padding-left: 20upx;
  198. padding-top: 10upx;
  199. background-color: #FFFFFF;
  200. width: 400upx;
  201. height: 50upx;
  202. box-shadow: 0upx 0upx 20upx #D3D3D3;
  203. border-radius: 5upx;
  204. }
  205. .button {
  206. margin: auto;
  207. width: 60%;
  208. height: 100upx;
  209. }
  210. .button1 {
  211. margin: auto;
  212. width: 75upx;
  213. height: 50upx;
  214. }
  215. .p {
  216. /* #ifdef H5 */
  217. top: -13%;
  218. /* #endif */
  219. width: 50upx;
  220. height: 30upx;
  221. font-size: 25upx;
  222. padding-right: 9upx;
  223. padding-top: 6upx;
  224. /* #ifndef H5 */
  225. /* padding-top: 10upx; */
  226. /* #endif */
  227. position: absolute;
  228. /* 水平居中 */
  229. left: 50%;
  230. -webkit-transform: translateX(-50%);
  231. transform: translateX(-50%);
  232. }
  233. .p1 {
  234. /* #ifdef H5 */
  235. top: -13%;
  236. /* #endif */
  237. width: 80upx;
  238. height: 60upx;
  239. font-size: 40upx;
  240. padding-top: 6upx;
  241. /* #ifndef H5 */
  242. padding-top: 10upx;
  243. /* #endif */
  244. position: absolute;
  245. /* 水平居中 */
  246. left: 50%;
  247. -webkit-transform: translateX(-50%);
  248. transform: translateX(-50%);
  249. }
  250. .radio {
  251. padding-top: 20upx;
  252. padding-left: 30upx;
  253. }
  254. .lis {
  255. padding-left: 90upx;
  256. font-size: 30upx;
  257. padding-top: 5upx;
  258. }
  259. .title {
  260. padding-left: 20upx;
  261. font-size: 35upx;
  262. }
  263. </style>