From 91e0287e84910bb4f6a1d1344750cb508e9d1374 Mon Sep 17 00:00:00 2001 From: yufei0306 <13417315+yufei0306@user.noreply.gitee.com> Date: Fri, 7 Jun 2024 17:54:16 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=98=E7=82=B9=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/TableFormCountPlan.vue | 23 +- .../countManage/count/countPlanMain/index.vue | 289 ++++++++++++++---- 2 files changed, 248 insertions(+), 64 deletions(-) diff --git a/src/components/TableFormCountPlan/src/TableFormCountPlan.vue b/src/components/TableFormCountPlan/src/TableFormCountPlan.vue index e1138a47f..e5d027c55 100644 --- a/src/components/TableFormCountPlan/src/TableFormCountPlan.vue +++ b/src/components/TableFormCountPlan/src/TableFormCountPlan.vue @@ -72,11 +72,16 @@ " > +
+ {{ pageCount }} 页 + 上一页 + 下一页 +
{ } const tableFormChange = (field, val, row) => { + pageCount.value = 1 emit('tableFormChange', field, val, row) } // 添加数据 @@ -172,6 +178,21 @@ const handleAddTable = () => { const handleDeleteTable = (row, index) => { emit('handleDeleteTable', row, index) } +const pageCount = ref(1) + +const currentList = (options)=>{ + if(options&&options.length>0){ + return options.slice((pageCount.value-1)*15,pageCount.value*15) + }else{ + return [] + } +} +const nextPage = ()=>{ + pageCount.value++ +} +const prexPage = ()=>{ + pageCount.value-- +} // setup 语法糖 抛出方法 defineExpose({ TableBaseComponents_Ref, diff --git a/src/views/wms/countManage/count/countPlanMain/index.vue b/src/views/wms/countManage/count/countPlanMain/index.vue index 726f91745..75f779e81 100644 --- a/src/views/wms/countManage/count/countPlanMain/index.vue +++ b/src/views/wms/countManage/count/countPlanMain/index.vue @@ -374,27 +374,27 @@ const openForm = async (type: string, row?: number) => { ] // 重置明细数据 formRef.value.open(type, row) - Promise.all([getOwnerAllList(), - getSupplierAllList(), - getCustomerAllList(), - getItembasicAllList(), - getWarehouseAllList(), - getAreaAllList(), - getLocationgroupAllList(), - getLocationAllList()]) + // Promise.all([getOwnerAllList(), + // getSupplierAllList(), + // getCustomerAllList(), + // getItembasicAllList(), + // getWarehouseAllList(), + // getAreaAllList(), + // getLocationgroupAllList(), + // getLocationAllList()]) } /** 详情操作 */ const detailRef = ref() const openDetail = (row: any, titleName: any, titleValue: any) => { - getOwnerAllList() - getSupplierAllList() - getCustomerAllList() - getItembasicAllList() - getWarehouseAllList() - getAreaAllList() - getLocationgroupAllList() - getLocationAllList() + // getOwnerAllList() + // getSupplierAllList() + // getCustomerAllList() + // getItembasicAllList() + // getWarehouseAllList() + // getAreaAllList() + // getLocationgroupAllList() + // getLocationAllList() detailRef.value.openDetail(row, titleName, titleValue) } // 详情打开的编辑的时候设置盘点范围值列表 @@ -417,13 +417,13 @@ const detailOpenForm = (type, row) => { formTypeDetail.value = 'Select' switch (row.type) { case 'OWNER': - countPlanAllList.value = allList.value.ownerAllList + getOwnerAllList(null,true) break case 'SUPPLIER': - countPlanAllList.value = allList.value.supplierAllList + getSupplierAllList(null,true) break case 'CUSTOMER': - countPlanAllList.value = allList.value.customerAllList + getCustomerAllList(null,true) break case 'ABC': countPlanAllList.value = getStrDictOptions(DICT_TYPE.ABC_CLASS) @@ -435,19 +435,19 @@ const detailOpenForm = (type, row) => { countPlanAllList.value = getStrDictOptions(DICT_TYPE.ITEM_GROUP) break case 'ITEMS_CODE': - countPlanAllList.value = allList.value.itembasicAllList + getItembasicAllList(null,true) break case 'WAREHOUSE_CODE': - countPlanAllList.value = allList.value.warehouseAllList + getWarehouseAllList(null,true) break case 'AREABASIC_CODE': - countPlanAllList.value = allList.value.areaAllList + getAreaAllList(null,true) break case 'LOCATIONGROUP_CODE': - countPlanAllList.value = allList.value.locationgroupAllList + getLocationgroupAllList(null,true) break case 'LOCATION_CODE': - countPlanAllList.value = allList.value.locationAllList + getLocationAllList(null,true) break } } else if (val == 'PROJECT') { @@ -606,13 +606,13 @@ const selectChangeDetail = (field, val) => { formTypeDetail.value = 'Select' switch (val) { case 'OWNER': - countPlanAllList.value = allList.value.ownerAllList + getOwnerAllList(null,true) break case 'SUPPLIER': - countPlanAllList.value = allList.value.supplierAllList + getSupplierAllList(null,true) break case 'CUSTOMER': - countPlanAllList.value = allList.value.customerAllList + getCustomerAllList(null,true) break case 'ABC': countPlanAllList.value = getStrDictOptions(DICT_TYPE.ABC_CLASS) @@ -624,19 +624,19 @@ const selectChangeDetail = (field, val) => { countPlanAllList.value = getStrDictOptions(DICT_TYPE.ITEM_GROUP) break case 'ITEMS_CODE': - countPlanAllList.value = allList.value.itembasicAllList + getItembasicAllList(null,true) break case 'WAREHOUSE_CODE': - countPlanAllList.value = allList.value.warehouseAllList + getWarehouseAllList(null,true) break case 'AREABASIC_CODE': - countPlanAllList.value = allList.value.areaAllList + getAreaAllList(null,true) break case 'LOCATIONGROUP_CODE': - countPlanAllList.value = allList.value.locationgroupAllList + getLocationgroupAllList(null,true) break case 'LOCATION_CODE': - countPlanAllList.value = allList.value.locationAllList + getLocationAllList(null,true) break } } else if (val == 'PROJECT') { @@ -664,13 +664,13 @@ const tableFormChange = async (field, val, row) => { row.formType = 'Select' switch (row.type) { case 'OWNER': - row.initOptions = allList.value.ownerAllList + getOwnerAllList(row) break case 'SUPPLIER': - row.initOptions = allList.value.supplierAllList + getSupplierAllList(row) break case 'CUSTOMER': - row.initOptions = allList.value.customerAllList + getCustomerAllList(row) break case 'ABC': row.initOptions = getStrDictOptions(DICT_TYPE.ABC_CLASS) @@ -682,19 +682,19 @@ const tableFormChange = async (field, val, row) => { row.initOptions = getStrDictOptions(DICT_TYPE.ITEM_GROUP) break case 'ITEMS_CODE': - row.initOptions = allList.value.itembasicAllList + getItembasicAllList(row) break case 'WAREHOUSE_CODE': - row.initOptions = allList.value.warehouseAllList + getWarehouseAllList(row) break case 'AREABASIC_CODE': - row.initOptions = allList.value.areaAllList + getAreaAllList(row) break case 'LOCATIONGROUP_CODE': - row.initOptions = allList.value.locationgroupAllList + getLocationgroupAllList(row) break case 'LOCATION_CODE': - row.initOptions = allList.value.locationAllList + getLocationAllList(row) break } } else if (row.type == 'PROJECT') { @@ -717,91 +717,254 @@ const allList = ref({ itemGroupList: getStrDictOptions(DICT_TYPE.ITEM_GROUP) }) // 获取货主列表 -const getOwnerAllList = async () => { - OwnerApi.getOwnerList().then((res) => { +const getOwnerAllList = async (row,update_countPlanAllList=false) => { + + let getLoading = null + let res = null + if(!allList.value.ownerAllList||allList.value.ownerAllList.length==0){ + try { + getLoading = ElLoading.service({ + lock: true, + text: 'loading...', + background: 'rgba(0, 0, 0, 0.7)' + }) + res = await OwnerApi.getOwnerList() + } finally { + getLoading?.close() + } + } + + if(res){ allList.value.ownerAllList = res.map((element) => { return { value: element.code, label: element.name } }) - }) + } + if(row){ + row.initOptions = allList.value.ownerAllList + } + if(update_countPlanAllList){ + countPlanAllList.value = allList.value.ownerAllList + } } // 获取供应商列表 -const getSupplierAllList = async () => { - SupplierApi.getSupplierList().then((res) => { +const getSupplierAllList = async (row,update_countPlanAllList=false) => { + let getLoading = null + let res = null + if(!allList.value.supplierAllList||allList.value.supplierAllList.length==0){ + try { + getLoading = ElLoading.service({ + lock: true, + text: 'loading...', + background: 'rgba(0, 0, 0, 0.7)' + }) + res = await SupplierApi.getSupplierList() + } finally { + getLoading?.close() + } + } + if(res){ allList.value.supplierAllList = res.map((element) => { return { value: element.code, label: element.name } }) - }) + } + if(row){ + row.initOptions = allList.value.supplierAllList + } + if(update_countPlanAllList){ + countPlanAllList.value = allList.value.supplierAllList + } } // 获取供应商列表 -const getCustomerAllList = async () => { - CustomerApi.getCustomerList().then((res) => { +const getCustomerAllList = async (row,update_countPlanAllList=false) => { + let getLoading = null + let res = null + if(!allList.value.customerAllList||allList.value.customerAllList.length==0){ + try { + getLoading = ElLoading.service({ + lock: true, + text: 'loading...', + background: 'rgba(0, 0, 0, 0.7)' + }) + res = await CustomerApi.getCustomerList() + } finally { + getLoading?.close() + } + } + if(res){ allList.value.customerAllList = res.map((element) => { return { value: element.code, label: element.name } }) - }) + } + if(row){ + row.initOptions = allList.value.customerAllList + } + if(update_countPlanAllList){ + countPlanAllList.value = allList.value.customerAllList + } } // 获取物料代码列表 -const getItembasicAllList = async () => { - ItembasicApi.getItembasicList().then((res) => { +const getItembasicAllList = async (row,update_countPlanAllList=false) => { + let getLoading = null + let res = null + if(!allList.value.itembasicAllList||allList.value.itembasicAllList.length==0){ + try { + getLoading = ElLoading.service({ + lock: true, + text: 'loading...', + background: 'rgba(0, 0, 0, 0.7)' + }) + res = await ItembasicApi.getItembasicList() + } finally { + getLoading?.close() + } + } + if(res){ allList.value.itembasicAllList = res.map((element) => { return { value: element.code, label: element.name + '-'+ element.code } }) - }) + } + if(row){ + row.initOptions = allList.value.itembasicAllList + } + if(update_countPlanAllList){ + countPlanAllList.value = allList.value.itembasicAllList + } } // 获取仓库列表 -const getWarehouseAllList = async () => { - WarehouseApi.getWarehouseList({ available: 'TRUE' }).then((res) => { +const getWarehouseAllList = async (row,update_countPlanAllList=false) => { + let getLoading = null + let res = null + if(!allList.value.warehouseAllList||allList.value.warehouseAllList.length==0){ + try { + getLoading = ElLoading.service({ + lock: true, + text: 'loading...', + background: 'rgba(0, 0, 0, 0.7)' + }) + res = await WarehouseApi.getWarehouseList({ available: 'TRUE' }) + } finally { + getLoading?.close() + } + } + if(res){ allList.value.warehouseAllList = res.map((element) => { return { value: element.code, label: element.name } }) - }) + } + if(row){ + row.initOptions = allList.value.warehouseAllList + } + if(update_countPlanAllList){ + countPlanAllList.value = allList.value.warehouseAllList + } } // 获取库区列表 -const getAreaAllList = async () => { - AreaApi.getAreaList({ available: 'TRUE' }).then((res) => { +const getAreaAllList = async (row,update_countPlanAllList=false) => { + let getLoading = null + let res = null + if(!allList.value.areaAllList||allList.value.areaAllList.length==0){ + try { + getLoading = ElLoading.service({ + lock: true, + text: 'loading...', + background: 'rgba(0, 0, 0, 0.7)' + }) + res = await AreaApi.getAreaList({ available: 'TRUE' }) + } finally { + getLoading?.close() + } + } + if(res){ allList.value.areaAllList = res.map((element) => { return { value: element.code, label: element.name + '-'+ element.code } }) - }) + } + if(row){ + row.initOptions = allList.value.areaAllList + } + if(update_countPlanAllList){ + countPlanAllList.value = allList.value.areaAllList + } } // 获取库位组列表 -const getLocationgroupAllList = async () => { - LocationgroupApi.getLocationgroupList({ available: 'TRUE' }).then((res) => { +const getLocationgroupAllList = async (row,update_countPlanAllList=false) => { + let getLoading = null + let res = null + if(!allList.value.locationgroupAllList||allList.value.locationgroupAllList.length==0){ + try { + getLoading = ElLoading.service({ + lock: true, + text: 'loading...', + background: 'rgba(0, 0, 0, 0.7)' + }) + res = await LocationgroupApi.getLocationgroupList({ available: 'TRUE' }) + } finally { + getLoading?.close() + } + } + if(res){ allList.value.locationgroupAllList = res.map((element) => { return { value: element.code, label: element.name } }) - }) + } + if(row){ + row.initOptions = allList.value.locationgroupAllList + } + if(update_countPlanAllList){ + countPlanAllList.value = allList.value.locationgroupAllList + } } // 获取库位列表 -const getLocationAllList = async () => { - LocationpApi.getLocationList({ available: 'TRUE' }).then((res) => { +const getLocationAllList = async (row,update_countPlanAllList=false) => { + let getLoading = null + let res = null + if(!allList.value.locationAllList||allList.value.locationAllList.length==0){ + getLoading = ElLoading.service({ + lock: true, + text: 'loading...', + background: 'rgba(0, 0, 0, 0.7)' + }) + res = await LocationpApi.getLocationList({ available: 'TRUE' }) + console.log('res',res) + + } + if(res){ allList.value.locationAllList = res.map((element) => { return { value: element.code, label: element.name + '-'+ element.code } }) + } + if(row){ + row.initOptions = allList.value.locationAllList + } + if(update_countPlanAllList){ + countPlanAllList.value = allList.value.locationAllList + } + nextTick(()=>{ + getLoading?.close() }) } /** 初始化 **/