|
@@ -23,15 +23,34 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" class="search-btn" @click="filterBoxListFnc()">搜 索</el-button>
|
|
|
+ <el-button
|
|
|
+ class="search-button"
|
|
|
+ type="warning"
|
|
|
+ @click="batchUpdate"
|
|
|
+ >批量升级网关
|
|
|
+ </el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<el-button type="primary" circle class="el-icon-refresh-right refresh-button" @click="refreshList()"></el-button>
|
|
|
|
|
|
+
|
|
|
<el-button type="danger" class="add-new-button" @click="addBoxFnc()" v-if="modeShow === 'all'">新 建</el-button>
|
|
|
+
|
|
|
+<!-- <div class="search-button-container">-->
|
|
|
+
|
|
|
+<!-- </div>-->
|
|
|
</div>
|
|
|
<!-- 搜索end -->
|
|
|
<!-- 列表start -->
|
|
|
- <el-table :data="boxList" v-loading="boxListLoading" style="width: 100%" border stripe>
|
|
|
+ <el-table :data="boxList" v-loading="boxListLoading" style="width: 100%" border stripe ref="multipleTable" @select="select" @select-all="selectAll"
|
|
|
+ :key="randomKey"
|
|
|
+ :row-key="getRowKey">
|
|
|
+ <el-table-column :reserve-selection ="true"
|
|
|
+ label="选择" type="selection"
|
|
|
+ width="66"
|
|
|
+ align="center"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="序号" align="center" width="60">
|
|
|
<template slot-scope="scope">{{ scope.$index + 1 + (pageIndex - 1) * pageSize }}</template>
|
|
|
</el-table-column>
|
|
@@ -75,11 +94,135 @@
|
|
|
@size-change="sizeChange"></el-pagination>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <el-dialog title="批量升级网关" :visible.sync="show" width="800px" append-to-body :close-on-click-modal="false">
|
|
|
+ <div class="operate-container">
|
|
|
+ <div class="operate-form">
|
|
|
+ <div class="form-item">
|
|
|
+ <div class="label">任务名称</div>
|
|
|
+ <div>
|
|
|
+ <el-input
|
|
|
+ v-model="name"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="form-item">
|
|
|
+ <div class="label">升级时间</div>
|
|
|
+ <div>
|
|
|
+ <el-date-picker
|
|
|
+ value-format=" yyyy-MM-dd HH:mm:ss"
|
|
|
+ v-model="batch_update_time"
|
|
|
+ type="datetime"
|
|
|
+ placeholder="选择日期时间">
|
|
|
+ </el-date-picker>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-item">
|
|
|
+ <div class="label">版本号</div>
|
|
|
+ <div>
|
|
|
+ <el-input
|
|
|
+ v-model="version"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-item">
|
|
|
+ <div class="label">上传版本</div>
|
|
|
+ <div class="content">
|
|
|
+ <el-input
|
|
|
+ v-model="download_url"
|
|
|
+ clearable
|
|
|
+ placeholder
|
|
|
+ v-if="download_url"
|
|
|
+ ></el-input>
|
|
|
+ <!-- <div class="upload-button" v-else>点击此处上传</div> -->
|
|
|
+ <el-upload
|
|
|
+ name="file"
|
|
|
+ class="upload-button"
|
|
|
+ drag
|
|
|
+ :on-success="handleFileSuccess1"
|
|
|
+ action="http://uploader.linkseeiot.com/upload/file"
|
|
|
+ v-else
|
|
|
+ :data="signData"
|
|
|
+ multiple
|
|
|
+ >点击此处上传</el-upload>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="make-sure-container">
|
|
|
+ <el-button
|
|
|
+ class="make-sure-button"
|
|
|
+ type="danger"
|
|
|
+ @click="makeSureAddOperate1('delay')"
|
|
|
+ >定时升级</el-button>
|
|
|
+ <el-button
|
|
|
+ class="make-sure-button"
|
|
|
+ type="success"
|
|
|
+ @click="makeSureAddOperate1('now')"
|
|
|
+ >立即升级</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+<div>
|
|
|
+ <el-table
|
|
|
+ :data="this.checkedList"
|
|
|
+ style="width: 100%"
|
|
|
+ border
|
|
|
+ >
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ label="序号"
|
|
|
+ width="66"
|
|
|
+ :reserve-selection="true"
|
|
|
+ align="center"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>{{scope.$index + pageSize * (pageIndex -1)+1}}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="项目名称"
|
|
|
+ prop="project_name"
|
|
|
+ align="left"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="盒子名称"
|
|
|
+ prop="box_name"
|
|
|
+ align="left"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ width="100"
|
|
|
+ label="网关版本"
|
|
|
+ prop="box_sversion"
|
|
|
+ align="center"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="操作"
|
|
|
+ width="100"
|
|
|
+ align="center"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ style="color: #FF4949;"
|
|
|
+ @click="deleteSelected(scope.row)"
|
|
|
+ >删除
|
|
|
+ </el-button>
|
|
|
+
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+</div>
|
|
|
+
|
|
|
+
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { getBoxList, delBox, syncConf, getBoxDetail, createBox } from "@/api/box";
|
|
|
-import { getProjectList } from "@/api/project";
|
|
|
+import {batchCommitUpdate, getProjectList} from "@/api/project";
|
|
|
import { currentUserName } from "@/utils/trace";
|
|
|
import { dateFtt } from "@/utils/format";
|
|
|
import { operatorList } from "@/api/project";
|
|
@@ -110,6 +253,20 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ gateWayTableData: [],
|
|
|
+ checkedList:[],
|
|
|
+ download_url:'',
|
|
|
+ name:'',
|
|
|
+ version:'',
|
|
|
+ formData:{
|
|
|
+ select_time:'',
|
|
|
+ req:[],
|
|
|
+ name:'',
|
|
|
+ download_url:'',
|
|
|
+ version:'',
|
|
|
+ },
|
|
|
+ batch_update_time: '',
|
|
|
+ randomKey: Math.random(),
|
|
|
modeShow: "view",
|
|
|
boxList: [],
|
|
|
boxListLoading: false,
|
|
@@ -120,6 +277,8 @@ export default {
|
|
|
searchProject: undefined, //搜索所属项目
|
|
|
searchOperate: undefined, //搜索运营商
|
|
|
operatorListOption: [],
|
|
|
+ open:false,
|
|
|
+ show:false,
|
|
|
pojectListOption: [
|
|
|
{
|
|
|
label: "全部",
|
|
@@ -133,7 +292,122 @@ export default {
|
|
|
this.pageIndex = currentPage || 1;
|
|
|
await Promise.all([this.operatorListFnc(), this.projectListFunc(), this.getBoxListFnc()]);
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ signData() {
|
|
|
+ // return signVal({ customer_id: currentUserName() });
|
|
|
+ return { customer_id: currentUserName() };
|
|
|
+ },
|
|
|
+ // operateTypeFilter() {
|
|
|
+ // if (this._props.operateType === "create") {
|
|
|
+ // return "确认新增"
|
|
|
+ // } else if (this._props.operateType === "edit") {
|
|
|
+ // return "确认修改"
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ deleteSelected(row){
|
|
|
+ console.log('deleteSelected row is:',row)
|
|
|
+ },
|
|
|
+ addRows (rows) {
|
|
|
+ console.log('rows is',rows)
|
|
|
+
|
|
|
+ rows.forEach(row => {
|
|
|
+ if (this.checkedList.find(item => item.box_auto_id == row.box_auto_id)) { return }
|
|
|
+ this.checkedList.push(row)
|
|
|
+ });
|
|
|
+ console.log('add then count is:',this.checkedList.length)
|
|
|
+ console.log('add this.checkedList is',this.checkedList)
|
|
|
+ },
|
|
|
+ //取消选中
|
|
|
+ deleteRows (rows) {
|
|
|
+ //当selectedItems为空数组时,不执行删除
|
|
|
+ if (this.checkedList.length == 0) { return }
|
|
|
+ rows.forEach(row => {
|
|
|
+ this.checkedList = this.checkedList.filter(item => item.box_auto_id != row.box_auto_id)
|
|
|
+ })
|
|
|
+ console.log('delete then count is:',this.checkedList.length)
|
|
|
+ console.log('delete this.checkedList is',this.checkedList)
|
|
|
+ },
|
|
|
+ selectAll (selection) {
|
|
|
+ console.log('///selection is:',selection)
|
|
|
+ console.log('///this.gateWayTableData is:',this.gateWayTableData)
|
|
|
+ //判断是选中还是取消
|
|
|
+ if (selection.length > 0) {
|
|
|
+ this.addRows(this.gateWayTableData)
|
|
|
+ } else {
|
|
|
+ this.deleteRows(this.gateWayTableData)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ select (selection, row) {
|
|
|
+ console.log('///select ...',selection,row)
|
|
|
+ if (selection && selection.find(item => item && (item.box_auto_id == row.box_auto_id))) {
|
|
|
+ this.addRows([row])
|
|
|
+ } else {
|
|
|
+ this.deleteRows([row])
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async makeSureAddOperate1(val) {
|
|
|
+ console.log('downloadurl is:',this.download_url);
|
|
|
+ console.log('signData is:', this.signData);
|
|
|
+ console.log(this.batch_update_time);
|
|
|
+ if (val === 'delay')
|
|
|
+ {this.formData.select_time = this.batch_update_time;}
|
|
|
+ else if (val === 'now'){
|
|
|
+ this.formData.select_time = 'now'
|
|
|
+ }
|
|
|
+ console.log('this.formData.select_time is:',this.formData.select_time )
|
|
|
+ this.formData.name = this.name;
|
|
|
+ this.formData.version = this.version;
|
|
|
+ this.formData.gateway_version = this.download_url;
|
|
|
+ for (var i = 0; i < this.checkedList.length; i++) {
|
|
|
+ let cell = {}
|
|
|
+ cell.project_auto_id = this.checkedList[i].project_auto_id
|
|
|
+ cell.box_auto_id = this.checkedList[i].box_auto_id
|
|
|
+ cell.box_id = this.checkedList[i].box_id
|
|
|
+ this.formData.req.push(cell)
|
|
|
+ }
|
|
|
+ console.log('formData is:', this.formData)
|
|
|
+ const res = await batchCommitUpdate({
|
|
|
+ name: this.formData.name,
|
|
|
+ gateway_version: this.formData.gateway_version,
|
|
|
+ select_time: this.formData.select_time,
|
|
|
+ req: this.formData.req,
|
|
|
+ version: this.formData.version,
|
|
|
+
|
|
|
+ });
|
|
|
+ console.log('res is', res)
|
|
|
+ if (res.code === 200) {
|
|
|
+ console.log('batch success')
|
|
|
+ this.$notify({
|
|
|
+ message: "提交成功",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ this.show = false;
|
|
|
+ } else {
|
|
|
+ console.log('batch fail')
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleFileSuccess1(res, file) {
|
|
|
+ this.download_url = res.data;
|
|
|
+ },
|
|
|
+ // 批量升级
|
|
|
+ batchUpdate() {
|
|
|
+ console.log('batchUpdate.this.checkedList is: ',this.checkedList)
|
|
|
+ if (this.checkedList.length>0){
|
|
|
+ this.show = true;
|
|
|
+ }else{
|
|
|
+ this.show =false;
|
|
|
+ this.$notify({
|
|
|
+ message: "请至少选择一个盒子进行批量升级",
|
|
|
+ type: "warning"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getRowKey(row){
|
|
|
+ return row.box_auto_id;
|
|
|
+ },
|
|
|
boxStateFilterColor(state) {
|
|
|
switch (state) {
|
|
|
case 0:
|