update:字典优化

This commit is contained in:
2025-12-04 16:06:14 +08:00
parent 2382198ad1
commit 85e534c495
4 changed files with 86 additions and 46 deletions

View File

@@ -9,13 +9,17 @@
</template>
<template #nodeName="{ row }">
<div class="node-name">
<el-icon v-if="row.nodeType === NODE_TYPE.TASK" :size="16" class="blue"><Document /></el-icon>
<el-icon v-else-if="row.nodeType === NODE_TYPE.PERFORMANCE" :size="16" class="blue"><Operation /></el-icon>
<el-icon v-if="row.nodeType === NODE_TYPE.TASK" :size="16" class="blue">
<Document />
</el-icon>
<el-icon v-else-if="row.nodeType === NODE_TYPE.PERFORMANCE" :size="16" class="blue">
<Operation />
</el-icon>
<el-icon v-else :size="16" class="blue"><Folder /></el-icon>
<span class="name">{{ row.nodeName }}</span>
</div>
</template>
<template v-for="(name) in Object.keys($slots)" :key="name" #[name]="scope">
<template v-for="name in Object.keys($slots)" :key="name" #[name]="scope">
<slot :name="name" v-bind="scope" />
</template>
</TreeTable>
@@ -44,9 +48,12 @@ const props = withDefaults(defineProps<Props>(), {
const treeData = ref<any>([]);
watch(() => props.data, (val: any) => {
watch(
() => props.data,
(val: any) => {
treeData.value = treeDataFormatFun(val, [], '0');
});
}
);
const treeDataFormatFun = (data: any, build: any, pId: any) => {
data.forEach((item: any) => {

View File

@@ -44,6 +44,12 @@
<el-button type="primary" @click="compareFun(currentModel)">对比</el-button>
</div>
</template>
<template #achieveStatus="{ row }">
{{ RESULT_ACHIEVE_STATUS.O[row.achieveStatus] || '--' }}
</template>
<template #exeStatus="{ row }">
{{ TASK_ACHIEVE_STATUS.O[row.exeStatus] || '--' }}
</template>
</BaseTable>
</div>
<Dialog
@@ -225,7 +231,12 @@ import analysisDataDialog from './components/analysisDataDialog.vue';
import taskDetail from '@/views/task/projectDetail/components/taskDetail.vue';
import FilePreview from '@/components/common/filePreview/index.vue';
import runDetailPage from './components/runDetailPage.vue';
import { useDict } from '@/utils/useDict';
const { RESULT_ACHIEVE_STATUS, TASK_ACHIEVE_STATUS } = useDict(
'RESULT_ACHIEVE_STATUS',
'TASK_ACHIEVE_STATUS'
);
const showTaskDetailDialog = ref(false);
const showRunDetailDialog = ref(false);

View File

@@ -23,7 +23,11 @@
<script setup lang="ts">
import { ref, watch } from 'vue';
import { ElMessage } from 'element-plus';
import { addDictionaryClassApi, updateDictionaryClassApi, getDictionaryClassDetailApi } from '@/api/system/systemData';
import {
addDictionaryClassApi,
updateDictionaryClassApi,
getDictionaryClassDetailApi,
} from '@/api/system/systemData';
import TableForm from '@/components/common/table/tableForm.vue';
import { getAllDictDataFun } from '@/utils/common';
@@ -43,7 +47,9 @@ const emit = defineEmits(['update:modelValue', 'submit']);
const visible = ref(false);
const tableFormRef = ref<any>();
watch(() => props.modelValue, (val: boolean) => {
watch(
() => props.modelValue,
(val: boolean) => {
visible.value = val;
if (val) {
if (props.data.uuid) {
@@ -54,7 +60,8 @@ watch(() => props.modelValue, (val: boolean) => {
tableFormRef.value.resetFun();
}
}
});
}
);
const getDetailFun = () => {
const params = {

View File

@@ -12,27 +12,12 @@
<el-button :icon="Plus" type="primary" @click="openDetailFun({})">新增字典</el-button>
</div>
<div class="table">
<vxe-table :data="tableData" height="100%">
<vxe-column field="dictName" title="名称" align="center" header-align="center" />
<vxe-column field="dictValue" title="数值" align="center" header-align="center" />
<vxe-column field="comment" title="备注" align="center" header-align="center">
<template #default="{ row }">
<span>{{ row.comment ||'--' }}</span>
</template>
</vxe-column>
<vxe-column field="action" title="操作" align="center" header-align="center">
<template #default="{ row }">
<div class="gl-table-actions">
<el-link type="primary" @click="openDetailFun(row)">编辑</el-link>
<el-popconfirm title="确定删除字典吗?" :width="200" placement="left" @confirm="delFun(row)">
<template #reference>
<el-link type="danger">删除</el-link>
</template>
</el-popconfirm>
</div>
</template>
</vxe-column>
</vxe-table>
<BaseTable
ref="BaseTableRef"
tableName="DICT_CLASS_LIST"
hidePagination
:actionList="actionList"
/>
</div>
</div>
<template #footer>
@@ -40,7 +25,12 @@
<el-button @click="closeFun">关闭</el-button>
</div>
</template>
<DictDetailDia v-model="addDiaVisible" :classData="data" :data="detailData" @submit="submitFun" />
<DictDetailDia
v-model="addDiaVisible"
:classData="data"
:data="detailData"
@submit="submitFun"
/>
</el-drawer>
</div>
</template>
@@ -52,6 +42,7 @@ import { ElMessage } from 'element-plus';
import DictDetailDia from './dictDetail.vue';
import { getDictionaryDataApi, deleteDictionaryDataApi } from '@/api/system/systemData';
import { getAllDictDataFun } from '@/utils/common';
import BaseTable from '@/components/common/table/baseTable.vue';
interface Props {
modelValue: boolean;
@@ -63,18 +54,41 @@ const props = withDefaults(defineProps<Props>(), {
data: {},
});
const actionList = ref<any>([
{
title: '编辑',
type: 'primary',
click: (row: any) => {
openDetailFun(row);
},
},
{
title: '删除',
type: 'danger',
needConfirm: true,
confirmTip: '确定删除字典吗?',
click: (row: any) => {
delFun(row);
},
},
]);
const emit = defineEmits(['update:modelValue']);
const BaseTableRef = ref<any>();
const visible = ref(false);
const tableData = ref<any>([]);
const addDiaVisible = ref(false);
const detailData = ref<any>({});
watch(() => props.modelValue, (val: boolean) => {
watch(
() => props.modelValue,
(val: boolean) => {
visible.value = val;
if (val) {
getListFun();
}
});
}
);
const getListFun = () => {
const params = {
@@ -82,6 +96,7 @@ const getListFun = () => {
};
getDictionaryDataApi(params).then((res: any) => {
if (res.code === 200) {
BaseTableRef.value?.setDataFun(res.data);
tableData.value = res.data;
}
});