finish.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. <template>
  2. <div class="context">
  3. <div class="panel">
  4. <h5>下课管理
  5. <!--<span class="current">{{current}}</span>-->
  6. </h5>
  7. </div>
  8. <div class="table">
  9. <el-table
  10. :data="tableData"
  11. border
  12. is-horizontal-resize
  13. :default-sort="{prop: 'date', order: 'descending'}"
  14. element-loading-background="rgba(0, 0, 0, 0.8)"
  15. class=""
  16. @selection-change="handleSelectionChange"
  17. >
  18. >
  19. <el-table-column
  20. type="index"
  21. label="序号"
  22. align="center"
  23. width="50">
  24. </el-table-column>
  25. <el-table-column
  26. prop="EndTime"
  27. label="下课时间"
  28. :formatter="filterFmtDate"
  29. >
  30. </el-table-column>
  31. <el-table-column
  32. prop="ClassName"
  33. label="课程"
  34. sortable
  35. >
  36. <template slot-scope="scope">
  37. <span class="lessonSpan"
  38. :style="{background:scope.row.ClassColor}">{{scope.row.ClassName}}</span>
  39. </template>
  40. </el-table-column>
  41. <el-table-column
  42. prop="ConsumeHour"
  43. label="消耗课时"
  44. sortable
  45. >
  46. </el-table-column>
  47. <el-table-column
  48. prop="OrderNum"
  49. label="实际预约人数"
  50. sortable
  51. >
  52. </el-table-column>
  53. <el-table-column
  54. prop="Status"
  55. label="操作"
  56. >
  57. <template slot-scope="scope">
  58. <el-button type="primary" round size="mini" @click="checkClassOverPrepare(scope.row)">
  59. 下课
  60. </el-button>
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64. <br>
  65. <el-pagination
  66. background
  67. :total="pageination.total"
  68. :page-size="pageination.pageItem"
  69. @current-change="pageChange"
  70. ></el-pagination>
  71. </div>
  72. </div>
  73. </template>
  74. <script>
  75. import Global from '../../Global.js'
  76. import {
  77. ClassPreFinishListQuery,
  78. ClassOverPrepare,
  79. } from "../../api/getApiRes";
  80. let qs = require('qs');
  81. export default {
  82. data() {
  83. return {
  84. dialogVisible: false,//其他dialog
  85. dialogFinishVisible: false,//确认下课dialog
  86. dialogLesson: false,//课时调整
  87. dialogGift: false,//赠送课时调整
  88. dialogExpTime: false,//有效期调整
  89. dialogLessonTable: false,//会员课程
  90. dialogTitle: '',
  91. current: getNowDate(),
  92. dialogValue: [],
  93. // panel 配置项目
  94. panel: {
  95. usercode: '',
  96. username: '',
  97. compname: '',
  98. keyword: '',
  99. USERCODE: '',
  100. endType: '',
  101. taskstatus: 99,
  102. draw: 1,
  103. start: 0,
  104. recordsTotal: 0,
  105. tableData: [],
  106. allTableData: [],
  107. limit: '10',
  108. multipleSort: false,
  109. loading: false,
  110. fileList: [],
  111. multipleSelection: [],
  112. detectedmac: '',
  113. options: [
  114. {value: 99, label: '全部'},
  115. {value: 1, label: '进行中'},
  116. {value: 2, label: '已完成'},
  117. ],
  118. endTypeOptions: [
  119. {value: 99, label: '全部'},
  120. {value: 30, label: '近一个月'},
  121. {value: 7, label: '近一周'},
  122. {value: 1, label: '当日'},
  123. ],
  124. time1: globalBt(),
  125. },
  126. multipleSelection: [],
  127. pageination: {
  128. pageItem: 10,
  129. pageoptions: pageOptions(),
  130. total: 100,
  131. pageIndex: 1,
  132. },
  133. form: {
  134. name: '',
  135. userCode: '',
  136. coach: '',
  137. coachOptions: [],
  138. shopId: '',
  139. memberType: 1,
  140. lesson: 1,
  141. gift: 1,
  142. btnType: 0,//0新建,1编辑编辑
  143. memo: '',
  144. expTime: '',
  145. dialogdata: [],//穿梭待选
  146. dialogValue: [],//穿梭已选
  147. },
  148. memberTypes: [
  149. {value: 1, label: '年会员'},
  150. {value: 2, label: '充值会员'},
  151. ],
  152. tableData: []
  153. }
  154. },
  155. mounted() {
  156. this.getTableQuery();
  157. },
  158. methods: {
  159. // 检测当前课是否处于可改变状态
  160. checkClassOverPrepare(row) {
  161. let that = this;
  162. let param = {
  163. token: localStorage.token,
  164. stdId: row.StdId,
  165. };
  166. let postdata = qs.stringify(param);
  167. ClassOverPrepare(postdata).then(res => {
  168. let json = res;
  169. if (json.Code == 0) {
  170. that.goFinish(row);
  171. } else {
  172. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  173. }
  174. })
  175. },
  176. goFinish(row) {
  177. this.$router.push({
  178. path: '/finishDetail', query: {
  179. id: row.StdId,
  180. classId: row.ClassId,
  181. ClassName:row.ClassName,
  182. BeginTime:row.BeginTime,
  183. }
  184. });
  185. },
  186. handleSelectionChange(val) {
  187. this.multipleSelection = val;
  188. },
  189. // 页面数据查询
  190. getTableQuery() {
  191. let that = this;
  192. that.loading = true;
  193. let param = {
  194. token: localStorage.token,
  195. tagname: that.panel.tagname,//标签名
  196. start: 1,//
  197. tableMax: 9999,//
  198. };
  199. let postdata = qs.stringify(param);
  200. ClassPreFinishListQuery(postdata).then(res => {
  201. let json = res;
  202. if (json.Code == 0) {
  203. that.loading = false;
  204. if (json.Rs) {
  205. that.allTableData = json.Rs;
  206. that.recordsTotal = json.Rs.length;
  207. } else {
  208. that.allTableData = [];
  209. that.recordsTotal = 0;
  210. }
  211. // 设置分页数据
  212. that.setPaginations();
  213. } else {
  214. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  215. }
  216. })
  217. },
  218. // 设置分页数据
  219. setPaginations() {
  220. // 分页属性
  221. let that = this;
  222. that.pageination.total = that.recordsTotal;
  223. // 默认分页
  224. that.tableData = that.allTableData.filter((item, index) => {
  225. return index < that.pageination.pageItem;
  226. });
  227. },
  228. // 每页显示数量
  229. handleSizeChange() {
  230. let that = this;
  231. that.tableData = that.allTableData.filter((item, index) => {
  232. return index < that.pageination.pageItem;
  233. });
  234. that.draw = that.pageination.pageItem;
  235. // that.getTableQuery();
  236. },
  237. // 翻页
  238. pageChange(pageIndex) {
  239. let that = this;
  240. // 获取当前页
  241. let index = that.pageination.pageItem * (pageIndex - 1);
  242. // 数据总数
  243. let nums = that.pageination.pageItem * pageIndex;
  244. // 容器
  245. let tables = [];
  246. for (var i = index; i < nums; i++) {
  247. if (that.allTableData[i]) {
  248. tables.push(that.allTableData[i])
  249. }
  250. this.tableData = tables;
  251. }
  252. that.start = index * that.draw;
  253. // that.getTableQuery();
  254. },
  255. // 过滤时间
  256. filterFmtDate(value, row, column) {
  257. let that = this;
  258. return nonTfmtDate(column, 11);
  259. },
  260. },
  261. watch: {
  262. $route(to) {
  263. if (to.name == 'finish') {
  264. this.getTableQuery();
  265. }
  266. },
  267. },
  268. }
  269. </script>
  270. <style scoped>
  271. @import "../../assets/css/panel.css";
  272. .context {
  273. /* height: 770px; */
  274. overflow-y: scroll;
  275. display: block;
  276. margin: 0 auto;
  277. background-color: #fff !important;
  278. padding: 30px;
  279. }
  280. .panel-body {
  281. padding: 20px;
  282. background: #F0F2F5;
  283. }
  284. .change {
  285. width: 100%;
  286. overflow: hidden;
  287. display: block;
  288. margin: 0 auto;
  289. padding-top: 10px;
  290. padding-bottom: 10px;
  291. }
  292. .change button {
  293. float: left;
  294. }
  295. .change button.pull-right {
  296. float: right;
  297. }
  298. .dialogTitle {
  299. width: 100%;
  300. overflow: hidden;
  301. display: block;
  302. margin: 0 auto;
  303. color: #000000;
  304. font-size: 18px;
  305. text-align: center;
  306. }
  307. .dialogTitle em {
  308. float: none;
  309. font-style: normal;
  310. color: #3799FF;
  311. margin: 0;
  312. }
  313. /deep/ .el-transfer-panel__item .el-checkbox__input {
  314. left: 40px;
  315. }
  316. .dialogFooter {
  317. width: 90%;
  318. overflow: hidden;
  319. display: block;
  320. margin: 0 auto;
  321. margin-top: 10px;
  322. }
  323. .dialogFooter button {
  324. float: right;
  325. margin-left: 10px;
  326. }
  327. .dialogContent {
  328. width: 100%;
  329. overflow: hidden;
  330. display: block;
  331. margin: 0 auto;
  332. }
  333. .dialogContent .pull-left {
  334. width: 30%;
  335. float: left;
  336. }
  337. .dialogContent .pull-right {
  338. width: 70%;
  339. float: right;
  340. }
  341. .blueTitle {
  342. width: 200px;
  343. overflow: hidden;
  344. display: block;
  345. margin: 0 auto;
  346. margin-top: 10px;
  347. margin-bottom: 40px;
  348. background: #F0F2F5;
  349. border-radius: 19px;
  350. text-align: center;
  351. color: #3799FF;
  352. font-size: 16px;
  353. padding: 5px 24px;
  354. }
  355. .current {
  356. width: 158px;
  357. height: 23px;
  358. /*float: left;*/
  359. border-radius: 250px;
  360. text-align: center;
  361. background: #F0F2F5;
  362. color: #545454;
  363. font-size: 14px;
  364. padding: 3px 10px;
  365. margin-left: 20px;
  366. }
  367. .lessonSpan {
  368. width: 78px;
  369. height: 22px;
  370. border-radius: 11px;
  371. margin-right: 5px;
  372. float: left;
  373. margin-bottom: 3px;
  374. text-align: center;
  375. color: #000;
  376. font-size: 12px;
  377. }
  378. </style>