index.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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: "updateTime",
  157. scope: "aTimeList",
  158. hidden: true,
  159. },
  160. {
  161. label: "创建时间",
  162. prop: "createTime",
  163. scope: "aTimeList",
  164. hidden: true,
  165. },
  166. {
  167. label: "发布状态",
  168. prop: "publishStatus",
  169. hidden: true,
  170. scope: "fabStatus",
  171. },
  172. ],
  173. tableData: [], //表单数据
  174. total: 0, //一共多少条
  175. };
  176. },
  177. mounted() {
  178. this.search();
  179. },
  180. activated() {
  181. this.search();
  182. },
  183. methods: {
  184. batchDel() {
  185. if (!this.$refs.tableList.allCheckData.length) {
  186. this.$message.warning("请勾选需要删除的章卷");
  187. return;
  188. }
  189. this.$confirm(
  190. `此操作将永久删除所勾选的${this.$refs.tableList.allCheckData.length}条章卷, 是否继续?`,
  191. "提示",
  192. {
  193. confirmButtonText: "确定",
  194. cancelButtonText: "取消",
  195. type: "warning",
  196. }
  197. )
  198. .then(() => {
  199. const ids = this.$refs.tableList.allCheckData.map(
  200. (item) => item.chapterExamId
  201. );
  202. chapterVolumeBatchDel({
  203. status: -1,
  204. ids,
  205. }).then((res) => {
  206. this.$message.success("批量删除成功");
  207. this.$refs.tableList.clearMoreActive();
  208. this.search(1);
  209. });
  210. })
  211. .catch(() => {});
  212. },
  213. editInfo(v) {
  214. this.addClick(v, 0);
  215. },
  216. search(int) {
  217. this.loading = true;
  218. if (int === 1) {
  219. this.formData.pageNum = 1;
  220. }
  221. if (int === 2) {
  222. this.formData = {
  223. status: "0,1",
  224. pageSize: 10,
  225. pageNum: 1,
  226. };
  227. }
  228. this.$api
  229. .inquirebankchapterList(this.formData)
  230. .then((res) => {
  231. this.tableData = res.rows;
  232. this.total = res.total;
  233. this.navText.index = res.total;
  234. })
  235. .finally(() => {
  236. this.loading = false;
  237. });
  238. },
  239. init() {
  240. this.search(2);
  241. },
  242. del(v) {
  243. this.$alert(
  244. "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
  245. "提示",
  246. {
  247. dangerouslyUseHTMLString: true,
  248. }
  249. )
  250. .then(() => {
  251. var data = {
  252. chapterExamId: v.chapterExamId,
  253. status: -1,
  254. };
  255. this.$api.editbankchapter(data).then((res) => {
  256. this.$message.success("删除成功");
  257. this.search();
  258. });
  259. })
  260. .catch(() => {
  261. this.$message({
  262. type: "info",
  263. message: "已取消删除",
  264. });
  265. });
  266. },
  267. addClick(v, int) {
  268. if (v === undefined) {
  269. this.$router.push({
  270. path: "chapterVolumeManagementAdd",
  271. });
  272. } else {
  273. const jump = () => {
  274. this.$store.dispatch("changechapterExamPage", null);
  275. this.$router.push({
  276. path: "chapterVolumeManagementEdit",
  277. query: {
  278. id: v.chapterExamId,
  279. },
  280. });
  281. };
  282. const statusPage = this.$store.state.tagsView.visitedViews.some(
  283. (item) => {
  284. return item.name == "ChapterVolumeManagementEdit";
  285. }
  286. );
  287. if (statusPage) {
  288. this.$store
  289. .dispatch("tagsView/delCachedView", {
  290. name: "ChapterVolumeManagementEdit",
  291. })
  292. .then((res) => {
  293. jump();
  294. });
  295. } else {
  296. jump();
  297. }
  298. }
  299. },
  300. handleSizeChange(v) {
  301. this.formData.pageSize = v;
  302. this.formData.pageNum = 1;
  303. this.search();
  304. },
  305. handleCurrentChange(v) {
  306. this.formData.pageNum = v;
  307. this.search();
  308. },
  309. },
  310. };
  311. </script>
  312. <style lang="less" scoped>
  313. /deep/.el-button {
  314. border-radius: 8px;
  315. }
  316. /deep/.el-dialog {
  317. border-radius: 8px;
  318. .el-dialog__header {
  319. padding: 0;
  320. .hearders {
  321. height: 40px;
  322. display: flex;
  323. align-items: center;
  324. justify-content: space-between;
  325. padding: 0px 18px 0px 20px;
  326. border-bottom: 1px solid #e2e2e2;
  327. .leftTitle {
  328. font-size: 14px;
  329. font-weight: bold;
  330. color: #2f4378;
  331. }
  332. .rightBoxs {
  333. display: flex;
  334. align-items: center;
  335. img {
  336. width: 14px;
  337. height: 14px;
  338. margin-left: 13px;
  339. cursor: pointer;
  340. }
  341. }
  342. }
  343. }
  344. .el-dialog__footer {
  345. padding: 0;
  346. .dialog-footer {
  347. padding: 0px 40px;
  348. height: 70px;
  349. border-top: 1px solid #e2e2e2;
  350. display: flex;
  351. align-items: center;
  352. justify-content: flex-end;
  353. }
  354. }
  355. }
  356. .imgBox {
  357. width: 100%;
  358. // height: 210px;
  359. border: 1px solid #e2e2e2;
  360. border-radius: 8px;
  361. padding: 8px 8px 3px;
  362. display: flex;
  363. flex-direction: column;
  364. align-items: center;
  365. .imgLabel {
  366. flex: 1;
  367. width: 100%;
  368. border: 1px dotted #e2e2e2;
  369. color: #999;
  370. font-size: 14px;
  371. cursor: pointer;
  372. border-radius: 8px;
  373. .msPhoto {
  374. display: flex;
  375. justify-content: center;
  376. align-items: center;
  377. max-width: 100%;
  378. max-height: 270px;
  379. img {
  380. max-width: 100%;
  381. max-height: 270px;
  382. }
  383. }
  384. .imgbbx {
  385. display: flex;
  386. flex-direction: column;
  387. align-items: center;
  388. justify-content: center;
  389. width: 100%;
  390. height: 100%;
  391. i {
  392. font-weight: bold;
  393. margin: 14px 0;
  394. font-size: 24px;
  395. }
  396. }
  397. }
  398. p {
  399. margin: 5px 0px;
  400. }
  401. }
  402. </style>