StatisticsManage.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <div class="exam-statistics">
  3. <div class="part-box part-box-filter part-box-flex">
  4. <el-form ref="FilterForm" label-position="left" label-width="90px" inline>
  5. <el-form-item label="学期:">
  6. <semester-select v-model="filter.semesterId"></semester-select>
  7. </el-form-item>
  8. <el-form-item label="考试:">
  9. <exam-select
  10. v-model="filter.examId"
  11. :semester-id="filter.semesterId"
  12. @change="examChange"
  13. ></exam-select>
  14. </el-form-item>
  15. <el-form-item label="开课学院:">
  16. <college-select
  17. v-model.trim="filter.collegeId"
  18. placeholder="开课学院"
  19. clearable
  20. @change="facultyChange"
  21. ></college-select>
  22. </el-form-item>
  23. <el-form-item label="开课部门:">
  24. <el-select
  25. v-model="filter.teachingRoomId"
  26. placeholder="开课部门"
  27. filterable
  28. clearable
  29. >
  30. <el-option
  31. v-for="item in teachingRooms"
  32. :key="item.id"
  33. :value="item.id"
  34. :label="item.name"
  35. >
  36. </el-option>
  37. </el-select>
  38. </el-form-item>
  39. <el-form-item label="完成状态:">
  40. <el-select
  41. v-model="filter.status"
  42. style="width: 142px;"
  43. placeholder="完成状态"
  44. clearable
  45. >
  46. <el-option
  47. v-for="(val, key) in FINISH_STATUS"
  48. :key="key"
  49. :value="key"
  50. :label="val"
  51. ></el-option>
  52. </el-select>
  53. </el-form-item>
  54. <el-form-item label="课程名称:">
  55. <el-input
  56. v-model.trim="filter.courseName"
  57. placeholder="课程名称"
  58. clearable
  59. ></el-input>
  60. </el-form-item>
  61. <el-form-item label="任课老师:">
  62. <el-input
  63. v-model.trim="filter.teacherName"
  64. placeholder="任课老师"
  65. clearable
  66. ></el-input>
  67. </el-form-item>
  68. <el-form-item>
  69. <el-button
  70. v-if="checkPrivilege('button', 'select')"
  71. type="primary"
  72. @click="toPage(1)"
  73. >查询</el-button
  74. >
  75. </el-form-item>
  76. </el-form>
  77. <div class="part-box-action">
  78. <el-button
  79. v-if="checkPrivilege('button', 'Delete')"
  80. type="danger"
  81. icon="el-icon-delete"
  82. :loading="loading"
  83. @click="toBatDelete"
  84. >批量删除</el-button
  85. >
  86. <el-button
  87. v-if="checkPrivilege('button', 'Freshen')"
  88. type="primary"
  89. icon="el-icon-refresh"
  90. :loading="loading"
  91. :disabled="!filter.examId"
  92. @click="toFresh"
  93. >刷新数据</el-button
  94. >
  95. <el-button
  96. type="success"
  97. icon="el-icon-download"
  98. v-if="checkPrivilege('button', 'import')"
  99. ><a :href="downloadUrl" :download="dfilename">模板下载</a></el-button
  100. >
  101. <upload-button
  102. v-if="checkPrivilege('button', 'import')"
  103. btn-icon="el-icon-circle-plus-outline"
  104. btn-content="导入"
  105. btn-type="success"
  106. :upload-url="uploadUrl"
  107. :upload-data="uploadData"
  108. :format="['xls', 'xlsx']"
  109. accept=".xls,.xlsx"
  110. :disabled="!filter.examId"
  111. @valid-error="validError"
  112. @upload-success="uploadSuccess"
  113. >
  114. </upload-button>
  115. </div>
  116. </div>
  117. <div class="part-box part-box-pad">
  118. <el-table
  119. ref="TableList"
  120. :data="dataList"
  121. @selection-change="handleSelectionChange"
  122. >
  123. <el-table-column
  124. type="selection"
  125. width="55"
  126. align="center"
  127. ></el-table-column>
  128. <el-table-column
  129. type="index"
  130. label="序号"
  131. width="70"
  132. :index="indexMethod"
  133. ></el-table-column>
  134. <el-table-column
  135. prop="collegeName"
  136. label="开课学院"
  137. min-width="160"
  138. ></el-table-column>
  139. <el-table-column
  140. prop="teachingRoom"
  141. label="开课部门"
  142. min-width="160"
  143. ></el-table-column>
  144. <el-table-column
  145. prop="courseCode"
  146. label="课程代码"
  147. min-width="160"
  148. ></el-table-column>
  149. <el-table-column
  150. prop="courseName"
  151. label="课程名称"
  152. min-width="160"
  153. ></el-table-column>
  154. <el-table-column
  155. prop="teacher"
  156. label="任课老师"
  157. min-width="100"
  158. ></el-table-column>
  159. <el-table-column
  160. prop="clazzNames"
  161. label="班级名称"
  162. min-width="100"
  163. ></el-table-column>
  164. <el-table-column
  165. prop="printCount"
  166. label="总印份数"
  167. width="80"
  168. ></el-table-column>
  169. <el-table-column prop="status" label="状态" width="60">
  170. <span slot-scope="scope">{{ FINISH_STATUS[scope.row.status] }}</span>
  171. </el-table-column>
  172. <el-table-column
  173. class-name="action-column"
  174. label="操作"
  175. width="100px"
  176. fixed="right"
  177. >
  178. <template slot-scope="scope">
  179. <el-button
  180. v-if="scope.row.clazzContent"
  181. class="btn-primary"
  182. type="text"
  183. @click="toDetail(scope.row)"
  184. >详情</el-button
  185. ></template
  186. ></el-table-column
  187. >
  188. </el-table>
  189. <div class="part-page">
  190. <el-pagination
  191. background
  192. layout="total, sizes, prev, pager, next, jumper"
  193. :pager-count="5"
  194. :current-page="current"
  195. :total="total"
  196. :page-size="size"
  197. @current-change="toPage"
  198. @size-change="pageSizeChange"
  199. >
  200. </el-pagination>
  201. </div>
  202. </div>
  203. <!-- StatisticsDetailDialog -->
  204. <statistics-detail-dialog
  205. :contents="curContents"
  206. ref="StatisticsDetailDialog"
  207. ></statistics-detail-dialog>
  208. </div>
  209. </template>
  210. <script>
  211. import { statisticsList, statisticsDelete, statisticsFreshen } from "../api";
  212. import { organizationFindByTypeList } from "../../base/api";
  213. import UploadButton from "../../../components/UploadButton";
  214. import StatisticsDetailDialog from "../components/StatisticsDetailDialog.vue";
  215. export default {
  216. name: "exam-statistics",
  217. components: { UploadButton, StatisticsDetailDialog },
  218. data() {
  219. return {
  220. filter: {
  221. semesterId: "",
  222. examId: "",
  223. collegeId: "",
  224. teachingRoomId: "",
  225. courseName: "",
  226. teacherName: "",
  227. status: ""
  228. },
  229. loading: false,
  230. current: 1,
  231. size: this.GLOBAL.pageSize,
  232. total: 0,
  233. dataList: [],
  234. curRow: {},
  235. curContents: [],
  236. teachingRooms: [],
  237. multipleSelection: [],
  238. FINISH_STATUS: { UN_FINISH: "未完成", FINISH: "已完成" },
  239. // import
  240. uploadData: {},
  241. uploadUrl: "/api/admin/statistics/import",
  242. downloadUrl: "/temps/examStatisticsTemplate.xlsx",
  243. dfilename: "命题计划导入模板.xlsx"
  244. };
  245. },
  246. mounted() {
  247. this.getList();
  248. },
  249. methods: {
  250. async getList() {
  251. if (!this.checkPrivilege("list", "list")) return;
  252. const datas = {
  253. ...this.filter,
  254. pageNumber: this.current,
  255. pageSize: this.size
  256. };
  257. const data = await statisticsList(datas);
  258. this.dataList = data.records;
  259. this.total = data.total;
  260. },
  261. toPage(page) {
  262. this.current = page;
  263. this.getList();
  264. },
  265. async getTeachingRooms() {
  266. this.teachingRooms = await organizationFindByTypeList({
  267. orgType: "TEACHING_ROOM",
  268. orgId: this.filter.collegeId,
  269. auth: false
  270. });
  271. },
  272. facultyChange(val) {
  273. this.filter.teachingRoomId = "";
  274. this.teachingRooms = [];
  275. if (!val) return;
  276. this.getTeachingRooms();
  277. },
  278. examChange() {
  279. this.uploadData = {
  280. examId: this.filter.examId
  281. };
  282. },
  283. handleSelectionChange(val) {
  284. this.multipleSelection = val.map(item => item.id);
  285. },
  286. async toBatDelete() {
  287. if (this.loading) return;
  288. if (!this.multipleSelection.length) {
  289. this.$message.error("请选择要删除的数据");
  290. return;
  291. }
  292. const result = await this.$confirm("确定要删除选择的数据吗?", "提示", {
  293. type: "warning"
  294. }).catch(() => {});
  295. if (result !== "confirm") return;
  296. this.loading = true;
  297. const data = await statisticsDelete(
  298. this.multipleSelection
  299. ).catch(() => {});
  300. this.loading = false;
  301. if (!data) return;
  302. this.$message.success("提交成功!");
  303. this.toPage(this.current);
  304. },
  305. async toFresh() {
  306. if (!this.filter.examId) {
  307. this.$message.error("请先选择考试");
  308. return;
  309. }
  310. this.loading = true;
  311. const data = await statisticsFreshen({
  312. examId: this.filter.examId
  313. }).catch(() => {});
  314. this.loading = false;
  315. if (!data) return;
  316. this.$message.success("刷新成功!");
  317. this.toPage(1);
  318. },
  319. toDetail(row) {
  320. if (!row.clazzContent) {
  321. this.$message.error("当前无详情展示");
  322. return;
  323. }
  324. this.curContents = JSON.parse(row.clazzContent);
  325. this.$refs.StatisticsDetailDialog.open();
  326. },
  327. // import
  328. validError(errorData) {
  329. this.$message.error(errorData.message);
  330. },
  331. uploadSuccess() {
  332. this.$message.success("文件上传成功,后台正在导入!");
  333. this.getList();
  334. }
  335. }
  336. };
  337. </script>