teacherList.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <div class="squrt"></div>
  5. 老师列表
  6. </h2>
  7. <div class="m-core">
  8. <div
  9. class="newBand"
  10. v-permission="'/teacherOperationAdd'"
  11. @click="onTeacher('create')"
  12. >
  13. 老师新增
  14. </div>
  15. <!-- 搜索标题 -->
  16. <save-form
  17. :inline="true"
  18. @submit="search"
  19. @reset="onReSet"
  20. class="searchForm"
  21. :model="searchForm"
  22. >
  23. <el-form-item>
  24. <el-input
  25. v-model.trim="searchForm.search"
  26. @keyup.enter.native="getList"
  27. placeholder="老师姓名或电话"
  28. ></el-input>
  29. </el-form-item>
  30. <el-form-item>
  31. <el-select
  32. v-model.trim="searchForm.lockFlag"
  33. clearable
  34. filterable
  35. placeholder="老师状态"
  36. >
  37. <el-option
  38. v-for="item in teacherStatus"
  39. :key="item.value"
  40. :label="item.label"
  41. :value="item.value"
  42. ></el-option>
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item>
  46. <el-select style="width: 100% !important;"
  47. filterable
  48. clearable
  49. v-model.trim="searchForm.subjectId"
  50. placeholder="专业技能">
  51. <el-option v-for="(item, i) in selects.subjects"
  52. :key="i"
  53. :label="item.name"
  54. :value="item.id"></el-option>
  55. </el-select>
  56. <!-- <el-select
  57. v-model.trim="searchForm.subjectId"
  58. filterable
  59. clearable
  60. placeholder="专业技能"
  61. >
  62. <el-option-group
  63. v-for="group in subjectList"
  64. :key="group.label"
  65. :label="group.label"
  66. >
  67. <el-option
  68. v-for="item in group.options"
  69. :key="item.value"
  70. :label="item.label"
  71. :value="item.value"
  72. ></el-option>
  73. </el-option-group>
  74. </el-select> -->
  75. </el-form-item>
  76. <el-form-item>
  77. <el-select
  78. v-model.trim="searchForm.organId"
  79. filterable
  80. clearable
  81. placeholder="请选择分部"
  82. >
  83. <el-option
  84. v-for="item in selects.branchs"
  85. :key="item.id"
  86. :label="item.name"
  87. :value="item.id"> </el-option>
  88. ></el-option>
  89. </el-select>
  90. </el-form-item>
  91. <el-form-item>
  92. <el-select
  93. v-model.trim="searchForm.jobNature"
  94. filterable
  95. clearable
  96. placeholder="工作类型"
  97. >
  98. <el-option
  99. v-for="item in jobNature"
  100. :key="item.value"
  101. :label="item.label"
  102. :value="item.value"
  103. ></el-option>
  104. </el-select>
  105. </el-form-item>
  106. <el-form-item>
  107. <el-select
  108. v-model.trim="searchForm.isProbationPeriod"
  109. clearable
  110. filterable
  111. placeholder="人事状态"
  112. >
  113. <el-option label="正式" value="0"></el-option>
  114. <el-option label="试用" value="1"></el-option>
  115. </el-select>
  116. </el-form-item>
  117. <!-- isSupportExtraPracticeLesson -->
  118. <el-form-item>
  119. <el-select
  120. v-model.trim="searchForm.isSupportExtraPracticeLesson"
  121. clearable
  122. filterable
  123. placeholder="开放陪练"
  124. >
  125. <el-option label="是" value="true"></el-option>
  126. <el-option label="否" value="false"></el-option>
  127. </el-select>
  128. </el-form-item>
  129. <el-form-item>
  130. <el-button native-type="submit" type="danger">搜索</el-button>
  131. <el-button native-type="reset" type="primary">重置</el-button>
  132. </el-form-item>
  133. </save-form>
  134. <!-- 列表 -->
  135. <div class="tableWrap">
  136. <el-table
  137. :data="tableList"
  138. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  139. >
  140. <el-table-column
  141. align="center"
  142. prop="id"
  143. label="老师编号"
  144. ></el-table-column>
  145. <el-table-column align="center" prop="realName" label="老师名称">
  146. <template slot-scope="scope">
  147. <div>
  148. <p>{{ scope.row.realName }}</p>
  149. <p v-if="scope.row.memo">{{ "(" + scope.row.memo + ")" }}</p>
  150. </div>
  151. </template>
  152. </el-table-column>
  153. <el-table-column
  154. align="center"
  155. prop="organName"
  156. label="所属分部"
  157. ></el-table-column>
  158. <el-table-column align="center" width="150px" label="老师状态">
  159. <template slot-scope="scope">{{
  160. scope.row.lockFlag | teacherStatus
  161. }}</template>
  162. </el-table-column>
  163. <el-table-column
  164. align="center"
  165. :show-overflow-tooltip="true"
  166. width="200px"
  167. label="专业技能"
  168. >
  169. <template slot-scope="scope">
  170. <span
  171. style="max-height: 68px; display: block"
  172. :title="scope.row.splitSubjectName"
  173. >{{ scope.row.splitSubjectName }}</span
  174. >
  175. </template>
  176. </el-table-column>
  177. <el-table-column
  178. align="center"
  179. prop="phone"
  180. width="150px"
  181. label="联系电话"
  182. ></el-table-column>
  183. <el-table-column align="center" label="工作类型">
  184. <template slot-scope="scope">{{
  185. scope.row.jobNature | jobNature
  186. }}</template>
  187. </el-table-column>
  188. <el-table-column align="center" label="人事状态">
  189. <template slot-scope="scope">
  190. {{ scope.row.isProbationPeriod == 0 ? "正式" : "试用" }}
  191. </template>
  192. </el-table-column>
  193. <el-table-column
  194. align="center"
  195. prop="vipNum"
  196. label="已开小课"
  197. ></el-table-column>
  198. <el-table-column align="center" width="130px" label="试听课安排">
  199. <template slot-scope="scope">{{
  200. scope.row.demoNum > 0 ? "是" : "否"
  201. }}</template>
  202. </el-table-column>
  203. <el-table-column align="center" width="120px" label="开放网管课">
  204. <template slot-scope="scope">{{
  205. scope.row.isSupportExtraPracticeLesson ? "是" : "否"
  206. }}</template>
  207. </el-table-column>
  208. <el-table-column align="center" label="运营指标">
  209. <template slot-scope="scope">
  210. <el-button type="text" @click="gotoOperating(scope.row)">{{
  211. scope.row.operatingIndex + "%"
  212. }}</el-button>
  213. </template>
  214. </el-table-column>
  215. <el-table-column align="center" label="服务指标">
  216. <template slot-scope="scope">
  217. <el-button type="text" @click="gotoAfterSchool(scope.row)">{{
  218. scope.row.serviceIndex + "%"
  219. }}</el-button>
  220. </template>
  221. </el-table-column>
  222. <el-table-column
  223. align="center"
  224. fixed="right"
  225. width="200"
  226. label="操作"
  227. >
  228. <template slot-scope="scope">
  229. <!-- let search = JSON.stringify(this.searchForm)
  230. let rules = JSON.stringify(this.pageInfo)-->
  231. <router-link
  232. v-permission="'/teacherDetail'"
  233. class="el-button--text"
  234. :to="{
  235. path: `/business/teacherDetail?teacherId=${scope.row.id}&teacherName=${scope.row.realName}`,
  236. }"
  237. >查看</router-link
  238. >
  239. <el-button
  240. v-permission="'/teacherIperationUpdate'"
  241. @click="onTeacher('update', scope.row)"
  242. type="text"
  243. >修改</el-button
  244. >
  245. <el-button
  246. v-permission="'employee/employeeOperate'"
  247. @click="onStaffOperation('LOCK_UNLOCK', scope.row)"
  248. type="text"
  249. >{{ scope.row.lockFlag == 1 ? "解冻" : "冻结" }}</el-button
  250. >
  251. <!-- -->
  252. <el-button
  253. v-permission="'api-auth/user/updatePassword2'"
  254. @click="resetPassWrod(scope.row)"
  255. type="text"
  256. >修改密码</el-button
  257. >
  258. </template>
  259. </el-table-column>
  260. </el-table>
  261. <pagination
  262. sync
  263. :total.sync="pageInfo.total"
  264. :page.sync="pageInfo.page"
  265. :limit.sync="pageInfo.limit"
  266. :page-sizes="pageInfo.page_size"
  267. @pagination="getList"
  268. />
  269. </div>
  270. </div>
  271. <el-dialog
  272. title="修改密码"
  273. :visible.sync="passwrodVisiable"
  274. :before-close="closePassWord"
  275. width="400px"
  276. >
  277. <el-form :model="passwrodForm" ref="passwrodForm" :inline="true">
  278. <el-form-item
  279. label="手机号"
  280. prop="phone"
  281. label-width="80px"
  282. :rules="[
  283. { required: true, message: '手机号不能为空', trigger: 'blur' },
  284. {
  285. pattern: /^1\d{10}$/,
  286. message: '请输入正确的手机号',
  287. trigger: 'blur',
  288. },
  289. ]"
  290. >
  291. <el-input
  292. v-model.trim="passwrodForm.phone"
  293. minlength="11"
  294. maxlength="11"
  295. ></el-input>
  296. </el-form-item>
  297. <el-form-item
  298. label="输入密码"
  299. prop="password"
  300. label-width="80px"
  301. :rules="[
  302. { required: true, message: '密码不能为空', trigger: 'blur' },
  303. {
  304. pattern: /^[\w]{6,20}$/,
  305. message: '密码为6-20位',
  306. trigger: 'blur',
  307. },
  308. ]"
  309. >
  310. <el-input v-model.trim="passwrodForm.password"></el-input>
  311. </el-form-item>
  312. <el-form-item
  313. label="再次输入"
  314. prop="password2"
  315. label-width="80px"
  316. :rules="[
  317. { required: true, message: '密码不能为空', trigger: 'blur' },
  318. {
  319. pattern: /^[\w]{6,20}$/,
  320. message: '密码为6-20位',
  321. trigger: 'blur',
  322. },
  323. ]"
  324. >
  325. <el-input v-model.trim="passwrodForm.password2"></el-input>
  326. </el-form-item>
  327. </el-form>
  328. <span slot="footer" class="dialog-footer">
  329. <el-button @click="passwrodVisiable = false">取 消</el-button>
  330. <el-button type="primary" @click="submitResetPassWord">确 定</el-button>
  331. </span>
  332. </el-dialog>
  333. </div>
  334. </template>
  335. <script>
  336. import pagination from "@/components/Pagination/index";
  337. import { teacherQueryPage } from "@/api/teacherManager";
  338. import { employeeOperate } from "@/api/systemManage";
  339. // import { subjectListTree } from "@/api/specialSetting";
  340. import { resetPassword2 } from "@/api/buildTeam";
  341. import { jobNature, teacherStatus } from "@/utils/searchArray";
  342. import store from "@/store";
  343. export default {
  344. name: "teacherList",
  345. components: {
  346. pagination,
  347. },
  348. data() {
  349. return {
  350. searchForm: {
  351. lockFlag: null,
  352. isProbationPeriod: null,
  353. jobNature: null,
  354. subjectId: null,
  355. organId: null,
  356. search: null, // 老师姓名或电话
  357. isSupportExtraPracticeLesson: null,
  358. },
  359. jobNature: jobNature, // 工作类型
  360. teacherStatus: teacherStatus, // 老师状态
  361. subjectList: [], // 声部列表
  362. branchList: [], // 分部列表
  363. tableList: [],
  364. // organId: store.getters.organ,
  365. pageInfo: {
  366. // 分页规则
  367. limit: 10, // 限制显示条数
  368. page: 1, // 当前页
  369. total: 1, // 总条数
  370. page_size: [10, 20, 40, 50], // 选择限制显示条数
  371. },
  372. passwrodVisiable: false,
  373. passwrodForm: {
  374. phone: "",
  375. password: "",
  376. password2: "",
  377. },
  378. activatedRow: null,
  379. };
  380. },
  381. // activated() {
  382. // this.__init();
  383. // this.getList();
  384. // },
  385. mounted() {
  386. this.__init();
  387. this.getList();
  388. },
  389. methods: {
  390. search() {
  391. this.pageInfo.page = 1;
  392. this.getList();
  393. },
  394. async __init() {
  395. // 获取分部
  396. await this.$store.dispatch('setBranchs')
  397. await this.$store.dispatch('setSubjects')
  398. // getEmployeeOrgan().then((res) => {
  399. // if (res.code == 200) {
  400. // this.branchList = [];
  401. // res.data.forEach((item) => {
  402. // this.branchList.push({
  403. // label: item.name,
  404. // value: item.id,
  405. // });
  406. // });
  407. // }
  408. // });
  409. // subjectListTree({
  410. // delFlag: "NO",
  411. // rows: 9999,
  412. // }).then((res) => {
  413. // let result = res.data;
  414. // if (res.code == 200) {
  415. // let tempArray = [];
  416. // result.rows.forEach((item, index) => {
  417. // let subject = [];
  418. // item.subjects.forEach((s) => {
  419. // subject.push({
  420. // value: s.id,
  421. // label: s.name,
  422. // });
  423. // });
  424. // tempArray[index] = {
  425. // label: item.name,
  426. // options: subject,
  427. // };
  428. // });
  429. // this.subjectList = tempArray;
  430. // }
  431. // });
  432. // this.getList();
  433. },
  434. onTeacher(type, row) {
  435. let params = {
  436. type: type,
  437. };
  438. if (row) {
  439. params.teacherId = row.id;
  440. }
  441. let path = "/business/teacherOperation";
  442. if (type == "update") {
  443. path = "/business/teacherOperationUpdate";
  444. }
  445. this.$router.push({
  446. path: path,
  447. query: params,
  448. });
  449. },
  450. getList() {
  451. let params = this.searchForm;
  452. // params.organId = this.organId
  453. // searchForm: {
  454. // lockFlag: null,
  455. // isProbationPeriod: null,
  456. // jobNature: null,
  457. // subjectId: null,
  458. // organId: null,
  459. // search: null, // 老师姓名或电话
  460. // isSupportExtraPracticeLesson:null
  461. // },
  462. params.lockFlag ? params.lockFlag : (params.lockFlag = null);
  463. params.isProbationPeriod
  464. ? params.isProbationPeriod
  465. : (params.isProbationPeriod = null);
  466. params.jobNature ? params.jobNature : (params.jobNature = null);
  467. // params.subjectId?params.subjectId:params.subjectId = null
  468. params.subjectId ? params.subjectId : (params.subjectId = null);
  469. params.search ? params.search : (params.search = null);
  470. params.isSupportExtraPracticeLesson
  471. ? params.isSupportExtraPracticeLesson
  472. : (params.isSupportExtraPracticeLesson = null);
  473. params.rows = this.pageInfo.limit;
  474. params.page = this.pageInfo.page;
  475. teacherQueryPage(params).then((res) => {
  476. if (res.code == 200) {
  477. // console.log(res)
  478. this.tableList = res.data.rows;
  479. this.pageInfo.total = res.data.total;
  480. }
  481. });
  482. },
  483. onStaffOperation(type, data) {
  484. let str = "";
  485. if (data.lockFlag != 1) {
  486. str = `是否冻结${data.realName}老师?`;
  487. } else {
  488. str = `是否解冻${data.realName}老师?`;
  489. }
  490. this.$confirm(str, "提示", {
  491. confirmButtonText: "确定",
  492. cancelButtonText: "取消",
  493. type: "warning",
  494. })
  495. .then(() => {
  496. employeeOperate({
  497. employeeId: data.id,
  498. operate: type,
  499. }).then((res) => {
  500. if (res.code == 200) {
  501. this.$message.success("更改成功");
  502. this.roleStatus = false;
  503. this.getList();
  504. } else {
  505. this.$message.error(res.msg);
  506. }
  507. });
  508. })
  509. .catch(() => {});
  510. },
  511. onReSet() {
  512. this.searchForm = {
  513. lockFlag: null,
  514. isProbationPeriod: null,
  515. jobNature: null,
  516. organId: null,
  517. subjectId: null,
  518. search: null,
  519. };
  520. },
  521. resetPassWrod(row) {
  522. this.activatedRow = row;
  523. this.passwrodForm.phone = row.phone;
  524. this.passwrodVisiable = true;
  525. },
  526. closePassWord() {
  527. this.activatedRow = null;
  528. this.passwrodForm = {
  529. phone: "",
  530. password: "",
  531. password2: "",
  532. };
  533. this.$refs["passwrodForm"].resetFields();
  534. this.passwrodVisiable = false;
  535. },
  536. submitResetPassWord() {
  537. if (this.passwrodForm.password !== this.passwrodForm.password2) {
  538. this.$message.error("两次密码必须相同");
  539. return;
  540. }
  541. this.$refs["passwrodForm"].validate((res) => {
  542. if (res) {
  543. // 发请求
  544. resetPassword2({
  545. mobile: this.passwrodForm.phone,
  546. newPassword: this.passwrodForm.password,
  547. userId: this.activatedRow.id,
  548. }).then((res) => {
  549. if (res.code == 200) {
  550. // 修改成功
  551. this.$message.success("修改成功");
  552. this.closePassWord();
  553. }
  554. });
  555. }
  556. });
  557. },
  558. gotoAfterSchool(row) {
  559. // 需要的参数 id
  560. this.$router.push({
  561. path: "/operateManager/serverIndexList",
  562. query: { teacherId: row.id, activeIndex: "2" },
  563. });
  564. },
  565. gotoOperating(row) {
  566. this.$router.push({
  567. path: "/operateManager/operateStudent",
  568. query: { teacherId: row.id, operatingTag: "1" },
  569. });
  570. },
  571. },
  572. };
  573. </script>
  574. <style lang="scss" scoped>
  575. .el-button + .el-button {
  576. margin-left: 0;
  577. }
  578. </style>