heartEquip.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954
  1. <template>
  2. <div class="context">
  3. <div class="panel">
  4. <h5>心率设备</h5>
  5. <div class="likeTab">
  6. <el-button type="primary" @click="goType('heartEquip')">场馆心率设备</el-button>
  7. <el-button type="" @click="goType('heartEquipPerson')">私有心率设备</el-button>
  8. </div>
  9. <div class="panel-body">
  10. <div class="panel_control">
  11. <el-row :gutter="20">
  12. <el-col :span="4">
  13. <em>心率设备:</em>
  14. <el-input v-model="panel.str" placeholder="请输入编号" type="number"></el-input>
  15. </el-col>
  16. <!--<el-col :span="4">-->
  17. <!--<em>设备状态:</em>-->
  18. <!--&lt;!&ndash;status&ndash;&gt;-->
  19. <!--<el-select v-model="panel.status" placeholder="请选择">-->
  20. <!--<el-option-->
  21. <!--v-for="item in panel.statusOptions"-->
  22. <!--:key="item.value"-->
  23. <!--:label="item.label"-->
  24. <!--:value="item.value">-->
  25. <!--</el-option>-->
  26. <!--</el-select>-->
  27. <!--</el-col>-->
  28. <el-col :span="4">
  29. <el-button size="" type="primary" @click="query" plain>查询</el-button>
  30. </el-col>
  31. </el-row>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="change">
  36. <el-button @click="addMember" type="primary">新增心率设备</el-button>
  37. <el-button @click="editList">编辑心率设备</el-button>
  38. <el-button type="success" @click="getAllPower" :loading="BtnGetAllPower">全部设备电量</el-button>
  39. <!--<el-button @click="delList" type="danger">删除心率设备</el-button>-->
  40. </div>
  41. <div class="table">
  42. <el-table
  43. :data="tableData"
  44. border
  45. is-horizontal-resize
  46. :default-sort="{prop: 'date', order: 'descending'}"
  47. element-loading-background="rgba(0, 0, 0, 0.8)"
  48. class=""
  49. @selection-change="handleSelectionChange" @current-change="clickChange"
  50. >
  51. >
  52. <el-table-column label="选择" width="55">
  53. <template slot-scope="scope">
  54. <el-radio v-model="tableRadio" :label="scope.row"><i></i></el-radio>
  55. </template>
  56. </el-table-column>
  57. <!--<el-table-column-->
  58. <!--type="index"-->
  59. <!--label="序号"-->
  60. <!--align="center"-->
  61. <!--width="50">-->
  62. <!--</el-table-column>-->
  63. <!--<el-table-column-->
  64. <!--prop="InVenueNo"-->
  65. <!--label="馆内编号"-->
  66. <!--align="center"-->
  67. <!--width="90"-->
  68. <!--&gt;-->
  69. <!--</el-table-column>-->
  70. <el-table-column
  71. prop="Sn"
  72. label="序列号"
  73. align="InVenueNo"
  74. sortable
  75. >
  76. </el-table-column>
  77. <el-table-column
  78. prop="UserName"
  79. label="用户"
  80. align="center"
  81. sortable
  82. >
  83. <template slot-scope="scope">
  84. {{scope.row.UserName}}
  85. <!--<el-select v-model="scope.row.BindUserId" @change="getRowTop(scope.row)" filterable v-if="scope.row.BindUserId">-->
  86. <!--<el-option-->
  87. <!--v-for="item in panel.options"-->
  88. <!--:key="item.value"-->
  89. <!--:label="item.label"-->
  90. <!--:value="item.value">-->
  91. <!--</el-option>-->
  92. <!--</el-select>-->
  93. <!--<el-button @click="takeBack(scope.row)" type="danger" v-if="!scope.row.BindUserId">{{scope.row.UserName}} 设备收回</el-button>-->
  94. </template>
  95. </el-table-column>
  96. <el-table-column
  97. prop="PowerPercent"
  98. label="电量"
  99. align="center"
  100. >
  101. </el-table-column>
  102. <el-table-column
  103. prop="PowerUpdateAt"
  104. label="电量更新时间"
  105. align="center"
  106. :formatter="filterFmtDate"
  107. >
  108. </el-table-column>
  109. <!--<el-table-column-->
  110. <!--prop="Status"-->
  111. <!--label="状态"-->
  112. <!--align="center"-->
  113. <!--width="90"-->
  114. <!--&gt;-->
  115. <!--<template slot-scope="scope">-->
  116. <!--&lt;!&ndash;1:启用 8:暂停 9:删除&ndash;&gt;-->
  117. <!--<span v-if="scope.row.Status == 1" style="color: #67c23a">已启用</span>-->
  118. <!--<span v-if="scope.row.Status == 8" style="color: #E6A23C">已暂停</span>-->
  119. <!--<span v-if="scope.row.Status == 9" style="color: red">已删除</span>-->
  120. <!--</template>-->
  121. <!--</el-table-column>-->
  122. <el-table-column
  123. prop="id"
  124. label="操作"
  125. >
  126. <template slot-scope="scope">
  127. <!--<el-button type="success" v-if="scope.row.Status == 8" size="mini"-->
  128. <!--@click="pauseRow(scope.row,1)">-->
  129. <!--启用-->
  130. <!--</el-button>-->
  131. <!--<el-button type="warning" v-if="scope.row.Status == 1" size="mini"-->
  132. <!--@click="pauseRow(scope.row,8)">-->
  133. <!--禁用-->
  134. <!--</el-button>-->
  135. <el-button type="danger" size="mini"
  136. @click="pauseRowDel(scope.row)">
  137. 删除
  138. </el-button>
  139. <el-button type="primary" size="mini" @click="goPage(scope.row)">记录</el-button>
  140. <el-button type="success" size="mini" @click="getPower(scope.row)">获取电量</el-button>
  141. </template>
  142. </el-table-column>
  143. </el-table>
  144. <br>
  145. <el-pagination
  146. background
  147. :total="pageination.total"
  148. :page-size="pageination.pageItem"
  149. @current-change="pageChange"
  150. ></el-pagination>
  151. </div>
  152. <el-dialog :title="dialogTitle" :visible.sync="dialogMemberVisible" width="650px">
  153. <div class="dialogContent">
  154. <div class="">
  155. <el-form ref="form" :model="form" label-width="160px">
  156. <!--<el-form-item label="馆内编号" :required="true">-->
  157. <!--<el-input v-model="form.venueNo"></el-input>-->
  158. <!--</el-form-item>-->
  159. <el-form-item label="序列号" :required="true">
  160. <el-input v-model="form.sn"></el-input>
  161. </el-form-item>
  162. </el-form>
  163. </div>
  164. </div>
  165. <div class="dialogFooter">
  166. <el-button type="primary" size="small" v-if="form.btnType == 0" @click="confirmMember">确定</el-button>
  167. <el-button type="primary" size="small" v-if="form.btnType == 1" @click="confirmEditMember">确定
  168. </el-button>
  169. <el-button size="small" @click="dialogMemberVisible = false">取消</el-button>
  170. </div>
  171. </el-dialog>
  172. </div>
  173. </template>
  174. <script>
  175. import Global from '../Global.js'
  176. import {
  177. testTable,
  178. testSelect,
  179. ShopManagerStatusEdit,
  180. ClassDetailOne,
  181. QueryHrSensors,
  182. AddHrSensors,
  183. HrSensorsStatusEdit,
  184. EditHrSensors,
  185. UnBindHrSensorsToUser,
  186. GetHrSensorsPowerPercent,
  187. ShopVenueEquipEditStatus,
  188. } from "../api/getApiRes";
  189. let qs = require('qs');
  190. export default {
  191. data() {
  192. return {
  193. activeName: 'comm',
  194. dialogVisible: false,//其他dialog
  195. BtnGetAllPower: false,//
  196. dialogMemberVisible: false,//新增心率设备dialog
  197. dialogLesson: false,//课时调整
  198. dialogGift: false,//赠送课时调整
  199. dialogExpTime: false,//有效期调整
  200. dialogLessonTable: false,//心率设备课程
  201. dialogTitle: '新增心率设备',
  202. dialogValue: [],
  203. tableRadio: [],
  204. // panel 配置项目
  205. panel: {
  206. str: '',
  207. phone: '',
  208. compname: '',
  209. keyword: '',
  210. USERCODE: '',
  211. endType: '',
  212. taskstatus: 99,
  213. status: "",
  214. draw: 1,
  215. start: 0,
  216. recordsTotal: 0,
  217. tableData: [],
  218. allTableData: [],
  219. limit: '10',
  220. multipleSort: false,
  221. loading: false,
  222. fileList: [],
  223. multipleSelection: [],
  224. detectedmac: '',
  225. statusOptions: [
  226. {value: "", label: '全部'},
  227. {value: 1, label: '启用'},
  228. {value: 8, label: '暂停'},
  229. {value: 9, label: '删除'},
  230. ], options: [
  231. {value: 99, label: '全部'},
  232. {value: 1, label: '进行中'},
  233. {value: 2, label: '已完成'},
  234. ],
  235. endTypeOptions: [
  236. {value: 99, label: '全部'},
  237. {value: 30, label: '近一个月'},
  238. {value: 7, label: '近一周'},
  239. {value: 1, label: '当日'},
  240. ],
  241. time1: globalBt(),
  242. },
  243. multipleSelection: [],
  244. pageination: {
  245. pageItem: 100,
  246. pageoptions: pageOptions(),
  247. total: 100,
  248. pageIndex: 1,
  249. },
  250. form: {
  251. name: '',
  252. userCode: '',
  253. sn: '',
  254. venueNo: '',
  255. shopId: '',
  256. teacherId: 0,
  257. memberType: 1,
  258. lesson: 1,
  259. gift: 1,
  260. btnType: 0,//0新建,1编辑编辑
  261. memo: '',
  262. phone: '',
  263. expTime: '',
  264. dialogdata: [],//穿梭待选
  265. dialogValue: [],//穿梭已选
  266. },
  267. memberTypes: [
  268. {value: 1, label: '年心率设备'},
  269. {value: 2, label: '充值心率设备'},
  270. ],
  271. tableData: []
  272. }
  273. },
  274. mounted() {
  275. this.getTableQuery();
  276. },
  277. methods: {
  278. handleClick(tab, event) {
  279. let that = this;
  280. if (tab.name == "personal") {
  281. // 私有
  282. that.$router.push({path: '/heartEquipPerson'});
  283. } else {
  284. // 公共
  285. that.$router.push({path: '/heartEquip'});
  286. }
  287. },
  288. // 设备回收
  289. takeBack(row) {
  290. let that = this;
  291. this.$confirm('是否回收用户' + row.name + '的心率设备?', '回收操作', {
  292. confirmButtonText: '确定',
  293. cancelButtonText: '取消',
  294. type: 'warning'
  295. }).then(() => {
  296. let param = {
  297. token: localStorage.token,
  298. Id: row.Id,
  299. status: 0,
  300. };
  301. let postdata = qs.stringify(param);
  302. UnBindHrSensorsToUser(postdata).then(res => {
  303. let json = res;
  304. if (json.Code == 0) {
  305. that.$message({
  306. showClose: true,
  307. message: row.name + '回收成功!',
  308. type: 'success'
  309. });
  310. // table 重载
  311. that.getTableQuery();
  312. } else {
  313. that.$message.error(json.Memo + '错误码:' + json.Code);
  314. }
  315. })
  316. }).catch(() => {
  317. this.$message({
  318. type: 'info',
  319. message: '已取消回收'
  320. });
  321. });
  322. },
  323. goPage(row) {
  324. // 查看绑定记录
  325. this.$router.push({path: '/bindRecord', query: {hrId: row.HrId}});
  326. },
  327. goType(url) {
  328. this.$router.push({path: '/' + url});
  329. },
  330. // 编辑
  331. editList() {
  332. let that = this;
  333. this.clearForm();
  334. console.log(this.tableRadio);
  335. if (this.tableRadio.length == 0) {
  336. this.$message.error("请先选中一条记录");
  337. return false
  338. }
  339. let row = this.tableRadio;
  340. this.form.shopid = row.ShopId;
  341. this.form.userId = row.Id;
  342. this.form.name = row.Name;
  343. this.form.userCode = row.Usercode;
  344. this.form.password = '';
  345. this.form.hrId = row.HrId;
  346. this.form.sn = row.Sn;
  347. this.form.venueNo = row.InVenueNo;
  348. this.dialogVisible = true;
  349. this.dialogTitle = '编辑心率设备';
  350. this.form.btnType = 1;
  351. this.dialogMemberVisible = true
  352. },
  353. clickChange(item) {
  354. this.tableRadio = item
  355. },
  356. // 选择课程后,获取当前课程的建议上课人数和课时消耗
  357. getRowTop(row) {
  358. let that = this;
  359. console.log(row);
  360. let param = {
  361. token: localStorage.token,
  362. classId: row.ClassId,
  363. };
  364. let postdata = qs.stringify(param);
  365. ClassDetailOne(postdata).then(res => {
  366. let json = res;
  367. if (json.Code == 0) {
  368. row.TopLimit = json.Rs.TopLimit;
  369. row.ConsumeHour = json.Rs.ConsumeHour;
  370. } else {
  371. that.$message.error(json.Memo + '错误码:' + json.Code);
  372. }
  373. })
  374. },
  375. // 编辑
  376. editMember(row) {
  377. this.clearForm();
  378. this.form.name = row.Name;
  379. this.form.phone = row.Phone;
  380. this.form.shopId = row.ShopId;
  381. this.form.teacherId = row.TeacherId;
  382. this.form.btnType = 1;
  383. this.dialogMemberVisible = true
  384. this.dialogTitle = '编辑心率设备'
  385. },
  386. // 禁用
  387. pauseRow(row, status) {
  388. let that = this;
  389. let param = {
  390. token: localStorage.token,
  391. hrId: row.HrId,
  392. status: status,//1:启用 8:暂停 9:删除
  393. };
  394. let postdata = qs.stringify(param);
  395. HrSensorsStatusEdit(postdata).then(res => {
  396. let json = res;
  397. if (json.Code == 0) {
  398. that.$message({
  399. showClose: true,
  400. message: '执行成功!',
  401. type: 'success'
  402. });
  403. // table 重载
  404. that.getTableQuery();
  405. } else {
  406. that.$message.error(json.Memo + '错误码:' + json.Code);
  407. }
  408. })
  409. },
  410. // pauseRow(row) {
  411. // let that = this;
  412. // this.$confirm('是否禁用心率设备' + row.Sn + '?', '禁用操作', {
  413. // confirmButtonText: '确定',
  414. // cancelButtonText: '取消',
  415. // type: 'warning'
  416. // }).then(() => {
  417. // let param = {
  418. // token: localStorage.token,
  419. // shopId : localStorage.token,
  420. // status: 8,
  421. // };
  422. // let postdata = qs.stringify(param);
  423. // ShopVenueEquipEditStatus(postdata).then(res => {
  424. // let json = res;
  425. // if (json.Code == 0) {
  426. // that.$message({
  427. // showClose: true,
  428. // message: row.name + '禁用成功!',
  429. // type: 'success'
  430. // });
  431. // // table 重载
  432. // that.getTableQuery();
  433. // } else {
  434. // that.$message.error(json.Memo + '错误码:' + json.Code);
  435. // }
  436. // })
  437. // }).catch(() => {
  438. // this.$message({
  439. // type: 'info',
  440. // message: '已取消禁用'
  441. // });
  442. // });
  443. // },
  444. // 启用
  445. runRow(row) {
  446. let that = this;
  447. this.$confirm('是否启用心率设备' + row.Sn + '?', '启用操作', {
  448. confirmButtonText: '确定',
  449. cancelButtonText: '取消',
  450. type: 'warning'
  451. }).then(() => {
  452. let param = {
  453. token: localStorage.token,
  454. Id: row.Id,
  455. status: 1,
  456. };
  457. let postdata = qs.stringify(param);
  458. testTable(postdata).then(res => {
  459. let json = res;
  460. if (json.Code == 0) {
  461. that.$message({
  462. showClose: true,
  463. message: row.name + '启用成功!',
  464. type: 'success'
  465. });
  466. // table 重载
  467. that.getTableQuery();
  468. } else {
  469. that.$message.error(json.Memo + '错误码:' + json.Code);
  470. }
  471. })
  472. }).catch(() => {
  473. this.$message({
  474. type: 'info',
  475. message: '已取消启用'
  476. });
  477. });
  478. },
  479. // 获取电量
  480. getPower(row) {
  481. let that = this;
  482. let param = {
  483. token: localStorage.token,
  484. shopId: row.ShopId,
  485. hrId: row.HrId,
  486. };
  487. let postdata = qs.stringify(param);
  488. GetHrSensorsPowerPercent(postdata).then(res => {
  489. let json = res;
  490. if (json.Code == 0) {
  491. console.log(json);
  492. that.$message({
  493. showClose: true,
  494. message: '电量获取成功!',
  495. type: 'success'
  496. });
  497. } else {
  498. that.$message.error(json.Memo);
  499. }
  500. })
  501. },
  502. getAllPower() {
  503. let that = this;
  504. that.BtnGetAllPower = true;
  505. let param = {
  506. token: localStorage.token,
  507. shopId: localStorage.ShopId,
  508. };
  509. let postdata = qs.stringify(param);
  510. GetHrSensorsPowerPercent(postdata).then(res => {
  511. let json = res;
  512. if (json.Code == 0) {
  513. // table 重载
  514. that.getTableQuery();
  515. that.$message({
  516. showClose: true,
  517. message: '电量获取成功!',
  518. type: 'success'
  519. });
  520. } else {
  521. that.$message.error(json.Memo);
  522. }
  523. that.BtnGetAllPower = false;
  524. })
  525. },
  526. // 删除
  527. pauseRowDel(row) {
  528. let that = this;
  529. let param = {
  530. token: localStorage.token,
  531. hrId: row.HrId,
  532. status: 9,//1:启用,8:暂停,9:删除
  533. };
  534. let postdata = qs.stringify(param);
  535. this.$confirm('此操作将永久删除该心率设备, 是否继续?', '提示', {
  536. confirmButtonText: '确定',
  537. cancelButtonText: '取消',
  538. type: 'warning'
  539. }).then(() => {
  540. HrSensorsStatusEdit(postdata).then(res => {
  541. let json = res;
  542. if (json.Code == 0) {
  543. that.$message({
  544. showClose: true,
  545. message: '选中的心率设备已删除!',
  546. type: 'success'
  547. });
  548. // 重载列表
  549. that.getTableQuery();
  550. } else {
  551. that.$message.error(json.Memo + '错误码:' + json.Code);
  552. }
  553. });
  554. }).catch(() => {
  555. this.$message({
  556. type: 'info',
  557. message: '已取消删除'
  558. });
  559. });
  560. },
  561. // 关闭所有
  562. allDialogClose() {
  563. this.dialogVisible = false;
  564. this.dialogGift = false;
  565. this.dialogLesson = false;
  566. this.dialogExpTime = false;
  567. this.dialogLessonTable = false;
  568. },
  569. // 确认提交新增心率设备
  570. confirmMember() {
  571. let that = this;
  572. // checkNum
  573. if (!that.form.sn) {
  574. this.$message.error('错了哦,编号不能为空');
  575. return false
  576. }
  577. if (that.form.sn.length > 20) {
  578. this.$message.error('错了哦,编号不能超过20个字符');
  579. return false
  580. }
  581. // if (!that.form.venueNo) {
  582. // this.$message.error('错了哦,实体序列号不能为空');
  583. // return false
  584. // }
  585. // if (that.form.venueNo.length > 30) {
  586. // this.$message.error('错了哦,实体序列号不能超过30个字符');
  587. // return false
  588. // }
  589. let param = {
  590. token: localStorage.token,
  591. shopId: localStorage.shopId,
  592. sn: that.form.sn,
  593. venueNo: that.form.venueNo,
  594. };
  595. let postdata = qs.stringify(param);
  596. AddHrSensors(postdata).then(res => {
  597. let json = res;
  598. if (json.Code == 0) {
  599. // 关闭弹窗
  600. that.dialogMemberVisible = false;
  601. // 重载列表
  602. that.getTableQuery();
  603. that.$message({
  604. showClose: true,
  605. message: '心率设备添加成功!',
  606. type: 'success'
  607. });
  608. } else {
  609. that.$message.error(json.Memo + '错误码:' + json.Code);
  610. }
  611. })
  612. },
  613. confirmEditMember() {
  614. let that = this;
  615. // checkNum
  616. if (!that.form.sn) {
  617. this.$message.error('错了哦,编号不能为空');
  618. return false
  619. }
  620. if (that.form.sn.length > 20) {
  621. this.$message.error('错了哦,编号不能超过20个字符');
  622. return false
  623. }
  624. // if (!that.form.venueNo) {
  625. // this.$message.error('错了哦,实体序列号不能为空');
  626. // return false
  627. // }
  628. // if (that.form.venueNo.length > 30) {
  629. // this.$message.error('错了哦,实体序列号不能超过30个字符');
  630. // return false
  631. // }
  632. let param = {
  633. token: localStorage.token,
  634. shopId: localStorage.shopId,
  635. hrId: that.form.hrId,
  636. sn: that.form.sn,
  637. venueNo: that.form.venueNo,
  638. };
  639. let postdata = qs.stringify(param);
  640. EditHrSensors(postdata).then(res => {
  641. let json = res;
  642. if (json.Code == 0) {
  643. // 关闭弹窗
  644. that.dialogMemberVisible = false;
  645. // 重载列表
  646. that.getTableQuery();
  647. that.$message({
  648. showClose: true,
  649. message: '心率设备信息编辑成功!',
  650. type: 'success'
  651. });
  652. } else {
  653. that.$message.error(json.Memo + '错误码:' + json.Code);
  654. }
  655. })
  656. },
  657. // 确认提交课时
  658. confirmLesson() {
  659. let that = this;
  660. // checkNum
  661. let param = {
  662. token: localStorage.token,
  663. userCode: that.form.userCode,
  664. lesson: that.form.lesson,
  665. };
  666. let postdata = qs.stringify(param);
  667. testSelect(postdata).then(res => {
  668. let json = res;
  669. if (json.Code == 0) {
  670. // 关闭弹窗
  671. that.dialogVisible = false;
  672. // 重载列表
  673. that.getTableQuery();
  674. that.$message({
  675. showClose: true,
  676. message: '课时调整成功!',
  677. type: 'success'
  678. });
  679. } else {
  680. that.$message.error(json.Memo + '错误码:' + json.Code);
  681. }
  682. })
  683. },
  684. // 新增心率设备
  685. addMember() {
  686. this.clearForm();
  687. this.dialogMemberVisible = true;
  688. this.form.btnType = 0;
  689. this.dialogTitle = '新增心率设备'
  690. },
  691. // 删除
  692. delList() {
  693. let that = this;
  694. if (this.tableRadio.length == 0) {
  695. this.$message.error("请先选中一条记录");
  696. return false
  697. }
  698. let hrId = this.tableRadio.HrId;
  699. let param = {
  700. token: localStorage.token,
  701. hrId: hrId,
  702. status: 9,//1:启用,8:暂停,9:删除
  703. };
  704. let postdata = qs.stringify(param);
  705. this.$confirm('此操作将永久删除该心率设备, 是否继续?', '提示', {
  706. confirmButtonText: '确定',
  707. cancelButtonText: '取消',
  708. type: 'warning'
  709. }).then(() => {
  710. HrSensorsStatusEdit(postdata).then(res => {
  711. let json = res;
  712. if (json.Code == 0) {
  713. that.$message({
  714. showClose: true,
  715. message: '选中的心率设备已删除!',
  716. type: 'success'
  717. });
  718. // 重载列表
  719. that.getTableQuery();
  720. } else {
  721. that.$message.error(json.Memo + '错误码:' + json.Code);
  722. }
  723. });
  724. }).catch(() => {
  725. this.$message({
  726. type: 'info',
  727. message: '已取消删除'
  728. });
  729. });
  730. },
  731. handleSelectionChange(val) {
  732. this.multipleSelection = val;
  733. },
  734. // 查询按钮
  735. query() {
  736. this.getTableQuery();
  737. this.$message.success('查询完毕');
  738. },
  739. clearForm() {
  740. // clear
  741. this.form.name = '';
  742. this.form.sn = '';
  743. this.form.venueNo = '';
  744. this.form.phone = '';
  745. this.form.userCode = '';
  746. this.form.shopId = '';
  747. },
  748. // 页面数据查询
  749. getTableQuery() {
  750. let that = this;
  751. that.loading = true;
  752. let param = {
  753. token: localStorage.token,
  754. str: this.panel.str,//
  755. status: this.panel.status,//
  756. shopId: localStorage.shopId,//
  757. };
  758. let postdata = qs.stringify(param);
  759. QueryHrSensors(postdata).then(res => {
  760. let json = res;
  761. if (json.Code == 0) {
  762. that.loading = false;
  763. if (json.Rs) {
  764. that.allTableData = json.Rs;
  765. that.recordsTotal = json.Rs.length;
  766. } else {
  767. that.allTableData = [];
  768. that.recordsTotal = 0;
  769. }
  770. // 设置分页数据
  771. that.setPaginations();
  772. } else {
  773. that.$message.error(json.Memo + '错误码:' + json.Code);
  774. }
  775. })
  776. },
  777. // 设置分页数据
  778. setPaginations() {
  779. // 分页属性
  780. let that = this;
  781. that.pageination.total = that.recordsTotal;
  782. // 默认分页
  783. that.tableData = that.allTableData.filter((item, index) => {
  784. return index < that.pageination.pageItem;
  785. });
  786. },
  787. // 每页显示数量
  788. handleSizeChange() {
  789. let that = this;
  790. that.tableData = that.allTableData.filter((item, index) => {
  791. return index < that.pageination.pageItem;
  792. });
  793. that.draw = that.pageination.pageItem;
  794. // that.getTableQuery();
  795. },
  796. // 翻页
  797. pageChange(pageIndex) {
  798. let that = this;
  799. // 获取当前页
  800. let index = that.pageination.pageItem * (pageIndex - 1);
  801. // 数据总数
  802. let nums = that.pageination.pageItem * pageIndex;
  803. // 容器
  804. let tables = [];
  805. for (var i = index; i < nums; i++) {
  806. if (that.allTableData[i]) {
  807. tables.push(that.allTableData[i])
  808. }
  809. this.tableData = tables;
  810. }
  811. that.start = index * that.draw;
  812. // that.getTableQuery();
  813. },
  814. // 自动排序
  815. sortChange(params) {
  816. console.log(params)
  817. },
  818. // 过滤时间
  819. filterFmtDate(value, row, column) {
  820. let that = this;
  821. if(column == 0){
  822. return '未获得'
  823. }else{
  824. return nonTfmtDatetoLength(new Date(column*1000), 16);
  825. }
  826. },
  827. },
  828. }
  829. </script>
  830. <style scoped>
  831. @import "../assets/css/panel.css";
  832. .context {
  833. height: 770px;
  834. overflow-y: scroll;
  835. display: block;
  836. margin: 0 auto;
  837. background-color: #fff !important;
  838. padding: 30px;
  839. }
  840. .panel-body {
  841. padding: 20px;
  842. background: #F0F2F5;
  843. }
  844. .change {
  845. width: 100%;
  846. overflow: hidden;
  847. display: block;
  848. margin: 0 auto;
  849. padding-top: 10px;
  850. padding-bottom: 10px;
  851. }
  852. .change button {
  853. float: left;
  854. }
  855. .change button.pull-right {
  856. float: right;
  857. }
  858. .likeTab {
  859. width: 100%;
  860. overflow: hidden;
  861. display: block;
  862. margin: 0 auto;
  863. padding-top: 10px;
  864. padding-bottom: 0;
  865. border-bottom: 1px solid #ccc;
  866. margin-bottom: 10px;
  867. }
  868. .likeTab button {
  869. float: left;
  870. border-radius: 0;
  871. }
  872. .likeTab button.pull-right {
  873. float: right;
  874. }
  875. .dialogTitle {
  876. width: 100%;
  877. overflow: hidden;
  878. display: block;
  879. margin: 0 auto;
  880. color: #000000;
  881. font-size: 18px;
  882. text-align: center;
  883. }
  884. .dialogTitle em {
  885. float: none;
  886. font-style: normal;
  887. color: #3799FF;
  888. margin: 0;
  889. }
  890. /deep/ .el-transfer-panel__item .el-checkbox__input {
  891. left: 40px;
  892. }
  893. .dialogFooter {
  894. width: 90%;
  895. overflow: hidden;
  896. display: block;
  897. margin: 0 auto;
  898. margin-top: 10px;
  899. }
  900. .dialogFooter button {
  901. float: right;
  902. margin-left: 10px;
  903. }
  904. .dialogContent {
  905. width: 100%;
  906. overflow: hidden;
  907. display: block;
  908. margin: 0 auto;
  909. }
  910. .dialogContent .pull-left {
  911. width: 30%;
  912. float: left;
  913. }
  914. .dialogContent .pull-right {
  915. width: 70%;
  916. float: right;
  917. }
  918. </style>