index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <div class="squrt"></div>人力资源表
  5. </h2>
  6. <div class="m-core">
  7. <div class="newBand" v-permission="'helpCenterContent/modify'" @click="openTypes('create')">添加</div>
  8. <!-- 搜索标题 -->
  9. <el-form :inline="true" class="searchForm" v-model.trim="searchForm">
  10. <el-form-item>
  11. <el-input placeholder="姓名手机号" v-model.trim="searchForm.userNameOrIdOrMobile"></el-input>
  12. </el-form-item>
  13. <el-form-item>
  14. <el-select v-model.trim="searchForm.jobNature"
  15. clearable
  16. filterable
  17. placeholder="请选择员工类型">
  18. <el-option label="全职"
  19. value="FULL_TIME"></el-option>
  20. <el-option label="兼职"
  21. value="PART_TIME"></el-option>
  22. <el-option label="临时"
  23. value="TEMPORARY"></el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item>
  27. <el-select v-model.trim="searchForm.position"
  28. clearable
  29. filterable
  30. placeholder="请选择职位">
  31. <el-option label="指导老师"
  32. value="ADVISER"></el-option>
  33. <el-option label="教务老师"
  34. value="ACADEMIC"></el-option>
  35. <el-option label="乐队指导"
  36. value="TEACHING"></el-option>
  37. </el-select>
  38. </el-form-item>
  39. <el-form-item>
  40. <el-select v-model.trim="searchForm.organId"
  41. placeholder='请选择分部'
  42. clearable
  43. filterable
  44. >
  45. <el-option v-for='(item,index) in organList'
  46. :key="index"
  47. :value="item.id"
  48. :label="item.name"
  49. >
  50. </el-option>
  51. </el-select>
  52. </el-form-item>
  53. <el-form-item
  54. prop="subjectIds"
  55. :label-width="formLabelWidth"
  56. >
  57. <el-select
  58. v-model.trim="searchForm.subjectId"
  59. clearable
  60. filterable
  61. placeholder='请选择声部'
  62. >
  63. <el-option-group v-for="group in subjectList"
  64. :key="group.label"
  65. :label="group.label">
  66. <el-option v-for="item in group.options"
  67. :key="item.value"
  68. :label="item.label"
  69. :value="item.value">
  70. </el-option>
  71. </el-option-group>
  72. </el-select>
  73. </el-form-item>
  74. <el-form-item>
  75. <el-button @click="getList" type="danger">搜索</el-button>
  76. </el-form-item>
  77. </el-form>
  78. <div class="tableWrap">
  79. <el-table :data="tableList"
  80. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  81. <el-table-column width="120px" align="center" prop="id" label="编号"></el-table-column>
  82. <el-table-column align="center" prop="realName" label="姓名"></el-table-column>
  83. <el-table-column align="center" prop="mobileNo" label="手机号"></el-table-column>
  84. <el-table-column align="center" prop="wechatNo" label="微信"></el-table-column>
  85. <el-table-column align="center" label="学历信息">
  86. <template slot-scope="scope">
  87. <el-button @click="openEducation(scope.row)" type="text">查看学历</el-button>
  88. </template>
  89. </el-table-column>
  90. <el-table-column align="center" prop="subjectId" label="声部">
  91. <template slot-scope="scope">
  92. {{ subjectListObj[scope.row.subjectId] }}
  93. </template>
  94. </el-table-column>
  95. <el-table-column align="center" prop="liveCity" label="所在城市"></el-table-column>
  96. <el-table-column align="center" prop="intentionCity" label="工作意向"></el-table-column>
  97. <el-table-column align="center" prop="isInterviewed" label="是否经过评估">
  98. <template slot-scope="scope">
  99. {{ scope.row.gender ? '是' : '否' }}
  100. </template>
  101. </el-table-column>
  102. <el-table-column align="center" prop="otherComment" label="其它综合情况"></el-table-column>
  103. <el-table-column align="center" prop="entryDate" label="入职时间">
  104. <template slot-scope="scope">
  105. {{ scope.row.entryDate | dayjsFormat}}
  106. </template>
  107. </el-table-column>
  108. <el-table-column align="center" prop="position" label="职位">
  109. <template slot-scope="scope">
  110. {{ scope.row.position | jobType }}
  111. </template>
  112. </el-table-column>
  113. <el-table-column align="center" prop="organId" label="分部">
  114. <template slot-scope="scope">
  115. {{ organListObj[scope.row.organId] }}
  116. </template>
  117. </el-table-column>
  118. <el-table-column align="center" prop="jobNature" label="员工类型">
  119. <template slot-scope="scope">
  120. {{ scope.row.jobNature | jobNature }}
  121. </template>
  122. </el-table-column>
  123. <el-table-column align="center" prop="isProbationPeriod" label="员工状态">
  124. <template slot-scope="scope">
  125. {{ scope.row.isProbationPeriod ? '正式' : '试用' }}
  126. </template>
  127. </el-table-column>
  128. <el-table-column align="center" prop="idCard" label="证件号码"></el-table-column>
  129. <el-table-column align="center" prop="age" label="年龄"></el-table-column>
  130. <el-table-column align="center" prop="gender" label="性别">
  131. <template slot-scope="scope">
  132. {{ scope.row.gender ? '男' : '女' }}
  133. </template>
  134. </el-table-column>
  135. <el-table-column align="center" prop="bankCardNo" label="银行卡号"></el-table-column>
  136. <el-table-column align="center" prop="bankAddress" label="开户行"></el-table-column>
  137. <el-table-column align="center" prop="emergencyContactName" label="紧急联系人"></el-table-column>
  138. <el-table-column align="center" prop="emergencyContactRelation" label="紧急联系人关系"></el-table-column>
  139. <el-table-column align="center" prop="emergencyContactPhone" label="紧急联系人电话"></el-table-column>
  140. <el-table-column align="center" prop="resignationDate" label="离职时间">
  141. <template slot-scope="scope">
  142. {{ scope.row.resignationDate | dayjsFormat}}
  143. </template>
  144. </el-table-column>
  145. <el-table-column align="center" label="操作">
  146. <template slot-scope="scope">
  147. <el-button v-permission="'helpCenterContent/modify'" @click="openTypes('update', scope.row)" type="text">修改</el-button>
  148. <!-- <el-button @click="onTypeDelOpeation(scope.row)"
  149. v-permission="'helpCenterContent/delete'" type="text">删除</el-button> -->
  150. </template>
  151. </el-table-column>
  152. </el-table>
  153. <pagination
  154. :total="pageInfo.total"
  155. :page.sync="pageInfo.page"
  156. :limit.sync="pageInfo.limit"
  157. :page-sizes="pageInfo.page_size"
  158. @pagination="getList"
  159. />
  160. </div>
  161. </div>
  162. <el-dialog
  163. :title="formTitle[formActionTitle]"
  164. :visible.sync="typeStatus"
  165. destroy-on-close
  166. :close-on-click-modal="false"
  167. @close="onFormClose('ruleForm')"
  168. width="1050px"
  169. >
  170. <hrform :detail.sync="rowDetail" :organList="organList" :subjectList="subjectList" :close="onFormClose" />
  171. </el-dialog>
  172. <el-dialog
  173. title="查看学历信息"
  174. :visible.sync="educationVisible"
  175. destroy-on-close
  176. :close-on-click-modal="false"
  177. @close="educationVisible = false"
  178. width="600px"
  179. >
  180. <el-table :data="educationList"
  181. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  182. <el-table-column align="center" prop="level" label="学历"></el-table-column>
  183. <el-table-column align="center" prop="school" label="毕业学校"></el-table-column>
  184. <el-table-column align="center" prop="year" label="毕业时间">
  185. <template slot-scope="scope">
  186. {{ scope.row.year | dayjsFormat}}
  187. </template>
  188. </el-table-column>
  189. </el-table>
  190. </el-dialog>
  191. </div>
  192. </template>
  193. <script>
  194. import pagination from "@/components/Pagination/index";
  195. import dayjs from 'dayjs'
  196. import hrform from './form'
  197. // import store from '@/store'
  198. import {
  199. helpCenterCatalogList,
  200. employeeInfo,
  201. helpCenterContentModify,
  202. helpCenterContentDelete
  203. } from "@/api/appTenant";
  204. import { getEmployeeOrgan } from '@/api/buildTeam'
  205. import { subjectListTree } from '@/api/specialSetting'
  206. export default {
  207. components: { pagination, hrform },
  208. name: "helpCategory",
  209. data() {
  210. return {
  211. searchForm: {
  212. organId: '',
  213. jobNature: '',
  214. position: '',
  215. subjectId: '',
  216. userNameOrIdOrMobile: '',
  217. },
  218. educationVisible: false,
  219. treeList: [],
  220. tableList: [],
  221. educationList: [],
  222. formActionTitle: "create",
  223. formTitle: {
  224. create: "添加人员",
  225. update: "修改人员"
  226. },
  227. typeStatus: false, // 添加教学点
  228. formLabelWidth: "100px",
  229. form: {
  230. title: null, // 标题
  231. content: null, // 内容
  232. catalogId: null, // 分类编号
  233. },
  234. rules: {
  235. title: [{ required: true, message: "请输入标题", trigger: "blur" }],
  236. content: [{ required: true, message: "请输入内容", trigger: "blur" }],
  237. catalogId: [{ required: true, message: "请输入选择分类", trigger: "blur" }]
  238. // subjectIds: [{ required: true, message: "请选择声部组合", trigger: "change" }]
  239. },
  240. pageInfo: {
  241. // 分页规则
  242. limit: 10, // 限制显示条数
  243. page: 1, // 当前页
  244. total: 0, // 总条数
  245. page_size: [10, 20, 40, 50] // 选择限制显示条数
  246. },
  247. rowDetail: null,
  248. tempTreeList: [],
  249. organList: [],
  250. subjectList: [],
  251. };
  252. },
  253. activated() {
  254. this.getList();
  255. // this.getTreeList()
  256. },
  257. computed: {
  258. subjectListObj() {
  259. const data = {}
  260. for (let i = 0; i < this.subjectList.length; i++) {
  261. const item = this.subjectList[i];
  262. for (let j = 0; j < item.options.length; j++) {
  263. const option = item.options[j];
  264. data[option.value] = option.label
  265. }
  266. }
  267. return data
  268. },
  269. organListObj() {
  270. const data = {}
  271. for (let i = 0; i < this.organList.length; i++) {
  272. const item = this.organList[i];
  273. data[item.id] = item.name
  274. }
  275. return data
  276. }
  277. },
  278. mounted() {
  279. this.getList();
  280. this.getTreeList()
  281. getEmployeeOrgan().then(res => {
  282. if (res.code == 200) {
  283. this.organList = res.data;
  284. }
  285. })
  286. subjectListTree({
  287. delFlag: 0,
  288. rows: 9999
  289. }).then(res => {
  290. let result = res.data
  291. if (res.code == 200) {
  292. let tempArray = []
  293. result.rows.forEach((item, index) => {
  294. let subject = []
  295. item.subjects.forEach(s => {
  296. subject.push({
  297. value: s.id,
  298. label: s.name
  299. })
  300. })
  301. tempArray[index] = {
  302. label: item.name,
  303. options: subject
  304. }
  305. })
  306. this.subjectList = tempArray
  307. }
  308. })
  309. },
  310. methods: {
  311. openEducation(row) {
  312. try {
  313. this.educationList = JSON.parse(row.educationalBackground)
  314. this.educationVisible = true
  315. } catch (error) {
  316. this.$message.error('数据解析失败')
  317. }
  318. },
  319. onTypeDelOpeation(row) {
  320. this.$confirm('您是否删除该内容?', '提示', {
  321. confirmButtonText: '确定',
  322. cancelButtonText: '取消',
  323. type: 'warning'
  324. }).then(() => {
  325. helpCenterContentDelete({ id: row.id }).then(res => {
  326. this.messageTips('删除', res)
  327. })
  328. }).catch(() => {
  329. })
  330. },
  331. onTypeSubmit(formName) {
  332. // 添加数据
  333. this.$refs[formName].validate(valid => {
  334. if (valid) {
  335. if (this.formActionTitle == "create") {
  336. let params = {
  337. title: this.form.title, // 标题
  338. content: this.form.content, // 内容
  339. catalogId: this.form.catalogId[this.form.catalogId.length - 1], // 分类编号
  340. }
  341. helpCenterContentModify(params).then(res => {
  342. this.messageTips("添加", res);
  343. });
  344. } else if (this.formActionTitle == "update") {
  345. let params = {
  346. id: this.form.id,
  347. title: this.form.title, // 标题
  348. content: this.form.content, // 内容
  349. catalogId: this.form.catalogId[this.form.catalogId.length - 1], // 分类编号
  350. }
  351. helpCenterContentModify(params).then(res => {
  352. this.messageTips("修改", res);
  353. });
  354. }
  355. } else {
  356. return false;
  357. }
  358. });
  359. },
  360. messageTips(title, res) {
  361. if (res.code == 200) {
  362. this.$message.success(title + "成功");
  363. this.typeStatus = false;
  364. this.getList();
  365. } else {
  366. this.$message.error(res.msg);
  367. }
  368. },
  369. getList() {
  370. let params = {
  371. ...this.searchForm,
  372. page: this.pageInfo.page,
  373. rows: this.pageInfo.limit
  374. }
  375. employeeInfo(params).then(res => {
  376. let result = res.data;
  377. if (res.code == 200) {
  378. this.tableList = result.rows;
  379. this.pageInfo.total = result.total
  380. }
  381. });
  382. },
  383. getTreeList() {
  384. helpCenterCatalogList({
  385. parentId: 0
  386. }).then(res => {
  387. let result = res.data;
  388. if (res.code == 200) {
  389. this.treeList = this.setTableData(result);
  390. }
  391. });
  392. },
  393. setTableData (result) {
  394. let list = []
  395. list = result.map(res => {
  396. let tempList = {}
  397. tempList = {
  398. value: res.id,
  399. label: res.text,
  400. parentId: res.parentId
  401. }
  402. if (res.children && res.children.length > 0) {
  403. tempList.children = this.setTableData(res.children)
  404. }
  405. return tempList
  406. })
  407. return list
  408. },
  409. openTypes(type, row) {
  410. this.rowDetail = {...row}
  411. this.typeStatus = true
  412. this.formActionTitle = type
  413. if (type == "update") {
  414. // 修改的时候赋值
  415. this.form = {
  416. id: row.id,
  417. title: row.title, // 标题
  418. content: row.content, // 内容
  419. catalogId: this.getAllIds(row), // 分类编号
  420. };
  421. }
  422. },
  423. onToUrl() {
  424. this.$router.push('/insideSetting/helpCategory')
  425. },
  426. getAllIds(row) {
  427. let idAndParent=[];// idAndParent保存 Tree所有节点的id和parentId
  428. this.getIdAndParent(this.treeList,idAndParent);
  429. let parentIds = []; // 用于保存选中节点的父节点及父节点的父节点
  430. this.getId(row.catalogId, parentIds, idAndParent);
  431. return parentIds.reverse(); //反转数组
  432. },
  433. getIdAndParent(tree, idAndParentIds) {// idAndParentIds用来保存所有节点的id,parentId
  434. // 对原有的数据结构进行遍历,拿出所有节点的id,parentId到一个一维数组中。
  435. tree.forEach(item => {
  436. let mid = {
  437. id: item.value,
  438. parentId: item.parentId,
  439. };
  440. idAndParentIds.push(mid);
  441. if (item.children) {
  442. this.getIdAndParent(item.children, idAndParentIds);
  443. }
  444. });
  445. },
  446. getId(id, parentIds, idAndParent) {
  447. idAndParent.forEach(item => {
  448. if (item.id == id) {
  449. parentIds.push(id);
  450. if (item.parentId != -1) {
  451. this.getId(item.parentId, parentIds, idAndParent);
  452. }
  453. }
  454. });
  455. },
  456. onFormClose(formName) {
  457. this.rowDetail = null
  458. this.typeStatus = false
  459. // 关闭弹窗重置验证
  460. this.form = {
  461. title: null, // 标题
  462. content: null, // 内容
  463. catalogId: [], // 分类编号
  464. }
  465. // this.$refs.cascader.handleClear()
  466. // this.$refs[formName].resetFields();
  467. }
  468. }
  469. };
  470. </script>
  471. <style lang="scss" scoped>
  472. .el-button--primary {
  473. background: #14928a;
  474. border-color: #14928a;
  475. color: #fff;
  476. &:hover,
  477. &:active,
  478. &:focus {
  479. background: #14928a;
  480. border-color: #14928a;
  481. color: #fff;
  482. }
  483. }
  484. /deep/.el-date-editor.el-input {
  485. width: 100% !important;
  486. }
  487. /deep/.el-select {
  488. width: 100% !important;
  489. }
  490. /deep/.el-table .cell {
  491. display: -webkit-box;
  492. overflow: hidden;
  493. text-overflow: ellipsis;
  494. -webkit-line-clamp: 3;
  495. -webkit-box-orient: vertical;
  496. }
  497. /deep/.el-dialog__body {
  498. padding: 10px 20px;
  499. }
  500. .newBand {
  501. display: inline-block;
  502. }
  503. </style>