Browse Source

BUG修改

master
yejiaxing 12 months ago
parent
commit
e0e62d505a
  1. 350
      src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMain/index.vue

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

@ -5,28 +5,15 @@
</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,67 +26,48 @@
</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') {
// //
@ -110,32 +78,32 @@ 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(() => { nextTick(() => {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
formRef.setValues(setV) formRef.setValues(setV)
}) })
} }
// //
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom'] // const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
const Echo = [] const Echo = []
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: PurchaseMainApi.getPurchaseMainPage // getListApi: PurchaseMainApi.getPurchaseMainPage //
}) })
// //
const { getList, setSearchParams } = tableMethods const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:purchase-main:create'}), // defaultButtons.defaultAddBtn({ hasPermi: 'wms:purchase-main:create' }), //
defaultButtons.defaultImportBtn({hasPermi:'wms:purchase-main:import'}), // defaultButtons.defaultImportBtn({ hasPermi: 'wms:purchase-main:import' }), //
defaultButtons.defaultExportBtn({hasPermi:'wms:purchase-main:export'}), // defaultButtons.defaultExportBtn({ hasPermi: 'wms:purchase-main:export' }), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
@ -147,10 +115,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') { //
@ -163,65 +131,61 @@ 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.mainListOrderCloBtn({hide:isShowMainButton(row,['1'])}), // defaultButtons.mainListOrderCloBtn({ hide: isShowMainButton(row, ['1']) }), //
defaultButtons.mainListOrderPubBtn({hide:isShowMainButton(row,['1'])}), // defaultButtons.mainListOrderOpeBtn({ hide: isShowMainButton(row, ['3']) }), //
defaultButtons.mainListOrderOpeBtn({hide:isShowMainButton(row,['3'])}), // defaultButtons.mainListOrderPubBtn({ hide: isShowMainButton(row, ['1']) }), //
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') { //
const buttonTableClick = async (val, row) => {
if (val == 'mainClose') { //
console.log('列表-操作按钮事件-关闭')
} else if (val == 'mainReAdd') { //
console.log('列表-操作按钮事件-重新添加')
} else if (val == 'mainSubmit') { //
console.log('列表-操作按钮事件-提交审批')
} else if (val == 'mainTurnDown') { //
console.log('列表-操作按钮事件-驳回')
} else if (val == 'mainApprove') { //
console.log('列表-操作按钮事件-审批通过')
} else if (val == 'edit') { //
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
handleDelete(row.id) handleDelete(row.id)
} else if (val == 'mainOrderClo') { //
handleClose(row.id)
} else if (val == 'mainOrderOpe') { //
handleOpen(row.id)
} else if (val == 'mainOrderPub') { //
handlePublish(row.id)
} else if (val == 'mainOrderWit') { //
handleWit(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()
@ -230,12 +194,64 @@ 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 PurchaseMainApi.closePurchaseMain(id)
message.success(t('关闭成功!'))
//
await getList()
} catch { }
}
/** 导出按钮操作 */ /** 打开按钮操作 */
const exportLoading = ref(false) // const handleOpen = async (id : number) => {
const handleExport = async () => { 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 { try {
// //
await message.exportConfirm() await message.exportConfirm()
@ -247,28 +263,28 @@ const handleExport = async () => {
} finally { } finally {
exportLoading.value = false exportLoading.value = false
} }
} }
/** /**
* tableForm方法 * tableForm方法
*/ */
const tableFormKeys = {} const tableFormKeys = {}
PurchaseDetail.allSchemas.tableFormColumns.forEach(item => { PurchaseDetail.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 = tableData.value // data.subList = tableData.value //
try { try {
if (formType === 'create') { if (formType === 'create') {
@ -284,37 +300,37 @@ const submitForm = async (formType, data) => {
} finally { } finally {
formRef.value.formLoading = false formRef.value.formLoading = false
} }
} }
/** 导入 */ /** 导入 */
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: '采购订单主导入模版.xlsx'
}) })
// //
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 PurchaseMainApi.importTemplate() importTemplateData.templateUrl = await PurchaseMainApi.importTemplate()
}) })
</script> </script>

Loading…
Cancel
Save