| 1 |
- import{d as q,f as v,w as K,ag as z,aq as L,ar as E,k as b,aD as f,G as S,aB as B,F as R,au as P}from"./vue-vendor-Be68asQ6.js";import{u as V}from"./index-D2G57Sln.js";import{l as A,r as G,s as M,c as D,i as O}from"./auth.api-53df4c33-DOccuXMK.js";import{S as Q}from"./auth.data-626c5083-BEawXwT3.js";import{co as W}from"./index-BFfnEkVs.js";import X from"./BasicTable-CuSLkXEu.js";import"./componentMap-BUTAcOmo.js";import"./antd-vue-vendor-DcqS7Wvq.js";import"./useFormItem-CtGMPcLp.js";import"./index-CETWS1o0.js";import"./BasicModal-D4gc2R81.js";import"./useTimeout-Ca5eqGu-.js";import"./vxe-table-vendor-DHF2TRpV.js";import"./useWindowSizeFn-BTSGGcie.js";import"./index-BZ_MXCtW.js";import"./index-BIPzXG41.js";import"./index-CXEQnmRq.js";import"./useIntersectionObserver-Bl62RIZ4.js";import"./download-CjoX0_mR.js";import"./base64Conver-24EVOS6V.js";import"./index-D1703ozz.js";import"./index-Bi7PIj53.js";import"./useCountdown-B7iR27pS.js";import"./useFormItemSingle-nLM0QlcI.js";import"./JSelectUser-DCwPqRxp.js";import"./props-BPxWJPuD.js";import"./JSelectBiz-Be8KsC5j.js";import"./JAddInput-BBXQvvpq.js";import"./areaDataUtil-Cik-Rc_P.js";import"./index-BOEzG86y.js";import"./index-BNFwynfr.js";import"./bem-BvvqSl-N.js";import"./props-Cw7AfxGV.js";import"./useContextMenu-BDwmjIwb.js";import"./depart.api-CDwTvdwQ.js";import"./JSelectDept-DT6g7V5M.js";import"./JPopup-DKJW27Yk.js";import"./JEllipsis-C04xKxcI.js";import"./JUpload-cB_Qj2H2.js";import"./index-iuayQczx.js";import"./index-DJQB4_Pr.js";import"./index-D68l__AG.js";import"./BasicForm-Cv-dsB-e.js";import"./useForm-kcRIHoe0.js";import"./JAreaLinkage-BNOKwn5l.js";import"./JCodeEditor-CSivhUhT.js";import"./htmlmixed-DNSd26j0.js";import"./vue-DbzutmLn.js";/* empty css */import"./EasyCronInput-wCv2YMHn.js";import"./injectionKey-DPVn4AgL.js";var C=(l,h,p)=>new Promise((x,k)=>{var g=m=>{try{s(p.next(m))}catch(c){k(c)}},w=m=>{try{s(p.throw(m))}catch(c){k(c)}},s=m=>m.done?x(m.value):Promise.resolve(m.value).then(g,w);s((p=p.apply(l,h)).next())});const j=q({name:"AuthFieldConfig",components:{BasicTable:X},props:{headId:{type:String,default:"",required:!0}},emits:["update:authFields"],setup(l,{emit:h}){const p=v(""),[x,{reload:k,getTableRef:g,setPagination:w}]=V({api:U,rowKey:"code",bordered:!0,columns:Q,showIndexColumn:!1}),s=v(!1),m=v(!1),c=v(!1),r=v(!1),u=v(!1),y=v(!1),I=v(!1);K(()=>l.headId,o=>{p.value=o.split("?")[0],g().value&&w({current:1,pageSize:10}),k().catch(()=>null)},{immediate:!0});function U(o){return C(this,null,function*(){const e=["id"];let n=yield A(p.value,o),a=[],i=[];return n.forEach(d=>{e.indexOf(d.code)<0&&((d.isShowForm==1||d.isShowList==1)&&i.push(d),d.dbIsPersist==1&&a.push({text:d.title,value:d.code,view:d.fieldShowType,dbType:d.dbType}))}),h("update:authFields",a),T(o.pageNo,o.pageSize,i),i})}function N(o,e){return C(this,null,function*(){yield G({cgformId:p.value,code:e.code,status:o?1:0}),e.formEditable||e.formShow||e.listShow||(e.formEditable=!0,e.formShow=!0,e.listShow=!0),e.status=Math.abs(e.status-1),_()})}function $(o,e,n){return C(this,null,function*(){let a=o.target.checked;yield M({cgformId:p.value,code:e.code,switchFlag:n,listShow:a,formShow:a,formEditable:a}),n==1?e.listShow=a:n==2?e.formShow=a:n==3&&(e.formEditable=a),e.listShow===!1&&e.formShow===!1&&e.formEditable===!1&&(e.status=0),_()})}function T(o,e,n){const a=[];if(n!=null&&n.length){const i=o*e>n.length?n.length:o*e;for(let d=o*e-e;d<i;d++){const t=n[d];a.push(t)}}a.length?(s.value=!0,m.value=!0,c.value=!0,a.forEach(i=>{s.value&&i.status==0&&(s.value=!1),m.value&&i.listShow==!1&&(m.value=!1),c.value&&(i.formEditable==!1||i.formShow==!1)&&(c.value=!1)}),m.value==!0?I.value=!1:a.find(i=>i.listShow)?I.value=!0:I.value=!1,c.value==!0?y.value=!1:a.find(i=>i.formEditable||i.formShow)?y.value=!0:y.value=!1):(s.value=!1,m.value=!1,c.value=!1)}const _=()=>{const{current:o,pageSize:e}=g().value.getPaginationRef(),n=g().value.getDataSource();T(o,e,n)},F=(o,e)=>{const n=[],a=g().value.getDataSource();if(a!=null&&a.length){const i=o*e>a.length?a.length:o*e;for(let d=o*e-e;d<i;d++){const t=a[d];n.push(t)}}return n};return{registerTable:x,onUpdateStatus:N,onCheckboxChange:$,handleChangeSwitch:o=>C(this,null,function*(){u.value=!0,s.value=o;const{current:e,pageSize:n}=g().value.getPaginationRef(),a=F(e,n);let i=a.map(t=>({cgformId:t.cgformId,code:t.code,status:o?1:0}));r.value=!0,yield O(i),a.forEach(t=>{o?t.status=1:t.status=0,t.formEditable||t.formShow||t.listShow||(t.formEditable=!0,t.formShow=!0,t.listShow=!0)}),r.value=!1,u.value=!1;const d=g().value.getDataSource();T(e,n,d)}),allSwitch:s,allFormControl:c,allListControl:m,allSloading:r,handleTableChange:o=>{},handleChangeList:o=>C(this,null,function*(){u.value=!0;const e=o.target.checked;m.value=e;const{current:n,pageSize:a}=g().value.getPaginationRef(),i=F(n,a);let d=i.map(t=>({cgformId:t.cgformId,code:t.code,switchFlag:1,listShow:!!e}));yield D(d),i.forEach(t=>{t.listShow=!!e,t.listShow===!1&&t.formShow===!1&&t.formEditable===!1&&(t.status=0,s.value=!1)}),e&&(I.value=!1),u.value=!1}),handleChangeForm:o=>C(this,null,function*(){u.value=!0;const e=o.target.checked;c.value=e;const{current:n,pageSize:a}=g().value.getPaginationRef(),i=F(n,a),d=[...i.map(t=>({cgformId:t.cgformId,code:t.code,switchFlag:4,formShow:!!e,formEditable:!!e}))];yield D(d),i.forEach(t=>{t.formEditable=!!e,t.formShow=!!e,t.listShow===!1&&t.formShow===!1&&t.formEditable===!1&&(t.status=0,s.value=!1)}),e&&(y.value=!1),u.value=!1}),tableLoading:u,formIndeterminate:y,listIndeterminate:I}}}),H={class:"auth-field-config"};function J(l,h,p,x,k,g){const w=z("a-switch"),s=z("a-checkbox"),m=z("BasicTable");return E(),L("div",H,[b(m,{onRegister:l.registerTable,onChange:l.handleTableChange,loading:l.tableLoading},{headerCell:f(({column:c})=>[c.dataIndex==="switch"?(E(),L(R,{key:0},[b(w,{loading:l.allSloading,checked:l.allSwitch,"onUpdate:checked":h[0]||(h[0]=r=>l.allSwitch=r),size:"small",onChange:l.handleChangeSwitch},null,8,["loading","checked","onChange"]),h[3]||(h[3]=S("启用 "))],64)):c.dataIndex==="list"?(E(),B(s,{key:1,indeterminate:l.listIndeterminate,checked:l.allListControl,"onUpdate:checked":h[1]||(h[1]=r=>l.allListControl=r),disabled:!l.allSwitch,onChange:l.handleChangeList},{default:f(()=>[S(P(c.customTitle),1)]),_:2},1032,["indeterminate","checked","disabled","onChange"])):c.dataIndex==="form"?(E(),B(s,{key:2,indeterminate:l.formIndeterminate,checked:l.allFormControl,"onUpdate:checked":h[2]||(h[2]=r=>l.allFormControl=r),disabled:!l.allSwitch,onChange:l.handleChangeForm},{default:f(()=>[S(P(c.customTitle),1)]),_:2},1032,["indeterminate","checked","disabled","onChange"])):(E(),L(R,{key:3},[S(P(c.customTitle),1)],64))]),switch:f(({text:c,record:r})=>[b(w,{size:"small",checked:r.status===1,onChange:u=>l.onUpdateStatus(u,r)},null,8,["checked","onChange"])]),list:f(({text:c,record:r})=>[b(s,{checked:r.listShow,disabled:r.status===0,onChange:u=>l.onCheckboxChange(u,r,1)},{default:f(()=>h[4]||(h[4]=[S(" 可见 ")])),_:2},1032,["checked","disabled","onChange"])]),form:f(({text:c,record:r})=>[b(s,{checked:r.formShow,disabled:r.status===0,onChange:u=>l.onCheckboxChange(u,r,2)},{default:f(()=>h[5]||(h[5]=[S(" 可见 ")])),_:2},1032,["checked","disabled","onChange"]),b(s,{checked:r.formEditable,disabled:r.status===0,onChange:u=>l.onCheckboxChange(u,r,3)},{default:f(()=>h[6]||(h[6]=[S(" 可编辑 ")])),_:2},1032,["checked","disabled","onChange"])]),_:1},8,["onRegister","onChange","loading"])])}const je=W(j,[["render",J],["__scopeId","data-v-c48da65c"]]);export{je as default};
|