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

2 lines
8.2 KiB
JavaScript
Raw Normal View History

2026-06-01 18:38:29 +03:30
import{_ as K}from"./BasicModal.vue_vue_type_style_index_0_lang-a547157a.js";import{_ as Q,u as Y}from"./useBaseTable-13b436e1.js";import{_ as Z}from"./button.vue_vue_type_style_index_0_lang-851afdd8.js";import{I as P}from"./Icon-04c02c0b.js";import{t as ee}from"./useDataTime-10f46d84.js";import{g as T}from"./convert-c2e7255b.js";import{_ as E}from"./TextPreview.vue_vue_type_script_setup_true_lang-38b465eb.js";import{_ as D}from"./CustomTag.vue_vue_type_script_setup_true_lang-6745f6a1.js";import{b as a,d as te,g as m,r as ae,l as oe,x as ne,n as se,o as j,c as F,a as g,w as r,e as le,j as c,G as ie,k as re,D as p,H as O}from"./index-82b07f49.js";import{g as N}from"./index-e3788657.js";import{a as ue,u as ce,c as de,d as pe}from"./brand-40a5ca82.js";import{M as me,_ as fe}from"./index-5dc3a2fa.js";import{I as _e,_ as ge}from"./index-c6d6dccd.js";import{_ as ve,F as he}from"./index-2a5d6560.js";import{U as xe}from"./index-0f0f5d8d.js";import{T as q}from"./shallowequal-17b27246.js";import"./index-1f61ecf5.js";import"./vnode-007df887.js";import"./Col-5d52aed9.js";import"./_plugin-vue_export-helper-f81f33f1.js";import"./index-7e5faec0.js";import"./toArray-e3bbd719.js";import"./FormItemContext-f4f190fd.js";import"./pickAttrs-b9acd388.js";import"./useState-e0a5bff5.js";import"./index-d634ff29.js";import"./isPlainObject-f3a46277.js";import"./useRefs-e9385981.js";const be=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:t=>t.index+1},{title:"تصویر ",dataIndex:"image",key:"image",customRender:t=>{const C=T(t.record.image);return a("img",{src:C,width:60},null)}},{title:"عنوان",dataIndex:"title",key:"title"},{title:"توضیحات",dataIndex:"description",key:"description",width:500,customRender:t=>a(E,{text:t.record.description},null)},{title:"وضعیت ",dataIndex:"active",key:"active",type:"Boolean",width:100,customRender:t=>a("div",{class:"flex justify-center"},[a(D,{class:"px-3 font-bold py-1",textColor:t!=null&&t.record.active?"#65a30d":"#dc2626",bgColor:t!=null&&t.record.active?"#ecfccb":"#fee2e2"},{default:()=>[t!=null&&t.record.active?"فعال":"غیر فعال"]})])},{title:"وضعیت دسترسی ",dataIndex:"active",key:"active",type:"Boolean",width:150,customRender:t=>a("div",{class:"flex justify-center"},[a(D,{class:"px-3 font-bold py-1",textColor:t!=null&&t.record.public?"#0d6fa3":"#333333",bgColor:t!=null&&t.record.public?"#cbe9fc":"#eaeaea"},{default:()=>[t!=null&&t.record.public?"عمومی":"خصوصی"]})])},{title:"زمان ایجاد",dataIndex:"created_at",key:"created_at",customRender:t=>ee(t.record.created_at)},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center"}],ye={class:"flex justify-between items-center mb-4"},ke=g("h2",null,"برند ها",-1),we={class:"gap-2 flex justify-center"},Ie=g("span",null,"حذف",-1),Be=g("span",null,"ویرایش",-1),Ce={class:"grid grid-cols-3 gap-4"},Ue={key:0},$e=g("div",{style:{"margin-top":"8px"}},"آپلود",-1),ot=te({__name:"index",setup(t){`${N()||localStorage.getItem("tamin_token")||""}`;const[C,M]=Y(),V=m({columns:be,api:ue,defaultPageLimit:20}),h=m(!1),k=m(!1),w=m(null),W=m([]),x=m(0),I=m(0),l=ae({title:"",active:!0,image:void 0,owner_id:void 0,id:void 0,description:void 0,public:void 0});let z=oe.cloneDeep(l);m();const v=m([]);function H(){W.value=[],k.value=!1,w.value=null,h.value=!0}function R(){Object.assign(l,z),v.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 A(s){const{file:e,onSuccess:d,onError:u,onProgress:b}=s,f=new FormData;f.append("file",e);const B=`${O}/upload/machartaa-img`;I.value=0,x.value++,await new Promise((U,y)=>{const i=new XMLHttpRequest;i.open("POST",B);const $=N()||localStorage.getItem("tamin_token")||"";i.setRequestHeader("Authorization",`Bearer ${$}`),i.upload.onprogress=o=>{if(o.lengthComputable){const n=Math.round(o.loaded/o.total*100