quwangxin 2 лет назад
Родитель
Сommit
667e292e3c

+ 29 - 0
src/api/material/product.js

@@ -0,0 +1,29 @@
+import request from '@/utils/request';
+
+// 产品关联物料
+export async function productTieUpMaterial (data) {
+  const res = await request.post(`/main/category/productTieUpMaterial`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 查询产品已关联物料信息
+export async function getRelatesInformationList (data) {
+  const res = await request.post(
+    `/main/category/getRelatesInformationList`,
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 查询未关联产品物料信息
+export async function unassociated (data) {
+  const res = await request.post(`/main/category/unassociated`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 11 - 15
src/views/material/manage/components/RemarkInfo.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="other">
-      <el-form label-width="120px"  ref="form" :model="form">
+    <!-- <el-form label-width="120px"  ref="form" :model="form">
          <div class="divider">
            <div class="title">
              <div class="ele-bg-primary"></div>
@@ -20,7 +20,7 @@
              </el-form-item>
            </el-col>
          </el-row>
-      </el-form>
+      </el-form> -->
   </div>
 </template>
 
@@ -33,20 +33,16 @@
         default: {}
       }
     },
-    components: { fileUpload  },
-    data() {
-      return {
-      };
+    components: { fileUpload },
+    data () {
+      return {};
     },
-    methods: {
-
-
-    }
+    methods: {}
   };
 </script>
 
 <style lang="scss" scoped>
-  .other{
+  .other {
     background: #fff;
     padding: 1px 17px;
   }
@@ -65,17 +61,17 @@
         font-size: 20px;
       }
     }
-    .ele-width{
+    .ele-width {
       width: 100%;
       height: 2px;
     }
   }
-  .form-line{
+  .form-line {
     display: flex;
     align-items: center;
     justify-content: space-between;
-    .line-select{
-      margin-left:15px;
+    .line-select {
+      margin-left: 15px;
     }
   }
 </style>

+ 6 - 0
src/views/material/product/components/link-msg.vue

@@ -25,6 +25,12 @@
 
 <script>
   export default {
+    props: {
+      form: {
+        type: Object,
+        default: {}
+      }
+    },
     data () {
       return {
         activeTab: '0',

+ 1 - 3
src/views/material/product/detail.vue

@@ -207,8 +207,7 @@
         loading: false,
         form: {
           categoryLevelGroupName: '',
-          categoryLevelName: '',
-          files: []
+          categoryLevelName: ''
         },
         remarkform: {},
         // 表单验证规则
@@ -233,7 +232,6 @@
     methods: {
       async _getDetails () {
         const data = await getDetails(this.$route.query.id);
-
         this.form = data;
 
         this.searchDeptNodeClick(this.form.deptLeaderId);

+ 1 - 1
src/views/material/product/index.vue

@@ -26,7 +26,7 @@
           >
             <!-- 表头工具栏 -->
             <template v-slot:action="{ row }">
-              <el-link @click="handleEdit(row)">编辑</el-link>
+              <el-link type="primary" @click="handleEdit(row)">编辑</el-link>
             </template>
           </ele-pro-table>
         </template>

+ 118 - 43
src/views/material/productLinkMaterial/components/link-material-dialog.vue

@@ -6,37 +6,54 @@
           <template v-slot:title>
             可选
             <el-button type="primary" class="ml20" size="mini">关联</el-button>
-            <el-button type="primary" size="mini" icon="icon-search"
+            <el-button
+              type="primary"
+              size="mini"
+              icon="icon-search"
+              @click="reload"
               >搜索</el-button
             >
           </template>
         </headerTitle>
-        <el-form label-width="60px">
+        <el-form label-width="100px">
           <el-row>
             <el-col :span="12">
-              <el-form-item label="分类">
-                <el-input placeholder="请输入"></el-input> </el-form-item
+              <el-form-item :label="`${catogaryName}分类`">
+                <el-input
+                  placeholder="请输入"
+                  v-model="where.categoryLevelRootId"
+                ></el-input> </el-form-item
             ></el-col>
             <el-col :span="12">
-              <el-form-item label="编码">
-                <el-input placeholder="请输入"></el-input></el-form-item
+              <el-form-item :label="`${catogaryName}编码`">
+                <el-input
+                  placeholder="请输入"
+                  v-model="where.code"
+                ></el-input></el-form-item
             ></el-col>
             <el-col :span="12">
-              <el-form-item label="名称">
-                <el-input placeholder="请输入"></el-input></el-form-item
+              <el-form-item :label="`${catogaryName}名称`">
+                <el-input
+                  placeholder="请输入"
+                  v-model="where.name"
+                ></el-input></el-form-item
             ></el-col>
             <el-col :span="12">
               <el-form-item label="型号">
-                <el-input placeholder="请输入"></el-input></el-form-item
+                <el-input
+                  placeholder="请输入"
+                  v-model="where.modelType"
+                ></el-input></el-form-item
             ></el-col>
           </el-row>
         </el-form>
         <ele-pro-table
-          ref="tableRight"
+          ref="table"
           :columns="columns"
-          :datasource="[]"
+          :datasource="datasource"
           cache-key="link-material-dialog"
           height="45vh"
+          :initLoad="false"
           :need-page="false"
         >
         </ele-pro-table>
@@ -48,36 +65,53 @@
             <el-button type="primary" class="ml20" size="mini"
               >取消关联</el-button
             >
-            <el-button type="primary" size="mini" icon="icon-search"
+            <el-button
+              type="primary"
+              size="mini"
+              icon="icon-search"
+              @click="reloadRight"
               >搜索</el-button
             ></template
           ></headerTitle
         >
-        <el-form label-width="60px">
+        <el-form label-width="100px">
           <el-row>
             <el-col :span="12">
-              <el-form-item label="分类">
-                <el-input placeholder="请输入"></el-input> </el-form-item
+              <el-form-item :label="`${catogaryName}分类`">
+                <el-input
+                  placeholder="请输入"
+                  v-model="whereRight.categoryLevelRootId"
+                ></el-input> </el-form-item
             ></el-col>
             <el-col :span="12">
-              <el-form-item label="编码">
-                <el-input placeholder="请输入"></el-input></el-form-item
+              <el-form-item :label="`${catogaryName}编码`">
+                <el-input
+                  placeholder="请输入"
+                  v-model="whereRight.code"
+                ></el-input></el-form-item
             ></el-col>
             <el-col :span="12">
-              <el-form-item label="名称">
-                <el-input placeholder="请输入"></el-input></el-form-item
+              <el-form-item :label="`${catogaryName}名称`">
+                <el-input
+                  placeholder="请输入"
+                  v-model="whereRight.name"
+                ></el-input></el-form-item
             ></el-col>
             <el-col :span="12">
               <el-form-item label="型号">
-                <el-input placeholder="请输入"></el-input></el-form-item
+                <el-input
+                  placeholder="请输入"
+                  v-model="whereRight.modelType"
+                ></el-input></el-form-item
             ></el-col>
           </el-row>
         </el-form>
         <ele-pro-table
-          ref="table"
+          ref="tableRight"
           :columns="columnsRight"
-          :datasource="[]"
+          :datasource="datasourceRight"
           height="45vh"
+          :initLoad="false"
           :need-page="false"
           cache-key="link-material-dialog-right"
         >
@@ -93,41 +127,64 @@
 </template>
 
 <script>
+  import {
+    getRelatesInformationList,
+    unassociated,
+    productTieUpMaterial
+  } from '@/api/material/product.js';
+  import dictMixins from '@/mixins/dictMixins';
   export default {
+    mixins: [dictMixins],
     data () {
       return {
         visible: false,
-        columns: [
+        row: {},
+        whereRight: {},
+        where: {},
+        type: ''
+      };
+    },
+    created () {
+      this.requestDict('类型用途');
+    },
+    computed: {
+      catogaryName () {
+        return this.getDictValue('类型用途', this.type);
+      },
+      columns () {
+        return [
           {
             type: 'selection',
             align: 'center'
           },
           {
-            label: '设备分类'
+            label: `${this.catogaryName}分类`
           },
           {
-            label: '设备编码'
+            label: `${this.catogaryName}编码`
           },
           {
-            label: '设备名称'
+            label: `${this.catogaryName}名称`
           },
           {
             label: '型号'
           }
-        ],
-        columnsRight: [
+        ];
+      },
+      columnsRight () {
+        return [
           {
             type: 'selection',
             align: 'center'
           },
           {
-            label: '设备分类'
+            label: `${this.catogaryName}分类`
           },
           {
-            label: '设备编码'
+            label: `${this.catogaryName}编码`
           },
           {
-            label: '设备名称'
+            label: `${this.catogaryName}名称`
           },
           {
             label: '型号'
@@ -135,27 +192,45 @@
           {
             label: '产能'
           }
-        ],
-        row: {}
-      };
+        ];
+      }
     },
     methods: {
       open (type, row) {
+        this.type = type;
         this.row = row;
-        switch (type) {
-          case 1:
-            break;
-
-          default:
-            break;
-        }
-
+        this.$nextTick(() => {
+          this.$refs.table.reload();
+          this.$refs.tableRight.reload();
+        });
         this.visible = true;
       },
       cancel () {
         this.visible = false;
       },
-      save () {}
+      save () {},
+      reload () {
+        this.$refs.table.reload();
+      },
+      reloadRight () {
+        this.$refs.tableRight.reload();
+      },
+      datasource ({ where }) {
+        return getRelatesInformationList({
+          ...where,
+          mainCategoryId: this.row.categoryLevelId
+        });
+      },
+      datasourceRight ({ where }) {
+        return unassociated({
+          ...where,
+          mainCategoryId: this.row.categoryLevelId
+        });
+      },
+      async _productTieUpMaterial () {
+        const data = await productTieUpMaterial();
+        console.log(data);
+      }
     }
   };
 </script>

+ 34 - 74
src/views/material/productLinkMaterial/index.vue

@@ -8,7 +8,11 @@
         :right-style="{ overflow: 'hidden' }"
       >
         <div class="ele-border-lighter split-layout-right-content">
-          <AssetTree ref="assetTreeRef" id="9" />
+          <AssetTree
+            ref="assetTreeRef"
+            id="9"
+            @handleNodeClick="handleNodeClick"
+          />
         </div>
         <!-- 表格 -->
         <template v-slot:content>
@@ -18,6 +22,7 @@
             :datasource="datasource"
             height="calc(100vh - 350px)"
             :need-page="false"
+            :initLoad="false"
             :current.sync="current"
             highlight-current-row
             class="dict-table"
@@ -25,19 +30,16 @@
           >
             <!-- 表头工具栏 -->
             <template v-slot:toolbar>
-              <el-button type="primary" @click="handleLink(1)"
+              <el-button type="primary" @click="handleLink('4')"
                 >关联设备</el-button
               >
-              <el-button type="primary" @click="handleLink(2)"
+              <el-button type="primary" @click="handleLink('5')"
                 >关联模具</el-button
               >
-              <el-button type="primary" @click="handleLink(3)"
+              <el-button type="primary" @click="handleLink('8')"
                 >关联舟皿</el-button
               >
             </template>
-            <template v-slot:action>
-              <el-link>编辑</el-link>
-            </template>
           </ele-pro-table>
         </template>
       </ele-split-layout>
@@ -50,7 +52,7 @@
   import AssetTree from '@/components/AssetTree';
   import ProductSearch from './components/product-search.vue';
   import linkMaterialDialog from './components/link-material-dialog.vue';
-  import { listDictionaries, removeDictionary } from '@/api/system/dictionary';
+  import { getList } from '@/api/classifyManage/itemInformation';
 
   export default {
     name: 'SystemDictionary',
@@ -64,12 +66,11 @@
             type: 'index',
             width: 45,
             align: 'center',
-            showOverflowTooltip: true
+            reserveSelection: true
           },
           {
-            prop: 'name',
-            label: '产品编码',
-            showOverflowTooltip: true
+            prop: 'code',
+            label: '产品编码'
           },
           {
             prop: 'name',
@@ -77,48 +78,38 @@
             showOverflowTooltip: true
           },
           {
-            prop: 'name',
-            label: '牌号',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'name',
-            label: '型号',
-            showOverflowTooltip: true
+            prop: 'brandNum',
+            label: '牌号'
           },
           {
-            prop: 'name',
-            label: '计量单位',
-            showOverflowTooltip: true
+            prop: 'modelType',
+            label: '型号'
           },
           {
-            prop: 'name',
-            label: '包装单位',
-            showOverflowTooltip: true
+            prop: 'measuringUnit',
+            label: '计量单位'
           },
           {
-            action: 'action',
-            slot: 'action',
-            label: '操作'
+            prop: 'packingUnit',
+            label: '包装单位'
           }
         ],
-        // 当前编辑数据
-        current: null,
-        // 是否显示编辑弹窗
-        showEdit: false,
-        // 编辑回显数据
-        editData: null
+        categoryLevelId: '9',
+        current: null
       };
     },
 
     methods: {
       /* 表格数据源 */
-      datasource () {
-        // return;
-        return listDictionaries();
+      datasource ({ page, where, limit }) {
+        return getList({
+          ...where,
+          pageNum: page,
+          size: limit,
+          categoryLevelId: this.categoryLevelId
+        });
       },
       handleLink (type) {
-        console.log(this.current, 'handleLink');
         if (!this.current) {
           return this.$message.error('请选择产品!');
         }
@@ -126,43 +117,12 @@
         this.$refs.linkMaterialDialogRef.open(type, this.current);
       },
       /* 刷新表格 */
-      reload (where) {
+      reload () {
         this.$refs.table.reload();
-        this.$refs.dictData.reload(where);
       },
-      /* 显示编辑 */
-      openEdit (row) {
-        this.editData = row;
-        this.showEdit = true;
-      },
-      /* 删除 */
-      remove () {
-        this.$confirm('确定要删除选中的字典吗?', '提示', {
-          type: 'warning'
-        })
-          .then(() => {
-            if (this.$refs.dictData.selection.length == 0) {
-              this.$message({
-                message: '当前未选择数据',
-                type: 'error'
-              });
-              return;
-            }
-            let ids = this.$refs.dictData.selection.map((item) => item.id);
-            const loading = this.$loading({ lock: true });
-
-            removeDictionary(ids, true)
-              .then((msg) => {
-                loading.close();
-                this.$message.success(msg);
-                this.reload();
-              })
-              .catch((e) => {
-                loading.close();
-                // this.$message.error(e.message);
-              });
-          })
-          .catch(() => {});
+      handleNodeClick (data) {
+        this.categoryLevelId = data.id;
+        this.reload();
       }
     }
   };