| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725 |
- <template>
- <div class="content">
- <div class="tabs">
- <ul>
- <li v-for="(tab,i) in tabs" @click="goTab(tab.url)" :class="{'active':tabIndex == i}">
- {{tab.name}}
- </li>
- </ul>
- </div>
- <!--<div class="upload">-->
- <!--<h5>固件上传</h5>-->
- <!--<div class="uploadContainer">-->
- <!--<el-upload-->
- <!--class="upload-demo"-->
- <!--action="/api/v1/AdminSettings/FirmwareUpdate"-->
- <!--:on-change="handleChange"-->
- <!--:auto-upload="true"-->
- <!--:file-list="fileList">-->
- <!--<el-button size="small" type="primary">点击上传</el-button>-->
- <!--</el-upload>-->
- <!--<!–<em class="addMemo" v-show="fileList.length == 0" @click="addMemo">–>-->
- <!--<!–<i></i>添加固件–>-->
- <!--<!–</em>–>-->
- <!--</div>-->
- <!--</div>-->
- <div class="hardwareList">
- <h5>升级设备列表</h5>
- <div class="panel">
- <div class="panel-body">
- <div class=" panel_control">
- <el-row :gutter="20">
- <el-col :span="4">
- <em>标签名:</em>
- <el-input v-model="panel.tagname" placeholder="请输入标签名"></el-input>
- </el-col>
- <el-col :span="4">
- <em>所属区域:</em>
- <el-select v-model="panel.regionid">
- <el-option
- v-for="item in panel.regionidOptions"
- :key="item.Id"
- :label="item.Name"
- :value="item.Id">
- </el-option>
- </el-select>
- </el-col>
- <!--<el-col :span="4">-->
- <!--<em>固件版本:</em>-->
- <!--<el-input v-model="panel.keyword" placeholder="请输入固件版本"></el-input>-->
- <!--</el-col>-->
- <el-col :span="4">
- <el-button size="small" type="primary" @click="query">查询</el-button>
- </el-col>
- </el-row>
- </div>
- </div>
- </div>
- <div class="contorl">
- <!--<el-button size="small" type="primary" @click="startUpdate">开始更新</el-button>-->
- <div class="version">
- <em>NEW </em>
- <span>最新固件版本:M0固件:v{{FirmwareScanM0Version}}</span>
- <span>M4固件: v{{FirmwareScanM4Version}}</span>
- <span>ESP固件 :v{{FirmwareVersion}}</span>
- </div>
- <!--<el-tooltip class="item" effect="dark" content="一键更新全部设备固件" placement="top">-->
- <!--<i class="question"></i>-->
- <!--</el-tooltip>-->
- <!--<el-button class="allItem" size="small" type="primary" @click="changeList">全部更新</el-button>-->
- <el-upload
- class="upload-demo"
- :action="FirmwareUpdateUrl"
- :on-change="handleChange"
- :on-success="successResave"
- :before-upload="handleupload"
- :data="uploadData"
- :auto-upload="true"
- :file-list="fileList">
- <el-button size="small" type="primary">点击上传</el-button>
- </el-upload>
- </div>
- <br>
- <el-table
- :data="tableData"
- is-horizontal-resize
- :default-sort="{prop: 'date', order: 'descending'}"
- v-loading="loading"
- element-loading-background="rgba(0, 0, 0, 0.8)"
- class=""
- @selection-change="handleSelectionChange"
- stripe
- >
- <el-table-column
- type="selection"
- width="55">
- </el-table-column>
- <el-table-column
- prop="Mac"
- label="Mac"
- >
- </el-table-column>
- <el-table-column
- prop="TagName"
- label="标签名"
- >
- </el-table-column>
- <el-table-column
- prop="Location"
- label="位置"
- >
- <template slot-scope="scope">
- <el-tooltip class="item" effect="dark" :content="scope.row.Location" placement="top-start">
- <span>
- {{ scope.row.Location.length > 11 ? scope.row.Location.substr(0,11)+'...' : scope.row.Location }}
- </span>
- </el-tooltip>
- </template>
- </el-table-column>
- <el-table-column
- prop="FirmwareVersion"
- label="ESP固件"
- >
- </el-table-column>
- <el-table-column
- prop="HardwareVersion"
- label="硬件版本"
- >
- </el-table-column>
- <el-table-column
- prop="FirmwareScanM4Version"
- label="M4固件版本"
- >
- </el-table-column>
- <el-table-column
- prop="FirmwareScanM0Version"
- label="M0固件版本"
- >
- </el-table-column>
- <el-table-column
- prop="LastOnline"
- label="最近上线"
- >
- </el-table-column>
- <el-table-column
- prop="Memo"
- label="备注"
- >
- </el-table-column>
- <el-table-column
- prop="Status"
- label="状态"
- >
- <template slot-scope="scope">
- <span v-if="scope.row.Status == 0">已禁用</span>
- <span v-if="scope.row.Status == 1">已启用</span>
- <span v-if="scope.row.Status == 2">已离线</span>
- </template>
- </el-table-column>
- </el-table>
- <br>
- <el-pagination
- background
- :total="pageination.total"
- :page-size="pageination.pageItem"
- @current-change="pageChange"
- ></el-pagination>
- <dialog_referrer_list
- :show="dialog_state"
- :title="dialog_title"
- :large="true"
- @dialog_cancel="dialog_cancel"
- @dialog_ok="dialog_ok"
- >
- <div class="dialogContent">
- <el-row :gutter="20">
- <el-col :span="20">
- <label>
- 固件版本号
- </label>
- <el-input type="text" v-model="dialog.version"></el-input>
- </el-col>
- <el-col :span="20">
- <label>
- 备注
- </label>
- <el-input type="textarea" v-model="dialog.memo"></el-input>
- </el-col>
- </el-row>
- </div>
- </dialog_referrer_list>
- <el-dialog
- title="提示"
- :visible.sync="dialogVisible"
- width="30%"
- :before-close="handleClose">
- <span>{{dialogInfo}}</span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </div>
- </template>
- <script>
- import Global from '../Global.js'
- import dialog_referrer_list from '../components/dialog_referrer_list'
- import {
- DetectorQuery,
- GetChildRegionSelect,
- GetLastVerionFirmwareinfo,
- RegionPictureGetByRegionId,
- FirmwareAdd,
- } from '../api/getApiRes.js'
- let qs = require('qs');
- export default {
- data() {
- return {
- FirmwareUpdateUrl: headapi + 'v1/AdminSettings/FirmwareUpdate',
- FirmwareScanM0Version: '',
- FirmwareScanM4Version: '',
- FirmwareVersion: '',
- VersionTime: '',
- // dialog
- dialog_state: false,
- dialog_title: '添加备注',
- dialog_type: '',//类型,1是添加,2是修改
- dialogVisible: false,
- dialogInfo: '开始升级咯~',
- tabIndex: 0,
- tabs: [
- {name: '固件管理', url: 'hardware'},
- //{name: '警务通管理', url: 'police'},
- {name: '密码修改', url: 'pwd'},
- {name: '系统设置', url: 'setting'},
- ],
- fileList: [
- // {name: 'food.jpeg',
- // url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}
- ],
- uploadData: {
- token: localStorage.token
- },
- // panel 配置项目
- panel: {
- usercode: '',
- username: '',
- compname: '',
- keyword: '',
- USERCODE: '',
- taskstatus: 99,
- regionid: 0,
- regionid2: '',
- regionidOptions: [],
- regionidOptions2: [],
- options: [
- {value: 99, label: '全部'},
- {value: 1, label: '进行中'},
- {value: 2, label: '已完成'},
- ],
- time1: globalBt2(),
- },
- pageination: {
- pageItem: 10,
- pageoptions: pageOptions(),
- total: 10,
- pageIndex: 1,
- },
- dialog: {
- version: '',
- updateContent: '',
- key: '',
- },
- draw: 1,
- start: 0,
- recordsTotal: 0,
- tableData: [],
- allTableData: [],
- limit: '10',
- multipleSort: false,
- loading: true,
- multipleSelection: [],
- }
- },
- mounted() {
- this.getTableQuery();
- this.getGetLastVerionFirmwareinfo();
- },
- methods: {
- // 页面数据查询
- getTableQuery() {
- let that = this;
- that.loading = true;
- this.getGetChildRegionSelect(0, 1);
- // 查询检测设备。上级区域id,区域id必传。regionid传0,查询supregionid对应所有子区域的检测设备。 如果supregionid,regionid都传0,默认查询企业ID下所有检测设备
- let param = {
- token: localStorage.token,
- supregionid: 0,//
- regionid: this.panel.regionid,//
- comid: 1,//
- tagname: that.panel.tagname,//标签名
- start: 1,//
- tableMax: 9999,//
- };
- let postdata = qs.stringify(param);
- DetectorQuery(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);
- }
- })
- },
- getGetLastVerionFirmwareinfo() {
- let that = this;
- let param = {
- token: localStorage.token,
- };
- let postdata = qs.stringify(param);
- GetLastVerionFirmwareinfo(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.FirmwareScanM0Version = json.FirmwareScanM0Version;
- that.FirmwareScanM4Version = json.FirmwareScanM4Version;
- that.FirmwareVersion = json.FirmwareVersion;
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 获取下级列表
- getGetChildRegionSelect(regionId, level) {
- let that = this;
- let param = {
- token: localStorage.token,
- regionId: regionId,
- };
- let postdata = qs.stringify(param);
- GetChildRegionSelect(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- if (level == 1) {
- that.panel.regionidOptions = json.Rs;
- that.panel.regionidOptions.unshift({Id: 0, Name: "全部"});
- } else {
- if (json.Rs) {
- that.panel.regionidOptions2 = json.Rs;
- that.panel.regionid2 = json.Rs[0].Id;
- } else {
- that.panel.regionidOptions2 = [];
- that.panel.regionid2 = '';
- }
- }
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 跳转tab页面
- goTab(url) {
- this.$router.push({path: url});
- },
- // 查询按钮
- query() {
- this.getTableQuery();
- this.$message.success('查询完毕');
- },
- handleSelectionChange(val) {
- this.multipleSelection = val;
- console.log(val);
- },
- successResave(response) {
- if (response.Code == 0) {
- this.$message.success('上传成功,等待系统自动更新中....');
- this.getTableQuery();
- } else {
- this.$message.error(response.Memo);
- }
- },
- handleChange(file, fileList) {
- this.fileList = fileList.slice(-3);
- },
- handleupload(file) {
- if (file.type != 'application/x-zip-compressed') {
- this.$message.error('只允许上传压缩文件,当前文件格式为' + file.type);
- return false
- }
- },
- handleClose() {
- console.log(123);
- },
- handleImgbefore(file) {
- console.log(file);
- this.dialog.image = file;
- },
- // 设置分页数据
- 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 globalfmtDate(column, 11);
- },
- addList() {
- this.dialog_state = true;
- this.dialog_title = '添加设备';
- },
- changeList() {
- // checkNum
- if (!this.multipleSelection.length) {
- this.$message({
- showClose: true,
- message: '错了哦,需要先选中一个设备',
- type: 'error'
- });
- return false
- }
- if (this.multipleSelection.length > 1) {
- this.$message({
- showClose: true,
- message: '错了哦,只能选中一个设备',
- type: 'error'
- });
- return false
- }
- },
- // 探测记录
- goRecord(row) {
- console.log(row);
- this.$router.push({path: '/record', query: {row: row}});
- },
- dialog_cancel() {
- let that = this;
- that.dialog_state = false;
- },
- dialog_ok() {
- // 获取提交类型
- this.confirmFirmwareAdd();
- },
- // 添加备注
- addMemo() {
- // 开启弹窗
- this.dialog_state = true;
- },
- // 添加固件
- confirmFirmwareAdd() {
- let that = this;
- let param = {
- token: localStorage.token,
- version: that.dialog.version,
- updateContent: that.dialog.updateContent,
- key: that.dialog.key,
- };
- let postdata = qs.stringify(param);
- FirmwareAdd(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: '添加固件成功!',
- type: 'success'
- });
- that.getTableQuery();
- that.getGetLastVerionFirmwareinfo();
- // 关闭弹窗
- that.dialog_state = false;
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 开始更新
- startUpdate() {
- // checkNum
- if (!this.multipleSelection.length) {
- this.$message({
- showClose: true,
- message: '错了哦,需要先选中一个设备',
- type: 'error'
- });
- return false
- }
- this.dialogVisible = true;
- }
- },
- components: {
- dialog_referrer_list
- }
- }
- </script>
- <style scoped>
- @import "../assets/css/panel.css";
- @import "../assets/css/dialog.css";
- .content {
- width: 98%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- padding-left: 20px;
- }
- .tabs ul {
- width: 558px;
- }
- table span {
- cursor: pointer;
- }
- .upload {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .upload h5 {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- color: #6DC1FF;
- font-size: 18px;
- text-align: left;
- font-weight: normal;
- }
- .uploadContainer {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- background: rgba(27, 86, 200, 0.14);
- border: 1px solid #005EA2;
- border-radius: 0;
- margin-top: 11px;
- padding: 10px 0;
- }
- /deep/ .el-upload {
- float: left;
- margin-left: 27px;
- }
- /deep/ .el-upload-list {
- width: 600px;
- float: left;
- overflow: hidden;
- }
- /deep/ .el-upload-list__item-name [class^=el-icon] {
- color: #6DC1FF;
- }
- /deep/ .el-upload-list__item-name {
- color: #6DC1FF;
- }
- /deep/ .el-upload-list__item:first-child {
- margin-top: 5px;
- }
- /deep/ .el-upload-list__item:hover {
- background: none;
- }
- .addMemo {
- width: 120px;
- height: 30px;
- line-height: 30px;
- border-radius: 250px;
- float: left;
- background: #005EA2;
- color: #6DC1FF;
- font-size: 14px;
- text-align: left;
- font-style: normal;
- cursor: pointer;
- margin-top: 2px;
- margin-left: 20px;
- }
- .addMemo i {
- width: 14px;
- height: 14px;
- overflow: hidden;
- float: left;
- background: url("../assets/img/icon/addMemo.png") top center no-repeat;
- background-size: 100% 100%;
- margin-top: 8px;
- margin-left: 20px;
- margin-right: 10px;
- }
- .hardwareList {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- margin-top: 35px;
- }
- .hardwareList h5 {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- color: #6DC1FF;
- font-size: 18px;
- text-align: left;
- font-weight: normal;
- margin-bottom: 10px;
- }
- .contorl {
- /*width: 100%;*/
- overflow: hidden;
- display: block;
- margin: 0 auto;
- padding: 17px 23px;
- }
- em {
- font-style: normal;
- }
- .version {
- float: left;
- color: #6DC1FF;
- font-size: 14px;
- font-style: normal;
- margin-left: 30px;
- line-height: 30px;
- }
- .version span {
- margin-right: 10px;
- }
- .allItem {
- float: right;
- }
- .question {
- width: 18px;
- height: 18px;
- cursor: pointer;
- background: url("../assets/img/icon/question_icon.png") top center no-repeat;
- float: right;
- margin-top: 7px;
- margin-left: 13px;
- }
- /deep/ textarea {
- color: #6DC1FF;
- outline: none;
- }
- .upload-demo {
- /*float: right;*/
- }
- /deep/ .el-upload-list__item {
- width: 160px;
- float: left;
- }
- </style>
|