Просмотр исходного кода

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

695593266@qq.com 2 месяцев назад
Родитель
Сommit
37f3fb9792

+ 3 - 9
src/api/material/list.js

@@ -184,12 +184,6 @@ export async function queryBindSubstanceList(data) {
 }
 // 获取实体物联点位
 export async function getPhysicalModel(id) {
-  const res = await request.get(
-    `/main/asset/getPhysicalModel/` + id,
-    {}
-  );
-  if (res.data.code == 0) {
-    return res.data.data;
-  }
-  return Promise.reject(new Error(res.data.message));
-}
+  const res = await request.get(`/main/asset/getPhysicalModel/` + id, {});
+  return res.data;
+}

+ 42 - 1
src/views/rulesManagement/recordPlan/components/programRulesDialog.vue

@@ -114,6 +114,25 @@
             </el-select>
           </el-form-item>
         </el-col>
+        <el-col :span="8" v-if="addForm.type == 1">
+          <el-form-item label="场站" prop="productLineId">
+            <el-select
+              v-model="addForm.productLineId"
+              placeholder="请选择场站"
+              filterable
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in productLineList"
+                :label="item.name"
+                :value="item.id"
+                :key="item.id"
+                @click.native="addForm.productLineName = item.name"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
         <el-col :span="8" v-if="addForm.autoOrder && addForm.type == 0">
           <el-form-item label="部门" prop="groupId">
             <deptSelect
@@ -676,6 +695,8 @@
         createUserName: '',
         duration: null,
         associatedObject: 2,
+        productLineId: '',
+        productLineName: '',
         planType: 1,
         executeUsers: [
           // {
@@ -706,6 +727,7 @@
       };
 
       return {
+        productLineList: [],
         visible: false,
         title: '新增记录计划配置',
         formBaseData,
@@ -1012,6 +1034,7 @@
         } else {
           // 班组
           this.addForm.teamId = this.addForm.executeUsers[0]?.teamId || '';
+          this.teamChange(true);
         }
         this.tabsValue = this.addForm.children[0]?.ruleId || '';
 
@@ -1126,6 +1149,9 @@
       typeChange() {
         this.addForm.groupId = '';
         this.addForm.executeIdList = [];
+        this.addForm.productLineName = '';
+        this.productLineList = [];
+        this.addForm.productLineId = '';
       },
       //选择部门(搜索)
       async searchDeptNodeClick(info, data) {
@@ -1482,12 +1508,27 @@
         console.log('teamAllList 班组', list);
         this.teamAllList = list;
       },
-      teamChange() {
+      teamChange(init) {
         console.log('this.addForm.teamId', this.addForm.teamId);
         // 当前班组
         const currentTeam = this.teamAllList.find(
           (item) => item.id === this.addForm.teamId
         );
+        if (!init) {
+          this.addForm.productLineName = '';
+          this.addForm.productLineId = '';
+        }
+        this.productLineList = [];
+        currentTeam.factoryWorkstationVOList.forEach((item) => {
+          if (
+            !this.productLineList.find((p) => p.id === item.productionLineId)
+          ) {
+            this.productLineList.push({
+              name: item.productionLineName,
+              id: item.productionLineId
+            });
+          }
+        });
         if (currentTeam) {
           // 同步执行人
           this.addForm.executeUsers = [

+ 16 - 7
src/views/rulesManagement/releaseRules/components/bindSubstanceList.vue

@@ -61,8 +61,10 @@
 <script>
   import {
     queryBindSubstanceList,
-    getPhysicalModel
+    getPhysicalModel,
+    getDetailInfo
   } from '@/api/material/list';
+  import { getAssetInfo } from '@/api/ledgerAssets/index.js';
   export default {
     components: {},
     props: {
@@ -167,9 +169,12 @@
       },
       getPhysicalModel(id) {
         getPhysicalModel(id).then((res) => {
-          this.physicalList = res.properties;
-          if (this.cachingData[id]) {
-            this.$refs.table.setSelectedRows(this.cachingData[id].list);
+          this.physicalList = [];
+          if (res.code == 0) {
+            this.physicalList = res.data.properties;
+            if (this.cachingData[id]) {
+              this.$refs.table.setSelectedRows(this.cachingData[id].list);
+            }
           }
         });
       },
@@ -183,12 +188,14 @@
         this.$refs.table.clearSelection();
         this.getPhysicalModel(data.id);
       },
-      open(id, name,code) {
+      async open(id) {
+        const data = await getAssetInfo(id);
+        console.log(data);
+
         this.visible = true;
         if (id) {
           this.treeList.push({
-            id,
-            name,code,
+            ...data,
             children: []
           });
           this.$nextTick(() => {
@@ -202,6 +209,7 @@
           substanceCode: this.current.code,
           substanceId: this.current.id,
           substanceName: this.current.name,
+          iotId: this.current.iotId,
           list: data
         };
       },
@@ -228,6 +236,7 @@
               substanceCode: item.substanceCode,
               substanceId: item.substanceId,
               substanceName: item.substanceName,
+              iotId: item.iotId,
               paramCode: listItem.identifier,
               paramValue: listItem.name,
               maxValue: listItem.dataType?.specs.max,

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

@@ -1866,6 +1866,7 @@
               productName: '',
               productCode: '',
               paramCode: item.paramCode,
+              iotId: item.iotId,
               substanceId: item.substanceId,
               substanceCode: item.substanceCode,
               substanceName: item.substanceName,