From 1e848b86fbb38e88591be01a39099701ba16b10f Mon Sep 17 00:00:00 2001 From: weiwei Date: Wed, 19 Feb 2025 19:29:55 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 8 ++++---- src/views/hard/hard-dept-total/index.vue | 1 + .../smErpCgDd/smErpCgDdOption.vue | 12 ++---------- .../smErpCgPlan/cgPlanOption.vue | 19 ++++++------------- 4 files changed, 13 insertions(+), 27 deletions(-) diff --git a/.env.development b/.env.development index 06c6a70..6480b17 100644 --- a/.env.development +++ b/.env.development @@ -8,18 +8,18 @@ VITE_OPEN = true ENV = 'development' # ADMIN 服务地址 -# VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/ # 线上 +VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/ # 线上 # VITE_ADMIN_PROXY_PATH = http://pjcloud.center.takin.cc/ # VITE_ADMIN_PROXY_PATH = http://localhost:9999/ -VITE_ADMIN_PROXY_PATH = http://192.168.101.50:9999/ # 邓-本地 +# VITE_ADMIN_PROXY_PATH = http://192.168.101.50:9999/ # 邓-本地 # VITE_ADMIN_PROXY_PATH = http://59.202.170.152:81/api # 正式环境 # 图片访问基础地址 -# VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api # 线上 +VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api # 线上 # VITE_IMAGE_BASE_PATH = http://pjcloud.center.takin.cc # VITE_IMAGE_BASE_PATH = http://localhost:9999 -VITE_IMAGE_BASE_PATH = http://192.168.101.50:9999 # 邓-本地 +# VITE_IMAGE_BASE_PATH = http://192.168.101.50:9999 # 邓-本地 # VITE_IMAGE_BASE_PATH = http://59.202.170.152:81/api/ # 正式环境 # 代码生成服务地址 diff --git a/src/views/hard/hard-dept-total/index.vue b/src/views/hard/hard-dept-total/index.vue index 1e3c9cf..0be3693 100644 --- a/src/views/hard/hard-dept-total/index.vue +++ b/src/views/hard/hard-dept-total/index.vue @@ -44,6 +44,7 @@ v-loading="state.loading" border :cell-style="tableStyle.cellStyle" + height="70vh" :header-cell-style="tableStyle.headerCellStyle" :summary-method="getSummaries" show-summary diff --git a/src/views/supermarketerp/smErpCgDd/smErpCgDdOption.vue b/src/views/supermarketerp/smErpCgDd/smErpCgDdOption.vue index 18d99ac..a533fea 100644 --- a/src/views/supermarketerp/smErpCgDd/smErpCgDdOption.vue +++ b/src/views/supermarketerp/smErpCgDd/smErpCgDdOption.vue @@ -4,18 +4,11 @@
- + - + @@ -256,7 +249,6 @@ 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 @@ diff --git a/src/components/index.ts b/src/components/index.ts index 6c169e8..227f315 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -22,6 +22,7 @@ import SelectDept from "/@/components/Select/SelectDept.vue" import SelectCtcg from "/@/components/Select/SelectCtcg.vue" import SelectCtcgol from "/@/components/Select/SelectCtcgol.vue" import SelectHardGroup from "/@/components/Select/selectHardGroup.vue" +import SelectHandlerUser from "/@/components/Select/SelectHandlerUser.vue" // 第三方组件 import ElementPlus from "element-plus" @@ -66,6 +67,7 @@ export default { app.component("SelectCtcg", SelectCtcg) app.component("SelectCtcgol", SelectCtcgol) app.component("SelectHardGroup", SelectHardGroup) + app.component("SelectHandlerUser", SelectHandlerUser) // 导入全部的elmenet-plus的图标 for (const [key, component] of Object.entries(ElementPlusIconsVue)) { diff --git a/src/views/supermarketerp/components/erpSpuSelectDialog.vue b/src/views/supermarketerp/components/erpSpuSelectDialog.vue new file mode 100644 index 0000000..00732c2 --- /dev/null +++ b/src/views/supermarketerp/components/erpSpuSelectDialog.vue @@ -0,0 +1,123 @@ + + + diff --git a/src/views/supermarketerp/smErpCgDd/components/linkCgCodeDialog.vue b/src/views/supermarketerp/smErpCgDd/components/linkCgCodeDialog.vue new file mode 100644 index 0000000..197a131 --- /dev/null +++ b/src/views/supermarketerp/smErpCgDd/components/linkCgCodeDialog.vue @@ -0,0 +1,81 @@ + + + diff --git a/src/views/supermarketerp/smErpCgDd/smErpCgDdOption.vue b/src/views/supermarketerp/smErpCgDd/smErpCgDdOption.vue index ddecd0d..c7156ef 100644 --- a/src/views/supermarketerp/smErpCgDd/smErpCgDdOption.vue +++ b/src/views/supermarketerp/smErpCgDd/smErpCgDdOption.vue @@ -12,16 +12,14 @@ - - - + - - - - - - - - - - - - - - @@ -182,182 +162,43 @@ - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - diff --git a/src/views/supermarketerp/smErpCgPlan/cgPlanOption.vue b/src/views/supermarketerp/smErpCgPlan/cgPlanOption.vue index 341144e..0c97a44 100644 --- a/src/views/supermarketerp/smErpCgPlan/cgPlanOption.vue +++ b/src/views/supermarketerp/smErpCgPlan/cgPlanOption.vue @@ -11,7 +11,7 @@ - + @@ -158,71 +158,12 @@ - - - - - - - - - - - - - - - - - - - - - - - + @@ -231,47 +172,23 @@ 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/smErpCgPlan" -import { getPlanCode, getCgPlanSpuPage, getErpSpuSimpleAll } from "/@/api/supermarketerp/common" import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table" import { getSupplierTypeOptions } from "/@/api/supermarketerp/smErpSupplier" +import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpCgPlan" +import { getPlanCode, getErpSpuSimpleAll } from "/@/api/supermarketerp/common" +import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue" import { storePrice } from "/@/utils/formatMoney" import { formatDate } from "/@/utils/formatTime" -// 基本表单数据类型 -interface FormVO { - id: string | undefined - planCode: string - orderNumber: string - planDate: string - supplierId: string - handlerUserId: string - remark: string - [key: string]: string | undefined -} - -// 可编辑表格行数据类型 -interface RowVO { - id?: string - erpSpuId: string - quantity: number | null - unitPrice: number | null - totalAmount: number | null - remark: string - unitId: string -} - const router = useRouter() const route = useRoute() +const erpSpuSelectDialogRef = ref() // 商品选择对话框ref const loading = ref(false) // 采购计划加载 -const spuListLoading = ref(false) // 对话框商品列表加载 const baseDataFormRef = ref() // 基本数据表单ref -const editableTableRef = ref>() // 可编辑表格ref -const spuMultipleTableRef = ref() // 对话框多选表格ref +const editableTableRef = ref>() // 可编辑表格ref const supplierTypeDict = ref([]) // 货商下拉选项 - // 基本信息表单数据 -const baseDataForm = reactive({ +const baseDataForm = reactive({ id: undefined, planCode: "", orderNumber: "", @@ -281,24 +198,19 @@ const baseDataForm = reactive({ remark: "", }) const state = reactive<{ - editableTableData: RowVO[] - erpSpuItemsMemo: RowVO[] + editableTableData: any[] + erpSpuItemsMemo: any[] selectedRowsErpSpuIds: string[] insertedRowNumber: number erpSpuSimpleAll: any - spuSelectDialogVisible: boolean - spuDataList: any[] - selectedSpuObjs: any[] + erpSpuSelectDialogVisible: boolean }>({ editableTableData: [], // 可编辑表格数据 erpSpuItemsMemo: [], // 请求到的可编辑表格商品数据的缓存 selectedRowsErpSpuIds: [], // 可编辑表格已选行的ErpSpuId insertedRowNumber: 0, // 可编辑表格插入行的行号 erpSpuSimpleAll: [], // 简要商品列表 - - spuSelectDialogVisible: false, // 商品选择对话框开关 - spuDataList: [], // 商品列表 - selectedSpuObjs: [], // 已选中的商品列表项 + erpSpuSelectDialogVisible: false, // 商品选择对话框开关 }) // 基本信息表单校验规则 @@ -309,7 +221,7 @@ const dataRules = ref({ }) // 可编辑表格校验规则 -const validRules = ref>({ +const validRules = ref>({ unitId: [{ required: true, message: "必须选择" }], quantity: [{ required: true, type: "number", min: 1, max: 99, message: "数值范围1~99" }], }) @@ -349,19 +261,9 @@ const getInitData = async () => { planCode && planCode.code === 0 && (baseDataForm.planCode = planCode.data) } -// 可编辑表格行勾选 -const selectChangeEvent: VxeTableEvents.CheckboxChange = ({ checked }) => { - const $table = editableTableRef.value - if ($table) { - const records = $table.getCheckboxRecords() - console.log(checked ? "勾选事件" : "取消事件", records) - state.selectedRowsErpSpuIds = records.map((item) => item.erpSpuId) - } -} - // 顶部表格行新增 const addEvent = () => { - const newRow: RowVO = { + const newRow: any = { id: "", erpSpuId: "", quantity: null, @@ -381,7 +283,7 @@ const addEvent = () => { // 底部表格行新增 const pushEvent = () => { - const newRow: RowVO = { + const newRow: any = { id: "", erpSpuId: "", quantity: null, @@ -401,7 +303,7 @@ const pushEvent = () => { // 在指定行插入 const insertEvent = () => { - const newRow: RowVO = { + const newRow: any = { id: "", erpSpuId: "", quantity: null, @@ -430,86 +332,27 @@ const removeSelectRowEvent = () => { } } +// 可编辑表格行勾选 +const selectChangeEvent: VxeTableEvents.CheckboxChange = ({ checked }) => { + const $table = editableTableRef.value + if ($table) { + const records = $table.getCheckboxRecords() + console.log(checked ? "勾选事件" : "取消事件", records) + state.selectedRowsErpSpuIds = records.map((item) => item.erpSpuId) + } +} + // 点击商品选择 -const handleClickSpuSelect = async () => { - state.selectedSpuObjs = [...state.editableTableData] +const handleClickSpuSelect = () => erpSpuSelectDialogRef.value.openDialog() - state.spuSelectDialogVisible = true - spuListLoading.value = true - try { - const { code, data } = await getCgPlanSpuPage().finally(() => (spuListLoading.value = false)) - if (code === 0) { - state.spuDataList = data.records.map((item: RowVO) => ({ ...item, erpSpuId: item.id })) - - // 勾选已经选择的商品 - const target = state.spuDataList.filter((row: any) => state.selectedSpuObjs.some((item: any) => row.erpSpuId === item.erpSpuId)) - target.forEach((row: any) => nextTick(() => spuMultipleTableRef.value!.toggleRowSelection(row))) - } - } catch (error) { - state.spuDataList = [] - spuListLoading.value = false - } -} - -// 点击商品列表表格行 -const rowClick = (row: any) => { - state.selectedSpuObjs.findIndex((item: any) => item.erpSpuId === row.erpSpuId) === -1 - ? // state.selectedSpuObjs.indexOf(row) === -1 - state.selectedSpuObjs.push(row) - : state.selectedSpuObjs.splice( - // state.selectedSpuObjs.indexOf(row) - state.selectedSpuObjs.findIndex((item: any) => item.erpSpuId === row.erpSpuId), - 1, - ) - console.log("click-select", state.selectedSpuObjs) - spuMultipleTableRef.value.toggleRowSelection(row) -} - -// 选中商品列表表格行 -const handleSelect = (selectedRows: any[], row: any) => { - state.selectedSpuObjs.findIndex((item: any) => item.erpSpuId === row.erpSpuId) === -1 - ? // state.selectedSpuObjs.indexOf(row) === -1 - state.selectedSpuObjs.push(row) - : state.selectedSpuObjs.splice( - // state.selectedSpuObjs.indexOf(row) - state.selectedSpuObjs.findIndex((item: any) => item.erpSpuId === row.erpSpuId), - 1, - ) - console.log("check-select", state.selectedSpuObjs) -} - -// 全选和反全选商品列表表格行 -const handleSelectAll = (selectedRows: any[]) => { - if (selectedRows.length > 0) { - selectedRows.forEach((row: any) => { - if (state.selectedSpuObjs.findIndex((item: any) => item.erpSpuId === row.erpSpuId) === -1) { - state.selectedSpuObjs.push(row) - } - }) - } else { - state.spuDataList.forEach((row: any) => { - const index = state.selectedSpuObjs.findIndex((item: any) => item.erpSpuId === row.erpSpuId) - if (index !== -1) { - state.selectedSpuObjs.splice(index, 1) - } - }) - } - console.log("checkAll-select", state.selectedSpuObjs) -} - -// 商品表格多选 -const selectionChangeHandle = (rows: any) => { - // console.log("onChange-selects", rows) -} - -// 商品选择对话框确认 -const handleSelectDialogConfirm = () => { - console.log(state.editableTableData, state.selectedSpuObjs) +// 获取被选择的商品行 +const getSelectedSpuRows = (selectionRows: any) => { + console.log("被选择的商品行", selectionRows) // 筛选新勾选的项 - const addedItems = state.selectedSpuObjs - .filter((item: any) => !state.editableTableData.some((editableTableItem: RowVO) => editableTableItem.erpSpuId === item.erpSpuId)) - .map((addItem) => { + const addedItems = selectionRows + .filter((item: any) => !state.editableTableData.some((editableTableItem: any) => editableTableItem.erpSpuId === item.erpSpuId)) + .map((addItem: any) => { const index = state.erpSpuItemsMemo.findIndex((item: any) => item.erpSpuId === addItem.erpSpuId) if (index !== -1) return state.erpSpuItemsMemo[index] return { ...addItem, isNew: true } @@ -519,7 +362,7 @@ const handleSelectDialogConfirm = () => { // 筛选取消勾选的项 const removedItems = state.editableTableData.filter( - (item: any) => !state.selectedSpuObjs.some((selectedItem: any) => selectedItem.erpSpuId === item.erpSpuId), + (item: any) => !selectionRows.some((selectedItem: any) => selectedItem.erpSpuId === item.erpSpuId), ) // 仅移除取消勾选的项 state.editableTableData = state.editableTableData.filter( @@ -532,7 +375,7 @@ const handleSelectDialogConfirm = () => { // $table.setRow(item) // } // }) - state.spuSelectDialogVisible = false + state.erpSpuSelectDialogVisible = false console.log("state.editableTableData", state.editableTableData) } @@ -640,8 +483,8 @@ const clearData = () => { } state.insertedRowNumber = 0 state.editableTableData = [] + state.erpSpuItemsMemo = [] state.selectedRowsErpSpuIds = [] - state.selectedSpuObjs = [] return true } From c843ad753ea71497bfaa12d6ffeca2bdd04077ad Mon Sep 17 00:00:00 2001 From: weiwei Date: Fri, 21 Feb 2025 10:42:55 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=85=B3=E8=81=94=E8=A1=A5=E8=B4=A7=E7=94=B3=E8=AF=B7=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D=E6=A1=86=E8=A1=A8=E6=A0=BC=E5=88=86=E6=AD=A5=E5=8B=BE?= =?UTF-8?q?=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../smErpCgDd/components/linkCgCodeDialog.vue | 69 ++++++++++++++----- .../smErpCgDd/smErpCgDdOption.vue | 3 + .../smErpCgPlan/cgPlanOption.vue | 1 + 3 files changed, 55 insertions(+), 18 deletions(-) diff --git a/src/views/supermarketerp/smErpCgDd/components/linkCgCodeDialog.vue b/src/views/supermarketerp/smErpCgDd/components/linkCgCodeDialog.vue index 197a131..ca3057c 100644 --- a/src/views/supermarketerp/smErpCgDd/components/linkCgCodeDialog.vue +++ b/src/views/supermarketerp/smErpCgDd/components/linkCgCodeDialog.vue @@ -1,20 +1,15 @@ @@ -42,17 +56,22 @@