Browse Source

2025-11-19

ECN中Delegate Access 选择时页面卡住
master
fengyuan_yang 2 months ago
parent
commit
63079829ac
  1. 15
      src/utils/httpRequest.js
  2. 38
      src/views/modules/changeManagement/changeRecord.vue
  3. 48
      src/views/modules/changeManagement/changeRequest.vue
  4. 6
      src/views/modules/oss/ossComponents.vue

15
src/utils/httpRequest.js

@ -92,7 +92,13 @@ const instance = axios.create({
* 请求拦截
*/
instance.interceptors.request.use(config => {
config.headers['token'] =Vue.cookie.get('token') // 请求头带上token
config.headers['token'] = Vue.cookie.get('token') // 请求头带上token
// 如果是 FormData,删除 Content-Type 让浏览器自动设置(包含 boundary)
if (config.data instanceof FormData) {
delete config.headers['Content-Type']
}
return config
}, error => {
return Promise.reject(error)
@ -127,6 +133,12 @@ const instance2 = axios.create({
*/
instance2.interceptors.request.use(config => {
config.headers['token'] = Vue.cookie.get('token') // 请求头带上token
// 如果是 FormData,删除 Content-Type 让浏览器自动设置(包含 boundary)
if (config.data instanceof FormData) {
delete config.headers['Content-Type']
}
return config
}, error => {
return Promise.reject(error)
@ -155,6 +167,7 @@ export const createAPI = (url, method, data) => {
} else {
config.data = data
}
if (data === 'download'){ // 下载功能的请求
return instance2({
url,

38
src/views/modules/changeManagement/changeRecord.vue

@ -5041,6 +5041,7 @@
searchDelegateAccessByUser(params).then(({data}) => {
if (data && data.code === 0) {
this.baseDelegateAccessList = data.rows;
// :reserve-selection
} else {
this.$message.warning(data.msg)
}
@ -5050,8 +5051,25 @@
},
handleSelectionChange(val) {
//
this.selectionDelegateAccess2 = val;
// val
// selectionDelegateAccess
//
let currentDataKeys = this.baseDelegateAccessList.map(item => item.delegateAccess);
//
let historyNotInCurrent = this.selectionDelegateAccess.filter(item =>
!currentDataKeys.includes(item.delegateAccess)
);
// +
let merged = [...historyNotInCurrent, ...val];
//
let map = new Map();
merged.forEach(item => map.set(item.delegateAccess, item));
this.selectionDelegateAccess2 = Array.from(map.values());
},
handleTableClick(row, column, event, val) {
@ -5060,17 +5078,19 @@
},
openDelegateAccess() {
let rows = JSON.parse(JSON.stringify(this.selectionDelegateAccess))
if (rows && rows.length > 0) {
this.$nextTick(() => {
//
// :reserve-selection
this.$nextTick(() => {
let rows = JSON.parse(JSON.stringify(this.selectionDelegateAccess))
if (rows && rows.length > 0 && this.$refs.delegateAccesstTable) {
rows.forEach(item => {
let row = this.baseDelegateAccessList.find(row => row.delegateAccess === item.delegateAccess);
if (row) {
this.$refs.delegateAccesstTable.toggleRowSelection(row);
if (row) { //
this.$refs.delegateAccesstTable.toggleRowSelection(row, true); //
}
})
})
}
}
})
},
closeDelegateAccess() {

48
src/views/modules/changeManagement/changeRequest.vue

@ -2556,6 +2556,14 @@
this.chooseItemList = []
this.chooseItemList2 = []
this.chooseCSItemList = []
// DelegateAccess delegateAccessName
this.selectionDelegateAccess = []
this.selectionDelegateAccess2 = []
this.baseDelegateAccessList = []
this.changeDelegateAccess = {
delegateAccess: '',
delegateAccessName: '',
}
this.getDepartmentByUserName()
this.getEcnTypeData() // ECN
this.chooseDataList = data.rows.chooseDataList
@ -3357,6 +3365,7 @@
searchDelegateAccessByUser(params).then(({data}) => {
if (data && data.code === 0) {
this.baseDelegateAccessList = data.rows;
// :reserve-selection
} else {
this.$message.warning(data.msg)
}
@ -3366,8 +3375,25 @@
},
handleSelectionChange(val) {
//
this.selectionDelegateAccess2 = val;
// val
// selectionDelegateAccess
//
let currentDataKeys = this.baseDelegateAccessList.map(item => item.delegateAccess);
//
let historyNotInCurrent = this.selectionDelegateAccess.filter(item =>
!currentDataKeys.includes(item.delegateAccess)
);
// +
let merged = [...historyNotInCurrent, ...val];
//
let map = new Map();
merged.forEach(item => map.set(item.delegateAccess, item));
this.selectionDelegateAccess2 = Array.from(map.values());
},
handleTableClick(row, column, event, val) {
@ -3376,15 +3402,19 @@
},
openDelegateAccess() {
let rows = JSON.parse(JSON.stringify(this.selectionDelegateAccess))
if (rows && rows.length > 0) {
this.$nextTick(() => {
//
// :reserve-selection
this.$nextTick(() => {
let rows = JSON.parse(JSON.stringify(this.selectionDelegateAccess))
if (rows && rows.length > 0 && this.$refs.delegateAccesstTable) {
rows.forEach(item => {
let row = this.baseDelegateAccessList.find(row => row.delegateAccess === item.delegateAccess);
this.$refs.delegateAccesstTable.toggleRowSelection(row);
if (row) { //
this.$refs.delegateAccesstTable.toggleRowSelection(row, true); //
}
})
})
}
}
})
},
closeDelegateAccess() {
@ -3392,6 +3422,8 @@
},
confirmDelegateAccess() {
// selectionDelegateAccess2 handleSelectionChange
//
this.selectionDelegateAccess = JSON.parse(JSON.stringify(this.selectionDelegateAccess2))
this.delegateAccessVisible = false;
},

6
src/views/modules/oss/ossComponents.vue

@ -141,7 +141,11 @@ export default {
}
this.uploadLoading = false;
}).catch((error)=>{
this.$message.error(error);
console.error('文件上传失败:', error);
const errorMsg = error.response && error.response.data && error.response.data.msg
? error.response.data.msg
: (error.message || '文件上传失败');
this.$message.error(errorMsg);
this.uploadLoading = false;
})
},

Loading…
Cancel
Save