bindRecord.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. <template>
  2. <div class="context">
  3. <div class="panel">
  4. <el-page-header @back="goBack" content="绑定记录">
  5. </el-page-header>
  6. <h5></h5>
  7. <div class="panel-body" v-if="true">
  8. <div class="panel_control">
  9. <el-row :gutter="20">
  10. <!--<el-col :span="4">-->
  11. <!--<em>心率带ID:</em>-->
  12. <!--<el-input v-model="panel.hrId" placeholder="请输入心率带ID"></el-input>-->
  13. <!--</el-col>-->
  14. <el-col :span="7">
  15. <em>日期:</em>
  16. <el-date-picker
  17. v-model="panel.timeScope"
  18. type="daterange"
  19. range-separator="至"
  20. start-placeholder="开始日期"
  21. end-placeholder="结束日期">
  22. </el-date-picker>
  23. </el-col>
  24. <el-col :span="4">
  25. <el-button size="" type="primary" @click="query" plain :disabled="serachBtnStatus">查询
  26. </el-button>
  27. </el-col>
  28. </el-row>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="table">
  33. <el-table
  34. :data="tableData"
  35. border
  36. is-horizontal-resize
  37. :default-sort="{prop: 'date', order: 'descending'}"
  38. element-loading-background="rgba(0, 0, 0, 0.8)"
  39. class=""
  40. @selection-change="handleSelectionChange"
  41. >
  42. >
  43. <el-table-column
  44. type="index"
  45. label="序号"
  46. align="center"
  47. width="50">
  48. </el-table-column>
  49. <el-table-column
  50. prop="UserName"
  51. label="绑定用户"
  52. >
  53. </el-table-column>
  54. <el-table-column
  55. prop="Sn"
  56. label="序列号"
  57. >
  58. </el-table-column>
  59. <el-table-column
  60. prop="ClassName"
  61. label="课程"
  62. sortable
  63. >
  64. <template slot-scope="scope">
  65. <span class="lessons"
  66. :style="{ background:scope.row.ClassColor }">{{ scope.row.ClassName }}</span>
  67. </template>
  68. </el-table-column>
  69. <el-table-column
  70. prop="Base.CreatedAt"
  71. label="绑定时间"
  72. width="180"
  73. :formatter="filterFmtDate"
  74. sortable
  75. >
  76. </el-table-column>
  77. <el-table-column
  78. prop="Base.UpdatedAt"
  79. label="解绑时间"
  80. width="180"
  81. :formatter="filterFmtDate"
  82. sortable
  83. >
  84. </el-table-column>
  85. <el-table-column
  86. prop="IsPrivate"
  87. label="是否私有"
  88. sortable
  89. >
  90. <template slot-scope="scope">
  91. <span v-if="scope.row.IsPrivate == 1">私有</span>
  92. <span v-if="scope.row.IsPrivate == 2">公共</span>
  93. </template>
  94. </el-table-column>
  95. <!--<el-table-column-->
  96. <!--prop="BindStatus"-->
  97. <!--label="绑定状态"-->
  98. <!--&gt;-->
  99. <!--<template slot-scope="scope">-->
  100. <!--<span v-if="scope.row.BindStatus == 1" style="color: greenyellow">绑定</span>-->
  101. <!--<span v-if="scope.row.BindStatus == 2" style="color:red;">解绑</span>-->
  102. <!--</template>-->
  103. <!--</el-table-column>-->
  104. </el-table>
  105. <br>
  106. <el-pagination
  107. background
  108. :total="pageination.total"
  109. :page-size="pageination.pageItem"
  110. @current-change="pageChange"
  111. ></el-pagination>
  112. </div>
  113. </div>
  114. </template>
  115. <script>
  116. import Global from '../Global.js'
  117. import {
  118. HrSensorsBindHistory,
  119. } from "../api/getApiRes";
  120. let qs = require('qs');
  121. export default {
  122. data() {
  123. return {
  124. serachBtnStatus: false,
  125. dialogVisible: false,//其他dialog
  126. dialogMemberVisible: false,//新增会员dialog
  127. dialogLesson: false,//课时调整
  128. dialogGift: false,//赠送课时调整
  129. dialogExpTime: false,//有效期调整
  130. dialogLessonTable: false,//会员课程
  131. dialogTitle: '新增会员',
  132. dialogValue: [],
  133. // panel 配置项目
  134. panel: {
  135. hrId: this.$route.query.hrId,
  136. phone: '',
  137. classId: '',
  138. usercode: '',
  139. username: '',
  140. timeScope: globalBt2(3),
  141. compname: '',
  142. keyword: '',
  143. USERCODE: '',
  144. endType: '',
  145. taskstatus: 99,
  146. draw: 1,
  147. start: 0,
  148. recordsTotal: 0,
  149. tableData: [],
  150. allTableData: [],
  151. limit: '10',
  152. multipleSort: false,
  153. loading: false,
  154. fileList: [],
  155. multipleSelection: [],
  156. detectedmac: '',
  157. options: [],
  158. time1: globalBt(),
  159. },
  160. multipleSelection: [],
  161. pageination: {
  162. pageItem: 100,
  163. pageoptions: pageOptions(),
  164. total: 100,
  165. pageIndex: 1,
  166. },
  167. form: {
  168. name: '',
  169. userCode: '',
  170. shopId: '',
  171. memberType: 1,
  172. lesson: 1,
  173. gift: 1,
  174. btnType: 0,//0新建,1编辑编辑
  175. memo: '',
  176. expTime: '',
  177. dialogdata: [],//穿梭待选
  178. dialogValue: [],//穿梭已选
  179. },
  180. memberTypes: [
  181. {value: 1, label: '年会员'},
  182. {value: 2, label: '充值会员'},
  183. ],
  184. tableData: []
  185. }
  186. },
  187. mounted() {
  188. this.getTableQuery();
  189. },
  190. methods: {
  191. goBack(){
  192. this.$router.push({
  193. path: '/heartEquip', query: {}
  194. });
  195. },
  196. // 表格合计
  197. getSummaries(param) {
  198. const {columns, data} = param;
  199. const sums = [];
  200. columns.forEach((column, index) => {
  201. if (index === 0) {
  202. sums[index] = '合计';
  203. return;
  204. }
  205. const values = data.map(item => Number(item[column.property]));
  206. if (!values.every(value => isNaN(value)) && index != 0 && index != 1 && index != 2) {
  207. sums[index] = values.reduce((prev, curr) => {
  208. const value = Number(curr);
  209. if (!isNaN(value)) {
  210. return prev + curr;
  211. } else {
  212. return prev;
  213. }
  214. }, 0);
  215. sums[index] += '';
  216. sums[index] = parseInt(sums[index]);
  217. } else {
  218. sums[index] = '';
  219. }
  220. });
  221. return sums;
  222. },
  223. // 关闭所有
  224. handleSelectionChange(val) {
  225. this.multipleSelection = val;
  226. },
  227. // 查询按钮
  228. query() {
  229. // 按钮倒计时
  230. let that = this;
  231. that.serachBtnStatus = true;
  232. let totalTime = 2;
  233. let clock = window.setInterval(() => {
  234. totalTime--;
  235. if (totalTime < 0) {
  236. totalTime = 2;
  237. that.serachBtnStatus = false;
  238. }
  239. }, 1000);
  240. this.getTableQuery();
  241. this.$message.success('查询完毕');
  242. },
  243. clearForm() {
  244. // clear
  245. this.form.name = '';
  246. this.form.userCode = '';
  247. this.form.shopId = '';
  248. },
  249. // 页面数据查询
  250. getTableQuery() {
  251. console.log(123);
  252. let that = this;
  253. that.loading = true;
  254. let param = {
  255. token: localStorage.token,
  256. hrId: this.$route.query.hrId,
  257. bt: nonTfmtDatetoLength(that.panel.timeScope[0], 10) + " 00:00:01",
  258. et: nonTfmtDatetoLength(that.panel.timeScope[1], 10) + " 23:59:59",
  259. };
  260. let postdata = qs.stringify(param);
  261. HrSensorsBindHistory(postdata).then(res => {
  262. let json = res;
  263. if (json.Code == 0) {
  264. that.loading = false;
  265. if (json.Rs) {
  266. that.allTableData = json.Rs;
  267. that.recordsTotal = json.Rs.length;
  268. } else {
  269. that.allTableData = [];
  270. that.recordsTotal = 0;
  271. }
  272. // 设置分页数据
  273. that.setPaginations();
  274. } else {
  275. that.$message.error(json.Memo + '错误码:' + json.Code);
  276. }
  277. })
  278. },
  279. // 设置分页数据
  280. setPaginations() {
  281. // 分页属性
  282. let that = this;
  283. that.pageination.total = that.recordsTotal;
  284. // 默认分页
  285. that.tableData = that.allTableData.filter((item, index) => {
  286. return index < that.pageination.pageItem;
  287. });
  288. },
  289. // 每页显示数量
  290. handleSizeChange() {
  291. let that = this;
  292. that.tableData = that.allTableData.filter((item, index) => {
  293. return index < that.pageination.pageItem;
  294. });
  295. that.draw = that.pageination.pageItem;
  296. // that.getTableQuery();
  297. },
  298. // 翻页
  299. pageChange(pageIndex) {
  300. let that = this;
  301. // 获取当前页
  302. let index = that.pageination.pageItem * (pageIndex - 1);
  303. // 数据总数
  304. let nums = that.pageination.pageItem * pageIndex;
  305. // 容器
  306. let tables = [];
  307. for (var i = index; i < nums; i++) {
  308. if (that.allTableData[i]) {
  309. tables.push(that.allTableData[i])
  310. }
  311. this.tableData = tables;
  312. }
  313. that.start = index * that.draw;
  314. // that.getTableQuery();
  315. },
  316. // 自动排序
  317. sortChange(params) {
  318. console.log(params)
  319. },
  320. // 过滤时间
  321. filterFmtDate(value, row, column) {
  322. let that = this;
  323. return nonTfmtDate(column, 11);
  324. },
  325. },
  326. watch: {
  327. $route(to) {
  328. if (to.name == 'bindRecord') {
  329. this.getTableQuery();
  330. }
  331. },
  332. },
  333. }
  334. </script>
  335. <style scoped>
  336. @import "../assets/css/panel.css";
  337. .context {
  338. height: 770px;
  339. overflow-y: scroll;
  340. display: block;
  341. margin: 0 auto;
  342. background-color: #fff !important;
  343. padding: 30px;
  344. }
  345. .panel-body {
  346. padding: 20px;
  347. background: #F0F2F5;
  348. }
  349. .change {
  350. width: 100%;
  351. overflow: hidden;
  352. display: block;
  353. margin: 0 auto;
  354. padding-top: 10px;
  355. padding-bottom: 10px;
  356. }
  357. .change button {
  358. float: left;
  359. }
  360. .change button.pull-right {
  361. float: right;
  362. }
  363. .dialogTitle {
  364. width: 100%;
  365. overflow: hidden;
  366. display: block;
  367. margin: 0 auto;
  368. color: #000000;
  369. font-size: 18px;
  370. text-align: center;
  371. }
  372. .dialogTitle em {
  373. float: none;
  374. font-style: normal;
  375. color: #3799FF;
  376. margin: 0;
  377. }
  378. /deep/ .el-transfer-panel__item .el-checkbox__input {
  379. left: 40px;
  380. }
  381. .dialogFooter {
  382. width: 90%;
  383. overflow: hidden;
  384. display: block;
  385. margin: 0 auto;
  386. margin-top: 10px;
  387. }
  388. .dialogFooter button {
  389. float: right;
  390. margin-left: 10px;
  391. }
  392. .dialogContent {
  393. width: 100%;
  394. overflow: hidden;
  395. display: block;
  396. margin: 0 auto;
  397. }
  398. .dialogContent .pull-left {
  399. width: 30%;
  400. float: left;
  401. }
  402. .dialogContent .pull-right {
  403. width: 70%;
  404. float: right;
  405. }
  406. .panel /deep/ .el-date-editor--daterange {
  407. /*width: 260px;*/
  408. }
  409. /deep/ .el-col-4 {
  410. width: 15% !important;
  411. }
  412. .panel /deep/ .el-input__inner {
  413. /*width: 130px;*/
  414. }
  415. .panel /deep/ .el-input {
  416. /*width: 130px;*/
  417. }
  418. .panel /deep/ .el-select {
  419. width: 130px;
  420. }
  421. /deep/ .el-date-editor .el-range-separator {
  422. line-height: 22px;
  423. }
  424. .lessons {
  425. padding: 1px 7px;
  426. border-radius: 250px;
  427. float: left;
  428. color: #000;
  429. }
  430. </style>