1086 lines
33 KiB
Vue
1086 lines
33 KiB
Vue
<!-- db——网关的数据采集MQTT云服务 -->
|
|
<template>
|
|
<div class="Clone">
|
|
<!-- <div v-click-outside="closeMenu"> -->
|
|
<!-- <el-button type="info" plain @click="dialogVisible = !dialogVisible">MQTT云</el-button> -->
|
|
<div v-show="dialogVisible" class="tree_menu">
|
|
<el-tree
|
|
:data="trees"
|
|
node-key="id"
|
|
:props="defaultProps"
|
|
default-expand-all
|
|
@node-contextmenu="rightClick"
|
|
@node-click="treeNodeClick"
|
|
ref="tree"
|
|
>
|
|
</el-tree>
|
|
</div>
|
|
<!-- </div> -->
|
|
<div class="pas_params" v-show="add_passage">
|
|
<div class="content" v-loading="loading">
|
|
<div class="con_left">
|
|
<h3 class="mqtt" style="margin-top: 20px; color: white">
|
|
MQTT Client
|
|
</h3>
|
|
<el-divider></el-divider>
|
|
<el-form
|
|
:model="formData"
|
|
:label-position="labelPosition"
|
|
:rules="rules"
|
|
ref="formData"
|
|
>
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-form-item>
|
|
<el-checkbox v-model="formData.mqtt_qiyong">{{ $t('mqttClient.enable') }}</el-checkbox>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row class="serveip">
|
|
<el-col :span="12">
|
|
<el-form-item
|
|
:label="$t('mqttClient.serverIp')"
|
|
:label-width="formLabelWidth"
|
|
prop="mqtt_ip"
|
|
>
|
|
<el-row>
|
|
<el-col :span="5">
|
|
<el-form-item prop="mqtt_ip1">
|
|
<el-input
|
|
v-model="mqtt_ip1"
|
|
style="width: 43px; height: 30px"
|
|
maxlength="3"
|
|
>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="1">. </el-col>
|
|
<el-col :span="5">
|
|
<el-form-item prop="mqtt_ip2">
|
|
<el-input
|
|
v-model="mqtt_ip2"
|
|
style="width: 43px; height: 30px"
|
|
maxlength="3"
|
|
></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="1">.</el-col>
|
|
<el-col :span="5">
|
|
<el-form-item prop="mqtt_ip3">
|
|
<el-input
|
|
v-model="mqtt_ip3"
|
|
style="width: 43px; height: 30px"
|
|
maxlength="3"
|
|
></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="1">.</el-col>
|
|
<el-col :span="5">
|
|
<el-form-item prop="mqtt_ip4">
|
|
<el-input
|
|
v-model="mqtt_ip4"
|
|
style="width: 43px; height: 30px"
|
|
maxlength="3"
|
|
></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-form-item
|
|
:label="$t('mqttClient.port')"
|
|
:label-width="formLabelWidth"
|
|
prop="mqtt_port"
|
|
>
|
|
<el-input
|
|
v-model="formData.mqtt_port"
|
|
placeholder=""
|
|
style="width: 200px; height: 30px"
|
|
></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-form-item
|
|
:label="$t('mqttClient.gatewaySN')"
|
|
|
|
prop="mqtt_wgsn"
|
|
>
|
|
<el-input
|
|
v-model="formData.mqtt_wgsn"
|
|
placeholder=""
|
|
style="width: 200px; height: 30px"
|
|
></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-divider></el-divider>
|
|
<el-row class="theme">
|
|
<el-col :span="12">
|
|
<el-form-item
|
|
:label="$t('mqttClient.realTimePublish')"
|
|
style="display: block"
|
|
|
|
prop="mqtt_sssjfbzt"
|
|
>
|
|
<el-row>
|
|
<el-col :span="15">
|
|
<el-input
|
|
v-model="formData.mqtt_sssjfbzt"
|
|
placeholder=""
|
|
style="width: 200px"
|
|
></el-input>
|
|
</el-col>
|
|
<el-col :span="9">
|
|
<el-select
|
|
v-model="formData.mqtt_qos"
|
|
placeholder="请选择"
|
|
style="width: 99px"
|
|
>
|
|
<el-option
|
|
v-for="item in options1"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value"
|
|
>
|
|
</el-option>
|
|
</el-select>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item
|
|
:label="$t('mqttClient.uploadMode')"
|
|
|
|
prop="mqtt_scms"
|
|
>
|
|
<el-select
|
|
v-model="formData.mqtt_scms"
|
|
placeholder="请选择"
|
|
style="width: 99px"
|
|
>
|
|
<el-option
|
|
v-for="item in options2"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value"
|
|
>
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item
|
|
:label="$t('mqttClient.uploadCycle')"
|
|
|
|
prop="mqtt_sczq"
|
|
>
|
|
<el-input
|
|
v-model="formData.mqtt_sczq"
|
|
placeholder=""
|
|
style="width: 200px; height: 30px"
|
|
></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-form-item
|
|
:label="$t('mqttClient.dataFilter')"
|
|
|
|
prop="mqtt_sjgl"
|
|
>
|
|
<div class="checkbox1">
|
|
<el-checkbox-group v-model="formData.mqtt_sjgl">
|
|
<el-checkbox :label="$t('mqttClient.oneCheck')">{{ $t('mqttClient.oneCheck') }}</el-checkbox>
|
|
<el-checkbox :label="$t('mqttClient.twoCheck')">{{ $t('mqttClient.twoCheck') }}</el-checkbox>
|
|
<el-checkbox :label="$t('mqttClient.threeCheck')">{{ $t('mqttClient.threeCheck') }}</el-checkbox>
|
|
</el-checkbox-group>
|
|
</div>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<div class="con_left_footer">
|
|
<el-button type="primary" @click="submitForm">{{ $t('save') }}</el-button>
|
|
<el-button @click="add_passage = false">{{ $t('cancel') }}</el-button>
|
|
</div>
|
|
</el-form>
|
|
</div>
|
|
<div>
|
|
<div class="con_right">
|
|
<h3 class="mqtt" style="margin-top: 20px; color: white">
|
|
MQTT Client采集点
|
|
</h3>
|
|
<el-divider></el-divider>
|
|
<!-- <el-button type="info" plain @click="handleSelect">保存</el-button> -->
|
|
<!-- <el-menu class="el-menu-demo" mode="horizontal" @select="handleSelect">
|
|
<el-menu-item index="1">添加</el-menu-item>
|
|
<el-menu-item index="2">保存</el-menu-item>
|
|
<el-menu-item index="3">删除</el-menu-item>
|
|
</el-menu> -->
|
|
</div>
|
|
<el-table ref="singleTable" :data="tableData" style="width: 100%">
|
|
<el-table-column type="index"> </el-table-column>
|
|
<el-table-column property="mqtt_cjd_sbmc" :label="$t('mqttClient.deviceName')">
|
|
<template slot-scope="scope">
|
|
<el-select v-model="scope.row.mqtt_cjd_sbmc" placeholder="">
|
|
<el-option
|
|
v-for="(option, index) in options3"
|
|
:key="index"
|
|
:label="option.label"
|
|
:value="option.value"
|
|
></el-option>
|
|
</el-select>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column property="mqtt_cjd_tagid" label="TagID">
|
|
<template slot-scope="scope">
|
|
<el-select v-model="scope.row.mqtt_cjd_tagid" placeholder="">
|
|
<el-option
|
|
v-for="(option, index) in options4"
|
|
:key="index"
|
|
:label="option.label"
|
|
:value="option.value"
|
|
></el-option>
|
|
</el-select>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- 添加按钮下显示出来的弹框信息 -->
|
|
<!-- <div>
|
|
<el-dialog title="选择点" :visible.sync="choose_point" width="30%">
|
|
<el-tree :data="points" show-checkbox node-key="id" :default-expanded-keys="[1, 2]"
|
|
:default-checked-keys="[3, 4, 5, 6]" :props="defaultProps">
|
|
</el-tree>
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="savePoint">保 存</el-button>
|
|
<el-button @click="choose_point = false">取 消</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
</div> -->
|
|
|
|
<div class="gateway">
|
|
<el-dialog :title="$t('dbcollectiongate.title')" :visible.sync="outerVisible" width="382px">
|
|
<el-form
|
|
:model="formData"
|
|
:rules="rulesGate"
|
|
ref="gateWay"
|
|
:label-width="this.$i18n.locale === 'zh'?'140px':'85px'"
|
|
class="demo-ruleForm"
|
|
>
|
|
<el-form-item :label="$t('dbcollectiongate.name')" prop="wgpz_wgmc">
|
|
<el-select
|
|
v-model="formData.wgpz_wgmc"
|
|
:placeholder="$t('select')"
|
|
style="width: 200px"
|
|
>
|
|
<el-option
|
|
v-for="item in opts1"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value"
|
|
>
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item :label="$t('dbcollectiongate.ID')" prop="wgpz_wgid">
|
|
<el-select
|
|
v-model="formData.wgpz_wgid"
|
|
:placeholder="$t('select')"
|
|
style="width: 200px"
|
|
>
|
|
<el-option
|
|
v-for="item in opts2"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value"
|
|
>
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item :label="$t('dbcollectiongate.type')" prop="wgpz_wglx">
|
|
<el-select
|
|
v-model="formData.wgpz_wglx"
|
|
:placeholder="$t('select')"
|
|
style="width: 200px"
|
|
>
|
|
<el-option
|
|
v-for="item in opts3"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value"
|
|
>
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer-outer">
|
|
<el-button type="primary" @click="submitGate">{{ $t('save') }}</el-button>
|
|
<el-button @click="outerVisible = false">{{ $t('cancel') }}</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {SaveUserAnswer, GetUserAnswer, GetTree, SendTree, getQueryAnswer} from "@/api/user";
|
|
export default {
|
|
name: "CloneView",
|
|
|
|
data() {
|
|
return {
|
|
loading: false,
|
|
flag: false,
|
|
gateway: "",
|
|
step: "",
|
|
trees: [],
|
|
user_id: "",
|
|
formData: {
|
|
ippz_lwfs: "",
|
|
// ippz_wangkou: "",
|
|
ippz_zwym: "",
|
|
ippz_mrwg: "",
|
|
ippz_dns_sx: "",
|
|
ippz_dns_by: "",
|
|
ippz_ip: "",
|
|
ippz_mac: "",
|
|
ippz_wifi_ssid: "",
|
|
ippz_wifi_mm: "",
|
|
wgpz_wgmc: "",
|
|
wgpz_wgid: "",
|
|
wgpz_wglx: "",
|
|
tdpz_tdmc: "",
|
|
tdpz_td: "",
|
|
tdpz_qdmc: "",
|
|
tdpz_chuankou: "",
|
|
tdpz_btl: "",
|
|
tdpz_sjw: "",
|
|
tdpz_tzw: "",
|
|
tdpz_jojy: "",
|
|
tdpz_cgsj: "",
|
|
tdpz_jgsj: "",
|
|
tdpz_lxsj: "",
|
|
tdpz_cfcs: "",
|
|
tdpz_watchtime: "",
|
|
tdpz_cjsylxdz: "",
|
|
tdpz_dxzkb: "",
|
|
tdpz_050F: "",
|
|
tdpz_0610: "",
|
|
sbpz_sbid: "",
|
|
sbpz_sbmc: "",
|
|
sbpz_sbdz: "",
|
|
sbpz_jysb: "",
|
|
sbpz_jdzxz: "",
|
|
cjdpz_tagid: "",
|
|
cjdpz_mc: "",
|
|
cjdpz_sjq: "",
|
|
cjdpz_jcqdz: "",
|
|
cjdpz_cjsjlx: "",
|
|
cjdpz_zjx: "",
|
|
cjdpz_dxsx: "",
|
|
cjdpz_beilv: "",
|
|
mqtt_qiyong: false,
|
|
mqtt_ip: "",
|
|
mqtt_port: "",
|
|
mqtt_wgsn: "",
|
|
mqtt_sssjfbzt: "",
|
|
mqtt_qos: "",
|
|
mqtt_scms: "",
|
|
mqtt_sczq: "",
|
|
mqtt_sjgl: [],
|
|
mqtt_cjd_sbmc: "",
|
|
mqtt_cjd_tagid: "",
|
|
},
|
|
mqtt_ip1: "",
|
|
mqtt_ip2: "",
|
|
mqtt_ip3: "",
|
|
mqtt_ip4: "",
|
|
options1: [
|
|
{
|
|
value: "qos0",
|
|
label: "qos0",
|
|
},
|
|
{
|
|
value: "qos1",
|
|
label: "qos1",
|
|
},
|
|
{
|
|
value: "qos2",
|
|
label: "qos2",
|
|
},
|
|
],
|
|
options2: [
|
|
{
|
|
value: "周期上传",
|
|
label: "周期上传",
|
|
},
|
|
{
|
|
value: "整点上传",
|
|
label: "整点上传",
|
|
},
|
|
],
|
|
options3: [],
|
|
options4: [],
|
|
points: [
|
|
{
|
|
id: 1,
|
|
label: "I/O点",
|
|
children: [
|
|
{
|
|
id: 2,
|
|
label: "Channel1",
|
|
children: [
|
|
{
|
|
id: 3,
|
|
label: "Device1",
|
|
children: [
|
|
{
|
|
id: 4,
|
|
label: "tag0001",
|
|
},
|
|
{
|
|
id: 5,
|
|
label: "tag0002",
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
choose_point: false,
|
|
value: "qos0",
|
|
value1: 0,
|
|
labelPosition: "left",
|
|
formLabelWidth: "88px",
|
|
add_passage: true,
|
|
rightMenu: "",
|
|
dialogVisible: true,
|
|
isAdd: false,
|
|
datas: [
|
|
{
|
|
label: "Gateway",
|
|
children: [
|
|
{
|
|
label: "数据采集",
|
|
children: [
|
|
{
|
|
label: "I/O点",
|
|
},
|
|
{
|
|
label: "用户点",
|
|
},
|
|
{
|
|
label: "计算点",
|
|
},
|
|
{
|
|
label: "系统点",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
label: "数据服务",
|
|
children: [
|
|
{
|
|
label: "Modbus",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
label: "IOT",
|
|
children: [
|
|
{
|
|
label: "Mqtt Client",
|
|
},
|
|
{
|
|
label: "Alink",
|
|
},
|
|
{
|
|
label: "Tlink",
|
|
},
|
|
{
|
|
label: "loTDDC",
|
|
},
|
|
{
|
|
label: "Ulink",
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
defaultProps: {
|
|
children: "children",
|
|
label: "label",
|
|
},
|
|
tableData: [
|
|
{
|
|
mqtt_cjd_sbmc: "",
|
|
mqtt_cjd_tagid: "",
|
|
},
|
|
],
|
|
// 校验
|
|
rules: {
|
|
mqtt_ip: [
|
|
{
|
|
required: true,
|
|
message: "",
|
|
validator: this.validateIp,
|
|
trigger: "blur",
|
|
},
|
|
],
|
|
mqtt_port: [{ required: true, message: this.$t('mqttClient.rules.mqtt_port'), trigger: "blur" }],
|
|
mqtt_wgsn: [
|
|
{ required: true, message: this.$t('mqttClient.rules.mqtt_wgsn'), trigger: "blur" },
|
|
],
|
|
mqtt_sssjfbzt: [
|
|
{ required: true, message: this.$t('mqttClient.rules.mqtt_sssjfbzt'), trigger: "blur" },
|
|
],
|
|
mqtt_scms: [
|
|
{ required: true, message: this.$t('mqttClient.rules.mqtt_scms'), trigger: "blur" },
|
|
],
|
|
mqtt_sczq: [
|
|
{ required: true, message: this.$t('mqttClient.rules.mqtt_sczq'), trigger: "blur" },
|
|
],
|
|
mqtt_sjgl: [
|
|
{ required: true, message: this.$t('mqttClient.rules.mqtt_sjgl'), trigger: "blur" },
|
|
],
|
|
},
|
|
// 网关配置
|
|
outerVisible: false,
|
|
gateWay: {
|
|
wgpz_wgmc: "",
|
|
wgpz_wgid: "",
|
|
wgpz_wglx: "",
|
|
},
|
|
rulesGate: {
|
|
wgpz_wgmc: [
|
|
{ required: true, message: this.$t('dbcollectiongate.rules.wgpz_wgmc'), trigger: "blur" },
|
|
],
|
|
wgpz_wgid: [
|
|
{ required: true, message: this.$t('dbcollectiongate.rules.wgpz_wgid'), trigger: "blur" },
|
|
],
|
|
wgpz_wglx: [
|
|
{ required: true, message: this.$t('dbcollectiongate.rules.wgpz_wglx'), trigger: "blur" },
|
|
],
|
|
},
|
|
opts1: this.$t('dbcollectiongate.options1'),
|
|
opts2: [
|
|
{
|
|
value: "LAN-BOX1",
|
|
label: "LAN-BOX1",
|
|
},
|
|
{
|
|
value: "WLAN-BOX1",
|
|
label: "WLAN-BOX1",
|
|
},
|
|
],
|
|
opts3: this.$t('dbcollectiongate.options3'),
|
|
};
|
|
},
|
|
methods: {
|
|
// IP地址的校验
|
|
validateIp(rule, value, callback) {
|
|
if (
|
|
this.mqtt_ip1 +
|
|
"." +
|
|
this.mqtt_ip2 +
|
|
"." +
|
|
this.mqtt_ip3 +
|
|
"." +
|
|
this.mqtt_ip4 ===
|
|
"..."
|
|
) {
|
|
callback(new Error(this.$t('mqttClient.rules.ip1')));
|
|
} else if (
|
|
!/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/.test(
|
|
this.mqtt_ip1 +
|
|
"." +
|
|
this.mqtt_ip2 +
|
|
"." +
|
|
this.mqtt_ip3 +
|
|
"." +
|
|
this.mqtt_ip4
|
|
)
|
|
) {
|
|
callback(new Error(this.$t('mqttClient.rules.ip2')));
|
|
} else {
|
|
callback();
|
|
}
|
|
},
|
|
// 提交时进行校验
|
|
submitForm() {
|
|
this.$refs["formData"].validate((valid) => {
|
|
if (valid) {
|
|
this.saveClone();
|
|
} else {
|
|
console.log("error submit!!");
|
|
return false;
|
|
}
|
|
});
|
|
},
|
|
changeInput() {
|
|
this.flag = false;
|
|
this.trees[0].label = this.gateway;
|
|
this.sendTree();
|
|
},
|
|
async rightClick(e, data, node) {
|
|
console.log(node);
|
|
if (data.editing) {
|
|
this.outerVisible = true;
|
|
this.GetUserAnswer();
|
|
this.trees[0].label = this.formData.wgpz_wgid;
|
|
this.sendTree();
|
|
}
|
|
},
|
|
|
|
treeNodeClick() {
|
|
this.add_passage = true;
|
|
},
|
|
getDriveName() {
|
|
this.diag_drive = true;
|
|
},
|
|
closeMenu(ev) {
|
|
// console.log({ ev });
|
|
this.dialogVisible = false;
|
|
},
|
|
async saveClone() {
|
|
var obj = {
|
|
mqtt_qiyong: String(Number(this.formData.mqtt_qiyong)),
|
|
mqtt_ip:
|
|
this.mqtt_ip1 +
|
|
"." +
|
|
this.mqtt_ip2 +
|
|
"." +
|
|
this.mqtt_ip3 +
|
|
"." +
|
|
this.mqtt_ip4,
|
|
mqtt_port: this.formData.mqtt_port,
|
|
mqtt_wgsn: this.formData.mqtt_wgsn,
|
|
mqtt_sssjfbzt: this.formData.mqtt_sssjfbzt,
|
|
mqtt_qos: this.formData.mqtt_qos,
|
|
mqtt_scms: this.formData.mqtt_scms,
|
|
mqtt_sczq: this.formData.mqtt_sczq,
|
|
mqtt_sjgl: this.formData.mqtt_sjgl,
|
|
mqtt_cjd_sbmc: this.tableData[0].mqtt_cjd_sbmc,
|
|
mqtt_cjd_tagid: this.tableData[0].mqtt_cjd_tagid,
|
|
};
|
|
// console.log("1231");
|
|
// console.log(JSON.parse(datas));
|
|
let datas = { ...this.formData, ...obj };
|
|
let res = await SaveUserAnswer({
|
|
mark: "DB-IotLite_wx",
|
|
user_id: this.user_id,
|
|
// user_id:"USER202307301114011710",
|
|
mark_value: JSON.stringify(datas),
|
|
step: this.step,
|
|
});
|
|
if (res.data.state) {
|
|
this.$message({
|
|
message: "保存成功",
|
|
type: "success",
|
|
});
|
|
sessionStorage.setItem("DB-IotLite_wx", JSON.stringify(datas));
|
|
} else {
|
|
this.$message({
|
|
message: `保存失败${res.message}`,
|
|
type: "error",
|
|
});
|
|
}
|
|
// console.log(res);
|
|
},
|
|
savePoint() {
|
|
this.choose_point = false;
|
|
this.isAdd = true;
|
|
this.$message({
|
|
message: "添加成功",
|
|
type: "success",
|
|
});
|
|
},
|
|
async GetUserAnswer() {
|
|
let answer = await GetUserAnswer({
|
|
mark: "DB-IotLite_wx",
|
|
user_id: this.user_id,
|
|
// user_id: "USER202307301114011710",
|
|
});
|
|
console.log(answer);
|
|
if(!answer.data.state){
|
|
getQueryAnswer({
|
|
mark: "DB-IotLite_wx",
|
|
user_id: this.user_id
|
|
}).then(res => {
|
|
if(res.data.data.step) {
|
|
this.step = res.data.data.step;
|
|
}
|
|
let obj = JSON.parse(res.data.data.r3);
|
|
if (obj.mqtt_ip) {
|
|
this.formData.mqtt_qiyong = Boolean(Number(obj.mqtt_qiyong));
|
|
this.mqtt_ip1 = obj.mqtt_ip.split(".")[0];
|
|
this.mqtt_ip2 = obj.mqtt_ip.split(".")[1];
|
|
this.mqtt_ip3 = obj.mqtt_ip.split(".")[2];
|
|
this.mqtt_ip4 = obj.mqtt_ip.split(".")[3];
|
|
this.formData.mqtt_port = obj.mqtt_port;
|
|
this.formData.mqtt_sssjfbzt = obj.mqtt_sssjfbzt;
|
|
this.formData.mqtt_wgsn = obj.mqtt_wgsn;
|
|
this.formData.mqtt_qos = obj.mqtt_qos;
|
|
this.formData.mqtt_scms = obj.mqtt_scms;
|
|
this.formData.mqtt_sczq = obj.mqtt_sczq;
|
|
this.formData.mqtt_sjgl = obj.mqtt_sjgl;
|
|
// this.formData.mqtt_retained = Boolean(Number(obj.mqtt_retained));
|
|
}
|
|
this.formData.ippz_lwfs = obj.ippz_lwfs;
|
|
// this.formData.ippz_wangkou = obj.ippz_wangkou;
|
|
this.formData.ippz_zwym = obj.ippz_zwym;
|
|
this.formData.ippz_mrwg = obj.ippz_mrwg;
|
|
this.formData.ippz_ip = obj.ippz_ip;
|
|
this.formData.ippz_dns_sx = obj.ippz_dns_sx;
|
|
this.formData.ippz_dns_by = obj.ippz_dns_by;
|
|
this.formData.ippz_mac = obj.ippz_mac;
|
|
this.formData.ippz_wifi_ssid = obj.ippz_wifi_ssid;
|
|
this.formData.ippz_wifi_mm = obj.ippz_wifi_mm;
|
|
this.formData.wgpz_wgmc = obj.wgpz_wgmc;
|
|
this.formData.wgpz_wgid = obj.wgpz_wgid;
|
|
this.formData.wgpz_wglx = obj.wgpz_wglx;
|
|
this.formData.tdpz_tdmc = obj.tdpz_tdmc;
|
|
this.formData.tdpz_td = obj.tdpz_td;
|
|
this.formData.tdpz_qdmc = obj.tdpz_qdmc;
|
|
this.formData.tdpz_chuankou = obj.tdpz_chuankou;
|
|
this.formData.tdpz_btl = obj.tdpz_btl;
|
|
this.formData.tdpz_sjw = obj.tdpz_sjw;
|
|
this.formData.tdpz_tzw = obj.tdpz_tzw;
|
|
this.formData.tdpz_jojy = obj.tdpz_jojy;
|
|
this.formData.tdpz_port = obj.tdpz_port;
|
|
this.formData.tdpz_cgsj = obj.tdpz_cgsj;
|
|
this.formData.tdpz_jgsj = obj.tdpz_jgsj;
|
|
this.formData.tdpz_lxsj = obj.tdpz_lxsj;
|
|
this.formData.tdpz_cfcs = obj.tdpz_cfcs;
|
|
this.formData.tdpz_watchtime = obj.tdpz_watchtime;
|
|
this.formData.tdpz_cjsylxdz = obj.tdpz_cjsylxdz;
|
|
this.formData.tdpz_050F = obj.tdpz_050F;
|
|
this.formData.tdpz_0610 = obj.tdpz_0610;
|
|
this.formData.tdpz_dxzkb = obj.tdpz_dxzkb;
|
|
this.formData.cjdpz_tagid = obj.cjdpz_tagid;
|
|
this.formData.cjdpz_mc = obj.cjdpz_mc;
|
|
this.formData.cjdpz_sjq = obj.cjdpz_sjq;
|
|
this.formData.cjdpz_jcqdz = obj.cjdpz_jcqdz;
|
|
this.formData.cjdpz_cjsjlx = obj.cjdpz_cjsjlx;
|
|
this.formData.cjdpz_zjx = obj.cjdpz_zjx;
|
|
this.formData.cjdpz_dxsx = obj.cjdpz_dxsx;
|
|
this.formData.cjdpz_beilv = obj.cjdpz_beilv;
|
|
this.formData.sbpz_sbid = obj.sbpz_sbid;
|
|
this.formData.sbpz_sbmc = obj.sbpz_sbmc;
|
|
this.formData.sbpz_sbdz = obj.sbpz_sbdz;
|
|
this.formData.sbpz_jysb = obj.sbpz_jysb;
|
|
this.formData.sbpz_jdzxz = obj.sbpz_jdzxz;
|
|
this.tableData[0].mqtt_cjd_sbmc = obj.sbpz_sbmc;
|
|
this.tableData[0].mqtt_cjd_tagid = obj.cjdpz_tagid;
|
|
})
|
|
}
|
|
// alert(this.step);
|
|
if (answer.data.data && answer.data.state) {
|
|
if(answer.data.data.step) {
|
|
this.step = answer.data.data.step;
|
|
}
|
|
let obj = JSON.parse(answer.data.data.mark_value);
|
|
if (obj.mqtt_ip) {
|
|
this.formData.mqtt_qiyong = Boolean(Number(obj.mqtt_qiyong));
|
|
this.mqtt_ip1 = obj.mqtt_ip.split(".")[0];
|
|
this.mqtt_ip2 = obj.mqtt_ip.split(".")[1];
|
|
this.mqtt_ip3 = obj.mqtt_ip.split(".")[2];
|
|
this.mqtt_ip4 = obj.mqtt_ip.split(".")[3];
|
|
this.formData.mqtt_port = obj.mqtt_port;
|
|
this.formData.mqtt_sssjfbzt = obj.mqtt_sssjfbzt;
|
|
this.formData.mqtt_wgsn = obj.mqtt_wgsn;
|
|
this.formData.mqtt_qos = obj.mqtt_qos;
|
|
this.formData.mqtt_scms = obj.mqtt_scms;
|
|
this.formData.mqtt_sczq = obj.mqtt_sczq;
|
|
this.formData.mqtt_sjgl = obj.mqtt_sjgl;
|
|
// this.formData.mqtt_retained = Boolean(Number(obj.mqtt_retained));
|
|
}
|
|
this.formData.ippz_lwfs = obj.ippz_lwfs;
|
|
// this.formData.ippz_wangkou = obj.ippz_wangkou;
|
|
this.formData.ippz_zwym = obj.ippz_zwym;
|
|
this.formData.ippz_mrwg = obj.ippz_mrwg;
|
|
this.formData.ippz_ip = obj.ippz_ip;
|
|
this.formData.ippz_dns_sx = obj.ippz_dns_sx;
|
|
this.formData.ippz_dns_by = obj.ippz_dns_by;
|
|
this.formData.ippz_mac = obj.ippz_mac;
|
|
this.formData.ippz_wifi_ssid = obj.ippz_wifi_ssid;
|
|
this.formData.ippz_wifi_mm = obj.ippz_wifi_mm;
|
|
this.formData.wgpz_wgmc = obj.wgpz_wgmc;
|
|
this.formData.wgpz_wgid = obj.wgpz_wgid;
|
|
this.formData.wgpz_wglx = obj.wgpz_wglx;
|
|
this.formData.tdpz_tdmc = obj.tdpz_tdmc;
|
|
this.formData.tdpz_td = obj.tdpz_td;
|
|
this.formData.tdpz_qdmc = obj.tdpz_qdmc;
|
|
this.formData.tdpz_chuankou = obj.tdpz_chuankou;
|
|
this.formData.tdpz_btl = obj.tdpz_btl;
|
|
this.formData.tdpz_sjw = obj.tdpz_sjw;
|
|
this.formData.tdpz_tzw = obj.tdpz_tzw;
|
|
this.formData.tdpz_jojy = obj.tdpz_jojy;
|
|
this.formData.tdpz_port = obj.tdpz_port;
|
|
this.formData.tdpz_cgsj = obj.tdpz_cgsj;
|
|
this.formData.tdpz_jgsj = obj.tdpz_jgsj;
|
|
this.formData.tdpz_lxsj = obj.tdpz_lxsj;
|
|
this.formData.tdpz_cfcs = obj.tdpz_cfcs;
|
|
this.formData.tdpz_watchtime = obj.tdpz_watchtime;
|
|
this.formData.tdpz_cjsylxdz = obj.tdpz_cjsylxdz;
|
|
this.formData.tdpz_050F = obj.tdpz_050F;
|
|
this.formData.tdpz_0610 = obj.tdpz_0610;
|
|
this.formData.tdpz_dxzkb = obj.tdpz_dxzkb;
|
|
this.formData.cjdpz_tagid = obj.cjdpz_tagid;
|
|
this.formData.cjdpz_mc = obj.cjdpz_mc;
|
|
this.formData.cjdpz_sjq = obj.cjdpz_sjq;
|
|
this.formData.cjdpz_jcqdz = obj.cjdpz_jcqdz;
|
|
this.formData.cjdpz_cjsjlx = obj.cjdpz_cjsjlx;
|
|
this.formData.cjdpz_zjx = obj.cjdpz_zjx;
|
|
this.formData.cjdpz_dxsx = obj.cjdpz_dxsx;
|
|
this.formData.cjdpz_beilv = obj.cjdpz_beilv;
|
|
this.formData.sbpz_sbid = obj.sbpz_sbid;
|
|
this.formData.sbpz_sbmc = obj.sbpz_sbmc;
|
|
this.formData.sbpz_sbdz = obj.sbpz_sbdz;
|
|
this.formData.sbpz_jysb = obj.sbpz_jysb;
|
|
this.formData.sbpz_jdzxz = obj.sbpz_jdzxz;
|
|
this.tableData[0].mqtt_cjd_sbmc = obj.sbpz_sbmc;
|
|
this.tableData[0].mqtt_cjd_tagid = obj.cjdpz_tagid;
|
|
}
|
|
},
|
|
async sendTree() {
|
|
let result = await SendTree({
|
|
user_id: this.user_id,
|
|
// user_id: "USER202307301114011710",
|
|
data: JSON.stringify(this.trees),
|
|
type: "2",
|
|
});
|
|
// console.log(result);
|
|
},
|
|
async getTree() {
|
|
console.log("12341");
|
|
let res = await GetTree({ user_id: this.user_id, type: "2" });
|
|
// console.log(res);
|
|
// console.log(JSON.parse(res.data.data.data));
|
|
if(this.$i18n.locale==='zh'){
|
|
this.trees = JSON.parse(res.data.data.r2);
|
|
}else{
|
|
this.trees = JSON.parse(res.data.data.data);
|
|
}
|
|
},
|
|
|
|
//网关信息配置
|
|
async submitGate() {
|
|
this.$refs["gateWay"].validate((valid) => {
|
|
if (valid) {
|
|
// console.log('submit!');
|
|
this.saveGates();
|
|
} else {
|
|
console.log("error submit!!");
|
|
return false;
|
|
}
|
|
});
|
|
},
|
|
async saveGates() {
|
|
this.outerVisible = false;
|
|
// this.innerVisible = false;
|
|
// console.log(JSON.parse(datas));
|
|
// let datas = { ...this.f, ...this.gateWay };
|
|
// console.log(datas);
|
|
let datas = { ...this.formData, ...this.tableData[0] };
|
|
let res = await SaveUserAnswer({
|
|
mark: "DB-IotLite_wx",
|
|
user_id: this.user_id,
|
|
// user_id: "USER202307301114011710",
|
|
mark_value: JSON.stringify(datas),
|
|
step: this.step,
|
|
});
|
|
if (res.data.state) {
|
|
this.$message({
|
|
message: "修改成功",
|
|
type: "success",
|
|
});
|
|
this.trees[0].label = this.formData.wgpz_wgid;
|
|
this.sendTree();
|
|
// sessionStorage.setItem("DB-IotLite_wx", JSON.stringify(this.formData));
|
|
} else {
|
|
this.$message({
|
|
message: `保存失败,原因是${res.data.message}`,
|
|
type: "error",
|
|
});
|
|
}
|
|
console.log(res);
|
|
},
|
|
},
|
|
created() {
|
|
this.user_id = window.location.href.split("?")[1];
|
|
this.getTree();
|
|
this.loading = true;
|
|
this.GetUserAnswer();
|
|
this.loading = false;
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.tree_menu {
|
|
position: absolute;
|
|
width: 286px;
|
|
height: 753px;
|
|
left: 64px;
|
|
top: 104px;
|
|
width: 286px;
|
|
height: 753px;
|
|
line-height: 20px;
|
|
border-radius: 3px;
|
|
background-color: rgba(255, 255, 255, 1);
|
|
text-align: center;
|
|
border: 1px solid rgba(220, 220, 220, 1);
|
|
}
|
|
|
|
/deep/ .pas_params {
|
|
.el-button {
|
|
width: 80px;
|
|
height: 30px;
|
|
line-height: 0.5;
|
|
}
|
|
|
|
.el-col-12:last-child {
|
|
//padding-right: 150px;
|
|
}
|
|
|
|
.el-col-12:first-child {
|
|
padding-right: 54px;
|
|
}
|
|
|
|
// .el-form-item {
|
|
// margin-bottom: 0px;
|
|
// }
|
|
|
|
.el-row {
|
|
height: 50px;
|
|
display: flex;
|
|
align-items: flex-start;
|
|
|
|
.el-col-1 {
|
|
color: #fff;
|
|
text-align: center;
|
|
line-height: 52px;
|
|
height: 20px;
|
|
}
|
|
|
|
.el-col-9 {
|
|
padding-left: 30px;
|
|
}
|
|
}
|
|
|
|
.el-input__inner {
|
|
height: 30px;
|
|
text-align: left;
|
|
padding: 0px 8px;
|
|
}
|
|
|
|
.content {
|
|
position: absolute;
|
|
left: 377px;
|
|
top: 69px;
|
|
width: 1220px;
|
|
height: 836px;
|
|
line-height: 20px;
|
|
padding-left: 36px;
|
|
background-image: url(../assets/image/bg.png);
|
|
background-size: 100% 100%;
|
|
// background-color: rgba(255, 255, 255, 1);
|
|
color: rgba(16, 16, 16, 1);
|
|
font-size: 14px;
|
|
border: 1px solid rgba(187, 187, 187, 1);
|
|
display: flex;
|
|
justify-content: flex-start;
|
|
align-items: flex-start;
|
|
|
|
/deep/ .con_left {
|
|
.el-con-5 {
|
|
width: 43px;
|
|
}
|
|
|
|
.el-checkbox-group {
|
|
margin-top: -28px;
|
|
}
|
|
}
|
|
|
|
.con_left {
|
|
width: 708px;
|
|
height: 100%;
|
|
position: relative;
|
|
border-top: 1px solid rgba(187, 187, 187, 1);
|
|
border-right: 1px solid rgba(187, 187, 187, 1);
|
|
}
|
|
|
|
.con_right {
|
|
width: 480px;
|
|
|
|
.dialog-footer {
|
|
.el-button {
|
|
width: 80px;
|
|
height: 30px;
|
|
line-height: 0.5;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/deep/ .theme {
|
|
height: 80px !important;
|
|
display: flex;
|
|
align-items: flex-end !important;
|
|
|
|
.el-col:first-child {
|
|
.el-form-item__label {
|
|
float: none;
|
|
}
|
|
|
|
.el-form-item__content {
|
|
margin-left: 0px !important;
|
|
}
|
|
}
|
|
}
|
|
|
|
.con_left_footer {
|
|
position: absolute;
|
|
left: 499px;
|
|
top: 777px;
|
|
}
|
|
|
|
/deep/ .serveip {
|
|
.el-form-item__error {
|
|
padding-top: 0px !important;
|
|
line-height: 0px !important;
|
|
}
|
|
}
|
|
|
|
.mqtt {
|
|
margin-left: 20px;
|
|
}
|
|
|
|
// .el-col-24 {
|
|
// display: flex;
|
|
// align-items: center;
|
|
// }
|
|
|
|
.checkbox1 {
|
|
height: 20px;
|
|
display: inline-block;
|
|
line-height: 1 !important;
|
|
}
|
|
</style>
|