SpecialPerformance.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div class="SPerformance-all" v-loading.fullscreen.lock="SPLoading">
  3. <div class="SPerformance-Search">
  4. <div class="SPerformance-Search-ul">
  5. <div class="SPerformance-Search-li">
  6. <label>选择月份:</label>
  7. <el-date-picker @change="CompanyDailyKpiInfo" size="small" style="width:200px" v-model="months" type="month" placeholder="选择月">
  8. </el-date-picker>
  9. </div>
  10. <div class="SPerformance-Search-li">
  11. <label>人员名称:</label>
  12. <el-select @change="CompanyDailyKpiInfo" size="small" style="width:200px" v-model="value" filterable placeholder="请选择">
  13. <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id">
  14. </el-option>
  15. </el-select>
  16. </div>
  17. </div>
  18. <el-button :disabled="!isOp" @click="CompanyDailyKpiSave" size="small" type="primary">保存</el-button>
  19. </div>
  20. <div class="SPerformance-Search-table">
  21. <el-table :data="tableData" border style="width: 100%">
  22. <el-table-column prop="evalContentOrder" label="序号" width="80">
  23. </el-table-column>
  24. <el-table-column prop="evalContent" label="工作内容" width="520">
  25. <template slot-scope="scope">
  26. <div style="text-align: left;">{{ scope.row.evalContent }}</div>
  27. </template>
  28. </el-table-column>
  29. <el-table-column prop="name" label="工作是否失误" width="100">
  30. <template slot-scope="scope">
  31. <el-checkbox :disabled="!isOp" v-model="scope.row.isMistake"></el-checkbox>
  32. </template>
  33. </el-table-column>
  34. <el-table-column prop="address" label="失误原因描述">
  35. <template slot-scope="scope">
  36. <el-input :disabled="!isOp" style="width:100%" v-model="scope.row.mistakeReason" type="textarea" :rows="2" placeholder="请输入内容"></el-input>
  37. </template>
  38. </el-table-column>
  39. </el-table>
  40. </div>
  41. </div>
  42. </template>
  43. <script>
  44. export default {
  45. data () {
  46. return {
  47. userId:'',
  48. months:new Date(),
  49. value:'',
  50. options:[],
  51. tableData: [],
  52. SPLoading:false,
  53. isOp:false,
  54. }
  55. },
  56. methods: {
  57. //获取人员名单
  58. CompanyDailyKpiInit() {
  59. var url = "/api/PersonnelModule/CompanyDailyKpiInit/"+this.userId;
  60. var that = this;
  61. this.$axios({
  62. method: 'get',
  63. url: url,
  64. headers: {
  65. Authorization: 'Bearer '
  66. }
  67. }).then(function (res) {
  68. that.options=[];
  69. if (res.data.code == 200) {
  70. that.options=res.data.data.userInfos;
  71. that.isOp=res.data.data.isOp;
  72. if(that.value==''){
  73. that.value=that.options[0].id;
  74. }
  75. that.CompanyDailyKpiInfo();
  76. } else {
  77. that.$message.error(res.data.msg);
  78. }
  79. })
  80. },
  81. //处理日期
  82. datetime(val){
  83. var date=new Date(val);
  84. var y=date.getFullYear();
  85. var m=date.getMonth()+1>=10?date.getMonth()+1:'0'+(date.getMonth()+1).toString();
  86. var d=date.getDate()>=10?date.getDate():'0'+(date.getDate()).toString();
  87. return y+'-'+m
  88. },
  89. //获取任务明细
  90. CompanyDailyKpiInfo() {
  91. this.SPLoading=true;
  92. if (this.months==''||this.months==null){
  93. this.$message.error('请选择月份!');
  94. return
  95. }
  96. var url = "/api/PersonnelModule/CompanyDailyKpiInfo?month="+this.datetime(this.months)+"&evaluator="+this.value;
  97. var that = this;
  98. this.$axios({
  99. method: 'get',
  100. url: url,
  101. headers: {
  102. Authorization: 'Bearer '
  103. }
  104. }).then(function (res) {
  105. if (res.data.code == 200) {
  106. that.tableData=res.data.data;
  107. that.SPLoading=false;
  108. } else {
  109. that.SPLoading=false;
  110. that.$message.error(res.data.msg);
  111. }
  112. })
  113. },
  114. //保存任务
  115. CompanyDailyKpiSave() {
  116. this.SPLoading=true;
  117. var url = "/api/PersonnelModule/CompanyDailyKpiSave";
  118. var that = this;
  119. this.$axios({
  120. method: 'post',
  121. url: url,
  122. headers: {
  123. Authorization: 'Bearer '
  124. },
  125. data:{
  126. currUserId:that.userId,
  127. infos:that.tableData
  128. }
  129. }).then(function (res) {
  130. if (res.data.code == 200) {
  131. that.$message.success(res.data.msg);
  132. that.CompanyDailyKpiInfo();
  133. } else {
  134. that.SPLoading=false;
  135. that.$message.error(res.data.msg);
  136. }
  137. })
  138. },
  139. },
  140. mounted() {
  141. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
  142. this.CompanyDailyKpiInit();
  143. }
  144. }
  145. </script>
  146. <style>
  147. .SPerformance-all {
  148. background-color: #fff;
  149. padding: 10px;
  150. box-shadow: 0 0 5px #0005;
  151. border-radius: 10px;
  152. min-height: 780px;
  153. }
  154. .SPerformance-Search{
  155. display: flex;
  156. justify-content: space-between;
  157. align-items: center;
  158. margin-bottom: 20px;
  159. }
  160. .SPerformance-Search-ul{
  161. display: flex;
  162. align-items: center;
  163. }
  164. .SPerformance-Search-li{
  165. margin-right: 20px;
  166. }
  167. </style>