2026-06-14 14:05:58 +03:30
|
|
|
import{_ as X}from"./BasicModal.vue_vue_type_style_index_0_lang-c3ae10a6.js";import{_ as K,u as Q}from"./useBaseTable-40588527.js";import{_ as Y}from"./button.vue_vue_type_style_index_0_lang-ffd7bdde.js";import{I as P}from"./Icon-61889149.js";import{t as Z}from"./useDataTime-58f0c0c0.js";import{g as $}from"./convert-67c23be8.js";import{_ as N}from"./TextPreview.vue_vue_type_script_setup_true_lang-49c0f3bd.js";import{_ as D}from"./CustomTag.vue_vue_type_script_setup_true_lang-93e5bf8f.js";import{b as a,d as ee,g as m,r as te,v as ae,l as oe,o as j,c as F,a as _,w as r,e as ne,j as c,E as se,k as le,C as p,G as ie}from"./index-4dc7c6f6.js";import{g as O}from"./index-3ee06b96.js";import{a as re,u as ue,c as ce,d as de}from"./brand-5ee4e94b.js";import{l as pe}from"./lodash-746af23f.js";import{M as me,_ as fe}from"./index-4573c903.js";import{I as _e,_ as ge}from"./index-177aaded.js";import{_ as ve,F as he}from"./index-99e2bbac.js";import{U as be}from"./index-94e20169.js";import{T as E}from"./shallowequal-c81602d9.js";import"./index-286adeb4.js";import"./vnode-88405440.js";import"./Col-21efcdc2.js";import"./_plugin-vue_export-helper-a5e52605.js";import"./fa_IR-06db085c.js";import"./toArray-48ad4c5b.js";import"./FormItemContext-4baae48b.js";import"./pickAttrs-10867317.js";import"./useState-4068a96b.js";import"./index-ebdb1487.js";import"./isPlainObject-8aaa3401.js";import"./useRefs-262e2b68.js";const xe=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:t=>t.index+1},{title:"تصویر ",dataIndex:"image",key:"image",customRender:t=>{const B=$(t.record.image);return a("img",{src:B,width:60},null)}},{title:"عنوان",dataIndex:"title",key:"title"},{title:"توضیحات",dataIndex:"description",key:"description",width:500,customRender:t=>a(N,{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),Ce=_("span",null,"ویرایش",-1),Be={class:"grid grid-cols-3 gap-4"},Ue={key:0},Te=_("div",{style:{"margin-top":"8px"}},"آپلود",-1),nt=ee({__name:"index",setup(t){`${O()||localStorage.getItem("tamin_token")||""}`;const[B,M]=Q(),q=m({columns:xe,api:re,defaultPageLimit:20}),h=m(!1),k=m(!1),w=m(null),V=m([]),b=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=pe.cloneDeep(l);m();const g=m([]);function S(){V.value=[],k.value=!1,w.value=null,h.value=!0}function R(){Object.assign(l,z),g.value=[],h.value=!1}function W(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:x}=s,f=new FormData;f.append("file",e);const C=`${ie}/upload/machartaa-img`;I.value=0,b.value++,await new Promise((U,y)=>{const i=new XMLHttpRequest;i.open("POST",C);const T=O()||localStorage.getItem("tamin_token")||"";i.setRequestHeader("Authorization",`Bearer ${T}`),i.upload.onprogress=o=>{if(o.lengthComputable){const
|