Przeglądaj źródła

Merge branch 'purchaseDev' of http://172.16.100.139/new-business/drp-web into purchaseDev

002201 2 lat temu
rodzic
commit
d2af02c1e3

+ 30 - 3
src/views/purchase/PurchaseDemandList/add.vue

@@ -89,6 +89,7 @@
                 clearable
                 type="date"
                 value-format="yyyy-MM-dd"
+                @change="changeDemandDate"
                 size="small"
                 style="width: 200px"
               >
@@ -269,6 +270,8 @@
           </el-table-column>
           <el-table-column show-overflow-tooltip label="需求可用周期" align="center"  prop="demandPeriod" width="120px"/>
           <el-table-column show-overflow-tooltip label="集团预测分类" align="center"  prop="forecastClassify" width="120px"/>
+          <el-table-column show-overflow-tooltip label="近一月需求" align="center"  prop="onemonthAvgVolume" width="120px"/>
+          <el-table-column show-overflow-tooltip label="近三月需求" align="center"  prop="threemonthAvgVolume" width="120px"/>
           <el-table-column show-overflow-tooltip label="交货日期" align="center"  prop="deliveryDate" width="230px">
             <template slot-scope="scope">
               <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'deliveryDate'" :rules="{ required: true, message: '请填写交货日期', trigger: 'blur' }">
@@ -276,10 +279,10 @@
                   v-model="scope.row.deliveryDate"
                   :readonly="sonDisable"
                   clearable
-                  type="datetime"
+                  type="date"
                   size="small"
-                  format="yyyy-MM-dd"
-                  value-format="yyyy-MM-dd HH:mm:ss"
+                  value-format="yyyy-MM-dd"
+                  :picker-options="pickerOptionsEnd"
                   placeholder="选择日期">
                 </el-date-picker>
               </el-form-item>
@@ -330,6 +333,11 @@
               </el-form-item>
             </template>
           </el-table-column>
+          <el-table-column show-overflow-tooltip label="最终采购执行数量" align="center"  prop="executeQty" width="150px">
+            <template slot-scope="scope">
+              {{scope.row.executeQty ? scope.row.executeQty : 0 }}
+            </template>
+          </el-table-column>
           <el-table-column show-overflow-tooltip label="收货仓库" align="center"  prop="deliveryWarehouseName" width="200px">
             <template slot-scope="scope">
               <el-form-item class="hang">
@@ -549,6 +557,17 @@ export default {
       personOptions: [],
       deptOptions: [],
       customerOptions: [],
+      pickerOptionsEnd: {
+        disabledDate: (time) => {
+          let beginDateVal = this.basicForm.demandDate;
+          if (beginDateVal) {
+            return (
+              time.getTime() <
+              new Date(beginDateVal).getTime() - 8.64e7
+            );
+          }
+        }
+      },
       isBDXQ: false,
       isYl: false
     }
@@ -562,6 +581,12 @@ export default {
     }
   },
   methods: {
+    // 改变单据日期时清空子表的调拨日期
+    changeDemandDate() {
+      this.basicForm.puDemandItemList.forEach(item => {
+        item.deliveryDate = null
+      })
+    },
     // 更改业务类型调整明细行内补单或紧急标识
     changeBillType() {
       if (this.basicForm.billType == 'BDXQ' && this.basicForm.puDemandItemList.length != 0) {
@@ -717,6 +742,8 @@ export default {
         reservedQty: null,
         demandPeriod: null,
         forecastClassify: null,
+        onemonthAvgVolume: null,
+        threemonthAvgVolume: null,
         deliveryDate: null,
         isUrgency: this.basicForm.billType == 'JJXQ' ? 'Y' : 'N',
         isReplenishment: this.basicForm.billType == 'BDXQ'? 'Y': 'N',

+ 115 - 24
src/views/purchase/PurchaseDemandList/index.vue

@@ -16,7 +16,7 @@
             </el-col>
             <el-col :span="1.5">
               <el-form-item label="需求客户">
-                <el-select clearable size="small" v-model="queryParams.customer" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')" style="width: 200px">
+                <el-select clearable size="small" v-model="queryParams.customer" @focus="chooseOrg('CUSTOMER_PARAM', true, '需求客户')" style="width: 200px">
                   <el-option v-for="item in customerOptions" :key="item.id" :label="item.name" :value="item.id" />
                 </el-select>
               </el-form-item>
@@ -226,14 +226,53 @@
       <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
       </el-upload>
       <div slot="footer" class="dialog-footer">
-      <el-button type="primary" @click="submitFileForm">确 定</el-button>
-      <el-button @click="upload.open = false">取 消</el-button>
+      <el-button size="small" type="primary" @click="submitFileForm">确 定</el-button>
+      <el-button size="small" @click="upload.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 模板下载新增参数 -->
+    <el-dialog title="需求模板下载" :visible.sync="download.open" width="400px">
+      <el-row style="margin-bottom: 20px;">
+        <span style="margin-right: 10px;">需求客户</span>
+        <el-select clearable size="small" v-model="download.customer" @clear="download.customer = ''" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')">
+          <el-option v-for="item in mBcustomer" :key="item.id" :label="item.name" :value="item.code" />
+        </el-select>
+      </el-row>
+      <el-row style="margin-bottom: 20px;">
+        <span style="margin-right: 10px;">供应仓库</span>
+        <el-select clearable size="small" v-model="download.warehouse" @clear="cleanMb" @focus="chooseOrg('WAREHOUSE_PARAM', true, '选择仓库')">
+          <el-option v-for="item in mBwarehouse" :key="item.id" :label="item.name" :value="item.code" />
+        </el-select>
+      </el-row>
+      <el-row style="margin-bottom: 20px;">
+        <span style="margin-right: 10px;">供应货位</span>
+        <el-select clearable size="small" v-model="download.cargoSpace" @clear="download.cargoSpace = ''" @focus="chooseOrg('ALLOCATION_PARAM', true, '选择货位', download.warehouseId)">
+          <el-option v-for="item in mBcargoSpace" :key="item.id" :label="item.name" :value="item.code" />
+        </el-select>
+      </el-row>
+      <el-row style="margin-bottom: 20px;">
+        <span style="margin-right: 10px;">品类选择</span>
+        <el-select
+        v-model="download.category"
+        size="small"
+        clearable
+        @focus="chooseTreeRefer('MATERIALCLASSIFY_PARAM', false, '选择品类')"
+        >
+          <el-option v-for="item in classOptions" :key="item.id" :label="item.name" :value="item.code" />
+        </el-select>
+      </el-row>
+      <div slot="footer" class="dialog-footer">
+      <el-button size="small" type="primary" @click="mbDownload">模板下载</el-button>
+      <el-button size="small" @click="download.open = false">取 消</el-button>
       </div>
     </el-dialog>
 
     <Add v-model="isList" v-if="!isList" :pageStu="page" :disable="disable" :row="rowDetail" @refresh="resetList"/>
   
     <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
+
+    <TreeRefers ref="tree" @doSubmit="selectionsToInput2" :single="true"/>
   </div>
 </template>
 
@@ -242,6 +281,7 @@
 import { getToken } from "@/utils/auth";
 import Add from './add.vue'
 import Refers from '@/components/Refers/refers.vue'
+import TreeRefers from '@/components/Refers/treeRefer.vue'
 import CollapseTransition from '@/components/MyCollapse/collapse.vue'
 import {getDemandList, delDemand, downLoadDemand, exportDemand } from '@/api/purchase/purchaseDemand.js'
 export default {
@@ -249,7 +289,8 @@ export default {
   components: {
     Add,
     CollapseTransition,
-    Refers
+    Refers,
+    TreeRefers
   },
   dicts: ['sys_processing_mode', 'sys_status', 'sys_bill_source', 'sys_business', 'sys_reserve_ratio', 'sys_period_unit', 'sys_price_type'],
   data() {
@@ -269,6 +310,19 @@ export default {
         // 上传的地址
         url: process.env.VUE_APP_BASE_API + "/pu/demand/import"
       },
+      // 模板下载参数
+      download: {
+        open: false,
+        customer: '',
+        warehouse: '',
+        warehouseId: '',
+        cargoSpace: '',
+        category: ''
+      },
+      mBcustomer: [],
+      mBwarehouse: [],
+      mBcargoSpace: [],
+      classOptions: [],
       // 下拉收起配置
       expanded: false,
       // 页面配置
@@ -389,26 +443,30 @@ export default {
       this.ids = selection.map(item => item.id)
       console.log('选中数组', this.ids.join())
     },
+    mbDownload() {
+      downLoadDemand(this.download).then(res => {
+        console.log('下载的文件流', res)
+        const blob = new Blob([res], {
+          type: "application/vnd.ms-excel;charset=UTF-8",
+        });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
+        const downloadElement = document.createElement("a"); //创建a标签
+        const href = window.URL.createObjectURL(blob); // 创建下载的链接
+        // var temp = res.headers["content-disposition"]; 
+        // var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
+        // var name = fileName.split(";")[0]; //切割成文件名
+        downloadElement.href = href;  //下载地址
+        downloadElement.download = '模板'; // 下载后文件名
+        document.body.appendChild(downloadElement);
+        downloadElement.click(); // 点击下载
+        document.body.removeChild(downloadElement); // 下载完成移除元素
+        window.URL.revokeObjectURL(href); // 释放blob对象
+        this.download.open = false
+      })
+    },
     handleCommand(command) {
       // alert(command)
       if(command == '模板下载') {
-        downLoadDemand({}).then(res => {
-          console.log('下载的文件流', res)
-          const blob = new Blob([res], {
-            type: "application/vnd.ms-excel;charset=UTF-8",
-          });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
-          const downloadElement = document.createElement("a"); //创建a标签
-          const href = window.URL.createObjectURL(blob); // 创建下载的链接
-          // var temp = res.headers["content-disposition"]; 
-          // var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
-          // var name = fileName.split(";")[0]; //切割成文件名
-          downloadElement.href = href;  //下载地址
-          downloadElement.download = '模板'; // 下载后文件名
-          document.body.appendChild(downloadElement);
-          downloadElement.click(); // 点击下载
-          document.body.removeChild(downloadElement); // 下载完成移除元素
-          window.URL.revokeObjectURL(href); // 释放blob对象
-        })
+        this.download.open = true
       }
       if (command == '数据导入') {
         this.upload.title = "用户导入"
@@ -536,17 +594,35 @@ export default {
       this.expanded = !this.expanded
     },
     // 搜索区参照选择
-    chooseOrg(type, isPage, title) {
+    chooseOrg(type, isPage, title, stordocId) {
       this.referCondition.type = type
       this.referCondition.isPage = isPage
       this.referCondition.title = title
+      this.referCondition.stordocId = stordocId
       this.$refs.refer.init(this.referCondition)
     },
     selectionsToInput(selection) {
-      if (this.referCondition.type == 'CUSTOMER_PARAM') {
+      // 搜索区选择客户
+      if (this.referCondition.type == 'CUSTOMER_PARAM' && this.referCondition.title == '需求客户') {
         this.customerOptions = selection
         this.queryParams.customer = selection[0].id
       }
+      // 模板内选择客户
+      if (this.referCondition.type == 'CUSTOMER_PARAM' && this.referCondition.title == '选择客户') {
+        this.mBcustomer = selection
+        this.download.customer = selection[0].code
+      }
+      // 模板内选择仓库
+      if (this.referCondition.type == 'WAREHOUSE_PARAM' && this.referCondition.title == '选择仓库') {
+        this.mBwarehouse = selection
+        this.download.warehouse = selection[0].code
+        this.download.warehouseId = selection[0].id
+      }
+      // 模板内选择货位
+      if (this.referCondition.type == 'ALLOCATION_PARAM' && this.referCondition.title == '选择货位') {
+        this.mBcargoSpace = selection
+        this.download.cargoSpace = selection[0].code
+      }
       if (this.referCondition.type == 'CONTACTS_PARAM') {
         this.personOptions = selection
         this.queryParams.demandPersonal = selection[0].code
@@ -555,7 +631,22 @@ export default {
         this.deptOptions = selection
         this.queryParams.demandDept = selection[0].id
       }
-    }
+    },
+    cleanMb() {
+      this.download.warehouse = ''
+      this.download.warehouseId = ''
+    },
+    // 搜索区树形选择
+    chooseTreeRefer(type, isPage, title) {
+      this.referCondition.type = type
+      this.referCondition.isPage = isPage
+      this.referCondition.title = title
+      this.$refs.tree.init(this.referCondition)
+    },
+    selectionsToInput2(selection) {
+      this.classOptions.push(selection)
+      this.download.category = selection.code
+    },
   }
 }
 </script>

+ 2 - 1
src/views/purchase/transferOrder/add.vue

@@ -324,6 +324,7 @@
             <template slot-scope="scope">
               <el-form-item class="hang">
                 <el-date-picker
+                  ref="findDate"
                   v-model="scope.row.allotDate"
                   :readonly="sonDisable"
                   type="date"
@@ -701,7 +702,7 @@ export default {
           if (beginDateVal) {
             return (
               time.getTime() <
-              new Date(beginDateVal).getTime()
+              new Date(beginDateVal).getTime() - 8.64e7
             );
           }
         }