yusheng 4 дней назад
Родитель
Сommit
02856c088f

+ 1 - 0
src/views/recordComponents/bindSubstanceList.vue

@@ -237,6 +237,7 @@
               substanceName: item.substanceName,
               paramCode: listItem.identifier,
               paramValue: listItem.name,
+              iotPointName: listItem.name,
               maxValue: listItem.dataType?.specs.max,
               minValue: listItem.dataType?.specs.min,
               unitName: listItem.dataType?.specs.unitName

+ 52 - 22
src/views/recordComponents/programRulesDialog.vue

@@ -580,11 +580,6 @@
                 class="el-icon-arrow-down"
                 @click="handleAdd(row, '', 'toolName')"
               ></i>
-              <i
-                v-else
-                class="el-icon-close"
-                @click="clearTool(row, '', 'toolName')"
-              ></i>
             </div>
           </el-link>
         </template>
@@ -599,10 +594,19 @@
                 class="el-icon-arrow-down"
                 @click="handleAdd(row, $index, 'substanceName')"
               ></i>
+            </div>
+          </el-link>
+        </template>
+        <template v-slot:iotPointName="{ row, $index }">
+          <el-link :underline="false" style="cursor: pointer">
+            <div class="ele-cell">
+              <div @click="handleAdd(row, $index, 'iotPointName')">
+                {{ row.iotPointName || '请选择' }}
+              </div>
               <i
-                v-else
-                class="el-icon-close"
-                @click="clearTool(row, $index, 'substanceName')"
+                v-if="!row.iotPointName"
+                class="el-icon-arrow-down"
+                @click="handleAdd(row, $index, 'iotPointName')"
               ></i>
             </div>
           </el-link>
@@ -712,7 +716,9 @@
     'paramValue',
     'maxValue',
     'minValue',
-    'unitName'
+    'unitName',
+    'iotId',
+    'iotPointName'
   ];
   const formBaseData = {
     address: '',
@@ -934,6 +940,7 @@
           },
           {
             prop: 'iotPointName',
+            slot: 'iotPointName',
             label: '物联点位',
             align: 'center',
             minWidth: 150
@@ -1281,6 +1288,7 @@
       },
       // 打开选择车间弹窗
       openWorkShops(type) {
+        this.currentIndex = 9999;
         if (type == 1) {
           this.$refs.selectWorkshopRef.open();
         } else {
@@ -1288,7 +1296,29 @@
         }
       },
       confirmWorkshops(info) {
-        console.log('info', info);
+        if (this.currentIndex != 9999) {
+          substanceKey.forEach((key) => {
+            if (key != 'paramValue') {
+              this.$set(this.addForm.detailList[this.currentIndex], key, '');
+            }
+          });
+          this.$set(
+            this.addForm.detailList[this.currentIndex],
+            'substanceId',
+            info.id
+          );
+          this.$set(
+            this.addForm.detailList[this.currentIndex],
+            'substanceName',
+            info.name
+          );
+          this.$set(
+            this.addForm.detailList[this.currentIndex],
+            'substanceCode',
+            info.code
+          );
+          return;
+        }
         if (this.addForm.associatedObject == 1) {
           this.addForm.workshopId = info.workshopId;
           this.addForm.workshopName = info.workshopName;
@@ -1371,7 +1401,7 @@
       handleAdd(row, index, type) {
         this.currentRow = row;
         this.currentIndex = index;
-        if (type == 'substanceName') {
+        if (type == 'iotPointName') {
           if (!this.addForm.deviceId) {
             this.$message.error('请选择主设备!');
             return;
@@ -1381,6 +1411,8 @@
             this.addForm.deviceName,
             this.addForm.deviceCode
           );
+        } else if (type == 'substanceName') {
+          this.$refs.MaterialAddRef.open();
         } else {
           this.$refs.toolModalRef.open(row.toolCodes);
         }
@@ -1403,6 +1435,10 @@
               this.$set(this.addForm.detailList[currentIndex], key, item[key]);
             });
             this.$set(this.addForm.detailList[currentIndex], 'paramType', 7);
+            console.log(
+              this.addForm.detailList[currentIndex],
+              'this.addForm.detailList[currentIndex]'
+            );
           } else {
             this.addForm.detailList.push({
               id: new Date().getTime(),
@@ -1411,7 +1447,7 @@
               minValue: item.minValue,
               paramType: 7,
               paramValue: item.paramValue,
-              iotPointName: item.paramValue,
+              iotPointName: item.iotPointName,
               iotId: item.iotId,
               remark: '',
               symbol: null,
@@ -1442,16 +1478,10 @@
           }
         });
       },
-      // 清空工具
-      clearTool(row, index) {
-        if (type == 'substanceName') {
-          substanceKey.forEach((key) => {
-            this.$set(this.addForm.details[index], key, '');
-          });
-        } else {
-          row.tools = [];
-        }
-      },
+      // // 清空工具
+      // clearTool(row, index) {
+      //   row.tools = [];
+      // },
       // 选择物品 产品、物料等
       selectChooseModalProduct(row) {
         this.currentRow = row;