diff --git a/src/api/modules/global.ts b/src/api/modules/global.ts index d70cbfc..4f5604e 100644 --- a/src/api/modules/global.ts +++ b/src/api/modules/global.ts @@ -26,8 +26,8 @@ export const getProductLinesApi = (params: any) => { }; //仓库 -export const getWarehousesListApi = () => { - return http.get(`basicinfo/warehouses`); +export const getWarehousesListApi = (params?: any) => { + return http.get(`basicinfo/warehouses`, params); }; //获取金蝶仓库 @@ -35,13 +35,13 @@ export const getWarehousesKingdeeListApi = (params: any) => { return http.get(`basicinfo/warehouses/kingdee`, params); }; //获取金蝶子仓库 -export const getSubwarehouseskingdeeListApi = (params: any) => { +export const getSubwarehouseskingdeeListApi = (params?: any) => { return http.get(`basicinfo/subwarehouses/kingdee`, params); }; //获取聚水潭仓库 /admapi/basicinfo/warehouses/jushuitan -export const getWarehousesJushuitanListApi = (params: any) => { +export const getWarehousesJushuitanListApi = (params?: any) => { return http.get(`basicinfo/warehouses/jushuitan`, params); }; -export const getWarehousesLingXingListApi = (params: any) => { +export const getWarehousesLingXingListApi = (params?: any) => { return http.get(`basicinfo/warehouses/lingxing`, params); }; diff --git a/src/api/modules/setGoods.ts b/src/api/modules/setGoods.ts new file mode 100644 index 0000000..7c7335e --- /dev/null +++ b/src/api/modules/setGoods.ts @@ -0,0 +1,26 @@ +import http from "@/api"; +//列表 /admapi/warehouse/pos_picking_priority +export const getGoodsListApi = (params: any) => { + return http.get(`warehouse/pos_picking_priority`, params); +}; + +//新增 /admapi/warehouse/pos_picking_priority +export const getGoodsAddApi = (params: any) => { + return http.post(`warehouse/pos_picking_priority`, params); +}; +//更新 +export const getGoodsUpApi = (id: any, params: any) => { + return http.post(`warehouse/pos_picking_priority/${id}`, params); +}; +//详情 +export const getGoodsDetailsApi = (id: any) => { + return http.get(`warehouse/pos_picking_priority/${id}`); +}; +//预览 +export const getGoodsPreviewApi = (id: any) => { + return http.get(`warehouse/pos_picking_priority/preview/${id}`); +}; +//验证 /admapi/warehouse/pos_picking_priority/check_exists +export const getGoodsCheckExistswApi = (params: any) => { + return http.get(`warehouse/pos_picking_priority/check_exists`, params); +}; diff --git a/src/api/modules/setWarehouse.ts b/src/api/modules/setWarehouse.ts index c82d462..86787d5 100644 --- a/src/api/modules/setWarehouse.ts +++ b/src/api/modules/setWarehouse.ts @@ -21,19 +21,3 @@ export const getWarehouseUpApi = (id: any, params: any) => { export const getWarehouseDetailsApi = (id: any) => { return http.get(`warehouse/relationship/${id}`); }; - -// //获取金蝶仓库 -// export const getSetWarehouseKingdeeListApi = (params: any) => { -// return http.get(`basicinfo/warehouses/kingdee`, params); -// }; -// //获取金蝶子仓库 -// export const getSetWarehouseSubwarehousesListApi = (params: any) => { -// return http.get(`basicinfo/subwarehouses/kingdee`, params); -// }; -// //获取聚水潭仓库 /admapi/basicinfo/warehouses/jushuitan -// export const getSetWarehouseSubwarehousesJushuitanListApi = (params: any) => { -// return http.get(`basicinfo/warehouses/jushuitan`, params); -// }; -// export const getSetWarehouseSubwarehousesLingXingListApi = (params: any) => { -// return http.get(`basicinfo/warehouses/lingxing`, params); -// }; diff --git a/src/components.d.ts b/src/components.d.ts index 9bb4c2f..571a44e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -5,65 +5,68 @@ // Read more: https://github.com/vuejs/core/pull/3399 export {} -declare module 'vue' { - export interface GlobalComponents { - 403: typeof import('./components/ErrorMessage/403.vue')['default'] - 404: typeof import('./components/ErrorMessage/404.vue')['default'] - 500: typeof import('./components/ErrorMessage/500.vue')['default'] - ColSetting: typeof import('./components/ProTable/components/ColSetting.vue')['default'] - DetailsSearch: typeof import('./components/DetailsSearch/index.vue')['default'] - ElAside: typeof import('element-plus/es')['ElAside'] - ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb'] - ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem'] - ElButton: typeof import('element-plus/es')['ElButton'] - ElContainer: typeof import('element-plus/es')['ElContainer'] - ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] - ElDialog: typeof import('element-plus/es')['ElDialog'] - ElDrawer: typeof import('element-plus/es')['ElDrawer'] - ElDropdown: typeof import('element-plus/es')['ElDropdown'] - ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] - ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] - ElForm: typeof import('element-plus/es')['ElForm'] - ElFormItem: typeof import('element-plus/es')['ElFormItem'] - ElHeader: typeof import('element-plus/es')['ElHeader'] - ElIcon: typeof import('element-plus/es')['ElIcon'] - ElInput: typeof import('element-plus/es')['ElInput'] - ElMain: typeof import('element-plus/es')['ElMain'] - ElMenu: typeof import('element-plus/es')['ElMenu'] - ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] - ElOption: typeof import('element-plus/es')['ElOption'] - ElPagination: typeof import('element-plus/es')['ElPagination'] - ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] - ElSelect: typeof import('element-plus/es')['ElSelect'] - ElSubMenu: typeof import('element-plus/es')['ElSubMenu'] - ElSwitch: typeof import('element-plus/es')['ElSwitch'] - ElTable: typeof import('element-plus/es')['ElTable'] - ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] - ElTabPane: typeof import('element-plus/es')['ElTabPane'] - ElTabs: typeof import('element-plus/es')['ElTabs'] - ElTag: typeof import('element-plus/es')['ElTag'] - Empty: typeof import('./components/ProTable/components/Empty.vue')['default'] - Form: typeof import('./components/Form/index.vue')['default'] - FormItem: typeof import('./components/Form/components/FormItem.vue')['default'] - FormTable: typeof import('./components/FormTable/index.vue')['default'] - Grid: typeof import('./components/Grid/index.vue')['default'] - GridItem: typeof import('./components/Grid/components/GridItem.vue')['default'] - IEpArrowDown: typeof import('~icons/ep/arrow-down')['default'] - IEpCircleClose: typeof import('~icons/ep/circle-close')['default'] - IEpFolderDelete: typeof import('~icons/ep/folder-delete')['default'] - IEpFullScreen: typeof import('~icons/ep/full-screen')['default'] - IEpRefresh: typeof import('~icons/ep/refresh')['default'] - IEpRemove: typeof import('~icons/ep/remove')['default'] - IEpSwitchButton: typeof import('~icons/ep/switch-button')['default'] - ImportExcel: typeof import('./components/ImportExcel/index.vue')['default'] - Loading: typeof import('./components/Loading/index.vue')['default'] - Pagination: typeof import('./components/ProTable/components/Pagination.vue')['default'] - PermissionButton: typeof import('./components/PermissionButton/index.vue')['default'] - ProTable: typeof import('./components/ProTable/index.vue')['default'] - RouterLink: typeof import('vue-router')['RouterLink'] - RouterView: typeof import('vue-router')['RouterView'] - SearchForm: typeof import('./components/SearchForm/index.vue')['default'] - SearchFormItem: typeof import('./components/SearchForm/components/SearchFormItem.vue')['default'] - TableColumn: typeof import('./components/ProTable/components/TableColumn.vue')['default'] - } +declare module "vue" { + export interface GlobalComponents { + 403: typeof import("./components/ErrorMessage/403.vue")["default"]; + 404: typeof import("./components/ErrorMessage/404.vue")["default"]; + 500: typeof import("./components/ErrorMessage/500.vue")["default"]; + ColSetting: typeof import("./components/ProTable/components/ColSetting.vue")["default"]; + DetailsSearch: typeof import("./components/DetailsSearch/index.vue")["default"]; + ElAside: typeof import("element-plus/es")["ElAside"]; + ElBreadcrumb: typeof import("element-plus/es")["ElBreadcrumb"]; + ElBreadcrumbItem: typeof import("element-plus/es")["ElBreadcrumbItem"]; + ElButton: typeof import("element-plus/es")["ElButton"]; + ElCheckbox: typeof import("element-plus/es")["ElCheckbox"]; + ElContainer: typeof import("element-plus/es")["ElContainer"]; + ElDatePicker: typeof import("element-plus/es")["ElDatePicker"]; + ElDialog: typeof import("element-plus/es")["ElDialog"]; + ElDrawer: typeof import("element-plus/es")["ElDrawer"]; + ElDropdown: typeof import("element-plus/es")["ElDropdown"]; + ElDropdownItem: typeof import("element-plus/es")["ElDropdownItem"]; + ElDropdownMenu: typeof import("element-plus/es")["ElDropdownMenu"]; + ElForm: typeof import("element-plus/es")["ElForm"]; + ElFormItem: typeof import("element-plus/es")["ElFormItem"]; + ElHeader: typeof import("element-plus/es")["ElHeader"]; + ElIcon: typeof import("element-plus/es")["ElIcon"]; + ElInput: typeof import("element-plus/es")["ElInput"]; + ElInputNumber: typeof import("element-plus/es")["ElInputNumber"]; + ElMain: typeof import("element-plus/es")["ElMain"]; + ElMenu: typeof import("element-plus/es")["ElMenu"]; + ElMenuItem: typeof import("element-plus/es")["ElMenuItem"]; + ElOption: typeof import("element-plus/es")["ElOption"]; + ElPagination: typeof import("element-plus/es")["ElPagination"]; + ElScrollbar: typeof import("element-plus/es")["ElScrollbar"]; + ElSelect: typeof import("element-plus/es")["ElSelect"]; + ElSubMenu: typeof import("element-plus/es")["ElSubMenu"]; + ElSwitch: typeof import("element-plus/es")["ElSwitch"]; + ElTable: typeof import("element-plus/es")["ElTable"]; + ElTableColumn: typeof import("element-plus/es")["ElTableColumn"]; + ElTabPane: typeof import("element-plus/es")["ElTabPane"]; + ElTabs: typeof import("element-plus/es")["ElTabs"]; + ElTag: typeof import("element-plus/es")["ElTag"]; + ElTooltip: typeof import("element-plus/es")["ElTooltip"]; + Empty: typeof import("./components/ProTable/components/Empty.vue")["default"]; + Form: typeof import("./components/Form/index.vue")["default"]; + FormItem: typeof import("./components/Form/components/FormItem.vue")["default"]; + FormTable: typeof import("./components/FormTable/index.vue")["default"]; + Grid: typeof import("./components/Grid/index.vue")["default"]; + GridItem: typeof import("./components/Grid/components/GridItem.vue")["default"]; + IEpArrowDown: typeof import("~icons/ep/arrow-down")["default"]; + IEpCircleClose: typeof import("~icons/ep/circle-close")["default"]; + IEpFolderDelete: typeof import("~icons/ep/folder-delete")["default"]; + IEpFullScreen: typeof import("~icons/ep/full-screen")["default"]; + IEpRefresh: typeof import("~icons/ep/refresh")["default"]; + IEpRemove: typeof import("~icons/ep/remove")["default"]; + IEpSwitchButton: typeof import("~icons/ep/switch-button")["default"]; + ImportExcel: typeof import("./components/ImportExcel/index.vue")["default"]; + Loading: typeof import("./components/Loading/index.vue")["default"]; + Pagination: typeof import("./components/ProTable/components/Pagination.vue")["default"]; + PermissionButton: typeof import("./components/PermissionButton/index.vue")["default"]; + ProTable: typeof import("./components/ProTable/index.vue")["default"]; + RouterLink: typeof import("vue-router")["RouterLink"]; + RouterView: typeof import("vue-router")["RouterView"]; + SearchForm: typeof import("./components/SearchForm/index.vue")["default"]; + SearchFormItem: typeof import("./components/SearchForm/components/SearchFormItem.vue")["default"]; + TableColumn: typeof import("./components/ProTable/components/TableColumn.vue")["default"]; + } } diff --git a/src/components/DetailsSearch/index.vue b/src/components/DetailsSearch/index.vue index 02ac856..c0bc064 100644 --- a/src/components/DetailsSearch/index.vue +++ b/src/components/DetailsSearch/index.vue @@ -67,6 +67,7 @@ :placeholder="item.placeholder" clearable :disabled="item.disabled" + @change="handleSelectChange(item)" > void; setRuleFormValue?: () => void; selectMultipleDClear?: () => void; + selectChange?: () => void; }>(); let _searchResult = computed(() => { @@ -235,8 +237,11 @@ const emits = defineEmits<{ (e: "selectMultipleRemoveTag", result: Record): void; (e: "selectMultipleRemoteTag1", result: Record): void; (e: "selectMultipleDClear", result: Record): void; + (e: "selectChange", result: Record): void; }>(); - +const handleSelectChange = (item: any) => { + emits("selectChange", item); +}; const handleRomoveTag = (item: any) => { emits("selectMultipleRemoveTag", { item, org_number: _searchResult.value.org_number }); }; diff --git a/src/components/SearchForm/index.vue b/src/components/SearchForm/index.vue index 7ccaf63..b2fc1bc 100644 --- a/src/components/SearchForm/index.vue +++ b/src/components/SearchForm/index.vue @@ -206,7 +206,7 @@ const emits = defineEmits<{ let loading = ref(false); const remoteRef = ref(null); -const _searchParams = computed(() => { +const _searchParams: any = computed(() => { return props.searchParams; }); @@ -276,7 +276,8 @@ const getProductLines = async (keywords: any, item: any) => { //金蝶仓库 const getSetWarehouseKingdeeList = async (keywords: any, item: any) => { - if (Array.isArray(_searchParams.value.use_org_number) ** _searchParams.value.use_org_number.length) { + const useOrgNumber: any[] = _searchParams?.value?.use_org_number; + if (Array.isArray(useOrgNumber) && useOrgNumber?.length > 0) { item.options = []; let use_org_number = ""; use_org_number = _searchParams.value.use_org_number.join(","); @@ -299,7 +300,8 @@ const getSetWarehouseKingdeeList = async (keywords: any, item: any) => { }; //获取金蝶子仓库 const getSetWarehouseSubwarehousesList = async (keywords: any, item: any) => { - if (Array.isArray(_searchParams?.value?.kd_warehouse_number) ** _searchParams?.value?.kd_warehouse_number?.length) { + const kdWarehouseNumber: any[] = _searchParams?.value?.kd_warehouse_number; + if (Array.isArray(kdWarehouseNumber) && kdWarehouseNumber?.length > 0) { //先清空一下 item.options = []; let kd_warehouse_number = ""; diff --git a/src/routers/index.ts b/src/routers/index.ts index 2e60777..28e0477 100644 --- a/src/routers/index.ts +++ b/src/routers/index.ts @@ -41,7 +41,8 @@ router.beforeEach(async (to, from, next) => { const currentPath = window.location.pathname; // 2.动态设置标题 const title = import.meta.env.VITE_GLOB_APP_TITLE; - document.title = to.meta.title ? `${to.meta.title} - ${title}` : title; + // to.meta.title ? `${to.meta.title} - ${title}` : + document.title = title; // 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由到登陆页 if (to.path.toLocaleLowerCase() === LOGIN_URL) { if (userStore.newUserToken) return next(from.fullPath); diff --git a/src/views/foundation/set/goods/add.vue b/src/views/foundation/set/goods/add.vue index 051dfde..1c3aac1 100644 --- a/src/views/foundation/set/goods/add.vue +++ b/src/views/foundation/set/goods/add.vue @@ -13,6 +13,7 @@ :labelWidth="dataStore.labelWidth" :inline="true" ref="detailsRef" + @selectChange="handleChange" /> @@ -24,19 +25,140 @@ import { cloneDeep } from "lodash-es"; import { DETAILS_FORM_DATA, DETAILS_RULE_FORM } from "./constant/list/add"; import DetailsSearch from "@/components/DetailsSearch/index.vue"; import PermissionButton from "@/components/PermissionButton/index.vue"; - +import { useUserStore } from "@/stores/modules/user"; +import $Bus from "@/utils/mittBus"; +import { getGoodsAddApi, getGoodsUpApi, getGoodsDetailsApi, getGoodsCheckExistswApi } from "@/api/modules/setGoods"; +import { getWarehousesListApi } from "@/api/modules/global"; +import { useMsg } from "@/hooks/useMsg"; +const userStore = useUserStore(); +const route = useRoute(); +const $router = useRouter(); // 数据源 const dataStore = reactive({ buttons: cloneDeep(BUTTON), labelWidth: "120px", formData: cloneDeep(DETAILS_FORM_DATA), - ruleForm: cloneDeep(DETAILS_RULE_FORM) + ruleForm: cloneDeep(DETAILS_RULE_FORM), + id: null, + title: "" }); - // 详情表单实例 const detailsRef = ref(null); + +//初始化组织数据 +const init = () => { + if (userStore.orgIdArr.length) { + dataStore.formData[0].options = userStore?.orgIdArr; + } +}; +init(); + +//新增 +const handleAdd = async () => { + const result = await getGoodsAddApi(dataStore.ruleForm); + if (result?.code === 0) { + useMsg("success", "新增成功 !"); + dataStore.id = result?.data?.id; + $Bus.emit("setGoodsResetList"); + } +}; +//更新 +const getGoodsUp = async () => { + const result = await getGoodsUpApi(dataStore.id, dataStore.ruleForm); + if (result?.code === 0) { + useMsg("success", "更新成功 !"); + $Bus.emit("setGoodsResetList"); + } +}; +//详情 +const getGoodsDetails = async () => { + dataStore.id = route.query.id; + if (!dataStore.id) { + return; + } + //getGoodsDetailsApi + const result = await getGoodsDetailsApi(dataStore.id); + if (result?.code === 0) { + dataStore.ruleForm = result?.data; + } +}; +getGoodsDetails(); +//验证 +const getGoodsCheckExistsw = async () => { + const result = await getGoodsCheckExistswApi({ + use_org_number: dataStore.ruleForm.use_org_number, + warehouse_number: dataStore.ruleForm.warehouse_number + }); + if (result?.code === 0 && result?.data?.exists) { + useMsg("error", "仓库已存在数据, 无需再次新增 !"); + } +}; // 按钮点击事件 -const handleButtonClickCallback = () => {}; +const handleButtonClickCallback = (item: any) => { + const { type } = item; + dataStore.title = route.query.title; + if (type === "save") { + if (!dataStore.ruleForm.use_org_number) { + return useMsg("warning", "组织不能为空 !"); + } + if (!dataStore.ruleForm.warehouse_number) { + return useMsg("warning", "仓库不能为空 !"); + } + if (!dataStore.ruleForm.pos_picking_priority) { + return useMsg("warning", "仓位不能为空 !"); + } + dataStore.title === "新增仓位找货优先级" ? handleAdd() : getGoodsUp(); + } + if (type === "preview") { + if (!dataStore.id) { + useMsg("warning", "请先保存数据 !"); + } + $router.push({ + path: "/foundation/set/goods/preview", + query: { id: dataStore.id, name: dataStore.title } + }); + } + if (type === "return") { + $router.push({ + path: "/foundation/set/goods/index" + }); + } +}; +//仓库列表 /foundation/set/goods/preview +const getWarehousesList = async () => { + const result = await getWarehousesListApi({ use_org_number: dataStore.ruleForm.use_org_number }); + if (result?.code === 0) { + const { data } = result; + if (data?.length) { + let options: any = []; + data.forEach((item: any) => { + options.push({ + id: item.id, + value: item.warehouse_number, + label: item.warehouse_name + }); + }); + dataStore.formData[1].options = options; + } + } +}; +const handleChange = (item: any) => { + console.log(item); + getGoodsCheckExistsw(); +}; +//监听当前组织 +watch( + () => dataStore.ruleForm.use_org_number, + (newVal: any) => { + if (newVal) { + getWarehousesList(); + } + }, + { + deep: true, + immediate: true + } +); diff --git a/src/views/foundation/set/goods/constant/list/add.ts b/src/views/foundation/set/goods/constant/list/add.ts index 4ee9fc7..3ed103a 100644 --- a/src/views/foundation/set/goods/constant/list/add.ts +++ b/src/views/foundation/set/goods/constant/list/add.ts @@ -1,6 +1,15 @@ export const DETAILS_FORM_DATA: any[] = [ { - prop: "org_number", + prop: "use_org_number", + placeholder: "请选择", + type: "select", + label: "组织:", + disabled: false, + required: true, + class: "form-item1" + }, + { + prop: "warehouse_number", placeholder: "请选择", type: "select", label: "仓库:", @@ -9,7 +18,7 @@ export const DETAILS_FORM_DATA: any[] = [ class: "form-item1" }, { - prop: "org_number", + prop: "pos_picking_priority", placeholder: "请输入", type: "textarea", label: "仓位:", @@ -19,4 +28,6 @@ export const DETAILS_FORM_DATA: any[] = [ maxLength: 5000 } ]; -export const DETAILS_RULE_FORM: any = {}; +export const DETAILS_RULE_FORM: any = { + use_org_number: "101" +}; diff --git a/src/views/foundation/set/goods/constant/list/addButton.ts b/src/views/foundation/set/goods/constant/list/addButton.ts index 234b6df..52f115e 100644 --- a/src/views/foundation/set/goods/constant/list/addButton.ts +++ b/src/views/foundation/set/goods/constant/list/addButton.ts @@ -11,5 +11,10 @@ export const BUTTON = [ text: "预览(请先保存)", permission: "foundationSetGoodsAddBtnPreview", type: "preview" + }, + { + text: "返回", + permission: "foundationSetGoodsAddBtnRreturn", + type: "return" } ]; diff --git a/src/views/foundation/set/goods/constant/list/search.ts b/src/views/foundation/set/goods/constant/list/search.ts index b4e252e..3e78910 100644 --- a/src/views/foundation/set/goods/constant/list/search.ts +++ b/src/views/foundation/set/goods/constant/list/search.ts @@ -17,10 +17,11 @@ interface FormItem { } export const FORM_DATA: FormItem[] = [ { - prop: "org_number", + prop: "warehouse_number", placeholder: "请输入仓库", - type: "input", - label: "仓库: " + type: "select", + label: "仓库: ", + options: [] } ]; diff --git a/src/views/foundation/set/goods/constant/list/table.ts b/src/views/foundation/set/goods/constant/list/table.ts index 4fa56f0..02da7ae 100644 --- a/src/views/foundation/set/goods/constant/list/table.ts +++ b/src/views/foundation/set/goods/constant/list/table.ts @@ -4,38 +4,30 @@ export const COLUMNS = [ { align: "left", fixed: true, - label: "金蝶仓库", - prop: "material_number", - width: 200 + label: "仓库名称", + prop: "warehouse_name" }, { align: "left", - label: "金蝶子仓库", - prop: "sku", fixed: true, - width: 200 + label: "组织", + prop: "use_org_name" }, { align: "left", - label: "对应聚水潭仓库", - prop: "material_name", - width: 200 - }, - { - align: "left", - label: "对应领星仓库", - prop: "org_name", - width: 200 + label: "仓库优先级", + prop: "pos_picking_priority" }, + { align: "left", label: "更新人", - prop: "product_line" + prop: "operator_name" }, { align: "left", label: "更新时间", - prop: "bar_code" + prop: "updated_at" } ]; diff --git a/src/views/foundation/set/goods/index.vue b/src/views/foundation/set/goods/index.vue index a2e0d04..9901cc2 100644 --- a/src/views/foundation/set/goods/index.vue +++ b/src/views/foundation/set/goods/index.vue @@ -11,7 +11,7 @@ @@ -23,6 +23,11 @@ :formData="dataStore.formData" /> + @@ -31,10 +36,12 @@ import ProTable from "@/components/ProTable/index.vue"; import SearchForm from "@/components/SearchForm/index.vue"; import PermissionButton from "@/components/PermissionButton/index.vue"; -import { getMaterialListApi } from "@/api/modules/foundationMaterial"; +import { getGoodsListApi } from "@/api/modules/setGoods"; +import { useUserStore } from "@/stores/modules/user"; +import $Bus from "@/utils/mittBus"; // import { useMsg } from "@/hooks/useMsg"; import { RULE_FORM, FORM_DATA, COLUMNS, BUTTON } from "./constant/list/index"; -// import { getWarehousesListApi } from "@/api/modules/global"; + // 表格TS import { ProTableInstance } from "@/components/ProTable/interface"; @@ -53,7 +60,13 @@ const dataStore = reactive({ dialogVisible: false, //弹窗 selectionList: [] //选中表格的行 }); - +const userStore = useUserStore(); +const router = useRouter(); +const init = () => { + //仓库赋值 + dataStore.formData[0].options = userStore.warehouse; +}; +init(); // 表格选择事件 const selectionChange = (selection: any) => { dataStore.selectionList = selection; @@ -62,9 +75,15 @@ const selectionChange = (selection: any) => { // 顶部按钮点击事件 const handleButtonClickCallback = (item: any) => { console.log(item); - $router.push({ path: "/foundation/set/goods/add", query: { title: "编辑仓位找货优先级" } }); + $router.push({ path: "/foundation/set/goods/add", query: { title: "新增仓位找货优先级" } }); +}; +//跳转详情 +const handleOpen = (row: any) => { + router.push({ + path: "/foundation/set/goods/add", + query: { id: row.id, title: "编辑仓位找货优先级" } + }); }; - // 搜索 const handleSearch = async (params: any) => { dataStore.initParam = cloneDeep(params); @@ -82,6 +101,13 @@ const handleReset = () => { proTableRef?.value!.getTableList(); }); }; +onMounted(() => { + $Bus.on("setGoodsResetList", () => { + nextTick(() => { + proTableRef?.value!.getTableList(); + }); + }); +}); diff --git a/src/views/foundation/set/shop/index.vue b/src/views/foundation/set/shop/index.vue index 8304802..1a2b0e7 100644 --- a/src/views/foundation/set/shop/index.vue +++ b/src/views/foundation/set/shop/index.vue @@ -159,7 +159,7 @@ const getShopAccessSystem = async () => { const result = await getShopAccessSystemApi(); if (result?.code === 0) { let data = cloneDeep(result?.data); - let options = []; + let options: any = []; data?.length && data.forEach((item: any) => { diff --git a/src/views/foundation/set/warehouse/constant/list/table.ts b/src/views/foundation/set/warehouse/constant/list/table.ts index 09da411..82cd772 100644 --- a/src/views/foundation/set/warehouse/constant/list/table.ts +++ b/src/views/foundation/set/warehouse/constant/list/table.ts @@ -28,7 +28,7 @@ export const COLUMNS = [ arr.push(item.subwarehouse_name); }); } - return Array.isArray(arr) && arr.length ? arr.join(",") : ""; + return Array.isArray(arr) && arr.length ? arr.join(",") : "--"; } }, { diff --git a/src/views/foundation/set/warehouse/index.vue b/src/views/foundation/set/warehouse/index.vue index 931c233..df6379a 100644 --- a/src/views/foundation/set/warehouse/index.vue +++ b/src/views/foundation/set/warehouse/index.vue @@ -248,11 +248,11 @@ const handleOpen = (row: any) => { const handleButtonClickCallback = (item: any) => { const { type } = item; if (type === "del") { - return handleDel(); - } - if (type === "export") { - return handleExport(); + handleDel(); } + // if (type === "export") { + // handleExport(); + // } if (type === "add") { dataStore.title = "新增金蝶子仓与各系统仓库关系"; dataStore.dialogVisible = true; @@ -278,6 +278,8 @@ const handleCommit = () => { let kd_subwarehouse_number = params.kd_subwarehouse_number; if (Array.isArray(kd_subwarehouse_number) && kd_subwarehouse_number.length) { params.kd_subwarehouse_number = kd_subwarehouse_number.join(","); + } else { + delete params.kd_subwarehouse_number; } if (dataStore.title === "新增金蝶子仓与各系统仓库关系") { @@ -308,8 +310,6 @@ const handleSelectMultipleDClear = (params: any) => { item: { prop } } = params; dataStore.detailsRuleForm[prop] = ""; - // if(dataStore.) - // console.log("1232322222222"); }; /** * 监听查询条件标签关闭(统一处理组织、仓库、子仓库联动,修复split类型错误) @@ -341,13 +341,13 @@ const handleSelectMultipleRemoveTag = (params: any) => { */ const handleOrgTagRemove = (remainingOrgValues: any[]) => { // 2. 筛选仓库:基于原始金蝶仓库数据,聚合所有剩余组织对应的仓库(去重) - let filteredWarehouses = []; + let filteredWarehouses: any = []; if (remainingOrgValues.length > 0) { - filteredWarehouses = dataStore.formData[1].options.filter(warehouse => + filteredWarehouses = dataStore.formData[1].options.filter((warehouse: any) => remainingOrgValues.includes(warehouse.use_org_number) ); // 去重:避免同一仓库被多个组织关联导致重复 - filteredWarehouses = Array.from(new Map(filteredWarehouses.map(item => [item.value, item])).values()); + filteredWarehouses = Array.from(new Map(filteredWarehouses.map((item: any) => [item.value, item])).values()); } // 3. 重置仓库状态(清空已选+更新选项) @@ -368,7 +368,7 @@ const handleKdWarehouseTagRemove = (remainingWarehouseValues: any[]) => { // 2. 筛选子仓库:基于原始金蝶子仓库数据,聚合所有剩余仓库对应的子仓库 let filteredSubWarehouses = []; if (remainingWarehouseValues.length > 0) { - filteredSubWarehouses = dataStore.formData[2].options.filter(subWarehouse => + filteredSubWarehouses = dataStore.formData[2].options.filter((subWarehouse: any) => remainingWarehouseValues.includes(subWarehouse.warehouse_number) ); } else { @@ -411,7 +411,6 @@ watch( watch( () => dataStore.detailsRuleForm.use_org_number, (newVal: any) => { - console.log(newVal, "==============value============="); if (newVal) { dataStore.detailsRuleForm.kd_warehouse_number = ""; dataStore.detailsRuleForm.kd_subwarehouse_number = ""; diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 7496eb8..a160981 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -6,11 +6,11 @@