selectMachine.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <view>
  3. <view class="body">
  4. <input class="input" style="display:none;" name="code" :value=code />
  5. 编码:<input class="input" v-model="code" />
  6. <button type="primary" @click="saoma()" class="button1">
  7. <p class="p">扫码</p>
  8. </button>
  9. <button type="primary" @click="getMessage(code)" class="button1">
  10. <p class="p">获取</p>
  11. </button>
  12. </view>
  13. <view class="">
  14. <t-table>
  15. <t-tr class="tr">
  16. 机器编码:<input class="input" v-model="coding" />
  17. </t-tr>
  18. <t-tr class="tr">
  19. 机器铭牌:{{nameplate}}
  20. </t-tr>
  21. <t-tr class="tr">
  22. 设备编码:{{clientId}}
  23. </t-tr>
  24. <t-tr class="tr">
  25. 订单编码:{{orderNo}}
  26. </t-tr>
  27. <t-tr class="tr">
  28. 客户编码:{{customerNo}}
  29. </t-tr>
  30. <t-tr class="tr">
  31. 机器名称:{{name}}
  32. </t-tr>
  33. <t-tr class="tr">
  34. 总装开始时间:{{startDate}}
  35. </t-tr>
  36. <t-tr class="tr">
  37. 工序状态:{{weiname}}
  38. </t-tr>
  39. <t-tr class="tr">
  40. 模块状态:{{Modulesname}}
  41. </t-tr>
  42. <t-tr class="tr">
  43. 总装结束时间:{{endDate}}
  44. </t-tr>
  45. </t-table>
  46. </view>
  47. <view class="line"></view>
  48. <view class="">
  49. <uni-list-item title="工序查询" @click="gongxu()" />
  50. </view>
  51. <view class="line"></view>
  52. <view class="line"></view>
  53. <view class="">
  54. <view v-for="(item,index) in modulesList" :key="index">
  55. <t-table class="table">
  56. <t-tr class="tr table">
  57. 名称:{{item.name}}
  58. </t-tr>
  59. <t-tr class="tr">
  60. <t-td>编码:{{item.coding}}</t-td>
  61. <t-td class="td">
  62. <button type="primary" @click="tran(item.coding)" class="button1">
  63. <p class="p">详情</p>
  64. </button>
  65. </t-td>
  66. </t-tr>
  67. </t-table>
  68. <view class="line"></view>
  69. </view>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. import {
  75. mapState,
  76. mapActions,
  77. mapMutations
  78. } from 'vuex';
  79. export default {
  80. data() {
  81. return {
  82. code: '',
  83. coding: '',
  84. nameplate: '',
  85. name: '',
  86. startDate: '',
  87. clientId: '',
  88. customerNo: '',
  89. orderNo: '',
  90. endDate: '',
  91. modulesList: [],
  92. Modulesname:'',
  93. weiname:''
  94. }
  95. },
  96. onShow() {
  97. },
  98. onLoad: function(option) {
  99. const item = JSON.parse(decodeURIComponent(option.item));
  100. var coding = item.coding;
  101. this.getMessage(coding);
  102. },
  103. methods: {
  104. saoma() {
  105. var that = this;
  106. // 允许从相机和相册扫码
  107. uni.scanCode({
  108. success(res) {
  109. that.code = res.result;
  110. }
  111. });
  112. },
  113. gongxu(){
  114. var item = {
  115. coding:null,
  116. type:'get'
  117. };
  118. var coding = this.coding;
  119. item.coding = coding;
  120. uni.navigateTo({
  121. url:'../Insert/workingProcedure?item='+encodeURIComponent(JSON.stringify(item))
  122. });
  123. },
  124. getMessage(coding) {
  125. var that = this;
  126. var serverUrl = that.serverurl;
  127. var token = uni.getStorageSync("token");
  128. uni.request({
  129. url: serverUrl + "/TMachine/selectMachine?coding=" + coding,
  130. method: "GET",
  131. header: {
  132. 'token': token
  133. },
  134. success: (Result) => {
  135. // console.log(Result);
  136. var res = Result;
  137. if (res.data.code == true) {
  138. //当机器已录入时,会先把所有录入模块给列出来
  139. if (res.data.message == 'all') {
  140. var tmachine = res.data.data.tmachine;
  141. that.name = tmachine.name;
  142. that.nameplate = tmachine.nameplate;
  143. that.clientId = tmachine.clientId;
  144. that.customerNo = tmachine.customerNo;
  145. that.orderNo = tmachine.orderNo;
  146. that.coding = tmachine.coding;
  147. that.startDate = tmachine.startDate;
  148. that.endDate = tmachine.endDate;
  149. that.modulesList = res.data.data.modulesList;
  150. } else {
  151. var codes = res.data.data;
  152. that.name = codes.name;
  153. that.nameplate = codes.nameplate;
  154. that.clientId = codes.clientId;
  155. that.customerNo = codes.customerNo;
  156. that.orderNo = codes.orderNo;
  157. that.producePersonnel = uni.getStorageSync("name");
  158. }
  159. } else {
  160. uni.showModal({
  161. title: '提示',
  162. content: res.data.message,
  163. });
  164. }
  165. this.jiancha();
  166. }
  167. });
  168. },
  169. tran(coding) {
  170. uni.setStorageSync("selectCoding", coding);
  171. uni.navigateTo({
  172. url: 'selectModules',
  173. });
  174. },
  175. jiancha(){
  176. var token = uni.getStorageSync("token");
  177. uni.request({
  178. url: this.serverurl + "/TWorkingProcedure/jiancha",
  179. method: "POST",
  180. data: {
  181. "machineCoding": this.coding
  182. },
  183. header: {
  184. 'token': token
  185. },
  186. success: (Result) => {
  187. var res = Result;
  188. if (res.data.code == false) {
  189. var re = res.data.data.toString();
  190. this.weiname = re+'未安装';
  191. }else{
  192. this.weiname = '已全部安装';
  193. }
  194. this.jianchaModules();
  195. }
  196. });
  197. },
  198. jianchaModules(){
  199. var token = uni.getStorageSync("token");
  200. uni.request({
  201. url: this.serverurl + "/TModules/jianchaModules?machineCoding="+this.coding,
  202. method: "GET",
  203. header: {
  204. 'token': token
  205. },
  206. success: (Result) => {
  207. var res = Result;
  208. if (res.data.code == false) {
  209. var re = res.data.data.toString();
  210. this.Modulesname = re+'未安装';
  211. }else{
  212. this.Modulesname = '已全部安装';
  213. }
  214. }
  215. });
  216. }
  217. }
  218. }
  219. </script>
  220. <style>
  221. .body {
  222. background-color: #FFFFFF;
  223. padding: 20upx 20upx 20upx 20upx;
  224. font-size: 30upx;
  225. display: flex;
  226. flex-direction: row;
  227. justify-content: flex-start;
  228. }
  229. .table {
  230. padding-top: 30upx;
  231. }
  232. .tr {
  233. padding-left: 30upx;
  234. padding-top: 13upx;
  235. font-size: 30upx;
  236. padding-bottom: 13upx;
  237. }
  238. .td {
  239. padding-left: 280upx;
  240. }
  241. .input {
  242. /* padding: 10upx 20upx 10upx 0upx; */
  243. padding-left: 20upx;
  244. padding-top: 10upx;
  245. background-color: #FFFFFF;
  246. width: 400upx;
  247. height: 50upx;
  248. box-shadow: 0upx 0upx 20upx #D3D3D3;
  249. border-radius: 5upx;
  250. }
  251. .button {
  252. margin: auto;
  253. width: 60%;
  254. height: 100upx;
  255. }
  256. .button1 {
  257. margin: auto;
  258. width: 75upx;
  259. height: 50upx;
  260. text-align: right
  261. }
  262. .p {
  263. /* #ifdef H5 */
  264. top: -13%;
  265. /* #endif */
  266. width: 50upx;
  267. height: 30upx;
  268. font-size: 25upx;
  269. padding-right: 9upx;
  270. padding-top: 6upx;
  271. /* #ifndef H5 */
  272. /* padding-top: 10upx; */
  273. /* #endif */
  274. position: absolute;
  275. /* 水平居中 */
  276. left: 50%;
  277. -webkit-transform: translateX(-50%);
  278. transform: translateX(-50%);
  279. }
  280. .p1 {
  281. /* #ifdef H5 */
  282. top: -13%;
  283. /* #endif */
  284. width: 80upx;
  285. height: 60upx;
  286. font-size: 40upx;
  287. padding-top: 6upx;
  288. /* #ifndef H5 */
  289. padding-top: 10upx;
  290. /* #endif */
  291. position: absolute;
  292. /* 水平居中 */
  293. left: 50%;
  294. -webkit-transform: translateX(-50%);
  295. transform: translateX(-50%);
  296. }
  297. .radio {
  298. padding-top: 20upx;
  299. padding-left: 30upx;
  300. }
  301. .lis {
  302. padding-left: 90upx;
  303. font-size: 30upx;
  304. padding-top: 5upx;
  305. }
  306. .title {
  307. padding-left: 20upx;
  308. font-size: 35upx;
  309. }
  310. .line {
  311. background: #ECECEC;
  312. height: 10upx;
  313. }
  314. </style>