Browse Source

详情组件修改 动态参数

master
陈薪名 1 year ago
parent
commit
f25dcde64d
  1. 84
      src/components/Detail/src/Detail.vue

84
src/components/Detail/src/Detail.vue

@ -2,17 +2,17 @@
<el-drawer v-model="isShowDrawer" title="详情" direction="rtl" size="80%" v-loading="detailLoading" > <el-drawer v-model="isShowDrawer" title="详情" direction="rtl" size="80%" v-loading="detailLoading" >
<template #header> <template #header>
<div class="font-size-18px"> <div class="font-size-18px">
{{ detailData.code }} <span class="ml-20px font-size-16px">{{ detailData.name }}</span> {{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span>
</div> </div>
</template> </template>
<ContentWrap> <ContentWrap v-if="!isBasic">
<Descriptions :data="detailData" labelClassName="label-class-name" label-align="left" direction="vertical" :column="8" :schema="ItemBasic.allSchemas.detailSchema" :columns="2" width="200px"/> <Descriptions :data="detailData" labelClassName="label-class-name" label-align="left" direction="vertical" :column="8" :schema="detailSchema" :columns="2" width="200px"/>
</ContentWrap> </ContentWrap>
<Tabs :tabsList="tabsList" :current="current" @change="change" /> <Tabs :tabsList="tabsList" :current="current" @change="change" />
<div class="flex" v-if="current == 0"> <div class="flex" v-if="current == 0">
<!-- 详情 --> <!-- 详情 -->
<ContentWrap class="w-[73%]"> <ContentWrap class="w-[73%]">
<Descriptions :data="detailData" :schema="ItemBasic.allSchemas.detailSchema" :columns="2" /> <Descriptions :data="detailData" :schema="detailSchema" :columns="2" />
</ContentWrap> </ContentWrap>
<ContentWrap class="w-[27%] ml-16px"> <ContentWrap class="w-[27%] ml-16px">
<!-- 附件组件 --> <!-- 附件组件 -->
@ -22,12 +22,10 @@
<!-- 变更记录组件 --> <!-- 变更记录组件 -->
<ChangeRecord :data="changeRecordData" class="mt-20px" /> <ChangeRecord :data="changeRecordData" class="mt-20px" />
</ContentWrap> </ContentWrap>
<!-- 用户导入对话框 -->
<ImportForm ref="importFormRef" :importTemplateData="importTemplateData" @success="importSuccess" />
</div> </div>
<ContentWrap v-else> <ContentWrap v-else>
<Table <Table
:columns="ItemBasic.allSchemas.tableColumns" :columns="tableColumns"
:data="tableObject.tableList" :data="tableObject.tableList"
:loading="tableObject.loading" :loading="tableObject.loading"
:pagination="{total: tableObject.total}" :pagination="{total: tableObject.total}"
@ -39,23 +37,69 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
defineOptions({ name: 'Detail' })
import Annex from '@/components/Annex/src/Annex.vue' import Annex from '@/components/Annex/src/Annex.vue'
import Remarks from '@/components/Remarks/src/Remarks.vue' import Remarks from '@/components/Remarks/src/Remarks.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import ChangeRecord from '@/components/ChangeRecord/src/ChangeRecord.vue' import ChangeRecord from '@/components/ChangeRecord/src/ChangeRecord.vue'
import Tabs from '@/components/Tabs/src/Tabs.vue' import Tabs from '@/components/Tabs/src/Tabs.vue'
import { ItemBasic } from '@/utils/disposition/tableColumns.ts'
import { ItemBasicTabsList } from '@/utils/disposition/tabsList.ts'
import * as ItembasicApi from '@/api/wms/itembasic' import * as ItembasicApi from '@/api/wms/itembasic'
defineOptions({ name: 'Detail' })
const props = defineProps({
//
tabs: {
type: Object,
required: true,
default: null
},
//
isBasic: {
type: Boolean,
required: false,
default: false
},
//
allSchemas: {
type: Object,
required: true,
default: null
},
// //
// accept: {
// type: String,
// required: false,
// default:'.xlsx,.xls'
// },
// // .1
// mode: {
// type: Number,
// required: false,
// default: 1
// },
// url:{
// type: String,
// required: false,
// }
})
const isShowDrawer = ref(false) const isShowDrawer = ref(false)
const isBasic = ref(props.isBasic)
const tableColumns = ref(props.allSchemas.tableColumns)
const detailSchema = ref(props.allSchemas.detailSchema)
const tabsList = ref(JSON.parse(JSON.stringify(props.tabs?props.tabs:'')))
const tabsList = ref(JSON.parse(JSON.stringify(ItemBasicTabsList))) if (tabsList.value) {
tabsList.value.unshift({ tabsList.value.unshift({
label: '详情', label: '详情',
prop: 'Detail' prop: 'Detail'
}) })
} else {
tabsList.value = [{
label: '详情',
prop: 'Detail'
}]
}
// //
const annexData = reactive({ const annexData = reactive({
@ -166,12 +210,18 @@ const { getList } = tableMethods
getList() getList()
/** 打开弹窗 */ /** 打开弹窗 */
const openDetail = async (id?: number) => { const titleNameRef = ref()
const titleValueRef = ref()
const openDetail = async (row: any, titleName: any, titleValue: any) => {
titleNameRef.value = titleName
titleValueRef.value = titleValue
isShowDrawer.value = true isShowDrawer.value = true
if (id) { console.log(216, row)
if (row) {
detailLoading.value = true detailLoading.value = true
try { try {
detailData.value = await ItembasicApi.getItembasic(id) // detailData.value = await ItembasicApi.getItembasic(id)
detailData.value = row
} finally { } finally {
detailLoading.value = false detailLoading.value = false
} }

Loading…
Cancel
Save