diff --git a/src/views/base/common-address.vue b/src/views/base/common-address.vue index 4e8bf0b..58e864b 100644 --- a/src/views/base/common-address.vue +++ b/src/views/base/common-address.vue @@ -334,6 +334,9 @@ export default { }, }, created() { + if (this.isAdmin) { + this.allDept = 1; + } this.initDeptTree(); }, methods: { diff --git a/src/views/base/region.vue b/src/views/base/region.vue index 876d7b9..a9d9ae7 100644 --- a/src/views/base/region.vue +++ b/src/views/base/region.vue @@ -120,14 +120,7 @@ placeholder="请输入国家编码,如 +86" v-model="regionForm.code" /> - - - - + @@ -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', diff --git a/src/views/business/common-route.vue b/src/views/business/common-route.vue index 9114d89..dec5955 100644 --- a/src/views/business/common-route.vue +++ b/src/views/business/common-route.vue @@ -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(), }; diff --git a/src/views/business/contract-manage.vue b/src/views/business/contract-manage.vue index c57b980..e03a5fa 100644 --- a/src/views/business/contract-manage.vue +++ b/src/views/business/contract-manage.vue @@ -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) diff --git a/src/views/business/process-config.vue b/src/views/business/process-config.vue index f3147c0..b75263d 100644 --- a/src/views/business/process-config.vue +++ b/src/views/business/process-config.vue @@ -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 || {}; diff --git a/src/views/business/project-apply.vue b/src/views/business/project-apply.vue index 6062b93..a3437cc 100644 --- a/src/views/business/project-apply.vue +++ b/src/views/business/project-apply.vue @@ -1364,6 +1364,9 @@ export default { }, }, created() { + if (this.isAdmin) { + this.allDept = 1; + } if (this.isPublicViewPage) { this.isFormPageInstance = true; this.openPublicProjectForm(); diff --git a/src/views/business/temporary-credit-limit.vue b/src/views/business/temporary-credit-limit.vue index 490706f..7c9cab1 100644 --- a/src/views/business/temporary-credit-limit.vue +++ b/src/views/business/temporary-credit-limit.vue @@ -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 => {