Files
machartaa_admin_dist/dist/assets/index-2d3e654f.js
T

2 lines
8.2 KiB
JavaScript
Raw Normal View History

2026-06-02 20:08:47 +03:30
import{_ as K}from"./BasicModal.vue_vue_type_style_index_0_lang-c60160bb.js";import{_ as Q,u as Y}from"./useBaseTable-c7721a03.js";import{_ as Z}from"./button.vue_vue_type_style_index_0_lang-4dc9d3e9.js";import{I as P}from"./Icon-83dbbbe4.js";import{t as ee}from"./useDataTime-7a9ebe02.js";import{g as T}from"./convert-c2e7255b.js";import{_ as E}from"./TextPreview.vue_vue_type_script_setup_true_lang-d2a051b6.js";import{_ as D}from"./CustomTag.vue_vue_type_script_setup_true_lang-19fd431b.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-9a17e55b.js";import{g as N}from"./index-d0cad351.js";import{a as ue,u as ce,c as de,d as pe}from"./brand-827c9b37.js";import{M as me,_ as fe}from"./index-d5d26f82.js";import{I as _e,_ as ge}from"./index-369204e0.js";import{_ as ve,F as he}from"./index-dad403b6.js";import{U as xe}from"./index-b78b7a1c.js";import{T as q}from"./shallowequal-5f876352.js";import"./index-26298d7e.js";import"./vnode-0a46e202.js";import"./Col-dc7ee55f.js";import"./_plugin-vue_export-helper-09135f79.js";import"./index-4182a454.js";import"./toArray-c5dd79c4.js";import"./FormItemContext-101590b9.js";import"./pickAttrs-0804445f.js";import"./useState-6ac08ff3.js";import"./index-e6e78cc4.js";import"./isPlainObject-7dd54c5e.js";import"./useRefs-707c512d.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