manager.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818
  1. <template>
  2. <div>
  3. <div>
  4. <save-form
  5. :inline="true"
  6. class="searchForm"
  7. ref="searchForm"
  8. @submit="search"
  9. @reset="reset"
  10. :model="searchForm"
  11. >
  12. <el-form-item prop="search">
  13. <el-input
  14. type="text"
  15. clearable
  16. v-model.trim="searchForm.search"
  17. @keyup.enter.native="
  18. e => {
  19. e.target.blur();
  20. $refs.searchForm.save();
  21. search();
  22. }
  23. "
  24. placeholder="姓名/编号/手机号"
  25. ></el-input>
  26. </el-form-item>
  27. <el-form-item prop="jobNature">
  28. <el-select
  29. v-model.trim="searchForm.jobNature"
  30. clearable
  31. filterable
  32. placeholder="请选择工作类型"
  33. >
  34. <el-option label="全职" value="FULL_TIME"></el-option>
  35. <el-option label="兼职" value="PART_TIME"></el-option>
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item prop="deptId">
  39. <el-cascader
  40. v-model="searchForm.deptId"
  41. placeholder="请选择社保分部"
  42. clearable
  43. style="width: 100%"
  44. :options="deptList"
  45. :show-all-levels="false"
  46. :collapse-tags="true"
  47. :props="{ checkStrictly: false }"
  48. ></el-cascader>
  49. </el-form-item>
  50. <el-form-item prop="deptIds">
  51. <el-cascader
  52. v-model="searchForm.deptIds"
  53. placeholder="请选择所属部门"
  54. clearable
  55. style="width: 100%"
  56. :options="deptList"
  57. :show-all-levels="false"
  58. :collapse-tags="true"
  59. @change="onDeptChange"
  60. :props="{ multiple: true, checkStrictly: false }"
  61. ></el-cascader>
  62. </el-form-item>
  63. <el-form-item>
  64. <el-button native-type="submit" type="danger">搜索</el-button>
  65. <el-button native-type="reset" type="primary">重置</el-button>
  66. </el-form-item>
  67. </save-form>
  68. <!-- <el-button
  69. type="primary"
  70. style="margin-bottom: 20px"
  71. @click="roleOperation('create')"
  72. v-permission="'employee/add'"
  73. >添加</el-button
  74. > -->
  75. <!-- 列表 -->
  76. <div class="tableWrap">
  77. <el-table
  78. :data="tableList"
  79. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  80. >
  81. <el-table-column align="center" prop="id" label="员工编号">
  82. <template slot-scope="scope">
  83. <copy-text>{{ scope.row.id }}</copy-text>
  84. </template>
  85. </el-table-column>
  86. <el-table-column align="center" prop="realName" label="姓名">
  87. <template slot-scope="scope">
  88. <copy-text>{{ scope.row.realName }}</copy-text>
  89. </template>
  90. </el-table-column>
  91. <el-table-column align="center" prop="phone" label="手机号">
  92. <template slot-scope="scope">
  93. <copy-text>{{ scope.row.phone }}</copy-text>
  94. </template>
  95. </el-table-column>
  96. <!-- <el-table-column align="center" prop="deptName" label="社保分部">
  97. </el-table-column>
  98. <el-table-column align="center" prop="deptsName" label="所属部门">
  99. </el-table-column> -->
  100. <!-- <el-table-column align="center" label="角色分类">
  101. <template slot-scope="scope">
  102. <tooltip
  103. :content="scope.row.roleNames | joinArray(',')"
  104. ></tooltip>
  105. </template>
  106. </el-table-column> -->
  107. <!-- <el-table-column align="center" prop="jobNature" label="工作类型">
  108. <template slot-scope="scope">
  109. {{ scope.row.jobNature | jobNature }}
  110. </template>
  111. </el-table-column> -->
  112. <!-- <el-table-column align="center" label="所属分部">
  113. <template slot-scope="scope">
  114. <tooltip
  115. :content="scope.row.organNameList | joinArray(',')"
  116. ></tooltip>
  117. </template>
  118. </el-table-column> -->
  119. <!-- <el-table-column
  120. align="center"
  121. label="状态"
  122. :formatter="formatLockFlag"
  123. >
  124. </el-table-column> -->
  125. <!-- <el-table-column align="center" label="入职时间">
  126. <template slot-scope="scope">
  127. {{ scope.row.entryDate | formatTimer }}
  128. </template>
  129. </el-table-column>
  130. <el-table-column align="center" label="离职时间">
  131. <template slot-scope="scope">
  132. {{ scope.row.demissionDate | formatTimer }}
  133. </template>
  134. </el-table-column> -->
  135. <el-table-column
  136. align="center"
  137. width="250px"
  138. fixed="right"
  139. label="操作"
  140. >
  141. <template slot-scope="scope">
  142. <el-button
  143. @click="roleOperation('update', scope.row)"
  144. v-if="permission('employee/update')"
  145. type="text"
  146. >修改</el-button
  147. >
  148. </template>
  149. </el-table-column>
  150. </el-table>
  151. <pagination
  152. sync
  153. :total.sync="pageInfo.total"
  154. :page.sync="pageInfo.page"
  155. :limit.sync="pageInfo.limit"
  156. :page-sizes="pageInfo.page_size"
  157. @pagination="getList"
  158. />
  159. </div>
  160. </div>
  161. <el-dialog
  162. :title="formTitle[formActionTitle]"
  163. :visible.sync="roleStatus"
  164. @close="onFormClose('ruleForm')"
  165. width="650px"
  166. >
  167. <el-form :model="form" :rules="rules" ref="ruleForm">
  168. <el-alert
  169. style="margin: 10px 0"
  170. title="OA信息"
  171. :closable="false"
  172. type="info"
  173. >
  174. </el-alert>
  175. <el-row>
  176. <el-col :span="12">
  177. <el-form-item
  178. label="所属部门"
  179. prop="deptIds"
  180. :label-width="formLabelWidth"
  181. >
  182. <el-cascader
  183. v-model="form.deptIds"
  184. placeholder="请选择所属部门"
  185. clearable
  186. style="width: 100%"
  187. :options="deptList"
  188. :show-all-levels="false"
  189. :collapse-tags="true"
  190. @change="onDeptChange"
  191. :props="{ multiple: true, checkStrictly: false }"
  192. ></el-cascader>
  193. </el-form-item>
  194. </el-col>
  195. <el-col :span="12">
  196. <el-form-item
  197. label="社保分部"
  198. prop="deptId"
  199. :label-width="formLabelWidth"
  200. >
  201. <el-cascader
  202. v-model="form.deptId"
  203. placeholder="请选择社保分部"
  204. clearable
  205. style="width: 100%"
  206. :options="deptSmallList"
  207. :show-all-levels="false"
  208. :collapse-tags="true"
  209. :props="{ checkStrictly: false }"
  210. ></el-cascader>
  211. </el-form-item>
  212. </el-col>
  213. </el-row>
  214. <div v-for="(postDeptIds, index) in form.postDeptIds" :key="index">
  215. <el-form-item
  216. :label="'岗位管理' + (index + 1)"
  217. :label-width="formLabelWidth"
  218. class="setWidth"
  219. :prop="'postDeptIds.' + index + '.postId'"
  220. >
  221. <el-select
  222. filterable
  223. clearable
  224. placeholder="所属岗位"
  225. style="width: 180px !important"
  226. v-model.trim="postDeptIds.postId"
  227. >
  228. <el-option
  229. v-for="item in postList"
  230. :key="item.value"
  231. :label="item.label"
  232. :value="item.value"
  233. ></el-option>
  234. </el-select>
  235. </el-form-item>
  236. <el-form-item
  237. class="setWidth"
  238. style="margin: 0 10px; width: 190px !important"
  239. :prop="'postDeptIds.' + index + '.deptIds'"
  240. >
  241. <el-cascader
  242. v-model="postDeptIds.deptIds"
  243. placeholder="管理部门"
  244. clearable
  245. :options="deptList"
  246. :show-all-levels="false"
  247. :collapse-tags="true"
  248. :props="{ multiple: true, checkStrictly: false }"
  249. ></el-cascader>
  250. </el-form-item>
  251. <el-button
  252. icon="el-icon-minus"
  253. circle
  254. v-if="form.postDeptIds.length > 1"
  255. @click.prevent="removePostDept(postDeptIds)"
  256. ></el-button>
  257. <el-button
  258. icon="el-icon-plus"
  259. @click.prevent="addPostDept"
  260. circle
  261. style="margin-left: 5px"
  262. ></el-button>
  263. </div>
  264. </el-form>
  265. <span slot="footer" class="dialog-footer">
  266. <el-button @click="roleStatus = false">取 消</el-button>
  267. <el-button @click="onRoleSubmit('ruleForm')" type="primary"
  268. >确 定</el-button
  269. >
  270. </span>
  271. </el-dialog>
  272. </div>
  273. </template>
  274. <script>
  275. import pagination from "@/components/Pagination/index";
  276. import { permission } from "@/utils/directivePage";
  277. import {
  278. queryEmployByOrganId,
  279. employeeOperate,
  280. getUserRole,
  281. employeeAdd,
  282. employeeUpdate,
  283. hasCourseGroupRelation,
  284. updateEducationTeacherId,
  285. queryEmployeeOrganByUser,
  286. getDepts,
  287. getPosts
  288. } from "@/api/systemManage";
  289. import deepClone from "@/helpers/deep-clone";
  290. // import Treeselect from '@riophae/vue-treeselect'
  291. // import '@riophae/vue-treeselect/dist/vue-treeselect.css'
  292. import Tooltip from "@/components/Tooltip/index";
  293. import { isvalidPhone } from "@/utils/validate";
  294. let validPhone = (rule, value, callback) => {
  295. if (!value) {
  296. callback(new Error("请输入电话号码"));
  297. } else if (!isvalidPhone(value)) {
  298. callback(new Error("请输入正确的11位手机号码"));
  299. } else {
  300. callback();
  301. }
  302. };
  303. export default {
  304. name: "staffManager",
  305. components: { pagination, Tooltip },
  306. data() {
  307. return {
  308. roleResetList: [],
  309. organList: [],
  310. tableList: [],
  311. educationList: [],
  312. deptList: [],
  313. deptSmallList: [],
  314. postList: [],
  315. educationForm: {
  316. targetUserId: ""
  317. },
  318. educationViseble: false,
  319. activeRow: null,
  320. pageInfo: {
  321. // 分页规则
  322. limit: 10, // 限制显示条数
  323. page: 1, // 当前页
  324. total: 0, // 总条数
  325. page_size: [10, 20, 40, 50] // 选择限制显示条数
  326. },
  327. detail: null,
  328. handoverVisible: false,
  329. roleStatus: false,
  330. formActionTitle: "create",
  331. roleList: [], // 角色列表,
  332. roleBaseList: [], // 登陆人角色
  333. formTitle: {
  334. create: "添加员工",
  335. update: "修改员工"
  336. },
  337. formLabelWidth: "100px",
  338. form: {
  339. realName: null,
  340. gender: null,
  341. phone: null,
  342. roleIds: [],
  343. deptId: null, // 社保分部
  344. organIdLists: [],
  345. postDeptIds: [
  346. {
  347. postId: null,
  348. deptIds: []
  349. }
  350. ],
  351. deptIds: [],
  352. // postIds: [],
  353. jobNature: null,
  354. entryDate: null,
  355. contactAddress: null,
  356. postalCode: null
  357. },
  358. rules: {
  359. realName: [{ required: true, message: "请输入姓名", trigger: "blur" }],
  360. gender: [{ required: true, message: "请选择性别", trigger: "change" }],
  361. phone: [
  362. {
  363. type: "number",
  364. required: true,
  365. validator: validPhone,
  366. trigger: "blur"
  367. },
  368. {
  369. pattern: /^1[3456789]\d{9}$/,
  370. message: "请输入正确的手机号",
  371. trigger: "blur"
  372. }
  373. ],
  374. roleIds: [
  375. {
  376. type: "array",
  377. required: true,
  378. message: "请选择分类",
  379. trigger: "change"
  380. }
  381. ],
  382. // deptId: [{ required: true, message: '请选择社保分部', trigger: 'change' }],
  383. organIdLists: [
  384. {
  385. type: "array",
  386. required: true,
  387. message: "请选择所属分部",
  388. trigger: "change"
  389. }
  390. ],
  391. // deptIds: [{ type: 'array', required: true, message: '请选择所属部门', trigger: 'change' }],
  392. // postIds: [{ type: 'array', required: true, message: '请选择所属岗位', trigger: 'change' }],
  393. jobNature: [
  394. { required: true, message: "请选择工作类型", trigger: "change" }
  395. ],
  396. entryDate: [
  397. { required: true, message: "请选择入职时间", trigger: "blur" }
  398. ]
  399. },
  400. searchForm: {
  401. search: null,
  402. jobNature: null,
  403. organId: null,
  404. roleId: null,
  405. deptId: null,
  406. deptIds: null
  407. }
  408. };
  409. },
  410. mounted() {
  411. this.getList();
  412. this.getRoleList();
  413. },
  414. methods: {
  415. permission,
  416. handover(row) {
  417. this.detail = row;
  418. this.handoverVisible = true;
  419. },
  420. onBranchCheckAll() {
  421. this.form.organIdLists = [];
  422. this.organList.forEach(item => {
  423. this.form.organIdLists.push(item.id);
  424. });
  425. },
  426. onRoleSubmit(formName) {
  427. this.$refs[formName].validate(valid => {
  428. if (valid) {
  429. const {
  430. organIdLists,
  431. postDeptIds,
  432. deptIds,
  433. deptId,
  434. ...res
  435. } = this.form;
  436. let tempPost = [];
  437. postDeptIds.forEach(post => {
  438. let tempIds = [];
  439. post.deptIds.forEach(item => {
  440. tempIds.push(item[item.length - 1]);
  441. });
  442. tempPost.push({
  443. postId: post.postId,
  444. deptIds: tempIds
  445. });
  446. });
  447. const tempDeptIds = [];
  448. deptIds.forEach(ds => {
  449. tempDeptIds.push(ds[ds.length - 1]);
  450. });
  451. const tempDeptId = deptId ? deptId[deptId.length - 1] : "";
  452. let tempForm = {
  453. postDeptIds: JSON.stringify(tempPost),
  454. organIdList: organIdLists.join(","),
  455. deptIds: tempDeptIds,
  456. deptId: tempDeptId,
  457. ...res
  458. };
  459. if (this.formActionTitle == "create") {
  460. if (this.form.id) {
  461. // 判断有没有Id,如果有则删除
  462. delete this.form.id;
  463. }
  464. employeeAdd(tempForm).then(res => {
  465. this.messageTips("添加", res);
  466. });
  467. } else if (this.formActionTitle == "update") {
  468. employeeUpdate(tempForm).then(res => {
  469. this.messageTips("修改", res);
  470. });
  471. }
  472. } else {
  473. return;
  474. }
  475. });
  476. },
  477. messageTips(title, res) {
  478. if (res.code == 200) {
  479. this.$message.success(title + "成功");
  480. this.roleStatus = false;
  481. this.getList();
  482. } else {
  483. this.$message.error(res.msg);
  484. }
  485. },
  486. search() {
  487. this.pageInfo.page = 1;
  488. this.getList();
  489. },
  490. reset() {
  491. this.$refs.searchForm.resetFields();
  492. this.search();
  493. },
  494. getList() {
  495. let searchForm = this.searchForm;
  496. let params = {
  497. search: searchForm.search ? searchForm.search : null,
  498. jobNature: searchForm.jobNature ? searchForm.jobNature : null,
  499. organId: searchForm.organId ? searchForm.organId : null,
  500. roleId: searchForm.roleId ? searchForm.roleId : null,
  501. rows: this.pageInfo.limit,
  502. page: this.pageInfo.page
  503. };
  504. queryEmployByOrganId(params).then(res => {
  505. if (res.code == 200 && res.data) {
  506. this.tableList = res.data.rows;
  507. this.pageInfo.total = res.data.total;
  508. }
  509. });
  510. },
  511. /** 转换菜单数据结构 */
  512. normalizer(node) {
  513. let temp = [];
  514. if (node.children && node.children.length > 0) {
  515. node.children.forEach(item => {
  516. let child = this.normalizer(item, status);
  517. let obj = {
  518. value: item.deptId,
  519. label: item.deptName
  520. };
  521. if (child && child.length > 0) {
  522. obj.children = child;
  523. }
  524. temp.push(obj);
  525. });
  526. }
  527. return temp;
  528. },
  529. async getRoleList() {
  530. // 获取角色
  531. getUserRole({ delFlag: 0, rows: 9999 }).then(res => {
  532. let result = res.data;
  533. if (res.code == 200 && result && result.rows.length > 0) {
  534. this.roleList = [];
  535. result.rows.forEach(item => {
  536. this.roleList.push({
  537. label: item.roleName,
  538. value: item.id,
  539. disabled: false
  540. });
  541. });
  542. }
  543. });
  544. // 获取可编辑角色
  545. // try {
  546. // const res = await userRole();
  547. // this.roleResetList = [];
  548. // res.data.forEach((item) => {
  549. // this.roleResetList.push({
  550. // label: item.roleName,
  551. // value: item.id,
  552. // disabled: false,
  553. // });
  554. // });
  555. // } catch (e) {
  556. // console.log(e);
  557. // }
  558. getDepts({ rows: 9999 }).then(res => {
  559. if (res.code == 200 && res.data && res.data.length > 0) {
  560. const depts = res.data || [];
  561. const formatArr = [];
  562. depts.forEach(dep => {
  563. formatArr.push({
  564. value: dep.deptId,
  565. label: dep.deptName,
  566. children: this.normalizer(dep)
  567. });
  568. });
  569. this.deptList = formatArr;
  570. }
  571. });
  572. // 岗位
  573. getPosts({ rows: 9999 }).then(res => {
  574. if (res.code == 200 && res.data && res.data.length > 0) {
  575. this.postList = [];
  576. res.data.forEach(item => {
  577. this.postList.push({
  578. label: item.postName,
  579. value: item.postId
  580. });
  581. });
  582. }
  583. });
  584. this.$store.dispatch("setBranchs");
  585. },
  586. onDeptChange(value) {
  587. this.form.deptId = null;
  588. this.deptSmallList = [];
  589. let selectList = value.flat(Infinity);
  590. selectList = [...new Set(selectList)];
  591. const depts = deepClone(this.deptList);
  592. const formatArr = [];
  593. depts.forEach(dep => {
  594. formatArr.push({
  595. value: dep.value,
  596. label: dep.label,
  597. disabled: !selectList.includes(dep.value),
  598. children: this.normalizer2(dep, selectList)
  599. });
  600. });
  601. this.deptSmallList = formatArr;
  602. },
  603. /** 转换菜单数据结构 */
  604. normalizer2(node, selectList) {
  605. let temp = [];
  606. if (node.children && node.children.length > 0) {
  607. node.children.forEach(item => {
  608. let child = this.normalizer2(item, selectList);
  609. let obj = {
  610. value: item.value,
  611. label: item.label,
  612. disabled: !selectList.includes(item.value)
  613. };
  614. if (child && child.length > 0) {
  615. obj.children = child;
  616. }
  617. temp.push(obj);
  618. });
  619. }
  620. return temp;
  621. },
  622. async roleOperation(type, data) {
  623. // 获取分部
  624. // await queryEmployeeOrganByUser().then(res => {
  625. // if (res.code == 200) {
  626. // this.organList = res.data;
  627. // }
  628. // });
  629. this.formActionTitle = type;
  630. this.roleStatus = true;
  631. // 格式化 可选角色
  632. // 修改的时候
  633. if (type == "update") {
  634. let roleIdList = [...data.roleIds];
  635. // this.roleBaseList.forEach((item) => {
  636. // if (roleIdList.indexOf(item.value) == -1) {
  637. // roleIdList.push(item.value);
  638. // }
  639. // });
  640. // this.roleResetList = [...this.roleList];
  641. // this.roleList.forEach((role) => {
  642. // if (roleIdList.indexOf(role.value) != -1) {
  643. // this.roleResetList.push(role);
  644. // }
  645. // });
  646. // 初始化数据
  647. let postDeptArr = [];
  648. const postDept = data.postDeptIds ? JSON.parse(data.postDeptIds) : [];
  649. if (postDept.length > 0) {
  650. postDept.forEach(dept => {
  651. let deptIds = dept.deptIds || [];
  652. let deptArr = [];
  653. deptIds.forEach(ds => {
  654. deptArr.push(this.formatParentId(ds, this.deptList));
  655. });
  656. postDeptArr.push({
  657. postId: dept.postId,
  658. deptIds: deptArr
  659. });
  660. });
  661. } else {
  662. postDeptArr = [
  663. {
  664. postId: null,
  665. deptIds: []
  666. }
  667. ];
  668. }
  669. const deptIds = data.deptIds ? eval(data.deptIds) : [];
  670. const tempDeptIds = [];
  671. if (deptIds.length > 0) {
  672. deptIds.forEach(ds => {
  673. tempDeptIds.push(this.formatParentId(ds, this.deptList));
  674. });
  675. }
  676. this.onDeptChange(tempDeptIds);
  677. this.form = {
  678. id: data.id,
  679. realName: data.realName,
  680. gender: data.gender,
  681. phone: Number(data.phone),
  682. roleIds: data.roleIds,
  683. deptId: data.deptId
  684. ? this.formatParentId(data.deptId, this.deptList)
  685. : null,
  686. organIdLists: data.organIdList ? data.organIdList : [],
  687. jobNature: data.jobNature,
  688. entryDate: data.entryDate,
  689. contactAddress: data.contactAddress,
  690. postalCode: data.postalCode,
  691. postDeptIds: postDeptArr,
  692. deptIds: tempDeptIds
  693. };
  694. } else {
  695. this.roleResetList = [...this.roleBaseList];
  696. }
  697. },
  698. formatParentId(id, list, ids = []) {
  699. for (const item of list) {
  700. if (item.children) {
  701. const cIds = this.formatParentId(id, item.children, [
  702. ...ids,
  703. item.value
  704. ]);
  705. if (cIds.includes(id)) {
  706. return cIds;
  707. }
  708. }
  709. if (item.value === id) {
  710. return [...ids, id];
  711. }
  712. }
  713. return ids;
  714. },
  715. onFormClose(formName) {
  716. // 关闭弹窗重置验证
  717. this.form = {
  718. realName: null,
  719. gender: null,
  720. phone: null,
  721. roleName: null,
  722. roleIds: [],
  723. deptId: null,
  724. organIdLists: [],
  725. jobNature: null,
  726. entryDate: null,
  727. contactAddress: null,
  728. postalCode: null,
  729. deptIds: [],
  730. postDeptIds: [
  731. {
  732. postId: null,
  733. deptIds: []
  734. }
  735. ]
  736. };
  737. this.$refs[formName].resetFields();
  738. },
  739. formatLockFlag(row) {
  740. let reuslt = ["正常", "冻结"];
  741. if (row.demissionDate) {
  742. return "离职";
  743. } else {
  744. return reuslt[row.lockFlag];
  745. }
  746. },
  747. submitEducation() {
  748. // 发请求 提交信息
  749. updateEducationTeacherId({
  750. currentUserId: this.activeRow.id,
  751. targetUserId: this.educationForm.targetUserId
  752. }).then(res => {
  753. if (res.code === 200) {
  754. const type = "DEMISSION";
  755. const data = this.activeRow;
  756. employeeOperate({
  757. employeeId: data.id,
  758. operate: type
  759. }).then(res => {
  760. if (res.code == 200) {
  761. this.$message.success("更改成功");
  762. this.roleStatus = false;
  763. this.educationViseble = false;
  764. this.getList();
  765. } else {
  766. this.$message.error(res.msg);
  767. }
  768. });
  769. }
  770. });
  771. },
  772. removePostDept(item) {
  773. const index = this.form.postDeptIds.indexOf(item);
  774. if (index !== -1) {
  775. this.form.postDeptIds.splice(index, 1);
  776. }
  777. },
  778. addPostDept() {
  779. this.form.postDeptIds.push({
  780. postId: null,
  781. deptIds: []
  782. });
  783. }
  784. },
  785. watch: {
  786. educationViseble(val) {
  787. if (!val) {
  788. this.educationForm.targetUserId = "";
  789. this.$refs["educationForm"].resetFields();
  790. }
  791. }
  792. }
  793. };
  794. </script>
  795. <style lang="scss" scoped>
  796. ::v-deep .el-dialog__body {
  797. // padding: 0 20px;
  798. }
  799. ::v-deep .el-select,
  800. ::v-deep .el-date-editor.el-input {
  801. width: 100% !important;
  802. }
  803. .setWidth {
  804. display: inline-block;
  805. }
  806. </style>