Files
machartaa_admin_dist/dist/assets/index-f36da240.js
T

2 lines
8.3 KiB
JavaScript
Raw Normal View History

2026-06-03 16:59:33 +03:30
import{_ as X}from"./BasicModal.vue_vue_type_style_index_0_lang-b6c04ed1.js";import{_ as K,u as Q}from"./useBaseTable-f0604f98.js";import{_ as Y}from"./button.vue_vue_type_style_index_0_lang-9ce24083.js";import{I as $}from"./Icon-03d9588d.js";import{t as Z}from"./useDataTime-0f06f32d.js";import{g as M}from"./convert-67c23be8.js";import{_ as q}from"./TextPreview.vue_vue_type_script_setup_true_lang-c1f6c9a3.js";import{_ as D}from"./CustomTag.vue_vue_type_script_setup_true_lang-5a409c0d.js";import{b as a,d as ee,g as m,r as te,l as ae,x as oe,n as ne,o as j,c as F,a as _,w as r,e as se,j as c,G as le,k as ie,D as p,H as re}from"./index-108817e3.js";import{g as O}from"./index-0f0e7a01.js";import{a as ue,u as ce,c as de,d as pe}from"./category-b18e99b6.js";import{M as me,_ as fe}from"./index-0d047161.js";import{I as _e,_ as ge}from"./index-707b194d.js";import{_ as ve,F as he}from"./index-4f951158.js";import{U as xe}from"./index-7f62fea2.js";import{T as N}from"./shallowequal-105194c4.js";import"./index-f0ba03aa.js";import"./vnode-9b8abbbf.js";import"./Col-b2cbfe37.js";import"./_plugin-vue_export-helper-ec62f026.js";import"./index-802c3c8f.js";import"./toArray-a421612c.js";import"./FormItemContext-cecaca7f.js";import"./pickAttrs-f899bdd0.js";import"./useState-472505a2.js";import"./index-7c9c2b70.js";import"./isPlainObject-a22b8354.js";import"./useRefs-eb5e3b2f.js";const ye=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:e=>e.index+1},{title:"تصویر ",dataIndex:"image",key:"image",width:80,customRender:e=>{const k=M(e.record.image);return k?a("img",{src:k,width:60},null):a($,{icon:"vuesax-linear:category"},null)}},{title:"عنوان",dataIndex:"title",key:"title"},{title:"توضیحات",dataIndex:"description",key:"description",width:500,customRender:e=>a(q,{text:e.record.description},null)},{title:"وضعیت ",dataIndex:"active",key:"active",type:"Boolean",width:150,customRender:e=>a("div",{class:"flex justify-center"},[a(D,{class:"px-3 font-bold py-1",textColor:e!=null&&e.record.active?"#65a30d":"#dc2626",bgColor:e!=null&&e.record.active?"#ecfccb":"#fee2e2"},{default:()=>[e!=null&&e.record.active?"فعال":"غیر فعال"]})])},{title:"وضعیت دسترسی ",dataIndex:"active",key:"active",type:"Boolean",width:150,customRender:e=>a("div",{class:"flex justify-center"},[a(D,{class:"px-3 font-bold py-1",textColor:e!=null&&e.record.public?"#0d6fa3":"#333333",bgColor:e!=null&&e.record.public?"#cbe9fc":"#eaeaea"},{default:()=>[e!=null&&e.record.public?"عمومی":"خصوصی"]})])},{title:"زمان ایجاد",dataIndex:"created_at",key:"created_at",width:80,customRender:e=>e.record.created_at?Z(e.record.created_at):"-"},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center"}],be={class:"flex justify-between items-center mb-4"},ke=_("h2",null,"دسته بندی ها",-1),we={class:"gap-2 flex justify-center"},Ce=_("span",null,"حذف",-1),Ie=_("span",null,"ویرایش",-1),Ue={class:"grid grid-cols-3 gap-4"},Be={key:0},Te=_("div",{style:{"margin-top":"8px"}},"آپلود",-1),ot=ee({__name:"index",setup(e){`${O()||localStorage.getItem("tamin_token")||""}`;const[k,R]=Q(),E=m({columns:ye,api:ue,defaultPageLimit:20}),h=m(!1),w=m(!1),C=m(null),V=m([]),x=m(0),I=m(0),l=te({title:"",active:!0,image:void 0,owner_id:void 0,id:void 0,description:void 0,public:void 0});let z=ae.cloneDeep(l);m();const g=m([]);function H(){V.value=[],w.value=!1,C.value=null,h.value=!0}function L(){Object.assign(l,z),g.value=[],h.value=!1}function S(s){return s.type.startsWith("image/")?s.size/1024/1024<5?!0:(p.error("حجم تصویر باید کمتر از 5MB باشد"),!1):(p.error("فقط فایل‌های تصویری مجاز است"),!1)}async function W(s){const{file:t,onSuccess:d,onError:u,onProgress:y}=s,f=new FormData;f.append("file",t);const U=`${re}/upload/machartaa-img`;I.value=0,x.value++,await new Promise((B,b)=>{const i=new XMLHttpRequest;i.open("POST",U);const T=O()||localStorage.getItem("tamin_token")||"";i.setRequestHeader("Authorization",`Be