| 1 |
- var y=(D,C,i)=>new Promise((r,m)=>{var b=o=>{try{d(i.next(o))}catch(a){m(a)}},f=o=>{try{d(i.throw(o))}catch(a){m(a)}},d=o=>o.done?r(o.value):Promise.resolve(o.value).then(b,f);d((i=i.apply(D,C)).next())});import{u as P,_ as q}from"./useTable-98d6d579.js";import{_ as Q}from"./FormItem.vue_vue_type_script_lang-39d09a3e.js";import{u as W}from"./index-4f5bc708.js";import{ak as g,au as Y}from"./index.js";import{c as Z,s as j,_ as z}from"./FormModal.vue_vue_type_script_setup_true_lang-16ab2893.js";import{s as G,b as H}from"./sysDictApi-e4a0480c.js";import{l as v}from"./index-a4e1ec38.js";import{d as J,f as R,B as L,a5 as U,q as X,Y as u,Z as ee,l as T,a7 as p,a6 as _,u as t,E as k,$ as B,a9 as S,n as oe}from"./vue-aed314e3.js";import{O as x}from"./antd-f259b82a.js";import"./useForm-c7f42ee0.js";import"./componentMap-175d8229.js";import"./uuid-31b8b5a4.js";import"./useWindowSizeFn-6e9d633b.js";import"./onMountedOrActivated-d9097634.js";import"./sortable.esm-4ae27e0b.js";import"./useFormItem-421691fe.js";import"./useSortable-7d2b6665.js";import"./download-2ecc6b15.js";import"./index-7fe9c1e2.js";import"./copyTextToClipboard-328ee3b1.js";import"./index-6811a03f.js";import"./TextEditor-4892fcd0.js";import"./validate-579cb177.js";const Re=J({__name:"index",emits:["dict-change"],setup(D,{emit:C}){const i=R([]),r=R();L(()=>y(this,null,function*(){const e=yield v({dictCode:"sys_dict_type"});r.value=yield v({dictCode:"sys_disable_type"}),i.value=e||[]}));const{createMessage:m}=Y(),[b,{openModal:f}]=W(),[d,{reload:o,getDataSource:a,getSelectRowKeys:M,setSelectedRowKeys:n}]=P({title:"字典列表",api:G,rowKey:"id",columns:Z,rowSelection:{type:"radio"},clickToRowSelect:!0,formConfig:{labelWidth:120,schemas:j,autoSubmitOnEnter:!0,showAdvancedButton:!1,baseColProps:{span:12},actionColOptions:{span:24},resetButtonOptions:{preIcon:"icon-delete|iconfont"},submitButtonOptions:{preIcon:"icon-search|iconfont"}},showIndexColumn:!1,useSearchForm:!0,showTableSetting:!0,bordered:!0,actionColumn:{auth:["sys:dict:edit","sys:dict:remove"],width:80,title:"操作",dataIndex:"action"},afterFetch:K});function O(){f(!0,{isUpdate:!1})}function F(e){console.log(e),f(!0,{record:e,isUpdate:!0})}function I(e){return y(this,null,function*(){console.log(e),yield H([e.id]),m.success("删除成功!"),yield o();const s=a();s.length>0?n([s[0].id]):n([]),console.log("handleDelete"),l()})}function E(N){return y(this,arguments,function*({isUpdate:e,values:s}){if(console.log(e),console.log(s),yield o(),e)n([s.id]);else{const h=a();h.length>0?n([h[0].id]):n([])}console.log("handleSuccess",e?"update":"create"),l()})}function K(e){e.length>0?n([e[0].id]):n([]),console.log("handleAfterFetch",e),l()}function V(e){console.log("handleRowClick",e),n([e.id]),l()}function $(e){console.log("handleRowDbClick",e),n([e.id]),l()}function A({keys:e,rows:s}){console.log("handleSelectionChange",e,s),l()}function l(){const e=M();console.log(e),C("dict-change",e.length>0?e[0]:"")}return(e,s)=>{const N=U("a-button"),h=X("auth");return u(),ee("div",null,[T(t(q),{onRegister:t(d),onSelectionChange:A,onRowClick:V,onRowDbClick:$},{bodyCell:p(({column:w,record:c})=>[w.key==="disable"?(u(),_(t(x),{key:0,color:t(g)(r.value,c.disable,"fontColor")},{default:p(()=>[k(B(t(g)(r.value,c.disable,"label")),1)]),_:2},1032,["color"])):S("",!0),w.key==="dictType"?(u(),_(t(x),{key:1,color:t(g)(i.value,c.dictType,"fontColor")},{default:p(()=>[k(B(t(g)(i.value,c.dictType,"label")),1)]),_:2},1032,["color"])):S("",!0),w.key==="action"?(u(),_(t(Q),{key:2,actions:[{auth:["sys:dict:edit"],icon:"icon-edit|iconfont",tooltip:"编辑",onClick:F.bind(null,c)},{auth:["sys:dict:remove"],icon:"icon-delete|iconfont",tooltip:"删除",color:"error",popConfirm:{title:"是否确认删除",confirm:I.bind(null,c)}}]},null,8,["actions"])):S("",!0)]),toolbar:p(()=>[oe((u(),_(N,{type:"primary",onClick:O,preIcon:"icon-plus|iconfont"},{default:p(()=>[k("新增")]),_:1})),[[h,["sys:dict:add"]]])]),_:1},8,["onRegister"]),T(z,{onRegister:t(b),onSuccess:E},null,8,["onRegister"])])}}});export{Re as default};
|