| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798 |
- <template>
- <div class="context">
- <div class="panel">
- <h5>心率设备</h5>
- <div class="panel-body">
- <div class="panel_control">
- <el-row :gutter="20">
- <el-col :span="4">
- <em>心率设备:</em>
- <el-input v-model="panel.str" placeholder="请输入编号" type="number"></el-input>
- </el-col>
- <el-col :span="4">
- <em>设备状态:</em>
- <!--status-->
- <el-select v-model="panel.status" placeholder="请选择">
- <el-option
- v-for="item in panel.statusOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-col>
- <el-col :span="4">
- <el-button size="" type="primary" @click="query" plain>查询</el-button>
- </el-col>
- </el-row>
- </div>
- </div>
- </div>
- <div class="change">
- <el-button @click="addMember" type="primary">新增心率设备</el-button>
- <el-button @click="editList">编辑心率设备</el-button>
- <el-button @click="delList" type="danger">删除心率设备</el-button>
- </div>
- <div class="table">
- <el-table
- :data="tableData"
- border
- is-horizontal-resize
- :default-sort="{prop: 'date', order: 'descending'}"
- element-loading-background="rgba(0, 0, 0, 0.8)"
- class=""
- @selection-change="handleSelectionChange" @current-change="clickChange"
- >
- >
- <el-table-column label="选择" width="55">
- <template slot-scope="scope">
- <el-radio v-model="tableRadio" :label="scope.row"><i></i></el-radio>
- </template>
- </el-table-column>
- <!--<el-table-column-->
- <!--type="index"-->
- <!--label="序号"-->
- <!--align="center"-->
- <!--width="50">-->
- <!--</el-table-column>-->
- <el-table-column
- prop="InVenueNo"
- label="馆内编号"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="Sn"
- label="序列号"
- align="InVenueNo"
- >
- </el-table-column>
- <el-table-column
- prop="UserName"
- label="用户"
- align="center"
- sortable
- >
- <template slot-scope="scope">
- {{scope.row.UserName}}
- <!--<el-select v-model="scope.row.BindUserId" @change="getRowTop(scope.row)" filterable v-if="scope.row.BindUserId">-->
- <!--<el-option-->
- <!--v-for="item in panel.options"-->
- <!--:key="item.value"-->
- <!--:label="item.label"-->
- <!--:value="item.value">-->
- <!--</el-option>-->
- <!--</el-select>-->
- <!--<el-button @click="takeBack(scope.row)" type="danger" v-if="!scope.row.BindUserId">{{scope.row.UserName}} 设备收回</el-button>-->
- </template>
- </el-table-column>
- <el-table-column
- prop="Status"
- label="状态"
- align="center"
- >
- <template slot-scope="scope">
- <!--1:启用 8:暂停 9:删除-->
- <span v-if="scope.row.Status == 1" style="color: #67c23a">已启用</span>
- <span v-if="scope.row.Status == 8" style="color: #E6A23C">已暂停</span>
- <span v-if="scope.row.Status == 9" style="color: red">已删除</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="id"
- label="操作"
- >
- <template slot-scope="scope">
- <el-button type="success" v-if="scope.row.Status == 8" size="mini"
- @click="pauseRow(scope.row,1)">
- 启用
- </el-button>
- <el-button type="warning" v-if="scope.row.Status == 1" size="mini"
- @click="pauseRow(scope.row,8)">
- 暂停
- </el-button>
- <el-button type="text" @click="goPage(scope.row)">记录</el-button>
- </template>
- </el-table-column>
- </el-table>
- <br>
- <el-pagination
- background
- :total="pageination.total"
- :page-size="pageination.pageItem"
- @current-change="pageChange"
- ></el-pagination>
- </div>
- <el-dialog :title="dialogTitle" :visible.sync="dialogMemberVisible" width="650px">
- <div class="dialogContent">
- <div class="">
- <el-form ref="form" :model="form" label-width="160px">
- <el-form-item label="馆内编号" :required="true">
- <el-input v-model="form.venueNo"></el-input>
- </el-form-item>
- <el-form-item label="序列号" :required="true">
- <el-input v-model="form.sn"></el-input>
- </el-form-item>
- </el-form>
- </div>
- </div>
- <div class="dialogFooter">
- <el-button type="primary" size="small" v-if="form.btnType == 0" @click="confirmMember">确定</el-button>
- <el-button type="primary" size="small" v-if="form.btnType == 1" @click="confirmEditMember">确定
- </el-button>
- <el-button size="small" @click="dialogMemberVisible = false">取消</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import Global from '../Global.js'
- import {
- testTable,
- testSelect,
- ShopManagerStatusEdit,
- ClassDetailOne,
- QueryHrSensors,
- AddHrSensors,
- HrSensorsStatusEdit,
- EditHrSensors,
- UnBindHrSensorsToUser,
- ShopVenueEquipEditStatus,
- } from "../api/getApiRes";
- let qs = require('qs');
- export default {
- data() {
- return {
- dialogVisible: false,//其他dialog
- dialogMemberVisible: false,//新增心率设备dialog
- dialogLesson: false,//课时调整
- dialogGift: false,//赠送课时调整
- dialogExpTime: false,//有效期调整
- dialogLessonTable: false,//心率设备课程
- dialogTitle: '新增心率设备',
- dialogValue: [],
- tableRadio: [],
- // panel 配置项目
- panel: {
- str: '',
- phone: '',
- compname: '',
- keyword: '',
- USERCODE: '',
- endType: '',
- taskstatus: 99,
- status: "",
- draw: 1,
- start: 0,
- recordsTotal: 0,
- tableData: [],
- allTableData: [],
- limit: '10',
- multipleSort: false,
- loading: false,
- fileList: [],
- multipleSelection: [],
- detectedmac: '',
- statusOptions: [
- {value: "", label: '全部'},
- {value: 1, label: '启用'},
- {value: 8, label: '暂停'},
- {value: 9, label: '删除'},
- ], options: [
- {value: 99, label: '全部'},
- {value: 1, label: '进行中'},
- {value: 2, label: '已完成'},
- ],
- endTypeOptions: [
- {value: 99, label: '全部'},
- {value: 30, label: '近一个月'},
- {value: 7, label: '近一周'},
- {value: 1, label: '当日'},
- ],
- time1: globalBt(),
- },
- multipleSelection: [],
- pageination: {
- pageItem: 100,
- pageoptions: pageOptions(),
- total: 100,
- pageIndex: 1,
- },
- form: {
- name: '',
- userCode: '',
- sn: '',
- venueNo: '',
- shopId: '',
- teacherId: 0,
- memberType: 1,
- lesson: 1,
- gift: 1,
- btnType: 0,//0新建,1编辑编辑
- memo: '',
- phone: '',
- expTime: '',
- dialogdata: [],//穿梭待选
- dialogValue: [],//穿梭已选
- },
- memberTypes: [
- {value: 1, label: '年心率设备'},
- {value: 2, label: '充值心率设备'},
- ],
- tableData: []
- }
- },
- mounted() {
- this.getTableQuery();
- },
- methods: {
- // 设备回收
- takeBack(row) {
- let that = this;
- this.$confirm('是否回收用户' + row.name + '的心率设备?', '回收操作', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let param = {
- token: localStorage.token,
- Id: row.Id,
- status: 0,
- };
- let postdata = qs.stringify(param);
- UnBindHrSensorsToUser(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: row.name + '回收成功!',
- type: 'success'
- });
- // table 重载
- that.getTableQuery();
- } else {
- that.$message.error(json.Memo);
- }
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消回收'
- });
- });
- },
- goPage(row) {
- // 查看绑定记录
- this.$router.push({path: '/bindRecord', query: {hrId: row.HrId}});
- },
- // 编辑
- editList() {
- let that = this;
- this.clearForm();
- console.log(this.tableRadio);
- if (this.tableRadio.length == 0) {
- this.$message.error("请先选中一条记录");
- return false
- }
- let row = this.tableRadio;
- this.form.shopid = row.ShopId;
- this.form.userId = row.Id;
- this.form.name = row.Name;
- this.form.userCode = row.Usercode;
- this.form.password = '';
- this.form.hrId = row.HrId;
- this.form.sn = row.Sn;
- this.form.venueNo = row.InVenueNo;
- this.dialogVisible = true;
- this.dialogTitle = '编辑心率设备';
- this.form.btnType = 1;
- this.dialogMemberVisible = true
- },
- clickChange(item) {
- this.tableRadio = item
- },
- // 选择课程后,获取当前课程的建议上课人数和课时消耗
- getRowTop(row) {
- let that = this;
- console.log(row);
- let param = {
- token: localStorage.token,
- classId: row.ClassId,
- };
- let postdata = qs.stringify(param);
- ClassDetailOne(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- row.TopLimit = json.Rs.TopLimit;
- row.ConsumeHour = json.Rs.ConsumeHour;
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 编辑
- editMember(row) {
- this.clearForm();
- this.form.name = row.Name;
- this.form.phone = row.Phone;
- this.form.shopId = row.ShopId;
- this.form.teacherId = row.TeacherId;
- this.form.btnType = 1;
- this.dialogMemberVisible = true
- this.dialogTitle = '编辑心率设备'
- },
- // 禁用
- pauseRow(row, status) {
- let that = this;
- let param = {
- token: localStorage.token,
- hrId: row.HrId,
- status: status,//1:启用 8:暂停 9:删除
- };
- let postdata = qs.stringify(param);
- HrSensorsStatusEdit(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: '执行成功!',
- type: 'success'
- });
- // table 重载
- that.getTableQuery();
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // pauseRow(row) {
- // let that = this;
- // this.$confirm('是否禁用心率设备' + row.Sn + '?', '禁用操作', {
- // confirmButtonText: '确定',
- // cancelButtonText: '取消',
- // type: 'warning'
- // }).then(() => {
- // let param = {
- // token: localStorage.token,
- // shopId : localStorage.token,
- // status: 8,
- // };
- // let postdata = qs.stringify(param);
- // ShopVenueEquipEditStatus(postdata).then(res => {
- // let json = res;
- // if (json.Code == 0) {
- // that.$message({
- // showClose: true,
- // message: row.name + '禁用成功!',
- // type: 'success'
- // });
- // // table 重载
- // that.getTableQuery();
- // } else {
- // that.$message.error(json.Memo);
- // }
- // })
- // }).catch(() => {
- // this.$message({
- // type: 'info',
- // message: '已取消禁用'
- // });
- // });
- // },
- // 启用
- runRow(row) {
- let that = this;
- this.$confirm('是否启用心率设备' + row.Sn + '?', '启用操作', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let param = {
- token: localStorage.token,
- Id: row.Id,
- status: 1,
- };
- let postdata = qs.stringify(param);
- testTable(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: row.name + '启用成功!',
- type: 'success'
- });
- // table 重载
- that.getTableQuery();
- } else {
- that.$message.error(json.Memo);
- }
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消启用'
- });
- });
- },
- // 关闭所有
- allDialogClose() {
- this.dialogVisible = false;
- this.dialogGift = false;
- this.dialogLesson = false;
- this.dialogExpTime = false;
- this.dialogLessonTable = false;
- },
- // 确认提交新增心率设备
- confirmMember() {
- let that = this;
- // checkNum
- if (!that.form.sn) {
- this.$message.error('错了哦,编号不能为空');
- return false
- }
- if (that.form.sn.length > 20) {
- this.$message.error('错了哦,编号不能超过20个字符');
- return false
- }
- if (!that.form.venueNo) {
- this.$message.error('错了哦,实体序列号不能为空');
- return false
- }
- if (that.form.venueNo.length > 30) {
- this.$message.error('错了哦,实体序列号不能超过30个字符');
- return false
- }
- let param = {
- token: localStorage.token,
- shopId: localStorage.shopId,
- sn: that.form.sn,
- venueNo: that.form.venueNo,
- };
- let postdata = qs.stringify(param);
- AddHrSensors(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- // 关闭弹窗
- that.dialogMemberVisible = false;
- // 重载列表
- that.getTableQuery();
- that.$message({
- showClose: true,
- message: '心率设备添加成功!',
- type: 'success'
- });
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- confirmEditMember() {
- let that = this;
- // checkNum
- if (!that.form.sn) {
- this.$message.error('错了哦,编号不能为空');
- return false
- }
- if (that.form.sn.length > 20) {
- this.$message.error('错了哦,编号不能超过20个字符');
- return false
- }
- if (!that.form.venueNo) {
- this.$message.error('错了哦,实体序列号不能为空');
- return false
- }
- if (that.form.venueNo.length > 30) {
- this.$message.error('错了哦,实体序列号不能超过30个字符');
- return false
- }
- let param = {
- token: localStorage.token,
- shopId: localStorage.shopId,
- hrId: that.form.hrId,
- sn: that.form.sn,
- venueNo: that.form.venueNo,
- };
- let postdata = qs.stringify(param);
- EditHrSensors(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- // 关闭弹窗
- that.dialogMemberVisible = false;
- // 重载列表
- that.getTableQuery();
- that.$message({
- showClose: true,
- message: '心率设备信息编辑成功!',
- type: 'success'
- });
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 确认提交课时
- confirmLesson() {
- let that = this;
- // checkNum
- let param = {
- token: localStorage.token,
- userCode: that.form.userCode,
- lesson: that.form.lesson,
- };
- let postdata = qs.stringify(param);
- testSelect(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- // 关闭弹窗
- that.dialogVisible = false;
- // 重载列表
- that.getTableQuery();
- that.$message({
- showClose: true,
- message: '课时调整成功!',
- type: 'success'
- });
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 新增心率设备
- addMember() {
- this.clearForm();
- this.dialogMemberVisible = true;
- this.btnType = 0;
- this.dialogTitle = '新增心率设备'
- },
- // 删除
- delList() {
- let that = this;
- if (this.tableRadio.length == 0) {
- this.$message.error("请先选中一条记录");
- return false
- }
- let hrId = this.tableRadio.HrId;
- let param = {
- token: localStorage.token,
- hrId: hrId,
- status: 9,//1:启用,8:暂停,9:删除
- };
- let postdata = qs.stringify(param);
- this.$confirm('此操作将永久删除该心率设备, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- HrSensorsStatusEdit(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: '选中的心率设备已删除!',
- type: 'success'
- });
- // 重载列表
- that.getTableQuery();
- } else {
- that.$message.error(json.Memo);
- }
- });
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- handleSelectionChange(val) {
- this.multipleSelection = val;
- },
- // 查询按钮
- query() {
- this.getTableQuery();
- this.$message.success('查询完毕');
- },
- clearForm() {
- // clear
- this.form.name = '';
- this.form.sn = '';
- this.form.venueNo = '';
- this.form.phone = '';
- this.form.userCode = '';
- this.form.shopId = '';
- },
- // 页面数据查询
- getTableQuery() {
- let that = this;
- that.loading = true;
- let param = {
- token: localStorage.token,
- str: this.panel.str,//
- status: this.panel.status,//
- shopId: localStorage.shopId,//
- };
- let postdata = qs.stringify(param);
- QueryHrSensors(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.loading = false;
- if (json.Rs) {
- that.allTableData = json.Rs;
- that.recordsTotal = json.Rs.length;
- } else {
- that.allTableData = [];
- that.recordsTotal = 0;
- }
- // 设置分页数据
- that.setPaginations();
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 设置分页数据
- setPaginations() {
- // 分页属性
- let that = this;
- that.pageination.total = that.recordsTotal;
- // 默认分页
- that.tableData = that.allTableData.filter((item, index) => {
- return index < that.pageination.pageItem;
- });
- },
- // 每页显示数量
- handleSizeChange() {
- let that = this;
- that.tableData = that.allTableData.filter((item, index) => {
- return index < that.pageination.pageItem;
- });
- that.draw = that.pageination.pageItem;
- // that.getTableQuery();
- },
- // 翻页
- pageChange(pageIndex) {
- let that = this;
- // 获取当前页
- let index = that.pageination.pageItem * (pageIndex - 1);
- // 数据总数
- let nums = that.pageination.pageItem * pageIndex;
- // 容器
- let tables = [];
- for (var i = index; i < nums; i++) {
- if (that.allTableData[i]) {
- tables.push(that.allTableData[i])
- }
- this.tableData = tables;
- }
- that.start = index * that.draw;
- // that.getTableQuery();
- },
- // 自动排序
- sortChange(params) {
- console.log(params)
- },
- },
- }
- </script>
- <style scoped>
- @import "../assets/css/panel.css";
- .context {
- height: 770px;
- overflow-y: scroll;
- display: block;
- margin: 0 auto;
- background-color: #fff !important;
- padding: 30px;
- }
- .panel-body {
- padding: 20px;
- background: #F0F2F5;
- }
- .change {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- padding-top: 10px;
- padding-bottom: 10px;
- }
- .change button {
- float: left;
- }
- .change button.pull-right {
- float: right;
- }
- .dialogTitle {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- color: #000000;
- font-size: 18px;
- text-align: center;
- }
- .dialogTitle em {
- float: none;
- font-style: normal;
- color: #3799FF;
- margin: 0;
- }
- /deep/ .el-transfer-panel__item .el-checkbox__input {
- left: 40px;
- }
- .dialogFooter {
- width: 90%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- margin-top: 10px;
- }
- .dialogFooter button {
- float: right;
- margin-left: 10px;
- }
- .dialogContent {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .dialogContent .pull-left {
- width: 30%;
- float: left;
- }
- .dialogContent .pull-right {
- width: 70%;
- float: right;
- }
- </style>
|