|
@@ -252,6 +252,13 @@
|
|
<!-- 模板下载新增参数 -->
|
|
<!-- 模板下载新增参数 -->
|
|
<el-dialog title="需求模板下载" :visible.sync="download.open" @close="clearDownload" width="400px">
|
|
<el-dialog title="需求模板下载" :visible.sync="download.open" @close="clearDownload" width="400px">
|
|
<el-row style="margin-bottom: 20px;">
|
|
<el-row style="margin-bottom: 20px;">
|
|
|
|
+ <span style="margin-right: 10px;">需求计划</span>
|
|
|
|
+ <el-select size="mini" v-model="download.planType">
|
|
|
|
+ <el-option v-for="dict in dict.type.sys_plan_type" :key="dict.value" :label="dict.label" :value="dict.value">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row style="margin-bottom: 20px;">
|
|
<span style="margin-right: 10px;">需求客户</span>
|
|
<span style="margin-right: 10px;">需求客户</span>
|
|
<el-select clearable size="mini" v-model="download.customer" @clear="download.customer = ''" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')">
|
|
<el-select clearable size="mini" 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-option v-for="item in mBcustomer" :key="item.id" :label="item.name" :value="item.code" />
|
|
@@ -310,7 +317,7 @@ export default {
|
|
Refers,
|
|
Refers,
|
|
TreeRefers
|
|
TreeRefers
|
|
},
|
|
},
|
|
- dicts: ['sys_processing_mode', 'sys_status', 'sys_bill_source', 'sys_business', 'sys_reserve_ratio', 'sys_period_unit', 'sys_price_type'],
|
|
|
|
|
|
+ dicts: ['sys_processing_mode', 'sys_status', 'sys_bill_source', 'sys_business', 'sys_reserve_ratio', 'sys_period_unit', 'sys_price_type', 'sys_plan_type'],
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
loading: true,
|
|
loading: true,
|
|
@@ -332,6 +339,7 @@ export default {
|
|
// 模板下载参数
|
|
// 模板下载参数
|
|
download: {
|
|
download: {
|
|
open: false,
|
|
open: false,
|
|
|
|
+ planType: 'ZJH',
|
|
customer: '',
|
|
customer: '',
|
|
warehouse: '',
|
|
warehouse: '',
|
|
warehouseId: '',
|
|
warehouseId: '',
|
|
@@ -473,8 +481,9 @@ export default {
|
|
console.log('选中数组', this.ids.join())
|
|
console.log('选中数组', this.ids.join())
|
|
},
|
|
},
|
|
mbDownload() {
|
|
mbDownload() {
|
|
|
|
+ this.$modal.loading("正在下载模板,请稍后...");
|
|
downLoadDemand(this.download).then(res => {
|
|
downLoadDemand(this.download).then(res => {
|
|
- console.log('下载的文件流', res)
|
|
|
|
|
|
+ this.$modal.closeLoading();
|
|
const blob = new Blob([res], {
|
|
const blob = new Blob([res], {
|
|
type: "application/vnd.ms-excel;charset=UTF-8",
|
|
type: "application/vnd.ms-excel;charset=UTF-8",
|
|
});// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
|
|
});// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
|
|
@@ -484,12 +493,14 @@ export default {
|
|
// var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
|
|
// var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
|
|
// var name = fileName.split(";")[0]; //切割成文件名
|
|
// var name = fileName.split(";")[0]; //切割成文件名
|
|
downloadElement.href = href; //下载地址
|
|
downloadElement.href = href; //下载地址
|
|
- downloadElement.download = '模板'; // 下载后文件名
|
|
|
|
|
|
+ downloadElement.download = '采购需求单模板'+ this.parseTime(new Date().getTime()) + ".xlsx"; // 下载后文件名
|
|
document.body.appendChild(downloadElement);
|
|
document.body.appendChild(downloadElement);
|
|
downloadElement.click(); // 点击下载
|
|
downloadElement.click(); // 点击下载
|
|
document.body.removeChild(downloadElement); // 下载完成移除元素
|
|
document.body.removeChild(downloadElement); // 下载完成移除元素
|
|
window.URL.revokeObjectURL(href); // 释放blob对象
|
|
window.URL.revokeObjectURL(href); // 释放blob对象
|
|
this.download.open = false
|
|
this.download.open = false
|
|
|
|
+ }).catch(err => {
|
|
|
|
+ this.$modal.closeLoading();
|
|
})
|
|
})
|
|
},
|
|
},
|
|
// 关闭模板下载弹窗清空参数
|
|
// 关闭模板下载弹窗清空参数
|
|
@@ -497,6 +508,7 @@ export default {
|
|
// 模板下载参数
|
|
// 模板下载参数
|
|
this.download = {
|
|
this.download = {
|
|
open: false,
|
|
open: false,
|
|
|
|
+ planType: 'ZJH',
|
|
customer: '',
|
|
customer: '',
|
|
warehouse: '',
|
|
warehouse: '',
|
|
warehouseId: '',
|
|
warehouseId: '',
|
|
@@ -517,9 +529,11 @@ export default {
|
|
// 文件上传中处理
|
|
// 文件上传中处理
|
|
handleFileUploadProgress(event, file, fileList) {
|
|
handleFileUploadProgress(event, file, fileList) {
|
|
this.upload.isUploading = true;
|
|
this.upload.isUploading = true;
|
|
|
|
+ this.$modal.loading("正在导入数据,请稍后...");
|
|
},
|
|
},
|
|
// 文件上传成功处理
|
|
// 文件上传成功处理
|
|
handleFileSuccess(response, file, fileList) {
|
|
handleFileSuccess(response, file, fileList) {
|
|
|
|
+ this.$modal.closeLoading();
|
|
this.upload.open = false;
|
|
this.upload.open = false;
|
|
this.upload.isUploading = false;
|
|
this.upload.isUploading = false;
|
|
this.$refs.upload.clearFiles();
|
|
this.$refs.upload.clearFiles();
|
|
@@ -527,6 +541,7 @@ export default {
|
|
this.getList(this.queryParams);
|
|
this.getList(this.queryParams);
|
|
},
|
|
},
|
|
errorFile(err) {
|
|
errorFile(err) {
|
|
|
|
+ this.$modal.closeLoading();
|
|
this.$modal.notifyError("文件已变动,请重新上传");
|
|
this.$modal.notifyError("文件已变动,请重新上传");
|
|
},
|
|
},
|
|
// 提交上传文件
|
|
// 提交上传文件
|