index.vue 7.1 KB

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