import{_ as g,d as I,w as D,n as R,W as T,a7 as z,aY as K,az as M,r as F,at as S,H as U,l as e,o as d,G as p,C as a,j as u,aT as i,aL as r,b7 as Y,a as c,c as A,b0 as O,aR as h,J as j,M as m,L as b,aO as G,aP as H,aQ as B,h as L,aK as J}from"./index.js";import{b as Q}from"./index.6a0f4b7c.js";import{c as W,r as $}from"./shared.80186348.js";import q from"./index.bb93f8.js";import{P as X}from"./index.b8dc5811.js";import{b as Z}from"./index.df9c5952.js";import"./use-page-search.09da52b8.js";import"./status.0f771e9a.js";import"./basic-descriptions.1a629879.js";import"./tootip.51743c5b.js";import"./columns.e82121ef.js";const ee={key:1,class:"flex items-start"},ue={class:"w-full flex justify-end"},ae=I({__name:"BaseForm",setup(le){const n=D(null),V=o=>{const l=new Date;return o.getTime()>l.setHours(0,0,0,0)},w=R(),y=D(null),v=T({editVisible:!1,visible:!1,companies:[],index:-1,data:{}}),C=z(()=>{var f,_,k;const o=(((f=n.value)==null?void 0:f.residue_stock)-Number(t.value.check_num)||0)*-1,l=o*((_=n.value)==null?void 0:_.subunit_price)||0;return Number(l)===0&&t.value.check_type=="2"&&(t.value.check_type=""),{ykNum:o,yKPrice:o*((k=n.value)==null?void 0:k.subunit_price)||0}}),t=D(W()),E=K({success(){M.success("\u521B\u5EFA\u6210\u529F!"),w.push("/invoiceInOut/inventoryCheck")}});async function N(){var o;try{await((o=y.value)==null?void 0:o.validate()),E.run(Z(t.value))}catch{}}function P(o){n.value=o[0],t.value.product_id=o[0].id,t.value.check_num=String(o[0].residue_stock)}function x(){n.value=null,t.value.check_num="0",t.value.product_id=""}return async function(){const l=await Q({size:1e4});l.code==0&&(v.companies=[...l.data.list])}(),(o,l)=>{const f=F("ElDatePicker"),_=F("ElRow"),k=S("loading");return U((d(),p(e(J),{ref_key:"formRef",ref:y,rules:e($),model:t.value,"label-width":"140px"},{default:a(()=>[u(_,null,{default:a(()=>[u(e(i),{span:24},{default:a(()=>[u(e(r),{label:"\u5546\u54C1\u4FE1\u606F",prop:"product_id"},{default:a(()=>[n.value?c("v-if",!0):(d(),p(e(Y),{key:0,placeholder:"\u5546\u54C1\u4FE1\u606F",onClick:l[0]||(l[0]=s=>v.visible=!0)})),n.value?(d(),A("div",ee,[n.value?(d(),p(X,{key:0,data:n.value},null,8,["data"])):c("v-if",!0),c(' <BasicDescriptions :data="detail" :columns="goodColumns" /> '),u(e(O),{content:"\u91CD\u65B0\u9009\u62E9",placement:"top"},{default:a(()=>[u(e(h),{link:"",type:"info",icon:e(j)("close-circle-line"),onClick:x},null,8,["icon"])]),_:1})])):c("v-if",!0)]),_:1})]),_:1}),n.value?(d(),p(e(i),{key:0,span:6},{default:a(()=>[u(e(r),{label:"\u8D26\u9762\u6570\u91CF"},{default:a(()=>{var s;return[m(b(((s=n.value)==null?void 0:s.residue_stock)||0),1)]}),_:1})]),_:1})):c("v-if",!0),n.value?(d(),p(e(i),{key:1,span:6},{default:a(()=>[u(e(r),{label:"\u7A0E\u524D\u5355\u4EF7"},{default:a(()=>{var s;return[m(b(((s=n.value)==null?void 0:s.subunit_price)||0),1)]}),_:1})]),_:1})):c("v-if",!0),u(e(i),{span:12}),u(e(i),{span:24},{default:a(()=>[u(e(r),{label:"\u76D8\u70B9\u6570\u91CF",prop:"check_num"},{default:a(()=>[u(e(G),{modelValue:t.value.check_num,"onUpdate:modelValue":l[1]||(l[1]=s=>t.value.check_num=s),placeholder:"\u76D8\u70B9\u6570\u91CF"},null,8,["modelValue"])]),_:1})]),_:1}),u(e(i),{span:24},{default:a(()=>[u(e(r),{label:"\u76C8\u4E8F\u6570\u91CF",prop:"ykNum"},{default:a(()=>[m(b(C.value.ykNum),1)]),_:1})]),_:1}),u(e(i),{span:24},{default:a(()=>[u(e(r),{label:"\u76C8\u4E8F\u91D1\u989D",prop:"ykPrice"},{default:a(()=>[c(" =(\u8D26\u9762\u6570\u91CF-\u76D8\u70B9\u6570\u91CF) * \u7A0E\u524D\u5355\u4EF7 "),m(" "+b(C.value.yKPrice),1)]),_:1})]),_:1}),u(e(i),{span:24},{default:a(()=>[u(e(r),{label:"\u7ED3\u679C\u7C7B\u578B",prop:"check_type"},{default:a(()=>[u(e(H),{modelValue:t.value.check_type,"onUpdate:modelValue":l[2]||(l[2]=s=>t.value.check_type=s),placeholder:"\u7ED3\u679C\u7C7B\u578B"},{default:a(()=>[u(e(B),{disabled:C.value.yKPrice==0,label:"\u8C03\u6574\u5355",value:"2"},null,8,["disabled"]),u(e(B),{label:"\u524D\u671F\u6570\u636E\u5BFC\u5165",value:"1"})]),_:1},8,["modelValue"])]),_:1})]),_:1}),u(e(i),{span:24},{default:a(()=>[u(e(r),{label:"\u8C03\u6574\u5355\u5165\u8D26\u6708\u4EFD",prop:"fz_date"},{default:a(()=>[u(f,{type:"month",placeholder:"\u5165\u8D26\u6708\u4EFD",modelValue:t.value.fz_date,"onUpdate:modelValue":l[3]||(l[3]=s=>t.value.fz_date=s),disabledDate:V,"value-format":"YYYY-MM"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),L("div",ue,[u(e(h),{type:"primary",onClick:N},{default:a(()=>l[5]||(l[5]=[m("\u4FDD\u5B58")])),_:1})]),u(q,{visible:v.visible,"onUpdate:visible":l[4]||(l[4]=s=>v.visible=s),onSubmit:P},null,8,["visible"])]),_:1},8,["rules","model"])),[[k,e(E).loading]])}}});var fe=g(ae,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/views/invoiceInOut/inventoryCheck/components/BaseForm.vue"]]);export{fe as default};
