(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-c2bbdc3e"],{4774:function(e,t,n){"use strict";n("4abe")},"4abe":function(e,t,n){},"6b01":function(e,t,n){"use strict";n("b0c0");var s=function(){var e=this,t=e._self._c;return t("div",[t("a-input",{attrs:{"select-model":"single",readOnly:""},on:{click:e.showSelectDept},model:{value:e.showValue,callback:function(t){e.showValue=t},expression:"showValue"}},[t("a-icon",{attrs:{slot:"suffix",type:"apartment"},slot:"suffix"})],1),t("ant-modal",{attrs:{visible:e.open,"modal-title":e.title,"adjust-size":!1,modalHeight:"480",modalWidth:"800",dialogClass:"deptSelect"},on:{cancel:e.cancel}},[e._v(" > "),t("a-row",{attrs:{slot:"content"},slot:"content"},[t("a-spin",{attrs:{spinning:e.spinning,delay:e.delayTime,tip:"Loading..."}},[t("a-col",{staticClass:"treeBox treeborder",attrs:{span:12}},[t("a-input-search",{attrs:{placeholder:"请输入部门信息"},on:{search:e.filterNode}}),t("div",{staticClass:"deptSelectTree"},["multi"==e.selectModel?t("a-tree",{attrs:{checkable:"",replaceFields:e.replaceFields,"default-expanded-keys":e.expandedKeys,"selected-keys":e.selectedKeys,"expanded-keys":e.expandedKeys,"auto-expand-parent":e.autoExpandParent,"tree-data":e.deptOptions,"load-data":e.onLoadData,checkStrictly:e.checkStrictly,showIcon:""},on:{expand:e.onExpand,check:e.checkNode},scopedSlots:e._u([{key:"title",fn:function(n){var s=n.title,a=n.attributes;return[s.indexOf(e.searchValue)>-1?t("span",[e._v(" "+e._s(s.substr(0,s.indexOf(e.searchValue)))+" "),t("span",{staticStyle:{color:"#f50"}},[e._v(e._s(e.searchValue))]),e._v(" "+e._s(s.substr(s.indexOf(e.searchValue)+e.searchValue.length))+" ")]):a.deptPinyin.indexOf(e.searchValue)>-1?t("span",[t("span",{staticStyle:{color:"#f50"}},[e._v(e._s(s))])]):t("span",[e._v(e._s(s))])]}}],null,!1,4008372618),model:{value:e.checkedKeys,callback:function(t){e.checkedKeys=t},expression:"checkedKeys"}},[t("a-icon",{staticClass:"depIcon",attrs:{slot:"org",component:e.allIcon.companyFillIcon},slot:"org"}),t("a-icon",{staticClass:"depIcon",attrs:{slot:"company",component:e.allIcon.companyIcon},slot:"company"}),t("a-icon",{staticClass:"depIcon",attrs:{slot:"dept",component:e.allIcon.connectionsIcon},slot:"dept"})],1):e._e(),"single"==e.selectModel?t("a-tree",{attrs:{replaceFields:e.replaceFields,"default-expanded-keys":e.expandedKeys,"selected-keys":e.selectedKeys,"expanded-keys":e.expandedKeys,"auto-expand-parent":e.autoExpandParent,"tree-data":e.deptOptions,"load-data":e.onLoadData,showIcon:""},on:{expand:e.onExpand,select:e.selectNode},scopedSlots:e._u([{key:"title",fn:function(n){var s=n.title,a=n.attributes;return[s.indexOf(e.searchValue)>-1?t("span",[e._v(" "+e._s(s.substr(0,s.indexOf(e.searchValue)))+" "),t("span",{staticStyle:{color:"#f50"}},[e._v(e._s(e.searchValue))]),e._v(" "+e._s(s.substr(s.indexOf(e.searchValue)+e.searchValue.length))+" ")]):a.deptPinyin.indexOf(e.searchValue)>-1?t("span",[t("span",{staticStyle:{color:"#f50"}},[e._v(e._s(s))])]):t("span",[e._v(e._s(s))])]}}],null,!1,322713610)},[t("a-icon",{staticClass:"depIcon",attrs:{slot:"org",component:e.allIcon.companyFillIcon},slot:"org"}),t("a-icon",{staticClass:"depIcon",attrs:{slot:"company",component:e.allIcon.companyIcon},slot:"company"}),t("a-icon",{staticClass:"depIcon",attrs:{slot:"dept",component:e.allIcon.connectionsIcon},slot:"dept"})],1):e._e()],1)],1),t("a-col",{attrs:{span:12}},[t("div",{staticClass:"contentBox"},[t("div",{style:{padding:"10px 20px"}},[t("a-checkbox",{attrs:{indeterminate:e.indeterminate,checked:e.checkAll},on:{change:e.onCheckAllChange}},[e._v("已选（"+e._s(e.selectCount)+"）")]),t("a-icon",{style:{float:"right"},attrs:{type:"delete"},on:{click:e.deleteSelectDept}})],1),t("a-checkbox-group",{on:{change:e.onChange},model:{value:e.deptCheckedList,callback:function(t){e.deptCheckedList=t},expression:"deptCheckedList"}},[t("a-list",{ref:"editTable",attrs:{"item-layout":"horizontal","data-source":e.deptdata},scopedSlots:e._u([{key:"renderItem",fn:function(n){return t("a-list-item",{},[t("a-checkbox",{attrs:{value:n.id},on:{change:e.checkBoxOnChange}}),t("a-list-item-meta",[t("template",{slot:"title"},[t("span",[e._v(e._s(n.name))])]),t("a-avatar",{attrs:{slot:"avatar",icon:n.icon},slot:"avatar"})],2),t("template",{slot:"actions"},["multi"==e.selectModel?t("a-icon",{staticClass:"dragIconClass",attrs:{type:"drag"}}):e._e(),t("a-icon",{attrs:{type:"close-circle"},on:{click:function(t){return e.deletSelectDeptByParentIds(n.id,n.parentIds)}}})],1)],2)}}])})],1)],1)])],1)],1),t("template",{slot:"footer"},[t("a-button",{on:{click:e.cancel}},[e._v(" 取消 ")]),t("a-button",{attrs:{type:"primary"},on:{click:e.saveSelectDept}},[e._v(" 保存 ")])],1)],2)],1)},a=[],c=(n("4de4"),n("a434"),n("4ec9"),n("d3b7"),n("3ca3"),n("498a"),n("159b"),n("ddb0"),n("04b3")),i=n("2dd7"),d=n("fcb7"),o=n("aa47"),l={props:{title:{type:String,default:"部门选择"},selectModel:{type:String,required:!1,default:"single"},selectScope:{type:String,required:!1,default:"dept"},value:{required:!1}},data:function(){return{showValue:"",oldValue:"",indeterminate:!1,delayTime:200,spinning:!1,open:!1,replaceFields:{children:"children",key:"id",title:"title"},expandedKeys:[],autoExpandParent:!0,selectedKeys:[],deptOptions:[],checkedKeys:[],checkAll:!1,deptCheckedList:[],selectCount:0,deptdata:[],checkStrictly:!0,oldDeptOptions:[],oldExpandedKeys:[],searchValue:"",deptNodes:[],checkedDept:[],allIcon:c["a"],sortable:void 0,select:{ids:"",names:""}}},created:function(){this.getTreeselect()},watch:{select:{immediate:!0,handler:function(e){this.oldValue=this.select&&this.select.names?this.select.names:"",this.showValue=this.oldValue}},value:{immediate:!0,handler:function(e){this.select=e||{ids:"",names:""}}},checkedDept:{immediate:!0,handler:function(e){this.deptCheckedList=e}},deptdata:{immediate:!0,deep:!0,handler:function(e){this.selectCount=e.length,this.onChange(),"multi"===this.selectModel&&e.length>0&&void 0===this.sortable&&this.rowDrop()}}},components:{AntModal:i["a"],allIcon:c["a"]},methods:{checkBoxOnChange:function(e){e.target.checked?this.checkedDept.push(e.target.value):this.checkedDept=this.checkedDept.filter((function(t){return t!==e.target.value}))},filterNode:function(e,t){var n=this;if(0===this.oldDeptOptions.length&&(this.oldDeptOptions=this.deptOptions,this.oldExpandedKeys=this.expandedKeys),""===e.trim())this.deptOptions=this.oldDeptOptions,Object.assign(this,{expandedKeys:this.oldExpandedKeys,searchValue:e,autoExpandParent:!0});else{var s={deptName:e};Object(d["k"])(s).then((function(t){n.deptOptions=t.data,n.getExpandedAllKeys(t.data),Object.assign(n,{expandedKeys:n.deptNodes,searchValue:e,autoExpandParent:!0}),n.deptNodes=[]}))}},callback:function(e){},getExpandedAllKeys:function(e){var t=this;if(!e||0===e.length)return[];e.forEach((function(e){return t.deptNodes.push(e.id),t.getExpandedAllKeys(e.children)}))},showSelectDept:function(){this.getSelectDeptInfo(),this.open=!0,this.resetSelectDeptInfo()},resetSelectDeptInfo:function(){this.checkedKeys=[],this.deptdata=[]},getSelectDeptInfo:function(){var e=this;if(void 0!==this.select.ids&&"undefined"!==this.select.ids&&""!==this.select.ids){var t={deptIds:this.select.ids};Object(d["f"])(t).then((function(t){e.deptdata=t.data,e.selectedKeys=[],e.checkedKeys=[],e.deptdata.forEach((function(t){e.selectedKeys.push(t.id),e.checkedKeys.push(t.id)}))}))}},cancel:function(e){this.open=!1},onChange:function(e){this.indeterminate=!!this.checkedDept.length&&this.checkedDept.length<this.deptdata.length,this.checkAll=!!this.deptdata.length&&this.checkedDept.length===this.deptdata.length},getTreeselect:function(){var e=this;Object(d["i"])("0",3).then((function(t){e.deptOptions=t.data,e.getExpandedKeys(e.deptOptions,3),Object.assign(e,{expandedKeys:e.expandedKeys,searchValue:"",autoExpandParent:!0})}))},getExpandedKeys:function(e,t){var n=this;t>1&&e.forEach((function(e){return n.expandedKeys.push(e.id),t-=1,n.getExpandedKeys(e.children,t)}))},onLoadData:function(e){var t=this,n=this;return new Promise((function(s){e.dataRef.children?s():(t.spinning=!t.spinning,Object(d["i"])(e.dataRef.id,1).then((function(t){e.dataRef.children=t.data,n.expandSonData=t.data,n.spinning=!n.spinning,s()})))}))},onExpand:function(e){this.expandedKeys=e,this.autoExpandParent=!1},checkNode:function(e,t){var n=this;if(t.checked&&!t.node.isLeaf){var s=t.node.dataRef.children;this.setSelectDeptInfoByNodes([t.node.$options.propsData.dataRef]),null===s?Promise.all([this.onLoadData(t.node)]).then((function(e){var s=t.node.$options.propsData.dataRef.id;n.expandedKeys.push(s),n.expandSonData.length>0&&(n.setSelectDeptInfoByNodes(n.expandSonData),n.expandSonData=[])})):this.setSelectDeptInfoByNodes(s)}else t.checked&&t.node.isLeaf?this.setSelectDeptInfoByNodes([t.node.$options.propsData.dataRef]):this.removeSelectDeptByDeptTree(t.node,"node")},removeSelectDeptByDeptTree:function(e,t){var n=this,s="",a=null;"node"===t?(s=e.dataRef.id,a=e.dataRef.children):(s=e.id,a=e.children),this.selectedKeys=this.selectedKeys.filter((function(e){return e!==s})),this.checkedKeys.checked=this.checkedKeys.checked.filter((function(e){return e!==s})),this.deptdata=this.deptdata.filter((function(e){return e.id!==s})),this.checkedDept=this.checkedDept.filter((function(e){return e!==s})),null!==a&&a.forEach((function(e){n.removeSelectDeptByDeptTree(e,"children")}))},setSelectDeptInfo:function(e){var t=this;e.forEach((function(e){var n=e.componentOptions.propsData.dataRef.title,s=e.componentOptions.propsData.dataRef.id,a=e.componentOptions.propsData.dataRef.parentIds,c=e.componentOptions.propsData.dataRef.attributes.deptType;t.setSelectedDeptInfo(s,n,a,c)}))},setSelectDeptInfoByNodes:function(e){var t=this;e.forEach((function(e){var n=e.title,s=e.id,a=e.parentIds,c=e.attributes.deptType;t.setSelectedDeptInfo(s,n,a,c)}))},getAllSubChildren:function(e,t){var n=this;return e.forEach((function(e){t.push(e.id),null!=e.children&&n.getAllSubChildren(e.children,t)})),!1},selectNode:function(e,t){var n=t.node.dataRef,s=n.attributes.deptType;if("dept"!==s&&"dept"===this.selectScope)this.$message.warning("请选择部门添加");else if("dept"===s&&"nonDept"===this.selectScope)this.$message.warning("请选择机构或公司添加");else{this.selectedKeys=[],this.deptdata=[],this.checkAll=!1,this.deptCheckedList=[];var a=n.id,c=n.title,i=n.parentIds;this.setSelectedDeptInfo(a,c,i,s)}},setSelectedDeptInfo:function(e,t,n,s){this.selectedKeys.push(e),this.checkedKeys.checked?this.checkedKeys.checked.push(e):this.checkedKeys.push(e);var a={id:e,name:t,type:s,parentIds:n,icon:"apartment"};this.deptdata.push(a),this.deptdata=this.unique(this.deptdata)},unique:function(e){var t=new Map;return e.filter((function(e){return!t.has(e.id)&&t.set(e.id,1)}))},onCheckAllChange:function(e){Object.assign(this,{deptCheckedList:e.target.checked?this.selectedKeys:[],checkedDept:e.target.checked?this.selectedKeys:[],indeterminate:!1,checkAll:e.target.checked})},deleteSelectDept:function(){var e=this,t=this;this.checkAll?(this.checkedKeys=[],this.deptdata=[],this.checkedDept=[],this.selectedKeys=[],this.checkAll=!1):(void 0!==this.checkedKeys.checked?this.checkedKeys.checked=this.checkedKeys.checked.filter((function(e){return t.deptCheckedList.indexOf(e)<0})):this.checkedKeys=this.checkedKeys.filter((function(e){return t.deptCheckedList.indexOf(e)<0})),this.selectedKeys=this.selectedKeys.filter((function(e){return t.deptCheckedList.indexOf(e)<0})),this.deptCheckedList.forEach((function(t){e.deptdata.some((function(n,s){n.id===t&&e.deptdata.splice(s,1)}))}))),this.deptCheckedList=[],this.checkedDept=[],this.checkAll=!1},deletSelectDeptByParentIds:function(e,t){var n=this;void 0!==this.checkedKeys.checked?this.checkedKeys.checked=this.checkedKeys.checked.filter((function(t){return e!==t})):this.checkedKeys=this.checkedKeys.filter((function(t){return e!==t})),this.deptCheckedList=this.deptCheckedList.filter((function(t){return e!==t})),this.checkedDept=this.checkedDept.filter((function(t){return e!==t})),this.selectedKeys=this.selectedKeys.filter((function(t){return e!==t})),this.deptdata.some((function(t,s){t.id===e&&n.deptdata.splice(s,1)}))},saveSelectDept:function(){var e=this,t="",n="",s="";this.deptdata.forEach((function(e,a){t=t+";"+e.id,n=n+";"+e.name,s=s+";"+e.type})),t.length>0&&(t=t.substr(1,t.length),n=n.substr(1,n.length),s=s.substr(1,s.length)),this.showValue=n;var a={ids:t,names:n,types:s};this.$emit("change",a),this.$nextTick((function(){e.select=a,e.$emit("input",a),e.$emit("callBack",a)})),this.open=!1},rowDrop:function(){var e=this;this.$nextTick((function(){var t=e.$refs.editTable;e.sortable=o["a"].create(t.$el.querySelector(".ant-list-items"),{handle:".ant-list-item",animation:300,delay:100,chosenClass:"drag-list-color",dragClass:"drag-list-color",onEnd:function(t){var n=t.newIndex,s=t.oldIndex,a=e.deptdata.splice(s,1)[0];e.deptdata.splice(n,0,a),e.$emit("rowDrop",e.deptdata)},onUpdate:function(e){var n=e.newIndex,s=e.oldIndex,a=t.$el.querySelector(".ant-list-items"),c=a.children[n],i=a.children[s];a.removeChild(c),n>s?a.insertBefore(c,i):a.insertBefore(c,i.nextSibling)}})}))}}},r=l,h=(n("4774"),n("2877")),p=Object(h["a"])(r,s,a,!1,null,null,null);t["a"]=p.exports},fcb7:function(e,t,n){"use strict";n.d(t,"g",(function(){return a})),n.d(t,"h",(function(){return c})),n.d(t,"i",(function(){return i})),n.d(t,"e",(function(){return d})),n.d(t,"j",(function(){return o})),n.d(t,"a",(function(){return l})),n.d(t,"o",(function(){return r})),n.d(t,"b",(function(){return h})),n.d(t,"d",(function(){return p})),n.d(t,"k",(function(){return u})),n.d(t,"l",(function(){return f})),n.d(t,"p",(function(){return y})),n.d(t,"m",(function(){return m})),n.d(t,"f",(function(){return k})),n.d(t,"n",(function(){return g})),n.d(t,"c",(function(){return b}));n("d3b7");var s=n("b775");function a(e,t,n){return null!=t&&""!==t||(t="0"),null!=n&&""!==n||(n="1"),Object(s["b"])({url:"/system/dept/list/"+n+"/"+t,method:"get",params:e})}function c(e){return Object(s["b"])({url:"/system/dept/listTreeExcludeChild/10/0/"+e,method:"get"})}function i(e,t){return null!=e&&""!==e||(e="0"),null!=t&&""!==t||(t="1"),Object(s["b"])({url:"/system/dept/listTree/"+t+"/"+e,method:"get"})}function d(e){return Object(s["b"])({url:"/system/dept/"+e,method:"get"})}function o(e){return Object(s["b"])({url:"/system/dept/roleDeptTreeselect/"+e,method:"get"})}function l(e){return Object(s["b"])({url:"/system/dept",method:"post",data:e})}function r(e){return Object(s["b"])({url:"/system/dept/edit",method:"post",data:e})}function h(e){return Object(s["b"])({url:"/system/dept/"+e,method:"post"})}function p(e){return Object(s["b"])({url:"/system/dept/findMaxSort/"+e,method:"get"})}function u(e){return Object(s["b"])({url:"/system/dept/search",method:"get",params:e})}function f(e){return Object(s["b"])({url:"/system/dept/searchDeptList",method:"get",params:e})}function y(e,t){return null!=e&&""!==e||(e="0"),null!=t&&""!==t||(t="1"),Object(s["b"])({url:"/system/dept/userSelectList/"+t+"/"+e,method:"get"})}function m(e){return Object(s["b"])({url:"/system/dept/searchDeptUserList",method:"get",params:e})}function k(e){return Object(s["b"])({url:"/system/dept/getDeptInfoByIds",method:"post",data:e})}function g(){return new Promise((function(e,t){e({code:200,msg:"",data:[]})}))}function b(e){return Object(s["b"])({url:"/system/dept/export",method:"get",params:e})}}}]);