From 1deb6e58ecaea9e86ac659d535284555e6ee7d39 Mon Sep 17 00:00:00 2001 From: my_ong <429426262@qq.com> Date: Thu, 19 Dec 2024 16:23:00 +0800 Subject: [PATCH] =?UTF-8?q?bug:=20=E4=BF=AE=E6=94=B9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/stock/stocktaking/form.ts | 4 ++-- src/views/stock/stocktaking/stocktaking-page.vue | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/views/stock/stocktaking/form.ts b/src/views/stock/stocktaking/form.ts index 2979fda..7e4d4d0 100644 --- a/src/views/stock/stocktaking/form.ts +++ b/src/views/stock/stocktaking/form.ts @@ -15,7 +15,7 @@ export const config: FormConfig = { export const formItems = ( materialOptions: Array<{ value: string | undefined; label: string | undefined }>, - required: Ref, + required: boolean, persons: Array<{ value: string | undefined; label: string | undefined }>, ): FormItem[] => [ { @@ -53,7 +53,7 @@ export const formItems = ( properties: { size: 'default', mode: 'multiple', - required: required.value, + required: required, placeholder: '请选择物料', options: materialOptions, }, diff --git a/src/views/stock/stocktaking/stocktaking-page.vue b/src/views/stock/stocktaking/stocktaking-page.vue index 842b0e8..4be2e50 100644 --- a/src/views/stock/stocktaking/stocktaking-page.vue +++ b/src/views/stock/stocktaking/stocktaking-page.vue @@ -146,7 +146,7 @@ //新增申请的下拉框选择对象 const materialList = ref>([]) const personList = ref>([]) - const required = ref(false) + const required = ref(true) api.materialApi.material.all((data) => { materialList.value = data.map((item) => { return { @@ -166,7 +166,16 @@ //是否必填 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(() => { - return formItems(materialList.value, required, personList.value) + //required 参数未生效 + return formItems(materialList.value, required.value, personList.value) }) // 加载数据的方法 const loadData = async (page = 1, size = 10) => {