单片材料导出

xuhongjie
严飞永 2 weeks ago
parent d6599c5af0
commit 568ce5118e

@ -39,7 +39,6 @@ service.interceptors.request.use(config => {
config.url = url; config.url = url;
} }
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) { if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
const requestObj = { const requestObj = {
url: config.url, url: config.url,
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data, data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
@ -129,10 +128,9 @@ service.interceptors.response.use(res => {
// 通用下载方法 // 通用下载方法
export function download(url, params, filename, config) { export function download(url, params, filename, config) {
downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", }) downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
console.log(tansParams(params))
return service.post(url, params, { return service.post(url, params, {
transformRequest: [(params) => { transformRequest: [(params) => { return tansParams(params) }],
return Array.isArray(params) ? params : tansParams(params) }],
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
responseType: 'blob', responseType: 'blob',
...config ...config

@ -144,6 +144,7 @@ export default {
dicts: ["xzfl"], dicts: ["xzfl"],
data() { data() {
return { return {
ids: [],
// //
loading: true, loading: true,
// //
@ -283,19 +284,22 @@ export default {
this.download( this.download(
"/gysl/basicInformation/exportInfo", "/gysl/basicInformation/exportInfo",
{ {
idList: this.ids[0] idList: this.ids
}, },
`基本信息${new Date().getTime()}.xlsx` `基本信息${new Date().getTime()}.xlsx`
); );
}, },
/** 单片材料导出按钮操作 */ /** 单片材料导出按钮操作 */
handleExporttwo() { handleExporttwo() {
console.log(this.ids)
this.download( this.download(
"/gysl/basicInformation/wordExport", "/gysl/basicInformation/wordExport",
this.ids , {
`单片材料${new Date().getTime()}.docx` ids: this.ids.join(","),
},
`单片材料${new Date().getTime()}.zip`
); );
}, },

@ -14,12 +14,12 @@
</el-col> </el-col>
<el-col :span="7"> <el-col :span="7">
<el-form-item label="建设起止时间"> <el-form-item label="建设起止时间">
<el-date-picker v-model="queryParams.begainTime" type="date" placeholder="开始日期" <el-date-picker v-model="queryParams.startTime" type="month" placeholder="开始月份"
value-format="yyyy-MM-dd" style="width: 9rem;" :clearable="true"> value-format="yyyy-MM" style="width: 9rem;" :clearable="true">
</el-date-picker> </el-date-picker>
~ ~
<el-date-picker v-model="queryParams.endTime" type="date" placeholder="结束日期" <el-date-picker v-model="queryParams.endTime" type="month" placeholder="结束月份"
value-format="yyyy-MM-dd" style="width: 9rem;" :clearable="true"> value-format="yyyy-MM" style="width: 9rem;" :clearable="true">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>

Loading…
Cancel
Save