Browse Source

订单-库存预警

zhangjinxing 3 years ago
parent
commit
5aa72a7801

+ 1 - 2
src/components/number-range/main.vue

@@ -54,8 +54,7 @@ export default {
   //   },
   // },
   data() {
-    return {
-    };
+    return {};
   },
   mounted() {},
   methods: {

+ 44 - 105
src/views/stock/stockWarning/addEdit.vue

@@ -24,29 +24,25 @@
             label-width="110px"
             class="demo-ruleForm"
           >
-            <el-form-item label="供应商名称" prop="supplier_code">
-              <search-supplier
-                :value="ruleForm.supplier_code"
-                :disabled="true"
-                :placeholder="'请选择供应商'"
-                @searchChange="selectSupplier"
+            <el-form-item label="供应商名称" prop="wsm_supplier">
+              <el-input
+                v-model="ruleForm.wsm_supplier"
+                disabled
+                placeholder="请选择供应商"
               />
             </el-form-item>
-            <el-form-item label="仓库名称" prop="stock_code">
-              <search-stock
-                :value="ruleForm.stock_code"
-                :isDetail="true"
-                :placeholder="'请选择备库仓库'"
-                :isRelation="true"
-                :companyCode="companyCode"
-                @searchChange="selectStock"
+            <el-form-item label="仓库名称" prop="wsm_name">
+              <el-input
+                v-model="ruleForm.wsm_name"
+                disabled
+                placeholder="请选择备库仓库"
               />
             </el-form-item>
             <el-form-item label="商品名称" prop="good_name">
               <el-input v-model="ruleForm.good_name" disabled></el-input>
             </el-form-item>
-            <el-form-item label="预警数量" prop="warn_num">
-              <el-input v-model="ruleForm.warn_num"></el-input>
+            <el-form-item label="预警数量" prop="warn_stock">
+              <el-input v-model="ruleForm.warn_stock"></el-input>
             </el-form-item>
           </el-form>
         </el-col>
@@ -59,7 +55,6 @@
           }}</el-button>
         </el-col>
       </el-row>
-      <!-- {{ sitem }}供应商公司编码+仓库编码 -->
     </el-card>
   </el-dialog>
 </template>
@@ -73,21 +68,19 @@ export default {
   data() {
     return {
       title: "库存预警修改",
-      input: "", //二合一搜索框输入
-      select: "1", //二合一搜索框下拉
-      companyCode: "", //选择公司
+      companyCode: "", 
       loading: false,
       showModelThis: this.showModel,
       ruleForm: {
-        supplier_code: [], //供应商名称
-        stock_code: [], //仓库名称
-        good_name: "", //产品名称
-        warn_num_low: "", //预警数量下限
-        warn_num_up: "", //预警数量上限
+        good_code: "", 
+        wsm_code: "", 
+        wsm_name: "", 
+        good_name: "", 
+        warn_stock: "", 
       },
       rulesThis: this.rules,
       rules: {
-        warn_num: [
+        warn_stock: [
           {
             required: true,
             message: "预计数量不能为空",
@@ -101,20 +94,18 @@ export default {
             trigger: "blur",
           },
         ],
-        supplier_code: [
+        wsm_supplier: [
           {
-            type: "array",
             required: true,
             message: "请选择供应商",
-            trigger: "change",
+            trigger: "blue",
           },
         ],
-        stock_code: [
+        wsm_name: [
           {
-            type: "array",
             required: true,
             message: "请选择仓库",
-            trigger: "change",
+            trigger: "blur",
           },
         ],
       },
@@ -133,11 +124,22 @@ export default {
       }
     },
     sitem(val) {
-      // 缺少供应商名称和仓库名称
-      let { good_name, warn_stock } = val;
-      console.log(val);
-      this.ruleForm.good_name = good_name;
-      this.ruleForm.warn_num = warn_stock;
+      let {
+        good_name,
+        warn_stock,
+        wsm_name,
+        wsm_supplier,
+        wsm_code,
+        type_code,
+      } = val;
+      this.ruleForm = {
+        wsm_supplier,
+        wsm_name,
+        good_name,
+        warn_stock,
+        wsm_code,
+        good_code: type_code,
+      };
     },
   },
   methods: {
@@ -147,58 +149,21 @@ export default {
     },
     async initForm() {
       this.loading = true;
-      // await this.getRole();
-      // if (this.id === "add") {
-      //   this.title = "库存预警修改";
-      //   this.rulesThis = this.rules;
-      //   // await this.resetForm();
-      // } else {
-      //   if (this.isDetail) {
-      //     this.title = "库存详情";
-      //     this.rulesThis = {};
-      //   } else {
-      //     this.rulesThis = this.rules;
-      //   }
-      //   // await this.initData()
-      // }
       this.title = "库存预警修改";
       this.rulesThis = this.rules;
       this.loading = false;
     },
-    // 重置
-    async resetForm() {
-      // await this.$nextTick(() => {
-      //   if (this.$refs.ruleForm) {
-      //     this.$refs.ruleForm.resetFields();
-      //     this.$refs.ruleForm.clearValidate();
-      //     this.ruleForm = {
-      //       stock_code: [],
-      //       supplier_code: [],
-      //       good_name: "", //产品名称
-      //       warn_num: "", //预警数量
-      //     };
-      //   }
-      // });
-    },
-    // 提交库存预警量修改
     async submitForm() {
       await this.$refs.ruleForm.validate(async (valid) => {
         if (valid) {
           this.loading = true;
-          // console.log(this.ruleForm);
-          const model = {
-            // 使用供应商编码+公司编码
-            warn_stock: this.ruleForm.warn_num,
+          let model = {
+            warn_stock: this.ruleForm.warn_stock,
+
+            type_code: this.ruleForm.good_code,
+            wsm_code: this.ruleForm.wsm_code,
           };
-          // console.log(model);
           const res = await asyncRequest.update(model);
-          // let res = {};
-          // if (this.id === "add") {
-          //   delete model["id"];
-          //   res = await asyncRequest.add(model);
-          // } else {
-          //   res = await asyncRequest.update(model);
-          // }
           this.loading = false;
           if (res && res.code === 0) {
             const title = this.id === "add" ? "添加成功" : "修改成功";
@@ -220,32 +185,6 @@ export default {
         }
       });
     },
-    // 选择仓库
-    selectStock(e) {
-      console.log(e);
-      if (e && e.id) {
-        this.ruleForm.stock_code = [e.code];
-        this.stockCode = e.code;
-      } else {
-        this.ruleForm.stockCode = [];
-        this.stockCode = "";
-      }
-      console.log(this.ruleForm);
-      this.$refs.ruleForm.validateField("stock_code");
-    },
-    // 选择供应商
-    selectSupplier(e) {
-      console.log(e);
-      console.log(this.ruleForm);
-      if (e && e.id) {
-        this.ruleForm.supplier_code = [e.code];
-        this.companyCode = e.code;
-      } else {
-        this.ruleForm.supplier_code = [];
-        this.companyCode = "";
-      }
-      this.$refs.ruleForm.validateField("supplier_code");
-    },
   },
 };
 </script>

+ 35 - 18
src/views/stock/stockWarning/colums.js

@@ -4,16 +4,45 @@ export default [
           label: "产品编码",
           width:"150"
         },
-        {
-          prop: "brand",
-          label: "品牌",
-          width:"70"
-        },
         {
           prop: "good_name",
           label: "产品名称",
           width:"100"
         },
+        {
+          prop: "type_code",
+          label: "产品属性编码",
+          width:"130"
+        },
+        {
+          prop:"wsm_supplier",
+          label:"供应商名称",
+          width:"180"
+        },
+        {
+          prop:"wsm_name",
+          label:"仓库名称",
+          width:"80"
+        },
+        {
+          prop:"wsm_code",
+          label:"仓库编码",
+          width:"180"
+        },
+        {
+          prop: "usable_stock",
+          label: "可用库存",
+        },
+        {
+          prop: "warn_stock", 
+          label: "预警库存",
+        },
+        {
+          prop: "brand",
+          label: "品牌",
+          width:"70"
+        },
+        
         {
           prop: "attribute",
           label: "产品型号",
@@ -30,14 +59,7 @@ export default [
           prop: "good_type",
           label: "产品类型",
         },
-        {
-          prop: "usable_stock",
-          label: "可用库存",
-        },
-        {
-          prop: "usable_stock", //暂时无这个字段
-          label: "预警库存",
-        },
+        
         {
           prop: "unit",
           label: "单位",
@@ -55,11 +77,6 @@ export default [
           prop: "specs",
           label: "规格",
         },
-        {
-          prop: "addtime",
-          label: "添加时间",
-        },
-        
         {
           prop: "",
           label: "操作",

+ 53 - 51
src/views/stock/stockWarning/index.vue

@@ -28,11 +28,10 @@
           <div style="width: 100%" class="min">
             <el-row style="padding: 0 0 0 80px">
               <el-col :span="24">
-                <!-- 供应商选择 -->
                 <el-col :span="12" style="width: 300px; padding: 0">
                   <search-supplier
                     :size="searchSize"
-                    :placeholder="'请选择供应商公司'"
+                    :placeholder="'供应商公司'"
                     :value="parmValue.supplier_code"
                     @searchChange="selectSupplier"
                   />
@@ -43,7 +42,7 @@
                     :size="searchSize"
                     :value="parmValue.stock_code"
                     :disabled="isDisabled"
-                    :placeholder="'请选择出口仓库'"
+                    :placeholder="'出库仓库'"
                     :isRelation="true"
                     :companyCode="supplier_code"
                     :names="''"
@@ -52,10 +51,11 @@
                 </el-col>
                 <el-col style="width: 200px; padding-left: 10px">
                   <el-input
-                    :disabled="is_disabled"
-                    placeholder="请输入商品编码"
+                    placeholder="商品编码"
                     :size="searchSize"
                     v-model="parmValue.goods_sn"
+                    @blur="searchList"
+                    clearable
                   />
                 </el-col>
                 <el-col :span="4" style="width: 54px; margin-left: 10px">
@@ -100,7 +100,6 @@
                   @numReturned="numReturned1($event, 0)"
                 />
               </el-col>
-              <!--搜索按钮 -->
               <el-col :span="4" style="width: 44px; padding-top: 10px">
                 <el-button
                   style="width: 100%"
@@ -112,7 +111,6 @@
                 </el-button>
               </el-col>
             </el-row>
-            {{ parmValue }}1{{ supplier_code }}
           </div>
         </template>
         <template #status="{ scope }">
@@ -209,24 +207,22 @@ export default {
   },
   data() {
     return {
-      input: "WSMdr4w211019095958", //三合一输入框的内容
-      stockCode: "", //仓库名称
-      supplier_code: "", //供应商名称
-      isDisabled: true, //默认不能选仓库
-      is_disabled: true, //默认不能选商品编码
+      stockCode: "", 
+      supplier_code: "", 
+      isDisabled: true, 
       statusList: statusList,
       loading: true,
       showModel: false,
       isDetail: false,
       modelId: 0,
       parmValue: {
-        goods_sn: "", //商品编码
-        supplier_code: [], //供应商编码
-        stock_code: [], //仓库编码
-        warn_num_low: "", //预警库存下限
-        warn_num_up: "", //预警库存上限
-        stock_num_low: "", //库存量下限
-        stock_num_up: "", //库存上限
+        goods_sn: "", 
+        supplier_code: [], 
+        stock_code: [],
+        warn_num_low: "", 
+        warn_num_up: "", 
+        stock_num_low: "", 
+        stock_num_up: "", 
       },
       // 表格 - 数据
       tableData: [],
@@ -256,13 +252,14 @@ export default {
       if (e && e.id) {
         this.parmValue.stock_code = [e.code];
         this.stockCode = e.code;
-        this.is_disabled = false;
       } else {
         this.parmValue.stock_code = [];
         this.stock_code = "";
-        this.is_disabled = true;
         this.parmValue.goods_sn = "";
       }
+      if (this.parmValue.stock_code) {
+        this.searchList();
+      }
     },
     // 选择供应商
     selectSupplier(e) {
@@ -271,15 +268,15 @@ export default {
         this.supplier_code = e.code;
         this.isDisabled = false;
       } else {
-        console.log("asa");
         this.parmValue.stock_code = [];
-        this.parmValue.goods_sn = "";
         this.parmValue.supplier_code = [];
         this.stock_code = "";
         this.supplier_code = "";
-        this.is_disabled = true;
         this.isDisabled = true;
       }
+      if (this.parmValue.supplier_code) {
+        this.searchList();
+      }
     },
     // 预警量范围框
     numReturned1(e) {
@@ -287,8 +284,14 @@ export default {
         this.parmValue.warn_num_low = e.lower;
         this.parmValue.warn_num_up = e.online;
       } else {
-        this.parmValue.warn_num_low = "0";
-        this.parmValue.warn_num_up = "0";
+        this.parmValue.warn_num_low = "";
+        this.parmValue.warn_num_up = "";
+      }
+      if (
+        this.parmValue.warn_num_low != "" &&
+        this.parmValue.warn_num_up != ""
+      ) {
+        this.searchList();
       }
     },
     // 库存量范围框
@@ -297,10 +300,15 @@ export default {
         this.parmValue.stock_num_low = e.lower;
         this.parmValue.stock_num_up = e.online;
       } else {
-        this.parmValue.stock_num_low = "0";
-        this.parmValue.stock_num_up = "0";
+        this.parmValue.stock_num_low = "";
+        this.parmValue.stock_num_up = "";
+      }
+      if (
+        this.parmValue.stock_num_low != "" &&
+        this.parmValue.stock_num_up != ""
+      ) {
+        this.searchList();
       }
-      console.log(this.parmValue);
     },
     // 重置搜索栏
     restSearch() {
@@ -311,20 +319,18 @@ export default {
         total: 0,
       };
       this.parmValue = {
-        goods_sn: "", //商品编码
-        supplier_code: [], //供应商编码
-        stock_code: [], //仓库编码
-        warn_num_low: "", //预警库存下限
-        warn_num_up: "", //预警库存上限
-        stock_num_low: "", //库存量下限
-        stock_num_up: "", //库存上限
+        goods_sn: "", 
+        supplier_code: [], 
+        stock_code: [], 
+        warn_num_low: "", 
+        warn_num_up: "", 
+        stock_num_low: "", 
+        stock_num_up: "",
       };
       this.searchList();
     },
 
     openModal(id, isDetail, sitem) {
-      console.log(id);
-      console.log(isDetail);
       this.showModel = true;
       this.row = id;
       this.isDetail = isDetail;
@@ -342,26 +348,22 @@ export default {
         warn_num_low,
         warn_num_up,
       } = JSON.parse(JSON.stringify(this.parmValue));
-      console.log(this.ruleForm);
       let model = {
-        wsm_code: "", //WSMdr4w211019095958
-        // 缺少库存量上下限两个字段
-        // 缺少预警量上下限两个字段
-        supplier_code: supplier_code.toString() || "",
-        stock_code: stock_code.toString() || "",
-        goods_sn,
-        stock_num_low,
-        stock_num_up,
-        warn_num_low,
-        warn_num_up,
+        supplierNo: supplier_code.toString() || "",
+        wsm_code: stock_code.toString() || "",
         page: 1,
         size: 15,
+        stock_low: stock_num_low,
+        stock_up: stock_num_up,
+        warn_low: warn_num_low,
+        warn_up: warn_num_up,
+        good_code: goods_sn,
+        good_name: "",
+        type_code: "",
       };
-      console.log(model);
 
       const res = await asyncRequest.list(model);
       if (res && res.code === 0 && res.data) {
-        // console.log(res.data.list);
         res.data.list.forEach((element) => {
           if (element.sort_s != "" && element.sort_t != "") {
             element.classArr = `${element.sort_f}/${element.sort_s}/${element.sort_t}`;