diff --git a/src/hooks/smProcessFormAction.ts b/src/hooks/smProcessFormAction.ts index 009621d..c532850 100644 --- a/src/hooks/smProcessFormAction.ts +++ b/src/hooks/smProcessFormAction.ts @@ -3,16 +3,16 @@ import { useMessage } from "./message" export function useSmProcessFormAction() { // 校验 成功返回true 失败返回false - const formValidate = async (baseDataFormRef: any, editableTableRef: any, editableTableData: any) => { - const valid = await baseDataFormRef.value.validate().catch(() => {}) + const formValidate = async (baseFormRef: any, vxeTableRef: any, vxeTableDataLength: number) => { + const valid = await baseFormRef.value.validate().catch(() => {}) if (!valid) return false - if (editableTableData.length <= 0) { + if (vxeTableDataLength <= 0) { useMessage().warning("请选择商品") return false } - const $table = editableTableRef.value + const $table = vxeTableRef.value if ($table) { const errMap = await $table.validate(true) if (errMap) { @@ -25,13 +25,13 @@ export function useSmProcessFormAction() { } // 提交数据 成功返回 true 失败返回 false - const submitData = async (baseDataForm: any, cgPlanSpuItems: Ref, loading: Ref, putObj: any, addObj: any) => { + const submitData = async (baseDataForm: any, vxeTableItems: Ref, loading: Ref, putObj: any, addObj: any) => { try { loading.value = true const _pa = { ...baseDataForm, - items: cgPlanSpuItems.value, + items: vxeTableItems, } console.log("提交的数据:", _pa) @@ -40,10 +40,9 @@ export function useSmProcessFormAction() { if (res.code == 0) { useMessage().success(baseDataForm.id ? "修改成功" : "添加成功") return true - } else { - useMessage().error(res.msg) - return false } + useMessage().error(res.msg || baseDataForm.id ? "修改失败" : "添加失败") + return false } catch (err: any) { useMessage().error(err.msg) loading.value = false @@ -52,6 +51,7 @@ export function useSmProcessFormAction() { loading.value = false } } + return { formValidate, submitData, diff --git a/src/views/hard/canteen-product-total/index.vue b/src/views/hard/canteen-product-total/index.vue index 8f3708a..0215bca 100644 --- a/src/views/hard/canteen-product-total/index.vue +++ b/src/views/hard/canteen-product-total/index.vue @@ -1,9 +1,16 @@ @@ -117,7 +138,7 @@ const exportExcel = () => { const getSummaries = (param: any) => { const { columns, data } = param - const totalColumns = ["payCount", "totalPrice"] + const totalColumns = ["timeCount", "payCount", "totalPrice"] const totalRow = Array.from({ length: columns.length }) totalRow[0] = "合计" columns.forEach((i: any, index: number) => { diff --git a/src/views/supermarketerp/components/select-dialog.vue b/src/views/supermarketerp/components/select-dialog.vue index 70baa71..198a31c 100644 --- a/src/views/supermarketerp/components/select-dialog.vue +++ b/src/views/supermarketerp/components/select-dialog.vue @@ -1,7 +1,7 @@