courseEdit.vue 65 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624
  1. <template>
  2. <div class="context">
  3. <div class="panel">
  4. <div class="panel-body">
  5. <br>
  6. <el-page-header @back="goBack" content="课程管理">
  7. <br>
  8. </el-page-header>
  9. <span class="classNames">
  10. {{ title }} {{ ClassStateText }}
  11. </span>
  12. <br>
  13. <div class="panel_control">
  14. <el-row :gutter="20">
  15. <el-col :span="4">
  16. <em>会员名:</em>
  17. <el-input v-model="panel.name" placeholder="请输入会员名"></el-input>
  18. </el-col>
  19. <el-col :span="4">
  20. <em>手机号:</em>
  21. <el-input v-model="panel.phone" placeholder="请输入手机号" type="number"></el-input>
  22. </el-col>
  23. <el-col :span="4">
  24. <el-button size="" type="primary" @click="query" plain :disabled="serachBtnStatus"
  25. :loading="serachBtnStatus">查询
  26. </el-button>
  27. </el-col>
  28. </el-row>
  29. </div>
  30. </div>
  31. <div class="change">
  32. <el-button @click="confirmBegin" type="primary" :disabled="BeginState" :loading="BeginState"
  33. v-if="FinishClass == 3">确认上课
  34. </el-button>
  35. <el-button @click="confirmClose" type="danger" :disabled="!BeginState">关闭课程</el-button>
  36. <el-button @click="addFinish" type="primary" v-if="FinishClass == 2">确认下课</el-button>
  37. <el-button @click="addFinishMember">添加上课会员</el-button>
  38. <el-button @click="addTempMember" type="warning">添加临时会员</el-button>
  39. <el-button @click="addCrossMember" type="primary">添加跨店会员</el-button>
  40. </div>
  41. </div>
  42. <div class="table">
  43. <el-table
  44. :data="tableData"
  45. border
  46. is-horizontal-resize
  47. :default-sort="{prop: 'data', order: 'descending'}"
  48. element-loading-background="rgba(0, 0, 0, 0.8)"
  49. class=""
  50. :row-class-name="tableRowClassName"
  51. @selection-change="handleSelectionChange"
  52. >
  53. >
  54. <el-table-column
  55. type="index"
  56. label="排名"
  57. align="center"
  58. width="50">
  59. </el-table-column>
  60. <el-table-column
  61. prop="head"
  62. label="头像"
  63. width="75"
  64. align="center"
  65. sortable
  66. >
  67. <template slot-scope="scope">
  68. <div class="demo-image__preview" v-if="scope.row.Head">
  69. <el-image
  70. style="width: 25px; height: 25px"
  71. :src="scope.row.Head"
  72. :preview-src-list="[scope.row.Head]"
  73. >
  74. </el-image>
  75. </div>
  76. <img src="../assets/img/nav/head.png" alt="" v-else width="25px" height="25px">
  77. <!--<img class="head" :src="scope.row.Head" alt="" height="51" width="51" v-if="scope.row.Head">-->
  78. <!--<img class="head" src="../assets/img/nav/head.png" height="51" width="51" v-else/>-->
  79. </template>
  80. </el-table-column>
  81. <el-table-column
  82. prop="Name"
  83. label="会员名"
  84. width="90"
  85. sortable
  86. >
  87. </el-table-column>
  88. <el-table-column
  89. prop="Phone"
  90. label="手机号"
  91. width="120"
  92. sortable
  93. >
  94. </el-table-column>
  95. <el-table-column
  96. prop="ClassName"
  97. label="课程"
  98. width="110"
  99. sortable
  100. >
  101. <template slot-scope="scope">
  102. <span class="lessons"
  103. :style="{ background:scope.row.ClassColor }">{{ scope.row.ClassName }}</span>
  104. </template>
  105. </el-table-column>
  106. <el-table-column
  107. prop="OrderTime"
  108. label="预约时间"
  109. :formatter="filterFmtDate"
  110. sortable
  111. >
  112. </el-table-column>
  113. <el-table-column
  114. prop="RemainTotalhour"
  115. label="剩余课时"
  116. width="110"
  117. sortable
  118. >
  119. </el-table-column>
  120. <el-table-column
  121. prop="group_no"
  122. label="队伍"
  123. width="140"
  124. v-if="ClassType == 2"
  125. sortable
  126. >
  127. <template slot-scope="scope">
  128. <!--正式会员-->
  129. <div v-if="scope.row.IsTmpUser != 1">
  130. <el-select v-model="scope.row.group_no"
  131. filterable
  132. :disabled="FinishClass == 2 && scope.row.DpId != 0"
  133. placeholder="请选团队">
  134. <el-option
  135. v-for="item in panel.groupList"
  136. :key="item.value"
  137. :label="item.label"
  138. :value="item.value">
  139. </el-option>
  140. </el-select>
  141. </div>
  142. <div v-if="scope.row.IsTmpUser == 1">
  143. <el-select v-model="scope.row.group_no"
  144. filterable
  145. :disabled="FinishClass == 2 && scope.row.HrSubmitFlag == 1"
  146. placeholder="请选团队">
  147. <el-option
  148. v-for="item in panel.groupList"
  149. :key="item.value"
  150. :label="item.label"
  151. :value="item.value">
  152. </el-option>
  153. </el-select>
  154. </div>
  155. </template>
  156. </el-table-column>
  157. <el-table-column
  158. prop="BindId"
  159. label="心率带"
  160. sortable
  161. >
  162. <template slot-scope="scope">
  163. <div v-if="scope.row.IsTmpUser != 1">
  164. <el-select v-model="scope.row.BindId"
  165. @change="bindSensorToUser(scope.row)"
  166. @focus="getSelectHrSensors(scope.row)"
  167. :disabled="scope.row.isOnline == 1"
  168. filterable
  169. v-if="!scope.row.BindId" placeholder="请选心率带">
  170. <el-option
  171. v-for="item in panel.bindList"
  172. :key="item.index"
  173. :label="item.label"
  174. :value="item.HrId">
  175. <!--私有的-->
  176. <span v-if="item.HrType == 1" style="background: #409eff;color: #fff">
  177. {{ item.label }}
  178. </span>
  179. <!--共有的-->
  180. <span v-else>
  181. {{ item.label }}
  182. </span>
  183. </el-option>
  184. </el-select>
  185. <el-button @click="takeBack(scope.row)" :type="scope.row.IsPrivate == 1 ?'primary':'danger'"
  186. v-if="scope.row.BindId"
  187. :disabled="scope.row.isOnline == 1"
  188. icon="el-icon-cpu">
  189. {{ scope.row.Sn }} {{scope.row.IsPrivate == 1 ? '私有':''}}
  190. 设备收回
  191. </el-button>
  192. </div>
  193. <div v-if="scope.row.IsTmpUser == 1">
  194. <!--临时会员-->
  195. <el-select v-model="scope.row.BindId"
  196. @change="bindSensorToTmepUser(scope.row)"
  197. @focus="getSelectHrSensors(scope.row)"
  198. :disabled="scope.row.isOnline == 1"
  199. filterable
  200. v-if="!scope.row.Sn" placeholder="请选心率带">
  201. <el-option
  202. v-for="item in panel.bindList"
  203. :key="item.index"
  204. :label="item.label"
  205. :value="item.HrId">
  206. </el-option>
  207. </el-select>
  208. <el-button @click="takeTempBack(scope.row)" type="danger" v-if="scope.row.Sn"
  209. :disabled="scope.row.isOnline == 1"
  210. icon="el-icon-cpu">
  211. {{ scope.row.Sn }}
  212. 临时设备收回
  213. </el-button>
  214. </div>
  215. </template>
  216. </el-table-column>
  217. <el-table-column
  218. prop="isOnline"
  219. label="是否网课"
  220. type="selection"
  221. width="120"
  222. sortable
  223. >
  224. <!--<template slot-scope="scope">-->
  225. <!--<el-checkbox label="网课" v-model="scope.row.isOnline" name="type"-->
  226. <!--@change="showOrDiss(scope.row)"></el-checkbox>-->
  227. <!--</template>-->
  228. </el-table-column>
  229. <el-table-column
  230. prop="Status"
  231. label="状态"
  232. width="110"
  233. sortable
  234. >
  235. <template slot-scope="scope">
  236. <span v-if="scope.row.Status == 1">预约上课 </span>
  237. <span v-if="scope.row.Status == 2">预约未到</span>
  238. <span v-if="scope.row.Status == 3">上课未预约</span>
  239. </template>
  240. </el-table-column>
  241. <el-table-column
  242. prop="Status"
  243. label="操作"
  244. >
  245. <template slot-scope="scope">
  246. <div v-if="scope.row.DpId <= 0">
  247. <el-button type="primary" round v-if="scope.row.Status == 1 " size="mini"
  248. @click="pauseRow(scope.row,2)">
  249. 预约未到
  250. </el-button>
  251. <el-button type="warning" round v-if="scope.row.Status == 2" size="mini"
  252. @click="pauseRow(scope.row,1)">
  253. 上课
  254. </el-button>
  255. <el-button type="danger" round v-if="scope.row.Status == 3" size="mini"
  256. @click="getClassOverDetailDel(scope.row)">
  257. 删除
  258. </el-button>
  259. <em v-if="FinishClass != 3">
  260. <el-button type="warning" round
  261. v-if="scope.row.Status == 1 || scope.row.Status == 3 && FinishClass == 2 "
  262. size="mini"
  263. :disabled="scope.row.HrSubmitFlag == 1"
  264. @click="getClassDetailAndSnAdd(scope.row)">
  265. 提交
  266. </el-button>
  267. </em>
  268. </div>
  269. <div v-if=" scope.row.IsTmpUser == 1">
  270. <el-button type="danger" round v-if="scope.row.Status == 3 && scope.row.HrSubmitFlag != 1 "
  271. size="mini"
  272. @click="getClassOverTempDel(scope.row)">
  273. 删除
  274. </el-button>
  275. <span v-if="FinishClass != 3 && scope.row.IsTmpUser == 1">
  276. <el-button type="warning" round
  277. v-if="scope.row.Status == 1 || scope.row.Status == 3 && FinishClass == 2 "
  278. size="mini"
  279. :disabled="scope.row.HrSubmitFlag == 1"
  280. @click="getClassDetailAndSnAdd(scope.row)">
  281. 提交
  282. </el-button>
  283. </span>
  284. </div>
  285. </template>
  286. </el-table-column>
  287. </el-table>
  288. <br>
  289. <el-pagination
  290. background
  291. :total="pageination.total"
  292. :page-size="pageination.pageItem"
  293. @current-change="pageChange"
  294. ></el-pagination>
  295. </div>
  296. <!--添加上课会员-->
  297. <el-dialog title="添加上课会员" :visible.sync="dialogVisible" width="720px">
  298. <div class="dialogContent viplist">
  299. <span class="blueTitle">{{ ClassName }} {{ BeginTime }}</span>
  300. <div>
  301. <el-transfer filterable v-model="dialogValue" :data="form.dialogdata"
  302. :titles="['会员列表', '已添加会员']"></el-transfer>
  303. </div>
  304. </div>
  305. <div class="dialogFooter">
  306. <el-button type="primary" size="small" :disabled="BtnConfirmMember" :loading="BtnConfirmMember"
  307. @click="confirmMember">确定
  308. </el-button>
  309. <el-button size="small" @click="dialogVisible = false">取消</el-button>
  310. </div>
  311. </el-dialog>
  312. <!--添加临时会员-->
  313. <el-dialog title="添加临时会员" :visible.sync="dialogTempVisible" width="720px">
  314. <div class="dialogContent viplist">
  315. <span class="blueTitle">{{ ClassName }} {{ BeginTime }}</span>
  316. <div>
  317. <el-transfer filterable v-model="dialogTempValue" :data="form.dialogTempdata"
  318. :titles="['临时会员', '已添加会员']"></el-transfer>
  319. </div>
  320. </div>
  321. <div class="dialogFooter">
  322. <el-button type="primary" size="small" :disabled="BtnTempConfirmMember" :loading="BtnTempConfirmMember"
  323. @click="TempconfirmMember">确定
  324. </el-button>
  325. <el-button size="small" @click="dialogTempVisible = false">取消</el-button>
  326. </div>
  327. </el-dialog>
  328. <!--添加跨店会员-->
  329. <el-dialog title="添加跨店会员" :visible.sync="dialogAcrossVisible" width="720px">
  330. <div class="dialogContent viplist">
  331. <span class="blueTitle">{{ ClassName }} {{ BeginTime }}</span>
  332. <div>
  333. <el-transfer filterable v-model="dialogAcrossValue" :data="form.dialogAcrossdata"
  334. :titles="['跨店会员', '已添加会员']"></el-transfer>
  335. </div>
  336. </div>
  337. <div class="dialogFooter">
  338. <el-button type="primary" size="small" :disabled="BtnAcrossConfirmMember"
  339. :loading="BtnAcrossConfirmMember"
  340. @click="AcrossConfirmMember">确定
  341. </el-button>
  342. <el-button size="small" @click="dialogAcrossVisible = false">取消</el-button>
  343. </div>
  344. </el-dialog>
  345. <el-dialog title="确认下课" :visible.sync="dialogFinishVisible" width="650px">
  346. <div class="dialogContent">
  347. <span class="blueTitle">{{ ClassName }} {{ BeginTime }}</span>
  348. <div>
  349. <!--<el-transfer filterable v-model="dialogCoachValue" :data="form.dialogCoachdata"-->
  350. <!--:titles="['教练列表', '已添加教练']"></el-transfer>-->
  351. <p>
  352. 您是否确认下课?
  353. <br>
  354. <br>
  355. (确定后将不可再编辑上课学员的信息)
  356. </p>
  357. <br>
  358. </div>
  359. </div>
  360. <div class="dialogFooter">
  361. <el-button type="primary" size="small" :disabled="BtnConfirmClassFinish"
  362. :loading="BtnConfirmClassFinish" @click="confirmClassFinish">确定
  363. </el-button>
  364. <el-button size="small" @click="dialogFinishVisible = false">取消</el-button>
  365. </div>
  366. </el-dialog>
  367. </div>
  368. </template>
  369. <script>
  370. import Global from '../Global.js'
  371. import {
  372. ClassDetailQuery,
  373. ClassOverDetailListQuery,
  374. VipUserSimpleQuery,
  375. ClassOverDetailAdd,
  376. ClassDetailAndSnAdd,
  377. ClassOverDetailStatusEdit,
  378. ClassOverDetailDel,
  379. SelectHrSensors,
  380. BindHrSensorsToUser,
  381. UnBindHrSensorsToUser,
  382. ClassStartConfirm,
  383. ShopManagerListQuery,
  384. ClassOverConfirm,
  385. TmpUserQuery,
  386. ClassOverTmpDetailAdd,
  387. ClassTmpUserOverDetailDel,
  388. BindHrSensorsToTempUser,
  389. AcrossUserSimpleQuery, ClassGiveUpConfirm,
  390. } from "../api/getApiRes";
  391. let qs = require('qs');
  392. export default {
  393. data() {
  394. return {
  395. serachBtnStatus: false,
  396. BtnConfirmClassFinish: false,
  397. BtnConfirmMember: false,
  398. BtnTempConfirmMember: false,
  399. BtnAcrossConfirmMember: false,
  400. BeginState: true,//确认上课
  401. tableData: [],
  402. title: '',
  403. ClassType: 0,
  404. PkNum: 0,
  405. ClassStateText: '',
  406. FinishClass: 0,//当前上课状态 1已下课 2已上课 3准备上课 FinishClass
  407. dialogVisible: false,//添加下课会员
  408. dialogTempVisible: false,//添加临时会员
  409. dialogAcrossVisible: false,//
  410. dialogFinishVisible: false,//确认下课dialog
  411. dialogLesson: false,//课时调整
  412. dialogGift: false,//赠送课时调整
  413. dialogExpTime: false,//有效期调整
  414. dialogLessonTable: false,//会员课程
  415. dialogTitle: '新增会员',
  416. current: getNowDate(),
  417. dialogValue: [],
  418. dialogTempValue: [],
  419. dialogCoachValue: [],
  420. dialogAcrossValue: [],
  421. BeginTime: '',
  422. ClassName: '',
  423. // panel 配置项目
  424. panel: {
  425. name: '',
  426. phone: '',
  427. usercode: '',
  428. username: '',
  429. compname: '',
  430. keyword: '',
  431. USERCODE: '',
  432. endType: '',
  433. taskstatus: 99,
  434. draw: 1,
  435. start: 0,
  436. recordsTotal: 0,
  437. tableData: [],
  438. allTableData: [],
  439. limit: '10',
  440. multipleSort: false,
  441. loading: false,
  442. fileList: [],
  443. bindList: [
  444. {
  445. value: 0,
  446. HrId: 0,
  447. label: "请选择心率带",
  448. InVenueNo: 0,
  449. index: 0
  450. }
  451. ],
  452. groupList: [
  453. {label: '红队', value: 1},
  454. {label: '蓝队', value: 2},
  455. {label: '黄队', value: 3}
  456. ],
  457. multipleSelection: [],
  458. detectedmac: '',
  459. BeginTime: '',
  460. ClassName: '',
  461. options: [
  462. {value: 99, label: '全部'},
  463. {value: 1, label: '进行中'},
  464. {value: 2, label: '已完成'},
  465. ],
  466. endTypeOptions: [
  467. {value: 99, label: '全部'},
  468. {value: 30, label: '近一个月'},
  469. {value: 7, label: '近一周'},
  470. {value: 1, label: '当日'},
  471. ],
  472. time1: globalBt(),
  473. },
  474. form: {
  475. name: '',
  476. userCode: '',
  477. coach: '',
  478. coachOptions: [],
  479. shopId: '',
  480. memberType: 1,
  481. lesson: 1,
  482. gift: 1,
  483. btnType: 0,//0新建,1编辑编辑
  484. memo: '',
  485. expTime: '',
  486. dialogdata: [],//穿梭待选
  487. dialogTempdata: [],//穿梭待选
  488. dialogValue: [],//穿梭已选
  489. dialogCoachdata: [],//穿梭已选
  490. dialogAcrossdata: [],//穿梭已选
  491. },
  492. memberTypes: [
  493. {value: 1, label: '年会员'},
  494. {value: 2, label: '充值会员'},
  495. ],
  496. pageination: {
  497. pageItem: 100,
  498. pageoptions: pageOptions(),
  499. total: 100,
  500. pageIndex: 1,
  501. },
  502. }
  503. },
  504. mounted() {
  505. this.getTableQuery();
  506. // this.getSelectHrSensors();
  507. this.ClassType = this.$route.query.ClassType;
  508. this.PkNum = this.$route.query.PkNum;
  509. this.FinishClass = this.$route.query.FinishClass;
  510. this.title = this.$route.query.ClassName + ' ' + this.$route.query.BeginStr + '-' + this.$route.query.EndStr;
  511. },
  512. methods: {
  513. // 禁用或启用绑定心率带
  514. showOrDiss(row) {
  515. // console.log(row);
  516. // if (row.isOnline == 1) {
  517. // row.isOnline = 0
  518. // } else {
  519. // row.isOnline = 1
  520. // }
  521. },
  522. handleSelectionChange(val) {
  523. let row = '';
  524. for (let t in this.tableData) {
  525. this.tableData[t].isOnline = 0;
  526. }
  527. for (let v in val) {
  528. val[v].isOnline = 1;
  529. }
  530. },
  531. // 请选心率带
  532. bindSensorToUser(row) {
  533. let that = this;
  534. let obj = {};
  535. // 未到用户不能绑心率带
  536. if (row.Status == 2) {
  537. row.BindId = 0;
  538. that.$message.error("会员未到不能绑定心率带");
  539. return false
  540. }
  541. obj = this.panel.bindList.find((item) => {
  542. return item.HrId === row.BindId;
  543. });
  544. // let oldSn = row.BindId == 0 ? row.Sn : '';
  545. let oldSn = "";
  546. let param = {
  547. token: localStorage.token,
  548. shopId: localStorage.shopId,
  549. cfId: row.CfId,
  550. userId: row.UserId,
  551. sn: obj.Sn,
  552. hrId: row.BindId,
  553. };
  554. let postdata = qs.stringify(param);
  555. BindHrSensorsToUser(postdata).then(res => {
  556. let json = res;
  557. if (json.Code == 0) {
  558. that.$message({
  559. showClose: true,
  560. message: '心率带绑定成功!',
  561. type: 'success'
  562. });
  563. // table 重载
  564. that.getTableQuery();
  565. // 重置心率带可选列表
  566. // that.getSelectHrSensors();
  567. } else {
  568. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  569. }
  570. })
  571. },
  572. // 临时会员绑定心率带
  573. bindSensorToTmepUser(row) {
  574. let that = this;
  575. let obj = {};
  576. obj = this.panel.bindList.find((item) => {
  577. return item.HrId === row.BindId;
  578. });
  579. // let oldSn = row.BindId == 0 ? row.Sn : '';
  580. let param = {
  581. token: localStorage.token,
  582. sn: obj.Sn,
  583. cfId: row.CfId,
  584. userId: row.UserId,
  585. shopId: localStorage.shopId,
  586. hrId: row.BindId,
  587. };
  588. let postdata = qs.stringify(param);
  589. BindHrSensorsToTempUser(postdata).then(res => {
  590. let json = res;
  591. if (json.Code == 0) {
  592. that.$message({
  593. showClose: true,
  594. message: '临时会员心率带绑定成功!',
  595. type: 'success'
  596. });
  597. // table 重载
  598. that.getTableQuery();
  599. // 重置心率带可选列表
  600. // that.getSelectHrSensors();
  601. } else {
  602. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  603. }
  604. })
  605. },
  606. // 设备回收
  607. takeBack(row) {
  608. let that = this;
  609. let text = "";
  610. if (this.$route.query.FinishClass == 2) {
  611. text = '当前上课种是否回收用户' + row.Name + '的心率设备?(回收将重置用户的上课成绩)'
  612. } else {
  613. text = '是否回收用户' + row.Name + '的心率设备?'
  614. }
  615. this.$confirm(text, '回收操作', {
  616. confirmButtonText: '确定',
  617. cancelButtonText: '取消',
  618. type: 'warning'
  619. }).then(() => {
  620. let param = {
  621. token: localStorage.token,
  622. cfId: row.CfId,
  623. bindId: row.BindId,
  624. userId: row.UserId,
  625. sn: row.Sn,
  626. };
  627. let postdata = qs.stringify(param);
  628. UnBindHrSensorsToUser(postdata).then(res => {
  629. let json = res;
  630. if (json.Code == 0) {
  631. that.$message({
  632. showClose: true,
  633. message: '心率带' + row.Sn + '回收成功!',
  634. type: 'success'
  635. });
  636. // table 重载
  637. that.getTableQuery();
  638. // 重置心率带可选列表
  639. // that.getSelectHrSensors();
  640. } else {
  641. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  642. }
  643. })
  644. }).catch(() => {
  645. this.$message({
  646. type: 'info',
  647. message: '已取消回收'
  648. });
  649. });
  650. },
  651. takeTempBack(row) {
  652. let that = this;
  653. if (this.FinishClass == 2) {
  654. that.$message.error('请删除临时会员后重新添加');
  655. } else {
  656. that.$message.error('临时会员无法替换心率带');
  657. }
  658. // let that = this;
  659. // let text = "";
  660. // if (this.$route.query.FinishClass == 2) {
  661. // text = '当前上课种是否回收用户' + row.Name + '的心率设备?(回收将重置用户的上课成绩)'
  662. // } else {
  663. // text = '是否回收用户' + row.Name + '的心率设备?'
  664. // }
  665. // this.$confirm(text, '回收操作', {
  666. // confirmButtonText: '确定',
  667. // cancelButtonText: '取消',
  668. // type: 'warning'
  669. // }).then(() => {
  670. // let param = {
  671. // token: localStorage.token,
  672. // cfId: row.CfId,
  673. // bindId: row.BindId,
  674. // userId: row.UserId,
  675. // sn: row.Sn,
  676. // };
  677. // let postdata = qs.stringify(param);
  678. // UnBindHrSensorsToUser(postdata).then(res => {
  679. // let json = res;
  680. // if (json.Code == 0) {
  681. // that.$message({
  682. // showClose: true,
  683. // message: '心率带' + row.Sn + '回收成功!',
  684. // type: 'success'
  685. // });
  686. // // table 重载
  687. // that.getTableQuery();
  688. // // 重置心率带可选列表
  689. // // that.getSelectHrSensors();
  690. // } else {
  691. // that.$message.error(json.Memo + ' 错误码:' + json.Code);
  692. // }
  693. // })
  694. // }).catch(() => {
  695. // this.$message({
  696. // type: 'info',
  697. // message: '已取消回收'
  698. // });
  699. // });
  700. },
  701. // 确认下课
  702. addFinish() {
  703. this.clearForm();
  704. // 重新获得教练名单
  705. this.getCoachOption();
  706. this.dialogFinishVisible = true;
  707. this.btnType = 0;
  708. this.dialogTitle = '确认下课'
  709. },
  710. // 获取教练选项
  711. getCoachOption() {
  712. let that = this;
  713. let param = {
  714. token: localStorage.token,
  715. name: this.panel.name,//
  716. phone: this.panel.phone,//
  717. shopId: localStorage.ShopId,//
  718. adminType: 4,//
  719. start: 1,//
  720. tableMax: 299,//
  721. };
  722. let postdata = qs.stringify(param);
  723. ShopManagerListQuery(postdata).then(res => {
  724. let json = res;
  725. if (json.Code == 0) {
  726. that.form.dialogCoachdata = turnResToOptionByUsers(json.Rs);
  727. } else {
  728. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  729. }
  730. })
  731. },
  732. // 确认下课
  733. confirmClassFinish() {
  734. this.BtnConfirmClassFinish = true;
  735. let that = this;
  736. // checkNum
  737. let userlist = that.dialogCoachValue.toString();
  738. let param = {
  739. token: localStorage.token,
  740. stdId: this.$route.query.StdId,
  741. teacherList: userlist
  742. };
  743. let postdata = qs.stringify(param);
  744. // 下课记录详情添加
  745. ClassOverConfirm(postdata).then(res => {
  746. that.BtnConfirmClassFinish = false;
  747. let json = res;
  748. if (json.Code == 0) {
  749. // 关闭弹窗
  750. that.dialogFinishVisible = false;
  751. // 重载列表
  752. that.getTableQuery();
  753. that.$message({
  754. showClose: true,
  755. message: '当前课程已确认下课!',
  756. type: 'success'
  757. });
  758. // 返回下课列表
  759. // that.$router.push({path: '/finish'});
  760. this.$router.go(-1);
  761. } else {
  762. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  763. }
  764. })
  765. },
  766. // 确认上课
  767. confirmBegin() {
  768. let that = this;
  769. // 没绑心率带不能开课,预约未到的不管他
  770. for (var i = 0; i < this.tableData.length; i++) {
  771. console.log(this.tableData[i].isOnline);
  772. if (this.tableData[i].Sn == 0 && this.tableData[i].Status != 2 && this.tableData[i].isOnline != 1) {
  773. that.$message.error("会员" + this.tableData[i].Name + '没绑心率带,不能开课');
  774. return false
  775. }
  776. }
  777. let duRs = [];
  778. // "sn":"10001",//心率带
  779. // "group_no":0,// 0不分队 1蓝队 2红队 3黄队
  780. // "begin_time":1605686788,//开始上课时间戳
  781. // "name":"张三",
  782. // "head":"http://192.168.0.2/lhs.png",
  783. // "static_hr":100,
  784. // "sex":1,//性别
  785. // "height":176,
  786. // "age":40,
  787. // "user_id":50,
  788. // "weight":1000
  789. let row;
  790. let begin_time = parseInt(new Date().valueOf() / 1000);
  791. // 过滤未到会员
  792. let curPeolle = this.tableData.filter(item => {
  793. if (item.Status != 2) {
  794. return item
  795. }
  796. });
  797. // 拼装上课人员信息
  798. for (var i = 0; i < curPeolle.length; i++) {
  799. row = curPeolle[i];
  800. // 过滤预约未到
  801. duRs[i] = {
  802. sn: row.Sn,
  803. group_no: row.group_no,//0不分队 1蓝队 2红队 3黄队
  804. begin_time: begin_time,
  805. name: row.Name,
  806. head: row.Head,
  807. static_hr: row.StaticHr,
  808. sex: row.Sex,
  809. height: row.Height,
  810. age: row.Age,
  811. user_id: row.UserId,
  812. weight: row.Weight,
  813. user_md5: row.UserMd5,
  814. birthday: row.Birthday,
  815. is_tmp_user: row.IsTmpUser,
  816. is_private: row.IsPrivate,
  817. isOnline: row.isOnline,
  818. }
  819. }
  820. // 确认上课
  821. this.getClassStartConfirm(duRs);
  822. },
  823. // 确认上课
  824. getClassStartConfirm(duRs) {
  825. duRs = '{"Rs":' + JSON.stringify(duRs).toString() + '}';
  826. let that = this;
  827. that.BeginState = true;
  828. let param = {
  829. token: localStorage.token,
  830. stdId: this.$route.query.StdId,
  831. duRs: duRs
  832. };
  833. let postdata = qs.stringify(param);
  834. ClassStartConfirm(postdata).then(res => {
  835. let json = res;
  836. that.BeginState = false;
  837. if (json.Code == 0) {
  838. that.$message({
  839. showClose: true,
  840. message: '确认上课成功!',
  841. type: 'success'
  842. });
  843. // 返回课程管理
  844. that.$router.push({
  845. path: '/courses', query: {}
  846. });
  847. // that.FinishClass = 2;
  848. // that.getTableQuery();
  849. } else {
  850. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  851. }
  852. })
  853. },
  854. //关闭课程
  855. confirmClose() {
  856. this.$confirm('您确认要关闭课程?', '提示', {
  857. confirmButtonText: '确定',
  858. cancelButtonText: '取消',
  859. type: 'warning'
  860. }).then(() => {
  861. this.getConfirmClassClose()
  862. }).catch(() => {
  863. this.$message({
  864. type: 'info',
  865. message: '已取消'
  866. });
  867. });
  868. },
  869. //确认执行关闭课程
  870. getConfirmClassClose() {
  871. let that = this;
  872. let param = {
  873. token: localStorage.token,
  874. stdId: this.$route.query.StdId,
  875. };
  876. let postdata = qs.stringify(param);
  877. ClassGiveUpConfirm(postdata).then(res => {
  878. let json = res;
  879. if (json.Code == 0) {
  880. that.$message({
  881. showClose: true,
  882. message: '课程关闭成功!',
  883. type: 'success'
  884. });
  885. // 返回课程管理
  886. that.$router.push({
  887. path: '/courses', query: {}
  888. });
  889. } else {
  890. that.$message({
  891. showClose: true,
  892. message: '课程关闭失败',
  893. type: 'success'
  894. });
  895. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  896. }
  897. })
  898. },
  899. // 添加下课会员
  900. addFinishMember() {
  901. let that = this;
  902. this.clearForm();
  903. this.getClassVipuserQuery();
  904. this.dialogValue = [];
  905. // 遍历已添加的上课会员,回填穿梭框
  906. let std = [];
  907. if (this.tableData) {
  908. this.tableData.map(function (item) {
  909. if (item.IsTmpUser != 1) {
  910. std.push(item.UserId)
  911. }
  912. })
  913. }
  914. that.dialogValue = std;
  915. this.dialogVisible = true
  916. },
  917. // 获取临时会员列表
  918. getTmpUserQuery() {
  919. let that = this;
  920. let param = {
  921. token: localStorage.token,
  922. start: 1,
  923. tableMax: 999,
  924. };
  925. let postdata = qs.stringify(param);
  926. TmpUserQuery(postdata).then(res => {
  927. let json = res;
  928. if (json.Code == 0) {
  929. that.form.dialogTempdata = turnResToOptionByTempUser(json.Rs);
  930. } else {
  931. that.$message.error(json.Memo);
  932. }
  933. })
  934. },
  935. // 获取跨店会员列表
  936. getAcrossUserQuery() {
  937. let that = this;
  938. let param = {
  939. token: localStorage.token,
  940. start: 1,
  941. tableMax: 999,
  942. };
  943. let postdata = qs.stringify(param);
  944. AcrossUserSimpleQuery(postdata).then(res => {
  945. let json = res;
  946. if (json.Code == 0) {
  947. that.form.dialogAcrossdata = turnResToOptionBySimViper(json.Rs);
  948. } else {
  949. that.$message.error(json.Memo);
  950. }
  951. })
  952. },
  953. // 添加临时会员
  954. addTempMember() {
  955. let that = this;
  956. this.clearForm();
  957. // this.getClassVipuserQuery();
  958. this.getTmpUserQuery();
  959. this.dialogTempValue = [];
  960. let std = [];
  961. if (this.tableData) {
  962. this.tableData.map(function (item) {
  963. if (item.IsTmpUser == 1) {
  964. std.push(item.UserId)
  965. }
  966. })
  967. }
  968. that.dialogTempValue = std;
  969. this.dialogTempVisible = true
  970. },
  971. // 添加跨店会员
  972. addCrossMember() {
  973. let that = this;
  974. this.clearForm();
  975. this.getAcrossUserQuery();
  976. this.dialogAcrossValue = [];
  977. let std = [];
  978. if (this.tableData) {
  979. this.tableData.map(function (item) {
  980. std.push(item.UserId)
  981. })
  982. }
  983. that.dialogAcrossValue = std;
  984. this.dialogAcrossVisible = true
  985. },
  986. clearForm() {
  987. // clear
  988. this.form.name = '';
  989. this.form.userCode = '';
  990. this.form.shopId = '';
  991. this.dialogCoachValue = [];
  992. },
  993. // 获取本课程下的会员列表
  994. getClassVipuserQuery() {
  995. let that = this;
  996. let param = {
  997. token: localStorage.token,
  998. // classId: this.$route.query.classId,
  999. };
  1000. let postdata = qs.stringify(param);
  1001. // ClassVipuserQuery(postdata).then(res => {
  1002. VipUserSimpleQuery(postdata).then(res => {
  1003. let json = res;
  1004. if (json.Code == 0) {
  1005. // that.form.dialogdata = turnResToOptionByViper(json.Rs);
  1006. that.form.dialogdata = turnResToOptionBySimViper(json.Rs);
  1007. } else {
  1008. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  1009. }
  1010. })
  1011. },
  1012. // 确认提交上课会员
  1013. confirmMember() {
  1014. let that = this;
  1015. if (that.BtnConfirmMember == true) return false;
  1016. that.BtnConfirmMember = true;
  1017. // checkNum
  1018. let userlist = that.dialogValue.toString();
  1019. let param = {
  1020. token: localStorage.token,
  1021. stdId: this.$route.query.StdId,
  1022. userlist: userlist
  1023. };
  1024. let postdata = qs.stringify(param);
  1025. // 下课记录详情添加
  1026. ClassOverDetailAdd(postdata).then(res => {
  1027. let json = res;
  1028. if (json.Code == 0) {
  1029. // 关闭弹窗
  1030. that.dialogVisible = false;
  1031. // 重载列表
  1032. that.getTableQuery();
  1033. that.$message({
  1034. showClose: true,
  1035. message: '会员添加成功!',
  1036. type: 'success'
  1037. });
  1038. that.BtnConfirmMember = false;
  1039. } else {
  1040. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  1041. that.BtnConfirmMember = false;
  1042. }
  1043. })
  1044. }, // 确认提交临时会员
  1045. TempconfirmMember() {
  1046. let that = this;
  1047. if (that.BtnTempConfirmMember == true) return false;
  1048. that.BtnTempConfirmMember = true;
  1049. // checkNum
  1050. let userlist = that.dialogTempValue.toString();
  1051. let param = {
  1052. token: localStorage.token,
  1053. stdId: this.$route.query.StdId,
  1054. tmpuserlist: userlist
  1055. };
  1056. let postdata = qs.stringify(param);
  1057. // 下课记录详情添加
  1058. ClassOverTmpDetailAdd(postdata).then(res => {
  1059. let json = res;
  1060. if (json.Code == 0) {
  1061. // 关闭弹窗
  1062. that.dialogTempVisible = false;
  1063. // 重载列表
  1064. that.getTableQuery();
  1065. that.$message({
  1066. showClose: true,
  1067. message: '会员添加成功!',
  1068. type: 'success'
  1069. });
  1070. that.BtnTempConfirmMember = false;
  1071. } else {
  1072. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  1073. that.BtnTempConfirmMember = false;
  1074. }
  1075. })
  1076. },
  1077. // 确认提交跨店会员
  1078. AcrossConfirmMember() {
  1079. let that = this;
  1080. if (that.BtnAcrossConfirmMember == true) return false;
  1081. that.BtnAcrossConfirmMember = true;
  1082. // checkNum
  1083. let userlist = that.dialogAcrossValue.toString();
  1084. let param = {
  1085. token: localStorage.token,
  1086. stdId: this.$route.query.StdId,
  1087. userlist: userlist
  1088. };
  1089. let postdata = qs.stringify(param);
  1090. // 下课记录详情添加
  1091. ClassOverDetailAdd(postdata).then(res => {
  1092. let json = res;
  1093. if (json.Code == 0) {
  1094. // 关闭弹窗
  1095. that.dialogAcrossVisible = false;
  1096. // 重载列表
  1097. that.getTableQuery();
  1098. that.$message({
  1099. showClose: true,
  1100. message: '会员添加成功!',
  1101. type: 'success'
  1102. });
  1103. that.BtnAcrossConfirmMember = false;
  1104. } else {
  1105. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  1106. that.BtnAcrossConfirmMember = false;
  1107. }
  1108. })
  1109. },
  1110. pauseRow(row, status) {
  1111. let that = this;
  1112. let param = {
  1113. token: localStorage.token,
  1114. stdId: this.$route.query.StdId,
  1115. cfId: row.CfId,
  1116. status: status,
  1117. };
  1118. let postdata = qs.stringify(param);
  1119. ClassOverDetailStatusEdit(postdata).then(res => {
  1120. let json = res;
  1121. if (json.Code == 0) {
  1122. that.$message({
  1123. showClose: true,
  1124. message: '执行成功!',
  1125. type: 'success'
  1126. });
  1127. // table 重载
  1128. that.getTableQuery();
  1129. } else {
  1130. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  1131. }
  1132. })
  1133. },
  1134. // 下课记录详情删除
  1135. getClassOverDetailDel(row) {
  1136. let that = this;
  1137. let param = {
  1138. token: localStorage.token,
  1139. stdId: row.StdId,
  1140. cfId: row.CfId,
  1141. };
  1142. this.$confirm('是否删除用户 ' + row.Name + '?', '提示', {
  1143. confirmButtonText: '确定',
  1144. cancelButtonText: '取消',
  1145. type: 'warning'
  1146. }).then(() => {
  1147. let postdata = qs.stringify(param);
  1148. ClassOverDetailDel(postdata).then(res => {
  1149. let json = res;
  1150. if (json.Code == 0) {
  1151. that.$message({
  1152. showClose: true,
  1153. message: '当前学生上课记录已删除!',
  1154. type: 'success'
  1155. });
  1156. that.getTableQuery();
  1157. } else {
  1158. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  1159. }
  1160. })
  1161. }).catch(() => {
  1162. this.$message({
  1163. type: 'info',
  1164. message: '已取消删除'
  1165. });
  1166. });
  1167. },
  1168. // 下课记录临时会员删除
  1169. getClassOverTempDel(row) {
  1170. let that = this;
  1171. let param = {
  1172. token: localStorage.token,
  1173. stdId: row.StdId,
  1174. tcfId: row.CfId,
  1175. };
  1176. this.$confirm('是否删除临时会员 ' + row.Name + '?', '提示', {
  1177. confirmButtonText: '确定',
  1178. cancelButtonText: '取消',
  1179. type: 'warning'
  1180. }).then(() => {
  1181. let postdata = qs.stringify(param);
  1182. ClassTmpUserOverDetailDel(postdata).then(res => {
  1183. let json = res;
  1184. if (json.Code == 0) {
  1185. that.$message({
  1186. showClose: true,
  1187. message: '当前临时会员上课记录已删除!',
  1188. type: 'success'
  1189. });
  1190. that.getTableQuery();
  1191. } else {
  1192. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  1193. }
  1194. })
  1195. }).catch(() => {
  1196. this.$message({
  1197. type: 'info',
  1198. message: '已取消删除'
  1199. });
  1200. });
  1201. },
  1202. // 查询按钮
  1203. query() {
  1204. let that = this;
  1205. that.serachBtnStatus = true;
  1206. let totalTime = 2;
  1207. let clock = window.setInterval(() => {
  1208. totalTime--;
  1209. if (totalTime < 0) {
  1210. totalTime = 2;
  1211. that.serachBtnStatus = false;
  1212. }
  1213. }, 1000);
  1214. this.getTableQuery();
  1215. this.$message.success('查询完毕');
  1216. },
  1217. goBack() {
  1218. this.$router.push({
  1219. path: '/courses', query: {}
  1220. });
  1221. },
  1222. // 页面数据查询
  1223. getTableQuery() {
  1224. let that = this;
  1225. that.loading = true;
  1226. that.BeginState = true;
  1227. let param = {
  1228. token: localStorage.token,
  1229. stdId: this.$route.query.StdId,
  1230. start: 1,//
  1231. tableMax: 9999,//
  1232. };
  1233. let postdata = qs.stringify(param);
  1234. ClassOverDetailListQuery(postdata).then(res => {
  1235. let json = res;
  1236. if (json.Code == 0) {
  1237. that.loading = false;
  1238. if (json.Rs) {
  1239. // 没人不允许开课
  1240. if (json.Rs.length > 0) {
  1241. // 全部预约 都是未到也不允许开课
  1242. json.Rs.map(function (item) {
  1243. // 只要有一个不是就放开
  1244. if (item.Status != 2) {
  1245. that.BeginState = false;
  1246. }
  1247. });
  1248. }
  1249. // 分队处理
  1250. // 未上课的分队,已上课的旧的不处理,新人需要处理
  1251. if (that.FinishClass == 3) {
  1252. if (that.ClassType == 2) {
  1253. that.TurnUnit(json.Rs);
  1254. } else {
  1255. json.Rs.map(function (item) {
  1256. item.group_no = item.GroupNo;
  1257. })
  1258. }
  1259. } else {
  1260. // 已上课的状态
  1261. json.Rs.map(function (item, i) {
  1262. if (that.ClassType == 2) {
  1263. if (item.GroupNo == 0) {
  1264. item.group_no = i % that.PkNum + 1;
  1265. } else {
  1266. item.group_no = item.GroupNo;
  1267. }
  1268. } else {
  1269. item.group_no = item.GroupNo;
  1270. }
  1271. });
  1272. }
  1273. that.allTableData = json.Rs;
  1274. that.recordsTotal = json.Rs.length;
  1275. } else {
  1276. that.allTableData = [];
  1277. that.recordsTotal = 0;
  1278. }
  1279. // 设置分页数据
  1280. that.setPaginations();
  1281. } else {
  1282. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  1283. }
  1284. })
  1285. },
  1286. // 分队
  1287. TurnUnit(Rs) {
  1288. let that = this;
  1289. // 分拆2队
  1290. if (that.PkNum == 2) {
  1291. Rs.map(function (item, t) {
  1292. item.group_no = t % 2 + 1;
  1293. })
  1294. }
  1295. // 分拆3队
  1296. if (that.PkNum == 3) {
  1297. Rs.map(function (item, t) {
  1298. item.group_no = t % 3 + 1;
  1299. })
  1300. }
  1301. },
  1302. // 获取心率带下拉菜单
  1303. getSelectHrSensors(row) {
  1304. let that = this;
  1305. that.loading = true;
  1306. let param = {
  1307. token: localStorage.token,
  1308. shopId: localStorage.shopId,
  1309. userId: row.UserId,
  1310. };
  1311. let postdata = qs.stringify(param);
  1312. SelectHrSensors(postdata).then(res => {
  1313. let json = res;
  1314. if (json.Code == 0) {
  1315. that.loading = false;
  1316. if (json.Rs) {
  1317. that.panel.bindList = json.Rs;
  1318. let HrTypeText = "";
  1319. json.Rs.map(function (item, i) {
  1320. HrTypeText = item.HrType == 1 ? "(私有)" : "";
  1321. item.label = "Sn:" + item.Sn + HrTypeText;
  1322. item.index = i + 1;
  1323. });
  1324. that.panel.bindList.push({
  1325. value: 0,
  1326. HrId: 0,
  1327. label: "请选择心率带",
  1328. InVenueNo: 0
  1329. });
  1330. } else {
  1331. that.panel.bindList = [];
  1332. }
  1333. } else {
  1334. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  1335. }
  1336. })
  1337. },
  1338. // 设置分页数据
  1339. setPaginations() {
  1340. // 分页属性
  1341. let that = this;
  1342. that.pageination.total = that.recordsTotal;
  1343. // 默认分页
  1344. that.tableData = that.allTableData.filter((item, index) => {
  1345. return index < that.pageination.pageItem;
  1346. });
  1347. },
  1348. // 每页显示数量
  1349. handleSizeChange() {
  1350. let that = this;
  1351. that.tableData = that.allTableData.filter((item, index) => {
  1352. return index < that.pageination.pageItem;
  1353. });
  1354. that.draw = that.pageination.pageItem;
  1355. // that.getTableQuery();
  1356. },
  1357. // 翻页
  1358. pageChange(pageIndex) {
  1359. let that = this;
  1360. // 获取当前页
  1361. let index = that.pageination.pageItem * (pageIndex - 1);
  1362. // 数据总数
  1363. let nums = that.pageination.pageItem * pageIndex;
  1364. // 容器
  1365. let tables = [];
  1366. for (var i = index; i < nums; i++) {
  1367. if (that.allTableData[i]) {
  1368. tables.push(that.allTableData[i])
  1369. }
  1370. this.tableData = tables;
  1371. }
  1372. that.start = index * that.draw;
  1373. // that.getTableQuery();
  1374. },
  1375. // 过滤时间
  1376. filterFmtDate(value, row, column) {
  1377. let that = this;
  1378. if (column == "0001-01-01T08:05:43+08:05" || column == "0001-01-01T00:00:00Z") {
  1379. return '未预约';
  1380. } else {
  1381. return nonTfmtDate(column, 11);
  1382. }
  1383. },
  1384. // 提交单人
  1385. getClassDetailAndSnAdd(row) {
  1386. let begin_time = parseInt(new Date().valueOf() / 1000);
  1387. let duRs = [];
  1388. if (!row.Sn && row.isOnline == 0) {
  1389. this.$message.error(row.Name + '没有绑定心率带');
  1390. return false
  1391. }
  1392. // 拼装上课人员信息
  1393. duRs[0] = {
  1394. sn: row.Sn,
  1395. group_no: row.group_no,//0不分队 1蓝队 2红队 3黄队
  1396. begin_time: begin_time,
  1397. name: row.Name,
  1398. head: row.Head,
  1399. static_hr: row.StaticHr,
  1400. sex: row.Sex,
  1401. height: row.Height,
  1402. age: row.Age,
  1403. user_id: row.UserId,
  1404. weight: row.Weight,
  1405. user_md5: row.UserMd5,
  1406. birthday: row.Birthday,
  1407. is_tmp_user: row.IsTmpUser,
  1408. is_private: row.IsPrivate,
  1409. isOnline: row.isOnline,
  1410. };
  1411. duRs = '{"Rs":' + JSON.stringify(duRs).toString() + '}';
  1412. let that = this;
  1413. let param = {
  1414. token: localStorage.token,
  1415. stdId: this.$route.query.StdId,
  1416. duRs: duRs
  1417. };
  1418. let postdata = qs.stringify(param);
  1419. ClassDetailAndSnAdd(postdata).then(res => {
  1420. let json = res;
  1421. if (json.Code == 0) {
  1422. that.$message({
  1423. showClose: true,
  1424. message: '提交成功!',
  1425. type: 'success'
  1426. });
  1427. this.getTableQuery();
  1428. } else {
  1429. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  1430. }
  1431. })
  1432. },
  1433. tableRowClassName({row, rowIndex}) {
  1434. if (row.group_no == 1) {
  1435. return 'red-row';
  1436. } else if (row.group_no == 2) {
  1437. return 'blue-row';
  1438. } else if (row.group_no == 3) {
  1439. return 'yellow-row';
  1440. }
  1441. return '';
  1442. }
  1443. },
  1444. watch: {
  1445. $route(to) {
  1446. if (to.name == 'courseEdit') {
  1447. this.getTableQuery();
  1448. this.FinishClass = this.$route.query.FinishClass;
  1449. this.ClassType = this.$route.query.ClassType;
  1450. this.PkNum = this.$route.query.PkNum;
  1451. this.title = this.$route.query.ClassName + ' ' + this.$route.query.BeginStr + '-' + this.$route.query.EndStr;
  1452. }
  1453. },
  1454. FinishClass(to) {
  1455. switch (parseInt(to)) {
  1456. case 1:
  1457. this.ClassStateText = "已下课";
  1458. break;
  1459. case 2:
  1460. this.ClassStateText = "已上课";
  1461. break;
  1462. case 3:
  1463. this.ClassStateText = "准备上课";
  1464. break;
  1465. }
  1466. },
  1467. PkNum(to) {
  1468. let that = this;
  1469. if (to == 2) {
  1470. that.panel.groupList = [
  1471. {label: '红队', value: 1},
  1472. {label: '蓝队', value: 2},
  1473. ]
  1474. } else {
  1475. that.panel.groupList = [
  1476. {label: '红队', value: 1},
  1477. {label: '蓝队', value: 2},
  1478. {label: '黄队', value: 3}
  1479. ]
  1480. }
  1481. }
  1482. },
  1483. }
  1484. </script>
  1485. <style scoped>
  1486. @import "../assets/css/panel.css";
  1487. .context {
  1488. height: 770px;
  1489. overflow-y: scroll;
  1490. display: block;
  1491. margin: 0 auto;
  1492. background-color: #fff !important;
  1493. padding: 30px;
  1494. }
  1495. .classNames {
  1496. height: 25px;
  1497. background: #f0f2f5;
  1498. font-family: "Source Han Sans CN";
  1499. font-weight: normal;
  1500. font-size: 16px;
  1501. color: #3799ff;
  1502. border-radius: 250px;
  1503. text-align: center;
  1504. margin-top: 15px;
  1505. margin-bottom: 3px;
  1506. float: left;
  1507. padding-left: 10px;
  1508. padding-right: 10px;
  1509. }
  1510. .head {
  1511. overflow: hidden;
  1512. display: block;
  1513. margin: 0 auto;
  1514. border-radius: 250px;
  1515. }
  1516. .panel_control {
  1517. width: 100%;
  1518. overflow: hidden;
  1519. display: block;
  1520. margin: 0 auto;
  1521. }
  1522. /*.panel-body {*/
  1523. .panel_control {
  1524. padding: 20px;
  1525. background: #F0F2F5;
  1526. }
  1527. .change {
  1528. width: 100%;
  1529. overflow: hidden;
  1530. display: block;
  1531. margin: 0 auto;
  1532. padding-top: 10px;
  1533. padding-bottom: 10px;
  1534. }
  1535. .change button {
  1536. float: left;
  1537. }
  1538. .change button.pull-right {
  1539. float: right;
  1540. }
  1541. .lessons {
  1542. padding: 1px 7px;
  1543. border-radius: 250px;
  1544. float: left;
  1545. color: #000;
  1546. }
  1547. /deep/ .el-transfer-panel__item .el-checkbox__input {
  1548. /*float: left;*/
  1549. left: 10%;
  1550. }
  1551. /*/deep/ .el-checkbox .el-checkbox {*/
  1552. /*margin-right: 1px;*/
  1553. /*}*/
  1554. /deep/ .el-checkbox__label span {
  1555. width: 100%;
  1556. white-space: nowrap;
  1557. overflow: hidden;
  1558. text-overflow: ellipsis;
  1559. float: left;
  1560. }
  1561. .cell em {
  1562. margin-left: 5px;
  1563. margin-right: 5px;
  1564. }
  1565. /deep/ .el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label span {
  1566. width: 50px;
  1567. float: right;
  1568. right: 0;
  1569. }
  1570. /*/deep/ .el-table .red-row {*/
  1571. /*background: #fb88c1;*/
  1572. /*}*/
  1573. /*/deep/ .el-table .blue-row {*/
  1574. /*background: #7099d0;*/
  1575. /*}*/
  1576. /*/deep/ .el-table .yellow-row {*/
  1577. /*background: #fbe56e;*/
  1578. /*}*/
  1579. /deep/ .el-table__header .el-table-column--selection .cell .el-checkbox:after {
  1580. content: " 是否网课";
  1581. }
  1582. /deep/ .el-table__body-wrapper .el-table-column--selection .cell .el-checkbox:after {
  1583. content: " 网课";
  1584. }
  1585. </style>