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