智慧教务系统
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.
 
 
 
 
 
 

1 lines
6.2 KiB

import{d as O,v as H,bL as J,l as K,aq as Y,aH as A,r as T,Y as I,f as Q,h as S,c as U,e as a,w as i,a as m,t as u,u as r,i as b,k as s,J as W,m as X,z as Z,M as ee,E as te,aa as oe,ab as ae,O as se,C as le,a9 as ne,P as ie,K as re,L as ce,p as de,g as pe}from"./index-f5d841af.js";/* empty css *//* empty css *//* empty css *//* empty css */import"./el-tooltip-4ed993c7.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{_ as _e}from"./category_default-03996666.js";import{g as me,u as ge,s as ue,t as fe}from"./goods-8145e37b.js";import{_ as he}from"./category-edit.vue_vue_type_style_index_0_lang-ff80de00.js";import{_ as ye}from"./goods-category-spread-popup.vue_vue_type_script_setup_true_lang-51533f96.js";import{S as be}from"./sortable.esm-be94e56d.js";import{_ as ve}from"./_plugin-vue_export-helper-c27b6911.js";/* empty css *//* empty css *//* empty css *//* empty css */import"./index-21a2ccda.js";import"./index.vue_vue_type_style_index_0_lang-7d665fb9.js";import"./attachment-740d9717.js";import"./index.vue_vue_type_script_setup_true_lang-f45dcca3.js";import"./el-form-item-4ed993c7.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./index.vue_vue_type_script_setup_true_lang-1f394a8b.js";/* empty css */import"./index.vue_vue_type_script_setup_true_lang-30796a48.js";import"./sys-4eb1a831.js";import"./browser-a1ac24ac.js";const B=v=>(de("data-v-cfa7eab1"),v=v(),pe(),v),Ce={class:"main-container"},we={class:"flex justify-between items-center mb-[5px]"},xe={class:"text-page-title"},ke={class:"mt-[10px]"},Ee=B(()=>m("i",{class:"order-0 iconfont icontuodong vues-rank mr-[8px]"},null,-1)),Te={class:"order-2"},Ie={class:"h-[30px]"},Re=B(()=>m("div",{class:"image-slot"},[m("img",{class:"w-[30px] h-[30px]",src:_e})],-1)),De=O({__name:"category",setup(v){const $=H().meta.title,R=J(),l=K({loading:!0,data:[]});Y(()=>{A(()=>{L()}),C()});const _=T([]),L=()=>{const e=R.value.$el.querySelector(".el-table__body-wrapper tbody");be.create(e,{handle:".vues-rank",animation:300,onMove:({dragged:n,related:c})=>{const d=_.value[n.rowIndex],g=_.value[c.rowIndex];if(d.pid!==g.pid)return!1},onStart:()=>{_.value=N(I(l.data))},onEnd:n=>{var w;const c=_.value[n.oldIndex],d=_.value[n.newIndex];if(n.oldIndex===n.newIndex||c.pid!==d.pid||_.value.indexOf(c)<0)return!1;const t=_.value.splice(n.oldIndex,1)[0];_.value.splice(n.newIndex,0,t);const x=d.pid,k=(w=_.value.filter(p=>p.pid===x))==null?void 0:w.map((p,h)=>{if(p.level===1&&p.category_id===t.category_id&&(l.data=l.data.filter(o=>o.category_id!==t.category_id),l.data.splice(h,0,t)),p.level===2&&p.category_id===t.category_id){const o=l.data.findIndex(E=>E.category_id===p.pid),y=I(l.data[o].child_list.filter(E=>E.category_id!==t.category_id));l.data[o].child_list=[],l.data[o].child_list.push(...y),l.data[o].child_list.splice(h,0,t)}return{category_id:p.category_id,sort:9999-h}});M({category_sort_array:k})}})},N=(e,n="child_list")=>{const c=[],d=g=>{g&&g.length>0&&g.filter(t=>t).forEach(t=>{c.push(t),d(t[n]||[])})};return d(e),c},C=()=>{l.loading=!0,me().then(e=>{l.loading=!1,l.data=e.data}).catch(()=>{l.loading=!1})},M=e=>{ge(e).then(n=>{C()})},P=e=>{e.is_show=e.is_show===1?2:1;const n=I(e);delete n.child_list,ue(n)},f=T(null),j=()=>{f.value.setFormData(),f.value.showDialog=!0},F=e=>{f.value.setFormData(e),f.value.showDialog=!0},G=e=>{ee.confirm(!e.child_list||!e.child_list.length?s("categoryDeleteTips"):s("categoryDeleteTips1"),s("warning"),{confirmButtonText:s("confirm"),cancelButtonText:s("cancel"),type:"warning"}).then(()=>{fe(e.category_id).then(()=>{C()}).catch(()=>{})})},D=T(null),V=e=>{D.value.show(e)},q=Q(),z=e=>{q.push({path:e})};return(e,n)=>{const c=te,d=oe,g=ae,t=se,x=le,k=ne,w=ie,p=re,h=ce;return S(),U("div",Ce,[a(p,{class:"box-card !border-none",shadow:"never"},{default:i(()=>[m("div",we,[m("span",xe,u(r($)),1),a(c,{type:"primary",onClick:j},{default:i(()=>[b(u(r(s)("addCategory")),1)]),_:1})]),a(g,{class:"demo-tabs","model-value":"/shop/goods/category",onTabChange:z},{default:i(()=>[a(d,{label:r(s)("tabGoodsCategory"),name:"/shop/goods/category"},null,8,["label"]),a(d,{label:r(s)("tabGoodsCategoryConfig"),name:"/shop/goods/category/config"},null,8,["label"])]),_:1}),m("div",ke,[W((S(),X(w,{data:l.data,ref_key:"tableRef",ref:R,size:"large","row-key":"category_id","tree-props":{hasChildren:"hasChildren",children:"child_list"}},{empty:i(()=>[m("span",null,u(l.loading?"":r(s)("emptyData")),1)]),default:i(()=>[a(t,{label:r(s)("categoryName"),"min-width":"120"},{default:i(({row:o})=>[Ee,m("span",Te,u(o.category_name),1)]),_:1},8,["label"]),a(t,{label:r(s)("image"),width:"170",align:"left"},{default:i(({row:o})=>[m("div",Ie,[a(x,{class:"w-[30px] h-[30px]",src:r(Z)(o.image),fit:"contain"},{error:i(()=>[Re]),_:2},1032,["src"])])]),_:1},8,["label"]),a(t,{prop:"is_show",label:r(s)("isShow"),width:"400"},{default:i(({row:o})=>[a(k,{class:"cursor-pointer",type:o.is_show!=2?"success":"danger",onClick:y=>P(o)},{default:i(()=>[b(u(o.is_show!=2?"是":"否"),1)]),_:2},1032,["type","onClick"])]),_:1},8,["label"]),a(t,{prop:"sort",label:r(s)("sort"),width:"120"},null,8,["label"]),a(t,{label:r(s)("operation"),fixed:"right",align:"right",width:"200"},{default:i(({row:o})=>[a(c,{type:"primary",link:"",onClick:y=>V(o)},{default:i(()=>[b(u(r(s)("spreadGoodsCategory")),1)]),_:2},1032,["onClick"]),a(c,{type:"primary",link:"",onClick:y=>F(o)},{default:i(()=>[b(u(r(s)("edit")),1)]),_:2},1032,["onClick"]),a(c,{type:"primary",link:"",onClick:y=>G(o)},{default:i(()=>[b(u(r(s)("delete")),1)]),_:2},1032,["onClick"])]),_:1},8,["label"])]),_:1},8,["data"])),[[h,l.loading]])]),a(he,{ref_key:"editCategoryDialog",ref:f,onComplete:C},null,512)]),_:1}),a(ye,{ref_key:"goodsCategorySpreadPopupRef",ref:D},null,512)])}}});const bt=ve(De,[["__scopeId","data-v-cfa7eab1"]]);export{bt as default};