增加维修单导入
This commit is contained in:
parent
da33f75322
commit
fd8f5488bf
@ -124,8 +124,22 @@ export default {
|
||||
post: async function (params) {
|
||||
return await http.post(this.url,params);
|
||||
}
|
||||
},
|
||||
template:{
|
||||
url: `${config.API_URL}/repair.order.import.template`,
|
||||
name: "维修工单导入模版",
|
||||
post: async function (params) {
|
||||
return await http.get(this.url,params,{responseType: 'arraybuffer'});
|
||||
}
|
||||
},
|
||||
import:{
|
||||
url: `${config.API_URL}/repair.order.import`,
|
||||
name: "维修工单导入",
|
||||
post: async function (params) {
|
||||
return await http.post(this.url,params,{'Content-Type': 'multipart/form-data'});
|
||||
}
|
||||
},
|
||||
},
|
||||
maintenance:{
|
||||
list:{
|
||||
url: `${config.API_URL}/maintenance.order.list`,
|
||||
|
||||
@ -113,7 +113,7 @@ export default {
|
||||
},
|
||||
methods:{
|
||||
getWsResult(res){
|
||||
if(res.data && (res.data.type == 4 || res.data.type == 5 || res.data.type == 10 || res.data.type == 17 || res.data.type == 18 || res.data.type == 27 || res.data.type == 28 || res.data.type == 31 || res.data.type == 42 || res.data.type == 44 || res.data.type == 45 || res.data.type == 48)){
|
||||
if(res.data && (res.data.type == 4 || res.data.type == 5 || res.data.type == 10 || res.data.type == 17 || res.data.type == 18 || res.data.type == 27 || res.data.type == 28 || res.data.type == 31 || res.data.type == 42 || res.data.type == 44 || res.data.type == 45 || res.data.type == 48 || res.data.type == 49)){
|
||||
if(this.type == res.data.type){
|
||||
this.importInfo = res.data;
|
||||
this.progressShow = true;
|
||||
|
||||
@ -66,11 +66,6 @@ function start() {
|
||||
}
|
||||
|
||||
function createWebSocket(callback, token) {
|
||||
console.log(websocket,'websocket')
|
||||
// if (websocket == null || typeof websocket !== WebSocket) {
|
||||
// initWebSocket(callback, token);
|
||||
// }
|
||||
|
||||
// websocket.readyState 0 (CONNECTING) 1 (OPEN) 2 (CLOSING) 3 (CLOSED)
|
||||
// 0 连接正在建立中,尚未连接
|
||||
// 1 已经建立,可以进行通信
|
||||
@ -80,7 +75,6 @@ function createWebSocket(callback, token) {
|
||||
if(websocket && websocket.readyState === 1){
|
||||
return
|
||||
}
|
||||
console.log(websocket)
|
||||
if (websocket === null || websocket.readyState === 3) {
|
||||
initWebSocket(callback, token);
|
||||
}
|
||||
|
||||
@ -3,6 +3,14 @@
|
||||
<el-header class="header">
|
||||
<div class="left-panel">
|
||||
<el-button type="primary" :disabled="selection.length!==1" :size="size" icon="sc-icon-MaintenanceSetup" @click="upkeep">执行维修</el-button>
|
||||
<scImport ref="scImport" :size="size" type="49" :httpDisabled="httpDisabled" title="批量导入维修工单" @parentParams="importUpload" @importSuccess="importSuccess">
|
||||
<template #header>
|
||||
<el-button v-auth="'repairOrderImport'" type="primary" :size="size" plain @click="importFile" style="margin-right: 12px;">批量导入</el-button>
|
||||
</template>
|
||||
<template #download>
|
||||
<div v-auth="'repairOrderImportTemplate'" @click="importTemplate">下载导入模版</div>
|
||||
</template>
|
||||
</scImport>
|
||||
</div>
|
||||
<div class="right-panel">
|
||||
|
||||
@ -69,6 +77,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
size:'small',
|
||||
httpDisabled:false,
|
||||
flowList:[
|
||||
{name:'维修确认',left:false,right:true},
|
||||
{name:'维修中',left:true,right:true},
|
||||
@ -234,6 +243,39 @@ export default {
|
||||
this.$refs.saveDialog.open()
|
||||
})
|
||||
},
|
||||
// 批量导入
|
||||
importFile(){
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.scImport.importFile();
|
||||
})
|
||||
},
|
||||
async importTemplate() {
|
||||
const res = await this.$API.orders.order.repair.template.post();
|
||||
const blob = new Blob([res]);
|
||||
const text = new Date().getTime();
|
||||
const eLink = document.createElement('a');
|
||||
eLink.download = "维修导入模版_"+text+'.xlsx';
|
||||
eLink.style.display = 'none';
|
||||
eLink.href = URL.createObjectURL(blob);
|
||||
document.body.appendChild(eLink);
|
||||
eLink.click();
|
||||
URL.revokeObjectURL(eLink.href);
|
||||
document.body.removeChild(eLink);
|
||||
},
|
||||
async importUpload(params) {
|
||||
this.httpDisabled = true;
|
||||
const res = await this.$API.orders.order.repair.import.post(params);
|
||||
if(res.code == 200){
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
|
||||
upkeep(){
|
||||
const row = this.selection[0];
|
||||
eventBus.$emit('tagClose','/order/repair-action',{id:row.id,order_id:row.order_id});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user