浏览代码

修改bug

695593266@qq.com 4 天之前
父节点
当前提交
584c125784

+ 36 - 18
src/views/productionPlan/components/newFactoryProductionScheduling.vue

@@ -586,6 +586,22 @@
         const text = String(value).trim();
         return /^\d+$/.test(text) ? text : '';
       },
+      normalizeBackendTextValue(value) {
+        if (value === null || value === undefined || value === '') {
+          return '';
+        }
+        const text = String(value).trim();
+        return ['undefined', 'null'].includes(text.toLowerCase()) ? '' : text;
+      },
+      pickBackendTextValue(...values) {
+        for (const value of values) {
+          const text = this.normalizeBackendTextValue(value);
+          if (text) {
+            return text;
+          }
+        }
+        return '';
+      },
       normalizeOrderQuantity(value) {
         if (value === null || value === undefined || value === '') {
           return '';
@@ -1331,24 +1347,26 @@
             code: item.code || item.workstationCode || item.stationCode || '',
             workstationCode:
               item.workstationCode || item.code || item.stationCode || '',
-            assetCode:
-              item.assetCode ||
-              item.deviceCode ||
-              item.extInfo?.assetCode ||
-              substance.code ||
-              '',
+            assetCode: this.pickBackendTextValue(
+              item.assetCode,
+              item.deviceCode,
+              item.extInfo?.assetCode,
+              item.extInfo?.deviceCode,
+              substance.code
+            ),
             assetId:
               this.normalizeBackendLongId(item.assetId) ||
               this.normalizeBackendLongId(item.deviceId) ||
               this.normalizeBackendLongId(item.extInfo?.assetId) ||
               this.normalizeBackendLongId(substance.id) ||
               '',
-            assetName:
-              item.assetName ||
-              item.deviceName ||
-              item.extInfo?.assetName ||
-              substance.name ||
-              '',
+            assetName: this.pickBackendTextValue(
+              item.assetName,
+              item.deviceName,
+              item.extInfo?.assetName,
+              item.extInfo?.deviceName,
+              substance.name
+            ),
             assetModelType:
               item.assetModelType ||
               item.deviceModel ||
@@ -2935,9 +2953,9 @@
 
         const titleText = this.isReview
           ? '是否发起流程'
-          : '发布工单后不可撤回,确定发布吗?';
-        const title = this.isReview ? '流程确认' : '发布确认';
-        const text = this.isReview ? '流程发布中...' : '工单发布中...';
+          : '审批工单后不可撤回,确定审批吗?';
+        const title = this.isReview ? '流程确认' : '审批确认';
+        const text = this.isReview ? '流程审批中...' : '工单审批中...';
 
         try {
           await this.$confirm(titleText, title);
@@ -2955,14 +2973,14 @@
           const api = this.isReview ? releaseByApproval : release;
           const data = await api([row.id]);
           if (data || data === 0) {
-            this.$message.success('发布成功!');
+            this.$message.success('审批成功!');
           } else {
-            this.$message.error('发布失败,请重新发布!');
+            this.$message.error('审批失败,请重新审批!');
           }
           await this.refreshSchedulingView();
           await this.reloadPlanSchedulingPlansByStatus();
         } catch (e) {
-          this.$message.error(e.message || '发布失败,请重新发布!');
+          this.$message.error(e.message || '审批失败,请重新审批!');
         } finally {
           this.approvalLoading = false;
           loading.close();

+ 43 - 12
src/views/productionPlan/components/newFactoryProductionScheduling/TaskConfigPanel.vue

@@ -979,16 +979,26 @@
               teamTimeIds: task?.teamTimeIds || assignment?.teamTimeIds,
               weight: task?.weight || assignment?.weight || item.weight || '',
               code: item.code || item.workstationCode || '',
-              assetCode:
-                item.assetCode ||
-                item.deviceCode ||
-                item.extInfo?.assetCode ||
-                '',
-              assetName:
-                item.assetName ||
-                item.deviceName ||
-                item.extInfo?.assetName ||
-                '',
+              assetCode: this.pickDispatchSingleValue([
+                {
+                  source: item,
+                  keys: ['assetCode', 'deviceCode']
+                },
+                {
+                  source: item.extInfo,
+                  keys: ['assetCode', 'deviceCode']
+                }
+              ]),
+              assetName: this.pickDispatchSingleValue([
+                {
+                  source: item,
+                  keys: ['assetName', 'deviceName']
+                },
+                {
+                  source: item.extInfo,
+                  keys: ['assetName', 'deviceName']
+                }
+              ]),
               assetModelType: item.assetModelType || item.deviceModel || '',
               assetCategoryLevelPath:
                 item.assetCategoryLevelPath || item.deviceType || ''
@@ -1392,6 +1402,9 @@
         if (!text) {
           return '';
         }
+        if (['undefined', 'null'].includes(text.toLowerCase())) {
+          return '';
+        }
         return text.includes(',') ? text.split(',')[0].trim() : text;
       },
       pickDispatchSingleValue(groups = []) {
@@ -2479,12 +2492,30 @@
         const stations = (Array.isArray(list) ? list : []).map((item) => ({
           ...item,
           isNew: 1,
-          assetCode: item.assetCode || item.extInfo?.assetCode || '',
+          assetCode: this.pickDispatchSingleValue([
+            {
+              source: item,
+              keys: ['assetCode', 'deviceCode']
+            },
+            {
+              source: item.extInfo,
+              keys: ['assetCode', 'deviceCode']
+            }
+          ]),
           assetId:
             this.normalizeDispatchLongId(item.assetId) ||
             this.normalizeDispatchLongId(item.extInfo?.assetId) ||
             '',
-          assetName: item.assetName || item.extInfo?.assetName || ''
+          assetName: this.pickDispatchSingleValue([
+            {
+              source: item,
+              keys: ['assetName', 'deviceName']
+            },
+            {
+              source: item.extInfo,
+              keys: ['assetName', 'deviceName']
+            }
+          ])
         }));
         this.$emit('add-dispatch-stations', {
           task,

+ 2 - 2
src/views/productionPlan/components/planDotLine.vue

@@ -401,9 +401,9 @@
         this.currentPlan = data || null;
         this.planRoutingPayload = null;
         await Promise.all([
-          this.loadTaskList(),
           this.loadTeamOptions(),
-          this.loadFactoryList()
+          this.loadFactoryList(),
+          this.loadTaskList()
         ]);
         this.visible = true;
         this.dialogVisible = true;

+ 2 - 2
vue.config.js

@@ -35,14 +35,14 @@ module.exports = {
         // target: 'http://192.168.1.103:18086',
         // target: 'http://192.168.1.158:18086',
         // target: 'http://192.168.158:18086',
-        // target: 'http://192.168.1.251:18086',
+        target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.144:18086',
         // target: 'http://192.168.1.251:18186',
         // target: 'http://192.168.1.211:18086',
         // target: 'http://192.168.1.251:18186',
         // target: 'http://192.168.1.102:18086',
         // target: 'http://aiot.zoomwin.com.cn:51001/api',
-        target: 'http://192.168.1.125:18086',
+        // target: 'http://192.168.1.125:18086',
 
         // target: 'http://192.168.1.116:18086',