Commit 56e5e79a authored by tanjunxin's avatar tanjunxin

fix: 1.生产报工细节优化; 2.生产报工导出功能优化

parent 4428d3a9
...@@ -16,7 +16,7 @@ import store from './store' ...@@ -16,7 +16,7 @@ import store from './store'
import router from './router' import router from './router'
import directive from './directive' // directive import directive from './directive' // directive
import plugins from './plugins' // plugins import plugins from './plugins' // plugins
import { download } from '@/utils/request' import { download, download1 } from '@/utils/request'
import './assets/icons' // icon import './assets/icons' // icon
import './permission' // permission control import './permission' // permission control
...@@ -64,6 +64,7 @@ Vue.prototype.addDateRange = addDateRange ...@@ -64,6 +64,7 @@ Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.download = download Vue.prototype.download = download
Vue.prototype.download1 = download1
Vue.prototype.handleTree = handleTree Vue.prototype.handleTree = handleTree
Vue.prototype.formatMoney = formatMoney Vue.prototype.formatMoney = formatMoney
......
...@@ -200,4 +200,29 @@ export function download(url, params, filename) { ...@@ -200,4 +200,29 @@ export function download(url, params, filename) {
}) })
} }
export function download1(url, params, filename) {
downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
return service.post(url, params, {
// transformRequest: [(params) => { return tansParams(params) }],
headers: { 'Content-Type': 'application/json;charset=utf-8' },
responseType: 'blob'
}).then(async (data) => {
const isLogin = await blobValidate(data);
if (isLogin) {
const blob = new Blob([data])
saveAs(blob, filename)
} else {
const resText = await data.text();
const rspObj = JSON.parse(resText);
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
Message.error(errMsg);
}
downloadLoadingInstance.close();
}).catch((r) => {
console.error(r)
Message.error('下载文件出现错误,请联系管理员!')
downloadLoadingInstance.close();
})
}
export default service export default service
...@@ -296,7 +296,7 @@ ...@@ -296,7 +296,7 @@
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="编排单号" width="100px" align="center" prop="arrangeCode" :show-overflow-tooltip="true"> <el-table-column label="编排单号" width="140px" align="center" prop="arrangeCode">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" @click="showArrangDetail(scope.row, scope.row.arrangeCode)">{{ <el-button size="mini" type="text" @click="showArrangDetail(scope.row, scope.row.arrangeCode)">{{
scope.row.arrangeCode }} scope.row.arrangeCode }}
...@@ -1589,11 +1589,22 @@ export default { ...@@ -1589,11 +1589,22 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download( const params = {
...this.queryParams,
workorderCodes: this.queryParams.workorderCodes ? this.queryParams.workorderCodes.split(/[\n,;,、;。]/).filter(item => item) : null,
salesVouchers: this.queryParams.salesVouchers ? this.queryParams.salesVouchers.split(/[\n,;,、;。]/).filter(item => item) : null,
productCodes: this.queryParams.productCodes ? this.queryParams.productCodes.split(/[\n,;,、;。]/).filter(item => item) : null,
arrangeCodes: this.queryParams.arrangeCodes ? this.queryParams.arrangeCodes.split(/[\n,;,、;。]/).filter(item => item) : null
}
if(this.ids && this.ids.length > 0) {
params.workorderCodes = this.selectedRows.map(item => item.workorderCode)
}
params.statusArr = params.statusArr.length > 0 ? params.statusArr : null;
delete params.pageNum;
delete params.pageSize;
this.download1(
"mes/pro/workorder/export", "mes/pro/workorder/export",
{ params,
...this.queryParams,
},
`workorder_${new Date().getTime()}.xlsx` `workorder_${new Date().getTime()}.xlsx`
); );
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment