🐛 超管业务列表默认查全部组织,并简化区划编号录入
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -334,6 +334,9 @@ export default {
|
||||
},
|
||||
},
|
||||
created() {
|
||||
if (this.isAdmin) {
|
||||
this.allDept = 1;
|
||||
}
|
||||
this.initDeptTree();
|
||||
},
|
||||
methods: {
|
||||
|
||||
+42
-38
@@ -120,14 +120,7 @@
|
||||
placeholder="请输入国家编码,如 +86"
|
||||
v-model="regionForm.code"
|
||||
/>
|
||||
<el-input
|
||||
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>
|
||||
<el-input v-else placeholder="请输入区划编号" v-model="regionForm.subCode" />
|
||||
</template>
|
||||
</avue-form>
|
||||
<el-dialog title="行政区划数据导入" append-to-body v-model="excelBox" width="555px">
|
||||
@@ -419,9 +412,6 @@ export default {
|
||||
isCountryRegion() {
|
||||
return Number(this.regionForm.regionLevel) === 0;
|
||||
},
|
||||
isProvinceRegion() {
|
||||
return Number(this.regionForm.regionLevel) === 1;
|
||||
},
|
||||
isEditRegion() {
|
||||
return !validatenull(this.regionForm.originalCode);
|
||||
},
|
||||
@@ -485,10 +475,7 @@ export default {
|
||||
getDetail(this.treeCode).then(res => {
|
||||
this.regionForm = res.data.data;
|
||||
this.regionForm.originalCode = this.regionForm.code;
|
||||
this.regionForm.subCode =
|
||||
this.regionForm.parentCode === this.topCode
|
||||
? this.regionForm.code
|
||||
: this.regionForm.code.replace(this.regionForm.parentCode, '');
|
||||
this.regionForm.subCode = this.regionForm.code;
|
||||
this.loadParentOptions(this.regionForm.parentCode, this.regionForm.parentName);
|
||||
});
|
||||
},
|
||||
@@ -509,25 +496,31 @@ export default {
|
||||
};
|
||||
},
|
||||
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('请先选择一项区划');
|
||||
return;
|
||||
}
|
||||
if (Number(this.regionForm.regionLevel) >= 3) {
|
||||
if (Number(current.regionLevel) >= 3) {
|
||||
this.$message.warning('区县已是末级,不能新增下级');
|
||||
return;
|
||||
}
|
||||
const parentCode = this.regionForm.code;
|
||||
const parentName = this.regionForm.name;
|
||||
const parentGroupCode = this.regionForm.parentCode || this.topCode;
|
||||
const parentName = current.name;
|
||||
const parentGroupCode = current.parentCode || this.topCode;
|
||||
this.setRegionColumnDisplay('code', true);
|
||||
this.regionForm.parentCode = parentCode;
|
||||
this.regionForm.parentName = parentName;
|
||||
this.regionForm.code = '';
|
||||
this.regionForm.subCode = '';
|
||||
this.regionForm.originalCode = '';
|
||||
this.regionForm.name = '';
|
||||
this.regionForm.regionLevel = Number(this.regionForm.regionLevel) + 1;
|
||||
this.regionForm = {
|
||||
parentCode,
|
||||
parentName,
|
||||
code: '',
|
||||
subCode: '',
|
||||
originalCode: '',
|
||||
name: '',
|
||||
regionLevel: Number(current.regionLevel) + 1,
|
||||
sort: 1,
|
||||
remark: '',
|
||||
status: 1,
|
||||
};
|
||||
this.loadParentOptionsByGroup(parentGroupCode, parentCode, parentName);
|
||||
},
|
||||
setRegionColumnDisplay(prop, display) {
|
||||
@@ -545,8 +538,7 @@ export default {
|
||||
if (this.isCountryRegion) {
|
||||
return;
|
||||
}
|
||||
const parentCode = this.isProvinceRegion ? '' : this.regionForm.parentCode || '';
|
||||
this.regionForm.code = parentCode + (this.regionForm.subCode || '');
|
||||
this.regionForm.code = this.regionForm.subCode || '';
|
||||
},
|
||||
getRootParentOptions() {
|
||||
return [
|
||||
@@ -595,16 +587,28 @@ export default {
|
||||
this.parentOptions = this.ensureSelectedParent(options, selectedCode, selectedName);
|
||||
});
|
||||
},
|
||||
handleSubmit(form, done) {
|
||||
if (Number(form.regionLevel) === 0) {
|
||||
form.parentCode = this.topCode;
|
||||
form.ancestors = this.topCode;
|
||||
form.subCode = form.code;
|
||||
} else {
|
||||
const parentCode = Number(form.regionLevel) === 1 ? '' : form.parentCode;
|
||||
form.code = parentCode + form.subCode;
|
||||
buildRegionPayload(form) {
|
||||
const source = validatenull(this.regionForm) ? form || {} : this.regionForm;
|
||||
const regionLevel = Number(source.regionLevel);
|
||||
const isNew = validatenull(source.originalCode);
|
||||
const payload = {
|
||||
code: regionLevel === 0 ? source.code : source.subCode,
|
||||
parentCode: regionLevel === 0 ? this.topCode : source.parentCode,
|
||||
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({
|
||||
type: 'success',
|
||||
|
||||
@@ -490,7 +490,7 @@ export default {
|
||||
this.addressLoading = true;
|
||||
getCommonAddressList(this.addressPage.currentPage, this.addressPage.pageSize, {
|
||||
...this.addressQuery,
|
||||
allDept: 0,
|
||||
allDept: this.isAdmin ? 1 : 0,
|
||||
})
|
||||
.then(res => {
|
||||
const data = res.data.data || {};
|
||||
@@ -1028,7 +1028,11 @@ export default {
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
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 => {
|
||||
const result = res.data.data;
|
||||
this.page.total = result.total;
|
||||
@@ -1042,7 +1046,7 @@ export default {
|
||||
buildExportParams() {
|
||||
return {
|
||||
...this.query,
|
||||
allDept: 0,
|
||||
allDept: this.isAdmin ? 1 : 0,
|
||||
ids: this.ids,
|
||||
[this.website.tokenHeader]: getToken(),
|
||||
};
|
||||
|
||||
@@ -1610,7 +1610,7 @@ export default {
|
||||
});
|
||||
},
|
||||
normalizeSearch(params = {}) {
|
||||
const query = { ...params };
|
||||
const query = { ...params, allDept: this.isAdmin ? 1 : 0 };
|
||||
if (query.organizationName) {
|
||||
const id = Array.isArray(query.organizationName)
|
||||
? query.organizationName.at(-1)
|
||||
|
||||
@@ -696,7 +696,7 @@ export default {
|
||||
return getProjectList(1, 50, {
|
||||
projectName: keyword,
|
||||
approvalStatus: 'approved',
|
||||
allDept: 0,
|
||||
allDept: this.isAdmin ? 1 : 0,
|
||||
})
|
||||
.then(res => {
|
||||
const data = res.data.data || {};
|
||||
|
||||
@@ -1364,6 +1364,9 @@ export default {
|
||||
},
|
||||
},
|
||||
created() {
|
||||
if (this.isAdmin) {
|
||||
this.allDept = 1;
|
||||
}
|
||||
if (this.isPublicViewPage) {
|
||||
this.isFormPageInstance = true;
|
||||
this.openPublicProjectForm();
|
||||
|
||||
@@ -537,7 +537,11 @@ export default {
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
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 => {
|
||||
const result = res.data?.data || {};
|
||||
this.page.total = result.total || 0;
|
||||
@@ -942,7 +946,7 @@ export default {
|
||||
NProgress.start();
|
||||
exportBlob(
|
||||
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 }
|
||||
)
|
||||
.then(res => {
|
||||
|
||||
Reference in New Issue
Block a user