LJWWDMSelect-legacy-e4e781f9.js 6.8 KB

1
  1. !function(){function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}System.register(["./vendor-legacy-8856a2a6.js","./LJWWData-legacy-70848b40.js","./index-legacy-240e7575.js","./LJWWDMSelect.vue_vue_type_style_index_0_lang-legacy-2f5e0dc8.js"],(function(t,n){"use strict";var l,a,o,i,r,u,c,d;return{setters:[function(e){l=e.r,a=e.h,o=e.w,i=e.n,r=e.o},function(e){u=e.L},function(e){c=e.n,d=e.$},function(){}],execute:function(){var n={__name:"LJWWDMSelect",props:{visible:{type:Boolean,default:!1},value:{type:Array,default:function(){return[]}},valueType:{type:String,default:"string"},treeProps:{type:Object,default:function(){return{children:"children",label:"name",value:"mark"}}},defaultCheckedKeys:{type:Array,default:function(){return[]}},placeholder:{type:String,default:"请选择"},height:{type:String,default:"36px"},dialog:{type:Boolean,default:!1},dialogWidth:{type:String,default:"600px"},dialogHeight:{type:String,default:"500px"}},emits:["input","dept","member"],setup:function(t,n){var c=n.expose,s=n.emit,p=t,f=l([]),v=l(""),h=l(!1),m=l(),y=l([]),g=l([]),w=l(!1),k=l(!1),C=l({true:"el-icon-arrow-up",false:"el-icon-arrow-down"}),_=l(!1);function j(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!e||e.indexOf("-")<0?e:e.split("-")[1]}var x=a((function(){return f.value.filter((function(e){return 1===e.type})).map((function(e){return j(e.mark)}))})),D=a((function(){return f.value.filter((function(e){return 2===e.type})).map((function(e){return j(e.mark)}))}));o((function(){return f.value}),(function(){var e,t;h.value=f.value.length===g.value.length,"string"===p.valueType?(e=x.value.join(","),t=D.value.join(",")):"array"===p.valueType&&(e=x.value,t=D.value),i((function(){s("input",f.value),s("dept",e),s("member",t)}))})),o((function(){return v.value}),(function(e){m.value.filter(e)})),o((function(){return p.defaultCheckedKeys}),(function(){i((function(){T()}))}),{deep:!0}),o((function(){return p.visible}),(function(e){e&&I()}));function b(t){var n=t.data;n&&"object"===e(n)&&!Array.isArray(n)&&t.checked&&(console.log("modelInputValue.value:",f.value),m.value.setChecked(n.mark,!1,!1)),t.parent?b(t.parent):i((function(){_.value=!1,S()}))}function W(e){var t=m.value.getNode(e.mark);t&&t.parent&&b(t.parent)}function S(){i((function(){var e=m.value.getCheckedNodes();f.value=e.map((function(e){return{mark:e.mark,name:e.name,type:e.type}}))}))}var T=function(e,t){if(!_.value){if(!t&&e&&2===e.type)return _.value=!0,void W(e);e&&1===e.type&&e.children&&e.children.length&&e.children.filter((function(e){return 2===e.type})).map((function(e){m.value.setChecked(e.mark,t,!1)})),S()}};function I(){f.value=[],m.value.setCheckedKeys([])}function L(){d.getters.company?HTTP.post("get_company_dept",{company_id:d.getters.company}).then((function(e){if(0!==e.code)return y.value=[];y.value=e.data;!function e(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=0;n<t.length;n++)g.value.push(t[n].mark),t[n].children&&e(t[n].children)}(y.value),i((function(){p.defaultCheckedKeys.length&&T()}))})).catch((function(e){console.log("error:",e)})):console.log("LJWWDMSelect getCompanyDept not company")}function P(){k.value=!0,console.log("打开dialog")}return c({show:P}),r((function(){L()})),{__sfc:!0,emits:s,props:p,modelInputValue:f,filterText:v,allChecked:h,downTreeRef:m,treeData:y,treeDataKeys:g,isDown:w,isDialogShow:k,lJWWDMIcons:C,cancel_personnel_ing:_,formatId:j,deptIds:x,memberIds:D,filterNode:function(e,t){return!e||-1!==t.name.indexOf(e)},getWWDataNodeKeyType:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.indexOf("user")>-1?2:e.indexOf("dept")>-1?1:""},handleClick:function(){if(k.value)return k.value=!1;w.value=!w.value},handleDeleteModelValue:function(e,t){f.value.splice(t,1),m.value.setChecked(e.mark,!1,!1)},removeDeptParent:b,getUpperLevelDeptParent:W,updateModelInputValue:S,handleCheckChange:T,handleAllChecked:function(e){e?(m.value.setCheckedKeys(g.value),i((function(){T()}))):I()},handleAllClear:I,getCompanyDept:L,show:P,LJWWData:u}}},s=function(){var e=this,t=e._self._c,n=e._self._setupProxy;return t("div",{staticClass:"lj-ww-d-m-tree",class:{"lj-ww-d-m-tree-down":n.isDown,"lj-ww-d-m-tree-dialog":e.dialog,"lj-ww-d-m-tree-dialog-is-dialog-show":n.isDialogShow},style:{"--lj-ww-d-m-content-height":e.height,"--lj-ww-d-m-dialog-width":e.dialogWidth,"--lj-ww-d-m-dialog-height":e.dialogHeight},on:{click:function(e){return e.stopPropagation(),n.handleClick.apply(null,arguments)}}},[t("div",{staticClass:"lj-ww-d-m-content"},[n.modelInputValue.length?t("div",{staticClass:"lj-ww-d-m-input"},e._l(n.modelInputValue,(function(e,l){return t("div",{key:l,staticClass:"lj-d-m-item"},[t("div",{staticClass:"lj-d-m-label"},[t(n.LJWWData,{attrs:{type:n.getWWDataNodeKeyType(e.mark),openid:e.name}})],1),t("i",{staticClass:"lj-d-m-delete-icon el-icon-close",on:{click:function(t){return t.stopPropagation(),n.handleDeleteModelValue(e,l)}}})])})),0):e._e(),n.modelInputValue.length?e._e():t("div",{staticClass:"lj-ww-d-m-input-placeholder"},[e._v(" "+e._s(e.placeholder)+" ")]),t("div",{staticClass:"lj-ww-d-m-icon"},[t("i",{class:n.lJWWDMIcons[n.isDown]})])]),t("div",{staticClass:"lj-ww-d-m-down-main",on:{click:function(e){return e.stopPropagation(),function(){}.apply(null,arguments)}}},[t("div",{staticClass:"lj-ww-d-m-down-title"},[e._v("部门/员工")]),t("div",{staticClass:"lj-ww-d-m-down-filter"},[t("el-input",{attrs:{placeholder:"请输入内容"},model:{value:n.filterText,callback:function(e){n.filterText=e},expression:"filterText"}})],1),t("div",{staticClass:"lj-ww-d-m-down-tree"},[t("el-checkbox",{on:{change:n.handleAllChecked},model:{value:n.allChecked,callback:function(e){n.allChecked=e},expression:"allChecked"}},[e._v(" 全部 ")]),t("el-tree",{ref:"downTreeRef",attrs:{"show-checkbox":"","check-strictly":"","node-key":"mark",data:n.treeData,"default-checked-keys":e.defaultCheckedKeys,props:e.treeProps,"filter-node-method":n.filterNode},on:{"check-change":n.handleCheckChange},scopedSlots:e._u([{key:"default",fn:function(l){var a=l.data;return t("div",{staticClass:"lj-ww-d-m-custom-tree-node"},[t(n.LJWWData,{attrs:{type:a.type,openid:a.name}}),t("div",{staticClass:"next-level-btn",class:{show:1===a.type&&a.children.length}},[t("i",{staticClass:"iconfont icon-xiaji"}),t("span",{staticClass:"next-level-label"},[e._v("下级")])])],1)}}])})],1),t("div",{staticClass:"lj-ww-d-m-down-footer"},[t("div",{staticClass:"statistics"},[e._v(" 已选择 "),t("span",{staticClass:"statistics-value"},[e._v(e._s(n.modelInputValue.length))]),e._v(" 项 ")]),t("el-button",{attrs:{type:"text"},on:{click:function(e){return e.stopPropagation(),n.handleAllClear.apply(null,arguments)}}},[e._v("清空")])],1)])])};t("L",c(n,s,[],!1,null,null,null,null).exports)}}}))}();