afterSchoolList.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <!-- -->
  2. <template>
  3. <div class="">
  4. <!-- <h2>
  5. <div class="squrt"></div>课外训练
  6. </h2> -->
  7. <div class="m-core">
  8. <save-form
  9. :inline="true"
  10. @submit="search"
  11. @reset="onReSet"
  12. :saveKey="'afterSchoolList'"
  13. :model="searchForm"
  14. >
  15. <el-form-item>
  16. <el-input
  17. v-model.trim="searchForm.listSearch"
  18. clearable
  19. @keyup.enter.native="search"
  20. placeholder="请输入标题"
  21. ></el-input>
  22. </el-form-item>
  23. <el-form-item>
  24.  <remote-search
  25. :commit="'setTeachers'"
  26. v-model="searchForm.teacherId"
  27. />
  28. </el-form-item>
  29. <el-form-item prop="organIdList">
  30. <el-select
  31. class="multiple"
  32. v-model.trim="searchForm.organIdList"
  33. filterable
  34. clearable
  35. placeholder="请选择分部"
  36. >
  37. <el-option
  38. v-for="(item, index) in selects.branchs"
  39. :key="index"
  40. :label="item.name"
  41. :value="item.id"
  42. ></el-option>
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item>
  46. <el-date-picker
  47. v-model.trim="searchForm.listTimer"
  48. style="width: 410px"
  49. type="daterange"
  50. value-format="yyyy-MM-dd"
  51. range-separator="至"
  52. start-placeholder="布置开始日期"
  53. end-placeholder="布置结束日期"
  54. :picker-options="{
  55. firstDayOfWeek: 1,
  56. }"
  57. ></el-date-picker>
  58. </el-form-item>
  59. <el-form-item>
  60. <el-button type="danger" native-type="submit">搜索</el-button>
  61. <el-button native-type="reset" type="primary">重置</el-button>
  62. </el-form-item>
  63. </save-form>
  64. <div class="tableWrap">
  65. <el-table
  66. style="width: 100%"
  67. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  68. :data="tableList"
  69. >
  70. <el-table-column align="center" prop="teacherName" label="老师姓名">
  71. <template slot-scope="scope">
  72. <copy-text v-if="scope.row.teacher">
  73. {{ scope.row.teacher.username }}
  74. </copy-text>
  75. </template>
  76. </el-table-column>
  77. <el-table-column align="center" prop="createTime" label="布置时间">
  78. <template slot-scope="scope">
  79. {{ scope.row.createTime | dateForMinFormat }}
  80. </template>
  81. </el-table-column>
  82. <el-table-column
  83. align="center"
  84. prop="title"
  85. label="训练标题"
  86. >
  87. <template slot-scope="scope">
  88. <copy-text >
  89. {{ scope.row.title }}
  90. </copy-text>
  91. </template>
  92. </el-table-column>
  93. <el-table-column
  94. align="center"
  95. prop="organName"
  96. label="老师分部"
  97. >
  98. <template slot-scope="scope">
  99. <copy-text >
  100. {{ scope.row.organName }}
  101. </copy-text>
  102. </template>
  103. </el-table-column>
  104. <el-table-column align="center" prop="expireDate" label="截止时间">
  105. <template slot-scope="scope">
  106. {{ scope.row.expireDate | dateForMinFormat }}
  107. </template>
  108. </el-table-column>
  109. <el-table-column align="center" label="操作">
  110. <template slot-scope="scope">
  111. <div>
  112. <auth auths='afterSchollList/look'>
  113. <el-button
  114. type="text"
  115. @click="lookDetail(scope.row)"
  116. >查看</el-button
  117. >
  118. </auth>
  119. </div>
  120. </template>
  121. </el-table-column>
  122. </el-table>
  123. <pagination
  124. sync
  125. :saveKey="'afterSchoolList'"
  126. :total.sync="rules.total"
  127. :page.sync="rules.page"
  128. :limit.sync="rules.limit"
  129. :page-sizes="rules.page_size"
  130. @pagination="getList"
  131. />
  132. </div>
  133. </div>
  134. <!-- <el-dialog title="课外训练详情"
  135. :visible.sync="afterSchoolVisible"
  136. width="600px">
  137. <el-form :model="visibleForm">
  138. <el-form-item label="布置时间">
  139. <p class="schoolCell">{{visibleForm.createTime}}</p>
  140. </el-form-item>
  141. <el-form-item label="老师姓名">
  142. <p class="schoolCell">{{visibleForm.createTime}}</p>
  143. </el-form-item>
  144. <el-form-item label="学生姓名">
  145. <el-popover placement="top-start"
  146. width="400"
  147. trigger="hover"
  148. :content="visibleForm.createTime">
  149. <p class="schoolCell"
  150. slot="reference">{{visibleForm.createTime}}</p>
  151. </el-popover>
  152. </el-form-item>
  153. <el-form-item label="截止时间">
  154. <p class="schoolCell">{{visibleForm.createTime}}</p>
  155. </el-form-item>
  156. <el-form-item label="训练标题">
  157. <p class="schoolCell">{{visibleForm.createTime}}</p>
  158. </el-form-item>
  159. <el-form-item label="训练内容">
  160. <el-input disabled
  161. type="textarea"
  162. rows="5"
  163. v-model="visibleForm.createTime"
  164. style="width:400px"></el-input>
  165. </el-form-item>
  166. <el-form-item label="学生上传">
  167. <el-input disabled
  168. v-model="visibleForm.createTime"
  169. style="width:400px"></el-input>
  170. </el-form-item>
  171. </el-form>
  172. </el-dialog> -->
  173. </div>
  174. </template>
  175. <script>
  176. import pagination from "@/components/Pagination/index";
  177. import remoteSearch from "@/components/remote-search";
  178. import { queryPageList } from "@/api/afterSchool";
  179. export default {
  180. components: { pagination, remoteSearch },
  181. data() {
  182. return {
  183. searchForm: {
  184. listSearch: null,
  185. listTimer: [],
  186. teacherId: null,
  187. organIdList: null,
  188. },
  189. rules: {
  190. // 分页规则
  191. limit: 10, // 限制显示条数
  192. page: 1, // 当前页
  193. total: 0, // 总条数
  194. page_size: [10, 20, 40, 50], // 选择限制显示条数
  195. },
  196. tableList: [],
  197. visibleForm: {
  198. createTime: null,
  199. },
  200. };
  201. },
  202. //生命周期 - 创建完成(可以访问当前this实例)
  203. created() {
  204. if (this.searchForm.listTimer && this.searchForm.listTimer.length <= 0) {
  205. this.getNow()
  206. }
  207. },
  208. //生命周期 - 挂载完成(可以访问DOM元素)
  209. mounted() {
  210. this.$store.dispatch("setBranchs");
  211. // 获取分部
  212. this.init();
  213. },
  214. methods: {
  215. getNow(){
  216. let now = new Date();
  217. let startDate = new Date(
  218. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  219. )
  220. .toISOString()
  221. .slice(0, 10);
  222. let endDate = new Date(
  223. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  224. )
  225. .toISOString()
  226. .slice(0, 10);
  227. this.searchForm.listTimer = [];
  228. this.searchForm.listTimer.push(startDate);
  229. this.searchForm.listTimer.push(endDate);
  230. },
  231. init() {
  232. this.getList();
  233. },
  234. getList() {
  235. // assignStartTime assignEndTime page search teacherId title
  236. let obj = {};
  237. if (this.searchForm.listTimer && this.searchForm.listTimer.length > 0) {
  238. obj.assignStartTime = this.searchForm.listTimer[0];
  239. obj.assignEndTime = this.searchForm.listTimer[1];
  240. }
  241. obj.page = this.rules.page;
  242. (obj.rows = this.rules.limit),
  243. this.searchForm.teacherId
  244. ? (obj.teacherId = this.searchForm.teacherId)
  245. : null;
  246. this.searchForm.listSearch
  247. ? (obj.title = this.searchForm.listSearch)
  248. : null;
  249. this.searchForm.organIdList
  250. ? (obj.organIdList = this.searchForm.organIdList)
  251. : null;
  252. queryPageList(obj).then((res) => {
  253. if (res.code == 200) {
  254. this.tableList = res.data.rows;
  255. this.rules.total = res.data.total;
  256. }
  257. });
  258. },
  259. search() {
  260. this.rules.page = 1;
  261. this.getList();
  262. },
  263. onReSet() {
  264. this.searchForm = {
  265. listSearch: null,
  266. listTimer: [],
  267. teacherId: null,
  268. organIdList: null,
  269. };
  270. this.getNow()
  271. this.search();
  272. },
  273. lookDetail(row) {
  274. this.$router.push({
  275. path: "/afterSchoolDetail",
  276. query: { extracurricularExercisesId: row.id, title: row.title },
  277. });
  278. },
  279. },
  280. };
  281. </script>
  282. <style lang='scss' scoped>
  283. .schoolCell {
  284. width: 400px;
  285. color: #333;
  286. background-color: #f5f7fa;
  287. border-color: #e4e7ed;
  288. height: 40px;
  289. line-height: 40px;
  290. outline: 0;
  291. padding: 0 15px;
  292. border-radius: 4px;
  293. border: 1px solid #dcdfe6;
  294. display: inline-block;
  295. box-sizing: border-box;
  296. white-space: nowrap;
  297. text-overflow: ellipsis;
  298. overflow: hidden;
  299. }
  300. /deep/.el-textarea.is-disabled .el-textarea__inner {
  301. color: #333;
  302. }
  303. </style>