修改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);
},
},
field:{
url: `${config.API_URL}/`,
name: "维修工单检索",
post: async function (params) {
return await http.post(this.url,params);
}
}
},
maintenance:{
list:{
@ -198,6 +205,13 @@ export default {
get: async function (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: {

View File

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

View File

@ -139,11 +139,13 @@ function webSocketOnMessage(msg) {
global_callback(result);
}
}
if (result.type == -1 || result.type == 0 || result.type == 8 || result.type == 9) {
if(result.type == -1 || result.type == 0){
if(result.data && result.data.token){
tool.cookie.set("TOKEN", result.data.token);
if (result.data && (result.data.type == -1 || result.data.type == 0 || result.data.type == 8 || result.data.type == 9)) {
if(result.data.type == -1 || result.data.type == 0){
if(result.data && result.data.data.token){
console.log(result.data.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{
showNot = ElNotification.error({

View File

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