|
|
@@ -25,10 +25,10 @@
|
|
25
|
25
|
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
|
26
|
26
|
v-hasPermi="['system:project:add']">新增</el-button>
|
|
27
|
27
|
</el-col>
|
|
28
|
|
- <el-col :span="1.5">
|
|
|
28
|
+ <!-- <el-col :span="1.5">
|
|
29
|
29
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
|
30
|
30
|
v-hasPermi="['system:project:edit']">修改</el-button>
|
|
31
|
|
- </el-col>
|
|
|
31
|
+ </el-col> -->
|
|
32
|
32
|
<el-col :span="1.5">
|
|
33
|
33
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
|
34
|
34
|
v-hasPermi="['system:project:remove']">删除</el-button>
|
|
|
@@ -37,10 +37,14 @@
|
|
37
|
37
|
<el-button type="warning" plain icon="Download" @click="handleExport"
|
|
38
|
38
|
v-hasPermi="['system:project:export']">导出</el-button>
|
|
39
|
39
|
</el-col>
|
|
|
40
|
+ <el-col :span="1.5">
|
|
|
41
|
+ <el-button type="info" plain icon="Upload" @click="handleImport"
|
|
|
42
|
+ v-hasPermi="['system:project:import']">导入</el-button>
|
|
|
43
|
+ </el-col>
|
|
40
|
44
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
41
|
45
|
</el-row>
|
|
42
|
46
|
|
|
43
|
|
- <el-table v-loading="loading" :data="projectList" @selection-change="handleSelectionChange">
|
|
|
47
|
+ <el-table v-loading="loading" :data="indicatorList" @selection-change="handleSelectionChange">
|
|
44
|
48
|
<el-table-column type="selection" width="55" align="center" />
|
|
45
|
49
|
<el-table-column label="编码" align="center" prop="code" />
|
|
46
|
50
|
<el-table-column label="考核指标名称" align="center" prop="name" />
|
|
|
@@ -77,15 +81,15 @@
|
|
77
|
81
|
<!-- 添加或修改考核指标对话框 -->
|
|
78
|
82
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
|
79
|
83
|
<el-form ref="projectRef" :model="form" :rules="rules" label-width="120px">
|
|
80
|
|
- <el-form-item label="编码" prop="code" v-if="form.id">
|
|
81
|
|
- <el-input v-model="form.code" placeholder="请输入编码" disabled />
|
|
82
|
|
- </el-form-item>
|
|
|
84
|
+ <!-- <el-form-item label="编码" prop="code">
|
|
|
85
|
+ <el-input v-model="form.code" placeholder="请输入编码" />
|
|
|
86
|
+ </el-form-item> -->
|
|
83
|
87
|
<el-form-item label="考核指标名称" prop="name">
|
|
84
|
88
|
<el-input v-model="form.name" placeholder="请输入考核指标名称" />
|
|
85
|
89
|
</el-form-item>
|
|
86
|
90
|
<el-form-item label="所属分类" prop="categoryCode">
|
|
87
|
91
|
<el-tree-select v-model="form.categoryCode" :data="enableCategoryOptions"
|
|
88
|
|
- :props="{ value: 'code', label: 'label', children: 'children' }" value-key="id" placeholder="请选择所属分类"
|
|
|
92
|
+ :props="{ value: 'code', label: 'name', children: 'children' }" value-key="id" placeholder="请选择所属分类"
|
|
89
|
93
|
@node-click="handleNodeClick" />
|
|
90
|
94
|
</el-form-item>
|
|
91
|
95
|
<el-form-item label="分值" prop="score">
|
|
|
@@ -101,8 +105,9 @@
|
|
101
|
105
|
|
|
102
|
106
|
<el-form-item label="事病假" prop="leaveType">
|
|
103
|
107
|
<el-select v-model="form.leaveType" placeholder="请选择事病假" style="width: 100%">
|
|
104
|
|
- <el-option label="是" value="1" />
|
|
105
|
|
- <el-option label="否" value="0" />
|
|
|
108
|
+ <el-option label="事假" value="事假" />
|
|
|
109
|
+ <el-option label="病假" value="病假" />
|
|
|
110
|
+ <el-option label="无" value="无" />
|
|
106
|
111
|
</el-select>
|
|
107
|
112
|
</el-form-item>
|
|
108
|
113
|
<!-- <el-form-item label="重要程度" prop="importance">
|
|
|
@@ -123,17 +128,44 @@
|
|
123
|
128
|
</div>
|
|
124
|
129
|
</template>
|
|
125
|
130
|
</el-dialog>
|
|
|
131
|
+
|
|
|
132
|
+ <!-- 导入对话框 -->
|
|
|
133
|
+ <el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
|
|
|
134
|
+ <el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
|
|
|
135
|
+ :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
|
|
|
136
|
+ :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
|
|
137
|
+ <el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
|
|
138
|
+ <div class="el-upload__text">
|
|
|
139
|
+ 将文件拖到此处,或<em>点击上传</em>
|
|
|
140
|
+ </div>
|
|
|
141
|
+ <template #tip>
|
|
|
142
|
+ <div class="el-upload__tip">
|
|
|
143
|
+ <!-- <el-checkbox v-model="upload.updateSupport" /> -->
|
|
|
144
|
+ <!-- 是否更新已经存在的考核指标数据 -->
|
|
|
145
|
+ <span>仅允许导入xls、xlsx格式文件。</span>
|
|
|
146
|
+ <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
|
|
|
147
|
+ @click="importTemplate">下载模板</el-link>
|
|
|
148
|
+ </div>
|
|
|
149
|
+ </template>
|
|
|
150
|
+ </el-upload>
|
|
|
151
|
+ <template #footer>
|
|
|
152
|
+ <div class="dialog-footer">
|
|
|
153
|
+ <el-button type="primary" @click="submitFileForm">确 定</el-button>
|
|
|
154
|
+ <el-button @click="upload.open = false">取 消</el-button>
|
|
|
155
|
+ </div>
|
|
|
156
|
+ </template>
|
|
|
157
|
+ </el-dialog>
|
|
126
|
158
|
</div>
|
|
127
|
159
|
</template>
|
|
128
|
160
|
|
|
129
|
161
|
<script setup name="Project">
|
|
130
|
|
-import { listProject, getProject, delProject, addProject, updateProject } from "@/api/system/project"
|
|
131
|
|
-import { treeSelectByType } from "@/api/system/common"
|
|
132
|
|
-
|
|
|
162
|
+import { listIndicator, getIndicator, delIndicator, addIndicator, updateIndicator, exportIndicator, importIndicator, getImportTemplate } from "@/api/system/classificationAssess"
|
|
|
163
|
+import { queryAssessCategoryTree } from "@/api/system/classificationAssessIndicator"
|
|
|
164
|
+import { getToken } from '@/utils/auth'
|
|
133
|
165
|
const { proxy } = getCurrentInstance()
|
|
134
|
166
|
const { base_check_importance, check_level, check_checked_level } = proxy.useDict('base_check_importance', 'check_level', 'check_checked_level')
|
|
135
|
167
|
|
|
136
|
|
-const projectList = ref([])
|
|
|
168
|
+const indicatorList = ref([])
|
|
137
|
169
|
const open = ref(false)
|
|
138
|
170
|
const loading = ref(true)
|
|
139
|
171
|
const showSearch = ref(true)
|
|
|
@@ -145,20 +177,31 @@ const title = ref("")
|
|
145
|
177
|
const base_check_status = ref([{ "value": "0", "label": "启用" }, { "value": "1", "label": "停用" }])
|
|
146
|
178
|
const enableCategoryOptions = ref(undefined)
|
|
147
|
179
|
|
|
|
180
|
+// 导入参数
|
|
|
181
|
+const upload = reactive({
|
|
|
182
|
+ // 是否显示弹出层
|
|
|
183
|
+ open: false,
|
|
|
184
|
+ // 弹出层标题
|
|
|
185
|
+ title: "",
|
|
|
186
|
+ // 是否禁用上传
|
|
|
187
|
+ isUploading: false,
|
|
|
188
|
+ // 是否更新已经存在的考核指标数据
|
|
|
189
|
+ updateSupport: 0,
|
|
|
190
|
+ // 设置上传的请求头部
|
|
|
191
|
+ headers: { Authorization: "Bearer " + getToken() },
|
|
|
192
|
+ // 上传的地址
|
|
|
193
|
+ url: import.meta.env.VITE_APP_BASE_API + "/system/indicator/importData"
|
|
|
194
|
+})
|
|
|
195
|
+
|
|
|
196
|
+const uploadRef = ref()
|
|
|
197
|
+
|
|
148
|
198
|
const data = reactive({
|
|
149
|
199
|
form: {},
|
|
150
|
200
|
queryParams: {
|
|
151
|
201
|
pageNum: 1,
|
|
152
|
202
|
pageSize: 10,
|
|
153
|
203
|
name: null,
|
|
154
|
|
- categoryCode: null,
|
|
155
|
|
- checkStandard: null,
|
|
156
|
|
- checkMethod: null,
|
|
157
|
|
- importance: null,
|
|
158
|
|
- status: null,
|
|
159
|
|
- categoryName: null,
|
|
160
|
204
|
code: null,
|
|
161
|
|
- importanceDesc: null
|
|
162
|
205
|
},
|
|
163
|
206
|
rules: {
|
|
164
|
207
|
name: [
|
|
|
@@ -190,8 +233,8 @@ const { queryParams, form, rules } = toRefs(data)
|
|
190
|
233
|
/** 查询考核指标列表 */
|
|
191
|
234
|
function getList() {
|
|
192
|
235
|
loading.value = true
|
|
193
|
|
- listProject(queryParams.value).then(response => {
|
|
194
|
|
- projectList.value = response.rows
|
|
|
236
|
+ listIndicator(queryParams.value).then(response => {
|
|
|
237
|
+ indicatorList.value = response.rows
|
|
195
|
238
|
total.value = response.total
|
|
196
|
239
|
loading.value = false
|
|
197
|
240
|
})
|
|
|
@@ -257,7 +300,7 @@ function handleAdd() {
|
|
257
|
300
|
function handleUpdate(row) {
|
|
258
|
301
|
reset()
|
|
259
|
302
|
const _id = row.id || ids.value
|
|
260
|
|
- getProject(_id).then(response => {
|
|
|
303
|
+ getIndicator(_id).then(response => {
|
|
261
|
304
|
form.value = {
|
|
262
|
305
|
...response.data,
|
|
263
|
306
|
checkLevel: response.data?.checkLevel?.split(","),
|
|
|
@@ -271,6 +314,11 @@ function handleUpdate(row) {
|
|
271
|
314
|
function submitForm() {
|
|
272
|
315
|
proxy.$refs["projectRef"].validate(valid => {
|
|
273
|
316
|
if (valid) {
|
|
|
317
|
+ // 根据categoryCode获取categoryName
|
|
|
318
|
+ if (form.value.categoryCode) {
|
|
|
319
|
+ form.value.categoryName = getCategoryNameByCode(form.value.categoryCode)
|
|
|
320
|
+ }
|
|
|
321
|
+
|
|
274
|
322
|
// 名称转换
|
|
275
|
323
|
if (form.value.importance) {
|
|
276
|
324
|
form.value.importanceDesc = base_check_importance.value.find(item => item.value === form.value.importance).label;
|
|
|
@@ -281,13 +329,13 @@ function submitForm() {
|
|
281
|
329
|
checkLevel: form.value.checkLevel && form.value.checkLevel.join(","),
|
|
282
|
330
|
}
|
|
283
|
331
|
if (form.value.id != null) {
|
|
284
|
|
- updateProject(res).then(response => {
|
|
|
332
|
+ updateIndicator(res).then(response => {
|
|
285
|
333
|
proxy.$modal.msgSuccess("修改成功")
|
|
286
|
334
|
open.value = false
|
|
287
|
335
|
getList()
|
|
288
|
336
|
})
|
|
289
|
337
|
} else {
|
|
290
|
|
- addProject(res).then(response => {
|
|
|
338
|
+ addIndicator(res).then(response => {
|
|
291
|
339
|
proxy.$modal.msgSuccess("新增成功")
|
|
292
|
340
|
open.value = false
|
|
293
|
341
|
getList()
|
|
|
@@ -301,7 +349,7 @@ function submitForm() {
|
|
301
|
349
|
function handleDelete(row) {
|
|
302
|
350
|
const _ids = row.id || ids.value
|
|
303
|
351
|
proxy.$modal.confirm('是否确认删除数据项?').then(function () {
|
|
304
|
|
- return delProject(_ids)
|
|
|
352
|
+ return delIndicator(_ids)
|
|
305
|
353
|
}).then(() => {
|
|
306
|
354
|
getList()
|
|
307
|
355
|
proxy.$modal.msgSuccess("删除成功")
|
|
|
@@ -310,19 +358,78 @@ function handleDelete(row) {
|
|
310
|
358
|
|
|
311
|
359
|
/** 导出按钮操作 */
|
|
312
|
360
|
function handleExport() {
|
|
313
|
|
- proxy.download('system/project/export', {
|
|
314
|
|
- ...queryParams.value
|
|
315
|
|
- }, `project_${new Date().getTime()}.xlsx`)
|
|
|
361
|
+ // 过滤掉值为null的参数,但保留分页参数
|
|
|
362
|
+ const filteredParams = Object.fromEntries(
|
|
|
363
|
+ Object.entries(queryParams.value).filter(([key, value]) => {
|
|
|
364
|
+ // 保留分页参数
|
|
|
365
|
+ if (key === 'pageNum' || key === 'pageSize') return true
|
|
|
366
|
+ // 过滤掉其他为null的参数
|
|
|
367
|
+ return value !== null
|
|
|
368
|
+ })
|
|
|
369
|
+ )
|
|
|
370
|
+
|
|
|
371
|
+ proxy.download('/system/indicator/export', filteredParams, `indicator_${new Date().getTime()}.xlsx`)
|
|
316
|
372
|
}
|
|
317
|
373
|
/** 查询分类下拉树结构 */
|
|
318
|
374
|
function getCategoryTree() {
|
|
319
|
|
- treeSelectByType("CHECK_CATEGORY", 2).then(response => {
|
|
|
375
|
+ queryAssessCategoryTree().then(response => {
|
|
320
|
376
|
enableCategoryOptions.value = response.data
|
|
321
|
377
|
})
|
|
322
|
378
|
}
|
|
323
|
379
|
|
|
324
|
380
|
function handleNodeClick(data) {
|
|
325
|
|
- form.value.categoryName = data.label;
|
|
|
381
|
+ form.value.categoryName = data.name;
|
|
|
382
|
+}
|
|
|
383
|
+
|
|
|
384
|
+/** 根据categoryCode获取categoryName */
|
|
|
385
|
+function getCategoryNameByCode(categoryCode) {
|
|
|
386
|
+ if (!categoryCode || !enableCategoryOptions.value) return ''
|
|
|
387
|
+
|
|
|
388
|
+ const findCategory = (categories) => {
|
|
|
389
|
+ for (const category of categories) {
|
|
|
390
|
+ if (category.code === categoryCode) {
|
|
|
391
|
+ return category.name
|
|
|
392
|
+ }
|
|
|
393
|
+ if (category.children && category.children.length > 0) {
|
|
|
394
|
+ const result = findCategory(category.children)
|
|
|
395
|
+ if (result) return result
|
|
|
396
|
+ }
|
|
|
397
|
+ }
|
|
|
398
|
+ return ''
|
|
|
399
|
+ }
|
|
|
400
|
+
|
|
|
401
|
+ return findCategory(enableCategoryOptions.value)
|
|
|
402
|
+}
|
|
|
403
|
+
|
|
|
404
|
+/** 导入按钮操作 */
|
|
|
405
|
+function handleImport() {
|
|
|
406
|
+ upload.title = "考核指标导入"
|
|
|
407
|
+ upload.open = true
|
|
|
408
|
+}
|
|
|
409
|
+
|
|
|
410
|
+/** 下载模板操作 */
|
|
|
411
|
+function importTemplate() {
|
|
|
412
|
+ proxy.download('/system/indicator/importTemplate', {
|
|
|
413
|
+ }, `考核指标导入模板_${new Date().getTime()}.xlsx`)
|
|
|
414
|
+}
|
|
|
415
|
+
|
|
|
416
|
+/** 文件上传中处理 */
|
|
|
417
|
+const handleFileUploadProgress = (event, file, fileList) => {
|
|
|
418
|
+ upload.isUploading = true
|
|
|
419
|
+}
|
|
|
420
|
+
|
|
|
421
|
+/** 文件上传成功处理 */
|
|
|
422
|
+const handleFileSuccess = (response, file, fileList) => {
|
|
|
423
|
+ upload.open = false
|
|
|
424
|
+ upload.isUploading = false
|
|
|
425
|
+ uploadRef.value.handleRemove(file)
|
|
|
426
|
+ proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true })
|
|
|
427
|
+ getList()
|
|
|
428
|
+}
|
|
|
429
|
+
|
|
|
430
|
+/** 提交上传文件 */
|
|
|
431
|
+function submitFileForm() {
|
|
|
432
|
+ uploadRef.value.submit()
|
|
326
|
433
|
}
|
|
327
|
434
|
|
|
328
|
435
|
getCategoryTree()
|