|
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+<template>
|
|
|
2
|
+ <div class="app-container">
|
|
|
3
|
+ <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px">
|
|
|
4
|
+ <el-form-item label="编码" prop="code">
|
|
|
5
|
+ <el-input v-model="queryParams.code" placeholder="请输入编码" clearable @keyup.enter="handleQuery" />
|
|
|
6
|
+ </el-form-item>
|
|
|
7
|
+ <el-form-item label="考核指标名称" prop="name">
|
|
|
8
|
+ <el-input v-model="queryParams.name" placeholder="请输入考核指标名称" clearable @keyup.enter="handleQuery" />
|
|
|
9
|
+ </el-form-item>
|
|
|
10
|
+
|
|
|
11
|
+ <!-- <el-form-item label="重要程度" prop="categoryName"> -->
|
|
|
12
|
+ <!-- <el-select v-model="queryParams.importance" placeholder="请选择重要程度" clearable style="width: 180px;">
|
|
|
13
|
+ <el-option v-for="dict in base_check_importance" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
14
|
+ </el-select> -->
|
|
|
15
|
+ <!-- <el-input v-model="queryParams.categoryName" placeholder="请输入所属分类名称" clearable @keyup.enter="handleQuery" />
|
|
|
16
|
+ </el-form-item> -->
|
|
|
17
|
+ <el-form-item>
|
|
|
18
|
+ <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
19
|
+ <el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
20
|
+ </el-form-item>
|
|
|
21
|
+ </el-form>
|
|
|
22
|
+
|
|
|
23
|
+ <el-row :gutter="10" class="mb8">
|
|
|
24
|
+ <el-col :span="1.5">
|
|
|
25
|
+ <el-button type="primary" plain icon="Plus" @click="handleAdd"
|
|
|
26
|
+ v-hasPermi="['system:indicator:add']">新增</el-button>
|
|
|
27
|
+ </el-col>
|
|
|
28
|
+ <!-- <el-col :span="1.5">
|
|
|
29
|
+ <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
|
|
30
|
+ v-hasPermi="['system:project:edit']">修改</el-button>
|
|
|
31
|
+ </el-col> -->
|
|
|
32
|
+ <el-col :span="1.5">
|
|
|
33
|
+ <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
|
|
34
|
+ v-hasPermi="['system:indicator:remove']">删除</el-button>
|
|
|
35
|
+ </el-col>
|
|
|
36
|
+ <el-col :span="1.5">
|
|
|
37
|
+ <el-button type="warning" plain icon="Download" @click="handleExport"
|
|
|
38
|
+ v-hasPermi="['system:indicator:export']">导出</el-button>
|
|
|
39
|
+ </el-col>
|
|
|
40
|
+ <el-col :span="1.5">
|
|
|
41
|
+ <el-button type="info" plain icon="Upload" @click="handleImport"
|
|
|
42
|
+ v-hasPermi="['system:indicator:import']">导入</el-button>
|
|
|
43
|
+ </el-col>
|
|
|
44
|
+ <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
45
|
+ </el-row>
|
|
|
46
|
+
|
|
|
47
|
+ <el-table v-loading="loading" :data="indicatorList" @selection-change="handleSelectionChange">
|
|
|
48
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
49
|
+ <el-table-column label="编码" align="center" prop="code" />
|
|
|
50
|
+ <el-table-column label="考核指标名称" align="center" prop="name" />
|
|
|
51
|
+ <el-table-column label="一级分类" align="center" prop="categoryNameOne" />
|
|
|
52
|
+ <el-table-column label="二级分类" align="center" prop="categoryName" />
|
|
|
53
|
+ <el-table-column label="分值" align="center" prop="score" />
|
|
|
54
|
+ <el-table-column label="单位" align="center" prop="unit" />
|
|
|
55
|
+ <el-table-column label="事病假" align="center" prop="leaveType">
|
|
|
56
|
+ <template #default="scope">
|
|
|
57
|
+ <dict-tag :options="base_performance_indicator_leave_type" :value="scope.row.leaveType" />
|
|
|
58
|
+ </template>
|
|
|
59
|
+ </el-table-column>
|
|
|
60
|
+ <!-- <el-table-column label="检查标准" align="center" prop="checkStandard" />
|
|
|
61
|
+ <el-table-column label="检查方法" align="center" prop="checkMethod" /> -->
|
|
|
62
|
+ <!-- <el-table-column label="重要程度" align="center" prop="importance">
|
|
|
63
|
+ <template #default="scope">
|
|
|
64
|
+ <dict-tag :options="base_check_importance" :value="scope.row.importance" />
|
|
|
65
|
+ </template>
|
|
|
66
|
+</el-table-column> -->
|
|
|
67
|
+ <!-- <el-table-column label="状态" align="center" prop="status" >
|
|
|
68
|
+ <template #default="scope">
|
|
|
69
|
+ <dict-tag :options="base_check_status" :value="scope.row.status"/>
|
|
|
70
|
+ </template>
|
|
|
71
|
+ </el-table-column> -->
|
|
|
72
|
+ <!-- <el-table-column label="备注" align="center" prop="remark" /> -->
|
|
|
73
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
74
|
+ <template #default="scope">
|
|
|
75
|
+ <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
|
|
76
|
+ v-hasPermi="['system:indicator:edit']">修改</el-button>
|
|
|
77
|
+ <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
|
|
78
|
+ v-hasPermi="['system:indicator:remove']">删除</el-button>
|
|
|
79
|
+ </template>
|
|
|
80
|
+ </el-table-column>
|
|
|
81
|
+ </el-table>
|
|
|
82
|
+
|
|
|
83
|
+ <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
|
|
84
|
+ v-model:limit="queryParams.pageSize" @pagination="getList" />
|
|
|
85
|
+
|
|
|
86
|
+ <!-- 添加或修改考核指标对话框 -->
|
|
|
87
|
+ <el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
|
|
88
|
+ <el-form ref="projectRef" :model="form" :rules="rules" label-width="120px">
|
|
|
89
|
+ <!-- <el-form-item label="编码" prop="code">
|
|
|
90
|
+ <el-input v-model="form.code" placeholder="请输入编码" />
|
|
|
91
|
+ </el-form-item> -->
|
|
|
92
|
+ <el-form-item label="考核指标名称" prop="name">
|
|
|
93
|
+ <el-input v-model="form.name" placeholder="请输入考核指标名称" />
|
|
|
94
|
+ </el-form-item>
|
|
|
95
|
+ <el-form-item label="二级分类" prop="categoryCode">
|
|
|
96
|
+ <el-tree-select v-model="form.categoryCode" :data="enableCategoryOptions"
|
|
|
97
|
+ :props="{ value: 'code', label: 'name', children: 'children' }" value-key="id" placeholder="请选择二级分类"
|
|
|
98
|
+ @node-click="handleNodeClick" />
|
|
|
99
|
+ </el-form-item>
|
|
|
100
|
+ <el-form-item label="分值" prop="score">
|
|
|
101
|
+ <el-input-number v-model="form.score" :precision="2" placeholder="请输入分值" style="width: 100%" />
|
|
|
102
|
+ </el-form-item>
|
|
|
103
|
+
|
|
|
104
|
+
|
|
|
105
|
+
|
|
|
106
|
+
|
|
|
107
|
+ <el-form-item label="单位" prop="unit">
|
|
|
108
|
+ <el-input v-model="form.unit" placeholder="请输入单位" />
|
|
|
109
|
+ </el-form-item>
|
|
|
110
|
+
|
|
|
111
|
+ <el-form-item label="事病假" prop="leaveType">
|
|
|
112
|
+ <el-select v-model="form.leaveType" placeholder="请选择事病假" style="width: 100%">
|
|
|
113
|
+ <el-option v-for="dict in base_performance_indicator_leave_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
114
|
+ </el-select>
|
|
|
115
|
+ </el-form-item>
|
|
|
116
|
+ <!-- <el-form-item label="重要程度" prop="importance">
|
|
|
117
|
+ <el-select v-model="form.importance" placeholder="请选择重要程度">
|
|
|
118
|
+ <el-option v-for="dict in base_check_importance" :key="dict.value" :label="dict.label"
|
|
|
119
|
+ :value="dict.value"></el-option>
|
|
|
120
|
+ </el-select>
|
|
|
121
|
+ </el-form-item> -->
|
|
|
122
|
+
|
|
|
123
|
+ <el-form-item label="备注" prop="remark">
|
|
|
124
|
+ <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
|
|
125
|
+ </el-form-item>
|
|
|
126
|
+ </el-form>
|
|
|
127
|
+ <template #footer>
|
|
|
128
|
+ <div class="dialog-footer">
|
|
|
129
|
+ <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
130
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
131
|
+ </div>
|
|
|
132
|
+ </template>
|
|
|
133
|
+ </el-dialog>
|
|
|
134
|
+
|
|
|
135
|
+ <!-- 导入对话框 -->
|
|
|
136
|
+ <el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
|
|
|
137
|
+ <el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
|
|
|
138
|
+ :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
|
|
|
139
|
+ :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
|
|
140
|
+ <el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
|
|
141
|
+ <div class="el-upload__text">
|
|
|
142
|
+ 将文件拖到此处,或<em>点击上传</em>
|
|
|
143
|
+ </div>
|
|
|
144
|
+ <template #tip>
|
|
|
145
|
+ <div class="el-upload__tip">
|
|
|
146
|
+ <!-- <el-checkbox v-model="upload.updateSupport" /> -->
|
|
|
147
|
+ <!-- 是否更新已经存在的考核指标数据 -->
|
|
|
148
|
+ <span>仅允许导入xls、xlsx格式文件。</span>
|
|
|
149
|
+ <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
|
|
|
150
|
+ @click="importTemplate">下载模板</el-link>
|
|
|
151
|
+ </div>
|
|
|
152
|
+ </template>
|
|
|
153
|
+ </el-upload>
|
|
|
154
|
+ <template #footer>
|
|
|
155
|
+ <div class="dialog-footer">
|
|
|
156
|
+ <el-button type="primary" @click="submitFileForm">确 定</el-button>
|
|
|
157
|
+ <el-button @click="upload.open = false">取 消</el-button>
|
|
|
158
|
+ </div>
|
|
|
159
|
+ </template>
|
|
|
160
|
+ </el-dialog>
|
|
|
161
|
+ </div>
|
|
|
162
|
+</template>
|
|
|
163
|
+
|
|
|
164
|
+<script setup name="Project">
|
|
|
165
|
+import { listIndicator, getIndicator, delIndicator, addIndicator, updateIndicator, exportIndicator, importIndicator, getImportTemplate } from "@/api/system/classificationAssess"
|
|
|
166
|
+import { queryAssessCategoryTree } from "@/api/system/classificationAssessIndicator"
|
|
|
167
|
+import { getToken } from '@/utils/auth'
|
|
|
168
|
+const { proxy } = getCurrentInstance()
|
|
|
169
|
+const { base_check_importance, check_level, check_checked_level, base_performance_indicator_leave_type } = proxy.useDict('base_check_importance', 'check_level', 'check_checked_level', 'base_performance_indicator_leave_type')
|
|
|
170
|
+
|
|
|
171
|
+const indicatorList = ref([])
|
|
|
172
|
+const open = ref(false)
|
|
|
173
|
+const loading = ref(true)
|
|
|
174
|
+const showSearch = ref(true)
|
|
|
175
|
+const ids = ref([])
|
|
|
176
|
+const single = ref(true)
|
|
|
177
|
+const multiple = ref(true)
|
|
|
178
|
+const total = ref(0)
|
|
|
179
|
+const title = ref("")
|
|
|
180
|
+const base_check_status = ref([{ "value": "0", "label": "启用" }, { "value": "1", "label": "停用" }])
|
|
|
181
|
+const enableCategoryOptions = ref(undefined)
|
|
|
182
|
+
|
|
|
183
|
+// 导入参数
|
|
|
184
|
+const upload = reactive({
|
|
|
185
|
+ // 是否显示弹出层
|
|
|
186
|
+ open: false,
|
|
|
187
|
+ // 弹出层标题
|
|
|
188
|
+ title: "",
|
|
|
189
|
+ // 是否禁用上传
|
|
|
190
|
+ isUploading: false,
|
|
|
191
|
+ // 是否更新已经存在的考核指标数据
|
|
|
192
|
+ updateSupport: 0,
|
|
|
193
|
+ // 设置上传的请求头部
|
|
|
194
|
+ headers: { Authorization: "Bearer " + getToken() },
|
|
|
195
|
+ // 上传的地址
|
|
|
196
|
+ url: import.meta.env.VITE_APP_BASE_API + "/system/indicator/importData"
|
|
|
197
|
+})
|
|
|
198
|
+
|
|
|
199
|
+const uploadRef = ref()
|
|
|
200
|
+
|
|
|
201
|
+const data = reactive({
|
|
|
202
|
+ form: {},
|
|
|
203
|
+ queryParams: {
|
|
|
204
|
+ pageNum: 1,
|
|
|
205
|
+ pageSize: 10,
|
|
|
206
|
+ name: null,
|
|
|
207
|
+ code: null,
|
|
|
208
|
+ },
|
|
|
209
|
+ rules: {
|
|
|
210
|
+ name: [
|
|
|
211
|
+ { required: true, message: "考核指标名称不能为空", trigger: "blur" }
|
|
|
212
|
+ ],
|
|
|
213
|
+ categoryCode: [
|
|
|
214
|
+ { required: true, message: "分类编码不能为空", trigger: "blur" }
|
|
|
215
|
+ ],
|
|
|
216
|
+ // importance: [
|
|
|
217
|
+ // { required: true, message: "重要程度不能为空", trigger: "change" }
|
|
|
218
|
+ // ],
|
|
|
219
|
+ status: [
|
|
|
220
|
+ { required: true, message: "状态不能为空", trigger: "change" }
|
|
|
221
|
+ ],
|
|
|
222
|
+ categoryName: [
|
|
|
223
|
+ { required: true, message: "分类名称不能为空", trigger: "blur" }
|
|
|
224
|
+ ],
|
|
|
225
|
+ code: [
|
|
|
226
|
+ { required: true, message: "编码不能为空", trigger: "blur" }
|
|
|
227
|
+ ],
|
|
|
228
|
+ // importanceDesc: [
|
|
|
229
|
+ // { required: true, message: "重要程度名称不能为空", trigger: "blur" }
|
|
|
230
|
+ // ]
|
|
|
231
|
+ }
|
|
|
232
|
+})
|
|
|
233
|
+
|
|
|
234
|
+const { queryParams, form, rules } = toRefs(data)
|
|
|
235
|
+
|
|
|
236
|
+/** 查询考核指标列表 */
|
|
|
237
|
+function getList() {
|
|
|
238
|
+ loading.value = true
|
|
|
239
|
+ listIndicator(queryParams.value).then(response => {
|
|
|
240
|
+ indicatorList.value = response.rows
|
|
|
241
|
+ total.value = response.total
|
|
|
242
|
+ loading.value = false
|
|
|
243
|
+ })
|
|
|
244
|
+}
|
|
|
245
|
+
|
|
|
246
|
+// 取消按钮
|
|
|
247
|
+function cancel() {
|
|
|
248
|
+ open.value = false
|
|
|
249
|
+ reset()
|
|
|
250
|
+}
|
|
|
251
|
+
|
|
|
252
|
+// 表单重置
|
|
|
253
|
+function reset() {
|
|
|
254
|
+ form.value = {
|
|
|
255
|
+ tenantId: null,
|
|
|
256
|
+ revision: null,
|
|
|
257
|
+ createBy: null,
|
|
|
258
|
+ createTime: null,
|
|
|
259
|
+ updateBy: null,
|
|
|
260
|
+ updateTime: null,
|
|
|
261
|
+ id: null,
|
|
|
262
|
+ name: null,
|
|
|
263
|
+ categoryCode: null,
|
|
|
264
|
+ categoryCodeOne: null,
|
|
|
265
|
+ checkStandard: null,
|
|
|
266
|
+ checkMethod: null,
|
|
|
267
|
+ importance: null,
|
|
|
268
|
+ status: null,
|
|
|
269
|
+ categoryName: null,
|
|
|
270
|
+ categoryNameOne: null,
|
|
|
271
|
+ remark: null,
|
|
|
272
|
+ code: null,
|
|
|
273
|
+ importanceDesc: null
|
|
|
274
|
+ }
|
|
|
275
|
+ proxy.resetForm("projectRef")
|
|
|
276
|
+}
|
|
|
277
|
+
|
|
|
278
|
+/** 搜索按钮操作 */
|
|
|
279
|
+function handleQuery() {
|
|
|
280
|
+ queryParams.value.pageNum = 1
|
|
|
281
|
+ getList()
|
|
|
282
|
+}
|
|
|
283
|
+
|
|
|
284
|
+/** 重置按钮操作 */
|
|
|
285
|
+function resetQuery() {
|
|
|
286
|
+ proxy.resetForm("queryRef")
|
|
|
287
|
+ handleQuery()
|
|
|
288
|
+}
|
|
|
289
|
+
|
|
|
290
|
+// 多选框选中数据
|
|
|
291
|
+function handleSelectionChange(selection) {
|
|
|
292
|
+ ids.value = selection.map(item => item.id)
|
|
|
293
|
+ single.value = selection.length != 1
|
|
|
294
|
+ multiple.value = !selection.length
|
|
|
295
|
+}
|
|
|
296
|
+
|
|
|
297
|
+/** 新增按钮操作 */
|
|
|
298
|
+function handleAdd() {
|
|
|
299
|
+ reset()
|
|
|
300
|
+ open.value = true
|
|
|
301
|
+ title.value = "添加考核指标"
|
|
|
302
|
+}
|
|
|
303
|
+
|
|
|
304
|
+/** 修改按钮操作 */
|
|
|
305
|
+function handleUpdate(row) {
|
|
|
306
|
+ reset()
|
|
|
307
|
+ const _id = row.id || ids.value
|
|
|
308
|
+ getIndicator(_id).then(response => {
|
|
|
309
|
+ form.value = {
|
|
|
310
|
+ ...response.data,
|
|
|
311
|
+ checkLevel: response.data?.checkLevel?.split(","),
|
|
|
312
|
+ }
|
|
|
313
|
+ open.value = true
|
|
|
314
|
+ title.value = "修改考核指标"
|
|
|
315
|
+ })
|
|
|
316
|
+}
|
|
|
317
|
+
|
|
|
318
|
+/** 提交按钮 */
|
|
|
319
|
+function submitForm() {
|
|
|
320
|
+ proxy.$refs["projectRef"].validate(valid => {
|
|
|
321
|
+ if (valid) {
|
|
|
322
|
+ // 根据categoryCode获取categoryName和一级分类信息
|
|
|
323
|
+ if (form.value.categoryCode) {
|
|
|
324
|
+ const categoryInfo = getCategoryInfoByCode(form.value.categoryCode)
|
|
|
325
|
+ form.value.categoryName = categoryInfo.categoryName
|
|
|
326
|
+ form.value.categoryCodeOne = categoryInfo.categoryCodeOne
|
|
|
327
|
+ form.value.categoryNameOne = categoryInfo.categoryNameOne
|
|
|
328
|
+ }
|
|
|
329
|
+
|
|
|
330
|
+ // 名称转换
|
|
|
331
|
+ if (form.value.importance) {
|
|
|
332
|
+ form.value.importanceDesc = base_check_importance.value.find(item => item.value === form.value.importance).label;
|
|
|
333
|
+ }
|
|
|
334
|
+ // form.value.checkLevelDesc = check_level.value.find(item => item.value === form.value.checkLevel).label;
|
|
|
335
|
+ let res = {
|
|
|
336
|
+ ...form.value,
|
|
|
337
|
+ checkLevel: form.value.checkLevel && form.value.checkLevel.join(","),
|
|
|
338
|
+ }
|
|
|
339
|
+ if (form.value.id != null) {
|
|
|
340
|
+ updateIndicator(res).then(response => {
|
|
|
341
|
+ proxy.$modal.msgSuccess("修改成功")
|
|
|
342
|
+ open.value = false
|
|
|
343
|
+ getList()
|
|
|
344
|
+ })
|
|
|
345
|
+ } else {
|
|
|
346
|
+ addIndicator(res).then(response => {
|
|
|
347
|
+ proxy.$modal.msgSuccess("新增成功")
|
|
|
348
|
+ open.value = false
|
|
|
349
|
+ getList()
|
|
|
350
|
+ })
|
|
|
351
|
+ }
|
|
|
352
|
+ }
|
|
|
353
|
+ })
|
|
|
354
|
+}
|
|
|
355
|
+
|
|
|
356
|
+/** 删除按钮操作 */
|
|
|
357
|
+function handleDelete(row) {
|
|
|
358
|
+ const _ids = row.id || ids.value
|
|
|
359
|
+ proxy.$modal.confirm('是否确认删除数据项?').then(function () {
|
|
|
360
|
+ return delIndicator(_ids)
|
|
|
361
|
+ }).then(() => {
|
|
|
362
|
+ getList()
|
|
|
363
|
+ proxy.$modal.msgSuccess("删除成功")
|
|
|
364
|
+ }).catch(() => { })
|
|
|
365
|
+}
|
|
|
366
|
+
|
|
|
367
|
+/** 导出按钮操作 */
|
|
|
368
|
+function handleExport() {
|
|
|
369
|
+ // 过滤掉值为null的参数,但保留分页参数
|
|
|
370
|
+ const filteredParams = Object.fromEntries(
|
|
|
371
|
+ Object.entries(queryParams.value).filter(([key, value]) => {
|
|
|
372
|
+ // 保留分页参数
|
|
|
373
|
+ if (key === 'pageNum' || key === 'pageSize') return true
|
|
|
374
|
+ // 过滤掉其他为null的参数
|
|
|
375
|
+ return value !== null
|
|
|
376
|
+ })
|
|
|
377
|
+ )
|
|
|
378
|
+
|
|
|
379
|
+ proxy.download('/system/indicator/export', filteredParams, `indicator_${new Date().getTime()}.xlsx`)
|
|
|
380
|
+}
|
|
|
381
|
+/** 查询分类下拉树结构 */
|
|
|
382
|
+function getCategoryTree() {
|
|
|
383
|
+ queryAssessCategoryTree().then(response => {
|
|
|
384
|
+ enableCategoryOptions.value = response.data
|
|
|
385
|
+ })
|
|
|
386
|
+}
|
|
|
387
|
+
|
|
|
388
|
+function handleNodeClick(data) {
|
|
|
389
|
+ form.value.categoryName = data.name;
|
|
|
390
|
+ // 根据选中的二级分类获取一级分类信息
|
|
|
391
|
+ const categoryInfo = getCategoryInfoByCode(data.code)
|
|
|
392
|
+ form.value.categoryCodeOne = categoryInfo.categoryCodeOne
|
|
|
393
|
+ form.value.categoryNameOne = categoryInfo.categoryNameOne
|
|
|
394
|
+}
|
|
|
395
|
+
|
|
|
396
|
+/** 根据categoryCode获取categoryName和categoryCodeOne, categoryNameOne */
|
|
|
397
|
+function getCategoryInfoByCode(categoryCode) {
|
|
|
398
|
+ if (!categoryCode || !enableCategoryOptions.value) return { categoryName: '', categoryCodeOne: '', categoryNameOne: '' }
|
|
|
399
|
+
|
|
|
400
|
+ const findCategory = (categories, parent = null) => {
|
|
|
401
|
+ for (const category of categories) {
|
|
|
402
|
+ if (category.code === categoryCode) {
|
|
|
403
|
+ return {
|
|
|
404
|
+ categoryName: category.name,
|
|
|
405
|
+ categoryCodeOne: parent ? parent.code : '',
|
|
|
406
|
+ categoryNameOne: parent ? parent.name : ''
|
|
|
407
|
+ }
|
|
|
408
|
+ }
|
|
|
409
|
+ if (category.children && category.children.length > 0) {
|
|
|
410
|
+ const result = findCategory(category.children, category)
|
|
|
411
|
+ if (result) return result
|
|
|
412
|
+ }
|
|
|
413
|
+ }
|
|
|
414
|
+ return { categoryName: '', categoryCodeOne: '', categoryNameOne: '' }
|
|
|
415
|
+ }
|
|
|
416
|
+
|
|
|
417
|
+ return findCategory(enableCategoryOptions.value)
|
|
|
418
|
+}
|
|
|
419
|
+
|
|
|
420
|
+/** 导入按钮操作 */
|
|
|
421
|
+function handleImport() {
|
|
|
422
|
+ upload.title = "考核指标导入"
|
|
|
423
|
+ upload.open = true
|
|
|
424
|
+}
|
|
|
425
|
+
|
|
|
426
|
+/** 下载模板操作 */
|
|
|
427
|
+function importTemplate() {
|
|
|
428
|
+ proxy.download('/system/indicator/importTemplate', {
|
|
|
429
|
+ }, `考核指标导入模板_${new Date().getTime()}.xlsx`)
|
|
|
430
|
+}
|
|
|
431
|
+
|
|
|
432
|
+/** 文件上传中处理 */
|
|
|
433
|
+const handleFileUploadProgress = (event, file, fileList) => {
|
|
|
434
|
+ upload.isUploading = true
|
|
|
435
|
+}
|
|
|
436
|
+
|
|
|
437
|
+/** 文件上传成功处理 */
|
|
|
438
|
+const handleFileSuccess = (response, file, fileList) => {
|
|
|
439
|
+ upload.open = false
|
|
|
440
|
+ upload.isUploading = false
|
|
|
441
|
+ uploadRef.value.handleRemove(file)
|
|
|
442
|
+ proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true })
|
|
|
443
|
+ getList()
|
|
|
444
|
+}
|
|
|
445
|
+
|
|
|
446
|
+/** 提交上传文件 */
|
|
|
447
|
+function submitFileForm() {
|
|
|
448
|
+ uploadRef.value.submit()
|
|
|
449
|
+}
|
|
|
450
|
+
|
|
|
451
|
+getCategoryTree()
|
|
|
452
|
+getList()
|
|
|
453
|
+</script>
|