Your Name
2022-09-29 6f954f70f54e492157b97db314eaaaeb12192580
1
(this.webpackJsonp=this.webpackJsonp||[]).push([["chunk-719c"],{"7VJi":function(e,t,i){"use strict";var a=i("J7/v");i.n(a).a},"J7/v":function(e,t,i){},WV7m:function(e,t,i){"use strict";i.r(t);var a=i("cLjf"),r=i.n(a),l=i("hDQ3"),o=i.n(l),s=i("omC7"),n=i.n(s),p=i("XsSp"),u=i("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 i=this.approveRuleForm.stepList.findIndex(function(t){return t.stepSerial===e.stepSerial});this.$set(this.approveRuleForm.stepList,i,e)}},showApproveRuleDialog:function(e,t,i,a,r){var l=this;this.ifShowApproveRuleDialog=!0,this.userList=a,this.workTypeList=r,this.departmentList=i,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(i){var a,l;return r.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!i){t.next=14;break}if("新增审批规则"!==e.title){t.next=8;break}return t.next=4,Object(u.a)().addApproveRule(e.approveRuleForm);case 4:"200"===(a=t.sent).data.code?(e.$message({type:"success",message:"审批规则新增成功",duration:2e3}),e.ifShowApproveRuleDialog=!1,e.$emit("refreshApproveRule")):e.$message({type:"warning",message:a.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=(i("7VJi"),i("ZrdR")),m=Object(v.a)(d,function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"system-add-menu-container"},[i("el-dialog",{attrs:{visible:e.ifShowApproveRuleDialog,title:e.title,"close-on-click-modal":!1},on:{"update:visible":function(t){e.ifShowApproveRuleDialog=t}}},[i("el-form",{ref:"approveRuleFormRef",attrs:{model:e.approveRuleForm,"label-width":"120px",rules:e.approveRuleFormRules}},[i("el-col",{attrs:{span:24}},[i("el-form-item",{attrs:{label:"任务名称",prop:"ruleName"}},[i("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(" "),i("el-col",{attrs:{span:24}},[i("el-form-item",{attrs:{label:"部门名称",prop:"depId"}},[i("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 i("el-option",{key:e.id,attrs:{value:e.id,label:e.department}})}))],1)],1),e._v(" "),i("el-col",{attrs:{span:24}},[i("el-form-item",{attrs:{label:"作业类型",prop:"workType"}},[i("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 i("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?i("el-col",{attrs:{span:24}},[i("el-form-item",{attrs:{label:"作业等级",prop:"workLevel"}},[i("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 i("el-option",{key:e.id,attrs:{value:e.id,label:e.name}})}))],1)],1):e._e(),e._v(" "),i("el-col",{attrs:{span:24}},[i("el-form-item",{attrs:{label:"创建审批链"}},[e.disabled?i("div",{staticStyle:{width:"100%","padding-bottom":"10px"}},[i("el-button",{attrs:{type:"primary",size:"default"},on:{click:function(t){e.openApproveLevelDialog("新增","")}}},[e._v("新增审批层级")])],1):e._e(),e._v(" "),i("div",{staticStyle:{width:"100%","margin-left":"-30px"}},e._l(e.approveRuleForm.stepList,function(t,a){return i("div",{staticClass:"stepItem"},[i("div",{staticClass:"stepNum"},[e._v(e._s(a+1))]),e._v(" "),i("div",{staticClass:"stepCard"},[i("el-card",{staticClass:"box-card"},[i("div",{staticClass:"text item"},[e._v("\n                                            层级名称:"),i("span",[e._v(e._s(t.stepName))])]),e._v(" "),e._l(e.typeList,function(a){return i("div",{staticClass:"text item"},[a.id===t.type?i("div",[e._v("\n                                                审批层级:"),i("span",[e._v(e._s(a.name))])]):e._e()])}),e._v(" "),i("div",{staticClass:"text item"},[e._v("\n                                            审批人:"),i("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(a){return i("div",{staticClass:"text item"},[a.id===t.continueTimeUnit?i("div",[e._v("\n                                                审批有效时长:"),i("span",[e._v(e._s(t.continueTime))]),e._v(" "),i("span",[e._v(e._s(a.name))])]):e._e()])}),e._v(" "),i("div",{staticClass:"text item"},[e._v("\n                                            审批项:"),i("span",[e._v(e._s(t.itemList.map(function(e){return e.itemName}).join("、")))])])],2)],1),e._v(" "),e.disabled?i("div",[i("el-button",{staticStyle:{"margin-left":"10px","margin-bottom":"10px"},attrs:{type:"primary",size:"default"},on:{click:function(i){e.openApproveLevelDialog("修改",t)}}},[e._v("修改")]),e._v(" "),i("el-button",{attrs:{type:"danger",size:"default"},on:{click:function(i){e.deleteApproveLevel(a,t)}}},[e._v("删除")])],1):e._e()])}))])],1)],1),e._v(" "),[e.disabled?i("div",{staticClass:"dialog-footer",attrs:{align:"right"}},[i("el-button",{attrs:{type:"warning",size:"default",plain:""},on:{click:function(t){e.ifShowApproveRuleDialog=!1}}},[e._v("取消")]),e._v(" "),i("el-button",{attrs:{type:"primary",size:"default"},on:{click:function(t){e.submitApproveRule()}}},[e._v("确认")])],1):e._e()]],2),e._v(" "),i("approve-level-dialog",{ref:"approveLevelDialogRef",on:{addApprovalLevel:e.achieveApprovalLevel}})],1)},[],!1,null,"2db98a8a",null);m.options.__file="approveRuleDialog.vue";t.default=m.exports},eli2:function(e,t,i){"use strict";i.d(t,"a",function(){return l});var a=i("t3Un"),r=i("X4fA");function l(){return{getApproveRuleList:function(e){return Object(a.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(a.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(a.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(a.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(a.a)({headers:{Authorization:Object(r.a)()},url:"http://222.92.213.22:8006/zhongtai/prevent/device/select/listDevices",method:"post",data:e})}}}}}]);