فهرست منبع

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

chencc 1 سال پیش
والد
کامیت
9cdbdf409e

+ 9 - 0
src/api/classifyManage/index.js

@@ -80,3 +80,12 @@ export async function getTreeByIds(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+//根据多个ID查询分类详情系信息
+export async function getPcTreeByPids (id) {
+  const res = await request.get(`/main/categoryLevel/getPcTreeByPids/${id}`);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+

+ 16 - 1
src/api/material/BOM.js

@@ -377,7 +377,22 @@ export async function contactList(params) {
   }
   return Promise.reject(new Error(res.data.message));
 }
-
+// 更新供应商
+export async function saveSupplier(data) {
+  const res = await request.post(`/eom/contactproduct/saveSupplier`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 删除供应商
+export async function deleteSupplier(data) {
+  const res = await request.post(`/eom/contactproduct/deleteSupplier`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 // 检查bom  (里面有几个草稿)
 
 export async function hasNewVersion(data) {

+ 7 - 4
src/components/AssetTree/index.vue

@@ -17,7 +17,7 @@
 </template>
 
 <script>
-  import { getTreeByPid } from '@/api/classifyManage';
+  import { getTreeByPid, getPcTreeByPids } from '@/api/classifyManage';
   // let originId = '';
   // let originType = '';
   export default {
@@ -55,6 +55,10 @@
       nodeKey: {
         type: String,
         default: 'id'
+      },
+      ids: {
+        type: String,
+        default: ''
       }
       // appendRoot: {
       //   type: Boolean,
@@ -83,8 +87,8 @@
       async getTreeData() {
         try {
           this.treeLoading = true;
-
-          const res = await getTreeByPid(this.id);
+          
+          const res =await (this.ids ? getPcTreeByPids(this.ids): getTreeByPid(this.id));
           this.treeLoading = false;
           if (res?.code === '0') {
             this.treeList = res.data;
@@ -108,7 +112,6 @@
         this.treeLoading = false;
       },
 
-
       handleNodeClick(data, node) {
         this.$emit('handleNodeClick', data, node);
       },

+ 57 - 24
src/views/factoryModel/qualificationManagement/components/vendorDialog.vue

@@ -54,10 +54,14 @@
       </el-row>
     </el-form>
     <el-container class="assets-dialog">
-      <el-aside width="200px" style="max-height: calc(100vh - 355px)" class="wrapper-assets">
+      <el-aside
+        width="200px"
+        style="max-height: calc(100vh - 355px)"
+        class="wrapper-assets"
+      >
         <AssetTree
           @handleNodeClick="handleNodeClick"
-          id="19"
+          ids="19,20250317001"
           :isFirstRefreshTable="false"
           ref="treeList"
         />
@@ -71,12 +75,16 @@
           full-height="calc(100vh - 116px)"
           tool-class="ele-toolbar-form"
           :current.sync="current"
+          :selection.sync="selection"
           :highlight-current-row="true"
           @current-change="handleCurrentChange"
           cache-key="eomContactPageTable"
+          row-key="id"
         >
-          <template v-slot:current="{row,_index}">
-            <el-radio class="radio" v-model="radio" :label="row.id"><i></i></el-radio>
+          <template v-slot:current="{ row, _index }">
+            <el-radio class="radio" v-model="radio" :label="row.id"
+              ><i></i
+            ></el-radio>
           </template>
         </ele-pro-table>
       </el-main>
@@ -108,12 +116,47 @@
         delVisible: false,
         // 加载状态
         loading: false,
-        columns: [
+        disabledId: [],
+
+        current: {},
+        curNodeData: {},
+        treeList: [],
+        treeLoading: false,
+        formData: {},
+        rootTreeId: null,
+        defaultProps: {
+          children: 'children',
+          label: 'name'
+        },
+        showEdit: true
+      };
+    },
+    props: {
+      isAll: {
+        type: Boolean,
+        default: false
+      }
+    },
+    computed: {
+      columns() {
+        return [
           {
             width: 55,
             columnKey: 'current',
             slot: 'current',
-            align: 'center'
+            align: 'center',
+            show: !this.isAll
+          },
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            show: this.isAll,
+            reserveSelection: true,
+            selectable: (row, index) => {
+              return !this.disabledId.includes(row.id)
+            }
           },
           {
             columnKey: 'index',
@@ -155,7 +198,7 @@
           },
           {
             prop: 'addressName',
-            label: '单位地址',
+            label: '注册地址',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 120,
@@ -209,19 +252,8 @@
               return this.$util.toDateString(cellValue);
             }
           }
-        ],
-        current: {},
-        curNodeData: {},
-        treeList: [],
-        treeLoading: false,
-        formData: {},
-        rootTreeId: null,
-        defaultProps: {
-          children: 'children',
-          label: 'name'
-        },
-        showEdit: true
-      };
+        ];
+      }
     },
     created() {},
     methods: {
@@ -237,8 +269,8 @@
         this.curNodeData = data;
         this.reload({ categoryId: data.id });
       },
-      handleCurrentChange(row){
-        this.radio = row.id
+      handleCurrentChange(row) {
+        this.radio = row.id;
       },
       reload(where) {
         this.$refs.table.reload({ page: 1, where });
@@ -251,14 +283,15 @@
           ...where
         });
       },
-      open() {
+      open(ids) {
         this.visible = true;
+        this.disabledId = ids;
         this.$nextTick(() => {
           this.$refs.treeList.getTreeData();
         });
       },
       confirm() {
-        this.$emit('success', this.current);
+        this.$emit('success', this.isAll ? this.selection : this.current);
         this.visible = false;
       }
     }

+ 79 - 11
src/views/material/product/components/link-msg.vue

@@ -23,18 +23,63 @@
         </ele-pro-table
       ></el-tab-pane>
       <el-tab-pane label="供应商">
-        <ele-pro-table :columns="supplierColumn" :datasource="supplierData" :need-page="false">
-        </ele-pro-table
-      ></el-tab-pane>
+        <ele-pro-table
+          :columns="supplierColumn"
+          :datasource="supplierData"
+          :need-page="false"
+          ref="supplierRef"
+        >
+          <template v-slot:toolbar>
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-plus"
+              class="ele-btn-icon"
+              @click="handParent()"
+              v-if="id"
+            >
+              添加供应商
+            </el-button>
+          </template>
+            <!-- 操作列 -->
+            <template v-slot:action="{ row }">
+              <el-popconfirm
+                  class="ele-action"
+                  title="确定要删除此供应商吗?"
+                  @confirm="deleteSupplie(row)"
+                >
+                  <template v-slot:reference>
+                    <el-link
+                      type="danger"
+                      :underline="false"
+                      icon="el-icon-delete"
+                    >
+                      删除
+                    </el-link>
+                  </template>
+          
+                </el-popconfirm>
+            </template>
+        </ele-pro-table>
+        </el-tab-pane
+      >
     </el-tabs>
+    <vendorDialog
+      ref="vendorDialogRef"
+      :is-all="true"
+      @success="success"
+    ></vendorDialog>
   </div>
 </template>
 
 <script>
   import { getBomRoutingList } from '@/api/material/list.js';
+  import { saveSupplier, deleteSupplie } from '@/api/material/BOM.js';
   import { getRelatesInformationList } from '@/api/material/product.js';
   import dictMixins from '@/mixins/dictMixins';
   import storage from '@/api/warehouseManagement/index.js';
+  //供应商弹窗
+  import vendorDialog from '@/views/factoryModel/qualificationManagement/components/vendorDialog.vue';
   export default {
     mixins: [dictMixins],
     props: {
@@ -43,6 +88,9 @@
       code: [Number, String],
       categoryLevelGroupId: [Number, String]
     },
+    components: {
+      vendorDialog
+    },
     data() {
       return {
         activeTab: '0',
@@ -163,8 +211,7 @@
             }
           }
         ],
-        supplierColumn:[
-
+        supplierColumn: [
           {
             prop: 'code',
             label: '编码',
@@ -203,7 +250,7 @@
             formatter: (_row, _column, cellValue) => {
               return (
                 (_row.addressName ? _row.addressName.replaceAll(',', '') : '') +
-                 ( _row.address || '')
+                (_row.address || '')
               );
             }
           },
@@ -261,13 +308,13 @@
             formatter: (_row, _column, cellValue) => {
               return this.$util.toDateString(cellValue);
             }
-          },
+          }
         ],
         moduleData: [],
         eqData: [],
         bomData: [],
         pathData: [],
-        supplierData:[]//供应商
+        supplierData: [] //供应商
       };
     },
     watch: {
@@ -288,7 +335,7 @@
           }
         },
         immediate: true
-      },
+      }
     },
     created() {
       this.requestDict('重量单位');
@@ -323,10 +370,31 @@
       // 关联供应商
       async contactQueryByCategoryIdsAPI() {
         const data = await storage.contactQueryByCategoryIdsAPI({
-          categoryIds:[this.id]
+          categoryIds: [this.id]
         });
 
-        this.supplierData = data[this.id]||[];
+        this.supplierData = data[this.id] || [];
+      },
+      handParent() {
+        this.$refs.vendorDialogRef.open(
+          this.supplierData.map((item) => item.id)
+        );
+      },
+      success(list) {
+        saveSupplier({
+          productId: this.id,
+          supplierIds: list.map((item) => item.id)
+        }).then((res) => {
+          this.contactQueryByCategoryIdsAPI();
+        });
+      },
+      deleteSupplie(row) {
+        deleteSupplie({
+          productId: this.id,
+          supplierId: row.id
+        }).then((res) => {
+          this.contactQueryByCategoryIdsAPI();
+        });
       }
     }
   };