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