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) => {