EvaluateSet.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <template>
  2. <div class="all">
  3. <header class="flex-box-ce">
  4. <div class="flex-1"><el-input prefix-icon="el-icon-search" placeholder="搜索考核表" v-model="search_words" class="width-250" clearable></el-input></div>
  5. <div class="flex-box-ce" v-if="$isAuthoritys($14)">
  6. <el-button type="text" style="margin-right: 10px;text-decoration:underline" @click="openUsers">无考核表人员</el-button>
  7. <el-button type="primary" style="margin-right: 10px;" @click="handleCommand('A')">新增考核表</el-button>
  8. <el-button class="primaryBtn" @click="handleCommand('B')">复制考核表</el-button>
  9. </div>
  10. </header>
  11. <div class="main">
  12. <div style="margin-top: 20px;">
  13. <div class="yellow" v-if="isUpdata">刚刚操作了【{{isUpdata}}】,你可以 “<span class="blue" @click="$router.push({ path: '/sponsorAssess' })">发起考核</span>” 或继续 “<span class="blue" @click="handleCommand('A')">新增考核表</span>” </div>
  14. <el-table stripe :data="tableData" class="table-box scroll-bar" style="width: 100%;" v-loading="loading">
  15. <el-table-column prop="name" width="600px" sortable label="名称">
  16. <template slot-scope="scope">
  17. <PreBox :value="scope.row.name"></PreBox>
  18. </template>
  19. </el-table-column>
  20. <el-table-column prop="employee_num" label="参与人数"></el-table-column>
  21. <el-table-column prop="cycle_type" label="周期类型" sortable>
  22. <template slot-scope="scope">
  23. <span>{{ $getCycleType(scope.row.cycle_type) }}</span>
  24. </template>
  25. </el-table-column>
  26. <el-table-column prop="address" label="操作">
  27. <template slot-scope="scope">
  28. <div class="is">
  29. <span class="blue" @click="compile(scope.row,'1')">人员分组</span>
  30. <span class="blue" style="margin: 0 10px;" @click="compile(scope.row,'2')">考核模板</span>
  31. <span class="blue" @click="compile(scope.row,'3')">具体流程</span>
  32. <!-- <el-tooltip effect="dark" content="编辑" placement="top"><i class="el-icon-edit yellow" @click="compile(scope.row)"></i></el-tooltip>
  33. <el-tooltip effect="dark" content="预览流程" placement="top"><i class="el-icon-tickets blue" @click="preview(scope.row)"></i></el-tooltip>
  34. <el-tooltip effect="dark" content="删除" placement="top"><i class="el-icon-delete red" @click="deleteItem(scope.row.id)"></i></el-tooltip> -->
  35. </div>
  36. <el-dropdown placement="bottom" :show-timeout="150" :hide-timeout="150">
  37. <span class="el-dropdown-links">···</span>
  38. <el-dropdown-menu slot="dropdown">
  39. <el-dropdown-item :disabled="false">
  40. <el-button type="text" class="color-red" v-loading.fullscreen.lock="bodyLoad" @click.stop="preview(scope.row)">预览流程</el-button>
  41. </el-dropdown-item>
  42. <el-dropdown-item :disabled="false">
  43. <el-button type="text" class="color-red" v-loading.fullscreen.lock="bodyLoad" @click.stop="deleteItem(scope.row.id)">删除</el-button>
  44. </el-dropdown-item>
  45. </el-dropdown-menu>
  46. </el-dropdown>
  47. </template>
  48. </el-table-column>
  49. </el-table>
  50. <Pagination :page="page" :page_size="page_size" :total="total" @handleSizeChange="handleSizeChange" @handleCurrentChange="handleCurrentChange"></Pagination>
  51. </div>
  52. </div>
  53. <BrawerBox drawerTitle="选择考核表" :showDrawer.sync="isChecks">
  54. <template slot="main">
  55. <div class="flex-box-ce">
  56. <el-input prefix-icon="el-icon-search" placeholder="搜索考核" v-model="search_words2"></el-input>
  57. <el-select v-model="cycle_type" placeholder="" style="margin: 0 10px;">
  58. <el-option v-for="item in $getCycleType()" :key="item.value" :label="item.label" :value="item.value"></el-option>
  59. </el-select>
  60. </div>
  61. <ul class="ul" v-if="allData.length > 0">
  62. <li v-for="(item, index) in allData" :key="index" class="flex-box-ce li" v-if="item.name.indexOf(search_words2) >= 0">
  63. <el-radio v-model="cycleId" :label="item.id" class="flex-box-ce flex-1" style="padding: 15px 0;">
  64. <div class="flex-box-ce">
  65. <div class="flex-1">{{ item.name }}</div>
  66. <div class="blue" v-if="item.employee_num > 0">{{ item.employee_num }} 人</div>
  67. </div>
  68. </el-radio>
  69. </li>
  70. </ul>
  71. <NoData v-else content="暂无内容"></NoData>
  72. </template>
  73. <template slot="footer">
  74. <el-button plain @click="isChecks = false">取消</el-button>
  75. <el-button type="primary" :loading="loading" @click="submitForm('detailForm')">确定</el-button>
  76. </template>
  77. </BrawerBox>
  78. <BrawerBox drawerTitle="无考核表人员" :showDrawer.sync="isNoUser">
  79. <template slot="main">
  80. <div class="flex-box-ce"><el-input prefix-icon="el-icon-search" placeholder="人员搜索" v-model="search_words3"></el-input></div>
  81. <ul class="ul" v-if="isNoUserList.length > 0">
  82. <li v-for="(item, index) in isNoUserList" :key="index" class="flex-box-ce li" style="padding: 15px 0;" v-if="item.name.indexOf(search_words3) >= 0">
  83. <userImage :user_name="item.name" fontSize="14" :img_url="item.img_url"></userImage>
  84. <div class="flex-box-v" style="margin: 0 10px;">
  85. <div>{{ item.name }}</div>
  86. <div v-if="item.dept_list.length > 0" style="margin-top: 5px;" class="fontColorF font-flex-word">
  87. <span v-for="(item2, index2) in item.dept_list" :key="index2">
  88. <span>{{ item2.name }}</span>
  89. <span v-if="item.dept_list.length - index2 > 1">,</span>
  90. </span>
  91. </div>
  92. </div>
  93. </li>
  94. </ul>
  95. <NoData v-else content="暂无内容"></NoData>
  96. </template>
  97. <template slot="footer">
  98. <el-button plain @click="isNoUser = false">关闭</el-button>
  99. </template>
  100. </BrawerBox>
  101. </div>
  102. </template>
  103. <script>
  104. import EmployeeSelector from '@/components/public/EmployeeSelector';
  105. import BrawerBox from '@/components/public/BrawerBox';
  106. import { _debounce } from '@/api/auth';
  107. export default {
  108. components: { EmployeeSelector, BrawerBox },
  109. name: 'EvaluateSet',
  110. data() {
  111. return {
  112. total: 0,
  113. page: 1,
  114. page_size: 10,
  115. tableData: [],
  116. allData: [],
  117. search_words: '', //关键字
  118. search_words2: '',
  119. search_words3: '',
  120. isChecks: false,
  121. loading: false,
  122. cycle_type: 0,
  123. cycleId: '',
  124. // 获取未加入考核表相关
  125. isNoUser: false,
  126. isNoUserList: [],
  127. bodyLoad: false,
  128. isUpdata:''
  129. };
  130. },
  131. watch: {
  132. isNoUser(val) {
  133. if (!val) {
  134. this.search_words3 = '';
  135. }
  136. },
  137. search_words: {
  138. deep: true,
  139. handler: _debounce(function(val) {
  140. this.page = 1;
  141. this.getList();
  142. })
  143. },
  144. cycle_type() {
  145. this.getAllList();
  146. }
  147. },
  148. created() {
  149. this.getList();
  150. this.getAllList();
  151. },
  152. activated(e) {
  153. this.isUpdata=this.$getCache('isUpdata');
  154. if(this.isUpdata){
  155. this.$removeCache('isUpdata');
  156. }
  157. },
  158. methods: {
  159. openUsers() {
  160. this.getNoEmployee(() => {
  161. this.isNoUser = true;
  162. });
  163. },
  164. // 获取未加入考核表人员
  165. getNoEmployee(fun = function() {}) {
  166. this.$axios('get', 'api/per/package/free_man').then(res => {
  167. this.isNoUserList = res.data.data.list;
  168. fun();
  169. });
  170. },
  171. //预览流程
  172. preview(item) {
  173. if (item.employee_num == 0) {
  174. this.$message.warning('该考核表没有参与人数,不可预览');
  175. return false;
  176. }
  177. this.$router.push({ path: '/previewTow', query: { group_id: item.id, name: item.name } });
  178. },
  179. //删除
  180. deleteItem(id) {
  181. this.$confirm('确定删除该考核表', '提示', {
  182. confirmButtonText: '确定',
  183. cancelButtonText: '取消',
  184. type: 'warning'
  185. })
  186. .then(() => {
  187. this.$axios('post', '/api/per/evaluation/delete_group', { id: id }).then(res => {
  188. this.$message.success('删除成功');
  189. this.getList();
  190. });
  191. })
  192. .catch(() => {});
  193. },
  194. //编辑
  195. compile(item,index) {
  196. let http = this.$axios('get', '/api/per/evaluation/group_detail', { id: item.id });
  197. let http2 = this.$axios('get', '/api/per/evaluation/manager', { id: item.id });
  198. Promise.all([http, http2]).then(res => {
  199. res[0].data.data.mannager_ids = res[1].data.data.list;
  200. this.$router.push({ path: '/evaluate', query: { data: JSON.stringify(res[0].data.data),index:index } });
  201. });
  202. },
  203. search() {
  204. this.page = 1;
  205. this.getList();
  206. },
  207. // 获取全部考核表
  208. getAllList() {
  209. this.$axios('get', '/api/per/evaluation/all_group', { cycle_type: this.cycle_type }).then(res => {
  210. let data = res.data.data.list || [];
  211. this.allData = data;
  212. });
  213. },
  214. // 获取考核表
  215. getList() {
  216. this.loading = true;
  217. this.$axios('get', '/api/per/evaluation/all_group', { page: this.page, page_size: this.page_size, search_words: this.search_words })
  218. .then(res => {
  219. let data = res.data.data.list || [];
  220. this.total = res.data.data.total;
  221. this.tableData = data;
  222. })
  223. .finally(() => {
  224. this.loading = false;
  225. });
  226. },
  227. actionCheck(e, obj) {},
  228. handleCommand(e) {
  229. if (e == 'A') {
  230. this.$router.push({ path: '/evaluate' });
  231. } else {
  232. this.isChecks = true;
  233. }
  234. },
  235. submitForm() {
  236. if (!this.cycleId) {
  237. this.$message.error('请选择考核表');
  238. return false;
  239. }
  240. let http = this.$axios('get', '/api/per/evaluation/group_detail', { id: this.cycleId });
  241. this.isChecks = false;
  242. Promise.all([http]).then(res => {
  243. res[0].data.data.mannager_ids = [];
  244. res[0].data.data.id = '';
  245. res[0].data.data.name = '';
  246. this.$router.push({ path: '/evaluate', query: { data: JSON.stringify(res[0].data.data) } });
  247. });
  248. },
  249. openHome() {
  250. this.$router.push({ path: '/home' });
  251. },
  252. // 页面变更
  253. handleCurrentChange(val) {
  254. this.page = val;
  255. this.getList();
  256. },
  257. // 页面跳转
  258. handleSizeChange(val) {
  259. this.page_size = val;
  260. this.getList();
  261. }
  262. }
  263. };
  264. </script>
  265. <style scoped="scoped">
  266. .blue{
  267. cursor: pointer;
  268. }
  269. .el-dropdown-links {
  270. font-size: 20px;
  271. cursor: pointer;
  272. color: #a6a8aa;
  273. }
  274. ::v-deep .el-table tr:hover {
  275. cursor: pointer;
  276. }
  277. .is i {
  278. font-size: 18px;
  279. padding: 0 10px;
  280. /* cursor: pointer; */
  281. }
  282. .all {
  283. padding: 10px;
  284. min-height: calc(100vh - 210px);
  285. position: relative;
  286. }
  287. .title {
  288. font-size: 18px;
  289. font-weight: 500;
  290. margin-bottom: 10px;
  291. }
  292. .width-250 {
  293. width: 250px;
  294. }
  295. .title-f {
  296. margin-bottom: 20px;
  297. }
  298. .inputDc {
  299. position: absolute;
  300. top: 0;
  301. right: 0;
  302. left: 0;
  303. bottom: 0;
  304. z-index: 9;
  305. }
  306. .checkChild {
  307. background-color: #fbfdff;
  308. margin-left: 20px;
  309. }
  310. .li {
  311. border-bottom: 1px solid #f1f1f1;
  312. }
  313. .li:hover {
  314. background-color: #f5f7fa;
  315. }
  316. .ul {
  317. margin-top: 20px;
  318. }
  319. .table-box {
  320. /* max-height: calc(100vh - 330px); */
  321. overflow: auto;
  322. }
  323. </style>