Browse Source

BUG修改

master_hella_20240701
parent
commit
6011f08440
  1. 324
      src/views/eam/applicationRecord/index.vue

324
src/views/eam/applicationRecord/index.vue

@ -1,91 +1,141 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="ApplicationRecordMain.allSchemas.searchSchema" @search="setSearchParams" <Search
@reset="setSearchParams" /> :schema="ApplicationRecordMain.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName" <TableHead
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" :HeadButttondata="HeadButttondata"
:allSchemas="ApplicationRecordMain.allSchemas" /> @button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ApplicationRecordMain.allSchemas"
/>
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{ <Table
: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:sort="tableObject.sort"> v-model:pageSize="tableObject.pageSize"
<template #number="{row}"> v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<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>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase
:Butttondata="butttondata(row)"
@button-base-click="buttonTableClick($event, row)"
/>
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm ref="formRef" @success="getList" :rules="ApplicationRecordMainRules" <BasicForm
:formAllSchemas="ApplicationRecordMain.allSchemas" :tableAllSchemas="ApplicationRecordDetail.allSchemas" ref="formRef"
:tableFormRules="ApplicationRecordDetailRules" :tableData="tableData" @success="getList"
:rules="ApplicationRecordMainRules"
:formAllSchemas="ApplicationRecordMain.allSchemas"
:tableAllSchemas="ApplicationRecordDetail.allSchemas"
:tableFormRules="ApplicationRecordDetailRules"
:tableData="tableData"
:apiUpdate="ApplicationRecordMainApi.updateApplicationRecordMain" :apiUpdate="ApplicationRecordMainApi.updateApplicationRecordMain"
:apiCreate="ApplicationRecordMainApi.createApplicationRecordMain" :isBusiness="true" :apiCreate="ApplicationRecordMainApi.createApplicationRecordMain"
@handleAddTable="handleAddTable" @handleDeleteTable="handleDeleteTable" @searchTableSuccess="searchTableSuccess" :isBusiness="true"
@submitForm="submitForm" /> @handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
/>
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="false" :allSchemas="ApplicationRecordMain.allSchemas" <Detail
:detailAllSchemas="ApplicationRecordDetail.allSchemas" :detailAllSchemasRules="ApplicationRecordDetailRules" ref="detailRef"
:isBasic="false"
:allSchemas="ApplicationRecordMain.allSchemas"
:detailAllSchemas="ApplicationRecordDetail.allSchemas"
:detailAllSchemasRules="ApplicationRecordDetailRules"
:apiCreate="ApplicationRecordDetailApi.createApplicationRecordDetail" :apiCreate="ApplicationRecordDetailApi.createApplicationRecordDetail"
:apiUpdate="ApplicationRecordDetailApi.updateApplicationRecordDetail" :apiUpdate="ApplicationRecordDetailApi.updateApplicationRecordDetail"
:apiPage="ApplicationRecordDetailApi.getApplicationRecordDetailPage" :apiPage="ApplicationRecordDetailApi.getApplicationRecordDetailPage"
:apiDelete="ApplicationRecordDetailApi.deleteApplicationRecordDetail" :apiDelete="ApplicationRecordDetailApi.deleteApplicationRecordDetail"
@searchTableSuccessDetail="searchTableSuccessDetail" @searchTableSuccessDetail="searchTableSuccessDetail"
:isShowAddBtn="false" :isShowAddBtn="false"
:detailButtonIsShow="true" /> :detailButtonIsShow="true"
/>
<!-- 审批详情 --> <!-- 审批详情 -->
<approveDetail ref="detailRef1" :isBasic="false" :allSchemas="ApplicationRecordMain.allSchemas" <!-- <approveDetail
:detailAllSchemas="ApplicationRecordDetail.allSchemas" :detailAllSchemasRules="ApplicationRecordDetailRules" ref="detailRef1"
:isBasic="false"
:allSchemas="ApplicationRecordMain.allSchemas"
:detailAllSchemas="ApplicationRecordDetail.allSchemas"
:detailAllSchemasRules="ApplicationRecordDetailRules"
:apiAgree="ApplicationRecordMainApi.agreeApplicationRecordMain" :apiAgree="ApplicationRecordMainApi.agreeApplicationRecordMain"
:apiDisAgree="ApplicationRecordMainApi.disAgreeApplicationRecordMain" :apiDisAgree="ApplicationRecordMainApi.disAgreeApplicationRecordMain"
:apiPage="ApplicationRecordDetailApi.getApplicationRecordDetailPage" :apiPage="ApplicationRecordDetailApi.getApplicationRecordDetailPage"
@searchTableSuccessDetail="searchTableSuccessDetail" @searchTableSuccessDetail="searchTableSuccessDetail"
@agree="getList"/> @agree="getList"
/> -->
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/purchase-main/import" :importTemplateData="importTemplateData" <ImportForm
@success="importSuccess" :isShowOut="true" :updateIsDisable="true" :coverIsDisable="true" :mode="2" /> ref="importFormRef"
url="/wms/purchase-main/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
:isShowOut="true"
:updateIsDisable="true"
:coverIsDisable="true"
:mode="2"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { ApplicationRecordMain, ApplicationRecordMainRules, ApplicationRecordDetail, ApplicationRecordDetailRules } from './applicationRecordMain.data' import {
import * as ApplicationRecordMainApi from '@/api/eam/applicationRecordMain' ApplicationRecordMain,
import * as ApplicationRecordDetailApi from '@/api/eam/applicationRecordDetail' ApplicationRecordMainRules,
import * as defaultButtons from '@/utils/disposition/defaultButtons' ApplicationRecordDetail,
import TableHead from '@/components/TableHead/src/TableHead.vue' ApplicationRecordDetailRules
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' } from './applicationRecordMain.data'
import approveDetail from '@/components/Detail/src/approveDetail.vue' import * as ApplicationRecordMainApi from '@/api/eam/applicationRecordMain'
import * as ApplicationRecordDetailApi from '@/api/eam/applicationRecordDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import approveDetail from '@/components/Detail/src/approveDetail.vue'
// //
defineOptions({ name: 'ApplicationRecord' }) defineOptions({ name: 'ApplicationRecord' })
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(ApplicationRecordMain.allSchemas.tableColumns) const tableColumns = ref(ApplicationRecordMain.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') {
// //
@ -99,9 +149,9 @@
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 = {}
// if(formField == 'itemCode'){ // if(formField == 'itemCode'){
@ -114,27 +164,27 @@
// } // }
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: ApplicationRecordMainApi.getApplicationRecordMainPage // getListApi: ApplicationRecordMainApi.getApplicationRecordMainPage //
}) })
// //
const { getList, setSearchParams } = tableMethods const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
// defaultButtons.defaultAddBtn(null), // // defaultButtons.defaultAddBtn(null), //
// defaultButtons.defaultImportBtn(null), // // defaultButtons.defaultImportBtn(null), //
// defaultButtons.defaultExportBtn(null), // // defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null) //
// { // {
// label: '', // label: '',
// name: 'zdy', // name: 'zdy',
@ -143,74 +193,86 @@
// 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') {
//
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)
} }
} }
// //
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.approveBtn({ hide: isShowMainButton(row, ['0']) ,hasPermi:'item:itemApplyMain:approve'}), // defaultButtons.approveBtn({
hide: isShowMainButton(row, ['0']),
hasPermi: 'item:itemApplyMain:approve'
}) //
// defaultButtons.mainListEditBtn(null), // // defaultButtons.mainListEditBtn(null), //
// defaultButtons.mainListDeleteBtn(null), // // defaultButtons.mainListDeleteBtn(null), //
] ]
} }
// - // -
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 == 'approve') { // } else if (val == 'approve') {
//
handleApprove(row, '单据号', row.number) handleApprove(row, '单据号', row.number)
} 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, 'basicApplicationRecordMain') detailRef.value.openDetail(row, titleName, titleValue, 'basicApplicationRecordMain')
} }
const detailRef1 = ref() const detailRef1 = ref()
const handleApprove = (row : any, titleName : any, titleValue : any) => { const handleApprove = (row: any, titleName: any, titleValue: any) => {
detailRef1.value.openDetail(row, titleName, titleValue, 'basicApplicationRecordMain') detailRef1.value.openDetail(row, titleName, titleValue, 'basicApplicationRecordMain')
// //
getList() getList()
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id : number) => { const handleDelete = async (id: number) => {
try { try {
// //
await message.delConfirm() await message.delConfirm()
@ -219,12 +281,12 @@
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
} catch { } } catch {}
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
const exportLoading = ref(false) // const exportLoading = ref(false) //
const handleExport = async () => { const handleExport = async () => {
try { try {
// //
await message.exportConfirm() await message.exportConfirm()
@ -236,28 +298,28 @@
} finally { } finally {
exportLoading.value = false exportLoading.value = false
} }
} }
/** /**
* tableForm方法 * tableForm方法
*/ */
const tableFormKeys = {} const tableFormKeys = {}
ApplicationRecordDetail.allSchemas.tableFormColumns.forEach(item => { ApplicationRecordDetail.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') {
@ -273,37 +335,37 @@
} 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: '采购订单主导入模版.xlsx' 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 ApplicationRecordMainApi.importTemplate() importTemplateData.templateUrl = await ApplicationRecordMainApi.importTemplate()
}) })
</script> </script>

Loading…
Cancel
Save