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