手环管理

This commit is contained in:
jjLv 2024-08-02 18:48:54 +08:00
parent 7ce1da4eca
commit 72c9614920
3 changed files with 226 additions and 69 deletions

View File

@ -45,6 +45,15 @@ export function listShBind(query) {
})
}
// 查询手环箱管理页面未绑定手环列表
export function listShNoBind(query) {
return request({
url: '/bracelet/bracelet/listShNoBind',
method: 'get',
params: query
})
}
// 添加手环
export function addSh(data) {
return request({
@ -129,10 +138,27 @@ export function getBoxInfo(shboxId) {
})
}
// 导出
export function exportDevice(query) {
// 详情
export function getBoxNewInfo(shboxId) {
return request({
url: '/bracelet/export/exportDevice',
url: '/bracelet/bracelet/new/' + shboxId,
method: 'get',
})
}
//绑定
export function bindSh(data) {
return request({
url: '/bracelet/bracelet/bindSh',
method: 'post',
data:data
})
}
// 导出
export function exportSh(query) {
return request({
url: '/bracelet/export/exportSh',
method: 'get',
responseType: 'blob',
params: query

View File

@ -310,7 +310,7 @@
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQueryShbox">查询</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQueryTwo">重置</el-button>
</el-form-item>
</el-form>
@ -331,7 +331,7 @@
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
@click="handleExportTemp"
v-hasPermi="['basic:bracelet:export']"
>导出二维码</el-button>
</el-col>
@ -405,7 +405,7 @@
<!-- 手环箱管理页面绑定手环弹窗 -->
<el-dialog :title="title" :visible.sync="showShall" width="1000px" height="1000px" append-to-body>
<el-form :model="queryShBoxall" ref="queryShBoxall" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form :model="queryShBoxall" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item prop="shCode">
<el-input
v-model="queryShBoxall.shCode"
@ -434,9 +434,23 @@
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQueryShBind">查询</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQueryThree">重置</el-button>
</el-form-item>
</el-form>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAddSh()"
v-hasPermi="['basic:bracelet:add']"
>绑定手环</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getboxList"></right-toolbar>
</el-row>
<el-table v-loading="loadingSix" :data="shBindList" width="600px" height = "400px" >
<el-table-column label="手环id" align="center" prop="shId" v-if="false" />
<el-table-column label="手环编码" align="center" prop="shCode" />
@ -454,16 +468,12 @@
type="text"
style="color:red"
icon="el-icon-edit"
@click="handleDelDevice(scope.row)"
@click="handleDelShbox(scope.row)"
v-hasPermi="['basic:sideband:edit']"
>解除绑定</el-button>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
<pagination
v-show="totalTwo>0"
:total="totalTwo"
@ -475,48 +485,32 @@
</el-dialog>
<!-- 手环绑定选择弹窗 -->
<el-dialog :title="title" :visible.sync="showshBind" width="600px" height="600px" append-to-body>
<el-form :model="queryshCodeBind" ref="queryshCodeBind" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item prop="keyword">
<el-input
v-model="queryshCodeBind.keyword"
placeholder="请输入关键词"
clearable
@keyup.enter.native="handleQueryBind"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQueryBind">查询</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loadingThree" :data="shboxListBind" width="600px" height = "400px" >
<el-table-column label="手环箱id" align="center" prop="shboxId" v-if="false" />
<el-table-column label="手环箱名称" align="center" prop="shboxName" />
<el-table-column label="手环箱编码" align="center" prop="shboxCode" />
<el-table-column label="已绑手环" align="center" prop="shboxBindNum" >
<template slot-scope="scope">
<div>
<span style="color: green;">{{ scope.row.shboxBindNum }}/</span><span>{{ scope.row.shboxCapacity }}</span>
</div>
</template>
</el-table-column>
<el-table-column label="选择" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<input type="radio" name="radio" value="1" v-model="radio" @click="getShboxBindName($event,scope.row)"/>
</template>
</el-table-column>
<el-dialog :title="title" :visible.sync="openSh" width="600px" height="600px" append-to-body>
<div> 当前手环箱还可以绑定{{ this.numers }}个手环</div>
<el-table v-loading="loadingSeven" :data="shListNoBind" width="600px" height = "400px" @selection-change="handleSelectionChange" >
<el-table-column type="selection" width="55" align="center" label="选择" :selectable="selectable" />
<el-table-column label="手环id" align="center" prop="shId" v-if="false" />
<el-table-column label="手环编码" align="center" prop="shCode" />
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFormBind"> </el-button>
<el-button @click="cancelBind"> </el-button>
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleBindSh"
v-hasPermi="['basic:bracelet:add']"
>绑定</el-button>
<el-button @click="cancelBindTemp"> </el-button>
</div>
<pagination
v-show="totalThree>0"
:total="totalThree"
:page.sync="queryshCodeBind.pageNum"
:limit.sync="queryshCodeBind.pageSize"
@pagination="getListBind"
/>
<!-- <pagination
v-show="totalTwo>0"
:total="totalTwo"
:page.sync="queryshNoBind.pageNum"
:limit.sync="queryshNoBind.pageSize"
@pagination="getListNoBind"
/> -->
</el-dialog>
@ -598,8 +592,8 @@
</template>
<script>
import { listBracelet, listShboxall,delShById, exportDevice,listShbox,addSh,listShboxBind,addShBind,delSh,editSh,
getBoxInfo,editBox,addBox,delShboxById,listShBind} from "@/api/base/bracelet";
import { listBracelet, listShboxall,delShById, exportSh,listShbox,addSh,listShboxBind,addShBind,delSh,editSh,
getBoxInfo,editBox,addBox,delShboxById,listShBind,listShNoBind,bindSh,getBoxNewInfo} from "@/api/base/bracelet";
import { downloadFile } from '@/utils/download'
import { getToken } from '@/utils/auth'
@ -625,6 +619,8 @@
loadingFive:true,
// 6
loadingSix:true,
// 7
loadingSeven:true,
//
ids: [],
//
@ -647,6 +643,8 @@
shboxallList:[],
//
shboxListBind: [],
//
shListNoBind: [],
//
bindNoList: [],
//
@ -663,6 +661,7 @@
StatusList:[],
selectOption:false,
zero:0,
shboxbindId:0,
Qrcode:"",
//
queryParams: {
@ -692,6 +691,20 @@
shboxCapacity: undefined,
shboxBindNum: undefined,
},
numers:0,
addNums:0,
numersTemp:0,
Capacity: 0,
BindNum: 0,
boxId:0,
queryshNoBind:{
pageNum: 1,
pageSize: 10,
shId: undefined,
shCode: undefined,
shboxId: undefined,
},
queryshEdit:{
pageNum: 1,
pageSize: 10,
@ -720,6 +733,7 @@
shStatus:undefined,
},
showsh:false,
showshBind:false,
@ -731,6 +745,8 @@
showShall:false,
openbox:false,
openSh:false,
stateList:['在用','未用'],
accept:'.png, .jpg, .jpeg, .pdf, .doc, .docx',
@ -814,6 +830,22 @@
});
},
selectAll() {
this.$refs.MainTable.clearSelection();
},
selectable(row, index) {
if(this.numers==0){
if(this.ids.indexOf(row.shId) != -1){
return true;
}else{
return false;
}
}else{
return true;
}
},
//
cancel() {
this.showsh = false;
@ -824,6 +856,11 @@
this.showshBind = false;
this.resetBind();
},
//
cancelBindTemp() {
this.openSh = false;
this.resetBindTemp();
},
//
cancelbox() {
@ -844,6 +881,11 @@
this.queryshCodeBind = {};
this.resetForm("queryshCodeBind");
},
resetBindTemp() {
this.queryshNoBind = {};
this.resetForm("queryshNoBind");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
@ -874,9 +916,24 @@
this.resetForm("queryForm");
this.handleQuery();
},
/** 重置按钮操作 */
resetQueryTwo() {
this.resetForm("queryForm");
this.handleQueryShbox();
},
/** 重置按钮操作 */
resetQueryThree() {
this.resetForm("queryForm");
this.handleQueryShBind();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.deviceId)
this.numers=this.addNums;
this.numers=this.numers-selection.length
this.ids = selection.map(item => item.shId);
this.single = selection.length!=1
this.multiple = !selection.length
},
@ -890,11 +947,28 @@
return delSh(param);
}).then(() => {
this.getList();
// this.getListTemp();
this.getBoxInfo();
this.$modal.msgSuccess("解除绑定成功");
}).catch(() => {});
},
/** 手环箱管理页面解除绑定操作 */
handleDelShbox(row) {
console.log(row)
const param = {
shId:row.shId,
}
this.$modal.confirm('确定把该手环与手环箱解除绑定吗?解绑后重新绑定才能继续使用!').then(function() {
return delSh(param);
}).then(() => {
this.getboxList();
this.getListBoxall();
this.$modal.msgSuccess("解除绑定成功");
this.BindNum = this.BindNum - 1;
this.numers = this.Capacity - this.BindNum;
}).catch(() => {});
},
handleQuertPage(row){
const qrCodeData = {
"设备类型": row.deviceType,
@ -924,6 +998,37 @@
this.title = "新增手环箱";
},
/** 手环箱管理页面绑定手环按钮操作 */
handleAddSh() {
this.openSh = true;
this.title = "绑定手环";
this.getListNoBind();
},
/** 绑定操作 */
handleBindSh(row) {
const shIds = row.shId || this.ids;
console.log(shIds)
const param = {
shboxId:this.shboxbindId,
shIds:shIds,
}
console.log(param)
this.$modal.confirm('确定与该手环箱绑定吗?').then(function() {
return bindSh(param);
}).then(() => {
this.getBoxInfo();
this.getboxList();
this.getListBoxall();
this.getListNoBind();
this.$modal.msgSuccess("绑定成功");
this.openSh = false;
}).catch(() => {});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
@ -1071,7 +1176,7 @@
},
/** 手环箱管理页面提交按钮 */
/** 手环箱管理页面提交按钮 */
submitFormbox() {
this.$refs["formTwo"].validate(valid => {
if (valid) {
@ -1142,8 +1247,8 @@
/** 导出按钮操作 */
handleExport() {
exportDevice(this.queryParams).then(res => {
downloadFile({ fileName: `设备_${new Date().getTime()}.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
exportSh(this.queryParams).then(res => {
downloadFile({ fileName: `手环_${new Date().getTime()}.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
})
},
@ -1208,14 +1313,17 @@
});
},
//
openShbox(row){
// this.sidebandId = row.sidebandId;
this.title = "新增手环"
this.showsh = true;
this.getListTemp();
this.queryshCode.pageNum = 1;
this.queryshCode.shCode = undefined;
/** 查询手环未绑定列表 */
getListNoBind(){
this.loadingSeven = true;
this.queryshNoBind.shboxId = this.queryShBoxall.shboxId;
console.log(this.queryshNoBind)
listShNoBind(this.queryshNoBind).then(response => {
this.shListNoBind = response.rows;
console.log(this.shboxListBind)
this.totalTwo = response.total;
this.loadingSeven = false;
});
},
//
@ -1251,11 +1359,31 @@
//
openShall(row){
this.shboxId = row.shboxId;
this.title = "绑定的手环信息"
console.log(row)
this.title = "绑定的手环信息",
this.boxId = row.shboxId;
this.Capacity = Number(row.shboxCapacity),
this.BindNum = Number(row.shboxBindNum),
// this.numers = Number(row.shboxCapacity)-Number(row.shboxBindNum);
// this.addNums = this.numers;
this.queryShBoxall.shboxId = row.shboxId;
this.showShall = true;
this.getListBoxall();
this.getBoxInfo();
this.shboxbindId = row.shboxId;
},
//
getBoxInfo(){
console.log("------->"+this.shboxId);
getBoxNewInfo(this.boxId).then(response => {
console.log(response.data.boxNum)
this.numers = response.data.boxNum;
this.addNums = response.data.boxNum;
})
},
//
cancelGt(){
@ -1291,4 +1419,7 @@
display: none;
}
}
::v-deep .el-table__header-wrapper .el-checkbox {
display: none;
}
</style>

View File

@ -1,7 +1,7 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item prop="devcieType">
<el-form-item prop="deviceType">
<el-select v-model="queryParams.deviceType" placeholder="设备类型" clearable style="width: 100%;">
<el-option
v-for="dict in dict.type.sys_device_type"