import{_ as L,d as N,w as x,m as T,aO as j,ag as b,Z as H,aP as P,z,r as _,o as y,c as F,l as n,C as d,b as p,u as i,aQ as G,F as h,D as M,G as O,aR as Q,M as Z}from"./index.1d1a5ecb.js";import{c as J}from"./configs.884a9ecd.js";import{h as K,a as W}from"./index.9d08ee5b.js";import"./tootip.76f6bcc3.js";import"./verification.611d3025.js";const X={flex:"",gap:"1"},Y={flex:"","gap-3":""},$={flex:"","justify-end":""},ee=N({__name:"procure-setting",props:{columns:{type:Array,required:!0},backRoute:{type:String,required:!0},name:{type:String,required:!1},detail:{type:null,required:!0}},emits:["refresh"],setup(B,{emit:R}){const f=B,v=x(null),V={inv_good_name:"",cat_name:"",cat_code:"",tax:""},m=x([]),{query:D}=T(),E=j(),C=x(null),w=b(()=>D.id),e=H({...V}),g=P(!1),S=b(()=>({tax:!e.cat_code})),k=b(()=>({...J}));function q(){C.value.validate(async a=>{if(!a)return;const{cat_code:t,inv_good_name:l,tax:u}=e,r=[{cat_code:t,inv_good_name:l,tax:u,spuCode:w.value}];g.value=!0;const{code:c,message:s}=await W({list:r,status:"1"});g.value=!1,E({code:c,message:s,handler:()=>R("refresh")})})}function A(a){if(!a)return e.tax="",e.cat_name="",m.value=[];const{tax:t,cat_name:l}=a;m.value=[...t,"0%"],e.cat_name=l,e.tax=""}function I(a){return a.merge_code+" / "+a.cat_name+"-"+a.short_name}return z(()=>f.detail,async()=>{if(!f.detail)return;const{inv_good_name:a,inv_cat_code:t,good_name:l,inv_tax:u,cgd_inv_tax:r}=f.detail;if(e.inv_good_name=a||l,e.tax=u?u*100+"%":"",e.inv_good_name.length>70&&(e.inv_good_name=e.inv_good_name.slice(0,70)),t&&v.value){const c={cat_code:t},s=await v.value.initalData(c);if(!s||!Array.isArray(s))return;const{tax:o}=s[0];m.value=o}r&&(e.tax=r)},{immediate:!0}),(a,t)=>{const l=_("el-form-item"),u=_("el-input"),r=_("el-option"),c=_("el-select"),s=_("el-button");return y(),F(h,null,[n(i(Q),{"label-position":"left",ref_key:"formRef",ref:C,rules:i(k),model:e},{default:d(()=>[p("div",X,[n(l,{label:"\u5546\u54C1\u7C7B\u76EE\u8BBE\u7F6E",prop:"cat_code","flex-1":""},{default:d(()=>[n(i(G),{ref_key:"remoteSelectRef",ref:v,"w-full":"","is-root":"",getLabel:I,api:i(K),modelValue:e.cat_code,"onUpdate:modelValue":t[0]||(t[0]=o=>e.cat_code=o),placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u7C7B\u76EE","response-label-prop":"cat_name","response-val-prop":"merge_code","request-prop":"cat_name","sub-label-prop":"short_name",onItemChange:A,onInital:t[1]||(t[1]=o=>e.cat_code=o)},null,8,["api","modelValue"])]),_:1})]),p("div",null,[n(l,{label:"\u5F00\u7968\u5546\u54C1\u540D\u79F0",prop:"inv_good_name","flex-1":""},{default:d(()=>[n(u,{"w-full":"",modelValue:e.inv_good_name,"onUpdate:modelValue":t[2]||(t[2]=o=>e.inv_good_name=o),placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",maxlength:"70"},null,8,["modelValue"])]),_:1})]),p("div",Y,[n(l,{label:"\u7A0E\u7387",prop:"tax"},{default:d(()=>[n(c,{"w-180px":"",modelValue:e.tax,"onUpdate:modelValue":t[3]||(t[3]=o=>e.tax=o),disabled:i(S).tax,placeholder:"\u8BF7\u8F93\u5165\u7A0E\u7387"},{default:d(()=>[(y(!0),F(h,null,M(m.value,(o,U)=>(y(),O(r,{key:U,label:o,value:o},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1})])]),_:1},8,["rules","model"]),p("div",$,[n(s,{type:"primary",onClick:q,loading:i(g)},{default:d(()=>[Z("\u4FDD\u5B58")]),_:1},8,["loading"])])],64)}}});var se=L(ee,[["__scopeId","data-v-09a86bb6"],["__file","C:/Users/63107/Desktop/projects/accout-vue3-ui/src/views/InvoiceSaleSettings/_component/procure-setting.vue"]]);export{se as default};
