(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-f6ae6470","chunk-4f9f43f7","chunk-823020a0","chunk-2d0a3715"],{"01ca":function(e,t,a){"use strict";a.d(t,"f",(function(){return s})),a.d(t,"d",(function(){return o})),a.d(t,"a",(function(){return i})),a.d(t,"e",(function(){return l})),a.d(t,"g",(function(){return n})),a.d(t,"c",(function(){return p})),a.d(t,"b",(function(){return c}));var r=a("b775");function s(e){return Object(r["a"])({url:"/iot/model/list",method:"get",params:e})}function o(e){return Object(r["a"])({url:"/iot/model/"+e,method:"get"})}function i(e){return Object(r["a"])({url:"/iot/model",method:"post",data:e})}function l(e){return Object(r["a"])({url:"/iot/model/import",method:"post",data:e})}function n(e){return Object(r["a"])({url:"/iot/model",method:"put",data:e})}function p(e){return Object(r["a"])({url:"/iot/model/"+e,method:"delete"})}function c(e){return Object(r["a"])({url:"/iot/model/cache/"+e,method:"get"})}},"09a1":function(e,t,a){"use strict";a.r(t);var r=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticStyle:{padding:"6px"}},[a("el-dialog",{attrs:{title:"编辑参数",visible:e.openEdit,width:"880px","append-to-body":""},on:{"update:visible":function(t){e.openEdit=t}}},[a("div",{staticStyle:{margin:"-30px 0 30px","background-color":"#ddd",height:"1px"}}),a("el-row",[a("el-col",{staticStyle:{border:"1px solid #ddd","border-radius":"5px",padding:"10px","background-color":"#eee"},attrs:{span:12}},[a("el-form",{attrs:{model:e.queryParams,inline:!0,"label-width":"48px",size:"small"}},[a("el-form-item",{attrs:{label:"",prop:"templateName"}},[a("el-input",{staticStyle:{width:"160px"},attrs:{placeholder:"请输入物模型名称",clearable:"",size:"mini"},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleQuery(t)}},model:{value:e.queryParams.templateName,callback:function(t){e.$set(e.queryParams,"templateName",t)},expression:"queryParams.templateName"}})],1),a("el-form-item",[a("el-button",{staticStyle:{padding:"5px"},attrs:{type:"info",icon:"el-icon-search",size:"mini"},on:{click:e.handleQuery}},[e._v("搜索")])],1),a("el-form-item",[a("el-link",{staticStyle:{"margin-left":"20px"},attrs:{underline:!1,icon:"el-icon-info",type:"primary"}},[e._v("单击应用模板")])],1)],1),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],attrs:{data:e.templateList,size:"mini","highlight-current-row":"",border:!1,"show-header":!1,"row-style":{backgroundColor:"#eee"}},on:{"row-click":e.rowClick}},[a("el-table-column",{attrs:{label:"选择",width:"30",align:"center"},scopedSlots:e._u([{key:"default",fn:function(e){return[a("input",{attrs:{type:"radio",disabled:"array"==e.row.datatype||"object"==e.row.datatype,name:"template"},domProps:{checked:e.row.isSelect}})]}}])}),a("el-table-column",{attrs:{label:"名称",align:"left",prop:"templateName"}}),a("el-table-column",{attrs:{label:"标识符",align:"left",prop:"identifier"}}),a("el-table-column",{attrs:{label:"数据类型",align:"center",prop:"datatype",width:"60"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("dict-tag",{attrs:{options:e.dict.type.iot_data_type,value:t.row.datatype}})]}}])})],1),a("pagination",{directives:[{name:"show",rawName:"v-show",value:e.total>0,expression:"total > 0"}],staticStyle:{margin:"0 0 10px","background-color":"#eee"},attrs:{small:"",layout:"prev, pager, next",total:e.total,page:e.queryParams.pageNum,limit:e.queryParams.pageSize},on:{"update:page":function(t){return e.$set(e.queryParams,"pageNum",t)},"update:limit":function(t){return e.$set(e.queryParams,"pageSize",t)},pagination:e.getList}})],1),a("el-col",{attrs:{span:11,offset:1}},[a("el-form",{ref:"form",attrs:{model:e.form,rules:e.rules,"label-width":"80px"}},[a("el-form-item",{attrs:{label:"参数名称",prop:"name"}},[a("el-input",{staticStyle:{width:"270px"},attrs:{placeholder:"例如:温度",size:"small"},model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1),a("el-form-item",{attrs:{label:"参数标识",prop:"id"}},[a("el-input",{staticStyle:{width:"270px"},attrs:{placeholder:"例如:temperature",size:"small"},model:{value:e.form.id,callback:function(t){e.$set(e.form,"id",t)},expression:"form.id"}})],1),a("el-form-item",{attrs:{label:"参数排序",prop:"order"}},[a("el-input-number",{staticStyle:{width:"270px"},attrs:{"controls-position":"right",placeholder:"请输入排序",type:"number",size:"small"},model:{value:e.form.order,callback:function(t){e.$set(e.form,"order",t)},expression:"form.order"}})],1),a("el-row",[a("el-col",{attrs:{span:7}},[a("el-form-item",{attrs:{label:"只读数据",prop:"isReadonly"}},[a("el-switch",{attrs:{"active-text":"","inactive-text":"","active-value":1,"inactive-value":0},model:{value:e.form.isReadonly,callback:function(t){e.$set(e.form,"isReadonly",t)},expression:"form.isReadonly"}})],1)],1),a("el-col",{attrs:{span:7}},[a("el-form-item",{attrs:{label:"图表",prop:"isMonitor"}},[a("el-switch",{attrs:{"active-text":"","inactive-text":"","active-value":1,"inactive-value":0},on:{change:function(t){return e.changeMonitor(e.form.isMonitor)}},model:{value:e.form.isMonitor,callback:function(t){e.$set(e.form,"isMonitor",t)},expression:"form.isMonitor"}})],1)],1)],1),a("div",{staticStyle:{"margin-bottom":"20px","background-color":"#ddd",height:"1px"}}),a("el-form-item",{attrs:{label:"数据类型",prop:"datatype"}},[a("el-select",{staticStyle:{width:"125px"},attrs:{placeholder:"请选择数据类型",size:"small"},model:{value:e.form.datatype,callback:function(t){e.$set(e.form,"datatype",t)},expression:"form.datatype"}},[a("el-option",{key:"integer",attrs:{label:"整数",value:"integer"}}),a("el-option",{key:"decimal",attrs:{label:"小数",value:"decimal"}}),a("el-option",{key:"bool",attrs:{label:"布尔",value:"bool",disabled:1==e.form.isMonitor}}),a("el-option",{key:"enum",attrs:{label:"枚举",value:"enum",disabled:1==e.form.isMonitor}}),a("el-option",{key:"string",attrs:{label:"字符串",value:"string",disabled:1==e.form.isMonitor}})],1)],1),"integer"==e.form.datatype||"decimal"==e.form.datatype?a("div",[a("el-form-item",{attrs:{label:"取值范围"}},[a("el-row",[a("el-col",{attrs:{span:10}},[a("el-input",{attrs:{placeholder:"最小值",type:"number",size:"small"},model:{value:e.form.specs.min,callback:function(t){e.$set(e.form.specs,"min",t)},expression:"form.specs.min"}})],1),a("el-col",{attrs:{span:4,align:"center"}},[e._v("到")]),a("el-col",{attrs:{span:10}},[a("el-input",{attrs:{placeholder:"最大值",type:"number",size:"small"},model:{value:e.form.specs.max,callback:function(t){e.$set(e.form.specs,"max",t)},expression:"form.specs.max"}})],1)],1)],1),a("el-form-item",{attrs:{label:"单位"}},[a("el-input",{staticStyle:{width:"308px"},attrs:{placeholder:"例如:℃",size:"small"},model:{value:e.form.specs.unit,callback:function(t){e.$set(e.form.specs,"unit",t)},expression:"form.specs.unit"}})],1),a("el-form-item",{attrs:{label:"步长"}},[a("el-input-number",{staticStyle:{width:"308px"},attrs:{"controls-position":"right",placeholder:"例如:1",type:"number",size:"small"},model:{value:e.form.specs.step,callback:function(t){e.$set(e.form.specs,"step",t)},expression:"form.specs.step"}})],1)],1):e._e(),"bool"==e.form.datatype?a("div",[a("el-form-item",{attrs:{label:"布尔值",prop:""}},[a("el-row",{staticStyle:{"margin-bottom":"10px"}},[a("el-col",{attrs:{span:10}},[a("el-input",{attrs:{placeholder:"例如:关闭",size:"small"},model:{value:e.form.specs.falseText,callback:function(t){e.$set(e.form.specs,"falseText",t)},expression:"form.specs.falseText"}})],1),a("el-col",{attrs:{span:10,offset:1}},[e._v(" (0 值对应文本)")])],1),a("el-row",[a("el-col",{attrs:{span:10}},[a("el-input",{attrs:{placeholder:"例如:打开",size:"small"},model:{value:e.form.specs.trueText,callback:function(t){e.$set(e.form.specs,"trueText",t)},expression:"form.specs.trueText"}})],1),a("el-col",{attrs:{span:10,offset:1}},[e._v(" (1 值对应文本)")])],1)],1)],1):e._e(),"enum"==e.form.datatype?a("div",[a("el-form-item",{attrs:{label:"枚举项",prop:""}},[e._l(e.form.specs.enumList,(function(t,r){return a("el-row",{key:"enum"+r,staticStyle:{"margin-bottom":"10px"}},[a("el-col",{attrs:{span:8}},[a("el-input",{attrs:{placeholder:"例如:0",type:"number",size:"small"},model:{value:t.value,callback:function(a){e.$set(t,"value",a)},expression:"item.value"}})],1),a("el-col",{attrs:{span:11,offset:1}},[a("el-input",{attrs:{placeholder:"例如:中速挡位",size:"small"},model:{value:t.text,callback:function(a){e.$set(t,"text",a)},expression:"item.text"}})],1),0!=r?a("el-col",{attrs:{span:3,offset:1}},[a("a",{staticStyle:{color:"#F56C6C"},on:{click:function(t){return e.removeEnumItem(r)}}},[e._v("删除")])]):e._e()],1)})),a("div",[e._v("+ "),a("a",{staticStyle:{color:"#409EFF"},on:{click:function(t){return e.addEnumItem()}}},[e._v("添加枚举项")])])],2)],1):e._e(),"string"==e.form.datatype?a("div",[a("el-form-item",{attrs:{label:"最大长度",prop:""}},[a("el-row",[a("el-col",{attrs:{span:10}},[a("el-input",{attrs:{placeholder:"例如:1024",type:"number",size:"small"},model:{value:e.form.specs.maxLength,callback:function(t){e.$set(e.form.specs,"maxLength",t)},expression:"form.specs.maxLength"}})],1)],1)],1)],1):e._e()],1)],1)],1),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"primary"},on:{click:e.submitForm}},[e._v("确 定")]),a("el-button",{on:{click:e.cancel}},[e._v("取 消")])],1)],1)],1)},s=[],o=(a("b0c0"),a("e9c4"),a("a9e3"),a("a434"),a("cec4")),i={name:"things_parameter",dicts:["iot_things_type","iot_data_type","iot_yes_no"],props:{data:{type:Object,default:null}},watch:{data:function(e,t){this.index=e.index,e&&e.parameter.name&&""!=e.parameter.name&&(this.form.name=e.parameter.name,this.form.id=e.parameter.id,this.form.order=e.parameter.order,this.form.isTop=e.parameter.isTop,this.form.isMonitor=e.parameter.isMonitor,this.form.isReadonly=e.parameter.isReadonly,this.form.specs=e.parameter.datatype,this.form.datatype=this.form.specs.type,this.form.specs.enumList||(this.form.specs.enumList=[{value:"",text:""}]),this.form.specs.arrayType||(this.form.specs.arrayType="int")),this.openEdit=!0,this.getList()}},data:function(){return{loading:!0,total:0,templateList:[],openEdit:!1,queryParams:{pageNum:1,pageSize:10,name:null,type:null},index:-1,form:{},rules:{name:[{required:!0,message:"参数名称不能为空",trigger:"blur"}],id:[{required:!0,message:"参数标识符不能为空",trigger:"blur"}],order:[{required:!0,message:"模型排序不能为空",trigger:"blur"}],datatype:[{required:!0,message:"数据类型不能为空",trigger:"change"}]}}},created:function(){this.getList(),this.reset()},methods:{getList:function(){var e=this;this.loading=!0,Object(o["d"])(this.queryParams).then((function(t){e.templateList=t.rows,e.total=t.total,e.setRadioSelected(e.productId),e.loading=!1}))},rowClick:function(e){null!=e&&"array"!=e.datatype&&"object"!=e.datatype&&(this.form.name=e.templateName,this.form.id=e.identifier,this.form.order=e.modelOrder,this.form.isTop=e.isTop,this.form.isReadonly=e.isReadonly,this.form.isMonitor=e.isMonitor,this.form.datatype=e.datatype,this.form.specs=JSON.parse(e.specs),this.form.specs.enumList||(this.form.specs.enumList=[{value:"",text:""}]),this.form.specs.arrayType||(this.form.specs.arrayType="int"),this.setRadioSelected(e.templateId))},setRadioSelected:function(e){for(var t=0;t0){var t={productId:this.productInfo.productId,productName:this.productInfo.productName,templateIds:this.templateIds};Object(c["e"])(t).then((function(t){e.$modal.msgSuccess(t.msg),e.openSelect=!1,e.$refs.productSelectTemplate.$refs.selectTemplateTable.clearSelection(),e.getList()}))}},submitForm:function(){var e=this;this.$refs["form"].validate((function(t){if(t){if(("object"==e.form.datatype||"array"==e.form.datatype&&"object"==e.form.specs.arrayType)&&(!e.form.specs.params||0==e.form.specs.params))return void e.$modal.msgError("对象的参数不能为空");if(e.form.specs.params&&e.form.specs.params.length>0)for(var a=e.form.specs.params.map((function(e){return e.id})).sort(),r=0;r最大值:"+t.max+'最小值:'+t.min+"
步长:"+t.step+'单位:'+t.unit;if("string"===t.type)return'最大长度:'+t.maxLength+"";if("array"===t.type)return"数组类型:"+t.arrayType+'元素个数:'+t.arrayCount;if("enum"===t.type){for(var a="",r=0;r"+t.enumList[r].value+":"+t.enumList[r].text+"",r>0&&r%2!=0&&(a+="
");return a}if("bool"===t.type)return"0:"+t.falseText+'1:'+t.trueText;if("object"===t.type){for(var s="",o=0;o"+t.params[o].name+":"+t.params[o].datatype.type+"",o>0&&o%2!=0&&(s+="
");return s}},addParameter:function(){this.paramData={index:-1,parameter:{}}},editParameter:function(e,t){this.paramData=null,this.paramData={index:t,parameter:e}},removeParameter:function(e){this.form.specs.params.splice(e,1)},getParamData:function(e){-1==e.index?this.form.specs.params.push(e.parameter):(this.form.specs.params[e.index]=e.parameter,this.$set(this.form.specs.params,e.index,this.form.specs.params[e.index]))}}},d=m,u=(a("55f2"),a("2877")),f=Object(u["a"])(d,r,s,!1,null,null,null);t["default"]=f.exports},"55f2":function(e,t,a){"use strict";a("7084")},7084:function(e,t,a){},cec4:function(e,t,a){"use strict";a.d(t,"d",(function(){return s})),a.d(t,"c",(function(){return o})),a.d(t,"a",(function(){return i})),a.d(t,"e",(function(){return l})),a.d(t,"b",(function(){return n}));var r=a("b775");function s(e){return Object(r["a"])({url:"/iot/template/list",method:"get",params:e})}function o(e){return Object(r["a"])({url:"/iot/template/"+e,method:"get"})}function i(e){return Object(r["a"])({url:"/iot/template",method:"post",data:e})}function l(e){return Object(r["a"])({url:"/iot/template",method:"put",data:e})}function n(e){return Object(r["a"])({url:"/iot/template/"+e,method:"delete"})}},dbf4:function(e,t,a){"use strict";a.r(t);var r=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticStyle:{"margin-top":"-50px"}},[a("el-divider"),a("el-form",{ref:"product-select-template",attrs:{model:e.queryParams,inline:!0,"label-width":"48px"}},[a("el-form-item",{attrs:{label:"名称",prop:"templateName"}},[a("el-input",{attrs:{placeholder:"请输入物模型名称",clearable:"",size:"small"},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleQuery(t)}},model:{value:e.queryParams.templateName,callback:function(t){e.$set(e.queryParams,"templateName",t)},expression:"queryParams.templateName"}})],1),a("el-form-item",{attrs:{label:"类别",prop:"type"}},[a("el-select",{attrs:{placeholder:"请选择模型类别",clearable:"",size:"small"},model:{value:e.queryParams.type,callback:function(t){e.$set(e.queryParams,"type",t)},expression:"queryParams.type"}},e._l(e.dict.type.iot_things_type,(function(e){return a("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-search",size:"mini"},on:{click:e.handleQuery}},[e._v("搜索")]),a("el-button",{attrs:{icon:"el-icon-refresh",size:"mini"},on:{click:e.resetQuery}},[e._v("重置")])],1)],1),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],ref:"selectTemplateTable",attrs:{data:e.templateList,size:"small"},on:{"selection-change":e.handleSelectionChange}},[a("el-table-column",{attrs:{type:"selection",width:"55",align:"center"}}),a("el-table-column",{attrs:{label:"名称",align:"center",prop:"templateName"}}),a("el-table-column",{attrs:{label:"标识符",align:"center",prop:"identifier"}}),a("el-table-column",{attrs:{label:"物模型类别",align:"center",prop:"type"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("dict-tag",{attrs:{options:e.dict.type.iot_things_type,value:t.row.type}})]}}])}),a("el-table-column",{attrs:{label:"监测值",align:"center",prop:"isMonitor"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("dict-tag",{attrs:{options:e.dict.type.iot_yes_no,value:t.row.isMonitor}})]}}])}),a("el-table-column",{attrs:{label:"数据类型",align:"center",prop:"datatype"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("dict-tag",{attrs:{options:e.dict.type.iot_data_type,value:t.row.datatype}})]}}])})],1),a("pagination",{directives:[{name:"show",rawName:"v-show",value:e.total>0,expression:"total > 0"}],attrs:{total:e.total,page:e.queryParams.pageNum,limit:e.queryParams.pageSize},on:{"update:page":function(t){return e.$set(e.queryParams,"pageNum",t)},"update:limit":function(t){return e.$set(e.queryParams,"pageSize",t)},pagination:e.getList}})],1)},s=[],o=(a("d81d"),a("cec4")),i={name:"product-select-template",dicts:["iot_things_type","iot_data_type","iot_yes_no"],data:function(){return{ids:[],single:!0,multiple:!0,total:0,templateList:[],queryParams:{pageNum:1,pageSize:10,templateName:null,type:null}}},created:function(){this.getList(),this.ids=[]},methods:{getList:function(){var e=this;this.loading=!0,Object(o["d"])(this.queryParams).then((function(t){e.templateList=t.rows,e.total=t.total,e.loading=!1}))},handleQuery:function(){this.queryParams.pageNum=1,this.getList()},resetQuery:function(){this.resetForm("queryForm"),this.handleQuery()},handleSelectionChange:function(e){this.ids=e.map((function(e){return e.templateId})),this.single=1!==e.length,this.multiple=!e.length,this.$emit("idsToParentEvent",this.ids)}}},l=i,n=a("2877"),p=Object(n["a"])(l,r,s,!1,null,null,null);t["default"]=p.exports}}]);