courseEdit.vue 51 KB

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