Просмотр исходного кода

Merge branch 'personnelPerformance' into dev

huoyi 1 месяц назад
Родитель
Сommit
010228acca

+ 28 - 15
src/views/system/classificationAssess/index.vue

@@ -23,7 +23,7 @@
23 23
     <el-row :gutter="10" class="mb8">
24 24
       <el-col :span="1.5">
25 25
         <el-button type="primary" plain icon="Plus" @click="handleAdd"
26
-          v-hasPermi="['system:project:add']">新增</el-button>
26
+          v-hasPermi="['system:indicator:add']">新增</el-button>
27 27
       </el-col>
28 28
       <!-- <el-col :span="1.5">
29 29
         <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
@@ -31,15 +31,15 @@
31 31
       </el-col> -->
32 32
       <el-col :span="1.5">
33 33
         <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
34
-          v-hasPermi="['system:project:remove']">删除</el-button>
34
+          v-hasPermi="['system:indicator:remove']">删除</el-button>
35 35
       </el-col>
36 36
       <el-col :span="1.5">
37 37
         <el-button type="warning" plain icon="Download" @click="handleExport"
38
-          v-hasPermi="['system:project:export']">导出</el-button>
38
+          v-hasPermi="['system:indicator:export']">导出</el-button>
39 39
       </el-col>
40 40
       <el-col :span="1.5">
41 41
         <el-button type="info" plain icon="Upload" @click="handleImport"
42
-          v-hasPermi="['system:project:import']">导入</el-button>
42
+          v-hasPermi="['system:indicator:import']">导入</el-button>
43 43
       </el-col>
44 44
       <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
45 45
     </el-row>
@@ -69,9 +69,9 @@
69 69
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
70 70
         <template #default="scope">
71 71
           <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
72
-            v-hasPermi="['system:project:edit']">修改</el-button>
72
+            v-hasPermi="['system:indicator:edit']">修改</el-button>
73 73
           <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
74
-            v-hasPermi="['system:project:remove']">删除</el-button>
74
+            v-hasPermi="['system:indicator:remove']">删除</el-button>
75 75
         </template>
76 76
       </el-table-column>
77 77
     </el-table>
@@ -259,11 +259,13 @@ function reset() {
259 259
     id: null,
260 260
     name: null,
261 261
     categoryCode: null,
262
+    categoryCodeOne: null,
262 263
     checkStandard: null,
263 264
     checkMethod: null,
264 265
     importance: null,
265 266
     status: null,
266 267
     categoryName: null,
268
+    categoryNameOne: null,
267 269
     remark: null,
268 270
     code: null,
269 271
     importanceDesc: null
@@ -315,9 +317,12 @@ function handleUpdate(row) {
315 317
 function submitForm() {
316 318
   proxy.$refs["projectRef"].validate(valid => {
317 319
     if (valid) {
318
-      // 根据categoryCode获取categoryName
320
+      // 根据categoryCode获取categoryName和一级分类信息
319 321
       if (form.value.categoryCode) {
320
-        form.value.categoryName = getCategoryNameByCode(form.value.categoryCode)
322
+        const categoryInfo = getCategoryInfoByCode(form.value.categoryCode)
323
+        form.value.categoryName = categoryInfo.categoryName
324
+        form.value.categoryCodeOne = categoryInfo.categoryCodeOne
325
+        form.value.categoryNameOne = categoryInfo.categoryNameOne
321 326
       }
322 327
       
323 328
       // 名称转换
@@ -380,23 +385,31 @@ function getCategoryTree() {
380 385
 
381 386
 function handleNodeClick(data) {
382 387
   form.value.categoryName = data.name;
388
+  // 根据选中的二级分类获取一级分类信息
389
+  const categoryInfo = getCategoryInfoByCode(data.code)
390
+  form.value.categoryCodeOne = categoryInfo.categoryCodeOne
391
+  form.value.categoryNameOne = categoryInfo.categoryNameOne
383 392
 }
384 393
 
385
-/** 根据categoryCode获取categoryName */
386
-function getCategoryNameByCode(categoryCode) {
387
-  if (!categoryCode || !enableCategoryOptions.value) return ''
394
+/** 根据categoryCode获取categoryName和categoryCodeOne, categoryNameOne */
395
+function getCategoryInfoByCode(categoryCode) {
396
+  if (!categoryCode || !enableCategoryOptions.value) return { categoryName: '', categoryCodeOne: '', categoryNameOne: '' }
388 397
   
389
-  const findCategory = (categories) => {
398
+  const findCategory = (categories, parent = null) => {
390 399
     for (const category of categories) {
391 400
       if (category.code === categoryCode) {
392
-        return category.name
401
+        return {
402
+          categoryName: category.name,
403
+          categoryCodeOne: parent ? parent.code : '',
404
+          categoryNameOne: parent ? parent.name : ''
405
+        }
393 406
       }
394 407
       if (category.children && category.children.length > 0) {
395
-        const result = findCategory(category.children)
408
+        const result = findCategory(category.children, category)
396 409
         if (result) return result
397 410
       }
398 411
     }
399
-    return ''
412
+    return { categoryName: '', categoryCodeOne: '', categoryNameOne: '' }
400 413
   }
401 414
   
402 415
   return findCategory(enableCategoryOptions.value)

+ 4 - 4
src/views/system/classificationAssessIndicator/index.vue

@@ -23,7 +23,7 @@
23 23
           plain
24 24
           icon="Plus"
25 25
           @click="handleAdd"
26
-          v-hasPermi="['system:checkCategory:add']"
26
+          v-hasPermi="['system:performanceIndicatorCategory:add']"
27 27
         >新增</el-button>
28 28
       </el-col>
29 29
       <el-col :span="1.5">
@@ -52,9 +52,9 @@
52 52
       <el-table-column label="备注" align="center" prop="remark" />
53 53
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
54 54
         <template #default="scope">
55
-          <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:checkCategory:edit']">修改</el-button>
56
-          <el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['system:checkCategory:add']">新增</el-button>
57
-          <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:checkCategory:remove']">删除</el-button>
55
+          <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:performanceIndicatorCategory:edit']">修改</el-button>
56
+          <el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['system:performanceIndicatorCategory:add']">新增</el-button>
57
+          <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:performanceIndicatorCategory:remove']">删除</el-button>
58 58
         </template>
59 59
       </el-table-column>
60 60
     </el-table>