Browse Source

详情回滚

master
陈薪名 12 months ago
parent
commit
93dd254e5e
  1. 288
      src/components/Detail/src/Detail.vue

288
src/components/Detail/src/Detail.vue

@ -1,100 +1,69 @@
<template>
<div>
<el-drawer
v-model="isShowDrawer"
title="详情"
direction="rtl"
size="80%"
v-loading="detailLoading"
>
<template #header>
<div class="font-size-18px">
{{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span>
</div>
</template>
<ContentWrap v-if="!isBasic">
<Descriptions
:data="detailData"
labelClassName="label-class-name"
label-align="left"
direction="vertical"
:column="8"
:schema="allSchemas.detailSchema"
:columns="2"
width="200px"
<el-drawer v-model="isShowDrawer" title="详情" direction="rtl" size="80%" v-loading="detailLoading">
<template #header>
<div class="font-size-18px">
{{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span>
</div>
</template>
<ContentWrap v-if="!isBasic">
<Descriptions :data="detailData" labelClassName="label-class-name" label-align="left" direction="vertical"
:column="8" :schema="allSchemas.detailSchema" :columns="2" width="200px" />
</ContentWrap>
<Tabs :tabsList="tabsList" :current="current" @change="change" />
<div class="flex" v-if="current == 0">
<!-- 详情 -->
<ContentWrap class="w-[73%]">
<!-- 列表头部 -->
<TableHead
v-if="!isBasic"
:HeadButttondata="HeadButttondata"
:masterId="masterParmas.masterId"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@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>
<Tabs :tabsList="tabsList" :current="current" @change="change" />
<div class="flex">
<!-- 详情 -->
<ContentWrap class="w-[73%]">
<!-- 列表头部 -->
<TableHead
v-if="!isBasic"
:HeadButttondata="HeadButttondata"
:masterId="masterParmas.masterId"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@searchFormClick="searchFormClick"
:allSchemas="detailAllSchemas"
/>
<Descriptions
v-if="isBasic"
:data="detailData"
:schema="allSchemas.detailSchema"
:columns="2"
/>
<Table
v-if="!isBasic"
:columns="tableColumnsRef"
: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>
<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="getList"
:rules="detailAllSchemasRules"
:formAllSchemas="detailAllSchemas"
:isBusiness="false"
:apiUpdate="apiUpdate"
:apiCreate="apiCreate"
@searchTableSuccess="searchTableSuccess"
:detailData="detailData"
@submitForm="submitForm"
/>
</div>
</template>
<script lang="ts" setup>
@ -116,7 +85,7 @@ const { t } = useI18n() // 国际化
const route = useRoute() //
const routeName = ref()
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({
//
@ -178,31 +147,22 @@ const props = defineProps({
type: Array,
required: false,
default: null
}
},
})
const isShowDrawer = ref(false)
const detailLoading = ref(false)
const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : '')))
if (props.isBasic == true) {
if (tabsList.value && tabsList.value.length > 0) {
tabsList.value.unshift({
label: '详情',
prop: 'Detail'
})
}
if (tabsList.value && tabsList.value.length > 0) {
tabsList.value.unshift({
label: '详情',
prop: 'Detail'
})
} else {
if (tabsList.value && tabsList.value.length > 0) {
} else {
tabsList.value = [
{
label: '明细',
prop: 'Detail'
}
]
}
}
if (tabsList.value) {
tabsList.value = [{
label: '明细',
prop: 'Detail'
}]
}
//
@ -213,14 +173,14 @@ const annexData = reactive({
//
const remarksData = reactive({
remarksList: [],
data: {}
data:{}
})
//
const changeRecordData = reactive({
changeRecordList: []
})
const detailData = ref({}) //
const detailData = ref({})//
//
const getFileList = async () => {
detailLoading.value = true
@ -234,9 +194,11 @@ const getFileList = async () => {
const handleAnnexSuccess = () => {
getFileList()
getChangeRecordList()
}
//
const deleteAnnexSuccess = async () => {
getFileList()
getChangeRecordList()
}
@ -245,14 +207,13 @@ const deleteAnnexSuccess = async () => {
const current = ref(0)
const change = (item, index) => {
current.value = index
emit('changeTabs', item)
}
//
const masterParmas = ref({
masterId: '', //id
number: '', //
status: '' //
const masterParmas=ref({
masterId:'',//id
number: '',//
status: '',//
})
//
@ -268,16 +229,16 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
titleValueRef.value = titleValue
remarksData.data = {
tableId: row.id,
tableName: tableName
tableName: tableName,
}
//
if (!props.isBasic) {
if(!props.isBasic) {
// id
masterParmas.value.masterId = row.id
masterParmas.value.number = row.number
masterParmas.value.status = row.status
tableObjectRef.value.params = {
masterId: row.id
tableObject.params = {
masterId: row.id,
}
getList()
}
@ -291,19 +252,13 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
getChangeRecordList()
//
HeadButttondata.value = [
defaultButtons.defaultAddBtn({
hide: isShowMainButton(row, ['1', '1', 'PLAN_PURCHASE_READY', '1'])
}), //
defaultButtons.defaultFilterBtn(null) //
defaultButtons.defaultAddBtn({hide:isShowMainButton(row,['1','1','PLAN_PURCHASE_READY','1'])}), //
defaultButtons.defaultFilterBtn(null), //
]
//
buttondata.value = [
defaultButtons.mainListEditBtn({
hide: isShowMainButton(row, ['1', '1', 'PLAN_PURCHASE_READY', '1'])
}), //
defaultButtons.mainListDeleteBtn({
hide: isShowMainButton(row, ['1', '1', 'PLAN_PURCHASE_READY', '1'])
}) //
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1','1','PLAN_PURCHASE_READY','1'])}), //
// defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['1','1','PLAN_PURCHASE_READY','1'])}), //
]
} finally {
detailLoading.value = false
@ -332,21 +287,12 @@ const getChangeRecordList = async () => {
changeRecordData.changeRecordList = await RemarkApi.getChangeRecordPage(remarksData.data)
}
const tableObjectRef = ref()
const tableMethodsRef = ref()
const tableColumnsRef = ref()
const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage //
})
tableObjectRef.value = tableObject
tableMethodsRef.value = tableMethods
tableColumnsRef.value = props.detailAllSchemas.tableColumns
//
const isShowMainButton = (row, val) => {
const isShowMainButton = (row,val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
@ -354,27 +300,22 @@ const isShowMainButton = (row, val) => {
}
}
//
const { getList } = tableMethodsRef.value
const { getList } = tableMethods
//
const buttonBaseClick = (val, item) => {
if (val == 'add') {
//
if (val == 'add') { //
openForm('create')
} else if (val == 'import') {
//
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') {
//
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') {
//
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') {
//
} else {
//
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
@ -386,11 +327,9 @@ const buttonBaseClick = (val, item) => {
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') {
//
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') {
//
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
@ -422,7 +361,9 @@ const searchTableSuccess = (formField, searchField, val, formRef) => {
emit('searchTableSuccessDetail', formField, searchField, val, formRef)
}
//
const emit = defineEmits(['searchTableSuccessDetail', 'changeTabs'])
const emit = defineEmits([
'searchTableSuccessDetail',
])
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
@ -433,33 +374,16 @@ const handleDelete = async (id: number) => {
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
} catch { }
}
//
const searchFormClick = (searchData) => {
tableObjectRef.value.params = {
tableObject.params = {
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() //
}
//
watch(
() => props.apiPage,
() => {
const { tableObject, tableMethods } = useTable({
getListApi: props.apiPage //
})
tableColumnsRef.value = props.detailAllSchemas.tableColumns
tableObjectRef.value = tableObject
tableMethodsRef.value = tableMethods
const { getList } = tableMethods
getList()
}
)
</script>
<style lang="scss">
.el-drawer__body {

Loading…
Cancel
Save