lj-zhgd-htweb/src/views/base/bracelet/index.vue

1943 lines
70 KiB
Vue
Raw Normal View History

2024-08-02 11:13:37 +08:00
<template>
<el-tabs v-model="activeName" @tab-click="handleClick" class="app-container">
<el-tab-pane label="手环管理" name="first" onclick="handleQuery">
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item prop="shCode">
<el-input
v-model="queryParams.shCode"
placeholder="请输入手环编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item prop="shboxName">
<el-input
v-model="queryParams.shboxName"
placeholder="请输入手环箱名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item prop="shboxCode">
<el-input
v-model="queryParams.shboxCode"
placeholder="请输入手环箱编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item prop="shPersonName">
<el-input
v-model="queryParams.shPersonName"
placeholder="请输入使用人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item prop="shStatus">
<el-select v-model="queryParams.shStatus" placeholder="状态" clearable style="width: 100%;">
<el-option
v-for="dict in dict.type.sys_sh_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</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="openShbox"
v-hasPermi="['basic:bracelet:add']"
>新增手环</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['basic:bracelet:export']"
>导出数据</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
2024-08-16 16:26:19 +08:00
<el-table v-loading="loading" :data="braceletList" ref="multipleTableSh" row-key="shId" @selection-change="handleSelectionChangeSh" @select="handlerSelectSh" @select-all="handlerSelectAllSh">
<el-table-column type="selection" width="55" align="center" :reserve-selection="true" />
2024-08-09 17:27:21 +08:00
<el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope">
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
2024-08-02 11:13:37 +08:00
<el-table-column label="手环id" align="center" prop="shId" v-if="false" />
<el-table-column label="手环编码" align="center" prop="shCode" sortable/>
<el-table-column label="所属手环箱" align="center" prop="shboxName" sortable>
2024-08-02 11:13:37 +08:00
<template slot-scope="scope">
<div v-if="scope.row.shboxName!=boxName" >
{{ scope.row.shboxName }}
<el-button
size="mini"
type="text"
icon="el-icon-edit"
style="color: red ;"
@click="handleDelSh(scope.row)"
v-hasPermi="['basic:bracelet:edit']"
>解绑</el-button>
</div>
<div v-if="scope.row.shboxName==boxName" >
{{ scope.row.shboxName }}
<el-button
size="mini"
type="text"
style="color: green ;"
icon="el-icon-link"
@click="openShboxTemp(scope.row)"
v-hasPermi="['basic:bracelet:edit']"
>绑定</el-button>
</div>
</template>
</el-table-column>
<el-table-column label="手环状态" align="center" prop="shStatus" sortable>
2024-08-02 11:13:37 +08:00
<template slot-scope="scope">
<div v-if="scope.row.shStatus==0" style="color: green;">{{ stateList[Number(scope.row.shStatus)] }}</div>
<div v-if="scope.row.shStatus==1" style="color: red;">{{ stateList[Number(scope.row.shStatus)] }}</div>
</template>
</el-table-column>
<el-table-column label="使用人" align="center" prop="shPersonName" sortable/>
2024-08-09 17:27:21 +08:00
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" >
2024-08-02 11:13:37 +08:00
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['basic:bracelet:edit']"
>编辑</el-button>
2024-08-08 13:15:49 +08:00
<el-button
size="mini"
type="text"
2024-08-09 17:27:21 +08:00
icon="el-icon-circle-plus-outline"
2024-08-13 16:17:44 +08:00
@click="openDeviceAttribute(scope.row)"
2024-08-08 13:15:49 +08:00
v-hasPermi="['basic:bracelet:edit']"
2024-08-09 17:27:21 +08:00
>设备属性</el-button>
2024-08-02 11:13:37 +08:00
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['basic:bracelet:del']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 手环弹窗 -->
<el-dialog :title="title" :visible.sync="showsh" width="600px" height="600px" append-to-body>
<el-form :model="queryshCode" ref="queryshCode" :rules="rules" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="手环编码" prop="shCode">
<el-input
v-model="queryshCode.shCode"
placeholder="请输入手环编码"
/>
</el-form-item>
</el-form>
<el-table v-loading="loadingTwo" :data="shboxList" 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="radioOne" :checked="shboxIdOne==scope.row.shboxId" @click="getShboxName($event,scope.row)"/>
2024-08-08 13:15:49 +08:00
</template>
2024-08-02 11:13:37 +08:00
</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"
:page.sync="queryshCode.pageNum"
:limit.sync="queryshCode.pageSize"
@pagination="getListTemp"
/>
</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="radioTwo" :checked="shboxIdTwo==scope.row.shboxId" @click="getShboxBindName($event,scope.row)"/>
2024-08-02 11:13:37 +08:00
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFormBind"> </el-button>
<el-button @click="cancelBind"> </el-button>
</div>
<pagination
v-show="totalThree>0"
:total="totalThree"
:page.sync="queryshCodeBind.pageNum"
:limit.sync="queryshCodeBind.pageSize"
@pagination="getListBind"
/>
</el-dialog>
<!-- 修改手环弹窗 -->
<el-dialog :title="title" :visible.sync="showShEdit" width="600px" height="600px" append-to-body>
<el-form :model="queryshEdit" ref="queryshEdit" :rules="rules" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="手环编码" prop="shCode">
<el-input
v-model="queryshEdit.shCode"
placeholder="请输入手环编码"
/>
</el-form-item>
</el-form>
<el-table v-loading="loadingFour" :data="shboxList" 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" :checked="shboxId==scope.row.shboxId" @click="getShboxNameEdit($event,scope.row)"/>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFormEdit"> </el-button>
2024-08-08 13:15:49 +08:00
<el-button @click="cancelEdit"> </el-button>
2024-08-02 11:13:37 +08:00
</div>
<pagination
v-show="totalTwo>0"
:total="totalTwo"
:page.sync="queryshEdit.pageNum"
:limit.sync="queryshEdit.pageSize"
@pagination="getListShEdit"
/>
</el-dialog>
2024-08-13 16:17:44 +08:00
<!-- 查看设备属性弹窗 -->
<el-dialog :title="title" :visible.sync="showDeviceAttribute" width="1200px" height="1000px" append-to-body>
<el-form :model="queryDeviceAttribute" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item prop="dataCode">
<el-input
v-model="queryDeviceAttribute.dataCode"
placeholder="请输入级联编码"
clearable
@keyup.enter.native="handleQueryDeviceAttribute"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQueryDeviceAttribute">查询</el-button>
</el-form-item>
</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="handleAddAttribute"
v-hasPermi="['basic:person:add']"
>新增设备属性</el-button>
</el-col>
</el-row>
<el-table v-loading="loadingTwo" :data="deviceAttributeList " width="600px" height = "600px" >
<el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope">
<span>{{ (queryDeviceAttribute.pageNum - 1) * queryDeviceAttribute.pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
2024-08-13 16:17:44 +08:00
<el-table-column label="设备id" align="center" prop="devId" v-if="false" />
<el-table-column label="设备属性名称" align="center" prop="dataName" sortable/>
<el-table-column label="设备采集值" align="center" prop="dataVal" sortable/>
<el-table-column label="设备值单位" align="center" prop="dataUnit" sortable/>
<el-table-column label="级联编码" align="center" prop="dataCode" sortable/>
<el-table-column label="数据类型" align="center" prop="dataType" sortable/>
<el-table-column label="数据采集时间" align="center" prop="dataTime" width="160px" sortable/>
2024-08-13 16:17:44 +08:00
<el-table-column label="设备属性图片" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="openImg(scope.row.base64Url)"
v-hasPermi="['basic:constructionRecord:edit']"
>查看</el-button>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdateAttribute(scope.row)"
v-hasPermi="['basic:device:edit']"
>编辑</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDeleteDeviceAttribute(scope.row)"
v-hasPermi="['basic:device:del']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="totalTwo>0"
:total="totalTwo"
:page.sync="queryDeviceAttribute.pageNum"
:limit.sync="queryDeviceAttribute.pageSize"
@pagination="getListDeviceAttribute"
/>
</el-dialog>
<!-- 新增或修改设备属性弹窗 -->
2024-08-08 13:15:49 +08:00
<el-dialog :title="title" :visible.sync="showAttribute" width="600px" append-to-body>
<el-form ref="formThree" :model="formThree" :rules="rulesShAttribute" label-width="120px" >
<el-row :gutter="24">
<el-col :span="20">
<el-form-item label="设备属性名称" prop="dataName">
<el-input v-model="formThree.dataName" placeholder="请输入设备属性名称" maxlength="20"/>
2024-08-08 13:15:49 +08:00
</el-form-item>
</el-col>
</el-row>
2024-08-16 16:26:19 +08:00
<!-- <el-row :gutter="24">
2024-08-08 13:15:49 +08:00
<el-col :span="20">
<el-form-item label="设备采集值" prop="dataVal">
<el-input v-model="formThree.dataVal" placeholder="请输入设备采集值" maxlength="20"/>
2024-08-08 13:15:49 +08:00
</el-form-item>
</el-col>
2024-08-16 16:26:19 +08:00
</el-row> -->
2024-08-08 13:15:49 +08:00
<el-row :gutter="24">
<el-col :span="20">
<el-form-item label="设备值单位" prop="dataUnit">
<el-input v-model.number="formThree.dataUnit" placeholder="请输入设备值单位" maxlength="20">
2024-08-08 13:15:49 +08:00
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="20">
<el-form-item label="级联编码" prop="dataCode">
<el-input v-model.number="formThree.dataCode" placeholder="请输入级联编码" maxlength="20">
2024-08-08 13:15:49 +08:00
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="20">
<el-form-item label="数据类型" prop="dataType">
<el-input v-model.number="formThree.dataType" placeholder="请输入数据类型" maxlength="20">
</el-input>
</el-form-item>
</el-col>
</el-row>
2024-08-16 16:26:19 +08:00
<!-- <el-row :gutter="24">
<el-col :span="20">
<el-form-item label="数据采集时间" prop="dataTime">
<el-date-picker
placeholder="请选择数据采集日期"
v-model="formThree.dataTime"
style="width: 345px"
value-format="yyyy-MM-dd"
type="date">
</el-date-picker>
</el-form-item>
</el-col>
2024-08-16 16:26:19 +08:00
</el-row> -->
<el-row :gutter="24">
<el-col :span="20">
<el-form-item label="图标 " label-width="120px">
<el-upload
action="#"
:limit="1"
:file-list="fileList"
:show-file-list="true"
:auto-upload="false"
list-type="picture-card"
accept=".png, .jpg, .jpeg"
:on-change="handleChange"
:class="{ disabled: uploadDisabled }"
:on-preview="picturePreview"
:on-remove="handleRemove"
>
<i class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
</el-col>
</el-row>
2024-08-08 13:15:49 +08:00
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFormAttribute"> </el-button>
<el-button @click="cancelAttribute"> </el-button>
</div>
</el-dialog>
2024-08-02 11:13:37 +08:00
</div>
</el-tab-pane>
2024-08-13 16:17:44 +08:00
<!-- 图片查看弹窗 -->
<el-dialog :visible.sync="dialogVisible">
<img width="100%" height="650px" :src="dialogImageUrl" alt />
</el-dialog>
2024-08-02 11:13:37 +08:00
<el-tab-pane label="手环箱管理" name="second" onclick="handleQueryShbox">
<div class="app-container">
<el-form :model="queryShbox" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item prop="shboxName">
<el-input
v-model="queryShbox.shboxName"
placeholder="请输入手环箱名称"
clearable
@keyup.enter.native="handleQueryShbox"
/>
</el-form-item>
<el-form-item prop="shboxCode">
<el-input
v-model="queryShbox.shboxCode"
placeholder="请输入手环箱编码"
clearable
@keyup.enter.native="handleQueryShbox"
/>
</el-form-item>
<el-form-item prop="shboxStatus">
<el-select v-model="queryShbox.shboxStatus" placeholder="状态" clearable style="width: 100%;">
<el-option
v-for="dict in dict.type.sys_sh_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQueryShbox">查询</el-button>
2024-08-02 18:48:54 +08:00
<el-button icon="el-icon-refresh" size="mini" @click="resetQueryTwo">重置</el-button>
2024-08-02 11:13:37 +08:00
</el-form-item>
</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="handleAddbox"
v-hasPermi="['basic:bracelet:add']"
>新增手环箱</el-button>
</el-col>
<el-col :span="1.5">
2024-08-06 14:31:46 +08:00
<!-- 二维码导出组件按钮在内部传选中数组 currentSelection:选中数组 clearCheck:清空选中状态-->
<qrCodeUpload :checkboxModel.sync="currentSelection" @clearCheck="clearCheck"/>
2024-08-02 11:13:37 +08:00
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getboxList"></right-toolbar>
</el-row>
2024-08-06 14:31:46 +08:00
<el-table v-loading="loadingFive" :data="shboxallList" ref="multipleTable" row-key="shboxCode" @selection-change="handleSelectionChangeImag" @select="handlerSelect" @select-all="handlerSelectAll">
<el-table-column type="selection" width="55" align="center" :reserve-selection="true" />
2024-08-09 17:27:21 +08:00
<el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope">
<span>{{ (queryShbox.pageNum - 1) * queryShbox.pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
2024-08-02 11:13:37 +08:00
<el-table-column label="手环箱id" align="center" prop="shboxId" v-if="false" />
<el-table-column label="手环箱名称" align="center" prop="shboxName" sortable/>
<el-table-column label="手环箱编码" align="center" prop="shboxCode" sortable/>
<el-table-column label="存放手环数量" align="center" prop="shboxBindNum" sortable>
2024-08-02 11:13:37 +08:00
<template slot-scope="scope">
<div @click="openShall(scope.row)" style="color: #02a7f0; cursor: pointer">
<div>
<span style="color: green;">{{ scope.row.shboxBindNum }}/</span><span>{{ scope.row.shboxCapacity }}</span>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="二维码" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
2024-08-06 14:31:46 +08:00
@click="labelUploadCode(scope.row)"
2024-08-02 11:13:37 +08:00
v-hasPermi="['basic:bracelet:query']"
>查看</el-button>
</template>
</el-table-column>
<el-table-column label="手环箱状态" align="center" prop="shboxStatus" sortable>
2024-08-02 11:13:37 +08:00
<template slot-scope="scope">
<div v-if="scope.row.shboxStatus==0" style="color: green;">{{ stateList[Number(scope.row.shboxStatus)] }}</div>
<div v-if="scope.row.shboxStatus==1" style="color: red;">{{ stateList[Number(scope.row.shboxStatus)] }}</div>
</template>
</el-table-column>
<el-table-column label="领用人" align="center" prop="lyName" sortable/>
2024-08-02 11:13:37 +08:00
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdatebox(scope.row)"
v-hasPermi="['basic:bracelet:edit']"
>编辑</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDeletebox(scope.row)"
v-hasPermi="['basic:bracelet:del']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
2024-08-09 16:21:52 +08:00
v-show="totalTwo>0"
:total="totalTwo"
2024-08-02 11:13:37 +08:00
:page.sync="queryShbox.pageNum"
:limit.sync="queryShbox.pageSize"
@pagination="getboxList"
/>
<!-- 手环箱管理页面绑定手环弹窗 -->
<el-dialog :title="title" :visible.sync="showShall" width="1000px" height="1000px" append-to-body>
2024-08-02 18:48:54 +08:00
<el-form :model="queryShBoxall" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
2024-08-02 11:13:37 +08:00
<el-form-item prop="shCode">
<el-input
v-model="queryShBoxall.shCode"
placeholder="请输入手环编码"
clearable
@keyup.enter.native="handleQueryShBind"
/>
</el-form-item>
<el-form-item prop="shPersonName">
<el-input
v-model="queryShBoxall.shPersonName"
placeholder="请输入使用人"
clearable
@keyup.enter.native="handleQueryShBind"
/>
</el-form-item>
<el-form-item prop="shStatus">
<el-select v-model="queryShBoxall.shStatus" placeholder="状态" clearable style="width: 100%;">
<el-option
v-for="dict in dict.type.sys_sh_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQueryShBind">查询</el-button>
2024-08-02 18:48:54 +08:00
<el-button icon="el-icon-refresh" size="mini" @click="resetQueryThree">重置</el-button>
2024-08-02 11:13:37 +08:00
</el-form-item>
2024-08-02 18:48:54 +08:00
</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>
2024-08-02 11:13:37 +08:00
<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" />
<el-table-column label="手环状态" align="center" prop="shStatus" >
<template slot-scope="scope">
<div v-if="scope.row.shStatus==0" style="color: green;">{{ stateList[Number(scope.row.shStatus)] }}</div>
<div v-if="scope.row.shStatus==1" style="color: red;">{{ stateList[Number(scope.row.shStatus)] }}</div>
</template>
</el-table-column>
<el-table-column label="使用人" align="center" prop="shPersonName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
style="color:red"
icon="el-icon-edit"
2024-08-02 18:48:54 +08:00
@click="handleDelShbox(scope.row)"
2024-08-02 11:13:37 +08:00
v-hasPermi="['basic:sideband:edit']"
>解除绑定</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="totalTwo>0"
:total="totalTwo"
:page.sync="queryShBoxall.pageNum"
:limit.sync="queryShBoxall.pageSize"
@pagination="getListBoxall"
/>
</el-dialog>
<!-- 手环绑定选择弹窗 -->
2024-08-02 18:48:54 +08:00
<el-dialog :title="title" :visible.sync="openSh" width="600px" height="600px" append-to-body>
<div> 当前手环箱还可以绑定{{ this.numers }}个手环</div>
2024-08-06 14:31:46 +08:00
<el-table v-loading="loadingSeven" :data="shListNoBind" width="600px" height = "400px" class="order" @selection-change="handleSelectionChange" >
2024-08-02 18:48:54 +08:00
<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" />
2024-08-02 11:13:37 +08:00
</el-table>
<div slot="footer" class="dialog-footer">
2024-08-02 18:48:54 +08:00
<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>
2024-08-02 11:13:37 +08:00
</div>
2024-08-02 18:48:54 +08:00
<!-- <pagination
v-show="totalTwo>0"
:total="totalTwo"
:page.sync="queryshNoBind.pageNum"
:limit.sync="queryshNoBind.pageSize"
@pagination="getListNoBind"
/> -->
2024-08-02 11:13:37 +08:00
</el-dialog>
<!-- 添加或修改手环箱对话框 -->
<el-dialog :title="title" :visible.sync="openbox" width="600px" append-to-body>
<el-form ref="formTwo" :model="formTwo" :rules="rulesbox" label-width="100px" >
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="手环箱名称" prop="shboxName">
<el-input v-model="formTwo.shboxName" placeholder="请输入手环箱名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="手环箱编码" prop="shboxCode">
<el-input v-model="formTwo.shboxCode" placeholder="请输入手环箱编码" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="14">
<el-form-item label="手环箱容量" prop="shboxCapacity">
<el-input v-model.number="formTwo.shboxCapacity" placeholder="请输入手环箱容量" >
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFormbox"> </el-button>
<el-button @click="cancelbox"> </el-button>
</div>
</el-dialog>
2024-08-06 14:31:46 +08:00
<!-- 标签下载对话框 -->
<el-dialog
:title="title"
:visible.sync="uploadOpen"
width="450px"
append-to-body
:close-on-click-modal="false"
>
<div style="text-align: center" ref="codeBox">
<div class="uploadImg">
<div id="qrcode" class="qrcode" ref="codeItem"></div>
<!-- <img src="" alt="">-->
</div>
<div class="shboxCodeTemp">手环箱编号{{ rowObj.shboxCode }}</div>
</div>
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button type="primary" @click="downloadCode"
> </el-button
>
</div>
</el-dialog>
2024-08-02 11:13:37 +08:00
</div>
</el-tab-pane>
</el-tabs>
</template>
<script>
2024-08-16 16:26:19 +08:00
import { listBracelet, listShboxall,delShById, exportSh,listShbox,addSh,listShboxBind,addShBind,delSh,editSh,delDeviceAttribute,exportShSome,
2024-08-13 16:17:44 +08:00
getBoxInfo,editBox,addBox,delShboxById,listShBind,listShNoBind,bindSh,getBoxNewInfo,addAttribute,listDeviceAttribute,getAttributeInfo,editAttribute} from "@/api/base/bracelet";
2024-08-02 11:13:37 +08:00
import { downloadFile } from '@/utils/download'
import { getToken } from '@/utils/auth'
2024-08-06 14:31:46 +08:00
import qrCodeUpload from '../../components/qrCodeUpload.vue'
import html2canvas from 'html2canvas'
import QRCode from 'qrcodejs2'
2024-08-02 11:13:37 +08:00
import uploadFile from '../../components/uploadFile.vue'
2024-08-06 14:31:46 +08:00
import JSZip from 'jszip'
import FileSaver from 'file-saver'
import C from "highlight.js/lib/languages/1c";
2024-08-02 11:13:37 +08:00
export default {
name: "Post",
dicts: ['sys_normal_disable','sys_sh_status'],
components: {
uploadFile,qrCodeUpload,
2024-08-02 11:13:37 +08:00
},
data() {
return {
2024-08-13 16:17:44 +08:00
showDeviceAttribute:false,
delFileId: undefined,
deviceAttributeList : [],
shboxIdOne:null,
shboxIdTwo:null,
2024-08-08 13:15:49 +08:00
radioOne:null,
radioTwo:null,
2024-08-02 11:13:37 +08:00
activeName: 'first',
// 遮罩层
loading: true,
// 遮罩层2
loadingTwo:true,
// 遮罩层3
loadingThree:true,
// 遮罩层4
loadingFour:true,
// 遮罩层5
loadingFive:true,
// 遮罩层6
loadingSix:true,
2024-08-02 18:48:54 +08:00
// 遮罩层7
loadingSeven:true,
2024-08-02 11:13:37 +08:00
// 选中数组
ids: [],
2024-08-16 16:26:19 +08:00
idsSh: [],
2024-08-06 14:31:46 +08:00
idsbox: [],
2024-08-02 11:13:37 +08:00
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
2024-08-16 16:26:19 +08:00
// 非单个禁用
singleSh: true,
// 非多个禁用
multipleSh: true,
2024-08-02 11:13:37 +08:00
// 显示搜索条件
showSearch: true,
2024-08-16 16:26:19 +08:00
maxLength:100,//已选列表上限,防止数据过多请求报错
currentSelection:[],//已选列表
currentSelectionSh:[],//手环已选列表
2024-08-02 11:13:37 +08:00
// 总条数
total: 0,
//绑定设备总条数
totalTwo:0,
//未绑定设备总条数
totalThree:0,
// 手环表格数据
braceletList: [],
// 手环箱表格数据
shboxList: [],
// 手环箱所有表格数据
shboxallList:[],
//手环绑定选择表格数据
shboxListBind: [],
2024-08-02 18:48:54 +08:00
//未绑定手环表格数据
shListNoBind: [],
2024-08-02 11:13:37 +08:00
// 绑定设备表格数据
bindNoList: [],
//手环箱绑定手环表格数据
shBindList: [],
// 弹出层标题
title: "",
boxName: "未绑定",
bind:"解绑",
// 是否显示弹出层
open: false,
//所属工程
proList: [],
//图片上传
fileList: [],
//图片查看弹窗
dialogImageUrl: '',
dialogVisible: false,
2024-08-02 11:13:37 +08:00
//状态
StatusList:[],
selectOption:false,
zero:0,
2024-08-02 18:48:54 +08:00
shboxbindId:0,
2024-08-02 11:13:37 +08:00
Qrcode:"",
2024-08-06 14:31:46 +08:00
//二维码
rowObj:{},
uploadOpen:false,
shboxCodeTemp:'',
2024-08-02 11:13:37 +08:00
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
shId:undefined,
shCode:undefined,
shboxName: undefined,
shboxCode: undefined,
shPersonName:undefined,
shStatus:undefined,
},
queryshCode:{
pageNum: 1,
pageSize: 10,
shCode: undefined,
shboxName: undefined,
shboxId: undefined,
},
queryshCodeBind:{
pageNum: 1,
pageSize: 10,
shId: undefined,
keyword: undefined,
shboxName: undefined,
shboxId: undefined,
shboxCapacity: undefined,
shboxBindNum: undefined,
},
2024-08-02 18:48:54 +08:00
numers:0,
addNums:0,
numersTemp:0,
Capacity: 0,
BindNum: 0,
boxId:0,
queryshNoBind:{
pageNum: 1,
pageSize: 10,
shId: undefined,
shCode: undefined,
shboxId: undefined,
},
2024-08-02 11:13:37 +08:00
queryshEdit:{
pageNum: 1,
pageSize: 10,
shId: undefined,
shCode: undefined,
shboxName: undefined,
shboxId: undefined,
},
queryShbox: {
pageNum: 1,
pageSize: 10,
shboxId:undefined,
shboxCode:undefined,
shboxName: undefined,
shboxStatus:undefined,
},
queryShBoxall: {
pageNum: 1,
pageSize: 10,
shboxId:undefined,
shCode:undefined,
shId:undefined,
shPersonName: undefined,
shStatus:undefined,
},
2024-08-13 16:17:44 +08:00
queryDeviceAttribute: {
pageNum: 1,
pageSize: 10,
shId:undefined,
dataCode:undefined,
},
2024-08-02 18:48:54 +08:00
2024-08-02 11:13:37 +08:00
showsh:false,
showshBind:false,
showDevice:false,
showShEdit:false,
showShall:false,
openbox:false,
2024-08-02 18:48:54 +08:00
openSh:false,
2024-08-02 11:13:37 +08:00
2024-08-08 13:15:49 +08:00
showAttribute:false,
2024-08-02 11:13:37 +08:00
stateList:['在用','未用'],
accept:'.png, .jpg, .jpeg, .pdf, .doc, .docx',
highImgList: [],
electricianImgList: [],
elseImgList: [],
// 表单参数
form: {},
formTwo: {},
2024-08-08 13:15:49 +08:00
formThree: {},
2024-08-02 11:13:37 +08:00
//图片上传
fileList: [],
//图片查看弹窗
dialogImageUrl: '',
dialogVisible: false,
2024-08-06 14:31:46 +08:00
maxLength:100,//已选列表上限,防止数据过多请求报错
currentSelection:[],//已选列表
2024-08-02 11:13:37 +08:00
// 用户导入参数
upload: {
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
title: "",
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的用户数据
updateSupport: 0,
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/bracelet/person/excelUpload"
},
// 表单校验
rules: {
shCode: [
{ required: true, message: "手环编码不能为空", trigger: "blur" }
],
},
rulesbox: {
shboxName: [
{ required: true, message: "手环箱名称不能为空", trigger: "blur" }
],
shboxCode: [
{ required: true, message: "手环箱编码不能为空", trigger: "blur" }
],
shboxCapacity: [
{ required: true, message: "手环箱容量不能为空",trigger: "blur" },
{
validator: (rule, value, callback) => {
if (!value) {
return callback(new Error('请必须输入为正整数'));
}
if (!Number.isInteger(value) || value <= 0) {
callback(new Error('请必须输入为正整数'));
} else {
callback();
}
},
trigger: 'blur'
}
],
2024-08-08 13:15:49 +08:00
},
rulesShAttribute: {
dataName: [
{ required: true, message: "设备属性名称不能为空", trigger: "blur" }
],
2024-08-16 16:26:19 +08:00
// dataVal: [
// { required: true, message: "设备采集值不能为空", trigger: "blur" }
// ],
2024-08-08 13:15:49 +08:00
dataUnit: [
{ required: true, message: "设备值单位不能为空", trigger: "blur" }
],
dataCode: [
{ required: true, message: "级联编码不能为空", trigger: "blur" }
],
dataType: [
{ required: true, message: "数据类型不能为空", trigger: "blur" },
],
2024-08-16 16:26:19 +08:00
// dataTime: [
// { required: true, message: "数据采集日期不能为空", trigger: "blur" }
// ],
2024-08-08 13:15:49 +08:00
},
2024-08-02 11:13:37 +08:00
};
},
computed: {
//图片上传1张后隐藏上传框
uploadDisabled() {
return this.fileList.length > 0
},
},
created() {
this.getList();
this.getboxList();
},
methods: {
2024-08-16 16:26:19 +08:00
//单选操作-跨页
handlerSelectSh(val, row) {
this.currentSelectionSh.indexOf(row.shId) === -1
? this.currentSelectionSh.push(row.shId)
: this.currentSelectionSh.splice(this.currentSelectionSh.indexOf(row.shId), 1)
},
//全选操作-跨页
handlerSelectAllSh(val) {
if (val.length) {
// 进来此处说明:
// 1 当前页的全选 2 其他页有数据然后当前页的取消全选
// 比较全选或者取消全选与当前页的数据,得到差集
// 如果braceletList中的数据在val中不存在则说明是取消全选需要从currentSelectionSh中移除
// 如果braceletList中所有的数据都在val中存在则说明是全选需要将差集添加到currentSelectionSh中
const isAllSelectSh = this.braceletList.every(item =>
val.some(valItem => valItem.shId === item.shId)
)
if (isAllSelectSh) {
// 全选中新增的差集
const diff = val.filter(
item => !this.currentSelectionSh.some(shId => shId === item.shId)
)
if (this.currentSelectionSh.length + diff.length > this.maxLength) {
this.currentSelectionSh = this.currentSelectionSh.concat(
diff.splice(0, this.maxLength - this.currentSelectionSh.length)
.map(item => item.shId))
diff.forEach(item => this.$refs.multipleTableSh.toggleRowSelection(item, false))
} else {
this.currentSelectionSh = this.currentSelectionSh.concat(diff.map(item => item.shId))
}
} else {
this.currentSelectionSh = this.currentSelectionSh.filter(
shId => !this.braceletList.some(item => item.shId === shId)
)
}
} else {
// 进来此处说明:
// 其他页并无勾选数据,且当前页取消勾选
this.currentSelectionSh = []
}
},
// 手环多选框选中数据
handleSelectionChangeSh(selection) {
this.idsSh = selection.map(item => item.shId)
this.singleSh = selection.length!=1
this.multipleSh = !selection.length
},
2024-08-13 16:17:44 +08:00
//列表-图片查看
openImg(url) {
this.dialogImageUrl = url
this.dialogVisible = true
},
//上传组件-图片查看
picturePreview(file) {
this.dialogImageUrl = file.url
this.dialogVisible = true
},
// 图片上传
handleChange(file, fileList) {
this.formThree.fileName = file.name;
this.fileList = fileList;
},
handleRemove(file, fileList) {
let sum = 0
this.fileList.forEach((item, index) => {
2024-08-13 16:17:44 +08:00
if(!item?.hasOwnProperty('raw')) {
this.delFileId = this.formThree.filePath;
}
sum = index;
})
2024-08-13 16:17:44 +08:00
// this.delFileId = this.fileList[sum].fileId;
console.log(this.delFileId)
this.fileList.splice(sum, 1)
},
//提交时循环fileList 获取raw文件
getFileData() {
const file = []
this.fileList.forEach(item => {
if (item?.hasOwnProperty('raw')) {
file.push(item.raw)
}
})
return { file }
},
2024-08-08 13:15:49 +08:00
/** 查询手环列表 */
2024-08-02 11:13:37 +08:00
getList() {
this.loading = true;
listBracelet(this.queryParams).then(response => {
this.braceletList = response.rows;
this.total = response.total;
this.loading = false;
2024-08-16 16:26:19 +08:00
if (this.currentSelectionSh.length) {
this.$nextTick(() => {
this.currentSelectionSh.forEach(row => {
this.braceletList.forEach(item => {
if (item.shId === row) {
this.$refs.multipleTableSh?.toggleRowSelection(item, true)
}
})
})
})
} else {
this.$refs.multipleTableSh?.clearSelection()
}
2024-08-02 11:13:37 +08:00
});
},
2024-08-02 18:48:54 +08:00
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;
}
},
2024-08-02 11:13:37 +08:00
// 取消按钮
cancel() {
this.showsh = false;
this.reset();
},
2024-08-08 13:15:49 +08:00
// 修改手环页面取消按钮
cancelEdit() {
this.showShEdit = false;
},
2024-08-02 11:13:37 +08:00
// 手环绑定选择页面取消按钮
cancelBind() {
this.showshBind = false;
this.resetBind();
},
2024-08-02 18:48:54 +08:00
// 手环绑定
cancelBindTemp() {
this.openSh = false;
this.resetBindTemp();
},
2024-08-02 11:13:37 +08:00
// 手环箱管理页面取消按钮
cancelbox() {
this.openbox = false;
this.resetbox();
},
// 表单重置
reset() {
this.queryParams = {};
this.resetForm("queryParams");
},
resetbox() {
this.formTwo = {};
this.resetForm("formTwo");
},
2024-08-08 13:15:49 +08:00
resetAttribute() {
this.formThree = {};
this.resetForm("formThree");
},
// 手环修改按钮页面表单重置
resetEdit() {
this.queryshEdit = {};
this.resetForm("queryshEdit");
},
2024-08-02 11:13:37 +08:00
// 手环绑定选择页面表单重置
resetBind() {
this.queryshCodeBind = {};
this.resetForm("queryshCodeBind");
},
2024-08-02 18:48:54 +08:00
resetBindTemp() {
this.queryshNoBind = {};
this.resetForm("queryshNoBind");
},
2024-08-02 11:13:37 +08:00
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 手环绑定选择搜索按钮操作 */
handleQueryBind() {
this.queryshCodeBind.pageNum = 1;
this.getListBind();
},
//手环箱管理页面搜索按钮操作
handleQueryShbox() {
this.queryShbox.pageNum = 1;
this.getboxList();
},
//手环箱管理页面搜索按钮操作
handleQueryShBind() {
this.queryShBoxall.pageNum = 1;
this.queryShBoxall.shboxId = this.queryShBoxall.shboxId;
this.getListBoxall();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
2024-08-16 16:26:19 +08:00
this.currentSelectionSh = [];//重置清除已选列表
2024-08-02 11:13:37 +08:00
this.handleQuery();
},
2024-08-02 18:48:54 +08:00
/** 重置按钮操作 */
resetQueryTwo() {
this.resetForm("queryForm");
this.handleQueryShbox();
},
/** 重置按钮操作 */
resetQueryThree() {
this.resetForm("queryForm");
this.handleQueryShBind();
},
2024-08-02 11:13:37 +08:00
// 多选框选中数据
handleSelectionChange(selection) {
2024-08-02 18:48:54 +08:00
this.numers=this.addNums;
this.numers=this.numers-selection.length
this.ids = selection.map(item => item.shId);
2024-08-02 11:13:37 +08:00
this.single = selection.length!=1
this.multiple = !selection.length
},
2024-08-06 14:31:46 +08:00
// 多选框选中数据二维码导出
handleSelectionChangeImag(selection) {
this.ids = selection.map(item => item.shboxCode);
this.single = selection.length!=1
this.multiple = !selection.length
},
//单选操作-跨页
handlerSelect(val, row) {
this.currentSelection.indexOf(row.shboxCode) === -1
? this.currentSelection.push(row.shboxCode)
: this.currentSelection.splice(this.currentSelection.indexOf(row.shboxCode), 1)
},
//全选操作-跨页
handlerSelectAll(val) {
if (val.length) {
// 进来此处说明:
// 1 当前页的全选 2 其他页有数据然后当前页的取消全选
// 比较全选或者取消全选与当前页的数据,得到差集
// 如果tableData中的数据在val中不存在则说明是取消全选需要从currentSelection中移除
// 如果tableData中所有的数据都在val中存在则说明是全选需要将差集添加到currentSelection中
const isAllSelect = this.tableData.every(item =>
val.some(valItem => valItem.shboxCode === item.shboxCode)
)
if (isAllSelect) {
// 全选中新增的差集
const diff = val.filter(
item => !this.currentSelection.some(shboxCode => shboxCode === item.shboxCode)
)
if (this.currentSelection.length + diff.length > this.maxLength) {
this.currentSelection = this.currentSelection.concat(
diff.splice(0, this.maxLength - this.currentSelection.length)
.map(item => item.shboxCode))
diff.forEach(item => this.$refs.multipleTable.toggleRowSelection(item, false))
} else {
this.currentSelection = this.currentSelection.concat(diff.map(item => item.shboxCode))
}
} else {
this.currentSelection = this.currentSelection.filter(
shboxCode => !this.tableData.some(item => item.shboxCode === shboxCode)
)
}
} else {
// 进来此处说明:
// 其他页并无勾选数据,且当前页取消勾选
this.currentSelection = []
}
},
clearCheck(){
console.log("clearCheck")
this.currentSelection = []
this.getboxList()
},
//二维码查看
labelUploadCode(row) {
this.rowObj = row
this.uploadOpen = true
this.title = '二维码查看'
this.shboxCodeTemp = row.shboxCode
let str = row.shboxCode
this.$nextTick(() => {
this.$refs.codeItem.innerHTML = ''
var qrcode = new QRCode(this.$refs.codeItem, {
text: str, //二维码内容
width: 256,
height: 256,
colorDark: '#000000',
colorLight: '#ffffff',
correctLevel: QRCode.CorrectLevel.H,
})
// });
}, 500)
},
downloadCode(e) {
if (document.getElementById('qrcode').childNodes[0]) {
let element = this.$refs.codeBox
html2canvas(element).then((canvas) => {
// 将canvas转换为图片URL
const image = canvas.toDataURL('image/png')
const alink = document.createElement('a')
alink.href = image
alink.download = this.shboxCodeTemp
alink.click()
})
}
},
2024-08-02 11:13:37 +08:00
/** 解除绑定操作 */
handleDelSh(row) {
const param = {
shId:row.shId,
}
this.$modal.confirm('确定把该手环与手环箱解除绑定吗?解绑后重新绑定才能继续使用!').then(function() {
return delSh(param);
}).then(() => {
this.getList();
this.$modal.msgSuccess("解除绑定成功");
}).catch(() => {});
},
2024-08-02 18:48:54 +08:00
/** 手环箱管理页面解除绑定操作 */
handleDelShbox(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(() => {});
},
2024-08-02 11:13:37 +08:00
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "新增手环";
},
/** 手环箱管理页面新增按钮操作 */
handleAddbox() {
this.resetbox();
this.openbox = true;
this.title = "新增手环箱";
},
2024-08-02 18:48:54 +08:00
/** 手环箱管理页面绑定手环按钮操作 */
handleAddSh() {
this.openSh = true;
this.title = "绑定手环";
this.getListNoBind();
},
2024-08-08 13:15:49 +08:00
/** 新增设备属性按钮操作 */
2024-08-13 16:17:44 +08:00
handleAddAttribute() {
this.fileList = [];
2024-08-08 13:15:49 +08:00
this.resetAttribute();
2024-08-13 16:17:44 +08:00
this.formThree.shId = this.shId;
2024-08-08 13:15:49 +08:00
this.title = "新增设备属性"
this.showAttribute = true;
},
2024-08-02 18:48:54 +08:00
2024-08-13 16:17:44 +08:00
/** 修改按钮操作 */
handleUpdateAttribute(row) {
this.resetAttribute();
const id = row.id
this.fileList=[];
getAttributeInfo({id:id}).then(response => {
this.formThree = response.data;
// this.$set(this.form,'sex',response.data.sex+'')
if(response.data.fileId && response.data.base64Url){
this.fileList.push({
name: response.data.fileId,
url: response.data.base64Url,
})
}
console.log(this.fileList)
//触发校验
// this.formThree.fileName = response.data.fileId;
setTimeout(()=>{
this.showAttribute = true;
this.title = "修改设备属性";
},100)
});
},
2024-08-15 17:56:45 +08:00
/** 删除按钮操作 */
handleDeleteDeviceAttribute(row) {
const id = row.id;
console.log(id)
this.$modal.confirm('是否确认删除级联编码为"' + row.dataCode + '"的数据项?').then(function() {
return delDeviceAttribute({id:id});
}).then(() => {
this.getListDeviceAttribute();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
2024-08-08 13:15:49 +08:00
/** 手环管理页面新增设备属性提交按钮 */
submitFormAttribute() {
this.$refs["formThree"].validate(valid => {
if (valid) {
2024-08-13 16:17:44 +08:00
if (this.formThree.id != undefined) {
//base64地址别传后台过长
this.formThree.base64Url = '';
this.formThree.delFileId = this.delFileId;
const reqData = new FormData()
reqData.append('params', JSON.stringify(this.formThree))
const { file } = this.getFileData()
file.forEach(item => {
reqData.append('file', item)
})
editAttribute(reqData).then(response => {
this.$modal.msgSuccess("修改成功");
this.showAttribute = false;
this.fileList=[];
// this.getList();
this.getListDeviceAttribute();
});
}else{
const reqData = new FormData()
reqData.append('params', JSON.stringify(this.formThree))
const { file } = this.getFileData()
file.forEach(item => {
reqData.append('file', item)
})
addAttribute(reqData).then(response => {
2024-08-08 13:15:49 +08:00
this.$modal.msgSuccess("新增成功");
this.showAttribute = false;
this.fileList=[];
2024-08-13 16:17:44 +08:00
// this.getList();
this.getListDeviceAttribute();
2024-08-08 13:15:49 +08:00
});
2024-08-13 16:17:44 +08:00
}
2024-08-08 13:15:49 +08:00
}
});
},
// 手环管理页面新增设备属性取消按钮
cancelAttribute() {
this.showAttribute = false;
this.fileList=[];
2024-08-08 13:15:49 +08:00
this.resetAttribute();
2024-08-13 16:17:44 +08:00
},
openDeviceAttribute(row){
this.shId = row.shId;
this.title = "查看设备属性"
this.showDeviceAttribute = true;
this.getListDeviceAttribute();
2024-08-08 13:15:49 +08:00
},
2024-08-13 16:17:44 +08:00
//查看设备属性
handleQueryDeviceAttribute() {
this.queryDeviceAttribute.pageNum = 1;
this.queryDeviceAttribute.shId = this.shId;
// this.title = "查看设备属性"
// this.showDeviceAttribute = true;
this.getListDeviceAttribute();
},
/** 查询设备属性列表 */
getListDeviceAttribute() {
this.loadingTwo = true;
this.queryDeviceAttribute.shId = this.shId;
listDeviceAttribute(this.queryDeviceAttribute).then(response => {
this.deviceAttributeList = response.rows;
this.totalTwo = response.total;
this.loadingTwo = false;
});
},
2024-08-02 18:48:54 +08:00
/** 绑定操作 */
handleBindSh(row) {
const shIds = row.shId || this.ids;
const param = {
shboxId:this.shboxbindId,
shIds:shIds,
}
this.$modal.confirm('确定与该手环箱绑定吗?').then(function() {
return bindSh(param);
}).then(() => {
this.getBoxInfo();
this.getboxList();
this.getListBoxall();
this.getListNoBind();
this.$modal.msgSuccess("绑定成功");
this.openSh = false;
}).catch(() => {});
},
2024-08-02 11:13:37 +08:00
/** 修改按钮操作 */
handleUpdate(row) {
2024-08-08 13:15:49 +08:00
// this.reset();
2024-08-02 11:13:37 +08:00
const shPersonName = row.shPersonName;
const shId = row.shId;
2024-08-16 17:51:32 +08:00
if(shPersonName!=null&&shPersonName!=''){
2024-08-02 11:13:37 +08:00
this.$alert('手环已绑定使用人,不可修改', '提示', {
type: 'warning',
confirmButtonText: '确定',
});
return;
}
this.shboxId = row.shboxId;
this.shId = row.shId;
this.title = "修改手环"
this.showShEdit = true;
this.getListShEdit();
this.queryshEdit.pageNum = 1;
this.queryshEdit.shId = row.shId;
this.queryshEdit.shCode = row.shCode;
},
2024-08-08 13:15:49 +08:00
2024-08-02 11:13:37 +08:00
handleUpdatebox(row) {
this.resetbox();
const lyName = row.lyName;
if(lyName!=null){
this.$alert('手环箱已绑定领用人,不可修改', '提示', {
type: 'warning',
confirmButtonText: '确定',
});
return;
}
const shboxId = row.shboxId
getBoxInfo(shboxId).then(response => {
this.formTwo = response.data;
this.$set(this.formTwo,'shboxName',response.data.shboxName+'')
this.$set(this.formTwo,'shboxCode',response.data.shboxCode+'')
this.$set(this.formTwo,'shboxCapacity',response.data.shboxCapacity)
this.formTwo.shboxId = response.data.shboxId;
setTimeout(()=>{
this.openbox = true;
this.title = "修改手环箱";
},100)
});
},
handleClick(tab, event) {
this.getList();
this.getboxList();
console.log(tab, event);
},
getShboxName(e,row){
this.queryshCode.shboxId = row.shboxId;
this.queryshCode.shboxName = row.shboxName;
if(this.shboxIdOne == row.shboxId){
this.shboxIdOne = null
e.target.checked = false;
2024-08-02 11:13:37 +08:00
this.queryshCode.shboxId = null;
this.queryshCode.shboxName =null;
}else{
this.shboxIdOne = row.shboxId;
}
2024-08-02 11:13:37 +08:00
},
getShboxNameEdit(e,row){
this.queryshEdit.shboxId = row.shboxId;
this.queryshEdit.shboxName = row.shboxName;
if(this.shboxId == row.shboxId){
this.shboxId = 0
e.target.checked = false;
this.queryshEdit.shboxId = null;
this.queryshEdit.shboxName =null;
}else{
this.shboxId = row.shboxId;
}
},
getShboxBindName(e,row){
this.queryshCodeBind.shboxId = row.shboxId;
this.queryshCodeBind.shboxName = row.shboxName;
this.queryshCodeBind.shboxCapacity = row.shboxCapacity;
this.queryshCodeBind.shboxBindNum = row.shboxBindNum;
if(this.shboxIdTwo == row.shboxId){
this.shboxIdTwo = null
2024-08-08 13:15:49 +08:00
e.target.checked = false;
2024-08-02 11:13:37 +08:00
this.queryshCodeBind.shboxId = null;
2024-08-08 13:15:49 +08:00
this.queryshCodeBind.shboxName =null;
this.queryshCodeBind.shboxCapacity = null;
this.queryshCodeBind.shboxBindNum = null;
}else{
this.shboxIdTwo = row.shboxId;
2024-08-08 13:15:49 +08:00
}
2024-08-02 11:13:37 +08:00
},
/** 提交按钮 */
submitForm() {
this.queryshCode.shCode = this.queryshCode.shCode;
this.$refs["queryshCode"].validate(valid => {
if (valid) {
addSh(this.queryshCode).then(response => {
this.$modal.msgSuccess("新增成功");
this.showsh = false;
this.getList();
});
}
})
},
/** 手环绑定选择页面提交按钮 */
submitFormBind() {
if(this.queryshCodeBind.shboxId == undefined){
this.$modal.msgError("请选择手环箱");
return;
}
this.$refs["queryshCodeBind"].validate(valid => {
if (valid) {
addShBind(this.queryshCodeBind).then(response => {
this.$modal.msgSuccess("绑定成功");
this.showshBind = false;
this.getList();
});
}
})
},
/** 修改手环页面提交按钮 */
submitFormEdit() {
this.queryshEdit.shCode = this.queryshEdit.shCode;
2024-08-08 13:15:49 +08:00
this.queryshEdit.shboxId = this.shboxId;
2024-08-02 11:13:37 +08:00
this.$refs["queryshEdit"].validate(valid => {
if (valid) {
editSh(this.queryshEdit).then(response => {
this.$modal.msgSuccess("修改成功");
this.showShEdit = false;
this.getList();
});
}
})
},
2024-08-02 18:48:54 +08:00
/** 手环箱管理页面提交按钮 */
2024-08-02 11:13:37 +08:00
submitFormbox() {
this.$refs["formTwo"].validate(valid => {
if (valid) {
if (this.formTwo.shboxId != undefined) {
editBox(this.formTwo).then(response => {
this.$modal.msgSuccess("修改成功");
this.openbox = false;
this.getboxList();
});
} else {
addBox(this.formTwo).then(response => {
this.$modal.msgSuccess("新增成功");
this.openbox = false;
this.getboxList();
});
}
}
});
},
2024-08-08 13:15:49 +08:00
2024-08-02 11:13:37 +08:00
/** 删除按钮操作 */
handleDelete(row) {
if(row.shboxName!=this.boxName){
this.$alert('请先解绑手环', '提示', {
type: 'warning',
confirmButtonText: '确定',
});
return;
}
const param = {
shId:row.shId
}
this.$modal.confirm('是否确认删除手环编号为"' + row.shCode + '"的数据项?').then(function() {
return delShById(param);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 手环箱子管理页面删除按钮操作 */
handleDeletebox(row) {
if (row.shboxBindNum!=0) {
this.$alert('手环箱不为空,还存放有手环,无法删除', '提示', {
type: 'warning',
confirmButtonText: '确定',
});
return;
}
const param = {
shboxId:row.shboxId
}
this.$modal.confirm('是否确认删除手环箱编号为"' + row.shboxCode + '"的数据项?').then(function() {
return delShboxById(param);
}).then(() => {
this.getboxList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
2024-08-16 16:26:19 +08:00
if(this.ids.length == 0){
exportSh(this.queryParams).then(res => {
2024-08-02 18:48:54 +08:00
downloadFile({ fileName: `手环_${new Date().getTime()}.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
2024-08-02 11:13:37 +08:00
})
2024-08-16 16:26:19 +08:00
}else{
const ids = this.ids.join(',')
exportShSome({ids:ids}).then(res => {
downloadFile({ fileName: `手环_${new Date().getTime()}.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
})
}
2024-08-02 11:13:37 +08:00
},
/** 导入按钮操作 */
handleImport() {
this.upload.title = "人员导入";
this.upload.open = true;
},
/** 查询手环箱列表 */
getListTemp() {
this.loadingTwo = true;
listShbox(this.queryshCode).then(response => {
this.shboxList = response.rows;
this.totalTwo = response.total;
this.loadingTwo = false;
});
},
/** 查询手环箱里绑定手环列表 */
getListBoxall() {
this.loadingSix = true;
this.queryShBoxall.shboxId = this.shboxId;
listShBind(this.queryShBoxall).then(response => {
this.shBindList = response.rows;
this.totalTwo = response.total;
this.loadingSix = false;
});
},
/** 手环箱管理查询手环箱列表 */
getboxList() {
this.loadingFive = true;
listShboxall(this.queryShbox).then(response => {
this.shboxallList = response.rows;
2024-08-09 16:21:52 +08:00
this.totalTwo = response.total;
2024-08-02 11:13:37 +08:00
this.loadingFive = false;
2024-08-06 14:31:46 +08:00
if (this.currentSelection.length) {
this.$nextTick(() => {
this.currentSelection.forEach(row => {
this.tableData.forEach(item => {
if (item.shboxCode === row) {
this.$refs.multipleTable?.toggleRowSelection(item, true)
}
})
})
})
} else {
this.$refs.multipleTable?.clearSelection()
}
2024-08-02 11:13:37 +08:00
});
},
/** 查询修改手环列表 */
getListShEdit() {
this.loadingFour = true;
listShbox(this.queryshEdit).then(response => {
this.shboxList = response.rows;
this.totalTwo = response.total;
this.loadingFour = false;
});
},
/** 查询手环绑定选择列表 */
getListBind() {
this.loadingThree = true;
listShboxBind(this.queryshCodeBind).then(response => {
this.shboxListBind = response.rows;
this.totalThree = response.total;
this.loadingThree = false;
});
},
2024-08-02 18:48:54 +08:00
/** 查询手环未绑定列表 */
getListNoBind(){
this.loadingSeven = true;
this.queryshNoBind.shboxId = this.queryShBoxall.shboxId;
listShNoBind(this.queryshNoBind).then(response => {
this.shListNoBind = response.rows;
this.totalTwo = response.total;
this.loadingSeven = false;
});
2024-08-02 11:13:37 +08:00
},
//打开手环页面
openShbox(row){
this.shboxIdOne = null;
2024-08-02 11:13:37 +08:00
this.title = "新增手环"
this.showsh = true;
this.getListTemp();
this.queryshCode.pageNum = 1;
this.queryshCode.shCode = undefined;
},
//打开手环绑定页面
2024-08-09 16:21:52 +08:00
openShboxTemp(row){
this.queryshCodeBind = {};
this.shboxIdTwo = null;
2024-08-02 11:13:37 +08:00
this.title = "选择"
this.showshBind = true;
this.getListBind();
2024-08-08 13:15:49 +08:00
this.radioTwo=null;
2024-08-02 11:13:37 +08:00
this.queryshCodeBind.pageNum = 1;
this.queryshCodeBind.shId = row.shId;
},
//打开编辑页面
openShEdit(row){
this.shId = row.shId;
this.title = "修改手环"
this.showShEdit = true;
this.getListShEdit();
this.queryshEdit.pageNum = 1;
this.queryshEdit.shCode = row.shCode;
},
//打开手环箱里手环信息页面
openShall(row){
this.shboxId = row.shboxId;
2024-08-02 18:48:54 +08:00
this.title = "绑定的手环信息",
this.boxId = row.shboxId;
this.Capacity = Number(row.shboxCapacity),
this.BindNum = Number(row.shboxBindNum),
2024-08-02 11:13:37 +08:00
this.queryShBoxall.shboxId = row.shboxId;
this.showShall = true;
this.getListBoxall();
2024-08-02 18:48:54 +08:00
this.getBoxInfo();
this.shboxbindId = row.shboxId;
2024-08-02 11:13:37 +08:00
},
2024-08-02 18:48:54 +08:00
//打开手环箱里手环信息页面
getBoxInfo(){
getBoxNewInfo(this.boxId).then(response => {
console.log(response.data.boxNum)
this.numers = response.data.boxNum;
this.addNums = response.data.boxNum;
})
},
2024-08-02 11:13:37 +08:00
}
};
</script>
<style lang="scss" scoped>
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important;
margin-bottom: 10px;
}
2024-08-06 14:31:46 +08:00
.uploadImg {
padding-top: 20px;
display: flex;
align-items: center;
justify-content: center;
}
.shboxCodeTemp {
margin-top: 10px;
padding-bottom: 20px;
font-size: 18px;
}
2024-08-02 11:13:37 +08:00
//隐藏图片上传框的css
::v-deep.disabled {
.el-upload--picture-card {
display: none;
}
}
2024-08-06 14:31:46 +08:00
::v-deep.order .el-table__header-wrapper .el-checkbox {
2024-08-02 18:48:54 +08:00
display: none;
}
2024-08-02 11:13:37 +08:00
</style>