1、修复基础配置

2、修复业务模块
3、拆分页面代码
This commit is contained in:
2026-09-03 15:59:34 +08:00
parent 40925cb21f
commit 024e77801e
9 changed files with 720 additions and 179 deletions
+27 -6
View File
@@ -30,6 +30,9 @@
{{ row.status === 1 ? '启用' : '停用' }}
</el-tag>
</template>
<template #feeCategory="{ row }">
{{ formatFeeCategory(row.feeCategory) }}
</template>
<template #feeCategory-form>
<el-select
v-model="form.feeCategory"
@@ -78,7 +81,7 @@
<script>
import { getList, getDetail, submit, remove, changeStatus } from '@/api/base/fee-item';
import { exportBlob } from '@/api/common';
import { getDictionary } from '@/api/system/dictbiz';
import { getDictionaryAll } from '@/api/system/dictbiz';
import { getDeptTree } from '@/api/system/dept';
import { downloadXls } from '@/utils/util';
import { getToken } from '@/utils/auth';
@@ -134,10 +137,11 @@ export default {
searchOrder: 3,
filterable: true,
formslot: true,
slot: true,
span: 12,
dicData: [],
props: {
label: 'dictValue',
label: 'displayLabel',
value: 'dictKey',
},
minWidth: 120,
@@ -168,7 +172,8 @@ export default {
type: 'textarea',
minRows: 2,
span: 24,
hide: true,
minWidth: 200,
overHidden: true,
maxlength: 200,
showWordLimit: true,
rules: [{ max: 200, message: '备注不能超过200个字', trigger: 'blur' }],
@@ -273,10 +278,17 @@ export default {
},
methods: {
initFeeCategoryOptions() {
getDictionary({ code: 'fee_category' }).then(res => {
this.feeCategoryOptions = res.data.data || [];
getDictionaryAll().then(res => {
const options = (res.data.data || [])
.filter(item => item.code === 'fee_category' && Number(item.parentId) > 0)
.sort((first, second) => Number(first.sort || 0) - Number(second.sort || 0))
.map(item => ({
...item,
displayLabel: `${item.dictValue}/${item.dictKey}`,
}));
this.feeCategoryOptions = options;
const column = this.findColumn(this.option.column, 'feeCategory');
column.dicData = this.feeCategoryOptions;
column.dicData = options;
});
},
initDeptTree() {
@@ -305,6 +317,15 @@ export default {
);
return String((option && option.dictKey) || feeCategory);
},
formatFeeCategory(value) {
const feeCategory = String(value || '').trim();
if (!feeCategory) return '';
const option = this.feeCategoryOptions.find(
item =>
String(item.dictKey || '') === feeCategory || String(item.dictValue || '') === feeCategory
);
return option ? `${option.dictValue}/${option.dictKey}` : feeCategory;
},
getFeeItemCodeSuffix(code, feeCategory) {
const value = String(code || '').trim();
const prefix = this.getFeeCategoryPrefix(feeCategory);
+135 -42
View File
@@ -93,6 +93,24 @@
<el-radio label="码头">码头</el-radio>
</el-radio-group>
</template>
<template #provinceCode-form>
<el-select
v-model="form.provinceCode"
clearable
filterable
:disabled="isProvinceDisabled"
placeholder="请选择"
style="width: 100%"
@change="handleProvinceChange"
>
<el-option
v-for="item in provinceOptions"
:key="item.id"
:label="item.title"
:value="item.id"
/>
</el-select>
</template>
<template #code-form>
<el-input
v-if="form.category !== '码头'"
@@ -300,6 +318,8 @@ export default {
excelForm: {},
portOptions: [],
countryOptions: [],
provinceOptions: [],
provinceOptionCache: {},
cityOptions: [],
cityLoading: false,
cityOptionCache: {},
@@ -436,13 +456,30 @@ export default {
change: ({ value }) => this.handleCountryNameChange(value),
rules: [{ required: true, message: '请选择国家', trigger: 'change' }],
},
{
label: '所属省份',
prop: 'provinceCode',
formslot: true,
hide: true,
span: 12,
order: 88,
placeholder: '请选择',
rules: [{ required: true, message: '请选择所属省份', trigger: 'change' }],
},
{
label: '所属省份',
prop: 'provinceName',
addDisplay: false,
editDisplay: false,
minWidth: 120,
},
{
label: '城市',
prop: 'cityCode',
formslot: true,
hide: true,
span: 12,
order: 88,
order: 87,
placeholder: '请选择',
rules: [{ required: true, message: '请选择所属城市', trigger: 'change' }],
},
@@ -465,7 +502,7 @@ export default {
type: 'select',
formslot: true,
hide: true,
order: 87,
order: 86,
props: {
label: 'title',
value: 'id',
@@ -534,7 +571,7 @@ export default {
span: 12,
minWidth: 220,
overHidden: false,
order: 86,
order: 85,
placeholder: '请输入',
maxlength: 255,
showWordLimit: true,
@@ -667,6 +704,9 @@ export default {
return this.form.category === '码头';
},
isCityDisabled() {
return this.isParentRegionLocked || !this.form.provinceCode;
},
isProvinceDisabled() {
return this.isParentRegionLocked || !this.form.countryCode;
},
isDistrictDisabled() {
@@ -755,7 +795,7 @@ export default {
this.form.parentName = '';
this.form.countryCode = '';
this.form.country = '';
this.clearCityValue();
this.clearProvinceValue();
},
handleCategoryChange(value, reset = true) {
const required = value === '码头';
@@ -779,13 +819,15 @@ export default {
handleCountryChange(value) {
const country = this.countryOptions.find(item => item.id === value);
this.form.country = country ? country.title : '';
this.clearCityValue();
this.loadCityOptions(value);
this.clearProvinceValue();
this.loadProvinceOptions(value);
},
handleCountryNameChange(value) {
const country = this.countryOptions.find(item => item.title === value);
this.setProvinceOptions([]);
this.setCityOptions([]);
this.setDistrictOptions([]);
this.loadCityOptions(country ? country.id : '');
this.loadProvinceOptions(country ? country.id : '');
},
syncCountryName(countryCode) {
const country = this.countryOptions.find(item => item.id === countryCode);
@@ -818,6 +860,18 @@ export default {
}));
}
},
setProvinceOptions(provinceOptions) {
this.provinceOptions = provinceOptions;
const provinceCodeColumn = this.findColumn(this.option.column, 'provinceCode');
if (provinceCodeColumn) {
provinceCodeColumn.dicData = provinceOptions;
}
},
clearProvinceValue() {
this.form.provinceCode = undefined;
this.form.provinceName = '';
this.clearCityValue();
},
clearCityValue() {
this.form.cityCode = undefined;
this.form.city = '';
@@ -828,36 +882,38 @@ export default {
this.form.districtName = '';
this.form.regionCode = '';
},
loadCityOptions(countryCode) {
loadProvinceOptions(countryCode) {
if (!countryCode) {
this.setProvinceOptions([]);
return Promise.resolve([]);
}
if (this.provinceOptionCache[countryCode]) {
this.setProvinceOptions(this.provinceOptionCache[countryCode]);
return Promise.resolve(this.provinceOptionCache[countryCode]);
}
return getLazyTree(countryCode).then(res => {
const options = (res.data.data || []).map(this.normalizeRegionOption);
this.provinceOptionCache[countryCode] = options;
this.setProvinceOptions(options);
return options;
});
},
loadCityOptions(provinceCode) {
if (!provinceCode) {
this.setCityOptions([]);
return Promise.resolve([]);
}
if (this.cityOptionCache[countryCode]) {
this.setCityOptions(this.cityOptionCache[countryCode]);
return Promise.resolve(this.cityOptionCache[countryCode]);
if (this.cityOptionCache[provinceCode]) {
this.setCityOptions(this.cityOptionCache[provinceCode]);
return Promise.resolve(this.cityOptionCache[provinceCode]);
}
this.cityLoading = true;
return getLazyTree(countryCode)
return getLazyTree(provinceCode)
.then(res => {
const firstLevelList = (res.data.data || []).map(this.normalizeRegionOption);
return Promise.all(
firstLevelList.map(parent => {
return getLazyTree(parent.id).then(childRes => {
const childList = (childRes.data.data || []).map(this.normalizeRegionOption);
return childList.map(child => ({
...child,
parentCode: child.parentCode || parent.id,
}));
});
})
).then(cityGroups => {
const cityList = cityGroups.flat();
const options = cityList.length > 0 ? cityList : firstLevelList;
this.cityOptionCache[countryCode] = options;
this.setCityOptions(options);
return options;
});
const options = (res.data.data || []).map(this.normalizeRegionOption);
this.cityOptionCache[provinceCode] = options;
this.setCityOptions(options);
return options;
})
.finally(() => {
this.cityLoading = false;
@@ -867,6 +923,12 @@ export default {
const city = this.cityOptions.find(item => item.title === cityName || item.id === regionCode);
return city ? city.id : '';
},
resolveProvinceCode(provinceName) {
const province = this.provinceOptions.find(
item => item.title === provinceName || item.id === provinceName
);
return province ? province.id : '';
},
setDistrictOptions(districtOptions) {
this.districtOptions = districtOptions;
const districtCodeColumn = this.findColumn(this.option.column, 'districtCode');
@@ -927,6 +989,8 @@ export default {
this.form.terminalCode = terminalCode;
this.handleTerminalCodeChange(terminalCode);
this.form.country = parent.country;
this.form.provinceCode = parent.provinceCode;
this.form.provinceName = parent.provinceName;
this.form.city = parent.city;
this.form.districtCode = parent.districtCode;
this.form.districtName = parent.districtName;
@@ -935,7 +999,12 @@ export default {
.then(countryCode => {
this.form.countryCode = countryCode;
this.syncCountryName(countryCode);
return this.loadCityOptions(countryCode);
return this.loadProvinceOptions(countryCode);
})
.then(() => {
this.form.provinceCode =
String(parent.provinceCode || '') || this.resolveProvinceCode(parent.provinceName);
return this.loadCityOptions(this.form.provinceCode);
})
.then(() => {
this.form.cityCode = this.resolveCityCode(parent.city, parent.regionCode);
@@ -952,6 +1021,12 @@ export default {
this.clearDistrictValue();
this.loadDistrictOptions(value);
},
handleProvinceChange(value) {
const province = this.provinceOptions.find(item => item.id === value);
this.form.provinceName = province ? province.title : '';
this.clearCityValue();
this.loadCityOptions(value);
},
handleCityNameChange(value) {
const city = this.cityOptions.find(item => item.title === value);
this.setDistrictOptions([]);
@@ -988,6 +1063,8 @@ export default {
submitRow.regionCode = String(submitRow.regionCode || '').trim();
submitRow.districtCode = String(submitRow.districtCode || '').trim();
submitRow.districtName = String(submitRow.districtName || '').trim();
submitRow.provinceCode = String(submitRow.provinceCode || '').trim();
submitRow.provinceName = String(submitRow.provinceName || '').trim();
submitRow.detailAddress = String(submitRow.detailAddress || '').trim();
submitRow.longitude = normalizeCoordinateInput(submitRow.longitude);
submitRow.latitude = normalizeCoordinateInput(submitRow.latitude);
@@ -1021,6 +1098,10 @@ export default {
this.$message.warning('请选择上级港口');
return false;
}
if (isBlank(row.provinceCode)) {
this.$message.warning('请选择所属省份');
return false;
}
if (isBlank(row.regionCode)) {
this.$message.warning('请选择区县');
return false;
@@ -1153,7 +1234,13 @@ export default {
.then(countryCode => {
this.form.countryCode = countryCode;
this.syncCountryName(countryCode);
return this.loadCityOptions(countryCode);
return this.loadProvinceOptions(countryCode);
})
.then(() => {
this.form.provinceCode =
String(this.form.provinceCode || '') ||
this.resolveProvinceCode(this.form.provinceName);
return this.loadCityOptions(this.form.provinceCode);
})
.then(() => {
this.form.cityCode = this.resolveCityCode(this.form.city, this.form.regionCode);
@@ -1179,7 +1266,13 @@ export default {
.then(countryCode => {
this.form.countryCode = countryCode;
this.syncCountryName(countryCode);
return this.loadCityOptions(countryCode);
return this.loadProvinceOptions(countryCode);
})
.then(() => {
this.form.provinceCode =
String(this.form.provinceCode || '') ||
this.resolveProvinceCode(this.form.provinceName);
return this.loadCityOptions(this.form.provinceCode);
})
.then(() => {
this.form.cityCode = this.resolveCityCode(this.form.city, this.form.regionCode);
@@ -1211,6 +1304,7 @@ export default {
},
searchReset() {
this.query = {};
this.setProvinceOptions([]);
this.setCityOptions([]);
this.setDistrictOptions([]);
this.onLoad(this.page);
@@ -1251,14 +1345,10 @@ export default {
});
},
handleImport() {
openImportDialog(
this,
'港口码头主数据',
() => {
this.loadPortOptions();
this.onLoad(this.page, this.query);
}
);
openImportDialog(this, '港口码头主数据', () => {
this.loadPortOptions();
this.onLoad(this.page, this.query);
});
},
handleExport() {
this.$confirm('是否导出港口码头主数据?', '提示', {
@@ -1271,7 +1361,10 @@ export default {
feedback: true,
})
.then(res => {
downloadXls(res.data, `港口码头主数据${this.$dayjs().format('YYYY-MM-DD HH:mm:ss')}.xlsx`);
downloadXls(
res.data,
`港口码头主数据${this.$dayjs().format('YYYY-MM-DD HH:mm:ss')}.xlsx`
);
})
.finally(() => {
NProgress.done();
+2 -4
View File
@@ -411,9 +411,7 @@ export default {
computed: {
...mapGetters(['permission']),
isCountryRegion() {
return (
Number(this.regionForm.regionLevel) === 0 || this.regionForm.parentCode === this.topCode
);
return Number(this.regionForm.regionLevel) === 0;
},
isProvinceRegion() {
return Number(this.regionForm.regionLevel) === 1;
@@ -641,7 +639,7 @@ export default {
() => {
this.initTree();
},
{ timeout: 180000 }
{ timeout: 300000 }
);
},
syncImportAction() {