ysy 2 ani în urmă
părinte
comite
0cc0fdbf73

+ 149 - 0
src/components/material/index.vue

@@ -0,0 +1,149 @@
+<template>
+    <el-dialog :title="title" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="false"
+        :close-on-press-escape="false" append-to-body width="80%">
+        <el-card shadow="never">
+            <userSearch @search="reload" />
+            <ele-split-layout width="244px" allow-collapse :right-style="{ overflow: 'hidden' }">
+                <div class="ele-border-lighter split-layout-right-content">
+                    <AssetTree ref="assetTreeRef" :id="categoryLevelId" @handleNodeClick="handleNodeClick" />
+                </div>
+                <!-- 表格 -->
+                <template v-slot:content>
+                    <ele-pro-table ref="table" :columns="columns" :datasource="datasource" height="calc(100vh - 350px)"
+                        class="dict-table" :selection.sync="selection">
+                    </ele-pro-table>
+                </template>
+            </ele-split-layout>
+        </el-card>
+        <div class="btns">
+            <el-button type="primary" size="small" @click="selected">选择</el-button>
+            <el-button size="small" @click="handleClose">关闭</el-button>
+        </div>
+    </el-dialog>
+</template>
+  
+<script>
+import AssetTree from '@/components/AssetTree';
+import userSearch from './user-search.vue'
+import { getList } from '@/api/classifyManage/itemInformation';
+export default {
+    components: { AssetTree, userSearch },
+    data() {
+        return {
+            visible: false,
+            // 表格列配置
+            title: null,
+            columns: [
+                {
+                    columnKey: 'selection',
+                    type: 'selection',
+                    width: 45,
+                    align: 'center',
+                    selectable: (row, index) => {
+                        return !this.tableData.some((it) => it.id == row.id);
+                    },
+                    reserveSelection: true,
+                    fixed: 'left'
+                },
+                {
+                    prop: 'code',
+                    label: '编码'
+                },
+                {
+                    prop: 'name',
+                    label: '名称',
+                    showOverflowTooltip: true
+                },
+                {
+                    prop: 'brandNum',
+                    label: '牌号'
+                },
+                {
+                    prop: 'modelType',
+                    label: '型号'
+                },
+                {
+                    prop: 'measuringUnit',
+                    label: '计量单位'
+                },
+                {
+                    prop: 'packingUnit',
+                    label: '包装单位'
+                },
+                {
+                    action: 'action',
+                    slot: 'action',
+                    align: 'center',
+                    label: '选择'
+                }
+            ],
+            categoryLevelId: null,
+            // 表格选中数据
+            selection: [],
+
+            tableData: [],
+            current: null
+        }
+    },
+
+    watch: {
+
+    },
+    methods: {
+        /* 表格数据源 */
+        datasource({ page, where, limit }) {
+            return getList({
+                ...where,
+                pageNum: page,
+                size: limit,
+                categoryLevelId: this.categoryLevelId,
+
+            });
+        },
+        handleNodeClick(data) {
+            this.categoryLevelId = data.id;
+            this.reload();
+        },
+        /* 刷新表格 */
+        reload() {
+            this.$refs.table.reload();
+        },
+        open(list, title, id) {
+            if (list) {
+                this.tableData = list
+            }
+            if(title) {
+                this.title = title
+            }
+            if (id) {
+                this.categoryLevelId = id
+            }
+            this.visible = true
+        },
+
+
+
+        handleClose() {
+            this.visible = false
+            this.$refs.table.setSelectedRows([]);
+            this.selection = []
+        },
+        selected() {
+            if (!this.selection.length) {
+                this.$message.error('请至少选择一条数据');
+                return;
+            }
+            this.$emit('chooseModal', this.selection, this.current)
+            this.handleClose()
+        },
+    }
+}
+</script>
+  
+<style lang="scss" scoped>
+.btns {
+    text-align: center;
+    padding: 10px 0;
+}
+</style>
+  

+ 129 - 0
src/components/material/user-search.vue

@@ -0,0 +1,129 @@
+
+<template>
+  <el-form
+    size="small"
+    label-width="60px"
+    class="ele-form-search"
+    @keyup.enter.native="search"
+    @submit.native.prevent
+  >
+    <el-row :gutter="10">
+      <el-col v-bind="styleResponsive ? { md: 6 } : { span: 6 }">
+        <el-form-item label="编码">
+          <el-input
+            clearable
+            size="small"
+            v-model="where.code"
+            placeholder="请输入"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { md: 6 } : { span: 6 }">
+        <el-form-item label="名称">
+          <el-input
+            clearable
+            size="small"
+            v-model="where.name"
+            placeholder="请输入"
+          />
+        </el-form-item>
+      </el-col>
+
+      <el-col v-bind="styleResponsive ? { md: 6 } : { span: 6 }">
+        <el-form-item label="型号">
+          <el-input
+            clearable
+            size="small"
+            v-model="where.modelType"
+            placeholder="请输入"
+          />
+        </el-form-item>
+      </el-col>
+
+
+
+      <el-col v-bind="styleResponsive ? { md: 6 } : { span: 4 }">
+        <el-form-item>
+          <el-button
+            size="small"
+            type="primary"
+            icon="el-icon-search"
+            class="ele-btn-icon"
+            @click="search"
+          >
+            查询
+          </el-button>
+
+          <el-button
+            @click="reset"
+            icon="el-icon-refresh"
+            class="ele-btn-icon"
+            size="medium"
+            >重置</el-button
+          >
+
+          <el-button
+            type="primary"
+            icon="el-icon-refresh-left"
+            class="ele-btn-icon"
+            @click='refreshData'
+            :loading="loading"
+          >刷新</el-button>
+
+          <slot></slot>
+        </el-form-item>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+  import { syncMateriel } from '@/api/material/list';
+  export default {
+    data() {
+      // 默认表单数据
+      const defaultWhere = {
+        name: '',
+        code: '',
+        modelType: ''
+      };
+      return {
+        defaultWhere,
+        // 表单数据
+        where: { ...defaultWhere },
+        loading:false
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    methods: {
+      /* 搜索 */
+      search() {
+        this.$emit('search', this.where);
+      },
+      /*  重置 */
+      reset() {
+        this.where = { ...this.defaultWhere };
+        this.search();
+      },
+      // 刷新数据
+      refreshData(){
+          this.loading = true;
+          syncMateriel().then(res=>{
+             if(res=='0'){
+               this.loading = false;
+                this.$message.success('数据刷新成功!')
+                this.search()
+             }
+          })
+          .catch((e) => {
+            this.loading = false;
+          });
+      }
+    }
+  };
+</script>

+ 280 - 287
src/views/material/product/components/MaterialModal.vue

@@ -1,326 +1,319 @@
 
 <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>
-  
-  
+        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-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' />
-  
 
-  
+                <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>
+
+
+        <!-- 选择物料弹窗 -->
+
+        <materialDialog ref="materiaRef" @chooseModal="chooseModal"></materialDialog>
+
+
 
-  
     </ele-modal>
-  </template>
+</template>
   
-  <script>
-  import parameter from '@/api/technology/productParam';
-  import ProductModal from '@/views/technology/productParam/components/ProductModal.vue';
+<script>
 
 
-  
-  import {  pageList } from '@/api/technology/version/version.js';
-  export default {
+
+import materialDialog from '@/components/material'
+export default {
     components: {
-        ProductModal,
+        materialDialog
 
     },
     props: {
-      // 弹窗是否打开
-      visible: Boolean,
-      // 修改回显的数据
-      data: Object
+        // 弹窗是否打开
+        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,
+        const defaultForm = {
+            id: null,
+            name: '',
+            code: '',
+            modelType: '',
+            brandNum: '',
+            specification: '',
+            measuringUnit: ''
 
 
-        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
-          }
-        ],
-  
-      };
+        };
+        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;
-      }
+        // 是否开启响应式布局
+        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;
 
-  
-  
+        openParam() {
+            this.$refs.materiaRef.open(this.tableData, '选择物料', '1')
+        },
+
+        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);
+        },
+
 
-  
-        });
-      },
-      /* 更新visible */
-      updateVisible(value) {
-        this.$emit('update:visible', value);
-      },
-
-   
     },
-  
+
     watch: {
-      async visible(visible) {
-        if (visible) {
+        async visible(visible) {
+            if (visible) {
 
-  
-          if (this.data) {
-           console.log(this.data)
-  
-            this.$util.assignObject(this.form, {
-              ...this.data
-            });
 
-          } else {
-  
+                if (this.data) {
+                    console.log(this.data)
 
-          }
-  
-  
-        } else {
-          this.$refs.form.clearValidate();
-          this.form = { ...this.defaultForm };
+                    this.$util.assignObject(this.form, {
+                        ...this.data
+                    });
+
+                } else {
+
+
+                }
+
+
+            } else {
+                this.$refs.form.clearValidate();
+                this.form = { ...this.defaultForm };
+            }
         }
-      }
     }
-  };
-  </script>
+};
+</script>
   

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

@@ -84,7 +84,8 @@
       // 默认表单数据
       const defaultWhere = {
         name: '',
-        code: ''
+        code: '',
+        modelType: ''
       };
       return {
         defaultWhere,

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

@@ -354,7 +354,7 @@ export default {
         this.$set(this.form, 'categoryId', row.id)
         this.$set(this.form, 'categoryCode', row.code)
         this.$set(this.form, 'categoryModelType', row.name)
-        this.$set(this.form, 'categoryBrandNum', row.categoryBrandNum)
+        this.$set(this.form, 'categoryBrandNum', row.brandNum)
         this.$set(this.form, 'specification', row.specification)
       } else if (title == '选择舟皿') {
         this.$set(this.form, 'palletName', row.name)