heartEquip.vue 33 KB

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