|
@ -5,103 +5,117 @@ |
|
|
</ContentWrap> |
|
|
</ContentWrap> |
|
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
<!-- 列表头部 --> |
|
|
<TableHead |
|
|
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName" |
|
|
:HeadButttondata="HeadButttondata" |
|
|
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" |
|
|
@button-base-click="buttonBaseClick" |
|
|
:allSchemas="ItemApplyMain.allSchemas" /> |
|
|
:routeName="routeName" |
|
|
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
|
|
:allSchemas="ItemApplyMain.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" |
|
|
<template #number="{row}"> |
|
|
v-model:sort="tableObject.sort" |
|
|
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> |
|
|
> |
|
|
<span>{{ row.number }}</span> |
|
|
<template #code="{row}"> |
|
|
|
|
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|
|
|
|
|
<span>{{ row.code }}</span> |
|
|
|
|
|
</el-button> |
|
|
</el-button> |
|
|
</template> |
|
|
</template> |
|
|
<template #action="{ row }"> |
|
|
<template #action="{ row }"> |
|
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|
|
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> |
|
|
</template> |
|
|
</template> |
|
|
</Table> |
|
|
</Table> |
|
|
</ContentWrap> |
|
|
</ContentWrap> |
|
|
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
<BasicForm |
|
|
<BasicForm ref="formRef" @success="getList" :rules="ItemApplyMainRules" :formAllSchemas="ItemApplyMain.allSchemas" |
|
|
ref="basicFormRef" |
|
|
:tableAllSchemas="ItemApplyDetail.allSchemas" :tableFormRules="ItemApplyDetailRules" :tableData="tableData" |
|
|
@success="formsSuccess" |
|
|
:apiUpdate="ItemApplyMainApi.updateItemApplyMain" :apiCreate="ItemApplyMainApi.createItemApplyMain" :isBusiness="true" |
|
|
:rules="ItemApplyMainRules" |
|
|
@handleAddTable="handleAddTable" @handleDeleteTable="handleDeleteTable" @searchTableSuccess="searchTableSuccess" |
|
|
:formAllSchemas="ItemApplyMain.allSchemas" |
|
|
@submitForm="submitForm" /> |
|
|
:apiUpdate="ItemApplyMainApi.updateItemApplyMain" |
|
|
|
|
|
:apiCreate="ItemApplyMainApi.createItemApplyMain" |
|
|
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
|
|
:isBusiness="false" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
<!-- 详情 --> |
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="ItemApplyMain.allSchemas" /> |
|
|
<Detail ref="detailRef" :isBasic="false" :allSchemas="ItemApplyMain.allSchemas" |
|
|
|
|
|
:detailAllSchemas="ItemApplyDetail.allSchemas" :detailAllSchemasRules="ItemApplyDetailRules" |
|
|
|
|
|
:apiCreate="ItemApplyDetailApi.createItemApplyDetail" :apiUpdate="ItemApplyDetailApi.updateItemApplyDetail" |
|
|
|
|
|
:apiPage="ItemApplyDetailApi.getItemApplyDetailPage" :apiDelete="ItemApplyDetailApi.deleteItemApplyDetail" :Echo="Echo" |
|
|
|
|
|
@searchTableSuccessDetail="searchTableSuccessDetail" /> |
|
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
<!-- 导入 --> |
|
|
<ImportForm ref="importFormRef" url="/eam/item-apply-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|
|
<ImportForm 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 { ItemApplyMain,ItemApplyMainRules } from './itemApplyMain.data' |
|
|
import {ItemApplyMain, ItemApplyMainRules, ItemApplyDetail, ItemApplyDetailRules} from './itemApplyMain.data' |
|
|
import * as ItemApplyMainApi from '@/api/eam/item/itemApplyMain' |
|
|
import * as ItemApplyMainApi from '@/api/eam/item/itemApplyMain' |
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
import * as ItemApplyDetailApi from '@/api/eam/item/itemApplyDetail' |
|
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
import Detail from '@/components/Detail/src/Detail.vue' |
|
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|
|
|
|
|
|
|
|
defineOptions({ name: 'ItemApplyMain' }) |
|
|
// 采购订单 |
|
|
|
|
|
defineOptions({ name: 'ItemApplyMain' }) |
|
|
const message = useMessage() // 消息弹窗 |
|
|
|
|
|
const { t } = useI18n() // 国际化 |
|
|
const message = useMessage() // 消息弹窗 |
|
|
|
|
|
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(ItemApplyMain.allSchemas.tableColumns) |
|
|
const tableColumns = ref(ItemApplyMain.allSchemas.tableColumns) |
|
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
// 字段设置 更新主列表字段 |
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
const updataTableColumns = (val) => { |
|
|
nextTick(() => { |
|
|
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'] |
|
|
|
|
|
|
|
|
|
|
|
}else { |
|
|
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) => { |
|
|
|
|
|
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 updataTableColumns = (val) => { |
|
|
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom'] |
|
|
tableColumns.value = val |
|
|
const Echo = [] |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
getListApi: ItemApplyMainApi.getItemApplyMainPage // 分页接口 |
|
|
getListApi: ItemApplyMainApi.getItemApplyMainPage // 分页接口 |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
// 获得表格的各种操作 |
|
|
// 获得表格的各种操作 |
|
|
const { getList, setSearchParams } = tableMethods |
|
|
const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
// 列表头部按钮 |
|
|
const HeadButttondata = [ |
|
|
const HeadButttondata = [ |
|
|
defaultButtons.defaultAddBtn({hasPermi:'eam:itemApplyMain:create'}), // 新增 |
|
|
defaultButtons.defaultAddBtn(null), // 新增 |
|
|
defaultButtons.defaultImportBtn({hasPermi:'eam:itemApplyMain:import'}), // 导入 |
|
|
defaultButtons.defaultImportBtn(null), // 导入 |
|
|
defaultButtons.defaultExportBtn({hasPermi:'eam:itemApplyMain:export'}), // 导出 |
|
|
defaultButtons.defaultExportBtn(null), // 导出 |
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
@ -113,10 +127,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') { // 导入 |
|
@ -129,61 +143,49 @@ const buttonBaseClick = (val, item) => { |
|
|
} else { // 其他按钮 |
|
|
} else { // 其他按钮 |
|
|
console.log('其他按钮', item) |
|
|
console.log('其他按钮', item) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
// 根据状态返回该按钮是否显示 |
|
|
const butttondata = [ |
|
|
const isShowMainButton = (row, val) => { |
|
|
defaultButtons.mainListEditBtn({hasPermi:'eam:itemApplyMain:update'}), // 编辑 |
|
|
if (val.indexOf(row.status) > -1) { |
|
|
defaultButtons.mainListDeleteBtn({hasPermi:'eam:itemApplyMain:delete'}), // 删除 |
|
|
return false |
|
|
] |
|
|
} else { |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
|
|
|
const butttondata = (row) => { |
|
|
|
|
|
return [ |
|
|
|
|
|
defaultButtons.mainListEditBtn(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 == 'delete') { // 删除 |
|
|
} else if (val == 'delete') { // 删除 |
|
|
handleDelete(row.id) |
|
|
handleDelete(row.id) |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
|
|
|
const basicFormRef = ref() |
|
|
|
|
|
const openForm = (type: string, row?: any) => { |
|
|
|
|
|
basicFormRef.value.open(type, row) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// form表单提交 |
|
|
|
|
|
const formsSuccess = async (formType,data) => { |
|
|
|
|
|
var isHave =ItemApplyMain.allSchemas.formSchema.some(function (item) { |
|
|
|
|
|
return item.field === 'activeTime' || item.field === 'expireTime'; |
|
|
|
|
|
}); |
|
|
|
|
|
if(isHave){ |
|
|
|
|
|
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|
|
|
|
|
message.error('失效时间要大于生效时间') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
if(data.activeTime==0)data.activeTime = null; |
|
|
|
|
|
if(data.expireTime==0)data.expireTime = null; |
|
|
/** 添加/修改操作 */ |
|
|
if (formType === 'create') { |
|
|
const formRef = ref() |
|
|
await ItemApplyMainApi.createItemApplyMain(data) |
|
|
const openForm = async (type : string, row ?: number) => { |
|
|
message.success(t('common.createSuccess')) |
|
|
tableData.value = [] // 重置明细数据 |
|
|
} else { |
|
|
formRef.value.open(type, row) |
|
|
await ItemApplyMainApi.updateItemApplyMain(data) |
|
|
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
|
|
} |
|
|
} |
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
|
|
getList() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 详情操作 */ |
|
|
/** 详情操作 */ |
|
|
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, 'basicItemApplyMain') |
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicItemApplyMain') |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** 删除按钮操作 */ |
|
|
/** 删除按钮操作 */ |
|
|
const handleDelete = async (id: number) => { |
|
|
const handleDelete = async (id : number) => { |
|
|
try { |
|
|
try { |
|
|
// 删除的二次确认 |
|
|
// 删除的二次确认 |
|
|
await message.delConfirm() |
|
|
await message.delConfirm() |
|
@ -192,12 +194,12 @@ const handleDelete = async (id: number) => { |
|
|
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() |
|
@ -209,36 +211,74 @@ const handleExport = async () => { |
|
|
} finally { |
|
|
} finally { |
|
|
exportLoading.value = false |
|
|
exportLoading.value = false |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* tableForm方法 |
|
|
|
|
|
*/ |
|
|
|
|
|
const tableFormKeys = {} |
|
|
|
|
|
ItemApplyDetail.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 ItemApplyMainApi.createItemApplyMain(data) |
|
|
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
|
|
} else { |
|
|
|
|
|
await ItemApplyMainApi.updateItemApplyMain(data) |
|
|
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
|
|
} |
|
|
|
|
|
formRef.value.dialogVisible = false |
|
|
|
|
|
// 刷新当前列表 |
|
|
|
|
|
getList() |
|
|
|
|
|
} finally { |
|
|
|
|
|
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 ItemApplyMainApi.importTemplate() |
|
|
importTemplateData.templateUrl = await ItemApplyMainApi.importTemplate() |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
</script> |
|
|
</script> |
|
|