ss-component-new 1.1.719 → 1.1.721
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{array-CV47iU9i.js → array-BcN1bdmj.js} +1 -1
- package/dist/{array-C_A3GqHl.cjs → array-CgJ6luvr.cjs} +1 -1
- package/dist/icons/svg/colFilter.svg +1 -0
- package/dist/{index-Bdy9rjka.js → index-50HGqFLU.js} +3 -3
- package/dist/{index-DmPffoKv.cjs → index-B9SUJ4Zu.cjs} +1 -1
- package/dist/index-BAdqe1Qk.cjs +1 -0
- package/dist/{index-CpnXGkvz.js → index-BHBGoWFE.js} +4 -4
- package/dist/{index-BCZ59Y4K.js → index-BHZ56TUj.js} +1 -0
- package/dist/{index-2p69g4HY.cjs → index-BKUqLOwQ.cjs} +5 -5
- package/dist/{index-Ca4sbgf-.cjs → index-BV3gIolN.cjs} +1 -1
- package/dist/{index-D8qVbjll.js → index-BYl3ZfMW.js} +2 -2
- package/dist/{index-ChQSWsp7.js → index-B_GAWj5p.js} +3 -3
- package/dist/{index-BU8nVgIT.js → index-B_h8SY5M.js} +1 -1
- package/dist/{index-juDP8c2k.js → index-BaJiGLkX.js} +1 -1
- package/dist/{index-HqICPCny.cjs → index-BaOJ2FlA.cjs} +1 -1
- package/dist/{index-BOZohpjd.cjs → index-Be3sB22h.cjs} +1 -1
- package/dist/{index-h0An6eiK.js → index-Bidjqofb.js} +2915 -2859
- package/dist/{index-BF1d01SM.js → index-Bjlg9wnM.js} +6 -6
- package/dist/{index-Bg2iV3ln.cjs → index-BkryeHcb.cjs} +1 -1
- package/dist/{index-BcNQOPYD.js → index-Bl6RAbAc.js} +2 -2
- package/dist/{index-47QrfG4u.cjs → index-Bwj8bU3w.cjs} +13 -13
- package/dist/{index-BrQVl4Zd.cjs → index-Bxw2nNk2.cjs} +1 -1
- package/dist/{index-DpzKMBIi.js → index-C08wAtul.js} +4 -4
- package/dist/{index-iGVtZ2hS.cjs → index-C1IBXnyt.cjs} +1 -1
- package/dist/{index-s4l8lwWV.js → index-C2KiCWir.js} +3 -3
- package/dist/{index-DwlLvQ7U.cjs → index-C5OJDom_.cjs} +1 -1
- package/dist/{index-Bu_OR9tS.js → index-C8KgQTfH.js} +8109 -7955
- package/dist/{index-C6SI8hvh.cjs → index-CAV4FH8Z.cjs} +1 -1
- package/dist/{index-XuxfvwKY.js → index-CIPfJ4V5.js} +6 -6
- package/dist/{index-VBY1u2Ig.cjs → index-CLaUio0q.cjs} +1 -1
- package/dist/{index-BAdkTvA0.cjs → index-CSfd9Nvs.cjs} +1 -1
- package/dist/index-CVDOumPC.js +514 -0
- package/dist/{index-cBErNLtY.js → index-Cd71tWDj.js} +3 -3
- package/dist/{index-DgPw8IAq.cjs → index-CeOHn1Vk.cjs} +1 -1
- package/dist/{index-B4D4I9Ei.cjs → index-Cx320XRD.cjs} +1 -1
- package/dist/index-CyCiiIH7.js +99 -0
- package/dist/{index-DSPdpu8p.cjs → index-CyTykQhT.cjs} +1 -1
- package/dist/index-D4nn1MaA.cjs +1 -0
- package/dist/{index-C_1UdyuB.cjs → index-D9G0MN0h.cjs} +1 -1
- package/dist/{index-KbmAaWgt.cjs → index-D9HFpsnH.cjs} +1 -1
- package/dist/{index-D-t9ZfYS.js → index-DFwEXQv-.js} +4 -4
- package/dist/{index-Ct0CmWjo.js → index-DIlWcnao.js} +1 -1
- package/dist/{index-CatyTybI.js → index-DJ2FxFvx.js} +1 -1
- package/dist/{index-BZkWytFH.js → index-DLPqu104.js} +6 -6
- package/dist/{index-8idzhcUq.cjs → index-DOn8yEZJ.cjs} +185 -185
- package/dist/{index-C9Nq7qdZ.cjs → index-Dn7yNpUx.cjs} +1 -1
- package/dist/{index-B1EBZK4V.cjs → index-Dz7-jX87.cjs} +1 -1
- package/dist/{index-glKQqAZb.cjs → index-GxAWv8aU.cjs} +1 -1
- package/dist/{index-CGv_PH5k.cjs → index-VQ4mf0NG.cjs} +1 -1
- package/dist/{index-B9e8jfXC.js → index-YA8F1H22.js} +3 -3
- package/dist/{index-BP-q1C8f.js → index-di0y5Ciz.js} +663 -662
- package/dist/{index-CHlc1LGK.cjs → index-fniyUh6b.cjs} +1 -1
- package/dist/{index-62jpKG-S.js → index-onW5suua.js} +4 -4
- package/dist/{index-Ba_1AoLH.js → index-v9IlbVxb.js} +3 -3
- package/dist/{index-C2JVL00b.js → index-xSTLa8Bb.js} +108 -108
- package/dist/{index.vue_vue_type_script_setup_true_lang-D6xvhgat.js → index.vue_vue_type_script_setup_true_lang-DAIduaBX.js} +2 -2
- package/dist/{index.vue_vue_type_script_setup_true_lang-BkYehasn.cjs → index.vue_vue_type_script_setup_true_lang-De8jbnS5.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CUNGVKqd.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bn_-cql3.cjs} +57 -57
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-D5Z2_TwH.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C_N41ilG.js} +1715 -1720
- package/dist/{index.vue_vue_type_style_index_0_scoped_8606206c_lang-D0Bstp43.js → index.vue_vue_type_style_index_0_scoped_8606206c_lang-BgHhMOqW.js} +16 -16
- package/dist/{index.vue_vue_type_style_index_0_scoped_8606206c_lang-B3LO5bhv.cjs → index.vue_vue_type_style_index_0_scoped_8606206c_lang-CCQ1V4Ad.cjs} +2 -2
- package/dist/{index.vue_vue_type_style_index_0_scoped_c81d0427_lang-BS8sJ53i.js → index.vue_vue_type_style_index_0_scoped_c81d0427_lang-BajRaUap.js} +7 -7
- package/dist/{index.vue_vue_type_style_index_0_scoped_c81d0427_lang-Bk-zmumx.cjs → index.vue_vue_type_style_index_0_scoped_c81d0427_lang-CVGFhYru.cjs} +1 -1
- package/dist/{login-C8QOZ9u0.cjs → login-DoVI1BJb.cjs} +2 -2
- package/dist/{login-BLjZKKjO.js → login-Dxsw3cch.js} +6 -2
- package/dist/{main-0XZaToNP.js → main-B5FfttkG.js} +4 -4
- package/dist/{main-zPoUljx8.cjs → main-C_jD1CK-.cjs} +1 -1
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +2 -2
- package/dist/ss-component.js +10 -10
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +10 -10
- package/dist/{threeModel-8wtgLTlp.js → threeModel-BNhwg7RT.js} +3 -3
- package/dist/{threeModel-cQmQcupA.cjs → threeModel-Dwjk_uWz.cjs} +1 -1
- package/package.json +1 -1
- package/public/icons/svg/colFilter.svg +1 -0
- package/dist/index-8oaOF8hU.cjs +0 -1
- package/dist/index-B0HGgYuY.cjs +0 -1
- package/dist/index-BE-X086v.js +0 -90
- package/dist/index-QzT_XISi.js +0 -508
- package/dist/obj/model.mtl +0 -42
- package/dist/obj/model.obj +0 -26110
- package/public/obj/model.mtl +0 -42
- package/public/obj/model.obj +0 -26110
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const l=require("vue"),d=require("./index-
|
|
1
|
+
"use strict";const l=require("vue"),d=require("./index-BKUqLOwQ.cjs"),c=require("./index-CLaUio0q.cjs"),u=require("./login-DoVI1BJb.cjs"),g=u.useModelComp(),{itemData:D}=u.storeToRefs(g),b=l.ref(0),i=l.ref([{label:"机构名称",value:"",name:"deptName"}]),f=e=>{console.log("handleQueryChange",e)},s=l.ref([{key:"extraButton",contents:[{label:"新增"}]},{key:"rowButton",contents:[{label:"编辑"},{label:"删除"}]},{key:"header",contents:[{label:"机构名称",prop:"deptName"},{label:"机构类型",prop:"deptType",formType:"Select",options:[{label:"集团",value:"集团"},{label:"公司",value:"公司"},{label:"部门",value:"部门"},{label:"区域",value:"区域"},{label:"组",value:"组"}]},{label:"机构状态",formType:"Radio",prop:"deptStatus",options:[{label:"启用",value:"启用"},{label:"禁用",value:"禁用"}]},{label:"操作"}]},{key:"tableContents",contents:[]}]),h=e=>{c.submitTableAsyncByVerify(e.singleContent,e.buttonName,b.value)},C=e=>{console.log("onDoubleClick",e)},k=(e,t)=>{console.log("onButtonClick",e,t)},m=async e=>{const t=await c.handleSubmitAsync(d.getInsofDataApi,{key:{systemKey:sessionStorage.getItem("systemKey"),type:"data",pageKey:e}},"查询"),n=t==null?void 0:t.map(a=>{var o;return{id:a.id,tableData:(o=a==null?void 0:a.value)==null?void 0:o.tableData}});return n==null?void 0:n.map(a=>{var o;if(Array.isArray(a==null?void 0:a.tableData)){let r={id:a.id};return(o=a==null?void 0:a.tableData)==null||o.forEach((p,y)=>{r[`a${y}`]=p}),r}else return{...a.tableData,id:a.id}})},S={comp:"Group",name:"/系统管理/部门管理",compData:[{key:"groupContents",contents:[{comp:"Table",compData:s.value,name:""}]}]};l.watch(()=>D.value,e=>{var t;e&&(e==null?void 0:e.length)>0&&(s.value=(t=e==null?void 0:e[0])==null?void 0:t.compData)});const T=Object.freeze(Object.defineProperty({__proto__:null,getPageDataAsync:m,handleItemDataChange:h,handleQueryChange:f,onButtonClick:k,onDoubleClick:C,pageData:s,queryFormData:i,structureId:b,tempDeptPageData:S},Symbol.toStringTag,{value:"Module"}));exports.State=T;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { defineComponent as o, reactive as n, onMounted as r, createElementBlock as s, openBlock as m, createVNode as i } from "vue";
|
|
2
2
|
import "./index-BHtNKL1L.js";
|
|
3
|
-
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
4
|
-
import { a as c, s as u } from "./login-
|
|
5
|
-
import "./index-
|
|
6
|
-
import { s as p } from "./index-
|
|
7
|
-
import { S as l } from "./index-
|
|
8
|
-
import { i as d } from "./index-
|
|
3
|
+
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C_N41ilG.js";
|
|
4
|
+
import { a as c, s as u } from "./login-Dxsw3cch.js";
|
|
5
|
+
import "./index-BHZ56TUj.js";
|
|
6
|
+
import { s as p } from "./index-C8KgQTfH.js";
|
|
7
|
+
import { S as l } from "./index-YA8F1H22.js";
|
|
8
|
+
import { i as d } from "./index-v9IlbVxb.js";
|
|
9
9
|
const k = /* @__PURE__ */ o({
|
|
10
10
|
__name: "index",
|
|
11
11
|
setup(f) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const l=require("vue"),i=require("./index-2p69g4HY.cjs"),u=require("./login-C8QOZ9u0.cjs"),D=require("./crypto-CRbcEKIz.cjs"),ve=require("./index-glKQqAZb.cjs"),F=u.defineStore("authorityState",{state:()=>({routerPageStructures:[]}),actions:{setRouterPageStructure(e){this.routerPageStructures=e}}}),de=u.useMenuState(u.pinia),{activeMenuPath:A}=u.storeToRefs(de),Y=u.useLoginState(u.pinia),{structureData:Ae}=u.storeToRefs(Y),be=F(u.pinia),{routerPageStructures:ke}=u.storeToRefs(be),Z=u.useModelComp(u.pinia),Se=l.ref([{label:"角色名称",value:"",name:"roleName"}]),Be=l.ref([{label:"查询"},{label:"重置"}]),H=l.reactive({isFilter:!1,filterForm:{}}),Te=l.ref(!1),Ce=e=>{H.isFilter=!0,H.filterForm=e},m=l.ref([]),ee=l.ref([]),te=l.ref(""),De=l.computed(()=>{var r,s,t,n,a;const e=(r=ke.value)==null?void 0:r.find(o=>{var c;return((c=o==null?void 0:o.comp)==null?void 0:c.toUpperCase())==="TABLE"});if(e){te.value=e.name,ee.value=(n=(t=(s=e==null?void 0:e.compData)==null?void 0:s.find(c=>(c==null?void 0:c.key)==="header"))==null?void 0:t.contents)==null?void 0:n.filter(c=>(c==null?void 0:c.label)!=="操作");const o=(a=e==null?void 0:e.compData)==null?void 0:a.map(c=>{if((c==null?void 0:c.key)==="rowButton"){let h=[];return K.value?h=[...c==null?void 0:c.contents,{label:"授权"}]:h=c==null?void 0:c.contents,{...c,contents:h}}return c});return ne(o),o}return[]}),Pe=e=>{V(e.singleContent,e.buttonName,N.value)},k=l.ref({}),O=l.ref(),P=async(e,r,s)=>{var t,n;try{const a=await e(r);return((t=a==null?void 0:a.data)==null?void 0:t.code)===200?(s!=="查询"&&await Y.setLogRecordAsync({type:s,data:r},A.value),a.data.result||((n=a==null?void 0:a.data)==null?void 0:n.code)===200):null}catch(a){i.ElMessage.error(a)}},Ke=(e,r)=>{const s=new Map(r.map(n=>[n.path,n.checkedButtons]));function t(n){var o,c;const a=(o=n==null?void 0:n.path)!=null&&o.startsWith("/")?(c=n==null?void 0:n.path)==null?void 0:c.substring(1):n==null?void 0:n.path;s.has(a)&&(n.checkedButtons=s.get(a)),n.children&&n.children.length>0&&n.children.forEach(t)}e.forEach(t)},se=e=>e==null?void 0:e.map(r=>{var t;const s={...r,checkedButtons:[]};return s.children&&((t=s.children)==null?void 0:t.length)>0&&(s.children=se(s.children)),s}),j=e=>{for(const r in e)if(Array.isArray(e[r]))return r;return""},re=e=>{const r=[];let s=0;for(;s<e.length;)if(typeof e[s]=="string"){const t={title:e[s]};s+1<e.length&&Array.isArray(e[s+1])?(t.children=re(e[s+1]),s+=2):s+=1,r.push(t)}return r},W=e=>{const r=[];let s=0;for(;s<(e==null?void 0:e.length);){const t={title:e==null?void 0:e[s]};s+1<(e==null?void 0:e.length)&&Array.isArray(e==null?void 0:e[s+1])?(t.children=re(e==null?void 0:e[s+1]),s+=2):s+=1,r.push(t)}return r},E=(e,r="",s=new Map)=>e==null?void 0:e.map(t=>{const n=r?`${r}/${t.title}`:t.title;if(s.has(n))return s.get(n);const a={...t,path:n};return t.children&&t.children.length>0&&(a.children=E(t.children,n,s)),s.set(n,a),a}),L=(e,r)=>e.reduce((s,t)=>{const n=t[r];return s[n]||(s[n]=[]),s[n].push(t),s},{}),q=e=>{const r=[];function s(t,n){!t.children||t.children.length===0?r.push({...t,parentPath:n||""}):t.children.forEach(a=>s(a,t.path||n))}return e.forEach(t=>s(t,"")),r},_=e=>Object.entries(e).map(([s,t])=>({path:s,checkedButtons:t==null?void 0:t.map(n=>n==null?void 0:n.path)})),we=e=>Object.prototype.toString.call(e)==="[object Object]"&&e!==null,Ie=e=>{const r={},s=Array.isArray(e)?e==null?void 0:e.filter(t=>{var n;return!(we(t)&&((n=Object.keys(t))!=null&&n.includes("id")))}):null;return s&&(s==null||s.forEach((t,n)=>{if(n<=0)return;const a=`a${n}`;r[a]=t})),r},S=l.ref(""),ne=e=>{var n;const r=e==null?void 0:e.find(a=>(a==null?void 0:a.key)==="tableContents");if(!r)return"";const s=(n=r==null?void 0:r.contents)==null?void 0:n[0],t=Ie(s);S.value=j(t)},Re=e=>{if(!Array.isArray(e))return!1;for(let r of e){if(typeof r!="object"||r===null||typeof r.path!="string"||!Array.isArray(r.checkedButtons))return!1;for(let s of r.checkedButtons)if(typeof s!="string")return!1}return!0},$e=e=>{const r=[];for(const s in e)e[s].forEach(n=>{var h,f;const a=(h=n.path)!=null&&h.startsWith("/")?(f=n.path)==null?void 0:f.substring(1):n.path,o=a==null?void 0:a.split("/");let c=r;o.forEach(p=>{let g=c.find(d=>d.title===p);g||(g={title:p,path:n.path,children:[]},c.push(g)),c=g.children})});return r},Me=e=>{const r={};return e.forEach(s=>{const{path:t,checkedButtons:n}=s,a=t,o=n.map(c=>({title:c.split("/").pop()||"",path:c,parentPath:a}));r[a]=o}),r},ae=e=>{let r=[];for(const s of e){let t=[s.title];if(s.children&&Array.isArray(s.children)){let n=ae(s.children);n.length>0&&t.push(n)}r.push(t)}return r},Ee=e=>{const r=[];for(const s of e){if(!Array.isArray(s)||s.length!==2)continue;const[t,n]=s,a=ce(n),o=r.indexOf(t);o===-1?r.push(t,a):r[o+1]=oe(r[o+1],a)}return r},ce=e=>{const r=[];for(const s of e)if(Array.isArray(s)){if(s.length===1&&typeof s[0]=="string")r.push(s[0]);else if(s.length===2&&typeof s[0]=="string"){const[t,n]=s;r.push(t,ce(n))}}return r},oe=(e,r)=>{const s=[...e];let t=0;for(;t<r.length;){const n=r[t];if(typeof n=="string"){const a=s.indexOf(n);a===-1?s.push(n,r[t+1]):s[a+1]=oe(s[a+1],r[t+1]),t+=2}else s.push(n),t+=1}return s},Ne=async(e,r)=>{var s,t;if(k.value=u.cloneDeep(r),Z.setRefreshCurStructure(!1),(s=B.value)==null||s.splice(0),e==="授权"){if(!S.value){i.ElMessage.error("请正确定义角色权限");return}const n=Re(k.value[S.value]);let a;if(n)a=k.value[S.value];else{const c=W(k.value[S.value]),h=E(c),f=q(h),p=L(f,"parentPath");a=_(p)}if(!a||!Array.isArray(a)){i.ElMessage.error("权限数据处理出错了,请联系管理员");return}b.title=`【${r.a0}】授权`,b.show=!0,await l.nextTick();const o=a==null?void 0:a.map(c=>c==null?void 0:c.path);(t=O.value)==null||t.setCheckedKeys(o),Ke(w.value,a)}},xe=()=>{b.show=!1},R=l.ref(),Fe=async e=>{const r=await P(i.getInsofDataApi,{key:{systemKey:sessionStorage.getItem("systemKey"),type:"data",pageKey:e}},"查询"),s=r==null?void 0:r.map(t=>{var n;return{id:t.id,tableData:(n=t==null?void 0:t.value)==null?void 0:n.tableData}});return s==null?void 0:s.map(t=>{var n;if(Array.isArray(t==null?void 0:t.tableData)){let a={id:t.id};return(n=t==null?void 0:t.tableData)==null||n.forEach((o,c)=>{a[`a${c}`]=o}),a}else return{...t.tableData,id:t.id}})},U=(e,r)=>{let s={};return r==null||r.forEach((t,n)=>{t.label&&e&&(s[t.label]=(e==null?void 0:e[`a${n}`])??null)}),s},V=(e,r,s)=>{var a,o,c,h;const t=u.cloneDeep(e);t!=null&&t.id&&delete t.id;const n=U(t,ee.value);r==="新增"?P(i.createInsofDataApi,{key:{type:"data",systemKey:sessionStorage.getItem("systemKey"),pageKey:(a=A.value)!=null&&a.startsWith("/")?(o=A.value)==null?void 0:o.substring(1):A.value,tableId:s},value:{tableData:n}},r).then(f=>{R.value={...e,newId:f}}):r==="编辑"?P(i.updateInsofDataApi,{id:e.id,key:{type:"data",systemKey:sessionStorage.getItem("systemKey"),pageKey:(c=A.value)!=null&&c.startsWith("/")?(h=A.value)==null?void 0:h.substring(1):A.value,tableId:s},value:{tableData:n}},r).then(f=>{b.show=!1}):r==="删除"&&P(i.deleteInsofDataApi,{id:e.id},r).then(f=>{r&&f&&i.ElMessage.success(r+"成功")}),Z.setRefreshCurStructure(!0)},le=e=>{let r=[];return e==null||e.forEach(s=>{var t;if(s.checkedButtons&&((t=s.checkedButtons)==null?void 0:t.length)>0){const n={path:s.path,checkedButtons:s.checkedButtons};r=r.concat(n)}s.children&&(r=r.concat(le(s.children)))}),r},Oe=()=>{const e=le(w.value),r=Me(e),s=$e(r),t=ae(s),n=Ee(t);R.value={...k.value,[S.value]:n},l.nextTick(()=>{V(R.value,"编辑",N.value)})},b=l.reactive({show:!1,title:"角色授权",width:"50%",draggable:!0}),je=({isPenultimate:e},r)=>{var s,t;return console.log("isPenultimate",e,r),((t=(s=r==null?void 0:r.data)==null?void 0:s.renderButtons)==null?void 0:t.length)>0?"is-penultimate":""},N=l.ref(0),ue=async e=>{var t,n,a,o,c;let r;const s=await i.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),type:"structure",pageKey:e!=null&&e.startsWith("/")?e==null?void 0:e.substring(1):e}});return((t=s==null?void 0:s.data)==null?void 0:t.code)===200&&(n=s==null?void 0:s.data)!=null&&n.result&&((a=s==null?void 0:s.data)==null?void 0:a.result.length)>0&&(r=(c=(o=s==null?void 0:s.data.result)==null?void 0:o[0])==null?void 0:c.id,N.value=r),r},w=l.ref([]),We=l.ref([{path:"资源管理",buttons:["查询","新增","编辑","删除"]},{path:"资源管理/人员",buttons:["查询","新增","编辑","删除"]}]),Le=(e,r)=>{var s;e.checkedButtons=r?(s=e.renderButtons)==null?void 0:s.map(t=>t.path):[]},B=l.ref([]),qe=(e,r)=>{var s,t,n;r.checkedButtons=e,((s=r.checkedButtons)==null?void 0:s.length)===((t=r.renderButtons)==null?void 0:t.length)?B.value.push(r.path):(e==null?void 0:e.length)===0&&(B.value=(n=B.value)==null?void 0:n.filter(a=>a!==r.path))};l.watch(()=>B.value.length,()=>{var e;(e=O.value)==null||e.setCheckedKeys([...B.value])});l.watch(()=>b.show,e=>{e||(w.value=se(w.value))});const he=l.computed(()=>{var s;const e=(s=u.cloneDeep(Ae.value))==null?void 0:s.filter(t=>{var n,a;return((a=(n=t==null?void 0:t.key)==null?void 0:n.pageKey)==null?void 0:a.toUpperCase())!=="MENU"});return e==null?void 0:e.map(t=>{var o,c,h,f,p,g,d,J;const n=/button/i;let a=(h=(c=(o=t==null?void 0:t.value)==null?void 0:o.pageData)==null?void 0:c.compData)==null?void 0:h.filter(C=>n.test(C==null?void 0:C.key));return a=Array.from(new Set(a==null?void 0:a.flatMap(C=>C.contents.map(ge=>ge.label)))),{path:(p=(f=t==null?void 0:t.key)==null?void 0:f.pageKey)!=null&&p.startsWith("/")?(d=(g=t==null?void 0:t.key)==null?void 0:g.pageKey)==null?void 0:d.substring(1):(J=t==null?void 0:t.key)==null?void 0:J.pageKey,buttons:a}})}),_e=l.ref([]),Ue=e=>{const s=[e==null?void 0:e.find(t=>(t==null?void 0:t.title)==="平台管理")].flatMap(t=>t==null?void 0:t.children);return s==null?void 0:s.map(t=>{var n,a;return{path:(n=t==null?void 0:t.path)!=null&&n.startsWith("/")?(a=t==null?void 0:t.path)==null?void 0:a.substring(1):t.path,buttons:["新增","查看","编辑","删除"]}})},X=(e,r)=>{var s;if(e.carryData){if(e.path==="系统管理/个人中心"){const t=["基本信息","上传头像","签名","修改密码"];return t==null?void 0:t.map(n=>{var a,o;return{title:n,path:(a=e==null?void 0:e.path)!=null&&a.startsWith("/")?((o=e==null?void 0:e.path)==null?void 0:o.substring(1))+"/"+n:e.path+"/"+n}})}return(s=r==null?void 0:r.buttons)==null?void 0:s.map(t=>{var n,a;return{title:t,path:(n=e==null?void 0:e.path)!=null&&n.startsWith("/")?((a=e==null?void 0:e.path)==null?void 0:a.substring(1))+"/"+t:e.path+"/"+t}})}return[]},ie=(e,r)=>{if(Array.isArray(e))return e==null?void 0:e.map(s=>{var a,o;const t=(a=s==null?void 0:s.path)!=null&&a.startsWith("/")?(o=s==null?void 0:s.path)==null?void 0:o.substring(1):s==null?void 0:s.path,n=r==null?void 0:r.find(c=>(c==null?void 0:c.path)===t);return s.children&&s.children.length>0?{...s,renderButtons:X(s,n),checkedButtons:[],children:ie(s.children,he.value)}:{...s,renderButtons:X(s,n),checkedButtons:[]}})},Ve={comp:"Group",name:"/系统管理/角色管理",compData:[{key:"groupContents",contents:[{comp:"Table",compData:m.value,name:""}]}]},ze=Object.freeze(Object.defineProperty({__proto__:null,addButtonsToTree:ie,addPathToTree:E,authorizeDialog:b,buttonValue:Be,changedRow:R,clickRow:k,clickRowButton:Ne,clickSubmitAuthority:Oe,closeAuthorizeDialog:xe,compName:te,convertArrayToTree:W,convertIndexToLabel:U,customNodeClass:je,getActivePageStructureId:ue,getAuthorityKey:ne,getFirstArrayProperty:j,getLeafNodesRecursive:q,getPageDataAsync:Fe,groupByField:L,handleAddSysMenusButtons:Ue,handleItemDataChange:Pe,handleNodeBtnChange:qe,handleNodeCheckChange:Le,handleQueryChange:Ce,handleRowAuthorityRender:_,handleSubmitAsync:P,isPageDataExist:Te,menuData:w,menusButtons:We,pageData:m,pageDataFiltered:De,queryFormData:Se,structureButtons:he,structureId:N,submitTableAsyncByVerify:V,tempRolePageData:Ve,tempSysMenus:_e,treeRef:O},Symbol.toStringTag,{value:"Module"})),fe=u.useLoginState(u.pinia),{superAdminInfo:Qe,cryptoInfo:y}=u.storeToRefs(fe),Ge=u.useMenuState(u.pinia),{activeMenuPath:v}=u.storeToRefs(Ge),I="123456",Je=F(u.pinia),{routerPageStructures:He}=u.storeToRefs(Je),z=l.ref(0),Xe=l.ref([{label:"用户名称",value:"",name:"userName"}]),K=l.computed(()=>{const e=sessionStorage.getItem("isSuperAdmin");return e?JSON.parse(e):!1}),Ye=e=>{console.log("handleQueryChange",e)},Q=l.ref([]),ye=l.ref(""),$=l.computed(()=>{var r,s,t,n,a;const e=(r=He.value)==null?void 0:r.find(o=>{var c;return((c=o==null?void 0:o.comp)==null?void 0:c.toUpperCase())==="TABLE"});return e?(ye.value=e.name,Q.value=(n=(t=(s=e==null?void 0:e.compData)==null?void 0:s.find(c=>(c==null?void 0:c.key)==="header"))==null?void 0:t.contents)==null?void 0:n.filter(c=>(c==null?void 0:c.label)!=="操作"),(a=e==null?void 0:e.compData)==null?void 0:a.map(c=>{if((c==null?void 0:c.key)==="rowButton"){const h=[...c==null?void 0:c.contents,{label:"重置密码"}];return{...c,contents:h}}return c})):[]}),Ze=e=>{x(e.singleContent,e.buttonName,z.value)},M=l.ref(),me=e=>{console.log("onDoubleClick",e)},et=(e,r)=>{e==="重置密码"&&ve.ElMessageBox.confirm(`该操作将会重置【${r==null?void 0:r.account}】的密码,确认重置?`,"警告",{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}).then(()=>{M.value={...r,password:I},x(M.value,e,z.value)}).catch(()=>{i.ElMessage.info("取消重置")})},pe=()=>{G(v.value).then(e=>{var s;const r=Array.isArray(e)&&(e==null?void 0:e.filter(t=>(t==null?void 0:t.account)!==Qe.value.account));$.value=(s=$.value)==null?void 0:s.map(t=>t.key==="tableContents"?{...t,contents:r==null?void 0:r.map(n=>{var a;return{...n,password:D.decryptData(n==null?void 0:n.password,(a=y==null?void 0:y.value)==null?void 0:a.privateKey)}})}:t)})},T=async(e,r,s)=>{var t,n;try{const a=await e(r);return((t=a==null?void 0:a.data)==null?void 0:t.code)===200?(s!=="查询"&&await fe.setLogRecordAsync({type:s,data:r},v.value),a.data.result||((n=a==null?void 0:a.data)==null?void 0:n.code)===200):null}catch(a){i.ElMessage.error(a)}},x=(e,r,s)=>{var a,o,c,h,f,p;const t=u.cloneDeep(e);t!=null&&t.id&&delete t.id;const n=U(t,Q.value);D.isEncryptAvailable()&&n&&(!n.password&&K.value?n.password=D.encryptData(I,(a=y==null?void 0:y.value)==null?void 0:a.publicKey):n.password&&K.value&&(n.password=D.encryptData(n==null?void 0:n.password,(o=y==null?void 0:y.value)==null?void 0:o.publicKey))),r==="新增"?T(i.createInsofDataApi,{key:{type:"data",layer:n==null?void 0:n.layer,systemKey:sessionStorage.getItem("systemKey"),pageKey:(c=v.value)!=null&&c.startsWith("/")?(h=v.value)==null?void 0:h.substring(1):v.value,tableId:s},value:{tableData:n}},r).then(g=>{var d;M.value={...e,newId:g,password:K.value?D.decryptData((e==null?void 0:e.password)??I,(d=y==null?void 0:y.value)==null?void 0:d.privateKey):e==null?void 0:e.password}}):r==="编辑"||r==="重置密码"?T(i.updateInsofDataApi,{id:e.id,key:{type:"data",layer:n==null?void 0:n.layer,systemKey:sessionStorage.getItem("systemKey"),pageKey:(f=v.value)!=null&&f.startsWith("/")?(p=v.value)==null?void 0:p.substring(1):v.value,tableId:s},value:{tableData:n}},r).then(()=>{r==="重置密码"&&pe(),b.show=!1}):r==="删除"&&T(i.deleteInsofDataApi,{id:e.id},r).then(()=>{r&&i.ElMessage.success(r+"成功")})},G=async e=>{const r=await T(i.getInsofDataApi,{key:{systemKey:sessionStorage.getItem("systemKey"),type:"data",pageKey:e}},"查询"),s=r==null?void 0:r.map(t=>{var n,a;return{id:t.id,layer:(n=t.key)==null?void 0:n.layer,tableData:(a=t==null?void 0:t.value)==null?void 0:a.tableData}});return s==null?void 0:s.map(t=>{var n;if(!Array.isArray(t==null?void 0:t.tableData))return{...t.tableData,layer:(n=t.key)==null?void 0:n.layer,id:t.id}})},tt={comp:"Group",name:"/系统管理/用户管理",compData:[{key:"groupContents",contents:[{comp:"Table",compData:$.value,name:""}]}]},st=Object.freeze(Object.defineProperty({__proto__:null,changedRow:M,clickRowButton:et,columns:Q,compName:ye,getPageDataAsync:G,handleItemDataChange:Ze,handleQueryChange:Ye,handleSubmitAsync:T,loginUserIsSuper:K,onDoubleClick:me,pageData:$,queryFormData:Xe,refreshUserTableData:pe,resetPassword:I,structureId:z,submitTableAsyncByVerify:x,tempUserPageData:tt},Symbol.toStringTag,{value:"Module"}));exports.State=st;exports.State$1=ze;exports.addPathToTree=E;exports.convertArrayToTree=W;exports.getActivePageStructureId=ue;exports.getFirstArrayProperty=j;exports.getLeafNodesRecursive=q;exports.getPageDataAsync=G;exports.groupByField=L;exports.handleRowAuthorityRender=_;exports.handleSubmitAsync=T;exports.resetPassword=I;exports.submitTableAsyncByVerify=x;exports.useAuthorityState=F;
|
|
1
|
+
"use strict";const l=require("vue"),i=require("./index-BKUqLOwQ.cjs"),u=require("./login-DoVI1BJb.cjs"),D=require("./crypto-CRbcEKIz.cjs"),ve=require("./index-GxAWv8aU.cjs"),F=u.defineStore("authorityState",{state:()=>({routerPageStructures:[]}),actions:{setRouterPageStructure(e){this.routerPageStructures=e}}}),de=u.useMenuState(u.pinia),{activeMenuPath:A}=u.storeToRefs(de),Y=u.useLoginState(u.pinia),{structureData:Ae}=u.storeToRefs(Y),be=F(u.pinia),{routerPageStructures:ke}=u.storeToRefs(be),Z=u.useModelComp(u.pinia),Se=l.ref([{label:"角色名称",value:"",name:"roleName"}]),Be=l.ref([{label:"查询"},{label:"重置"}]),H=l.reactive({isFilter:!1,filterForm:{}}),Te=l.ref(!1),Ce=e=>{H.isFilter=!0,H.filterForm=e},m=l.ref([]),ee=l.ref([]),te=l.ref(""),De=l.computed(()=>{var r,s,t,n,a;const e=(r=ke.value)==null?void 0:r.find(o=>{var c;return((c=o==null?void 0:o.comp)==null?void 0:c.toUpperCase())==="TABLE"});if(e){te.value=e.name,ee.value=(n=(t=(s=e==null?void 0:e.compData)==null?void 0:s.find(c=>(c==null?void 0:c.key)==="header"))==null?void 0:t.contents)==null?void 0:n.filter(c=>(c==null?void 0:c.label)!=="操作");const o=(a=e==null?void 0:e.compData)==null?void 0:a.map(c=>{if((c==null?void 0:c.key)==="rowButton"){let h=[];return K.value?h=[...c==null?void 0:c.contents,{label:"授权"}]:h=c==null?void 0:c.contents,{...c,contents:h}}return c});return ne(o),o}return[]}),Pe=e=>{V(e.singleContent,e.buttonName,N.value)},k=l.ref({}),O=l.ref(),P=async(e,r,s)=>{var t,n;try{const a=await e(r);return((t=a==null?void 0:a.data)==null?void 0:t.code)===200?(s!=="查询"&&await Y.setLogRecordAsync({type:s,data:r},A.value),a.data.result||((n=a==null?void 0:a.data)==null?void 0:n.code)===200):null}catch(a){i.ElMessage.error(a)}},Ke=(e,r)=>{const s=new Map(r.map(n=>[n.path,n.checkedButtons]));function t(n){var o,c;const a=(o=n==null?void 0:n.path)!=null&&o.startsWith("/")?(c=n==null?void 0:n.path)==null?void 0:c.substring(1):n==null?void 0:n.path;s.has(a)&&(n.checkedButtons=s.get(a)),n.children&&n.children.length>0&&n.children.forEach(t)}e.forEach(t)},se=e=>e==null?void 0:e.map(r=>{var t;const s={...r,checkedButtons:[]};return s.children&&((t=s.children)==null?void 0:t.length)>0&&(s.children=se(s.children)),s}),j=e=>{for(const r in e)if(Array.isArray(e[r]))return r;return""},re=e=>{const r=[];let s=0;for(;s<e.length;)if(typeof e[s]=="string"){const t={title:e[s]};s+1<e.length&&Array.isArray(e[s+1])?(t.children=re(e[s+1]),s+=2):s+=1,r.push(t)}return r},W=e=>{const r=[];let s=0;for(;s<(e==null?void 0:e.length);){const t={title:e==null?void 0:e[s]};s+1<(e==null?void 0:e.length)&&Array.isArray(e==null?void 0:e[s+1])?(t.children=re(e==null?void 0:e[s+1]),s+=2):s+=1,r.push(t)}return r},E=(e,r="",s=new Map)=>e==null?void 0:e.map(t=>{const n=r?`${r}/${t.title}`:t.title;if(s.has(n))return s.get(n);const a={...t,path:n};return t.children&&t.children.length>0&&(a.children=E(t.children,n,s)),s.set(n,a),a}),L=(e,r)=>e.reduce((s,t)=>{const n=t[r];return s[n]||(s[n]=[]),s[n].push(t),s},{}),q=e=>{const r=[];function s(t,n){!t.children||t.children.length===0?r.push({...t,parentPath:n||""}):t.children.forEach(a=>s(a,t.path||n))}return e.forEach(t=>s(t,"")),r},_=e=>Object.entries(e).map(([s,t])=>({path:s,checkedButtons:t==null?void 0:t.map(n=>n==null?void 0:n.path)})),we=e=>Object.prototype.toString.call(e)==="[object Object]"&&e!==null,Ie=e=>{const r={},s=Array.isArray(e)?e==null?void 0:e.filter(t=>{var n;return!(we(t)&&((n=Object.keys(t))!=null&&n.includes("id")))}):null;return s&&(s==null||s.forEach((t,n)=>{if(n<=0)return;const a=`a${n}`;r[a]=t})),r},S=l.ref(""),ne=e=>{var n;const r=e==null?void 0:e.find(a=>(a==null?void 0:a.key)==="tableContents");if(!r)return"";const s=(n=r==null?void 0:r.contents)==null?void 0:n[0],t=Ie(s);S.value=j(t)},Re=e=>{if(!Array.isArray(e))return!1;for(let r of e){if(typeof r!="object"||r===null||typeof r.path!="string"||!Array.isArray(r.checkedButtons))return!1;for(let s of r.checkedButtons)if(typeof s!="string")return!1}return!0},$e=e=>{const r=[];for(const s in e)e[s].forEach(n=>{var h,f;const a=(h=n.path)!=null&&h.startsWith("/")?(f=n.path)==null?void 0:f.substring(1):n.path,o=a==null?void 0:a.split("/");let c=r;o.forEach(p=>{let g=c.find(d=>d.title===p);g||(g={title:p,path:n.path,children:[]},c.push(g)),c=g.children})});return r},Me=e=>{const r={};return e.forEach(s=>{const{path:t,checkedButtons:n}=s,a=t,o=n.map(c=>({title:c.split("/").pop()||"",path:c,parentPath:a}));r[a]=o}),r},ae=e=>{let r=[];for(const s of e){let t=[s.title];if(s.children&&Array.isArray(s.children)){let n=ae(s.children);n.length>0&&t.push(n)}r.push(t)}return r},Ee=e=>{const r=[];for(const s of e){if(!Array.isArray(s)||s.length!==2)continue;const[t,n]=s,a=ce(n),o=r.indexOf(t);o===-1?r.push(t,a):r[o+1]=oe(r[o+1],a)}return r},ce=e=>{const r=[];for(const s of e)if(Array.isArray(s)){if(s.length===1&&typeof s[0]=="string")r.push(s[0]);else if(s.length===2&&typeof s[0]=="string"){const[t,n]=s;r.push(t,ce(n))}}return r},oe=(e,r)=>{const s=[...e];let t=0;for(;t<r.length;){const n=r[t];if(typeof n=="string"){const a=s.indexOf(n);a===-1?s.push(n,r[t+1]):s[a+1]=oe(s[a+1],r[t+1]),t+=2}else s.push(n),t+=1}return s},Ne=async(e,r)=>{var s,t;if(k.value=u.cloneDeep(r),Z.setRefreshCurStructure(!1),(s=B.value)==null||s.splice(0),e==="授权"){if(!S.value){i.ElMessage.error("请正确定义角色权限");return}const n=Re(k.value[S.value]);let a;if(n)a=k.value[S.value];else{const c=W(k.value[S.value]),h=E(c),f=q(h),p=L(f,"parentPath");a=_(p)}if(!a||!Array.isArray(a)){i.ElMessage.error("权限数据处理出错了,请联系管理员");return}b.title=`【${r.a0}】授权`,b.show=!0,await l.nextTick();const o=a==null?void 0:a.map(c=>c==null?void 0:c.path);(t=O.value)==null||t.setCheckedKeys(o),Ke(w.value,a)}},xe=()=>{b.show=!1},R=l.ref(),Fe=async e=>{const r=await P(i.getInsofDataApi,{key:{systemKey:sessionStorage.getItem("systemKey"),type:"data",pageKey:e}},"查询"),s=r==null?void 0:r.map(t=>{var n;return{id:t.id,tableData:(n=t==null?void 0:t.value)==null?void 0:n.tableData}});return s==null?void 0:s.map(t=>{var n;if(Array.isArray(t==null?void 0:t.tableData)){let a={id:t.id};return(n=t==null?void 0:t.tableData)==null||n.forEach((o,c)=>{a[`a${c}`]=o}),a}else return{...t.tableData,id:t.id}})},U=(e,r)=>{let s={};return r==null||r.forEach((t,n)=>{t.label&&e&&(s[t.label]=(e==null?void 0:e[`a${n}`])??null)}),s},V=(e,r,s)=>{var a,o,c,h;const t=u.cloneDeep(e);t!=null&&t.id&&delete t.id;const n=U(t,ee.value);r==="新增"?P(i.createInsofDataApi,{key:{type:"data",systemKey:sessionStorage.getItem("systemKey"),pageKey:(a=A.value)!=null&&a.startsWith("/")?(o=A.value)==null?void 0:o.substring(1):A.value,tableId:s},value:{tableData:n}},r).then(f=>{R.value={...e,newId:f}}):r==="编辑"?P(i.updateInsofDataApi,{id:e.id,key:{type:"data",systemKey:sessionStorage.getItem("systemKey"),pageKey:(c=A.value)!=null&&c.startsWith("/")?(h=A.value)==null?void 0:h.substring(1):A.value,tableId:s},value:{tableData:n}},r).then(f=>{b.show=!1}):r==="删除"&&P(i.deleteInsofDataApi,{id:e.id},r).then(f=>{r&&f&&i.ElMessage.success(r+"成功")}),Z.setRefreshCurStructure(!0)},le=e=>{let r=[];return e==null||e.forEach(s=>{var t;if(s.checkedButtons&&((t=s.checkedButtons)==null?void 0:t.length)>0){const n={path:s.path,checkedButtons:s.checkedButtons};r=r.concat(n)}s.children&&(r=r.concat(le(s.children)))}),r},Oe=()=>{const e=le(w.value),r=Me(e),s=$e(r),t=ae(s),n=Ee(t);R.value={...k.value,[S.value]:n},l.nextTick(()=>{V(R.value,"编辑",N.value)})},b=l.reactive({show:!1,title:"角色授权",width:"50%",draggable:!0}),je=({isPenultimate:e},r)=>{var s,t;return console.log("isPenultimate",e,r),((t=(s=r==null?void 0:r.data)==null?void 0:s.renderButtons)==null?void 0:t.length)>0?"is-penultimate":""},N=l.ref(0),ue=async e=>{var t,n,a,o,c;let r;const s=await i.getInsofDataApi({key:{systemKey:sessionStorage.getItem("systemKey"),type:"structure",pageKey:e!=null&&e.startsWith("/")?e==null?void 0:e.substring(1):e}});return((t=s==null?void 0:s.data)==null?void 0:t.code)===200&&(n=s==null?void 0:s.data)!=null&&n.result&&((a=s==null?void 0:s.data)==null?void 0:a.result.length)>0&&(r=(c=(o=s==null?void 0:s.data.result)==null?void 0:o[0])==null?void 0:c.id,N.value=r),r},w=l.ref([]),We=l.ref([{path:"资源管理",buttons:["查询","新增","编辑","删除"]},{path:"资源管理/人员",buttons:["查询","新增","编辑","删除"]}]),Le=(e,r)=>{var s;e.checkedButtons=r?(s=e.renderButtons)==null?void 0:s.map(t=>t.path):[]},B=l.ref([]),qe=(e,r)=>{var s,t,n;r.checkedButtons=e,((s=r.checkedButtons)==null?void 0:s.length)===((t=r.renderButtons)==null?void 0:t.length)?B.value.push(r.path):(e==null?void 0:e.length)===0&&(B.value=(n=B.value)==null?void 0:n.filter(a=>a!==r.path))};l.watch(()=>B.value.length,()=>{var e;(e=O.value)==null||e.setCheckedKeys([...B.value])});l.watch(()=>b.show,e=>{e||(w.value=se(w.value))});const he=l.computed(()=>{var s;const e=(s=u.cloneDeep(Ae.value))==null?void 0:s.filter(t=>{var n,a;return((a=(n=t==null?void 0:t.key)==null?void 0:n.pageKey)==null?void 0:a.toUpperCase())!=="MENU"});return e==null?void 0:e.map(t=>{var o,c,h,f,p,g,d,J;const n=/button/i;let a=(h=(c=(o=t==null?void 0:t.value)==null?void 0:o.pageData)==null?void 0:c.compData)==null?void 0:h.filter(C=>n.test(C==null?void 0:C.key));return a=Array.from(new Set(a==null?void 0:a.flatMap(C=>C.contents.map(ge=>ge.label)))),{path:(p=(f=t==null?void 0:t.key)==null?void 0:f.pageKey)!=null&&p.startsWith("/")?(d=(g=t==null?void 0:t.key)==null?void 0:g.pageKey)==null?void 0:d.substring(1):(J=t==null?void 0:t.key)==null?void 0:J.pageKey,buttons:a}})}),_e=l.ref([]),Ue=e=>{const s=[e==null?void 0:e.find(t=>(t==null?void 0:t.title)==="平台管理")].flatMap(t=>t==null?void 0:t.children);return s==null?void 0:s.map(t=>{var n,a;return{path:(n=t==null?void 0:t.path)!=null&&n.startsWith("/")?(a=t==null?void 0:t.path)==null?void 0:a.substring(1):t.path,buttons:["新增","查看","编辑","删除"]}})},X=(e,r)=>{var s;if(e.carryData){if(e.path==="系统管理/个人中心"){const t=["基本信息","上传头像","签名","修改密码"];return t==null?void 0:t.map(n=>{var a,o;return{title:n,path:(a=e==null?void 0:e.path)!=null&&a.startsWith("/")?((o=e==null?void 0:e.path)==null?void 0:o.substring(1))+"/"+n:e.path+"/"+n}})}return(s=r==null?void 0:r.buttons)==null?void 0:s.map(t=>{var n,a;return{title:t,path:(n=e==null?void 0:e.path)!=null&&n.startsWith("/")?((a=e==null?void 0:e.path)==null?void 0:a.substring(1))+"/"+t:e.path+"/"+t}})}return[]},ie=(e,r)=>{if(Array.isArray(e))return e==null?void 0:e.map(s=>{var a,o;const t=(a=s==null?void 0:s.path)!=null&&a.startsWith("/")?(o=s==null?void 0:s.path)==null?void 0:o.substring(1):s==null?void 0:s.path,n=r==null?void 0:r.find(c=>(c==null?void 0:c.path)===t);return s.children&&s.children.length>0?{...s,renderButtons:X(s,n),checkedButtons:[],children:ie(s.children,he.value)}:{...s,renderButtons:X(s,n),checkedButtons:[]}})},Ve={comp:"Group",name:"/系统管理/角色管理",compData:[{key:"groupContents",contents:[{comp:"Table",compData:m.value,name:""}]}]},ze=Object.freeze(Object.defineProperty({__proto__:null,addButtonsToTree:ie,addPathToTree:E,authorizeDialog:b,buttonValue:Be,changedRow:R,clickRow:k,clickRowButton:Ne,clickSubmitAuthority:Oe,closeAuthorizeDialog:xe,compName:te,convertArrayToTree:W,convertIndexToLabel:U,customNodeClass:je,getActivePageStructureId:ue,getAuthorityKey:ne,getFirstArrayProperty:j,getLeafNodesRecursive:q,getPageDataAsync:Fe,groupByField:L,handleAddSysMenusButtons:Ue,handleItemDataChange:Pe,handleNodeBtnChange:qe,handleNodeCheckChange:Le,handleQueryChange:Ce,handleRowAuthorityRender:_,handleSubmitAsync:P,isPageDataExist:Te,menuData:w,menusButtons:We,pageData:m,pageDataFiltered:De,queryFormData:Se,structureButtons:he,structureId:N,submitTableAsyncByVerify:V,tempRolePageData:Ve,tempSysMenus:_e,treeRef:O},Symbol.toStringTag,{value:"Module"})),fe=u.useLoginState(u.pinia),{superAdminInfo:Qe,cryptoInfo:y}=u.storeToRefs(fe),Ge=u.useMenuState(u.pinia),{activeMenuPath:v}=u.storeToRefs(Ge),I="123456",Je=F(u.pinia),{routerPageStructures:He}=u.storeToRefs(Je),z=l.ref(0),Xe=l.ref([{label:"用户名称",value:"",name:"userName"}]),K=l.computed(()=>{const e=sessionStorage.getItem("isSuperAdmin");return e?JSON.parse(e):!1}),Ye=e=>{console.log("handleQueryChange",e)},Q=l.ref([]),ye=l.ref(""),$=l.computed(()=>{var r,s,t,n,a;const e=(r=He.value)==null?void 0:r.find(o=>{var c;return((c=o==null?void 0:o.comp)==null?void 0:c.toUpperCase())==="TABLE"});return e?(ye.value=e.name,Q.value=(n=(t=(s=e==null?void 0:e.compData)==null?void 0:s.find(c=>(c==null?void 0:c.key)==="header"))==null?void 0:t.contents)==null?void 0:n.filter(c=>(c==null?void 0:c.label)!=="操作"),(a=e==null?void 0:e.compData)==null?void 0:a.map(c=>{if((c==null?void 0:c.key)==="rowButton"){const h=[...c==null?void 0:c.contents,{label:"重置密码"}];return{...c,contents:h}}return c})):[]}),Ze=e=>{x(e.singleContent,e.buttonName,z.value)},M=l.ref(),me=e=>{console.log("onDoubleClick",e)},et=(e,r)=>{e==="重置密码"&&ve.ElMessageBox.confirm(`该操作将会重置【${r==null?void 0:r.account}】的密码,确认重置?`,"警告",{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}).then(()=>{M.value={...r,password:I},x(M.value,e,z.value)}).catch(()=>{i.ElMessage.info("取消重置")})},pe=()=>{G(v.value).then(e=>{var s;const r=Array.isArray(e)&&(e==null?void 0:e.filter(t=>(t==null?void 0:t.account)!==Qe.value.account));$.value=(s=$.value)==null?void 0:s.map(t=>t.key==="tableContents"?{...t,contents:r==null?void 0:r.map(n=>{var a;return{...n,password:D.decryptData(n==null?void 0:n.password,(a=y==null?void 0:y.value)==null?void 0:a.privateKey)}})}:t)})},T=async(e,r,s)=>{var t,n;try{const a=await e(r);return((t=a==null?void 0:a.data)==null?void 0:t.code)===200?(s!=="查询"&&await fe.setLogRecordAsync({type:s,data:r},v.value),a.data.result||((n=a==null?void 0:a.data)==null?void 0:n.code)===200):null}catch(a){i.ElMessage.error(a)}},x=(e,r,s)=>{var a,o,c,h,f,p;const t=u.cloneDeep(e);t!=null&&t.id&&delete t.id;const n=U(t,Q.value);D.isEncryptAvailable()&&n&&(!n.password&&K.value?n.password=D.encryptData(I,(a=y==null?void 0:y.value)==null?void 0:a.publicKey):n.password&&K.value&&(n.password=D.encryptData(n==null?void 0:n.password,(o=y==null?void 0:y.value)==null?void 0:o.publicKey))),r==="新增"?T(i.createInsofDataApi,{key:{type:"data",layer:n==null?void 0:n.layer,systemKey:sessionStorage.getItem("systemKey"),pageKey:(c=v.value)!=null&&c.startsWith("/")?(h=v.value)==null?void 0:h.substring(1):v.value,tableId:s},value:{tableData:n}},r).then(g=>{var d;M.value={...e,newId:g,password:K.value?D.decryptData((e==null?void 0:e.password)??I,(d=y==null?void 0:y.value)==null?void 0:d.privateKey):e==null?void 0:e.password}}):r==="编辑"||r==="重置密码"?T(i.updateInsofDataApi,{id:e.id,key:{type:"data",layer:n==null?void 0:n.layer,systemKey:sessionStorage.getItem("systemKey"),pageKey:(f=v.value)!=null&&f.startsWith("/")?(p=v.value)==null?void 0:p.substring(1):v.value,tableId:s},value:{tableData:n}},r).then(()=>{r==="重置密码"&&pe(),b.show=!1}):r==="删除"&&T(i.deleteInsofDataApi,{id:e.id},r).then(()=>{r&&i.ElMessage.success(r+"成功")})},G=async e=>{const r=await T(i.getInsofDataApi,{key:{systemKey:sessionStorage.getItem("systemKey"),type:"data",pageKey:e}},"查询"),s=r==null?void 0:r.map(t=>{var n,a;return{id:t.id,layer:(n=t.key)==null?void 0:n.layer,tableData:(a=t==null?void 0:t.value)==null?void 0:a.tableData}});return s==null?void 0:s.map(t=>{var n;if(!Array.isArray(t==null?void 0:t.tableData))return{...t.tableData,layer:(n=t.key)==null?void 0:n.layer,id:t.id}})},tt={comp:"Group",name:"/系统管理/用户管理",compData:[{key:"groupContents",contents:[{comp:"Table",compData:$.value,name:""}]}]},st=Object.freeze(Object.defineProperty({__proto__:null,changedRow:M,clickRowButton:et,columns:Q,compName:ye,getPageDataAsync:G,handleItemDataChange:Ze,handleQueryChange:Ye,handleSubmitAsync:T,loginUserIsSuper:K,onDoubleClick:me,pageData:$,queryFormData:Xe,refreshUserTableData:pe,resetPassword:I,structureId:z,submitTableAsyncByVerify:x,tempUserPageData:tt},Symbol.toStringTag,{value:"Module"}));exports.State=st;exports.State$1=ze;exports.addPathToTree=E;exports.convertArrayToTree=W;exports.getActivePageStructureId=ue;exports.getFirstArrayProperty=j;exports.getLeafNodesRecursive=q;exports.getPageDataAsync=G;exports.groupByField=L;exports.handleRowAuthorityRender=_;exports.handleSubmitAsync=T;exports.resetPassword=I;exports.submitTableAsyncByVerify=x;exports.useAuthorityState=F;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const d=require("vue"),k=require("./login-C8QOZ9u0.cjs"),pe=require("./index-8idzhcUq.cjs"),fe=require("./index-VBY1u2Ig.cjs"),y=require("./index-2p69g4HY.cjs"),E=k.useModelComp(k.pinia),m=pe.useUnit(k.pinia),I=k.useMenuState(k.pinia),{menus:ee,configMenu:x,activeMenuPath:_,cacheStructures:F}=k.storeToRefs(I),$=d.ref(!1),te=d.computed(()=>{var e,t;return[{key:"extraButton",contents:[]},{key:"rowButton",contents:[{label:"修改"}]},{key:"header",contents:[{label:"菜单名称",prop:"title",isFormColHidden:!1},{label:"菜单类型",prop:"menuType",formType:"select",options:[{label:"系统菜单",value:"集团"},{label:"公司",value:"公司"}],isTableColHidden:!1,isFormColHidden:!0},{label:"操作"}]},{key:"tableContents",contents:(t=(e=k.cloneDeep(ee.value))==null?void 0:e.map(l=>({...l,menuType:"系统菜单"})))==null?void 0:t.filter(l=>l.title!=="系统管理"&&l.title!=="平台管理")}]}),j=d.ref([]),R=d.ref([{label:"新建"}]),ie=d.computed(()=>[{key:"extraButton",contents:R.value},{key:"rowButton",contents:[{label:"修改"},{label:"删除"}]},{key:"header",contents:[{label:"操作类型",prop:"operateType",formType:"select",options:[{label:"新增",value:"新增"},{label:"编辑",value:"编辑"},{label:"删除",value:"删除"}],value:""},{label:"操作图标",prop:"operateIcon",formType:"inputPopover",value:""},{label:"操作触发事件",prop:"trigger",formType:"select",options:[{label:"弹出弹窗",value:"openDialog"}],value:"openDialog"},{label:"配置一:",prop:"dialogConfig",formType:"button",value:"弹窗内容",isTableColHidden:!0},{label:"配置二:",prop:"contentConfig",formType:"button",value:"模块内容",isTableColHidden:!0},{label:"继承配置:",prop:"allowInherit",formType:"radio",contents:[{label:"是",value:!0},{label:"否",value:!1}],value:!1,isTableColHidden:!0},{label:"操作"}]},{key:"tableContents",contents:j.value}]),J=d.ref([]),T=d.ref({}),de=d.ref({}),q=d.ref([{label:"菜单",prop:"path",isFormColHidden:!0,value:""},{label:"操作类型:",prop:"operateType",type:"select",contents:[{label:"新增",value:"新增"},{label:"编辑",value:"编辑"},{label:"删除",value:"删除"}],value:""},{label:"操作图标:",prop:"operateIcon",type:"inputPopover",value:""},{label:"操作触发事件:",prop:"trigger",type:"select",contents:[{label:"弹出弹窗",value:"openDialog"}],value:"openDialog"},{label:"生成的菜单图标:",prop:"menuIcon",type:"inputPopover",value:""},{label:"配置一:",prop:"dialogConfig",type:"button",value:"操作触发的弹窗结构"},{label:"配置二:",prop:"contentConfig",type:"button",value:"操作生成的模块结构",isFormColHidden:!1},{label:"",prop:"structureIds",type:"input",value:[],isFormColHidden:!0},{label:"继承配置:",prop:"allowInherit",type:"radio",contents:[{label:"是",value:!0},{label:"否",value:!1}],value:!0}]),O=e=>{var t;J.value=e?(t=q.value)==null?void 0:t.map(l=>l.prop==="dialogConfig"||l.prop==="contentConfig"||l.prop==="trigger"?l:{...l,value:e?e[l==null?void 0:l.prop]:""}):q.value},ge=d.ref([{label:"查询"},{label:"重置"}]),ve=async()=>{},le=e=>e.map(t=>t.childMenus&&t.childMenus.length>0?{...t,value:t==null?void 0:t.title,label:t==null?void 0:t.title,children:le(t.childMenus)}:{...t,value:t==null?void 0:t.title,label:t==null?void 0:t.title}),g=d.reactive({show:!1,title:"菜单配置",width:"30%",type:"create"}),U=d.ref([]),C=d.ref({}),h=d.ref(null),ae=d.ref([]),oe=d.computed(()=>{var e;return(e=le(ee.value))==null?void 0:e.filter(t=>t.title!=="系统管理"&&t.title!=="平台管理")}),ne=async e=>{var l,u,n,c;const t=await y.getInsofDataApi({key:{type:"subStructure",systemKey:sessionStorage.getItem("systemKey"),pageKey:e,version:1}});if(((l=t==null?void 0:t.data)==null?void 0:l.code)===200&&(u=t.data)!=null&&u.result){const r=(c=(n=t.data)==null?void 0:n.result)==null?void 0:c.map(p=>{var f;return{id:p==null?void 0:p.id,...(f=p==null?void 0:p.value)==null?void 0:f.pageData}});ae.value=r,I.setCacheStructures({key:"contentConfig",data:r})}},ye=async e=>{var t;$.value=!0,h.value={...e,rootNode:k.findRootNodeByPath(oe.value,e.path)},I.setCacheStructures(null),(e==null?void 0:e.level)===0?R.value.splice(0):(R.value=[{label:"新建"}],U.value=(t=e==null?void 0:e.path)==null?void 0:t.split("/")),await I.setConfigMenu(null),await ne(e==null?void 0:e.path),await K(e)},be=e=>{switch(e){case"新建":return"create";case"修改":return"update";case"删除":return"delete"}},he=async(e,t)=>{var l,u;if(!h.value)return y.ElMessage.warning("请先选择菜单");if(g.type=be(e),U.value=[],E.setSubmitCurStructure(!1),m.setSelectTitle([]),C.value=k.cloneDeep(t),g.type!=="delete"){switch(g.type){case"create":O(null),await I.setConfigMenu(null);break;case"update":O(C.value),await I.setConfigMenu(C.value),console.log("clickRowButton",C.value);break}await d.nextTick(),g.title=`【${g.type==="create"?(l=h.value)==null?void 0:l.path:(u=C.value)==null?void 0:u.path}】菜单配置${e}`,g.show=!0}else await re(C.value,g.type)},ue=d.ref(!0),Ce=async e=>{var t;T.value=e,await I.setConfigMenu({...T.value,path:(t=h.value)==null?void 0:t.path}),ue.value=(e==null?void 0:e.operateType)!=="新增"};d.watch(()=>ue.value,async e=>{var t;await d.nextTick(),J.value=(t=q.value)==null?void 0:t.map(l=>l.prop==="dialogConfig"||l.prop==="contentConfig"||l.prop==="trigger"?l.prop==="contentConfig"?{...l,isFormColHidden:e}:l:{...l,value:T.value?T.value[l==null?void 0:l.prop]:""})},{immediate:!0,deep:!0});const Ie=d.ref(null),ke=async(e,t)=>{var r,p,f,s,b;if(g.type==="create"){const a=(p=(r=F.value)==null?void 0:r.filter(i=>(i==null?void 0:i.key)===t))==null?void 0:p.flatMap(i=>i==null?void 0:i.data);E.setItemData(a),I.setCacheStructures({key:t,data:a})}if(console.log("getTriggerStructures1",e==null?void 0:e.structureIds,t),!(e!=null&&e.structureIds)||((f=e==null?void 0:e.structureIds)==null?void 0:f.length)===0)return;const l=(b=(s=e==null?void 0:e.structureIds)==null?void 0:s.filter(a=>(a==null?void 0:a.key)===t))==null?void 0:b.map(a=>a==null?void 0:a.id);let u=l==null?void 0:l.map(a=>{if(a)return y.getInsofDataApi({id:a})});const n=await Promise.all(u),c=n==null?void 0:n.every(a=>{var i;return((i=a==null?void 0:a.data)==null?void 0:i.code)===200});if(console.log("getTriggerStructures2",e==null?void 0:e.structureIds,t,n),c&&(n==null?void 0:n.length)>0){const a=n==null?void 0:n.map(i=>{var M,D,N,P,A,o,B;return{id:(N=(D=(M=i==null?void 0:i.data)==null?void 0:M.result)==null?void 0:D[0])==null?void 0:N.id,...(B=(o=(A=(P=i==null?void 0:i.data)==null?void 0:P.result)==null?void 0:A[0])==null?void 0:o.value)==null?void 0:B.pageData}});E.setItemData(a),I.setCacheStructures({key:t,data:a})}},Te=async e=>{var n,c,r,p,f;const t=e==="操作触发的弹窗结构"?"dialogConfig":"contentConfig";I.setButtonTriggerType(t),await ke(C.value,t);let l;(n=T.value)!=null&&n.subMenus&&((c=T.value)==null?void 0:c.subMenus.length)>0&&(l=(r=U.value)==null?void 0:r.map(s=>({value:s})),l.unshift({value:(p=C.value)==null?void 0:p.title}));let u;g.type==="create"?u={...T.value,path:(f=h.value)==null?void 0:f.path}:g.type==="update"&&(u=x.value),await I.setConfigMenu(u),m.setSelectTitle(l),E.setIsEdit("edit")},K=async e=>{var l,u,n,c,r,p;const t=await y.getInsofDataApi({key:{type:"menuConfigData",systemKey:sessionStorage.getItem("systemKey"),pageKey:_.value+"/"+(e==null?void 0:e.path),tableId:""}});((l=t==null?void 0:t.data)==null?void 0:l.code)===200&&(u=t.data)!=null&&u.result&&(j.value=((c=(n=t.data)==null?void 0:n.result)==null?void 0:c.length)>0?(p=(r=t.data)==null?void 0:r.result)==null?void 0:p.map(f=>{var s;return{id:f==null?void 0:f.id,...(s=f==null?void 0:f.value)==null?void 0:s.tableData}}):[]),$.value=!1},H=async(e,t,l="contentConfig")=>{var u,n,c,r,p,f;try{let s,b;t==="create"?(s={key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:_.value+"/"+((u=h.value)==null?void 0:u.path),type:"structure",rootNodePath:(c=(n=h.value)==null?void 0:n.rootNode)==null?void 0:c.path,structureBelong:l,parentTable:"",version:1},value:{pageData:e}},b=y.createInsofDataApi):t==="update"?(s={id:e==null?void 0:e.id,value:{pageData:e}},b=y.updateInsofDataApi):t==="delete"&&(s={id:e},b=y.deleteInsofDataApi);const a=await b(s);if(((r=a==null?void 0:a.data)==null?void 0:r.code)!==200)throw y.ElMessage.error("保存响应失败"),new Error("保存响应失败");const i=t==="create"?(p=a==null?void 0:a.data)==null?void 0:p.result:e==null?void 0:e.id;return{status:((f=a==null?void 0:a.data)==null?void 0:f.code)===200,data:{id:i,key:l}}}catch{y.ElMessage.error("保存响应失败")}},Y=(e,t)=>{var f,s,b;const l=(f=e==null?void 0:e.flatMap(a=>a==null?void 0:a.data))==null?void 0:f.map(a=>a==null?void 0:a.id),u=t.filter(a=>!(l!=null&&l.includes(a))),n=l==null?void 0:l.filter(a=>!t.includes(a));let c=null,r=null,p=null;return c=[...u,...n].filter(a=>a),r=(s=e==null?void 0:e.flatMap(a=>a==null?void 0:a.data))==null?void 0:s.filter(a=>!(a!=null&&a.id)),p=(b=e==null?void 0:e.flatMap(a=>a==null?void 0:a.data))==null?void 0:b.filter(a=>a==null?void 0:a.id).filter(a=>Object.keys(a).length>1),{deleteIds:c,createComps:r,updateComps:p}},Z=(e,t)=>{var u,n,c,r,p,f;let l=[];return((u=t==null?void 0:t.deleteIds)==null?void 0:u.length)>0&&((n=t==null?void 0:t.deleteIds)==null||n.forEach(s=>{l.push(H(s,"delete",e))})),((c=t==null?void 0:t.createComps)==null?void 0:c.length)>0&&((r=t==null?void 0:t.createComps)==null||r.forEach(s=>{l.push(H(s,"create",e))})),((p=t==null?void 0:t.updateComps)==null?void 0:p.length)>0&&((f=t==null?void 0:t.updateComps)==null||f.forEach(s=>{s!=null&&s.id&&l.push(H(s,"update",e))})),l},Me=e=>{const t=new Map;return e.forEach(l=>{t.set(l.id,l)}),Array.from(t.values())},De=async(e,t)=>{var l,u,n,c,r,p,f;try{const s=e==null?void 0:e.filter(o=>(o==null?void 0:o.key)==="contentConfig"),b=e==null?void 0:e.filter(o=>(o==null?void 0:o.key)==="dialogConfig");await d.nextTick();const a=(n=(u=(l=F.value)==null?void 0:l.filter(o=>(o==null?void 0:o.key)==="dialogConfig"))==null?void 0:u.flatMap(o=>o==null?void 0:o.data))==null?void 0:n.map(o=>o==null?void 0:o.id);let i=(p=(r=(c=F.value)==null?void 0:c.filter(o=>(o==null?void 0:o.key)==="contentConfig"))==null?void 0:r.flatMap(o=>o==null?void 0:o.data))==null?void 0:p.map(o=>o==null?void 0:o.id);i=[...i,...(f=ae.value)==null?void 0:f.map(o=>o==null?void 0:o.id)];const M=Y(b,a),D=Y(s,i),N=Z("dialogConfig",M),P=Z("contentConfig",D),A=[...N,...P];await Promise.all(A).then(o=>{var z,G,L,V,Q,W,X;if(!(o==null?void 0:o.every(v=>v.status)))return;let w=(z=o==null?void 0:o.flatMap(v=>v==null?void 0:v.data))==null?void 0:z.filter(v=>(v==null?void 0:v.id)!==null&&(v==null?void 0:v.id)!==void 0);if(((G=M==null?void 0:M.updateComps)==null?void 0:G.length)===0&&g.type==="update"){const v=(V=(L=C.value)==null?void 0:L.structureIds)==null?void 0:V.filter(S=>(S==null?void 0:S.key)==="dialogConfig");w=[...w,...v]}if(((Q=D==null?void 0:D.updateComps)==null?void 0:Q.length)===0&&g.type==="update"){const v=(X=(W=C.value)==null?void 0:W.structureIds)==null?void 0:X.filter(S=>(S==null?void 0:S.key)==="contentConfig");w=[...w,...v]}const ce=Me(w);re({...t,isNotInitial:!0,structureIds:ce},g.type)}).catch(o=>{y.ElMessage.error(o)})}catch(s){throw y.ElMessage.error(s),new Error(s)}},re=async(e,t)=>{var n,c;let l,u;t==="create"?(l={key:{type:"menuConfigData",systemKey:sessionStorage.getItem("systemKey"),pageKey:_.value+"/"+((n=h.value)==null?void 0:n.path),tableId:"",rootNodePath:e==null?void 0:e.rootNodePath},value:{tableData:e}},u=y.createInsofDataApi):t==="update"?(l={id:e==null?void 0:e.id,value:{tableData:e}},u=y.updateInsofDataApi):t==="delete"&&(l={ids:[e.id,...(c=e==null?void 0:e.structureIds)==null?void 0:c.map(r=>r.id)]},u=y.batchDeleteInsofDataApi),fe.handleSubmitAsync(u,l,t).then(r=>{t==="create"&&j.value.push({...e,id:r}),t&&r&&y.ElMessage.success("响应成功"),K(h.value)})},Se=async()=>{var l,u,n,c,r;const e=JSON.parse(k.cloneDeep(JSON.stringify(F.value)));await d.nextTick();const t=g.type==="create"?{...x.value,rootNodePath:(u=(l=h.value)==null?void 0:l.rootNode)==null?void 0:u.path}:{...x.value,rootNodePath:(c=(n=h.value)==null?void 0:n.rootNode)==null?void 0:c.path,id:(r=C.value)==null?void 0:r.id};await De(e,t),T.value={},g.show=!1,await K(h.value)},we=()=>{g.show=!1},se={comp:"Group",name:"/平台管理/菜单管理",compData:[{key:"groupContents",contents:[{comp:"Table",compData:te.value,name:""}]}]},Ne=Object.freeze(Object.defineProperty({__proto__:null,beforeDialogDestroy:we,buttonValue:ge,changeTrigger:Ce,changedRow:de,clickNodeTrigger:ye,clickRowButton:he,clickSubmitForm:Se,clickTrigger:Te,dialogInfo:g,formatFormData:O,getInitialSubStructure:ne,getTableDataAsync:K,handleItemDataChange:ve,inputForm:T,menuPageData:ie,operatingForm:Ie,pageData:te,renderFormData:J,tableLoading:$,tempMenuPageData:se,treeData:oe},Symbol.toStringTag,{value:"Module"}));exports.State=Ne;exports.tempMenuPageData=se;
|
|
1
|
+
"use strict";const d=require("vue"),k=require("./login-DoVI1BJb.cjs"),pe=require("./index-DOn8yEZJ.cjs"),fe=require("./index-CLaUio0q.cjs"),y=require("./index-BKUqLOwQ.cjs"),E=k.useModelComp(k.pinia),m=pe.useUnit(k.pinia),I=k.useMenuState(k.pinia),{menus:ee,configMenu:x,activeMenuPath:_,cacheStructures:F}=k.storeToRefs(I),$=d.ref(!1),te=d.computed(()=>{var e,t;return[{key:"extraButton",contents:[]},{key:"rowButton",contents:[{label:"修改"}]},{key:"header",contents:[{label:"菜单名称",prop:"title",isFormColHidden:!1},{label:"菜单类型",prop:"menuType",formType:"select",options:[{label:"系统菜单",value:"集团"},{label:"公司",value:"公司"}],isTableColHidden:!1,isFormColHidden:!0},{label:"操作"}]},{key:"tableContents",contents:(t=(e=k.cloneDeep(ee.value))==null?void 0:e.map(l=>({...l,menuType:"系统菜单"})))==null?void 0:t.filter(l=>l.title!=="系统管理"&&l.title!=="平台管理")}]}),j=d.ref([]),R=d.ref([{label:"新建"}]),ie=d.computed(()=>[{key:"extraButton",contents:R.value},{key:"rowButton",contents:[{label:"修改"},{label:"删除"}]},{key:"header",contents:[{label:"操作类型",prop:"operateType",formType:"select",options:[{label:"新增",value:"新增"},{label:"编辑",value:"编辑"},{label:"删除",value:"删除"}],value:""},{label:"操作图标",prop:"operateIcon",formType:"inputPopover",value:""},{label:"操作触发事件",prop:"trigger",formType:"select",options:[{label:"弹出弹窗",value:"openDialog"}],value:"openDialog"},{label:"配置一:",prop:"dialogConfig",formType:"button",value:"弹窗内容",isTableColHidden:!0},{label:"配置二:",prop:"contentConfig",formType:"button",value:"模块内容",isTableColHidden:!0},{label:"继承配置:",prop:"allowInherit",formType:"radio",contents:[{label:"是",value:!0},{label:"否",value:!1}],value:!1,isTableColHidden:!0},{label:"操作"}]},{key:"tableContents",contents:j.value}]),J=d.ref([]),T=d.ref({}),de=d.ref({}),q=d.ref([{label:"菜单",prop:"path",isFormColHidden:!0,value:""},{label:"操作类型:",prop:"operateType",type:"select",contents:[{label:"新增",value:"新增"},{label:"编辑",value:"编辑"},{label:"删除",value:"删除"}],value:""},{label:"操作图标:",prop:"operateIcon",type:"inputPopover",value:""},{label:"操作触发事件:",prop:"trigger",type:"select",contents:[{label:"弹出弹窗",value:"openDialog"}],value:"openDialog"},{label:"生成的菜单图标:",prop:"menuIcon",type:"inputPopover",value:""},{label:"配置一:",prop:"dialogConfig",type:"button",value:"操作触发的弹窗结构"},{label:"配置二:",prop:"contentConfig",type:"button",value:"操作生成的模块结构",isFormColHidden:!1},{label:"",prop:"structureIds",type:"input",value:[],isFormColHidden:!0},{label:"继承配置:",prop:"allowInherit",type:"radio",contents:[{label:"是",value:!0},{label:"否",value:!1}],value:!0}]),O=e=>{var t;J.value=e?(t=q.value)==null?void 0:t.map(l=>l.prop==="dialogConfig"||l.prop==="contentConfig"||l.prop==="trigger"?l:{...l,value:e?e[l==null?void 0:l.prop]:""}):q.value},ge=d.ref([{label:"查询"},{label:"重置"}]),ve=async()=>{},le=e=>e.map(t=>t.childMenus&&t.childMenus.length>0?{...t,value:t==null?void 0:t.title,label:t==null?void 0:t.title,children:le(t.childMenus)}:{...t,value:t==null?void 0:t.title,label:t==null?void 0:t.title}),g=d.reactive({show:!1,title:"菜单配置",width:"30%",type:"create"}),U=d.ref([]),C=d.ref({}),h=d.ref(null),ae=d.ref([]),oe=d.computed(()=>{var e;return(e=le(ee.value))==null?void 0:e.filter(t=>t.title!=="系统管理"&&t.title!=="平台管理")}),ne=async e=>{var l,u,n,c;const t=await y.getInsofDataApi({key:{type:"subStructure",systemKey:sessionStorage.getItem("systemKey"),pageKey:e,version:1}});if(((l=t==null?void 0:t.data)==null?void 0:l.code)===200&&(u=t.data)!=null&&u.result){const r=(c=(n=t.data)==null?void 0:n.result)==null?void 0:c.map(p=>{var f;return{id:p==null?void 0:p.id,...(f=p==null?void 0:p.value)==null?void 0:f.pageData}});ae.value=r,I.setCacheStructures({key:"contentConfig",data:r})}},ye=async e=>{var t;$.value=!0,h.value={...e,rootNode:k.findRootNodeByPath(oe.value,e.path)},I.setCacheStructures(null),(e==null?void 0:e.level)===0?R.value.splice(0):(R.value=[{label:"新建"}],U.value=(t=e==null?void 0:e.path)==null?void 0:t.split("/")),await I.setConfigMenu(null),await ne(e==null?void 0:e.path),await K(e)},be=e=>{switch(e){case"新建":return"create";case"修改":return"update";case"删除":return"delete"}},he=async(e,t)=>{var l,u;if(!h.value)return y.ElMessage.warning("请先选择菜单");if(g.type=be(e),U.value=[],E.setSubmitCurStructure(!1),m.setSelectTitle([]),C.value=k.cloneDeep(t),g.type!=="delete"){switch(g.type){case"create":O(null),await I.setConfigMenu(null);break;case"update":O(C.value),await I.setConfigMenu(C.value),console.log("clickRowButton",C.value);break}await d.nextTick(),g.title=`【${g.type==="create"?(l=h.value)==null?void 0:l.path:(u=C.value)==null?void 0:u.path}】菜单配置${e}`,g.show=!0}else await re(C.value,g.type)},ue=d.ref(!0),Ce=async e=>{var t;T.value=e,await I.setConfigMenu({...T.value,path:(t=h.value)==null?void 0:t.path}),ue.value=(e==null?void 0:e.operateType)!=="新增"};d.watch(()=>ue.value,async e=>{var t;await d.nextTick(),J.value=(t=q.value)==null?void 0:t.map(l=>l.prop==="dialogConfig"||l.prop==="contentConfig"||l.prop==="trigger"?l.prop==="contentConfig"?{...l,isFormColHidden:e}:l:{...l,value:T.value?T.value[l==null?void 0:l.prop]:""})},{immediate:!0,deep:!0});const Ie=d.ref(null),ke=async(e,t)=>{var r,p,f,s,b;if(g.type==="create"){const a=(p=(r=F.value)==null?void 0:r.filter(i=>(i==null?void 0:i.key)===t))==null?void 0:p.flatMap(i=>i==null?void 0:i.data);E.setItemData(a),I.setCacheStructures({key:t,data:a})}if(console.log("getTriggerStructures1",e==null?void 0:e.structureIds,t),!(e!=null&&e.structureIds)||((f=e==null?void 0:e.structureIds)==null?void 0:f.length)===0)return;const l=(b=(s=e==null?void 0:e.structureIds)==null?void 0:s.filter(a=>(a==null?void 0:a.key)===t))==null?void 0:b.map(a=>a==null?void 0:a.id);let u=l==null?void 0:l.map(a=>{if(a)return y.getInsofDataApi({id:a})});const n=await Promise.all(u),c=n==null?void 0:n.every(a=>{var i;return((i=a==null?void 0:a.data)==null?void 0:i.code)===200});if(console.log("getTriggerStructures2",e==null?void 0:e.structureIds,t,n),c&&(n==null?void 0:n.length)>0){const a=n==null?void 0:n.map(i=>{var M,D,N,P,A,o,B;return{id:(N=(D=(M=i==null?void 0:i.data)==null?void 0:M.result)==null?void 0:D[0])==null?void 0:N.id,...(B=(o=(A=(P=i==null?void 0:i.data)==null?void 0:P.result)==null?void 0:A[0])==null?void 0:o.value)==null?void 0:B.pageData}});E.setItemData(a),I.setCacheStructures({key:t,data:a})}},Te=async e=>{var n,c,r,p,f;const t=e==="操作触发的弹窗结构"?"dialogConfig":"contentConfig";I.setButtonTriggerType(t),await ke(C.value,t);let l;(n=T.value)!=null&&n.subMenus&&((c=T.value)==null?void 0:c.subMenus.length)>0&&(l=(r=U.value)==null?void 0:r.map(s=>({value:s})),l.unshift({value:(p=C.value)==null?void 0:p.title}));let u;g.type==="create"?u={...T.value,path:(f=h.value)==null?void 0:f.path}:g.type==="update"&&(u=x.value),await I.setConfigMenu(u),m.setSelectTitle(l),E.setIsEdit("edit")},K=async e=>{var l,u,n,c,r,p;const t=await y.getInsofDataApi({key:{type:"menuConfigData",systemKey:sessionStorage.getItem("systemKey"),pageKey:_.value+"/"+(e==null?void 0:e.path),tableId:""}});((l=t==null?void 0:t.data)==null?void 0:l.code)===200&&(u=t.data)!=null&&u.result&&(j.value=((c=(n=t.data)==null?void 0:n.result)==null?void 0:c.length)>0?(p=(r=t.data)==null?void 0:r.result)==null?void 0:p.map(f=>{var s;return{id:f==null?void 0:f.id,...(s=f==null?void 0:f.value)==null?void 0:s.tableData}}):[]),$.value=!1},H=async(e,t,l="contentConfig")=>{var u,n,c,r,p,f;try{let s,b;t==="create"?(s={key:{systemKey:sessionStorage.getItem("systemKey"),pageKey:_.value+"/"+((u=h.value)==null?void 0:u.path),type:"structure",rootNodePath:(c=(n=h.value)==null?void 0:n.rootNode)==null?void 0:c.path,structureBelong:l,parentTable:"",version:1},value:{pageData:e}},b=y.createInsofDataApi):t==="update"?(s={id:e==null?void 0:e.id,value:{pageData:e}},b=y.updateInsofDataApi):t==="delete"&&(s={id:e},b=y.deleteInsofDataApi);const a=await b(s);if(((r=a==null?void 0:a.data)==null?void 0:r.code)!==200)throw y.ElMessage.error("保存响应失败"),new Error("保存响应失败");const i=t==="create"?(p=a==null?void 0:a.data)==null?void 0:p.result:e==null?void 0:e.id;return{status:((f=a==null?void 0:a.data)==null?void 0:f.code)===200,data:{id:i,key:l}}}catch{y.ElMessage.error("保存响应失败")}},Y=(e,t)=>{var f,s,b;const l=(f=e==null?void 0:e.flatMap(a=>a==null?void 0:a.data))==null?void 0:f.map(a=>a==null?void 0:a.id),u=t.filter(a=>!(l!=null&&l.includes(a))),n=l==null?void 0:l.filter(a=>!t.includes(a));let c=null,r=null,p=null;return c=[...u,...n].filter(a=>a),r=(s=e==null?void 0:e.flatMap(a=>a==null?void 0:a.data))==null?void 0:s.filter(a=>!(a!=null&&a.id)),p=(b=e==null?void 0:e.flatMap(a=>a==null?void 0:a.data))==null?void 0:b.filter(a=>a==null?void 0:a.id).filter(a=>Object.keys(a).length>1),{deleteIds:c,createComps:r,updateComps:p}},Z=(e,t)=>{var u,n,c,r,p,f;let l=[];return((u=t==null?void 0:t.deleteIds)==null?void 0:u.length)>0&&((n=t==null?void 0:t.deleteIds)==null||n.forEach(s=>{l.push(H(s,"delete",e))})),((c=t==null?void 0:t.createComps)==null?void 0:c.length)>0&&((r=t==null?void 0:t.createComps)==null||r.forEach(s=>{l.push(H(s,"create",e))})),((p=t==null?void 0:t.updateComps)==null?void 0:p.length)>0&&((f=t==null?void 0:t.updateComps)==null||f.forEach(s=>{s!=null&&s.id&&l.push(H(s,"update",e))})),l},Me=e=>{const t=new Map;return e.forEach(l=>{t.set(l.id,l)}),Array.from(t.values())},De=async(e,t)=>{var l,u,n,c,r,p,f;try{const s=e==null?void 0:e.filter(o=>(o==null?void 0:o.key)==="contentConfig"),b=e==null?void 0:e.filter(o=>(o==null?void 0:o.key)==="dialogConfig");await d.nextTick();const a=(n=(u=(l=F.value)==null?void 0:l.filter(o=>(o==null?void 0:o.key)==="dialogConfig"))==null?void 0:u.flatMap(o=>o==null?void 0:o.data))==null?void 0:n.map(o=>o==null?void 0:o.id);let i=(p=(r=(c=F.value)==null?void 0:c.filter(o=>(o==null?void 0:o.key)==="contentConfig"))==null?void 0:r.flatMap(o=>o==null?void 0:o.data))==null?void 0:p.map(o=>o==null?void 0:o.id);i=[...i,...(f=ae.value)==null?void 0:f.map(o=>o==null?void 0:o.id)];const M=Y(b,a),D=Y(s,i),N=Z("dialogConfig",M),P=Z("contentConfig",D),A=[...N,...P];await Promise.all(A).then(o=>{var z,G,L,V,Q,W,X;if(!(o==null?void 0:o.every(v=>v.status)))return;let w=(z=o==null?void 0:o.flatMap(v=>v==null?void 0:v.data))==null?void 0:z.filter(v=>(v==null?void 0:v.id)!==null&&(v==null?void 0:v.id)!==void 0);if(((G=M==null?void 0:M.updateComps)==null?void 0:G.length)===0&&g.type==="update"){const v=(V=(L=C.value)==null?void 0:L.structureIds)==null?void 0:V.filter(S=>(S==null?void 0:S.key)==="dialogConfig");w=[...w,...v]}if(((Q=D==null?void 0:D.updateComps)==null?void 0:Q.length)===0&&g.type==="update"){const v=(X=(W=C.value)==null?void 0:W.structureIds)==null?void 0:X.filter(S=>(S==null?void 0:S.key)==="contentConfig");w=[...w,...v]}const ce=Me(w);re({...t,isNotInitial:!0,structureIds:ce},g.type)}).catch(o=>{y.ElMessage.error(o)})}catch(s){throw y.ElMessage.error(s),new Error(s)}},re=async(e,t)=>{var n,c;let l,u;t==="create"?(l={key:{type:"menuConfigData",systemKey:sessionStorage.getItem("systemKey"),pageKey:_.value+"/"+((n=h.value)==null?void 0:n.path),tableId:"",rootNodePath:e==null?void 0:e.rootNodePath},value:{tableData:e}},u=y.createInsofDataApi):t==="update"?(l={id:e==null?void 0:e.id,value:{tableData:e}},u=y.updateInsofDataApi):t==="delete"&&(l={ids:[e.id,...(c=e==null?void 0:e.structureIds)==null?void 0:c.map(r=>r.id)]},u=y.batchDeleteInsofDataApi),fe.handleSubmitAsync(u,l,t).then(r=>{t==="create"&&j.value.push({...e,id:r}),t&&r&&y.ElMessage.success("响应成功"),K(h.value)})},Se=async()=>{var l,u,n,c,r;const e=JSON.parse(k.cloneDeep(JSON.stringify(F.value)));await d.nextTick();const t=g.type==="create"?{...x.value,rootNodePath:(u=(l=h.value)==null?void 0:l.rootNode)==null?void 0:u.path}:{...x.value,rootNodePath:(c=(n=h.value)==null?void 0:n.rootNode)==null?void 0:c.path,id:(r=C.value)==null?void 0:r.id};await De(e,t),T.value={},g.show=!1,await K(h.value)},we=()=>{g.show=!1},se={comp:"Group",name:"/平台管理/菜单管理",compData:[{key:"groupContents",contents:[{comp:"Table",compData:te.value,name:""}]}]},Ne=Object.freeze(Object.defineProperty({__proto__:null,beforeDialogDestroy:we,buttonValue:ge,changeTrigger:Ce,changedRow:de,clickNodeTrigger:ye,clickRowButton:he,clickSubmitForm:Se,clickTrigger:Te,dialogInfo:g,formatFormData:O,getInitialSubStructure:ne,getTableDataAsync:K,handleItemDataChange:ve,inputForm:T,menuPageData:ie,operatingForm:Ie,pageData:te,renderFormData:J,tableLoading:$,tempMenuPageData:se,treeData:oe},Symbol.toStringTag,{value:"Module"}));exports.State=Ne;exports.tempMenuPageData=se;
|