1 line
7.1 KiB
JavaScript
1 line
7.1 KiB
JavaScript
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2bec94fe"],{"0abe":function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("el-form",{ref:"dataForm",attrs:{model:t.dataForm,rules:t.dataRule,"label-width":"120px"},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.dataFormSubmit()}}},[r("el-form-item",{attrs:{prop:"name",label:t.$t("role.name")}},[r("el-input",{attrs:{placeholder:t.$t("role.name")},model:{value:t.dataForm.name,callback:function(e){t.$set(t.dataForm,"name",e)},expression:"dataForm.name"}})],1),r("el-form-item",{attrs:{prop:"remark",label:t.$t("role.remark")}},[r("el-input",{attrs:{placeholder:t.$t("role.remark")},model:{value:t.dataForm.remark,callback:function(e){t.$set(t.dataForm,"remark",e)},expression:"dataForm.remark"}})],1),r("el-row",[r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{size:"mini",label:t.$t("role.menuList")}},[r("el-tree",{ref:"menuListTree",attrs:{data:t.menuList,props:{label:"name",children:"children"},"node-key":"id",accordion:"","show-checkbox":""}})],1)],1),r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{size:"mini",label:t.$t("role.deptList")}},[r("el-tree",{ref:"deptListTree",attrs:{data:t.deptList,props:{label:"name",children:"children"},"node-key":"id",accordion:"","show-checkbox":""}})],1)],1)],1)],1)},a=[],i=(r("99af"),r("4160"),r("d3b7"),r("3ca3"),r("159b"),r("ddb0"),r("2909")),o=r("5530"),s=r("b047c"),c=r.n(s),u=r("3d7b"),d={mixins:[u["a"]],data:function(){return{urlOptions:{submitURL:"/sys/role/",infoURL:"/sys/role"},visible:!1,menuList:[],deptList:[],dataForm:{id:"",name:"",menuIdList:[],deptIdList:[],remark:""}}},computed:{dataRule:function(){return{name:[{required:!0,message:this.$t("validate.required"),trigger:"blur"}]}}},methods:{init:function(t){var e=this;this.dataForm.id=t||"",this.$nextTick((function(){e.$refs["dataForm"].resetFields(),e.$refs.menuListTree.setCheckedKeys([]),e.$refs.deptListTree.setCheckedKeys([]),Promise.all([e.getMenuList(),e.getDeptList()]).then((function(){e.dataForm.id&&e.getInfo()}))}))},getMenuList:function(){var t=this;return this.$http.get("/sys/menu/select").then((function(e){var r=e.data;if(0!==r.code)return t.$message.error(r.msg);t.menuList=r.data})).catch((function(){}))},getDeptList:function(){var t=this;return this.$http.get("/sys/dept/list").then((function(e){var r=e.data;if(0!==r.code)return t.$message.error(r.msg);t.deptList=r.data})).catch((function(){}))},getInfo:function(){var t=this;this.$http.get("/sys/role/".concat(this.dataForm.id)).then((function(e){var r=e.data;if(0!==r.code)return t.$message.error(r.msg);t.dataForm=Object(o["a"])(Object(o["a"])({},t.dataForm),r.data),t.dataForm.menuIdList.forEach((function(e){return t.$refs.menuListTree.setChecked(e,!0)})),t.$refs.deptListTree.setCheckedKeys(t.dataForm.deptIdList)})).catch((function(){}))},dataFormSubmit:c()((function(){var t=this;this.$refs["dataForm"].validate((function(e){if(!e)return!1;t.dataForm.menuIdList=[].concat(Object(i["a"])(t.$refs.menuListTree.getHalfCheckedKeys()),Object(i["a"])(t.$refs.menuListTree.getCheckedKeys())),t.dataForm.deptIdList=t.$refs.deptListTree.getCheckedKeys(),t.$http[t.dataForm.id?"put":"post"]("/sys/role",t.dataForm).then((function(e){var r=e.data;if(0!==r.code)return t.$message.error(r.msg);t.$message({message:t.$t("prompt.success"),type:"success",duration:500,onClose:function(){t.visible=!1,t.$emit("successSubmit")}})})).catch((function(){}))}))}),1e3,{leading:!0,trailing:!1})}},f=d,m=r("2877"),l=Object(m["a"])(f,n,a,!1,null,null,null);e["default"]=l.exports},2909:function(t,e,r){"use strict";r.d(e,"a",(function(){return c}));var n=r("6b75");function a(t){if(Array.isArray(t))return Object(n["a"])(t)}r("a4d3"),r("e01a"),r("d28b"),r("a630"),r("d3b7"),r("3ca3"),r("ddb0");function i(t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}var o=r("06c5");function s(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array o
|