index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. <!-- -->
  2. <template>
  3. <div class="m-container">
  4. <h2>
  5. <div class="squrt"></div>
  6. 服务指标明细
  7. </h2>
  8. <!-- <filter-search
  9. ref="filterSearch"
  10. @reload="reloadSearch"
  11. :keys="['searchType']"
  12. :moreKeys="['organId']"
  13. /> -->
  14. <div class="m-core">
  15. <save-form
  16. :inline="true"
  17. :model="searchForm"
  18. @submit="search"
  19. @reset="onReSet"
  20. ref="form"
  21. >
  22. <el-form-item prop="organId">
  23. <el-select
  24. class="multiple"
  25. v-model.trim="searchForm.organId"
  26. filterable
  27. clearable
  28. placeholder="请选择分部"
  29. >
  30. <el-option
  31. v-for="(item, index) in selects.branchs"
  32. :key="index"
  33. :label="item.name"
  34. :value="item.id"
  35. ></el-option>
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item prop="teacherId">
  39. <remote-search
  40. :commit="'setTeachers'"
  41. v-model="searchForm.teacherId"
  42. />
  43. </el-form-item>
  44. <el-form-item prop="unDone">
  45. <el-select
  46. class="multiple"
  47. v-model.trim="searchForm.unDone"
  48. clearable
  49. placeholder="是否异常"
  50. >
  51. <el-option label="是" value="1"></el-option>
  52. <el-option label="否" value="0"></el-option>
  53. </el-select>
  54. </el-form-item>
  55. <el-form-item prop="reminded">
  56. <el-select
  57. class="multiple"
  58. v-model.trim="searchForm.reminded"
  59. clearable
  60. placeholder="是否提醒"
  61. >
  62. <el-option label="是" :value="1"></el-option>
  63. <el-option label="否" :value="0"></el-option>
  64. </el-select>
  65. </el-form-item>
  66. <el-form-item prop="operatorId">
  67. <remote-search
  68. :commit="'setEmploys'"
  69. v-model.trim="searchForm.operatorId"
  70. />
  71. </el-form-item>
  72. <el-form-item prop="jobNature">
  73. <el-select
  74. v-model.trim="searchForm.jobNature"
  75. filterable
  76. clearable
  77. placeholder="工作类型"
  78. >
  79. <el-option
  80. v-for="item in jobNature"
  81. :key="item.value"
  82. :label="item.label"
  83. :value="item.value"
  84. ></el-option>
  85. </el-select>
  86. </el-form-item>
  87. <el-form-item>
  88. <el-date-picker
  89. style="width: 410px"
  90. v-model.trim="orderDate"
  91. type="daterange"
  92. value-format="yyyy-MM-dd"
  93. range-separator="至"
  94. start-placeholder="开始日期"
  95. end-placeholder="结束日期"
  96. :clearable="false"
  97. @change="changeWeek"
  98. :picker-options="bigin()"
  99. >
  100. </el-date-picker>
  101. </el-form-item>
  102. <el-form-item>
  103. <el-button native-type="submit" type="primary">搜索</el-button>
  104. <el-button native-type="reset" type="danger">重置</el-button>
  105. <el-button
  106. @click="onExport"
  107. type="primary"
  108. v-permission="'export/teacherServeInfo'"
  109. >导出</el-button
  110. >
  111. </el-form-item>
  112. </save-form>
  113. <div class="btnWraps" style="margin-bottom: 20px">
  114. <el-button
  115. type="primary"
  116. v-permission="'exercisesSituation/teacherServeRemindPush'"
  117. @click="remindTeachers"
  118. >批量提醒</el-button
  119. >
  120. </div>
  121. <div class="tableWrap">
  122. <el-table
  123. style="width: 100%"
  124. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  125. :data="tableList"
  126. @selection-change="handleSelectionChange"
  127. >
  128. <el-table-column
  129. type="selection"
  130. width="55"
  131. :selectable="checkSelectable"
  132. >
  133. </el-table-column>
  134. <el-table-column
  135. align="center"
  136. prop="organName"
  137. label="分部"
  138. ></el-table-column>
  139. <el-table-column
  140. align="center"
  141. prop="teacherId"
  142. label="老师编号"
  143. ></el-table-column>
  144. <el-table-column
  145. align="center"
  146. prop="teacherName"
  147. label="老师姓名"
  148. ></el-table-column>
  149. <el-table-column
  150. align="center"
  151. prop="teacherName"
  152. label="工作类型"
  153. >
  154. <template slot-scope="scope">
  155. <div>
  156. {{ scope.row.jobNature|hrStatus}}
  157. </div>
  158. </template>
  159. </el-table-column>
  160. <el-table-column
  161. align="center"
  162. prop="teacherName"
  163. label="服务周期"
  164. width="180px"
  165. >
  166. <template slot-scope="scope">
  167. <div>
  168. {{ scope.row.monday | dayjsFormat }}~{{
  169. scope.row.sunday | dayjsFormat
  170. }}
  171. </div>
  172. </template>
  173. </el-table-column>
  174. <el-table-column
  175. align="center"
  176. prop="homeworkNum"
  177. label="课后作业(节)"
  178. ></el-table-column>
  179. <el-table-column
  180. align="center"
  181. prop="exerciseNum"
  182. label="课外作业(人)"
  183. ></el-table-column>
  184. <el-table-column align="center" prop="studentId" label="是否异常">
  185. <template slot-scope="scope">
  186. {{ scope.row.unDone ? "是" : "否" }}
  187. </template>
  188. </el-table-column>
  189. <el-table-column align="center" prop="remindDate" label="提醒时间">
  190. <template slot-scope="scope">
  191. <div>
  192. {{ scope.row.remindDate | dateForMinFormat }}
  193. </div>
  194. </template>
  195. </el-table-column>
  196. <el-table-column
  197. align="center"
  198. prop="operatorName"
  199. label="操作人"
  200. ></el-table-column>
  201. <el-table-column
  202. align="center"
  203. prop="studentId"
  204. label="操作"
  205. width="160px"
  206. >
  207. <template slot-scope="scope">
  208. <div>
  209. <el-button type="text" @click="gotoDteail(scope.row)"
  210. >查看</el-button
  211. >
  212. <el-button
  213. type="text"
  214. v-if="scope.row.unDone"
  215. v-permission="'exercisesSituation/teacherServeRemindPush'"
  216. @click="remindTeacher(scope.row)"
  217. >提醒老师</el-button
  218. >
  219. </div>
  220. </template>
  221. </el-table-column>
  222. </el-table>
  223. <pagination
  224. sync
  225. :total.sync="rules.total"
  226. :page.sync="rules.page"
  227. :limit.sync="rules.limit"
  228. :page-sizes="rules.page_size"
  229. @pagination="getList"
  230. />
  231. </div>
  232. <el-dialog
  233. title="查看"
  234. destroy-on-close
  235. :close-on-click-modal="false"
  236. :visible.sync="lookVisible"
  237. v-if="lookVisible"
  238. >
  239. <serverMask
  240. :detail="activeRow"
  241. @close="lookVisible = false"
  242. @submited="getList"
  243. />
  244. <span slot="footer" class="dialog-footer">
  245. <el-button type="primary" @click="lookVisible = false"
  246. >确 定</el-button
  247. >
  248. </span>
  249. </el-dialog>
  250. </div>
  251. </div>
  252. </template>
  253. <script>
  254. import axios from "axios";
  255. import { getToken } from "@/utils/auth";
  256. import pagination from "@/components/Pagination/index";
  257. import serverMask from "./conponent/serverMask";
  258. import load from "@/utils/loading";
  259. import { getTeacherServeInfo, teacherServeRemindPush } from "./api";
  260. import { getTimes } from "@/utils";
  261. import { getNowDateAndSunday, getNowDateAndMonday } from "@/utils/date";
  262. import { jobNature } from "@/utils/searchArray";
  263. import { Export } from "@/utils/downLoadFile";
  264. import qs from "qs";
  265. export default {
  266. components: { pagination, serverMask },
  267. data() {
  268. return {
  269. searchForm: {
  270. organId: "",
  271. teacherId: "",
  272. operatorId: "",
  273. reminded: "",
  274. unDone: "",
  275. operatorId: "",
  276. jobNature: "",
  277. },
  278. orderDate: [],
  279. tableList: [],
  280. organList: [],
  281. rules: {
  282. // 分页规则
  283. limit: 10, // 限制显示条数
  284. page: 1, // 当前页
  285. total: 0, // 总条数
  286. page_size: [10, 20, 40, 50], // 选择限制显示条数
  287. },
  288. lookVisible: false,
  289. activeRow: null,
  290. chioseList: [],
  291. jobNature: jobNature,
  292. };
  293. },
  294. //生命周期 - 创建完成(可以访问当前this实例)
  295. created() {},
  296. //生命周期 - 挂载完成(可以访问DOM元素)
  297. mounted() {
  298. // 获取分部
  299. this.init();
  300. },
  301. methods: {
  302. init() {
  303. this.$store.dispatch("setBranchs");
  304. this.$store.dispatch("setEmploys");
  305. this.getDefaultTime();
  306. if (this.$route.query.searchType) {
  307. this.searchForm.organId = this.$route.query.organId * 1 || "";
  308. this.searchForm.unDone = this.$route.query.unDone + "" || "";
  309. const dayjs = this.$helpers.dayjs;
  310. let nowDate = dayjs(new Date()).format("YYYY-MM-DD");
  311. this.orderDate = [
  312. getNowDateAndMonday(nowDate),
  313. getNowDateAndSunday(nowDate),
  314. ];
  315. }
  316. this.getList();
  317. },
  318. async getList() {
  319. try {
  320. const { orderDate, ...rest } = this.searchForm;
  321. const result = await getTeacherServeInfo({
  322. ...rest,
  323. ...getTimes(this.orderDate, ["monday", "sunday"]),
  324. rows: this.rules.limit,
  325. page: this.rules.page,
  326. });
  327. this.rules.total = result.data.total;
  328. this.tableList = result.data.rows;
  329. } catch (e) {}
  330. },
  331. search() {
  332. this.rules.page = 1;
  333. this.getList();
  334. },
  335. onReSet() {
  336. this.$refs.form.resetFields();
  337. this.getDefaultTime();
  338. this.search();
  339. },
  340. gotoDteail(row) {
  341. this.activeRow = row;
  342. this.lookVisible = true;
  343. },
  344. reloadSearch() {
  345. this.getList();
  346. },
  347. getDefaultTime() {
  348. const dayjs = this.$helpers.dayjs;
  349. let nowDate = dayjs(new Date()).format("YYYY-MM-DD");
  350. let lastWeek = dayjs(nowDate).subtract(1, "week").format("YYYY-MM-DD");
  351. this.orderDate = [
  352. getNowDateAndMonday(lastWeek),
  353. getNowDateAndSunday(nowDate),
  354. ];
  355. },
  356. changeWeek(val) {
  357. if (val) {
  358. this.orderDate = [
  359. getNowDateAndMonday(val[0]),
  360. getNowDateAndSunday(val[1]),
  361. ];
  362. } else {
  363. this.getDefaultTime();
  364. }
  365. },
  366. remindTeacher(row) {
  367. this.$confirm("是否给老师发送提醒?", "提示", {
  368. confirmButtonText: "确定",
  369. cancelButtonText: "取消",
  370. type: "warning",
  371. }).then(async () => {
  372. try {
  373. const result = await teacherServeRemindPush([row]);
  374. this.getList();
  375. this.$message.success("提醒成功");
  376. } catch (e) {
  377. console.log(e);
  378. }
  379. });
  380. },
  381. remindTeachers() {
  382. if (this.chioseList.length <= 0) {
  383. this.$message.error("请至少选择一条信息");
  384. return;
  385. }
  386. this.$confirm("是否批量给老师发送提醒?", "提示", {
  387. confirmButtonText: "确定",
  388. cancelButtonText: "取消",
  389. type: "warning",
  390. }).then(async () => {
  391. try {
  392. const result = await teacherServeRemindPush(this.chioseList);
  393. this.getList();
  394. this.$message.success("提醒成功");
  395. } catch (e) {
  396. console.log(e);
  397. }
  398. });
  399. },
  400. checkSelectable(row) {
  401. return row.unDone;
  402. },
  403. handleSelectionChange(arr) {
  404. this.chioseList = arr;
  405. },
  406. bigin() {
  407. let self = this;
  408. return {
  409. firstDayOfWeek: 1,
  410. disabledDate(time) {
  411. return time.getTime() >= Date.now();
  412. },
  413. };
  414. },
  415. onExport() {
  416. const { orderDate, ...rest } = this.searchForm;
  417. Export(
  418. this,
  419. {
  420. url: "/api-web/export/teacherServeInfo",
  421. fileName: "退团申请.xlsx",
  422. method: "post",
  423. params: qs.stringify({
  424. ...rest,
  425. ...getTimes(this.orderDate, ["monday", "sunday"]),
  426. }),
  427. },
  428. "您确定导出退团申请列表?"
  429. );
  430. },
  431. },
  432. };
  433. </script>
  434. <style lang='scss' scoped>
  435. </style>