ysy 1 سال پیش
والد
کامیت
64b6752d46

+ 12 - 0
src/api/byProduct/index.js

@@ -8,4 +8,16 @@ export async function getPage(data) {
     return res.data.data;
     return res.data.data;
   }
   }
   return Promise.reject(new Error(res.data.message));
   return Promise.reject(new Error(res.data.message));
+}
+
+
+// 获取列表
+export async function getMaterialList(data) {
+  const res = await request.get(`/main/category/getList`, {
+    params: data
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
 }
 }

+ 258 - 0
src/views/byProduct/components/ProductModal.vue

@@ -0,0 +1,258 @@
+<template>
+  <el-dialog
+    :title="title"
+    :visible.sync="visible"
+    v-if="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="75%"
+  >
+    <el-card shadow="never">
+      <ProductSearch @search="reload" ref="searchRef" />
+
+      <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"
+            row-key="id"
+            height="calc(100vh - 350px)"
+            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>
+        </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 ProductSearch from './product-search.vue';
+  import { getMaterialList } from '@/api/byProduct/index.js';
+
+  export default {
+    components: { AssetTree, ProductSearch },
+    props: {},
+    data() {
+      return {
+        visible: false,
+
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'index',
+            type: 'index',
+            width: 45,
+            align: 'center',
+            reserveSelection: true
+          },
+          {
+            prop: 'code',
+            label: '编码'
+          },
+          {
+            prop: 'name',
+            label: '名称',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'brandNum',
+            label: '牌号'
+          },
+
+          {
+            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
+          },
+
+          {
+            action: 'action',
+            slot: 'action',
+            align: 'center',
+            label: '选择'
+          }
+        ],
+
+        title: null,
+        categoryLevelId: null,
+        radio: null,
+        idx: null,
+
+        isCategory: true
+      };
+    },
+
+    watch: {},
+    methods: {
+      /* 表格数据源 */
+      datasource({ page, where, limit }) {
+
+        if (this.isCategory) {
+          return getMaterialList({
+            ...where,
+            pageNum: page,
+            size: limit,
+            categoryLevelId: this.categoryLevelId
+          });
+        } else {
+          return getMaterialList({
+            ...where,
+            pageNum: page,
+            size: limit
+          });
+        }
+      },
+      handleNodeClick(data) {
+        this.isCategory = true;
+        this.categoryLevelId = data.id;
+        this.$refs.table.reload({ pageNum: 1, where: {} });
+        this.$refs.searchRef.reset2();
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.isCategory = false;
+        this.$refs.table.reload({ pageNum: 1, where: where });
+      },
+      open(item, title, categoryLevelId, idx) {
+        if (item) {
+          this.title = title;
+          this.categoryLevelId = categoryLevelId;
+          this.idx = idx;
+
+          this.current = {
+            id: item.categoryId,
+            name: item.categoryName,
+            code: item.categoryCode
+          };
+          this.radio = item.categoryId;
+        }
+        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('请选择工作中心');
+        }
+        this.$emit('changeProduct', this.title, this.current, this.idx);
+        this.handleClose();
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .tree_col {
+    border: 1px solid #eee;
+    padding: 10px 0;
+    box-sizing: border-box;
+    height: 500px;
+    overflow: auto;
+  }
+
+  .table_col {
+    padding-left: 10px;
+
+    ::v-deep .el-table th.el-table__cell {
+      background: #f2f2f2;
+    }
+  }
+
+  .pagination {
+    text-align: right;
+    padding: 10px 0;
+  }
+
+  .btns {
+    text-align: center;
+    padding: 10px 0;
+  }
+
+  .topsearch {
+    margin-bottom: 15px;
+  }
+</style>

+ 19 - 3
src/views/byProduct/components/addByProduct.vue

@@ -24,17 +24,24 @@
           </el-col>
           </el-col>
 
 
           <el-col :span="6">
           <el-col :span="6">
-            <el-button type="primary" @click="selectOrder">选择物料</el-button>
+            <el-button type="primary" @click="categorySelect"
+              >选择物料</el-button
+            >
           </el-col>
           </el-col>
         </el-row>
         </el-row>
       </el-form>
       </el-form>
     </div>
     </div>
+    <ProductModal ref="productRefs" @changeProduct="determineChoose" />
   </el-dialog>
   </el-dialog>
 </template>
 </template>
 
 
 <script>
 <script>
-  import {  getCode } from '@/api/produce/workOrder';
+  import { getCode } from '@/api/produce/workOrder';
+  import ProductModal from './ProductModal.vue';
   export default {
   export default {
+    components: {
+      ProductModal
+    },
     data() {
     data() {
       return {
       return {
         visible: true,
         visible: true,
@@ -47,7 +54,6 @@
     },
     },
 
 
     created() {
     created() {
-    
       this.getOrderCode();
       this.getOrderCode();
     },
     },
 
 
@@ -59,6 +65,16 @@
       async getOrderCode() {
       async getOrderCode() {
         this.productForm.code = await getCode('dispose_code');
         this.productForm.code = await getCode('dispose_code');
       },
       },
+
+      categorySelect() {
+        this.$refs.productRefs.open({}, '选择物料', '1', null);
+      },
+
+      determineChoose(title, row, idx) {
+        if (title == '选择物料') {
+          console.log(row);
+        }
+      }
     }
     }
   };
   };
 </script>
 </script>

+ 155 - 0
src/views/byProduct/components/byProduct-search.vue

@@ -0,0 +1,155 @@
+<!-- 搜索表单 -->
+<template>
+    <el-form
+      label-width="90px"
+      class="ele-form-search"
+      @keyup.enter.native="search"
+      @submit.native.prevent
+    >
+      <el-row :gutter="15">
+        <el-col v-bind="styleResponsive ? { lg: 4, md: 10 } : { span: 4 }">
+          <el-form-item label="处置单号:">
+            <el-input
+              size="mini"
+              clearable
+              v-model="where.code"
+              placeholder="请输入"
+            />
+          </el-form-item>
+        </el-col>
+  
+        <el-col v-bind="styleResponsive ? { lg: 4, md: 10 } : { span: 4 }">
+          <el-form-item label="工单号:">
+            <el-input
+              size="mini"
+              clearable
+              v-model="where.workOrderCode"
+              placeholder="请输入"
+            />
+          </el-form-item>
+        </el-col>
+
+
+
+      <el-col v-bind="styleResponsive ? { lg: 4, md: 10 } : { span: 4 }">
+        <el-form-item label="工序名称:">
+  
+          <el-select size="mini"   v-model="where.taskId"  filterable>
+            <el-option
+              v-for="(item, index) in produceTaskList"
+              :key="index"
+              :label="item.name"
+              :value="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
+
+
+
+      <el-col v-bind="styleResponsive ? { lg: 4, md: 10 } : { span: 4 }">
+          <el-form-item label="物品名称:">
+            <el-input
+              size="mini"
+              clearable
+              v-model="where.categoryName"
+              placeholder="请输入"
+            />
+          </el-form-item>
+        </el-col>
+
+
+        
+  
+
+        <el-col v-bind="styleResponsive ? { lg: 4, md: 10 } : { span: 4 }">
+          <el-form-item label-width="0px">
+            <el-button
+              size="mini"
+              type="primary"
+              icon="el-icon-search"
+              class="ele-btn-icon"
+              @click="search"
+            >
+              查询
+            </el-button>
+            <el-button
+              size="mini"
+              @click="reset"
+              icon="el-icon-refresh-left"
+              type="primary"
+              >重置</el-button
+            >
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+  </template>
+  
+  <script>
+    import { produceTask } from '@/api/InTheSystem/index';
+    export default {
+      props: {
+  
+      },
+      data() {
+        // 默认表单数据
+        const defaultWhere = {
+          code: '',
+          workOrderCode: '',
+          taskId: '',
+          categoryName: ''
+        };
+        return {
+          // 表单数据
+          where: { ...defaultWhere },
+
+          produceTaskList: []
+        };
+      },
+      computed: {
+        // 是否开启响应式布局
+        styleResponsive() {
+          return this.$store.state.theme.styleResponsive;
+        }
+      },
+      watch: {},
+      created() {
+        this.getTaskList();
+      },
+      methods: {
+
+        getTaskList() {
+        produceTask().then((res) => {
+          this.produceTaskList = res.list;
+          this.where.taskId =  res.list[0].id
+
+
+           if(this.where.taskId) {
+            this.$emit('search', this.where);
+           }
+        
+        });
+      },
+
+
+        /* 搜索 */
+        search() {
+          this.$emit('search', this.where);
+        },
+        /*  重置 */
+        reset() {
+          this.where = { ...this.defaultWhere };
+          this.search();
+        }
+      }
+    };
+  </script>
+  <style lang="scss" scoped>
+    .ele-form-actions {
+      display: flex;
+      align-items: center;
+      justify-content: flex-end;
+    }
+  </style>
+  

+ 88 - 141
src/views/byProduct/components/product-search.vue

@@ -1,155 +1,102 @@
 <!-- 搜索表单 -->
 <!-- 搜索表单 -->
 <template>
 <template>
-    <el-form
-      label-width="90px"
-      class="ele-form-search"
-      @keyup.enter.native="search"
-      @submit.native.prevent
-    >
-      <el-row :gutter="15">
-        <el-col v-bind="styleResponsive ? { lg: 4, md: 10 } : { span: 4 }">
-          <el-form-item label="处置单号:">
-            <el-input
-              size="mini"
-              clearable
-              v-model="where.code"
-              placeholder="请输入"
-            />
-          </el-form-item>
-        </el-col>
-  
-        <el-col v-bind="styleResponsive ? { lg: 4, md: 10 } : { span: 4 }">
-          <el-form-item label="工单号:">
-            <el-input
-              size="mini"
-              clearable
-              v-model="where.workOrderCode"
-              placeholder="请输入"
-            />
-          </el-form-item>
-        </el-col>
-
-
-
-      <el-col v-bind="styleResponsive ? { lg: 4, md: 10 } : { span: 4 }">
-        <el-form-item label="工序名称:">
-  
-          <el-select size="mini"   v-model="where.taskId"  filterable>
-            <el-option
-              v-for="(item, index) in produceTaskList"
-              :key="index"
-              :label="item.name"
-              :value="item.id"
-            ></el-option>
-          </el-select>
+  <el-form
+    label-width="77px"
+    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 v-model.trim="where.code" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { md: 6 } : { span: 6 }">
+        <el-form-item label="名称">
+          <el-input clearable v-model.trim="where.name" placeholder="请输入" />
         </el-form-item>
         </el-form-item>
       </el-col>
       </el-col>
 
 
+      <el-col v-bind="styleResponsive ? { md: 6 } : { span: 6 }">
+        <el-form-item label="型号">
+          <el-input clearable v-model.trim="where.modelType" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { md: 4 } : { md: 4 }">
+        <div class="ele-form-actions">
+          <el-button
+            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
+          >
+        </div>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
 
 
-      <el-col v-bind="styleResponsive ? { lg: 4, md: 10 } : { span: 4 }">
-          <el-form-item label="物品名称:">
-            <el-input
-              size="mini"
-              clearable
-              v-model="where.categoryName"
-              placeholder="请输入"
-            />
-          </el-form-item>
-        </el-col>
-
-
-        
-  
-
-        <el-col v-bind="styleResponsive ? { lg: 4, md: 10 } : { span: 4 }">
-          <el-form-item label-width="0px">
-            <el-button
-              size="mini"
-              type="primary"
-              icon="el-icon-search"
-              class="ele-btn-icon"
-              @click="search"
-            >
-              查询
-            </el-button>
-            <el-button
-              size="mini"
-              @click="reset"
-              icon="el-icon-refresh-left"
-              type="primary"
-              >重置</el-button
-            >
-          </el-form-item>
-        </el-col>
-      </el-row>
-    </el-form>
-  </template>
-  
-  <script>
-    import { produceTask } from '@/api/InTheSystem/index';
-    export default {
-      props: {
-  
-      },
-      data() {
-        // 默认表单数据
-        const defaultWhere = {
-          code: '',
-          workOrderCode: '',
-          taskId: '',
-          categoryName: ''
-        };
-        return {
-          // 表单数据
-          where: { ...defaultWhere },
+<script>
+  export default {
+    data () {
+      // 默认表单数据
+      const defaultWhere = {
+        name: '',
+        code: '',
+        modelType: ''
+      };
+      return {
+        defaultWhere,
+        // 表单数据
+        where: { ...defaultWhere },
+        treeData:[]
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive () {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    created() {
+    },
+    methods: {
 
 
-          produceTaskList: []
-        };
-      },
-      computed: {
-        // 是否开启响应式布局
-        styleResponsive() {
-          return this.$store.state.theme.styleResponsive;
+      /* 搜索 */
+      search () {
+        if (this.where.appType === 0) {
+          this.where.appType = '';
         }
         }
+        this.$emit('search', this.where);
       },
       },
-      watch: {},
-      created() {
-        this.getTaskList();
-      },
-      methods: {
-
-        getTaskList() {
-        produceTask().then((res) => {
-          this.produceTaskList = res.list;
-          this.where.taskId =  res.list[0].id
-
-
-           if(this.where.taskId) {
-            this.$emit('search', this.where);
-           }
-        
-        });
+      /*  重置 */
+      reset () {
+        this.where = { ...this.defaultWhere };
+        this.search();
       },
       },
+      reset2 () {
+        this.where = { ...this.defaultWhere };
 
 
-
-        /* 搜索 */
-        search() {
-          this.$emit('search', this.where);
-        },
-        /*  重置 */
-        reset() {
-          this.where = { ...this.defaultWhere };
-          this.search();
-        }
       }
       }
-    };
-  </script>
-  <style lang="scss" scoped>
-    .ele-form-actions {
-      display: flex;
-      align-items: center;
-      justify-content: flex-end;
     }
     }
-  </style>
-  
+  };
+</script>
+
+<style>
+  .ele-form-actions {
+    display: inline-block;
+    transform: translate(0);
+    transition: all;
+  }
+</style>

+ 3 - 3
src/views/byProduct/index.vue

@@ -1,7 +1,7 @@
 <template>
 <template>
   <div class="ele-body">
   <div class="ele-body">
     <el-card shadow="never" v-loading="loading">
     <el-card shadow="never" v-loading="loading">
-      <productSearch @search="reload" ref="searchRef"> </productSearch>
+      <byProductSearch @search="reload" ref="searchRef"> </byProductSearch>
 
 
       <!-- 数据表格 -->
       <!-- 数据表格 -->
       <ele-pro-table
       <ele-pro-table
@@ -42,12 +42,12 @@
 
 
 <script>
 <script>
   import { getPage } from '@/api/byProduct/index';
   import { getPage } from '@/api/byProduct/index';
-  import productSearch from './components/product-search.vue';
+  import byProductSearch from './components/byProduct-search.vue';
   import  addByProduct from './components/addByProduct.vue';
   import  addByProduct from './components/addByProduct.vue';
 
 
   export default {
   export default {
     components: {
     components: {
-      productSearch,
+      byProductSearch,
       addByProduct
       addByProduct
     },
     },