chenfang 11 months ago
parent
commit
612057a5ce
  1. 6
      src/components/Detail/src/Detail.vue
  2. 60
      src/components/DetailTable/src/DetailTable.vue
  3. 132
      src/views/wms/countManage/count/countPlanMain/index.vue

6
src/components/Detail/src/Detail.vue

@ -62,11 +62,11 @@
</template> </template>
</Table> </Table>
<DetailTable <DetailTable
v-if="!isBasic && fromeWhere == 'countPlan'" v-if="!isBasic && fromeWhere == 'countPlan' && isShowDrawer"
:columns="detailAllSchemasRef.tableColumns" :columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList" :data="tableObjectRef.tableList"
:allList="allList" :allList="allList"
:countScopeType="countScopeType" :countScopeType="countScopeType"
> >
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase <ButtonBase
@ -313,7 +313,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
tableObjectRef.value.params = { tableObjectRef.value.params = {
masterId: row.id masterId: row.id
} }
getList() await getList()
} }
isShowDrawer.value = true isShowDrawer.value = true
if (row) { if (row) {

60
src/components/DetailTable/src/DetailTable.vue

@ -1,14 +1,17 @@
<template> <template>
<div> <div>
<el-table :data="data" style="width: 100%"> <el-table :data="data" style="width: 100%">
<el-table-column <el-table-column :prop="columns[0].field" :label="columns[0].label" align="center">
:prop="item.field" <template #default="scope">
:label="item.label" {{ forrmatter(scope.row.type) }}
v-for="(item, index) in columns" </template>
:key="index" <!-- <slot name="action" v-if="item.field == 'action'"></slot> -->
align="center" </el-table-column>
> <el-table-column :prop="columns[1].field" :label="columns[1].label" align="center">
<slot name="action" v-if="item.field == 'action'"></slot> <template #default="scope">
<div v-if=" scope.row.type == 'PROJECT'"> {{ scope.row.value }}</div>
<div v-else> {{ forrmatter1(scope.row) }}</div>
</template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
@ -39,8 +42,47 @@ const props = defineProps({
default: null default: null
} }
}) })
// const data = ref(props.data)
const countScopeType = ref(props.countScopeType)
const allList = ref(props.allList)
const forrmatter = (val) => {
if(val){
return countScopeType.value.find((cur) => cur.value == val).label
}else{
return ''
}
}
const forrmatter1 = (item) => {
if(item?.type == 'OWNER'){
return allList.value.ownerAllList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'SUPPLIER'){
return allList.value.supplierAllList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'CUSTOMER'){
return allList.value.customerAllList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'ABC'){
return allList.value.abcList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'ITEMS_TYPE'){
return allList.value.itemTypeList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'ITEMS_GROUP'){
return allList.value.itemGroupList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'ITEMS_CODE'){
return allList.value.itembasicAllList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'WAREHOUSE_CODE'){
return allList.value.warehouseAllList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'AREABASIC_CODE'){
return allList.value.areaAllList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'LOCATIONGROUP_CODE'){
return allList.value.locationgroupAllList.find((cur) => cur.value == item.value).label
}else if(item?.type == 'LOCATION_CODE'){
return allList.value.locationAllList.find((cur) => cur.value == item.value).label
}else{
return ''
}
}
onMounted(async () => {
console.log('props.data',props.data)
})
</script> </script>
<style lang="scss"> <style lang="scss">
</style> </style>

132
src/views/wms/countManage/count/countPlanMain/index.vue

@ -117,7 +117,6 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
import * as ItembasicApi from '@/api/wms/itembasic' import * as ItembasicApi from '@/api/wms/itembasic'
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
console.log('CountPlanDetail.allSchemas', CountPlanDetail.allSchemas)
// //
defineOptions({ name: 'CountPlanMain' }) defineOptions({ name: 'CountPlanMain' })
@ -296,10 +295,12 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const formRef = ref()
const openForm = async (type: string, row?: number) => { const openForm = async (type: string, row?: number) => {
tableData.value = [ { tableData.value = [
type: '', {
value: '' type: '',
}] // value: ''
}
] //
formRef.value.open(type, row) formRef.value.open(type, row)
getOwnerAllList() getOwnerAllList()
@ -315,6 +316,14 @@ const openForm = async (type: string, row?: number) => {
/** 详情操作 */ /** 详情操作 */
const detailRef = ref() const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => { const openDetail = (row: any, titleName: any, titleValue: any) => {
getOwnerAllList()
getSupplierAllList()
getCustomerAllList()
getItembasicAllList()
getWarehouseAllList()
getAreaAllList()
getLocationgroupAllList()
getLocationAllList()
detailRef.value.openDetail(row, titleName, titleValue) detailRef.value.openDetail(row, titleName, titleValue)
} }
@ -354,10 +363,12 @@ let tableFormKeys = {}
CountPlanDetail.allSchemas.tableFormColumns.forEach((item) => { CountPlanDetail.allSchemas.tableFormColumns.forEach((item) => {
tableFormKeys[item.field] = item.default ? item.default : '' tableFormKeys[item.field] = item.default ? item.default : ''
}) })
const tableData = ref([{ const tableData = ref([
{
type: '', type: '',
value: '' value: ''
}]) }
])
// //
const handleAddTable = () => { const handleAddTable = () => {
@ -375,13 +386,12 @@ const handleDeleteTable = (item, index) => {
// //
const submitForm = async (formType, data) => { const submitForm = async (formType, data) => {
data.subList = tableData.value.map(item=>{ data.subList = tableData.value.map((item) => {
return{ return {
type:item.type, type: item.type,
value:item.value, value: item.value
} }
}) // }) //
console.log(tableData.value)
try { try {
if (formType === 'create') { if (formType === 'create') {
await CountPlanMainApi.createCountPlanMain(data) await CountPlanMainApi.createCountPlanMain(data)
@ -443,8 +453,6 @@ const selectChange = (field, val) => {
} }
// //
const tableFormChange = async (field, val, row) => { const tableFormChange = async (field, val, row) => {
console.log(field)
console.log(val)
if (field == 'type') { if (field == 'type') {
row.value = '' row.value = ''
if ( if (
@ -502,97 +510,105 @@ const tableFormChange = async (field, val, row) => {
} }
} }
const allList=ref({ const allList = ref({
ownerAllList:[], ownerAllList: [],
supplierAllList:[], supplierAllList: [],
customerAllList:[], customerAllList: [],
itembasicAllList:[], itembasicAllList: [],
warehouseAllList:[], warehouseAllList: [],
areaAllList:[], areaAllList: [],
locationgroupAllList:[], locationgroupAllList: [],
locationAllList:[], locationAllList: [],
abcList:getStrDictOptions(DICT_TYPE.ABC_CLASS), abcList: getStrDictOptions(DICT_TYPE.ABC_CLASS),
itemTypeList:getStrDictOptions(DICT_TYPE.ITEM_TYPE), itemTypeList: getStrDictOptions(DICT_TYPE.ITEM_TYPE),
itemGroupList:getStrDictOptions(DICT_TYPE.ITEM_GROUP), itemGroupList: getStrDictOptions(DICT_TYPE.ITEM_GROUP)
}) })
// //
const getOwnerAllList = async () => { const getOwnerAllList = async () => {
await OwnerApi.getOwnerList().then((res) => { await OwnerApi.getOwnerList().then((res) => {
res.forEach((element) => { allList.value.ownerAllList = res.map((element) => {
element.value = element.code return {
element.label = element.name value: element.code,
label: element.name
}
}) })
allList.value.ownerAllList = res
}) })
} }
// //
const getSupplierAllList = async () => { const getSupplierAllList = async () => {
await SupplierApi.getSupplierList().then((res) => { await SupplierApi.getSupplierList().then((res) => {
res.forEach((element) => { allList.value.supplierAllList = res.map((element) => {
element.value = element.code return {
element.label = element.name value: element.code,
label: element.name
}
}) })
allList.value.supplierAllList = res
}) })
} }
// //
const getCustomerAllList = async () => { const getCustomerAllList = async () => {
await CustomerApi.getCustomerList().then((res) => { await CustomerApi.getCustomerList().then((res) => {
res.forEach((element) => { allList.value.customerAllList = res.map((element) => {
element.value = element.code return {
element.label = element.name value: element.code,
label: element.name
}
}) })
allList.value.customerAllList = res
}) })
} }
// //
const getItembasicAllList = async () => { const getItembasicAllList = async () => {
await ItembasicApi.getItembasicList().then((res) => { await ItembasicApi.getItembasicList().then((res) => {
res.forEach((element) => { allList.value.itembasicAllList = res.map((element) => {
element.value = element.code return {
element.label = element.name value: element.code,
label: element.name
}
}) })
allList.value.itembasicAllList = res
}) })
} }
// //
const getWarehouseAllList = async () => { const getWarehouseAllList = async () => {
await WarehouseApi.getWarehouseList({ available: 'TRUE' }).then((res) => { await WarehouseApi.getWarehouseList({ available: 'TRUE' }).then((res) => {
res.forEach((element) => { allList.value.warehouseAllList = res.map((element) => {
element.value = element.code return {
element.label = element.name value: element.code,
label: element.name
}
}) })
allList.value.warehouseAllList = res
}) })
} }
// //
const getAreaAllList = async () => { const getAreaAllList = async () => {
await AreaApi.getAreaList({ available: 'TRUE' }).then((res) => { await AreaApi.getAreaList({ available: 'TRUE' }).then((res) => {
res.forEach((element) => { allList.value.areaAllList = res.map((element) => {
element.value = element.code return {
element.label = element.name value: element.code,
label: element.name
}
}) })
allList.value.areaAllList = res
}) })
} }
// //
const getLocationgroupAllList = async () => { const getLocationgroupAllList = async () => {
await LocationgroupApi.getLocationgroupList({ available: 'TRUE' }).then((res) => { await LocationgroupApi.getLocationgroupList({ available: 'TRUE' }).then((res) => {
res.forEach((element) => { allList.value.locationgroupAllList = res.map((element) => {
element.value = element.code return {
element.label = element.name value: element.code,
label: element.name
}
}) })
allList.value.locationgroupAllList = res
}) })
} }
// //
const getLocationAllList = async () => { const getLocationAllList = async () => {
await LocationpApi.getLocationList({ available: 'TRUE' }).then((res) => { await LocationpApi.getLocationList({ available: 'TRUE' }).then((res) => {
res.forEach((element) => { allList.value.locationAllList = res.map((element) => {
element.value = element.code return {
element.label = element.name value: element.code,
label: element.name
}
}) })
allList.value.locationAllList = res
}) })
} }
/** 初始化 **/ /** 初始化 **/

Loading…
Cancel
Save