提交: 优化部分问题 小结

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 data: data
}); });
} }
// 查询 子设备列表
export function listChildrenDevice(query) {
return request({
url: "iot/device/listWithoutScope",
method: "get",
params: query
});
}

View File

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

View File

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

View File

@ -235,12 +235,40 @@
<el-input v-model="form.otaVersion" placeholder="请输入固件版本" /> <el-input v-model="form.otaVersion" placeholder="请输入固件版本" />
</el-form-item> </el-form-item>
<el-form-item label="升级地址:" prop="otaUrl"> <el-form-item label="升级地址:" prop="otaUrl" v-if="form.otaId">
<el-input v-model="form.otaUrl" placeholder="请输入固件升级地址" /> <el-input
v-model="form.otaUrl"
disabled
placeholder="请输入固件升级地址"
/>
</el-form-item> </el-form-item>
<el-form-item label="文件地址:" prop="txtUrl"> <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-tab-pane label="文本输入" name="input">
<el-input <el-input
v-show="isFileUpload === 'input'" v-show="isFileUpload === 'input'"
@ -261,16 +289,17 @@
将文件拖到此处 将文件拖到此处
<em>点击上传</em> <em>点击上传</em>
</div> </div>
<!-- <div class="el-upload__tip" slot="tip">
只能上传jpg/png文件且不超过500kb
</div> -->
</el-upload> </el-upload>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs> -->
</el-form-item> </el-form-item>
<el-form-item label="固件大小:" prop="otaSize"> <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>
<el-form-item label="升级信息:" prop="otaInfo"> <el-form-item label="升级信息:" prop="otaInfo">
@ -400,7 +429,7 @@ export default {
{ required: true, message: "版本不能为空", trigger: "blur" }, { required: true, message: "版本不能为空", trigger: "blur" },
], ],
otaUrl: [ otaUrl: [
{ required: true, message: " 升级地址不能为空", trigger: "blur" }, { required: false, message: " 升级地址不能为空", trigger: "blur" },
], ],
txtUrl: [ txtUrl: [
{ required: true, message: " 文件地址不能为空", trigger: "blur" }, { required: true, message: " 文件地址不能为空", trigger: "blur" },

View File

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

View File

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

View File

@ -1,11 +1,34 @@
<template> <template>
<div class="iot-circuit-breaker-details-warp"> <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="info-tabs-circuit">
<div class="breadcrumb-wrap" v-show="breadcrumbList.length > 1"> <div class="breadcrumb-wrap" v-show="breadcrumbList.length > 1">
<el-breadcrumb separator-class="el-icon-arrow-right"> <el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item v-for="(item, index) in breadcrumbList" :key="index"> <el-breadcrumb-item
<span @click="deviceClick(item, index)" :class="item.deviceId === deviceId ? 'breadcrumb-span show-wrap' : 'breadcrumb-span'">{{item.deviceName}}</span> 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-item>
</el-breadcrumb> </el-breadcrumb>
</div> </div>
@ -24,12 +47,20 @@
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="设备信息" name="info"> <el-tab-pane label="设备信息" name="info">
<div class="tabs-body"> <div class="tabs-body">
<info-wrap :infoData="infoData" :isTenant="isTenant" @updateInfo="updateInfo($event)" /> <info-wrap
:infoData="infoData"
:isTenant="isTenant"
@updateInfo="updateInfo($event)"
/>
</div> </div>
</el-tab-pane> </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"> <div class="tabs-body">
<child-device <child-device
v-if="activeName === 'child'" v-if="activeName === 'child'"
@ -42,12 +73,20 @@
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="触发器" name="trigger"> <el-tab-pane label="触发器" name="trigger">
<div class="tabs-body protocol-wrap"> <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> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="固件" name="oat"> <el-tab-pane label="固件" name="oat">
<div class="tabs-body protocol-wrap"> <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> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="日志" name="devLog"> <el-tab-pane label="日志" name="devLog">
@ -69,9 +108,9 @@ import InfoWrap from "./info";
import DeviceLog from "./deviceLog"; import DeviceLog from "./deviceLog";
import StateManagement from "./stateManagement"; import StateManagement from "./stateManagement";
import TriggerWrap from "@/views/profile/DeviceTrigger/index"; import TriggerWrap from "@/views/profile/DeviceTrigger/index";
import DeviceSelect from './deviceSelectNav' import DeviceSelect from "./deviceSelectNav";
import ModelOat from './modelOat' import ModelOat from "./modelOat";
import ChildDevice from './childDevice' import ChildDevice from "./childDevice";
export default { export default {
name: "DetailsWrap", name: "DetailsWrap",
props: ["sourceId", "isTenant"], props: ["sourceId", "isTenant"],
@ -82,7 +121,7 @@ export default {
TriggerWrap, TriggerWrap,
DeviceSelect, DeviceSelect,
ModelOat, ModelOat,
ChildDevice ChildDevice,
}, },
data() { data() {
return { return {
@ -95,34 +134,38 @@ export default {
devudeRunState: false, devudeRunState: false,
realTimeData: null, realTimeData: null,
hzSelectList: [], hzSelectList: [],
userTenantId: '' userTenantId: "",
}; };
}, },
created() { created() {
this.deviceId = this.sourceId; this.deviceId = this.sourceId;
this.userTenantId = this.$store.getters.tenantId this.userTenantId = this.$store.getters.tenantId;
this.deviceInfo(); this.deviceInfo();
}, },
methods: { methods: {
//
toTableClick() {
this.$emit('toTableClick')
},
handleUpload() { handleUpload() {
let newActive = this.activeName; let newActive = this.activeName;
this.deviceId = this.sourceId; this.deviceId = this.sourceId;
this.userTenantId = this.$store.getters.tenantId this.userTenantId = this.$store.getters.tenantId;
// this.deviceInfo(); // this.deviceInfo();
this.$refs.deviceSelect.getList() this.$refs.deviceSelect.getList();
this.newActive = newActive; this.newActive = newActive;
}, },
wsRealTImeMsg(data) { wsRealTImeMsg(data) {
this.realTimeData = Object.assign(data) this.realTimeData = Object.assign(data);
}, },
viewDeviceChange(row) { viewDeviceChange(row) {
this.deviceId = row.val; 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; this.devudeRunState = false;
}, },
// //
deviceInfo(type) { deviceInfo(type) {
getDevice(this.deviceId).then(response => { getDevice(this.deviceId).then((response) => {
if (!type) { if (!type) {
this.pInfo = response.data; this.pInfo = response.data;
} }
@ -139,10 +182,12 @@ export default {
this.activeName = "runingState"; this.activeName = "runingState";
}, },
updateInfo(data) { updateInfo(data) {
console.log(data) console.log(data);
this.deviceInfo(data.deviceId === this.pInfo.deviceId ? null : 'children' ); this.deviceInfo(
} data.deviceId === this.pInfo.deviceId ? null : "children"
} );
},
},
}; };
</script> </script>
<style lang="scss"> <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 { .info-tabs-circuit {
position: relative; position: relative;
@ -891,7 +966,9 @@ export default {
width: 100%; 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; /*高宽分别对应横竖滚动条的尺寸*/ width: 8px; /*高宽分别对应横竖滚动条的尺寸*/
height: 3px; height: 3px;

View File

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

View File

@ -364,7 +364,8 @@ export default {
} }
], ],
tenantCode: [ 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}$/, pattern: /^[a-zA-Z0-9]{2,8}$/,
message: "允许字母数字", message: "允许字母数字",