<template>
|
<!-- 搜索工作栏 -->
|
<ContentWrap>
|
<el-form ref="queryFormRef" :inline="true" :model="queryParams" class="-mb-15px"
|
label-width="68px">
|
<el-form-item label="指标编码" prop="name">
|
<el-input v-model="queryParams.itemNo" class="!w-240px" clearable placeholder="请输入指标编码"
|
@keyup.enter="handleQuery"/>
|
</el-form-item>
|
<el-form-item label="指标名称" prop="name">
|
<el-input v-model="queryParams.itemName" class="!w-240px" clearable placeholder="请输入指标名称"
|
@keyup.enter="handleQuery"/>
|
</el-form-item>
|
<el-form-item>
|
<el-button @click="handleQuery">
|
<Icon class="mr-5px" icon="ep:search"/>
|
搜索
|
</el-button>
|
<el-button @click="resetQuery">
|
<Icon class="mr-5px" icon="ep:refresh"/>
|
重置
|
</el-button>
|
<el-button
|
v-hasPermi="['data:ind-item:create']"
|
plain
|
type="primary"
|
@click="openForm('create')"
|
>
|
<Icon class="mr-5px" icon="ep:plus"/>
|
新增
|
</el-button>
|
</el-form-item>
|
</el-form>
|
</ContentWrap>
|
|
<!-- 列表 -->
|
<ContentWrap>
|
<el-table v-loading="loading" :data="list">
|
<el-table-column prop="itemNo" label="指标编码" header-align="center" align="center" min-width="80"/>
|
<el-table-column prop="itemName" label="指标名称" header-align="center" align="center" min-width="120"/>
|
<el-table-column prop="itemCategoryName" label="指标分类" header-align="center" align="center" min-width="100"/>
|
<el-table-column prop="itemType" label="指标类型" header-align="center" align="center" min-width="60">
|
<template #default="scope">
|
<dict-tag :type="DICT_TYPE.ITEM_TYPE" :value="scope.row.itemType" />
|
</template>
|
</el-table-column>
|
<el-table-column prop="coefficient" label="系数" header-align="center" align="center" min-width="60"/>
|
<el-table-column prop="precision" label="指标精度" header-align="center" align="center" min-width="60"/>
|
<el-table-column prop="timeGranularity" label="时间粒度" header-align="center" align="center" min-width="40">
|
<template #default="scope">
|
<dict-tag :type="DICT_TYPE.TIME_GRANULARITY" :value="scope.row.timeGranularity" />
|
</template>
|
</el-table-column>
|
<el-table-column
|
:formatter="dateFormatter"
|
align="center"
|
label="创建时间"
|
prop="createTime"
|
width="180"/>
|
<el-table-column align="center" label="操作">
|
<template #default="scope">
|
<el-button
|
v-hasPermi="['data:ind-item:update']"
|
link
|
type="primary"
|
@click="openForm('update', scope.row)">
|
修改
|
</el-button>
|
<el-button
|
v-hasPermi="['data:ind-item:delete']"
|
link
|
type="danger"
|
@click="handleDelete(scope.row.id)">
|
删除
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<!-- 分页 -->
|
<Pagination
|
v-model:limit="queryParams.pageSize"
|
v-model:page="queryParams.pageNo"
|
:total="total"
|
@pagination="getList"
|
/>
|
</ContentWrap>
|
|
<!-- 表单弹窗:添加/修改 -->
|
<AtomIndDefineForm ref="atomFormRef" @success="getList" />
|
<DerIndDefineForm ref="derFormRef" @success="getList" />
|
<CalIndDefineForm ref="calFormRef" @success="getList" />
|
<SelectItemType ref="itemTypeSel"/>
|
</template>
|
|
<script lang="ts" setup>
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
import { dateFormatter } from '@/utils/formatTime'
|
import * as DataSetApi from '@/api/data/ind/data/data.set'
|
import AtomIndDefineForm from './AtomIndDefineForm.vue'
|
import DerIndDefineForm from './DerIndDefineForm.vue'
|
import CalIndDefineForm from './CalIndDefineForm.vue'
|
import SelectItemType from './selectItemType.vue'
|
import download from '@/utils/download'
|
import * as ItemApi from '@/api/data/ind/item/item'
|
import * as CategoryApi from "@/api/data/ind/category";
|
|
defineOptions({ name: 'IndDataSet' })
|
|
const message = useMessage() // 消息弹窗
|
const { t } = useI18n() // 国际化
|
const dataCategoryList = ref([] as CategoryApi.IndItemCategoryVO[])
|
const loading = ref(true) // 列表的加载中
|
const total = ref(0) // 列表的总页数
|
const list = ref([]) // 字典表格数据
|
const queryParams = reactive({
|
pageNo: 1,
|
pageSize: 10,
|
itemNo: '',
|
itemName: '',
|
itemType: '',
|
itemCategory: ''
|
})
|
const queryFormRef = ref() // 搜索的表单
|
const exportLoading = ref(false) // 导出的加载中
|
|
/** 查询字典类型列表 */
|
const getList = async () => {
|
loading.value = true
|
try {
|
const data = await ItemApi.getItemPage(queryParams)
|
list.value = data.list
|
total.value = data.total
|
dataCategoryList.value = await CategoryApi.getCategoryListAllSimple()
|
} finally {
|
loading.value = false
|
}
|
}
|
|
/** 搜索按钮操作 */
|
const handleQuery = () => {
|
queryParams.pageNo = 1
|
getList()
|
}
|
|
/** 重置按钮操作 */
|
const resetQuery = () => {
|
queryFormRef.value.resetFields()
|
handleQuery()
|
}
|
|
/** 添加/修改操作 */
|
const atomFormRef = ref()
|
const derFormRef = ref()
|
const calFormRef = ref()
|
const itemTypeSel = ref()
|
|
const openForm = (type: string, row) => {
|
if(row !== null && row !==undefined){
|
if(row.itemType === 'ATOM'){
|
if (row.id){
|
atomFormRef.value.open(type,row.id)
|
}
|
}else if(row.itemType === 'CAL'){
|
if (row.id){
|
calFormRef.value.open(type,row.id)
|
}
|
}else if(row.itemType === 'DER'){
|
if (row.id){
|
derFormRef.value.open(type,row.id)
|
}
|
}
|
}else {
|
itemTypeSel.value.open(type)
|
}
|
|
}
|
|
/** 删除按钮操作 */
|
const handleDelete = async (id: number) => {
|
try {
|
// 删除的二次确认
|
await message.delConfirm()
|
// 发起删除
|
await ItemApi.deleteItem(id)
|
message.success(t('common.delSuccess'))
|
// 刷新列表
|
await getList()
|
} catch {}
|
}
|
|
/** 初始化 **/
|
onMounted(() => {
|
getList()
|
})
|
</script>
|