index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <div>
  3. <div slot="header" class="clearfix">
  4. <span style="font-weight:bold">分数调整</span>
  5. <div style="float: right; padding: 3px 0" type="text">
  6. <el-button size="mini" plain @click="btnBack">返回</el-button>
  7. </div>
  8. </div>
  9. <div class="app-container" v-if="isList">
  10. <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" @submit.native.prevent>
  11. <el-form-item label="员工" prop="staffName">
  12. <el-input
  13. v-model="queryParams.staffName"
  14. clearable
  15. @keyup.enter.native="btnSearch"
  16. />
  17. </el-form-item>
  18. <el-form-item>
  19. <el-button type="primary" icon="el-icon-search" size="mini" @click="btnSearch">搜索</el-button>
  20. <el-button icon="el-icon-refresh" size="mini" @click="btnResetQuery">重置</el-button>
  21. </el-form-item>
  22. </el-form>
  23. <div style="float:right">
  24. <el-button-group>
  25. <el-dropdown @command="btnImport">
  26. <el-button type="primary" size="mini">
  27. 导入<i class="el-icon-arrow-down el-icon--right"></i>
  28. </el-button>
  29. <el-dropdown-menu slot="dropdown">
  30. <el-button size="mini" @click="useImportTemplate">模板下载</el-button>
  31. <el-upload ref="upload" action="" :http-request="onUpload">
  32. <el-button size="mini" type="primary">数据导入</el-button>
  33. </el-upload>
  34. </el-dropdown-menu>
  35. </el-dropdown>
  36. </el-button-group>
  37. </div>
  38. <el-table size="mini" height="500px" v-loading="loading" :data="listData">
  39. <el-table-column label="编号" align="center" prop="id" />
  40. <el-table-column label="员工姓名" align="center" prop="staffName" />
  41. <el-table-column label="评估周期" align="center" prop="name" />
  42. <el-table-column label="月度" align="center" prop="month" />
  43. <el-table-column label="权重" align="center" prop="weight" />
  44. <el-table-column label="自评分" align="center" prop="saMark" />
  45. <el-table-column label="上级评分" align="center" prop="ldMark" />
  46. <el-table-column label="调整后分数" align="center" prop="mark" />
  47. <el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width">
  48. <template slot-scope="scope">
  49. <el-button
  50. size="mini"
  51. type="text"
  52. icon="el-icon-edit"
  53. @click="btnAdjustMark(scope.row)"
  54. >调整</el-button>
  55. </template>
  56. </el-table-column>
  57. </el-table>
  58. <div class="paginationClass">
  59. <pagination
  60. v-show="total>0"
  61. :total="total"
  62. :page.sync="queryParams.pageNum"
  63. :limit.sync="queryParams.pageSize"
  64. @pagination="getList"
  65. />
  66. </div>
  67. </div>
  68. <el-dialog title="分数调整" :visible.sync="formOpen" width="1000px" :close-on-click-modal="false" :show-close="false">
  69. <el-descriptions :column="1">
  70. <el-descriptions-item label="员工编号">{{form.staff}}</el-descriptions-item>
  71. <el-descriptions-item label="员工姓名">{{form.staffName}}</el-descriptions-item>
  72. <el-descriptions-item label="自评分">{{form.saMark}}</el-descriptions-item>
  73. <el-descriptions-item label="上级评分">{{form.ldMark}}</el-descriptions-item>
  74. <el-descriptions-item label="调整后分数">{{ajaMark}}</el-descriptions-item>
  75. </el-descriptions>
  76. <el-form size="mini" label-position="right" ref="form" :model="adjustlogForm" :rules="formRules" label-width="80px">
  77. <el-form-item label="调整分" prop="ajMark">
  78. <el-input size="mini" type="number" v-model="adjustlogForm.ajMark" v-only-number="{max:100,min:-100,precision:1}"/>
  79. </el-form-item>
  80. <el-form-item label="调整原因" prop="ajCause">
  81. <el-input v-model="adjustlogForm.ajCause"></el-input>
  82. </el-form-item>
  83. </el-form>
  84. <span slot="footer" class="dialog-footer">
  85. <el-button size="mini" @click="btnClose">取 消</el-button>
  86. <el-button size="mini" type="primary" @click="btnConfirm">确 定</el-button>
  87. </span>
  88. </el-dialog>
  89. </div>
  90. </template>
  91. <script>
  92. import { listMarkAdjust,getPerformance} from "@/api/business/ehr/pm/markadjust";
  93. import { addAdjustlog,importData} from "@/api/business/ehr/pm/adjustlog";
  94. export default {
  95. name: "AdjustMark",
  96. dicts: ['ehr_pm_status'],
  97. data() {
  98. return {
  99. // 遮罩层
  100. loading: true,
  101. // 显示搜索条件
  102. showSearch: true,
  103. // 总条数
  104. total: 0,
  105. // 表格数据
  106. listData: [],
  107. //绩效表单数据
  108. form:{},
  109. //调整记录表单数据
  110. adjustlogForm:{},
  111. //是否显示行明细弹出层
  112. formOpen:false,
  113. //当行明细校验规则
  114. formRules:{
  115. ajMark: [
  116. { required: true, message: "调整分不能为空", trigger: "blur" },
  117. ],
  118. ajCause: [
  119. { required: true, message: "调整原因不能为空", trigger: "blur" },
  120. ],
  121. },
  122. // 查询参数
  123. queryParams: {
  124. pageNum: 1,
  125. pageSize: 10,
  126. sourceId: null,
  127. staffName: null,
  128. },
  129. //页面显示
  130. isList: true,
  131. //页面状态
  132. page: '',
  133. //详情id
  134. rowId: '',
  135. };
  136. },
  137. computed: {
  138. //调整后分数
  139. ajaMark: function () {
  140. console.log('this.form.mark',this.form.mark);
  141. console.log('this.adjustlogForm.ajMark',this.adjustlogForm.ajMark);
  142. console.log(this.form.mark - this.adjustlogForm.ajMark);
  143. return Number(this.form.mark)+Number(this.adjustlogForm.ajMark || 0);
  144. },
  145. },
  146. created() {
  147. this.queryParams.sourceId = this.$route.params.id;
  148. this.getList();
  149. },
  150. methods: {
  151. /** 查询绩效列表 */
  152. getList() {
  153. this.loading = true;
  154. listMarkAdjust(this.queryParams).then(response => {
  155. this.listData = response.rows;
  156. this.total = response.total;
  157. this.loading = false;
  158. });
  159. },
  160. /** 搜索按钮操作 */
  161. btnSearch() {
  162. this.queryParams.pageNum = 1;
  163. this.getList();
  164. },
  165. /** 重置按钮操作 */
  166. btnResetQuery() {
  167. this.resetForm("queryForm");
  168. this.btnSearch();
  169. },
  170. /** 刷新 */
  171. refresh(){
  172. this.resetForm("queryForm");
  173. this.getList();
  174. },
  175. //调整分数
  176. async btnAdjustMark(row){
  177. await getPerformance(row.id).then(res => {
  178. if (res.code === 200) {
  179. this.form = res.data
  180. this.formOpen = true;
  181. }
  182. })
  183. },
  184. //取消
  185. btnClose(){
  186. this.form = {};
  187. this.adjustlogForm = {};
  188. this.formOpen = false;
  189. },
  190. //确定
  191. btnConfirm(){
  192. this.$refs["form"].validate(valid => {
  193. if (valid) {
  194. this.adjustlogForm.performanceId = this.form.id;
  195. addAdjustlog(this.adjustlogForm).then(response => {
  196. this.$modal.msgSuccess("保存成功");
  197. this.adjustlogForm = {};
  198. this.formOpen = false;
  199. this.getList();
  200. });
  201. }
  202. });
  203. },
  204. //返回
  205. btnBack(){
  206. this.$router.back();
  207. },
  208. //导入按钮
  209. btnImport(command){
  210. if(command == 'useImportTemplate'){
  211. this.useImportTemplate();
  212. }
  213. if(command == 'useImportData'){
  214. this.useImportData();
  215. }
  216. },
  217. //模板下载
  218. useImportTemplate(){
  219. this.download('ehr/pm/adjustlog/importTemplate', {
  220. }, `分数调整导入模板_${new Date().getTime()}.xlsx`)
  221. },
  222. //导入
  223. useImportData(){
  224. console.log("导入");
  225. },
  226. // 上传文件
  227. onUpload (file) {
  228. this.loading = true;
  229. let formData = new FormData()
  230. formData.append('file',file.file);
  231. formData.append('stageId',this.$route.params.id);
  232. importData(formData).then((res) => {
  233. console.log('res',res);
  234. if(res.code == '200'){
  235. this.$message.success(res.msg);
  236. }else{
  237. this.$message.success(res.msg);
  238. }
  239. }).catch((e) => {
  240. console.log('e',e);
  241. }).finally((e) => {
  242. this.$refs['upload'].clearFiles();
  243. this.getList();
  244. this.loading = false;
  245. })
  246. },
  247. }
  248. };
  249. </script>
  250. <style lang="scss" scoped>
  251. .btn_grooup {
  252. margin-bottom: 10px;
  253. display: flex;
  254. justify-content: flex-end;
  255. }
  256. .paginationClass {
  257. z-index: 500;
  258. position: fixed;
  259. bottom: 10px;
  260. right: 10px;
  261. width: 100%;
  262. line-height: var(--footer-height);
  263. color: #fff;
  264. }
  265. </style>