Browse Source

2025-11-19

ECN中Delegate Access 选择时页面卡住
master
fengyuan_yang 10 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 => { 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 return config
}, error => { }, error => {
return Promise.reject(error) return Promise.reject(error)
@ -127,6 +133,12 @@ const instance2 = axios.create({
*/ */
instance2.interceptors.request.use(config => { instance2.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 return config
}, error => { }, error => {
return Promise.reject(error) return Promise.reject(error)
@ -155,6 +167,7 @@ export const createAPI = (url, method, data) => {
} else { } else {
config.data = data config.data = data
} }
if (data === 'download'){ // 下载功能的请求 if (data === 'download'){ // 下载功能的请求
return instance2({ return instance2({
url, url,

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

@ -5041,6 +5041,7 @@
searchDelegateAccessByUser(params).then(({data}) => { searchDelegateAccessByUser(params).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.baseDelegateAccessList = data.rows; this.baseDelegateAccessList = data.rows;
// 不清空选中状态,依赖 :reserve-selection 保留之前的选择
} else { } else {
this.$message.warning(data.msg) this.$message.warning(data.msg)
} }
@ -5050,8 +5051,25 @@
}, },
handleSelectionChange(val) { 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) { handleTableClick(row, column, event, val) {
@ -5060,17 +5078,19 @@
}, },
openDelegateAccess() { 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 => { rows.forEach(item => {
let row = this.baseDelegateAccessList.find(row => row.delegateAccess === item.delegateAccess); 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() { closeDelegateAccess() {

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

@ -2556,6 +2556,14 @@
this.chooseItemList = [] this.chooseItemList = []
this.chooseItemList2 = [] this.chooseItemList2 = []
this.chooseCSItemList = [] this.chooseCSItemList = []
// 清空 DelegateAccess 的选择(delegateAccessName 是计算属性会自动清空)
this.selectionDelegateAccess = []
this.selectionDelegateAccess2 = []
this.baseDelegateAccessList = []
this.changeDelegateAccess = {
delegateAccess: '',
delegateAccessName: '',
}
this.getDepartmentByUserName() this.getDepartmentByUserName()
this.getEcnTypeData() // 获取ECN种类 this.getEcnTypeData() // 获取ECN种类
this.chooseDataList = data.rows.chooseDataList this.chooseDataList = data.rows.chooseDataList
@ -3357,6 +3365,7 @@
searchDelegateAccessByUser(params).then(({data}) => { searchDelegateAccessByUser(params).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.baseDelegateAccessList = data.rows; this.baseDelegateAccessList = data.rows;
// 不清空选中状态,依赖 :reserve-selection 保留之前的选择
} else { } else {
this.$message.warning(data.msg) this.$message.warning(data.msg)
} }
@ -3366,8 +3375,25 @@
}, },
handleSelectionChange(val) { 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) { handleTableClick(row, column, event, val) {
@ -3376,15 +3402,19 @@
}, },
openDelegateAccess() { 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 => { rows.forEach(item => {
let row = this.baseDelegateAccessList.find(row => row.delegateAccess === item.delegateAccess); let row = this.baseDelegateAccessList.find(row => row.delegateAccess === item.delegateAccess);
this.$refs.delegateAccesstTable.toggleRowSelection(row);
if (row) { // 只对当前列表中存在的行进行选中操作
this.$refs.delegateAccesstTable.toggleRowSelection(row, true); // 明确设置为选中状态
}
}) })
})
}
}
})
}, },
closeDelegateAccess() { closeDelegateAccess() {
@ -3392,6 +3422,8 @@
}, },
confirmDelegateAccess() { confirmDelegateAccess() {
// selectionDelegateAccess2 已经在 handleSelectionChange 中合并了历史选择
// 直接保存即可
this.selectionDelegateAccess = JSON.parse(JSON.stringify(this.selectionDelegateAccess2)) this.selectionDelegateAccess = JSON.parse(JSON.stringify(this.selectionDelegateAccess2))
this.delegateAccessVisible = false; this.delegateAccessVisible = false;
}, },

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

@ -141,7 +141,11 @@ export default {
} }
this.uploadLoading = false; this.uploadLoading = false;
}).catch((error)=>{ }).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; this.uploadLoading = false;
}) })
}, },

Loading…
Cancel
Save