Browse Source

盘点

master
zhang_li 12 months ago
parent
commit
89221636ad
  1. 27
      src/components/Detail/src/Detail.vue
  2. 499
      src/components/DetailCountPlan/src/DetailCountPlan.vue
  3. 0
      src/components/DetailTable/index.ts
  4. 46
      src/components/DetailTable/src/DetailTable.vue
  5. 8
      src/components/TableFormCountPlan/src/TableFormCountPlan.vue
  6. 55
      src/views/wms/countManage/count/countPlanMain/index.vue

27
src/components/Detail/src/Detail.vue

@ -61,7 +61,20 @@
/>
</template>
</Table>
<DetailTable
v-if="!isBasic && fromeWhere == 'countPlan'"
:columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList"
:allList="allList"
:countScopeType="countScopeType"
>
<template #action="{ row }">
<ButtonBase
:Butttondata="buttondata"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
</DetailTable>
</ContentWrap>
<ContentWrap class="w-[27%] ml-16px">
<!-- 附件组件 -->
@ -108,6 +121,7 @@ import * as FileApi from '@/api/wms/file'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import DetailTable from '@/components/DetailTable/src/DetailTable.vue'
defineOptions({ name: 'Detail' })
@ -188,6 +202,17 @@ const props = defineProps({
required: false,
default: ''
},
//
allList: {
type: Object,
required: true,
default: null
},
countScopeType: {
type: Array,
required: false,
default: null
}
})
const isShowDrawer = ref(false)
const detailLoading = ref(false)

499
src/components/DetailCountPlan/src/DetailCountPlan.vue

@ -1,499 +0,0 @@
<template>
<div>
<el-drawer
v-model="isShowDrawer"
title="详情"
direction="rtl"
size="80%"
v-loading="detailLoading"
>
<template #header>
<div class="font-size-18px">
{{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span>
</div>
</template>
<ContentWrap v-if="!isBasic">
<Descriptions
:data="detailData"
labelClassName="label-class-name"
label-align="left"
direction="vertical"
:column="8"
:schema="allSchemas.detailSchema"
:columns="2"
width="200px"
/>
</ContentWrap>
<Tabs :tabsList="tabsList" :current="current" @change="change" />
<div class="flex">
<!-- 详情 -->
<ContentWrap class="w-[73%]">
<!-- 列表头部 -->
<TableHead
v-if="!isBasic"
:HeadButttondata="HeadButttondata"
:masterId="masterParmas.masterId"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@searchFormClick="searchFormClick"
:allSchemas="detailAllSchemas"
/>
<Descriptions
v-if="isBasic"
:data="detailData"
:schema="allSchemas.detailSchema"
:columns="2"
/>
<Table
v-if="!isBasic"
:columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList"
:loading="tableObjectRef.loading"
:pagination="{ total: tableObjectRef.total }"
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
>
<template #action="{ row }">
<ButtonBase
:Butttondata="buttondata"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
</Table>
</ContentWrap>
<ContentWrap class="w-[27%] ml-16px">
<!-- 附件组件 -->
<Annex
:annexData="annexData"
@handleAnnexSuccess="handleAnnexSuccess"
@deleteAnnexSuccess="deleteAnnexSuccess"
:upData="remarksData.data"
/>
<!-- 备注组件 -->
<Remarks
:remarksData="remarksData"
class="mt-20px"
@remarksSubmitScuess="remarksSubmitScuess"
/>
<!-- 变更记录组件 -->
<ChangeRecord :changeRecordData="changeRecordData" class="mt-20px" />
</ContentWrap>
</div>
</el-drawer>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="formRef"
@success="submitForm"
:rules="detailAllSchemasRules"
:formAllSchemas="detailAllSchemas"
:isBusiness="false"
:apiUpdate="apiUpdate"
:apiCreate="apiCreate"
@searchTableSuccess="searchTableSuccess"
:detailData="detailData"
@submitForm="submitForm"
/>
</div>
</template>
<script lang="ts" setup>
import Annex from '@/components/Annex/src/Annex.vue'
import Remarks from '@/components/Remarks/src/Remarks.vue'
import ChangeRecord from '@/components/ChangeRecord/src/ChangeRecord.vue'
import Tabs from '@/components/Tabs/src/Tabs.vue'
import * as RemarkApi from '@/api/wms/remark'
import * as FileApi from '@/api/wms/file'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import TableHead from '@/components/TableHead/src/TableHead.vue'
defineOptions({ name: 'DetailCountPlan' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
routeName.value = routeName.value.substring(0, routeName.value.length - 4) + 'Detail'
const props = defineProps({
//
tabs: {
type: Object,
required: true,
default: null
},
//
isBasic: {
type: Boolean,
required: false,
default: false
},
//
allSchemas: {
type: Object,
required: true,
default: null
},
//
detailAllSchemas: {
type: Object,
required: true,
default: null
},
//
detailAllSchemasRules: {
type: Object,
required: true,
default: null
},
// API
apiCreate: {
type: Function,
required: false,
default: null
},
// API
apiUpdate: {
type: Function,
required: false,
default: null
},
// API
apiPage: {
type: Function,
required: false,
default: null
},
// API
apiDelete: {
type: Function,
required: false,
default: null
},
//
detailValidate: {
type: Function,
required: false,
default: null
}
})
const isShowDrawer = ref(false)
const detailLoading = ref(false)
const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : '')))
if (props.isBasic == true) {
if (tabsList.value && tabsList.value.length > 0) {
tabsList.value.unshift({
label: '详情',
prop: 'Detail'
})
}
} else {
if (tabsList.value && tabsList.value.length > 0) {
} else {
tabsList.value = [
{
label: '明细',
prop: 'Detail'
}
]
}
}
if (tabsList.value) {
}
//
const annexData = reactive({
annexList: []
})
//
const remarksData = reactive({
remarksList: [],
data: {}
})
//
const changeRecordData = reactive({
changeRecordList: []
})
const detailData = ref({}) //
//
const getFileList = async () => {
detailLoading.value = true
try {
annexData.annexList = await FileApi.getFileList(remarksData.data)
} finally {
detailLoading.value = false
}
}
/** 添加附件 */
const handleAnnexSuccess = () => {
getFileList()
getChangeRecordList()
}
//
const deleteAnnexSuccess = async () => {
getFileList()
getChangeRecordList()
}
// Tabs
const current = ref(0)
const change = (item, index) => {
current.value = index
emit('changeTabs', item)
}
//
const masterParmas = ref({
masterId: '', //id
number: '', //
status: '' //
})
//
const HeadButttondata = ref()
// -
const buttondata = ref()
/** 打开弹窗 */
const titleNameRef = ref()
const titleValueRef = ref()
const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => {
titleNameRef.value = titleName
titleValueRef.value = titleValue
remarksData.data = {
tableId: row.id,
tableName: tableName
}
//
if (!props.isBasic) {
// id
masterParmas.value.masterId = row.id
masterParmas.value.number = row.number
masterParmas.value.status = row.status
tableObjectRef.value.params = {
masterId: row.id
}
getList()
}
isShowDrawer.value = true
if (row) {
detailLoading.value = true
try {
detailData.value = row
getRemarkList()
getFileList()
getChangeRecordList()
//
if(routeName.value.indexOf('Job') > -1){
HeadButttondata.value = [
defaultButtons.defaultFilterBtn(null) //
]
}else{
HeadButttondata.value = [
defaultButtons.defaultAddBtn({
hide: isShowMainButton(row, ['1'])
}), //
defaultButtons.defaultFilterBtn(null) //
]
}
//
buttondata.value = [
defaultButtons.mainListEditBtn({
hide: isShowMainButton(row, ['1'])
}), //
defaultButtons.mainListDeleteBtn({
hide: isShowMainButton(row, ['1'])
}) //
]
} finally {
detailLoading.value = false
}
}
}
defineExpose({ openDetail }) // open
//
const getRemarkList = async () => {
detailLoading.value = true
try {
remarksData.remarksList = await RemarkApi.getRemarkPage(remarksData.data)
} finally {
detailLoading.value = false
}
}
//
const remarksSubmitScuess = async (remark) => {
detailLoading.value = false
getRemarkList()
getChangeRecordList()
}
//
const getChangeRecordList = async () => {
changeRecordData.changeRecordList = await RemarkApi.getChangeRecordPage(remarksData.data)
}
const tableObjectRef = ref()
const tableMethodsRef = ref()
const detailAllSchemasRef = ref()
const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage //
})
tableObjectRef.value = tableObject
tableMethodsRef.value = tableMethods
detailAllSchemasRef.value = props.detailAllSchemas
//
const isShowMainButton = (row, val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
//
const { getList } = tableMethodsRef.value
//
const buttonBaseClick = (val, item) => {
if (val == 'add') {
//
openForm('create')
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') {
//
getList()
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
//
// const updataTableColumns = (val) => {
// detailAllSchemas.tableColumns.value = val
// }
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'delete') {
//
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = async (type: string, row?: number) => {
formRef.value.open(type, row, masterParmas.value)
}
// form
const submitForm = async (formType, data) => {
try {
// detailValidate
const rs = await props.detailValidate?props.detailValidate(data):true
if (!rs) return
if (formType === 'create') {
await props.apiCreate(data)
message.success(t('common.createSuccess'))
} else {
await props.apiUpdate(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
}
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
emit('searchTableSuccessDetail', formField, searchField, val, formRef)
}
//
const emit = defineEmits(['searchTableSuccessDetail', 'changeTabs'])
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await props.apiDelete(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
//
const searchFormClick = (searchData) => {
const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage //
})
tableObject.params = {
isSearch: true,
filters: searchData.filters
? searchData.filters
: [{ column: 'masterId', action: '==', value: masterParmas.value.masterId }]
}
detailAllSchemasRef.value = props.detailAllSchemas
tableObjectRef.value = tableObject
tableMethodsRef.value = tableMethods
tableObjectRef.value.tableList = []
const { getList } = tableMethods
getList()
// tableObjectRef.value.params = {
// isSearch: true,
// filters: searchData.filters
// ? searchData.filters
// : [{ column: 'masterId', action: '==', value: masterParmas.value.masterId }]
// }
// getList() //
}
//
watch(
() =>props.apiPage,
() => {
const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage //
})
tableObject.params.masterId = masterParmas.value.masterId
detailAllSchemasRef.value = props.detailAllSchemas
tableObjectRef.value = tableObject
tableMethodsRef.value = tableMethods
const { getList } = tableMethods
getList()
},
)
</script>
<style lang="scss">
.el-drawer__body {
background: #f5f5f5 !important;
}
::v-deep(.label-class-name) {
color: #dedede;
}
</style>
<style scoped lang="scss"></style>

0
src/components/DetailCountPlan/index.ts → src/components/DetailTable/index.ts

46
src/components/DetailTable/src/DetailTable.vue

@ -0,0 +1,46 @@
<template>
<div>
<el-table :data="data" style="width: 100%">
<el-table-column
:prop="item.field"
:label="item.label"
v-for="(item, index) in columns"
:key="index"
align="center"
>
<slot name="action" v-if="item.field == 'action'"></slot>
</el-table-column>
</el-table>
</div>
</template>
<script lang="ts" setup>
defineOptions({ name: 'DetailTable' })
const props = defineProps({
columns: {
type: Array,
required: true,
default: null
},
data: {
type: Array,
required: true,
default: null
},
//
allList: {
type: Object,
required: true,
default: null
},
countScopeType: {
type: Array,
required: false,
default: null
}
})
//
</script>
<style lang="scss">
</style>

8
src/components/TableFormCountPlan/src/TableFormCountPlan.vue

@ -1,7 +1,7 @@
<!-- 附件组件 -->
<template>
<!-- 盘点计划的子表 -->
<div class="table">
<div class="table1">
<el-table :data="tableData" stripe style="width: 100%"
ref="TableBaseComponents_Ref" >
<el-table-column fixed="left" :width="50" v-slot="{ row, $index }">
@ -176,6 +176,12 @@ defineExpose({
</script>
<style scoped lang="scss">
.table1 {
border: 1px solid #dedede;
border-radius: 8px;
padding: 10px;
width: calc(100% - 20px);
}
.button {
> div {
display: flex;

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

@ -80,6 +80,8 @@
:apiUpdate="CountPlanDetailApi.updateCountPlanDetail"
:apiPage="CountPlanDetailApi.getCountPlanDetailPage"
:apiDelete="CountPlanDetailApi.deleteCountPlanDetail"
:allList="allList"
:countScopeType="getStrDictOptions(DICT_TYPE.COUNT_SCOPE_TYPE)"
:Echo="Echo"
fromeWhere="countPlan"
/>
@ -461,13 +463,13 @@ const tableFormChange = async (field, val, row) => {
row.formType = 'Select'
switch (row.type) {
case 'OWNER':
row.initOptions = ownerAllList.value
row.initOptions = allList.value.ownerAllList
break
case 'SUPPLIER':
row.initOptions = supplierAllList.value
row.initOptions = allList.value.supplierAllList
break
case 'CUSTOMER':
row.initOptions = customerAllList.value
row.initOptions = allList.value.customerAllList
break
case 'ABC':
row.initOptions = getStrDictOptions(DICT_TYPE.ABC_CLASS)
@ -479,19 +481,19 @@ const tableFormChange = async (field, val, row) => {
row.initOptions = getStrDictOptions(DICT_TYPE.ITEM_GROUP)
break
case 'ITEMS_CODE':
row.initOptions = itembasicAllList.value
row.initOptions = allList.value.itembasicAllList
break
case 'WAREHOUSE_CODE':
row.initOptions = warehouseAllList.value
row.initOptions = allList.value.warehouseAllList
break
case 'AREABASIC_CODE':
row.initOptions = areaAllList.value
row.initOptions = allList.value.areaAllList
break
case 'LOCATIONGROUP_CODE':
row.initOptions = locationgroupAllList.value
row.initOptions = allList.value.locationgroupAllList
break
case 'LOCATION_CODE':
row.initOptions = locationAllList.value
row.initOptions = allList.value.locationAllList
break
}
} else if (row.type == 'PROJECT') {
@ -500,14 +502,19 @@ const tableFormChange = async (field, val, row) => {
}
}
const ownerAllList = ref()
const supplierAllList = ref()
const customerAllList = ref()
const itembasicAllList = ref()
const warehouseAllList = ref()
const areaAllList = ref()
const locationgroupAllList = ref()
const locationAllList = ref()
const allList=ref({
ownerAllList:[],
supplierAllList:[],
customerAllList:[],
itembasicAllList:[],
warehouseAllList:[],
areaAllList:[],
locationgroupAllList:[],
locationAllList:[],
abcList:getStrDictOptions(DICT_TYPE.ABC_CLASS),
itemTypeList:getStrDictOptions(DICT_TYPE.ITEM_TYPE),
itemGroupList:getStrDictOptions(DICT_TYPE.ITEM_GROUP),
})
//
const getOwnerAllList = async () => {
await OwnerApi.getOwnerList().then((res) => {
@ -515,7 +522,7 @@ const getOwnerAllList = async () => {
element.value = element.code
element.label = element.name
})
ownerAllList.value = res
allList.value.ownerAllList = res
})
}
//
@ -525,7 +532,7 @@ const getSupplierAllList = async () => {
element.value = element.code
element.label = element.name
})
supplierAllList.value = res
allList.value.supplierAllList = res
})
}
//
@ -535,7 +542,7 @@ const getCustomerAllList = async () => {
element.value = element.code
element.label = element.name
})
customerAllList.value = res
allList.value.customerAllList = res
})
}
//
@ -545,7 +552,7 @@ const getItembasicAllList = async () => {
element.value = element.code
element.label = element.name
})
itembasicAllList.value = res
allList.value.itembasicAllList = res
})
}
//
@ -555,7 +562,7 @@ const getWarehouseAllList = async () => {
element.value = element.code
element.label = element.name
})
warehouseAllList.value = res
allList.value.warehouseAllList = res
})
}
//
@ -565,7 +572,7 @@ const getAreaAllList = async () => {
element.value = element.code
element.label = element.name
})
areaAllList.value = res
allList.value.areaAllList = res
})
}
//
@ -575,7 +582,7 @@ const getLocationgroupAllList = async () => {
element.value = element.code
element.label = element.name
})
locationgroupAllList.value = res
allList.value.locationgroupAllList = res
})
}
//
@ -585,7 +592,7 @@ const getLocationAllList = async () => {
element.value = element.code
element.label = element.name
})
locationAllList.value = res
allList.value.locationAllList = res
})
}
/** 初始化 **/

Loading…
Cancel
Save