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

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
+50
View File
@@ -50,6 +50,19 @@
/>
</el-select>
</template>
<template #taxRate="{ row }">{{ formatTaxRate(row.taxRate) }}</template>
<template #taxRate-form>
<el-input
v-model="form.taxRate"
inputmode="decimal"
maxlength="6"
clearable
placeholder="请输入税率"
@input="handleTaxRateInput"
>
<template #append>%</template>
</el-input>
</template>
<template #englishName-form>
<el-input
v-model="form.englishName"
@@ -156,6 +169,30 @@ export default {
maxlength: 100,
rules: [{ required: true, message: '请输入费用项代码', trigger: 'blur' }],
},
{
label: '税率',
prop: 'taxRate',
type: 'input',
formslot: true,
slot: true,
minWidth: 100,
span: 12,
rules: [
{ required: true, message: '请输入税率', trigger: 'blur' },
{
validator: (rule, value, callback) => {
const text = String(value ?? '').trim();
const rate = Number(text);
if (!/^\d+(\.\d{1,2})?$/.test(text) || rate < 0 || rate > 100) {
callback(new Error('税率必须是0到100之间且最多保留2位小数的数字'));
return;
}
callback();
},
trigger: 'blur',
},
],
},
{
label: '费用项',
prop: 'name',
@@ -326,6 +363,9 @@ export default {
);
return option ? `${option.dictValue}/${option.dictKey}` : feeCategory;
},
formatTaxRate(value) {
return value === undefined || value === null || value === '' ? '' : `${value}%`;
},
getFeeItemCodeSuffix(code, feeCategory) {
const value = String(code || '').trim();
const prefix = this.getFeeCategoryPrefix(feeCategory);
@@ -347,6 +387,7 @@ export default {
const code = this.getFeeItemCodeSuffix(values.englishName, values.feeCategory);
values.feeCategory = String(values.feeCategory || '').trim();
values.name = String(values.name || '').trim();
values.taxRate = Number(values.taxRate);
values.englishName = prefix ? `${prefix}${code}` : code;
values.remark = String(values.remark || '').trim() || undefined;
if (!values.status) values.status = 1;
@@ -455,6 +496,15 @@ export default {
this.form.englishName = '';
done();
},
handleTaxRateInput(value) {
let normalized = String(value || '').replace(/[^\d.]/g, '');
normalized = normalized.replace(/(\..*)\./g, '$1');
if (normalized.startsWith('.')) normalized = `0${normalized}`;
const [integerPart, decimalPart] = normalized.split('.');
normalized =
decimalPart === undefined ? integerPart : `${integerPart}.${decimalPart.slice(0, 2)}`;
this.form.taxRate = normalized;
},
searchReset() {
this.query = {};
this.onLoad(this.page);