feat(01): mock code branch
This commit is contained in:
parent
fddaf80f89
commit
88eb554e01
4 changed files with 73 additions and 19 deletions
|
|
@ -261,16 +261,18 @@ watch(
|
|||
:readonly="readonly"
|
||||
:label="$t('branch.form.bankAccountNumber')"
|
||||
:maxlength="13"
|
||||
:rules="[
|
||||
(val: string) =>
|
||||
(val.length >= 7 && val.length <= 13) ||
|
||||
$t('form.error.please', { msg: $t('accountNumber') }),
|
||||
]"
|
||||
:model-value="readonly ? book.accountNumber || '-' : book.accountNumber"
|
||||
@update:model-value="
|
||||
(v) => (typeof v === 'string' ? (book.accountNumber = v) : '')
|
||||
"
|
||||
/>
|
||||
<!-- :rules="[
|
||||
(val: string) =>
|
||||
(val.length >= 7 && val.length <= 13) ||
|
||||
$t('form.error.please', {
|
||||
msg: $t('branch.form.bankAccountNumber'),
|
||||
}),
|
||||
]" -->
|
||||
|
||||
<q-input
|
||||
outlined
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<script setup lang="ts">
|
||||
const code = defineModel<string>('code');
|
||||
const branchCount = defineModel<number>('branchCount', { default: 0 });
|
||||
const codeSubBranch = defineModel<string>('codeSubBranch');
|
||||
const taxNo = defineModel<string>('taxNo');
|
||||
const name = defineModel<string>('name');
|
||||
|
|
@ -13,12 +14,13 @@ defineProps<{
|
|||
outlined?: boolean;
|
||||
readonly?: boolean;
|
||||
view?: boolean;
|
||||
onCreate?: boolean;
|
||||
}>();
|
||||
|
||||
function formatCode(input: string | undefined, type: 'code' | 'number') {
|
||||
if (!input) return;
|
||||
const code = input.slice(0, -6);
|
||||
const number = input.slice(-6);
|
||||
const code = input.slice(0, -5);
|
||||
const number = input.slice(-5);
|
||||
if (type === 'code') return code;
|
||||
if (type === 'number') return number;
|
||||
}
|
||||
|
|
@ -67,10 +69,22 @@ function formatCode(input: string | undefined, type: 'code' | 'number') {
|
|||
class="col-md col-7"
|
||||
:label="$t('branch.form.code')"
|
||||
for="input-code"
|
||||
:model-value="view ? formatCode(code, 'number') : code"
|
||||
:model-value="
|
||||
typeBranch === 'headOffice'
|
||||
? view
|
||||
? formatCode(code, 'number')
|
||||
: '00000'
|
||||
: view
|
||||
? onCreate
|
||||
? (branchCount + 1).toString().padStart(5, '0')
|
||||
: formatCode(codeSubBranch, 'number')
|
||||
: codeSubBranch
|
||||
"
|
||||
@update:model-value="(v) => (code = v as string)"
|
||||
/>
|
||||
<q-input
|
||||
|
||||
<!-- view ? `${formatCode(code, 'number')}${branchCount}` : code -->
|
||||
<!-- <q-input
|
||||
lazy-rules="ondemand"
|
||||
v-if="typeBranch !== 'headOffice'"
|
||||
:dense="dense"
|
||||
|
|
@ -85,7 +99,7 @@ function formatCode(input: string | undefined, type: 'code' | 'number') {
|
|||
view ? formatCode(codeSubBranch, 'number') : codeSubBranch
|
||||
"
|
||||
@update:model-value="(v) => (codeSubBranch = v as string)"
|
||||
/>
|
||||
/> -->
|
||||
|
||||
<q-input
|
||||
lazy-rules="ondemand"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue