index.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <template>
  2. <div id="classList">
  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, 2)"
  20. >详情</el-button
  21. >
  22. <el-button type="text" @click="addClick(props.scope.row, 3)"
  23. >学员管理</el-button
  24. >
  25. <el-button type="text" @click="del(props.scope.row)">删除</el-button>
  26. </template>
  27. </table-list>
  28. <pagination
  29. :total="total"
  30. :pageSize="formData.pageSize"
  31. :currentPage="formData.pageNum"
  32. @handleSizeChange="handleSizeChange"
  33. @handleCurrentChange="handleCurrentChange"
  34. />
  35. </div>
  36. </template>
  37. <script>
  38. import searchBoxNew from "@/components/searchBoxNew";
  39. import tableList from "@/components/tableList";
  40. import pagination from "@/components/pagination";
  41. export default {
  42. components: { searchBoxNew, tableList, pagination },
  43. name: "ClassList",
  44. data() {
  45. return {
  46. loading: false, //当前表单加载是否加载动画
  47. navText: {
  48. border: true,
  49. title: "班级列表",
  50. index: 0,
  51. ch: "条",
  52. num: false,
  53. choice: true,
  54. addHide: false,
  55. backFatherBtn: {
  56. status: false,
  57. title: "未定义",
  58. },
  59. },
  60. //搜索
  61. formList: [
  62. {
  63. prop: "educationTypeId",
  64. placeholder: "教育类型",
  65. scope: "educationType",
  66. },
  67. {
  68. prop: "businessId",
  69. placeholder: "业务层次",
  70. scope: "businessLevel",
  71. edu: "educationTypeId",
  72. },
  73. {
  74. prop: "schoolId",
  75. placeholder: "院校",
  76. scope: "schoolList",
  77. edu: "educationTypeId",
  78. },
  79. {
  80. prop: "majorId",
  81. placeholder: "专业",
  82. scope: "Professional",
  83. edu: "educationTypeId",
  84. },
  85. {
  86. prop: "status",
  87. placeholder: "班级状态",
  88. scope: "select",
  89. options: [
  90. { label: "全部状态", value: "0,1" },
  91. { label: "无效", value: 0 },
  92. { label: "有效", value: 1 },
  93. ],
  94. },
  95. {
  96. prop1: "classStartTime",
  97. prop2: "classEndTime",
  98. placeholder1: "班级有效期开始时间",
  99. placeholder2: "班级有效期结束时间",
  100. scope: "moreDataPicker",
  101. },
  102. {
  103. prop: "className",
  104. placeholder: "请输入班级名称",
  105. },
  106. ],
  107. formData: {
  108. status: "0,1",
  109. pageSize: 10,
  110. pageNum: 1,
  111. },
  112. // 表单
  113. tableSet: [
  114. {
  115. label: "商品编码",
  116. prop: "code",
  117. objProp: "goodsList",
  118. hidden: true,
  119. scope: "objType",
  120. width: "130px",
  121. },
  122. {
  123. label: "年份",
  124. prop: "year",
  125. objProp: "goodsList",
  126. hidden: true,
  127. scope: "objType",
  128. },
  129. {
  130. label: "商品业务层级",
  131. prop1: "educationName",
  132. prop2: "projectName",
  133. prop3: "businessName",
  134. objProp: "goodsList",
  135. hidden: true,
  136. scope: "objTypeYW",
  137. width: "240px",
  138. },
  139. {
  140. label: "商品名称",
  141. prop: "goodsName",
  142. objProp: "goodsList",
  143. hidden: true,
  144. scope: "objType",
  145. width: "280px",
  146. },
  147. {
  148. label: "班级编码",
  149. prop: "gradeCode",
  150. hidden: true,
  151. width: "130px",
  152. },
  153. {
  154. label: "班级号",
  155. prop: "classStatus",
  156. prop1: "officialName",
  157. hidden: true,
  158. scope: "classTypes",
  159. width: "160px",
  160. },
  161. {
  162. label: "班级名称",
  163. prop: "className",
  164. hidden: true,
  165. scope: "editInfo",
  166. width: "280px",
  167. },
  168. {
  169. label: "学时",
  170. prop: "classHours",
  171. objProp: "goodsList",
  172. hidden: true,
  173. scope: "objType",
  174. },
  175. {
  176. label: "班主任",
  177. prop: "nickName",
  178. hidden: true,
  179. },
  180. {
  181. label: "班级人数",
  182. prop1: "studentNum",
  183. prop2: "studentUpper",
  184. hidden: true,
  185. scope: "peopleNums",
  186. },
  187. {
  188. label: "开放学习时间",
  189. prop: "learningStatus",
  190. prop1: "learningTimeStart",
  191. hidden: true,
  192. scope: "classTimeTypes",
  193. width: "120px",
  194. },
  195. {
  196. label: "班级状态",
  197. prop: "status",
  198. hidden: true,
  199. scope: "hasTime",
  200. },
  201. {
  202. label: "班级有效期",
  203. prop1: "classStartTime",
  204. prop2: "classEndTime",
  205. hidden: true,
  206. Diszing: false,
  207. scope: "TimeLists",
  208. width: "220px",
  209. },
  210. ],
  211. tableData: [], //表单数据
  212. total: 0, //一共多少条
  213. };
  214. },
  215. mounted() {
  216. this.search();
  217. },
  218. activated() {
  219. this.search();
  220. },
  221. methods: {
  222. editInfo(v) {
  223. this.addClick(v, 2);
  224. },
  225. search(int) {
  226. this.loading = true;
  227. if (int === 1) {
  228. this.formData.pageNum = 1;
  229. }
  230. if (int === 2) {
  231. this.formData = {
  232. status: "0,1",
  233. pageSize: 10,
  234. pageNum: 1,
  235. };
  236. }
  237. var data = JSON.parse(JSON.stringify(this.formData));
  238. if (this.formData.classStartTime) {
  239. data.classStartTime = data.classStartTime / 1000;
  240. }
  241. if (this.formData.classEndTime) {
  242. data.classEndTime = data.classEndTime / 1000;
  243. }
  244. this.$api
  245. .inquireGradegradeList(data)
  246. .then((res) => {
  247. this.tableData = res.rows;
  248. this.total = res.total;
  249. this.navText.index = res.total;
  250. })
  251. .finally(() => {
  252. this.loading = false;
  253. });
  254. },
  255. init() {
  256. this.search(2);
  257. },
  258. del(v) {
  259. this.$alert(
  260. "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
  261. "提示",
  262. {
  263. dangerouslyUseHTMLString: true,
  264. }
  265. )
  266. .then(() => {
  267. var data = {
  268. gradeId: v.gradeId,
  269. status: -1,
  270. };
  271. this.$api.editGradegrade(data).then((res) => {
  272. this.$message.success("删除成功");
  273. this.search();
  274. });
  275. })
  276. .catch(() => {
  277. this.$message({
  278. type: "info",
  279. message: "已取消删除",
  280. });
  281. });
  282. },
  283. addClick(v, int) {
  284. console.log(v);
  285. // int = 2详情 3学员管理
  286. if (v === undefined) {
  287. // 添加班级
  288. this.$router.push({
  289. path: "addClass",
  290. });
  291. } else {
  292. if (int === 2) {
  293. const jump = () => {
  294. //班级详情
  295. this.$router.push({
  296. path: "manageClass",
  297. query: {
  298. id: v.gradeId,
  299. },
  300. });
  301. };
  302. const statusPage = this.$store.state.tagsView.visitedViews.some(
  303. (item) => {
  304. return item.name == "ManageClass";
  305. }
  306. );
  307. if (statusPage) {
  308. this.$store
  309. .dispatch("tagsView/delCachedView", {
  310. name: "ManageClass",
  311. })
  312. .then((res) => {
  313. jump();
  314. });
  315. } else {
  316. jump();
  317. }
  318. }
  319. if (int === 3) {
  320. // 学员管理
  321. this.$router.push({
  322. path: "studentMenu",
  323. query: {
  324. id: v.gradeId,
  325. goodsId: v.goodsList[0].goodsId,
  326. },
  327. });
  328. }
  329. }
  330. },
  331. handleSizeChange(v) {
  332. this.formData.pageSize = v;
  333. this.formData.pageNum = 1;
  334. this.search();
  335. },
  336. handleCurrentChange(v) {
  337. this.formData.pageNum = v;
  338. this.search();
  339. },
  340. },
  341. };
  342. </script>
  343. <style lang="less" scoped>
  344. /deep/.el-button {
  345. border-radius: 8px;
  346. }
  347. /deep/.el-dialog {
  348. border-radius: 8px;
  349. .el-dialog__header {
  350. padding: 0;
  351. .hearders {
  352. height: 40px;
  353. display: flex;
  354. align-items: center;
  355. justify-content: space-between;
  356. padding: 0px 18px 0px 20px;
  357. border-bottom: 1px solid #e2e2e2;
  358. .leftTitle {
  359. font-size: 14px;
  360. font-weight: bold;
  361. color: #2f4378;
  362. }
  363. .rightBoxs {
  364. display: flex;
  365. align-items: center;
  366. img {
  367. width: 14px;
  368. height: 14px;
  369. margin-left: 13px;
  370. cursor: pointer;
  371. }
  372. }
  373. }
  374. }
  375. .el-dialog__footer {
  376. padding: 0;
  377. .dialog-footer {
  378. padding: 0px 40px;
  379. height: 70px;
  380. border-top: 1px solid #e2e2e2;
  381. display: flex;
  382. align-items: center;
  383. justify-content: flex-end;
  384. }
  385. }
  386. }
  387. .imgBox {
  388. width: 100%;
  389. // height: 210px;
  390. border: 1px solid #e2e2e2;
  391. border-radius: 8px;
  392. padding: 8px 8px 3px;
  393. display: flex;
  394. flex-direction: column;
  395. align-items: center;
  396. .imgLabel {
  397. flex: 1;
  398. width: 100%;
  399. border: 1px dotted #e2e2e2;
  400. color: #999;
  401. font-size: 14px;
  402. cursor: pointer;
  403. border-radius: 8px;
  404. .msPhoto {
  405. display: flex;
  406. justify-content: center;
  407. align-items: center;
  408. max-width: 100%;
  409. max-height: 270px;
  410. img {
  411. max-width: 100%;
  412. max-height: 270px;
  413. }
  414. }
  415. .imgbbx {
  416. display: flex;
  417. flex-direction: column;
  418. align-items: center;
  419. justify-content: center;
  420. width: 100%;
  421. height: 100%;
  422. i {
  423. font-weight: bold;
  424. margin: 14px 0;
  425. font-size: 24px;
  426. }
  427. }
  428. }
  429. p {
  430. margin: 5px 0px;
  431. }
  432. }
  433. </style>