index.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  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"
  8. v-permission="'employeeInfo/insert'"
  9. @click="openTypes('create')">添加</div>
  10. <!-- 搜索标题 -->
  11. <saveform :inline="true"
  12. ref="searchForm"
  13. class="searchForm"
  14. :model.sync="searchForm">
  15. <el-form-item prop="userNameOrIdOrMobile">
  16. <el-input placeholder="姓名手机号"
  17. v-model.trim="searchForm.userNameOrIdOrMobile"
  18. clearable></el-input>
  19. </el-form-item>
  20. <el-form-item prop="sourceFrom">
  21. <el-select v-model.trim="searchForm.sourceFrom"
  22. clearable
  23. filterable
  24. placeholder="请选择信息来源">
  25. <el-option label="BOSS"
  26. value="BOSS"></el-option>
  27. <el-option label="转介绍"
  28. value="转介绍"></el-option>
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item prop="status">
  32. <el-select v-model.trim="searchForm.status"
  33. clearable
  34. filterable
  35. placeholder="请选择人员状态">
  36. <el-option label="未录用"
  37. value="NOT_EMPLOYED"></el-option>
  38. <el-option label="面试中"
  39. value="INTERVIEWING"></el-option>
  40. <el-option label="储备"
  41. value="RESERVE"></el-option>
  42. <el-option label="兼职"
  43. value="PART_TIME"></el-option>
  44. <el-option label="全职"
  45. value="FULL_TIME"></el-option>
  46. <el-option label="离职"
  47. value="DIMISSION"></el-option>
  48. </el-select>
  49. </el-form-item>
  50. <el-form-item prop="position">
  51. <el-select v-model.trim="searchForm.position"
  52. clearable
  53. filterable
  54. placeholder="请选择职位">
  55. <el-option label="指导老师"
  56. value="ADVISER"></el-option>
  57. <el-option label="乐团主管"
  58. value="ACADEMIC"></el-option>
  59. <el-option label="乐队指导"
  60. value="TEACHING"></el-option>
  61. </el-select>
  62. </el-form-item>
  63. <el-form-item prop="organId">
  64. <el-select v-model.trim="searchForm.organId"
  65. placeholder='请选择分部'
  66. clearable
  67. filterable>
  68. <el-option v-for='(item,index) in organList'
  69. :key="index"
  70. :value="item.id"
  71. :label="item.name">
  72. </el-option>
  73. </el-select>
  74. </el-form-item>
  75. <el-form-item prop="subjectId"
  76. :label-width="formLabelWidth">
  77. <el-select v-model.trim="searchForm.subjectId"
  78. clearable
  79. filterable
  80. placeholder='请选择声部'>
  81. <el-option v-for='(item,index) in subjectList'
  82. :key="index"
  83. :value="item.id"
  84. :label="item.name">
  85. </el-option>
  86. </el-select>
  87. </el-form-item>
  88. <el-form-item prop="dates" :label-width="formLabelWidth">
  89. <el-date-picker
  90. v-model="searchForm.dates"
  91. type="daterange"
  92. style="width: 405px;"
  93. range-separator="至"
  94. start-placeholder="更新开始日期"
  95. end-placeholder="更新结束日期">
  96. </el-date-picker>
  97. </el-form-item>
  98. <el-form-item prop="operator">
  99. <el-input placeholder="归属管理HR"
  100. v-model.trim="searchForm.operator"
  101. clearable></el-input>
  102. </el-form-item>
  103. <el-form-item>
  104. <el-button @click="search"
  105. type="danger">搜索</el-button>
  106. <el-button @click="onReSet"
  107. type="primary"
  108. style="background-color: #409EFF;border-color: #409EFF;">重置</el-button>
  109. </el-form-item>
  110. </saveform>
  111. <div class="tableWrap">
  112. <el-table :data="tableList"
  113. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  114. <el-table-column width="120px"
  115. align="center"
  116. prop="id"
  117. label="编号"></el-table-column>
  118. <el-table-column align="center"
  119. prop="realName"
  120. label="姓名">
  121. <template slot-scope="scope">
  122. <el-tooltip class="item"
  123. effect="dark"
  124. :content="scope.row.realName"
  125. placement="top">
  126. <span>{{ scope.row.realName}}</span>
  127. </el-tooltip>
  128. </template>
  129. </el-table-column>
  130. <el-table-column align="center"
  131. prop="mobileNo"
  132. label="手机号"></el-table-column>
  133. <el-table-column align="center"
  134. prop="wechatNo"
  135. label="微信"></el-table-column>
  136. <el-table-column align="center"
  137. label="学历信息">
  138. <template slot-scope="scope">
  139. <el-button @click="openEducation(scope.row)"
  140. type="text">查看学历</el-button>
  141. </template>
  142. </el-table-column>
  143. <el-table-column align="center"
  144. prop="subjectName"
  145. label="声部"
  146. width="200px">
  147. <template slot-scope="scope">
  148. <el-tooltip class="item"
  149. effect="dark"
  150. :content="scope.row.subjectName"
  151. placement="top">
  152. <span>{{ scope.row.subjectName}}</span>
  153. </el-tooltip>
  154. </template>
  155. </el-table-column>
  156. <el-table-column align="center"
  157. prop="liveCity"
  158. label="所在城市"></el-table-column>
  159. <el-table-column align="center"
  160. prop="intentionCity"
  161. label="工作意向"
  162. width="100px">
  163. <template slot-scope="scope">
  164. <el-tooltip class="item"
  165. effect="dark"
  166. :content="scope.row.intentionCity"
  167. placement="top">
  168. <span>{{ scope.row.intentionCity}}</span>
  169. </el-tooltip>
  170. </template>
  171. </el-table-column>
  172. <el-table-column align="center"
  173. prop="assessmentResult"
  174. label="评估结果"
  175. width="200px">
  176. <template slot-scope="scope">
  177. <el-tooltip class="item"
  178. effect="dark"
  179. :content="scope.row.assessmentResult"
  180. placement="top">
  181. <span>{{ scope.row.assessmentResult}}</span>
  182. </el-tooltip>
  183. </template>
  184. </el-table-column>
  185. <el-table-column align="center"
  186. prop="otherComment"
  187. label="其它综合情况"
  188. width="200px">
  189. <template slot-scope="scope">
  190. <el-tooltip class="item"
  191. effect="dark"
  192. :content="scope.row.otherComment"
  193. placement="top">
  194. <span>{{ scope.row.otherComment}}</span>
  195. </el-tooltip>
  196. </template>
  197. </el-table-column>
  198. <el-table-column align="center"
  199. prop="sourceFrom"
  200. label="信息来源"></el-table-column>
  201. <el-table-column align="center"
  202. prop="entryDate"
  203. label="入职时间"
  204. width="150px">
  205. <template slot-scope="scope">
  206. {{ scope.row.entryDate | dayjsFormat}}
  207. </template>
  208. </el-table-column>
  209. <el-table-column align="center"
  210. prop="position"
  211. label="职位">
  212. <template slot-scope="scope">
  213. {{ scope.row.position | jobType }}
  214. </template>
  215. </el-table-column>
  216. <el-table-column align="center"
  217. prop="organName"
  218. label="分部"></el-table-column>
  219. <el-table-column align="center"
  220. prop="isProbationPeriod"
  221. label="是否试用期">
  222. <template slot-scope="scope">
  223. {{ typeof scope.row.isProbationPeriod === 'boolean' ? scope.row.isProbationPeriod ? '是' : '否' : '' }}
  224. </template>
  225. </el-table-column>
  226. <el-table-column align="center"
  227. prop="status"
  228. label="人员状态">
  229. <template slot-scope="scope">
  230. {{ scope.row.status | hrStatus }}
  231. </template>
  232. </el-table-column>
  233. <el-table-column align="center"
  234. prop="idCard"
  235. label="证件号码"
  236. width="200px"></el-table-column>
  237. <el-table-column align="center"
  238. prop="age"
  239. label="年龄">
  240. <template slot-scope="scope">
  241. {{ scope.row.age > 0 ? scope.row.age : '' }}
  242. </template>
  243. </el-table-column>
  244. <el-table-column align="center"
  245. prop="gender"
  246. label="性别">
  247. <template slot-scope="scope">
  248. {{ typeof scope.row.gender === 'boolean' ? scope.row.gender ? '男' : '女' : '' }}
  249. </template>
  250. </el-table-column>
  251. <el-table-column align="center"
  252. prop="bankCardNo"
  253. label="银行卡号"
  254. width="200px"></el-table-column>
  255. <el-table-column align="center"
  256. prop="bankAddress"
  257. label="开户行"
  258. width="200px"></el-table-column>
  259. <el-table-column align="center"
  260. prop="emergencyContactName"
  261. label="紧急联系人"></el-table-column>
  262. <el-table-column align="center"
  263. prop="emergencyContactRelation"
  264. label="紧急联系人关系"></el-table-column>
  265. <el-table-column align="center"
  266. prop="emergencyContactPhone"
  267. label="紧急联系人电话"></el-table-column>
  268. <el-table-column align="center"
  269. prop="updateTime"
  270. label="最后一次操作时间时间"
  271. width="160px"></el-table-column>
  272. <el-table-column align="center"
  273. prop="operatorName"
  274. label="归属管理HR"></el-table-column>
  275. <el-table-column align="center"
  276. prop="resignationDate"
  277. label="离职时间"
  278. width="150px">
  279. <template slot-scope="scope">
  280. {{ scope.row.resignationDate | dayjsFormat}}
  281. </template>
  282. </el-table-column>
  283. <el-table-column align="center"
  284. label="操作"
  285. fixed="right">
  286. <template slot-scope="scope">
  287. <el-button v-permission="'employeeInfo/update'"
  288. @click="openTypes('update', scope.row)"
  289. type="text">修改</el-button>
  290. </template>
  291. </el-table-column>
  292. </el-table>
  293. <pagination :total.sync="pageInfo.total"
  294. :page.sync="pageInfo.page"
  295. :limit.sync="pageInfo.limit"
  296. :page-sizes="pageInfo.page_size"
  297. sync
  298. @pagination="getList" />
  299. </div>
  300. </div>
  301. <el-dialog :title="formTitle[formActionTitle]"
  302. :visible.sync="typeStatus"
  303. destroy-on-close
  304. :close-on-click-modal="false"
  305. @close="onFormClose('ruleForm')"
  306. width="1050px">
  307. <hrform :detail.sync="rowDetail"
  308. v-if="typeStatus"
  309. :organList="organList"
  310. :subjectList="subjectList"
  311. :close="onFormClose"
  312. :getList="getList" />
  313. </el-dialog>
  314. <el-dialog title="查看学历信息"
  315. :visible.sync="educationVisible"
  316. destroy-on-close
  317. :close-on-click-modal="false"
  318. @close="educationVisible = false"
  319. width="600px">
  320. <el-table :data="educationList"
  321. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  322. <el-table-column align="center"
  323. prop="level"
  324. label="学历"></el-table-column>
  325. <el-table-column align="center"
  326. prop="school"
  327. label="毕业学校"></el-table-column>
  328. <el-table-column align="center"
  329. prop="year"
  330. label="毕业时间">
  331. <template slot-scope="scope">
  332. {{ scope.row.year | dayjsFormat}}
  333. </template>
  334. </el-table-column>
  335. </el-table>
  336. </el-dialog>
  337. </div>
  338. </template>
  339. <script>
  340. import pagination from "@/components/Pagination/index";
  341. import saveform from '@/components/save-form'
  342. import dayjs from 'dayjs'
  343. import hrform from './form'
  344. // import store from '@/store'
  345. import {
  346. helpCenterCatalogList,
  347. employeeInfo,
  348. helpCenterContentModify,
  349. helpCenterContentDelete
  350. } from "@/api/appTenant";
  351. import { getEmployeeOrgan, getSubject } from '@/api/buildTeam'
  352. import { subjectListTree } from '@/api/specialSetting'
  353. export const getTimes = (times, keys = []) => {
  354. if (times && times.length) {
  355. return {
  356. [keys[0] || 'start']: dayjs(times[0]).format('YYYY-MM-DD'),
  357. [keys[1] || 'start']: dayjs(times[1]).format('YYYY-MM-DD'),
  358. }
  359. }
  360. return {}
  361. }
  362. const initSearch = {
  363. organId: '',
  364. jobNature: '',
  365. position: '',
  366. subjectId: '',
  367. userNameOrIdOrMobile: '',
  368. operator: '',
  369. dates: []
  370. }
  371. export default {
  372. components: { pagination, hrform, saveform },
  373. name: "helpCategory",
  374. data () {
  375. return {
  376. searchForm: {
  377. ...initSearch
  378. },
  379. educationVisible: false,
  380. treeList: [],
  381. tableList: [],
  382. educationList: [],
  383. formActionTitle: "create",
  384. formTitle: {
  385. create: "添加人员",
  386. update: "修改人员"
  387. },
  388. typeStatus: false, // 添加教学点
  389. formLabelWidth: "100px",
  390. form: {
  391. title: null, // 标题
  392. content: null, // 内容
  393. catalogId: null, // 分类编号
  394. },
  395. rules: {
  396. title: [{ required: true, message: "请输入标题", trigger: "blur" }],
  397. content: [{ required: true, message: "请输入内容", trigger: "blur" }],
  398. catalogId: [{ required: true, message: "请输入选择分类", trigger: "blur" }]
  399. // subjectIds: [{ required: true, message: "请选择声部组合", trigger: "change" }]
  400. },
  401. pageInfo: {
  402. // 分页规则
  403. limit: 10, // 限制显示条数
  404. page: 1, // 当前页
  405. total: 0, // 总条数
  406. page_size: [10, 20, 40, 50] // 选择限制显示条数
  407. },
  408. rowDetail: null,
  409. tempTreeList: [],
  410. organList: [],
  411. subjectList: [],
  412. };
  413. },
  414. activated () {
  415. this.getList();
  416. this.getSubjectList()
  417. //
  418. },
  419. mounted () {
  420. this.getList();
  421. this.getSubjectList()
  422. this.getTreeList()
  423. },
  424. computed: {
  425. subjectListObj () {
  426. const data = {}
  427. for (let i = 0; i < this.subjectList.length; i++) {
  428. const item = this.subjectList[i];
  429. data[item.id] = item.name
  430. }
  431. return data
  432. },
  433. organListObj () {
  434. const data = {}
  435. for (let i = 0; i < this.organList.length; i++) {
  436. const item = this.organList[i];
  437. data[item.id] = item.name
  438. }
  439. return data
  440. }
  441. },
  442. mounted () {
  443. this.getList();
  444. // this.getTreeList()
  445. getEmployeeOrgan().then(res => {
  446. if (res.code == 200) {
  447. this.organList = res.data;
  448. }
  449. })
  450. this.getSubjectList()
  451. },
  452. methods: {
  453. getSubjectList () {
  454. getSubject({
  455. delFlag: 0,
  456. tenantId: 1,
  457. }).then(res => {
  458. let result = res.data
  459. if (res.code == 200) {
  460. // let tempArray = []
  461. // result.rows.forEach((item, index) => {
  462. // let subject = []
  463. // item.subjects.forEach(s => {
  464. // subject.push({
  465. // value: s.id,
  466. // label: s.name
  467. // })
  468. // })
  469. // tempArray[index] = {
  470. // label: item.name,
  471. // options: subject
  472. // }
  473. // })
  474. this.subjectList = result
  475. }
  476. })
  477. },
  478. openEducation (row) {
  479. try {
  480. this.educationList = row.educationalBackground ? JSON.parse(row.educationalBackground) : []
  481. this.educationVisible = true
  482. } catch (error) {
  483. this.$message.error('数据解析失败')
  484. }
  485. },
  486. onTypeDelOpeation (row) {
  487. this.$confirm('您是否删除该内容?', '提示', {
  488. confirmButtonText: '确定',
  489. cancelButtonText: '取消',
  490. type: 'warning'
  491. }).then(() => {
  492. helpCenterContentDelete({ id: row.id }).then(res => {
  493. this.messageTips('删除', res)
  494. })
  495. }).catch(() => {
  496. })
  497. },
  498. search () {
  499. this.$refs.searchForm.validate(valid => {
  500. this.pageInfo = {
  501. ...this.pageInfo,
  502. page: 1
  503. }
  504. this.getList()
  505. })
  506. },
  507. onReSet () {
  508. this.pageInfo = {
  509. ...this.pageInfo,
  510. page: 1
  511. }
  512. this.$refs.searchForm.resetFields()
  513. this.getList()
  514. },
  515. onTypeSubmit (formName) {
  516. // 添加数据
  517. this.$refs[formName].validate(valid => {
  518. if (valid) {
  519. if (this.formActionTitle == "create") {
  520. let params = {
  521. title: this.form.title, // 标题
  522. content: this.form.content, // 内容
  523. catalogId: this.form.catalogId[this.form.catalogId.length - 1], // 分类编号
  524. }
  525. helpCenterContentModify(params).then(res => {
  526. this.messageTips("添加", res);
  527. });
  528. } else if (this.formActionTitle == "update") {
  529. let params = {
  530. id: this.form.id,
  531. title: this.form.title, // 标题
  532. content: this.form.content, // 内容
  533. catalogId: this.form.catalogId[this.form.catalogId.length - 1], // 分类编号
  534. }
  535. helpCenterContentModify(params).then(res => {
  536. this.messageTips("修改", res);
  537. });
  538. }
  539. } else {
  540. return false;
  541. }
  542. });
  543. },
  544. messageTips (title, res) {
  545. if (res.code == 200) {
  546. this.$message.success(title + "成功");
  547. this.typeStatus = false;
  548. this.getList();
  549. } else {
  550. this.$message.error(res.msg);
  551. }
  552. },
  553. getList () {
  554. const {dates, ...rest} = this.searchForm
  555. console.log(dates)
  556. let params = {
  557. ...rest,
  558. ...getTimes(dates, ["startDate", "endDate"]),
  559. page: this.pageInfo.page,
  560. rows: this.pageInfo.limit
  561. }
  562. employeeInfo(params).then(res => {
  563. let result = res.data;
  564. if (res.code == 200) {
  565. this.tableList = result.rows;
  566. this.pageInfo.total = result.total
  567. }
  568. });
  569. },
  570. getTreeList () {
  571. helpCenterCatalogList({
  572. parentId: 0
  573. }).then(res => {
  574. let result = res.data;
  575. if (res.code == 200) {
  576. this.treeList = this.setTableData(result);
  577. }
  578. });
  579. },
  580. setTableData (result) {
  581. let list = []
  582. list = result.map(res => {
  583. let tempList = {}
  584. tempList = {
  585. value: res.id,
  586. label: res.text,
  587. parentId: res.parentId
  588. }
  589. if (res.children && res.children.length > 0) {
  590. tempList.children = this.setTableData(res.children)
  591. }
  592. return tempList
  593. })
  594. return list
  595. },
  596. openTypes (type, row) {
  597. this.rowDetail = { ...row }
  598. this.typeStatus = true
  599. this.formActionTitle = type
  600. if (type == "update") {
  601. // 修改的时候赋值
  602. this.form = {
  603. id: row.id,
  604. title: row.title, // 标题
  605. content: row.content, // 内容
  606. catalogId: this.getAllIds(row), // 分类编号
  607. };
  608. }
  609. },
  610. onToUrl () {
  611. this.$router.push('/insideSetting/helpCategory')
  612. },
  613. getAllIds (row) {
  614. let idAndParent = [];// idAndParent保存 Tree所有节点的id和parentId
  615. this.getIdAndParent(this.treeList, idAndParent);
  616. let parentIds = []; // 用于保存选中节点的父节点及父节点的父节点
  617. this.getId(row.catalogId, parentIds, idAndParent);
  618. return parentIds.reverse(); //反转数组
  619. },
  620. getIdAndParent (tree, idAndParentIds) {// idAndParentIds用来保存所有节点的id,parentId
  621. // 对原有的数据结构进行遍历,拿出所有节点的id,parentId到一个一维数组中。
  622. tree.forEach(item => {
  623. let mid = {
  624. id: item.value,
  625. parentId: item.parentId,
  626. };
  627. idAndParentIds.push(mid);
  628. if (item.children) {
  629. this.getIdAndParent(item.children, idAndParentIds);
  630. }
  631. });
  632. },
  633. getId (id, parentIds, idAndParent) {
  634. idAndParent.forEach(item => {
  635. if (item.id == id) {
  636. parentIds.push(id);
  637. if (item.parentId != -1) {
  638. this.getId(item.parentId, parentIds, idAndParent);
  639. }
  640. }
  641. });
  642. },
  643. onFormClose (formName) {
  644. this.rowDetail = null
  645. this.typeStatus = false
  646. // 关闭弹窗重置验证
  647. this.form = {
  648. title: null, // 标题
  649. content: null, // 内容
  650. catalogId: [], // 分类编号
  651. }
  652. // this.$refs.cascader.handleClear()
  653. // this.$refs[formName].resetFields();
  654. }
  655. }
  656. };
  657. </script>
  658. <style lang="scss" scoped>
  659. .el-button--primary {
  660. background: #14928a;
  661. border-color: #14928a;
  662. color: #fff;
  663. &:hover,
  664. &:active,
  665. &:focus {
  666. background: #14928a;
  667. border-color: #14928a;
  668. color: #fff;
  669. }
  670. }
  671. /deep/.el-date-editor.el-input {
  672. width: 100% !important;
  673. }
  674. /deep/.el-select {
  675. width: 100% !important;
  676. }
  677. /deep/.el-table .cell {
  678. display: -webkit-box;
  679. overflow: hidden;
  680. max-height: 45px;
  681. text-overflow: ellipsis;
  682. -webkit-line-clamp: 3;
  683. -webkit-box-orient: vertical;
  684. }
  685. /deep/.el-dialog__body {
  686. padding: 10px 20px;
  687. }
  688. .newBand {
  689. display: inline-block;
  690. }
  691. </style>