فهرست منبع

fix: 修复API参数传递和条件渲染问题

yusheng 2 ماه پیش
والد
کامیت
0995c2e7b9

+ 15 - 17
src/api/classifyManage/itemInformation.js

@@ -1,9 +1,7 @@
 import request from '@/utils/request';
 // 物品信息列表
-export async function getList(data) {
-  const res = await request.get(
-    `/main/category/getList?categoryLevelId=${data.categoryLevelId}&pageNum=${data.pageNum}&size=${data.size}&searchKey=${data.searchKey}`
-  );
+export async function getList(params) {
+  const res = await request.get(`/main/category/getList`, { params });
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -35,24 +33,24 @@ export async function getDetails(id) {
   }
   return Promise.reject(new Error(res.data.message));
 }
-  // 根据物品ID获取包装维度
-  export async function getCategoryPackageDisposition(data) {
-  const res = await request.post(`/main/categoryPackageDisposition/list`,data);
+// 根据物品ID获取包装维度
+export async function getCategoryPackageDisposition(data) {
+  const res = await request.post(`/main/categoryPackageDisposition/list`, data);
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
-  // getCategoryPackageDisposition: async (data) => {
-  //   const res = await request.post(
-  //     '/main/categoryPackageDisposition/list',
-  //     data
-  //   );
-  //   if (res.data.code == 0) {
-  //     return res.data.data;
-  //   }
-  //   return Promise.reject(new Error(res.data.message));
-  // },
+// getCategoryPackageDisposition: async (data) => {
+//   const res = await request.post(
+//     '/main/categoryPackageDisposition/list',
+//     data
+//   );
+//   if (res.data.code == 0) {
+//     return res.data.data;
+//   }
+//   return Promise.reject(new Error(res.data.message));
+// },
 // 物品信息删除
 export async function removeItem(id) {
   const res = await request.get(`/main/category/remove/${id}`, {});

+ 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;
+}

+ 6 - 3
src/views/recordComponents/bindSubstanceList.vue

@@ -167,9 +167,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);
+            }
           }
         });
       },

+ 2 - 0
src/views/recordComponents/plan.vue

@@ -307,6 +307,8 @@
       }
     },
     created() {
+      this.requestDict('记录规则类型');
+
       getteampage({
         pageNum: 1,
         size: -1

+ 20 - 16
src/views/recordComponents/programRulesDialog.vue

@@ -301,6 +301,7 @@
               icon="el-icon-plus"
               class="ele-btn-icon"
               @click="bindSubstanceListOpen"
+              v-if="addForm.associatedObject == 2"
             >
               添加物联参数
             </el-button>
@@ -688,7 +689,6 @@
     productLineName: ''
   };
   export default {
-
     mixins: [dictMixins, tableColumnsMixin],
     components: {
       deptSelect,
@@ -1041,7 +1041,7 @@
               }
 
               const body = this.formMateBody();
-              body.planType =5
+              body.planType = 5;
 
               if (this.type == 'dispatch') {
                 await recordrulesplanManualDispatchOrder(body);
@@ -1239,11 +1239,18 @@
       handleAdd(row, index) {
         this.currentRow = row;
         this.currentIndex = index;
-        this.$refs.bindSubstanceRef.open(
-          this.addForm.deviceId,
-          this.addForm.deviceCode,
-          this.addForm.deviceName
-        );
+
+        if (this.addForm.associatedObject == 1) {
+          this.$refs.toolModalRef.open(row.toolCodes);
+        } else {
+          this.$refs.bindSubstanceRef.open(
+            this.addForm.deviceId,
+            this.addForm.deviceName,
+            this.addForm.deviceCode
+          );
+        }
+
+        //   this.currentRow = row;
       },
       bindSubstanceListOpen() {
         this.currentIndex = 9999;
@@ -1302,6 +1309,10 @@
       // 清空工具
       clearTool(row, index) {
         substanceKey.forEach((key) => {
+          console.log(
+            this.addForm.detailList[index],
+            'this.addForm.detailList[index]'
+          );
           this.$set(this.addForm.detailList[index], key, '');
         });
       },
@@ -1309,7 +1320,6 @@
       selectChooseModalProduct(row) {
         this.currentRow = row;
         this.$refs.toolModalTowRef.open([], '选择物品');
-        alert(1);
       },
       chooseModalProduct(current) {
         this.currentRow.productName = current.name;
@@ -1399,10 +1409,7 @@
           this.$set(row, 'activeIndex', index);
         }
       },
-      handleAdd(row) {
-        this.currentRow = row;
-        this.$refs.toolModalRef.open(row.toolCodes);
-      },
+
       chooseModal(data) {
         console.log('data', data);
         this.currentRow.tools = data.map((i) => {
@@ -1412,10 +1419,7 @@
           };
         });
       },
-      // 清空工具
-      clearTool(row) {
-        row.tools = [];
-      },
+
       deleteRow(time, row) {
         const index = this.addForm.detailList.findIndex(
           (item) => item.id === row.id