提交代码
This commit is contained in:
parent
622ad605ea
commit
f91f935d2f
|
@ -351,13 +351,13 @@ export default {
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
modelId: [
|
modelId: [
|
||||||
{ required: true, message: "所属型号不能为空", trigger: "blur" }
|
{ required: true, message: "所属型号不能为空", trigger: "change" }
|
||||||
],
|
],
|
||||||
deviceType: [
|
deviceType: [
|
||||||
{ required: true, message: "设备类型不能为空", trigger: "blur" }
|
{ required: true, message: "设备类型不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
parentId: [
|
parentId: [
|
||||||
{ required: true, message: "父设备不能为空", trigger: "blur" }
|
{ required: true, message: "父设备不能为空", trigger: "change" }
|
||||||
],
|
],
|
||||||
deviceName: [
|
deviceName: [
|
||||||
{ required: true, message: "设备名称不能为空", trigger: "blur" }
|
{ required: true, message: "设备名称不能为空", trigger: "blur" }
|
||||||
|
@ -455,16 +455,16 @@ export default {
|
||||||
size: "small",
|
size: "small",
|
||||||
value: "",
|
value: "",
|
||||||
options: [
|
options: [
|
||||||
{
|
// {
|
||||||
key: "IOTOS",
|
// key: "IOTOS",
|
||||||
label: "iot平台",
|
// label: "iot平台",
|
||||||
value: "IOTOS"
|
// value: "IOTOS"
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
key: "ONENET",
|
// key: "ONENET",
|
||||||
label: "ONENET",
|
// label: "ONENET",
|
||||||
value: "ONENET"
|
// value: "ONENET"
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
key: "OFFICIAL",
|
key: "OFFICIAL",
|
||||||
label: "官方平台",
|
label: "官方平台",
|
||||||
|
@ -558,7 +558,7 @@ export default {
|
||||||
deviceName: "",
|
deviceName: "",
|
||||||
modelId: "",
|
modelId: "",
|
||||||
parentId: 0,
|
parentId: 0,
|
||||||
deviceType: "GATEWAY_CONTROLLER"
|
deviceType: ""
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container page-iot-library">
|
||||||
<el-form
|
<el-form
|
||||||
:model="queryParams"
|
:model="queryParams"
|
||||||
ref="queryForm"
|
ref="queryForm"
|
||||||
|
@ -183,7 +183,7 @@
|
||||||
|
|
||||||
<!-- 添加或修改硬件数据库对话框 -->
|
<!-- 添加或修改硬件数据库对话框 -->
|
||||||
<div>
|
<div>
|
||||||
<dialog-template :title="title" :visible="open" @close="open = false" >
|
<dialog-template :title="title" :visible="open" @close="open = false">
|
||||||
<el-form
|
<el-form
|
||||||
ref="form"
|
ref="form"
|
||||||
:model="form"
|
:model="form"
|
||||||
|
@ -251,12 +251,7 @@
|
||||||
width="400px"
|
width="400px"
|
||||||
append-to-body
|
append-to-body
|
||||||
>
|
>
|
||||||
<el-form
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
ref="form"
|
|
||||||
:model="form"
|
|
||||||
:rules="rules"
|
|
||||||
label-width="80px"
|
|
||||||
>
|
|
||||||
<el-form-item label="批次" prop="batchId">
|
<el-form-item label="批次" prop="batchId">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="batchNumber"
|
v-model="batchNumber"
|
||||||
|
@ -320,7 +315,7 @@ import { listBatch } from "@/api/iot/batch";
|
||||||
import DialogTemplate from "@/components/DialogTemplate";
|
import DialogTemplate from "@/components/DialogTemplate";
|
||||||
import SelectTableWrap from "@/components/SelectTable/index";
|
import SelectTableWrap from "@/components/SelectTable/index";
|
||||||
import { getToken } from "@/utils/auth";
|
import { getToken } from "@/utils/auth";
|
||||||
import { downloadFile } from '@/utils/hciot'
|
import { downloadFile } from "@/utils/hciot";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Library",
|
name: "Library",
|
||||||
|
@ -420,7 +415,9 @@ export default {
|
||||||
this.upload.open = false;
|
this.upload.open = false;
|
||||||
this.upload.isUploading = false;
|
this.upload.isUploading = false;
|
||||||
this.$refs.upload.clearFiles();
|
this.$refs.upload.clearFiles();
|
||||||
this.$alert(response.msg || '导入失败,格式不正确!', "导入结果", { dangerouslyUseHTMLString: true });
|
this.$alert(response.msg || "导入失败,格式不正确!", "导入结果", {
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
});
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
// 提交上传文件
|
// 提交上传文件
|
||||||
|
@ -441,9 +438,9 @@ export default {
|
||||||
handleImport() {
|
handleImport() {
|
||||||
this.upload.title = "批量导入硬件";
|
this.upload.title = "批量导入硬件";
|
||||||
this.form = {
|
this.form = {
|
||||||
batchId: ''
|
batchId: "",
|
||||||
}
|
};
|
||||||
this.batchNumber = ''
|
this.batchNumber = "";
|
||||||
this.upload.open = true;
|
this.upload.open = true;
|
||||||
},
|
},
|
||||||
indexFormatter(val) {
|
indexFormatter(val) {
|
||||||
|
@ -613,7 +610,7 @@ export default {
|
||||||
uId: null,
|
uId: null,
|
||||||
batchId: null,
|
batchId: null,
|
||||||
};
|
};
|
||||||
this.batchNumber = ''
|
this.batchNumber = "";
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
|
@ -696,7 +693,7 @@ export default {
|
||||||
return exportLibraryCsv(queryParams);
|
return exportLibraryCsv(queryParams);
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
downloadFile(response, '硬件设备数据.csv');
|
downloadFile(response, "硬件设备数据.csv");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
|
@ -717,3 +714,9 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss" >
|
||||||
|
.el-message-box__message {
|
||||||
|
max-height: 60vh;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -105,7 +105,7 @@
|
||||||
width="200px"
|
width="200px"
|
||||||
prop="prodKey"
|
prop="prodKey"
|
||||||
/>
|
/>
|
||||||
<el-table-column label="产品密钥" align="left" prop="prodSecret" >
|
<el-table-column label="产品密钥" align="left" prop="prodSecret">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span class="lay-table-textarea" :title="scope.row.prodSecret">
|
<span class="lay-table-textarea" :title="scope.row.prodSecret">
|
||||||
{{ scope.row.prodSecret }}
|
{{ scope.row.prodSecret }}
|
||||||
|
@ -339,31 +339,47 @@
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<dialog-template :title="componentTitle" @close="() => {AttributeViewShow = false}" :visible="AttributeViewShow" width="750px">
|
<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>
|
||||||
|
|
||||||
<component
|
<div slot="dialog-footer">
|
||||||
v-if="AttributeViewShow"
|
<el-button type="primary" size="mini" @click="submitAttribute"
|
||||||
:is="componectVal"
|
>确 定</el-button
|
||||||
:tempType="childOpt.type"
|
>
|
||||||
:paramIdx="childOpt.paramIdx"
|
<el-button
|
||||||
:other="{
|
size="mini"
|
||||||
action: '',
|
@click="
|
||||||
prodPK: form.prodKey,
|
() => {
|
||||||
cmdKey: '',
|
AttributeViewShow = false;
|
||||||
}"
|
}
|
||||||
:paramsList="functionList"
|
"
|
||||||
ref="componentref"
|
>取 消</el-button
|
||||||
@ok="compEventOk"
|
>
|
||||||
slot="dialog-center"
|
</div>
|
||||||
></component>
|
</dialog-template>
|
||||||
|
|
||||||
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -388,17 +404,13 @@ import DialogTemplate from "@/components/DialogTemplate";
|
||||||
|
|
||||||
import attributeForm from "@/views/profile/attribute/attributeForm";
|
import attributeForm from "@/views/profile/attribute/attributeForm";
|
||||||
import groupForm from "@/views/profile/attribute/groupForm";
|
import groupForm from "@/views/profile/attribute/groupForm";
|
||||||
import paramsJson from "@/views/profile/attribute/paramsJson"
|
import paramsJson from "@/views/profile/attribute/paramsJson";
|
||||||
|
|
||||||
const deviceStartsOpt = {
|
const deviceStartsOpt = {
|
||||||
0: "禁用",
|
0: "禁用",
|
||||||
1: "启用",
|
1: "启用",
|
||||||
};
|
};
|
||||||
|
|
||||||
// const protocolTypeOpt = {
|
|
||||||
// IOTOS: "iot平台",
|
|
||||||
// ONENET: "ONENET"
|
|
||||||
// };
|
|
||||||
export default {
|
export default {
|
||||||
name: "Model",
|
name: "Model",
|
||||||
components: {
|
components: {
|
||||||
|
@ -408,16 +420,16 @@ export default {
|
||||||
DialogTemplate,
|
DialogTemplate,
|
||||||
attributeForm,
|
attributeForm,
|
||||||
groupForm,
|
groupForm,
|
||||||
paramsJson
|
paramsJson,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
componectVal: 'attributeForm',
|
componectVal: "attributeForm",
|
||||||
childOpt: {
|
childOpt: {
|
||||||
type: 'add',
|
type: "add",
|
||||||
paramIdx: 0
|
paramIdx: 0,
|
||||||
},
|
},
|
||||||
protocolTypeOpt: [],
|
protocolTypeOpt: {},
|
||||||
AttributeViewShow: false,
|
AttributeViewShow: false,
|
||||||
AttributeFormViewShow: false,
|
AttributeFormViewShow: false,
|
||||||
selectTableShow: false,
|
selectTableShow: false,
|
||||||
|
@ -474,6 +486,7 @@ export default {
|
||||||
},
|
},
|
||||||
functionList: [],
|
functionList: [],
|
||||||
deviceTypeList: {},
|
deviceTypeList: {},
|
||||||
|
componentTitle: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -483,28 +496,30 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleViewEvent(data) {
|
handleViewEvent(data) {
|
||||||
console.log(data)
|
console.log(data);
|
||||||
this.componentTitle = data.title
|
this.componentTitle = data.title;
|
||||||
this.childOpt.type = data.type,
|
(this.childOpt.type = data.type),
|
||||||
this.childOpt.paramIdx = data.paramIdx
|
(this.childOpt.paramIdx = data.paramIdx);
|
||||||
this.AttributeViewShow = true
|
this.AttributeViewShow = true;
|
||||||
this.functionList = JSON.parse(JSON.stringify(this.$store.getters.attributeList))
|
this.functionList = JSON.parse(
|
||||||
|
JSON.stringify(this.$store.getters.attributeList)
|
||||||
|
);
|
||||||
this.componectVal = data.component;
|
this.componectVal = data.component;
|
||||||
},
|
},
|
||||||
submitAttribute() {
|
submitAttribute() {
|
||||||
if (this.childOpt.type === 'param') {
|
if (this.childOpt.type === "param") {
|
||||||
this.AttributeViewShow = false
|
this.AttributeViewShow = false;
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
if (this.$refs.componentref) {
|
if (this.$refs.componentref) {
|
||||||
this.$refs.componentref.submitForm()
|
this.$refs.componentref.submitForm();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
compEventOk() {
|
compEventOk() {
|
||||||
//执行
|
//执行
|
||||||
this.AttributeViewShow = false
|
this.AttributeViewShow = false;
|
||||||
this.$forceUpdate()
|
this.$forceUpdate();
|
||||||
this.$refs.attributeref.forceUpdate(this.componectVal)
|
this.$refs.attributeref.forceUpdate(this.componectVal);
|
||||||
},
|
},
|
||||||
getModelTypeList() {
|
getModelTypeList() {
|
||||||
listModelType().then((res) => {
|
listModelType().then((res) => {
|
||||||
|
@ -548,8 +563,7 @@ export default {
|
||||||
total: 0,
|
total: 0,
|
||||||
},
|
},
|
||||||
inline: true,
|
inline: true,
|
||||||
queryChilds: [
|
queryChilds: [],
|
||||||
],
|
|
||||||
},
|
},
|
||||||
tableOpt: {
|
tableOpt: {
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@ -766,7 +780,7 @@ export default {
|
||||||
prodKey: "",
|
prodKey: "",
|
||||||
deviceType: "",
|
deviceType: "",
|
||||||
paramList: [],
|
paramList: [],
|
||||||
protocolType: "IOTOS",
|
protocolType: "OFFICIAL",
|
||||||
prodJson: "",
|
prodJson: "",
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
|
@ -811,17 +825,29 @@ export default {
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate((valid) => {
|
this.$refs["form"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if(this.form.protocolType === 'OFFICIAL') {
|
if (this.form.protocolType === "OFFICIAL") {
|
||||||
let attrList = this.$store.getters.attributeList.map(v => {
|
let attrList = [];
|
||||||
v['sourceId'] = this.form.prodKey
|
if (
|
||||||
return v
|
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 = this.$store.getters.groupList.map(v => {
|
let groupList = [];
|
||||||
v['sourceId'] = this.form.prodKey
|
if (
|
||||||
return v
|
this.$store.getters.groupList &&
|
||||||
});
|
this.$store.getters.groupList.length > 0
|
||||||
console.log(groupList, attrList)
|
) {
|
||||||
|
groupList = this.$store.getters.groupList.map((v) => {
|
||||||
|
v["sourceId"] = this.form.prodKey;
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
console.log(groupList, attrList);
|
||||||
this.form.prodJson = JSON.stringify(attrList) || null;
|
this.form.prodJson = JSON.stringify(attrList) || null;
|
||||||
this.form.remark = JSON.stringify(groupList) || null;
|
this.form.remark = JSON.stringify(groupList) || null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,6 +275,7 @@ export default {
|
||||||
isFrame: "1",
|
isFrame: "1",
|
||||||
visible: "0",
|
visible: "0",
|
||||||
status: "0",
|
status: "0",
|
||||||
|
dataType: '1',
|
||||||
tenantId: this.tenantId
|
tenantId: this.tenantId
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
|
|
Loading…
Reference in New Issue