ysy 2 年 前
コミット
5b5ed4dfc7

+ 326 - 0
src/views/material/product/components/MaterialModal.vue

@@ -0,0 +1,326 @@
+
+<template>
+    <ele-modal width="1160px" :visible="visible" v-if="visible" :append-to-body="true" :close-on-click-modal="true"
+      custom-class="ele-dialog-form" title="选择物料" @update:visible="updateVisible">
+      <header-title title="基本信息"></header-title>
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
+        <el-row>
+  
+          <el-col :span="8">
+            <el-form-item label="产品名称:" prop="name">
+              <el-input disabled v-model="form.name" readonly />
+            </el-form-item>
+          </el-col>
+  
+          <el-col :span="8">
+            <el-form-item label="产品编码:" prop="code">
+              <el-input disabled v-model="form.code" placeholder="自动带入" />
+            </el-form-item>
+          </el-col>
+  
+  
+  
+  
+          <el-col :span="8">
+            <el-form-item label="型号:" prop="modelType">
+              <el-input disabled v-model="form.modelType" placeholder="自动带入" />
+            </el-form-item>
+          </el-col>
+  
+          <el-col :span="8">
+            <el-form-item label="牌号:" prop="brandNum">
+              <el-input disabled v-model="form.brandNum" placeholder="自动带入" />
+            </el-form-item>
+          </el-col>
+  
+  
+          <el-col :span="8">
+            <el-form-item label="规格:" prop="specification">
+              <el-input disabled v-model="form.specification" placeholder="自动带入" />
+            </el-form-item>
+          </el-col>
+  
+  
+          <el-col :span="8">
+            <el-form-item label="计量单位:" prop="measuringUnit" >
+              
+              <el-input disabled v-model="form.measuringUnit" placeholder="自动带入" />
+            </el-form-item>
+          </el-col>
+  
+  
+
+
+  
+  
+
+
+  
+  
+        </el-row>
+  
+  
+        <header-title title="物料BOM"></header-title>
+  
+        <el-row>
+  
+          <div class="ele-body">
+            <ele-pro-table ref="table" :datasource="datasource" :columns="columns">
+              <!-- 表头工具栏 -->
+              <template v-slot:toolbar>
+  
+                <el-button size="small" icon="el-icon-plus" class="ele-btn-icon" type="primary"
+                  @click.native="openParam">添加物料BOM</el-button>
+  
+              </template>
+  
+  
+  
+              <!-- 操作列 -->
+              <template v-slot:action="{ row }">
+                <el-popconfirm class="ele-action" title="确定要删除当前物料吗?" @confirm="remove(row)">
+                  <template v-slot:reference>
+                    <el-link type="danger" :underline="false" icon="el-icon-delete">
+                      删除
+                    </el-link>
+                  </template>
+                </el-popconfirm>
+              </template>
+            </ele-pro-table>
+          </div>
+  
+        </el-row>
+  
+  
+
+  
+  
+  
+  
+      </el-form>
+  
+  
+  
+  
+      <template v-slot:footer>
+        <el-button @click="updateVisible(false)">取消</el-button>
+        <el-button type="primary" :loading="loading" @click="save">
+          保存
+        </el-button>
+      </template>
+  
+  
+      <!-- 选择物料弹窗 -->
+      <ProductModal ref="productRefs" @changeProduct='determineChoose' />
+  
+
+  
+
+  
+    </ele-modal>
+  </template>
+  
+  <script>
+  import parameter from '@/api/technology/productParam';
+  import ProductModal from '@/views/technology/productParam/components/ProductModal.vue';
+
+
+  
+  import {  pageList } from '@/api/technology/version/version.js';
+  export default {
+    components: {
+        ProductModal,
+
+    },
+    props: {
+      // 弹窗是否打开
+      visible: Boolean,
+      // 修改回显的数据
+      data: Object
+    },
+    data() {
+      const defaultForm = {
+        id: null,
+        name: '',
+        code: '',
+        modelType: '',
+        brandNum: '',
+        specification: '',
+        measuringUnit: ''
+  
+  
+      };
+      return {
+        defaultForm,
+        // 表单数据
+        form: { ...defaultForm },
+  
+        versionList: [],
+  
+  
+  
+        // 表单验证规则
+        rules: {
+          categoryName: [
+            { required: true, message: '请输入产品名称', trigger: 'blur' }
+          ],
+      
+  
+  
+        },
+        // 提交状态
+        loading: false,
+
+
+        removeList: [],
+  
+        // 表格列配置
+        columns: [
+          {
+            prop: 'code',
+            label: '参数编码',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            prop: 'name',
+            label: '参数名称',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            align: 'center',
+            prop: 'description',
+            label: '文本描述',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+  
+          {
+            prop: 'maxValue',
+            slot: 'maxValue',
+            label: '参数上限',
+            align: 'center',
+  
+          },
+          {
+            prop: 'minValue',
+            slot: 'minValue',
+            label: '参数下限',
+            align: 'center',
+  
+          },
+          {
+            prop: 'defaultValue',
+            slot: 'defaultValue',
+            label: '默认值',
+            align: 'center',
+  
+          },
+  
+          {
+            prop: 'unitName',
+            slot: 'unitName',
+            label: '参数单位',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+  
+  
+          {
+            columnKey: 'action',
+            label: '操作',
+  
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ],
+  
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    methods: {
+  
+  
+      chooseProduct() {
+        this.$refs.productRefs.open(this.form, '选择产品', '9')
+      },
+  
+  
+      chooseMolding() {
+        this.$refs.productRefs.open(this.form, '选择舟皿', '8')
+      },
+  
+      determineChoose(title, row) {
+
+  
+      },
+  
+
+  
+      /* 表格数据源 */
+      datasource({ page, limit, where }) {
+       return []
+      },
+  
+
+  
+      /* 保存编辑 */
+      save() {
+        this.$refs.form.validate((valid) => {
+  
+          if (!valid) {
+            return false;
+          }
+          this.loading = true;
+
+  
+  
+
+  
+        });
+      },
+      /* 更新visible */
+      updateVisible(value) {
+        this.$emit('update:visible', value);
+      },
+
+   
+    },
+  
+    watch: {
+      async visible(visible) {
+        if (visible) {
+
+  
+          if (this.data) {
+           console.log(this.data)
+  
+            this.$util.assignObject(this.form, {
+              ...this.data
+            });
+
+          } else {
+  
+
+          }
+  
+  
+        } else {
+          this.$refs.form.clearValidate();
+          this.form = { ...this.defaultForm };
+        }
+      }
+    }
+  };
+  </script>
+  

+ 194 - 199
src/views/material/product/components/index-data.vue

@@ -1,232 +1,227 @@
 <template>
   <div>
     <!-- 数据表格 -->
-    <ele-pro-table
-      ref="table"
-      :columns="columns"
-      :datasource="datasource"
-      :need-page="true"
-      :selection.sync="selection"
-      height="calc(100vh - 412px)"
-      full-height="calc(100vh - 116px)"
-      tool-class="ele-toolbar-form"
-      cache-key="systemDictDataTable"
-    >
+    <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :need-page="true" :selection.sync="selection"
+      height="calc(100vh - 412px)" full-height="calc(100vh - 116px)" tool-class="ele-toolbar-form"
+      cache-key="systemDictDataTable">
       <!-- 表头工具栏 -->
       <template v-slot:toolbar>
-        <el-button
-          size="small"
-          type="primary"
-          icon="el-icon-plus"
-          class="ele-btn-icon"
-          @click="openEdit({}, 2)"
-        >
+        <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon" @click="openEdit({}, 2)">
           新建
         </el-button>
       </template>
       <template v-slot:action="{ row }">
-        <el-link
-          type="primary"
-          :underline="false"
-          icon="el-icon-copy-document"
-          @click="openEdit(row, 1)"
-        >
+        <el-link type="primary" :underline="false" icon="el-icon-copy-document" @click="openEdit(row, 1)">
           复制
         </el-link>
-        <el-link
-          type="primary"
-          :underline="false"
-          icon="el-icon-edit"
-          @click="openEdit(row, 0)"
-        >
+        <el-link type="primary" :underline="false" icon="el-icon-edit" @click="openEdit(row, 0)">
           修改
         </el-link>
-        <el-popconfirm
-          class="ele-action"
-          title="确定要删除此物料吗?"
-          @confirm="remove(row)"
-        >
+        <el-popconfirm class="ele-action" title="确定要删除此物料吗?" @confirm="remove(row)">
           <template v-slot:reference>
             <el-link type="danger" :underline="false" icon="el-icon-delete">
               删除
             </el-link>
           </template>
         </el-popconfirm>
+
+
+        <el-link v-if="row.isProduct == 1" type="primary" :underline="false" @click="openMaterial(row)">
+          物料BOM
+        </el-link>
+
+
       </template>
     </ele-pro-table>
     <!-- 编辑弹窗 -->
     <!--    <dict-edit :visible.sync="showEdit" :id="id" @done="reload" /> -->
+
+    <!-- 选择物料 -->
+    <MaterialModal :visible.sync="materialEdit" :data="current" ref="materialRefs"></MaterialModal>
   </div>
 </template>
 
 <script>
-  import { getMaterialList, removeMaterial } from '@/api/material/manage.js';
-  export default {
-    components: {},
-    props: {
-      // 物料组id
-      currentId: [Number, String],
-      data: Object,
-      rootId:  [Number, String],
-    },
-    data () {
-      return {
-        // 表格列配置
-        columns: [
-          {
-            columnKey: 'index',
-            type: 'index',
-            width: 50,
-            align: 'center',
-            showOverflowTooltip: true,
-            label: '序号'
-          },
-          {
-            prop: 'code',
-            label: '编码',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'name',
-            label: '名称',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-      
-          {
-            prop: 'brandNum',
-            align: 'center',
-            label: '牌号',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'modelType',
-            label: '型号',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'specification',
-            label: '规格',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'measuringUnit',
-            label: '计量单位',
-            showOverflowTooltip: true,
-            minWidth: 90
-          },
-
-          {
-            prop: 'weightUnit',
-            label: '重量单位',
-            showOverflowTooltip: true,
-            minWidth: 90
-          },
-
-          {
-            prop: 'roughWeight',
-            label: '毛重',
-            showOverflowTooltip: true,
-            minWidth: 90
-          },
-
-          {
-            prop: 'netWeight',
-            label: '净重',
-            showOverflowTooltip: true,
-            minWidth: 90
-          },
-
-
-          {
-            prop: 'packingUnit',
-            align: 'center',
-            label: '包装单位',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'categoryLevelPath',
-            label: '分类',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 200,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            showOverflowTooltip: true,
-            fixed: 'right'
-          }
-        ],
-        types: {
-          1: '业务字典',
-          2: '数据字典'
+import { getMaterialList, removeMaterial } from '@/api/material/manage.js';
+import MaterialModal from './MaterialModal.vue'
+export default {
+  components: {
+    MaterialModal
+  },
+  props: {
+    // 物料组id
+    currentId: [Number, String],
+    data: Object,
+    rootId: [Number, String],
+  },
+  data() {
+    return {
+      // 表格列配置
+      columns: [
+        {
+          columnKey: 'index',
+          type: 'index',
+          width: 50,
+          align: 'center',
+          showOverflowTooltip: true,
+          label: '序号'
+        },
+        {
+          prop: 'code',
+          label: '编码',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'name',
+          label: '名称',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
         },
-        // 表格选中数据
-        selection: [],
-        // 是否显示编辑弹窗
-        showEdit: false,
-        id: null
-      };
-    },
 
-    methods: {
-      /* 表格数据源 */
-      datasource ({ page, limit, where, order }) {
-        return getMaterialList({
-          pageNum: page,
-          size: limit,
-          ...where,
-          categoryLevelId: this.currentId
-        });
-      },
-      /* 刷新表格 */
-      reload (where) {
-        this.$refs.table.reload({
-          page: 1,
-          where: where,
-          categoryLevelId: this.currentId
-        });
-      },
-      /* 显示编辑 */
-      openEdit (row, status) {
-        this.$router.push({
-          path: '/material/product/detail',
-          query: {
-            id: row.id ? row.id : null,
-            status: status,
-            rootId: this.rootId
-          }
+        {
+          prop: 'brandNum',
+          align: 'center',
+          label: '牌号',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'modelType',
+          label: '型号',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'specification',
+          label: '规格',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'measuringUnit',
+          label: '计量单位',
+          showOverflowTooltip: true,
+          minWidth: 90
+        },
+
+        {
+          prop: 'weightUnit',
+          label: '重量单位',
+          showOverflowTooltip: true,
+          minWidth: 90
+        },
+
+        {
+          prop: 'roughWeight',
+          label: '毛重',
+          showOverflowTooltip: true,
+          minWidth: 90
+        },
+
+        {
+          prop: 'netWeight',
+          label: '净重',
+          showOverflowTooltip: true,
+          minWidth: 90
+        },
+
+
+        {
+          prop: 'packingUnit',
+          align: 'center',
+          label: '包装单位',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'categoryLevelPath',
+          label: '分类',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 200,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          fixed: 'right'
+        }
+      ],
+
+      // 表格选中数据
+      selection: [],
+      // 是否显示编辑弹窗
+      showEdit: false,
+      id: null,
+
+      materialEdit: false,
+      current: null,
+    };
+  },
+
+  methods: {
+    /* 表格数据源 */
+    datasource({ page, limit, where, order }) {
+      return getMaterialList({
+        pageNum: page,
+        size: limit,
+        ...where,
+        categoryLevelId: this.currentId
+      });
+    },
+    /* 刷新表格 */
+    reload(where) {
+      this.$refs.table.reload({
+        page: 1,
+        where: where,
+        categoryLevelId: this.currentId
+      });
+    },
+    /* 显示编辑 */
+    openEdit(row, status) {
+      this.$router.push({
+        path: '/material/product/detail',
+        query: {
+          id: row.id ? row.id : null,
+          status: status,
+          rootId: this.rootId
+        }
+      });
+    },
+    /* 删除 */
+    remove(row) {
+      const loading = this.$loading({ lock: true });
+      removeMaterial(row.id)
+        .then((msg) => {
+          loading.close();
+          this.$message.success('删除' + msg);
+          this.reload();
+        })
+        .catch((e) => {
+          loading.close();
+          // this.$message.error(e.message);
         });
-      },
-      /* 删除 */
-      remove (row) {
-        const loading = this.$loading({ lock: true });
-        removeMaterial(row.id)
-          .then((msg) => {
-            loading.close();
-            this.$message.success('删除' + msg);
-            this.reload();
-          })
-          .catch((e) => {
-            loading.close();
-            // this.$message.error(e.message);
-          });
-      }
     },
-    watch: {
-      // 监听物料组id变化
-      currentId () {
-        this.reload();
-      }
+
+
+    openMaterial(row) {
+      this.current = row;
+      this.materialEdit = true;
+      this.$refs.materialRefs.$refs.form &&
+        this.$refs.materialRefs.$refs.form.clearValidate();
+    }
+
+
+
+  },
+  watch: {
+    // 监听物料组id变化
+    currentId() {
+      this.reload();
     }
-  };
+  }
+};
 </script>

+ 13 - 0
src/views/technology/productParam/components/process.vue

@@ -104,6 +104,9 @@ export default {
     ProcessModal,
     ParamModal
   },
+  props: {
+    taskParam: Array
+  },
   data() {
     return {
       // 表格列配置
@@ -304,6 +307,16 @@ export default {
       this.$forceUpdate()
     }
 
+  },
+
+  watch: {
+    async taskParam(list) {
+      if (list) {
+        this.$refs.table.setData(list)
+            console.log()
+
+      } 
+    }
   }
 };
 </script>

+ 7 - 2
src/views/technology/productParam/components/user-edit.vue

@@ -1,4 +1,4 @@
-<!-- 用户编辑弹窗 -->
+
 <template>
   <ele-modal width="1160px" :visible="visible" v-if="visible" :append-to-body="true" :close-on-click-modal="true"
     custom-class="ele-dialog-form" :title="isUpdate ? '修改参数' : '添加参数'" @update:visible="updateVisible">
@@ -179,7 +179,7 @@
     <ParamModal ref="paramRefs" @chooseModal="chooseModal"></ParamModal>
 
     <!-- 选择工序 -->
-    <Process @chooseProcess="chooseProcess"></Process>
+    <Process @chooseProcess="chooseProcess" :taskParam="taskParam"></Process>
 
   </ele-modal>
 </template>
@@ -255,6 +255,8 @@ export default {
       tableData: [],
       removeList: [],
 
+      taskParam: [],
+
       // 表格列配置
       columns: [
         {
@@ -461,6 +463,9 @@ export default {
           this.$util.assignObject(this.form, {
             ...res
           });
+     
+          this.$refs.table.setData(res.produceParam)
+          this.taskParam = res.taskParam
           this.isUpdate = true;
         } else {