调整基础数据、车船务、项目、合同

This commit is contained in:
2026-09-03 22:40:11 +08:00
parent 024e77801e
commit c63c7c3e33
43 changed files with 821 additions and 239 deletions
+59 -8
View File
@@ -113,7 +113,7 @@
:maxlength="getCargoCodeMaxLength()"
show-word-limit
placeholder="请输入"
:disabled="dialogReadonly || dialogType === 'edit'"
:disabled="dialogReadonly"
@input="handleCargoCodeInput"
>
<template v-if="getCargoCodePrefix()" #prepend>
@@ -130,11 +130,13 @@
placeholder="请输入"
:disabled="dialogReadonly"
@input="handleCargoValueInput"
@blur="handleCargoValueBlur"
/>
<el-select
v-model="form.priceUnit"
clearable
:disabled="dialogReadonly"
:loading="priceUnitLoading"
placeholder="请选择"
>
<el-option
@@ -147,6 +149,10 @@
</div>
</template>
<template #cargoValue="{ row }">
{{ formatCargoValue(row.cargoValue) }}
</template>
<template #menu="{ row, index }">
<el-link
type="primary"
@@ -196,8 +202,8 @@ import * as api from '@/api/business/common-cargo';
import { getList as getCargoTypeList } from '@/api/base/cargo-type';
import { exportBlob } from '@/api/common';
import { getDeptTree } from '@/api/system/dept';
import { config, excelOption, option } from '@/option/business/common-cargo';
import { priceUnitOptions } from '@/option/business/common';
import { config, excelOption, formatCargoValue, option } from '@/option/business/common-cargo';
import { getDictionary } from '@/api/system/dictbiz';
import { getToken } from '@/utils/auth';
import { openImportDialog } from '@/utils/import-excel';
import { downloadXls } from '@/utils/util';
@@ -211,7 +217,8 @@ export default {
api,
config,
option,
priceUnitOptions,
priceUnitOptions: [],
priceUnitLoading: false,
form: {},
query: {},
loading: true,
@@ -254,8 +261,10 @@ export default {
},
created() {
this.initDeptTree();
this.loadPriceUnitOptions();
},
methods: {
formatCargoValue,
hasPermission(code) {
return this.isAdmin || this.validData(this.permission && this.permission[code], false);
},
@@ -273,6 +282,28 @@ export default {
}
});
},
loadPriceUnitOptions() {
this.priceUnitLoading = true;
getDictionary({ code: 'unit_fee' })
.then(res => {
const payload = res?.data?.data || res?.data || [];
const list = Array.isArray(payload) ? payload : payload.records || payload.data || [];
this.priceUnitOptions = list
.map(item => ({
label: item.dictValue || item.label || item.name || item.dictKey || item.value,
value: item.dictKey || item.value || item.dictValue || item.name,
}))
.filter(item => item.label && item.value);
if (this.dialogType === 'add' && !this.form.priceUnit && this.priceUnitOptions.length) {
this.form.priceUnit = this.priceUnitOptions[0].value;
}
const priceUnitColumn = this.findColumn(this.option.column, 'priceUnit');
if (priceUnitColumn) priceUnitColumn.dicData = this.priceUnitOptions;
})
.finally(() => {
this.priceUnitLoading = false;
});
},
flattenDept(tree, level = 0) {
const result = [];
tree.forEach(item => {
@@ -389,6 +420,9 @@ export default {
const decimal = parts.slice(1).join('').slice(0, 2);
this.form.cargoValue = parts.length > 1 ? `${integer}.${decimal}` : integer;
},
handleCargoValueBlur() {
this.form.cargoValue = formatCargoValue(this.form.cargoValue);
},
normalizeRow(row) {
const submitRow = { ...row };
Object.keys(submitRow).forEach(key => {
@@ -399,14 +433,23 @@ export default {
if (submitRow.cargoValue !== undefined && submitRow.cargoValue !== null) {
submitRow.cargoValue = String(submitRow.cargoValue).trim();
}
if (!submitRow.cargoValue || String(submitRow.cargoValue) === '-1') {
const cargoValue = submitRow.cargoValue;
if (
cargoValue === undefined ||
cargoValue === null ||
String(cargoValue).trim() === '' ||
String(cargoValue) === '-1'
) {
submitRow.cargoValue = null;
} else {
submitRow.cargoValue = formatCargoValue(submitRow.cargoValue);
}
return submitRow;
},
normalizeCargoValue(row) {
if (row && String(row.cargoValue) === '-1') {
row.cargoValue = null;
if (row && Object.prototype.hasOwnProperty.call(row, 'cargoValue')) {
const formatted = formatCargoValue(row.cargoValue);
row.cargoValue = formatted || null;
}
return row;
},
@@ -445,6 +488,14 @@ export default {
this.$message.warning('货值只能输入数字,最多保留2位小数');
return false;
}
if (!row.model) {
this.$message.warning('请输入型号');
return false;
}
if (row.model.length > 50) {
this.$message.warning('型号不能超过50个字符');
return false;
}
if (row.remark && row.remark.length > 200) {
this.$message.warning('备注不能超过200个字符');
return false;
@@ -539,8 +590,8 @@ export default {
this.dialogType = type || 'add';
if (type === 'add') {
this.form = {
priceUnit: '元/吨',
...this.form,
priceUnit: this.priceUnitOptions[0]?.value || this.form.priceUnit || '',
};
this.loadFirstCargoTypeOptions();
done();