import{d as U,a as V,c as r,f as m,g as I,l as a,m as p,j as C,h as i,P as L,Q as S,E as _,y as Q,z as j,k as H,i as F,H as z,U as P}from"./index.2c7321ca.js";import{f as G}from"./index.7f3c3153.js";import{C as M}from"./api.7608f319.js";import{_ as K}from"./invoiceHeaderDialog.vue_vue_type_script_setup_true_lang.cec105a1.js";import{_ as N}from"./_plugin-vue_export-helper.cdc0426e.js";const J="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAFtSURBVFiFxZQvT8NAGIefQkhAQWZJhpmdrFvmCGIIDILVkwxFUDgwBBwJYnPsCwAKBHbhA5BUI2gCAtGEIJBDXEr/3dpee73+kiZt0/Z57n3fHjSYjeP5udUkfG5x1ohAAAcwLhCFGxdIwo0KyODGBBbBjQhkwWsXyIPXKlAEXptAUXgtAipw7QKqcK0CZeDaBMrCtQhUgQMsmYKPD+D9AgZdTQIq8Ms9GNqwvgajvgYBFfjpThz65FYUSMKHtjhkGXSFQJDJTBzRLFeBj/pwvR/29eUtfLbdgvtDWF0R1+4HONP0NwtXQFb279/wPFrqdgsej0TPATxfDoeCFVjUc/cTeh0BBLC34OFVTHx3M5TcvhESsuTuA3kDF6w2kEjGmaYHL5rMFhSZds+H3bF8hVfP2fBMAZVfzfPBuY3fm8yEQF6kM1Bme/36ESK9jpiDk7ti76VmoOrerpqYgGl4TKAJ+L9AU3AAq0k4wB/0NauxShzJvAAAAABJRU5ErkJggg==",Y=g=>(Q("data-v-f7ac29b4"),g=g(),j(),g),Z={class:"dialog-main"},R={class:"invoice-header-flex"},X={class:"list"},q=Y(()=>i("div",{class:"title"},"\u6DFB\u52A0\u53D1\u7968\u65B0\u5730\u5740",-1)),O=["onClick"],$={class:"title"},W={class:"titleType"},ee={class:"edit-delete"},te=["onClick"],oe=["onClick"],ie={class:"pagination"},se=U({__name:"InvoiceHeaderDialog",emits:["select","cancel"],setup(g,{expose:k,emit:v}){const e=V({dialogVisible:!0,invoiceHeaderList:[],limit:5,page:1,total:0,selectTitleIndex:null,showInvoiceHeaderDialog:!1,showAddInvoiceHeaderDialog:!1,type:"add",invoiceInfo:{}}),w=()=>{A()},A=()=>{let s={limit:e.limit,page:e.page};G(s).then(t=>{let{code:c,message:d,data:u}=t;if(c!==200){_.error(d);return}let{list:n,limit:f,page:o,total:l}=u;e.invoiceHeaderList=n,e.limit=f,e.page=o,e.total=l})},h=()=>{v("cancel")},x=()=>{e.selectTitleIndex||e.selectTitleIndex===0?(v("select",e.invoiceHeaderList[e.selectTitleIndex]),v("cancel")):_.error("\u8BF7\u9009\u62E9\u53D1\u7968\u62AC\u5934")},E=s=>{e.page=s,A()},T=()=>{e.showAddInvoiceHeaderDialog=!1},y=s=>{e.showAddInvoiceHeaderDialog=!1,A()},D=(s,t)=>{console.info("type invoice",t,s),e.type=t,t==="edit"&&(e.invoiceInfo=s),e.showAddInvoiceHeaderDialog=!0},b=(s,t)=>{P.confirm("\u786E\u8BA4\u8981\u5220\u9664\u5417\uFF1F","\u63D0\u793A",{confirmButtonText:"\u786E\u5B9A",cancelButtonText:"\u53D6\u6D88"}).then(()=>{let c={id:s.id};M().delInvoiceHeaderApi(c).then(d=>{let{code:u,message:n}=d;if(u!==200){_.error(n);return}e.invoiceHeaderList.splice(t,1),_({message:"\u5220\u9664\u6210\u529F",type:"success",showClose:!0}),A()})}).catch(()=>{})};return k({openDialog:w}),(s,t)=>{const c=r("Plus"),d=r("el-icon"),u=r("el-pagination"),n=r("el-button"),f=r("el-dialog");return m(),I("div",null,[a(f,{modelValue:e.dialogVisible,"onUpdate:modelValue":t[2]||(t[2]=o=>e.dialogVisible=o),width:"548px",title:"\u9009\u62E9\u53D1\u7968\u62AC\u5934",onClose:h},{footer:p(()=>[a(n,{class:"submit-button",onClick:x},{default:p(()=>[C("\u786E\u8BA4")]),_:1}),a(n,{class:"cancel-button",onClick:h},{default:p(()=>[C("\u53D6\u6D88")]),_:1})]),default:p(()=>[i("div",Z,[i("div",R,[i("div",X,[i("div",{class:"add",onClick:D},[i("div",null,[a(d,{size:"24px",color:"#909399"},{default:p(()=>[a(c)]),_:1}),q])])]),(m(!0),I(L,null,S(e.invoiceHeaderList,(o,l)=>(m(),I("div",{class:"list",key:"invoiceHeaderList"+l,onClick:B=>e.selectTitleIndex=l},[i("div",$,H(o.title),1),i("div",W,"\u53D1\u7968\u7C7B\u578B\uFF1A "+H(o.titleType===0?"\u589E\u503C\u7A0E\u7535\u5B50\u666E\u901A\u53D1\u7968":o.titleType===1?"\u589E\u503C\u7A0E\u7535\u5B50\u4E13\u7528\u53D1\u7968":""),1),i("div",ee,[i("span",{class:"text",onClick:F(B=>D(o,"edit"),["stop"])},"\u7F16\u8F91",8,te),i("span",{class:"text",onClick:F(B=>b(o,l),["stop"])},"\u5220\u9664",8,oe)]),i("img",{class:"checked-icon",src:J,style:z(e.selectTitleIndex===l?"display: block;":"display: none;")},null,4)],8,O))),128))]),i("div",ie,[a(u,{"current-page":e.page,"onUpdate:current-page":t[0]||(t[0]=o=>e.page=o),"page-size":e.limit,"onUpdate:page-size":t[1]||(t[1]=o=>e.limit=o),background:"",layout:"prev, pager, next",total:e.total,onCurrentChange:E},null,8,["current-page","page-size","total"])])]),a(K,{showAddInvoiceHeaderDialog:e.showAddInvoiceHeaderDialog,type:e.type,invoiceInfo:e.invoiceInfo,onUpdateInvoiceHeader:y,onCloseAddInvoiceHeaderDialog:T},null,8,["showAddInvoiceHeaderDialog","type","invoiceInfo"])]),_:1},8,["modelValue"])])}}});const ue=N(se,[["__scopeId","data-v-f7ac29b4"]]);export{ue as default};
