feat: 添加 网关批量固件升级,型号系列 功能
This commit is contained in:
parent
f729da1909
commit
89334e8f83
|
@ -19,6 +19,6 @@ port= 9988
|
|||
// target = http://192.168.18.136:8899
|
||||
|
||||
// 测试端
|
||||
target = http://192.168.10.241:32024
|
||||
// target = http://192.168.10.241:32024
|
||||
// 开发端
|
||||
// target = http://192.168.10.241:30646
|
||||
target = http://192.168.10.241:30646
|
||||
|
|
|
@ -60,3 +60,14 @@ export function upgradeOta(data) {
|
|||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 新增固件版本
|
||||
export function upgradeBatch(data) {
|
||||
return request({
|
||||
url: '/iot/ota/upgradeBatch',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
|
@ -68,3 +68,20 @@ export function listModelType() {
|
|||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
// 根据网关设备id 查询 子设备模型列表
|
||||
export function getModelListByGatewayDevId(deviceId) {
|
||||
return request({
|
||||
url: "/iot/device/modelList/" + deviceId,
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
// 根据 型号 产品key 查询固件
|
||||
export function getAtoListByModelProdKey(query) {
|
||||
return request({
|
||||
url: "/iot/ota/list",
|
||||
method: "get",
|
||||
params: query
|
||||
});
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询型号系列列表
|
||||
export function listModelSeries(query) {
|
||||
return request({
|
||||
url: '/iot/modelSeries/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询型号系列详细
|
||||
export function getModelSeries(seriesId) {
|
||||
return request({
|
||||
url: '/iot/modelSeries/' + seriesId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增型号系列
|
||||
export function addModelSeries(data) {
|
||||
return request({
|
||||
url: '/iot/modelSeries',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改型号系列
|
||||
export function updateModelSeries(data) {
|
||||
return request({
|
||||
url: '/iot/modelSeries',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除型号系列
|
||||
export function delModelSeries(seriesId) {
|
||||
return request({
|
||||
url: '/iot/modelSeries/' + seriesId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出型号系列
|
||||
export function exportModelSeries(query) {
|
||||
return request({
|
||||
url: '/iot/modelSeries/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
|
@ -9,6 +9,7 @@ const attribute = {
|
|||
|
||||
mutations: {
|
||||
SET_ATTRIBUTE_LIST: (state, list) => {
|
||||
debugger
|
||||
state.attributeList = list
|
||||
},
|
||||
SET_GROUP_LIST: (state, list) => {
|
||||
|
@ -37,15 +38,32 @@ const attribute = {
|
|||
},
|
||||
GET_GROUP_ITEM: (state, idx) => {
|
||||
return state.groupList[idx]
|
||||
}
|
||||
},
|
||||
GET_ATTRIBUTE_LIST: (state) => {
|
||||
return state.attributeList
|
||||
},
|
||||
GET_GROUP_LIST: (state) => {
|
||||
return state.groupList
|
||||
},
|
||||
},
|
||||
|
||||
actions: {
|
||||
GetAttributeList({state}) {
|
||||
debugger
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(state.attributeList)
|
||||
})
|
||||
},
|
||||
GetGroupList({state}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(state.groupList)
|
||||
})
|
||||
},
|
||||
// 初始化 属性和分组数据
|
||||
InitAttributeAndGroup({ commit, state }, data) {
|
||||
commit('SET_ATTRIBUTE_LIST', data.attrList)
|
||||
commit('SET_GROUP_LIST', data.groupList)
|
||||
console.log('res:', state)
|
||||
console.log('res:', state, data)
|
||||
},
|
||||
// 新增 属性
|
||||
AddAttribute({ commit, state }, attr) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/**
|
||||
* 通用js方法封装处理
|
||||
* Copyright (c) 2019 hciot
|
||||
|
|
|
@ -248,6 +248,18 @@
|
|||
<el-input v-model="form.modelName" placeholder="请输入型号名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" style="
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
height: 0;
|
||||
z-index: 99;
|
||||
position: relative;
|
||||
top: -10px;"
|
||||
>
|
||||
<el-button style="width: 200px; height: 40px;" type="primary" @click="openTableSelectScriesDialog" icon="el-icon-menu">选择型号系列</el-button>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24">
|
||||
<el-form-item
|
||||
label="产品json:"
|
||||
|
@ -406,6 +418,7 @@ import DialogTemplate from "@/components/DialogTemplate";
|
|||
import attributeForm from "@/views/profile/attribute/attributeForm";
|
||||
import groupForm from "@/views/profile/attribute/groupForm";
|
||||
import paramsJson from "@/views/profile/attribute/paramsJson";
|
||||
import { listModelSeries, getModelSeries } from "@/api/iot/modelSeries";
|
||||
|
||||
const deviceStartsOpt = {
|
||||
0: "禁用",
|
||||
|
@ -601,6 +614,93 @@ export default {
|
|||
};
|
||||
this.selectTableShow = true;
|
||||
},
|
||||
openTableSelectScriesDialog() {
|
||||
this.selectResult = {};
|
||||
this.tableSelectOption = {
|
||||
otherOption: {
|
||||
tableType: "scries",
|
||||
},
|
||||
queryOpt: {
|
||||
disable: false,
|
||||
labelWidth: "68px",
|
||||
params: {
|
||||
seriesName: "",
|
||||
prodKey: "",
|
||||
},
|
||||
page: {
|
||||
pageSize: 10,
|
||||
pageNum: 1,
|
||||
total: 0,
|
||||
},
|
||||
inline: true,
|
||||
queryChilds: [
|
||||
{
|
||||
style: "",
|
||||
placeholder: "系列名称",
|
||||
clearable: true,
|
||||
label: "系列名称",
|
||||
type: "input",
|
||||
key: "seriesName",
|
||||
size: "small",
|
||||
value: "",
|
||||
},
|
||||
{
|
||||
style: "",
|
||||
placeholder: "产品PK",
|
||||
clearable: true,
|
||||
label: "产品PK",
|
||||
type: "input",
|
||||
key: "prodKey",
|
||||
size: "small",
|
||||
value: "",
|
||||
},
|
||||
],
|
||||
},
|
||||
tableOpt: {
|
||||
loading: false,
|
||||
rowKey: "deviceId",
|
||||
selection: false,
|
||||
maxHeight: "45vh",
|
||||
childs: [
|
||||
{
|
||||
style: "",
|
||||
label: "系列名称",
|
||||
type: "",
|
||||
prop: "seriesName",
|
||||
align: "left",
|
||||
width: "",
|
||||
"show-overflow-tooltip": false,
|
||||
tempType: "span",
|
||||
},
|
||||
{
|
||||
style: "",
|
||||
label: " 产品PK",
|
||||
type: "",
|
||||
prop: "prodKey",
|
||||
align: "left",
|
||||
width: "",
|
||||
"show-overflow-tooltip": false,
|
||||
tempType: "span",
|
||||
},
|
||||
{
|
||||
style: "",
|
||||
label: "创建时间",
|
||||
type: "",
|
||||
prop: "createTime",
|
||||
align: "left",
|
||||
width: "",
|
||||
"show-overflow-tooltip": false,
|
||||
tempType: "span",
|
||||
},
|
||||
],
|
||||
tableList: {
|
||||
type: Array,
|
||||
},
|
||||
},
|
||||
tableList: [],
|
||||
};
|
||||
this.selectTableShow = true;
|
||||
},
|
||||
// 打开厂商选择窗口 ——表格
|
||||
openTableSelectDialog() {
|
||||
this.selectResult = {};
|
||||
|
@ -702,10 +802,18 @@ export default {
|
|||
},
|
||||
// 查询回调
|
||||
childGetList(data) {
|
||||
if (data.otherOption.tableType === "vendor") {
|
||||
this.vendorChildList(data);
|
||||
} else if (data.otherOption.tableType === "product") {
|
||||
this.productChildList(data);
|
||||
switch(data.otherOption.tableType) {
|
||||
case 'vendor':
|
||||
this.vendorChildList(data);
|
||||
break;
|
||||
|
||||
case 'product':
|
||||
this.productChildList(data);
|
||||
break;
|
||||
|
||||
case 'scries':
|
||||
this.scriesChildList(data);
|
||||
break;
|
||||
}
|
||||
},
|
||||
productChildList(data) {
|
||||
|
@ -724,37 +832,106 @@ export default {
|
|||
}
|
||||
);
|
||||
},
|
||||
scriesChildList(data) {
|
||||
listModelSeries(Object.assign(data.page, data.param)).then(
|
||||
(response) => {
|
||||
this.tableSelectOption.tableList = response.rows;
|
||||
this.tableSelectOption.queryOpt.page.total = Number(response.total);
|
||||
}
|
||||
);
|
||||
},
|
||||
// 点击或者双击数据回调
|
||||
returnEvent(data) {
|
||||
this.selectResult = {};
|
||||
if (data.type === "dblclick") {
|
||||
if (data.otherOption.tableType === "vendor") {
|
||||
this.form.vendorId = data.value.vendorId;
|
||||
this.form.vendorName = data.value.vendorName;
|
||||
} else if (data.otherOption.tableType === "product") {
|
||||
this.form.prodKey = data.value.prodId;
|
||||
this.form.prodSecret = data.value.prodSecret;
|
||||
switch(data.otherOption.tableType) {
|
||||
case 'vendor':
|
||||
this.form.vendorId = data.value.vendorId;
|
||||
this.form.vendorName = data.value.vendorName;
|
||||
break;
|
||||
|
||||
case 'product':
|
||||
this.form.prodKey = data.value.prodId;
|
||||
this.form.prodSecret = data.value.prodSecret;
|
||||
break;
|
||||
|
||||
case 'scries':
|
||||
this.form.prodJson = data.value.prodJson;
|
||||
this.form.remark = data.value.remark;
|
||||
this.form.deviceType = data.value.deviceType;
|
||||
try {
|
||||
this.form.paramList = JSON.parse(data.value.paramJson);
|
||||
} catch (error) {
|
||||
this.form.paramList = [];
|
||||
}
|
||||
let _this = this;
|
||||
setTimeout(() => {
|
||||
_this.$refs.paramWrap.setList(_this.form.paramList || []);
|
||||
_this.$refs.attributeref.handleInitData();
|
||||
_this.$refs.attributeref.forceUpdateList('groupForm');
|
||||
_this.$refs.attributeref.forceUpdateList('attributeForm');
|
||||
|
||||
}, 100);
|
||||
|
||||
break;
|
||||
}
|
||||
this.selectTableShow = false;
|
||||
} else if (data.type === "click") {
|
||||
if (data.otherOption.tableType === "vendor") {
|
||||
this.selectResult.vendorId = data.value.vendorId;
|
||||
this.selectResult.vendorName = data.value.vendorName;
|
||||
} else if (data.otherOption.tableType === "product") {
|
||||
this.selectResult.prodKey = data.value.prodId;
|
||||
this.selectResult.prodSecret = data.value.prodSecret;
|
||||
|
||||
switch(data.otherOption.tableType) {
|
||||
case 'vendor':
|
||||
this.selectResult.vendorId = data.value.vendorId;
|
||||
this.selectResult.vendorName = data.value.vendorName;
|
||||
break;
|
||||
|
||||
case 'product':
|
||||
this.selectResult.prodKey = data.value.prodId;
|
||||
this.selectResult.prodSecret = data.value.prodSecret;
|
||||
break;
|
||||
|
||||
case 'scries':
|
||||
this.selectResult.prodJson = data.value.prodJson;
|
||||
this.selectResult.remark = data.value.remark;
|
||||
this.selectResult.deviceType = data.value.deviceType;
|
||||
try {
|
||||
this.selectResult.paramList = JSON.parse(data.value.paramJson);
|
||||
} catch (error) {
|
||||
this.selectResult.paramList = [];
|
||||
}
|
||||
console.log('row:', data.value)
|
||||
break;
|
||||
}
|
||||
|
||||
this.selectResult.tableType = data.otherOption.tableType;
|
||||
}
|
||||
},
|
||||
// 点击确定按钮
|
||||
resuleClick() {
|
||||
if (this.selectResult.tableType === "vendor") {
|
||||
this.form.vendorId = this.selectResult.vendorId;
|
||||
this.form.vendorName = this.selectResult.vendorName;
|
||||
} else if (this.selectResult.tableType === "product") {
|
||||
this.form.prodKey = this.selectResult.prodKey;
|
||||
this.form.prodSecret = this.selectResult.prodSecret;
|
||||
switch(this.selectResult.tableType) {
|
||||
case 'vendor':
|
||||
this.form.vendorId = this.selectResult.vendorId;
|
||||
this.form.vendorName = this.selectResult.vendorName;
|
||||
break;
|
||||
|
||||
case 'product':
|
||||
this.form.prodKey = this.selectResult.prodKey;
|
||||
this.form.prodSecret = this.selectResult.prodSecret;
|
||||
break;
|
||||
|
||||
case 'scries':
|
||||
this.form.prodJson = this.selectResult.prodJson;
|
||||
this.form.remark = this.selectResult.remark;
|
||||
this.form.deviceType = this.selectResult.deviceType;
|
||||
this.form.paramList = this.selectResult.paramList
|
||||
let _this = this;
|
||||
setTimeout(() => {
|
||||
_this.$refs.paramWrap.setList(_this.form.paramList || []);
|
||||
_this.$refs.attributeref.handleInitData();
|
||||
_this.$refs.attributeref.forceUpdateList('groupForm');
|
||||
_this.$refs.attributeref.forceUpdateList('attributeForm');
|
||||
}, 100);
|
||||
|
||||
break;
|
||||
}
|
||||
this.selectTableShow = false;
|
||||
},
|
||||
|
@ -854,7 +1031,7 @@ export default {
|
|||
}
|
||||
|
||||
this.form.paramList = this.$refs.paramWrap.getResult();
|
||||
if (this.form.modelId != null) {
|
||||
if (this.form.seriesId != null) {
|
||||
updateModel(this.form).then((response) => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
|
|
|
@ -0,0 +1,637 @@
|
|||
<template>
|
||||
<div class="app-container iot-model-series">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="系列名称" prop="seriesName">
|
||||
<el-input
|
||||
v-model="queryParams.seriesName"
|
||||
placeholder="请输入系列名称"
|
||||
clearable
|
||||
size="mini"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="产品PK" prop="prodKey">
|
||||
<el-input
|
||||
v-model="queryParams.prodKey"
|
||||
placeholder="产品PK"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</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="handleAdd"
|
||||
v-hasPermi="['model:modelSeries:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['model:modelSeries:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['model:modelSeries:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['model:modelSeries:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="modelSeriesList"
|
||||
:default-sort="{ prop: 'createTime', order: 'descending' }"
|
||||
@sort-change="sortChange">
|
||||
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
align="center"
|
||||
:index="indexFormatter"
|
||||
width="80px"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
label="系列名称"
|
||||
align="left"
|
||||
prop="seriesName"
|
||||
/>
|
||||
<el-table-column
|
||||
label="产品PK"
|
||||
align="left"
|
||||
prop="prodKey"
|
||||
/>
|
||||
|
||||
<el-table-column
|
||||
label="设备类型"
|
||||
align="center"
|
||||
prop="deviceType"
|
||||
width="150px"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span v-text="deviceTypeList[scope.row.deviceType]"></span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="启用状态"
|
||||
align="center"
|
||||
prop="seriesStatus"
|
||||
width="100px"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success" v-if="scope.row.seriesStatus === '0'"
|
||||
>启用</el-tag
|
||||
>
|
||||
<el-tag type="danger" v-else>禁用</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label=" 创建时间"
|
||||
align="center"
|
||||
sortable="custom"
|
||||
prop="createTime"
|
||||
width="160px"
|
||||
/>
|
||||
|
||||
<el-table-column
|
||||
width="160px"
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['model:modelSeries:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['model:modelSeries:remove']"
|
||||
>删除</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"
|
||||
/>
|
||||
|
||||
<dialog-template width="1000px" :title="title" :visible="open" @close="open = false" >
|
||||
<el-form slot="dialog-center" ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="系列名称:" prop="seriesName">
|
||||
<el-input v-model="form.seriesName" placeholder="请输入系列名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="产品PK:" prop="prodKey">
|
||||
<el-input
|
||||
:disabled="form.seriesId || form.seriesId === 0"
|
||||
placeholder="请填写产品PK"
|
||||
v-model="form.prodKey"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24">
|
||||
<el-form-item
|
||||
label="产品json:"
|
||||
prop="prodJson"
|
||||
>
|
||||
<attribute-view
|
||||
v-if="open"
|
||||
:arttributeList="form.prodJson"
|
||||
:groupList="form.remark"
|
||||
@handleEvent="handleViewEvent"
|
||||
ref="attributeref"
|
||||
></attribute-view>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24">
|
||||
<el-form-item label="设备类型:" prop="deviceType">
|
||||
<el-select
|
||||
v-model="form.deviceType"
|
||||
style="width: 100%"
|
||||
placeholder="请选择设备类型"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
:label="keys"
|
||||
:value="vals"
|
||||
v-for="(keys, vals) in deviceTypeList"
|
||||
:key="vals"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24">
|
||||
<el-form-item label="参数设置:" v-show="form.deviceType">
|
||||
<span style="color: red; font-size: 12px"
|
||||
>*注意:锁定即参数不可修改;未锁则可以修改。</span
|
||||
>
|
||||
<div class="form-params-wrap">
|
||||
<param-wrap
|
||||
ref="paramWrap"
|
||||
:typeKeys="form.deviceType"
|
||||
></param-wrap>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
|
||||
</el-form>
|
||||
|
||||
<div slot="dialog-footer" class="dialog-footer">
|
||||
<el-button size="mini" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button size="mini" @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
|
||||
</dialog-template>
|
||||
|
||||
<dialog-template
|
||||
:title="componentTitle"
|
||||
@close="
|
||||
() => {
|
||||
AttributeViewShow = false;
|
||||
}
|
||||
"
|
||||
:visible="AttributeViewShow"
|
||||
width="750px"
|
||||
>
|
||||
<component
|
||||
v-if="AttributeViewShow"
|
||||
:is="componectVal"
|
||||
:tempType="childOpt.type"
|
||||
:paramIdx="childOpt.paramIdx"
|
||||
:other="{
|
||||
action: '',
|
||||
prodPK: form.prodKey,
|
||||
cmdKey: '',
|
||||
}"
|
||||
:paramsList="functionList"
|
||||
ref="componentref"
|
||||
@ok="compEventOk"
|
||||
slot="dialog-center"
|
||||
></component>
|
||||
|
||||
<div slot="dialog-footer">
|
||||
<el-button type="primary" size="mini" @click="submitAttribute"
|
||||
>确 定</el-button
|
||||
>
|
||||
<el-button
|
||||
size="mini"
|
||||
@click="
|
||||
() => {
|
||||
AttributeViewShow = false;
|
||||
}
|
||||
"
|
||||
>取 消</el-button
|
||||
>
|
||||
</div>
|
||||
</dialog-template>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listDeviceTypeList } from "@/api/iot/device";
|
||||
import { listModelSeries, getModelSeries, delModelSeries, addModelSeries, updateModelSeries, exportModelSeries } from "@/api/iot/modelSeries";
|
||||
import DialogTemplate from "@/components/DialogTemplate";
|
||||
import attributeForm from "@/views/profile/attribute/attributeForm";
|
||||
import groupForm from "@/views/profile/attribute/groupForm";
|
||||
import paramsJson from "@/views/profile/attribute/paramsJson";
|
||||
import ParamWrap from "@/components/ParamWrap/deviceParam";
|
||||
import AttributeView from "@/views/profile/attribute/index";
|
||||
|
||||
export default {
|
||||
name: "ModelSeries",
|
||||
components: {
|
||||
DialogTemplate,
|
||||
attributeForm,
|
||||
groupForm,
|
||||
paramsJson,
|
||||
AttributeView,
|
||||
ParamWrap,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 型号系列表格数据
|
||||
modelSeriesList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 执行状态字典
|
||||
statusOptions: [],
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
seriesName: null,
|
||||
prodKey: null,
|
||||
deviceType: null,
|
||||
seriesStatus: null,
|
||||
createId: null,
|
||||
updateId: null,
|
||||
prodJson: null,
|
||||
paramJson: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
vendorId: [
|
||||
{ required: true, message: "厂商不能为空", trigger: "change" },
|
||||
],
|
||||
prodKey: [
|
||||
{ required: true, message: "产品PK不能为空", trigger: "change" },
|
||||
],
|
||||
modelName: [
|
||||
{ required: true, message: "型号名称不能为空", trigger: "blur" },
|
||||
],
|
||||
deviceType: [
|
||||
{ required: true, message: "设备类型不能为空", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
///////
|
||||
childOpt: {
|
||||
type: "add",
|
||||
paramIdx: 0,
|
||||
},
|
||||
componentTitle: "",
|
||||
AttributeViewShow: false,
|
||||
functionList: [],
|
||||
componectVal: "attributeForm",
|
||||
deviceTypeList: {},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getDicts("sys_status").then(response => {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
this.getDeviceTypeList();
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
indexFormatter(val) {
|
||||
return (
|
||||
val + 1 + (this.queryParams.pageNum - 1) * this.queryParams.pageSize
|
||||
);
|
||||
},
|
||||
handleViewEvent(data) {
|
||||
console.log(data);
|
||||
this.componentTitle = data.title;
|
||||
(this.childOpt.type = data.type),
|
||||
(this.childOpt.paramIdx = data.paramIdx);
|
||||
this.AttributeViewShow = true;
|
||||
this.functionList = JSON.parse(
|
||||
JSON.stringify(this.$store.getters.attributeList)
|
||||
);
|
||||
this.componectVal = data.component;
|
||||
},
|
||||
submitAttribute() {
|
||||
if (this.childOpt.type === "param") {
|
||||
this.AttributeViewShow = false;
|
||||
return;
|
||||
}
|
||||
if (this.$refs.componentref) {
|
||||
this.$refs.componentref.submitForm();
|
||||
}
|
||||
},
|
||||
compEventOk() {
|
||||
//执行
|
||||
this.AttributeViewShow = false;
|
||||
this.$forceUpdate();
|
||||
this.$refs.attributeref.forceUpdate(this.componectVal);
|
||||
},
|
||||
// 查询设备类型列表
|
||||
getDeviceTypeList() {
|
||||
listDeviceTypeList().then((response) => {
|
||||
this.deviceTypeList = response.data;
|
||||
});
|
||||
},
|
||||
sortChange(column) {
|
||||
const sort = {
|
||||
isAsc: column.order === "descending" ? "desc" : "asc",
|
||||
orderByColumn: column.prop,
|
||||
};
|
||||
this.queryParams = Object.assign(this.queryParams, sort);
|
||||
this.handleQuery();
|
||||
},
|
||||
// 执行状态字典翻译
|
||||
statusFormat(row, column) {
|
||||
return this.selectDictLabel(this.statusOptions, row.status);
|
||||
},
|
||||
/** 查询型号系列列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listModelSeries(this.queryParams).then(response => {
|
||||
this.modelSeriesList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
seriesId: null,
|
||||
seriesName: '',
|
||||
prodKey: '',
|
||||
deviceType: '',
|
||||
seriesStatus: "0",
|
||||
prodJson: '[]',
|
||||
paramJson: '[]'
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.seriesId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.form.prodJson = '';
|
||||
this.open = true;
|
||||
this.title = "添加型号系列";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const seriesId = row.seriesId || this.ids;
|
||||
const _this = this;
|
||||
getModelSeries(seriesId).then((response) => {
|
||||
_this.form = response.data;
|
||||
_this.open = true;
|
||||
_this.title = "修改型号系列";
|
||||
setTimeout(() => {
|
||||
_this.$refs.paramWrap.setList(JSON.parse(response.data.paramJson) || []);
|
||||
}, 100);
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
// if (this.form.protocolType === "OFFICIAL") {
|
||||
let attrList = [];
|
||||
if (
|
||||
this.$store.getters.attributeList &&
|
||||
this.$store.getters.attributeList.length > 0
|
||||
) {
|
||||
attrList = this.$store.getters.attributeList.map((v) => {
|
||||
v["sourceId"] = this.form.prodKey;
|
||||
return v;
|
||||
});
|
||||
}
|
||||
|
||||
let groupList = [];
|
||||
if (
|
||||
this.$store.getters.groupList &&
|
||||
this.$store.getters.groupList.length > 0
|
||||
) {
|
||||
groupList = this.$store.getters.groupList.map((v) => {
|
||||
v["sourceId"] = this.form.prodKey;
|
||||
return v;
|
||||
});
|
||||
}
|
||||
this.form.prodJson = JSON.stringify(attrList) || null;
|
||||
this.form.remark = JSON.stringify(groupList) || null;
|
||||
// }
|
||||
|
||||
try {
|
||||
this.form.paramJson = JSON.stringify(this.$refs.paramWrap.getResult());
|
||||
} catch (error) {
|
||||
this.form.paramJson = "";
|
||||
}
|
||||
|
||||
if (this.form.seriesId != null) {
|
||||
updateModelSeries(this.form).then((response) => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addModelSeries(this.form).then((response) => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const seriesIds = row.seriesId || this.ids;
|
||||
this.$confirm("是否删除该选项?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return delModelSeries(seriesIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return exportModelSeries(queryParams);
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.iot-model-series {
|
||||
.eldialog-wrap {
|
||||
.el-dialog__header {
|
||||
border-bottom: 1px solid #747373;
|
||||
}
|
||||
.el-dialog__body {
|
||||
padding: 0px;
|
||||
}
|
||||
.el-form {
|
||||
padding: 20px;
|
||||
padding-right: 40px;
|
||||
}
|
||||
.el-dialog__footer {
|
||||
height: 60px;
|
||||
border-top: 1px solid #747373;
|
||||
text-align: right;
|
||||
width: 100%;
|
||||
padding: 0px;
|
||||
padding-top: 15px;
|
||||
.el-button + .el-button {
|
||||
margin-right: 10px;
|
||||
}
|
||||
.el-button {
|
||||
padding-top: 8px;
|
||||
}
|
||||
}
|
||||
.form-params-wrap {
|
||||
height: 100%;
|
||||
width: calc(100% + 110px);
|
||||
position: relative;
|
||||
top: 15px;
|
||||
left: -90px;
|
||||
max-height: 250px;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
border: 1px solid #009688;
|
||||
border-radius: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.form-params-wrap::-webkit-scrollbar {
|
||||
/*滚动条整体样式*/
|
||||
width: 8px; /*高宽分别对应横竖滚动条的尺寸*/
|
||||
height: 5px;
|
||||
}
|
||||
.form-params-wrap::-webkit-scrollbar-thumb {
|
||||
/*滚动条里面小方块*/
|
||||
border-radius: 10px;
|
||||
box-shadow: inset 0 0 5px #c4c4c4;
|
||||
background: #dededea6;
|
||||
}
|
||||
.form-params-wrap::-webkit-scrollbar-track {
|
||||
/*滚动条里面轨道*/
|
||||
box-shadow: inset 0 0 5px #f6f6f6;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
}
|
||||
</style>
|
|
@ -5,6 +5,7 @@ import ESelect from './ESelect'
|
|||
import EDeviceParam from './EDeviceParam'
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
name: 'EExecuteAction',
|
||||
props: {
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-button v-if="!paramData || paramData.length <=0" @click="handleAdd">新增</el-button>
|
||||
<e-tag-card
|
||||
style="margin-top: 5px; padding: 15px;"
|
||||
v-for="(item) in paramData"
|
||||
:key="item.guid || getGuid()"
|
||||
type="info"
|
||||
>
|
||||
<div slot="body">
|
||||
<firmware-item
|
||||
:dataItem="item"
|
||||
:addDisabled="paramData.length >= modelList.length"
|
||||
:paramsList="paramData"
|
||||
:firmwareList="firmwareList"
|
||||
:modelList="modelList.filter(v => item[options['model_pk']] === v[options['model_pk']] || !paramData.map(param => param[options['model_pk']]).includes(v[options['model_pk']]))"
|
||||
:options="options"
|
||||
@add="handleAdd"
|
||||
@delete="handleDelete"
|
||||
/>
|
||||
</div>
|
||||
</e-tag-card>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import ETagCard from "@/components/Cards/ETagCard";
|
||||
import FirmwareItem from "./index"
|
||||
import { getModelListByGatewayDevId, getAtoListByModelProdKey } from "@/api/iot/model"
|
||||
import { getGuid } from "@/utils/hciot";
|
||||
|
||||
export default {
|
||||
name: 'EBatchFirmwareUpgrade',
|
||||
props: {
|
||||
sourceData: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
sourceId: {
|
||||
type: [String, Number]
|
||||
}
|
||||
},
|
||||
components: {
|
||||
ETagCard,
|
||||
FirmwareItem
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
modelList: [],
|
||||
paramData: [],
|
||||
firmwareList: [],
|
||||
options: {
|
||||
model_pk: 'prodKey',
|
||||
ota_pk: 'otaId',
|
||||
model_label: 'modelName',
|
||||
ota_label: 'otaVersion',
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.init()
|
||||
},
|
||||
watch: {
|
||||
sourceData: {
|
||||
handler(val) {
|
||||
if(val && val.length > 0) {
|
||||
this.paramData = this.sourceData;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getGuid,
|
||||
handleChange() {
|
||||
this.$forceUpdate();
|
||||
this.$emit('handleChange', this.paramData);
|
||||
},
|
||||
init() {
|
||||
this.getModelList()
|
||||
},
|
||||
getModelList() {
|
||||
if (!this.sourceId && this.sourceId !== 0) return;
|
||||
this.modelList = [];
|
||||
// 这里采用接口
|
||||
getModelListByGatewayDevId(this.sourceId).then(res => {
|
||||
console.log('result:', res.rows)
|
||||
this.modelList = [...res.rows]
|
||||
})
|
||||
},
|
||||
handleAdd() {
|
||||
let opt = {};
|
||||
Object.keys(this.options).forEach(v => {
|
||||
if (v.includes('_pk')) {
|
||||
opt[this.options[v]] = '';
|
||||
}
|
||||
})
|
||||
opt.guid = getGuid();
|
||||
this.paramData.push(opt);
|
||||
this.handleChange();
|
||||
},
|
||||
handleDelete(item) {
|
||||
if (!this.paramData || !item) return;
|
||||
this.paramData = this.paramData.filter(v => v.guid !== item.guid)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,7 @@
|
|||
import FirmwareItem from "./src/firmwareItem"
|
||||
|
||||
FirmwareItem.install = function install(Vue) {
|
||||
Vue.component(FirmwareItem.name, FirmwareItem);
|
||||
};
|
||||
|
||||
export default FirmwareItem
|
|
@ -0,0 +1,44 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-select v-model="value" size="mini" :width="pwidth" @change="handleChange" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="(item, idx) in sourceData"
|
||||
:key="idx"
|
||||
:label="item[options.label]"
|
||||
:value="item[options.value]"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'ESelect',
|
||||
props: {
|
||||
sourceData:{
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
pwidth: {
|
||||
type: String
|
||||
},
|
||||
value: {
|
||||
type: [String, Number]
|
||||
},
|
||||
options: {
|
||||
type: Object,
|
||||
default: {
|
||||
label: 'label',
|
||||
value: 'value',
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
methods: {
|
||||
handleChange(v) {
|
||||
this.$emit('change', v)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,134 @@
|
|||
|
||||
import ESelect from './ESelect'
|
||||
import "./index.css"
|
||||
|
||||
import { getAtoListByModelProdKey } from "@/api/iot/model"
|
||||
|
||||
export default {
|
||||
name: 'FirmwareItem',
|
||||
props: {
|
||||
addDisabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
dataItem: {
|
||||
type: Object
|
||||
},
|
||||
inputWidth: {
|
||||
type: String,
|
||||
default: '200'
|
||||
},
|
||||
modelList: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
options:{
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
model_pk: 'prodKey',
|
||||
ota_pk: 'otaId',
|
||||
model_label: 'modelName',
|
||||
ota_label: 'otaVersion',
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
firmwareList: []
|
||||
}
|
||||
},
|
||||
|
||||
components: {
|
||||
ESelect
|
||||
},
|
||||
|
||||
methods: {
|
||||
methodChange(val) {
|
||||
this.dataItem[this.options.model_pk] = val;
|
||||
this.dataItem[this.options.ota_pk] = '';
|
||||
this.getFirmwareListFn();
|
||||
this.handlePinChange()
|
||||
},
|
||||
getFirmwareListFn() {
|
||||
getAtoListByModelProdKey({prodKey: this.dataItem[this.options.model_pk]}).then(res => {
|
||||
this.firmwareList = res.rows;
|
||||
if (this.firmwareList && this.firmwareList.length > 0) {
|
||||
this.dataItem[this.options.ota_pk] = this.firmwareList[0][this.options.ota_pk];
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
firmwareChange(value) {
|
||||
this.dataItem[this.options.ota_pk] = value;
|
||||
this.handlePinChange()
|
||||
},
|
||||
handlePinChange() {
|
||||
this.$forceUpdate();
|
||||
this.$emit('change', this.dataItem);
|
||||
},
|
||||
handleDelTrigger() {
|
||||
this.$emit('delete', this.dataItem)
|
||||
},
|
||||
handleAddItme() {
|
||||
this.$emit('add')
|
||||
},
|
||||
},
|
||||
|
||||
render() {
|
||||
const { dataItem, inputWidth, modelList, firmwareList, options, addDisabled } = this;
|
||||
|
||||
return (
|
||||
<div class="e-batch-firmware-upgrade">
|
||||
|
||||
{ dataItem && <div class="e-trigger-block">
|
||||
<span>选择模型:</span>
|
||||
<e-select
|
||||
style="margin-right: 10px;"
|
||||
value={dataItem[options.model_pk]}
|
||||
onChange={this.methodChange}
|
||||
pwidth={inputWidth}
|
||||
sourceData={modelList}
|
||||
options={{
|
||||
label: options.model_label,
|
||||
value: options.model_pk
|
||||
}}
|
||||
>
|
||||
</e-select>
|
||||
|
||||
<span>选择固件:</span>
|
||||
|
||||
<div class={!dataItem[options.ota_pk] ? 'ato-div ato-div-error' : 'ato-div'}>
|
||||
<e-select
|
||||
style="margin-right: 10px;"
|
||||
value={dataItem[options.ota_pk]}
|
||||
onChange={this.firmwareChange}
|
||||
pwidth={inputWidth}
|
||||
sourceData={firmwareList}
|
||||
options={{
|
||||
label: options.ota_label,
|
||||
value: options.ota_pk
|
||||
}}
|
||||
>
|
||||
</e-select>
|
||||
|
||||
{
|
||||
!dataItem[options.ota_pk] &&
|
||||
<span class="e-form-item__error">* 未选择固件版本...</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
<el-button type="text" class="e-button-del" onClick={this.handleDelTrigger}>刪除</el-button>
|
||||
|
||||
{ !addDisabled && <el-button type="text" class="e-button-pro" onClick={this.handleAddItme}>新增</el-button> }
|
||||
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
|
||||
.e-batch-firmware-upgrade .e-trigger-block {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
flex-wrap: nowrap;
|
||||
& > span {
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.ato-div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.ato-div-error {
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
.e-form-item__error {
|
||||
color: #ff4949;
|
||||
font-size: 12px;
|
||||
}
|
||||
.e-button-del {
|
||||
color: #ff4949;
|
||||
font-size: 12px;
|
||||
margin-left: 20px;
|
||||
padding: 5px;
|
||||
}
|
||||
.e-button-del:hover {
|
||||
background: #ff4949;
|
||||
padding: 5px;
|
||||
color: #fff;
|
||||
}
|
||||
.e-button-pro {
|
||||
color: #46a6ff;
|
||||
font-size: 12px;
|
||||
margin-left: 20px;
|
||||
padding: 5px;
|
||||
}
|
||||
.e-button-pro:hover {
|
||||
background: #2196F3;
|
||||
padding: 5px;
|
||||
color: #fff;
|
||||
|
||||
}
|
|
@ -8,10 +8,11 @@
|
|||
:wsDeviceInfo="infoData"
|
||||
@changeEvent="viewDeviceChange($event)"
|
||||
></device-select>
|
||||
<div class="link-to-list">
|
||||
<el-button icon="el-icon-d-arrow-left" title="返回列表" @click="toTableClick" circle
|
||||
<div :class="infoData.deviceType === 'GATEWAY_CONTROLLER' ? 'link-to-list is-widening': 'link-to-list'">
|
||||
<el-button icon="el-icon-d-arrow-left" style="margin-left: 10px;" title="返回列表" @click="toTableClick" circle
|
||||
>返回列表</el-button
|
||||
>
|
||||
<el-button v-if="infoData.deviceType === 'GATEWAY_CONTROLLER'" @click="batchUpgradeOpen" title="批量升级" circle>批量升级</el-button>
|
||||
</div>
|
||||
<div class="info-tabs-circuit">
|
||||
<div class="breadcrumb-wrap" v-show="breadcrumbList.length > 1">
|
||||
|
@ -107,6 +108,31 @@
|
|||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<!-- 添加或修改建筑类型对话框 -->
|
||||
<dialog-template
|
||||
:title="dialogTitle"
|
||||
:visible="dialogOpen"
|
||||
width="880px"
|
||||
@close="dialogOpen = false"
|
||||
>
|
||||
<e-batch-firmware-upgrade
|
||||
slot="dialog-center"
|
||||
:sourceId="this.pInfo.deviceId"
|
||||
:sourceData="this.form.data"
|
||||
@handleChange="handleFirmwareChange"
|
||||
></e-batch-firmware-upgrade>
|
||||
|
||||
<div slot="dialog-footer" class="dialog-footer">
|
||||
<el-button type="primary" size="mini" @click="submitForm"
|
||||
>确 定</el-button
|
||||
>
|
||||
<el-button @click="() => {dialogOpen = false}" size="mini">取 消</el-button>
|
||||
</div>
|
||||
|
||||
</dialog-template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -119,6 +145,9 @@ import DeviceSelect from "./deviceSelectNav";
|
|||
import ModelOat from "./modelOat";
|
||||
import ChildDevice from "./childDevice";
|
||||
import EDeviceScene from '@/views/profile/EDeviceScene/indexView'
|
||||
import DialogTemplate from "@/components/DialogTemplate";
|
||||
import EBatchFirmwareUpgrade from '@/views/profile/BatchFirmwareUpgrade/example'
|
||||
import { upgradeBatch } from '@/api/iot/deviceOta'
|
||||
export default {
|
||||
name: "DetailsWrap",
|
||||
props: ["sourceId", "isTenant", 'isPersonal'],
|
||||
|
@ -130,7 +159,9 @@ export default {
|
|||
DeviceSelect,
|
||||
ModelOat,
|
||||
ChildDevice,
|
||||
EDeviceScene
|
||||
EDeviceScene,
|
||||
DialogTemplate,
|
||||
EBatchFirmwareUpgrade
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -144,6 +175,12 @@ export default {
|
|||
realTimeData: null,
|
||||
hzSelectList: [],
|
||||
userTenantId: "",
|
||||
dialogTitle: '',
|
||||
dialogOpen: false,
|
||||
form: {
|
||||
deviceId: '',
|
||||
data: []
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
@ -196,6 +233,37 @@ export default {
|
|||
data.deviceId === this.pInfo.deviceId ? null : "children"
|
||||
);
|
||||
},
|
||||
batchUpgradeOpen() {
|
||||
this.dialogTitle = '网关批量固件升级';
|
||||
this.dialogOpen = true;
|
||||
this.form = {
|
||||
deviceId: this.pInfo.deviceId,
|
||||
data: []
|
||||
}
|
||||
},
|
||||
handleFirmwareChange(ev) {
|
||||
this.form.data = ev
|
||||
},
|
||||
submitForm() {
|
||||
|
||||
if(!this.form.data || (this.form.data && this.form.data.filter(v => !v.otaId || !v.prodKey).length > 0)) {
|
||||
this.$message({
|
||||
message: '未选择型号或固件',
|
||||
type: 'error'
|
||||
});
|
||||
return
|
||||
}
|
||||
|
||||
upgradeBatch(this.form).then(res => {
|
||||
if (!res.code) return;
|
||||
|
||||
this.$message({
|
||||
message: '升级固件已经提交,固件正在升级中(过程中有可能由 异常 等问题导致升级不成功!)',
|
||||
type: 'success'
|
||||
});
|
||||
this.dialogOpen = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -340,6 +408,7 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.link-to-list {
|
||||
display: flex;
|
||||
color: #656363;
|
||||
|
@ -349,10 +418,13 @@ export default {
|
|||
display: flex;
|
||||
position: relative;
|
||||
top: 10px;
|
||||
width: 100px;
|
||||
z-index: 100;
|
||||
left: calc(100% - 110px);
|
||||
width: 120px;
|
||||
left: calc(100% - 120px);
|
||||
cursor: default;
|
||||
justify-content: flex-start;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row-reverse;
|
||||
.el-button--medium.is-circle {
|
||||
width: 25px;
|
||||
height: 20px;
|
||||
|
@ -371,6 +443,11 @@ export default {
|
|||
font-size: 30px;
|
||||
}
|
||||
|
||||
.is-widening {
|
||||
width: 220px;
|
||||
left: calc(100% - 220px);
|
||||
}
|
||||
|
||||
.info-tabs-circuit {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
|
|
|
@ -342,7 +342,19 @@ export default {
|
|||
this.loading = true
|
||||
this.functionList = []
|
||||
setTimeout(() => {
|
||||
this.functionList = this.$store.getters.attributeList
|
||||
this.$store.dispatch("GetAttributeList").then((res) => {
|
||||
console.log('666', res)
|
||||
this.functionList = res
|
||||
this.$forceUpdate()
|
||||
this.loading = false
|
||||
});
|
||||
}, 50)
|
||||
},
|
||||
setList(list) {
|
||||
this.loading = true
|
||||
this.functionList = []
|
||||
setTimeout(() => {
|
||||
this.functionList = list
|
||||
this.$forceUpdate()
|
||||
this.loading = false
|
||||
}, 50)
|
||||
|
|
|
@ -210,7 +210,20 @@ export default {
|
|||
this.loading = true
|
||||
this.cmdList = []
|
||||
setTimeout(() => {
|
||||
this.cmdList = this.$store.getters.groupList
|
||||
this.$store.dispatch("GetGroupList").then((res) => {
|
||||
this.cmdList = res
|
||||
this.$forceUpdate()
|
||||
this.loading = false
|
||||
});
|
||||
}, 50)
|
||||
|
||||
},
|
||||
/** 查询分组集列表 */
|
||||
setList(list) {
|
||||
this.loading = true
|
||||
this.cmdList = []
|
||||
setTimeout(() => {
|
||||
this.cmdList = list
|
||||
this.$forceUpdate()
|
||||
this.loading = false
|
||||
}, 50)
|
||||
|
|
|
@ -119,20 +119,49 @@ export default {
|
|||
},
|
||||
forceUpdate(component) {
|
||||
if (component === "groupForm") {
|
||||
this.$refs.groupref.getList();
|
||||
this.$refs.groupref && this.$refs.groupref.getList();
|
||||
} else if (component === "attributeForm") {
|
||||
this.$refs.attributeref.getList();
|
||||
this.$refs.attributeref && this.$refs.attributeref.getList();
|
||||
}
|
||||
},
|
||||
forceUpdateList(component) {
|
||||
let arttributeList = [],
|
||||
groupList = [];
|
||||
|
||||
try {
|
||||
arttributeList = JSON.parse(this.arttributeList);
|
||||
groupList = JSON.parse(this.groupList);
|
||||
} catch (error) {
|
||||
arttributeList = [],
|
||||
groupList = [];
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
if (component === "groupForm") {
|
||||
this.$refs.groupref && this.$refs.groupref.setList(groupList);
|
||||
} else if (component === "attributeForm") {
|
||||
this.$refs.attributeref && this.$refs.attributeref.setList(arttributeList);
|
||||
}
|
||||
},
|
||||
handleInitData() {
|
||||
let arttributeList = [],
|
||||
groupList = [];
|
||||
|
||||
try {
|
||||
this.$store.dispatch("InitAttributeAndGroup", {
|
||||
attrList: JSON.parse(this.arttributeList),
|
||||
groupList: JSON.parse(this.groupList),
|
||||
});
|
||||
arttributeList = JSON.parse(this.arttributeList);
|
||||
groupList = JSON.parse(this.groupList);
|
||||
} catch (error) {
|
||||
arttributeList = [],
|
||||
groupList = [];
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
console.log(arttributeList, groupList)
|
||||
|
||||
this.$store.dispatch("InitAttributeAndGroup", {
|
||||
attrList: arttributeList,
|
||||
groupList: groupList,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue