Przeglądaj źródła

目标管理-月销售目标填报新增按时间范围查询对应客户的物料。

DongZ 1 rok temu
rodzic
commit
e1668bb90f

+ 9 - 0
src/api/business/spd/goal_management/monthSaleGoalDetails.js

@@ -53,4 +53,13 @@ export function importData(data) {
       'Content-Type': 'multipart/form-data'
     }
   })
+}
+
+//查询物料
+export function getMaterialRangeList(data) {
+  return request({
+    url: `/goal_management/monthSaleGoalDetails/getMaterialRangeList`,
+    method: 'post',
+    data: data
+  })
 }

+ 56 - 2
src/views/business/spd/target/MonthSaleGoal.vue

@@ -224,9 +224,21 @@
               </el-select>
             </el-form-item>
           </el-col>
+          <el-col :span="6">
+            <el-form-item label="时间范围" prop="materialRange">
+              <el-select v-model="materialRange" placeholder="请选择获取物料的时间范围">
+                <el-option v-for="item in dateOptions" :key="item.value" :label="item.label" :value="item.value">
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
         </el-row>
         <div>
-          <el-row :gutter="10" class="mb8" style="margin-left: 75%">
+          <el-row :gutter="10" class="mb8" style="margin-left: 67%">
+            <el-col :span="1.5">
+              <el-button type="primary" icon="el-icon-search" size="mini" @click="getMaterialList">查询物料
+              </el-button>
+            </el-col>
             <el-col :span="1.5">
               <el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleTemplateDownload">模板下载
               </el-button>
@@ -435,7 +447,8 @@
   import {
     getMonthSaleGoalDetails,
     delMonthSaleGoalDetails,
-    importData
+    importData,
+    getMaterialRangeList
   } from "@/api/business/spd/goal_management/monthSaleGoalDetails"
   import {
     getToken
@@ -651,6 +664,21 @@
         },
         //打开状态
         openStatus: null,
+        //物料来源时间
+        dateOptions: [{
+          value: '0',
+          label: '近一个月'
+        }, {
+          value: '1',
+          label: '近三个月'
+        }, {
+          value: '2',
+          label: '近半年'
+        }, {
+          value: '3',
+          label: '近一年'
+        }],
+        materialRange: '',
       };
     },
     created() {
@@ -1166,6 +1194,32 @@
           this.loading = false;
         })
       },
+      //查询该时间范围内对应客户的物料数据
+      getMaterialList() {
+        this.loading = true;
+        let data = {
+          customCode: this.form.customCode,
+          type: this.materialRange
+        }
+        console.log(data, 'data')
+        getMaterialRangeList(data).then((res) => {
+          console.log(res, 'res')
+          this.monthSaleGoalDetailsList = res;
+          for (const item of this.monthSaleGoalDetailsList) {
+            item.saleOrg = this.$store.state.user.orgName,
+            item.saleZone = this.form.saleZone,
+            item.custom = this.form.custom,
+            item.dept = this.form.dept,
+            item.creator = this.form.creator
+            item.monthly = new Date().getFullYear().toString() + '-' + (new Date().getMonth() + 1).toString().padStart(2,
+            '0')
+          }
+        }).catch((e) => {
+          this.$message.error(e.message)
+        }).finally((e) => {
+          this.loading = false;
+        })
+      }
     }
   }