陈薪名 1 year ago
parent
commit
5c27fdb8d6
  1. 18
      src/api/wms/purchaseMain/index.ts
  2. 29
      src/api/wms/purchasePlanMain/index.ts
  3. 572
      src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMain/index.vue
  4. 617
      src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/index.vue
  5. 38
      src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/purchasePlanMain.data.ts

18
src/api/wms/purchaseMain/index.ts

@ -54,6 +54,22 @@ export const deletePurchaseMain = async (id: number) => {
return await request.delete({ url: `/wms/purchase-main/delete?id=` + id }) return await request.delete({ url: `/wms/purchase-main/delete?id=` + id })
} }
// 关闭采购订单主
export const closePurchaseMain = async (id: number) => {
return await request.post({ url: `/wms/purchase-main/close?id=` + id })
}
// 打开采购订单主
export const openPurchaseMain = async (id: number) => {
return await request.post({ url: `/wms/purchase-main/open?id=` + id })
}
// 发布采购订单主
export const publishPurchaseMain = async (id: number) => {
return await request.post({ url: `/wms/purchase-main/publish?id=` + id })
}
// 下架采购订单主
export const witPurchaseMain = async (id: number) => {
return await request.post({ url: `/wms/purchase-main/wit?id=` + id })
}
// 导出采购订单主 Excel // 导出采购订单主 Excel
export const exportPurchaseMain = async (params) => { export const exportPurchaseMain = async (params) => {
return await request.download({ url: `/wms/purchase-main/export-excel`, params }) return await request.download({ url: `/wms/purchase-main/export-excel`, params })
@ -62,4 +78,4 @@ export const exportPurchaseMain = async (params) => {
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/wms/purchase-main/get-import-template' }) return request.download({ url: '/wms/purchase-main/get-import-template' })
} }

29
src/api/wms/purchasePlanMain/index.ts

@ -49,6 +49,33 @@ export const deletePurchasePlanMain = async (id: number) => {
return await request.delete({ url: `/wms/purchase-plan-main/delete?id=` + id }) return await request.delete({ url: `/wms/purchase-plan-main/delete?id=` + id })
} }
// 关闭要货计划主
export const closePurchasePlanMain = async (id: number) => {
return await request.post({ url: `/wms/purchase-plan-main/close?id=` + id })
}
// 打开要货计划主
export const openPurchasePlanMain = async (id: number) => {
return await request.post({ url: `/wms/purchase-plan-main/open?id=` + id })
}
// 发布要货计划主
export const publishPurchasePlanMain = async (id: number) => {
return await request.post({ url: `/wms/purchase-plan-main/publish?id=` + id })
}
// 下架要货计划主
export const witPurchasePlanMain = async (id: number) => {
return await request.post({ url: `/wms/purchase-plan-main/wit?id=` + id })
}
// 接受要货计划主
export const accPurchasePlanMain = async (id: number) => {
return await request.post({ url: `/wms/purchase-plan-main/acc?id=` + id })
}
// 驳回要货计划主
export const rejPurchasePlanMain = async (id: number) => {
return await request.post({ url: `/wms/purchase-plan-main/rej?id=` + id })
}
// 导出要货计划主 Excel // 导出要货计划主 Excel
export const exportPurchasePlanMain = async (params) => { export const exportPurchasePlanMain = async (params) => {
return await request.download({ url: `/wms/purchase-plan-main/export-excel`, params }) return await request.download({ url: `/wms/purchase-plan-main/export-excel`, params })
@ -57,4 +84,4 @@ export const exportPurchasePlanMain = async (params) => {
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/wms/purchase-plan-main/get-import-template' }) return request.download({ url: '/wms/purchase-plan-main/get-import-template' })
} }

572
src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMain/index.vue

@ -4,29 +4,16 @@
<Search :schema="PurchaseMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search :schema="PurchaseMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
:HeadButttondata="HeadButttondata" @updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" :allSchemas="PurchaseMain.allSchemas" />
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="PurchaseMain.allSchemas"
/>
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table <Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total total: tableObject.total
}" }" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage"
v-model:pageSize="tableObject.pageSize" v-model:sort="tableObject.sort">
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #number="{row}"> <template #number="{row}">
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> <el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
<span>{{ row.number }}</span> <span>{{ row.number }}</span>
@ -39,282 +26,311 @@
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm ref="formRef" @success="getList" :rules="PurchaseMainRules" :formAllSchemas="PurchaseMain.allSchemas"
ref="formRef" :tableAllSchemas="PurchaseDetail.allSchemas" :tableFormRules="PurchaseDetailRules" :tableData="tableData"
@success="getList" :apiUpdate="PurchaseMainApi.updatePurchaseMain" :apiCreate="PurchaseMainApi.createPurchaseMain" :isBusiness="true"
:rules="PurchaseMainRules" @handleAddTable="handleAddTable" @handleDeleteTable="handleDeleteTable" @searchTableSuccess="searchTableSuccess"
:formAllSchemas="PurchaseMain.allSchemas" @submitForm="submitForm" />
:tableAllSchemas="PurchaseDetail.allSchemas"
:tableFormRules="PurchaseDetailRules"
:tableData="tableData"
:apiUpdate="PurchaseMainApi.updatePurchaseMain"
:apiCreate="PurchaseMainApi.createPurchaseMain"
:isBusiness="true"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
/>
<!-- 详情 --> <!-- 详情 -->
<Detail <Detail ref="detailRef" :isBasic="false" :allSchemas="PurchaseMain.allSchemas"
ref="detailRef" :detailAllSchemas="PurchaseDetail.allSchemas" :detailAllSchemasRules="PurchaseDetailRules"
:isBasic="false" :apiCreate="PurchaseDetailApi.createPurchaseDetail" :apiUpdate="PurchaseDetailApi.updatePurchaseDetail"
:allSchemas="PurchaseMain.allSchemas" :apiPage="PurchaseDetailApi.getPurchaseDetailPage" :apiDelete="PurchaseDetailApi.deletePurchaseDetail" :Echo="Echo"
:detailAllSchemas="PurchaseDetail.allSchemas" @searchTableSuccessDetail="searchTableSuccessDetail" />
:detailAllSchemasRules="PurchaseDetailRules"
:apiCreate="PurchaseDetailApi.createPurchaseDetail"
:apiUpdate="PurchaseDetailApi.updatePurchaseDetail"
:apiPage="PurchaseDetailApi.getPurchaseDetailPage"
:apiDelete="PurchaseDetailApi.deletePurchaseDetail"
:Echo="Echo"
@searchTableSuccessDetail="searchTableSuccessDetail"
/>
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/purchase-main/import" :importTemplateData="importTemplateData" @success="importSuccess" :isShowOut="true" /> <ImportForm ref="importFormRef" url="/wms/purchase-main/import" :importTemplateData="importTemplateData"
@success="importSuccess" :isShowOut="true" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { PurchaseMain,PurchaseMainRules,PurchaseDetail,PurchaseDetailRules } from './purchaseMain.data' import { PurchaseMain, PurchaseMainRules, PurchaseDetail, PurchaseDetailRules } from './purchaseMain.data'
import * as PurchaseMainApi from '@/api/wms/purchaseMain' import * as PurchaseMainApi from '@/api/wms/purchaseMain'
import * as PurchaseDetailApi from '@/api/wms/purchaseDetail' import * as PurchaseDetailApi from '@/api/wms/purchaseDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
// //
defineOptions({ name: 'PurchaseMain' }) defineOptions({ name: 'PurchaseMain' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const route = useRoute() //
const route = useRoute() // const routeName = ref()
const routeName = ref() routeName.value = route.name
routeName.value = route.name const tableColumns = ref(PurchaseMain.allSchemas.tableColumns)
const tableColumns = ref(PurchaseMain.allSchemas.tableColumns)
//
// const updataTableColumns = (val) => {
const updataTableColumns = (val) => { tableColumns.value = val
tableColumns.value = val }
}
//
// const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { nextTick(() => {
nextTick(() => { if (type == 'tableForm') {
if (type == 'tableForm') { //
// row[formField] = val[0][searchField]
row[formField] = val[0][searchField] } else {
} else { const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
}
})
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
formRef.setValues(setV) formRef.setValues(setV)
} })
}) }
}
// //
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { // const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
nextTick(() => { const Echo = []
const setV = {}
setV[formField] = val[0][searchField] const { tableObject, tableMethods } = useTable({
formRef.setValues(setV) getListApi: PurchaseMainApi.getPurchaseMainPage //
}) })
}
//
// const { getList, setSearchParams } = tableMethods
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
const Echo = [] //
const HeadButttondata = [
const { tableObject, tableMethods } = useTable({ defaultButtons.defaultAddBtn({ hasPermi: 'wms:purchase-main:create' }), //
getListApi: PurchaseMainApi.getPurchaseMainPage // defaultButtons.defaultImportBtn({ hasPermi: 'wms:purchase-main:import' }), //
}) defaultButtons.defaultExportBtn({ hasPermi: 'wms:purchase-main:export' }), //
defaultButtons.defaultFreshBtn(null), //
// defaultButtons.defaultFilterBtn(null), //
const { getList, setSearchParams } = tableMethods defaultButtons.defaultSetBtn(null), //
// {
// // label: '',
const HeadButttondata = [ // name: 'zdy',
defaultButtons.defaultAddBtn({hasPermi:'wms:purchase-main:create'}), // // hide: false,
defaultButtons.defaultImportBtn({hasPermi:'wms:purchase-main:import'}), // // type: 'primary',
defaultButtons.defaultExportBtn({hasPermi:'wms:purchase-main:export'}), // // icon: 'Select',
defaultButtons.defaultFreshBtn(null), // // color: ''
defaultButtons.defaultFilterBtn(null), // // },
defaultButtons.defaultSetBtn(null), // ]
// {
// label: '', //
// name: 'zdy', const buttonBaseClick = (val, item) => {
// hide: false, if (val == 'add') { //
// type: 'primary', openForm('create')
// icon: 'Select', } else if (val == 'import') { //
// color: '' handleImport()
// }, } else if (val == 'export') { //
] handleExport()
} else if (val == 'refresh') { //
// getList()
const buttonBaseClick = (val, item) => { } else if (val == 'filtrate') { //
if (val == 'add') { // } else { //
openForm('create') console.log('其他按钮', item)
} else if (val == 'import') { // }
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
} }
}
//
// 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 { return true
return true }
} }
}
// -
// - const butttondata = (row) => {
const butttondata = (row) => { return [
return [ defaultButtons.mainListOrderCloBtn({ hide: isShowMainButton(row, ['1']) }), //
defaultButtons.mainListOrderCloBtn({hide:isShowMainButton(row,['1'])}), // defaultButtons.mainListOrderOpeBtn({ hide: isShowMainButton(row, ['3']) }), //
defaultButtons.mainListOrderPubBtn({hide:isShowMainButton(row,['1'])}), // defaultButtons.mainListOrderPubBtn({ hide: isShowMainButton(row, ['1']) }), //
defaultButtons.mainListOrderOpeBtn({hide:isShowMainButton(row,['3'])}), // defaultButtons.mainListOrderWitBtn({ hide: isShowMainButton(row, ['2']) }), //
defaultButtons.mainListOrderWitBtn({hide:isShowMainButton(row,['2'])}), // defaultButtons.mainListEditBtn({ hasPermi: 'wms:purchase-main:update', hide: isShowMainButton(row, ['1']) }), //
defaultButtons.mainListEditBtn({hasPermi:'wms:purchase-main:update',hide:isShowMainButton(row,['1'])}), // defaultButtons.mainListDeleteBtn({ hasPermi: 'wms:purchase-main:delete', hide: isShowMainButton(row, ['1']) }), //
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:purchase-main:delete',hide:isShowMainButton(row,['1'])}), // ]
] }
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
// - openForm('update', row)
const buttonTableClick = async (val, row) => { } else if (val == 'delete') { //
if (val == 'mainClose') { // handleDelete(row.id)
console.log('列表-操作按钮事件-关闭') } else if (val == 'mainOrderClo') { //
} else if (val == 'mainReAdd') { // handleClose(row.id)
console.log('列表-操作按钮事件-重新添加') } else if (val == 'mainOrderOpe') { //
} else if (val == 'mainSubmit') { // handleOpen(row.id)
console.log('列表-操作按钮事件-提交审批') } else if (val == 'mainOrderPub') { //
} else if (val == 'mainTurnDown') { // handlePublish(row.id)
console.log('列表-操作按钮事件-驳回') } else if (val == 'mainOrderWit') { //
} else if (val == 'mainApprove') { // handleWit(row.id)
console.log('列表-操作按钮事件-审批通过') }
} else if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} }
}
/** 添加/修改操作 */
/** 添加/修改操作 */ const formRef = ref()
const formRef = ref() const openForm = async (type : string, row ?: number) => {
const openForm =async (type: string, row?: number) => { tableData.value = [] //
tableData.value = [] // formRef.value.open(type, row)
formRef.value.open(type, row)
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await PurchaseMainApi.deletePurchaseMain(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await PurchaseMainApi.exportPurchaseMain(setSearchParams)
download.excel(data, '采购订单主.xlsx')
} catch {
} finally {
exportLoading.value = false
} }
}
/** 详情操作 */
/** const detailRef = ref()
* tableForm方法 const openDetail = (row : any, titleName : any, titleValue : any) => {
*/ detailRef.value.openDetail(row, titleName, titleValue)
const tableFormKeys = {} }
PurchaseDetail.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : '' /** 删除按钮操作 */
}) const handleDelete = async (id : number) => {
const tableData = ref([]) try {
//
// await message.delConfirm()
const handleAddTable = () => { //
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys))) await PurchaseMainApi.deletePurchaseMain(id)
} message.success(t('common.delSuccess'))
// //
const handleDeleteTable = (item, index) => { await getList()
tableData.value.splice(index, 1) } catch { }
} }
// /** 关闭按钮操作 */
const submitForm = async (formType, data) => { const handleClose = async (id : number) => {
data.subList = tableData.value // try {
try { //
if (formType === 'create') { await message.confirm('是否关闭所选中数据?')
await PurchaseMainApi.createPurchaseMain(data) //
message.success(t('common.createSuccess')) await PurchaseMainApi.closePurchaseMain(id)
} else { message.success(t('关闭成功!'))
await PurchaseMainApi.updatePurchaseMain(data) //
message.success(t('common.updateSuccess')) await getList()
} catch { }
}
/** 打开按钮操作 */
const handleOpen = async (id : number) => {
try {
//
await message.confirm('是否打开所选中数据?')
//
await PurchaseMainApi.openPurchaseMain(id)
message.success(t('打开成功!'))
//
await getList()
} catch { }
}
/** 发布按钮操作 */
const handlePublish = async (id : number) => {
try {
//
await message.confirm('是否发布所选中数据?')
//
await PurchaseMainApi.publishPurchaseMain(id)
message.success(t('发布成功!'))
//
await getList()
} catch { }
}
/** 下架按钮操作 */
const handleWit = async (id : number) => {
try {
//
await message.confirm('是否下架所选中数据?')
//
await PurchaseMainApi.witPurchaseMain(id)
message.success(t('下架成功!'))
//
await getList()
} catch { }
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await PurchaseMainApi.exportPurchaseMain(setSearchParams)
download.excel(data, '采购订单主.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/**
* tableForm方法
*/
const tableFormKeys = {}
PurchaseDetail.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
//
const handleAddTable = () => {
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
}
//
const handleDeleteTable = (item, index) => {
tableData.value.splice(index, 1)
}
//
const submitForm = async (formType, data) => {
data.subList = tableData.value //
try {
if (formType === 'create') {
await PurchaseMainApi.createPurchaseMain(data)
message.success(t('common.createSuccess'))
} else {
await PurchaseMainApi.updatePurchaseMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
} }
formRef.value.dialogVisible = false }
//
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '采购订单主导入模版.xlsx'
})
//
const importSuccess = () => {
getList() getList()
} finally {
formRef.value.formLoading = false
} }
}
//
/** 导入 */ const searchFormClick = (searchData) => {
const importFormRef = ref() tableObject.params = {
const handleImport = () => { isSearch: true,
importFormRef.value.open() filters: searchData.filters
} }
getList() //
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '采购订单主导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
} }
getList() //
} /** 初始化 **/
onMounted(async () => {
/** 初始化 **/ getList()
onMounted(async () => { importTemplateData.templateUrl = await PurchaseMainApi.importTemplate()
getList() })
importTemplateData.templateUrl = await PurchaseMainApi.importTemplate()
})
</script> </script>

617
src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/index.vue

@ -4,29 +4,17 @@
<Search :schema="PurchasePlanMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search :schema="PurchasePlanMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
:HeadButttondata="HeadButttondata" @updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick"
@button-base-click="buttonBaseClick" :allSchemas="PurchasePlanMain.allSchemas" />
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="PurchasePlanMain.allSchemas"
/>
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table <Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total total: tableObject.total
}" }" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage"
v-model:pageSize="tableObject.pageSize" v-model:sort="tableObject.sort">
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #number="{row}"> <template #number="{row}">
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> <el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
<span>{{ row.number }}</span> <span>{{ row.number }}</span>
@ -39,295 +27,354 @@
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm ref="formRef" @success="getList" :rules="PurchasePlanMainRules"
ref="formRef" :formAllSchemas="PurchasePlanMain.allSchemas" :tableAllSchemas="PurchasePlanDetail.allSchemas"
@success="getList" :tableFormRules="PurchasePlanDetailRules" :tableData="tableData"
:rules="PurchasePlanMainRules" :apiUpdate="PurchasePlanMainApi.updatePurchasePlanMain" :apiCreate="PurchasePlanMainApi.createPurchasePlanMain"
:formAllSchemas="PurchasePlanMain.allSchemas" :isBusiness="true" @handleAddTable="handleAddTable" @handleDeleteTable="handleDeleteTable"
:tableAllSchemas="PurchasePlanDetail.allSchemas" @searchTableSuccess="searchTableSuccess" @submitForm="submitForm" />
:tableFormRules="PurchasePlanDetailRules"
:tableData="tableData"
:apiUpdate="PurchasePlanMainApi.updatePurchasePlanMain"
:apiCreate="PurchasePlanMainApi.createPurchasePlanMain"
:isBusiness="true"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
/>
<!-- 详情 --> <!-- 详情 -->
<Detail <Detail ref="detailRef" :isBasic="false" :allSchemas="PurchasePlanMain.allSchemas"
ref="detailRef" :detailAllSchemas="PurchasePlanDetail.allSchemas" :detailAllSchemasRules="PurchasePlanDetailRules"
:isBasic="false"
:allSchemas="PurchasePlanMain.allSchemas"
:detailAllSchemas="PurchasePlanDetail.allSchemas"
:detailAllSchemasRules="PurchasePlanDetailRules"
:apiCreate="PurchasePlanDetailApi.createPurchasePlanDetail" :apiCreate="PurchasePlanDetailApi.createPurchasePlanDetail"
:apiUpdate="PurchasePlanDetailApi.updatePurchasePlanDetail" :apiUpdate="PurchasePlanDetailApi.updatePurchasePlanDetail"
:apiPage="PurchasePlanDetailApi.getPurchasePlanDetailPage" :apiPage="PurchasePlanDetailApi.getPurchasePlanDetailPage"
:apiDelete="PurchasePlanDetailApi.deletePurchasePlanDetail" :apiDelete="PurchasePlanDetailApi.deletePurchasePlanDetail" :Echo="Echo"
:Echo="Echo" @searchTableSuccessDetail="searchTableSuccessDetail" />
@searchTableSuccessDetail="searchTableSuccessDetail"
/>
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/purchase-plan-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> <ImportForm ref="importFormRef" url="/wms/purchase-plan-main/import" :importTemplateData="importTemplateData"
@success="importSuccess" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { PurchasePlanMain,PurchasePlanMainRules,PurchasePlanDetail,PurchasePlanDetailRules } from './purchasePlanMain.data' import { PurchasePlanMain, PurchasePlanMainRules, PurchasePlanDetail, PurchasePlanDetailRules } from './purchasePlanMain.data'
import * as PurchasePlanMainApi from '@/api/wms/purchasePlanMain' import * as PurchasePlanMainApi from '@/api/wms/purchasePlanMain'
import * as PurchasePlanDetailApi from '@/api/wms/purchasePlanDetail' import * as PurchasePlanDetailApi from '@/api/wms/purchasePlanDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
// //
defineOptions({ name: 'PurchasePlanMain' }) defineOptions({ name: 'PurchasePlanMain' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(PurchasePlanMain.allSchemas.tableColumns) const tableColumns = ref(PurchasePlanMain.allSchemas.tableColumns)
// //
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
tableColumns.value = val tableColumns.value = val
} }
// //
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(() => { nextTick(() => {
if (type == 'tableForm') { if (type == 'tableForm') {
// //
row[formField] = val[0][searchField] row[formField] = val[0][searchField]
row['itemCode'] = val[0]['code'] row['itemCode'] = val[0]['code']
row['poNumber'] = val[0]['number'] row['poNumber'] = val[0]['number']
row['poLine'] = val[0]['lineNumber'] row['poLine'] = val[0]['lineNumber']
} else { } else {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
}
})
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
setV['itemCode'] = val[0]['code']
setV['poNumber'] = val[0]['number']
setV['poLine'] = val[0]['lineNumber']
formRef.setValues(setV) formRef.setValues(setV)
} })
}) }
}
// //
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { // const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
nextTick(() => { const Echo = []
const setV = {}
setV[formField] = val[0][searchField] const { tableObject, tableMethods } = useTable({
setV['itemCode'] = val[0]['code'] getListApi: PurchasePlanMainApi.getPurchasePlanMainPage //
setV['poNumber'] = val[0]['number']
setV['poLine'] = val[0]['lineNumber']
formRef.setValues(setV)
}) })
}
//
// const { getList, setSearchParams } = tableMethods
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
const Echo = [] //
const HeadButttondata = [
const { tableObject, tableMethods } = useTable({ defaultButtons.defaultAddBtn({ hasPermi: 'wms:purchase-plan-main:create' }), //
getListApi: PurchasePlanMainApi.getPurchasePlanMainPage // defaultButtons.defaultImportBtn({ hasPermi: 'wms:purchase-plan-main:import' }), //
}) defaultButtons.defaultExportBtn({ hasPermi: 'wms:purchase-plan-main:export' }), //
defaultButtons.defaultFreshBtn(null), //
// defaultButtons.defaultFilterBtn(null), //
const { getList, setSearchParams } = tableMethods defaultButtons.defaultSetBtn(null), //
// {
// // label: '',
const HeadButttondata = [ // name: 'zdy',
defaultButtons.defaultAddBtn({hasPermi:'wms:purchase-plan-main:create'}), // // hide: false,
defaultButtons.defaultImportBtn({hasPermi:'wms:purchase-plan-main:import'}), // // type: 'primary',
defaultButtons.defaultExportBtn({hasPermi:'wms:purchase-plan-main:export'}), // // icon: 'Select',
defaultButtons.defaultFreshBtn(null), // // color: ''
defaultButtons.defaultFilterBtn(null), // // },
defaultButtons.defaultSetBtn(null), // ]
// {
// label: '', //
// name: 'zdy', const buttonBaseClick = (val, item) => {
// hide: false, if (val == 'add') { //
// type: 'primary', openForm('create')
// icon: 'Select', } else if (val == 'import') { //
// color: '' handleImport()
// }, } else if (val == 'export') { //
] handleExport()
} else if (val == 'refresh') { //
// getList()
const buttonBaseClick = (val, item) => { } else if (val == 'filtrate') { //
if (val == 'add') { // } else { //
openForm('create') console.log('其他按钮', item)
} else if (val == 'import') { // }
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
} }
}
//
// 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 { return true
return true }
} }
}
// - // -
const butttondata = (row) => { const butttondata = (row) => {
return [ return [
defaultButtons.mainListPurchasePlanModBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_REJECTED'])}), // defaultButtons.mainListPurchasePlanWitBtn({ hide: isShowMainButton(row, ['3']) }), //
defaultButtons.mainListPurchasePlanWitBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_PUBLISHED'])}), // defaultButtons.mainListPurchasePlanRejBtn({ hide: isShowMainButton(row, ['3']) }), //
defaultButtons.mainListPurchasePlanRejBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_PUBLISHED'])}), // defaultButtons.mainListPurchasePlanAccBtn({ hide: isShowMainButton(row, ['3']) }), //
defaultButtons.mainListPurchasePlanAccBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_PUBLISHED'])}), // defaultButtons.mainListPurchasePlanPubBtn({ hide: isShowMainButton(row, ['1']) }), //
defaultButtons.mainListPurchasePlanPubBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_READY'])}), // defaultButtons.mainListPurchasePlanCloBtn({ hide: isShowMainButton(row, ['1']) }), //
defaultButtons.mainListPurchasePlanCloBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_READY'])}), // defaultButtons.mainListPurchasePlanOpeBtn({ hide: isShowMainButton(row, ['2']) }), //
defaultButtons.mainListPurchasePlanOpeBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_CLOSED'])}), // defaultButtons.mainListEditBtn({ hide: isShowMainButton(row, ['1']), hasPermi: 'wms:purchase-plan-main:update' }), //
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_READY']),hasPermi:'wms:purchase-plan-main:update'}), // defaultButtons.mainListDeleteBtn({ hide: isShowMainButton(row, ['1']), hasPermi: 'wms:purchase-plan-main:delete' }), //
defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['PLAN_PURCHASE_READY']),hasPermi:'wms:purchase-plan-main:delete'}), //
] ]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'mainPurPlanOpe') { //
console.log('列表-操作按钮事件-打开')
} else if (val == 'mainPurPlanClo') { //
console.log('列表-操作按钮事件-关闭')
} else if (val == 'mainPurPlanPub') { //
console.log('列表-操作按钮事件-发布')
} else if (val == 'mainPurPlanAcc') { //
console.log('列表-操作按钮事件-接受')
} else if (val == 'mainPurPlanRej') { //
console.log('列表-操作按钮事件-不接受')
} else if (val == 'mainPurPlanWit') { //
console.log('列表-操作按钮事件-下架')
} else if (val == 'mainPurPlanMod') { //
console.log('列表-操作按钮事件-修改')
} else if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} }
}
// -
/** 添加/修改操作 */ const buttonTableClick = async (val, row) => {
const formRef = ref() if (val == 'edit') { //
const openForm =async (type: string, row?: number) => { openForm('update', row)
tableData.value = [] // } else if (val == 'delete') { //
formRef.value.open(type, row) handleDelete(row.id)
} } else if (val == 'mainPurPlanClo') { //
handleClose(row.id)
/** 详情操作 */ } else if (val == 'mainPurPlanOpe') { //
const detailRef = ref() handleOpen(row.id)
const openDetail = (row: any, titleName: any, titleValue: any) => { } else if (val == 'mainPurPlanPub') { //
detailRef.value.openDetail(row, titleName, titleValue) handlePublish(row.id)
} } else if (val == 'mainPurPlanWit') { //
handleWit(row.id)
/** 删除按钮操作 */ } else if (val == 'mainPurPlanAcc') { //
const handleDelete = async (id: number) => { handleAcc(row.id)
try { } else if (val == 'mainPurPlanRej') { //
// handleWit(row.id)
await message.delConfirm() }
//
await PurchasePlanMainApi.deletePurchasePlanMain(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await PurchasePlanMainApi.exportPurchasePlanMain(setSearchParams)
download.excel(data, '要货计划主.xlsx')
} catch {
} finally {
exportLoading.value = false
} }
}
/** 添加/修改操作 */
/** const formRef = ref()
* tableForm方法 const openForm = async (type : string, row ?: number) => {
*/ tableData.value = [] //
const tableFormKeys = {} formRef.value.open(type, row)
PurchasePlanDetail.allSchemas.tableFormColumns.forEach(item => { }
tableFormKeys[item.field] = item.default ? item.default : ''
}) /** 详情操作 */
const tableData = ref([]) const detailRef = ref()
const openDetail = (row : any, titleName : any, titleValue : any) => {
// detailRef.value.openDetail(row, titleName, titleValue)
const handleAddTable = () => { }
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
} /** 删除按钮操作 */
// const handleDelete = async (id : number) => {
const handleDeleteTable = (item, index) => { try {
tableData.value.splice(index, 1) //
} await message.delConfirm()
//
// await PurchasePlanMainApi.deletePurchasePlanMain(id)
const submitForm = async (formType, data) => { message.success(t('common.delSuccess'))
data.subList = tableData.value // //
try { await getList()
if (formType === 'create') { } catch { }
await PurchasePlanMainApi.createPurchasePlanMain(data) }
message.success(t('common.createSuccess'))
} else { /** 关闭按钮操作 */
await PurchasePlanMainApi.updatePurchasePlanMain(data) const handleClose = async (id : number) => {
message.success(t('common.updateSuccess')) try {
//
await message.confirm('是否关闭所选中数据?')
//
await PurchasePlanMainApi.closePurchasePlanMain(id)
message.success(t('关闭成功!'))
//
await getList()
} catch { }
}
/** 打开按钮操作 */
const handleOpen = async (id : number) => {
try {
//
await message.confirm('是否打开所选中数据?')
//
await PurchasePlanMainApi.openPurchasePlanMain(id)
message.success(t('打开成功!'))
//
await getList()
} catch { }
}
/** 发布按钮操作 */
const handlePublish = async (id : number) => {
try {
//
await message.confirm('是否发布所选中数据?')
//
await PurchasePlanMainApi.publishPurchasePlanMain(id)
message.success(t('发布成功!'))
//
await getList()
} catch { }
}
/** 下架按钮操作 */
const handleWit = async (id : number) => {
try {
//
await message.confirm('是否下架所选中数据?')
//
await PurchasePlanMainApi.witPurchasePlanMain(id)
message.success(t('下架成功!'))
//
await getList()
} catch { }
}
/** 接受按钮操作 */
const handleAcc = async (id : number) => {
try {
//
await message.confirm('是否接受所选中数据?')
//
await PurchasePlanMainApi.accPurchasePlanMain(id)
message.success(t('接受成功!'))
//
await getList()
} catch { }
}
/** 驳回按钮操作 */
const handleRej = async (id : number) => {
try {
//
await message.confirm('是否驳回所选中数据?')
//
await PurchasePlanMainApi.rejPurchasePlanMain(id)
message.success(t('驳回成功!'))
//
await getList()
} catch { }
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await PurchasePlanMainApi.exportPurchasePlanMain(setSearchParams)
download.excel(data, '要货计划主.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/**
* tableForm方法
*/
const tableFormKeys = {}
PurchasePlanDetail.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
//
const handleAddTable = () => {
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
}
//
const handleDeleteTable = (item, index) => {
tableData.value.splice(index, 1)
}
//
const submitForm = async (formType, data) => {
data.subList = tableData.value //
try {
if (formType === 'create') {
await PurchasePlanMainApi.createPurchasePlanMain(data)
message.success(t('common.createSuccess'))
} else {
await PurchasePlanMainApi.updatePurchasePlanMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
} }
formRef.value.dialogVisible = false }
//
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '要货计划主导入模版.xlsx'
})
//
const importSuccess = () => {
getList() getList()
} finally {
formRef.value.formLoading = false
} }
}
//
/** 导入 */ const searchFormClick = (searchData) => {
const importFormRef = ref() tableObject.params = {
const handleImport = () => { isSearch: true,
importFormRef.value.open() filters: searchData.filters
} }
getList() //
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '要货计划主导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
} }
getList() //
} /** 初始化 **/
onMounted(async () => {
/** 初始化 **/ getList()
onMounted(async () => { importTemplateData.templateUrl = await PurchasePlanMainApi.importTemplate()
getList() })
importTemplateData.templateUrl = await PurchasePlanMainApi.importTemplate()
})
</script> </script>

38
src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/purchasePlanMain.data.ts

@ -90,7 +90,7 @@ export const PurchasePlanMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '状态', label: '状态',
field: 'status', field: 'status',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.PURCHASE_PLAN_STATUS, dictType: DICT_TYPE.PURCHASE_PLAN_STATUS ,
dictClass: 'string', dictClass: 'string',
isTable: true, isTable: true,
isSearch: true, isSearch: true,
@ -98,7 +98,7 @@ export const PurchasePlanMain = useCrudSchemas(reactive<CrudSchema[]>([
width: 150 width: 150
}, },
form: { form: {
value: 'PLAN_PURCHASE_READY', value: '1',
componentProps: { componentProps: {
disabled: true disabled: true
} }
@ -107,46 +107,18 @@ export const PurchasePlanMain = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '开始时间', label: '开始时间',
field: 'beginTime', field: 'beginTime',
isTable: true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom', sort: 'custom',
table: { table: {
width: 180 width: 150
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
}, },
isForm: false, isForm: false,
}, },
{ {
label: '结束时间', label: '结束时间',
field: 'endTime', field: 'endTime',
isTable: true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom', sort: 'custom',
table: { table: {
width: 180 width: 150
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
}, },
isForm: false, isForm: false,
}, },
@ -554,4 +526,4 @@ export const PurchasePlanDetailRules = reactive({
planQty: [ planQty: [
{ required: true, message: '请输入计划数量', trigger: 'blur' } { required: true, message: '请输入计划数量', trigger: 'blur' }
], ],
}) })

Loading…
Cancel
Save