zhang_li
2 months ago
4 changed files with 72 additions and 5 deletions
@ -0,0 +1,3 @@ |
|||||
|
import Distinction from './src/Distinction.vue' |
||||
|
|
||||
|
export { Distinction } |
@ -0,0 +1,51 @@ |
|||||
|
<!-- 变更记录组件 --> |
||||
|
<template> |
||||
|
<el-dialog v-model="dialogVisible" title="变更详情" width="80%" :before-close="handleClose"> |
||||
|
<div style="display: flex"> |
||||
|
<div style="flex: 1; width: 0px"> |
||||
|
<div style="font-size: 16px; font-weight: bold; margin-bottom: 10px"> 变更前 </div> |
||||
|
<Descriptions :data="beforeContent" :schema="schema" :columns="2" /> |
||||
|
</div> |
||||
|
<div style="flex: 1; width: 0px; margin-left: 20px"> |
||||
|
<div style="font-size: 16px; font-weight: bold; margin-bottom: 10px"> 变更后 </div> |
||||
|
<Descriptions :data="afterContent" :schema="schema" :columns="2" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
<template #footer> |
||||
|
<div class="dialog-footer"> |
||||
|
<el-button @click="dialogVisible = false">关闭</el-button> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-dialog> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts" setup> |
||||
|
defineComponent({ |
||||
|
name: 'Distinction' |
||||
|
}) |
||||
|
// 接收父组件数据 |
||||
|
const props = defineProps({ |
||||
|
schema: { |
||||
|
type: Array, |
||||
|
required: true |
||||
|
} |
||||
|
}) |
||||
|
const schema = ref(props.schema.filter(item => { |
||||
|
return item.field !='updater' && item.field !='updateTime' && item.field !='creator' && item.field !='createTime' |
||||
|
})) |
||||
|
const dialogVisible = ref(false) |
||||
|
const afterContent = ref('') |
||||
|
const beforeContent = ref('') |
||||
|
const openDistinction = (row) => { |
||||
|
afterContent.value = JSON.parse(row.afterContent) |
||||
|
beforeContent.value = JSON.parse(row.beforeContent) |
||||
|
console.log(222,props.schema) |
||||
|
dialogVisible.value = true |
||||
|
} |
||||
|
|
||||
|
defineExpose({ dialogVisible, openDistinction }) // 提供 open 方法,用于打开弹窗 |
||||
|
</script> |
||||
|
|
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
</style> |
Loading…
Reference in new issue