afterSchoolList.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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. //生命周期 - 挂载完成(可以访问DOM元素)
  204. mounted() {
  205. this.$store.dispatch("setBranchs");
  206. // 获取分部
  207. this.init();
  208. },
  209. methods: {
  210. init() {
  211. if (this.searchForm.listTimer && this.searchForm.listTimer.length <= 0) {
  212. let now = new Date();
  213. let startDate = new Date(
  214. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  215. )
  216. .toISOString()
  217. .slice(0, 10);
  218. let endDate = new Date(
  219. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  220. )
  221. .toISOString()
  222. .slice(0, 10);
  223. this.searchForm.listTimer = [];
  224. this.searchForm.listTimer.push(startDate);
  225. this.searchForm.listTimer.push(endDate);
  226. }
  227. this.getList();
  228. },
  229. getList() {
  230. // assignStartTime assignEndTime page search teacherId title
  231. let obj = {};
  232. if (this.searchForm.listTimer && this.searchForm.listTimer.length > 0) {
  233. obj.assignStartTime = this.searchForm.listTimer[0];
  234. obj.assignEndTime = this.searchForm.listTimer[1];
  235. }
  236. obj.page = this.rules.page;
  237. (obj.rows = this.rules.limit),
  238. this.searchForm.teacherId
  239. ? (obj.teacherId = this.searchForm.teacherId)
  240. : null;
  241. this.searchForm.listSearch
  242. ? (obj.title = this.searchForm.listSearch)
  243. : null;
  244. this.searchForm.organIdList
  245. ? (obj.organIdList = this.searchForm.organIdList)
  246. : null;
  247. queryPageList(obj).then((res) => {
  248. if (res.code == 200) {
  249. this.tableList = res.data.rows;
  250. this.rules.total = res.data.total;
  251. }
  252. });
  253. },
  254. search() {
  255. this.rules.page = 1;
  256. this.getList();
  257. },
  258. onReSet() {
  259. this.searchForm = {
  260. listSearch: null,
  261. listTimer: [],
  262. teacherId: null,
  263. organIdList: null,
  264. };
  265. this.search();
  266. },
  267. lookDetail(row) {
  268. this.$router.push({
  269. path: "/business/afterSchoolDetail",
  270. query: { extracurricularExercisesId: row.id, title: row.title },
  271. });
  272. },
  273. },
  274. };
  275. </script>
  276. <style lang='scss' scoped>
  277. .schoolCell {
  278. width: 400px;
  279. color: #333;
  280. background-color: #f5f7fa;
  281. border-color: #e4e7ed;
  282. height: 40px;
  283. line-height: 40px;
  284. outline: 0;
  285. padding: 0 15px;
  286. border-radius: 4px;
  287. border: 1px solid #dcdfe6;
  288. display: inline-block;
  289. box-sizing: border-box;
  290. white-space: nowrap;
  291. text-overflow: ellipsis;
  292. overflow: hidden;
  293. }
  294. /deep/.el-textarea.is-disabled .el-textarea__inner {
  295. color: #333;
  296. }
  297. </style>