(this.webpackJsonp=this.webpackJsonp||[]).push([["chunk-e5ad"],{WV7m:function(e,t,a){"use strict";a.r(t);var i=a("cLjf"),r=a.n(i),l=a("hDQ3"),o=a.n(l),s=a("omC7"),n=a.n(s),p=a("XsSp"),u=a("eli2"),d={name:"approveRuleDialog",components:{approveLevelDialog:p.default},data:function(){return{title:"",pointTitle:"",disabled:!0,ifShowApproveRuleDialog:!1,inspectPointForm:{id:null,stepName:null,stepSerial:null,type:null,continueTime:null,continueTimeUnit:null,unitList:[],itemList:[]},approveRuleForm:{id:null,ruleName:null,depId:null,workType:null,workLevel:null,stepList:[]},approveRuleFormRules:{ruleName:[{required:!0,message:"请填写规则名称",trigger:"blur"}],depId:[{required:!0,message:"请选择部门",trigger:"change"}],workLevel:[{required:!0,message:"请选择作业等级",trigger:"change"}],workType:[{required:!0,message:"请选择作业类型",trigger:"cahnge"}]},departmentList:[],userList:[],typeList:[{id:1,name:"单人"},{id:2,name:"多人"},{id:3,name:"分析人"}],timeList:[{id:1,name:"日"},{id:2,name:"时"},{id:3,name:"分"}],workTypeList:[{id:1,name:"动火作业"},{id:2,name:"受限空间作业"},{id:3,name:"吊装作业"},{id:4,name:"动土作业"},{id:5,name:"断路作业"},{id:6,name:"高处作业"},{id:7,name:"临时用电作业"},{id:8,name:"盲板抽堵作业"}],workLevelList:[]}},created:function(){},methods:{openApproveLevelDialog:function(e,t){this.$refs.approveLevelDialogRef.showApproveLevelDialog(e,t,this.userList)},achieveApprovalLevel:function(e,t){if("新增审批层级"===t)0===this.approveRuleForm.stepList.length?(e.stepSerial=1,this.approveRuleForm.stepList.push(e)):(e.stepSerial=this.approveRuleForm.stepList[this.approveRuleForm.stepList.length-1].stepSerial+1,this.approveRuleForm.stepList.push(e));else{var a=this.approveRuleForm.stepList.findIndex(function(t){return t.stepSerial===e.stepSerial});this.$set(this.approveRuleForm.stepList,a,e)}},showApproveRuleDialog:function(e,t,a,i,r){var l=this;this.ifShowApproveRuleDialog=!0,this.userList=i,this.workTypeList=r,this.departmentList=a,this.$nextTick(function(){l.$refs.approveRuleFormRef.clearValidate()}),"新增"===e?(this.disabled=!0,this.title="新增审批规则",this.approveRuleForm={id:null,ruleName:null,depId:null,workType:null,workLevel:null,stepList:[]}):"修改"===e?(this.disabled=!0,this.title="修改审批规则",this.approveRuleForm=JSON.parse(n()(t)),this.setValue(t.workType)):(this.disabled=!0,this.title="查看审批规则",this.setValue(t.workType),this.approveRuleForm=JSON.parse(n()(t)))},deleteApproveLevel:function(e,t){this.approveRuleForm.stepList.splice(e,1)},clearValue:function(){1===this.approveRuleForm.workType?(this.approveRuleForm.workLevel=null,this.workLevelList=[{id:3,name:"特级动火作业"},{id:1,name:"一级动火作业"},{id:2,name:"二级动火作业"}]):3===this.approveRuleForm.workType?(this.approveRuleForm.workLevel=null,this.workLevelList=[{id:8,name:"一级吊装作业"},{id:9,name:"二级吊装作业"},{id:10,name:"三级吊装作业"}]):6===this.approveRuleForm.workType?(this.approveRuleForm.workLevel=null,this.workLevelList=[{id:7,name:"特级高处作业"},{id:4,name:"一级高处作业"},{id:5,name:"二级高处作业"},{id:6,name:"三级高处作业"}]):8===this.approveRuleForm.workType?(this.approveRuleForm.workLevel=null,this.workLevelList=[{id:11,name:"抽盲板作业"},{id:12,name:"堵盲板作业"}]):(this.approveRuleForm.workLevel=null,this.workLevelList=[])},setValue:function(e){this.workLevelList=1===e?[{id:3,name:"特级动火作业"},{id:1,name:"一级动火作业"},{id:2,name:"二级动火作业"}]:3===e?[{id:8,name:"一级吊装作业"},{id:9,name:"二级吊装作业"},{id:10,name:"三级吊装作业"}]:6===e?[{id:7,name:"四级高处作业"},{id:4,name:"一级高处作业"},{id:5,name:"二级高处作业"},{id:6,name:"三级高处作业"}]:8===e?[{id:11,name:"抽盲板作业"},{id:12,name:"堵盲板作业"}]:[]},parseNumber:function(e,t){if("时间单位"===e)return this.timeList.find(function(e){return e.id===t}).name},submitApproveRule:function(){var e=this;this.$refs.approveRuleFormRef.validate(function(){var t=o()(r.a.mark(function t(a){var i,l;return r.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!a){t.next=14;break}if("新增审批规则"!==e.title){t.next=8;break}return t.next=4,Object(u.a)().addApproveRule(e.approveRuleForm);case 4:"200"===(i=t.sent).data.code?(e.$message({type:"success",message:"审批规则新增成功",duration:2e3}),e.ifShowApproveRuleDialog=!1,e.$emit("refreshApproveRule")):e.$message({type:"warning",message:i.data.message}),t.next=12;break;case 8:return t.next=10,Object(u.a)().modApproveRule(e.approveRuleForm);case 10:"200"===(l=t.sent).data.code?(e.$message({type:"success",message:"审批规则修改成功",duration:2e3}),e.ifShowApproveRuleDialog=!1,e.$emit("refreshApproveRule")):e.$message({type:"warning",message:l.data.message});case 12:t.next=15;break;case 14:e.$message({type:"warning",message:"请完善基本信息"});case 15:case"end":return t.stop()}},t,e)}));return function(e){return t.apply(this,arguments)}}())}}},v=(a("jdJD"),a("ZrdR")),m=Object(v.a)(d,function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"system-add-menu-container"},[a("el-dialog",{attrs:{visible:e.ifShowApproveRuleDialog,title:e.title,"close-on-click-modal":!1},on:{"update:visible":function(t){e.ifShowApproveRuleDialog=t}}},[a("el-form",{ref:"approveRuleFormRef",attrs:{model:e.approveRuleForm,"label-width":"120px",rules:e.approveRuleFormRules}},[a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"任务名称",prop:"ruleName"}},[a("el-input",{staticClass:"input-add",attrs:{disabled:!e.disabled,placeholder:"请填写任务名称"},model:{value:e.approveRuleForm.ruleName,callback:function(t){e.$set(e.approveRuleForm,"ruleName",t)},expression:"approveRuleForm.ruleName"}})],1)],1),e._v(" "),a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"部门名称",prop:"depId"}},[a("el-select",{staticClass:"input-add",attrs:{disabled:!e.disabled,placeholder:"请选择部门名称"},model:{value:e.approveRuleForm.depId,callback:function(t){e.$set(e.approveRuleForm,"depId",t)},expression:"approveRuleForm.depId"}},e._l(e.departmentList,function(e){return a("el-option",{key:e.id,attrs:{value:e.id,label:e.department}})}))],1)],1),e._v(" "),a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"作业类型",prop:"workType"}},[a("el-select",{staticClass:"input-add",attrs:{disabled:!e.disabled,placeholder:"请选择作业类型"},on:{change:e.clearValue},model:{value:e.approveRuleForm.workType,callback:function(t){e.$set(e.approveRuleForm,"workType",t)},expression:"approveRuleForm.workType"}},e._l(e.workTypeList,function(e){return a("el-option",{key:e.id,attrs:{value:e.id,label:e.name}})}))],1)],1),e._v(" "),3===e.approveRuleForm.workType||6===e.approveRuleForm.workType||8===e.approveRuleForm.workType||1===e.approveRuleForm.workType?a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"作业等级",prop:"workLevel"}},[a("el-select",{staticClass:"input-add",attrs:{disabled:!e.disabled,placeholder:"请选择作业等级"},model:{value:e.approveRuleForm.workLevel,callback:function(t){e.$set(e.approveRuleForm,"workLevel",t)},expression:"approveRuleForm.workLevel"}},e._l(e.workLevelList,function(e){return a("el-option",{key:e.id,attrs:{value:e.id,label:e.name}})}))],1)],1):e._e(),e._v(" "),a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"创建审批链"}},[e.disabled?a("div",{staticStyle:{width:"100%","padding-bottom":"10px"}},[a("el-button",{attrs:{type:"primary",size:"default"},on:{click:function(t){e.openApproveLevelDialog("新增","")}}},[e._v("新增审批层级")])],1):e._e(),e._v(" "),a("div",{staticStyle:{width:"100%","margin-left":"-30px"}},e._l(e.approveRuleForm.stepList,function(t,i){return a("div",{staticClass:"stepItem"},[a("div",{staticClass:"stepNum"},[e._v(e._s(i+1))]),e._v(" "),a("div",{staticClass:"stepCard"},[a("el-card",{staticClass:"box-card"},[a("div",{staticClass:"text item"},[e._v("\n 层级名称:"),a("span",[e._v(e._s(t.stepName))])]),e._v(" "),e._l(e.typeList,function(i){return a("div",{staticClass:"text item"},[i.id===t.type?a("div",[e._v("\n 审批层级:"),a("span",[e._v(e._s(i.name))])]):e._e()])}),e._v(" "),a("div",{staticClass:"text item"},[e._v("\n 审批人:"),a("span",[e._v(e._s(JSON.parse(JSON.stringify(t.unitList.map(function(t){return e.userList.find(function(e){return e.id===t.bindUid}).realname}).join("、")))))])]),e._v(" "),e._l(e.timeList,function(i){return a("div",{staticClass:"text item"},[i.id===t.continueTimeUnit?a("div",[e._v("\n 审批有效时长:"),a("span",[e._v(e._s(t.continueTime))]),e._v(" "),a("span",[e._v(e._s(i.name))])]):e._e()])}),e._v(" "),a("div",{staticClass:"text item"},[e._v("\n 审批项:"),a("span",[e._v(e._s(t.itemList.map(function(e){return e.itemName}).join("、")))])])],2)],1),e._v(" "),e.disabled?a("div",[a("el-button",{staticStyle:{"margin-left":"10px","margin-bottom":"10px"},attrs:{type:"primary",size:"default"},on:{click:function(a){e.openApproveLevelDialog("修改",t)}}},[e._v("修改")]),e._v(" "),a("el-button",{attrs:{type:"danger",size:"default"},on:{click:function(a){e.deleteApproveLevel(i,t)}}},[e._v("删除")])],1):e._e()])}))])],1)],1),e._v(" "),[e.disabled?a("div",{staticClass:"dialog-footer",attrs:{align:"right"}},[a("el-button",{attrs:{type:"warning",size:"default",plain:""},on:{click:function(t){e.ifShowApproveRuleDialog=!1}}},[e._v("取消")]),e._v(" "),a("el-button",{attrs:{type:"primary",size:"default"},on:{click:function(t){e.submitApproveRule()}}},[e._v("确认")])],1):e._e()]],2),e._v(" "),a("approve-level-dialog",{ref:"approveLevelDialogRef",on:{addApprovalLevel:e.achieveApprovalLevel}})],1)},[],!1,null,"18d3eef6",null);m.options.__file="approveRuleDialog.vue";t.default=m.exports},"bJF+":function(e,t,a){},eli2:function(e,t,a){"use strict";a.d(t,"a",function(){return l});var i=a("t3Un"),r=a("X4fA");function l(){return{getApproveRuleList:function(e){return Object(i.a)({headers:{Authorization:Object(r.a)()},url:"http://222.92.213.22:8006/zhongtai/rule/listByPage",method:"post",data:e})},addApproveRule:function(e){return Object(i.a)({headers:{Authorization:Object(r.a)()},url:"http://222.92.213.22:8006/zhongtai/rule/save",method:"post",data:e})},modApproveRule:function(e){return Object(i.a)({headers:{Authorization:Object(r.a)()},url:"http://222.92.213.22:8006/zhongtai/rule/update",method:"post",data:e})},deleteApproveRule:function(e){return Object(i.a)({headers:{Authorization:Object(r.a)()},url:"http://222.92.213.22:8006/zhongtai/rule/del",method:"post",data:e})},getAllApproveRuleList:function(e){return Object(i.a)({headers:{Authorization:Object(r.a)()},url:"http://222.92.213.22:8006/zhongtai/prevent/device/select/listDevices",method:"post",data:e})}}}},jdJD:function(e,t,a){"use strict";var i=a("bJF+");a.n(i).a}}]);
|