You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
3.2 KiB

var f=(_,g,o)=>new Promise((v,d)=>{var i=l=>{try{c(o.next(l))}catch(s){d(s)}},r=l=>{try{c(o.throw(l))}catch(s){d(s)}},c=l=>l.done?v(l.value):Promise.resolve(l.value).then(i,r);c((o=o.apply(_,g)).next())});import{d as M,q as T,r as u,o as b,g as j,j as R,b as K,w as B,h as D,u as y,B as A,a as W,i as H,F as V,a1 as C,Y as E,$ as L}from"./index-f4658ae7.js";import{_ as U}from"./BasicTree.vue_vue_type_script_lang-af5742c8.js";import"./index-21ca82de.js";import"./tree-27cb054b.js";const I=M({__name:"PreplaceWoker",props:{params:{type:Object,default:()=>{}},isMultiSelect:{type:Boolean,default:!0}},emits:["AddEmps"],setup(_,{emit:g}){const o=_,v=T({hasError:!1,tips:""}),d=u(!1);o.isMultiSelect;const i=u([]),r=u(""),c=u(""),l=u(null),s=u([]),h=u([]),S=u([]),w=()=>f(this,null,function*(){try{d.value=!0,r.value=C.DeptNo||"0",c.value=r.value,yield k(r.value)}catch(e){v.hasError=!0,v.tips=e}finally{d.value=!1}}),F=()=>f(this,null,function*(){if(r.value=="0"){E.warning("\u5DF2\u5230\u7B2C\u4E00\u673A\u6784\u4E86");return}if(C.CCBPMRunModel!=0&&r.value==="100"){E.warning("\u5DF2\u5230\u7B2C\u4E00\u7EA7\u673A\u6784");return}c.value=r.value,yield k(r.value)});function k(e){return f(this,null,function*(){const t=new L("BP.WF.HttpHandler.WF_WorkOpt");t.AddPara("FK_Dept",e),t.AddPara("FK_Node",o.params.FK_Node);const n=yield t.DoMethodReturnString("SelectEmps_Init");if(typeof n=="string"&&n.includes("err@")){E.error(n.replace("err@",""));return}const m=JSON.parse(JSON.stringify(n));m.Emps.forEach(a=>{a.No=a.No.replace("Emp_","")});const p=u([]);return m.Depts.forEach(a=>{a.ParentNo==e&&p.value.push({title:a.Name||"",key:a.No||"",isLeaf:!1,disabled:!1,children:[]})}),m.Emps.forEach(a=>{e==a.FK_Dept&&p.value.push({title:a.Name||"",key:a.No||"",isLeaf:!0,children:[]})}),m.Depts.forEach(a=>{e===c.value&&e===a.No&&(i.value=[],i.value.push({title:a.Name||"",key:a.No||"",disabled:!1,children:p.value}),r.value=a.ParentNo)}),S.value.push({deptNo:e,children:p.value||[]}),p.value})}w();const P=e=>f(this,null,function*(){if(e.children.length!=0)return;const t=y(l);if(t){const n=yield k(e.eventKey);t.updateNodeByKey(e.eventKey,{children:n}),t.setExpandedKeys([e.eventKey,...t.getExpandedKeys()])}}),N=g,x=()=>{if(s.value.length==0&&h.value.length==0){E.warning("\u8BF7\u9009\u62E9\u63A5\u6536\u4EBA");return}N("AddEmps",s.value.length>0?s.value:h.value)},O=()=>{N("AddEmps",[])};return(e,t)=>(b(),j(V,null,[R("div",null,[K(y(A),{type:"primary",style:{"margin-right":"1em"},onClick:F},{default:B(()=>[D("\u4E0A\u4E00\u7EA7")]),_:1}),K(y(A),{type:"primary",style:{"margin-right":"1em"},onClick:x},{default:B(()=>[D("\u786E\u5B9A")]),_:1}),K(y(A),{type:"primary",onClick:O},{default:B(()=>[D("\u53D6\u6D88")]),_:1})]),i.value.length?(b(),W(y(U),{key:0,selectedKeys:s.value,"onUpdate:selectedKeys":t[0]||(t[0]=n=>s.value=n),checkedKeys:h.value,"onUpdate:checkedKeys":t[1]||(t[1]=n=>h.value=n),checkable:!!o.isMultiSelect,clickRowToExpand:!0,defaultExpandAll:!0,autoExpandParent:!0,ref_key:"asyncTreeRef",ref:l,treeData:i.value,"load-data":P,onSelect:e.handlerSelect},null,8,["selectedKeys","checkedKeys","checkable","treeData","onSelect"])):H("",!0)],64))}}),G=Object.freeze(Object.defineProperty({__proto__:null,default:I},Symbol.toStringTag,{value:"Module"}));export{G as _};