mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2025-12-29 01:40:16 +00:00
2 lines
6.5 KiB
JavaScript
2 lines
6.5 KiB
JavaScript
/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./el-tooltip-4ed993c7.js";/* empty css */import"./index-7eafba5f.js";/* empty css *//* empty css *//* empty css */import{_ as A}from"./category_default-9a714445.js";import{t as i}from"./index-0ca94763.js";import{g as O,u as P,i as q,j as z}from"./goods-6a4de1f3.js";import{c as G}from"./common-c3be41fd.js";import{_ as H}from"./category-edit.vue_vue_type_style_index_0_lang-5edb90bd.js";import{u as J}from"./vue-router-48fdc1e3.js";import{S as K}from"./sortable.esm-be94e56d.js";import{F as Q}from"./index-bcd7a424.js";import{c as k}from"./cloneDeep-eeb37e90.js";import{E as U}from"./index-ee5275c6.js";import{E as W}from"./index-c5914bde.js";import{a as X,E as Y}from"./index-fe3867fe.js";import{E as Z}from"./index-888853cf.js";import{E as tt}from"./index-99b65a15.js";import{E as et}from"./index-9ecd3f93.js";import{v as ot}from"./directive-64fb15dc.js";import{d as at,O as rt,r as I,o as it,E as st,e as D,f as nt,y as c,x as n,g as m,B as u,u as p,A as x,M as lt,v as ct,aA as pt,aB as dt}from"./plugin-vue_export-helper-85a4d40b.js";import{_ as mt}from"./_plugin-vue_export-helper-c27b6911.js";import"./index-e513479b.js";import"./el-main-86eb724f.js";import"./index-b9e5f5cb.js";import"./el-overlay-08181e74.js";import"./event-f85d77b0.js";import"./index-313cd2ce.js";import"./index-cf9a2dd7.js";import"./focus-trap-64c402c5.js";import"./index-1ad115d7.js";import"./index-de1d3b53.js";import"./el-form-item-1b16c9fc.js";import"./_baseClone-3dbf39d6.js";/* empty css */import"./index-d469ae66.js";import"./index-e27c3bb0.js";import"./index-4d8f36c6.js";import"./index-ebc73046.js";/* empty css */import"./index-2d04c504.js";import"./index.vue_vue_type_style_index_0_lang-14193028.js";import"./attachment-afdaf51f.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./index-489c18c0.js";import"./index-e1882aa8.js";import"./index-a7e8e96f.js";import"./index-448a4893.js";import"./index-95b00894.js";import"./isEqual-0b9509fd.js";import"./flatten-749195f8.js";import"./index-21f38393.js";import"./index-4601cf3b.js";import"./strings-53351eda.js";import"./debounce-6c3123a6.js";import"./index-bd04154b.js";import"./validator-bcf701e4.js";import"./index-344f0086.js";import"./index-a286aa2a.js";import"./aria-adfa05c5.js";import"./_isIterateeCall-47526406.js";import"./position-37364850.js";const R=y=>(pt("data-v-9a9f2699"),y=y(),dt(),y),_t={class:"main-container"},ut={class:"flex justify-between items-center"},ft={class:"text-[20px]"},gt={class:"mt-[10px]"},ht=R(()=>m("i",{class:"order-0 iconfont icontuodong vues-rank cursor-move mr-[8px]"},null,-1)),yt={class:"order-2"},vt={class:"h-[30px]"},xt=R(()=>m("div",{class:"image-slot"},[m("img",{class:"w-[30px] h-[30px]",src:A})],-1)),wt=at({__name:"category",setup(y){const B=J().meta.title,T=Q(),o=rt({loading:!0,data:[],searchParam:{category_name:""}});I(),it(()=>{st(()=>{S()}),w()});const d=I([]),S=()=>{const e=T.value.$el.querySelector(".el-table__body-wrapper tbody");K.create(e,{handle:".vues-rank",animation:300,onMove:({dragged:a,related:l})=>{const s=d.value[a.rowIndex],_=d.value[l.rowIndex];if(s.pid!==_.pid)return!1},onStart:()=>{d.value=N(k(o.data))},onEnd:a=>{var v;const l=d.value[a.oldIndex],s=d.value[a.newIndex];if(a.oldIndex===a.newIndex||l.pid!==s.pid||d.value.indexOf(l)<0)return!1;const r=d.value.splice(a.oldIndex,1)[0];d.value.splice(a.newIndex,0,r);const b=s.pid,C=(v=d.value.filter(t=>t.pid===b))==null?void 0:v.map((t,f)=>{if(t.level===1&&t.category_id===r.category_id&&(o.data=o.data.filter(g=>g.category_id!==r.category_id),o.data.splice(f,0,r)),t.level===2&&t.category_id===r.category_id){const g=o.data.findIndex(E=>E.category_id===t.pid),V=k(o.data[g].child_list.filter(E=>E.category_id!==r.category_id));o.data[g].child_list=[],o.data[g].child_list.push(...V),o.data[g].child_list.splice(f,0,r)}return{category_id:t.category_id,sort:9999-f}});$({category_sort_array:C})}})},N=(e,a="child_list")=>{const l=[],s=_=>{_&&_.length>0&&_.filter(r=>r).forEach(r=>{l.push(r),s(r[a]||[])})};return s(e),l},w=()=>{o.loading=!0,O({...o.searchParam}).then(e=>{o.loading=!1,o.data=e.data}).catch(()=>{o.loading=!1})},$=e=>{P(e).then(a=>{})},j=e=>{e.is_show=e.is_show===1?2:1;const a=k(e);delete a.child_list,q(a)},h=I(null),F=()=>{h.value.setFormData(),h.value.showDialog=!0},M=e=>{h.value.setFormData(e),h.value.showDialog=!0},L=e=>{U.confirm(!e.child_list||!e.child_list.length?i("categoryDeleteTips"):i("categoryDeleteTips1"),i("warning"),{confirmButtonText:i("confirm"),cancelButtonText:i("cancel"),type:"warning"}).then(()=>{z(e.category_id).then(()=>{w()}).catch(()=>{})})};return(e,a)=>{const l=W,s=X,_=Z,r=tt,b=Y,C=et,v=ot;return D(),nt("div",_t,[c(C,{class:"box-card !border-none",shadow:"never"},{default:n(()=>[m("div",ut,[m("span",ft,u(p(B)),1),c(l,{type:"primary",onClick:F},{default:n(()=>[x(u(p(i)("addCategory")),1)]),_:1})]),m("div",gt,[lt((D(),ct(b,{data:o.data,ref_key:"tableRef",ref:T,size:"large","row-key":"category_id","tree-props":{hasChildren:"hasChildren",children:"child_list"}},{empty:n(()=>[m("span",null,u(o.loading?"":p(i)("emptyData")),1)]),default:n(()=>[c(s,{label:p(i)("categoryName"),"min-width":"120"},{default:n(({row:t})=>[ht,m("span",yt,u(t.category_name),1)]),_:1},8,["label"]),c(s,{label:p(i)("image"),width:"170",align:"left"},{default:n(({row:t})=>[m("div",vt,[c(_,{class:"w-[30px] h-[30px]",src:p(G)(t.image),fit:"contain"},{error:n(()=>[xt]),_:2},1032,["src"])])]),_:1},8,["label"]),c(s,{prop:"is_show",label:p(i)("isShow"),width:"400"},{default:n(({row:t})=>[c(r,{class:"cursor-pointer",type:t.is_show!=2?"success":"danger",onClick:f=>j(t)},{default:n(()=>[x(u(t.is_show!=2?"是":"否"),1)]),_:2},1032,["type","onClick"])]),_:1},8,["label"]),c(s,{label:p(i)("operation"),fixed:"right",align:"right",width:"120"},{default:n(({row:t})=>[c(l,{type:"primary",link:"",onClick:f=>M(t)},{default:n(()=>[x(u(p(i)("edit")),1)]),_:2},1032,["onClick"]),c(l,{type:"primary",link:"",onClick:f=>L(t)},{default:n(()=>[x(u(p(i)("delete")),1)]),_:2},1032,["onClick"])]),_:1},8,["label"])]),_:1},8,["data"])),[[v,o.loading]])]),c(H,{ref_key:"editCategoryDialog",ref:h,onComplete:w},null,512)]),_:1})])}}});const He=mt(wt,[["__scopeId","data-v-9a9f2699"]]);export{He as default};
|