PaperStorage.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  1. <template>
  2. <section class="content">
  3. <div v-show="isClear == 1">
  4. <LinkTitlesCustom :current-paths="['卷库管理 ', '试卷仓库管理']" />
  5. </div>
  6. <div class="part-box">
  7. <h2 class="part-box-title">试卷仓库</h2>
  8. <el-form class="part-filter-form" :inline="true" :model="formSearch">
  9. <el-form-item label="课程名称">
  10. <el-select
  11. v-model="formSearch.courseNo"
  12. class="search_width"
  13. filterable
  14. :remote-method="getCourses"
  15. remote
  16. clearable
  17. placeholder="全部"
  18. @focus="(e) => getCourses(e.target.value)"
  19. >
  20. <el-option
  21. v-for="item in courseInfoSelect"
  22. :key="item.courseNo"
  23. :label="item.courseInfo"
  24. :value="item.courseNo"
  25. >
  26. </el-option>
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item label="试卷名称">
  30. <el-input
  31. v-model="formSearch.name"
  32. class="search_width"
  33. placeholder="试卷名称"
  34. ></el-input>
  35. </el-form-item>
  36. <el-form-item label="层次">
  37. <el-select
  38. v-model="formSearch.level"
  39. class="search_width"
  40. clearable
  41. placeholder="请选择"
  42. >
  43. <el-option
  44. v-for="item in levelList"
  45. :key="item.value"
  46. :label="item.label"
  47. :value="item.value"
  48. >
  49. </el-option>
  50. </el-select>
  51. </el-form-item>
  52. <el-form-item label="录入人">
  53. <el-input
  54. v-model="formSearch.creator"
  55. class="search_width"
  56. placeholder="录入人"
  57. ></el-input>
  58. </el-form-item>
  59. <el-form-item label="修改人">
  60. <el-input
  61. v-model="formSearch.lastModifyName"
  62. class="search_width"
  63. placeholder="修改人"
  64. ></el-input>
  65. </el-form-item>
  66. <el-form-item>
  67. <el-button type="primary" @click="searchFrom"
  68. ><i class="el-icon-search"></i> 查询</el-button
  69. >
  70. <el-button @click="resetForm"
  71. ><i class="el-icon-refresh"></i> 重 置</el-button
  72. >
  73. </el-form-item>
  74. </el-form>
  75. <div class="part-box-action">
  76. <el-button
  77. :disabled="noBatchSelected"
  78. type="primary"
  79. plain
  80. @click="releasePapers"
  81. ><i class="el-icon-share"></i>释放</el-button
  82. >
  83. </div>
  84. </div>
  85. <div class="part-box">
  86. <el-table
  87. v-loading="loading"
  88. element-loading-text="拼命加载中"
  89. :data="tableData"
  90. @selection-change="selectChange"
  91. >
  92. <el-table-column
  93. type="selection"
  94. width="50"
  95. align="center"
  96. ></el-table-column>
  97. <el-table-column label="课程名称" width="180">
  98. <template slot-scope="scope">
  99. <span>{{ scope.row.course.name }}</span>
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="课程代码" width="80">
  103. <template slot-scope="scope">
  104. <span>{{ scope.row.course.code }}</span>
  105. </template>
  106. </el-table-column>
  107. <el-table-column label="试卷名称" width="180">
  108. <template slot-scope="scope">
  109. <span>{{ scope.row.name }}</span>
  110. </template>
  111. </el-table-column>
  112. <el-table-column
  113. label="试卷总分"
  114. width="103"
  115. sortable
  116. prop="totalScore"
  117. >
  118. </el-table-column>
  119. <el-table-column
  120. label="试卷难度"
  121. width="103"
  122. sortable
  123. prop="difficultyDegree"
  124. >
  125. </el-table-column>
  126. <el-table-column
  127. label="大题数量"
  128. width="103"
  129. sortable
  130. prop="paperDetailCount"
  131. >
  132. </el-table-column>
  133. <el-table-column label="录入员" width="150">
  134. <template slot-scope="scope">
  135. <span>{{ scope.row.creator }}</span>
  136. </template>
  137. </el-table-column>
  138. <el-table-column
  139. label="创建时间"
  140. width="153"
  141. sortable
  142. prop="createTime"
  143. >
  144. </el-table-column>
  145. <el-table-column label="修改人" width="150">
  146. <template slot-scope="scope">
  147. <span>{{ scope.row.lastModifyName }}</span>
  148. </template>
  149. </el-table-column>
  150. <el-table-column
  151. label="修改时间"
  152. width="153"
  153. sortable
  154. prop="updateDate"
  155. >
  156. </el-table-column>
  157. <el-table-column label="操作" width="180" fixed="right">
  158. <template slot-scope="scope">
  159. <div class="operate_left">
  160. <el-button
  161. size="mini"
  162. type="primary"
  163. plain
  164. @click="viewPaper(scope.row)"
  165. ><i class="el-icon-view"></i>查看</el-button
  166. >
  167. <el-button
  168. size="mini"
  169. type="primary"
  170. plain
  171. @click="releasePaper(scope.row)"
  172. ><i class="el-icon-share"></i>释放</el-button
  173. >
  174. </div>
  175. </template>
  176. </el-table-column>
  177. </el-table>
  178. <div class="part-page">
  179. <el-pagination
  180. :current-page="currentPage"
  181. :page-size="pageSize"
  182. :page-sizes="[10, 20, 50, 100, 200, 300]"
  183. layout="total, sizes, prev, pager, next, jumper"
  184. :total="total"
  185. @current-change="handleCurrentChange"
  186. @size-change="handleSizeChange"
  187. >
  188. </el-pagination>
  189. </div>
  190. </div>
  191. </section>
  192. </template>
  193. <script>
  194. import { QUESTION_API } from "@/constants/constants";
  195. import { LEVEL_TYPE } from "../constants/constants";
  196. import { mapState } from "vuex";
  197. import LinkTitlesCustom from "@/components/LinkTitlesCustom.vue";
  198. export default {
  199. components: { LinkTitlesCustom },
  200. data() {
  201. return {
  202. publicityDis: false,
  203. difficultyDegreeDis: false,
  204. quesLoading: false,
  205. quesPropertyDialog: false,
  206. difficultyDegree: 0.1,
  207. publicity: true,
  208. isClear: 0,
  209. courseLoading: false,
  210. formSearch: {
  211. courseNo: "",
  212. courseName: "",
  213. creator: "",
  214. lastModifyName: "",
  215. level: "",
  216. name: "",
  217. },
  218. tableData: [],
  219. currentPage: 1,
  220. pageSize: 10,
  221. total: 0,
  222. loading: false,
  223. courseList: [],
  224. levelList: LEVEL_TYPE,
  225. dialogVisible: false,
  226. selectedPaperIds: [],
  227. fileList: [],
  228. uploadAction: "",
  229. formUpload: {
  230. paperName: "",
  231. },
  232. uploadData: {},
  233. fileLoading: false,
  234. exportDialog: false,
  235. exportModel: {
  236. id: "",
  237. courseCode: "",
  238. courseName: "",
  239. exportContentList: [],
  240. seqMode: "MODE1",
  241. },
  242. isShow: true,
  243. dialogModel: false,
  244. rowIds: [],
  245. isShowPrintExamPackage: false,
  246. isShowPrintExamPackagePassword: false,
  247. printExamPackagePassword: "",
  248. printFrom: {
  249. examId: "",
  250. },
  251. rules: {
  252. examId: [{ required: true, message: "请输入名称", trigger: "change" }],
  253. },
  254. };
  255. },
  256. computed: {
  257. paperIds() {
  258. var paperIds = "";
  259. for (let paperId of this.selectedPaperIds) {
  260. if (!paperIds) {
  261. paperIds += paperId;
  262. } else {
  263. paperIds += "," + paperId;
  264. }
  265. }
  266. return paperIds;
  267. },
  268. courseInfoSelect() {
  269. var courseList = [];
  270. for (let course of this.courseList) {
  271. var courseInfo = course.name + "(" + course.code + ")";
  272. var courseNo = course.code;
  273. var courseName = course.name;
  274. courseList.push({
  275. courseNo: courseNo,
  276. courseInfo: courseInfo,
  277. courseName: courseName,
  278. });
  279. }
  280. return courseList;
  281. },
  282. noBatchSelected() {
  283. return this.selectedPaperIds.length === 0;
  284. },
  285. ...mapState({ user: (state) => state.user }),
  286. },
  287. watch: {
  288. $route: "initVue",
  289. },
  290. created() {
  291. this.initVue();
  292. },
  293. methods: {
  294. resetForm() {
  295. this.formSearch = {
  296. courseNo: "",
  297. courseName: "",
  298. level: "",
  299. name: "",
  300. };
  301. },
  302. //查询
  303. searchFrom() {
  304. this.currentPage = 1;
  305. this.searchGenPaper();
  306. },
  307. searchGenPaper() {
  308. var pageNo = this.currentPage;
  309. this.currentPage = 1;
  310. this.loading = true;
  311. var url =
  312. QUESTION_API +
  313. "/paper_storage/findPage/" +
  314. pageNo +
  315. "/" +
  316. this.pageSize;
  317. this.$http.get(url, { params: this.formSearch }).then((response) => {
  318. this.tableData = response.data.content;
  319. this.total = response.data.totalElements;
  320. this.currentPage = Number(pageNo);
  321. });
  322. this.loading = false;
  323. },
  324. handleCurrentChange(val) {
  325. this.currentPage = val;
  326. this.searchGenPaper();
  327. },
  328. handleSizeChange(val) {
  329. this.pageSize = val;
  330. this.currentPage = 1;
  331. this.searchGenPaper();
  332. },
  333. getCourseObj(courseNo) {
  334. for (let course of this.courseList) {
  335. if (course.code == courseNo) {
  336. return course;
  337. }
  338. }
  339. return "";
  340. },
  341. viewPaper(row) {
  342. var course = this.getCourseObj(this.formSearch.courseNo);
  343. if (course) {
  344. this.formSearch.courseName = course.name;
  345. }
  346. sessionStorage.setItem("gen_paper", JSON.stringify(this.formSearch));
  347. sessionStorage.setItem("gen_paper_currentPage", this.currentPage);
  348. sessionStorage.setItem("question_back", "false");
  349. this.$router.push({
  350. path: "/view_paper/" + row.id,
  351. });
  352. },
  353. selectChange(row) {
  354. this.selectedPaperIds = [];
  355. row.forEach((element) => {
  356. this.selectedPaperIds.push(element.id);
  357. });
  358. },
  359. releasePapers() {
  360. var paperIds = this.paperIds;
  361. if (this.selectedPaperIds.length != 0) {
  362. this.$confirm("确认释放试卷吗?", "提示", {
  363. type: "warning",
  364. }).then(() => {
  365. this.loading = true;
  366. this.$http
  367. .put(QUESTION_API + "/paper_storage/release/" + paperIds)
  368. .then(
  369. () => {
  370. this.$notify({
  371. message: "操作成功",
  372. type: "success",
  373. });
  374. this.searchGenPaper();
  375. this.selectedPaperIds = [];
  376. },
  377. (response) => {
  378. this.$notify({
  379. message: response.response.data.desc,
  380. type: "error",
  381. });
  382. this.loading = false;
  383. }
  384. );
  385. });
  386. } else {
  387. this.$notify({
  388. message: "请勾选释放的试卷",
  389. type: "warning",
  390. });
  391. }
  392. },
  393. releasePaper(row) {
  394. this.$confirm("确认释放试卷吗?", "提示", {
  395. type: "warning",
  396. }).then(() => {
  397. this.loading = true;
  398. this.$http.put(QUESTION_API + "/paper_storage/release/" + row.id).then(
  399. () => {
  400. this.$notify({
  401. message: "操作成功",
  402. type: "success",
  403. });
  404. this.selectedPaperIds = [];
  405. this.searchGenPaper();
  406. },
  407. (response) => {
  408. this.$notify({
  409. message: response.response.data.desc,
  410. type: "error",
  411. });
  412. this.loading = false;
  413. }
  414. );
  415. });
  416. },
  417. //查询所有课程
  418. getCourses(query) {
  419. if (query) {
  420. query = query.trim();
  421. }
  422. this.courseLoading = true;
  423. this.$http
  424. .get(QUESTION_API + "/course/query?name=" + query + "&enable=true")
  425. .then((response) => {
  426. this.courseList = response.data;
  427. this.courseLoading = false;
  428. });
  429. },
  430. removeItem() {
  431. sessionStorage.removeItem("gen_paper");
  432. sessionStorage.removeItem("gen_paper_currentPage");
  433. },
  434. cancel(formData) {
  435. this.resetForm2(formData);
  436. this.dialogModel = false;
  437. },
  438. resetForm2(formData) {
  439. this.printFrom.examId = "";
  440. this.$refs[formData].clearValidate();
  441. },
  442. initVue() {
  443. this.isClear = this.$route.params.isClear;
  444. if (this.isClear == 0 || !this.isClear) {
  445. this.removeItem();
  446. this.formSearch = {
  447. courseNo: "",
  448. courseName: "",
  449. level: "",
  450. name: "",
  451. };
  452. this.currentPage = 1;
  453. } else {
  454. this.formSearch = JSON.parse(sessionStorage.getItem("gen_paper"));
  455. this.currentPage =
  456. sessionStorage.getItem("gen_paper_currentPage") == null
  457. ? 1
  458. : parseInt(sessionStorage.getItem("gen_paper_currentPage"));
  459. }
  460. this.getCourses(this.formSearch.courseName);
  461. this.searchGenPaper();
  462. },
  463. },
  464. };
  465. </script>