1 line
29 KiB
JavaScript
1 line
29 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-07780f6e"],{"1a6c":function(e,t,i){"use strict";i("4649")},4649:function(e,t,i){},"7a72":function(e,t,i){"use strict";i.r(t);var a=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"device-timer-wrap"},[i("el-form",{directives:[{name:"show",rawName:"v-show",value:e.showSearch,expression:"showSearch"}],ref:"queryForm",attrs:{model:e.queryParams,inline:!0,"label-width":"70px"}},[i("el-form-item",{attrs:{prop:"jobName"}},[i("el-input",{attrs:{placeholder:e.$t("device.device-timer.433369-1"),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.jobName,callback:function(t){e.$set(e.queryParams,"jobName",t)},expression:"queryParams.jobName"}})],1),i("el-form-item",{attrs:{prop:"status"}},[i("el-select",{attrs:{placeholder:e.$t("device.device-timer.433369-3"),clearable:""},model:{value:e.queryParams.status,callback:function(t){e.$set(e.queryParams,"status",t)},expression:"queryParams.status"}},e._l(e.dict.type.sys_job_status,(function(e){return i("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),i("el-form-item",[i("el-button",{attrs:{type:"primary",icon:"el-icon-search"},on:{click:e.handleQuery}},[e._v(e._s(e.$t("device.device-timer.433369-4")))]),i("el-button",{attrs:{icon:"el-icon-refresh"},on:{click:e.resetQuery}},[e._v(e._s(e.$t("device.device-timer.433369-5")))])],1)],1),i("el-row",{staticStyle:{"margin-bottom":"16px"},attrs:{gutter:10}},[i("el-col",{attrs:{span:1.5}},[i("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:device:timer:add"],expression:"['iot:device:timer:add']"}],attrs:{type:"primary",plain:"",icon:"el-icon-plus",size:"small"},on:{click:e.handleAdd}},[e._v(e._s(e.$t("add")))])],1),i("el-col",{attrs:{span:1.5}},[i("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:device:timer:remove"],expression:"['iot:device:timer:remove']"}],attrs:{plain:"",icon:"el-icon-delete",size:"small",disabled:e.multiple},on:{click:e.handleDelete}},[e._v(e._s(e.$t("del")))])],1),i("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),i("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],attrs:{data:e.jobList,border:!1},on:{"selection-change":e.handleSelectionChange}},[i("el-table-column",{attrs:{type:"selection",width:"55",align:"center"}}),i("el-table-column",{attrs:{label:e.$t("device.device-timer.433369-7"),align:"left",prop:"jobName","show-overflow-tooltip":!0,"min-width":"160"}}),i("el-table-column",{attrs:{label:e.$t("device.device-timer.433369-8"),align:"left",prop:"cronText","min-width":"160"},scopedSlots:e._u([{key:"default",fn:function(t){return[i("div",{domProps:{innerHTML:e._s(e.formatCronDisplay(t.row))}})]}}])}),i("el-table-column",{attrs:{label:e.$t("device.device-timer.433369-9"),align:"left",prop:"cronExpression","show-overflow-tooltip":!0,"min-width":"150"}}),i("el-table-column",{attrs:{label:e.$t("device.device-timer.433369-10"),align:"left",prop:"actions","show-overflow-tooltip":!0,"min-width":"200"},scopedSlots:e._u([{key:"default",fn:function(t){return[i("div",{staticStyle:{overflow:"hidden","white-space":"nowrap"},domProps:{innerHTML:e._s(e.formatActionsDisplay(t.row.actions))}})]}}])}),i("el-table-column",{attrs:{label:e.$t("device.device-timer.433369-11"),align:"center","min-width":"100"},scopedSlots:e._u([{key:"default",fn:function(t){return[i("el-switch",{attrs:{"active-value":0,"inactive-value":1},on:{change:function(i){return e.handleStatusChange(t.row)}},model:{value:t.row.status,callback:function(i){e.$set(t.row,"status",i)},expression:"scope.row.status"}})]}}])}),i("el-table-column",{attrs:{fixed:"right",label:e.$t("opation"),align:"center",width:"280"},scopedSlots:e._u([{key:"default",fn:function(t){return[i("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:device:timer:query"],expression:"['iot:device:timer:query']"}],attrs:{size:"small",type:"text",icon:"el-icon-view"},on:{click:function(i){return e.handleUpdate(t.row)}}},[e._v(e._s(e.$t("device.device-timer.433369-14")))]),i("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:device:timer:query"],expression:"['iot:device:timer:query']"}],attrs:{size:"small",type:"text",icon:"el-icon-caret-right"},on:{click:function(i){return e.handleView(t.row)}}},[e._v(e._s(e.$t("device.device-timer.433369-15")))]),i("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:device:timer:remove"],expression:"['iot:device:timer:remove']"}],attrs:{size:"small",type:"text",icon:"el-icon-delete"},on:{click:function(i){return e.handleDelete(t.row)}}},[e._v(e._s(e.$t("device.device-timer.433369-16")))]),i("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:device:timer:execute"],expression:"['iot:device:timer:execute']"}],attrs:{size:"small",type:"text",icon:"el-icon-caret-right"},on:{click:function(i){return e.handleRun(t.row)}}},[e._v(e._s(e.$t("device.device-timer.433369-17")))])]}}])})],1),i("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}}),i("el-dialog",{staticClass:"device-timer-config-dialog",attrs:{title:e.title,visible:e.open,width:"800px","append-to-body":"","close-on-click-modal":!1,"close-on-press-escape":!1},on:{"update:visible":function(t){e.open=t}}},[i("el-form",{ref:"form",attrs:{model:e.form,rules:e.rules,"label-width":"100px"}},[i("el-form-item",{attrs:{label:e.$t("device.device-timer.433369-0"),prop:"jobName"}},[i("el-input",{staticStyle:{width:"280px"},attrs:{placeholder:e.$t("device.device-timer.433369-1")},model:{value:e.form.jobName,callback:function(t){e.$set(e.form,"jobName",t)},expression:"form.jobName"}})],1),i("el-form-item",{attrs:{label:e.$t("device.device-timer.433369-18"),prop:"timerTimeValue"}},[i("el-time-picker",{staticStyle:{width:"280px"},attrs:{"value-format":"HH:mm",format:"HH:mm",placeholder:e.$t("device.device-timer.433369-19"),disabled:1==e.form.isAdvance},on:{change:e.timeChange},model:{value:e.timerTimeValue,callback:function(t){e.timerTimeValue=t},expression:"timerTimeValue"}})],1),i("el-form-item",{attrs:{label:e.$t("device.device-timer.433369-20"),prop:"timerWeek"}},[i("el-row",[i("el-col",{attrs:{span:18}},[i("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:e.$t("device.device-timer.433369-21"),multiple:"",disabled:1==e.form.isAdvance},on:{change:e.weekChange},model:{value:e.timerWeekValue,callback:function(t){e.timerWeekValue=t},expression:"timerWeekValue"}},e._l(e.timerWeeks,(function(e){return i("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1)],1)],1),i("el-form-item",{attrs:{label:e.$t("device.device-timer.433369-22"),prop:"cron"}},[i("el-row",[i("el-col",{attrs:{span:18}},[i("el-input",{attrs:{placeholder:e.$t("device.device-timer.433369-23"),disabled:0==e.form.isAdvance},model:{value:e.form.cronExpression,callback:function(t){e.$set(e.form,"cronExpression",t)},expression:"form.cronExpression"}},[i("template",{slot:"append"},[i("el-button",{attrs:{type:"primary",disabled:0==e.form.isAdvance},on:{click:e.handleShowCron}},[e._v(" "+e._s(e.$t("device.device-timer.433369-24"))+" "),i("i",{staticClass:"el-icon-time el-icon--right"})])],1)],2)],1),i("el-col",{attrs:{span:4,offset:1}},[i("el-checkbox",{attrs:{"true-label":1,"false-label":0},on:{change:e.customerCronChange},model:{value:e.form.isAdvance,callback:function(t){e.$set(e.form,"isAdvance",t)},expression:"form.isAdvance"}},[e._v(e._s(e.$t("device.device-timer.433369-25")))])],1)],1)],1),i("el-form-item",{attrs:{label:e.$t("device.device-timer.433369-2"),prop:"status"}},[i("el-radio-group",{model:{value:e.form.status,callback:function(t){e.$set(e.form,"status",t)},expression:"form.status"}},e._l(e.dict.type.sys_job_status,(function(t){return i("el-radio",{key:t.value,attrs:{label:Number(t.value)}},[e._v(e._s(t.label))])})),1)],1),i("div",{staticStyle:{height:"1px","background-color":"#ddd",margin:"0 0 20px 0"}}),i("el-form-item",{staticClass:"action-wrap",attrs:{label:e.$t("device.device-timer.433369-26"),prop:"actions"}},[e._l(e.actionList,(function(t,a){return i("div",{key:a+"action",staticClass:"item-wrap"},[i("el-row",{attrs:{gutter:16}},[i("el-col",{attrs:{span:5}},[i("el-select",{attrs:{placeholder:e.$t("device.device-timer.433369-27"),size:"small"},on:{change:function(t){return e.handleActionTypeChange(t,a)}},model:{value:t.type,callback:function(i){e.$set(t,"type",i)},expression:"actionItem.type"}},e._l(e.modelTypes,(function(e,t){return i("el-option",{key:t+"type",attrs:{label:e.label,value:e.value}})})),1)],1),i("el-col",{attrs:{span:10}},[1==t.type?i("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:e.$t("device.device-timer.433369-28"),size:"small"},on:{change:function(t){return e.handleActionParentModelChange(t,a)}},model:{value:t.parentId,callback:function(i){e.$set(t,"parentId",i)},expression:"actionItem.parentId"}},e._l(e.thingsModel.properties,(function(e,t){return i("el-option",{key:t+"property",attrs:{label:e.name,value:e.id}})})),1):2==t.type?i("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:e.$t("device.device-timer.433369-28"),size:"small"},on:{change:function(t){return e.handleActionParentModelChange(t,a)}},model:{value:t.parentId,callback:function(i){e.$set(t,"parentId",i)},expression:"actionItem.parentId"}},e._l(e.thingsModel.functions,(function(e,t){return i("el-option",{key:t+"func",attrs:{label:e.name,value:e.id}})})),1):e._e()],1),i("div",{staticClass:"delete-wrap"},[0!==a?i("el-button",{staticStyle:{padding:"5px"},attrs:{size:"small",plain:"",type:"danger",icon:"el-icon-delete"},on:{click:function(t){return e.handleRemoveActionItem(a)}}},[e._v(" "+e._s(e.$t("device.device-timer.433369-16"))+" ")]):e._e()],1)],1),i("el-row",{attrs:{gutter:16}},[t.parentModel&&"array"===t.parentModel.datatype.type?i("el-col",{attrs:{span:5}},[i("el-select",{attrs:{placeholder:e.$t("device.device-timer.433369-21"),size:"small"},on:{change:function(t){return e.handleActionIndexChange(t,a)}},model:{value:t.arrayIndex,callback:function(i){e.$set(t,"arrayIndex",i)},expression:"actionItem.arrayIndex"}},e._l(t.parentModel.datatype.arrayModel,(function(e){return i("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?i("el-col",{attrs:{span:5}},[i("el-select",{attrs:{placeholder:e.$t("device.device-timer.433369-21"),size:"small"},on:{change:function(t){return e.handleActionModelChange(t,a)}},model:{value:t.id,callback:function(i){e.$set(t,"id",i)},expression:"actionItem.id"}},e._l(t.parentModel.datatype.params,(function(e,t){return i("el-option",{key:t,attrs:{label:e.name,value:e.id}})})),1)],1):e._e(),t.parentModel&&"object"===t.parentModel.datatype.type?i("el-col",{attrs:{span:5}},[i("el-select",{attrs:{placeholder:e.$t("device.device-timer.433369-21"),size:"small"},on:{change:function(t){return e.handleActionModelChange(t,a)}},model:{value:t.id,callback:function(i){e.$set(t,"id",i)},expression:"actionItem.id"}},e._l(t.parentModel.datatype.params,(function(e,t){return i("el-option",{key:t,attrs:{label:e.name,value:e.id}})})),1)],1):e._e(),t.model?i("el-col",{attrs:{span:10}},["integer"==t.model.datatype.type||"decimal"==t.model.datatype.type?i("div",[i("el-input",{staticStyle:{"vertical-align":"baseline"},attrs:{placeholder:e.$t("device.device-timer.433369-29"),max:t.model.datatype.max,min:t.model.datatype.min,type:"number",size:"small"},model:{value:t.value,callback:function(i){e.$set(t,"value",i)},expression:"actionItem.value"}},[i("template",{slot:"append"},[e._v(e._s(t.model.datatype.unit))])],2)],1):"bool"==t.model.datatype.type?i("div",[i("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(i){e.$set(t,"value",i)},expression:"actionItem.value"}})],1):"enum"==t.model.datatype.type?i("div",[i("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:e.$t("device.device-timer.433369-21"),size:"small"},model:{value:t.value,callback:function(i){e.$set(t,"value",i)},expression:"actionItem.value"}},e._l(t.model.datatype.enumList,(function(e,t){return i("el-option",{key:t+"things",attrs:{label:e.text,value:e.value}})})),1)],1):"string"==t.model.datatype.type?i("div",[i("el-input",{attrs:{placeholder:e.$t("device.device-timer.433369-30"),max:t.model.datatype.maxLength,size:"small"},model:{value:t.value,callback:function(i){e.$set(t,"value",i)},expression:"actionItem.value"}})],1):e._e()]):e._e()],1)],1)})),i("div",[e._v(" + "),i("a",{staticStyle:{color:"#486ff2"},on:{click:function(t){return e.handleAddActionItem()}}},[e._v(e._s(e.$t("device.device-timer.433369-31")))])])],2)],1),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:device:timer:add"],expression:"['iot:device:timer:add']"},{name:"show",rawName:"v-show",value:!e.form.jobId,expression:"!form.jobId"}],attrs:{type:"primary",loading:e.submitButtonLoading},on:{click:e.handleSubmitForm}},[e._v(e._s(e.$t("device.device-timer.433369-32")))]),i("el-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["iot:device:timer:edit"],expression:"['iot:device:timer:edit']"},{name:"show",rawName:"v-show",value:e.form.jobId,expression:"form.jobId"}],attrs:{type:"primary",loading:e.submitButtonLoading},on:{click:e.handleSubmitForm}},[e._v(e._s(e.$t("device.device-timer.433369-33")))]),i("el-button",{on:{click:e.handleCancel}},[e._v(e._s(e.$t("cancel")))])],1)],1),i("el-dialog",{staticClass:"scrollbar",attrs:{title:e.$t("device.device-timer.433369-35"),visible:e.openCron,"append-to-body":"","destroy-on-close":""},on:{"update:visible":function(t){e.openCron=t}}},[i("crontab",{staticStyle:{"padding-bottom":"80px"},attrs:{expression:e.expression},on:{hide:function(t){e.openCron=!1},fill:e.crontabFill}})],1),i("el-dialog",{attrs:{title:e.$t("device.device-timer.433369-15"),visible:e.openView,width:"700px","append-to-body":""},on:{"update:visible":function(t){e.openView=t}}},[i("el-form",{ref:"form",attrs:{model:e.form,"label-width":"120px",size:"mini"}},[i("el-row",[i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:e.$t("device.device-timer.433369-36")}},[e._v(e._s(e.form.jobId))]),i("el-form-item",{attrs:{label:e.$t("device.device-timer.433369-37")}},[e._v(e._s(e.form.jobName))])],1),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:e.$t("device.device-timer.433369-38")}},[e._v(e._s(e.jobGroupFormat(e.form)))]),i("el-form-item",{attrs:{label:e.$t("device.device-timer.433369-39")}},[e._v(e._s(e.form.createTime))])],1),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:e.$t("device.device-timer.433369-40")}},[0==e.form.concurrent?i("div",[e._v(e._s(e.$t("device.device-timer.433369-41")))]):1==e.form.concurrent?i("div",[e._v(e._s(e.$t("device.device-timer.433369-42")))]):e._e()])],1),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:e.$t("device.device-timer.433369-43")}},[e._v(e._s(e.form.cronExpression))])],1),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:e.$t("device.device-timer.433369-44")}},[0==e.form.misfirePolicy?i("div",[e._v(e._s(e.$t("device.device-timer.433369-45")))]):1==e.form.misfirePolicy?i("div",[e._v(e._s(e.$t("device.device-timer.433369-46")))]):2==e.form.misfirePolicy?i("div",[e._v(e._s(e.$t("device.device-timer.433369-17")))]):3==e.form.misfirePolicy?i("div",[e._v(e._s(e.$t("device.device-timer.433369-47")))]):e._e()])],1),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:e.$t("device.device-timer.433369-48")}},[e._v(e._s(e.parseTime(e.form.nextValidTime)))])],1),i("el-col",{attrs:{span:12}},[i("el-form-item",{attrs:{label:e.$t("device.device-timer.433369-49")}},[0==e.form.status?i("div",[e._v(e._s(e.$t("device.device-timer.433369-50")))]):1==e.form.status?i("div",[e._v(e._s(e.$t("device.device-timer.433369-51")))]):e._e()])],1),i("el-col",{attrs:{span:24}},[i("el-form-item",{attrs:{label:e.$t("device.device-timer.433369-52")}},[i("div",{staticStyle:{border:"1px solid #ddd",padding:"10px","border-radius":"5px",width:"465px"},domProps:{innerHTML:e._s(e.formatActionsDisplay(e.form.actions))}})])],1)],1)],1),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:function(t){e.openView=!1}}},[e._v(e._s(e.$t("device.device-timer.433369-53")))])],1)],1)],1)},r=[],n=i("5530"),o=(i("99af"),i("4de4"),i("7db0"),i("d81d"),i("14d9"),i("fb6a"),i("4e82"),i("a434"),i("b0c0"),i("e9c4"),i("a9e3"),i("b64b"),i("d3b7"),i("b775"));function s(e){return Object(o["a"])({url:"/iot/job/list",method:"get",params:e})}function l(e){return Object(o["a"])({url:"/iot/job/"+e,method:"get"})}function c(e){return Object(o["a"])({url:"/iot/job",method:"post",data:e})}function d(e){return Object(o["a"])({url:"/iot/job",method:"put",data:e})}function m(e){return Object(o["a"])({url:"/iot/job/"+e,method:"delete"})}function u(e,t){var i={jobId:e,status:t};return Object(o["a"])({url:"/iot/job/changeStatus",method:"put",data:i})}function p(e,t){var i={jobId:e,jobGroup:t};return Object(o["a"])({url:"/iot/job/run",method:"put",data:i})}var v=i("bdd0"),h={components:{Crontab:v["a"]},name:"device-timer",dicts:["sys_job_group","sys_job_status"],props:{device:{type:Object,default:null}},watch:{device:function(e,t){this.deviceInfo=e,this.initThingsModel()}},data:function(){return{deviceInfo:{},actionList:[],thingsModel:{},loading:!1,ids:[],single:!0,multiple:!0,showSearch:!0,total:0,jobList:[],timerWeeks:[{value:1,label:"周一"},{value:2,label:"周二"},{value:3,label:"周三"},{value:4,label:"周四"},{value:5,label:"周五"},{value:6,label:"周六"},{value:7,label:"周日"}],timerWeekValue:[],timerTimeValue:"",title:"",open:!1,openView:!1,openCron:!1,expression:"",submitButtonLoading:!1,queryParams:{pageNum:1,pageSize:10,deviceId:0,jobName:void 0,jobGroup:void 0,status:void 0},modelTypes:[{value:1,label:this.$t("device.device-timer.433369-61")},{value:2,label:this.$t("device.device-timer.433369-62")}],form:{},rules:{jobName:[{required:!0,message:this.$t("device.device-timer.433369-63"),trigger:"blur"}]}}},created:function(){this.getList(),this.deviceInfo=this.device,this.initThingsModel()},methods:{initThingsModel:function(){this.deviceInfo&&0!==this.deviceInfo.deviceId&&(this.thingsModel=this.formatArrayIndex(this.deviceInfo.cacheThingsModel),this.thingsModel.properties&&0!==this.thingsModel.properties.length&&(this.thingsModel.properties=this.thingsModel.properties.filter((function(e){return e.datatype.params&&0!==e.datatype.params.length&&(e.datatype.params=e.datatype.params.filter((function(e){return 0==e.isMonitor&&0==e.isReadonly}))),0==e.isMonitor&&0==e.isReadonly}))),this.thingsModel.functions&&0!==this.thingsModel.functions.length&&(this.thingsModel.functions=this.thingsModel.functions.filter((function(e){return e.datatype.params&&0!==e.datatype.params.length&&(e.datatype.params=e.datatype.params.filter((function(e){return 0==e.isMonitor&&0==e.isReadonly}))),0==e.isMonitor&&0==e.isReadonly}))),this.queryParams.deviceId=this.deviceInfo.deviceId)},getList:function(){var e=this;this.loading=!0,s(this.queryParams).then((function(t){e.jobList=t.rows,e.total=t.total,e.loading=!1}))},jobGroupFormat:function(e,t){return this.selectDictLabel(this.dict.type.sys_job_group,e.jobGroup)},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.jobId})),this.single=1!=e.length,this.multiple=!e.length},handleStatusChange:function(e){var t=this,i=0===e.status?this.$t("device.device-timer.433369-12"):this.$t("device.device-timer.433369-64");this.$modal.confirm(this.$t("device.device-timer.433369-65",[i+'""'+e.jobName])).then((function(){return u(e.jobId,e.status)})).then((function(){t.$modal.msgSuccess(i+t.$t("device.device-timer.433369-67"))})).catch((function(){e.status=0===e.status?1:0}))},handleRun:function(e){var t=this;this.$modal.confirm(this.$t("device.device-timer.433369-68",[e.jobName])).then((function(){return p(e.jobId,e.jobGroup)})).then((function(){t.$modal.msgSuccess(t.$t("device.device-timer.433369-69"))})).catch((function(){}))},handleView:function(e){var t=this;l(e.jobId).then((function(e){t.form=e.data,t.openView=!0}))},handleShowCron:function(){this.expression=this.form.cronExpression,this.openCron=!0},crontabFill:function(e){this.form.cronExpression=e},handleAdd:function(){this.reset(),this.open=!0,this.title=this.$t("device.device-timer.433369-70")},handleCancel:function(){this.open=!1,this.reset()},reset:function(){this.form={jobId:void 0,jobName:void 0,cronExpression:void 0,status:0,jobGroup:"DEFAULT",misfirePolicy:2,concurrent:1,isAdvance:0,jobType:1,productId:0,productName:"",sceneId:0,alertId:0,actions:""},this.submitButtonLoading=!1,this.timerWeekValue=[1,2,3,4,5,6,7],this.timerTimeValue="",this.actionList=[{id:"",name:"",value:"",valueName:"",type:1,parentId:"",parentName:"",arrayIndex:"",arrayIndexName:"",model:null}],this.resetForm("form")},handleUpdate:function(e){var t=this;this.reset();var i=e.jobId||this.ids;l(i).then((function(e){t.form=e.data,t.actionList=JSON.parse(t.form.actions);for(var i=0;i<t.actionList.length;i++)1==t.actionList[i].type?t.setParentAndModelData(t.actionList[i],t.thingsModel.properties):2==t.actionList[i].type&&t.setParentAndModelData(t.actionList[i],t.thingsModel.functions);if(0==t.form.isAdvance){var a=t.form.cronExpression.substring(12).split(",").map(Number);t.timerWeekValue=a.map((function(e){return 1===e?7:e-1})),t.timerTimeValue=t.form.cronExpression.substring(5,7)+":"+t.form.cronExpression.substring(2,4)}t.open=!0,t.title=t.$t("device.device-timer.433369-71")}))},setParentAndModelData:function(e,t){for(var i=0;i<t.length;i++)if(e.parentId==t[i].id){if(e.parentModel=t[i],"object"===e.parentModel.datatype.type)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 if("object"===e.parentModel.datatype.arrayType&&"array"===e.parentModel.datatype.type){-1!=e.id.indexOf("array_")&&(e.id=e.id.substring(9));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"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("device.device-timer.433369-72")}}):e.model=e.parentModel;break}},handleDelete:function(e){var t=this,i=e.jobId||this.ids;this.$modal.confirm(this.$t("device.device-timer.433369-73",[i])).then((function(){return m(i)})).then((function(){t.getList(),t.$modal.msgSuccess(t.$t("device.device-timer.433369-75"))})).catch((function(){}))},handleExport:function(){this.download("iot/job/export",Object(n["a"])({},this.queryParams),"job_".concat((new Date).getTime(),".xlsx"))},weekChange:function(e){this.gentCronExpression()},timeChange:function(e){this.gentCronExpression()},customerCronChange:function(e){0==e&&this.gentCronExpression()},gentCronExpression:function(){var e="00",t="00";null!=this.timerTimeValue&&""!=this.timerTimeValue&&(e=this.timerTimeValue.substring(0,2),t=this.timerTimeValue.substring(3));var i="*";if(this.timerWeekValue.length>0){for(var a=this.timerWeekValue.slice().sort(),r=0;r<a.length;r++)7==a[r]?a[r]=1:a[r]=a[r]+1;console.log(a),i=a}this.form.cronExpression="0 "+t+" "+e+" ? * "+i},formatCronDisplay:function(e){var t="";if(0==e.isAdvance){var i='<br /><span style="color:#F56C6C">时间 '+e.cronExpression.substring(5,7)+":"+e.cronExpression.substring(2,4)+"</span>",a=e.cronExpression.substring(12);if("1,2,3,4,5,6,7"==a)t="每天 "+i;else{for(var r=a.split(","),n=0;n<r.length;n++)"2"==r[n]?t+=this.$t("device.device-timer.433369-78"):"3"==r[n]?t+=this.$t("device.device-timer.433369-79"):"4"==r[n]?t+=this.$t("device.device-timer.433369-80"):"5"==r[n]?t+=this.$t("device.device-timer.433369-81"):"6"==r[n]?t+=this.$t("device.device-timer.433369-82"):"7"==r[n]?t+=this.$t("device.device-timer.433369-83"):"1"==r[n]&&(t+=this.$t("device.device-timer.433369-84"));t=t.substring(0,t.length-1)+" "+i}}else t=this.$t("device.device-timer.433369-85");return t},formatActionsDisplay:function(e){if(null!=e&&""!=e){for(var t=JSON.parse(e),i="",a=0;a<t.length;a++)t[a].arrayIndexName?i+="".concat(t[a].parentName," >> ").concat(t[a].arrayIndexName," >> ").concat(t[a].name,' <span style="color:#F56C6C"> ').concat(t[a].valueName?t[a].valueName:t[a].value,"</span><br />"):t[a].parentName!==t[a].name?i+="".concat(t[a].parentName," >> ").concat(t[a].name,' <span style="color:#F56C6C">').concat(t[a].valueName?t[a].valueName:t[a].value,"</span><br />"):i+="".concat(t[a].name,' <span style="color:#F56C6C">').concat(t[a].valueName?t[a].valueName:t[a].value,"</span><br />");return""==i?this.$t("device.device-timer.433369-86"):i}},formatArrayIndex:function(e){var t=Object(n["a"])({},e);for(var i in t)t[i]=t[i].map((function(e){if("array"===e.datatype.type){for(var t=[],i=0;i<e.datatype.arrayCount;i++){var a=i>9?String(i):"0"+i;e.datatype.arrayType,t.push({id:a,name:e.name+" "+(i+1)})}e.datatype.arrayModel=t}return e}));return t},handleAddActionItem:function(){this.actionList.push({id:"",name:"",value:"",valueName:"",type:1,parentId:"",parentName:"",arrayIndex:"",arrayIndexName:"",model:null})},handleRemoveActionItem:function(e){this.actionList.splice(e,1)},handleActionTypeChange:function(e,t){this.actionList[t].id="",this.actionList[t].name="",this.actionList[t].value="",this.actionList[t].valueName="",this.actionList[t].parentId="",this.actionList[t].parentName="",this.actionList[t].arrayIndex="",this.actionList[t].arrayIndexName="",this.actionList[t].parentModel=null,this.actionList[t].model=null},handleActionIndexChange:function(e,t){this.actionList[t].arrayIndexName=this.actionList[t].parentModel.datatype.arrayModel.find((function(t){return t.id==e})).name,this.actionList[t].value="","object"===this.actionList[t].parentModel.datatype.arrayType&&(this.actionList[t].id="",this.actionList[t].name="")},handleActionParentModelChange:function(e,t){this.actionList[t].model=null,this.actionList[t].value="",this.actionList[t].arrayIndex="",this.actionList[t].arrayIndexName="";var i=[];1==this.actionList[t].type?i=this.thingsModel.properties:2==this.actionList[t].type&&(i=this.thingsModel.functions);for(var a=0;a<i.length;a++)if(i[a].id==e){this.actionList[t].parentName=i[a].name,this.actionList[t].parentModel=i[a],"object"===i[a].datatype.type||"array"===i[a].datatype.type&&"object"===i[a].datatype.arrayType?(this.actionList[t].id="",this.actionList[t].name=""):"array"===i[a].datatype.type&&"object"!==i[a].datatype.arrayType?(this.actionList[t].id=i[a].id,this.actionList[t].name=i[a].name,this.actionList[t].model={datatype:{type:i[a].datatype.arrayType,maxLength:-1,min:-1,max:-1,unit:this.$t("device.device-timer.433369-72")}}):(this.actionList[t].id=i[a].id,this.actionList[t].name=i[a].name,this.actionList[t].model=i[a]);break}},handleActionModelChange:function(e,t){this.actionList[t].value="";var i=null;"array"!==this.actionList[t].parentModel.datatype.type&&"object"!==this.actionList[t].parentModel.datatype.type||(i=this.actionList[t].parentModel.datatype.params.find((function(t){return t.id==e})),this.actionList[t].name=i.name,this.actionList[t].model=i)},handleSubmitForm:function(){var e=this;this.$refs["form"].validate((function(t){if(t){var i=[];if(0==e.form.isAdvance){if(""==e.timerTimeValue||null==e.timerTimeValue)return void e.$modal.alertError(e.$t("device.device-timer.433369-87"));if(null==e.timerWeekValue||""==e.timerWeekValue)return void e.$modal.alertError(e.$t("device.device-timer.433369-88"))}else if(1==e.form.isAdvance&&""==e.form.cronExpression)return void e.$modal.alertError(e.$t("device.device-timer.433369-89"));for(var a,r=function(){if(""===e.actionList[n].value)return e.$modal.alertError(e.$t("device.device-timer.433369-90")),{v:void 0};var t=e.actionList[n];""!=t.arrayIndex?(t.arrayIndex,t.id):t.id;var a="";a="bool"===t.model.datatype.type?1===t.value?t.model.datatype.trueText:t.model.datatype.falseText:"enum"===t.model.datatype.type?t.model.datatype.enumList.find((function(e){return e.value===t.value})).text:"",i[n]={type:t.type,id:t.id,name:t.name,value:t.value,valueName:a,parentId:t.parentId,parentName:t.parentName,arrayIndex:t.arrayIndex,arrayIndexName:t.arrayIndexName,deviceId:e.deviceInfo.deviceId,deviceName:e.deviceInfo.deviceName}},n=0;n<e.actionList.length;n++)if(a=r(),a)return a.v;e.form.actions=JSON.stringify(i),e.form.deviceId=e.deviceInfo.deviceId,e.form.deviceName=e.deviceInfo.deviceName,e.form.serialNumber=e.deviceInfo.serialNumber,e.form.productId=e.deviceInfo.productId,e.form.productName=e.deviceInfo.productName,e.form.protocolCode=e.deviceInfo.protocolCode,e.submitButtonLoading=!0,void 0!=e.form.jobId?d(e.form).then((function(){e.$modal.msgSuccess(e.$t("device.device-timer.433369-91")),e.submitButtonLoading=!1,e.open=!1,e.getList()})):c(e.form).then((function(){e.$modal.msgSuccess(e.$t("device.device-timer.433369-92")),e.submitButtonLoading=!1,e.open=!1,e.getList()}))}}))}}},f=h,y=(i("1a6c"),i("2877")),b=Object(y["a"])(f,a,r,!1,null,"7e84fff5",null);t["default"]=b.exports}}]); |