LAPTOP-16IUEB3P\Lenovo 2 anni fa
parent
commit
571deda6a5

+ 2 - 2
src/api/classifyManage/itemInformation.js

@@ -1,7 +1,7 @@
 import request from '@/utils/request';
 // 物品信息列表
-export async function getList (data) {
-  const res = await request.post('/main/category/getList', data);
+export async function getList (params) {
+  const res = await request.get('/main/category/getList', { params });
   if (res.data.code == 0) {
     return res.data.data;
   }

+ 2 - 3
src/api/material/manage.js

@@ -1,6 +1,5 @@
 import request from '@/utils/request';
 
-
 // 根据分类组编码查询分类树信息
 export async function getTreeByPid (pid) {
   const res = await request.get(`/main/categoryLevel/getTreeByPid/${pid}`);
@@ -13,7 +12,7 @@ export async function getTreeByPid (pid) {
 
 // 新增物料
 export async function addMaterial (data) {
-  const res = await request.post(`/main/category/add`,data);
+  const res = await request.post(`/main/category/add`, data);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -57,4 +56,4 @@ export async function removeMaterial (id) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}

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

+ 0 - 1
src/components/CommomSelect/person-select.vue

@@ -66,7 +66,6 @@
           data = Object.assign(data, params);
         }
         const res = await getUserPage(data);
-        this.selectVal = '';
         this.dictList = res.list;
       }
     }

+ 1 - 1
src/components/header-title/index.vue

@@ -35,7 +35,7 @@
 
     .title {
       display: flex;
-      align-items: center;
+      align-items: flex-end;
       justify-content: space-between;
       margin-bottom: 10px;
       .left {

+ 0 - 5
src/views/material/manage/components/CategoryDialog.vue

@@ -47,11 +47,6 @@ export default {
     open(pid,title){
       this.treeVisible = true
       this.title = title
-      // if(title=='选择产品分类'){
-      //   if(this.remarkform.productCategoryLevelId) this.$refs.tree.setCurrentKey(this.remarkform.productCategoryLevelId)
-      // }else{
-      //   if(this.remarkform.categoryLevelId) this.$refs.tree.setCurrentKey(this.remarkform.categoryLevelId)
-      // }
       this.getTree(pid)
     },
     handleClose () {

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

+ 2 - 2
src/views/material/manage/manageMaterial.vue

@@ -288,11 +288,11 @@
          if(title=='选择产品分类'){
             this.$set(this.form,'productCategoryLevelName',node.name)
             this.$set(this.form,'productCategoryLevelId',node.id)
-            this.remarkform.productCategoryLevelId = node.id
+            this.remarkform.productNode = node
          }else{
             this.$set(this.form,'categoryLevelName',node.name)
             this.$set(this.form,'categoryLevelId',node.id)
-            this.remarkform.categoryLevelId = node.id
+            this.remarkform.categoryNode = node
             this.PathInfo = PathInfo
          }
       },

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

@@ -0,0 +1,135 @@
+<template>
+  <div class="link-msg">
+    <headerTitle title="关联信息"></headerTitle>
+    <el-tabs v-model="activeTab">
+      <el-tab-pane label="可用模具">
+        <ele-pro-table :columns="moduleColumn" :datasource="[]">
+        </ele-pro-table>
+      </el-tab-pane>
+      <el-tab-pane label="BOM">
+        <ele-pro-table :columns="BOMColumn" :datasource="[]"> </ele-pro-table
+      ></el-tab-pane>
+      <el-tab-pane label="工艺路线">
+        <ele-pro-table :columns="pathColumn" :datasource="[]"> </ele-pro-table
+      ></el-tab-pane>
+      <el-tab-pane label="质量标准"></el-tab-pane>
+      <el-tab-pane label="文件">
+        <ele-pro-table :columns="fileColumn" :datasource="[]"> </ele-pro-table
+      ></el-tab-pane>
+      <el-tab-pane label="关联设备">
+        <ele-pro-table :columns="equiColumn" :datasource="[]"> </ele-pro-table
+      ></el-tab-pane>
+    </el-tabs>
+  </div>
+</template>
+
+<script>
+  export default {
+    props: {
+      form: {
+        type: Object,
+        default: {}
+      }
+    },
+    data () {
+      return {
+        activeTab: '0',
+        moduleColumn: [
+          {
+            type: 'index',
+            label: '序号',
+            width: '55px',
+            align: 'center'
+          },
+          {
+            label: '编码'
+          },
+          {
+            label: '名称'
+          },
+          {
+            label: '牌号'
+          },
+          {
+            label: '型号'
+          },
+          {
+            label: '收缩系数'
+          },
+          {
+            label: '大模体型号'
+          },
+          {
+            label: '物品类型'
+          },
+          {
+            label: '分类'
+          }
+        ],
+        BOMColumn: [
+          {
+            label: 'BOM编码'
+          },
+          {
+            label: 'BOM名称'
+          },
+          {
+            label: '版本号'
+          },
+          {
+            label: '基本数量'
+          },
+          {
+            label: '单位'
+          }
+        ],
+        pathColumn: [
+          {
+            label: '工艺路线组编码'
+          },
+          {
+            label: '工艺路线名称'
+          },
+          {
+            label: '生产版本'
+          },
+          {
+            label: '工艺路线版本'
+          }
+        ],
+        fileColumn: [
+          {
+            label: '文件编码'
+          },
+          {
+            label: '文件名称'
+          }
+        ],
+        equiColumn: [
+          {
+            type: 'selection'
+          },
+          {
+            label: '设备分类'
+          },
+          {
+            label: '设备编码'
+          },
+          {
+            label: '设备名称'
+          },
+          {
+            label: '产能'
+          }
+        ]
+      };
+    }
+  };
+</script>
+<style lang="scss" scoped>
+  .link-msg {
+    background: #fff;
+
+    padding: 1px 17px;
+  }
+</style>

+ 1 - 1
src/views/material/product/components/product-search.vue

@@ -28,7 +28,7 @@
         </el-form-item>
       </el-col>
       <el-col v-bind="styleResponsive ? { md: 4 } : { span: 4 }">
-        <div class="ele-form-actions" v-show="false">
+        <div class="ele-form-actions">
           <el-button
             type="primary"
             icon="el-icon-search"

+ 352 - 0
src/views/material/product/detail.vue

@@ -0,0 +1,352 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never">
+      <el-form
+        label-width="120px"
+        ref="manageForm"
+        :model="form"
+        :rules="rules"
+      >
+        <headerTitle title="基本信息">
+          <el-button @click="cancel">返回</el-button>
+          <el-button type="primary" @click="submit" :loading="loading"
+            >保存</el-button
+          ></headerTitle
+        >
+        <!-- <div class="divider">
+          <div class="title">
+            <div class="ele-bg-primary"></div>
+            <span>基本信息</span>
+          </div>
+          <div class="ele-bg-primary ele-width"></div>
+        </div> -->
+        <el-row :gutter="24">
+          <el-col :span="8">
+            <el-form-item label="编码" prop="code">
+              <el-input v-model="form.code" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="名称" prop="name">
+              <el-input v-model="form.name" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="分类" prop="categoryLevelName">
+              <el-input
+                v-model="form.categoryLevelName"
+                @click.native="openCategory"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="牌号" prop="brandNum">
+              <el-input v-model="form.brandNum" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="规格" prop="specification">
+              <el-input v-model="form.specification" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="型号" prop="modelType">
+              <el-input v-model="form.modelType" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="计量单位" prop="measuringUnit">
+              <DictSelection
+                dictName="计量单位"
+                clearable
+                v-model="form.measuringUnit"
+              >
+              </DictSelection>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="包装单位" prop="packingUnit">
+              <DictSelection
+                dictName="包装单位"
+                clearable
+                v-model="form.packingUnit"
+              >
+              </DictSelection>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="体积">
+              <div class="form-line">
+                <el-input v-model="form.volume" />
+                <DictSelection
+                  class="line-select"
+                  dictName="体积单位"
+                  clearable
+                  v-model="form.volumeUnit"
+                >
+                </DictSelection>
+              </div>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="毛重">
+              <div class="form-line">
+                <el-input v-model="form.roughWeight" />
+                <DictSelection
+                  class="line-select"
+                  dictName="重量单位"
+                  clearable
+                  v-model="form.roughWeightUnit"
+                >
+                </DictSelection>
+              </div>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="净重">
+              <div class="form-line">
+                <el-input v-model="form.netWeight" />
+                <DictSelection
+                  class="line-select"
+                  dictName="重量单位"
+                  clearable
+                  v-model="form.netWeightUnit"
+                >
+                </DictSelection>
+              </div>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="所属部门">
+              <deptSelect
+                v-model="form.deptLeaderId"
+                @changeGroup="searchDeptNodeClick"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="负责人">
+              <personSelect
+                ref="directorRef"
+                v-model="form.deptId"
+                @selfChange="handleDirectorChange"
+                :init="false"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+    </el-card>
+
+    <!-- 分类选择弹窗 -->
+    <CategoryDialog ref="categoryRefs" @chooseCategory="confirmCategory" />
+    <!-- 仓储配置 -->
+    <WarehouseInfo ref="warehouseRefs" :form="form" />
+    <!-- 采购 -->
+    <ProcureInfo ref="procureRefs" :form="form" />
+    <!-- 生产信息 -->
+    <ProductionInfo ref="productionRefs" :form="form" />
+    <!-- 计划 -->
+    <PlanInfo ref="planRefs" :form="form" />
+    <!-- 销售信息 -->
+    <SalesInfo ref="salesRefs" :form="form" />
+    <!-- 质量配置 -->
+    <QualityInfo ref="qualityRefs" :form="form" />
+    <!-- 舟皿信息 -->
+    <BoatInfo ref="qualityRefs" :form="form" />
+    <!-- 周转车信息 -->
+    <TurnoverInfo ref="turnoverRefs" :form="form" />
+    <!-- 模具信息 -->
+    <MoldInfo ref="moldRefs" :form="form" />
+    <!-- 备注信息 -->
+    <RemarkInfo ref="remarkRefs" :form="remarkform" />
+    <!-- 关联信息 -->
+    <linkMsg ref="linkMsgRef" :form="form" />
+  </div>
+</template>
+
+<script>
+  import GroupDialog from '../manage/components/GroupDialog.vue';
+  import CategoryDialog from '../manage/components/CategoryDialog.vue';
+  import WarehouseInfo from '../manage/components/WarehouseInfo.vue';
+  import ProcureInfo from '../manage/components/ProcureInfo.vue';
+  import ProductionInfo from '../manage/components/ProductionInfo.vue';
+  import PlanInfo from '../manage/components/PlanInfo.vue';
+  import SalesInfo from '../manage/components/SalesInfo.vue';
+  import QualityInfo from '../manage/components/QualityInfo.vue';
+  import BoatInfo from '../manage/components/BoatInfo.vue';
+  import TurnoverInfo from '../manage/components/TurnoverInfo.vue';
+  import MoldInfo from '../manage/components/MoldInfo.vue';
+  import RemarkInfo from '../manage/components/RemarkInfo.vue';
+  import deptSelect from '@/components/CommomSelect/dept-select.vue';
+  import personSelect from '@/components/CommomSelect/person-select.vue';
+  import linkMsg from './components/link-msg.vue';
+  import { getDetails } from '@/api/classifyManage/itemInformation';
+  import { editMaterial } from '@/api/material/manage.js';
+  export default {
+    name: 'ManageMaterial',
+    components: {
+      linkMsg,
+      GroupDialog,
+      deptSelect,
+      personSelect,
+      WarehouseInfo,
+      ProcureInfo,
+      ProductionInfo,
+      PlanInfo,
+      SalesInfo,
+      QualityInfo,
+      BoatInfo,
+      TurnoverInfo,
+      MoldInfo,
+      RemarkInfo,
+      CategoryDialog
+    },
+    data () {
+      return {
+        loading: false,
+        form: {
+          categoryLevelGroupName: '',
+          categoryLevelName: ''
+        },
+        remarkform: {},
+        // 表单验证规则
+        rules: {
+          categoryLevelGroupName: [
+            { required: true, message: '请选择所属物料组', trigger: 'change' }
+          ],
+          code: [{ required: true, message: '请输入编码', trigger: 'blur' }],
+          name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
+          categoryLevelName: [
+            { required: true, message: '请选择所属分类', trigger: 'change' }
+          ],
+          measuringUnit: [
+            { required: true, message: '请选择计量单位', trigger: 'change' }
+          ]
+        }
+      };
+    },
+    created () {
+      this._getDetails();
+    },
+    methods: {
+      async _getDetails () {
+        const data = await getDetails(this.$route.query.id);
+        this.form = data;
+
+        this.searchDeptNodeClick(this.form.deptLeaderId);
+      },
+      // 选择所属部门
+      searchDeptNodeClick (id, info) {
+        // 根据部门获取人员
+        const params = { executeGroupId: id };
+        this.$nextTick(() => {
+          this.$refs.directorRef.getList(params);
+        });
+      },
+      //选择负责人
+      handleDirectorChange (id, info) {},
+      // 确定分类
+      confirmCategory (node, title) {
+        if (title == '选择产品分类') {
+          this.$set(this.form, 'productCategoryLevelName', node.name);
+          this.$set(this.form, 'productCategoryLevelId', node.id);
+        } else {
+          this.$set(this.form, 'categoryLevelName', node.name);
+          this.$set(this.form, 'categoryLevelId', node.id);
+          this.$set(this.form, 'categoryLevelPath', node.name);
+          this.$set(this.form, 'categoryLevelPathId', node.id);
+        }
+      },
+      openCategory () {
+        this.$refs.categoryRefs.open(this.form.categoryLevelGroupId);
+      },
+      cancel () {
+        this.$router.go(-1);
+      },
+
+      // 保存
+      submit () {
+        this.$refs.manageForm.validate((valid) => {
+          if (!valid) {
+            return false;
+          }
+          this.loading = true;
+          const imgList = this.remarkform.imgList;
+          const arr = [];
+          if (imgList.length) {
+            imgList.map((item) => {
+              arr.push(item.storePath);
+            });
+            this.form.remarkAttach = arr.join(',');
+          }
+          this.form.remark = this.remarkform.remark
+            ? this.remarkform.remark
+            : '';
+          const data = {
+            ...this.form
+          };
+          editMaterial(data)
+            .then((msg) => {
+              this.loading = false;
+              this.$message.success(msg);
+              this.updateVisible(false);
+              this.$emit('done');
+            })
+            .catch((e) => {
+              this.loading = false;
+            });
+        });
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .ele-page-header {
+    border: none;
+  }
+  .body-top {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    background: #fff;
+    .top-left {
+      display: flex;
+      align-items: center;
+      justify-content: flex-start;
+      margin-left: -25px;
+      .el-form-item {
+        margin-bottom: 0;
+      }
+    }
+  }
+  .divider {
+    margin: 20px 0;
+    .title {
+      display: flex;
+      align-items: center;
+      margin-bottom: 10px;
+      div {
+        width: 8px;
+        height: 20px;
+        margin-right: 10px;
+      }
+      span {
+        font-size: 20px;
+      }
+    }
+    .ele-width {
+      width: 100%;
+      height: 2px;
+    }
+  }
+  .form-line {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    .line-select {
+      margin-left: 15px;
+    }
+  }
+</style>

+ 21 - 25
src/views/material/product/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,14 +22,11 @@
             :datasource="datasource"
             height="calc(100vh - 350px)"
             :need-page="false"
-            :current.sync="current"
-            highlight-current-row
             class="dict-table"
-            tool-class="ele-toolbar-actions"
           >
             <!-- 表头工具栏 -->
-            <template v-slot:action>
-              <el-link>编辑</el-link>
+            <template v-slot:action="{ row }">
+              <el-link type="primary" @click="handleEdit(row)">编辑</el-link>
             </template>
           </ele-pro-table>
         </template>
@@ -84,12 +85,7 @@
             label: '操作'
           }
         ],
-        // 当前编辑数据
-        current: null,
-        // 是否显示编辑弹窗
-        showEdit: false,
-        // 编辑回显数据
-        editData: null
+        categoryLevelId: ''
       };
     },
 
@@ -97,27 +93,27 @@
       /* 表格数据源 */
       datasource ({ page, where, limit }) {
         return getList({
-          ...this.where,
+          ...where,
           pageNum: page,
           size: limit,
-          categoryLevelGroupId: 9
+          categoryLevelId: 9
         });
       },
-      /* 表格渲染完成回调 */
-      done (res) {
-        if (res.data?.length) {
-          this.$refs.table.setCurrentRow(res.data[0]);
-        }
+      handleNodeClick (data) {
+        this.categoryLevelId = data.id;
+        this.reload();
       },
       /* 刷新表格 */
-      reload (where) {
+      reload () {
         this.$refs.table.reload();
-        this.$refs.dictData.reload(where);
       },
-      /* 显示编辑 */
-      openEdit (row) {
-        this.editData = row;
-        this.showEdit = true;
+      handleEdit ({ id }) {
+        this.$router.push({
+          path: '/material/product/detail',
+          query: {
+            id
+          }
+        });
       }
     }
   };

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