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

2 lines
8.1 KiB
JavaScript
Raw Normal View History

2026-06-03 19:51:45 +03:30
import{_ as X}from"./BasicModal.vue_vue_type_style_index_0_lang-078ddd77.js";import{_ as K,u as Q}from"./useBaseTable-e905173e.js";import{_ as Y}from"./button.vue_vue_type_style_index_0_lang-147050b5.js";import{I as P}from"./Icon-e19b6c6c.js";import{t as Z}from"./useDataTime-2f3b2841.js";import{g as $}from"./convert-67c23be8.js";import{_ as q}from"./TextPreview.vue_vue_type_script_setup_true_lang-b411baa3.js";import{_ as D}from"./CustomTag.vue_vue_type_script_setup_true_lang-b3ac33a2.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-c6a4e685.js";import{g as O}from"./index-48b33845.js";import{a as ue,u as ce,c as de,d as pe}from"./brand-8fd1c7be.js";import{M as me,_ as fe}from"./index-334d46a3.js";import{I as _e,_ as ge}from"./index-4608391b.js";import{_ as ve,F as he}from"./index-e3fdf3f3.js";import{U as xe}from"./index-cb3f2111.js";import{T as N}from"./shallowequal-ee0267e4.js";import"./index-d3f71215.js";import"./vnode-977fe706.js";import"./Col-8b3564ce.js";import"./_plugin-vue_export-helper-58b6e008.js";import"./index-03a51284.js";import"./toArray-5f8c3051.js";import"./FormItemContext-6df15dff.js";import"./pickAttrs-e8130b6d.js";import"./useState-08abbf84.js";import"./index-633a27e5.js";import"./isPlainObject-a663ca44.js";import"./useRefs-63b38e0f.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.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(q,{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=>Z(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=_("h2",null,"برند ها",-1),we={class:"gap-2 flex justify-center"},Ie=_("span",null,"حذف",-1),Be=_("span",null,"ویرایش",-1),Ce={class:"grid grid-cols-3 gap-4"},Ue={key:0},Te=_("div",{style:{"margin-top":"8px"}},"آپلود",-1),ot=ee({__name:"index",setup(t){`${O()||localStorage.getItem("tamin_token")||""}`;const[C,M]=Q(),E=m({columns:be,api:ue,defaultPageLimit:20}),h=m(!1),k=m(!1),w=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=[],k.value=!1,w.value=null,h.value=!0}function R(){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:e,onSuccess:d,onError:u,onProgress:b}=s,f=new FormData;f.append("file",e);const B=`${re}/upload/machartaa-img`;I.value=0,x.value++,await new Promise((U,y)=>{const i=new XMLHttpRequest;i.open("POST",B);const T=O()||localStorage.getItem("tamin_token")||"";i.setRequestHeader("Authorization",`Bearer ${T}`),i.upload.onprogress=o=>{if(o.lengthComputable){const n=Math.round(o.loaded/o.total*100