From 0ddf792e63bd48c85b61c5da6bc1e0ea1bdee39f Mon Sep 17 00:00:00 2001 From: weiwei Date: Thu, 20 Feb 2025 08:57:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E5=85=A5=E5=BA=93=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/supermarketerp/common.ts | 27 + src/api/supermarketerp/smErpCgPlan.ts | 25 - .../smErpCgDd/smErpCgDdOption.vue | 15 +- .../smErpCgPlan/cgPlanOption.vue | 7 +- .../smErpInventoryRecords/form.vue | 203 ----- .../smErpInventoryRecords/index.vue | 314 ++++---- .../smErpInventoryRecordsOption.vue | 728 ++++++++++++++++++ .../components/supermarketUnit/index.vue | 66 +- .../supermarketerp/supermarketSpu/form.vue | 62 +- 9 files changed, 992 insertions(+), 455 deletions(-) create mode 100644 src/api/supermarketerp/common.ts delete mode 100644 src/views/supermarketerp/smErpInventoryRecords/form.vue create mode 100644 src/views/supermarketerp/smErpInventoryRecords/smErpInventoryRecordsOption.vue diff --git a/src/api/supermarketerp/common.ts b/src/api/supermarketerp/common.ts new file mode 100644 index 0000000..2e3eefc --- /dev/null +++ b/src/api/supermarketerp/common.ts @@ -0,0 +1,27 @@ +import request from "/@/utils/request" + +// type:1 获取采购计划编号 +// type:2 获取订单编号 +export function getPlanCode(params: { type: 1 | 2 }) { + return request({ + url: "/supermarket/sm/common/getSequence", + method: "get", + params, + }) +} + +// 获取采购计划和订单所选择的商品的列表 +export function getCgPlanSpuPage() { + return request({ + url: "/supermarket/smErpCgPlan/erpSpuPage", + method: "get", + }) +} + +// 获取简要商品列表 +export function getErpSpuSimpleAll() { + return request({ + url: "/supermarket/supermarketSpu/SimpleAll", + method: "get", + }) +} diff --git a/src/api/supermarketerp/smErpCgPlan.ts b/src/api/supermarketerp/smErpCgPlan.ts index d8f86ea..3c8f5b2 100644 --- a/src/api/supermarketerp/smErpCgPlan.ts +++ b/src/api/supermarketerp/smErpCgPlan.ts @@ -38,28 +38,3 @@ export function putObj(obj?: Object) { data: obj, }) } - -// 获取采购计划编号 -export function getPlanCode() { - return request({ - url: "/supermarket/sm/common/getSequence", - method: "get", - params: { type: 1 }, - }) -} - -// 获取采购计划选择商品的列表 -export function getCgPlanSpuPage() { - return request({ - url: "/supermarket/smErpCgPlan/erpSpuPage", - method: "get", - }) -} - -// 获取简要商品列表 -export function getErpSpuSimpleAll() { - return request({ - url: "/supermarket/supermarketSpu/SimpleAll", - method: "get", - }) -} diff --git a/src/views/supermarketerp/smErpCgDd/smErpCgDdOption.vue b/src/views/supermarketerp/smErpCgDd/smErpCgDdOption.vue index a533fea..7444101 100644 --- a/src/views/supermarketerp/smErpCgDd/smErpCgDdOption.vue +++ b/src/views/supermarketerp/smErpCgDd/smErpCgDdOption.vue @@ -251,10 +251,11 @@ import { ref, reactive, computed, onMounted } from "vue" import { useRouter, useRoute } from "vue-router" import { useMessage } from "/@/hooks/message" import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpCgDd" -import { getPlanCode, getCgPlanSpuPage, getErpSpuSimpleAll } from "/@/api/supermarketerp/smErpCgPlan" +import { getPlanCode, getCgPlanSpuPage, getErpSpuSimpleAll } from "/@/api/supermarketerp/common" import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table" import { getSupplierTypeOptions } from "/@/api/supermarketerp/smErpSupplier" import { storePrice } from "/@/utils/formatMoney" +import { formatDate } from "/@/utils/formatTime" // 基本表单数据类型 interface FormVO { @@ -301,7 +302,7 @@ const supplierTypeDict = ref([]) // 货商下拉选项 const baseDataForm = reactive({ id: "", code: "", - dDate: "", + dDate: formatDate(new Date(), "YYYY-mm-dd"), warehouseId: "", handlerUserId: "", checkStatus: "", @@ -339,8 +340,8 @@ const state = reactive<{ // 基本信息表单校验规则 const dataRules = ref({ - planCode: [{ required: true, message: "采购计划编号不能为空", trigger: "blur" }], - planDate: [{ required: true, message: "采购计划单据日期不能为空", trigger: "blur" }], + code: [{ required: true, message: "采购订单编号不能为空", trigger: "blur" }], + dDate: [{ required: true, message: "采购订单单据日期不能为空", trigger: "blur" }], supplierId: [{ required: true, message: "货商不能为空", trigger: "blur" }], }) @@ -378,11 +379,11 @@ const getInitData = async () => { } // 获取货商选项 & 获取采购计划编号 - const [supplierTypeOptions, planCode] = await Promise.allSettled([getSupplierTypeOptions(), getPlanCode()]).then((results) => + const [supplierTypeOptions, planCode] = await Promise.allSettled([getSupplierTypeOptions(), getPlanCode({ type: 2 })]).then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)), ) supplierTypeOptions && supplierTypeOptions.code === 0 && (supplierTypeDict.value = supplierTypeOptions.data) - planCode && planCode.code === 0 && (baseDataForm.planCode = planCode.data) + planCode && planCode.code === 0 && (baseDataForm.code = planCode.data) } // 可编辑表格行勾选 @@ -670,7 +671,7 @@ const submitData = async () => { // 清空填写的数据 返回 true const clearData = () => { for (const key in baseDataForm) { - if (key === "planCode" || key === "id") continue + if (key === "code" || key === "id" || key === "dDate") continue baseDataForm[key] = "" } state.insertedRowNumber = 0 diff --git a/src/views/supermarketerp/smErpCgPlan/cgPlanOption.vue b/src/views/supermarketerp/smErpCgPlan/cgPlanOption.vue index 335fb7a..c26d6bb 100644 --- a/src/views/supermarketerp/smErpCgPlan/cgPlanOption.vue +++ b/src/views/supermarketerp/smErpCgPlan/cgPlanOption.vue @@ -233,7 +233,8 @@ import { ref, reactive, computed, onMounted } from "vue" import { useRouter, useRoute } from "vue-router" import { useMessage } from "/@/hooks/message" -import { getObj, addObj, putObj, getPlanCode, getCgPlanSpuPage, getErpSpuSimpleAll } from "/@/api/supermarketerp/smErpCgPlan" +import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpCgPlan" +import { getPlanCode, getCgPlanSpuPage, getErpSpuSimpleAll } from "/@/api/supermarketerp/common" import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table" import { getSupplierTypeOptions } from "/@/api/supermarketerp/smErpSupplier" import { storePrice } from "/@/utils/formatMoney" @@ -343,7 +344,7 @@ const getInitData = async () => { } // 获取货商选项 & 获取采购计划编号 - const [supplierTypeOptions, planCode] = await Promise.allSettled([getSupplierTypeOptions(), getPlanCode()]).then((results) => + const [supplierTypeOptions, planCode] = await Promise.allSettled([getSupplierTypeOptions(), getPlanCode({ type: 1 })]).then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)), ) supplierTypeOptions && supplierTypeOptions.code === 0 && (supplierTypeDict.value = supplierTypeOptions.data) @@ -635,7 +636,7 @@ const submitData = async () => { // 清空填写的数据 返回 true const clearData = () => { for (const key in baseDataForm) { - if (key === "planCode" || key === "id") continue + if (key === "planCode" || key === "id" || key === "planDate") continue baseDataForm[key] = "" } state.insertedRowNumber = 0 diff --git a/src/views/supermarketerp/smErpInventoryRecords/form.vue b/src/views/supermarketerp/smErpInventoryRecords/form.vue deleted file mode 100644 index ac1bd2f..0000000 --- a/src/views/supermarketerp/smErpInventoryRecords/form.vue +++ /dev/null @@ -1,203 +0,0 @@ - - - diff --git a/src/views/supermarketerp/smErpInventoryRecords/index.vue b/src/views/supermarketerp/smErpInventoryRecords/index.vue index f4b9526..589f9e0 100644 --- a/src/views/supermarketerp/smErpInventoryRecords/index.vue +++ b/src/views/supermarketerp/smErpInventoryRecords/index.vue @@ -1,114 +1,151 @@ diff --git a/src/views/supermarketerp/smErpInventoryRecords/smErpInventoryRecordsOption.vue b/src/views/supermarketerp/smErpInventoryRecords/smErpInventoryRecordsOption.vue new file mode 100644 index 0000000..c57ea0a --- /dev/null +++ b/src/views/supermarketerp/smErpInventoryRecords/smErpInventoryRecordsOption.vue @@ -0,0 +1,728 @@ + + + diff --git a/src/views/supermarketerp/supermarketSpu/components/supermarketUnit/index.vue b/src/views/supermarketerp/supermarketSpu/components/supermarketUnit/index.vue index d77b38c..7327a90 100644 --- a/src/views/supermarketerp/supermarketSpu/components/supermarketUnit/index.vue +++ b/src/views/supermarketerp/supermarketSpu/components/supermarketUnit/index.vue @@ -60,12 +60,7 @@ - + @@ -120,9 +115,6 @@ const FormDialog = defineAsyncComponent(() => import("./form.vue")) const supermarketUnitEntityList = defineModel("supermarketUnitEntityList", { default: [] }) -const props = defineProps<{ - defaultSpuUnit: any -}>() const formDialogRef = ref() // 搜索变量 @@ -150,36 +142,36 @@ const tableStyle = { } // 根据基础信息的部分填写项自动生成一条默认包装单位 -watch( - () => props.defaultSpuUnit, - (newValue, oldValue) => { - console.log(newValue, oldValue) +// watch( +// () => props.defaultSpuUnit, +// (newValue, oldValue) => { +// console.log(newValue, oldValue) - const defaultSpuUnitIndex = supermarketUnitEntityList.value.findIndex((item: any) => { - return ( - item.barCode == oldValue.barCode && - item.unit == oldValue.unit && - item.packageNum == oldValue.packageNum && - item.retailPrice == oldValue.retailPrice && - item.purchasePrice == oldValue.purchasePrice && - item.promotionPrice == oldValue.promotionPrice && - item.costPrice == oldValue.costPrice - ) - }) - console.log(defaultSpuUnitIndex) +// const defaultSpuUnitIndex = supermarketUnitEntityList.value.findIndex((item: any) => { +// return ( +// item.barCode == oldValue.barCode && +// item.unit == oldValue.unit && +// item.packageNum == oldValue.packageNum && +// item.retailPrice == oldValue.retailPrice && +// item.purchasePrice == oldValue.purchasePrice && +// item.promotionPrice == oldValue.promotionPrice && +// item.costPrice == oldValue.costPrice +// ) +// }) +// console.log(defaultSpuUnitIndex) - if (defaultSpuUnitIndex !== -1) { - supermarketUnitEntityList.value[defaultSpuUnitIndex] = newValue - } else { - supermarketUnitEntityList.value.push(newValue) - } - console.log(supermarketUnitEntityList.value) - }, - { - deep: true, - immediate: true, - }, -) +// if (defaultSpuUnitIndex !== -1) { +// supermarketUnitEntityList.value[defaultSpuUnitIndex] = newValue +// } else { +// supermarketUnitEntityList.value.push(newValue) +// } +// console.log(supermarketUnitEntityList.value) +// }, +// { +// deep: true, +// immediate: true, +// }, +// ) const getDataList = (formData: any) => { console.log(formData) diff --git a/src/views/supermarketerp/supermarketSpu/form.vue b/src/views/supermarketerp/supermarketSpu/form.vue index 0c73b3b..1fa265f 100644 --- a/src/views/supermarketerp/supermarketSpu/form.vue +++ b/src/views/supermarketerp/supermarketSpu/form.vue @@ -27,12 +27,7 @@ - + @@ -53,12 +48,7 @@ - + @@ -118,9 +108,7 @@ - {{ item.label }} - + {{ item.label }} @@ -157,10 +145,7 @@ - + @@ -173,9 +158,7 @@ 取消 上一步 下一步 - - 确 认 - + 确 认 @@ -184,13 +167,7 @@