import{_ as q,d as I,n as v,O as L,cc as M,dL as O,cB as z,p as P,w as E,r as T,o as j,c as G,h as o,y as l,i as e,dM as U,dn as b,dN as F,a as y,dO as g,e as s,ce as N,H as d,G as f,dm as _,cY as H,dQ as a,dq as Q,cd as Y,F as $,cm as c}from"./index.js";import{h as J}from"./index.d650a936.js";import{o as K}from"./_options.61c25632.js";import W from"./order-modal.796c15.js";import"./index.43fba9db.js";const X={class:"w-full flex justify-between"},Z={class:"flex items-center"},ee={class:"w-full flex justify-end"},oe=I({__name:"order-form",emits:["create"],setup(ue,{emit:x}){const A=x,C=v(null),h=v(null),r=v([]),{currentCompany:w}=L(),m=M(""),i=O({customerNo:"",companyNo:""}),{run:D}=z({success:()=>A("create")});function R(n){const u=r.value.map(t=>String(t.id)),p=n.filter(({id:t})=>!u.includes(String(t)));r.value=[...r.value,...p]}async function V(){var n;if(r.value.length>150){c.warning("\u901A\u7528\u8BA2\u5355\u6570\u91CF\u4E0D\u80FD\u8D85\u8FC7150\u6761");return}try{if(await((n=h.value)==null?void 0:n.validate()),r.value.length===0)return c.warning("\u8BF7\u9009\u62E9\u901A\u7528\u8BA2\u5355");D(J({common_ids:r.value.map(u=>u.id)}))}catch{}}function S(){var p;const{companyNo:n,customerNo:u}=i;if(!u){c.warning("\u8BF7\u9009\u62E9\u4E70\u5165\u65B9\u516C\u53F8");return}if(u!==n){c.warning("\u5356\u51FA\u65B9\u516C\u53F8\u4E0E\u4E70\u5165\u65B9\u516C\u53F8\u4E0D\u80FD\u662F\u4E00\u5BB6\u516C\u53F8");return}(p=C.value)==null||p.onDisplay(u,n)}return P(()=>{i.companyNo=w.value.companyNo,i.customerNo="GS2203161855277894"}),E(()=>[i.customerNo,i.customerNo],()=>r.value=[]),E(()=>m.value,()=>r.value=[]),(n,u)=>{const p=T("el-switch");return j(),G($,null,[o(e(Y),{rules:e(K),ref_key:"formRef",ref:h,model:e(i)},{default:l(()=>[o(e(U),{gutter:10},{default:l(()=>[o(e(b),{span:12},{default:l(()=>[o(e(F),{label:"\u5356\u51FA\u65B9\u516C\u53F8",prop:"companyNo"},{default:l(()=>[y(` \r
              <RemoteSelect \r
                  style="width: 100%" \r
                  :api="httpGetSupplier" \r
                  requestProp="name" \r
                  responseLabel-prop="name"\r
                  responseValProp="code" \r
                  placeholder="\u8BF7\u9009\u62E9\u5356\u65B9\u516C\u53F8" \r
                  v-model:value="formData.companyNo" \r
                  :getLabel="getLabel"\r
                /> \r
              `),o(e(g),{modelValue:e(w).companyName,"onUpdate:modelValue":u[0]||(u[0]=t=>e(w).companyName=t),disabled:""},null,8,["modelValue"])]),_:1})]),_:1}),o(e(b),{span:12},{default:l(()=>[o(e(F),{label:"\u4E70\u5165\u65B9\u516C\u53F8",prop:"customerNo"},{default:l(()=>[y(' <ElInput v-model="currentCompany.companyName" disabled></ElInput> '),y(` <RemoteSelect\r
            disabled\r
            ref="RemoteSelectRef"\r
            v-model="formData.customerNo"\r
            style="width: 100%"\r
            :api="httpCompanylist"\r
            requset-prop="name"\r
            response-label-prop="company_name"\r
            response-val-prop="companyNo"\r
           /> `),o(e(g),{modelValue:"\u5317\u4EAC\u4E07\u5B87\u6052\u901A\u56FD\u9645\u79D1\u8D38\u6709\u9650\u516C\u53F8",disabled:""})]),_:1})]),_:1})]),_:1}),o(e(F),{class:"be-current__item"},{label:l(()=>[s("div",X,[s("div",null,[u[2]||(u[2]=s("span",{style:{color:"red","margin-right":"5px"}},"*",-1)),u[3]||(u[3]=s("span",null,"\u901A\u7528\u8BA2\u5355",-1)),o(e(N),{style:{"margin-left":"10px"},size:"small"},{default:l(()=>[d(f(r.value.length)+"/150",1)]),_:1})]),s("div",Z,[u[5]||(u[5]=s("p",{class:"mr-[10px]"},"\u5E73\u53F0\u7C7B\u578B:",-1)),o(p,{class:"mr-[10px]",modelValue:m.value,"onUpdate:modelValue":u[1]||(u[1]=t=>m.value=t),size:"small","active-text":"toC","inactive-text":"toB","active-value":"2","inactive-value":"1"},null,8,["modelValue"]),o(e(_),{type:"primary",size:"small",onClick:S},{default:l(()=>u[4]||(u[4]=[d("\u6DFB\u52A0\u901A\u7528\u8BA2\u5355")])),_:1})])])]),default:l(()=>[o(e(H),{border:"",size:"small",data:r.value,class:"mt-[10px]","max-height":500},{default:l(()=>[o(e(a),{label:"\u5E8F\u53F7",type:"index",fixed:"left",align:"center"}),o(e(a),{label:"\u901A\u7528\u8BA2\u5355\u7F16\u53F7","min-width":"160",prop:"tyCode","show-overflow-tooltip":""}),o(e(a),{label:"\u786E\u8BA4\u5355\u7F16\u53F7","min-width":"160",prop:"orderCode","show-overflow-tooltip":""}),o(e(a),{label:"\u9500\u552E\u8BA2\u5355\u4E3B\u7F16\u53F7","min-width":"160",prop:"cxCode","show-overflow-tooltip":""}),o(e(a),{label:"\u7533\u8BF7\u4EBA",prop:"apply_name",width:"100px","show-overflow-tooltip":""}),o(e(a),{label:"\u5546\u54C1\u7F16\u53F7","min-width":"160",prop:"goodNo","show-overflow-tooltip":""}),o(e(a),{label:"\u5546\u54C1\u540D\u79F0","min-width":"160",prop:"goodName","show-overflow-tooltip":""}),o(e(a),{label:"\u5356\u51FA\u65B9\u516C\u53F8","min-width":"160",prop:"companyName","show-overflow-tooltip":""}),o(e(a),{label:"\u4E0B\u5355\u6570\u91CF",width:"80",prop:"goodNum","show-overflow-tooltip":""},{default:l(t=>[d(f(t.row.qrd?t.row.qrd.goodNum:""),1)]),_:1}),o(e(a),{label:"\u9500\u552E\u5355\u4EF7",width:"80",prop:"goodPrice","show-overflow-tooltip":""},{default:l(t=>[d(f(t.row.qrd?t.row.qrd.goodPrice:""),1)]),_:1}),o(e(a),{label:"\u5BF9\u8D26\u72B6\u6001",width:"80",prop:"status","show-overflow-tooltip":""},{default:l(t=>[o(e(N),null,{default:l(()=>{var B;return[d(f(((B=e(Q).find(k=>k.value==t.row.status))==null?void 0:B.label)||"--"),1)]}),_:2},1024)]),_:1}),o(e(a),{label:"\u4E0B\u5355\u65F6\u95F4",width:"100",prop:"addtime","show-overflow-tooltip":""}),o(e(a),{label:"\u64CD\u4F5C",fixed:"right",width:"60px"},{default:l(t=>[o(e(_),{size:"small",type:"primary",text:"",onClick:()=>r.value.splice(t.$index)},{default:l(()=>u[6]||(u[6]=[d("\u5220\u9664")])),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])]),_:1}),s("div",ee,[o(e(_),{type:"primary",onClick:V},{default:l(()=>u[7]||(u[7]=[d("\u4FDD\u5B58")])),_:1})])]),_:1},8,["rules","model"]),o(W,{platform_type:m.value,ref_key:"orderModalRef",ref:C,onList:R},null,8,["platform_type"])],64)}}});var se=q(oe,[["__scopeId","data-v-b5f03d08"],["__file","D:/work/jiesuan/settle-vue3/src/views/InvoiceSales/currentcyOrderRecord copy/components/order-form.vue"]]);export{se as default};
