🐛 超管业务列表默认查全部组织,并简化区划编号录入

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-29 21:41:48 +08:00
parent 2210e33643
commit e5a7ad616c
7 changed files with 63 additions and 45 deletions
+3
View File
@@ -334,6 +334,9 @@ export default {
}, },
}, },
created() { created() {
if (this.isAdmin) {
this.allDept = 1;
}
this.initDeptTree(); this.initDeptTree();
}, },
methods: { methods: {
+42 -38
View File
@@ -120,14 +120,7 @@
placeholder="请输入国家编码,如 +86" placeholder="请输入国家编码,如 +86"
v-model="regionForm.code" v-model="regionForm.code"
/> />
<el-input <el-input v-else placeholder="请输入区划编号" v-model="regionForm.subCode" />
v-else-if="isProvinceRegion"
placeholder="请输入省级区划编号"
v-model="regionForm.subCode"
/>
<el-input v-else placeholder="请输入 区划子编号" v-model="regionForm.subCode">
<template #prepend>{{ regionForm.parentCode }}</template>
</el-input>
</template> </template>
</avue-form> </avue-form>
<el-dialog title="行政区划数据导入" append-to-body v-model="excelBox" width="555px"> <el-dialog title="行政区划数据导入" append-to-body v-model="excelBox" width="555px">
@@ -419,9 +412,6 @@ export default {
isCountryRegion() { isCountryRegion() {
return Number(this.regionForm.regionLevel) === 0; return Number(this.regionForm.regionLevel) === 0;
}, },
isProvinceRegion() {
return Number(this.regionForm.regionLevel) === 1;
},
isEditRegion() { isEditRegion() {
return !validatenull(this.regionForm.originalCode); return !validatenull(this.regionForm.originalCode);
}, },
@@ -485,10 +475,7 @@ export default {
getDetail(this.treeCode).then(res => { getDetail(this.treeCode).then(res => {
this.regionForm = res.data.data; this.regionForm = res.data.data;
this.regionForm.originalCode = this.regionForm.code; this.regionForm.originalCode = this.regionForm.code;
this.regionForm.subCode = this.regionForm.subCode = this.regionForm.code;
this.regionForm.parentCode === this.topCode
? this.regionForm.code
: this.regionForm.code.replace(this.regionForm.parentCode, '');
this.loadParentOptions(this.regionForm.parentCode, this.regionForm.parentName); this.loadParentOptions(this.regionForm.parentCode, this.regionForm.parentName);
}); });
}, },
@@ -509,25 +496,31 @@ export default {
}; };
}, },
addChildren() { addChildren() {
if (validatenull(this.regionForm.code) || validatenull(this.regionForm.name)) { const current = this.regionForm || {};
const parentCode = current.originalCode || current.code;
if (validatenull(parentCode) || validatenull(current.name)) {
this.$message.warning('请先选择一项区划'); this.$message.warning('请先选择一项区划');
return; return;
} }
if (Number(this.regionForm.regionLevel) >= 3) { if (Number(current.regionLevel) >= 3) {
this.$message.warning('区县已是末级,不能新增下级'); this.$message.warning('区县已是末级,不能新增下级');
return; return;
} }
const parentCode = this.regionForm.code; const parentName = current.name;
const parentName = this.regionForm.name; const parentGroupCode = current.parentCode || this.topCode;
const parentGroupCode = this.regionForm.parentCode || this.topCode;
this.setRegionColumnDisplay('code', true); this.setRegionColumnDisplay('code', true);
this.regionForm.parentCode = parentCode; this.regionForm = {
this.regionForm.parentName = parentName; parentCode,
this.regionForm.code = ''; parentName,
this.regionForm.subCode = ''; code: '',
this.regionForm.originalCode = ''; subCode: '',
this.regionForm.name = ''; originalCode: '',
this.regionForm.regionLevel = Number(this.regionForm.regionLevel) + 1; name: '',
regionLevel: Number(current.regionLevel) + 1,
sort: 1,
remark: '',
status: 1,
};
this.loadParentOptionsByGroup(parentGroupCode, parentCode, parentName); this.loadParentOptionsByGroup(parentGroupCode, parentCode, parentName);
}, },
setRegionColumnDisplay(prop, display) { setRegionColumnDisplay(prop, display) {
@@ -545,8 +538,7 @@ export default {
if (this.isCountryRegion) { if (this.isCountryRegion) {
return; return;
} }
const parentCode = this.isProvinceRegion ? '' : this.regionForm.parentCode || ''; this.regionForm.code = this.regionForm.subCode || '';
this.regionForm.code = parentCode + (this.regionForm.subCode || '');
}, },
getRootParentOptions() { getRootParentOptions() {
return [ return [
@@ -595,16 +587,28 @@ export default {
this.parentOptions = this.ensureSelectedParent(options, selectedCode, selectedName); this.parentOptions = this.ensureSelectedParent(options, selectedCode, selectedName);
}); });
}, },
handleSubmit(form, done) { buildRegionPayload(form) {
if (Number(form.regionLevel) === 0) { const source = validatenull(this.regionForm) ? form || {} : this.regionForm;
form.parentCode = this.topCode; const regionLevel = Number(source.regionLevel);
form.ancestors = this.topCode; const isNew = validatenull(source.originalCode);
form.subCode = form.code; const payload = {
} else { code: regionLevel === 0 ? source.code : source.subCode,
const parentCode = Number(form.regionLevel) === 1 ? '' : form.parentCode; parentCode: regionLevel === 0 ? this.topCode : source.parentCode,
form.code = parentCode + form.subCode; name: source.name,
regionLevel,
sort: source.sort,
remark: source.remark,
status: source.status == null || source.status === '' ? 1 : source.status,
};
if (!isNew) {
payload.originalCode = source.originalCode;
payload.dataSource = source.dataSource;
} }
submit(form).then( return payload;
},
handleSubmit(form, done) {
const payload = this.buildRegionPayload(form);
submit(payload).then(
() => { () => {
this.$message({ this.$message({
type: 'success', type: 'success',
+7 -3
View File
@@ -490,7 +490,7 @@ export default {
this.addressLoading = true; this.addressLoading = true;
getCommonAddressList(this.addressPage.currentPage, this.addressPage.pageSize, { getCommonAddressList(this.addressPage.currentPage, this.addressPage.pageSize, {
...this.addressQuery, ...this.addressQuery,
allDept: 0, allDept: this.isAdmin ? 1 : 0,
}) })
.then(res => { .then(res => {
const data = res.data.data || {}; const data = res.data.data || {};
@@ -1028,7 +1028,11 @@ export default {
onLoad(page, params = {}) { onLoad(page, params = {}) {
this.loading = true; this.loading = true;
api api
.getList(page.currentPage, page.pageSize, { ...params, ...this.query, allDept: 0 }) .getList(page.currentPage, page.pageSize, {
...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,7 +1046,7 @@ export default {
buildExportParams() { buildExportParams() {
return { return {
...this.query, ...this.query,
allDept: 0, allDept: this.isAdmin ? 1 : 0,
ids: this.ids, ids: this.ids,
[this.website.tokenHeader]: getToken(), [this.website.tokenHeader]: getToken(),
}; };
+1 -1
View File
@@ -1610,7 +1610,7 @@ export default {
}); });
}, },
normalizeSearch(params = {}) { normalizeSearch(params = {}) {
const query = { ...params }; const query = { ...params, allDept: this.isAdmin ? 1 : 0 };
if (query.organizationName) { if (query.organizationName) {
const id = Array.isArray(query.organizationName) const id = Array.isArray(query.organizationName)
? query.organizationName.at(-1) ? query.organizationName.at(-1)
+1 -1
View File
@@ -696,7 +696,7 @@ export default {
return getProjectList(1, 50, { return getProjectList(1, 50, {
projectName: keyword, projectName: keyword,
approvalStatus: 'approved', approvalStatus: 'approved',
allDept: 0, allDept: this.isAdmin ? 1 : 0,
}) })
.then(res => { .then(res => {
const data = res.data.data || {}; const data = res.data.data || {};
+3
View File
@@ -1364,6 +1364,9 @@ export default {
}, },
}, },
created() { created() {
if (this.isAdmin) {
this.allDept = 1;
}
if (this.isPublicViewPage) { if (this.isPublicViewPage) {
this.isFormPageInstance = true; this.isFormPageInstance = true;
this.openPublicProjectForm(); this.openPublicProjectForm();
@@ -537,7 +537,11 @@ export default {
onLoad(page, params = {}) { onLoad(page, params = {}) {
this.loading = true; this.loading = true;
this.api this.api
.getList(page.currentPage, page.pageSize, { ...params, ...this.query }) .getList(page.currentPage, page.pageSize, {
...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;
@@ -942,7 +946,7 @@ export default {
NProgress.start(); NProgress.start();
exportBlob( exportBlob(
this.config.exportUrl, this.config.exportUrl,
{ ...this.query, ids: this.ids, [this.website.tokenHeader]: getToken() }, { ...this.query, allDept: this.isAdmin ? 1 : 0, ids: this.ids, [this.website.tokenHeader]: getToken() },
{ feedback: true } { feedback: true }
) )
.then(res => { .then(res => {