afterSchoolList.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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. <el-button
  113. type="text"
  114. v-permission="'afterSchollList/look'"
  115. @click="lookDetail(scope.row)"
  116. >查看</el-button
  117. >
  118. </div>
  119. </template>
  120. </el-table-column>
  121. </el-table>
  122. <pagination
  123. sync
  124. :saveKey="'afterSchoolList'"
  125. :total.sync="rules.total"
  126. :page.sync="rules.page"
  127. :limit.sync="rules.limit"
  128. :page-sizes="rules.page_size"
  129. @pagination="getList"
  130. />
  131. </div>
  132. </div>
  133. <!-- <el-dialog title="课外训练详情"
  134. :visible.sync="afterSchoolVisible"
  135. width="600px">
  136. <el-form :model="visibleForm">
  137. <el-form-item label="布置时间">
  138. <p class="schoolCell">{{visibleForm.createTime}}</p>
  139. </el-form-item>
  140. <el-form-item label="老师姓名">
  141. <p class="schoolCell">{{visibleForm.createTime}}</p>
  142. </el-form-item>
  143. <el-form-item label="学生姓名">
  144. <el-popover placement="top-start"
  145. width="400"
  146. trigger="hover"
  147. :content="visibleForm.createTime">
  148. <p class="schoolCell"
  149. slot="reference">{{visibleForm.createTime}}</p>
  150. </el-popover>
  151. </el-form-item>
  152. <el-form-item label="截止时间">
  153. <p class="schoolCell">{{visibleForm.createTime}}</p>
  154. </el-form-item>
  155. <el-form-item label="训练标题">
  156. <p class="schoolCell">{{visibleForm.createTime}}</p>
  157. </el-form-item>
  158. <el-form-item label="训练内容">
  159. <el-input disabled
  160. type="textarea"
  161. rows="5"
  162. v-model="visibleForm.createTime"
  163. style="width:400px"></el-input>
  164. </el-form-item>
  165. <el-form-item label="学生上传">
  166. <el-input disabled
  167. v-model="visibleForm.createTime"
  168. style="width:400px"></el-input>
  169. </el-form-item>
  170. </el-form>
  171. </el-dialog> -->
  172. </div>
  173. </template>
  174. <script>
  175. import pagination from "@/components/Pagination/index";
  176. import remoteSearch from "@/components/remote-search";
  177. import { queryPageList } from "@/api/afterSchool";
  178. export default {
  179. components: { pagination, remoteSearch },
  180. data() {
  181. return {
  182. searchForm: {
  183. listSearch: null,
  184. listTimer: [],
  185. teacherId: null,
  186. organIdList: null,
  187. },
  188. rules: {
  189. // 分页规则
  190. limit: 10, // 限制显示条数
  191. page: 1, // 当前页
  192. total: 0, // 总条数
  193. page_size: [10, 20, 40, 50], // 选择限制显示条数
  194. },
  195. tableList: [],
  196. visibleForm: {
  197. createTime: null,
  198. },
  199. };
  200. },
  201. //生命周期 - 创建完成(可以访问当前this实例)
  202. created() {
  203. if (this.searchForm.listTimer && this.searchForm.listTimer.length <= 0) {
  204. let now = new Date();
  205. let startDate = new Date(
  206. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  207. )
  208. .toISOString()
  209. .slice(0, 10);
  210. let endDate = new Date(
  211. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  212. )
  213. .toISOString()
  214. .slice(0, 10);
  215. this.searchForm.listTimer = [];
  216. this.searchForm.listTimer.push(startDate);
  217. this.searchForm.listTimer.push(endDate);
  218. }
  219. },
  220. //生命周期 - 挂载完成(可以访问DOM元素)
  221. mounted() {
  222. this.$store.dispatch("setBranchs");
  223. // 获取分部
  224. this.init();
  225. },
  226. methods: {
  227. init() {
  228. this.getList();
  229. },
  230. getList() {
  231. // assignStartTime assignEndTime page search teacherId title
  232. let obj = {};
  233. if (this.searchForm.listTimer && this.searchForm.listTimer.length > 0) {
  234. obj.assignStartTime = this.searchForm.listTimer[0];
  235. obj.assignEndTime = this.searchForm.listTimer[1];
  236. }
  237. obj.page = this.rules.page;
  238. (obj.rows = this.rules.limit),
  239. this.searchForm.teacherId
  240. ? (obj.teacherId = this.searchForm.teacherId)
  241. : null;
  242. this.searchForm.listSearch
  243. ? (obj.title = this.searchForm.listSearch)
  244. : null;
  245. this.searchForm.organIdList
  246. ? (obj.organIdList = this.searchForm.organIdList)
  247. : null;
  248. queryPageList(obj).then((res) => {
  249. if (res.code == 200) {
  250. this.tableList = res.data.rows;
  251. this.rules.total = res.data.total;
  252. }
  253. });
  254. },
  255. search() {
  256. this.rules.page = 1;
  257. this.getList();
  258. },
  259. onReSet() {
  260. this.searchForm = {
  261. listSearch: null,
  262. listTimer: [],
  263. teacherId: null,
  264. organIdList: null,
  265. };
  266. this.search();
  267. },
  268. lookDetail(row) {
  269. this.$router.push({
  270. path: "/business/afterSchoolDetail",
  271. query: { extracurricularExercisesId: row.id, title: row.title },
  272. });
  273. },
  274. },
  275. };
  276. </script>
  277. <style lang='scss' scoped>
  278. .schoolCell {
  279. width: 400px;
  280. color: #333;
  281. background-color: #f5f7fa;
  282. border-color: #e4e7ed;
  283. height: 40px;
  284. line-height: 40px;
  285. outline: 0;
  286. padding: 0 15px;
  287. border-radius: 4px;
  288. border: 1px solid #dcdfe6;
  289. display: inline-block;
  290. box-sizing: border-box;
  291. white-space: nowrap;
  292. text-overflow: ellipsis;
  293. overflow: hidden;
  294. }
  295. /deep/.el-textarea.is-disabled .el-textarea__inner {
  296. color: #333;
  297. }
  298. </style>