15179599649
2024-01-06 d1bcdf460a386c3df9998ba1ca20ec5c71e79bd6
'完善新增评优人模块'
4 files modified
176 ■■■■■ changed files
src/api/hfiveget/index.js 27 ●●●●● patch | view | raw | blame | history
src/views/Appraising/index.vue 38 ●●●●● patch | view | raw | blame | history
src/views/toAppraising/index.vue 55 ●●●●● patch | view | raw | blame | history
src/views/toAppraising/toAppraisingfirst.vue 56 ●●●●● patch | view | raw | blame | history
src/api/hfiveget/index.js
@@ -96,7 +96,32 @@
export const evaluateTask = (params) => {
    return request({
        // url: "/api/evaluate/evaluateTask/taskList/" + params.dept_id + "/" + params.user_id,
        url: "/api/evaluate/evaluateCandidateAssessor/listByAssessor",
        // url: "/api/evaluate/evaluateCandidateAssessor/listByAssessor",
        url: '/api/evaluate/evaluateTask/selfList',
        method: "get",
        apiKey: true,
        params: {
            ...params,
        },
    });
};
// 新增推荐人
export const saveBatch = (data) => {
    return request({
        url: '/api/evaluate/evaluateTaskReferrer/saveBatch',
        method: "post",
        apiKey: true,
        data
    });
};
// 获取用户所在部门的所有成员信息
export const userDeptinfo = (params) => {
    return request({
        // url: "/api/evaluate/evaluateTask/taskList/" + params.dept_id + "/" + params.user_id,
        // url: "/api/evaluate/evaluateCandidateAssessor/listByAssessor",
        url: '/api/evaluate/evaluateTask/userList',
        method: "get",
        apiKey: true,
        params: {
src/views/Appraising/index.vue
@@ -5,8 +5,8 @@
      <p class="TaskNumber">
        <span>{{item.taskName}}</span>
        <span
          :class="item.isEvaluateOk==false?'evaluation':'evaluationget'"
        >{{item.isEvaluateOk==false?'待完成 ':'已完成'}}</span>
          :class="item.isVote==false?'evaluation':'evaluationget'"
        >{{item.isVote==false?'待完成 ':'已完成'}}</span>
      </p>
      <p class="Tasktime">
        <span>评优级别:</span>
@@ -14,10 +14,10 @@
      </p>
      <p class="Tasktime">
        <span>截止日期:</span>
        <span>{{item.type==0?item.candidateCutoffTime:item.evaluateCutoffTime}}</span>
        <span>{{item.type==0?item.candidateCutoffTimeEnd:item.evaluateCutoffTime}}</span>
      </p>
      <van-button @click="toAppraising(item)" v-show="item.isEvaluateOk==false">去评优</van-button>
      <p class="details" @click="toAppraising(item)" v-show="item.isEvaluateOk==true">查看详情</p>
      <van-button @click="toAppraising(item)" v-show="item.isVote==false">去评优</van-button>
      <p class="details" @click="toAppraising(item)" v-show="item.isVote==true">查看详情</p>
    </div>
    <div class="not" v-show="ViewData.length==0">
      <img src="images/notdata.png" />
@@ -52,7 +52,8 @@
    // 评优任务列表
    evaluateTaskData() {
      let data = {
        userId: localStorage.getItem("tokensave")
        type: 0
        // userId: localStorage.getItem("tokensave")
        // dept_id: localStorage.getItem("dept_id")
      };
      if (
@@ -60,26 +61,11 @@
        localStorage.getItem("tokensave") != "111"
      ) {
        evaluateTask(data).then(res => {
          console.log(res.data.data.records);
          this.ViewData = res.data.data.records;
          this.ViewData = [
            {
              dept_name: "技术部",
              taskName: "2024年元旦评优",
              type: 0,
              candidateCutoffTime: "2024-01-09",
              isEvaluateOk: false,
              RecommendData: []
            },
            {
              dept_name: "技术部",
              taskName: "2024年元旦评优",
              type: 1,
              evaluateCutoffTime: "2024-01-09",
              isEvaluateOk: false,
              RecommendData: []
            }
          ];
          this.ViewData = res.data.data.records || [];
          this.ViewData = this.ViewData.sort((a, b) => a.isVote - b.isVote);
          this.ViewData.forEach(item => {
            item.jsonArr = [];
          });
        });
      }
    },
src/views/toAppraising/index.vue
@@ -5,7 +5,7 @@
      <p class="title">{{ this.poepleinfo.taskName }}</p>
      <p class="info">
        <span>所在部门:</span>
        <span>{{ this.poepleinfo.dept_name }}</span>
        <span>{{ this.deptName }}</span>
      </p>
      <p class="info">
        <span>评优级别:</span>
@@ -26,12 +26,12 @@
        <span>
          {{
          this.poepleinfo.type == 0
          ? this.poepleinfo.candidateCutoffTime
          ? this.poepleinfo.candidateCutoffTimeEnd
          : this.poepleinfo.evaluateCutoffTime
          }}
        </span>
      </p>
      <div v-if="poepleinfo.isEvaluateOk == false">
      <div v-if=" this.poepleinfo.type== 0">
        <div class="toin">
          <van-field
            v-model="currentValue"
@@ -73,7 +73,6 @@
        show-toolbar
        @cancel="showPicker = false"
        @confirm="onConfirm"
        :value-key="pickerkey"
        :columns="columns"
        v-model="currentValue"
      />
@@ -83,36 +82,61 @@
<script>
import { Picker } from "vant";
import { deptlistAll, evaluateResult } from "@/api/hfiveget/index.js";
import {
  deptlistAll,
  evaluateResult,
  userDeptinfo
} from "@/api/hfiveget/index.js";
import store from "../../store/index";
export default {
  data() {
    return {
      showPicker: false,
      deptName: "",
      pickerkey: "",
      currentValue: "", // 用于绑定选择结果的变量
      remark: "", //推荐理由
      columns: ["张三", "李四", "王五"], // 选择器的选项列表
      columns: [], // 选择器的选项列表
      poepleinfo: {},
      toData: {},
      toshow: {},
      disabledsubmit: false
      disabledsubmit: false,
      submitdata: {}
    };
  },
  computed: {},
  mounted() {
    localStorage.setItem("Appraising", "Appraising");
  },
  created() {
    this.poepleinfo = JSON.parse(this.$route.query.info);
    console.log(this.poepleinfo);
    this.deptName = localStorage.getItem("dept_name");
    let Data = { deptId: localStorage.getItem("dept_id") };
    if (
      localStorage.getItem("tokensave") != null &&
      localStorage.getItem("tokensave") != "111"
    ) {
      userDeptinfo(Data).then(res => {
        this.columns = [...res.data.data.records];
        this.columns.forEach(item => {
          item["text"] = item.name;
        });
      });
    }
  },
  created() {},
  methods: {
    onConfirm(select) {
      this.currentValue = select;
      this.currentValue = select.text;
      this.showPicker = false;
      this.poepleinfo.RecommendData.forEach(element => {
        if (element.efereename == select) {
      this.submitdata = {
        evaluateTaskId: this.poepleinfo.id,
        userId: select.id,
        userName: select.name,
        deptId: select.deptId,
        deptName: select.deptName,
        postName: select.postName
      };
      this.poepleinfo.jsonArr.forEach(element => {
        if (element.userId == select.id) {
          this.$toast.fail("该人员已推荐");
          this.currentValue = "";
        }
@@ -128,10 +152,7 @@
        this.$toast.fail("请输入推荐理由");
      } else {
        this.disabledsubmit = true;
        this.poepleinfo.RecommendData.push({
          remark: this.remark,
          efereename: this.currentValue
        });
        this.poepleinfo.jsonArr.push(this.submitdata);
        setTimeout(() => {
          this.$router.push({
            path: "/toAppraisingfirst",
src/views/toAppraising/toAppraisingfirst.vue
@@ -5,7 +5,7 @@
      <p class="title">{{this.poepleinfo.taskName}}</p>
      <p class="info">
        <span>所在部门:</span>
        <span>{{ this.poepleinfo.dept_name}}</span>
        <span>{{ this.deptname}}</span>
      </p>
      <p class="info">
        <span>评优级别:</span>
@@ -13,7 +13,7 @@
      </p>
      <p class="info">
        <span>截止日期:</span>
        <span>{{this.poepleinfo.type==0?this.poepleinfo.candidateCutoffTime:this.poepleinfo.evaluateCutoffTime}}</span>
        <span>{{this.poepleinfo.type==0?this.poepleinfo.candidateCutoffTimeEnd:this.poepleinfo.evaluateCutoffTime}}</span>
      </p>
      <p class="info">
        <span>说明:</span>
@@ -40,29 +40,35 @@
        </table>
      </p>
      <p class="info">
        <span class="tuijian">推荐人员:<van-button type="primary" block @click="Gotovote()" >添加推荐人员</van-button></span>
        <span class="tuijian">推荐人员:<van-button type="primary" block @click="Gotovote()" v-show="this.poepleinfo.isVote==false">添加推荐人员</van-button></span>
        <table  border="1" align="center" bordercolor="gray" class="tuijiaantable">
            <thead>
              <tr>
                <th>姓名</th>
                <th>评选理由</th>
                <th>操作</th>
                <th v-if="this.poepleinfo.isVote==false">操作</th>
              </tr>
            </thead>
            <tbody>
              <tr v-for="(item,index) of this.poepleinfo.RecommendData" :key="index">
                <td>{{item.efereename}}</td>
            <tbody v-if="this.poepleinfo.isVote==false">
              <tr v-for="(item,index) of this.poepleinfo.jsonArr" :key="index">
                <td>{{item.userName}}</td>
                <td>{{item.remark}}</td>
                <td><van-button type="danger" size="mini" @click="deleteRecommend(index)">删除</van-button></td>
              </tr>
              <tr v-show="this.poepleinfo.RecommendData.length==0">
              <tr v-show="this.poepleinfo.jsonArr.length==0">
                <td colspan="3">暂无数据</td>
              </tr>
            </tbody>
            <tbody v-if="this.poepleinfo.isVote==true">
              <tr v-for="(item,index) of this.poepleinfo.jsonArr" :key="index">
                <td>{{item.userName}}</td>
                <td>{{item.remark}}</td>
              </tr>
            </tbody>
        </table>
      </p>
      <div>
        <van-button type="primary" block @click="SubmitTo()">提交</van-button>
        <van-button type="primary" block @click="SubmitTo()" :disabled="disabledsubmit" v-show="this.poepleinfo.isVote==false">提交</van-button>
      </div>
    </div>
  </div>
@@ -70,23 +76,30 @@
          
<script>
import { Picker } from "vant";
import { deptlistAll, evaluateResult } from "@/api/hfiveget/index.js";
import { deptlistAll, evaluateResult,saveBatch } from "@/api/hfiveget/index.js";
import store from "../../store/index";
export default {
  data() {
    return {
      infoData:JSON.parse(this.$route.query.info)
      disabledsubmit: false,
      infoData:JSON.parse(this.$route.query.info),
      deptname: localStorage.getItem("dept_name")
    };
  },
  computed:{
    poepleinfo(){
      return this.infoData
      let Data=this.infoData
      if(Data.isVote==true){
        Data.jsonArr=Data.evaluateTaskReferrerVOS;
      }
      return Data
    }
  },
  mounted() {
    localStorage.setItem("Appraising", "Appraising");
  },
  created() {
  },
  methods: {
    //添加推荐人员
@@ -98,14 +111,23 @@
    },
    //删除推荐人员
    deleteRecommend(index){
      this.infoData.RecommendData.splice(index,1)
      this.infoData.jsonArr.splice(index,1)
    },
    //提交
    SubmitTo(){
      console.log(this.infoData)
      this.$router.push({
        path: "/Appraising",
      });
      if(this.infoData.jsonArr.length==0){
        this.$toast.fail("推荐人员不能为空");
      }
      else{
        this.disabledsubmit = true;
        saveBatch(this.infoData.jsonArr).then(res => {
          setTimeout(() => {
              this.$router.push("/Appraising");
            }, 1000);
            this.$toast.success("评分成功");
        });
      }
    }
  }
};