提交: 优化部分问题 小结

This commit is contained in:
23688nl 2022-05-24 16:16:27 +08:00
parent 9da5ab9fce
commit c4046f6aa0
9 changed files with 405 additions and 155 deletions

View File

@ -151,3 +151,12 @@ export function disassociateChild(data) {
data: data
});
}
// 查询 子设备列表
export function listChildrenDevice(query) {
return request({
url: "iot/device/listWithoutScope",
method: "get",
params: query
});
}

View File

@ -1,6 +1,11 @@
<template>
<div class="app-container iot-device">
<component :is="componectVal" :sourceId="sourceId" :isTenant="false"></component>
<component
:is="componectVal"
:sourceId="sourceId"
:isTenant="false"
@toTableClick="toTableClick"
></component>
<div v-show="componectVal === ''">
<el-form
:model="queryParams"
@ -72,8 +77,16 @@
</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-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>
@ -86,7 +99,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['iot:device:add']"
>新增</el-button>
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -95,15 +109,19 @@
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
>导出</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="deviceList"
:default-sort="{prop: 'createTime', order: 'descending'}"
:default-sort="{ prop: 'createTime', order: 'descending' }"
@sort-change="sortChange"
>
<el-table-column
@ -116,14 +134,36 @@
<el-table-column label="设备名称" align="left" prop="deviceName" />
<el-table-column label="所属型号" align="left" prop="modelName" />
<el-table-column label="设备key" align="left" prop="deviceKey" />
<el-table-column label="设备类型" align="left" width="120px" prop="deviceTypeName" />
<el-table-column
label="设备类型"
align="left"
width="120px"
prop="deviceTypeName"
/>
<!-- <el-table-column label="父设备" align="left" prop="parentName" /> -->
<el-table-column label="设备状态" align="center" width="120" prop="deviceState">
<el-table-column
label="设备状态"
align="center"
width="120"
prop="deviceState"
>
<template slot-scope="scope">
<el-tag type="success" v-if="scope.row.deviceState === 'ONLINE'">在线</el-tag>
<el-tag type="danger" v-else-if="scope.row.deviceState === 'OFFLINE'">离线</el-tag>
<el-tag type="danger" v-else-if="scope.row.deviceState === 'OUTLINE'">脱线</el-tag>
<el-tag type="info" v-else-if="scope.row.deviceState === 'UNACTIVE'">未激活</el-tag>
<el-tag type="success" v-if="scope.row.deviceState === 'ONLINE'"
>在线</el-tag
>
<el-tag
type="danger"
v-else-if="scope.row.deviceState === 'OFFLINE'"
>离线</el-tag
>
<el-tag
type="danger"
v-else-if="scope.row.deviceState === 'OUTLINE'"
>脱线</el-tag
>
<el-tag type="info" v-else-if="scope.row.deviceState === 'UNACTIVE'"
>未激活</el-tag
>
</template>
</el-table-column>
<el-table-column
@ -152,21 +192,35 @@
type="text"
icon="el-icon-search"
@click="handleDetails(scope.row)"
>详情</el-button>
>详情</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['iot:device:edit']"
>修改</el-button>
>修改</el-button
>
<el-button
v-if="scope.row['parentId'] && scope.row['parentId'] !== '0'"
size="mini"
type="text"
icon="el-icon-error"
@click="handleDisassociate(scope.row)"
v-hasPermi="['iot:device:edit']"
>解绑</el-button
>
<el-button
v-else
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['iot:device:remove']"
>删除</el-button>
>删除</el-button
>
</template>
</el-table-column>
</el-table>
@ -201,7 +255,7 @@
<el-select
disabled
v-model="form.deviceType"
style="width: 100%;"
style="width: 100%"
placeholder="请选择设备类型"
clearable
>
@ -214,7 +268,11 @@
</el-select>
</el-form-item>
<el-form-item label="父设备:" prop="parentId" v-if="form.deviceType === 'MINIATURE_BREAKER'">
<el-form-item
label="父设备:"
prop="parentId"
v-if="form.deviceType === 'MINIATURE_BREAKER'"
>
<el-input
v-model="form.parentName"
placeholder="点击选择父设备"
@ -222,9 +280,23 @@
/>
</el-form-item>
<el-form-item label="线路类型:" prop="lineType" v-if="form.deviceType === 'MINIATURE_BREAKER'">
<el-select v-model="form.lineType" style="width: 100%;" placeholder="请选择线路类型" clearable>
<el-option :label="keys" :value="vals" v-for="(keys, vals) in lineTypeOpt" :key="vals" />
<el-form-item
label="线路类型:"
prop="lineType"
v-if="form.deviceType === 'MINIATURE_BREAKER'"
>
<el-select
v-model="form.lineType"
style="width: 100%"
placeholder="请选择线路类型"
clearable
>
<el-option
:label="keys"
:value="vals"
v-for="(keys, vals) in lineTypeOpt"
:key="vals"
/>
</el-select>
</el-form-item>
@ -233,18 +305,26 @@
</el-form-item>
<el-form-item label="设备KEY" prop="deviceKey">
<el-input v-model="form.deviceKey" :disabled="form.deviceId" placeholder="请输入设备KEY" />
<el-input
v-model="form.deviceKey"
:disabled="form.deviceId"
placeholder="请输入设备KEY"
/>
</el-form-item>
<el-form-item label="参数设置:">
<span style="color: red; font-size: 12px;">*注意锁定即参数不可修改未锁则可以修改</span>
<span style="color: red; font-size: 12px"
>*注意锁定即参数不可修改未锁则可以修改</span
>
<div class="form-params-wrap">
<param-wrap ref="paramWrap" typeKeys v-if="open"></param-wrap>
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="mini" type="primary" @click="submitForm"> </el-button>
<el-button size="mini" type="primary" @click="submitForm"
> </el-button
>
<el-button size="mini" @click="cancel"> </el-button>
</div>
</el-dialog>
@ -268,13 +348,33 @@
/>
<div slot="footer" class="dialog-footer">
<el-button size="mini" type="primary" @click="resuleClick"> </el-button>
<el-button size="mini" @click="() =>{selectTableShow = false}"> </el-button>
<el-button size="mini" type="primary" @click="resuleClick"
> </el-button
>
<el-button
size="mini"
@click="
() => {
selectTableShow = false;
}
"
> </el-button
>
</div>
</el-dialog>
<div :class="componectVal === 'GatewayDetail'? 'to-home-wrap2 gateway-wrap': 'to-home-wrap2 '" @click="toTableClick" v-show="componectVal !== ''">
<el-button icon="el-icon-d-arrow-left" title="返回列表" circle>返回列表</el-button>
<div
:class="
componectVal === 'GatewayDetail'
? 'to-home-wrap2 gateway-wrap'
: 'to-home-wrap2 '
"
@click="toTableClick"
v-show="componectVal !== ''"
>
<el-button icon="el-icon-d-arrow-left" title="返回列表" circle
>返回列表</el-button
>
</div>
</div>
</template>
@ -287,23 +387,23 @@ import {
addDevice,
updateDevice,
exportDevice,
listDeviceTypeList
listDeviceTypeList,
disassociateChild,
} from "@/api/iot/device";
import { listModel, getModel } from "@/api/iot/model";
import SelectTableWrap from "@/components/SelectTable/index";
import DetailsWrap from "./profile/details";
import ParamWrap from "@/components/ParamWrap/deviceParam";
import GatewayDetail from '@/views/profile/DeviceDetailsView/index'
import axios from "axios";
import GatewayDetail from "@/views/profile/DeviceDetailsView/index";
const deviceStatusOpt = {
ONLINE: "在线",
OFFLINE: "离线",
OUTLINE: "脱线",
UNACTIVE: "未激活"
UNACTIVE: "未激活",
};
const lineTypeOpt = {
MAIN: "总路",
BRANCH: "支路"
BRANCH: "支路",
};
export default {
@ -312,7 +412,7 @@ export default {
SelectTableWrap,
DetailsWrap,
ParamWrap,
GatewayDetail
GatewayDetail,
},
data() {
return {
@ -353,47 +453,46 @@ export default {
deviceType: null,
modelName: null,
orderByColumn: "createTime",
isAsc: "desc"
isAsc: "desc",
},
//
form: {},
//
rules: {
modelId: [
{ required: true, message: "所属型号不能为空", trigger: "change" }
{ required: true, message: "所属型号不能为空", trigger: "change" },
],
deviceType: [
{ required: true, message: "设备类型不能为空", trigger: "blur" }
{ required: true, message: "设备类型不能为空", trigger: "blur" },
],
parentId: [
{ required: false, message: "父设备不能为空", trigger: "change" }
{ required: false, message: "父设备不能为空", trigger: "change" },
],
deviceName: [
{ required: true, message: "设备名称不能为空", trigger: "blur" }
{ required: true, message: "设备名称不能为空", trigger: "blur" },
],
lineType: [
{ required: false, message: "线路类型不能为空", trigger: "blur" }
{ required: false, message: "线路类型不能为空", trigger: "blur" },
],
deviceKey: [
{
required: true,
validator: this.chenking_deviceKey,
trigger: "blur"
}
]
trigger: "blur",
},
deviceTypeList: {}
],
},
deviceTypeList: {},
};
},
created() {
console.log(this.$route)
this.init()
console.log(this.$route);
this.init();
},
methods: {
init() {
if (this.$route.query['deviceId']) {
this.handleDetails(this.$route.query)
if (this.$route.query["deviceId"]) {
this.handleDetails(this.$route.query);
}
this.getDeviceTypeList();
this.initGetModelList();
@ -402,7 +501,7 @@ export default {
sortChange(column) {
const sort = {
isAsc: column.order === "descending" ? "desc" : "asc",
orderByColumn: column.prop
orderByColumn: column.prop,
};
this.queryParams = Object.assign(this.queryParams, sort);
this.handleQuery();
@ -414,12 +513,15 @@ export default {
},
handleDetails(row) {
this.sourceId = row.deviceId;
this.componectVal = row.deviceType === 'GATEWAY_CONTROLLER'? 'GatewayDetail' : "DetailsWrap";
this.componectVal =
row.deviceType === "GATEWAY_CONTROLLER"
? "GatewayDetail"
: "DetailsWrap";
},
//
toTableClick() {
if (this.$route.query['deviceId']) {
this.$router.push('/device/device')
if (this.$route.query["deviceId"]) {
this.$router.push("/device/device");
}
this.componectVal = "";
},
@ -428,19 +530,19 @@ export default {
this.selectResult = {};
this.tableSelectOption = {
otherOption: {
tableType: "model"
tableType: "model",
},
queryOpt: {
disable: false,
labelWidth: "68px",
params: {
protocolType: "",
modelName: ""
modelName: "",
},
page: {
pageSize: 10,
pageNum: 1,
total: 0
total: 0,
},
inline: true,
queryChilds: [
@ -452,7 +554,7 @@ export default {
type: "input",
key: "modelName",
size: "small",
value: ""
value: "",
},
{
style: "",
@ -477,16 +579,16 @@ export default {
{
key: "OFFICIAL",
label: "官方平台",
value: "OFFICIAL"
}
value: "OFFICIAL",
},
],
optionKey: {
key: "key",
label: "label",
value: "value"
}
}
]
value: "value",
},
},
],
},
tableOpt: {
loading: false,
@ -502,7 +604,7 @@ export default {
align: "left",
width: "200",
"show-overflow-tooltip": false,
tempType: "span"
tempType: "span",
},
{
style: "",
@ -512,7 +614,7 @@ export default {
align: "left",
width: "200",
"show-overflow-tooltip": false,
tempType: "span"
tempType: "span",
},
{
style: "",
@ -522,7 +624,7 @@ export default {
align: "left",
width: "120",
"show-overflow-tooltip": false,
tempType: "span"
tempType: "span",
},
{
style: "",
@ -532,7 +634,7 @@ export default {
align: "left",
width: "",
"show-overflow-tooltip": false,
tempType: "span"
tempType: "span",
},
{
style: "",
@ -542,14 +644,14 @@ export default {
align: "left",
width: "",
"show-overflow-tooltip": false,
tempType: "span"
}
tempType: "span",
},
],
tableList: {
type: Array
}
type: Array,
},
tableList: []
},
tableList: [],
};
this.selectTableShow = true;
},
@ -558,7 +660,7 @@ export default {
this.selectResult = {};
this.tableSelectOption = {
otherOption: {
tableType: "device"
tableType: "device",
},
queryOpt: {
disable: false,
@ -571,7 +673,7 @@ export default {
page: {
pageSize: 10,
pageNum: 1,
total: 0
total: 0,
},
inline: true,
queryChilds: [
@ -583,9 +685,9 @@ export default {
type: "input",
key: "deviceName",
size: "small",
value: ""
}
]
value: "",
},
],
},
tableOpt: {
loading: false,
@ -601,7 +703,7 @@ export default {
align: "left",
width: "",
"show-overflow-tooltip": false,
tempType: "span"
tempType: "span",
},
{
style: "",
@ -611,7 +713,7 @@ export default {
align: "left",
width: "",
"show-overflow-tooltip": false,
tempType: "span"
tempType: "span",
},
{
style: "",
@ -621,7 +723,7 @@ export default {
align: "left",
width: "",
"show-overflow-tooltip": false,
tempType: "span"
tempType: "span",
},
{
style: "",
@ -631,14 +733,14 @@ export default {
align: "center",
width: "160",
"show-overflow-tooltip": false,
tempType: "span"
}
tempType: "span",
},
],
tableList: {
type: Array
}
type: Array,
},
tableList: []
},
tableList: [],
};
this.selectTableShow = true;
},
@ -653,14 +755,14 @@ export default {
initGetModelList() {
listModel({
pageNum: 1,
pageSize: 99999
}).then(response => {
pageSize: 99999,
}).then((response) => {
this.queryModelOpt = response.rows;
});
},
modelChildList(data) {
listModel(Object.assign(data.page, data.param, { selected: 1 })).then(
response => {
(response) => {
this.tableSelectOption.tableList = response.rows;
this.tableSelectOption.queryOpt.page.total = Number(response.total);
}
@ -668,7 +770,7 @@ export default {
},
deviceChildList(data) {
listDevice(Object.assign(data.page, data.param, { selected: 1 })).then(
response => {
(response) => {
this.tableSelectOption.tableList = response.rows;
this.tableSelectOption.queryOpt.page.total = Number(response.total);
}
@ -676,7 +778,7 @@ export default {
},
// id
getModelInfoById(modelId) {
getModel(modelId).then(res => {
getModel(modelId).then((res) => {
this.$refs.paramWrap.setList(res.data.paramList || []);
});
},
@ -737,14 +839,14 @@ export default {
},
//
getDeviceTypeList() {
listDeviceTypeList().then(response => {
listDeviceTypeList().then((response) => {
this.deviceTypeList = response.data;
});
},
/** 查询设备列表 */
getList() {
this.loading = true;
listDevice(this.queryParams).then(response => {
listDevice(this.queryParams).then((response) => {
this.deviceList = response.rows;
this.total = response.total;
this.loading = false;
@ -766,7 +868,7 @@ export default {
deviceType: null,
paramList: [],
deviceKey: "",
lineType: undefined
lineType: undefined,
};
this.resetForm("form");
},
@ -791,7 +893,7 @@ export default {
this.reset();
const deviceId = row.deviceId || this.ids;
const _this = this;
getDevice(deviceId).then(response => {
getDevice(deviceId).then((response) => {
_this.form = response.data;
_this.open = true;
_this.title = "修改设备";
@ -802,7 +904,7 @@ export default {
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (valid) {
this.form.paramList = this.$refs.paramWrap.getResult();
this.form.lineType =
@ -810,13 +912,13 @@ export default {
? this.form.lineType
: undefined;
if (this.form.deviceId != null) {
updateDevice(this.form).then(response => {
updateDevice(this.form).then((response) => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDevice(this.form).then(response => {
addDevice(this.form).then((response) => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
@ -825,15 +927,35 @@ export default {
}
});
},
/** 取消关联 */
handleDisassociate(row) {
this.$confirm("是否确认取消父子设备关联?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return disassociateChild({ childIds: [row.deviceId] });
})
.then(() => {
this.getList();
this.msgSuccess("取消成功");
});
},
/** 删除按钮操作 */
handleDelete(row) {
const deviceIds = row.deviceId || this.ids;
this.$confirm("删除设备将会删除设备相关数据,请谨慎操作,是否继续?", "警告", {
this.$confirm(
"删除设备将会删除设备相关数据,请谨慎操作,是否继续?",
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(function() {
type: "warning",
}
)
.then(function () {
return delDevice(deviceIds);
})
.then(() => {
@ -847,12 +969,12 @@ export default {
this.$confirm("是否确认导出所有设备数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
type: "warning",
})
.then(function() {
.then(function () {
return exportDevice(queryParams);
})
.then(response => {
.then((response) => {
this.download(response.msg);
});
},
@ -863,8 +985,8 @@ export default {
} else {
callback();
}
}
}
},
},
};
</script>
@ -940,6 +1062,7 @@ export default {
}
.gateway-wrap {
top: 220px;
display: none;
}
}
.form-params-wrap::-webkit-scrollbar {

View File

@ -115,6 +115,10 @@
</div>
<div class="table-row">
<div class="table-row-col">
<div class="title">父设备</div>
<div class="content">{{infoData.parentName || '--'}}</div>
</div>
<div class="table-row-col">
<div class="title">设备类型</div>
<div class="content">{{infoData.deviceTypeName}}</div>
@ -126,15 +130,15 @@
<div class="content" v-else-if="infoData.deviceState === 'OUTLINE'">脱线</div>
<div class="content" v-else-if="infoData.deviceState === 'UNACTIVE'">未激活</div>
</div>
</div>
<div class="table-row">
<div class="table-row-col">
<div class="title">创建时间</div>
<div class="content">{{infoData.createTime || '--'}}</div>
</div>
</div>
<div class="table-row">
<div class="table-row-col" style="flex: 3 1 0%;">
<div class="table-row-col" style="flex: 2 1 0%;">
<div class="title">设备图片</div>
<div class="content">--</div>
</div>

View File

@ -235,12 +235,40 @@
<el-input v-model="form.otaVersion" placeholder="请输入固件版本" />
</el-form-item>
<el-form-item label="升级地址:" prop="otaUrl">
<el-input v-model="form.otaUrl" placeholder="请输入固件升级地址" />
<el-form-item label="升级地址:" prop="otaUrl" v-if="form.otaId">
<el-input
v-model="form.otaUrl"
disabled
placeholder="请输入固件升级地址"
/>
</el-form-item>
<el-form-item label="文件地址:" prop="txtUrl">
<el-tabs v-model="isFileUpload">
<el-upload
ref="upload"
:show-file-list="false"
:http-request="uploud"
action
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
将文件拖到此处
<em>点击上传</em>
</div>
</el-upload>
<span
style="
display: block;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
"
:title="form.txtUrl"
v-if="form.txtUrl"
v-text="form.txtUrl"
></span>
<!-- <el-tabs v-model="isFileUpload">
<el-tab-pane label="文本输入" name="input">
<el-input
v-show="isFileUpload === 'input'"
@ -261,16 +289,17 @@
将文件拖到此处
<em>点击上传</em>
</div>
<!-- <div class="el-upload__tip" slot="tip">
只能上传jpg/png文件且不超过500kb
</div> -->
</el-upload>
</el-tab-pane>
</el-tabs>
</el-tabs> -->
</el-form-item>
<el-form-item label="固件大小:" prop="otaSize">
<el-input v-model="form.otaSize" placeholder="请输入固件大小" />
<el-input
v-model="form.otaSize"
disabled
placeholder="请输入固件大小"
/>
</el-form-item>
<el-form-item label="升级信息:" prop="otaInfo">
@ -400,7 +429,7 @@ export default {
{ required: true, message: "版本不能为空", trigger: "blur" },
],
otaUrl: [
{ required: true, message: " 升级地址不能为空", trigger: "blur" },
{ required: false, message: " 升级地址不能为空", trigger: "blur" },
],
txtUrl: [
{ required: true, message: " 文件地址不能为空", trigger: "blur" },

View File

@ -48,8 +48,8 @@
:default-sort="{ prop: 'timestamp', order: 'descending' }"
@sort-change="sortChange">
<el-table-column type="index" label="序号" align="center" :index="indexFormatter" width="80px"/>
<el-table-column label="设备名称" align="left" prop="deviceName"/>
<el-table-column label="用户账号" align="left" prop="userName"/>
<el-table-column label="设备名称" align="left" width="200px" prop="deviceName"/>
<el-table-column label="用户账号" align="left" width="200px" prop="userName"/>
<el-table-column label="报文" align="left" prop="logData">
<template v-slot="scope">
<span class="column-part-hide">{{ scope.row.logData }}</span>

View File

@ -225,7 +225,7 @@
</template>
<script>
import { listDevice, setSwitchControl } from "@/api/iot/device";
import { listChildrenDevice, setSwitchControl } from "@/api/iot/device";
import { iotWebSocketBaseUrl, devLiveWebSocketBaseUrl } from "@/config/env";
import SignalIntensity from "./signalIntensity";
export default {
@ -515,8 +515,10 @@ export default {
},
/** 查询设备列表 */
getList() {
listDevice({
listChildrenDevice({
parentId: this.deviceInfo.deviceId,
pageNum: 1,
pageSize: 999999
}).then((response) => {
this.childDeviceList = response.rows;
});
@ -557,6 +559,7 @@ export default {
width: 100%;
display: flex;
height: 130px;
overflow: auto;
}
.nav-p-dev {
@ -656,18 +659,18 @@ export default {
}
}
}
.device-select-nav::-webkit-scrollbar {
.layout-device-list::-webkit-scrollbar {
/*滚动条整体样式*/
width: 8px; /*高宽分别对应横竖滚动条的尺寸*/
height: 5px;
}
.device-select-nav::-webkit-scrollbar-thumb {
.layout-device-list::-webkit-scrollbar-thumb {
/*滚动条里面小方块*/
border-radius: 10px;
// box-shadow: inset 0 0 5px #c4c4c4;
background: #929292a6;
}
.device-select-nav::-webkit-scrollbar-track {
.layout-device-list::-webkit-scrollbar-track {
/*滚动条里面轨道*/
// -webkit-box-shadow:
box-shadow: inset 0 0 5px #f6f6f6;

View File

@ -1,11 +1,34 @@
<template>
<div class="iot-circuit-breaker-details-warp">
<device-select ref="deviceSelect" @wsRealTImeMsg="wsRealTImeMsg($event)" v-if="pInfo" :deviceInfo="pInfo" :wsDeviceInfo="infoData" @changeEvent="viewDeviceChange($event)"></device-select>
<device-select
ref="deviceSelect"
@wsRealTImeMsg="wsRealTImeMsg($event)"
v-if="pInfo"
:deviceInfo="pInfo"
:wsDeviceInfo="infoData"
@changeEvent="viewDeviceChange($event)"
></device-select>
<div class="link-to-list">
<el-button icon="el-icon-d-arrow-left" title="返回列表" @click="toTableClick" circle
>返回列表</el-button
>
</div>
<div class="info-tabs-circuit">
<div class="breadcrumb-wrap" v-show="breadcrumbList.length > 1">
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item v-for="(item, index) in breadcrumbList" :key="index">
<span @click="deviceClick(item, index)" :class="item.deviceId === deviceId ? 'breadcrumb-span show-wrap' : 'breadcrumb-span'">{{item.deviceName}}</span>
<el-breadcrumb-item
v-for="(item, index) in breadcrumbList"
:key="index"
>
<span
@click="deviceClick(item, index)"
:class="
item.deviceId === deviceId
? 'breadcrumb-span show-wrap'
: 'breadcrumb-span'
"
>{{ item.deviceName }}</span
>
</el-breadcrumb-item>
</el-breadcrumb>
</div>
@ -26,10 +49,18 @@
<el-tab-pane label="设备信息" name="info">
<div class="tabs-body">
<info-wrap :infoData="infoData" :isTenant="isTenant" @updateInfo="updateInfo($event)" />
<info-wrap
:infoData="infoData"
:isTenant="isTenant"
@updateInfo="updateInfo($event)"
/>
</div>
</el-tab-pane>
<el-tab-pane label="子设备" name="child" v-if="infoData.deviceType === 'GATEWAY_CONTROLLER' && !isTenant">
<el-tab-pane
label="子设备"
name="child"
v-if="infoData.deviceType === 'GATEWAY_CONTROLLER' && !isTenant"
>
<div class="tabs-body">
<child-device
v-if="activeName === 'child'"
@ -42,12 +73,20 @@
</el-tab-pane>
<el-tab-pane label="触发器" name="trigger">
<div class="tabs-body protocol-wrap">
<trigger-wrap :sourceId="infoData.deviceId" :deviceInfo="infoData"></trigger-wrap>
<trigger-wrap
:sourceId="infoData.deviceId"
:deviceInfo="infoData"
></trigger-wrap>
</div>
</el-tab-pane>
<el-tab-pane label="固件" name="oat">
<div class="tabs-body protocol-wrap">
<model-oat v-if="activeName === 'oat'" :isTenant="isTenant" :deviceInfo="infoData" @updateInfo="updateInfo($event)" ></model-oat>
<model-oat
v-if="activeName === 'oat'"
:isTenant="isTenant"
:deviceInfo="infoData"
@updateInfo="updateInfo($event)"
></model-oat>
</div>
</el-tab-pane>
<el-tab-pane label="日志" name="devLog">
@ -69,9 +108,9 @@ import InfoWrap from "./info";
import DeviceLog from "./deviceLog";
import StateManagement from "./stateManagement";
import TriggerWrap from "@/views/profile/DeviceTrigger/index";
import DeviceSelect from './deviceSelectNav'
import ModelOat from './modelOat'
import ChildDevice from './childDevice'
import DeviceSelect from "./deviceSelectNav";
import ModelOat from "./modelOat";
import ChildDevice from "./childDevice";
export default {
name: "DetailsWrap",
props: ["sourceId", "isTenant"],
@ -82,7 +121,7 @@ export default {
TriggerWrap,
DeviceSelect,
ModelOat,
ChildDevice
ChildDevice,
},
data() {
return {
@ -95,34 +134,38 @@ export default {
devudeRunState: false,
realTimeData: null,
hzSelectList: [],
userTenantId: ''
userTenantId: "",
};
},
created() {
this.deviceId = this.sourceId;
this.userTenantId = this.$store.getters.tenantId
this.userTenantId = this.$store.getters.tenantId;
this.deviceInfo();
},
methods: {
//
toTableClick() {
this.$emit('toTableClick')
},
handleUpload() {
let newActive = this.activeName;
this.deviceId = this.sourceId;
this.userTenantId = this.$store.getters.tenantId
this.userTenantId = this.$store.getters.tenantId;
// this.deviceInfo();
this.$refs.deviceSelect.getList()
this.$refs.deviceSelect.getList();
this.newActive = newActive;
},
wsRealTImeMsg(data) {
this.realTimeData = Object.assign(data)
this.realTimeData = Object.assign(data);
},
viewDeviceChange(row) {
this.deviceId = row.val;
this.deviceInfo(row.val === this.pInfo.deviceId ? null : 'children')
this.deviceInfo(row.val === this.pInfo.deviceId ? null : "children");
this.devudeRunState = false;
},
//
deviceInfo(type) {
getDevice(this.deviceId).then(response => {
getDevice(this.deviceId).then((response) => {
if (!type) {
this.pInfo = response.data;
}
@ -139,10 +182,12 @@ export default {
this.activeName = "runingState";
},
updateInfo(data) {
console.log(data)
this.deviceInfo(data.deviceId === this.pInfo.deviceId ? null : 'children' );
}
}
console.log(data);
this.deviceInfo(
data.deviceId === this.pInfo.deviceId ? null : "children"
);
},
},
};
</script>
<style lang="scss">
@ -286,6 +331,36 @@ export default {
}
}
}
.link-to-list {
display: flex;
color: #656363;
font-size: 20px;
height: 0;
background: #e4eaf3;
display: flex;
position: relative;
top: 10px;
width: 100px;
z-index: 100;
left: calc(100% - 110px);
cursor: default;
.el-button--medium.is-circle {
width: 25px;
height: 20px;
padding: 0;
background: #f26a6a;
color: #fff;
font-size: 16px;
border-radius: 5px;
height: 30px;
width: 100%;
font-size: 14px;
}
}
.link-to-list:hover {
color: #1890ff;
font-size: 30px;
}
.info-tabs-circuit {
position: relative;
@ -891,7 +966,9 @@ export default {
width: 100%;
}
}
.iot-circuit-breaker-details-warp .info-tabs-circuit .el-tabs__content::-webkit-scrollbar {
.iot-circuit-breaker-details-warp
.info-tabs-circuit
.el-tabs__content::-webkit-scrollbar {
/*滚动条整体样式*/
width: 8px; /*高宽分别对应横竖滚动条的尺寸*/
height: 3px;

View File

@ -448,7 +448,7 @@ export default {
},
/** 根据角色ID查询部门树结构 */
getRoleDeptTreeselect(roleId) {
return roleDeptTreeselect(roleId).then(response => {
roleDeptTreeselect(roleId).then(response => {
this.deptOptions = response.depts;
return response;
});
@ -581,14 +581,18 @@ export default {
/** 分配数据权限操作 */
handleDataScope(row) {
this.reset();
const roleDeptTreeselect = this.getRoleDeptTreeselect(row.roleId);
// const list = this.getRoleDeptTreeselect(row.roleId);
getRole(row.roleId).then(response => {
this.form = response.data;
this.openDataScope = true;
this.$nextTick(() => {
roleDeptTreeselect.then(res => {
roleDeptTreeselect(row.roleId).then(response => {
this.deptOptions = response.depts;
this.$refs.dept.setCheckedKeys(res.checkedKeys);
});
// roleDeptTreeselect.then(res => {
// this.$refs.dept.setCheckedKeys(res.checkedKeys);
// });
});
this.title = "分配数据权限";
});

View File

@ -364,7 +364,8 @@ export default {
}
],
tenantCode: [
{ min: 2, max: 8, message: "用户名称长度在2-8", trigger: "blur" },
{ required: true, message: "企业编码不能为空", trigger: ["blur", "change"] },
{ min: 2, max: 8, message: "用户名称长度在2-8", trigger: "change" },
{
pattern: /^[a-zA-Z0-9]{2,8}$/,
message: "允许字母数字",