1 line
77 KiB
JavaScript
1 line
77 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2facefea","chunk-257dc331","chunk-3a322b3e","chunk-205fe4c5","chunk-74d326ff"],{"01ca":function(e,t,n){"use strict";n.d(t,"h",(function(){return a})),n.d(t,"d",(function(){return o})),n.d(t,"i",(function(){return i})),n.d(t,"a",(function(){return s})),n.d(t,"g",(function(){return l})),n.d(t,"k",(function(){return c})),n.d(t,"c",(function(){return d})),n.d(t,"b",(function(){return u})),n.d(t,"f",(function(){return p})),n.d(t,"e",(function(){return m})),n.d(t,"j",(function(){return f}));var r=n("b775");function a(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 s(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 c(e){return Object(r["a"])({url:"/iot/model",method:"put",data:e})}function d(e){return Object(r["a"])({url:"/iot/model/"+e,method:"delete"})}function u(e){return Object(r["a"])({url:"/iot/model/cache/"+e,method:"get"})}function p(e){return Object(r["a"])({url:"/iot/model/listModbus",method:"get",params:e})}function m(e){return Object(r["a"])({url:"/iot/model/write",method:"get",params:e})}function f(e){return Object(r["a"])({url:"/iot/model/refresh?productId="+e,method:"post"})}},"2c9f":function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("el-dialog",{attrs:{title:e.$t("device.product-list.058448-0"),visible:e.open,width:"1000px","close-on-click-modal":!1},on:{"update:visible":function(t){e.open=t}}},[n("el-form",{ref:"queryForm",attrs:{model:e.queryParams,inline:!0,"label-width":"68px"}},[n("el-form-item",{attrs:{prop:"productName"}},[n("el-input",{attrs:{placeholder:e.$t("product.index.091251-1"),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.productName,callback:function(t){e.$set(e.queryParams,"productName",t)},expression:"queryParams.productName"}})],1),n("el-form-item",[n("el-button",{attrs:{type:"primary",icon:"el-icon-search",size:"small"},on:{click:e.handleQuery}},[e._v(e._s(e.$t("search")))]),n("el-button",{attrs:{icon:"el-icon-refresh",size:"small"},on:{click:e.resetQuery}},[e._v(e._s(e.$t("reset")))])],1)],1),n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],ref:"singleTable",attrs:{data:e.productList,"highlight-current-row":"",size:"small",border:!1},on:{"row-click":e.rowClick}},[n("el-table-column",{attrs:{label:e.$t("select"),width:"50",align:"center"},scopedSlots:e._u([{key:"default",fn:function(e){return[n("input",{attrs:{type:"radio",name:"product"},domProps:{checked:e.row.isSelect}})]}}])}),n("el-table-column",{attrs:{label:e.$t("product.index.091251-0"),align:"left",prop:"productName","min-width":"160px"}}),n("el-table-column",{attrs:{label:e.$t("device.product-list.058448-6"),align:"left",prop:"categoryName","min-width":"120px"}}),n("el-table-column",{attrs:{label:e.$t("device.product-list.058448-7"),align:"center",prop:"tenantName","min-width":"120px"}}),n("el-table-column",{attrs:{label:e.$t("device.product-list.058448-8"),align:"center",prop:"status",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[1==t.row.isAuthorize?n("el-tag",{attrs:{type:"success"}},[e._v(e._s(e.$t("device.product-list.058448-9")))]):e._e(),0==t.row.isAuthorize?n("el-tag",{attrs:{type:"info"}},[e._v(e._s(e.$t("device.product-list.058448-10")))]):e._e()]}}])}),n("el-table-column",{attrs:{label:e.$t("device.product-list.058448-11"),align:"center",prop:"status","min-width":"110px"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("dict-tag",{attrs:{options:e.dict.type.iot_vertificate_method,value:t.row.vertificateMethod}})]}}])}),n("el-table-column",{attrs:{label:e.$t("device.product-list.058448-12"),align:"center",prop:"networkMethod","min-width":"110px"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("dict-tag",{attrs:{options:e.dict.type.iot_network_method,value:t.row.networkMethod}})]}}])}),n("el-table-column",{attrs:{label:e.$t("device.product-list.058448-13"),align:"center",prop:"createTime",width:"100"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("span",[e._v(e._s(e.parseTime(t.row.createTime,"{y}-{m}-{d}")))])]}}])})],1),n("pagination",{directives:[{name:"show",rawName:"v-show",value:e.total>0,expression:"total > 0"}],attrs:{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}}),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{type:"primary"},on:{click:e.confirmSelectProduct}},[e._v(e._s(e.$t("confirm")))]),n("el-button",{attrs:{type:"info"},on:{click:e.closeDialog}},[e._v(e._s(e.$t("cancel")))])],1)],1)},a=[],o=n("9b9c"),i={name:"ProductList",dicts:["iot_vertificate_method","iot_network_method"],data:function(){return{loading:!0,total:0,open:!1,productList:[],selectProductId:0,product:{},queryParams:{pageNum:1,pageSize:10,productName:null,categoryId:null,categoryName:null,tenantId:null,tenantName:null,isSys:null,status:2,deviceType:null,networkMethod:null,showSenior:!1}}},created:function(){},methods:{getList:function(){var e=this;this.loading=!0,Object(o["g"])(this.queryParams).then((function(t){for(var n=0;n<t.rows.length;n++)t.rows[n].isSelect=!1;e.productList=t.rows,e.total=t.total,e.loading=!1,e.setRadioSelected(e.selectProductId)}))},handleQuery:function(){this.queryParams.pageNum=1,this.getList()},resetQuery:function(){this.resetForm("queryForm"),this.handleQuery()},rowClick:function(e){null!=e&&(this.setRadioSelected(e.productId),this.product=e)},setRadioSelected:function(e){for(var t=0;t<this.productList.length;t++)this.productList[t].productId==e?this.productList[t].isSelect=!0:this.productList[t].isSelect=!1},confirmSelectProduct:function(){this.$emit("productEvent",this.product),this.open=!1,this.product=null},closeDialog:function(){this.open=!1}}},s=i,l=n("2877"),c=Object(l["a"])(s,r,a,!1,null,null,null);t["default"]=c.exports},"2d89":function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("el-dialog",{attrs:{title:"选择场景",visible:e.openScene,width:"800px","append-to-body":""},on:{"update:visible":function(t){e.openScene=t}}},[n("el-form",{ref:"queryForm",attrs:{model:e.queryParams,inline:!0,"label-width":"68px"}},[n("el-form-item",{attrs:{label:"场景名称",prop:"sceneName"}},[n("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.sceneName,callback:function(t){e.$set(e.queryParams,"sceneName",t)},expression:"queryParams.sceneName"}})],1),n("el-form-item",[n("el-button",{attrs:{type:"primary",icon:"el-icon-search",size:"small"},on:{click:e.handleQuery}},[e._v("搜索")]),n("el-button",{attrs:{icon:"el-icon-refresh",size:"small"},on:{click:e.handleResetQuery}},[e._v("重置")])],1)],1),n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],ref:"singleTable",attrs:{data:e.sceneList,"highlight-current-row":"",size:"small",border:!1},on:{"row-click":e.rowClick}},[n("el-table-column",{attrs:{label:"选择",width:"50",align:"center"},scopedSlots:e._u([{key:"default",fn:function(e){return[n("input",{attrs:{type:"radio",name:"product"},domProps:{checked:e.row.isSelect}})]}}])}),n("el-table-column",{attrs:{label:"场景名称",align:"left",prop:"sceneName","min-width":"160"}}),n("el-table-column",{attrs:{label:"状态",align:"center",prop:"enable",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[1==t.row.enable?n("el-tag",{attrs:{type:"success",size:"small"}},[e._v("启动")]):e._e(),2==t.row.enable?n("el-tag",{attrs:{type:"danger",size:"small"}},[e._v("暂停")]):e._e()]}}])}),n("el-table-column",{attrs:{label:"触发条件",align:"center",prop:"cond","min-width":"100"},scopedSlots:e._u([{key:"default",fn:function(t){return[1==t.row.cond?n("span",[e._v("任意条件")]):e._e(),2==t.row.cond?n("span",[e._v("所有条件")]):e._e(),3==t.row.cond?n("span",[e._v("不满足条件")]):e._e()]}}])}),n("el-table-column",{attrs:{label:"执行方式",align:"center",prop:"executeMode","min-width":"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[1==t.row.executeMode?n("span",[e._v("串行")]):e._e(),2==t.row.executeMode?n("span",[e._v("并行")]):e._e()]}}])}),n("el-table-column",{attrs:{label:"创建时间",align:"center",prop:"createTime",width:"100"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("span",[e._v(e._s(e.parseTime(t.row.createTime,"{y}-{m}-{d}")))])]}}])})],1),n("pagination",{directives:[{name:"show",rawName:"v-show",value:e.total>0,expression:"total > 0"}],attrs:{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}}),n("div",{staticStyle:{width:"100%"},attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{type:"primary"},on:{click:e.confirmSelectScene}},[e._v(e._s(e.$t("confirm")))]),n("el-button",{on:{click:e.cancel}},[e._v(e._s(e.$t("cancel")))])],1)],1)},a=[],o=n("2e40"),i={name:"sceneList",data:function(){return{openScene:!1,loading:!0,showSearch:!0,total:0,sceneList:[],selectSceneId:0,scene:{},title:"",queryParams:{pageNum:1,pageSize:10,hasAlert:1,sceneName:null},form:{}}},created:function(){},methods:{getList:function(){var e=this;this.loading=!0,Object(o["e"])(this.queryParams).then((function(t){e.sceneList=t.rows,e.total=t.total,e.loading=!1,e.setRadioSelected(e.selectSceneId)}))},cancel:function(){this.openScene=!1,this.ids=[],this.scene={}},handleQuery:function(){this.queryParams.pageNum=1,this.getList()},handleResetQuery:function(){this.resetForm("queryForm"),this.handleQuery()},rowClick:function(e){null!=e&&(this.setRadioSelected(e.sceneId),this.scene=e)},setRadioSelected:function(e){for(var t=0;t<this.sceneList.length;t++)this.sceneList[t].sceneId==e?this.sceneList[t].isSelect=!0:this.sceneList[t].isSelect=!1},confirmSelectScene:function(){this.$emit("sceneEvent",this.scene),this.openScene=!1}}},s=i,l=n("2877"),c=Object(l["a"])(s,r,a,!1,null,null,null);t["default"]=c.exports},"2e40":function(e,t,n){"use strict";n.d(t,"e",(function(){return a})),n.d(t,"c",(function(){return o})),n.d(t,"a",(function(){return i})),n.d(t,"g",(function(){return s})),n.d(t,"b",(function(){return l})),n.d(t,"f",(function(){return c})),n.d(t,"d",(function(){return d}));var r=n("b775");function a(e){return Object(r["a"])({url:"/iot/scene/list",method:"get",params:e})}function o(e){return Object(r["a"])({url:"/iot/scene/"+e,method:"get"})}function i(e){return Object(r["a"])({url:"/iot/scene",method:"post",data:e})}function s(e){return Object(r["a"])({url:"/iot/scene",method:"put",data:e})}function l(e){return Object(r["a"])({url:"/iot/scene/"+e,method:"delete"})}function c(e){return Object(r["a"])({url:"/iot/runtime/runScene",method:"post",params:e})}function d(e){return Object(r["a"])({url:"/iot/scene/log/"+e,method:"get"})}},"3b61":function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"iot-scene"},[n("el-card",{directives:[{name:"show",rawName:"v-show",value:e.showSearch,expression:"showSearch"}],staticClass:"search-card"},[n("el-form",{ref:"queryForm",staticClass:"search-form",attrs:{model:e.queryParams,inline:!0},nativeOn:{submit:function(e){e.preventDefault()}}},[n("el-form-item",{attrs:{prop:"sceneName"}},[n("el-input",{attrs:{placeholder:e.$t("alert.scene-list.591934-2"),clearable:""},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.sceneName,callback:function(t){e.$set(e.queryParams,"sceneName",t)},expression:"queryParams.sceneName"}})],1),n("div",{staticStyle:{float:"right"}},[n("el-button",{attrs:{type:"primary",icon:"el-icon-search"},on:{click:e.handleQuery}},[e._v(e._s(e.$t("search")))]),n("el-button",{attrs:{icon:"el-icon-refresh"},on:{click:e.handleResetQuery}},[e._v(e._s(e.$t("reset")))])],1)],1)],1),n("el-card",[n("el-row",{staticStyle:{"margin-bottom":"15px"},attrs:{gutter:10}},[n("el-col",{attrs:{span:1.5}},[n("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:scene:add"],expression:"['iot:scene:add']"}],attrs:{type:"primary",plain:"",icon:"el-icon-plus",size:"small"},on:{click:e.handleAdd}},[e._v(e._s(e.$t("add")))])],1),n("el-col",{attrs:{span:1.5}},[n("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:scene:remove"],expression:"['iot:scene:remove']"}],attrs:{plain:"",icon:"el-icon-delete",size:"small",disabled:e.multiple},on:{click:e.handleDelete}},[e._v(e._s(e.$t("del")))])],1),n("right-toolbar",{attrs:{showSearch:e.showSearch},on:{"update:showSearch":function(t){e.showSearch=t},"update:show-search":function(t){e.showSearch=t},queryTable:e.getList}})],1),n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],attrs:{data:e.sceneList,border:!1},on:{"selection-change":e.handleSelectionChange}},[n("el-table-column",{attrs:{type:"selection",width:"55",align:"center"}}),n("el-table-column",{attrs:{label:e.$t("alert.scene-list.591934-1"),align:"left",prop:"sceneName","min-width":"200"}}),n("el-table-column",{attrs:{label:e.$t("alert.index.236501-44"),align:"center",prop:"enable",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("el-switch",{attrs:{"active-value":1,"inactive-value":2,disabled:e.isDisabled},on:{change:function(n){return e.handleEnableChange(t.row)}},model:{value:t.row.enable,callback:function(n){e.$set(t.row,"enable",n)},expression:"scope.row.enable"}})]}}])}),n("el-table-column",{attrs:{label:e.$t("scene.index.670805-0"),align:"center",prop:"hasAlert",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[1==t.row.hasAlert?n("span",[e._v(e._s(e.$t("scene.index.670805-1")))]):e._e(),2==t.row.hasAlert?n("span",[e._v(e._s(e.$t("scene.index.670805-2")))]):e._e()]}}])}),n("el-table-column",{attrs:{label:e.$t("alert.index.236501-19"),align:"center",prop:"cond",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[1==t.row.cond?n("span",[e._v(e._s(e.$t("alert.index.236501-20")))]):e._e(),2==t.row.cond?n("span",[e._v(e._s(e.$t("alert.index.236501-21")))]):e._e(),3==t.row.cond?n("span",[e._v(e._s(e.$t("alert.index.236501-22")))]):e._e()]}}])}),n("el-table-column",{attrs:{label:e.$t("alert.index.236501-23"),align:"center",prop:"executeMode",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[1==t.row.executeMode?n("span",[e._v(e._s(e.$t("alert.index.236501-24")))]):e._e(),2==t.row.executeMode?n("span",[e._v(e._s(e.$t("alert.index.236501-25")))]):e._e()]}}])}),n("el-table-column",{attrs:{label:e.$t("scene.index.670805-3"),align:"center",prop:"silentPeriod",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("span",[e._v(e._s(t.row.silentPeriod)+" "+e._s(e.$t("scene.index.670805-4")))])]}}])}),n("el-table-column",{attrs:{label:e.$t("scene.index.670805-6"),align:"center",prop:"executeDelay",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("span",[e._v(e._s(t.row.executeDelay)+" "+e._s(e.$t("scene.index.670805-5")))])]}}])}),n("el-table-column",{attrs:{label:e.$t("creatTime"),align:"center",prop:"createTime",width:"120"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("span",[e._v(e._s(e.parseTime(t.row.createTime,"{y}-{m}-{d}")))])]}}])}),n("el-table-column",{attrs:{fixed:"right",label:e.$t("opation"),align:"center",width:"260"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:scene:query"],expression:"['iot:scene:query']"}],attrs:{size:"small",type:"text",icon:"el-icon-view"},on:{click:function(n){return e.handleUpdate(t.row)}}},[e._v(e._s(e.$t("look")))]),n("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:scene:remove"],expression:"['iot:scene:remove']"}],attrs:{size:"small",type:"text",icon:"el-icon-delete"},on:{click:function(n){return e.handleDelete(t.row)}}},[e._v(e._s(e.$t("del")))]),n("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:scene:run"],expression:"['iot:scene:run']"}],attrs:{size:"small",type:"text",icon:"el-icon-caret-right"},on:{click:function(n){return e.handleRun(t.row)}}},[e._v(e._s(e.$t("scene.index.670805-7")))]),n("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:scene:run"],expression:"['iot:scene:run']"}],attrs:{size:"small",type:"text",icon:"el-icon-view"},on:{click:function(n){return e.handleLog(t.row.chainName)}}},[e._v(e._s(e.$t("script.349087-36")))])]}}])})],1),n("pagination",{directives:[{name:"show",rawName:"v-show",value:e.total>0,expression:"total > 0"}],staticStyle:{"margin-bottom":"20px"},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),n("el-dialog",{staticClass:"scene-config-dialog",attrs:{title:e.title,visible:e.open,width:"900px","append-to-body":"","close-on-click-modal":!1,"close-on-press-escape":!1},on:{"update:visible":function(t){e.open=t}}},[n("el-form",{ref:"form",attrs:{model:e.form,rules:e.rules,"label-width":"90px"}},[n("el-row",{attrs:{gutter:50}},[n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:e.$t("alert.index.236501-18"),prop:"sceneName"}},[n("el-input",{attrs:{placeholder:e.$t("alert.scene-list.591934-2")},model:{value:e.form.sceneName,callback:function(t){e.$set(e.form,"sceneName",t)},expression:"form.sceneName"}})],1),n("el-form-item",{attrs:{label:e.$t("scene.index.670805-8")}},[n("el-switch",{attrs:{"active-value":1,"inactive-value":2},model:{value:e.form.enable,callback:function(t){e.$set(e.form,"enable",t)},expression:"form.enable"}})],1)],1),n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:e.$t("alert.index.236501-11"),prop:"remark"}},[n("el-input",{attrs:{type:"textarea",rows:"4",placeholder:e.$t("plzInput")},model:{value:e.form.remark,callback:function(t){e.$set(e.form,"remark",t)},expression:"form.remark"}})],1)],1)],1),n("div",{staticStyle:{height:"1px","background-color":"#ddd",margin:"0 0 20px 0"}}),n("div",{staticClass:"condition-wrap"},[n("el-form-item",{attrs:{label:e.$t("scene.index.670805-9"),prop:"triggers"}},[n("div",{staticClass:"item-wrap",staticStyle:{"background-color":"#eef3f7"}},[n("el-row",{attrs:{gutter:16}},[n("el-col",{attrs:{span:24}},[n("span",[e._v(e._s(e.$t("scene.index.670805-10")))]),n("el-select",{staticStyle:{width:"160px"},attrs:{placeholder:e.$t("scene.index.670805-11"),size:"small"},model:{value:e.form.cond,callback:function(t){e.$set(e.form,"cond",t)},expression:"form.cond"}},[n("el-option",{key:"1",attrs:{label:e.$t("alert.index.236501-20"),value:1}}),n("el-option",{key:"2",attrs:{label:e.$t("alert.index.236501-21"),value:2}}),n("el-option",{key:"3",attrs:{label:e.$t("scene.index.670805-12"),value:3,disabled:e.formJson.triggers.length>1}})],1),n("span",{staticStyle:{"margin-left":"20px","font-size":"12px"}},[e._v(e._s(e.$t("scene.index.670805-13")))])],1)],1)],1),e._l(e.formJson.triggers,(function(t,r){return n("div",{key:r,staticClass:"item-wrap"},[n("el-row",{attrs:{gutter:16}},[n("el-col",{attrs:{span:5}},[n("el-select",{attrs:{placeholder:e.$t("pleaseSelect"),size:"small"},on:{change:function(t){return e.handleTriggerSource(t,r)}},model:{value:t.source,callback:function(n){e.$set(t,"source",n)},expression:"item.source"}},e._l(e.triggerSource,(function(e){return n("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),1==t.source?n("el-col",{attrs:{span:10}},[n("el-input",{staticStyle:{"margin-top":"3px"},attrs:{readonly:"",size:"small",placeholder:e.$t("product.product-things-model.142341-83")},model:{value:t.deviceCount,callback:function(n){e.$set(t,"deviceCount",n)},expression:"item.deviceCount"}},[n("span",{attrs:{slot:"prepend",disabled:""},slot:"prepend"},[e._v(e._s(e.$t("scene.index.670805-14")))]),n("el-button",{attrs:{slot:"append",size:"small"},on:{click:function(n){return e.handleSelectDevice("trigger",t,r)}},slot:"append"},[e._v(e._s(e.$t("firmware.index.222541-31")))])],1)],1):e._e(),3==t.source?n("el-col",{attrs:{span:10}},[n("el-input",{staticStyle:{"margin-top":"3px"},attrs:{readonly:"",size:"small",placeholder:e.$t("device.allot-import-dialog.060657-1")},model:{value:t.productName,callback:function(n){e.$set(t,"productName",n)},expression:"item.productName"}},[n("el-button",{attrs:{slot:"append",size:"small"},on:{click:function(n){return e.handleSelectProduct("trigger",t,r)}},slot:"append"},[e._v(e._s(e.$t("sip.product-list.998536-0")))])],1)],1):e._e(),0!=r?n("div",{staticClass:"delete-wrap"},[n("el-button",{staticStyle:{padding:"5px"},attrs:{size:"small",plain:"",type:"danger",icon:"el-icon-delete"},on:{click:function(t){return e.handleRemoveTrigger(r)}}},[e._v(e._s(e.$t("del")))])],1):e._e()],1),n("el-row",{attrs:{gutter:16}},[4==t.source?n("el-col",{attrs:{span:10}},[n("el-input",{staticStyle:{"margin-top":"3px"},attrs:{size:"small",placeholder:e.$t("scene.index.670805-77")},model:{value:t.id,callback:function(n){e.$set(t,"id",n)},expression:"item.id"}},[n("span",{attrs:{slot:"prepend",disabled:""},slot:"prepend"},[e._v(e._s(e.$t("scene.index.670805-78")))])]),n("AceEditor",{ref:"codeEditor",refInFor:!0,attrs:{content:t.value,lang:"json",codeStyle:"chrome","read-only":!1,width:"100%",height:"200px"},on:{"update:content":function(n){return e.$set(t,"value",n)}}})],1):e._e()],1),2==t.source?n("el-row",{attrs:{gutter:16}},[n("el-col",{attrs:{span:5}},[n("el-time-picker",{staticStyle:{width:"100%"},attrs:{size:"small","value-format":"HH:mm",format:"HH:mm",placeholder:e.$t("device.device-timer.433369-19"),disabled:1==t.isAdvance},on:{change:function(t){return e.timeChange(t,r)}},model:{value:t.timerTimeValue,callback:function(n){e.$set(t,"timerTimeValue",n)},expression:"item.timerTimeValue"}})],1),n("el-col",{attrs:{span:19}},[n("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:e.$t("pleaseSelect"),multiple:"",size:"small",disabled:1==t.isAdvance},on:{change:function(t){return e.weekChange(t,r)}},model:{value:t.timerWeekValue,callback:function(n){e.$set(t,"timerWeekValue",n)},expression:"item.timerWeekValue"}},e._l(e.timerWeeks,(function(e){return n("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),n("el-col",{staticStyle:{"margin-top":"5px"},attrs:{span:5}},[n("el-checkbox",{staticStyle:{width:"100%"},attrs:{"true-label":1,"false-label":0,border:"",size:"small"},on:{change:function(t){e.customerCronChange(r)}},model:{value:t.isAdvance,callback:function(n){e.$set(t,"isAdvance",n)},expression:"item.isAdvance"}},[e._v(" "+e._s(e.$t("scene.index.670805-15"))+" ")])],1),n("el-col",{staticStyle:{"margin-top":"10px"},attrs:{span:19}},[n("el-input",{attrs:{placeholder:e.$t("scene.index.670805-16"),disabled:0==t.isAdvance,size:"small"},model:{value:t.cronExpression,callback:function(n){e.$set(t,"cronExpression",n)},expression:"item.cronExpression"}},[n("template",{slot:"append"},[n("el-button",{attrs:{type:"primary",disabled:0==t.isAdvance},on:{click:function(n){return e.handleShowCron(t,r)}}},[e._v(" "+e._s(e.$t("scene.index.670805-17"))+" "),n("i",{staticClass:"el-icon-time el-icon--right"})])],1)],2)],1)],1):e._e(),t.thingsModel?n("div",[n("el-row",{attrs:{gutter:16}},[n("el-col",{attrs:{span:5}},[n("el-select",{attrs:{placeholder:e.$t("scene.index.670805-18"),size:"small"},on:{change:function(t){return e.handleTriggerTypeChange(t,r)}},model:{value:t.type,callback:function(n){e.$set(t,"type",n)},expression:"item.type"}},e._l(e.triggerTypes,(function(e,t){return n("el-option",{key:t+"type",attrs:{label:e.label,value:e.value}})})),1)],1),n("el-col",{attrs:{span:10}},[1==t.type?n("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:e.$t("scene.index.670805-19"),size:"small"},on:{change:function(t){return e.handleTriggerParentModelChange(t,r)}},model:{value:t.parentId,callback:function(n){e.$set(t,"parentId",n)},expression:"item.parentId"}},e._l(t.thingsModel.properties,(function(e,t){return n("el-option",{key:t+"triggerProperty",attrs:{label:e.name,value:e.id}})})),1):2==t.type?n("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:e.$t("scene.index.670805-19"),size:"small"},on:{change:function(t){return e.handleTriggerParentModelChange(t,r)}},model:{value:t.parentId,callback:function(n){e.$set(t,"parentId",n)},expression:"item.parentId"}},e._l(t.thingsModel.functions,(function(e,t){return n("el-option",{key:t+"triggerFunc",attrs:{label:e.name,value:e.id}})})),1):3==t.type?n("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:e.$t("scene.index.670805-19"),size:"small"},on:{change:function(t){return e.handleTriggerParentModelChange(t,r)}},model:{value:t.parentId,callback:function(n){e.$set(t,"parentId",n)},expression:"item.parentId"}},e._l(t.thingsModel.events,(function(e,t){return n("el-option",{key:t+"triggerEvents",attrs:{label:e.name,value:e.id}})})),1):e._e()],1)],1),n("el-row",{attrs:{gutter:16}},[t.parentModel&&"array"===t.parentModel.datatype.type?n("el-col",{attrs:{span:5}},[n("el-select",{attrs:{placeholder:e.$t("pleaseSelect"),size:"small"},on:{change:function(t){return e.handleTriggerIndexChange(t,r)}},model:{value:t.arrayIndex,callback:function(n){e.$set(t,"arrayIndex",n)},expression:"item.arrayIndex"}},e._l(t.parentModel.datatype.arrayModel,(function(e){return n("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})})),1)],1):e._e(),t.parentModel&&"array"===t.parentModel.datatype.type&&"object"===t.parentModel.datatype.arrayType?n("el-col",{attrs:{span:5}},[n("el-select",{attrs:{placeholder:e.$t("pleaseSelect"),size:"small"},on:{change:function(t){return e.handleTriggerModelChange(t,r)}},model:{value:t.id,callback:function(n){e.$set(t,"id",n)},expression:"item.id"}},e._l(t.parentModel.datatype.params,(function(e,t){return n("el-option",{key:t,attrs:{label:e.name,value:e.id}})})),1)],1):e._e(),t.parentModel&&"object"===t.parentModel.datatype.type?n("el-col",{attrs:{span:5}},[n("el-select",{attrs:{placeholder:e.$t("pleaseSelect"),size:"small"},on:{change:function(t){return e.handleTriggerModelChange(t,r)}},model:{value:t.id,callback:function(n){e.$set(t,"id",n)},expression:"item.id"}},e._l(t.parentModel.datatype.params,(function(e,t){return n("el-option",{key:t,attrs:{label:e.name,value:e.id}})})),1)],1):e._e(),!t.model||"integer"!==t.model.datatype.type&&"decimal"!==t.model.datatype.type&&"string"!==t.model.datatype.type?e._e():n("el-col",{attrs:{span:5}},[n("el-select",{attrs:{placeholder:e.$t("scene.index.670805-20"),size:"small"},model:{value:t.operator,callback:function(n){e.$set(t,"operator",n)},expression:"item.operator"}},[n("el-option",{key:"=",attrs:{label:"等于(=)",value:"="}}),n("el-option",{key:"!=",attrs:{label:"不等于(!=)",value:"!="}}),"integer"===t.model.datatype.type||"decimal"===t.model.datatype.type?n("el-option",{key:">",attrs:{label:"大于(>)",value:">"}}):e._e(),"integer"===t.model.datatype.type||"decimal"===t.model.datatype.type?n("el-option",{key:"<",attrs:{label:"小于(<)",value:"<"}}):e._e(),"integer"===t.model.datatype.type||"decimal"===t.model.datatype.type?n("el-option",{key:">=",attrs:{label:"大于等于(>=)",value:">="}}):e._e(),"integer"===t.model.datatype.type||"decimal"===t.model.datatype.type?n("el-option",{key:"<=",attrs:{label:"小于等于(<=)",value:"<="}}):e._e(),"integer"===t.model.datatype.type||"decimal"===t.model.datatype.type?n("el-option",{key:"between",attrs:{label:"在...之间(between)",value:"between"}}):e._e(),"integer"===t.model.datatype.type||"decimal"===t.model.datatype.type?n("el-option",{key:"notBetween",attrs:{label:"不在...之间(notBetween)",value:"notBetween"}}):e._e(),"string"===t.model.datatype.type?n("el-option",{key:"contain",attrs:{label:"包含(contain)",value:"contain"}}):e._e(),"string"===t.model.datatype.type?n("el-option",{key:"notContain",attrs:{label:"不包含(notContain)",value:"notContain"}}):e._e()],1)],1),t.model?n("el-col",{attrs:{span:9}},["integer"===t.model.datatype.type||"decimal"===t.model.datatype.type?n("div",{directives:[{name:"show",rawName:"v-show",value:"between"===t.operator||"notBetween"===t.operator,expression:"item.operator === 'between' || item.operator === 'notBetween'"}]},[n("el-input",{staticStyle:{width:"95px","vertical-align":"baseline"},attrs:{placeholder:e.$t("scene.index.670805-21"),max:t.model.datatype.max,min:t.model.datatype.min,type:"number",size:"small"},on:{input:function(n){return e.valueChange(n,t)}},model:{value:t.valueA,callback:function(n){e.$set(t,"valueA",n)},expression:"item.valueA"}}),n("span",{staticStyle:{padding:"0 3px",color:"#999"}},[e._v("-")]),n("el-input",{staticStyle:{width:"165px","vertical-align":"baseline"},attrs:{placeholder:e.$t("scene.index.670805-21"),max:t.model.datatype.max,min:t.model.datatype.min,type:"number",size:"small"},on:{input:function(n){return e.valueChange(n,t)}},model:{value:t.valueB,callback:function(n){e.$set(t,"valueB",n)},expression:"item.valueB"}},[n("template",{slot:"append"},[e._v(e._s(t.model.datatype.unit))])],2)],1):e._e(),"integer"===t.model.datatype.type||"decimal"===t.model.datatype.type?n("div",{directives:[{name:"show",rawName:"v-show",value:"between"!==t.operator&&"notBetween"!==t.operator,expression:"item.operator !== 'between' && item.operator !== 'notBetween'"}]},[n("el-input",{staticStyle:{"vertical-align":"baseline"},attrs:{placeholder:e.$t("scene.index.670805-21"),size:"small"},model:{value:t.value,callback:function(n){e.$set(t,"value",n)},expression:"item.value"}},[n("template",{slot:"append"},[e._v(e._s(t.model.datatype.unit))])],2)],1):"bool"===t.model.datatype.type?n("div",[n("el-switch",{staticStyle:{"vertical-align":"sub"},attrs:{"active-text":t.model.datatype.trueText,"inactive-text":t.model.datatype.falseText,"active-value":"1","inactive-value":"0",size:"mini"},model:{value:t.value,callback:function(n){e.$set(t,"value",n)},expression:"item.value"}})],1):"enum"===t.model.datatype.type?n("div",[n("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:e.$t("pleaseSelect"),size:"small"},model:{value:t.value,callback:function(n){e.$set(t,"value",n)},expression:"item.value"}},e._l(t.model.datatype.enumList,(function(e,t){return n("el-option",{key:t+"things",attrs:{label:e.text,value:e.value}})})),1)],1):"string"===t.model.datatype.type?n("div",[n("el-input",{attrs:{placeholder:e.$t("scene.index.670805-22"),size:"small",max:t.model.datatype.maxLength},model:{value:t.value,callback:function(n){e.$set(t,"value",n)},expression:"item.value"}})],1):e._e()]):e._e()],1)],1):e._e()],1)})),3==e.form.cond&&e.formJson.triggers.length>0?e._e():n("div",[e._v(" + "),n("a",{staticStyle:{color:"#486ff2"},on:{click:function(t){return e.handleAddTrigger()}}},[e._v(e._s(e.$t("scene.index.670805-23")))])])],2)],1),n("el-divider"),n("div",{staticClass:"action-wrap"},[n("el-form-item",{attrs:{label:e.$t("scene.index.670805-24")}},[n("div",{staticClass:"item-wrap",staticStyle:{"background-color":"#eef3f7"}},[n("el-row",{attrs:{gutter:16}},[n("el-col",{attrs:{span:8}},[n("span",[n("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:e.$t("scene.index.670805-25"),placement:"top"}},[n("i",{staticClass:"el-icon-question"})]),e._v(" "+e._s(e.$t("scene.index.670805-26"))+" ")],1),n("el-input",{staticStyle:{width:"140px"},attrs:{size:"small",placeholder:e.$t("scene.index.670805-4"),type:"number"},model:{value:e.form.silentPeriod,callback:function(t){e.$set(e.form,"silentPeriod",t)},expression:"form.silentPeriod"}},[n("template",{slot:"append"},[e._v(e._s(e.$t("scene.index.670805-4")))])],2)],1),n("el-col",{attrs:{span:8}},[n("span",[e._v(e._s(e.$t("scene.index.670805-27")))]),n("el-select",{staticStyle:{width:"160px"},attrs:{placeholder:e.$t("scene.index.670805-28"),size:"small"},model:{value:e.form.executeMode,callback:function(t){e.$set(e.form,"executeMode",t)},expression:"form.executeMode"}},[n("el-option",{key:"1",attrs:{label:e.$t("scene.index.670805-29"),value:1}}),n("el-option",{key:"2",attrs:{label:e.$t("scene.index.670805-30"),value:2}})],1)],1),n("el-col",{attrs:{span:8}},[n("span",[n("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:e.$t("scene.index.670805-31"),placement:"top"}},[n("i",{staticClass:"el-icon-question"})]),e._v(" "+e._s(e.$t("scene.index.670805-32"))+" ")],1),n("el-input",{staticStyle:{width:"140px"},attrs:{size:"small",prop:"executeDelay",placeholder:e.$t("scene.index.670805-5"),max:90,min:0,oninput:"if(value>90)value=90;if(value<0)value=0",type:"number"},model:{value:e.form.executeDelay,callback:function(t){e.$set(e.form,"executeDelay",t)},expression:"form.executeDelay"}},[n("template",{slot:"append"},[e._v(e._s(e.$t("scene.index.670805-5")))])],2)],1)],1)],1),e._l(e.formJson.actions,(function(t,r){return n("div",{key:r,staticClass:"item-wrap"},[n("el-row",{attrs:{gutter:16}},[n("el-col",{attrs:{span:5}},[n("el-select",{attrs:{placeholder:e.$t("pleaseSelect"),size:"small"},on:{change:function(t){return e.handleActionSourceChange(t,r)}},model:{value:t.source,callback:function(n){e.$set(t,"source",n)},expression:"item.source"}},e._l(e.actionSource,(function(e){return n("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),1==t.source?n("el-col",{attrs:{span:10}},[n("el-input",{staticStyle:{"margin-top":"3px"},attrs:{readonly:"",size:"small",placeholder:e.$t("scene.index.670805-33")},model:{value:t.deviceCount,callback:function(n){e.$set(t,"deviceCount",n)},expression:"item.deviceCount"}},[n("span",{attrs:{slot:"prepend",disabled:""},slot:"prepend"},[e._v(e._s(e.$t("scene.index.670805-14")))]),n("el-button",{attrs:{slot:"append",size:"small"},on:{click:function(n){return e.handleSelectDevice("action",t,r)}},slot:"append"},[e._v(e._s(e.$t("scene.index.670805-34")))])],1)],1):e._e(),3==t.source?n("el-col",{attrs:{span:10}},[n("el-input",{staticStyle:{"margin-top":"3px"},attrs:{readonly:"",size:"small",placeholder:e.$t("scene.index.670805-35")},model:{value:t.productName,callback:function(n){e.$set(t,"productName",n)},expression:"item.productName"}},[n("el-button",{attrs:{slot:"append",size:"small"},on:{click:function(n){return e.handleSelectProduct("action",t,r)}},slot:"append"},[e._v(e._s(e.$t("scene.index.670805-36")))])],1)],1):e._e(),5==t.source?n("el-col",{attrs:{span:10}},[n("el-input",{staticStyle:{"margin-top":"3px"},attrs:{readonly:"",size:"small",placeholder:e.$t("scene.index.670805-75")},model:{value:t.name,callback:function(n){e.$set(t,"name",n)},expression:"item.name"}},[n("el-button",{attrs:{slot:"append",size:"small"},on:{click:function(n){return e.handleSelectRecoverScenes("action",t,r)}},slot:"append"},[e._v(e._s(e.$t("scene.index.670805-76")))])],1)],1):e._e(),n("div",{staticClass:"delete-wrap"},[0!=r?n("el-button",{staticStyle:{padding:"5px"},attrs:{size:"small",plain:"",type:"danger",icon:"el-icon-delete"},on:{click:function(t){return e.handleRemoveAction(r)}}},[e._v(e._s(e.$t("del")))]):e._e()],1)],1),t.thingsModel?n("div",[n("el-row",{attrs:{gutter:16}},[n("el-col",{attrs:{span:5}},[n("el-select",{attrs:{placeholder:e.$t("scene.index.670805-1"),size:"small"},on:{change:function(t){return e.handleActionTypeChange(t,r)}},model:{value:t.type,callback:function(n){e.$set(t,"type",n)},expression:"item.type"}},e._l(e.actionTypes,(function(e,t){return n("el-option",{key:t+"type",attrs:{label:e.label,value:e.value}})})),1)],1),n("el-col",{attrs:{span:10}},[1==t.type?n("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:e.$t("scene.index.670805-19"),size:"small"},on:{change:function(t){return e.handleActionParentModelChange(t,r)}},model:{value:t.parentId,callback:function(n){e.$set(t,"parentId",n)},expression:"item.parentId"}},e._l(t.thingsModel.properties,(function(e,t){return n("el-option",{key:t+"actionProperty",attrs:{label:e.name,value:e.id}})})),1):2==t.type?n("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:e.$t("scene.index.670805-19"),size:"small"},on:{change:function(t){return e.handleActionParentModelChange(t,r)}},model:{value:t.parentId,callback:function(n){e.$set(t,"parentId",n)},expression:"item.parentId"}},e._l(t.thingsModel.functions,(function(e,t){return n("el-option",{key:t+"actionFunc",attrs:{label:e.name,value:e.id}})})),1):e._e()],1)],1),n("el-row",{attrs:{gutter:16}},[t.parentModel&&"array"===t.parentModel.datatype.type?n("el-col",{attrs:{span:5}},[n("el-select",{attrs:{placeholder:e.$t("pleaseSelect"),size:"small"},on:{change:function(t){return e.handleActionIndexChange(t,r)}},model:{value:t.arrayIndex,callback:function(n){e.$set(t,"arrayIndex",n)},expression:"item.arrayIndex"}},e._l(t.parentModel.datatype.arrayModel,(function(e){return n("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})})),1)],1):e._e(),t.parentModel&&"array"===t.parentModel.datatype.type&&"object"===t.parentModel.datatype.arrayType?n("el-col",{attrs:{span:5}},[n("el-select",{attrs:{placeholder:e.$t("pleaseSelect"),size:"small"},on:{change:function(t){return e.handleActionModelChange(t,r)}},model:{value:t.id,callback:function(n){e.$set(t,"id",n)},expression:"item.id"}},e._l(t.parentModel.datatype.params,(function(e,t){return n("el-option",{key:t,attrs:{label:e.name,value:e.id}})})),1)],1):e._e(),t.parentModel&&"object"===t.parentModel.datatype.type?n("el-col",{attrs:{span:5}},[n("el-select",{attrs:{placeholder:e.$t("pleaseSelect"),size:"small"},on:{change:function(t){return e.handleActionModelChange(t,r)}},model:{value:t.id,callback:function(n){e.$set(t,"id",n)},expression:"item.id"}},e._l(t.parentModel.datatype.params,(function(e,t){return n("el-option",{key:t,attrs:{label:e.name,value:e.id}})})),1)],1):e._e(),t.model?n("el-col",{attrs:{span:10}},["integer"===t.model.datatype.type||"decimal"===t.model.datatype.type?n("div",[n("el-input",{staticStyle:{"vertical-align":"baseline"},attrs:{placeholder:e.$t("scene.index.670805-21"),max:t.model.datatype.max,min:t.model.datatype.min,type:"number",size:"small"},model:{value:t.value,callback:function(n){e.$set(t,"value",n)},expression:"item.value"}},[n("template",{slot:"append"},[e._v(e._s(t.model.datatype.unit))])],2)],1):"bool"===t.model.datatype.type?n("div",[n("el-switch",{staticStyle:{"vertical-align":"baseline"},attrs:{"active-text":t.model.datatype.trueText,"inactive-text":t.model.datatype.falseText,"active-value":"1","inactive-value":"0"},model:{value:t.value,callback:function(n){e.$set(t,"value",n)},expression:"item.value"}})],1):"enum"===t.model.datatype.type?n("div",[n("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:e.$t("pleaseSelect"),size:"small"},model:{value:t.value,callback:function(n){e.$set(t,"value",n)},expression:"item.value"}},e._l(t.model.datatype.enumList,(function(e,t){return n("el-option",{key:t+"things",attrs:{label:e.text,value:e.value}})})),1)],1):"string"===t.model.datatype.type?n("div",[n("el-input",{attrs:{placeholder:e.$t("scene.index.670805-22"),size:"small",max:t.model.datatype.maxLength},model:{value:t.value,callback:function(n){e.$set(t,"value",n)},expression:"item.value"}})],1):e._e()]):e._e()],1)],1):e._e()],1)})),n("div",[e._v(" + "),n("a",{staticStyle:{color:"#486ff2"},on:{click:function(t){return e.handleAddAction()}}},[e._v(e._s(e.$t("scene.index.670805-37")))])])],2)],1)],1),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:scene:edit"],expression:"['iot:scene:edit']"},{name:"show",rawName:"v-show",value:e.form.sceneId,expression:"form.sceneId"}],attrs:{type:"primary",disabled:e.updateBtnDisabled,loading:e.confirmLoading},on:{click:e.handleSubmitForm}},[e._v(e._s(e.$t("update")))]),n("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:scene:add"],expression:"['iot:scene:add']"},{name:"show",rawName:"v-show",value:!e.form.sceneId,expression:"!form.sceneId"}],attrs:{type:"primary",disabled:e.updateBtnDisabled,loading:e.confirmLoading},on:{click:e.handleSubmitForm}},[e._v(e._s(e.$t("add")))]),n("el-button",{on:{click:e.cancel}},[e._v(e._s(e.$t("cancel")))])],1)],1),n("el-dialog",{attrs:{title:e.title,visible:e.openLog,width:"800px","append-to-body":"","close-on-click-modal":!1,"close-on-press-escape":!1},on:{"update:visible":function(t){e.openLog=t}}},[n("div",{directives:[{name:"loading",rawName:"v-loading",value:e.logLoading,expression:"logLoading"}],ref:"logContainer",staticStyle:{border:"1px solid #ccc","border-radius":"4px",height:"480px","background-color":"#181818",color:"#fff",padding:"10px","line-height":"20px",overflow:"auto"},attrs:{"element-loading-text":e.$t("script.349087-39"),"element-loading-spinner":"el-icon-loading","element-loading-background":"rgba(0, 0, 0, 0.8)"}},[n("pre",[e._v(" "+e._s(e.logs)+"\n ")])]),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{on:{click:e.cancelLog}},[e._v(e._s(e.$t("script.349087-38")))])],1)]),n("deviceList",{ref:"deviceList",on:{deviceEvent:function(t){return e.getSelectProductDevice(t,1)}}}),n("productList",{ref:"productList",on:{productEvent:function(t){return e.getSelectProductDevice(t,2)}}}),n("scene-list",{ref:"sceneList",on:{sceneEvent:function(t){return e.getSceneData(t)}}}),n("el-dialog",{staticClass:"scrollbar",attrs:{title:e.$t("scene.index.670805-38"),visible:e.openCron,"append-to-body":"","destroy-on-close":""},on:{"update:visible":function(t){e.openCron=t}}},[n("crontab",{staticStyle:{"padding-bottom":"10px"},attrs:{expression:e.expression},on:{hide:function(t){e.openCron=!1},fill:e.crontabFill}})],1)],1)},a=[],o=n("5530"),i=(n("4de4"),n("7db0"),n("d81d"),n("14d9"),n("fb6a"),n("4e82"),n("a434"),n("b0c0"),n("a9e3"),n("b64b"),n("d3b7"),n("2e40")),s=n("01ca"),l=n("bdd0"),c=n("ed76"),d=n("2c9f"),u=n("2d89"),p=n("9edeb"),m=n("e350"),f={name:"scene",components:{AceEditor:p["default"],deviceList:c["default"],productList:d["default"],sceneList:u["default"],Crontab:l["a"]},data:function(){return{confirmLoading:!1,updateBtnDisabled:!1,currentType:null,currentIndex:null,loading:!0,ids:[],single:!0,multiple:!0,showSearch:!0,total:0,sceneList:[],title:"",open:!1,logs:"",logChainID:"",openCron:!1,openLog:!1,logLoading:!1,expression:"",triggerIndex:0,isDisabled:!1,queryParams:{pageNum:1,pageSize:10,sceneName:null,userId:null,userName:null},timerWeeks:[{value:1,label:this.$t("scene.index.670805-39")},{value:2,label:this.$t("scene.index.670805-40")},{value:3,label:this.$t("scene.index.670805-41")},{value:4,label:this.$t("scene.index.670805-42")},{value:5,label:this.$t("scene.index.670805-43")},{value:6,label:this.$t("scene.index.670805-44")},{value:7,label:this.$t("scene.index.670805-45")}],triggerSource:[{value:1,label:this.$t("scene.index.670805-46")},{value:2,label:this.$t("scene.index.670805-47")},{value:3,label:this.$t("scene.index.670805-48")},{value:4,label:this.$t("scene.index.670805-49")}],triggerTypes:[{value:1,label:this.$t("scene.index.670805-50")},{value:2,label:this.$t("scene.index.670805-51")},{value:3,label:this.$t("scene.index.670805-52")},{value:5,label:this.$t("scene.index.670805-53")},{value:6,label:this.$t("scene.index.670805-54")}],actionSource:[{value:1,label:this.$t("scene.index.670805-55")},{value:3,label:this.$t("scene.index.670805-56")},{value:4,label:this.$t("scene.index.670805-57")},{value:5,label:this.$t("scene.index.670805-58")}],actionTypes:[{value:1,label:this.$t("scene.index.670805-50")},{value:2,label:this.$t("scene.index.670805-51")}],formJson:{triggers:[{timerTimeValue:"",timerWeekValue:[1,2,3,4,5,6,7]}],actions:[]},form:{},rules:{sceneName:[{required:!0,message:this.$t("scene.index.670805-59"),trigger:"blur"}],executeDelay:[{required:!0,max:90,min:0,message:this.$t("scene.index.670805-60"),trigger:"blur"}],checkDelay:[{required:!0,max:600,min:0,message:this.$t("scene.index.670805-61"),trigger:"blur"}]}}},created:function(){this.getList();var e=Object(m["a"])(["iot:scene:edit"]);e||(this.isDisabled=!0)},methods:{getList:function(){var e=this;this.loading=!0,Object(i["e"])(this.queryParams).then((function(t){e.sceneList=t.rows,e.total=t.total,e.loading=!1}))},cancel:function(){this.open=!1,this.reset()},reset:function(){this.form={sceneId:null,recoverId:null,recoverSceneName:null,sceneName:null,userId:null,userName:null,remark:null,enable:1,cond:1,silentPeriod:0,executeMode:1,executeDelay:0,checkDelay:0,hasAlert:2,applicationName:"fastbee"},this.formJson={triggers:[{productId:0,productName:"",deviceCount:0,deviceNums:[],source:1,type:1,parentId:"",parentName:"",parentModel:null,model:null,operator:"",id:"",name:"",value:"",valueA:"",valueB:"",arrayIndex:"",arrayIndexName:"",isAdvance:0,cronExpression:"",timerTimeValue:"",timerWeekValue:[1,2,3,4,5,6,7],scriptPurpose:3}],actions:[{productId:0,productName:"",deviceCount:0,deviceNums:[],source:1,type:2,parentId:"",parentName:"",parentModel:null,model:null,id:"",name:"",value:"",arrayIndex:"",arrayIndexName:"",scriptPurpose:3}]},this.confirmLoading=!1,this.updateBtnDisabled=!1,this.resetForm("form")},valueChange:function(e,t){t.value=t.valueA+"-"+t.valueB},handleQuery:function(){this.queryParams.pageNum=1,this.getList()},handleResetQuery:function(){this.resetForm("queryForm"),this.handleQuery()},handleEnableChange:function(e){var t=this;this.isDisabled=!0,setTimeout((function(){t.isDisabled=!1}),1e3),this.reset();var n=e.sceneId;Object(i["c"])(n).then((function(e){200===e.code&&(t.form=e.data,t.form.enable=1==t.form.enable?2:1,Object(i["g"])(t.form).then((function(e){200===e.code&&(t.getList(),t.$modal.msgSuccess(t.$t("updateSuccess"))),t.open=!1})))}))},handleSelectionChange:function(e){this.ids=e.map((function(e){return e.sceneId})),this.single=1!==e.length,this.multiple=!e.length},handleAdd:function(){this.reset(),this.open=!0,this.title=this.$t("scene.index.670805-62")},handleUpdate:function(e){var t=this;this.reset();var n=e.sceneId||this.ids;Object(i["c"])(n).then((function(e){t.form=e.data,t.formJson.triggers=t.form.triggers;for(var n=0;n<t.formJson.triggers.length;n++)if(2==t.formJson.triggers[n].source){if(0==t.formJson.triggers[n].isAdvance){var r=t.formJson.triggers[n].cronExpression.substring(12).split(",").map(Number);t.formJson.triggers[n].timerWeekValue=r;var a=t.formJson.triggers[n].cronExpression.substring(5,7)+":"+t.formJson.triggers[n].cronExpression.substring(2,4);t.$set(t.formJson.triggers[n],"timerTimeValue",a)}}else 4==t.formJson.triggers[n].source||t.formatSceneScript(t.formJson.triggers[n],n);t.formJson.actions=t.form.actions;for(var o=0;o<t.formJson.actions.length;o++)t.formatSceneScript(t.formJson.actions[o],o);setTimeout((function(){t.updateBtnDisabled=!1}),2e3),t.open=!0,t.title=t.$t("scene.index.670805-63")}))},formatSceneScript:function(e,t){var n=this;if(2==e.scriptPurpose)Object(s["b"])(e.productId).then((function(r){var a=JSON.parse(r.data);if(e.thingsModel=n.formatArrayIndex(a),-1!=e.value.indexOf("-")){var o=e.value.split("-");e.valueA=o[0],e.valueB=o[1]}var i=[];1==e.type?i=e.thingsModel.properties:2==e.type?i=e.thingsModel.functions:3==e.type&&(i=e.thingsModel.events),n.setParentAndModelData(e,i),n.$set(n.formJson.triggers,t,n.formJson.triggers[t])}));else if(3==e.scriptPurpose){if(4==e.source||5==e.source)return;Object(s["b"])(e.productId).then((function(r){var a=JSON.parse(r.data);if(e.thingsModel=n.formatArrayIndex(a),e.thingsModel.properties){e.thingsModel.properties=e.thingsModel.properties.filter((function(e){return 0==e.isMonitor&&0==e.isReadonly}));for(var o=0;o<e.thingsModel.properties.length;o++)e.thingsModel.properties[o].datatype.params&&(e.thingsModel.properties[o].datatype.params=e.thingsModel.properties[o].datatype.params.filter((function(e){return 0==e.isReadonly})))}if(e.thingsModel.functions){e.thingsModel.functions=e.thingsModel.functions.filter((function(e){return 0==e.isReadonly}));for(var i=0;i<e.thingsModel.functions.length;i++)e.thingsModel.functions[i].datatype.params&&(e.thingsModel.functions[i].datatype.params=e.thingsModel.functions[i].datatype.params.filter((function(e){return 0==e.isReadonly})))}var s=[];1==e.type?s=e.thingsModel.properties:2==e.type&&(s=e.thingsModel.functions),n.setParentAndModelData(e,s),n.$set(n.formJson.actions,t,n.formJson.actions[t])}))}},setParentAndModelData:function(e,t){for(var n=0;n<t.length;n++)if(e.parentId==t[n].id){if(e.parentModel=t[n],"object"===e.parentModel.datatype.type)for(var r=0;r<e.parentModel.datatype.params.length;r++)e.id==e.parentModel.datatype.params[r].id&&(e.model=e.parentModel.datatype.params[r]);else if("object"===e.parentModel.datatype.arrayType&&"array"===e.parentModel.datatype.type){-1!=e.id.indexOf("array_")&&(e.id=e.id.substring(9));for(var a=0;a<e.parentModel.datatype.params.length;a++)e.id==e.parentModel.datatype.params[a].id&&(e.model=e.parentModel.datatype.params[a])}else"object"!==e.parentModel.datatype.arrayType&&"array"===e.parentModel.datatype.type?(-1!=e.id.indexOf("array_")&&(e.id=e.id.substring(9)),e.model={datatype:{type:e.parentModel.datatype.arrayType,maxLength:-1,min:-1,max:-1,unit:this.$t("scene.index.670805-64")}}):e.model=e.parentModel;break}},handleDelete:function(e){var t=this,n=e.sceneId||this.ids;this.$modal.confirm(this.$t("scene.index.670805-65",[n])).then((function(){return Object(i["b"])(n)})).then((function(){t.getList(),t.$modal.msgSuccess(t.$t("scene.index.670805-66"))})).catch((function(){}))},handleRun:function(e){var t=this,n={sceneId:e.sceneId};Object(i["f"])(n).then((function(e){t.$modal.msgSuccess(e.msg)}))},handleLog:function(e){var t=this;this.logLoading=!0,Object(i["d"])(e).then((function(n){t.logs=n.msg,t.form.chainName=e,t.openLog=!0,t.title=t.$t("script.349087-40"),t.logLoading=!1,t.$nextTick((function(){var e=this.$refs.logContainer;e.scroll({top:e.scrollHeight})}))}))},refreshLog:function(){this.handleLog(this.form.chainName)},cancelLog:function(){this.logs="",this.openLog=!1},handleExport:function(){this.download("iot/scene/export",Object(o["a"])({},this.queryParams),"scene_".concat((new Date).getTime(),".xlsx"))},handleTriggerSource:function(e,t){this.formJson.triggers[t].deviceCount=0,this.formJson.triggers[t].productId="",this.formJson.triggers[t].productName="",this.formJson.triggers[t].thingsModel=null,this.formJson.triggers[t].id="",this.formJson.triggers[t].name="",this.formJson.triggers[t].value="",this.formJson.triggers[t].valueA="",this.formJson.triggers[t].valueB="",this.formJson.triggers[t].parentId="",this.formJson.triggers[t].parentName="",this.formJson.triggers[t].model=null,this.formJson.triggers[t].parentModel=null,this.formJson.triggers[t].operator="",this.formJson.triggers[t].deviceNums=[],this.formJson.triggers[t].timerTimeValue="",this.formJson.triggers[t].timerWeekValue=[1,2,3,4,5,6,7]},handleActionSourceChange:function(e,t){console.log("this.formJson.actions[index]",this.formJson.actions[t]),this.formJson.actions[t].deviceCount=0,this.formJson.actions[t].productId="",this.formJson.actions[t].productName="",this.formJson.actions[t].thingsModel=null,this.formJson.actions[t].id="",this.formJson.actions[t].name="",this.formJson.actions[t].value="",this.formJson.actions[t].valueA="",this.formJson.actions[t].valueB="",this.formJson.actions[t].parentId="",this.formJson.actions[t].parentName="",this.formJson.actions[t].model=null,this.formJson.actions[t].parentModel=null,this.formJson.actions[t].operator="",this.formJson.actions[t].deviceNums=[],this.formJson.actions[t].timerTimeValue="",this.formJson.actions[t].timerWeekValue=[1,2,3,4,5,6,7]},handleSelectDevice:function(e,t,n){this.currentType=e,this.currentIndex=n,this.$refs.deviceList.queryParams.pageNum=1,this.$refs.deviceList.openDeviceList=!0,this.$refs.deviceList.selectDeviceNums=t.deviceNums,this.$refs.deviceList.productId=t.productId,this.$refs.deviceList.productName=t.productName,this.$refs.deviceList.queryParams.productId=t.productId,this.$refs.deviceList.getList()},handleSelectProduct:function(e,t,n){this.currentType=e,this.currentIndex=n,this.$refs.productList.queryParams.pageNum=1,this.$refs.productList.open=!0,this.$refs.productList.selectProductId=t.productId,this.$refs.productList.getList()},handleSelectRecoverScenes:function(e,t,n){this.currentType=e,this.currentIndex=n,this.$refs.sceneList.queryParams.pageNum=1,this.$refs.sceneList.openScene=!0,this.$refs.sceneList.selectSceneId=t.id,this.$refs.sceneList.getList()},getSelectProductDevice:function(e,t){var n=this;null!=this.currentType&&("trigger"==this.currentType?(1==t?(this.formJson.triggers[this.currentIndex].deviceNums=e.deviceNums,this.formJson.triggers[this.currentIndex].deviceCount=e.deviceNums.length,this.formJson.triggers[this.currentIndex].productId=e.productId,this.formJson.triggers[this.currentIndex].productName=e.productName):2==t&&(this.formJson.triggers[this.currentIndex].deviceNums=[],this.formJson.triggers[this.currentIndex].deviceCount=0,this.formJson.triggers[this.currentIndex].productId=e.productId,this.formJson.triggers[this.currentIndex].productName=e.productName),Object(s["b"])(e.productId).then((function(e){var t=JSON.parse(e.data);n.formJson.triggers[n.currentIndex].thingsModel=n.formatArrayIndex(t),n.formJson.triggers[n.currentIndex].type=1,n.formJson.triggers[n.currentIndex].parentId="",n.formJson.triggers[n.currentIndex].parentName="",n.formJson.triggers[n.currentIndex].parentModel=null,n.formJson.triggers[n.currentIndex].model=null,n.formJson.triggers[n.currentIndex].operator="",n.formJson.triggers[n.currentIndex].id="",n.formJson.triggers[n.currentIndex].name="",n.formJson.triggers[n.currentIndex].value="",n.formJson.triggers[n.currentIndex].arrayIndex="",n.formJson.triggers[n.currentIndex].arrayIndexName="",n.$set(n.formJson.triggers,n.currentIndex,n.formJson.triggers[n.currentIndex])}))):"action"==this.currentType&&(1==t?(this.formJson.actions[this.currentIndex].deviceNums=e.deviceNums,this.formJson.actions[this.currentIndex].deviceCount=e.deviceNums.length,this.formJson.actions[this.currentIndex].productId=e.productId,this.formJson.actions[this.currentIndex].productName=e.productName):2==t&&(this.formJson.actions[this.currentIndex].deviceNums=[],this.formJson.actions[this.currentIndex].deviceCount=0,this.formJson.actions[this.currentIndex].productId=e.productId,this.formJson.actions[this.currentIndex].productName=e.productName),Object(s["b"])(e.productId).then((function(e){var t=JSON.parse(e.data);if(n.formJson.actions[n.currentIndex].thingsModel=n.formatArrayIndex(t),n.formJson.actions[n.currentIndex].type=1,n.formJson.actions[n.currentIndex].parentId="",n.formJson.actions[n.currentIndex].parentModel=null,n.formJson.actions[n.currentIndex].parentName="",n.formJson.actions[n.currentIndex].model=null,n.formJson.actions[n.currentIndex].operator="",n.formJson.actions[n.currentIndex].id="",n.formJson.actions[n.currentIndex].name="",n.formJson.actions[n.currentIndex].value="",n.formJson.actions[n.currentIndex].arrayIndex="",n.formJson.actions[n.currentIndex].arrayIndexName="",n.formJson.actions[n.currentIndex].thingsModel.properties){n.formJson.actions[n.currentIndex].thingsModel.properties=n.formJson.actions[n.currentIndex].thingsModel.properties.filter((function(e){return 0==e.isMonitor&&0==e.isReadonly}));for(var r=0;r<n.formJson.actions[n.currentIndex].thingsModel.properties.length;r++)n.formJson.actions[n.currentIndex].thingsModel.properties[r].datatype.params&&(n.formJson.actions[n.currentIndex].thingsModel.properties[r].datatype.params=n.formJson.actions[n.currentIndex].thingsModel.properties[r].datatype.params.filter((function(e){return 0==e.isMonitor&&0==e.isReadonly})))}if(n.formJson.actions[n.currentIndex].thingsModel.functions){n.formJson.actions[n.currentIndex].thingsModel.functions=n.formJson.actions[n.currentIndex].thingsModel.functions.filter((function(e){return 0==e.isReadonly}));for(var a=0;a<n.formJson.actions[n.currentIndex].thingsModel.functions.length;a++)n.formJson.actions[n.currentIndex].thingsModel.functions[a].datatype.params&&(n.formJson.actions[n.currentIndex].thingsModel.functions[a].datatype.params=n.formJson.actions[n.currentIndex].thingsModel.functions[a].datatype.params.filter((function(e){return 0==e.isMonitor&&0==e.isReadonly})))}n.$set(n.formJson.actions,n.currentIndex,n.formJson.actions[n.currentIndex])}))))},getSceneData:function(e){this.formJson.actions[this.currentIndex].id=e.sceneId,this.formJson.actions[this.currentIndex].name=e.sceneName},formatArrayIndex:function(e){var t=Object(o["a"])({},e);for(var n in t)t[n]=t[n].map((function(e){if("array"===e.datatype.type){for(var t=[],n=0;n<e.datatype.arrayCount;n++){var r=n>9?String(n):"0"+n;e.datatype.arrayType,t.push({id:r,name:e.name+" "+(n+1)})}e.datatype.arrayModel=t}return e}));return t},handleTriggerTypeChange:function(e,t){this.formJson.triggers[t].id="",this.formJson.triggers[t].name="",this.formJson.triggers[t].model=null,this.formJson.triggers[t].operator="",this.formJson.triggers[t].value="",this.formJson.triggers[t].valueA="",this.formJson.triggers[t].valueB="",this.formJson.triggers[t].parentId="",this.formJson.triggers[t].parentName="",this.formJson.triggers[t].parentModel=null,this.formJson.triggers[t].arrayIndex="",this.formJson.triggers[t].arrayIndexName=""},handleTriggerParentModelChange:function(e,t){this.formJson.triggers[t].operator="",this.formJson.triggers[t].value="",this.formJson.triggers[t].valueA="",this.formJson.triggers[t].valueB="",this.formJson.triggers[t].arrayIndex="",this.formJson.triggers[t].arrayIndexName="",this.formJson.triggers[t].model=null;var n=[];1==this.formJson.triggers[t].type?n=this.formJson.triggers[t].thingsModel.properties:2==this.formJson.triggers[t].type?n=this.formJson.triggers[t].thingsModel.functions:3==this.formJson.triggers[t].type&&(n=this.formJson.triggers[t].thingsModel.events);for(var r=0;r<n.length;r++)if(n[r].id==e){this.formJson.triggers[t].parentName=n[r].name,this.formJson.triggers[t].parentModel=n[r],"object"===n[r].datatype.type||"array"===n[r].datatype.type&&"object"===n[r].datatype.arrayType?(this.formJson.triggers[t].id="",this.formJson.triggers[t].name=""):"array"===n[r].datatype.type&&"object"!==n[r].datatype.arrayType?(this.formJson.triggers[t].id=n[r].id,this.formJson.triggers[t].name=n[r].name,this.formJson.triggers[t].model={datatype:{type:this.formJson.triggers[t].parentModel.datatype.arrayType,maxLength:-1,min:-1,max:-1,unit:this.$t("scene.index.670805-64")}}):(this.formJson.triggers[t].id=n[r].id,this.formJson.triggers[t].name=n[r].name,this.formJson.triggers[t].model=n[r]);break}},handleTriggerIndexChange:function(e,t){this.formJson.triggers[t].arrayIndexName=this.formJson.triggers[t].parentModel.datatype.arrayModel.find((function(t){return t.id==e})).name,this.formJson.triggers[t].value="",this.formJson.triggers[t].valueA="",this.formJson.triggers[t].valueB="",this.formJson.triggers[t].operator="","object"===this.formJson.triggers[t].parentModel.datatype.arrayType&&(this.formJson.triggers[t].id="",this.formJson.triggers[t].name="")},handleTriggerModelChange:function(e,t){this.formJson.triggers[t].operator="",this.formJson.triggers[t].value="",this.formJson.triggers[t].valueA="",this.formJson.triggers[t].valueB="";var n=null;"array"!==this.formJson.triggers[t].parentModel.datatype.type&&"object"!==this.formJson.triggers[t].parentModel.datatype.type||(n=this.formJson.triggers[t].parentModel.datatype.params.find((function(t){return t.id==e})),this.formJson.triggers[t].name=n.name,this.formJson.triggers[t].model=n)},handleAddTrigger:function(){this.formJson.triggers.push({source:1,type:1,id:"",name:"",operator:"",value:"",valueA:"",valueB:"",model:null,parentModel:null,parentId:"",parentName:"",arrayIndex:"",arrayIndexName:"",isAdvance:0,cronExpression:"",timerTimeValue:"",timerWeekValue:[1,2,3,4,5,6,7],productId:0,productName:"",deviceNums:[],deviceCount:0,scriptPurpose:2})},handleAddAction:function(){this.formJson.actions.push({source:1,type:2,id:"",name:"",value:"",model:null,parentId:"",parentName:"",parentModel:null,arrayIndex:"",arrayIndexName:"",productId:0,productName:"",deviceNums:[],deviceCount:0,scriptPurpose:3})},handleRemoveTrigger:function(e){this.formJson.triggers.splice(e,1)},handleRemoveAction:function(e){this.formJson.actions.splice(e,1)},handleShowCron:function(e,t){this.expression=e.cronExpression,this.triggerIndex=t,this.openCron=!0},crontabFill:function(e){this.formJson.triggers[this.triggerIndex].cronExpression=e},weekChange:function(e,t){this.gentCronExpression(t)},timeChange:function(e,t){this.gentCronExpression(t)},customerCronChange:function(e,t){},gentCronExpression:function(e){var t="00",n="00";null!=this.formJson.triggers[e].timerTimeValue&&""!=this.formJson.triggers[e].timerTimeValue&&(t=this.formJson.triggers[e].timerTimeValue.substring(0,2),n=this.formJson.triggers[e].timerTimeValue.substring(3));var r="*";if(this.formJson.triggers[e].timerWeekValue.length>0){for(var a=this.formJson.triggers[e].timerWeekValue.slice().sort(),o=0;o<a.length;o++)7!=a[o]?a[o]=a[o]+1:a[o]=1;console.log(a),r=a,console.log(r)}this.formJson.triggers[e].cronExpression="0 "+n+" "+t+" ? * "+r},handleActionTypeChange:function(e,t){this.formJson.actions[t].id="",this.formJson.actions[t].name="",this.formJson.actions[t].value="",this.formJson.actions[t].model=null,this.formJson.actions[t].parentId="",this.formJson.actions[t].parentName="",this.formJson.actions[t].arrayIndex="",this.formJson.actions[t].arrayIndexName="",this.formJson.actions[t].parentModel=null},handleActionParentModelChange:function(e,t){this.formJson.actions[t].model=null,this.formJson.actions[t].value="",this.formJson.actions[t].arrayIndex="",this.formJson.actions[t].arrayIndexName="";var n=[];1==this.formJson.actions[t].type?n=this.formJson.actions[t].thingsModel.properties:2==this.formJson.actions[t].type&&(n=this.formJson.actions[t].thingsModel.functions);for(var r=0;r<n.length;r++)if(n[r].id==e){this.formJson.actions[t].parentName=n[r].name,this.formJson.actions[t].parentModel=n[r],"object"===n[r].datatype.type||"array"===n[r].datatype.type&&"object"===n[r].datatype.arrayType?(this.formJson.actions[t].id="",this.formJson.actions[t].name=""):"array"===n[r].datatype.type&&"object"!==n[r].datatype.arrayType?(this.formJson.actions[t].id=n[r].id,this.formJson.actions[t].name=n[r].name,this.formJson.actions[t].model={datatype:{type:this.formJson.actions[t].parentModel.datatype.arrayType,maxLength:-1,min:-1,max:-1,unit:this.$t("scene.index.670805-64")}}):(this.formJson.actions[t].id=n[r].id,this.formJson.actions[t].name=n[r].name,this.formJson.actions[t].model=n[r]);break}},handleActionIndexChange:function(e,t){this.formJson.actions[t].arrayIndexName=this.formJson.actions[t].parentModel.datatype.arrayModel.find((function(t){return t.id==e})).name,this.formJson.actions[t].value="",this.formJson.actions[t].valueA="",this.formJson.actions[t].valueB="",this.formJson.actions[t].operator="","object"===this.formJson.actions[t].parentModel.datatype.arrayType&&(this.formJson.actions[t].id="",this.formJson.actions[t].name="")},handleActionModelChange:function(e,t){this.formJson.actions[t].operator="",this.formJson.actions[t].value="";var n=null;"array"!==this.formJson.actions[t].parentModel.datatype.type&&"object"!==this.formJson.actions[t].parentModel.datatype.type||(n=this.formJson.actions[t].parentModel.datatype.params.find((function(t){return t.id==e})),this.formJson.actions[t].name=n.name,this.formJson.actions[t].model=n)},handleSubmitForm:function(){var e=this;this.$refs["form"].validate((function(t){if(t){for(var n=[],r=[],a=0;a<e.formJson.triggers.length;a++){if(1==e.formJson.triggers[a].type||2==e.formJson.triggers[a].type||3==e.formJson.triggers[a].type){if(1==e.formJson.triggers[a].source){if(""==e.formJson.triggers[a].value)return void e.$modal.alertError(e.$t("scene.index.670805-67"));if(-1!=e.formJson.triggers[a].value.indexOf("-")&&(""==e.formJson.triggers[a].valueA||""==e.formJson.triggers[a].valueB))return void e.$modal.alertError(e.$t("scene.index.670805-68"))}if(2==e.formJson.triggers[a].source)if(0==e.formJson.triggers[a].isAdvance){if(""==e.formJson.triggers[a].timerTimeValue||null==e.formJson.triggers[a].timerTimeValue)return void e.$modal.alertError(e.$t("scene.index.670805-69"));if(null==e.formJson.triggers[a].timerWeekValue||""==e.formJson.triggers[a].timerWeekValue)return void e.$modal.alertError(e.$t("scene.index.670805-70"))}else if(1==e.formJson.triggers[a].isAdvance&&""==e.formJson.triggers[a].cronExpression)return void e.$modal.alertError(e.$t("scene.index.670805-71"))}var o=e.formJson.triggers[a];""!=o.arrayIndex&&(o.id="array_"+o.arrayIndex+"_"+o.id),n[a]={productId:o.productId,productName:o.productName,deviceNums:o.deviceNums,deviceCount:o.deviceCount,source:o.source,type:o.type,id:o.id,name:o.name,operator:o.operator,value:o.value,isAdvance:o.isAdvance,cronExpression:o.cronExpression,parentId:o.parentId,parentName:o.parentName,arrayIndex:o.arrayIndex,arrayIndexName:o.arrayIndexName,scriptPurpose:2}}for(var s=0;s<e.formJson.actions.length;s++){if(""===e.formJson.actions[s].value&&4!==e.formJson.actions[s].source&&5!==e.formJson.actions[s].source)return void e.$modal.alertError(e.$t("scene.index.670805-72"));var l=e.formJson.actions[s];""!=l.arrayIndex&&(l.id="array_"+l.arrayIndex+"_"+l.id),r[s]={productId:l.productId,productName:l.productName,deviceCount:l.deviceCount,source:l.source,deviceNums:l.deviceNums,type:l.type,id:l.id,name:l.name,value:l.value,parentId:l.parentId,parentName:l.parentName,arrayIndex:l.arrayIndex,arrayIndexName:l.arrayIndexName,scriptPurpose:3}}r.filter((function(e){return 4===e.source})).length>0?e.form.hasAlert=1:e.form.hasAlert=2,e.form.triggers=n,e.form.actions=r,e.confirmLoading=!0,null!=e.form.sceneId?Object(i["g"])(e.form).then((function(){e.$modal.msgSuccess(e.$t("scene.index.670805-73")),e.open=!1,e.confirmLoading=!1,e.getList()})):Object(i["a"])(e.form).then((function(){e.$modal.msgSuccess(e.$t("scene.index.670805-74")),e.open=!1,e.confirmLoading=!1,e.getList()}))}}))}}},h=f,g=(n("7217"),n("2877")),v=Object(g["a"])(h,r,a,!1,null,"eb49bbdc",null);t["default"]=v.exports},"50d1":function(e,t,n){"use strict";n("5c5a")},"584f":function(e,t,n){"use strict";n.d(t,"n",(function(){return a})),n.d(t,"t",(function(){return o})),n.d(t,"o",(function(){return i})),n.d(t,"p",(function(){return s})),n.d(t,"m",(function(){return l})),n.d(t,"f",(function(){return c})),n.d(t,"c",(function(){return d})),n.d(t,"g",(function(){return u})),n.d(t,"i",(function(){return p})),n.d(t,"d",(function(){return m})),n.d(t,"u",(function(){return f})),n.d(t,"q",(function(){return h})),n.d(t,"r",(function(){return g})),n.d(t,"h",(function(){return v})),n.d(t,"a",(function(){return y})),n.d(t,"v",(function(){return b})),n.d(t,"b",(function(){return x})),n.d(t,"e",(function(){return $})),n.d(t,"k",(function(){return _})),n.d(t,"l",(function(){return J})),n.d(t,"j",(function(){return w})),n.d(t,"s",(function(){return k}));var r=n("b775");function a(e){return Object(r["a"])({url:"/iot/device/list",method:"get",params:e})}function o(e){return Object(r["a"])({url:"/iot/device/unAuthlist",method:"get",params:e})}function i(e){return Object(r["a"])({url:"/iot/device/listByGroup",method:"get",params:e})}function s(e){return Object(r["a"])({url:"/iot/device/shortList",method:"get",params:e})}function l(e){return Object(r["a"])({url:"/iot/device/all",method:"get",params:e})}function c(e){return Object(r["a"])({url:"/iot/device/"+e,method:"get"})}function d(e){return Object(r["a"])({url:"/iot/device/synchronization/"+e,method:"get"})}function u(e){return Object(r["a"])({url:"/iot/device/getDeviceBySerialNumber/"+e,method:"get"})}function p(){return Object(r["a"])({url:"/iot/device/statistic",method:"get"})}function m(e,t){return Object(r["a"])({url:"/iot/device/assignment?deptId="+e+"&deviceIds="+t,method:"post"})}function f(e,t){return Object(r["a"])({url:"/iot/device/recovery?deviceIds="+e+"&recoveryDeptId="+t,method:"post"})}function h(e){return Object(r["a"])({url:"/iot/record/list",method:"get",params:e})}function g(e){return Object(r["a"])({url:"/iot/record/list",method:"get",params:e})}function v(e){return Object(r["a"])({url:"/iot/device/runningStatus",method:"get",params:e})}function y(e){return Object(r["a"])({url:"/iot/device",method:"post",data:e})}function b(e){return Object(r["a"])({url:"/iot/device",method:"put",data:e})}function x(e){return Object(r["a"])({url:"/iot/device/"+e,method:"delete"})}function $(e){return Object(r["a"])({url:"/iot/device/generator",method:"get",params:e})}function _(e){return Object(r["a"])({url:"/iot/device/getMqttConnectData",method:"get",params:e})}function J(e){return Object(r["a"])({url:"/sip/sipconfig/auth/"+e,method:"get"})}function w(e){return Object(r["a"])({url:"/iot/device/getHttpAuthData",method:"get",params:e})}function k(e){return Object(r["a"])({url:"/iot/device/listThingsModel",method:"get",params:e})}},"5c5a":function(e,t,n){},7217:function(e,t,n){"use strict";n("c590")},"9b9c":function(e,t,n){"use strict";n.d(t,"g",(function(){return a})),n.d(t,"h",(function(){return o})),n.d(t,"f",(function(){return i})),n.d(t,"a",(function(){return s})),n.d(t,"i",(function(){return l})),n.d(t,"e",(function(){return c})),n.d(t,"b",(function(){return d})),n.d(t,"d",(function(){return u})),n.d(t,"c",(function(){return p}));var r=n("b775");function a(e){return Object(r["a"])({url:"/iot/product/list",method:"get",params:e})}function o(e){return Object(r["a"])({url:"/iot/product/shortList",method:"get",params:e})}function i(e){return Object(r["a"])({url:"/iot/product/"+e,method:"get"})}function s(e){return Object(r["a"])({url:"/iot/product",method:"post",data:e})}function l(e){return Object(r["a"])({url:"/iot/product",method:"put",data:e})}function c(e){return Object(r["a"])({url:"/iot/product/deviceCount/"+e,method:"get"})}function d(e){return Object(r["a"])({url:"/iot/product/status",method:"put",data:e})}function u(e){return Object(r["a"])({url:"/iot/product/"+e,method:"delete"})}function p(e){return Object(r["a"])({url:"/iot/product/copy?productId="+e,method:"post"})}},"9edeb":function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticStyle:{border:"0px solid #ebebeb",overflow:"hidden","border-radius":"6px","background-color":"#ebebeb",padding:"8px 5px 8px 0"}},[n("editor",{ref:"codeEditor",attrs:{options:e.options,lang:e.lang,theme:e.codeStyle,width:e.width,height:e.height},on:{init:e.editorInit},model:{value:e.currentContent,callback:function(t){e.currentContent=t},expression:"currentContent"}})],1)},a=[],o={name:"AceEditor",components:{editor:n("7c9e")},props:{width:{type:String,default:"100%"},height:{type:String,default:"500px"},content:{type:String,required:!0,default:function(){return null}},lang:{type:String,default:"groovy"},readOnly:{type:Boolean,default:!1},codeStyle:{type:String,default:"chrome"}},data:function(){return{options:{autoScrollEditorIntoView:!0,enableLiveAutocompletion:!0,enableSnippets:!0,readOnly:this.readOnly,showPrintMargin:!1,fontSize:13}}},computed:{currentContent:{get:function(){return this.content},set:function(e){this.$emit("update:content",e)}}},watch:{codeSize:{handler:function(e){this.$refs.codeEditor.editor.setOptions({fontSize:e})},deep:!0}},created:function(){},mounted:function(){},methods:{editorInit:function(e){n("2099"),n("0f6a"),n("61fa"),n("818b"),n("95b8"),n("5f48"),n("b039"),n("d74b")},format:function(){var e=n("061c"),t=this.$refs.codeEditor.editor,r=e.acequire("ace/ext/beautify");r.beautify(t.session)}}},i=o,s=n("2877"),l=Object(s["a"])(i,r,a,!1,null,null,null);t["default"]=l.exports},c590:function(e,t,n){},e350:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));n("caad"),n("d3b7"),n("2532");var r=n("4360");function a(e){if(e&&e instanceof Array&&e.length>0){var t=r["a"].getters&&r["a"].getters.permissions,n=e,a="*:*:*",o=t.some((function(e){return a===e||n.includes(e)}));return!!o}return console.error("need roles! Like checkPermi=\"['system:user:add','system:user:edit']\""),!1}},ed76:function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("el-dialog",{attrs:{title:e.$t("firmware.index.222541-31"),visible:e.openDeviceList,width:"1000px","append-to-body":""},on:{"update:visible":function(t){e.openDeviceList=t}}},[n("el-form",{ref:"queryForm",attrs:{model:e.queryParams,inline:!0,"label-width":"68px"}},[n("el-form-item",{attrs:{prop:"deviceName"}},[n("el-input",{attrs:{placeholder:e.$t("device.device-edit.148398-2"),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.deviceName,callback:function(t){e.$set(e.queryParams,"deviceName",t)},expression:"queryParams.deviceName"}})],1),n("el-form-item",{attrs:{prop:"serialNumber"}},[n("el-input",{attrs:{placeholder:e.$t("device.device-edit.148398-8"),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.serialNumber,callback:function(t){e.$set(e.queryParams,"serialNumber",t)},expression:"queryParams.serialNumber"}})],1),n("el-form-item",[n("el-button",{attrs:{type:"primary",icon:"el-icon-search",size:"small"},on:{click:e.handleQuery}},[e._v(e._s(e.$t("search")))]),n("el-button",{attrs:{icon:"el-icon-refresh",size:"small"},on:{click:e.resetQuery}},[e._v(e._s(e.$t("reset")))])],1)],1),n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],ref:"multipleTable",attrs:{data:e.deviceList,"row-key":"serialNumber",size:"small",border:!1},on:{select:e.handleSelectionChange}},[n("el-table-column",{attrs:{type:"selection",width:"55",align:"center"}}),n("el-table-column",{attrs:{label:e.$t("device.device-edit.148398-1"),align:"left",prop:"deviceName","min-width":"160px"}}),n("el-table-column",{attrs:{label:e.$t("device.device-edit.148398-7"),align:"left",prop:"serialNumber","min-width":"120px"}}),n("el-table-column",{attrs:{label:e.$t("firmware.index.222541-5"),align:"left",prop:"productName","min-width":"160px"}}),n("el-table-column",{attrs:{label:e.$t("firmware.deviceList.index.222542-6"),align:"center",width:"75"},scopedSlots:e._u([{key:"default",fn:function(t){return[0==t.row.isOwner?n("el-tag",{attrs:{type:"success"}},[e._v(e._s(e.$t("firmware.deviceList.index.222542-7")))]):n("el-tag",{attrs:{type:"primary"}},[e._v(e._s(e.$t("firmware.deviceList.index.222542-8")))])]}}])}),n("el-table-column",{attrs:{label:e.$t("home.position"),align:"center",prop:"locationWay",width:"100"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("dict-tag",{attrs:{options:e.dict.type.iot_location_way,value:t.row.locationWay}})]}}])}),n("el-table-column",{attrs:{label:e.$t("firmware.deviceList.index.222542-9"),align:"center",prop:"status",width:"80"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("dict-tag",{attrs:{options:e.dict.type.iot_device_status,value:t.row.status}})]}}])})],1),n("pagination",{directives:[{name:"show",rawName:"v-show",value:e.total>0,expression:"total > 0"}],attrs:{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:function(t){return e.getList(null)}}}),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{type:"primary"},on:{click:e.confirmSelectDevice}},[e._v(e._s(e.$t("confirm")))]),n("el-button",{on:{click:e.closeSelectDeviceList}},[e._v(e._s(e.$t("cancel")))])],1)],1)},a=[],o=(n("14d9"),n("a434"),n("d3b7"),n("159b"),n("584f")),i={name:"device-list",dicts:["iot_device_status","iot_location_way"],data:function(){return{loading:!0,selectDeviceNums:[],productId:0,productName:"",openDeviceList:!1,total:0,deviceList:[],queryParams:{pageNum:1,pageSize:10,deviceName:null,productId:null,productName:null,serialNumber:null,status:null}}},created:function(){},methods:{getList:function(){var e=this;this.deviceList=[],this.loading=!0,this.queryParams.productId=0==this.queryParams.productId?null:this.queryParams.productId,Object(o["p"])(this.queryParams).then((function(t){e.deviceList=t.rows,e.total=t.total,e.loading=!1,e.selectDeviceNums?e.deviceList.forEach((function(t){e.$nextTick((function(){e.selectDeviceNums.some((function(e){return e===t.serialNumber}))&&e.$refs.multipleTable.toggleRowSelection(t,!0)}))})):e.selectDeviceNums=[]}))},handleQuery:function(){this.queryParams.pageNum=1,this.getList(null)},resetQuery:function(){this.resetForm("queryForm"),this.handleQuery()},handleSelectionChange:function(e,t){var n=this.selectDeviceNums.indexOf(t.serialNumber),r=e.indexOf(t);-1==n&&-1!=r?(this.selectDeviceNums.push(t.serialNumber),this.productId=t.productId,this.productName=t.productName):-1!=n&&-1==r&&this.selectDeviceNums.splice(n,1),0==this.selectDeviceNums.length?(this.queryParams.productId=null,this.getList()):1==this.selectDeviceNums.length&&(this.queryParams.productId=t.productId,this.getList())},handleSelectionAll:function(e){for(var t=0;t<this.deviceList.length;t++){var n=this.selectDeviceNums.indexOf(this.deviceList[t].serialNumber),r=e.indexOf(this.deviceList[t]);-1==n&&-1!=r?this.selectDeviceNums.push(this.deviceList[t].serialNumber):-1!=n&&-1==r&&this.selectDeviceNums.splice(n,1)}},closeSelectDeviceList:function(){this.openDeviceList=!1},confirmSelectDevice:function(){if(this.selectDeviceNums.length>0){var e={productId:this.productId,productName:this.productName,deviceNums:this.selectDeviceNums};this.$emit("deviceEvent",e)}this.openDeviceList=!1}}},s=i,l=(n("50d1"),n("2877")),c=Object(l["a"])(s,r,a,!1,null,"ab7b2ee0",null);t["default"]=c.exports}}]); |