Browse Source

BUG修改

master
叶佳兴 1 year ago
parent
commit
2bc0998768
  1. 385
      src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/index.vue
  2. 33
      src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/purchasePlanMain.data.ts

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

@ -5,28 +5,16 @@
</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,37 +27,21 @@
</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" @searchTableSuccessDetail="searchTableSuccessDetail"
@searchTableSuccessDetail="searchTableSuccessDetail" :detailValidate="detailValidate" />
:detailValidate="detailValidate"
/>
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/purchase-plan-main/import" :importTemplateData="importTemplateData" <ImportForm ref="importFormRef" url="/wms/purchase-plan-main/import" :importTemplateData="importTemplateData"
@ -77,32 +49,32 @@
</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'
import * as PurchaseDetailApi from '@/api/wms/purchaseDetail' import * as PurchaseDetailApi from '@/api/wms/purchaseDetail'
// //
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(async() => { nextTick(async () => {
if (type == 'tableForm') { if (type == 'tableForm') {
// //
row[formField] = val[0][searchField] row[formField] = val[0][searchField]
@ -113,7 +85,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
number: row['poNumber'], number: row['poNumber'],
lineNumber: row['poLine'], lineNumber: row['poLine'],
}).then(res => { }).then(res => {
if(res.list.length == 1) { if (res.list.length == 1) {
row['itemCode'] = res.list[0].itemCode row['itemCode'] = res.list[0].itemCode
} }
}) })
@ -123,10 +95,10 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
formRef.setValues(setV) formRef.setValues(setV)
} }
}) })
} }
// //
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(async() => { nextTick(async () => {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
setV['poNumber'] = val[0]['number'] setV['poNumber'] = val[0]['number']
@ -135,26 +107,26 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
number: setV['poNumber'], number: setV['poNumber'],
lineNumber: setV['poLine'], lineNumber: setV['poLine'],
}).then(res => { }).then(res => {
if(res.list.length == 1) { if (res.list.length == 1) {
setV['itemCode'] = res.list[0].itemCode setV['itemCode'] = res.list[0].itemCode
formRef.setValues(setV) formRef.setValues(setV)
} }
}) })
}) })
} }
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: PurchasePlanMainApi.getPurchasePlanMainPage // getListApi: PurchasePlanMainApi.getPurchasePlanMainPage //
}) })
// //
const { getList, setSearchParams } = tableMethods const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:purchase-plan-main:create'}), // defaultButtons.defaultAddBtn({ hasPermi: 'wms:purchase-plan-main:create' }), //
defaultButtons.defaultImportBtn({hasPermi:'wms:purchase-plan-main:import'}), // defaultButtons.defaultImportBtn({ hasPermi: 'wms:purchase-plan-main:import' }), //
defaultButtons.defaultExportBtn({hasPermi:'wms:purchase-plan-main:export'}), // defaultButtons.defaultExportBtn({ hasPermi: 'wms:purchase-plan-main:export' }), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
@ -166,10 +138,10 @@ const HeadButttondata = [
// icon: 'Select', // icon: 'Select',
// color: '' // color: ''
// }, // },
] ]
// //
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') { //
@ -182,70 +154,67 @@ const buttonBaseClick = (val, item) => {
} else { // } else { //
console.log('其他按钮', item) 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,['5'])}), // defaultButtons.mainListPurchasePlanOpeBtn({ hide: isShowMainButton(row, ['5']) }), //
defaultButtons.mainListPurchasePlanWitBtn({hide:isShowMainButton(row,['3'])}), // defaultButtons.mainListPurchasePlanCloBtn({ hide: isShowMainButton(row, ['1']) }), //
defaultButtons.mainListPurchasePlanRejBtn({hide:isShowMainButton(row,['3'])}), // defaultButtons.mainListPurchasePlanPubBtn({ hide: isShowMainButton(row, ['1']) }), //
defaultButtons.mainListPurchasePlanAccBtn({hide:isShowMainButton(row,['3'])}), // defaultButtons.mainListPurchasePlanAccBtn({ hide: isShowMainButton(row, ['6']) }), //
defaultButtons.mainListPurchasePlanPubBtn({hide:isShowMainButton(row,['1'])}), // defaultButtons.mainListPurchasePlanRejBtn({ hide: isShowMainButton(row, ['6']) }), //
defaultButtons.mainListPurchasePlanCloBtn({hide:isShowMainButton(row,['1'])}), // defaultButtons.mainListPurchasePlanWitBtn({ hide: isShowMainButton(row, ['6']) }), //
defaultButtons.mainListPurchasePlanOpeBtn({hide:isShowMainButton(row,['2'])}), // defaultButtons.mainListEditBtn({ hide: isShowMainButton(row, ['1']), hasPermi: 'wms:purchase-plan-main:update' }), //
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:purchase-plan-main:update'}), //
// defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:purchase-plan-main:delete'}), // // defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:purchase-plan-main:delete'}), //
] ]
} }
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'mainPurPlanOpe') { // if (val == 'mainPurPlanOpe') { //
console.log('列表-操作按钮事件-打开') handleOpen(row.id)
} else if (val == 'mainPurPlanClo') { // } else if (val == 'mainPurPlanClo') {//
console.log('列表-操作按钮事件-关闭') handleClose(row.id)
} else if (val == 'mainPurPlanPub') { // } else if (val == 'mainPurPlanPub') { //
console.log('列表-操作按钮事件-发布') handlePublish(row.id)
} else if (val == 'mainPurPlanAcc') { // } else if (val == 'mainPurPlanAcc') { //
console.log('列表-操作按钮事件-接受') handleAcc(row.id)
} else if (val == 'mainPurPlanRej') { // } else if (val == 'mainPurPlanRej') { //
console.log('列表-操作按钮事件-不接受') handleRej(row.id)
} else if (val == 'mainPurPlanWit') { // } else if (val == 'mainPurPlanWit') { //
console.log('列表-操作按钮事件-下架') handleWit(row.id)
} else if (val == 'mainPurPlanMod') { //
console.log('列表-操作按钮事件-修改')
} else if (val == 'edit') { // } else if (val == 'edit') { //
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
handleDelete(row.id) 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 detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => { const openDetail = (row : any, titleName : any, titleValue : any) => {
detailRef.value.openDetail(row, titleName, titleValue) detailRef.value.openDetail(row, titleName, titleValue)
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id: number) => { const handleDelete = async (id : number) => {
try { try {
// //
await message.delConfirm() await message.delConfirm()
@ -254,12 +223,90 @@ const handleDelete = async (id: number) => {
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
} catch {} } catch { }
} }
/** 关闭按钮操作 */
const handleClose = async (id : number) => {
try {
//
await message.confirm('是否关闭所选中数据?')
//
await PurchasePlanMainApi.closePurchasePlanMain(id)
message.success(t('关闭成功!'))
//
await getList()
} catch { }
}
/** 导出按钮操作 */ /** 打开按钮操作 */
const exportLoading = ref(false) // const handleOpen = async (id : number) => {
const handleExport = async () => { 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 { try {
// //
await message.exportConfirm() await message.exportConfirm()
@ -271,30 +318,30 @@ const handleExport = async () => {
} finally { } finally {
exportLoading.value = false exportLoading.value = false
} }
} }
/** /**
* tableForm方法 * tableForm方法
*/ */
const tableFormKeys = {} const tableFormKeys = {}
PurchasePlanDetail.allSchemas.tableFormColumns.forEach(item => { PurchasePlanDetail.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : '' tableFormKeys[item.field] = item.default ? item.default : ''
}) })
const tableData = ref([]) const tableData = ref([])
// //
const handleAddTable = () => { const handleAddTable = () => {
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys))) tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
} }
// //
const handleDeleteTable = (item, index) => { const handleDeleteTable = (item, index) => {
tableData.value.splice(index, 1) tableData.value.splice(index, 1)
} }
// //
const submitForm = async (formType, data) => { const submitForm = async (formType, data) => {
data.subList = [] data.subList = []
for(let item of tableData.value) { for (let item of tableData.value) {
await PurchaseDetailApi.getPurchaseDetailPage({ await PurchaseDetailApi.getPurchaseDetailPage({
number: item.poNumber, number: item.poNumber,
lineNumber: item.poLine, lineNumber: item.poLine,
@ -307,7 +354,7 @@ const submitForm = async (formType, data) => {
// } // }
}) })
} }
if(data.subList.length == tableData.value.length){ if (data.subList.length == tableData.value.length) {
try { try {
if (formType === 'create') { if (formType === 'create') {
await PurchasePlanMainApi.createPurchasePlanMain(data) await PurchasePlanMainApi.createPurchasePlanMain(data)
@ -322,18 +369,18 @@ const submitForm = async (formType, data) => {
} finally { } finally {
formRef.value.formLoading = false formRef.value.formLoading = false
} }
} }
formRef.value.formLoading = false formRef.value.formLoading = false
} }
// / // /
const detailValidate = async (data) => { const detailValidate = async (data) => {
let tag = false let tag = false
await PurchaseDetailApi.getPurchaseDetailPage({ await PurchaseDetailApi.getPurchaseDetailPage({
number: data.poNumber, number: data.poNumber,
lineNumber: data.poLine lineNumber: data.poLine
}).then(res => { }).then(res => {
if(data.planQty > res.list[0].orderQty-res.list[0].plannedQty){ if (data.planQty > res.list[0].orderQty - res.list[0].plannedQty) {
message.error('要货计划数量不得大于订单数量-已计划数量') message.error('要货计划数量不得大于订单数量-已计划数量')
tag = false tag = false
} else { } else {
@ -341,37 +388,37 @@ const detailValidate = async (data) => {
} }
}) })
return tag return tag
} }
/** 导入 */ /** 导入 */
const importFormRef = ref() const importFormRef = ref()
const handleImport = () => { const handleImport = () => {
importFormRef.value.open() importFormRef.value.open()
} }
// //
const importTemplateData = reactive({ const importTemplateData = reactive({
templateUrl: '', templateUrl: '',
templateTitle: '要货计划主导入模版.xls' templateTitle: '要货计划主导入模版.xls'
}) })
// //
const importSuccess = () => { const importSuccess = () => {
getList() getList()
} }
// //
const searchFormClick = (searchData) => { const searchFormClick = (searchData) => {
tableObject.params = { tableObject.params = {
isSearch: true, isSearch: true,
filters: searchData.filters filters: searchData.filters
} }
getList() // getList() //
} }
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()
importTemplateData.templateUrl = await PurchasePlanMainApi.importTemplate() importTemplateData.templateUrl = await PurchasePlanMainApi.importTemplate()
}) })
</script> </script>

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

@ -110,49 +110,22 @@ 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,
}, },
{ {
label: '备注', label: '备注',
field: 'remark', field: 'remark',

Loading…
Cancel
Save