FastBee/docker/data/nginx/vue/static/js/chunk-24a25d1e.767348b3.js
2025-07-07 09:21:15 +08:00

1 line
50 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-24a25d1e","chunk-09e59946","chunk-823020a0"],{"01ca":function(e,t,a){"use strict";a.d(t,"f",(function(){return s})),a.d(t,"d",(function(){return o})),a.d(t,"g",(function(){return i})),a.d(t,"a",(function(){return l})),a.d(t,"e",(function(){return n})),a.d(t,"i",(function(){return m})),a.d(t,"c",(function(){return c})),a.d(t,"b",(function(){return p})),a.d(t,"h",(function(){return d}));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/permList/"+e,method:"get"})}function l(e){return Object(r["a"])({url:"/iot/model",method:"post",data:e})}function n(e){return Object(r["a"])({url:"/iot/model/import",method:"post",data:e})}function m(e){return Object(r["a"])({url:"/iot/model",method:"put",data:e})}function c(e){return Object(r["a"])({url:"/iot/model/"+e,method:"delete"})}function p(e){return Object(r["a"])({url:"/iot/model/cache/"+e,method:"get"})}function d(e){return Object(r["a"])({url:"/iot/model/synchron",method:"post",data:e})}},"0581":function(e,t,a){},"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:"900px","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-form-item",{attrs:{label:"参数特性",prop:"property"}},[a("el-checkbox",{attrs:{name:"isChart",label:"图表展示","true-label":1,"false-label":0},on:{change:e.isChartChange},model:{value:e.form.isChart,callback:function(t){e.$set(e.form,"isChart",t)},expression:"form.isChart"}}),a("el-checkbox",{attrs:{name:"isMonitor",label:"实时监测","true-label":1,"false-label":0},on:{change:e.isMonitorChange},model:{value:e.form.isMonitor,callback:function(t){e.$set(e.form,"isMonitor",t)},expression:"form.isMonitor"}}),a("el-checkbox",{attrs:{name:"isReadonly",label:"只读数据","true-label":1,"false-label":0},on:{change:e.isReadonlyChange},model:{value:e.form.isReadonly,callback:function(t){e.$set(e.form,"isReadonly",t)},expression:"form.isReadonly"}}),a("el-checkbox",{attrs:{name:"isHistory",label:"历史存储","true-label":1,"false-label":0},model:{value:e.form.isHistory,callback:function(t){e.$set(e.form,"isHistory",t)},expression:"form.isHistory"}}),a("el-checkbox",{attrs:{name:"isSharePerm",label:"分享权限","true-label":1,"false-label":0},model:{value:e.form.isSharePerm,callback:function(t){e.$set(e.form,"isSharePerm",t)},expression:"form.isSharePerm"}})],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.isChart}}),a("el-option",{key:"enum",attrs:{label:"枚举",value:"enum",disabled:1==e.form.isChart}}),a("el-option",{key:"string",attrs:{label:"字符串",value:"string",disabled:1==e.form.isChart}})],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:"展示方式"}},[a("el-select",{staticStyle:{width:"175px"},attrs:{placeholder:"请选择展示方式"},model:{value:e.form.specs.showWay,callback:function(t){e.$set(e.form.specs,"showWay",t)},expression:"form.specs.showWay"}},[a("el-option",{key:"select",attrs:{label:"下拉框",value:"select"}}),a("el-option",{key:"button",attrs:{label:"按钮",value:"button"}})],1)],1),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",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("14d9"),a("a434"),a("b0c0"),a("e9c4"),a("a9e3"),a("b64b"),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.isChart=e.parameter.isChart?e.parameter.isChart:0,this.form.isHistory=e.parameter.isHistory?e.parameter.isHistory:1,this.form.isSharePerm=e.parameter.isSharePerm?e.parameter.isSharePerm:0,this.form.isMonitor=e.parameter.isMonitor?e.parameter.isMonitor:0,this.form.isReadonly=e.parameter.isReadonly?e.parameter.isReadonly:0,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="integer")),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["e"])(this.queryParams).then((function(t){for(var a=0;a<t.rows.length;a++)t.rows[a].isSelect=!1;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.isChart=e.isChart?e.isChart:0,this.form.isHistory=e.isHistory?e.isHistory:1,this.form.isSharePerm=e.isSharePerm?e.isSharePerm:0,this.form.isReadonly=e.isReadonly?e.isReadonly:0,this.form.isMonitor=e.isMonitor?e.isMonitor:0,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="integer"),this.setRadioSelected(e.templateId))},setRadioSelected:function(e){for(var t=0;t<this.templateList.length;t++)this.templateList[t].templateId==e?this.templateList[t].isSelect=!0:this.templateList[t].isSelect=!1},cancel:function(){this.openEdit=!1,this.reset()},reset:function(){this.index=-1,this.form={name:null,id:null,order:0,datatype:"integer",isChart:0,isHistory:1,isSharePerm:0,isMonitor:0,isReadonly:0,specs:{enumList:[{value:"",text:""}],showWay:"select"}},this.resetForm("form")},handleQuery:function(){this.queryParams.pageNum=1,this.getList()},submitForm:function(){var e=this;this.$refs["form"].validate((function(t){if(t){e.form.datatype=e.formatThingsSpecs(),delete e.form.specs,e.openEdit=!1;var a={parameter:JSON.parse(JSON.stringify(e.form)),index:e.index};console.log("data",a),e.$emit("dataEvent",a),e.reset()}}))},isChartChange:function(){1==this.form.isChart?this.form.isReadonly=1:this.form.isMonitor=0},isMonitorChange:function(){1==this.form.isMonitor&&(this.form.isReadonly=1,this.form.isChart=1)},isReadonlyChange:function(){0==this.form.isReadonly&&(this.form.isMonitor=0,this.form.isChart=0)},formatThingsSpecs:function(){var e={};return e.type=this.form.datatype,"integer"==this.form.datatype||"decimal"==this.form.datatype?(e.min=Number(this.form.specs.min?this.form.specs.min:0),e.max=Number(this.form.specs.max?this.form.specs.max:100),e.unit=this.form.specs.unit?this.form.specs.unit:"",e.step=Number(this.form.specs.step?this.form.specs.step:1)):"string"==this.form.datatype?e.maxLength=Number(this.form.specs.maxLength?this.form.specs.maxLength:1024):"bool"==this.form.datatype?(e.falseText=this.form.specs.falseText?this.form.specs.falseText:"关闭",e.trueText=this.form.specs.trueText?this.form.specs.trueText:"打开"):"array"==this.form.datatype?e.arrayType=this.form.specs.arrayType:"enum"==this.form.datatype&&(e.showWay=this.form.specs.showWay,this.form.specs.enumList&&""!=this.form.specs.enumList[0].text?e.enumList=this.form.specs.enumList:(e.showWay="select",e.enumList=[{value:"0",text:"低"},{value:"1",text:"高"}])),e},addEnumItem:function(){this.form.specs.enumList.push({value:"",text:""})},removeEnumItem:function(e){this.form.specs.enumList.splice(e,1)}}},l=i,n=(a("4df4f"),a("2877")),m=Object(n["a"])(l,r,s,!1,null,null,null);t["default"]=m.exports},"2d31":function(e,t,a){"use strict";a("0581")},"416d":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-left":"20px"}},[a("el-row",{staticClass:"mb8",attrs:{gutter:10}},[a("el-col",{attrs:{span:1.5}},[1==e.productInfo.status&&0!=e.productInfo.isOwner?a("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:model:add"],expression:"['iot:model:add']"}],attrs:{type:"primary",plain:"",icon:"el-icon-plus",size:"mini"},on:{click:e.handleAdd}},[e._v("新增")]):e._e()],1),a("el-col",{attrs:{span:1.5}},[1==e.productInfo.status&&0!=e.productInfo.isOwner?a("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:model:import"],expression:"['iot:model:import']"}],attrs:{type:"success",plain:"",icon:"el-icon-upload2",size:"mini"},on:{click:e.handleSelect}},[e._v("导入通用物模型")]):e._e()],1),a("el-col",{attrs:{span:1.5}},[a("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:model:list"],expression:"['iot:model:list']"}],attrs:{type:"warning",plain:"",icon:"el-icon-refresh",size:"mini"},on:{click:e.getList}},[e._v("刷新")])],1),a("el-col",{attrs:{span:1.5}},[a("el-button",{attrs:{type:"info",plain:"",icon:"el-icon-view",size:"mini"},on:{click:e.handleOpenThingsModel}},[e._v("查看物模型")])],1),a("el-col",{attrs:{span:1.5}},[a("el-link",{staticStyle:{"padding-top":"5px"},attrs:{type:"danger",underline:!1}},[e._v("注意:标识符不能重复")])],1)],1),this.queryParams.isModbus?a("el-form",{attrs:{size:"small"}},[a("el-form-item",{attrs:{label:"请选择设备从机:"}},[a("el-select",{attrs:{placeholder:"请选择设备从机"},on:{change:e.selectSlave},model:{value:e.slave.id,callback:function(t){e.$set(e.slave,"id",t)},expression:"slave.id"}},e._l(e.slaveList,(function(e){return a("el-option",{key:e.slaveAddr,attrs:{label:e.slaveName+" ("+e.slaveAddr+")",value:e.slaveAddr}})})),1),a("el-button",{attrs:{type:"primary",plain:"",size:"mini"},on:{click:e.getGateway}},[e._v("网关物模型")])],1)],1):e._e(),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],attrs:{data:e.modelList,size:"mini"}},[a("el-table-column",{attrs:{label:"名称",align:"center",prop:"modelName",width:"230"}}),a("el-table-column",{attrs:{label:"标识符",align:"center",prop:"identifier"}}),e.queryParams.isModbus?a("el-table-column",{attrs:{label:"寄存器地址(10进制)",align:"center",prop:"regAddr"}}):e._e(),a("el-table-column",{attrs:{label:"图表展示",align:"center",prop:"",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("dict-tag",{attrs:{options:e.dict.type.iot_yes_no,value:t.row.isChart}})]}}])}),a("el-table-column",{attrs:{label:"实时监测",align:"center",prop:"",width:"75"},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:"",width:"75"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("dict-tag",{attrs:{options:e.dict.type.iot_yes_no,value:t.row.isReadonly}})]}}])}),a("el-table-column",{attrs:{label:"历史存储",align:"center",prop:"",width:"75"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("dict-tag",{attrs:{options:e.dict.type.iot_yes_no,value:t.row.isHistory}})]}}])}),a("el-table-column",{attrs:{label:"物模型类别",align:"center",prop:"type",width:"100"},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:"datatype",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("dict-tag",{attrs:{options:e.dict.type.iot_data_type,value:t.row.datatype}})]}}])}),a("el-table-column",{attrs:{label:"数据定义",align:"left","header-align":"center",prop:"specs","min-width":"150","class-name":"specsColor"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("div",{domProps:{innerHTML:e._s(e.formatSpecsDisplay(t.row.specs))}})]}}])}),a("el-table-column",{attrs:{label:"计算公式",align:"center",prop:"formula"}}),a("el-table-column",{attrs:{label:"排序",align:"center",prop:"modelOrder",width:"80"}}),a("el-table-column",{attrs:{label:"操作",align:"center","class-name":"small-padding fixed-width"},scopedSlots:e._u([{key:"default",fn:function(t){return[2!=e.productInfo.status&&0!=e.productInfo.isOwner?a("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:model:query"],expression:"['iot:model:query']"}],attrs:{size:"mini",type:"text",icon:"el-icon-view"},on:{click:function(a){return e.handleUpdate(t.row)}}},[e._v("查看")]):e._e(),2!=e.productInfo.status&&0!=e.productInfo.isOwner?a("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:model:remove"],expression:"['iot:model:remove']"}],attrs:{size:"mini",type:"text",icon:"el-icon-delete"},on:{click:function(a){return e.handleDelete(t.row)}}},[e._v("删除")]):e._e()]}}])})],1),a("el-dialog",{attrs:{title:e.title,visible:e.open,width:"600px","append-to-body":""},on:{"update:visible":function(t){e.open=t}}},[a("el-form",{ref:"form",attrs:{model:e.form,rules:e.rules,"label-width":"100px"}},[a("el-form-item",{attrs:{label:"模型名称",prop:"modelName"}},[a("el-input",{staticStyle:{width:"385px"},attrs:{placeholder:"请输入物模型名称,例如:温度"},model:{value:e.form.modelName,callback:function(t){e.$set(e.form,"modelName",t)},expression:"form.modelName"}})],1),a("el-form-item",{attrs:{label:"模型标识",prop:"identifier"}},[a("el-input",{staticStyle:{width:"385px"},attrs:{placeholder:"请输入标识符例如temperature"},model:{value:e.form.identifier,callback:function(t){e.$set(e.form,"identifier",t)},expression:"form.identifier"}})],1),e.queryParams.isModbus?a("el-form-item",{attrs:{label:"寄存器地址",prop:"regAddr"}},[a("el-input",{staticStyle:{width:"385px"},model:{value:e.form.regAddr,callback:function(t){e.$set(e.form,"regAddr",t)},expression:"form.regAddr"}})],1):e._e(),a("el-form-item",{attrs:{label:"模型排序",prop:"modelOrder"}},[a("el-input",{staticStyle:{width:"385px"},attrs:{placeholder:"请输入排序",type:"number"},model:{value:e.form.modelOrder,callback:function(t){e.$set(e.form,"modelOrder",t)},expression:"form.modelOrder"}})],1),a("el-form-item",{attrs:{label:"模型类别",prop:"type"}},[a("el-radio-group",{on:{change:function(t){return e.typeChange(e.form.type)}},model:{value:e.form.type,callback:function(t){e.$set(e.form,"type",t)},expression:"form.type"}},[a("el-radio-button",{attrs:{label:"1"}},[e._v("属性")]),a("el-radio-button",{attrs:{label:"2"}},[e._v("功能")]),a("el-radio-button",{attrs:{label:"3"}},[e._v("事件")])],1)],1),a("el-form-item",{attrs:{label:"模型特性",prop:"property"}},[a("el-checkbox",{directives:[{name:"show",rawName:"v-show",value:1==e.form.type,expression:"form.type == 1"}],attrs:{name:"isChart",label:"图表展示","true-label":1,"false-label":0},on:{change:e.isChartChange},model:{value:e.form.isChart,callback:function(t){e.$set(e.form,"isChart",t)},expression:"form.isChart"}}),a("el-checkbox",{directives:[{name:"show",rawName:"v-show",value:1==e.form.type,expression:"form.type == 1"}],attrs:{name:"isMonitor",label:"实时监测","true-label":1,"false-label":0},on:{change:e.isMonitorChange},model:{value:e.form.isMonitor,callback:function(t){e.$set(e.form,"isMonitor",t)},expression:"form.isMonitor"}}),a("el-checkbox",{attrs:{name:"isReadonly",label:"只读数据",disabled:3==e.form.type,"true-label":1,"false-label":0},on:{change:e.isReadonlyChange},model:{value:e.form.isReadonly,callback:function(t){e.$set(e.form,"isReadonly",t)},expression:"form.isReadonly"}}),a("el-checkbox",{attrs:{name:"isHistory",label:"历史存储","true-label":1,"false-label":0},model:{value:e.form.isHistory,callback:function(t){e.$set(e.form,"isHistory",t)},expression:"form.isHistory"}}),a("el-checkbox",{attrs:{name:"isSharePerm",label:"分享权限","true-label":1,"false-label":0},model:{value:e.form.isSharePerm,callback:function(t){e.$set(e.form,"isSharePerm",t)},expression:"form.isSharePerm"}})],1),a("el-divider"),a("el-form-item",{attrs:{label:"数据类型",prop:"datatype"}},[a("el-select",{staticStyle:{width:"175px"},attrs:{placeholder:"请选择数据类型"},on:{change:e.dataTypeChange},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.isChart}}),a("el-option",{key:"enum",attrs:{label:"枚举",value:"enum",disabled:1==e.form.isChart}}),a("el-option",{key:"string",attrs:{label:"字符串",value:"string",disabled:1==e.form.isChart}}),a("el-option",{key:"array",attrs:{label:"数组",value:"array",disabled:1==e.form.isChart}}),a("el-option",{key:"object",attrs:{label:"对象",value:"object",disabled:1==e.form.isChart}})],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:9}},[a("el-input",{attrs:{placeholder:"最小值",type:"number"},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:2,align:"center"}},[e._v("到")]),a("el-col",{attrs:{span:9}},[a("el-input",{attrs:{placeholder:"最大值",type:"number"},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:"385px"},attrs:{placeholder:"请输入单位,例如:℃"},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",{staticStyle:{width:"385px"},attrs:{placeholder:"请输入步长例如1",type:"number"},model:{value:e.form.specs.step,callback:function(t){e.$set(e.form.specs,"step",t)},expression:"form.specs.step"}})],1),a("el-form-item",{attrs:{label:"计算公式",prop:"formula"}},[a("template",{slot:"label"},[a("span",[e._v("计算公式")]),a("el-tooltip",{staticStyle:{cursor:"pointer"},attrs:{effect:"light",placement:"top"}},[a("div",{attrs:{slot:"content"},slot:"content"},[e._v(" 设备上行数据经计算公式计算后显示 。 "),a("br"),e._v(" 公式中的%s为占位符是固定字段。 "),a("br"),e._v(" 如: "),a("br"),e._v(" 加:%s+10 "),a("br"),e._v(" 减:%s-10 "),a("br"),e._v(" 乘:%s*10 "),a("br"),e._v(" 除:%s/10 "),a("br"),e._v(" 除(保留小数)%s%10.00 "),a("br")]),a("i",{staticClass:"el-icon-question"})])],1),a("el-input",{staticStyle:{width:"385px"},model:{value:e.form.formula,callback:function(t){e.$set(e.form,"formula",t)},expression:"form.formula"}})],2),e.queryParams.isModbus?a("el-form-item",{attrs:{label:"控制公式",prop:"reverseFormula"}},[a("el-input",{staticStyle:{width:"385px"},model:{value:e.form.reverseFormula,callback:function(t){e.$set(e.form,"reverseFormula",t)},expression:"form.reverseFormula"}})],1):e._e()],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:9}},[a("el-input",{attrs:{placeholder:"例如:关闭"},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:9}},[a("el-input",{attrs:{placeholder:"例如:打开"},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:"展示方式"}},[a("el-select",{staticStyle:{width:"175px"},attrs:{placeholder:"请选择展示方式"},model:{value:e.form.specs.showWay,callback:function(t){e.$set(e.form.specs,"showWay",t)},expression:"form.specs.showWay"}},[a("el-option",{key:"select",attrs:{label:"下拉框",value:"select"}}),a("el-option",{key:"button",attrs:{label:"按钮",value:"button"}})],1)],1),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:9}},[a("el-input",{attrs:{placeholder:"参数值例如0"},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:"参数描述,例如:中速档位"},model:{value:t.text,callback:function(a){e.$set(t,"text",a)},expression:"item.text"}})],1),0!=r?a("el-col",{attrs:{span:2,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:9}},[a("el-input",{attrs:{placeholder:"例如1024",type:"number"},model:{value:e.form.specs.maxLength,callback:function(t){e.$set(e.form.specs,"maxLength",t)},expression:"form.specs.maxLength"}})],1),a("el-col",{attrs:{span:14,offset:1}},[e._v("(字符串的最大长度)")])],1)],1)],1):e._e(),"array"==e.form.datatype?a("div",[a("el-form-item",{attrs:{label:"元素个数",prop:""}},[a("el-row",[a("el-col",{attrs:{span:9}},[a("el-input",{attrs:{placeholder:"例如5",type:"number"},model:{value:e.form.specs.arrayCount,callback:function(t){e.$set(e.form.specs,"arrayCount",t)},expression:"form.specs.arrayCount"}})],1)],1)],1),a("el-form-item",{attrs:{label:"数组类型",prop:""}},[a("el-radio-group",{model:{value:e.form.specs.arrayType,callback:function(t){e.$set(e.form.specs,"arrayType",t)},expression:"form.specs.arrayType"}},[a("el-radio",{attrs:{label:"integer"}},[e._v("整数")]),a("el-radio",{attrs:{label:"decimal"}},[e._v("小数")]),a("el-radio",{attrs:{label:"string"}},[e._v("字符串")]),a("el-radio",{attrs:{label:"object"}},[e._v("对象")])],1)],1),"object"==e.form.specs.arrayType?a("el-form-item",{attrs:{label:"对象参数"}},[a("div",{staticStyle:{"background-color":"#f8f8f8","border-radius":"5px"}},e._l(e.form.specs.params,(function(t,r){return a("el-row",{key:r,staticStyle:{padding:"0 10px 5px"}},[0==r?a("div",{staticStyle:{"margin-top":"5px"}}):e._e(),a("el-col",{attrs:{span:18}},[a("el-input",{staticStyle:{"margin-top":"3px"},attrs:{readonly:"",size:"mini",placeholder:"请选择设备"},model:{value:t.name,callback:function(a){e.$set(t,"name",a)},expression:"item.name"}},[a("template",{slot:"prepend"},[a("el-tag",{staticStyle:{"margin-left":"-21px",height:"26px","line-height":"26px"},attrs:{size:"mini",effect:"dark"}},[e._v(e._s(t.order))]),e._v(" "+e._s(e.form.identifier+"_"+t.id)+" ")],1),a("el-button",{attrs:{slot:"append",size:"small"},on:{click:function(a){return e.editParameter(t,r)}},slot:"append"},[e._v("编辑")])],2)],1),a("el-col",{attrs:{span:2,offset:2}},[a("el-button",{staticStyle:{padding:"5px"},attrs:{size:"small",plain:"",type:"danger",icon:"el-icon-delete"},on:{click:function(t){return e.removeParameter(r)}}},[e._v("删除")])],1)],1)})),1),a("div",[e._v(" + "),a("a",{staticStyle:{color:"#409eff"},on:{click:function(t){return e.addParameter()}}},[e._v("添加参数")])])]):e._e()],1):e._e(),"object"==e.form.datatype?a("div",[a("el-form-item",{attrs:{label:"对象参数",prop:""}},[a("div",{staticStyle:{"background-color":"#f8f8f8","border-radius":"5px"}},e._l(e.form.specs.params,(function(t,r){return a("el-row",{key:r,staticStyle:{padding:"0 10px 5px"}},[0==r?a("div",{staticStyle:{"margin-top":"5px"}}):e._e(),a("el-col",{attrs:{span:18}},[a("el-input",{staticStyle:{"margin-top":"3px"},attrs:{readonly:"",size:"mini",placeholder:"请选择设备"},model:{value:t.name,callback:function(a){e.$set(t,"name",a)},expression:"item.name"}},[a("template",{slot:"prepend"},[a("el-tag",{staticStyle:{"margin-left":"-21px",height:"26px","line-height":"26px"},attrs:{size:"mini",effect:"dark"}},[e._v(e._s(t.order))]),e._v(" "+e._s(e.form.identifier+"_"+t.id)+" ")],1),a("el-button",{attrs:{slot:"append",size:"small"},on:{click:function(a){return e.editParameter(t,r)}},slot:"append"},[e._v("编辑")])],2)],1),a("el-col",{attrs:{span:2,offset:2}},[a("el-button",{staticStyle:{padding:"5px"},attrs:{size:"small",plain:"",type:"danger",icon:"el-icon-delete"},on:{click:function(t){return e.removeParameter(r)}}},[e._v("删除")])],1)],1)})),1),a("div",[e._v(" + "),a("a",{staticStyle:{color:"#409eff"},on:{click:function(t){return e.addParameter()}}},[e._v("添加参数")])])])],1):e._e()],1),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:model:edit"],expression:"['iot:model:edit']"},{name:"show",rawName:"v-show",value:e.form.modelId,expression:"form.modelId"}],attrs:{type:"primary"},on:{click:e.submitForm}},[e._v("修 改")]),a("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:model:add"],expression:"['iot:model:add']"},{name:"show",rawName:"v-show",value:!e.form.modelId,expression:"!form.modelId"}],attrs:{type:"primary"},on:{click:e.submitForm}},[e._v("新 增")]),a("el-button",{on:{click:e.cancel}},[e._v("取 消")])],1)],1),a("things-parameter",{attrs:{data:e.paramData},on:{dataEvent:function(t){return e.getParamData(t)}}}),a("el-dialog",{attrs:{title:e.title,visible:e.openSelect,width:"800px","append-to-body":""},on:{"update:visible":function(t){e.openSelect=t}}},[a("product-select-template",{ref:"productSelectTemplate",on:{idsToParentEvent:function(t){return e.getChildData(t)}}}),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"primary"},on:{click:e.importSelect}},[e._v("导 入")]),a("el-button",{on:{click:e.cancelSelect}},[e._v("取 消")])],1)],1),a("el-dialog",{attrs:{title:e.title,visible:e.openThingsModel,width:"600px","append-to-body":""},on:{"update:visible":function(t){e.openThingsModel=t}}},[a("div",{staticStyle:{border:"1px solid #ccc","margin-top":"-15px",height:"600px",overflow:"scroll"}},[a("json-viewer",{attrs:{value:e.thingsModel,"expand-depth":10,copyable:""},scopedSlots:e._u([{key:"copy",fn:function(){return[e._v("复制")]},proxy:!0}])})],1),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"info"},on:{click:e.handleCloseThingsModel}},[e._v("关 闭")])],1)])],1)},s=[],o=a("5530"),i=(a("d81d"),a("14d9"),a("4e82"),a("a434"),a("b0c0"),a("e9c4"),a("a9e3"),a("b64b"),a("ac1f"),a("00b4"),a("dbf4")),l=a("349e"),n=a.n(l),m=(a("0b22"),a("09a1")),c=a("01ca"),p=a("a824");a("b775");var d={name:"product-things-model",dicts:["iot_things_type","iot_data_type","iot_yes_no"],components:{productSelectTemplate:i["default"],thingsParameter:m["default"],JsonViewer:n.a},props:{product:{type:Object,default:null}},watch:{product:function(e,t){this.productInfo=e,this.productInfo&&0!=this.productInfo.productId&&(this.queryParams.productId=this.productInfo.productId,this.queryParams.isModbus=this.productInfo.isModbus,this.getList(),this.queryParams.isModbus&&this.getSlaveList())}},data:function(){return{thingsModel:{},productInfo:{},templateIds:[],loading:!1,ids:[],single:!0,multiple:!0,showSearch:!0,total:0,modelList:[],title:"",open:!1,openSelect:!1,openThingsModel:!1,queryParams:{productId:0,pageNum:1,pageSize:100},form:{},paramData:{index:-1,parameter:{}},isModbus:!1,slaveList:[],slave:{},rules:{modelName:[{required:!0,message:"物模型名称不能为空",trigger:"blur"}],identifier:[{required:!0,message:"标识符,产品下唯一不能为空",trigger:"blur"}],modelOrder:[{required:!0,message:"模型排序不能为空",trigger:"blur"}],type:[{required:!0,message:"模型类别不能为空",trigger:"change"}],datatype:[{required:!0,message:"数据类型不能为空",trigger:"change"}]}}},created:function(){},methods:{getList:function(){var e=this;this.loading=!0,Object(c["f"])(this.queryParams).then((function(t){e.modelList=t.rows,e.total=t.total,e.loading=!1}))},getSlaveList:function(){var e=this,t={productId:this.queryParams.productId};Object(p["d"])(t).then((function(t){e.slaveList=t.data,e.slave.id=e.slaveList[0].slaveAddr,e.queryParams.tempSlaveId=e.slaveList[0].slaveAddr,e.getList()}))},selectSlave:function(){this.queryParams.tempSlaveId=this.slave.id,this.getList()},getGateway:function(){this.queryParams.tempSlaveId=void 0,this.getList()},cancel:function(){this.open=!1,this.reset()},reset:function(){this.form={templateId:null,templateName:null,userId:null,userName:null,tenantId:null,tenantName:null,identifier:null,modelOrder:0,type:1,datatype:"integer",isSys:null,isChart:1,isHistory:1,isSharePerm:1,isMonitor:1,isReadonly:1,delFlag:null,createBy:null,createTime:null,updateBy:null,updateTime:null,remark:null,specs:{enumList:[{value:"",text:""}],arrayType:"integer",arrayCount:5,showWay:"select",params:[]}},this.resetForm("form")},handleQuery:function(){this.queryParams.pageNum=1,this.getList()},resetQuery:function(){this.resetForm("queryForm"),this.handleQuery()},handleAdd:function(){this.reset(),this.open=!0,this.title="添加物模型"},handleUpdate:function(e){var t=this;this.reset();var a=e.modelId;Object(c["d"])(a).then((function(e){var a=e.data;if(t.open=!0,t.title="修改物模型",a.specs=JSON.parse(a.specs),a.specs.enumList||(a.specs.showWay="select",a.specs.enumList=[{value:"",text:""}]),a.specs.arrayType||(a.specs.arrayType="integer"),a.specs.arrayCount||(a.specs.arrayCount=5),a.specs.params||(a.specs.params=[]),"array"==a.specs.type&&"object"==a.specs.arrayType||"object"==a.specs.type)for(var r=0;r<a.specs.params.length;r++)a.specs.params[r].id=String(a.specs.params[r].id).substring(String(a.identifier).length+1);t.form=a}))},handleOpenThingsModel:function(){this.title="物模型",this.thingsModel={properties:[],functions:[],events:[]};for(var e=0;e<this.modelList.length;e++){var t={};t.id=this.modelList[e].identifier,t.name=this.modelList[e].modelName,1==this.modelList[e].type?(t.isChart=this.modelList[e].isChart,t.isMonitor=this.modelList[e].isMonitor,t.isHistory=this.modelList[e].isHistory,t.isSharePerm=this.modelList[e].isSharePerm,t.isReadonly=this.modelList[e].isReadonly,t.datatype=JSON.parse(this.modelList[e].specs),this.thingsModel.properties.push(t)):2==this.modelList[e].type?(t.isHistory=this.modelList[e].isHistory,t.isSharePerm=this.modelList[e].isSharePerm,t.isReadonly=this.modelList[e].isReadonly,t.datatype=JSON.parse(this.modelList[e].specs),this.thingsModel.functions.push(t)):3==this.modelList[e].type&&(t.isHistory=this.modelList[e].isHistory,t.isSharePerm=this.modelList[e].isSharePerm,t.isReadonly=this.modelList[e].isReadonly,t.datatype=JSON.parse(this.modelList[e].specs),this.thingsModel.events.push(t))}this.openThingsModel=!0},handleCloseThingsModel:function(){this.openThingsModel=!1},handleSelect:function(){this.openSelect=!0,this.title="导入通用物模型",this.form.type=1,this.form.datatype="integer",this.form.specs={enumList:[]}},cancelSelect:function(){this.openSelect=!1,this.$refs.productSelectTemplate.$refs.selectTemplateTable.clearSelection()},getChildData:function(e){this.templateIds=e},importSelect:function(){var e=this;if(null!=this.templateIds&&this.templateIds.length>0){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()}))}},containsUnderscore:function(e){return/_/.test(e)},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){if(!e.form.specs.params||0==e.form.specs.params)return void e.$modal.msgError("对象的参数不能为空");if(e.containsUnderscore(e.form.identifier))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<a.length;r++)if(a[r]==a[r+1])return void e.$modal.msgError("参数标识 "+a[r]+" 重复");if(1==e.form.isChart&&"integer"!=e.form.datatype&&1==e.form.isChart&&"decimal"!=e.form.datatype)e.$modal.msgError("请重新选择数据类型!");else if(null!=e.form.modelId){var s=JSON.parse(JSON.stringify(e.form));s.specs=e.formatThingsSpecs(),(2==e.form.type||3==e.form.type)&&(s.isMonitor=0,s.isChart=0),Object(c["i"])(s).then((function(t){e.$modal.msgSuccess("修改成功"),e.open=!1,e.getList()}))}else{var o=JSON.parse(JSON.stringify(e.form));o.specs=e.formatThingsSpecs(),o.productId=e.productInfo.productId,o.productName=e.productInfo.productName,2==e.form.type?o.isMonitor=0:3==e.form.type&&(o.isMonitor=0,o.isChart=0),Object(c["a"])(o).then((function(t){e.$modal.msgSuccess("新增成功"),e.open=!1,e.getList()}))}}}))},handleDelete:function(e){var t=this,a=e.modelId;this.queryParams.isModbus?this.$modal.alert("采集点删除请在采集点模板修改"):this.$modal.confirm('是否确认删除物模型编号为"'+a+'"的数据项?').then((function(){return Object(c["c"])(a)})).then((function(){t.getList(),t.$modal.msgSuccess("删除成功")})).catch((function(){}))},handleExport:function(){this.download("iot/model/export",Object(o["a"])({},this.queryParams),"model_".concat((new Date).getTime(),".xlsx"))},typeChange:function(e){1==e?(this.form.isChart=1,this.form.isHistory=1,this.form.isSharePerm=1,this.form.isMonitor=1,this.form.isReadonly=1,this.form.datatype="integer"):2==e?(this.form.isChart=0,this.form.isHistory=1,this.form.isSharePerm=1,this.form.isMonitor=0,this.form.isReadonly=0):3==e&&(this.form.isChart=0,this.form.isHistory=1,this.form.isSharePerm=0,this.form.isMonitor=0,this.form.isReadonly=1)},isChartChange:function(){1==this.form.isChart?this.form.isReadonly=1:this.form.isMonitor=0},isMonitorChange:function(){1==this.form.isMonitor&&(this.form.isReadonly=1,this.form.isChart=1)},isReadonlyChange:function(){0==this.form.isReadonly&&(this.form.isMonitor=0,this.form.isChart=0)},formatThingsSpecs:function(){var e={};if(e.type=this.form.datatype,"integer"==this.form.datatype||"decimal"==this.form.datatype)e.min=Number(this.form.specs.min?this.form.specs.min:0),e.max=Number(this.form.specs.max?this.form.specs.max:100),e.unit=this.form.specs.unit?this.form.specs.unit:"",e.step=Number(this.form.specs.step?this.form.specs.step:1);else if("string"==this.form.datatype)e.maxLength=Number(this.form.specs.maxLength?this.form.specs.maxLength:1024);else if("bool"==this.form.datatype)e.falseText=this.form.specs.falseText?this.form.specs.falseText:"关闭",e.trueText=this.form.specs.trueText?this.form.specs.trueText:"打开";else if("enum"==this.form.datatype)e.showWay=this.form.specs.showWay,this.form.specs.enumList&&""!=this.form.specs.enumList[0].text?e.enumList=this.form.specs.enumList:(e.showWay="select",e.enumList=[{value:"0",text:"低"},{value:"1",text:"高"}]);else if("array"==this.form.datatype){if(e.arrayType=this.form.specs.arrayType,e.arrayCount=this.form.specs.arrayCount?this.form.specs.arrayCount:5,"object"==e.arrayType){e.params=this.form.specs.params;for(var t=0;t<e.params.length;t++)e.params[t].id=this.form.identifier+"_"+e.params[t].id}}else if("object"==this.form.datatype){e.params=this.form.specs.params;for(var a=0;a<e.params.length;a++)e.params[a].id=this.form.identifier+"_"+e.params[a].id}return JSON.stringify(e)},dataTypeChange:function(e){},addEnumItem:function(){this.form.specs.enumList.push({value:"",text:""})},removeEnumItem:function(e){this.form.specs.enumList.splice(e,1)},formatSpecsDisplay:function(e){var t=JSON.parse(e);if("integer"===t.type||"decimal"===t.type||"INT16"===t.type||"INT"===t.type)return"<span style='width:50%;display:inline-block;'>最大值:<span style=\"color:#F56C6C\">"+t.max+'</span></span>最小值:<span style="color:#F56C6C">'+t.min+"</span><br /><span style='width:50%;display:inline-block;'>步长:<span style=\"color:#F56C6C\">"+t.step+'</span></span>单位:<span style="color:#F56C6C">'+t.unit;if("string"===t.type)return'最大长度:<span style="color:#F56C6C">'+t.maxLength+"</span>";if("array"===t.type)return"<span style='width:50%;display:inline-block;'>数组类型:<span style=\"color:#F56C6C\">"+t.arrayType+'</span></span>元素个数:<span style="color:#F56C6C">'+t.arrayCount;if("enum"===t.type){for(var a="",r=0;r<t.enumList.length;r++)a=a+"<span style='width:50%;display:inline-block;'>"+t.enumList[r].value+"<span style='color:#F56C6C'>"+t.enumList[r].text+"</span></span>",r>0&&r%2!=0&&(a+="<br />");return a}if("bool"===t.type)return"<span style='width:50%;display:inline-block;'>0<span style=\"color:#F56C6C\">"+t.falseText+'</span></span>1<span style="color:#F56C6C">'+t.trueText;if("object"===t.type){for(var s="",o=0;o<t.params.length;o++)s=s+"<span style='width:50%;display:inline-block;'>"+t.params[o].name+"<span style='color:#F56C6C'>"+t.params[o].datatype.type+"</span></span>",o>0&&o%2!=0&&(s+="<br />");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]))}}},u=d,f=(a("2d31"),a("2877")),h=Object(f["a"])(u,r,s,!1,null,null,null);t["default"]=h.exports},"4df4f":function(e,t,a){"use strict";a("c23a")},a824:function(e,t,a){"use strict";a.d(t,"e",(function(){return s})),a.d(t,"c",(function(){return o})),a.d(t,"a",(function(){return i})),a.d(t,"f",(function(){return l})),a.d(t,"b",(function(){return n})),a.d(t,"d",(function(){return m}));var r=a("b775");function s(e){return Object(r["a"])({url:"/iot/salve/list",method:"get",params:e})}function o(e){return Object(r["a"])({url:"/iot/salve/"+e,method:"get"})}function i(e){return Object(r["a"])({url:"/iot/salve",method:"post",data:e})}function l(e){return Object(r["a"])({url:"/iot/salve",method:"put",data:e})}function n(e){return Object(r["a"])({url:"/iot/salve/"+e,method:"delete"})}function m(e){return Object(r["a"])({url:"/iot/salve/listByPId",method:"get",params:e})}},c23a:function(e,t,a){},cec4:function(e,t,a){"use strict";a.d(t,"e",(function(){return s})),a.d(t,"d",(function(){return o})),a.d(t,"a",(function(){return i})),a.d(t,"f",(function(){return l})),a.d(t,"b",(function(){return n})),a.d(t,"c",(function(){return m}));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"})}function m(e){return Object(r["a"])({url:"/iot/template/getPoints",method:"get",params:e})}},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:"isChart",width:"75"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("dict-tag",{attrs:{options:e.dict.type.iot_yes_no,value:t.row.isChart}})]}}])}),a("el-table-column",{attrs:{label:"实时监测",align:"center",prop:"isMonitor",width:"75"},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:"isReadonly",width:"75"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("dict-tag",{attrs:{options:e.dict.type.iot_yes_no,value:t.row.isReadonly}})]}}])}),a("el-table-column",{attrs:{label:"历史存储",align:"center",prop:"isHistory",width:"75"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("dict-tag",{attrs:{options:e.dict.type.iot_yes_no,value:t.row.isHistory}})]}}])}),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["e"])(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"),m=Object(n["a"])(l,r,s,!1,null,null,null);t["default"]=m.exports}}]);