档案模版字段剪联动配置
This commit is contained in:
parent
f8838cc1f9
commit
ba830dff60
@ -1,13 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<template v-for="item in formItems" :key="item.title">
|
<template v-for="item in formItems" :key="item.title">
|
||||||
<form-cell v-if="item.cellType === 'formCellItem'" v-bind="item" :form="form"
|
<form-cell v-if="item.cellType === 'formCellItem'" v-bind="item" :form="form"
|
||||||
:disableChange="disabledMap[item.title]" @change="change" @addRule="addRule" />
|
:disableChange="isDisableChange(item)" @change="change" @addRule="addRule" />
|
||||||
</template>
|
</template>
|
||||||
<form-cell />
|
<form-cell />
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, provide, ref } from 'vue';
|
import { computed, provide, ref, watch } from 'vue';
|
||||||
import verifyForm from './verify.js';
|
import verifyForm from './verify.js';
|
||||||
|
import { collectAutoFillChanges } from './auto-fill.mjs';
|
||||||
|
|
||||||
import FormCell from './form-cell/index.vue';
|
import FormCell from './form-cell/index.vue';
|
||||||
// import CustomCell from './custom-cell/index.vue';
|
// import CustomCell from './custom-cell/index.vue';
|
||||||
@ -69,6 +70,21 @@ function change(data) {
|
|||||||
emits('change', data)
|
emits('change', data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isDisableChange(item) {
|
||||||
|
return Boolean(disabledMap.value[item.title] || item.readonly === true || item.readonly === 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
function syncAutoFill() {
|
||||||
|
const changes = collectAutoFillChanges(formItems.value, props.form);
|
||||||
|
changes.forEach(change);
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => [props.items, props.form],
|
||||||
|
syncAutoFill,
|
||||||
|
{ deep: true, immediate: true }
|
||||||
|
);
|
||||||
|
|
||||||
function verify() {
|
function verify() {
|
||||||
return verifyForm(props.items, rules.value, props.form)
|
return verifyForm(props.items, rules.value, props.form)
|
||||||
}
|
}
|
||||||
@ -79,4 +95,4 @@ defineExpose({ verify })
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
@import './cell-style.css';
|
@import './cell-style.css';
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user