| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <route lang="yaml">
- meta:
- enabled: false
- </route>
- <script lang="ts" setup name="BizObjectMappingList">
- import { ElMessage } from 'element-plus'
- import {
- deleteObjectMappingById,
- getObjectAttrListById,
- } from '@/api/biz/bizObjectMappingApi'
- const props = withDefaults(defineProps<{
- bizId: number
- objectId: number
- }>(), {
- bizId: 0,
- objectId: 0,
- })
- // 数据
- const state = reactive({
- title: '',
- dialogVisible: false,
- loading: false,
- search: {
- keywords: '',
- },
- conditions: {
- bizId: props.bizId,
- objectId: props.objectId,
- },
- dataList: [],
- actionType: 1,
- })
- // 查询数据
- const getData = async () => {
- state.loading = true
- const { bizId, objectId } = state.conditions
- const { data } = await getObjectAttrListById(bizId, objectId)
- state.loading = false
- state.dataList = data
- }
- const objectMappingTableRef = ref()
- function onObjectMappingAdd() {
- state.actionType = 2
- }
- async function onObjectMappingDelete(row: any) {
- const { bizId, objectId } = state.conditions
- const mappingId = row.mappingId
- await deleteObjectMappingById(bizId, objectId, mappingId)
- ElMessage.success('删除成功')
- }
- onMounted(() => {
- getData()
- nextTick(() => {
- })
- })
- </script>
- <template>
- <div class="absolute-container">
- <div class="container">
- <tool-bar>
- <template #left>
- <h4>模型映射</h4>
- </template>
- <template #right>
- <el-input v-model="state.search.keywords" placeholder="请输入关键词筛选" clearable style="width: 200px;" />
- <el-button style="margin-left:10px" @click="getData">
- <template #icon>
- <el-icon>
- <svg-icon name="i-ep:search" />
- </el-icon>
- </template>
- </el-button>
- <el-button type="default" @click="onObjectMappingAdd">
- <template #icon>
- <el-icon>
- <svg-icon name="i-ep:plus" />
- </el-icon>
- </template>
- </el-button>
- </template>
- </tool-bar>
- <el-table ref="objectMappingTableRef" :data="state.dataList" class="list-table" size="small" border stripe highlight-current-row>
- <el-table-column type="index" label="序号" header-align="center" align="center" width="70" />
- <el-table-column label="模型" header-align="center" align="center" width="300">
- <template #default="scope">
- <span>{{ scope.row.mappingModelTitle }}</span>
- </template>
- </el-table-column>
- <el-table-column label="对象" header-align="center" align="center" width="300">
- <template #default="scope">
- <span>{{ scope.row.mappingObjectTitle }}</span>
- </template>
- </el-table-column>
- <el-table-column label="映射代码" header-align="center" align="center">
- <template #default="scope">
- <el-input v-if="scope.row.isEdit" v-model="scope.row.mappingCode" size="small" />
- <span v-else>{{ scope.row.mappingCode }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center">
- <template #default="scope">
- <el-popconfirm title="是否要删除此行?" style="margin-left: 10px;" @confirm="onObjectMappingDelete(scope.row)">
- <template #reference>
- <el-button type="danger" plain size="small">
- 删除
- </el-button>
- </template>
- </el-popconfirm>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- </template>
- <style lang="scss" scoped>
- .page-main {
- :deep(.el-table) {
- height: 100%;
- .el-table__row {
- .index {
- display: inline-block;
- }
- .delete {
- display: none;
- }
- &:hover {
- .index {
- display: none;
- }
- .delete {
- display: inline-block;
- }
- }
- .el-tag.sortable,
- .el-tag.sortable .el-icon {
- cursor: s-resize;
- }
- }
- }
- h4{
- padding: 0;
- margin: 0;
- }
- }
- </style>
|