| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653 |
- <template>
- <div class="context">
- <el-page-header @back="goBack" content="关联手机号"></el-page-header>
- <div class="panel">
- <br>
- <h5> {{regionName}}</h5>
- </div>
- <div class="change">
- <el-button @click="addMember" type="primary">新增手机号</el-button>
- <el-button @click="editList">编辑手机号</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="UserName"
- label="主账号用户名"
- >
- </el-table-column>
- <el-table-column
- prop="UserPhone"
- label="手机号"
- >
- </el-table-column>
- <el-table-column
- prop="Status"
- label="状态"
- >
- <!--1:启用 8:暂停 9:删除-->
- <template slot-scope="scope">
- <span v-if="scope.row.Status == 1" style="color: yellowgreen">启用</span>
- <span v-if="scope.row.Status == 8" style="color: yellow">暂停</span>
- <span v-if="scope.row.Status == 9" style="color: red">删除</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="Memo"
- label="备注"
- >
- </el-table-column>
- <el-table-column
- prop="UserPhone"
- label="操作">
- <template slot-scope="scope">
- <el-button type="danger" size="mini"
- @click="pauseRowDel(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="手机号">
- <el-input v-model="form.phone"></el-input>
- </el-form-item>
- <el-form-item label="备注">
- <el-input v-model="form.memo" placeholder="姓名或家庭关系"></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,
- ShopManagerStatusEdit,
- VipUserAssociatedPhoneSimpleQuery,
- VipUserAssociatedPhoneAdd,
- EditShopVenueEquip,
- VipUserAssociatedPhoneEdit,
- VipUserAssociatedPhoneDel,
- VipUserAssociatedPhoneStatusEdit
- } from "../api/getApiRes";
- let qs = require('qs');
- export default {
- data() {
- return {
- regionName: '',
- dialogVisible: false,
- dialogMemberVisible: false,
- dialogTitle: '新增手机号',
- // panel 配置项目
- multipleSelection: [],
- tableRadio: [],
- pageination: {
- pageItem: 100,
- pageoptions: pageOptions(),
- total: 100,
- pageIndex: 1,
- },
- form: {
- phone: '',
- memo: '',
- eqId: '',
- eqSn: '',
- name: '',
- version: '',
- userCode: '',
- shopId: '',
- pId: '',
- btnType: 0,
- equipType: 1,
- },
- options: [
- {value: 1, label: 'TVBox'},
- {value: 2, label: 'BLEHub'},
- ],
- shops: [],
- tableData: [],
- serachBtnStatus: false,
- }
- },
- mounted() {
- this.regionName = this.$route.query.name;
- this.getTableQuery();
- },
- methods: {
- goBack() {
- this.$router.push({
- path: '/member', query: {}
- });
- },
- // 删除
- pauseRowDel(row) {
- let that = this;
- let param = {
- token: localStorage.token,
- userId: this.$route.query.userId,
- pId: row.PId,
- };
- let postdata = qs.stringify(param);
- this.$confirm('此操作将永久删除该手机号, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- VipUserAssociatedPhoneDel(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 + ' 错误码:' + json.Code);
- }
- });
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- clearForm() {
- // clear
- this.form.name = '';
- this.form.phone = '';
- this.form.memo = '';
- this.form.userCode = '';
- this.form.shopId = '';
- this.form.eqSn = '';
- this.form.version = '';
- this.form.pId = '';
- this.form.equipType = 1;
- },
- handleSelectionChange(val) {
- this.multipleSelection = val;
- },
- // 新增手机号
- addMember() {
- this.clearForm();
- this.dialogMemberVisible = true;
- this.form.btnType = 0;
- this.dialogTitle = '新增手机号'
- },
- clickChange(item) {
- this.tableRadio = item
- },
- // 删除
- delList() {
- let that = this;
- if (this.tableRadio.length == 0) {
- this.$message.error("请先选中一条记录");
- return false
- }
- let userId = this.tableRadio.Id;
- let param = {
- key: localStorage.ServiceKey,
- shopId: localStorage.ServiceId,
- svId: this.$route.query.svId,
- eqId: this.tableRadio.EqId,
- status: 9,//1:启用 8:暂停 9:删除
- };
- let postdata = qs.stringify(param);
- this.$confirm('此操作将永久删除该手机号, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- VipUserAssociatedPhoneStatusEdit(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 + ' 错误码:' + json.Code);
- }
- });
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- // 编辑
- editList() {
- let that = this;
- this.clearForm();
- 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.phone = row.UserPhone;
- this.form.userCode = row.Usercode;
- this.form.pId = row.PId;
- this.form.password = '';
- this.form.eqId = row.EqId;
- this.form.equipType = row.EquipType;
- this.form.memo = row.Memo;
- this.form.adminType = row.AdminType;
- this.dialogVisible = true;
- this.dialogTitle = '编辑手机号';
- this.form.btnType = 1;
- this.dialogMemberVisible = true
- },
- // 确认提交新增手机号
- confirmMember() {
- let that = this;
- if (!that.form.phone) {
- this.$message.error('错了哦,手机号码不能为空');
- return false
- }
- if (!globalCheckPhone(that.form.phone)) {
- this.$message.error('错了哦,手机号格式不正确');
- return false
- }
- if (that.form.memo) {
- if (that.form.memo.length > 200) {
- this.$message.error('错了哦,备注字数超过200个字');
- return false
- }
- }
- let param = {
- token: localStorage.token,
- userId: this.$route.query.userId,
- phone: this.form.phone,
- memo: this.form.memo,
- };
- let postdata = qs.stringify(param);
- VipUserAssociatedPhoneAdd(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 + ' 错误码:' + json.Code);
- }
- })
- },
- confirmEditMember() {
- let that = this;
- console.log(that.form.version.length);
- // checkNum
- if (!that.form.phone) {
- this.$message.error('错了哦,手机号码不能为空');
- return false
- }
- if (!globalCheckPhone(that.form.phone)) {
- this.$message.error('错了哦,手机号格式不正确');
- return false
- }
- if (that.form.memo) {
- if (that.form.memo.length > 200) {
- this.$message.error('错了哦,备注字数超过200个字');
- return false
- }
- }
- let param = {
- token: localStorage.token,
- userId: this.$route.query.userId,
- phone: this.form.phone,
- memo: this.form.memo,
- pId: this.form.pId,
- };
- let postdata = qs.stringify(param);
- VipUserAssociatedPhoneEdit(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 + ' 错误码:' + json.Code);
- }
- })
- },
- // 查询按钮
- query() {
- // 按钮倒计时
- let that = this;
- that.serachBtnStatus = true;
- let totalTime = 2;
- let clock = window.setInterval(() => {
- totalTime--;
- if (totalTime < 0) {
- totalTime = 2;
- that.serachBtnStatus = false;
- }
- }, 1000);
- this.getTableQuery();
- this.$message.success('查询完毕');
- },
- // 页面数据查询
- getTableQuery() {
- let that = this;
- that.loading = true;
- let param = {
- token: localStorage.token,
- userId: this.$route.query.userId,
- };
- let postdata = qs.stringify(param);
- VipUserAssociatedPhoneSimpleQuery(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 + ' 错误码:' + json.Code);
- }
- })
- },
- // 设置分页数据
- 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)
- },
- // 过滤时间
- filterFmtDate(value, row, column) {
- let that = this;
- return nonTfmtDate(column, 11);
- },
- // 暂停
- pause(row) {
- let that = this;
- console.log(row);
- this.$confirm('是否暂停设备' + row.EqSn + '?', '暂停操作', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let param = {
- key: localStorage.ServiceKey,
- shopId: localStorage.ServiceId,
- svId: this.$route.query.svId,
- eqId: row.EqId,
- status: 8,//1:启用 8:暂停 9:删除
- };
- let postdata = qs.stringify(param);
- VipUserAssociatedPhoneStatusEdit(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: row.EqSn + '暂停成功!',
- type: 'success'
- });
- // table 重载
- that.getTableQuery();
- } else {
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消暂停'
- });
- });
- },
- // 开启
- run(row) {
- let that = this;
- this.$confirm('是否开启设备' + row.EqSn + '?', '开启操作', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let param = {
- key: localStorage.ServiceKey,
- shopId: localStorage.ServiceId,
- svId: this.$route.query.svId,
- eqId: row.EqId,
- status: 1,//1:启用 8:暂停 9:删除
- };
- let postdata = qs.stringify(param);
- VipUserAssociatedPhoneStatusEdit(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: row.EqSn + '开启成功!',
- type: 'success'
- });
- // table 重载
- that.getTableQuery();
- } else {
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消开启'
- });
- });
- },
- },
- watch: {
- $route(to) {
- if (to.name == 'relevancePhone') {
- this.getTableQuery();
- }
- },
- },
- }
- </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;
- padding-bottom: 60px;
- }
- .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;
- }
- /deep/ .el-date-editor .el-range__icon {
- line-height: 22px;
- }
- .panel /deep/ .el-date-editor .el-range-separator {
- line-height: 22px;
- }
- /deep/ .el-select {
- width: 100%;
- }
- .panel h5 {
- font-size: 24px;
- }
- /*ipad only*/
- @media only screen and (max-width: 1366px) {
- .panel /deep/ .el-date-editor--daterange {
- width: 100%;
- }
- }
- </style>
|