调整基础数据模块
This commit is contained in:
@@ -108,14 +108,18 @@
|
||||
|
||||
<template #cargoCode-form>
|
||||
<el-input
|
||||
v-model="form.cargoCode"
|
||||
:model-value="getCargoCodeSuffix()"
|
||||
clearable
|
||||
maxlength="20"
|
||||
:maxlength="getCargoCodeMaxLength()"
|
||||
show-word-limit
|
||||
placeholder="请输入"
|
||||
:disabled="dialogReadonly || dialogType === 'edit'"
|
||||
@input="handleCargoCodeInput"
|
||||
/>
|
||||
>
|
||||
<template v-if="getCargoCodePrefix()" #prepend>
|
||||
{{ getCargoCodePrefix() }}
|
||||
</template>
|
||||
</el-input>
|
||||
</template>
|
||||
|
||||
<template #cargoValue-form>
|
||||
@@ -143,10 +147,6 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #packageBrand="{ row }">
|
||||
{{ [row.packageType, row.brand].filter(Boolean).join(' / ') || '-' }}
|
||||
</template>
|
||||
|
||||
<template #menu="{ row, index }">
|
||||
<el-link
|
||||
type="primary"
|
||||
@@ -357,6 +357,14 @@ export default {
|
||||
? String(this.form.secondCargoTypeCode).slice(0, 4)
|
||||
: '';
|
||||
},
|
||||
getCargoCodeSuffix() {
|
||||
const prefix = this.getCargoCodePrefix();
|
||||
const cargoCode = String(this.form.cargoCode || '');
|
||||
return prefix && cargoCode.startsWith(prefix) ? cargoCode.slice(prefix.length) : cargoCode;
|
||||
},
|
||||
getCargoCodeMaxLength() {
|
||||
return 20 - this.getCargoCodePrefix().length;
|
||||
},
|
||||
syncCargoCodePrefix() {
|
||||
const prefix = this.getCargoCodePrefix();
|
||||
const current = String(this.form.cargoCode || '').replace(/\D/g, '');
|
||||
@@ -369,13 +377,10 @@ export default {
|
||||
},
|
||||
handleCargoCodeInput(value) {
|
||||
const prefix = this.getCargoCodePrefix();
|
||||
const input = String(value || '').replace(/\D/g, '');
|
||||
if (!prefix) {
|
||||
this.form.cargoCode = input.slice(0, 20);
|
||||
return;
|
||||
}
|
||||
const suffix = input.startsWith(prefix) ? input.slice(prefix.length) : input;
|
||||
this.form.cargoCode = `${prefix}${suffix}`.slice(0, 20);
|
||||
const suffix = String(value || '')
|
||||
.replace(/\D/g, '')
|
||||
.slice(0, this.getCargoCodeMaxLength());
|
||||
this.form.cargoCode = `${prefix}${suffix}`;
|
||||
},
|
||||
handleCargoValueInput(value) {
|
||||
const raw = String(value || '').replace(/[^\d.]/g, '');
|
||||
|
||||
Reference in New Issue
Block a user