|
|
@ -1,7 +1,7 @@ |
|
|
|
<template> |
|
|
|
<ContentWrap> |
|
|
|
<!-- 搜索工作栏 --> |
|
|
|
<Search :schema="RelegateRecordMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
<Search :schema="[...RelegateRecordMain.allSchemas.searchSchema, ...RelegateRecordDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
@ -27,9 +27,9 @@ |
|
|
|
v-model:currentPage="tableObject.currentPage" |
|
|
|
v-model:sort="tableObject.sort" |
|
|
|
> |
|
|
|
<template #code="{row}"> |
|
|
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|
|
|
<span>{{ row.code }}</span> |
|
|
|
<template #number="{row}"> |
|
|
|
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> |
|
|
|
<span>{{ row.number }}</span> |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
<template #action="{ row }"> |
|
|
@ -41,29 +41,44 @@ |
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
|
<BasicForm |
|
|
|
ref="basicFormRef" |
|
|
|
@success="formsSuccess" |
|
|
|
:isOpenSearchTable="true" |
|
|
|
@success="getList" |
|
|
|
:rules="RelegateRecordMainRules" |
|
|
|
:formAllSchemas="RelegateRecordMain.allSchemas" |
|
|
|
:tableAllSchemas="RelegateRecordDetail.allSchemas" |
|
|
|
:tableFormRules="RelegateRecordDetailRules" |
|
|
|
:apiUpdate="RelegateRecordMainApi.updateRelegateRecordMain" |
|
|
|
:apiCreate="RelegateRecordMainApi.createRelegateRecordMain" |
|
|
|
:isBusiness="true" |
|
|
|
fromeWhere="RelegateRecordMain" |
|
|
|
@submitForm="submitForm" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
:isBusiness="false" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="RelegateRecordMain.allSchemas" /> |
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
|
<ImportForm ref="importFormRef" url="/wms/relegate-record-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|
|
|
<Detail |
|
|
|
ref="detailRef" |
|
|
|
:isBasic="true" |
|
|
|
:allSchemas="RelegateRecordMain.allSchemas" |
|
|
|
:detailAllSchemas="RelegateRecordDetail.allSchemas" |
|
|
|
:detailAllSchemasRules="RelegateRecordDetailRules" |
|
|
|
:apiCreate="RelegateRecordDetailApi.createRelegateRecordDetail" |
|
|
|
:apiUpdate="RelegateRecordDetailApi.updateRelegateRecordDetail" |
|
|
|
:apiPage="RelegateRecordDetailApi.getRelegateRecordDetailPage" |
|
|
|
:apiDelete="RelegateRecordDetailApi.deleteRelegateRecordDetail" |
|
|
|
fromeWhere="RelegateRecordMain" |
|
|
|
@searchTableSuccessDetail="searchTableSuccessDetail" |
|
|
|
:detailButtonIsShowAdd="true" |
|
|
|
:detailButtonIsShowDelete="true" /> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { RelegateRecordMain,RelegateRecordMainRules } from './relegate-record-main.data' |
|
|
|
import { RelegateRecordMain,RelegateRecordMainRules,RelegateRecordDetail,RelegateRecordDetailRules } from './relegateRecordMain.data' |
|
|
|
import * as RelegateRecordMainApi from '@/api/wms/relegateRecordMain' |
|
|
|
import * as RelegateRecordDetailApi from '@/api/wms/relegateRecordDetail' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|
|
|
import Detail from '@/components/Detail/src/Detail.vue' |
|
|
|
|
|
|
|
defineOptions({ name: 'RelegateRecordMain' }) |
|
|
@ -74,7 +89,8 @@ const { t } = useI18n() // 国际化 |
|
|
|
const route = useRoute() // 路由信息 |
|
|
|
const routeName = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref(RelegateRecordMain.allSchemas.tableColumns) |
|
|
|
const tableColumns = ref([...RelegateRecordMain.allSchemas.tableColumns,...RelegateRecordDetail.allSchemas.tableMainColumns]) |
|
|
|
|
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
@ -85,13 +101,22 @@ const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// 查询页面返回——详情 |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
formRef.setValues(setV) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
const updataTableColumns = (val) => { |
|
|
|
tableColumns.value = val |
|
|
|
} |
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
|
getListApi: RelegateRecordMainApi.getRelegateRecordMainPage // 分页接口 |
|
|
|
getListApi: RelegateRecordDetailApi.getRelegateRecordDetailPage // 分页接口 |
|
|
|
}) |
|
|
|
|
|
|
|
// 获得表格的各种操作 |
|
|
@ -119,8 +144,6 @@ const HeadButttondata = [ |
|
|
|
const buttonBaseClick = (val, item) => { |
|
|
|
if (val == 'add') { // 新增 |
|
|
|
openForm('create') |
|
|
|
} else if (val == 'import') { // 导入 |
|
|
|
handleImport() |
|
|
|
} else if (val == 'export') { // 导出 |
|
|
|
handleExport() |
|
|
|
} else if (val == 'refresh') { // 刷新 |
|
|
@ -152,19 +175,16 @@ const openForm = (type: string, row?: any) => { |
|
|
|
basicFormRef.value.open(type, row) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* tableForm方法 |
|
|
|
*/ |
|
|
|
const tableFormKeys = {} |
|
|
|
RelegateRecordDetail.allSchemas.tableFormColumns.forEach(item => { |
|
|
|
tableFormKeys[item.field] = item.default ? item.default : '' |
|
|
|
}) |
|
|
|
|
|
|
|
// form表单提交 |
|
|
|
const formsSuccess = async (formType,data) => { |
|
|
|
var isHave =RelegateRecordMain.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; |
|
|
|
const submitForm = async (formType,data) => { |
|
|
|
if (formType === 'create') { |
|
|
|
await RelegateRecordMainApi.createRelegateRecordMain(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
@ -211,20 +231,6 @@ const handleExport = async () => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** 导入 */ |
|
|
|
const importFormRef = ref() |
|
|
|
const handleImport = () => { |
|
|
|
importFormRef.value.open() |
|
|
|
} |
|
|
|
// 导入附件弹窗所需的参数 |
|
|
|
const importTemplateData = reactive({ |
|
|
|
templateUrl: '', |
|
|
|
templateTitle: '物料降级记录主导入模版.xlsx' |
|
|
|
}) |
|
|
|
// 导入成功之后 |
|
|
|
const importSuccess = () => { |
|
|
|
getList() |
|
|
|
} |
|
|
|
|
|
|
|
// 筛选提交 |
|
|
|
const searchFormClick = (searchData) => { |
|
|
@ -238,7 +244,6 @@ const searchFormClick = (searchData) => { |
|
|
|
/** 初始化 **/ |
|
|
|
onMounted(async () => { |
|
|
|
getList() |
|
|
|
importTemplateData.templateUrl = await RelegateRecordMainApi.importTemplate() |
|
|
|
}) |
|
|
|
|
|
|
|
</script> |
|
|
|