Переглянути джерело

Merge branch 'personnelPerformance' into dev

huoyi 1 місяць тому
батько
коміт
010228acca

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

@@ -23,7 +23,7 @@
23
     <el-row :gutter="10" class="mb8">
23
     <el-row :gutter="10" class="mb8">
24
       <el-col :span="1.5">
24
       <el-col :span="1.5">
25
         <el-button type="primary" plain icon="Plus" @click="handleAdd"
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
       </el-col>
27
       </el-col>
28
       <!-- <el-col :span="1.5">
28
       <!-- <el-col :span="1.5">
29
         <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
29
         <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
@@ -31,15 +31,15 @@
31
       </el-col> -->
31
       </el-col> -->
32
       <el-col :span="1.5">
32
       <el-col :span="1.5">
33
         <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
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
       </el-col>
35
       </el-col>
36
       <el-col :span="1.5">
36
       <el-col :span="1.5">
37
         <el-button type="warning" plain icon="Download" @click="handleExport"
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
       </el-col>
39
       </el-col>
40
       <el-col :span="1.5">
40
       <el-col :span="1.5">
41
         <el-button type="info" plain icon="Upload" @click="handleImport"
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
       </el-col>
43
       </el-col>
44
       <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
44
       <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
45
     </el-row>
45
     </el-row>
@@ -69,9 +69,9 @@
69
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
69
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
70
         <template #default="scope">
70
         <template #default="scope">
71
           <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
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
           <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
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
         </template>
75
         </template>
76
       </el-table-column>
76
       </el-table-column>
77
     </el-table>
77
     </el-table>
@@ -259,11 +259,13 @@ function reset() {
259
     id: null,
259
     id: null,
260
     name: null,
260
     name: null,
261
     categoryCode: null,
261
     categoryCode: null,
262
+    categoryCodeOne: null,
262
     checkStandard: null,
263
     checkStandard: null,
263
     checkMethod: null,
264
     checkMethod: null,
264
     importance: null,
265
     importance: null,
265
     status: null,
266
     status: null,
266
     categoryName: null,
267
     categoryName: null,
268
+    categoryNameOne: null,
267
     remark: null,
269
     remark: null,
268
     code: null,
270
     code: null,
269
     importanceDesc: null
271
     importanceDesc: null
@@ -315,9 +317,12 @@ function handleUpdate(row) {
315
 function submitForm() {
317
 function submitForm() {
316
   proxy.$refs["projectRef"].validate(valid => {
318
   proxy.$refs["projectRef"].validate(valid => {
317
     if (valid) {
319
     if (valid) {
318
-      // 根据categoryCode获取categoryName
320
+      // 根据categoryCode获取categoryName和一级分类信息
319
       if (form.value.categoryCode) {
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
 function handleNodeClick(data) {
386
 function handleNodeClick(data) {
382
   form.value.categoryName = data.name;
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
     for (const category of categories) {
399
     for (const category of categories) {
391
       if (category.code === categoryCode) {
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
       if (category.children && category.children.length > 0) {
407
       if (category.children && category.children.length > 0) {
395
-        const result = findCategory(category.children)
408
+        const result = findCategory(category.children, category)
396
         if (result) return result
409
         if (result) return result
397
       }
410
       }
398
     }
411
     }
399
-    return ''
412
+    return { categoryName: '', categoryCodeOne: '', categoryNameOne: '' }
400
   }
413
   }
401
   
414
   
402
   return findCategory(enableCategoryOptions.value)
415
   return findCategory(enableCategoryOptions.value)

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

@@ -23,7 +23,7 @@
23
           plain
23
           plain
24
           icon="Plus"
24
           icon="Plus"
25
           @click="handleAdd"
25
           @click="handleAdd"
26
-          v-hasPermi="['system:checkCategory:add']"
26
+          v-hasPermi="['system:performanceIndicatorCategory:add']"
27
         >新增</el-button>
27
         >新增</el-button>
28
       </el-col>
28
       </el-col>
29
       <el-col :span="1.5">
29
       <el-col :span="1.5">
@@ -52,9 +52,9 @@
52
       <el-table-column label="备注" align="center" prop="remark" />
52
       <el-table-column label="备注" align="center" prop="remark" />
53
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
53
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
54
         <template #default="scope">
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
         </template>
58
         </template>
59
       </el-table-column>
59
       </el-table-column>
60
     </el-table>
60
     </el-table>