levelSetting.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <!--
  2. * @Author: zwy
  3. * @Date: 2021-05-08 08:28:00
  4. * @LastEditors: zwy
  5. * @LastEditTime: 2021-05-17 10:37:51
  6. * @Descripttion:考评设置-考评等级设置
  7. -->
  8. <template>
  9. <div class="levelSetting">
  10. <div class="organ-tree">
  11. <el-input v-model="filterText" placeholder="请输入机构名称" suffix-icon="el-icon-search"></el-input>
  12. <div class="tree-style-box">
  13. <el-scrollbar style="height: 100%">
  14. <el-tree
  15. class="tree-style"
  16. :data="organList"
  17. ref="tree"
  18. node-key="id"
  19. :highlight-current="true"
  20. :props="defaultProps"
  21. :expand-on-click-node="false"
  22. @node-click="treeClick"
  23. default-expand-all
  24. :filter-node-method="filterNode"
  25. >
  26. <span class="ellipsis" slot-scope="{ node }">
  27. <span :title="node.label">{{ node.label }}</span>
  28. </span>
  29. </el-tree>
  30. </el-scrollbar>
  31. </div>
  32. </div>
  33. <div class="levelSetting-content">
  34. <div class="search">
  35. <el-select v-model="mixins_query.grade" clearable placeholder="请选择绩效等级">
  36. <el-option v-for="(item, index) in levelList" :key="index" :label="item.dictValue" :value="item.dictCode">{{
  37. item.dictValue
  38. }}</el-option>
  39. </el-select>
  40. <el-button type="primary" class="search-btn" @click="mixins_search" icon="el-icon-search">查询 </el-button>
  41. <div class="search-icon">
  42. <el-tooltip class="item" effect="light" placement="bottom" content="删除">
  43. <i class="zoniot_font zoniot-icon-shanchu2" @click="deleteAll"></i>
  44. </el-tooltip>
  45. <el-tooltip class="item" effect="light" placement="bottom" content="新增">
  46. <i class="zoniot_font zoniot-icon-tianjia2" @click="addOrEdit('add')"></i>
  47. </el-tooltip>
  48. </div>
  49. </div>
  50. <zz-table
  51. :cols="cols"
  52. :settings="{ showIndex: true, showCheckbox: true }"
  53. :pageset="mixins_pageset"
  54. @page-change="pageChange"
  55. :data="mixins_list"
  56. :loading="mixins_onQuery"
  57. @selection-change="selectionChange"
  58. >
  59. <template slot-scope="scope" slot="opt">
  60. <div class="opt">
  61. <el-tooltip effect="light" placement="bottom" content="编辑">
  62. <i class="zoniot_font zoniot-icon-bianji" @click="addOrEdit('edit', scope.index)"></i>
  63. </el-tooltip>
  64. <el-tooltip effect="light" placement="bottom" content="删除">
  65. <i class="zoniot_font zoniot-icon-shanchu redText" @click="deleteOne(scope.row.id)"></i>
  66. </el-tooltip>
  67. </div>
  68. </template>
  69. </zz-table>
  70. </div>
  71. </div>
  72. </template>
  73. <script>
  74. import list from '@utils/list.js';
  75. export default {
  76. mixins: [list],
  77. data() {
  78. return {
  79. currentId: '',
  80. selectRow: [],
  81. filterText: '',
  82. organList: [],
  83. defaultProps: {
  84. children: 'orgs',
  85. label: 'orgName'
  86. },
  87. cols: [
  88. {
  89. label: '所属公司',
  90. prop: 'companyOrgName'
  91. },
  92. {
  93. label: '绩效等级',
  94. prop: 'evaluationGradeName'
  95. },
  96. {
  97. label: '分值1',
  98. prop: 'valueOne'
  99. },
  100. {
  101. label: '分值2',
  102. prop: 'valueTwo'
  103. },
  104. {
  105. label: '类型',
  106. prop: 'typeName'
  107. },
  108. {
  109. label: '备注',
  110. prop: 'remarks'
  111. },
  112. {
  113. label: '创建时间',
  114. prop: 'createDate'
  115. },
  116. {
  117. label: '操作',
  118. slot: 'opt'
  119. }
  120. ],
  121. levelList: [] //绩效等级分类
  122. };
  123. },
  124. methods: {
  125. getOrgTreeList() {
  126. this.$http.postForm('/sc-user-center/org/getOrgTree', { orgType: 'company', id: '000' }).then(({ status, data, msg }) => {
  127. if (status === 0 && data) {
  128. this.organList = data;
  129. this.$nextTick().then(() => {
  130. const firstNode = document.querySelector('.el-tree-node');
  131. firstNode.click();
  132. });
  133. }
  134. });
  135. },
  136. filterNode(value, data) {
  137. if (!value) return true;
  138. return data.orgName.indexOf(value) !== -1;
  139. },
  140. treeClick(e) {
  141. if (e.id == 0) return;
  142. this.currentId = e.id;
  143. },
  144. addOrEdit(todo, index) {
  145. new Promise((resolve) => {
  146. let row,
  147. title = '编辑考评等级';
  148. if ('add' == todo) {
  149. title = '新增考评等级';
  150. } else {
  151. row = this.mixins_list[index] || {};
  152. row = JSON.parse(JSON.stringify(row));
  153. }
  154. this.$store.dispatch('openModal', {
  155. url: '/performanceManagement/evaluationSet/levelSetting/popups/levelAddOrEdit.vue',
  156. title: title,
  157. width: todo == 'add' ? '926px' : '562px',
  158. height: todo == 'add' ? '662px' : '520px',
  159. props: {
  160. data: row,
  161. todo: todo,
  162. callback: resolve
  163. }
  164. });
  165. }).then(() => {
  166. this.mixins_search();
  167. });
  168. },
  169. deleteOne(id) {
  170. this.$msgBox(`刪除考评等级`, '删除后将无法恢复,请问是否继续?')
  171. .then(() => {
  172. this.$http.postForm('/sc-community/evaluation/grade/deleteById', { id }).then(({ msg, status, data }) => {
  173. if (status == 0) {
  174. this.$message.success(msg);
  175. this.mixins_search();
  176. } else {
  177. this.$message.error(msg);
  178. }
  179. });
  180. })
  181. .catch(() => {});
  182. },
  183. deleteAll() {
  184. let ids = [];
  185. if (!this.selectRow.length) {
  186. this.$message.error('您尚未选择要删除的记录,请选择后再操作批量删除');
  187. return;
  188. }
  189. this.selectRow.forEach((v) => {
  190. ids.push(v.id);
  191. });
  192. this.$msgBox(`刪除考评等级`, '删除后将无法恢复,请问是否继续?')
  193. .then(() => {
  194. this.$http.post('/sc-community/evaluation/grade/deleteByIds', ids).then(({ status, data, msg }) => {
  195. if (status == 0) {
  196. this.$message.success(msg);
  197. this.mixins_search();
  198. } else {
  199. this.$message.error(msg);
  200. }
  201. });
  202. })
  203. .catch(() => {});
  204. },
  205. selectionChange(val) {
  206. this.selectRow = val;
  207. },
  208. //获取绩效等级
  209. getLevelList() {
  210. this.$api.common.getDictionaryData('SC_EVALUATION_GRADE ').then(({ msg, status, data }) => {
  211. if (status == 0) {
  212. this.levelList = data;
  213. }
  214. });
  215. }
  216. },
  217. watch: {
  218. currentId(newValue, oldValue) {
  219. this.mixins_query.companyOrgId = newValue;
  220. this.mixins_search();
  221. },
  222. filterText(val) {
  223. this.$refs.tree.filter(val);
  224. }
  225. },
  226. created() {
  227. this.getLevelList();
  228. this.getOrgTreeList();
  229. this.mixins_dataUrl = '/sc-community/evaluation/grade/selectPage';
  230. this.mixins_post = 'get';
  231. this.mixins_query = {
  232. companyOrgId: '',
  233. grade: ''
  234. };
  235. }
  236. };
  237. </script>
  238. <style lang="scss" scoped>
  239. .levelSetting {
  240. height: calc(100% - 80px);
  241. .organ-tree {
  242. width: 260px;
  243. height: 100%;
  244. background: #ffffff;
  245. padding: 20px;
  246. float: left;
  247. font-size: 14px;
  248. .tree-style-box {
  249. margin-top: 20px;
  250. }
  251. }
  252. .levelSetting-content {
  253. margin-left: 20px;
  254. width: calc(100% - 280px);
  255. float: left;
  256. .search {
  257. background: #ffffff;
  258. height: 60px;
  259. padding: 16px 20px 14px 20px;
  260. .search-icon {
  261. vertical-align: top;
  262. float: right;
  263. .fr-fs-fc {
  264. color: #2787f1;
  265. font-size: 30px;
  266. }
  267. .fr-fs-fc:first-child {
  268. margin-right: 20px;
  269. }
  270. }
  271. .searchbutton {
  272. width: 0.6rem;
  273. vertical-align: middle;
  274. margin-right: 5px;
  275. }
  276. }
  277. }
  278. }
  279. </style>