Browse Source

BUG修改

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

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

@ -1,309 +1,371 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="ApplicationRecordMain.allSchemas.searchSchema" @search="setSearchParams"
@reset="setSearchParams" />
<Search
:schema="ApplicationRecordMain.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick"
:allSchemas="ApplicationRecordMain.allSchemas" />
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ApplicationRecordMain.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort">
<template #number="{row}">
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #number="{ row }">
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase
:Butttondata="butttondata(row)"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm ref="formRef" @success="getList" :rules="ApplicationRecordMainRules"
:formAllSchemas="ApplicationRecordMain.allSchemas" :tableAllSchemas="ApplicationRecordDetail.allSchemas"
:tableFormRules="ApplicationRecordDetailRules" :tableData="tableData"
<BasicForm
ref="formRef"
@success="getList"
:rules="ApplicationRecordMainRules"
:formAllSchemas="ApplicationRecordMain.allSchemas"
:tableAllSchemas="ApplicationRecordDetail.allSchemas"
:tableFormRules="ApplicationRecordDetailRules"
:tableData="tableData"
:apiUpdate="ApplicationRecordMainApi.updateApplicationRecordMain"
:apiCreate="ApplicationRecordMainApi.createApplicationRecordMain" :isBusiness="true"
@handleAddTable="handleAddTable" @handleDeleteTable="handleDeleteTable" @searchTableSuccess="searchTableSuccess"
@submitForm="submitForm" />
:apiCreate="ApplicationRecordMainApi.createApplicationRecordMain"
:isBusiness="true"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="false" :allSchemas="ApplicationRecordMain.allSchemas"
:detailAllSchemas="ApplicationRecordDetail.allSchemas" :detailAllSchemasRules="ApplicationRecordDetailRules"
<Detail
ref="detailRef"
:isBasic="false"
:allSchemas="ApplicationRecordMain.allSchemas"
:detailAllSchemas="ApplicationRecordDetail.allSchemas"
:detailAllSchemasRules="ApplicationRecordDetailRules"
:apiCreate="ApplicationRecordDetailApi.createApplicationRecordDetail"
:apiUpdate="ApplicationRecordDetailApi.updateApplicationRecordDetail"
:apiPage="ApplicationRecordDetailApi.getApplicationRecordDetailPage"
:apiDelete="ApplicationRecordDetailApi.deleteApplicationRecordDetail"
@searchTableSuccessDetail="searchTableSuccessDetail"
@searchTableSuccessDetail="searchTableSuccessDetail"
:isShowAddBtn="false"
:detailButtonIsShow="true" />
:detailButtonIsShow="true"
/>
<!-- 审批详情 -->
<approveDetail ref="detailRef1" :isBasic="false" :allSchemas="ApplicationRecordMain.allSchemas"
:detailAllSchemas="ApplicationRecordDetail.allSchemas" :detailAllSchemasRules="ApplicationRecordDetailRules"
<!-- <approveDetail
ref="detailRef1"
:isBasic="false"
:allSchemas="ApplicationRecordMain.allSchemas"
:detailAllSchemas="ApplicationRecordDetail.allSchemas"
:detailAllSchemasRules="ApplicationRecordDetailRules"
:apiAgree="ApplicationRecordMainApi.agreeApplicationRecordMain"
:apiDisAgree="ApplicationRecordMainApi.disAgreeApplicationRecordMain"
:apiPage="ApplicationRecordDetailApi.getApplicationRecordDetailPage"
@searchTableSuccessDetail="searchTableSuccessDetail"
@agree="getList"/>
@searchTableSuccessDetail="searchTableSuccessDetail"
@agree="getList"
/> -->
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/purchase-main/import" :importTemplateData="importTemplateData"
@success="importSuccess" :isShowOut="true" :updateIsDisable="true" :coverIsDisable="true" :mode="2" />
<ImportForm
ref="importFormRef"
url="/wms/purchase-main/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
:isShowOut="true"
:updateIsDisable="true"
:coverIsDisable="true"
:mode="2"
/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { ApplicationRecordMain, ApplicationRecordMainRules, ApplicationRecordDetail, ApplicationRecordDetailRules } from './applicationRecordMain.data'
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'
import download from '@/utils/download'
import {
ApplicationRecordMain,
ApplicationRecordMainRules,
ApplicationRecordDetail,
ApplicationRecordDetailRules
} from './applicationRecordMain.data'
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 { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(ApplicationRecordMain.allSchemas.tableColumns)
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(ApplicationRecordMain.allSchemas.tableColumns)
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(async () => {
if (type == 'tableForm') {
//
row[formField] = val[0][searchField]
row['itemNumber'] = val[0]['number']
row['isRadeIn'] = val[0]['isRadeIn']
row['available'] = val[0]['available']
} else {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
}
})
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(async () => {
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(async () => {
if (type == 'tableForm') {
//
row[formField] = val[0][searchField]
row['itemNumber'] = val[0]['number']
row['isRadeIn'] = val[0]['isRadeIn']
row['available'] = val[0]['available']
} else {
const setV = {}
// if(formField == 'itemCode'){
// await ItembasicApi.getItembasicPage({
// code: setV['itemCode']
// }).then(res => {
// setV['uom'] = res.list[0].uom
// setV[formField] = val[0][searchField]
// })
// }
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
}
})
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(async () => {
const setV = {}
// if(formField == 'itemCode'){
// await ItembasicApi.getItembasicPage({
// code: setV['itemCode']
// }).then(res => {
// setV['uom'] = res.list[0].uom
// setV[formField] = val[0][searchField]
// })
// }
formRef.setValues(setV)
})
}
//
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
const Echo = []
//
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
const Echo = []
const { tableObject, tableMethods } = useTable({
getListApi: ApplicationRecordMainApi.getApplicationRecordMainPage //
})
const { tableObject, tableMethods } = useTable({
getListApi: ApplicationRecordMainApi.getApplicationRecordMainPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
// defaultButtons.defaultAddBtn(null), //
// defaultButtons.defaultImportBtn(null), //
// defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const HeadButttondata = [
// defaultButtons.defaultAddBtn(null), //
// defaultButtons.defaultImportBtn(null), //
// defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
//
const buttonBaseClick = (val, item) => {
if (val == 'add') {
//
openForm('create')
} 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) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
//
const isShowMainButton = (row, val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
// -
const butttondata = (row) => {
return [
defaultButtons.approveBtn({ hide: isShowMainButton(row, ['0']) ,hasPermi:'item:itemApplyMain:approve'}), //
// defaultButtons.mainListEditBtn(null), //
// defaultButtons.mainListDeleteBtn(null), //
]
}
// -
const butttondata = (row) => {
return [
defaultButtons.approveBtn({
hide: isShowMainButton(row, ['0']),
hasPermi: 'item:itemApplyMain:approve'
}) //
// defaultButtons.mainListEditBtn(null), //
// defaultButtons.mainListDeleteBtn(null), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'approve') { //
handleApprove(row, '单据号', row.number)
} else if (val == 'delete') { //
handleDelete(row.id)
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'approve') {
//
handleApprove(row, '单据号', row.number)
} else if (val == 'delete') {
//
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = async (type : string, row ?: number) => {
tableData.value = [] //
formRef.value.open(type, row)
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = async (type: string, row?: number) => {
tableData.value = [] //
formRef.value.open(type, row)
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row : any, titleName : any, titleValue : any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicApplicationRecordMain')
}
const detailRef1 = ref()
const handleApprove = (row : any, titleName : any, titleValue : any) => {
detailRef1.value.openDetail(row, titleName, titleValue, 'basicApplicationRecordMain')
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicApplicationRecordMain')
}
const detailRef1 = ref()
const handleApprove = (row: any, titleName: any, titleValue: any) => {
detailRef1.value.openDetail(row, titleName, titleValue, 'basicApplicationRecordMain')
//
getList()
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await ApplicationRecordMainApi.deleteApplicationRecordMain(id)
message.success(t('common.delSuccess'))
//
getList()
}
await getList()
} catch {}
}
/** 删除按钮操作 */
const handleDelete = async (id : number) => {
try {
//
await message.delConfirm()
//
await ApplicationRecordMainApi.deleteApplicationRecordMain(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 ApplicationRecordMainApi.exportApplicationRecordMain(tableObject.params)
download.excel(data, '备件申领记录主.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await ApplicationRecordMainApi.exportApplicationRecordMain(tableObject.params)
download.excel(data, '备件申领记录主.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/**
* tableForm方法
*/
const tableFormKeys = {}
ApplicationRecordDetail.allSchemas.tableFormColumns.forEach((item) => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
/**
* tableForm方法
*/
const tableFormKeys = {}
ApplicationRecordDetail.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 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 ApplicationRecordMainApi.createApplicationRecordMain(data)
message.success(t('common.createSuccess'))
} else {
await ApplicationRecordMainApi.updateApplicationRecordMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
//
const submitForm = async (formType, data) => {
data.subList = tableData.value //
try {
if (formType === 'create') {
await ApplicationRecordMainApi.createApplicationRecordMain(data)
message.success(t('common.createSuccess'))
} else {
await ApplicationRecordMainApi.updateApplicationRecordMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '采购订单主导入模版.xlsx'
})
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '采购订单主导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await ApplicationRecordMainApi.importTemplate()
})
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await ApplicationRecordMainApi.importTemplate()
})
</script>

Loading…
Cancel
Save