chunk-1aa7186e.d7c9be5a.js 12 KB

123456
  1. /*!
  2. * build: Hopaheal
  3. * copyright: Mead
  4. * time: 2022-6-7 11:38:49
  5. */
  6. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-1aa7186e"],{"2f4e":function(e,t,r){},"4fee":function(e,t,r){},"986f":function(e,t,r){"use strict";r.r(t);var n=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"department-management-container"},[n("vab-query-form",[n("vab-query-form-left-panel",{attrs:{span:12}},[n("el-button",{attrs:{icon:"el-icon-plus",type:"primary"},on:{click:e.handleEdit}},[e._v(" 添加 ")]),n("el-button",{attrs:{icon:"el-icon-delete",type:"danger"},on:{click:e.handleDelete}},[e._v(" 批量删除 ")])],1),n("vab-query-form-right-panel",{attrs:{span:12}},[n("el-form",{attrs:{inline:!0,model:e.queryForm},nativeOn:{submit:function(e){e.preventDefault()}}},[n("el-form-item",[n("el-input",{attrs:{clearable:"",placeholder:"请输入名称"},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.queryData.apply(null,arguments)}},model:{value:e.queryForm.name,callback:function(t){e.$set(e.queryForm,"name","string"===typeof t?t.trim():t)},expression:"queryForm.name"}})],1),n("el-form-item",[n("el-button",{attrs:{icon:"el-icon-search",type:"primary"},on:{click:e.queryData}},[e._v(" 查询 ")])],1)],1)],1)],1),n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.listLoading,expression:"listLoading"}],attrs:{border:"",data:e.list,"default-expand-all":"","row-key":"id","tree-props":{children:"children"}},on:{"selection-change":e.setSelectRows},scopedSlots:e._u([{key:"empty",fn:function(){return[n("el-image",{staticClass:"vab-data-empty",attrs:{src:r("f1f0")}})]},proxy:!0}])},[n("el-table-column",{attrs:{"show-overflow-tooltip":"",type:"selection"}}),n("el-table-column",{attrs:{label:"部门名称",prop:"name","show-overflow-tooltip":""}}),n("el-table-column",{attrs:{align:"center",label:"排序",prop:"sort","show-overflow-tooltip":""},scopedSlots:e._u([{key:"default",fn:function(t){var r=t.row;return[n("div",{staticClass:"edit"},[e.editForm.id==r.id&&1==e.editStatus?n("i",{staticClass:"el-icon-circle-close",on:{click:function(t){return t.stopPropagation(),e.cancelSort(r)}}}):e._e(),e.editForm.id!==r.id||0==e.editStatus?n("span",{staticClass:"sort-num"},[e._v(" "+e._s(r.sort)+" ")]):e._e(),e.editForm.id==r.id&&1==e.editStatus?n("el-input",{ref:"getFocus",staticClass:"input-sort",on:{input:e.inputSort},model:{value:r.sort,callback:function(t){e.$set(r,"sort",t)},expression:"row.sort"}}):e._e(),e.editForm.id!==r.id||0==e.editStatus?n("i",{staticClass:"el-icon-edit",on:{click:function(t){return e.changeSort(r)}}}):e._e(),e.editForm.id==r.id&&1==e.editStatus?n("i",{staticClass:"el-icon-circle-check",on:{click:function(t){return t.stopPropagation(),e.sureChange.apply(null,arguments)}}}):e._e()],1)]}}])}),n("el-table-column",{attrs:{align:"center",label:"创建时间",prop:"created_at","show-overflow-tooltip":""}}),n("el-table-column",{attrs:{align:"center",label:"状态",prop:"status","show-overflow-tooltip":""},scopedSlots:e._u([{key:"default",fn:function(t){var r=t.row;return[1==r.status?n("el-tag",[e._v("正常")]):e._e(),0==r.status?n("el-tag",{attrs:{type:"danger"}},[e._v("禁用")]):e._e()]}}])}),n("el-table-column",{attrs:{align:"center",label:"操作",width:"90"},scopedSlots:e._u([{key:"default",fn:function(t){var r=t.row;return[n("el-button",{attrs:{type:"text"},on:{click:function(t){return e.handleEdit(r)}}},[e._v("编辑")]),n("el-button",{attrs:{disabled:!!r.children,type:"text"},on:{click:function(t){return e.handleDelete(r)}}},[e._v(" 删除 ")])]}}])})],1),n("edit",{ref:"edit",on:{"fetch-data":e.getList}})],1)},a=[],s=r("1da1"),o=(r("96cf"),r("4e82"),r("d81d"),r("bb0e")),i=r("ee9d"),l={name:"DepartmentManagement",components:{Edit:i["default"]},data:function(){return{list:[],listLoading:!0,total:0,selectRows:"",queryForm:{name:""},editForm:{},oldSort:0,editStatus:0,flag:!1}},created:function(){this.getList()},methods:{changeSort:function(e){var t=this;return Object(s["a"])(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:t.editStatus=1,t.editForm=e,t.oldSort=e.sort,t.$nextTick((function(){t.$refs["getFocus"].focus()}));case 4:case"end":return r.stop()}}),r)})))()},cancelSort:function(e){e.sort=this.oldSort,this.editStatus=0},inputSort:function(e){console.log(e,"000000000"),this.editForm.sort=e},sureChange:function(){var e=this;return Object(s["a"])(regeneratorRuntime.mark((function t(){var r,n;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(console.log("触发change事件"),e.editStatus=0,e.oldSort===e.editForm.sort){t.next=12;break}return t.next=5,Object(o["doEdit"])(e.editForm);case 5:r=t.sent,n=r.message,console.log(n,"message"),e.$baseMessage(n,"success",!1,"vab-hey-message-success"),e.getList(),t.next=13;break;case 12:return t.abrupt("return");case 13:case"end":return t.stop()}}),t)})))()},setSelectRows:function(e){this.selectRows=e},handleEdit:function(e){e.id?this.$refs["edit"].showEdit(e):this.$refs["edit"].showEdit()},handleDelete:function(e){var t=this;if(console.log(e),e.id)this.$baseConfirm("你确定要删除当前项吗",null,Object(s["a"])(regeneratorRuntime.mark((function r(){var n,a;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.next=2,Object(o["doDelete"])({ids:[e.id]});case 2:return n=r.sent,a=n.message,t.$baseMessage(a,"success",!1,"vab-hey-message-success"),r.next=7,t.getList();case 7:case"end":return r.stop()}}),r)}))));else if(this.selectRows.length>0){var r=this.selectRows.map((function(e){return e.id}));this.$baseConfirm("你确定要删除选中项吗",null,Object(s["a"])(regeneratorRuntime.mark((function e(){var n,a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(o["doDelete"])({ids:r});case 2:return n=e.sent,a=n.message,t.$baseMessage(a,"success",!1,"vab-hey-message-success"),e.next=7,t.getList();case 7:case"end":return e.stop()}}),e)}))))}else this.$baseMessage("未选中任何行","error",!1,"vab-hey-message-error")},queryData:function(){this.queryForm.page=1,this.getList()},getList:function(){var e=this;return Object(s["a"])(regeneratorRuntime.mark((function t(){var r,n;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.listLoading=!0,t.next=3,Object(o["getList"])(e.queryForm);case 3:r=t.sent,n=r.data,console.log(n.length,"部门列表"),n.length?e.list=n:e.list=[],e.listLoading=!1;case 8:case"end":return t.stop()}}),t)})))()}}},c=l,u=(r("cb8a"),r("2877")),d=Object(u["a"])(c,n,a,!1,null,"252bd50b",null);t["default"]=d.exports},bb0e:function(e,t,r){"use strict";r.r(t),r.d(t,"getTree",(function(){return a})),r.d(t,"getList",(function(){return s})),r.d(t,"doAdd",(function(){return o})),r.d(t,"doEdit",(function(){return i})),r.d(t,"doDelete",(function(){return l}));var n=r("b775");function a(e){return Object(n["default"])({url:"/base/department-tree",method:"get",params:e})}function s(e){return Object(n["default"])({url:"/base/department-tree",method:"get",params:e})}function o(e){return Object(n["default"])({url:"/base/department",method:"post",data:e})}function i(e){return Object(n["default"])({url:"/base/department/"+e.id,method:"put",data:e})}function l(e){return Object(n["default"])({url:"/base/department/delete",method:"post",data:e})}},ca23:function(e,t,r){"use strict";r("2f4e")},cb8a:function(e,t,r){"use strict";r("4fee")},ee9d:function(e,t,r){"use strict";r.r(t);var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("el-dialog",{attrs:{title:e.title,visible:e.dialogFormVisible,width:"500px"},on:{"update:visible":function(t){e.dialogFormVisible=t},close:e.close},scopedSlots:e._u([{key:"footer",fn:function(){return[r("el-button",{on:{click:e.close}},[e._v("取 消")]),"编辑"==e.title?r("el-button",{attrs:{type:"primary"},on:{click:e.save}},[e._v(" 确 定 ")]):e._e(),"添加"==e.title?r("el-button",{attrs:{type:"primary"},on:{click:e.add}},[e._v(" 添 加 ")]):e._e()]},proxy:!0}])},[r("el-form",{ref:"form",staticClass:"dep-form",attrs:{"label-width":"80px",model:e.form,rules:e.rules}},[r("el-form-item",{attrs:{label:"上级部门",prop:"parent_id"}},[r("el-select",{ref:"selectblur",staticStyle:{width:"100%"},attrs:{placeholder:"请选择上级部门"},model:{value:e.form.parent_name,callback:function(t){e.$set(e.form,"parent_name",t)},expression:"form.parent_name"}},[r("el-option",{staticStyle:{height:"auto",padding:"0"},attrs:{label:e.form.parent_name,value:e.form.parent_id}},[r("el-tree",{ref:"tree",attrs:{data:e.treeData,"default-expand-all":"",props:e.defaultProps},on:{"node-click":e.handleNodeClick}})],1)],1)],1),r("el-form-item",{attrs:{label:"部门名称",prop:"name"}},[r("el-input",{model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1),r("el-form-item",{attrs:{label:"部门排序",prop:"sort"}},[r("el-input",{attrs:{type:"number"},model:{value:e.form.sort,callback:function(t){e.$set(e.form,"sort",t)},expression:"form.sort"}})],1),r("el-form-item",{attrs:{label:"部门状态",prop:"status"}},[r("el-radio-group",{model:{value:e.form.status,callback:function(t){e.$set(e.form,"status",t)},expression:"form.status"}},[r("el-radio",{attrs:{label:1}},[e._v("正常")]),r("el-radio",{attrs:{label:0}},[e._v("禁用")])],1)],1)],1)],1)},a=[],s=r("1da1"),o=(r("96cf"),r("99af"),r("b0c0"),r("bb0e")),i={name:"DepartmentManagementEdit",data:function(){return{treeData:[{id:"0",name:"顶级部门"}],defaultProps:{children:"children",label:"name",leaf:!0},form:{parent_id:"",status:1,sort:0},parentName:"",rules:{parent_id:[{required:!0,trigger:"change",message:"请选择上级部门"}],name:[{required:!0,trigger:"blur",message:"请输入部门名称"}],sort:[{required:!0,trigger:"blur",message:"请输入部门排序"}]},title:"",dialogFormVisible:!1}},created:function(){},methods:{fetchData:function(){var e=this;return Object(s["a"])(regeneratorRuntime.mark((function t(){var r,n;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(o["getList"])();case 2:r=t.sent,n=r.data,console.log(n,"编辑"),e.treeData=e.treeData.concat(n);case 6:case"end":return t.stop()}}),t)})))()},handleNodeClick:function(e){this.$refs.selectblur.blur(),this.form.parent_name=e.name,this.form.parent_id=e.id},showEdit:function(e){this.treeData=[{id:"0",name:"顶级部门"}],this.fetchData(),console.log("子组件"),e?(this.title="编辑",this.form=Object.assign({},e),null==this.form.parent_name&&(this.form.parent_name="顶级部门")):this.title="添加",this.dialogFormVisible=!0},close:function(){this.$refs["form"].resetFields(),this.form=this.$options.data().form,this.dialogFormVisible=!1},save:function(){var e=this;this.$refs["form"].validate(function(){var t=Object(s["a"])(regeneratorRuntime.mark((function t(r){var n,a;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(!r){t.next=8;break}return t.next=3,Object(o["doEdit"])(e.form);case 3:n=t.sent,a=n.message,e.$baseMessage(a,"success",!1,"vab-hey-message-success"),e.$emit("fetch-data"),e.close();case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())},add:function(){var e=this;this.$refs["form"].validate(function(){var t=Object(s["a"])(regeneratorRuntime.mark((function t(r){var n,a;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(!r){t.next=8;break}return t.next=3,Object(o["doAdd"])(e.form);case 3:n=t.sent,a=n.message,e.$baseMessage(a,"success",!1,"vab-hey-message-success"),e.$emit("fetch-data"),e.close();case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}}},l=i,c=(r("ca23"),r("2877")),u=Object(c["a"])(l,n,a,!1,null,"62c1dff9",null);t["default"]=u.exports},f1f0:function(e,t,r){e.exports=r.p+"static/img/data_empty.475a2a1e.png"}}]);