2
0

EvaluateSet.vue 11 KB

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