Newer
Older
smartwell_front_dz / smartwell / static / js / 846.5517538e.js
wangxitong on 11 Sep 2023 12 KB first commit
"use strict";(self["webpackChunknewfront"]=self["webpackChunknewfront"]||[]).push([[846],{846:(e,t,a)=>{a.r(t),a.d(t,{default:()=>v});a(74916),a(64765);var l=function(){var e=this,t=e._self._c;return t("app-container",[t("search-area",{attrs:{size:"small"},on:{search:e.search}},[t("search-item",[t("el-input",{attrs:{size:"small",clearable:"",placeholder:"请输入设备类型"},model:{value:e.listQuery.deviceType,callback:function(t){e.$set(e.listQuery,"deviceType",t)},expression:"listQuery.deviceType"}})],1),t("search-item",[t("el-select",{attrs:{size:"small",placeholder:"是否启用",clearable:""},model:{value:e.listQuery.isValid,callback:function(t){e.$set(e.listQuery,"isValid",t)},expression:"listQuery.isValid"}},e._l(e.isValidList,(function(e){return t("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1)],1),t("normal-table",{ref:"table",attrs:{data:e.list,total:e.total,query:e.listQuery,columns:e.columns,"list-loading":e.listLoading,pagination:!0,options:e.tableOptions,size:"small"},on:{change:e.changePage}},[t("template",{slot:"btns"},[e.hasPerm("/deviceType/add")?t("el-button",{attrs:{size:"small"},on:{click:e.add}},[e._v(" 新增 ")]):e._e()],1),t("template",{slot:"columns"},[t("el-table-column",{attrs:{label:"报警规则类型",align:"center"},scopedSlots:e._u([{key:"default",fn:function(a){return[t("span",[e._v(e._s(e.alarmRuleTypeDict[a.row.alarmRuleType]))])]}}])}),t("el-table-column",{attrs:{label:"是否需要报警上限",align:"center"},scopedSlots:e._u([{key:"default",fn:function(a){return[t("span",[e._v(e._s("1"===a.row.alarmRuleHighvalue?"是":"0"===a.row.alarmRuleHighvalue?"否":""))])]}}])}),t("el-table-column",{attrs:{label:"是否需要报警下限",align:"center"},scopedSlots:e._u([{key:"default",fn:function(a){return[t("span",[e._v(e._s("1"===a.row.alarmRuleLowvalue?"是":"0"===a.row.alarmRuleLowvalue?"否":""))])]}}])}),t("el-table-column",{attrs:{label:"是否启用",align:"center",width:"70px"},scopedSlots:e._u([{key:"default",fn:function(a){return[t("span",[e._v(e._s("1"===a.row.valid?"是":"0"===a.row.valid?"否":""))])]}}])}),t("el-table-column",{attrs:{label:"操作",align:"center",width:"160"},scopedSlots:e._u([{key:"default",fn:function(a){return[e.hasPerm("/deviceType/update")?t("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(t){return e.edit(a.row)}}},[e._v(" 编辑 ")]):e._e(),e.hasPerm("/deviceType/delete")?t("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(t){return e.del(a.row)}}},[e._v(" 删除 ")]):e._e()]}}])})],1)],2),t("edit-device",{ref:"editDevice",on:{watchChild:e.fetchData}})],1)},i=[],r=(a(91058),a(73210),function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{"append-to-body":"",title:e.textMap[e.dialogStatus],visible:e.dialogFormVisible},on:{"update:visible":function(t){e.dialogFormVisible=t}}},[t("el-form",{ref:"dataForm",attrs:{rules:e.rules,model:e.dataForm,"label-width":"140px","label-well-code":"right"}},[t("el-row",{attrs:{gutter:20}},[t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{prop:"id"}},[t("span",{attrs:{slot:"label"},slot:"label"},[e._v(" 设备类型编号"),"create"===e.dialogStatus?t("el-tooltip",{attrs:{content:"编号不能超过100",placement:"top"}},[t("i",{staticClass:"el-icon-warning-outline"})]):e._e()],1),t("el-input",{attrs:{maxlength:"3",type:"text",placeholder:"请输入设备类型编号",clearable:"",disabled:"create"!==e.dialogStatus},model:{value:e.dataForm.id,callback:function(t){e.$set(e.dataForm,"id","string"===typeof t?t.trim():t)},expression:"dataForm.id"}})],1)],1),t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"设备类型",prop:"typeName"}},[t("el-input",{attrs:{clearable:"",placeholder:"请输入设备类型名称"},model:{value:e.dataForm.typeName,callback:function(t){e.$set(e.dataForm,"typeName",t)},expression:"dataForm.typeName"}})],1)],1)],1),t("el-row",{attrs:{gutter:20}},[t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"描述",prop:"typeDescription"}},[t("el-input",{attrs:{type:"text",placeholder:"非必填",clearable:"",disabled:"update"!==e.dialogStatus&&"create"!==e.dialogStatus},model:{value:e.dataForm.typeDescription,callback:function(t){e.$set(e.dataForm,"typeDescription","string"===typeof t?t.trim():t)},expression:"dataForm.typeDescription"}})],1)],1),t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"监控内容",prop:"watchType"}},[t("el-input",{attrs:{type:"text",clearable:"",placeholder:"请输入监控内容",disabled:"update"!==e.dialogStatus&&"create"!==e.dialogStatus},model:{value:e.dataForm.watchType,callback:function(t){e.$set(e.dataForm,"watchType","string"===typeof t?t.trim():t)},expression:"dataForm.watchType"}})],1)],1)],1),t("el-row",{attrs:{gutter:20}},[t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"是否启用",prop:"valid"}},[t("el-select",{attrs:{placeholder:"请选择是否启用",clearable:""},model:{value:e.dataForm.valid,callback:function(t){e.$set(e.dataForm,"valid","string"===typeof t?t.trim():t)},expression:"dataForm.valid"}},e._l(e.isValidList,(function(e){return t("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1)],1),t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"报警规则类型",prop:"alarmRuleType"}},[t("el-select",{attrs:{placeholder:"请选择",clearable:""},model:{value:e.dataForm.alarmRuleType,callback:function(t){e.$set(e.dataForm,"alarmRuleType","string"===typeof t?t.trim():t)},expression:"dataForm.alarmRuleType"}},e._l(e.alarmRuleTypeList,(function(e){return t("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1)],1)],1),t("el-row",{attrs:{gutter:20}},[t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"是否需要报警上限",prop:"alarmRuleHighvalue"}},[t("el-select",{attrs:{placeholder:"请选择",clearable:""},model:{value:e.dataForm.alarmRuleHighvalue,callback:function(t){e.$set(e.dataForm,"alarmRuleHighvalue","string"===typeof t?t.trim():t)},expression:"dataForm.alarmRuleHighvalue"}},e._l(e.isValidList,(function(e){return t("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1)],1),t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"是否需要报警下限",prop:"alarmRuleLowvalue"}},[t("el-select",{attrs:{placeholder:"请选择",clearable:""},model:{value:e.dataForm.alarmRuleLowvalue,callback:function(t){e.$set(e.dataForm,"alarmRuleLowvalue","string"===typeof t?t.trim():t)},expression:"dataForm.alarmRuleLowvalue"}},e._l(e.isValidList,(function(e){return t("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1)],1)],1),t("el-row",{attrs:{gutter:20}},[t("el-col",{attrs:{span:24}},[t("el-form-item",{attrs:{label:"数据展示项配置",prop:"dataConfig"}},[t("el-input",{attrs:{type:"text",placeholder:"非必填,非开发人员勿动,json串",clearable:"",disabled:"update"!==e.dialogStatus&&"create"!==e.dialogStatus},model:{value:e.dataForm.dataConfig,callback:function(t){e.$set(e.dataForm,"dataConfig","string"===typeof t?t.trim():t)},expression:"dataForm.dataConfig"}})],1)],1)],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:"detail"!==e.dialogStatus,expression:"dialogStatus === 'detail' ? false : true"}],staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{attrs:{type:"primary"},on:{click:e.saveData}},[e._v(" 保存 ")]),t("el-button",{on:{click:function(t){e.dialogFormVisible=!1}}},[e._v(" 取消 ")])],1)],1)}),o=[],s=a(11299),n=a(25108);const u={name:"EditDeviceType",data:function(){return{dialogFormVisible:!1,dialogStatus:"",textMap:{update:"编辑",create:"新增",detail:"详情"},isValidList:[{label:"是",value:"1"},{label:"否",value:"0"}],alarmRuleTypeList:[{label:"需要单独设置报警规则",value:"1"},{label:"统一的报警规则",value:"2"},{label:"无报警规则",value:"3"}],dataForm:{id:"",typeName:"",typeDescription:"",valid:"",watchType:"",alarmRuleType:"",alarmRuleHighvalue:"",alarmRuleLowvalue:"",dataConfig:""},rules:{id:[{required:!0,message:"设备编号不能为空",trigger:["blur","change"]}],typeName:[{required:!0,message:"设备类型必选",trigger:["blur","change"]}],valid:[{required:!0,message:"是否启用必选",trigger:["blur","change"]}],watchType:[{required:!0,message:"监控内容不能为空",trigger:["blur","change"]}],alarmRuleType:[{required:!0,message:"报警规则类型不能为空",trigger:["blur","change"]}],alarmRuleHighvalue:[{required:!0,message:"是否需要报警上限必选",trigger:["blur","change"]}],alarmRuleLowvalue:[{required:!0,message:"是否需要报警下限必选",trigger:["blur","change"]}]}}},methods:{resetForm:function(){this.dataForm={id:"",typeName:"",typeDescription:"",valid:"",watchType:"",alarmRuleType:"",alarmRuleHighvalue:"",alarmRuleLowvalue:"",dataConfig:""}},initDialog:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.dialogFormVisible=!0,this.dialogStatus=e,"create"===this.dialogStatus?(this.resetForm(),this.$nextTick((function(){t.$refs["dataForm"].clearValidate()}))):"update"!==this.dialogStatus&&"detail"!==this.dialogStatus||(this.dataForm={id:a.id,typeName:a.typeName,typeDescription:a.typeDescription,valid:a.valid,watchType:a.watchType,alarmRuleType:a.alarmRuleType,alarmRuleHighvalue:a.alarmRuleHighvalue,alarmRuleLowvalue:a.alarmRuleLowvalue,dataConfig:a.dataConfig})},saveData:function(){"update"===this.dialogStatus?this.updateData():"create"===this.dialogStatus&&this.createData()},updateData:function(){var e=this;this.$refs["dataForm"].validate((function(t){t&&(0,s.VJ)(e.dataForm).then((function(t){200===t.code&&(e.$message.success("修改成功"),e.$emit("watchChild"),e.dialogFormVisible=!1)}))}))},createData:function(){var e=this;this.$refs["dataForm"].validate((function(t){n.log(e.dataForm),t&&(0,s.eu)(e.dataForm).then((function(t){200===t.code&&e.$confirm("新增成功,是否继续新增?","提示",{confirmButtonText:"是",cancelButtonText:"否",type:"info"}).then((function(){e.resetForm(),e.$nextTick((function(){e.$refs["dataForm"].clearValidate()}))}))["catch"]((function(){e.$emit("watchChild"),e.dialogFormVisible=!1}))}))}))}}},c=u;var d=a(1001),p=(0,d.Z)(c,r,o,!1,null,"59ee2bd5",null);const m=p.exports,f={name:"DeviceType",components:{editDevice:m},data:function(){return{listQuery:{deviceType:"",isValid:"",offset:1,limit:20,sort:"id",order:"asc"},isValidList:[{label:"是",value:"1"},{label:"否",value:"0"}],columns:[{text:"设备类型编号",value:"id",align:"center",width:100},{text:"设备类型",value:"typeName",align:"center"},{text:"描述",value:"typeDescription",align:"center"},{text:"监控内容",value:"watchType",align:"center"}],alarmRuleTypeDict:{1:"需要单独设置报警规则",2:"统一的报警规则",3:"无报警规则"},tableOptions:{needIndex:!1,border:!0},total:0,multipleSelection:[],list:[],listLoading:!0,dialogShow:!1}},created:function(){this.fetchData()},methods:{search:function(){this.fetchData(!1)},fetchData:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.listLoading=!0,t||(this.listQuery.offset=1),(0,s.bL)(this.listQuery).then((function(t){e.list=t.data.rows,e.total=parseInt(t.data.total),e.listLoading=!1}))},del:function(e){var t=this;this.$confirm("确定要删除所选设备类型吗?该操作可能会引起其他功能异常","确认操作",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,s.U4)(e.id).then((function(e){200===e.code&&(t.$message.success("删除成功"),t.fetchData())}))}))},detail:function(e){this.$refs.editDevice.initDialog("detail",e)},add:function(){this.$refs.editDevice.initDialog("create")},edit:function(e){this.$refs.editDevice.initDialog("update",e)},changePage:function(e){e&&e.size&&(this.listQuery.limit=e.size),e&&e.page&&(this.listQuery.offset=e.page),this.fetchData()}}},g=f;var h=(0,d.Z)(g,l,i,!1,null,"28ed9046",null);const v=h.exports},11299:(e,t,a)=>{a.d(t,{U4:()=>u,VJ:()=>n,bL:()=>o,eu:()=>s});var l=a(84471),i=a(80129),r=a.n(i);function o(e){return(0,l.Z)({url:"deviceType/listPage",method:"get",params:e})}function s(e){return(0,l.Z)({url:"deviceType/add",method:"post",params:e})}function n(e){return(0,l.Z)({url:"deviceType/update",method:"post",params:e})}function u(e){return(0,l.Z)({url:"deviceType/delete",method:"post",params:{deviceTypeId:e},paramsSerializer:function(e){return r().stringify(e,{indices:!1})}})}}}]);