695593266@qq.com 8 meses atrás
pai
commit
cf234878fa

+ 39 - 4
src/views/material/BOMmanage/components/BOM-search.vue

@@ -46,6 +46,25 @@
         </el-form-item>
       </el-col>
 
+      <el-col v-bind="styleResponsive ? { md: 4 } : { span: 4 }">
+        <el-form-item label="级别">
+          <el-select
+            clearable
+            v-model.trim="where.level"
+            placeholder="请选择"
+            class="w100"
+            size="mini"
+          >
+            <el-option
+              v-for="item in bomLevelList"
+              :key="item.value"
+              :value="item.value"
+              :label="item.label"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
+
       <el-col v-bind="styleResponsive ? { md: 4 } : { span: 4 }">
         <el-form-item label="存货类型">
           <el-select
@@ -158,14 +177,16 @@
         status: '',
         attributeType: '',
         specification: '',
-        modeType: ''
+        modeType: '',
+        level: ''
       };
       return {
         defaultWhere,
         // 表单数据
         where: { ...defaultWhere },
         moudleName: 'mainUser',
-        attributeList: []
+        attributeList: [],
+        bomLevelList: []
       };
     },
     computed: {
@@ -177,6 +198,7 @@
 
     mounted() {
       this.getAttributeList('inventory_type');
+      this.getBomLevel('bom_query_level');
     },
 
     methods: {
@@ -197,6 +219,21 @@
       success() {
         this.search();
       },
+
+      async getBomLevel(code) {
+        let { data: res } = await getByCode(code);
+
+        this.bomLevelList = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: values[0],
+            label: item[values[0]]
+          };
+        });
+
+        console.log(this.bomLevelList, 'bomLevelList');
+      },
+
       async getAttributeList(code) {
         let res = await getByCode(code);
 
@@ -213,8 +250,6 @@
           return { value: Number(key), label: item[key] };
         });
         this.attributeList = list;
-
-        console.log(this.attributeList, 'this.attributeList');
       }
     }
   };

+ 39 - 27
src/views/material/materialBOM/index.vue

@@ -11,37 +11,49 @@
       >
         <!-- 表头工具栏 -->
         <template v-slot:toolbar>
-          <el-button type="primary" size="small" @click="handelEdit('新建')">新建</el-button>
+          <el-button type="primary" size="small" @click="handelEdit('新建')"
+            >新建</el-button
+          >
           <el-button
             size="small"
             type="primary"
             icon="el-icon-refresh-left"
             class="ele-btn-icon"
-            @click='refreshData'
+            @click="refreshData"
             :loading="loading"
-          >刷新</el-button>
+            >刷新</el-button
+          >
         </template>
         <template v-slot:action="{ row }">
           <el-link type="primary" @click="handelDetail(row)">详情</el-link>
-          <el-link type="primary"  icon="el-icon-edit"  @click="handelEdit('编辑', row)">编辑</el-link>
+          <el-link
+            type="primary"
+            icon="el-icon-edit"
+            @click="handelEdit('编辑', row)"
+            >编辑</el-link
+          >
         </template>
       </ele-pro-table>
     </el-card>
     <ViewDialog ref="detailDialogRef" :statusOpt="statusOpt" />
-    <EditDialog ref="editDialogRef" :statusOpt="statusOpt"     @done="reload"></EditDialog>
+    <EditDialog
+      ref="editDialogRef"
+      :statusOpt="statusOpt"
+      @done="reload"
+    ></EditDialog>
   </div>
 </template>
 
 <script>
   import BOMSearch from './components/BOM-search.vue';
   import ViewDialog from './components/view-dialog.vue';
-  import EditDialog from './components/edit-dialog.vue'
-  import { getPage , syncBom } from '@/api/material/BOM';
+  import EditDialog from './components/edit-dialog.vue';
+  import { getPage, syncBom } from '@/api/material/BOM';
 
   export default {
     name: 'SystemDictionary',
     components: { BOMSearch, ViewDialog, EditDialog },
-    data () {
+    data() {
       return {
         // 表格列配置
         columns: [
@@ -101,36 +113,36 @@
           }
         ],
         statusOpt: {
-          '-1': '草稿',
-          0: '已停用',
-          1: '已发布'
+          0: '草稿',
+          1: '已发布',
+          2: '已停用'
         },
-        loading:false
+        loading: false
       };
     },
 
     methods: {
       /* 表格数据源 */
-      datasource ({ where, page, limit }) {
+      datasource({ where, page, limit }) {
         return getPage({
           ...where,
           pageNum: page,
           size: limit
         });
       },
-      handelDetail (row) {
+      handelDetail(row) {
         this.$refs.detailDialogRef.open(row);
       },
       /* 刷新表格 */
-      reload (where) {
+      reload(where) {
         this.$refs.table.reload({ where });
       },
       /* 显示编辑 */
-      handelEdit (type, row) {
-        this.$refs.editDialogRef.open(type,row);
+      handelEdit(type, row) {
+        this.$refs.editDialogRef.open(type, row);
       },
       /* 删除 */
-      remove () {
+      remove() {
         this.$confirm('确定要删除选中的字典吗?', '提示', {
           type: 'warning'
         })
@@ -160,20 +172,20 @@
       },
 
       // 刷新数据
-      refreshData(){
-          this.loading = true;
-          syncBom().then(res=>{
-             if(res=='0'){
-               this.loading = false;
-                this.$message.success('数据刷新成功!')
-                this.reload()
-             }
+      refreshData() {
+        this.loading = true;
+        syncBom()
+          .then((res) => {
+            if (res == '0') {
+              this.loading = false;
+              this.$message.success('数据刷新成功!');
+              this.reload();
+            }
           })
           .catch((e) => {
             this.loading = false;
           });
       }
-
     }
   };
 </script>

+ 168 - 167
src/views/technology/version/components/bomModal.vue

@@ -1,198 +1,199 @@
 <template>
-    <el-dialog title="选择物料BOM" :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">
-            <bomSearch @search="reload" />
-
-
-            <!-- 表格 -->
-
-            <ele-pro-table ref="table" :columns="columns" :datasource="datasource" height="calc(100vh - 350px)"
-            :need-page="true" class="dict-table" @cell-click="cellClick">
-
-
-                <!-- 表头工具栏 -->
-                <template v-slot:action="{ row }">
-                    <el-radio class="radio" v-model="radio" :label="row.id"><i></i></el-radio>
-                </template>
-            </ele-pro-table>
-
-
-        </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>
+  <el-dialog
+    title="选择物料BOM"
+    :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">
+      <bomSearch @search="reload" />
+
+      <!-- 表格 -->
+
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        height="calc(100vh - 350px)"
+        :need-page="true"
+        class="dict-table"
+        @cell-click="cellClick"
+      >
+        <!-- 表头工具栏 -->
+        <template v-slot:action="{ row }">
+          <el-radio class="radio" v-model="radio" :label="row.id"
+            ><i></i
+          ></el-radio>
+        </template>
+      </ele-pro-table>
+    </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 bomSearch from './BOM-search.vue'
-import { getPage } from '@/api/material/BOM';
-export default {
+  import AssetTree from '@/components/AssetTree';
+  import bomSearch from './BOM-search.vue';
+  import { getPage } from '@/api/material/BOM';
+  export default {
     components: { AssetTree, bomSearch },
     data() {
-        return {
-            visible: false,
-            // 表格列配置
-            columns: [
-
-
-
-                {
-                    label: '序号',
-                    columnKey: 'index',
-                    type: 'index',
-                    width: 55,
-                    align: 'center',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'code',
-                    label: 'BOM编码',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'name',
-                    label: 'BOM名称',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'categoryCode',
-                    label: '产品编码',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'categoryName',
-                    label: '产品名称',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'version',
-                    label: '版本'
-                },
-                {
-                    prop: 'status ',
-                    label: '状态',
-                    formatter: (row) => {
-                        return this.statusOpt[row.status];
-                    }
-                },
-                {
-                    prop: 'createUserName',
-                    label: '创建人',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'createTime',
-                    label: '创建日期',
-                    showOverflowTooltip: true
-                },
-
-                {
-                    action: 'action',
-                    slot: 'action',
-                    align: 'center',
-                    label: '选择'
-                }
-
-            ],
-
-            statusOpt: {
-                '-1': '草稿',
-                0: '已停用',
-                1: '已发布'
-            },
-
-            radio: null,
-            idx: null, // 父组件,index 
+      return {
+        visible: false,
+        // 表格列配置
+        columns: [
+          {
+            label: '序号',
+            columnKey: 'index',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'code',
+            label: 'BOM编码',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: 'BOM名称',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'categoryCode',
+            label: '产品编码',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'categoryName',
+            label: '产品名称',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'version',
+            label: '版本'
+          },
+          {
+            prop: 'status ',
+            label: '状态',
+            formatter: (row) => {
+              return this.statusOpt[row.status];
+            }
+          },
+          {
+            prop: 'createUserName',
+            label: '创建人',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'createTime',
+            label: '创建日期',
+            showOverflowTooltip: true
+          },
+
+          {
+            action: 'action',
+            slot: 'action',
+            align: 'center',
+            label: '选择'
+          }
+        ],
+
+        statusOpt: {
+          0: '草稿',
+          1: '已发布',
+          2: '已停用'
+        },
 
-        }
+        radio: null,
+        idx: null // 父组件,index
+      };
     },
 
-    watch: {
-
-    },
+    watch: {},
     methods: {
-        /* 表格数据源 */
-        async datasource({ page, limit, where, order }) {
-            return getPage({
-                ...where,
-                pageNum: page,
-                size: limit
-            });
-        },
-
-
-
-        /* 刷新表格 */
-        reload() {
-            this.$refs.table.reload();
-        },
-        open(item, idx) {
-            if (item) {
-                this.current = {
-                    id: item.routingId,
-                    name: item.routingName,
-                    code: item.routingCode
-                }
-                this.radio = item.routingId
-            }
-            this.idx = idx
-            this.visible = true
-        },
-
-        // 单击获取id
-        cellClick(row) {
-            this.current = row
-            this.radio = row.id
-        },
-        handleClose() {
-            this.visible = false
-            this.current = null
-            this.radio = ''
-        },
-        selected() {
-            if (!this.current) {
-                return this.$message.warning('请选择物料BOM')
-            }
-            this.$emit('changeBom', this.current, this.idx)
-            this.handleClose()
-        },
+      /* 表格数据源 */
+      async datasource({ page, limit, where, order }) {
+        return getPage({
+          ...where,
+          pageNum: page,
+          size: limit
+        });
+      },
+
+      /* 刷新表格 */
+      reload() {
+        this.$refs.table.reload();
+      },
+      open(item, idx) {
+        if (item) {
+          this.current = {
+            id: item.routingId,
+            name: item.routingName,
+            code: item.routingCode
+          };
+          this.radio = item.routingId;
+        }
+        this.idx = idx;
+        this.visible = true;
+      },
+
+      // 单击获取id
+      cellClick(row) {
+        this.current = row;
+        this.radio = row.id;
+      },
+      handleClose() {
+        this.visible = false;
+        this.current = null;
+        this.radio = '';
+      },
+      selected() {
+        if (!this.current) {
+          return this.$message.warning('请选择物料BOM');
+        }
+        this.$emit('changeBom', this.current, this.idx);
+        this.handleClose();
+      }
     }
-}
+  };
 </script>
-  
+
 <style lang="scss" scoped>
-.tree_col {
+  .tree_col {
     border: 1px solid #eee;
     padding: 10px 0;
     box-sizing: border-box;
     height: 500px;
     overflow: auto;
-}
+  }
 
-.table_col {
+  .table_col {
     padding-left: 10px;
 
     ::v-deep .el-table th.el-table__cell {
-        background: #f2f2f2;
+      background: #f2f2f2;
     }
-}
+  }
 
-.pagination {
+  .pagination {
     text-align: right;
     padding: 10px 0;
-}
+  }
 
-.btns {
+  .btns {
     text-align: center;
     padding: 10px 0;
-}
+  }
 
-.topsearch {
+  .topsearch {
     margin-bottom: 15px;
-}
+  }
 </style>
-