EditLessonTable2.vue 14 KB

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