index.vue 9.4 KB

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