Sfoglia il codice sorgente

绩效评分修改

yanshichao 11 mesi fa
parent
commit
29340c8c14
2 ha cambiato i file con 91 aggiunte e 15 eliminazioni
  1. 22 6
      src/api/performance/performance.js
  2. 69 9
      src/views/statistics/performance.vue

+ 22 - 6
src/api/performance/performance.js

@@ -1,13 +1,14 @@
 import request from '@/utils/request'
 import download from '@/utils/download'
+
 /**
  * 根据年份获取日期列表数据
  * @param year
  * @returns {*}
  */
-export function getDateListByYear(year){
+export function getDateListByYear(year) {
   return request({
-    url: '/performanceDateSet/getDateListByYear?year='+year,
+    url: '/performanceDateSet/getDateListByYear?year=' + year,
     method: 'get'
   })
 }
@@ -16,7 +17,7 @@ export function getDateListByYear(year){
  * 获取日期集合列表数据
  * @returns {*}
  */
-export function getDateDataList(){
+export function getDateDataList() {
   return request({
     url: '/performanceDateSet/getDateDataList',
     method: 'get'
@@ -28,7 +29,7 @@ export function getDateDataList(){
  * @param data
  * @returns {*}
  */
-export function addPerformanceScoreSet(data){
+export function addPerformanceScoreSet(data) {
   return request({
     url: "/performanceScoreSet/addPerformanceScoreSet",
     method: "POST",
@@ -41,7 +42,7 @@ export function addPerformanceScoreSet(data){
  * @param data
  * @returns {*}
  */
-export function editPerformanceScore(data){
+export function editPerformanceScore(data) {
   return request({
     url: "/performanceScore/editPerformanceScore",
     method: "POST",
@@ -54,7 +55,7 @@ export function editPerformanceScore(data){
  * @param data
  * @returns {*}
  */
-export function getPerformanceScoreList(data){
+export function getPerformanceScoreList(data) {
   return request({
     url: "/performanceScore/getPerformanceScoreList",
     method: "POST",
@@ -76,3 +77,18 @@ export function exportPerformanceScore(data) {
   })
 }
 
+export function delScoreSet(scoreSetId) {
+  return request({
+    url: '/performanceScoreSet/' + scoreSetId,
+    method: 'delete'
+  })
+}
+
+
+export function updateScoreSet(data) {
+  return request({
+    url: '/performanceScoreSet/',
+    method: 'put',
+    data: data
+  })
+}

+ 69 - 9
src/views/statistics/performance.vue

@@ -6,6 +6,7 @@
           <el-date-picker
             v-model="yearValue"
             type="year" value-format="yyyy" format="yyyy"
+            :clearable="false"
             placeholder="选择年查询" size="small" @change="getData">
           </el-date-picker>
           <el-button type="primary" plain icon="el-icon-plus" style="margin-left: 20px" @click="addScoreWin">创建评分
@@ -13,7 +14,20 @@
         </div>
         <div>
           <el-tree ref="dateTree" node-key="id" :default-expand-all="true" highlight-current :data="data"
-                   :props="defaultProps" @node-click="handleNodeClick"></el-tree>
+                   :props="defaultProps" @node-click="handleNodeClick">
+            <span class="custom-tree-node" slot-scope="{ node, data }">
+              <span>{{ node.label }}</span>
+              <div v-if="data.json&&data.json.length>0">
+              <el-popover
+                placement="right"
+                trigger="hover">
+                <el-button size="mini" @click="handleUpdate(data)">修改</el-button>
+                <el-button size="mini" type="danger" @click="handleDelete(data)">删除</el-button>
+                <i class="el-icon-share" slot="reference"></i>
+              </el-popover>
+              </div>
+            </span>
+          </el-tree>
         </div>
       </el-col>
 
@@ -129,16 +143,18 @@
 
 <script>
 import {
-  addPerformanceScoreSet, editPerformanceScore,
-  getDateDataList,
+  addPerformanceScoreSet,
+  editPerformanceScore,
   getDateListByYear,
   getPerformanceScoreList,
-  exportPerformanceScore
+  exportPerformanceScore,
+  delScoreSet, updateScoreSet
 } from '@/api/performance/performance'
 import {getDeptUserTree} from '@/api/system/user'
 import task from "@/views/mixins/task";
 import DateUtil from '@/utils/date'
 import DeptUserTree from "@/components/DeptUserTree"
+import {delTaskWithReason} from "@/api/task/task";
 
 export default {
   name: 'performance',
@@ -290,10 +306,10 @@ export default {
         this.$message.error("请选择评分日期!")
         return;
       }
-      // if (!this.queryParams.scoreUsers) {
-      //   this.$message.error("请选择被评分人!")
-      //   return
-      // }
+      if (!this.queryParams.scoreUsers) {
+        this.$message.error("请选择被评分人!")
+        return
+      }
       let data = {
         scoreSetId: this.queryParams.scoreSetId,
         userIdStr: this.queryParams.scoreUsers.join(',')
@@ -353,7 +369,43 @@ export default {
       getPerformanceScoreList(searchParam).then(res => {
         this.taskDatas = res.data
       });
-    }
+    },
+    handleUpdate(data) {
+      let name = data.label.substring(0, data.label.indexOf('('))
+      let title = '您将修改名称为[' + name + ']的数据项'
+
+      this.$prompt("请输入新的评分名称", title, {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        closeOnClickModal: false,
+        inputType: 'text',
+        inputValidator: (val) => {
+          if (!val) {
+            return "新的评分名称不能为空"
+          }
+          if (val.length > 50) {
+            return "新的评分名称不能超过50字符"
+          }
+        },
+        inputErrorMessage: "新的评分名称不能为空"
+      }).then(({value}) => {
+        updateScoreSet({id: data.id, name: value}).then(response => {
+          this.$message.success("修改成功");
+          this.getData()
+        });
+      }).catch(() => {
+      });
+    },
+    handleDelete(data) {
+      let name = data.label.substring(0, data.label.indexOf('('))
+      this.$confirm('是否确认删除名称为[' + name + ']的数据项?').then(function () {
+        return delScoreSet(data.id);
+      }).then(() => {
+        this.$message.success('删除成功');
+        this.getData();
+      }).catch(() => {
+      });
+    },
   }
 }
 </script>
@@ -364,4 +416,12 @@ export default {
   margin-bottom: 20px;
   justify-content: space-between;
 }
+
+.custom-tree-node {
+  flex: 1;
+  display: flex;
+  align-items: center;
+  font-size: 12px;
+  padding-right: 8px;
+}
 </style>