2024-01-22 19:13:58 +08:00
|
|
|
<template>
|
2024-01-23 14:14:26 +08:00
|
|
|
<div class="default-main">
|
2024-01-22 19:13:58 +08:00
|
|
|
<TableHeader>
|
|
|
|
|
<template #select>
|
2024-01-23 14:14:26 +08:00
|
|
|
<el-form-item label="数据分类">
|
2024-10-16 20:31:54 +08:00
|
|
|
<el-select v-model="tableStore.table.params.dataType" multiple filterable collapse-tags clearable
|
|
|
|
|
placeholder="请选择数据分类">
|
|
|
|
|
<el-option v-for="item in DataTypeSelect" :key="item.id" :label="item.name"
|
|
|
|
|
:value="item.id"></el-option>
|
2024-01-22 19:13:58 +08:00
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2024-01-23 14:14:26 +08:00
|
|
|
<el-form-item label="数据存储">
|
2024-10-16 20:31:54 +08:00
|
|
|
<el-select v-model="tableStore.table.params.classId" multiple filterable collapse-tags clearable
|
|
|
|
|
placeholder="请选择数据存储">
|
|
|
|
|
<el-option v-for="item in DataSelect" :key="item.id" :label="item.name"
|
|
|
|
|
:value="item.id"></el-option>
|
2024-01-22 19:13:58 +08:00
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2024-02-19 11:34:03 +08:00
|
|
|
<el-form-item label="过滤筛选">
|
2024-10-16 20:31:54 +08:00
|
|
|
<el-input v-model="tableStore.table.params.searchValue" placeholder="数据名称、别名、名称"
|
|
|
|
|
clearable></el-input>
|
2024-01-22 19:13:58 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
|
|
|
|
<template #operation>
|
2024-01-23 14:05:03 +08:00
|
|
|
<el-button :icon="Plus" type="primary" @click="addMenu" class="ml10">新增字典</el-button>
|
2024-01-22 19:13:58 +08:00
|
|
|
</template>
|
|
|
|
|
</TableHeader>
|
2024-01-23 14:14:26 +08:00
|
|
|
<Table ref="tableRef" />
|
|
|
|
|
<PopupDictionary ref="popupDictionary"></PopupDictionary>
|
2024-01-22 19:13:58 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
2024-01-23 14:14:26 +08:00
|
|
|
<script setup lang="ts">
|
2024-01-22 19:13:58 +08:00
|
|
|
import { ref, onMounted, provide } from 'vue'
|
|
|
|
|
import TableStore from '@/utils/tableStore'
|
|
|
|
|
import Table from '@/components/table/index.vue'
|
|
|
|
|
import TableHeader from '@/components/table/header/index.vue'
|
|
|
|
|
import { useDictData } from '@/stores/dictData'
|
|
|
|
|
import PopupDictionary from './popupDictionary.vue'
|
2024-01-23 14:05:03 +08:00
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
|
|
import { delCsDictData } from '@/api/system-boot/csDictData'
|
|
|
|
|
import { Plus } from '@element-plus/icons-vue'
|
2024-01-22 19:13:58 +08:00
|
|
|
|
|
|
|
|
defineOptions({
|
|
|
|
|
name: 'govern/manage/basic/dictionary'
|
|
|
|
|
})
|
|
|
|
|
const popupDictionary = ref()
|
|
|
|
|
const dictData = useDictData()
|
|
|
|
|
const DataSelect = dictData.getBasicData('Data')
|
|
|
|
|
const DataTypeSelect = dictData.getBasicData('Cs_Data_Type')
|
2024-01-22 19:56:30 +08:00
|
|
|
const ResourcesIdSelect = dictData.getBasicData('Data_Day')
|
2024-01-22 19:13:58 +08:00
|
|
|
const tableStore = new TableStore({
|
|
|
|
|
url: '/system-boot/csDictData/list',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
column: [
|
2024-12-09 16:30:40 +08:00
|
|
|
{ title: '序号', width: 80,formatter: (row: any) => {
|
|
|
|
|
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
|
|
|
|
|
} },
|
2024-10-16 20:31:54 +08:00
|
|
|
{ title: '数据分类', field: 'dataTypeName', minWidth: 170 },
|
|
|
|
|
{ title: '数据名称', field: 'name', minWidth: 220 },
|
|
|
|
|
{ title: '别名', field: 'otherName', minWidth: 220 },
|
|
|
|
|
{ title: '展示名称', field: 'showName', minWidth: 170 },
|
|
|
|
|
{ title: '相别', field: 'phaseName', minWidth: 80 },
|
|
|
|
|
{ title: '单位', field: 'unit', minWidth: 80 },
|
|
|
|
|
{ title: '基础数据类型', field: 'type', minWidth: 170 },
|
|
|
|
|
{ title: '数据谐波次数', field: 'harmStartEnd', minWidth: 170 },
|
|
|
|
|
{ title: '数据统计方法', field: 'statMethod', minWidth: 170 },
|
|
|
|
|
{ title: '数据存储', field: 'classIdName', minWidth: 120 },
|
|
|
|
|
{ title: '数据来源', field: 'resourcesIdName', minWidth: 120 },
|
2024-01-22 19:13:58 +08:00
|
|
|
{
|
|
|
|
|
title: '操作',
|
|
|
|
|
align: 'center',
|
2024-01-30 14:11:29 +08:00
|
|
|
width: '180',
|
2024-06-12 18:05:35 +08:00
|
|
|
fixed: 'right',
|
2024-01-22 19:13:58 +08:00
|
|
|
render: 'buttons',
|
|
|
|
|
buttons: [
|
|
|
|
|
{
|
|
|
|
|
name: 'edit',
|
|
|
|
|
title: '编辑',
|
|
|
|
|
type: 'primary',
|
|
|
|
|
icon: 'el-icon-EditPen',
|
2024-01-30 14:11:29 +08:00
|
|
|
render: 'basicButton',
|
2024-01-22 19:13:58 +08:00
|
|
|
click: row => {
|
|
|
|
|
popupDictionary.value.open('编辑字典', row)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'del',
|
|
|
|
|
title: '删除',
|
|
|
|
|
type: 'danger',
|
|
|
|
|
icon: 'el-icon-Delete',
|
|
|
|
|
render: 'confirmButton',
|
|
|
|
|
popconfirm: {
|
|
|
|
|
confirmButtonText: '确认',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
confirmButtonType: 'danger',
|
|
|
|
|
title: '确定删除吗?'
|
|
|
|
|
},
|
|
|
|
|
click: row => {
|
2024-01-23 14:14:26 +08:00
|
|
|
delCsDictData(row.id).then(res => {
|
|
|
|
|
ElMessage.success('删除成功')
|
2024-01-23 14:05:03 +08:00
|
|
|
tableStore.index()
|
|
|
|
|
})
|
2024-01-22 19:13:58 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
loadCallback: () => {
|
|
|
|
|
tableStore.table.data.forEach((item: any) => {
|
|
|
|
|
item.classIdName = DataSelect.find((child: any) => child.id == item.classId)?.name || '/'
|
2024-01-22 19:56:30 +08:00
|
|
|
item.resourcesIdName = ResourcesIdSelect.find((child: any) => child.id == item.resourcesId)?.name || '/'
|
2024-01-22 19:13:58 +08:00
|
|
|
item.phaseName = item.phase === 'M' ? '/' : item.phase || '/'
|
2024-02-02 09:58:14 +08:00
|
|
|
item.harmStartEnd = item.harmEnd ? item.harmStart + '-' + item.harmEnd : '/'
|
2024-01-22 19:13:58 +08:00
|
|
|
for (let key in item) {
|
|
|
|
|
if (typeof item[key] !== 'number') {
|
|
|
|
|
item[key] = item[key] || '/'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
2024-01-22 19:56:30 +08:00
|
|
|
tableStore.table.params.searchValue = ''
|
2024-10-16 20:31:54 +08:00
|
|
|
tableStore.table.params.dataType = []
|
|
|
|
|
tableStore.table.params.classId = []
|
2024-01-22 19:13:58 +08:00
|
|
|
provide('tableStore', tableStore)
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
tableStore.index()
|
|
|
|
|
})
|
|
|
|
|
const addMenu = () => {
|
|
|
|
|
popupDictionary.value.open('新增字典')
|
|
|
|
|
}
|
|
|
|
|
</script>
|