index.vue 11 KB

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