提交 | 用户 | 时间
|
c62768
|
1 |
<template> |
J |
2 |
<!-- 搜索工作栏 --> |
|
3 |
<ContentWrap> |
|
4 |
<el-form ref="queryFormRef" :inline="true" :model="queryParams" class="-mb-15px" |
|
5 |
label-width="68px"> |
2e092f
|
6 |
<el-form-item label="指标编码" prop="itemNo"> |
J |
7 |
<el-input v-model="queryParams.itemNo" class="!w-200px" clearable placeholder="请输入指标编码" |
c62768
|
8 |
@keyup.enter="handleQuery"/> |
J |
9 |
</el-form-item> |
2e092f
|
10 |
<el-form-item label="指标名称" prop="itemName"> |
J |
11 |
<el-input v-model="queryParams.itemName" class="!w-200px" clearable placeholder="请输入指标名称" |
c62768
|
12 |
@keyup.enter="handleQuery"/> |
2e092f
|
13 |
</el-form-item> |
J |
14 |
<el-form-item label="指标类型" prop="itemType"> |
|
15 |
<el-select v-model="queryParams.itemType" class="!w-200px" clearable placeholder="请选择指标类型"> |
|
16 |
<el-option |
|
17 |
v-for="dict in getStrDictOptions(DICT_TYPE.IND_ITEM_TYPE)" |
|
18 |
:key="dict.value" |
|
19 |
:label="dict.label" |
|
20 |
:value="dict.value" |
|
21 |
/> |
|
22 |
</el-select> |
c62768
|
23 |
</el-form-item> |
J |
24 |
<el-form-item> |
|
25 |
<el-button @click="handleQuery"> |
|
26 |
<Icon class="mr-5px" icon="ep:search"/> |
|
27 |
搜索 |
|
28 |
</el-button> |
|
29 |
<el-button @click="resetQuery"> |
|
30 |
<Icon class="mr-5px" icon="ep:refresh"/> |
|
31 |
重置 |
|
32 |
</el-button> |
|
33 |
<el-button |
|
34 |
v-hasPermi="['data:ind-item:create']" |
|
35 |
plain |
|
36 |
type="primary" |
|
37 |
@click="openForm('create')" |
|
38 |
> |
|
39 |
<Icon class="mr-5px" icon="ep:plus"/> |
|
40 |
新增 |
|
41 |
</el-button> |
|
42 |
</el-form-item> |
|
43 |
</el-form> |
|
44 |
</ContentWrap> |
|
45 |
|
|
46 |
<!-- 列表 --> |
|
47 |
<ContentWrap> |
|
48 |
<el-table v-loading="loading" :data="list"> |
|
49 |
<el-table-column prop="itemNo" label="指标编码" header-align="center" align="center" min-width="80"/> |
|
50 |
<el-table-column prop="itemName" label="指标名称" header-align="center" align="center" min-width="120"/> |
|
51 |
<el-table-column prop="itemCategoryName" label="指标分类" header-align="center" align="center" min-width="100"/> |
|
52 |
<el-table-column prop="itemType" label="指标类型" header-align="center" align="center" min-width="60"> |
|
53 |
<template #default="scope"> |
d3ee81
|
54 |
<dict-tag :type="DICT_TYPE.IND_ITEM_TYPE" :value="scope.row.itemType" /> |
c62768
|
55 |
</template> |
J |
56 |
</el-table-column> |
|
57 |
<el-table-column prop="coefficient" label="系数" header-align="center" align="center" min-width="60"/> |
|
58 |
<el-table-column prop="precision" label="指标精度" header-align="center" align="center" min-width="60"/> |
|
59 |
<el-table-column prop="timeGranularity" label="时间粒度" header-align="center" align="center" min-width="40"> |
|
60 |
<template #default="scope"> |
|
61 |
<dict-tag :type="DICT_TYPE.TIME_GRANULARITY" :value="scope.row.timeGranularity" /> |
|
62 |
</template> |
|
63 |
</el-table-column> |
|
64 |
<el-table-column |
|
65 |
:formatter="dateFormatter" |
|
66 |
align="center" |
|
67 |
label="创建时间" |
|
68 |
prop="createTime" |
|
69 |
width="180"/> |
|
70 |
<el-table-column align="center" label="操作"> |
|
71 |
<template #default="scope"> |
|
72 |
<el-button |
|
73 |
v-hasPermi="['data:ind-item:update']" |
|
74 |
link |
|
75 |
type="primary" |
|
76 |
@click="openForm('update', scope.row)"> |
|
77 |
修改 |
|
78 |
</el-button> |
|
79 |
<el-button |
|
80 |
v-hasPermi="['data:ind-item:delete']" |
|
81 |
link |
|
82 |
type="danger" |
|
83 |
@click="handleDelete(scope.row.id)"> |
|
84 |
删除 |
|
85 |
</el-button> |
|
86 |
</template> |
|
87 |
</el-table-column> |
|
88 |
</el-table> |
|
89 |
<!-- 分页 --> |
|
90 |
<Pagination |
|
91 |
v-model:limit="queryParams.pageSize" |
|
92 |
v-model:page="queryParams.pageNo" |
|
93 |
:total="total" |
|
94 |
@pagination="getList" |
|
95 |
/> |
|
96 |
</ContentWrap> |
|
97 |
|
|
98 |
<!-- 表单弹窗:添加/修改 --> |
|
99 |
<AtomIndDefineForm ref="atomFormRef" @success="getList" /> |
|
100 |
<DerIndDefineForm ref="derFormRef" @success="getList" /> |
|
101 |
<CalIndDefineForm ref="calFormRef" @success="getList" /> |
|
102 |
<SelectItemType ref="itemTypeSel"/> |
|
103 |
</template> |
|
104 |
|
|
105 |
<script lang="ts" setup> |
2e092f
|
106 |
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict' |
c62768
|
107 |
import { dateFormatter } from '@/utils/formatTime' |
J |
108 |
import * as DataSetApi from '@/api/data/ind/data/data.set' |
|
109 |
import AtomIndDefineForm from './AtomIndDefineForm.vue' |
|
110 |
import DerIndDefineForm from './DerIndDefineForm.vue' |
|
111 |
import CalIndDefineForm from './CalIndDefineForm.vue' |
|
112 |
import SelectItemType from './selectItemType.vue' |
|
113 |
import download from '@/utils/download' |
|
114 |
import * as ItemApi from '@/api/data/ind/item/item' |
|
115 |
import * as CategoryApi from "@/api/data/ind/category"; |
|
116 |
|
9e6ba7
|
117 |
defineOptions({ name: 'IndItem' }) |
c62768
|
118 |
|
J |
119 |
const message = useMessage() // 消息弹窗 |
|
120 |
const { t } = useI18n() // 国际化 |
|
121 |
const dataCategoryList = ref([] as CategoryApi.IndItemCategoryVO[]) |
|
122 |
const loading = ref(true) // 列表的加载中 |
|
123 |
const total = ref(0) // 列表的总页数 |
|
124 |
const list = ref([]) // 字典表格数据 |
|
125 |
const queryParams = reactive({ |
|
126 |
pageNo: 1, |
|
127 |
pageSize: 10, |
|
128 |
itemNo: '', |
|
129 |
itemName: '', |
|
130 |
itemType: '', |
|
131 |
itemCategory: '' |
|
132 |
}) |
|
133 |
const queryFormRef = ref() // 搜索的表单 |
|
134 |
const exportLoading = ref(false) // 导出的加载中 |
|
135 |
|
|
136 |
/** 查询字典类型列表 */ |
|
137 |
const getList = async () => { |
|
138 |
loading.value = true |
|
139 |
try { |
|
140 |
const data = await ItemApi.getItemPage(queryParams) |
|
141 |
list.value = data.list |
|
142 |
total.value = data.total |
|
143 |
dataCategoryList.value = await CategoryApi.getCategoryListAllSimple() |
|
144 |
} finally { |
|
145 |
loading.value = false |
|
146 |
} |
|
147 |
} |
|
148 |
|
|
149 |
/** 搜索按钮操作 */ |
|
150 |
const handleQuery = () => { |
|
151 |
queryParams.pageNo = 1 |
|
152 |
getList() |
|
153 |
} |
|
154 |
|
|
155 |
/** 重置按钮操作 */ |
|
156 |
const resetQuery = () => { |
|
157 |
queryFormRef.value.resetFields() |
|
158 |
handleQuery() |
|
159 |
} |
|
160 |
|
|
161 |
/** 添加/修改操作 */ |
|
162 |
const atomFormRef = ref() |
|
163 |
const derFormRef = ref() |
|
164 |
const calFormRef = ref() |
|
165 |
const itemTypeSel = ref() |
|
166 |
|
|
167 |
const openForm = (type: string, row) => { |
|
168 |
if(row !== null && row !==undefined){ |
|
169 |
if(row.itemType === 'ATOM'){ |
|
170 |
if (row.id){ |
|
171 |
atomFormRef.value.open(type,row.id) |
|
172 |
} |
|
173 |
}else if(row.itemType === 'CAL'){ |
|
174 |
if (row.id){ |
|
175 |
calFormRef.value.open(type,row.id) |
|
176 |
} |
|
177 |
}else if(row.itemType === 'DER'){ |
|
178 |
if (row.id){ |
|
179 |
derFormRef.value.open(type,row.id) |
|
180 |
} |
|
181 |
} |
|
182 |
}else { |
|
183 |
itemTypeSel.value.open(type) |
|
184 |
} |
|
185 |
|
|
186 |
} |
|
187 |
|
|
188 |
/** 删除按钮操作 */ |
|
189 |
const handleDelete = async (id: number) => { |
|
190 |
try { |
|
191 |
// 删除的二次确认 |
|
192 |
await message.delConfirm() |
|
193 |
// 发起删除 |
|
194 |
await ItemApi.deleteItem(id) |
|
195 |
message.success(t('common.delSuccess')) |
|
196 |
// 刷新列表 |
|
197 |
await getList() |
|
198 |
} catch {} |
|
199 |
} |
|
200 |
|
|
201 |
/** 初始化 **/ |
|
202 |
onMounted(() => { |
|
203 |
getList() |
|
204 |
}) |
|
205 |
</script> |