🐛 过程配置与常用线路组织筛选只传单个deptId
多组织账号默认搜索不再拼接逗号分隔 ID,避免列表接口 Long 转换失败。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -436,7 +436,25 @@ export default {
|
|||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
defaultDeptId() {
|
defaultDeptId() {
|
||||||
return (this.userInfo && (this.userInfo.deptId || this.userInfo.dept_id)) || '';
|
const raw = (this.userInfo && (this.userInfo.deptId || this.userInfo.dept_id)) || '';
|
||||||
|
return (
|
||||||
|
String(raw)
|
||||||
|
.split(',')
|
||||||
|
.map(item => item.trim())
|
||||||
|
.filter(Boolean)[0] || ''
|
||||||
|
);
|
||||||
|
},
|
||||||
|
normalizeListQuery(params = {}) {
|
||||||
|
const query = { ...params, ...this.query };
|
||||||
|
const rawDeptId = query.deptId ?? query.searchDeptId;
|
||||||
|
delete query.searchDeptId;
|
||||||
|
if (rawDeptId !== undefined && rawDeptId !== null && String(rawDeptId).trim() !== '') {
|
||||||
|
query.deptId = String(rawDeptId).split(',')[0].trim();
|
||||||
|
} else {
|
||||||
|
delete query.deptId;
|
||||||
|
}
|
||||||
|
query.allDept = this.isAdmin ? 1 : 0;
|
||||||
|
return query;
|
||||||
},
|
},
|
||||||
applyDefaultDeptSearch() {
|
applyDefaultDeptSearch() {
|
||||||
const deptId = this.defaultDeptId();
|
const deptId = this.defaultDeptId();
|
||||||
@@ -999,9 +1017,9 @@ export default {
|
|||||||
this.onLoad(this.page, this.query);
|
this.onLoad(this.page, this.query);
|
||||||
},
|
},
|
||||||
searchChange(params, done) {
|
searchChange(params, done) {
|
||||||
this.query = params;
|
this.query = this.normalizeListQuery(params);
|
||||||
this.page.currentPage = 1;
|
this.page.currentPage = 1;
|
||||||
this.onLoad(this.page, params);
|
this.onLoad(this.page, this.query);
|
||||||
done();
|
done();
|
||||||
},
|
},
|
||||||
selectionChange(list) {
|
selectionChange(list) {
|
||||||
@@ -1024,12 +1042,10 @@ export default {
|
|||||||
},
|
},
|
||||||
onLoad(page, params = {}) {
|
onLoad(page, params = {}) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
const query = this.normalizeListQuery(params);
|
||||||
|
this.query = query;
|
||||||
api
|
api
|
||||||
.getList(page.currentPage, page.pageSize, {
|
.getList(page.currentPage, page.pageSize, query)
|
||||||
...params,
|
|
||||||
...this.query,
|
|
||||||
allDept: this.isAdmin ? 1 : 0,
|
|
||||||
})
|
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const result = res.data.data;
|
const result = res.data.data;
|
||||||
this.page.total = result.total;
|
this.page.total = result.total;
|
||||||
@@ -1042,8 +1058,7 @@ export default {
|
|||||||
},
|
},
|
||||||
buildExportParams() {
|
buildExportParams() {
|
||||||
return {
|
return {
|
||||||
...this.query,
|
...this.normalizeListQuery(this.query),
|
||||||
allDept: this.isAdmin ? 1 : 0,
|
|
||||||
ids: this.ids,
|
ids: this.ids,
|
||||||
[this.website.tokenHeader]: getToken(),
|
[this.website.tokenHeader]: getToken(),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -565,7 +565,13 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
defaultDeptId() {
|
defaultDeptId() {
|
||||||
return (this.userInfo && (this.userInfo.deptId || this.userInfo.dept_id)) || '';
|
const raw = (this.userInfo && (this.userInfo.deptId || this.userInfo.dept_id)) || '';
|
||||||
|
return (
|
||||||
|
String(raw)
|
||||||
|
.split(',')
|
||||||
|
.map(item => item.trim())
|
||||||
|
.filter(Boolean)[0] || ''
|
||||||
|
);
|
||||||
},
|
},
|
||||||
applyDefaultDeptSearch() {
|
applyDefaultDeptSearch() {
|
||||||
const deptId = this.defaultDeptId();
|
const deptId = this.defaultDeptId();
|
||||||
@@ -580,15 +586,32 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
flattenDept(tree, level = 0) {
|
flattenDept(tree, level = 0) {
|
||||||
return tree.flatMap(item => [
|
return tree.flatMap(item => {
|
||||||
{
|
const id =
|
||||||
label: `${' '.repeat(level)}${item.title || item.deptName || item.name}`,
|
item.id === undefined || item.id === null || item.id === '' ? '' : String(item.id);
|
||||||
value: item.id,
|
if (!id) return [];
|
||||||
},
|
return [
|
||||||
...(item.children && item.children.length
|
{
|
||||||
? this.flattenDept(item.children, level + 1)
|
label: `${' '.repeat(level)}${item.title || item.deptName || item.name}`,
|
||||||
: []),
|
value: id,
|
||||||
]);
|
},
|
||||||
|
...(item.children && item.children.length
|
||||||
|
? this.flattenDept(item.children, level + 1)
|
||||||
|
: []),
|
||||||
|
];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
normalizeListQuery(params = {}) {
|
||||||
|
const query = { ...params, ...this.query };
|
||||||
|
const rawDeptId = query.deptId ?? query.searchDeptId;
|
||||||
|
delete query.searchDeptId;
|
||||||
|
if (rawDeptId !== undefined && rawDeptId !== null && String(rawDeptId).trim() !== '') {
|
||||||
|
query.deptId = String(rawDeptId).split(',')[0].trim();
|
||||||
|
} else {
|
||||||
|
delete query.deptId;
|
||||||
|
}
|
||||||
|
query.allDept = this.isAdmin ? 1 : 0;
|
||||||
|
return query;
|
||||||
},
|
},
|
||||||
displayStatus(status) {
|
displayStatus(status) {
|
||||||
const statusMap = {
|
const statusMap = {
|
||||||
@@ -1074,9 +1097,9 @@ export default {
|
|||||||
this.onLoad(this.page, this.query);
|
this.onLoad(this.page, this.query);
|
||||||
},
|
},
|
||||||
searchChange(params, done) {
|
searchChange(params, done) {
|
||||||
this.query = params;
|
this.query = this.normalizeListQuery(params);
|
||||||
this.page.currentPage = 1;
|
this.page.currentPage = 1;
|
||||||
this.onLoad(this.page, params);
|
this.onLoad(this.page, this.query);
|
||||||
done();
|
done();
|
||||||
},
|
},
|
||||||
selectionChange(list) {
|
selectionChange(list) {
|
||||||
@@ -1099,12 +1122,10 @@ export default {
|
|||||||
},
|
},
|
||||||
onLoad(page, params = {}) {
|
onLoad(page, params = {}) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
const query = this.normalizeListQuery(params);
|
||||||
|
this.query = query;
|
||||||
api
|
api
|
||||||
.getList(page.currentPage, page.pageSize, {
|
.getList(page.currentPage, page.pageSize, query)
|
||||||
...params,
|
|
||||||
...this.query,
|
|
||||||
allDept: this.isAdmin ? 1 : 0,
|
|
||||||
})
|
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const result = res.data.data || {};
|
const result = res.data.data || {};
|
||||||
this.page.total = result.total || 0;
|
this.page.total = result.total || 0;
|
||||||
@@ -1117,8 +1138,7 @@ export default {
|
|||||||
},
|
},
|
||||||
buildExportParams() {
|
buildExportParams() {
|
||||||
return {
|
return {
|
||||||
...this.query,
|
...this.normalizeListQuery(this.query),
|
||||||
allDept: this.isAdmin ? 1 : 0,
|
|
||||||
ids: this.ids,
|
ids: this.ids,
|
||||||
[this.website.tokenHeader]: getToken(),
|
[this.website.tokenHeader]: getToken(),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user