baseForm.a0bea7.js 6.6 KB

1
  1. import{_ as J,d as W,ag as Z,W as K,w as D,n as X,Z as ee,z as N,r as s,aC as le,o as _,c as ae,H as te,G as b,C as l,j as e,l as i,bS as ue,bT as oe,h as f,M as E,L as h,a as x,J as T,b1 as de,aN as U}from"./index.js";import{P as ne}from"./platform-query.44bd7119.js";import{g as re,r as se}from"./_options.b485149d.js";import{b as ie}from"./index.3c9dc929.js";import pe from"./ladderModal.ce0631.js";const me={style:{width:"100%"}},ce={class:"flex",style:{width:"100%"}},_e=f("p",{class:"ml-[10px]"},"\u5143",-1),fe={class:"flex w-full justify-between"},ve=f("p",null,"\u64CD\u4F5C",-1),be={class:"flex justify-end"},Ee=W({__name:"baseForm",props:{detail:{type:null,required:!1}},setup(A){const F=A,m=Z(()=>F.detail?"detail":"create"),{currentCompany:y}=K(),I={name:"",platform:"",companyNo:"",khNo:"",budget_total:"0.00",arrtime:"",endtime:"",use_desc:"",ladder:[]},C=D(!1),L=X(),t=D({...I}),g=D(null),d=ee({visible:!1,type:"create",index:-1,detail:{}});N(()=>y,()=>{!y&&m.value==="create"||(t.value.companyNo=y.value.companyNo)},{immediate:!0,deep:!0}),N(()=>m.value,()=>{m.value!=="create"&&(t.value={...F.detail})},{immediate:!0});const V=o=>o.getTime()<Date.now()-1e3*60*60*24;async function Y(){try{g.value&&g.value.validate();let{ladder:o,...u}=t.value;if(o.length<2){U.warning("\u81F3\u5C11\u6DFB\u52A0\u4E24\u6761\u9879\u76EE\u8981\u6C42");return}o=o.map(({can:r,...w})=>({...w,cat_id:r.length===3?r[2].id:""})),C.value=!0;const{code:c,message:n}=await ie({...u,ladder:o});C.value=!1,Number(c)===0?L.push("/sellOut/project"):U.error(n)}catch{}}function j(){d.visible=!0,d.type="create",d.index=-1,d.detail={budget_total:"",good_name:"",good_type:"",good_img:"",can:[],num:0}}function M(o){d.visible=!0,d.type="update",d.index=o;const{can:u,...c}=t.value.ladder[o];d.detail={...c,can:u.map(({id:n})=>n)}}function R(o){t.value.ladder.push(o)}function z(o){t.value.ladder[o.index]=o.data}return(o,u)=>{const c=s("ElInput"),n=s("ElFormItem"),r=s("ElCol"),w=s("ElInputNumber"),B=s("ElDatePicker"),p=s("ElTableColumn"),P=s("ElTag"),S=s("ElImage"),k=s("ElButton"),O=s("ElTooltip"),Q=s("el-button"),$=s("ElTable"),q=s("ElRow"),G=le("loading");return _(),ae("div",me,[te((_(),b(i(de),{"label-width":"100px",size:"small",rules:i(se),ref_key:"formRef",ref:g,model:t.value,disabled:i(m)!=="create"},{default:l(()=>[e(q,{gutter:10},{default:l(()=>[e(r,{span:12},{default:l(()=>[e(n,{label:"\u9879\u76EE\u540D\u79F0",prop:"name"},{default:l(()=>[e(c,{modelValue:t.value.name,"onUpdate:modelValue":u[0]||(u[0]=a=>t.value.name=a),placeholder:"\u9879\u76EE\u540D\u79F0"},null,8,["modelValue"])]),_:1})]),_:1}),e(r,{span:12},{default:l(()=>[e(n,{label:"\u6240\u5C5E\u5E73\u53F0",prop:"platform"},{default:l(()=>[e(i(ne),{modelValue:t.value.platform,"onUpdate:modelValue":u[1]||(u[1]=a=>t.value.platform=a),placeholder:"\u6240\u5C5E\u5E73\u53F0"},null,8,["modelValue"])]),_:1})]),_:1}),e(r,{span:12},{default:l(()=>[e(n,{label:"\u9500\u552E\u65B9",prop:"companyNo"},{default:l(()=>[e(i(ue),{modelValue:t.value.companyNo,"onUpdate:modelValue":u[2]||(u[2]=a=>t.value.companyNo=a),disabled:""},null,8,["modelValue"])]),_:1})]),_:1}),e(r,{span:12},{default:l(()=>[e(n,{label:"\u8D2D\u4E70\u65B9",prop:"khNo"},{default:l(()=>[e(i(oe),{modelValue:t.value.khNo,"onUpdate:modelValue":u[3]||(u[3]=a=>t.value.khNo=a),placeholder:"\u8D2D\u4E70\u65B9"},null,8,["modelValue"])]),_:1})]),_:1}),e(r,{span:8},{default:l(()=>[e(n,{label:"\u9879\u76EE\u603B\u9884\u7B97",prop:"budget_total"},{default:l(()=>[f("div",ce,[e(w,{class:"flex-1",modelValue:t.value.budget_total,"onUpdate:modelValue":u[4]||(u[4]=a=>t.value.budget_total=a),"controls-position":"right",precision:2},null,8,["modelValue"]),_e])]),_:1})]),_:1}),e(r,{span:8},{default:l(()=>[e(n,{label:"\u8981\u6C42\u5230\u8D27\u65F6\u95F4",prop:"arrtime"},{default:l(()=>[e(B,{disabledDate:V,"value-format":"YYYY-MM-DD",modelValue:t.value.arrtime,"onUpdate:modelValue":u[5]||(u[5]=a=>t.value.arrtime=a),placeholder:"\u8981\u6C42\u5230\u8D27\u65F6\u95F4",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1}),e(r,{span:8},{default:l(()=>[e(n,{label:"\u7ADE\u4EF7\u622A\u6B62\u65F6\u95F4",prop:"endtime"},{default:l(()=>[e(B,{disabledDate:V,"value-format":"YYYY-MM-DD",modelValue:t.value.endtime,"onUpdate:modelValue":u[6]||(u[6]=a=>t.value.endtime=a),placeholder:"\u7ADE\u4EF7\u622A\u6B62\u65F6\u95F4",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1}),e(r,{span:24},{default:l(()=>[e(n,{label:"\u9879\u76EE\u7528\u9014",prop:"use_desc"},{default:l(()=>[e(c,{type:"textarea",modelValue:t.value.use_desc,"onUpdate:modelValue":u[7]||(u[7]=a=>t.value.use_desc=a),placeholder:"\u9879\u76EE\u7528\u9014"},null,8,["modelValue"])]),_:1})]),_:1}),e(r,{span:24},{default:l(()=>[e(n,{label:"\u5546\u54C1\u8981\u6C42",prop:"ladder"},{default:l(()=>[e($,{border:"",size:"small",data:t.value.ladder},{default:l(()=>[e(p,{label:"\u5546\u54C1\u9636\u68AF",width:"70px"},{default:l(a=>[E(h(a.$index+1),1)]),_:1}),e(p,{label:"\u5546\u54C1\u7C7B\u578B",width:"70px"},{default:l(a=>[e(P,null,{default:l(()=>{var v;return[E(h(((v=i(re).find(({value:H})=>H===a.row.good_type))==null?void 0:v.label)||"--"),1)]}),_:2},1024)]),_:1}),e(p,{label:"\u9884\u7B97\u5355\u4EF7",prop:"budget_price",width:"70px"}),e(p,{label:"\u8D2D\u4E70\u6570\u91CF",prop:"num",width:"70px"}),e(p,{label:"\u5546\u54C1\u5206\u7C7B","min-width":"180px"},{default:l(a=>[E(h(a.row.can.length===3?a.row.can.map(({name:v})=>v).join("/"):""),1)]),_:1}),e(p,{label:"\u56FE\u7247",width:"70px"},{default:l(a=>[a.row.good_img?(_(),b(S,{key:0,style:{width:"20px",height:"20px"},src:a.row.good_img,previewTeleported:"",previewSrcList:[a.row.good_img]},null,8,["src","previewSrcList"])):x("v-if",!0)]),_:1}),e(p,{label:"\u5546\u54C1\u540D\u79F0",prop:"good_name","min-width":"180px"}),i(m)==="create"?(_(),b(p,{key:0,label:"\u64CD\u4F5C",width:"80px"},{header:l(()=>[f("div",fe,[ve,e(O,{content:"\u6DFB\u52A0\u5546\u54C1\u8981\u6C42",placement:"top"},{default:l(()=>[e(k,{link:"",size:"small",type:"primary",icon:i(T)("add"),onClick:j},null,8,["icon"])]),_:1})])]),default:l(a=>[e(Q,{text:"",type:"primary",icon:i(T)("edits"),onClick:()=>M(a.$index)},null,8,["icon","onClick"])]),_:1})):x("v-if",!0)]),_:1},8,["data"])]),_:1})]),_:1}),i(m)==="create"?(_(),b(r,{key:0,span:24},{default:l(()=>[f("div",be,[e(k,{type:"primary",onClick:Y},{default:l(()=>[E("\u4FDD\u5B58")]),_:1})])]),_:1})):x("v-if",!0)]),_:1})]),_:1},8,["rules","model","disabled"])),[[G,C.value]]),e(pe,{visible:d.visible,"onUpdate:visible":u[8]||(u[8]=a=>d.visible=a),index:d.index,detail:d.detail,type:d.type,onAdd:R,onUpdate:z},null,8,["visible","index","detail","type"])])}}});var he=J(Ee,[["__file","C:/Users/Administrator/Desktop/projects/purchase-vue3/src/views/sellOut/project/components/baseForm.vue"]]);export{he as default};