unis_crm/frontend1/dist/assets/index-D2xu8y6V.js

2 lines
9.0 KiB
JavaScript
Raw Normal View History

2026-04-13 01:35:05 +00:00
import{u as ne,G as oe,r as c,j as e,z as p,B as d,H as me,U as z,V as F,I as R,bG as L,T as pe,J as ue,bH as $,K,W as xe,M as ye,s as f}from"./index-D2cxrzyv.js";import{u as he,f as fe,a as je,d as Ie,b as Te,c as we,e as be,g as ge,h as Ce}from"./useDict-BN4y0n-Y.js";import{P as Ne}from"./index-DICUnuN_.js";import{g as ve}from"./pagination-m5F4NDQi.js";import{F as r}from"./index-KuslyOWx.js";import{R as Se,C as O}from"./row-C5EMotZ4.js";import{C as q}from"./index-BFDbUxK1.js";import{I as o}from"./index-4zw5l6IX.js";import{F as A}from"./Table-BLvbgkX9.js";import{P as H}from"./index-Dv-9vGc2.js";import{T as Ee}from"./index-C8Xnkbw4.js";import"./useForm-CaItC8xb.js";import"./iconUtil-CAY5Il88.js";import"./index-COTHVrjr.js";import"./index-Iw46KAPi.js";import"./Pagination-lXX40XmA.js";const{Text:ke}=pe;function Me(){const{t}=ne(),{can:m}=oe(),{items:N}=he("sys_common_status"),[B,G]=c.useState([]),[M,v]=c.useState([]),[i,T]=c.useState(null),[J,S]=c.useState(!1),[U,E]=c.useState(!1),[W,Q]=c.useState(0),[n,w]=c.useState({current:1,size:10,typeCode:"",typeName:""}),[b,k]=c.useState(""),[X,u]=c.useState(!1),[j,D]=c.useState(null),[I]=r.useForm(),[Y,x]=c.useState(!1),[g,P]=c.useState(null),[y]=r.useForm(),h=c.useCallback(async(s=n)=>{var a;S(!0);try{const l=await fe(s);if(G(l.records||[]),Q(l.total||0),(a=l.records)!=null&&a.length&&!i)T(l.records[0]);else if(i){const _=l.records.find(de=>de.dictTypeId===i.dictTypeId);_&&T(_)}}finally{S(!1)}},[i,n]),C=async s=>{E(!0);try{const a=await je(s);v(a||[])}finally{E(!1)}};c.useEffect(()=>{h()},[n.current,n.size]),c.useEffect(()=>{i?C(i.typeCode):v([])},[i]);const Z=()=>{D(null),I.resetFields(),u(!0)},ee=s=>{D(s),I.setFieldsValue(s),u(!0)},te=async s=>{await Ie(s),f.success(t("common.success")),h()},se=async()=>{const s=await I.validateFields();j?await Te(j.dictTypeId,s):await we(s),f.success(t("common.success")),u(!1),h()},V=s=>{const a={...n,current:1,typeName:s};w(a),h(a)},ae=()=>{k("");const s={...n,current:1,typeName:""};w(s),h(s)},ie=()=>{if(!i){f.warning(t("dicts.selectType"));return}P(null),y.resetFields(),y.setFieldsValue({typeCode:i.typeCode,sortOrder:0,status:1}),x(!0)},le=s=>{P(s),y.setFieldsValue(s),x(!0)},ce=async s=>{await be(s),f.success(t("common.success")),i&&C(i.typeCode)},re=async()=>{const s=await y.validateFields();g?await ge(g.dictItemId,s):await Ce(s),f.success(t("common.success")),x(!1),i&&C(i.typeCode)};return e.jsxs("div",{className:"app-page dictionaries-page",children:[e.jsx(Ne,{title:t("dicts.title"),subtitle:t("dicts.subtitle")}),e.jsxs(Se,{gutter:24,className:"flex-1 min-h-0 overflow-hidden",children:[e.jsx(O,{span:8,className:"h-full flex flex-col overflow-hidden",children:e.jsxs(q,{title:e.jsxs(p,{children:[e.jsx(L,{"aria-hidden":"true"}),e.jsx("span",{children:t("dicts.dictType")})]}),className:"app-page__panel-card flex-1 flex flex-col overflow-hidden",styles:{body:{padding:"12px",flex:1,display:"flex",flexDirection:"column",overflow:"hidden"}},extra:m("sys_dict:type:create")&&e.jsx(d,{type:"primary",size:"small",icon:e.jsx(R,{"aria-hidden":"true"}),onClick:Z,children:t("common.create")}),children:[e.jsx("div",{style:{marginBottom:12},className:"flex-shrink-0",children:e.jsxs(p.Compact,{style:{width:"100%"},children:[e.jsx(o,{placeholder:t("dictsExt.searchTypes"),allowClear:!0,value:b,onChange:s=>k(s.target.value),onPressEnter:()=>V(b)}),e.jsx(d,{type:"primary",icon:e.jsx(me,{"aria-hidden":"true"}),onClick:()=>V(b),children:t("common.search")}),e.jsx(d,{onClick:ae,children:t("common.reset")})]})}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(A,{rowKey:"dictTypeId",loading:J,dataSource:B,pagination:{...ve(W,n.current,n.size,(s,a)=>w({...n,current:s,size:a})),simple:!0,size:"small",position:["bottomCenter"]},size:"small",showHeader:!1,scroll:{y:"calc(100vh - 480px)"},onRow:s=>({onClick:()=>T(s),className:`cursor-pointer dict-type-row ${(i==null?void 0:i.dictTypeId)===s.dictTypeId?"dict-type-row-selected":""}`}),columns:[{render:(s,a)=>e.jsxs("div",{className:"dict-type-item flex justify-between items-center p-1",children:[e.jsxs("div",{classN