EditLessonTable2.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. <template>
  2. <div class="context">
  3. <div class="panel">
  4. <h5>{{pageTitle}}</h5>
  5. </div>
  6. <div class="panel-body">
  7. <div class="panel_control">
  8. <el-row :gutter="20">
  9. <el-col :span="9">
  10. <em>课程表模板名称:</em>
  11. <el-input v-model="panel.name" placeholder="请输入课程表模板名称"></el-input>
  12. </el-col>
  13. </el-row>
  14. </div>
  15. </div>
  16. <br>
  17. <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  18. <el-tab-pane label="星期一" name="Monday"></el-tab-pane>
  19. <el-tab-pane label="星期二" name="Tuesday"></el-tab-pane>
  20. <el-tab-pane label="星期三" name="Wednesday"></el-tab-pane>
  21. <el-tab-pane label="星期四" name="Thursday"></el-tab-pane>
  22. <el-tab-pane label="星期五" name="Friday"></el-tab-pane>
  23. <el-tab-pane label="星期六" name="Saturday"></el-tab-pane>
  24. <el-tab-pane label="星期天" name="Sunday"></el-tab-pane>
  25. </el-tabs>
  26. <el-button class="seeTemp">预览模板</el-button>
  27. <div class="table">
  28. <el-table
  29. :data="tableData"
  30. border
  31. is-horizontal-resize
  32. :default-sort="{prop: 'date', order: 'descending'}"
  33. element-loading-background="rgba(0, 0, 0, 0.8)"
  34. class=""
  35. @selection-change="handleSelectionChange" @current-change="clickChange"
  36. >
  37. >
  38. <el-table-column
  39. prop="timeScope"
  40. label="时间"
  41. width="260px"
  42. align="center"
  43. >
  44. <template slot-scope="scope">
  45. <el-time-picker
  46. is-range
  47. v-model="scope.row.timeScope"
  48. range-separator="至"
  49. start-placeholder="开始时间"
  50. end-placeholder="结束时间"
  51. placeholder="选择时间范围">
  52. </el-time-picker>
  53. </template>
  54. </el-table-column>
  55. <el-table-column
  56. prop="name"
  57. label="课程"
  58. align="center"
  59. >
  60. <template slot-scope="scope">
  61. <el-select v-model="scope.row.vipType">
  62. <el-option
  63. v-for="item in panel.options"
  64. :key="item.value"
  65. :label="item.label"
  66. :value="item.value">
  67. </el-option>
  68. </el-select>
  69. </template>
  70. </el-table-column>
  71. <el-table-column
  72. prop="Recovered"
  73. label="预约名额"
  74. align="center"
  75. >
  76. <template slot-scope="scope">
  77. <el-input-number v-model="scope.row.Recovered" :min="1" :max="9999" label=""></el-input-number>
  78. </template>
  79. </el-table-column>
  80. <el-table-column
  81. prop="Recovered"
  82. label="消耗课时"
  83. align="center"
  84. >
  85. <template slot-scope="scope">
  86. <el-input-number v-model="scope.row.Recovered" :min="1" :max="9999" label=""></el-input-number>
  87. </template>
  88. </el-table-column>
  89. <el-table-column
  90. prop="Status"
  91. label="操作"
  92. width="100px"
  93. align="center"
  94. >
  95. <template slot-scope="scope">
  96. <el-button type="text" class="red">删除</el-button>
  97. </template>
  98. </el-table-column>
  99. </el-table>
  100. <div class="rowBottom">
  101. <el-button type="primary">新增课表</el-button>
  102. <el-button type="primary">提交</el-button>
  103. </div>
  104. </div>
  105. <br>
  106. <div v-show="true">
  107. <el-pagination :total="pageination.total" :page-size="pageination.pageItem"
  108. @current-change="pageChange"></el-pagination>
  109. </div>
  110. <el-dialog title="增删课程会员" :visible.sync="dialogVisible">
  111. <div class="dialogTitle">
  112. <span>基础功能</span>
  113. </div>
  114. <div>
  115. <el-transfer filterable v-model="dialogValue" :data="dialogdata"></el-transfer>
  116. </div>
  117. <div class="dialogFooter">
  118. <el-button type="primary" size="small">确定</el-button>
  119. <el-button @click="dialogVisible = false" size="small">取消</el-button>
  120. </div>
  121. </el-dialog>
  122. </div>
  123. </template>
  124. <script>
  125. import Global from '../Global.js'
  126. import {
  127. testTable,
  128. testTableLong,
  129. testSelect
  130. } from "../api/getApiRes";
  131. let qs = require('qs');
  132. export default {
  133. data() {
  134. return {
  135. pageTitle: '新增课程表模板',
  136. dialogVisible: false,
  137. dialogdata: [],
  138. dialogValue: [],
  139. temId: '',
  140. activeName: 'Monday',
  141. tableData: [],
  142. // panel 配置项目
  143. panel: {
  144. usercode: '',
  145. username: '',
  146. compname: '',
  147. keyword: '',
  148. USERCODE: '',
  149. taskstatus: 99,
  150. draw: 1,
  151. start: 0,
  152. recordsTotal: 0,
  153. tableData: [],
  154. allTableData: [],
  155. limit: '10',
  156. multipleSort: false,
  157. loading: false,
  158. fileList: [],
  159. multipleSelection: [],
  160. detectedmac: '',
  161. options: [
  162. {value: 99, label: '全部'},
  163. {value: 1, label: '进行中'},
  164. {value: 2, label: '已完成'},
  165. ],
  166. time1: globalBt(),
  167. },
  168. multipleSelection: [],
  169. pageination: {
  170. pageItem: 7,
  171. pageoptions: pageOptions(),
  172. total: 70,
  173. pageIndex: 1,
  174. },
  175. }
  176. },
  177. mounted() {
  178. this.getTableQuery();
  179. },
  180. methods: {
  181. handleClick() {
  182. },
  183. changeWechat(e, row) {
  184. // todo
  185. this.$message.success('当前用户微信已可见');
  186. },
  187. // 增删会员课程
  188. lessonStudenChange() {
  189. this.dialogVisible = true
  190. },
  191. handleSelectionChange(val) {
  192. this.multipleSelection = val;
  193. },
  194. // 页面数据查询
  195. getTableQuery() {
  196. let that = this;
  197. that.loading = true;
  198. let param = {
  199. token: localStorage.token,
  200. supregionid: 0,//
  201. };
  202. let postdata = qs.stringify(param);
  203. testTableLong(postdata).then(res => {
  204. let json = res;
  205. if (json.Code == 0) {
  206. that.loading = false;
  207. if (json.Rs) {
  208. that.allTableData = json.Rs;
  209. that.recordsTotal = json.Rs.length;
  210. } else {
  211. that.allTableData = [];
  212. that.recordsTotal = 0;
  213. }
  214. // 设置分页数据
  215. that.setPaginations();
  216. } else {
  217. that.$message.error(json.Memo);
  218. }
  219. })
  220. },
  221. // 设置分页数据
  222. setPaginations() {
  223. // 分页属性
  224. let that = this;
  225. that.pageination.total = that.recordsTotal;
  226. // 默认分页
  227. that.tableData = that.allTableData.filter((item, index) => {
  228. return index < that.pageination.pageItem;
  229. });
  230. },
  231. // 每页显示数量
  232. handleSizeChange() {
  233. let that = this;
  234. that.tableData = that.allTableData.filter((item, index) => {
  235. return index < that.pageination.pageItem;
  236. });
  237. that.draw = that.pageination.pageItem;
  238. that.getTableQuery();
  239. },
  240. // 翻页
  241. pageChange(pageIndex) {
  242. let that = this;
  243. // 获取当前页
  244. let index = that.pageination.pageItem * (pageIndex - 1);
  245. // 数据总数
  246. let nums = that.pageination.pageItem * pageIndex;
  247. // 容器
  248. let tables = [];
  249. for (var i = index; i < nums; i++) {
  250. if (that.allTableData[i]) {
  251. tables.push(that.allTableData[i])
  252. }
  253. this.tableData = tables;
  254. }
  255. that.start = index * that.draw;
  256. },
  257. // 自动排序
  258. sortChange(params) {
  259. console.log(params)
  260. },
  261. // 过滤时间
  262. filterFmtDate(value, row, column) {
  263. let that = this;
  264. return nonTfmtDate(column, 11);
  265. },
  266. },
  267. watch: {
  268. $route() {
  269. this.temId = this.$route.query.id
  270. },
  271. temId(e) {
  272. if (parseInt(e) == 0) {
  273. this.pageTitle = '新增课程表模板'
  274. } else {
  275. this.pageTitle = '编辑课程表模板'
  276. }
  277. },
  278. activeName(e) {
  279. switch (e) {
  280. case "Monday":
  281. this.pageChange(1);
  282. break;
  283. case "Tuesday":
  284. this.pageChange(2);
  285. break;
  286. case "Wednesday":
  287. this.pageChange(3);
  288. break;
  289. case "Thursday":
  290. this.pageChange(4);
  291. break;
  292. case "Friday":
  293. this.pageChange(5);
  294. break;
  295. case "Saturday":
  296. this.pageChange(6);
  297. break;
  298. case "Sunday":
  299. this.pageChange(7);
  300. break;
  301. }
  302. }
  303. },
  304. }
  305. </script>
  306. <style scoped>
  307. @import "../assets/css/panel.css";
  308. em {
  309. font-style: normal;
  310. }
  311. .context { height: 770px;
  312. overflow-y: scroll;
  313. display: block;
  314. margin: 0 auto;
  315. background-color: #fff !important;
  316. padding: 30px;
  317. }
  318. .panel-body {
  319. padding: 20px;
  320. background: #F0F2F5;
  321. }
  322. .change {
  323. width: 100%;
  324. overflow: hidden;
  325. display: block;
  326. margin: 0 auto;
  327. padding-top: 10px;
  328. padding-bottom: 10px;
  329. }
  330. .change button {
  331. float: left;
  332. }
  333. .change button.pull-right {
  334. float: right;
  335. }
  336. .dialogTitle {
  337. width: 100%;
  338. overflow: hidden;
  339. display: block;
  340. margin: 0 auto;
  341. color: #000000;
  342. font-size: 18px;
  343. text-align: center;
  344. }
  345. .dialogTitle span {
  346. width: 169px;
  347. height: 40px;
  348. line-height: 40px;
  349. text-align: center;
  350. color: #fff;
  351. background: #3799FF;
  352. border-radius: 250px;
  353. font-size: 18px;
  354. overflow: hidden;
  355. display: block;
  356. margin: 0 auto;
  357. margin-bottom: 30px;
  358. }
  359. .dialogTitle em {
  360. float: none;
  361. font-style: normal;
  362. color: #3799FF;
  363. margin: 0;
  364. }
  365. /deep/ .el-transfer-panel__item .el-checkbox__input {
  366. left: 40px;
  367. }
  368. .dialogFooter {
  369. width: 90%;
  370. overflow: hidden;
  371. display: block;
  372. margin: 0 auto;
  373. margin-top: 10px;
  374. }
  375. .dialogFooter button {
  376. float: right;
  377. margin-left: 10px;
  378. }
  379. /deep/ .panel_control .el-input {
  380. width: 200px;
  381. float: left;
  382. }
  383. .panel_control em {
  384. float: left;
  385. font-size: 14px;
  386. color: #545454;
  387. line-height: 45px;
  388. margin-right: 10px;
  389. }
  390. .seeTemp {
  391. position: relative;
  392. float: right;
  393. bottom: 60px;
  394. }
  395. .table {
  396. position: relative;
  397. top: -50px;
  398. }
  399. .el-range-editor.el-input__inner {
  400. width: 220px;
  401. padding: 3px 6px;
  402. }
  403. .rowBottom {
  404. width: 100%;
  405. overflow: hidden;
  406. display: block;
  407. margin: 0 auto;
  408. margin-top: 10px;
  409. }
  410. .rowBottom button {
  411. float: left;
  412. margin-right: 10px;
  413. }
  414. </style>