Browse Source

采购收货申请

master
zhang_li 1 year ago
parent
commit
ba0eca9b82
  1. 11
      src/api/wms/purchasereceiptRequestDetail/index.ts
  2. 277
      src/components/Detail/src/Detail.vue
  3. 16
      src/components/Table/src/Table.vue
  4. 9
      src/utils/disposition/tabsList.ts
  5. 17
      src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/index.vue

11
src/api/wms/purchasereceiptRequestDetail/index.ts

@ -65,6 +65,17 @@ export const deletePurchasereceiptRequestDetail = async (id: number) => {
return await request.delete({ url: `/wms/purchasereceipt-request-detail/delete?id=` + id }) return await request.delete({ url: `/wms/purchasereceipt-request-detail/delete?id=` + id })
} }
// 缺货明细
export const getScarceGoodsDetailPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/wms/purchaseshortage-detail/senior', data })
} else {
return await request.get({ url: `/wms/purchaseshortage-detail/page`, params })
}
}
// 导出采购收货申请子 Excel // 导出采购收货申请子 Excel
export const exportPurchasereceiptRequestDetail = async (params) => { export const exportPurchasereceiptRequestDetail = async (params) => {
return await request.download({ url: `/wms/purchasereceipt-request-detail/export-excel`, params }) return await request.download({ url: `/wms/purchasereceipt-request-detail/export-excel`, params })

277
src/components/Detail/src/Detail.vue

@ -1,69 +1,100 @@
<template> <template>
<div> <div>
<el-drawer v-model="isShowDrawer" title="详情" direction="rtl" size="80%" v-loading="detailLoading"> <el-drawer
<template #header> v-model="isShowDrawer"
<div class="font-size-18px"> title="详情"
{{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span> direction="rtl"
</div> size="80%"
</template> v-loading="detailLoading"
<ContentWrap v-if="!isBasic"> >
<Descriptions :data="detailData" labelClassName="label-class-name" label-align="left" direction="vertical" <template #header>
:column="8" :schema="allSchemas.detailSchema" :columns="2" width="200px" /> <div class="font-size-18px">
</ContentWrap> {{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span>
</div>
<Tabs :tabsList="tabsList" :current="current" @change="change" /> </template>
<div class="flex" v-if="current == 0"> <ContentWrap v-if="!isBasic">
<!-- 详情 --> <Descriptions
<ContentWrap class="w-[73%]"> :data="detailData"
<!-- 列表头部 --> labelClassName="label-class-name"
<TableHead label-align="left"
v-if="!isBasic" direction="vertical"
:HeadButttondata="HeadButttondata" :column="8"
:masterId="masterParmas.masterId" :schema="allSchemas.detailSchema"
@button-base-click="buttonBaseClick" :columns="2"
:routeName="routeName" width="200px"
@searchFormClick="searchFormClick"
:allSchemas="detailAllSchemas"
/> />
<Descriptions v-if="isBasic" :data="detailData" :schema="allSchemas.detailSchema" :columns="2" />
<Table
v-if="!isBasic"
:columns="detailAllSchemas.tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{ total: tableObject.total }"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.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> </ContentWrap>
</div>
</el-drawer> <Tabs :tabsList="tabsList" :current="current" @change="change" />
<!-- 表单弹窗添加/修改 --> <div class="flex" v-if="current == 0">
<BasicForm <!-- 详情 -->
ref="formRef" <ContentWrap class="w-[73%]">
@success="submitForm" <!-- 列表头部 -->
:rules="detailAllSchemasRules" <TableHead
:formAllSchemas="detailAllSchemas" v-if="!isBasic"
:isBusiness="false" :HeadButttondata="HeadButttondata"
:apiUpdate="apiUpdate" :masterId="masterParmas.masterId"
:apiCreate="apiCreate" @button-base-click="buttonBaseClick"
@searchTableSuccess="searchTableSuccess" :routeName="routeName"
:detailData="detailData" @searchFormClick="searchFormClick"
@submitForm="submitForm" :allSchemas="detailAllSchemas"
/> />
</div> <Descriptions
v-if="isBasic"
:data="detailData"
:schema="allSchemas.detailSchema"
:columns="2"
/>
<Table
v-if="!isBasic"
:columns="detailAllSchemas.tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{ total: tableObject.total }"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.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> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -85,7 +116,7 @@ const { t } = useI18n() // 国际化
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
routeName.value = routeName.value.substring(0,routeName.value.length - 4) + 'Detail' routeName.value = routeName.value.substring(0, routeName.value.length - 4) + 'Detail'
const props = defineProps({ const props = defineProps({
// //
@ -147,22 +178,31 @@ const props = defineProps({
type: Array, type: Array,
required: false, required: false,
default: null default: null
}, }
}) })
const isShowDrawer = ref(false) const isShowDrawer = ref(false)
const detailLoading = ref(false) const detailLoading = ref(false)
const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : ''))) const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : '')))
if (tabsList.value && tabsList.value.length > 0) { if (props.isBasic == true) {
tabsList.value.unshift({ if (tabsList.value && tabsList.value.length > 0) {
label: '详情', tabsList.value.unshift({
prop: 'Detail' label: '详情',
}) prop: 'Detail'
})
}
} else { } else {
tabsList.value = [{ if (tabsList.value && tabsList.value.length > 0) {
label: '明细', } else {
prop: 'Detail' tabsList.value = [
}] {
label: '明细',
prop: 'Detail'
}
]
}
}
if (tabsList.value) {
} }
// //
@ -173,14 +213,14 @@ const annexData = reactive({
// //
const remarksData = reactive({ const remarksData = reactive({
remarksList: [], remarksList: [],
data:{} data: {}
}) })
// //
const changeRecordData = reactive({ const changeRecordData = reactive({
changeRecordList: [] changeRecordList: []
}) })
const detailData = ref({})// const detailData = ref({}) //
// //
const getFileList = async () => { const getFileList = async () => {
detailLoading.value = true detailLoading.value = true
@ -194,11 +234,9 @@ const getFileList = async () => {
const handleAnnexSuccess = () => { const handleAnnexSuccess = () => {
getFileList() getFileList()
getChangeRecordList() getChangeRecordList()
} }
// //
const deleteAnnexSuccess = async () => { const deleteAnnexSuccess = async () => {
getFileList() getFileList()
getChangeRecordList() getChangeRecordList()
} }
@ -207,13 +245,14 @@ const deleteAnnexSuccess = async () => {
const current = ref(0) const current = ref(0)
const change = (item, index) => { const change = (item, index) => {
current.value = index current.value = index
emit('changeTabs', item)
} }
// //
const masterParmas=ref({ const masterParmas = ref({
masterId:'',//id masterId: '', //id
number: '',// number: '', //
status: '',// status: '' //
}) })
// //
@ -229,19 +268,19 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
titleValueRef.value = titleValue titleValueRef.value = titleValue
remarksData.data = { remarksData.data = {
tableId: row.id, tableId: row.id,
tableName: tableName, tableName: tableName
} }
// //
if(!props.isBasic) { if (!props.isBasic) {
// id // id
masterParmas.value.masterId = row.id masterParmas.value.masterId = row.id
masterParmas.value.number = row.number masterParmas.value.number = row.number
masterParmas.value.status = row.status masterParmas.value.status = row.status
tableObject.params = { tableObject.params = {
masterId: row.id, masterId: row.id
} }
getList() getList()
} }
isShowDrawer.value = true isShowDrawer.value = true
if (row) { if (row) {
detailLoading.value = true detailLoading.value = true
@ -252,13 +291,19 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
getChangeRecordList() getChangeRecordList()
// //
HeadButttondata.value = [ HeadButttondata.value = [
defaultButtons.defaultAddBtn({hide:isShowMainButton(row,['1','1','PLAN_PURCHASE_READY','1'])}), // defaultButtons.defaultAddBtn({
defaultButtons.defaultFilterBtn(null), // hide: isShowMainButton(row, ['1', '1', 'PLAN_PURCHASE_READY', '1'])
}), //
defaultButtons.defaultFilterBtn(null) //
] ]
// //
buttondata.value = [ buttondata.value = [
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1','1','PLAN_PURCHASE_READY','1'])}), // defaultButtons.mainListEditBtn({
defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['1','1','PLAN_PURCHASE_READY','1'])}), // hide: isShowMainButton(row, ['1', '1', 'PLAN_PURCHASE_READY', '1'])
}), //
defaultButtons.mainListDeleteBtn({
hide: isShowMainButton(row, ['1', '1', 'PLAN_PURCHASE_READY', '1'])
}) //
] ]
} finally { } finally {
detailLoading.value = false detailLoading.value = false
@ -286,13 +331,12 @@ const remarksSubmitScuess = async (remark) => {
const getChangeRecordList = async () => { const getChangeRecordList = async () => {
changeRecordData.changeRecordList = await RemarkApi.getChangeRecordPage(remarksData.data) changeRecordData.changeRecordList = await RemarkApi.getChangeRecordPage(remarksData.data)
} }
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage // getListApi: props.apiPage //
}) })
// //
const isShowMainButton = (row,val) => { const isShowMainButton = (row, val) => {
if (val.indexOf(row.status) > -1) { if (val.indexOf(row.status) > -1) {
return false return false
} else { } else {
@ -300,22 +344,27 @@ const isShowMainButton = (row,val) => {
} }
} }
// //
const { getList } = tableMethods const { getList } = tableMethods
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') {
//
openForm('create') openForm('create')
} else if (val == 'import') { // } else if (val == 'import') {
//
handleImport() handleImport()
} else if (val == 'export') { // } else if (val == 'export') {
//
handleExport() handleExport()
} else if (val == 'refresh') { // } else if (val == 'refresh') {
//
getList() getList()
} else if (val == 'filtrate') { // } else if (val == 'filtrate') {
} else { // //
} else {
//
console.log('其他按钮', item) console.log('其他按钮', item)
} }
} }
@ -325,11 +374,13 @@ const buttonBaseClick = (val, item) => {
// detailAllSchemas.tableColumns.value = val // detailAllSchemas.tableColumns.value = val
// } // }
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') {
//
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') {
//
handleDelete(row.id) handleDelete(row.id)
} }
} }
@ -361,9 +412,7 @@ const searchTableSuccess = (formField, searchField, val, formRef) => {
emit('searchTableSuccessDetail', formField, searchField, val, formRef) emit('searchTableSuccessDetail', formField, searchField, val, formRef)
} }
// //
const emit = defineEmits([ const emit = defineEmits(['searchTableSuccessDetail', 'changeTabs'])
'searchTableSuccessDetail',
])
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {
try { try {
@ -374,16 +423,30 @@ const handleDelete = async (id: number) => {
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
} catch { } } catch {}
} }
// //
const searchFormClick = (searchData) => { const searchFormClick = (searchData) => {
tableObject.params = { tableObject.params = {
isSearch: true, isSearch: true,
filters: searchData.filters?searchData.filters:[{column: "masterId", action: "==", value: masterParmas.value.masterId}] filters: searchData.filters
? searchData.filters
: [{ column: 'masterId', action: '==', value: masterParmas.value.masterId }]
} }
getList() // getList() //
} }
console.log(props.apiPage)
//
// watch(props.apiPage, (newValue, oldValue) => {
// //
// console.log('', '' + newValue, '' + oldValue)
// })
watch(
() => props.apiPage,
(newValue,oldValue) => {
console.log('求和的值变了', '变化后的值是' + newValue, '变化前的值是' + oldValue)
}
)
</script> </script>
<style lang="scss"> <style lang="scss">
.el-drawer__body { .el-drawer__body {

16
src/components/Table/src/Table.vue

@ -44,6 +44,7 @@ export default defineComponent({
align: propTypes.string align: propTypes.string
.validate((v: string) => ['left', 'center', 'right'].includes(v)) .validate((v: string) => ['left', 'center', 'right'].includes(v))
.def('center'), .def('center'),
border : propTypes.bool.def(true),
// //
headerAlign: propTypes.string headerAlign: propTypes.string
.validate((v: string) => ['left', 'center', 'right'].includes(v)) .validate((v: string) => ['left', 'center', 'right'].includes(v))
@ -174,7 +175,7 @@ export default defineComponent({
}) })
const renderTableSelection = () => { const renderTableSelection = () => {
const { selection, reserveSelection, align, headerAlign } = unref(getProps) const { selection, reserveSelection, align, headerAlign,border } = unref(getProps)
// //
return selection ? ( return selection ? (
<ElTableColumn <ElTableColumn
@ -182,16 +183,17 @@ export default defineComponent({
reserveSelection={reserveSelection} reserveSelection={reserveSelection}
align={align} align={align}
headerAlign={headerAlign} headerAlign={headerAlign}
border={border}
width="50" width="50"
></ElTableColumn> ></ElTableColumn>
) : undefined ) : undefined
} }
const renderTableExpand = () => { const renderTableExpand = () => {
const { align, headerAlign, expand } = unref(getProps) const { align, headerAlign, expand,border } = unref(getProps)
// //
return expand ? ( return expand ? (
<ElTableColumn type="expand" align={align} headerAlign={headerAlign}> <ElTableColumn type="expand" align={align} headerAlign={headerAlign} border={border}>
{{ {{
// @ts-ignore // @ts-ignore
default: (data: TableSlotDefault) => getSlot(slots, 'expand', data) default: (data: TableSlotDefault) => getSlot(slots, 'expand', data)
@ -201,7 +203,7 @@ export default defineComponent({
} }
const rnderTreeTableColumn = (columnsChildren: TableColumn[]) => { const rnderTreeTableColumn = (columnsChildren: TableColumn[]) => {
const { align, headerAlign, showOverflowTooltip } = unref(getProps) const { align, headerAlign, showOverflowTooltip,border } = unref(getProps)
return columnsChildren.map((v) => { return columnsChildren.map((v) => {
const props = { ...v } const props = { ...v }
if (props.children) delete props.children if (props.children) delete props.children
@ -209,6 +211,7 @@ export default defineComponent({
<ElTableColumn <ElTableColumn
showOverflowTooltip={showOverflowTooltip} showOverflowTooltip={showOverflowTooltip}
align={align} align={align}
border={border}
headerAlign={headerAlign} headerAlign={headerAlign}
{...props} {...props}
prop={v.field} prop={v.field}
@ -237,7 +240,8 @@ export default defineComponent({
currentPage, currentPage,
align, align,
headerAlign, headerAlign,
showOverflowTooltip showOverflowTooltip,
border
} = unref(getProps) } = unref(getProps)
return [...[renderTableExpand()], ...[renderTableSelection()]].concat( return [...[renderTableExpand()], ...[renderTableSelection()]].concat(
(columnsChildren || columns).map((v) => { (columnsChildren || columns).map((v) => {
@ -252,6 +256,7 @@ export default defineComponent({
: (index) => setIndex(reserveIndex, index, pageSize, currentPage) : (index) => setIndex(reserveIndex, index, pageSize, currentPage)
} }
align={v.align || align} align={v.align || align}
border={v.border || border}
headerAlign={v.headerAlign || headerAlign} headerAlign={v.headerAlign || headerAlign}
label={v.label} label={v.label}
width="65px" width="65px"
@ -264,6 +269,7 @@ export default defineComponent({
<ElTableColumn <ElTableColumn
showOverflowTooltip={showOverflowTooltip} showOverflowTooltip={showOverflowTooltip}
align={align} align={align}
border={border}
headerAlign={headerAlign} headerAlign={headerAlign}
{...props} {...props}
prop={v.field} prop={v.field}

9
src/utils/disposition/tabsList.ts

@ -28,4 +28,13 @@ export const ItemBasicTabsList = [{
}, },
] ]
export const PurchasereceiptRequestTabsList = [{
label: "收货明细",
prop: 'receiptDetail',
},
{
label: "缺货明细",
prop: 'scarceGoodsDetail',
}
]

17
src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/index.vue

@ -65,10 +65,12 @@
:detailAllSchemasRules="PurchasereceiptRequestDetailRules" :detailAllSchemasRules="PurchasereceiptRequestDetailRules"
:apiCreate="PurchasereceiptRequestDetailApi.createPurchasereceiptRequestDetail" :apiCreate="PurchasereceiptRequestDetailApi.createPurchasereceiptRequestDetail"
:apiUpdate="PurchasereceiptRequestDetailApi.updatePurchasereceiptRequestDetail" :apiUpdate="PurchasereceiptRequestDetailApi.updatePurchasereceiptRequestDetail"
:apiPage="PurchasereceiptRequestDetailApi.getPurchasereceiptRequestDetailPage" :apiPage="apiPage"
:apiDelete="PurchasereceiptRequestDetailApi.deletePurchasereceiptRequestDetail" :apiDelete="PurchasereceiptRequestDetailApi.deletePurchasereceiptRequestDetail"
:Echo="Echo" :Echo="Echo"
:tabs="PurchasereceiptRequestTabsList"
@searchTableSuccessDetail="searchTableSuccessDetail" @searchTableSuccessDetail="searchTableSuccessDetail"
@changeTabs="changeTabs"
/> />
<!-- 导入 --> <!-- 导入 -->
@ -81,6 +83,7 @@ import { PurchasereceiptRequestMain,PurchasereceiptRequestMainRules,Purchaserece
import * as PurchasereceiptRequestMainApi from '@/api/wms/purchasereceiptRequestMain' import * as PurchasereceiptRequestMainApi from '@/api/wms/purchasereceiptRequestMain'
import * as PurchasereceiptRequestDetailApi from '@/api/wms/purchasereceiptRequestDetail' import * as PurchasereceiptRequestDetailApi from '@/api/wms/purchasereceiptRequestDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { PurchasereceiptRequestTabsList } from '@/utils/disposition/tabsList'
// //
defineOptions({ name: 'PurchasereceiptRequestMain' }) defineOptions({ name: 'PurchasereceiptRequestMain' })
@ -93,6 +96,8 @@ const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(PurchasereceiptRequestMain.allSchemas.tableColumns) const tableColumns = ref(PurchasereceiptRequestMain.allSchemas.tableColumns)
const apiPage = ref(PurchasereceiptRequestDetailApi.getPurchasereceiptRequestDetailPage)
// //
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
tableColumns.value = val tableColumns.value = val
@ -358,7 +363,15 @@ const searchFormClick = (searchData) => {
} }
getList() // getList() //
} }
const changeTabs = (data) =>{
// console.log(data.prop)
if(data.prop == 'receiptDetail'){
apiPage.value = PurchasereceiptRequestDetailApi.getPurchasereceiptRequestDetailPage
}else if(data.prop == 'scarceGoodsDetail'){
apiPage.value = PurchasereceiptRequestDetailApi.getScarceGoodsDetailPage
}
console.log( apiPage.value)
}
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()

Loading…
Cancel
Save