|
|
@@ -7,7 +7,7 @@
|
|
|
>
|
|
|
<el-card shadow="never">
|
|
|
<!-- 数据表格 -->
|
|
|
- <div>
|
|
|
+ <div style="padding-bottom: 12px">
|
|
|
<el-form
|
|
|
label-position="left"
|
|
|
class="ele-form-search"
|
|
|
@@ -15,6 +15,7 @@
|
|
|
:rules="rules"
|
|
|
@keyup.enter.native="search"
|
|
|
@submit.native.prevent
|
|
|
+ ref="formData"
|
|
|
>
|
|
|
<el-row :gutter="15">
|
|
|
<el-col :span="5">
|
|
|
@@ -90,8 +91,6 @@
|
|
|
:needPage="!isView"
|
|
|
:columns="columns"
|
|
|
:datasource="datasource"
|
|
|
- height="calc(100vh - 405px)"
|
|
|
- full-height="calc(100vh - 116px)"
|
|
|
tool-class="ele-toolbar-form"
|
|
|
>
|
|
|
<!-- 状态 -->
|
|
|
@@ -347,38 +346,39 @@
|
|
|
return `${obj.year}-${obj.month}-${obj.strDate}`;
|
|
|
},
|
|
|
downLoad() {
|
|
|
- if (!this.formData.name) {
|
|
|
- return this.$message.error('请输入名称');
|
|
|
- }
|
|
|
- if (this.formData.time.length <= 0) {
|
|
|
- return this.$message.error('请选择时间');
|
|
|
- }
|
|
|
- this.loading = true;
|
|
|
- const params = Object.assign({}, this.formData);
|
|
|
- if (params.time?.length) {
|
|
|
- params.startTime = params.time[0];
|
|
|
- params.endTime = params.time[1];
|
|
|
- }
|
|
|
- delete params.time;
|
|
|
- sendReceiveGatherExcel(params).then((data) => {
|
|
|
- try {
|
|
|
- let objectUrl1 = window.URL.createObjectURL(new Blob([data]));
|
|
|
- let elink = document.createElement('a');
|
|
|
- elink.setAttribute(
|
|
|
- 'download',
|
|
|
- decodeURI(decodeURI('收发明细表.xlsx'))
|
|
|
- );
|
|
|
- elink.style.display = 'none';
|
|
|
- elink.href = objectUrl1;
|
|
|
- document.body.appendChild(elink);
|
|
|
- elink.click();
|
|
|
- document.body.removeChild(elink);
|
|
|
- window.URL.revokeObjectURL(elink.href);
|
|
|
- this.loading = false;
|
|
|
- this.visible = false;
|
|
|
- this.$emit('reload');
|
|
|
- } catch (err) {
|
|
|
- this.$message.error('导出失败,请联系管理员!');
|
|
|
+ this.$refs.formData.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.loading = true;
|
|
|
+ const params = Object.assign({}, this.formData);
|
|
|
+ if (params.time?.length) {
|
|
|
+ params.startTime = params.time[0];
|
|
|
+ params.endTime = params.time[1];
|
|
|
+ }
|
|
|
+ delete params.time;
|
|
|
+ sendReceiveGatherExcel(params).then((data) => {
|
|
|
+ try {
|
|
|
+ let objectUrl1 = window.URL.createObjectURL(new Blob([data]));
|
|
|
+ let elink = document.createElement('a');
|
|
|
+ elink.setAttribute(
|
|
|
+ 'download',
|
|
|
+ decodeURI(decodeURI('收发明细表.xlsx'))
|
|
|
+ );
|
|
|
+ elink.style.display = 'none';
|
|
|
+ elink.href = objectUrl1;
|
|
|
+ document.body.appendChild(elink);
|
|
|
+ elink.click();
|
|
|
+ document.body.removeChild(elink);
|
|
|
+ window.URL.revokeObjectURL(elink.href);
|
|
|
+ this.loading = false;
|
|
|
+ this.visible = false;
|
|
|
+ this.$emit('reload');
|
|
|
+ } catch (err) {
|
|
|
+ this.$message.error('导出失败,请联系管理员!');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!');
|
|
|
+ return false;
|
|
|
}
|
|
|
});
|
|
|
},
|