2 lines
8.4 KiB
JavaScript
2 lines
8.4 KiB
JavaScript
import{_ as X}from"./BasicModal.vue_vue_type_style_index_0_lang-e958db4a.js";import{_ as K,u as Q}from"./useBaseTable-89d1aacb.js";import{_ as Y}from"./button.vue_vue_type_style_index_0_lang-191f5704.js";import{I as $}from"./Icon-119151dd.js";import{t as Z}from"./useDataTime-59b033a0.js";import{g as M}from"./convert-67c23be8.js";import{_ as q}from"./TextPreview.vue_vue_type_script_setup_true_lang-1a6b0ce8.js";import{_ as D}from"./CustomTag.vue_vue_type_script_setup_true_lang-5e31a2fa.js";import{b as a,d as ee,g as m,r as te,v as ae,l as oe,o as F,c as j,a as _,w as r,e as le,j as c,G as ie,k as se,D as p,H as ne}from"./index-b83d6d0d.js";import{g as O}from"./index-a547fa3e.js";import{l as re}from"./lodash-47741477.js";import{a as ue,u as ce,c as de,d as pe}from"./category-d1fea0c6.js";import{M as me,_ as fe}from"./index-1cd5c0d2.js";import{I as _e,_ as ge}from"./index-c1e4380b.js";import{_ as ve,F as he}from"./index-536c7585.js";import{U as be}from"./index-851e80f2.js";import{T as N}from"./shallowequal-edc0445d.js";import"./index-ff385697.js";import"./vnode-0ebe7df2.js";import"./styleChecker-1135ece5.js";import"./_plugin-vue_export-helper-8145279e.js";import"./fa_IR-a69f9606.js";import"./toArray-2505e2fa.js";import"./FormItemContext-29f2be27.js";import"./pickAttrs-bae23be8.js";import"./useState-cf08b50c.js";import"./index-7b7f3d69.js";import"./isPlainObject-e729189d.js";import"./Col-ab1281bd.js";import"./useRefs-1ac90454.js";const xe=[{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:"public",key:"public",filterField:"public",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"}],ye={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),it=ee({__name:"index",setup(e){`${O()||localStorage.getItem("tamin_token")||""}`;const[k,R]=Q(),E=m({columns:xe,api:ue,defaultPageLimit:20}),h=m(!1),w=m(!1),C=m(null),V=m([]),b=m(0),I=m(0),s=te({title:"",active:!0,image:void 0,owner_id:void 0,id:void 0,description:void 0,public:void 0});let z=re.cloneDeep(s);m();const g=m([]);function H(){V.value=[],w.value=!1,C.value=null,h.value=!0}function L(){Object.assign(s,z),g.value=[],h.value=!1}function S(i){return i.type.startsWith("image/")?i.size/1024/1024<5?!0:(p.error("حجم تصویر باید کمتر از 5MB باشد"),!1):(p.error("فقط فایلهای تصویری مجاز است"),!1)}async function W(i){const{file:t,onSuccess:d,onError:u,onProgress:x}=i,f=new FormData;f.append("file",t);const U=`${ne}/upload/machartaa-img`;I.value=0,b.value++,await new Promise((B,y)=>{const n=new XMLHttpRequest;n.open("POST",U);c
|