Browse Source

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend into dengfei

695593266@qq.com 23 hours ago
parent
commit
6150c048b6

+ 1 - 0
src/views/rulesManagement/releaseRules/components/bindSubstanceList.vue

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

+ 56 - 22
src/views/rulesManagement/releaseRules/components/permitAdd.vue

@@ -416,7 +416,7 @@
             autosize
           ></el-input>
         </template>
-        <!-- <template v-slot:supplierName="{ row, $index }">
+        <template v-slot:supplierName="{ row, $index }">
           {{ row.supplierName }}
           <el-button
             type="primary"
@@ -426,7 +426,7 @@
           >
             选择供应商
           </el-button>
-        </template> -->
+        </template>
         <template v-slot:formula="{ row }">
           <div v-if="row.paramType == 9" class="formula-builder">
             <div class="formula-builder__selects">
@@ -627,6 +627,20 @@
             </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-if="!row.iotPointName"
+                class="el-icon-arrow-down"
+                @click="handleAdd(row, $index, 'iotPointName')"
+              ></i>
+            </div>
+          </el-link>
+        </template>
         <template v-slot:toolCodes="{ row }">
           <el-input
             :value="
@@ -742,11 +756,11 @@
       @chooseProcess="processChooseProcess"
     ></processModal>
 
-    <!-- <vendorDialog
+    <vendorDialog
       ref="supplierSelectionRef"
       @success="confirmStaffSelection1"
       :isAll="true"
-    ></vendorDialog> -->
+    ></vendorDialog>
   </ele-modal>
 </template>
 
@@ -760,7 +774,9 @@
     'paramValue',
     'maxValue',
     'minValue',
-    'unitName'
+    'unitName',
+    'iotId',
+    'iotPointName'
   ];
   import { getByCode } from '@/api/system/dictionary-data';
   // import RuleCycle from '../../matterRules/components/rule-cycle.vue';
@@ -792,7 +808,6 @@
   import { recordrulesexecutemethodPage } from '@/api/recordrulesexecutemethod/index';
   import { businessTypeList } from '@/views/regulationManagement/components/util';
 
-
   export default {
     mixins: [dictMixins],
     components: {
@@ -805,7 +820,7 @@
       processModal,
       ProductModalCorrelation,
       experimentationProcess,
-      bindSubstanceList,
+      bindSubstanceList
       // vendorDialog
     },
     props: {
@@ -846,16 +861,9 @@
             slot: 'paramValue',
             minWidth: 261
           },
-          // {
-          //   prop: 'supplierName',
-          //   label: '供应商',
-          //   align: 'center',
-          //   slot: 'supplierName',
-          //   minWidth: 261
-          // },
-
-          {
+    {
             prop: 'iotPointName',
+            slot: 'iotPointName',
             label: '物联点位',
             align: 'center',
             minWidth: 150
@@ -902,6 +910,7 @@
             slot: 'substanceName',
             minWidth: 110
           },
+      
           {
             prop: 'substanceCode',
             label: '设备编码',
@@ -1358,10 +1367,10 @@
 
         console.log('this.formData', this.formData);
       },
-      // addSupplier(row, index) {
-      //   this.currentIndex = index;
-      //   this.$refs.supplierSelectionRef.open();
-      // },
+      addSupplier(row, index) {
+        this.currentIndex = index;
+        this.$refs.supplierSelectionRef.open();
+      },
       confirmStaffSelection1(data = []) {
         this.$set(
           this.formData.details[this.currentIndex],
@@ -1843,11 +1852,34 @@
       },
       // 去选择设备
       selectDeviceId() {
+        this.currentIndex = 9999;
         this.$refs.deviceSelectDialog.open([]);
       },
       // 选择设备回调
       chooseEquipment(data, index, categoryId) {
-        console.log('data', data, index, categoryId);
+        if (this.currentIndex != 9999) {
+          substanceKey.forEach((key) => {
+            if (key != 'paramValue') {
+              this.$set(this.formData.details[this.currentIndex], key, '');
+            }
+          });
+          this.$set(
+            this.formData.details[this.currentIndex],
+            'substanceId',
+            data.id
+          );
+          this.$set(
+            this.formData.details[this.currentIndex],
+            'substanceName',
+            data.name
+          );
+          this.$set(
+            this.formData.details[this.currentIndex],
+            'substanceCode',
+            data.code
+          );
+          return;
+        }
         this.formData.deviceId = data?.id || null;
         this.formData.deviceName = data?.name || '';
         this.formData.codeNumber = data?.codeNumber || '';
@@ -1910,7 +1942,7 @@
       handleAdd(row, index, type) {
         this.currentRow = row;
         this.currentIndex = index;
-        if (type == 'substanceName') {
+        if (type == 'iotPointName') {
           if (!this.formData.deviceId) {
             this.$message.error('请选择主设备!');
             return;
@@ -1920,6 +1952,8 @@
             this.formData.deviceName,
             this.formData.deviceCode
           );
+        } else if (type == 'substanceName') {
+          this.$refs.deviceSelectDialog.open([]);
         } else {
           this.$refs.toolModalRef.open(row.toolCodes);
         }