index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  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="'employeeInfo/insert'" @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="'employeeInfo/update'" @click="openTypes('update', scope.row)" type="text">修改</el-button>
  148. </template>
  149. </el-table-column>
  150. </el-table>
  151. <pagination
  152. :total="pageInfo.total"
  153. :page.sync="pageInfo.page"
  154. :limit.sync="pageInfo.limit"
  155. :page-sizes="pageInfo.page_size"
  156. @pagination="getList"
  157. />
  158. </div>
  159. </div>
  160. <el-dialog
  161. :title="formTitle[formActionTitle]"
  162. :visible.sync="typeStatus"
  163. destroy-on-close
  164. :close-on-click-modal="false"
  165. @close="onFormClose('ruleForm')"
  166. width="1050px"
  167. >
  168. <hrform :detail.sync="rowDetail" :organList="organList" :subjectList="subjectList" :close="onFormClose" />
  169. </el-dialog>
  170. <el-dialog
  171. title="查看学历信息"
  172. :visible.sync="educationVisible"
  173. destroy-on-close
  174. :close-on-click-modal="false"
  175. @close="educationVisible = false"
  176. width="600px"
  177. >
  178. <el-table :data="educationList"
  179. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  180. <el-table-column align="center" prop="level" label="学历"></el-table-column>
  181. <el-table-column align="center" prop="school" label="毕业学校"></el-table-column>
  182. <el-table-column align="center" prop="year" label="毕业时间">
  183. <template slot-scope="scope">
  184. {{ scope.row.year | dayjsFormat}}
  185. </template>
  186. </el-table-column>
  187. </el-table>
  188. </el-dialog>
  189. </div>
  190. </template>
  191. <script>
  192. import pagination from "@/components/Pagination/index";
  193. import dayjs from 'dayjs'
  194. import hrform from './form'
  195. // import store from '@/store'
  196. import {
  197. helpCenterCatalogList,
  198. employeeInfo,
  199. helpCenterContentModify,
  200. helpCenterContentDelete
  201. } from "@/api/appTenant";
  202. import { getEmployeeOrgan } from '@/api/buildTeam'
  203. import { subjectListTree } from '@/api/specialSetting'
  204. export default {
  205. components: { pagination, hrform },
  206. name: "helpCategory",
  207. data() {
  208. return {
  209. searchForm: {
  210. organId: '',
  211. jobNature: '',
  212. position: '',
  213. subjectId: '',
  214. userNameOrIdOrMobile: '',
  215. },
  216. educationVisible: false,
  217. treeList: [],
  218. tableList: [],
  219. educationList: [],
  220. formActionTitle: "create",
  221. formTitle: {
  222. create: "添加人员",
  223. update: "修改人员"
  224. },
  225. typeStatus: false, // 添加教学点
  226. formLabelWidth: "100px",
  227. form: {
  228. title: null, // 标题
  229. content: null, // 内容
  230. catalogId: null, // 分类编号
  231. },
  232. rules: {
  233. title: [{ required: true, message: "请输入标题", trigger: "blur" }],
  234. content: [{ required: true, message: "请输入内容", trigger: "blur" }],
  235. catalogId: [{ required: true, message: "请输入选择分类", trigger: "blur" }]
  236. // subjectIds: [{ required: true, message: "请选择声部组合", trigger: "change" }]
  237. },
  238. pageInfo: {
  239. // 分页规则
  240. limit: 10, // 限制显示条数
  241. page: 1, // 当前页
  242. total: 0, // 总条数
  243. page_size: [10, 20, 40, 50] // 选择限制显示条数
  244. },
  245. rowDetail: null,
  246. tempTreeList: [],
  247. organList: [],
  248. subjectList: [],
  249. };
  250. },
  251. activated() {
  252. this.getList();
  253. // this.getTreeList()
  254. },
  255. computed: {
  256. subjectListObj() {
  257. const data = {}
  258. for (let i = 0; i < this.subjectList.length; i++) {
  259. const item = this.subjectList[i];
  260. for (let j = 0; j < item.options.length; j++) {
  261. const option = item.options[j];
  262. data[option.value] = option.label
  263. }
  264. }
  265. return data
  266. },
  267. organListObj() {
  268. const data = {}
  269. for (let i = 0; i < this.organList.length; i++) {
  270. const item = this.organList[i];
  271. data[item.id] = item.name
  272. }
  273. return data
  274. }
  275. },
  276. mounted() {
  277. this.getList();
  278. this.getTreeList()
  279. getEmployeeOrgan().then(res => {
  280. if (res.code == 200) {
  281. this.organList = res.data;
  282. }
  283. })
  284. subjectListTree({
  285. delFlag: 0,
  286. rows: 9999
  287. }).then(res => {
  288. let result = res.data
  289. if (res.code == 200) {
  290. let tempArray = []
  291. result.rows.forEach((item, index) => {
  292. let subject = []
  293. item.subjects.forEach(s => {
  294. subject.push({
  295. value: s.id,
  296. label: s.name
  297. })
  298. })
  299. tempArray[index] = {
  300. label: item.name,
  301. options: subject
  302. }
  303. })
  304. this.subjectList = tempArray
  305. }
  306. })
  307. },
  308. methods: {
  309. openEducation(row) {
  310. try {
  311. this.educationList = JSON.parse(row.educationalBackground)
  312. this.educationVisible = true
  313. } catch (error) {
  314. this.$message.error('数据解析失败')
  315. }
  316. },
  317. onTypeDelOpeation(row) {
  318. this.$confirm('您是否删除该内容?', '提示', {
  319. confirmButtonText: '确定',
  320. cancelButtonText: '取消',
  321. type: 'warning'
  322. }).then(() => {
  323. helpCenterContentDelete({ id: row.id }).then(res => {
  324. this.messageTips('删除', res)
  325. })
  326. }).catch(() => {
  327. })
  328. },
  329. onTypeSubmit(formName) {
  330. // 添加数据
  331. this.$refs[formName].validate(valid => {
  332. if (valid) {
  333. if (this.formActionTitle == "create") {
  334. let params = {
  335. title: this.form.title, // 标题
  336. content: this.form.content, // 内容
  337. catalogId: this.form.catalogId[this.form.catalogId.length - 1], // 分类编号
  338. }
  339. helpCenterContentModify(params).then(res => {
  340. this.messageTips("添加", res);
  341. });
  342. } else if (this.formActionTitle == "update") {
  343. let params = {
  344. id: this.form.id,
  345. title: this.form.title, // 标题
  346. content: this.form.content, // 内容
  347. catalogId: this.form.catalogId[this.form.catalogId.length - 1], // 分类编号
  348. }
  349. helpCenterContentModify(params).then(res => {
  350. this.messageTips("修改", res);
  351. });
  352. }
  353. } else {
  354. return false;
  355. }
  356. });
  357. },
  358. messageTips(title, res) {
  359. if (res.code == 200) {
  360. this.$message.success(title + "成功");
  361. this.typeStatus = false;
  362. this.getList();
  363. } else {
  364. this.$message.error(res.msg);
  365. }
  366. },
  367. getList() {
  368. let params = {
  369. ...this.searchForm,
  370. page: this.pageInfo.page,
  371. rows: this.pageInfo.limit
  372. }
  373. employeeInfo(params).then(res => {
  374. let result = res.data;
  375. if (res.code == 200) {
  376. this.tableList = result.rows;
  377. this.pageInfo.total = result.total
  378. }
  379. });
  380. },
  381. getTreeList() {
  382. helpCenterCatalogList({
  383. parentId: 0
  384. }).then(res => {
  385. let result = res.data;
  386. if (res.code == 200) {
  387. this.treeList = this.setTableData(result);
  388. }
  389. });
  390. },
  391. setTableData (result) {
  392. let list = []
  393. list = result.map(res => {
  394. let tempList = {}
  395. tempList = {
  396. value: res.id,
  397. label: res.text,
  398. parentId: res.parentId
  399. }
  400. if (res.children && res.children.length > 0) {
  401. tempList.children = this.setTableData(res.children)
  402. }
  403. return tempList
  404. })
  405. return list
  406. },
  407. openTypes(type, row) {
  408. this.rowDetail = {...row}
  409. this.typeStatus = true
  410. this.formActionTitle = type
  411. if (type == "update") {
  412. // 修改的时候赋值
  413. this.form = {
  414. id: row.id,
  415. title: row.title, // 标题
  416. content: row.content, // 内容
  417. catalogId: this.getAllIds(row), // 分类编号
  418. };
  419. }
  420. },
  421. onToUrl() {
  422. this.$router.push('/insideSetting/helpCategory')
  423. },
  424. getAllIds(row) {
  425. let idAndParent=[];// idAndParent保存 Tree所有节点的id和parentId
  426. this.getIdAndParent(this.treeList,idAndParent);
  427. let parentIds = []; // 用于保存选中节点的父节点及父节点的父节点
  428. this.getId(row.catalogId, parentIds, idAndParent);
  429. return parentIds.reverse(); //反转数组
  430. },
  431. getIdAndParent(tree, idAndParentIds) {// idAndParentIds用来保存所有节点的id,parentId
  432. // 对原有的数据结构进行遍历,拿出所有节点的id,parentId到一个一维数组中。
  433. tree.forEach(item => {
  434. let mid = {
  435. id: item.value,
  436. parentId: item.parentId,
  437. };
  438. idAndParentIds.push(mid);
  439. if (item.children) {
  440. this.getIdAndParent(item.children, idAndParentIds);
  441. }
  442. });
  443. },
  444. getId(id, parentIds, idAndParent) {
  445. idAndParent.forEach(item => {
  446. if (item.id == id) {
  447. parentIds.push(id);
  448. if (item.parentId != -1) {
  449. this.getId(item.parentId, parentIds, idAndParent);
  450. }
  451. }
  452. });
  453. },
  454. onFormClose(formName) {
  455. this.rowDetail = null
  456. this.typeStatus = false
  457. // 关闭弹窗重置验证
  458. this.form = {
  459. title: null, // 标题
  460. content: null, // 内容
  461. catalogId: [], // 分类编号
  462. }
  463. // this.$refs.cascader.handleClear()
  464. // this.$refs[formName].resetFields();
  465. }
  466. }
  467. };
  468. </script>
  469. <style lang="scss" scoped>
  470. .el-button--primary {
  471. background: #14928a;
  472. border-color: #14928a;
  473. color: #fff;
  474. &:hover,
  475. &:active,
  476. &:focus {
  477. background: #14928a;
  478. border-color: #14928a;
  479. color: #fff;
  480. }
  481. }
  482. /deep/.el-date-editor.el-input {
  483. width: 100% !important;
  484. }
  485. /deep/.el-select {
  486. width: 100% !important;
  487. }
  488. /deep/.el-table .cell {
  489. display: -webkit-box;
  490. overflow: hidden;
  491. text-overflow: ellipsis;
  492. -webkit-line-clamp: 3;
  493. -webkit-box-orient: vertical;
  494. }
  495. /deep/.el-dialog__body {
  496. padding: 10px 20px;
  497. }
  498. .newBand {
  499. display: inline-block;
  500. }
  501. </style>