1 |
- var p=(t,e,a)=>new Promise((s,r)=>{var o=i=>{try{c(a.next(i))}catch(d){r(d)}},y=i=>{try{c(a.throw(i))}catch(d){r(d)}},c=i=>i.done?s(i.value):Promise.resolve(i.value).then(o,y);c((a=a.apply(t,e)).next())});import{W as D,f}from"./vue-B5pbXMv7.js";import{a as n,aU as M}from"./entry/index-DJx93RYF-1731481145019.js";import{j as l}from"./antd-CBeLo_oO.js";const O=(t,e="notice")=>n.post({url:"/sys-api/dictionary_detail/list",params:t},{errorMessageMode:e}),v=(t,e="notice")=>n.post({url:"/sys-api/dictionary_detail/create",params:t},{errorMessageMode:e,successMessageMode:e}),J=(t,e="notice")=>n.post({url:"/sys-api/dictionary_detail/update",params:t},{errorMessageMode:e,successMessageMode:e}),_=(t,e="notice")=>n.post({url:"/sys-api/dictionary_detail/delete",params:t},{errorMessageMode:e,successMessageMode:e}),g=(t,e="notice")=>n.get({url:"/sys-api/dict/"+t.name},{errorMessageMode:e}),u=new Map,h=500,A=D({id:"app-dictionary",state:()=>({data:JSON.stringify(Array.from(new Map))}),actions:{getDictionary(t,e=!0){return p(this,null,function*(){const a=new Map(JSON.parse(this.data));if(e&&a.has(t))return a.get(t);{const s=u.get(t);if(s&&Date.now()-s.timestamp<h)return s.promise;const r=this.fetchDictionaryData(t);return u.set(t,{promise:r,timestamp:Date.now()}),setTimeout(()=>{u.delete(t)},500),r}})},fetchDictionaryData(t){return p(this,null,function*(){const e=new Map(JSON.parse(this.data)),a=yield g({name:t});if(a.code===0){const s=f([]);for(let o=0;o<a.data.total;o++)s.value.push({label:a.data.data[o].title,value:a.data.data[o].value});const r={data:s.value};return e.set(t,r),this.data=JSON.stringify(Array.from(e.entries())),r}else return null})},removeDictionary(t){const e=new Map(JSON.parse(this.data));e.has(t)&&e.delete(t),this.data=JSON.stringify(Array.from(e.entries()))},clear(){const t=new Map;this.data=JSON.stringify(Array.from(t.entries()))}},persist:{storage:sessionStorage,key:M}});function C(t,e="已成功复制到剪切板!"){navigator.clipboard.writeText(t).then(function(){e&&l.success(e)},function(a){l.error("复制失败!"+a.message)})}export{J as a,v as b,C as c,_ as d,O as g,A as u};
|