quwangxin há 2 anos atrás
pai
commit
a667af9e7d

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

+ 11 - 5
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}`);
@@ -10,12 +9,19 @@ export async function getTreeByPid (pid) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
-// 新增物料 
+// 新增物料
 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;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 编辑物料
+export async function editMaterial (data) {
+  const res = await request.post(`/main/category/edit`, 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 {

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

@@ -0,0 +1,129 @@
+<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 {
+    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"

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

@@ -0,0 +1,354 @@
+<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: '',
+          files: []
+        },
+        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 @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
+          }
+        });
       }
     }
   };