bug: 修改逻辑
All checks were successful
Release / lint (push) Successful in 29s
Release / Release (push) Successful in 1m19s

This commit is contained in:
my_ong 2024-12-19 16:23:00 +08:00
parent d96b8f4329
commit 1deb6e58ec
2 changed files with 15 additions and 5 deletions

View File

@ -15,7 +15,7 @@ export const config: FormConfig = {
export const formItems = ( export const formItems = (
materialOptions: Array<{ value: string | undefined; label: string | undefined }>, materialOptions: Array<{ value: string | undefined; label: string | undefined }>,
required: Ref<boolean>, required: boolean,
persons: Array<{ value: string | undefined; label: string | undefined }>, persons: Array<{ value: string | undefined; label: string | undefined }>,
): FormItem[] => [ ): FormItem[] => [
{ {
@ -53,7 +53,7 @@ export const formItems = (
properties: { properties: {
size: 'default', size: 'default',
mode: 'multiple', mode: 'multiple',
required: required.value, required: required,
placeholder: '请选择物料', placeholder: '请选择物料',
options: materialOptions, options: materialOptions,
}, },

View File

@ -146,7 +146,7 @@
// //
const materialList = ref<Array<{ value: string | undefined; label: string | undefined }>>([]) const materialList = ref<Array<{ value: string | undefined; label: string | undefined }>>([])
const personList = ref<Array<{ value: string | undefined; label: string | undefined }>>([]) const personList = ref<Array<{ value: string | undefined; label: string | undefined }>>([])
const required = ref(false) const required = ref(true)
api.materialApi.material.all((data) => { api.materialApi.material.all((data) => {
materialList.value = data.map((item) => { materialList.value = data.map((item) => {
return { return {
@ -166,7 +166,16 @@
// //
const disabledFields = computed(() => { const disabledFields = computed(() => {
return applyForm.value?.auditType === 'ALL' ? ['materials'] : [] return applyForm.value?.auditType === 'ALL' ? ['ids'] : []
})
//
watch(applyForm, () => {
if (applyForm.value && applyForm.value.auditType === 'ALL') {
required.value = false
} else {
required.value = true
}
}) })
// //
@ -176,7 +185,8 @@
}) })
// //
const items = computed(() => { const items = computed(() => {
return formItems(materialList.value, required, personList.value) //required
return formItems(materialList.value, required.value, personList.value)
}) })
// //
const loadData = async (page = 1, size = 10) => { const loadData = async (page = 1, size = 10) => {