Files
financial_system_frontend/dist/assets/LegalEntities-l2As0eJ2.js
T

2 lines
8.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{d as O,u as P,o as Z,c as s,p as B,q as H,b as e,x as m,y as x,M as q,t as d,e as i,F as K,v as Q,P as N,f as R,r,R as W,B as S,j as o,n as X,A as F,E as D,C as ee,J as te}from"./index-DU2fjqYh.js";import{_ as le,b as M,a as ae}from"./business-config-CDFDGnOE.js";const se={class:"page-content route-list-page prototype-config-page"},oe={class:"card fill-list-card primary-list-card prototype-config-card"},ne={class:"prototype-filter-bar"},ie={class:"prototype-result-count"},de={key:0,class:"prototype-loading"},re={key:1,class:"prototype-error"},ue={key:2,class:"table-wrap",tabindex:"0"},ce={class:"data-table prototype-table"},ve={key:0},pe={key:1},ye={key:2},me={key:3},ge={key:0,"data-label":"主体编码"},be={key:1,"data-label":"主体名称"},_e={key:2,"data-label":"统一社会信用代码"},fe={class:"mono"},Ce={key:3,"data-label":"状态"},ke={"data-label":"操作"},Ee={class:"prototype-row-actions"},he=["onClick"],Ae=["disabled","onClick"],Te={key:3,class:"prototype-empty"},Ve={class:"modal-head","data-dialog-drag-handle":""},Ie=["disabled"],Le={class:"modal-body"},$e={key:0,class:"prototype-form-error",role:"alert"},xe={class:"prototype-form-grid"},Ne={class:"field full"},Se=["disabled"],De={class:"field full"},Me=["disabled"],Ue={class:"modal-actions"},we=["disabled"],Be=["disabled"],qe={class:"app-dialog__panel"},Re={class:"modal-head","data-dialog-drag-handle":""},Fe={class:"modal-body"},je={key:0,class:"prototype-spec-grid"},ze={class:"modal-actions"},Oe=O({__name:"LegalEntities",setup(Ge){const f=P(),b=r([]),A=r(""),C=r("ALL"),k=r("code"),T=r(!1),E=r(""),c=r(!1),V=r(null),y=r(""),h=r(null),_=r(null),g=r(null),v=W({name:"",creditCode:""}),U=S(()=>f.canEdit("ui.legal-entities.create")&&["name","creditCode"].every(l=>f.canEdit(`dialog.legal-entities.create.${l}`))),j=S(()=>f.canEdit("ui.legal-entities.deactivate")),p=l=>f.canRead(`ui.legal-entities.column.${l}`),I=(l,t)=>l instanceof Error&&l.message?l.message:t,L=S(()=>{const l=A.value.toLocaleLowerCase();return b.value.filter(t=>(C.value==="ALL"||t.status===C.value)&&(!l||[t.code,t.name,t.creditCode].some(n=>String(n||"").toLocaleLowerCase().includes(l)))).sort((t,n)=>String(t[k.value]).localeCompare(String(n[k.value]),"zh-CN"))}),w=async()=>{T.value=!0,E.value="";try{b.value=await M.legalEntities()}catch(l){E.value=I(l,"法人主体加载失败")}finally{T.value=!1}},z=async()=>{var l;Object.assign(v,{name:"",creditCode:""}),y.value="",await F(),(l=h.value)==null||l.showModal()},$=()=>{var l;c.value||(l=h.value)==null||l.close()},G=async()=>{var t;y.value="";const l=v.creditCode.replace(/\s+/g,"").toUpperCase();if(!v.name)return void(y.value="请填写主体名称");if(!/^[0-9A-Z]{18}$/.test(l))return void(y.value="统一社会信用代码应为 18 位数字或大写字母");c.value=!0;try{const n=await M.create("legal-entities",{name:v.name,creditCode:l});b.value.push(n),(t=h.value)==null||t.close(),D.success("法人主体已创建")}catch(n){y.value=I(n,"保存失败,请稍后重试")}finally{c.value=!1}},Y=async l=>{var t;g.value=l,await F(),(t=_.value)==null||t.showModal()},J=async l=>{const t=l.status==="ACTIVE"?"INACTIVE":"ACTIVE";try{await ee.confirm(`确认${t==="ACTIVE"?"启用":"停用"}“${l.name}”?`,`${t==="ACTIVE"?"启用":"停用"}法人主体`,{type:"warning"})}catch{return}V.value=l.id;try{const n=await M.changeStatus("legal-entities",l.id,t);b.value.splice(b.value.findIndex(a=>a.id===l.id),1,n),D.success(`法人主体已${t==="ACTIVE"?"启用":"停用"}`)}catch(n){D.error(I(n,"状态更新失败"))}finally{V.value=null}};return Z(()=>{w()}),(l,t)=>{const n=te("dialog-drag");return o(),s("div",se,[B(le,{eyebrow:"FINANCIAL MASTER DATA",title:"法人主体",description:"统一维护可用于费用归属、预算控制和付款账户的公司主体。"},{default:H(()=>[U.value?(o(),s("button",{key:0,class:"btn primary",type:"button",onClick:z}," + 新增法人主体 ")):i("",!0)]),_:1}),t[22]||(t[22]=e("div",{class:"prototype-governance-note"},[e("strong",null,"主数据治理"),e("span",null,"主体编码由系统自动生成;已被成本中心引用的主体不能直接停用,历史业务数据始终保留。")],-1)),e("section",oe,[e("div",ne,[m(e("input",{"onUpdate:modelValue":t[0]||(t[0]=a=>A.value=a),type:"search",placeholder:"搜索主体编码、名称或统一社会信用代码","aria-label":"搜索法人主体"},null,512),[[x,A.value,void 0,{trim:!0}]]),m(e("select",{"onUpdate:modelValue":t[1]||(t[1]=a=>C.value=a),"aria-label":"筛选状态"},[...t[8]||(t[8]=[e("option",{value:"ALL"},"全部状态",-1),e("option",{value:"ACTIVE"},"启用",-1),e("option",{value:"INACTIVE"},"停用",-1)])],512),[[q,C.value]]),m(e("select",{"onUpdate:modelValue":t[2]||(t[2]=a=>k.value=a),"aria-label":"排序方式"},[...t[9]||(t[9]=[e("option",{value:"code"},"按编码排序",-1),e("option",{value:"name"},"按名称排序",-1)])],512),[[q,k.value]]),t[10]||(t[10]=e("span",{class:"prototype-filter-spacer"},null,-1)),e("span",ie,"共 "+d(L.value.length)+" 个主体",1)]),T.value?(o(),s("div",de,[...t[11]||(t[11]=[e("span",{class:"loader"},null,-1),e("span",null,"正在加载法人主体…",-1)])])):E.value?(o(),s("div",re,[e("span",null,d(E.value),1),e("button",{class:"btn small",type:"button",onClick:w},"重试")])):L.value.length?(o(),s("div",ue,[e("table",ce,[e("thead",null,[e("tr",null,[p("code")?(o(),s("th",ve,"主体编码")):i("",!0),p("name")?(o(),s("th",pe,"主体名称")):i("",!0),p("creditCode")?(o(),s("th",ye,"统一社会信用代码")):i("",!0),p("status")?(o(),s("th",me,"状态")):i("",!0),t[12]||(t[12]=e("th",null,"操作",-1))])]),e("tbody",null,[(o(!0),s(K,null,Q(L.value,a=>(o(),s("tr",{key:a.id},[p("code")?(o(),s("td",ge,[e("strong",null,d(a.code),1)])):i("",!0),p("name")?(o(),s("td",be,d(a.name),1)):i("",!0),p("creditCode")?(o(),s("td",_e,[e("span",fe,d(a.creditCode),1)])):i("",!0),p("status")?(o(),s("td",Ce,[B(ae,{active:a.status==="ACTIVE"},null,8,["active"])])):i("",!0),e("td",ke,[e("div",Ee,[e("button",{class:"prototype-table-action",type:"button",onClick:u=>Y(a)}," 查看",8,he),j.value?(o(),s("button",{key:0,class:X(["prototype-table-action",{danger:a.status==="ACTIVE"}]),type:"button",disabled:V.value===a.id,onClick:u=>J(a)},d(a.status==="ACTIVE"?"停用":"启用"),11,Ae)):i("",!0)])])]))),128))])])])):(o(),s("div",Te,"没有符合当前筛选条件的法人主体。"))]),U.value?m((o(),s("dialog",{key:0,ref_key:"createDialog",ref:h,class:"app-dialog prototype-dialog",onCancel:N($,["prevent"])},[e("form",{onSubmit:N(G,["prevent"])},[e("div",Ve,[t[13]||(t[13]=e("div",null,[e("span",{class:"eyebrow"},"LEGAL ENTITY"),e("h2",null,"新增法人主体"),e("p",null,"主体编码保存时由系统自动生成。")],-1)),e("button",{class:"modal-close",type:"button",disabled:c.value,onClick:$}," × ",8,Ie)]),e("div",Le,[y.value?(o(),s("p",$e,d(y.value),1)):i("",!0),t[16]||(t[16]=e("div",{class:"prototype-code-note"}," 编码规则:LE + 4 位流水号,例如 LE0001。 ",-1)),e("div",xe,[e("div",Ne,[t[14]||(t[14]=e("label",{for:"legal-name"},[R("主体名称 "),e("em",null,"*")],-1)),m(e("input",{id:"legal-name","onUpdate:modelValue":t[3]||(t[3]=a=>v.name=a),required:"",maxlength:"200",autocomplete:"off",disabled:c.value},null,8,Se),[[x,v.name,void 0,{trim:!0}]])]),e("div",De,[t[15]||(t[15]=e("label",{for:"legal-credit"},[R("统一社会信用代码 "),e("em",null,"*")],-1)),m(e("input",{id:"legal-credit","onUpdate:modelValue":t[4]||(t[4]=a=>v.creditCode=a),required:"",maxlength:"18",autocomplete:"off",placeholder:"18 位统一社会信用代码",disabled:c.value},null,8,Me),[[x,v.creditCode,void 0,{trim:!0}]])])])]),e("div",Ue,[e("button",{class:"btn",type:"button",disabled:c.value,onClick:$}," 取消",8,we),e("button",{class:"btn primary",type:"submit",disabled:c.value},d(c.value?"保存中…":"保存主体"),9,Be)])],32)],32)),[[n]]):i("",!0),m((o(),s("dialog",{ref_key:"detailDialog",ref:_,class:"app-dialog prototype-dialog",onCancel:t[7]||(t[7]=N(a=>{var u;return(u=_.value)==null?void 0:u.close()},["prevent"]))},[e("div",qe,[e("div",Re,[t[17]||(t[17]=e("div",null,[e("span",{class:"eyebrow"},"LEGAL ENTITY"),e("h2",null,"法人主体详情")],-1)),e("button",{class:"modal-close",type:"button",onClick:t[5]||(t[5]=a=>{var u;return(u=_.value)==null?void 0:u.close()})}," × ")]),e("div",Fe,[g.value?(o(),s("div",je,[e("div",null,[t[18]||(t[18]=e("span",null,"主体编码",-1)),e("strong",null,d(g.value.code),1)]),e("div",null,[t[19]||(t[19]=e("span",null,"状态",-1)),e("strong",null,d(g.value.status==="ACTIVE"?"启用":"停用"),1)]),e("div",null,[t[20]||(t[20]=e("span",null,"主体名称",-1)),e("strong",null,d(g.value.name),1)]),e("div",null,[t[21]||(t[21]=e("span",null,"统一社会信用代码",-1)),e("strong",null,d(g.value.creditCode),1)])])):i("",!0)]),e("div",ze,[e("button",{class:"btn primary",type:"button",onClick:t[6]||(t[6]=a=>{var u;return(u=_.value)==null?void 0:u.close()})}," 关闭 ")])])],32)),[[n]])])}}});export{Oe as default};