index.vue 10.0 KB

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