|
@ -1,69 +1,100 @@ |
|
|
<template> |
|
|
<template> |
|
|
<div> |
|
|
<div> |
|
|
<el-drawer v-model="isShowDrawer" title="详情" direction="rtl" size="80%" v-loading="detailLoading"> |
|
|
<el-drawer |
|
|
<template #header> |
|
|
v-model="isShowDrawer" |
|
|
<div class="font-size-18px"> |
|
|
title="详情" |
|
|
{{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span> |
|
|
direction="rtl" |
|
|
</div> |
|
|
size="80%" |
|
|
</template> |
|
|
v-loading="detailLoading" |
|
|
<ContentWrap v-if="!isBasic"> |
|
|
> |
|
|
<Descriptions :data="detailData" labelClassName="label-class-name" label-align="left" direction="vertical" |
|
|
<template #header> |
|
|
:column="8" :schema="allSchemas.detailSchema" :columns="2" width="200px" /> |
|
|
<div class="font-size-18px"> |
|
|
</ContentWrap> |
|
|
{{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span> |
|
|
|
|
|
</div> |
|
|
<Tabs :tabsList="tabsList" :current="current" @change="change" /> |
|
|
</template> |
|
|
<div class="flex" v-if="current == 0"> |
|
|
<ContentWrap v-if="!isBasic"> |
|
|
<!-- 详情 --> |
|
|
<Descriptions |
|
|
<ContentWrap class="w-[73%]"> |
|
|
:data="detailData" |
|
|
<!-- 列表头部 --> |
|
|
labelClassName="label-class-name" |
|
|
<TableHead |
|
|
label-align="left" |
|
|
v-if="!isBasic" |
|
|
direction="vertical" |
|
|
:HeadButttondata="HeadButttondata" |
|
|
:column="8" |
|
|
:masterId="masterParmas.masterId" |
|
|
:schema="allSchemas.detailSchema" |
|
|
@button-base-click="buttonBaseClick" |
|
|
:columns="2" |
|
|
:routeName="routeName" |
|
|
width="200px" |
|
|
@searchFormClick="searchFormClick" |
|
|
|
|
|
:allSchemas="detailAllSchemas" |
|
|
|
|
|
/> |
|
|
/> |
|
|
<Descriptions v-if="isBasic" :data="detailData" :schema="allSchemas.detailSchema" :columns="2" /> |
|
|
|
|
|
<Table |
|
|
|
|
|
v-if="!isBasic" |
|
|
|
|
|
:columns="detailAllSchemas.tableColumns" |
|
|
|
|
|
:data="tableObject.tableList" |
|
|
|
|
|
:loading="tableObject.loading" |
|
|
|
|
|
:pagination="{ total: tableObject.total }" |
|
|
|
|
|
v-model:pageSize="tableObject.pageSize" |
|
|
|
|
|
v-model:currentPage="tableObject.currentPage" > |
|
|
|
|
|
<template #action="{ row }"> |
|
|
|
|
|
<ButtonBase :Butttondata="buttondata" @button-base-click="buttonTableClick($event, row)" /> |
|
|
|
|
|
</template> |
|
|
|
|
|
</Table> |
|
|
|
|
|
</ContentWrap> |
|
|
|
|
|
<ContentWrap class="w-[27%] ml-16px"> |
|
|
|
|
|
<!-- 附件组件 --> |
|
|
|
|
|
<Annex :annexData="annexData" @handleAnnexSuccess="handleAnnexSuccess" @deleteAnnexSuccess="deleteAnnexSuccess" :upData="remarksData.data"/> |
|
|
|
|
|
<!-- 备注组件 --> |
|
|
|
|
|
<Remarks :remarksData="remarksData" class="mt-20px" |
|
|
|
|
|
@remarksSubmitScuess="remarksSubmitScuess" /> |
|
|
|
|
|
<!-- 变更记录组件 --> |
|
|
|
|
|
<ChangeRecord :changeRecordData="changeRecordData" class="mt-20px" /> |
|
|
|
|
|
</ContentWrap> |
|
|
</ContentWrap> |
|
|
</div> |
|
|
|
|
|
</el-drawer> |
|
|
<Tabs :tabsList="tabsList" :current="current" @change="change" /> |
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
<div class="flex"> |
|
|
<BasicForm |
|
|
<!-- 详情 --> |
|
|
ref="formRef" |
|
|
<ContentWrap class="w-[73%]"> |
|
|
@success="getList" |
|
|
<!-- 列表头部 --> |
|
|
:rules="detailAllSchemasRules" |
|
|
<TableHead |
|
|
:formAllSchemas="detailAllSchemas" |
|
|
v-if="!isBasic" |
|
|
:isBusiness="false" |
|
|
:HeadButttondata="HeadButttondata" |
|
|
:apiUpdate="apiUpdate" |
|
|
:masterId="masterParmas.masterId" |
|
|
:apiCreate="apiCreate" |
|
|
@button-base-click="buttonBaseClick" |
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
:routeName="routeName" |
|
|
:detailData="detailData" |
|
|
@searchFormClick="searchFormClick" |
|
|
@submitForm="submitForm" |
|
|
:allSchemas="detailAllSchemas" |
|
|
/> |
|
|
/> |
|
|
</div> |
|
|
<Descriptions |
|
|
|
|
|
v-if="isBasic" |
|
|
|
|
|
:data="detailData" |
|
|
|
|
|
:schema="allSchemas.detailSchema" |
|
|
|
|
|
:columns="2" |
|
|
|
|
|
/> |
|
|
|
|
|
<Table |
|
|
|
|
|
v-if="!isBasic" |
|
|
|
|
|
:columns="detailAllSchemasRef.tableColumns" |
|
|
|
|
|
:data="tableObjectRef.tableList" |
|
|
|
|
|
:loading="tableObjectRef.loading" |
|
|
|
|
|
:pagination="{ total: tableObjectRef.total }" |
|
|
|
|
|
v-model:pageSize="tableObjectRef.pageSize" |
|
|
|
|
|
v-model:currentPage="tableObjectRef.currentPage" |
|
|
|
|
|
> |
|
|
|
|
|
<template #action="{ row }"> |
|
|
|
|
|
<ButtonBase |
|
|
|
|
|
:Butttondata="buttondata" |
|
|
|
|
|
@button-base-click="buttonTableClick($event, row)" |
|
|
|
|
|
/> |
|
|
|
|
|
</template> |
|
|
|
|
|
</Table> |
|
|
|
|
|
</ContentWrap> |
|
|
|
|
|
<ContentWrap class="w-[27%] ml-16px"> |
|
|
|
|
|
<!-- 附件组件 --> |
|
|
|
|
|
<Annex |
|
|
|
|
|
:annexData="annexData" |
|
|
|
|
|
@handleAnnexSuccess="handleAnnexSuccess" |
|
|
|
|
|
@deleteAnnexSuccess="deleteAnnexSuccess" |
|
|
|
|
|
:upData="remarksData.data" |
|
|
|
|
|
/> |
|
|
|
|
|
<!-- 备注组件 --> |
|
|
|
|
|
<Remarks |
|
|
|
|
|
:remarksData="remarksData" |
|
|
|
|
|
class="mt-20px" |
|
|
|
|
|
@remarksSubmitScuess="remarksSubmitScuess" |
|
|
|
|
|
/> |
|
|
|
|
|
<!-- 变更记录组件 --> |
|
|
|
|
|
<ChangeRecord :changeRecordData="changeRecordData" class="mt-20px" /> |
|
|
|
|
|
</ContentWrap> |
|
|
|
|
|
</div> |
|
|
|
|
|
</el-drawer> |
|
|
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
|
|
|
<BasicForm |
|
|
|
|
|
ref="formRef" |
|
|
|
|
|
@success="submitForm" |
|
|
|
|
|
:rules="detailAllSchemasRules" |
|
|
|
|
|
:formAllSchemas="detailAllSchemas" |
|
|
|
|
|
:isBusiness="false" |
|
|
|
|
|
:apiUpdate="apiUpdate" |
|
|
|
|
|
:apiCreate="apiCreate" |
|
|
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
|
|
:detailData="detailData" |
|
|
|
|
|
@submitForm="submitForm" |
|
|
|
|
|
/> |
|
|
|
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script lang="ts" setup> |
|
|
<script lang="ts" setup> |
|
@ -85,7 +116,7 @@ const { t } = useI18n() // 国际化 |
|
|
const route = useRoute() // 路由信息 |
|
|
const route = useRoute() // 路由信息 |
|
|
const routeName = ref() |
|
|
const routeName = ref() |
|
|
routeName.value = route.name |
|
|
routeName.value = route.name |
|
|
routeName.value = routeName.value.substring(0,routeName.value.length - 4) + 'Detail' |
|
|
routeName.value = routeName.value.substring(0, routeName.value.length - 4) + 'Detail' |
|
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
const props = defineProps({ |
|
|
// 标签参数 |
|
|
// 标签参数 |
|
@ -147,22 +178,31 @@ const props = defineProps({ |
|
|
type: Array, |
|
|
type: Array, |
|
|
required: false, |
|
|
required: false, |
|
|
default: null |
|
|
default: null |
|
|
}, |
|
|
} |
|
|
}) |
|
|
}) |
|
|
const isShowDrawer = ref(false) |
|
|
const isShowDrawer = ref(false) |
|
|
const detailLoading = ref(false) |
|
|
const detailLoading = ref(false) |
|
|
const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : ''))) |
|
|
const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : ''))) |
|
|
|
|
|
|
|
|
if (tabsList.value && tabsList.value.length > 0) { |
|
|
if (props.isBasic == true) { |
|
|
tabsList.value.unshift({ |
|
|
if (tabsList.value && tabsList.value.length > 0) { |
|
|
label: '详情', |
|
|
tabsList.value.unshift({ |
|
|
prop: 'Detail' |
|
|
label: '详情', |
|
|
}) |
|
|
prop: 'Detail' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
tabsList.value = [{ |
|
|
if (tabsList.value && tabsList.value.length > 0) { |
|
|
label: '明细', |
|
|
} else { |
|
|
prop: 'Detail' |
|
|
tabsList.value = [ |
|
|
}] |
|
|
{ |
|
|
|
|
|
label: '明细', |
|
|
|
|
|
prop: 'Detail' |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (tabsList.value) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 附件默认数据 |
|
|
// 附件默认数据 |
|
@ -173,14 +213,14 @@ const annexData = reactive({ |
|
|
// 备注数据 |
|
|
// 备注数据 |
|
|
const remarksData = reactive({ |
|
|
const remarksData = reactive({ |
|
|
remarksList: [], |
|
|
remarksList: [], |
|
|
data:{} |
|
|
data: {} |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
// 变更记录默认数据 |
|
|
// 变更记录默认数据 |
|
|
const changeRecordData = reactive({ |
|
|
const changeRecordData = reactive({ |
|
|
changeRecordList: [] |
|
|
changeRecordList: [] |
|
|
}) |
|
|
}) |
|
|
const detailData = ref({})//详情数据 |
|
|
const detailData = ref({}) //详情数据 |
|
|
// 获取附件列表篇 |
|
|
// 获取附件列表篇 |
|
|
const getFileList = async () => { |
|
|
const getFileList = async () => { |
|
|
detailLoading.value = true |
|
|
detailLoading.value = true |
|
@ -194,11 +234,9 @@ const getFileList = async () => { |
|
|
const handleAnnexSuccess = () => { |
|
|
const handleAnnexSuccess = () => { |
|
|
getFileList() |
|
|
getFileList() |
|
|
getChangeRecordList() |
|
|
getChangeRecordList() |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
// 删除附件成功之后所走的方法 |
|
|
// 删除附件成功之后所走的方法 |
|
|
const deleteAnnexSuccess = async () => { |
|
|
const deleteAnnexSuccess = async () => { |
|
|
|
|
|
|
|
|
getFileList() |
|
|
getFileList() |
|
|
getChangeRecordList() |
|
|
getChangeRecordList() |
|
|
} |
|
|
} |
|
@ -207,13 +245,14 @@ const deleteAnnexSuccess = async () => { |
|
|
const current = ref(0) |
|
|
const current = ref(0) |
|
|
const change = (item, index) => { |
|
|
const change = (item, index) => { |
|
|
current.value = index |
|
|
current.value = index |
|
|
|
|
|
emit('changeTabs', item) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//主表所需的参数 |
|
|
//主表所需的参数 |
|
|
const masterParmas=ref({ |
|
|
const masterParmas = ref({ |
|
|
masterId:'',//主表id |
|
|
masterId: '', //主表id |
|
|
number: '',//主表单据号 |
|
|
number: '', //主表单据号 |
|
|
status: '',//主表状态 用于控制子表新增编辑按钮显示情况 |
|
|
status: '' //主表状态 用于控制子表新增编辑按钮显示情况 |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
// 列表头部按钮 |
|
@ -229,16 +268,16 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName: |
|
|
titleValueRef.value = titleValue |
|
|
titleValueRef.value = titleValue |
|
|
remarksData.data = { |
|
|
remarksData.data = { |
|
|
tableId: row.id, |
|
|
tableId: row.id, |
|
|
tableName: tableName, |
|
|
tableName: tableName |
|
|
} |
|
|
} |
|
|
// 加载明细列表 |
|
|
// 加载明细列表 |
|
|
if(!props.isBasic) { |
|
|
if (!props.isBasic) { |
|
|
// 设置主表id |
|
|
// 设置主表id |
|
|
masterParmas.value.masterId = row.id |
|
|
masterParmas.value.masterId = row.id |
|
|
masterParmas.value.number = row.number |
|
|
masterParmas.value.number = row.number |
|
|
masterParmas.value.status = row.status |
|
|
masterParmas.value.status = row.status |
|
|
tableObject.params = { |
|
|
tableObjectRef.value.params = { |
|
|
masterId: row.id, |
|
|
masterId: row.id |
|
|
} |
|
|
} |
|
|
getList() |
|
|
getList() |
|
|
} |
|
|
} |
|
@ -252,13 +291,19 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName: |
|
|
getChangeRecordList() |
|
|
getChangeRecordList() |
|
|
// 判断详情新增按钮是否显示 |
|
|
// 判断详情新增按钮是否显示 |
|
|
HeadButttondata.value = [ |
|
|
HeadButttondata.value = [ |
|
|
defaultButtons.defaultAddBtn({hide:isShowMainButton(row,['1','1','PLAN_PURCHASE_READY','1'])}), // 新增 |
|
|
defaultButtons.defaultAddBtn({ |
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
hide: isShowMainButton(row, ['1']) |
|
|
|
|
|
}), // 新增 |
|
|
|
|
|
defaultButtons.defaultFilterBtn(null) // 筛选 |
|
|
] |
|
|
] |
|
|
// 动态显示操作列按钮 |
|
|
// 动态显示操作列按钮 |
|
|
buttondata.value = [ |
|
|
buttondata.value = [ |
|
|
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1','1','PLAN_PURCHASE_READY','1'])}), // 编辑 |
|
|
defaultButtons.mainListEditBtn({ |
|
|
// defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['1','1','PLAN_PURCHASE_READY','1'])}), // 删除 |
|
|
hide: isShowMainButton(row, ['1']) |
|
|
|
|
|
}), // 编辑 |
|
|
|
|
|
defaultButtons.mainListDeleteBtn({ |
|
|
|
|
|
hide: isShowMainButton(row, ['1']) |
|
|
|
|
|
}) // 删除 |
|
|
] |
|
|
] |
|
|
} finally { |
|
|
} finally { |
|
|
detailLoading.value = false |
|
|
detailLoading.value = false |
|
@ -287,12 +332,21 @@ const getChangeRecordList = async () => { |
|
|
changeRecordData.changeRecordList = await RemarkApi.getChangeRecordPage(remarksData.data) |
|
|
changeRecordData.changeRecordList = await RemarkApi.getChangeRecordPage(remarksData.data) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const tableObjectRef = ref() |
|
|
|
|
|
const tableMethodsRef = ref() |
|
|
|
|
|
const detailAllSchemasRef = ref() |
|
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
getListApi: props.apiPage // 分页接口 |
|
|
getListApi: props.apiPage // 分页接口 |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
tableObjectRef.value = tableObject |
|
|
|
|
|
tableMethodsRef.value = tableMethods |
|
|
|
|
|
detailAllSchemasRef.value = props.detailAllSchemas |
|
|
|
|
|
|
|
|
// 根据状态返回该按钮是否显示 |
|
|
// 根据状态返回该按钮是否显示 |
|
|
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 { |
|
@ -300,22 +354,27 @@ const isShowMainButton = (row,val) => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获得表格的各种操作 |
|
|
// 获得表格的各种操作 |
|
|
const { getList } = tableMethods |
|
|
const { getList } = tableMethodsRef.value |
|
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
// 头部按钮事件 |
|
|
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) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -327,9 +386,11 @@ const buttonBaseClick = (val, item) => { |
|
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
// 列表-操作按钮事件 |
|
|
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) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -361,9 +422,7 @@ const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
emit('searchTableSuccessDetail', formField, searchField, val, formRef) |
|
|
emit('searchTableSuccessDetail', formField, searchField, val, formRef) |
|
|
} |
|
|
} |
|
|
// 传递给父类 |
|
|
// 传递给父类 |
|
|
const emit = defineEmits([ |
|
|
const emit = defineEmits(['searchTableSuccessDetail', 'changeTabs']) |
|
|
'searchTableSuccessDetail', |
|
|
|
|
|
]) |
|
|
|
|
|
/** 删除按钮操作 */ |
|
|
/** 删除按钮操作 */ |
|
|
const handleDelete = async (id: number) => { |
|
|
const handleDelete = async (id: number) => { |
|
|
try { |
|
|
try { |
|
@ -374,16 +433,33 @@ const handleDelete = async (id: number) => { |
|
|
message.success(t('common.delSuccess')) |
|
|
message.success(t('common.delSuccess')) |
|
|
// 刷新列表 |
|
|
// 刷新列表 |
|
|
await getList() |
|
|
await getList() |
|
|
} catch { } |
|
|
} catch {} |
|
|
} |
|
|
} |
|
|
// 筛选提交 |
|
|
// 筛选提交 |
|
|
const searchFormClick = (searchData) => { |
|
|
const searchFormClick = (searchData) => { |
|
|
tableObject.params = { |
|
|
tableObjectRef.value.params = { |
|
|
isSearch: true, |
|
|
isSearch: true, |
|
|
filters: searchData.filters?searchData.filters:[{column: "masterId", action: "==", value: masterParmas.value.masterId}] |
|
|
filters: searchData.filters |
|
|
|
|
|
? searchData.filters |
|
|
|
|
|
: [{ column: 'masterId', action: '==', value: masterParmas.value.masterId }] |
|
|
} |
|
|
} |
|
|
getList() // 刷新当前列表 |
|
|
getList() // 刷新当前列表 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//监视属性 |
|
|
|
|
|
watch( |
|
|
|
|
|
() => props.apiPage, |
|
|
|
|
|
() => { |
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
|
|
|
getListApi: props.apiPage // 分页接口 |
|
|
|
|
|
}) |
|
|
|
|
|
detailAllSchemasRef.value = props.detailAllSchemas |
|
|
|
|
|
tableObjectRef.value = tableObject |
|
|
|
|
|
tableMethodsRef.value = tableMethods |
|
|
|
|
|
const { getList } = tableMethods |
|
|
|
|
|
getList() |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
</script> |
|
|
</script> |
|
|
<style lang="scss"> |
|
|
<style lang="scss"> |
|
|
.el-drawer__body { |
|
|
.el-drawer__body { |
|
|