修改ws token替换问题

This commit is contained in:
龙运模 2024-09-03 15:09:34 +08:00
parent 9d0d5e6b94
commit d4a90bdb7d
4 changed files with 47 additions and 35 deletions

View File

@ -90,6 +90,13 @@ export default {
return await http.post(this.url, params); return await http.post(this.url, params);
}, },
}, },
field:{
url: `${config.API_URL}/`,
name: "维修工单检索",
post: async function (params) {
return await http.post(this.url,params);
}
}
}, },
maintenance:{ maintenance:{
list:{ list:{
@ -198,6 +205,13 @@ export default {
get: async function (params) { get: async function (params) {
return await http.post(this.url, params); return await http.post(this.url, params);
}, },
},
field:{
url: `${config.API_URL}/`,
name: "维保计划检索",
post: async function (params) {
return await http.post(this.url,params);
}
} }
}, },
sock: { sock: {

View File

@ -1,7 +1,8 @@
.orderMain{ .orderMain{
background: none; //background: none;
padding: 0; padding: 0;
.cardBox{ .cardBox{
.headerView{ .headerView{
border-bottom: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8;
display: flex;justify-content: space-between;align-items: center; display: flex;justify-content: space-between;align-items: center;
@ -38,8 +39,9 @@
} }
} }
.footerCard{ .footerCard{
min-height: 800px; border-top: 10px solid #f6f8f9;
margin-top: 10px; border-top-left-radius: 0;
border-top-right-radius: 0;
.cardItem{ .cardItem{
margin-bottom: 12px; margin-bottom: 12px;
border-bottom: 1px solid #e9e9e9; border-bottom: 1px solid #e9e9e9;

View File

@ -139,11 +139,13 @@ function webSocketOnMessage(msg) {
global_callback(result); global_callback(result);
} }
} }
if (result.data && (result.data.type == -1 || result.data.type == 0 || result.data.type == 8 || result.data.type == 9)) {
if (result.type == -1 || result.type == 0 || result.type == 8 || result.type == 9) { if(result.data.type == -1 || result.data.type == 0){
if(result.type == -1 || result.type == 0){ if(result.data && result.data.data.token){
if(result.data && result.data.token){ console.log(result.data.data.token)
tool.cookie.set("TOKEN", result.data.token); // tool.cookie.set("TOKEN", result.data.data.token);
let reToken = result.data.data.token.replace(/Bearer /g, "");
tool.cookie.set("TOKEN", reToken);
} }
}else{ }else{
showNot = ElNotification.error({ showNot = ElNotification.error({

View File

@ -77,12 +77,6 @@ export default {
} }
}, },
methods: { methods: {
async getStatusList() {
const res = await this.$API.orders.order.maintenance.status.post();
if (res.code == 200) {
this.statusList = res.data;
}
},
searchShowClick(){ searchShowClick(){
this.searchShow = !this.searchShow; this.searchShow = !this.searchShow;
this.searchList.forEach(item=>{ this.searchList.forEach(item=>{
@ -91,33 +85,33 @@ export default {
} }
}) })
}, },
getSelectData(item){ async getSelectData(item) {
let {data, params} = item; let {data, params} = item;
this.params = params; this.params = params;
if(data.code == "id"){ let searchParams = this.$TOOL.objCopy(params);
this.getCompanyList(data,params) searchParams.field = ""
}else if(data.code == "active_status"){ if (typeof data.code === 'string') {
this.getStatusList(data,params); searchParams.field = data.code;
} else {
searchParams.field = data.code[0];
} }
}, if (data.type == 'select') {
const res = await this.$API.orders.order.maintenance.field.post(searchParams);
async getCompanyList(data,params) { if (res.code == 200) {
const res = await this.$API.system.company.select.post(params);
if (res.data && res.data.length > 0) { if (res.data && res.data.length > 0) {
res.data.forEach(item => { res.data.forEach(item => {
item.label = item.full_name; item.label = item[data.code];
}) })
} }
if(res.code == 200){
this.searchList.forEach(item => { this.searchList.forEach(item => {
if (item.code == data.code) { if (item.code == data.code) {
item.data = res.data; item.data = res.data;
} }
}) })
} }
}
}, },
// //
confirmOrderClick(){ confirmOrderClick(){
this.dialog.confirm = true; this.dialog.confirm = true;