index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <template>
  2. <div id="chapterVolumeManagement">
  3. <search-box-new
  4. ref="searchBox"
  5. :formData="formData"
  6. :formList="formList"
  7. @search="search"
  8. @init="init"
  9. />
  10. <table-list
  11. :tableSets="tableSet"
  12. :tableData="tableData"
  13. :navText="navText"
  14. @addClick="addClick"
  15. :loading="loading"
  16. @editInfo="editInfo"
  17. ref="tableList"
  18. rowKey="chapterExamId"
  19. >
  20. <template slot="customize">
  21. <el-button size="medium" @click="batchDel" type="warning"
  22. >批量删除</el-button
  23. >
  24. </template>
  25. <template slot="btn" slot-scope="props">
  26. <el-button type="text" @click="addClick(props.scope.row, 0)"
  27. >修改</el-button
  28. >
  29. <el-button type="text" @click="del(props.scope.row)">删除</el-button>
  30. </template>
  31. </table-list>
  32. <pagination
  33. :total="total"
  34. :pageSize="formData.pageSize"
  35. :currentPage="formData.pageNum"
  36. @handleSizeChange="handleSizeChange"
  37. @handleCurrentChange="handleCurrentChange"
  38. />
  39. </div>
  40. </template>
  41. <script>
  42. import searchBoxNew from "@/components/searchBoxNew";
  43. import tableList from "@/components/tableList";
  44. import pagination from "@/components/pagination";
  45. import { chapterVolumeBatchDel } from "@/api/resource/volumeManagement";
  46. export default {
  47. components: { searchBoxNew, tableList, pagination },
  48. name: "ChapterVolumeManagement",
  49. data() {
  50. return {
  51. loading: false, //当前表单加载是否加载动画
  52. navText: {
  53. title: "章卷管理",
  54. index: 0,
  55. ch: "条",
  56. num: false,
  57. border: true,
  58. choice: true,
  59. addHide: false,
  60. openCheckMore: true,
  61. backFatherBtn: {
  62. status: false,
  63. title: "未定义",
  64. },
  65. },
  66. //搜索
  67. formList: [
  68. {
  69. prop: "educationId",
  70. placeholder: "教育类型",
  71. scope: "educationType",
  72. },
  73. {
  74. prop: "businessId",
  75. placeholder: "业务层次",
  76. scope: "businessLevel",
  77. edu: "educationId",
  78. },
  79. {
  80. prop: "subjectId",
  81. placeholder: "科目",
  82. scope: "sujectType",
  83. edu: "educationId",
  84. },
  85. {
  86. prop: "publishStatus",
  87. placeholder: "发布状态",
  88. scope: "select",
  89. options: [
  90. {
  91. label: "发布",
  92. value: 1,
  93. },
  94. {
  95. label: "未发布",
  96. value: 0,
  97. },
  98. ],
  99. },
  100. {
  101. prop: "prefixName",
  102. placeholder: "请输入标题前缀",
  103. },
  104. {
  105. prop: "name",
  106. placeholder: "请输入章卷标题",
  107. },
  108. ],
  109. formData: {
  110. status: "0,1",
  111. pageSize: 10,
  112. pageNum: 1,
  113. },
  114. // 表单
  115. tableSet: [
  116. {
  117. label: "章卷编码",
  118. prop: "code",
  119. hidden: false,
  120. },
  121. {
  122. label: "标题前缀",
  123. prop: "prefixName",
  124. hidden: false,
  125. },
  126. {
  127. label: "章卷标题",
  128. prop: "name",
  129. hidden: true,
  130. scope: "editInfo",
  131. },
  132. {
  133. label: "适用业务层级",
  134. prop1: "educationName",
  135. prop2: "projectName",
  136. prop3: "businessName",
  137. prop4: "subjectName",
  138. hidden: false,
  139. scope: "eduTypes",
  140. },
  141. {
  142. label: "关联商品",
  143. prop: "goodsList",
  144. prop1: "goodsName",
  145. hidden: false,
  146. scope: "aboutChapter",
  147. int: 7,
  148. },
  149. {
  150. label: "试卷总数",
  151. prop: "examNum",
  152. hidden: true,
  153. },
  154. {
  155. label: "题目总数",
  156. prop: "questionNum",
  157. hidden: true,
  158. },
  159. {
  160. label: "最后编辑时间",
  161. prop: "updateTime",
  162. scope: "aTimeList",
  163. hidden: true,
  164. },
  165. {
  166. label: "创建时间",
  167. prop: "createTime",
  168. scope: "aTimeList",
  169. hidden: true,
  170. },
  171. {
  172. label: "发布状态",
  173. prop: "publishStatus",
  174. hidden: true,
  175. scope: "fabStatus",
  176. },
  177. ],
  178. tableData: [], //表单数据
  179. total: 0, //一共多少条
  180. };
  181. },
  182. mounted() {
  183. this.search();
  184. },
  185. activated() {
  186. this.search();
  187. },
  188. methods: {
  189. batchDel() {
  190. if (!this.$refs.tableList.allCheckData.length) {
  191. this.$message.warning("请勾选需要删除的章卷");
  192. return;
  193. }
  194. this.$confirm(
  195. `此操作将永久删除所勾选的${this.$refs.tableList.allCheckData.length}条章卷, 是否继续?`,
  196. "提示",
  197. {
  198. confirmButtonText: "确定",
  199. cancelButtonText: "取消",
  200. type: "warning",
  201. }
  202. )
  203. .then(() => {
  204. const ids = this.$refs.tableList.allCheckData.map(
  205. (item) => item.chapterExamId
  206. );
  207. chapterVolumeBatchDel({
  208. status: -1,
  209. ids,
  210. }).then((res) => {
  211. this.$message.success("批量删除成功");
  212. this.$refs.tableList.clearMoreActive();
  213. this.search(1);
  214. });
  215. })
  216. .catch(() => {});
  217. },
  218. editInfo(v) {
  219. this.addClick(v, 0);
  220. },
  221. search(int) {
  222. this.loading = true;
  223. if (int === 1) {
  224. this.formData.pageNum = 1;
  225. }
  226. if (int === 2) {
  227. this.formData = {
  228. status: "0,1",
  229. pageSize: 10,
  230. pageNum: 1,
  231. };
  232. }
  233. this.$api
  234. .inquirebankchapterList(this.formData)
  235. .then((res) => {
  236. this.tableData = res.rows;
  237. this.total = res.total;
  238. this.navText.index = res.total;
  239. })
  240. .finally(() => {
  241. this.loading = false;
  242. });
  243. },
  244. init() {
  245. this.search(2);
  246. },
  247. del(v) {
  248. this.$alert(
  249. "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
  250. "提示",
  251. {
  252. dangerouslyUseHTMLString: true,
  253. }
  254. )
  255. .then(() => {
  256. var data = {
  257. chapterExamId: v.chapterExamId,
  258. status: -1,
  259. };
  260. this.$api.editbankchapter(data).then((res) => {
  261. this.$message.success("删除成功");
  262. this.search();
  263. });
  264. })
  265. .catch(() => {
  266. this.$message({
  267. type: "info",
  268. message: "已取消删除",
  269. });
  270. });
  271. },
  272. addClick(v, int) {
  273. if (v === undefined) {
  274. this.$router.push({
  275. path: "chapterVolumeManagementAdd",
  276. });
  277. } else {
  278. const jump = () => {
  279. this.$store.dispatch("changechapterExamPage", null);
  280. this.$router.push({
  281. path: "chapterVolumeManagementEdit",
  282. query: {
  283. id: v.chapterExamId,
  284. },
  285. });
  286. };
  287. const statusPage = this.$store.state.tagsView.visitedViews.some(
  288. (item) => {
  289. return item.name == "ChapterVolumeManagementEdit";
  290. }
  291. );
  292. if (statusPage) {
  293. this.$store
  294. .dispatch("tagsView/delCachedView", {
  295. name: "ChapterVolumeManagementEdit",
  296. })
  297. .then((res) => {
  298. jump();
  299. });
  300. } else {
  301. jump();
  302. }
  303. }
  304. },
  305. handleSizeChange(v) {
  306. this.formData.pageSize = v;
  307. this.formData.pageNum = 1;
  308. this.search();
  309. },
  310. handleCurrentChange(v) {
  311. this.formData.pageNum = v;
  312. this.search();
  313. },
  314. },
  315. };
  316. </script>
  317. <style lang="less" scoped>
  318. /deep/.el-button {
  319. border-radius: 8px;
  320. }
  321. /deep/.el-dialog {
  322. border-radius: 8px;
  323. .el-dialog__header {
  324. padding: 0;
  325. .hearders {
  326. height: 40px;
  327. display: flex;
  328. align-items: center;
  329. justify-content: space-between;
  330. padding: 0px 18px 0px 20px;
  331. border-bottom: 1px solid #e2e2e2;
  332. .leftTitle {
  333. font-size: 14px;
  334. font-weight: bold;
  335. color: #2f4378;
  336. }
  337. .rightBoxs {
  338. display: flex;
  339. align-items: center;
  340. img {
  341. width: 14px;
  342. height: 14px;
  343. margin-left: 13px;
  344. cursor: pointer;
  345. }
  346. }
  347. }
  348. }
  349. .el-dialog__footer {
  350. padding: 0;
  351. .dialog-footer {
  352. padding: 0px 40px;
  353. height: 70px;
  354. border-top: 1px solid #e2e2e2;
  355. display: flex;
  356. align-items: center;
  357. justify-content: flex-end;
  358. }
  359. }
  360. }
  361. .imgBox {
  362. width: 100%;
  363. // height: 210px;
  364. border: 1px solid #e2e2e2;
  365. border-radius: 8px;
  366. padding: 8px 8px 3px;
  367. display: flex;
  368. flex-direction: column;
  369. align-items: center;
  370. .imgLabel {
  371. flex: 1;
  372. width: 100%;
  373. border: 1px dotted #e2e2e2;
  374. color: #999;
  375. font-size: 14px;
  376. cursor: pointer;
  377. border-radius: 8px;
  378. .msPhoto {
  379. display: flex;
  380. justify-content: center;
  381. align-items: center;
  382. max-width: 100%;
  383. max-height: 270px;
  384. img {
  385. max-width: 100%;
  386. max-height: 270px;
  387. }
  388. }
  389. .imgbbx {
  390. display: flex;
  391. flex-direction: column;
  392. align-items: center;
  393. justify-content: center;
  394. width: 100%;
  395. height: 100%;
  396. i {
  397. font-weight: bold;
  398. margin: 14px 0;
  399. font-size: 24px;
  400. }
  401. }
  402. }
  403. p {
  404. margin: 5px 0px;
  405. }
  406. }
  407. </style>