kanban.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <div>
  3. <div class="app-container">
  4. <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true">
  5. <el-row >
  6. <el-col :span="18">
  7. <el-form-item label="部门">
  8. <el-cascader
  9. v-model="treeValue"
  10. :options="deptTree"
  11. :props="{ checkStrictly: true }"
  12. ref="cascaderHandle"
  13. clearable
  14. @change="handleChange"
  15. placeholder=""
  16. >
  17. </el-cascader>
  18. </el-form-item>
  19. <el-form-item label="员工">
  20. <el-input
  21. v-model="queryParams.params.staffCodeOrName"
  22. clearable
  23. @keyup.enter.native="btnSearch"
  24. />
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="6">
  28. <el-form-item style="float:right">
  29. <el-button type="primary" icon="el-icon-search" size="mini" @click="btnSearch">搜索</el-button>
  30. <el-button icon="el-icon-refresh" size="mini" @click="btnResetQuery">重置</el-button>
  31. <el-button size="mini" @click="btnBack" style="float:right">返回</el-button>
  32. </el-form-item>
  33. </el-col>
  34. </el-row>
  35. </el-form>
  36. <div style="float:right">
  37. <el-dropdown @command="btnImport">
  38. <el-button type="primary" size="mini">
  39. 导入<i class="el-icon-arrow-down el-icon--right"></i>
  40. </el-button>
  41. <el-dropdown-menu slot="dropdown">
  42. <el-button size="mini" @click="useImportTemplate">模板下载</el-button>
  43. <el-upload ref="upload" action="" :http-request="onUpload">
  44. <el-button size="mini" type="primary">数据导入</el-button>
  45. </el-upload>
  46. </el-dropdown-menu>
  47. </el-dropdown>
  48. </div>
  49. <el-table size="mini" height="500px" v-loading="loading" :data="listData">
  50. <el-table-column label="绩效编号" align="center" prop="id" />
  51. <el-table-column label="员工姓名" align="center" prop="staffName" />
  52. <el-table-column show-overflow-tooltip label="评估周期" align="center" prop="name" />
  53. <el-table-column label="月度" align="center" prop="month" />
  54. <el-table-column label="自评分" align="center" prop="saMark" />
  55. <el-table-column label="上级评分" align="center" prop="ldMark" />
  56. <el-table-column label="综合得分" align="center" prop="mark" />
  57. <el-table-column label="等级" align="center" prop="grade" />
  58. <el-table-column label="绩效系数" align="center" prop="coefficient" />
  59. </el-table>
  60. <div class="paginationClass">
  61. <pagination
  62. v-show="total>0"
  63. :total="total"
  64. :page.sync="queryParams.pageNum"
  65. :limit.sync="queryParams.pageSize"
  66. @pagination="getList"
  67. />
  68. </div>
  69. </div>
  70. </div>
  71. </template>
  72. <script>
  73. import { listKanban,importData} from "@/api/business/ehr/pm/kanban";
  74. import { listDept} from "@/api/business/ehr/ehr/dept";
  75. export default {
  76. name: "assess",
  77. dicts: ['ehr_pm_status'],
  78. data() {
  79. return {
  80. // 遮罩层
  81. loading: true,
  82. // 显示搜索条件
  83. showSearch: true,
  84. // 总条数
  85. total: 0,
  86. // 表格数据
  87. listData: [],
  88. // id集合
  89. ids: [],
  90. // 弹出层标题
  91. title: "",
  92. // 是否显示弹出层
  93. open: false,
  94. // 查询参数
  95. queryParams: {
  96. pageNum: 1,
  97. pageSize: 10,
  98. params:{
  99. staffCodeOrName: null,
  100. },
  101. dept: null,
  102. },
  103. //部门树
  104. deptTree: [],
  105. //value
  106. treeValue: [],
  107. };
  108. },
  109. async created() {
  110. this.queryParams.sourceId = this.$route.query.id;
  111. this.getList();
  112. listDept().then(response => {
  113. let arr = response.rows;
  114. arr.forEach(function(element) {
  115. element.parent_id = element.superiorsDept;
  116. element.value = element.code;
  117. element.label = element.name;
  118. });
  119. this.deptTree = this.arrayToTree(arr,null);
  120. });
  121. },
  122. methods: {
  123. /** 查询绩效列表 */
  124. getList() {
  125. this.loading = true;
  126. this.queryParams.dept = this.treeValue[this.treeValue.length - 1];
  127. listKanban(this.queryParams).then(response => {
  128. this.listData = response.rows;
  129. this.ids = response.rows.map(item => item.id);
  130. this.total = response.total;
  131. this.loading = false;
  132. });
  133. },
  134. /** 搜索按钮操作 */
  135. async btnSearch() {
  136. this.queryParams.pageNum = 1;
  137. this.getList();
  138. },
  139. /** 重置按钮操作 */
  140. btnResetQuery() {
  141. this.resetForm("queryForm");
  142. this.treeValue = [];
  143. this.queryParams.params.staffCodeOrName = null;
  144. this.btnSearch();
  145. },
  146. arrayToTree(data, pid) {
  147. let result = []
  148. this.getChildren(data, result, pid)
  149. return result
  150. },
  151. getChildren(data, result, pid) {
  152. for (const item of data) {
  153. if (item.parent_id === pid) {
  154. const newItem = { children: [], ...item }
  155. result.push(newItem)
  156. this.getChildren(data, newItem.children, item.code)
  157. }
  158. }
  159. },
  160. //
  161. handleChange(value){
  162. console.log("value",value);
  163. this.$refs.cascaderHandle.dropDownVisible = false;
  164. },
  165. //导入按钮
  166. btnImport(command){
  167. if(command == 'useImportTemplate'){
  168. this.useImportTemplate();
  169. }
  170. if(command == 'useImportData'){
  171. this.useImportData();
  172. }
  173. },
  174. //模板下载
  175. useImportTemplate(){
  176. this.download('ehr/pm/kanban/importTemplate', {
  177. }, `看板数据导入模板_${new Date().getTime()}.xlsx`)
  178. },
  179. //导入
  180. useImportData(){
  181. console.log("导入");
  182. },
  183. // 上传文件
  184. onUpload (file) {
  185. this.loading = true;
  186. let formData = new FormData()
  187. formData.append('file',file.file);
  188. formData.append('stageId',this.$route.query.id);
  189. importData(formData).then((res) => {
  190. if(res.code == '200'){
  191. this.$message.success(res.msg);
  192. }else{
  193. this.$message.success(res.msg);
  194. }
  195. }).catch((e) => {
  196. this.$message.error(e.message)
  197. }).finally((e) => {
  198. this.$refs['upload'].clearFiles();
  199. this.getList();
  200. this.loading = false;
  201. })
  202. },
  203. //返回
  204. btnBack(){
  205. this.$router.back();
  206. },
  207. }
  208. };
  209. </script>
  210. <style lang="scss" scoped>
  211. .btn_grooup {
  212. margin-bottom: 10px;
  213. display: flex;
  214. justify-content: flex-end;
  215. }
  216. .paginationClass {
  217. z-index: 500;
  218. position: fixed;
  219. bottom: 10px;
  220. right: 10px;
  221. width: 100%;
  222. line-height: var(--footer-height);
  223. color: #fff;
  224. }
  225. </style>