index.vue 24 KB

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