index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <template>
  2. <div id="handoutList">
  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. >
  18. <template slot="btn" slot-scope="props">
  19. <el-button
  20. type="text"
  21. @click="addClick(props.scope.row, 0)"
  22. >修改</el-button
  23. >
  24. <el-button
  25. type="text"
  26. :disabled="props.scope.row['updateStatus'] === 0"
  27. @click="del(props.scope.row)"
  28. >删除</el-button
  29. >
  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. export default {
  46. name: "HandoutList",
  47. components: { searchBoxNew, tableList, pagination },
  48. data() {
  49. return {
  50. loading: false, //当前表单加载是否加载动画
  51. navText: {
  52. title: "讲义列表",
  53. index: 0,
  54. ch: "条",
  55. num: false,
  56. choice: true,
  57. addHide: false,
  58. backFatherBtn: {
  59. status: false,
  60. title: "未定义",
  61. },
  62. },
  63. //搜索
  64. formList: [
  65. {
  66. prop: "educationId",
  67. placeholder: "教育类型",
  68. scope: "educationType",
  69. },
  70. {
  71. prop: "businessId",
  72. placeholder: "业务层次",
  73. scope: "businessLevel",
  74. edu: "educationId",
  75. },
  76. {
  77. prop: "subjectId",
  78. placeholder: "科目",
  79. scope: "sujectType",
  80. edu: "educationId",
  81. },
  82. {
  83. prop: "status",
  84. placeholder: "发布状态",
  85. scope: "select",
  86. options: [
  87. {
  88. label: "全部状态",
  89. value: "0,1",
  90. },
  91. {
  92. label: "发布",
  93. value: 1,
  94. },
  95. {
  96. label: "未发布",
  97. value: 0,
  98. },
  99. ],
  100. },
  101. {
  102. prop: "handoutsName",
  103. placeholder: "请输入讲义名称",
  104. },
  105. ],
  106. formData: {
  107. status: "0,1",
  108. pageSize: 10,
  109. pageNum: 1,
  110. },
  111. // 表单
  112. tableSet: [
  113. {
  114. label: "讲义编码",
  115. prop: "encoder",
  116. hidden: true,
  117. width: "140px",
  118. },
  119. {
  120. label: "讲义标题",
  121. prop: "handoutsName",
  122. hidden: true,
  123. },
  124. {
  125. label: "适用业务层级",
  126. prop: "courseHandoutsBusinessVo",
  127. hidden: true,
  128. scope: "mapTypesMores",
  129. },
  130. {
  131. label: "是否可下载",
  132. prop: "canDownload",
  133. hidden: true,
  134. scope: "isOptions",
  135. width: "120px",
  136. options: [
  137. {
  138. label: "是",
  139. value: 1,
  140. },
  141. {
  142. label: "否",
  143. value: 0,
  144. },
  145. ],
  146. },
  147. {
  148. label: "状态",
  149. prop: "updateStatus",
  150. hidden: true,
  151. scope: "isOptions",
  152. width: "120px",
  153. options: [
  154. {
  155. label: "正常",
  156. value: 1,
  157. },
  158. {
  159. label: "修改中",
  160. value: 0,
  161. },
  162. ],
  163. },
  164. {
  165. label: "发布状态",
  166. prop: "status",
  167. hidden: true,
  168. scope: "fabStatus",
  169. width: "140px",
  170. },
  171. ],
  172. tableData: [], //表单数据
  173. total: 0, //一共多少条
  174. pageSize: 10, //每页多少条数据
  175. currentPage: 1, //当前页码
  176. };
  177. },
  178. mounted() {
  179. this.search();
  180. },
  181. activated() {
  182. this.search();
  183. },
  184. methods: {
  185. editInfo(v) {
  186. this.addClick(v, 0);
  187. },
  188. search(int) {
  189. this.loading = true;
  190. if (int === 1) {
  191. this.formData.pageNum = 1;
  192. }
  193. if (int === 2) {
  194. this.formData = {
  195. status: "0,1",
  196. pageSize: 10,
  197. pageNum: 1,
  198. };
  199. }
  200. this.$api
  201. .inquireCourseHandoutsList(this.formData)
  202. .then((res) => {
  203. this.tableData = res.rows;
  204. this.total = res.total;
  205. this.navText.index = res.total;
  206. })
  207. .finally(() => {
  208. this.loading = false;
  209. });
  210. },
  211. init() {
  212. this.search(2);
  213. },
  214. del(v) {
  215. this.$alert(
  216. "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
  217. "提示",
  218. {
  219. dangerouslyUseHTMLString: true,
  220. }
  221. )
  222. .then(() => {
  223. var data = {
  224. handoutsId: v.handoutsId,
  225. status: -1,
  226. };
  227. this.$api.editCourseHandouts(data).then((res) => {
  228. this.$message.success("删除成功");
  229. this.search();
  230. });
  231. })
  232. .catch(() => {
  233. this.$message({
  234. type: "info",
  235. message: "已取消删除",
  236. });
  237. });
  238. },
  239. addClick(v, int) {
  240. if (v === undefined) {
  241. this.$router.push({
  242. path: "handoutListAdd",
  243. });
  244. } else {
  245. const jump = () => {
  246. this.$router.push({
  247. path: "handoutListEdit",
  248. query: {
  249. id: v.handoutsId,
  250. },
  251. });
  252. };
  253. const statusPage = this.$store.state.tagsView.visitedViews.some(
  254. (item) => {
  255. return item.name == "HandoutListEdit";
  256. }
  257. );
  258. if (statusPage) {
  259. this.$store
  260. .dispatch("tagsView/delCachedView", {
  261. name: "HandoutListEdit",
  262. })
  263. .then((res) => {
  264. jump();
  265. });
  266. } else {
  267. jump();
  268. }
  269. }
  270. },
  271. handleSizeChange(v) {
  272. this.formData.pageSize = v;
  273. this.formData.pageNum = 1;
  274. this.search();
  275. },
  276. handleCurrentChange(v) {
  277. this.formData.pageNum = v;
  278. this.search();
  279. },
  280. },
  281. };
  282. </script>
  283. <style lang="less" scoped>
  284. /deep/.el-button {
  285. border-radius: 8px;
  286. }
  287. /deep/.el-dialog {
  288. border-radius: 8px;
  289. .el-dialog__header {
  290. padding: 0;
  291. .hearders {
  292. height: 40px;
  293. display: flex;
  294. align-items: center;
  295. justify-content: space-between;
  296. padding: 0px 18px 0px 20px;
  297. border-bottom: 1px solid #e2e2e2;
  298. .leftTitle {
  299. font-size: 14px;
  300. font-weight: bold;
  301. color: #2f4378;
  302. }
  303. .rightBoxs {
  304. display: flex;
  305. align-items: center;
  306. img {
  307. width: 14px;
  308. height: 14px;
  309. margin-left: 13px;
  310. cursor: pointer;
  311. }
  312. }
  313. }
  314. }
  315. .el-dialog__footer {
  316. padding: 0;
  317. .dialog-footer {
  318. padding: 0px 40px;
  319. height: 70px;
  320. border-top: 1px solid #e2e2e2;
  321. display: flex;
  322. align-items: center;
  323. justify-content: flex-end;
  324. }
  325. }
  326. }
  327. .imgBox {
  328. width: 100%;
  329. // height: 210px;
  330. border: 1px solid #e2e2e2;
  331. border-radius: 8px;
  332. padding: 8px 8px 3px;
  333. display: flex;
  334. flex-direction: column;
  335. align-items: center;
  336. .imgLabel {
  337. flex: 1;
  338. width: 100%;
  339. border: 1px dotted #e2e2e2;
  340. color: #999;
  341. font-size: 14px;
  342. cursor: pointer;
  343. border-radius: 8px;
  344. .msPhoto {
  345. display: flex;
  346. justify-content: center;
  347. align-items: center;
  348. max-width: 100%;
  349. max-height: 270px;
  350. img {
  351. max-width: 100%;
  352. max-height: 270px;
  353. }
  354. }
  355. .imgbbx {
  356. display: flex;
  357. flex-direction: column;
  358. align-items: center;
  359. justify-content: center;
  360. width: 100%;
  361. height: 100%;
  362. i {
  363. font-weight: bold;
  364. margin: 14px 0;
  365. font-size: 24px;
  366. }
  367. }
  368. }
  369. p {
  370. margin: 5px 0px;
  371. }
  372. }
  373. </style>