add-edit-form.53a3b5.js 10 KB

1
  1. import{_ as fe,d as ye,x as p,W as P,p as he,aO as we,Z as Ce,A as $,y as be,b4 as Fe,r as m,aD as De,o as w,c as I,H,G as S,D as a,l as e,F as G,E as Q,m as _,cg as Be,cG as Ee,h as A,M as f,L as h,bP as ke,J as Z,K as ge,aQ as Ae,aZ as C,cH as xe,bL as Ne,z as Ve,Q as Ie,R as Se}from"./index.js";import{h as Re}from"./index.684ecd6b.js";import Te from"./order-dialog.6bddc3.js";import Oe from"./edit-order.bba840.js";import J from"./invoice-title.001bf0.js";import{convertInvoiceTitleData as K,convertInvoiceTitle as ze}from"./columns.17ba95.js";import{A as Le}from"./configs.55e4fd8d.js";import"./search-check.146e22.js";import"./inv-open.a495ad22.js";import"./search-batch.8d1810.js";import"./search-batch-main.447a41.js";const Ue=b=>(Ie("data-v-9bdd5bf4"),b=b(),Se(),b),qe={class:"addEditForm"},je={flex:"","justify-between":"","w-full":"","mb-2":""},Me={class:"flex"},Pe=Ue(()=>A("span",null,"\u64CD\u4F5C",-1)),$e={"w-full":""},He=ye({__name:"add-edit-form",setup(b){const W=p("order"),{companyList:Y}=P(),{push:X}=he(),R=p(null),T=p(null),F=p(null),c=p({}),O=we(),z=p(!1),v=p([]),{currentCompany:ee}=P(),L=p(0),D=150,t=p({...{companyNo:"",buy_id:"",invtype:"",email:"",remark:"",exam_remark:"",orderArr:[],companyType:"01",platform_type:""}}),U=p([]),q=Ce({...Le});function le(o,l){T.value.onDisplay({row:l})}function ue({row:o,inv_fee:l,num:n}){c.value[o.sequenceNo]={inv_fee:l,num:n,platform_type:o.platform_type}}const oe=(o,l)=>{const n=l===v.value.length-1;if(v.value.length===1)return t.value.remark=t.value.remark.split(o).join("");t.value.remark=t.value.remark.split(n?";"+o:o+";").join("")},te=o=>{const{sequenceNo:l,poCode:n}=v.value[o];oe(n,o),delete c.value[l],v.value.splice(o,1)};function j(){return{orderArr:Object.keys(c.value).map(n=>{const{inv_fee:r,num:i,platform_type:d}=c.value[n];return{platform_type:d,sequenceNo:n,inv_fee:r,num:i}})}}function ae(){F.value.validate(async o=>{if(!o)return;if(t.value.remark.length>184)return C.error("\u53D1\u7968\u5907\u6CE8\u4E0D\u80FD\u8D85\u8FC7184\u4E2A\u5B57\u7B26");if(v.value.length>D)return C.error(`\u8BA2\u5355\u6570\u91CF\u4E0D\u80FD\u8D85\u8FC7${D}\u4E2A`);const{orderArr:l}=j(),n=l.reduce((d,{inv_fee:y})=>d+Number(y),0);if(t.value.invtype==="fully_digitalized_special_electronic"||t.value.invtype==="fully_digitalized_normal_electronic"){if(n>1e3*1e4)return C.error("\u8BA2\u5355\u603B\u91D1\u989D\u4E0D\u80FD\u8D85\u8FC71000\u4E07")}else if(n>L.value)return C.error("\u8BA2\u5355\u603B\u91D1\u989D\u8D85\u8FC7\u6700\u5927\u5F00\u7968\u9762\u989D");const{code:r,message:i}=await xe({relaComNo:t.value.companyNo,...t.value,...j(),is_comon:"0"});O({code:r,message:i,handler:()=>X("/InvoiceSales/invoiceApply")})})}function ne(){const{invtype:o}=t.value;q.email[0].required=o==="special_electronic"||o==="electronic"||o==="fully_digitalized_special_electronic"||o==="fully_digitalized_normal_electronic"}function re(){const{companyNo:o,platform_type:l}=t.value;if(!o)return C.warning("\u8BF7\u9009\u62E9\u9500\u552E\u516C\u53F8\u62AC\u5934");if(!l)return C.warning("\u8BF7\u9009\u62E9\u5E73\u53F0\u7C7B\u578B");R.value.show(o,l)}function ie(o){t.value.remark="",o.forEach((l,n)=>{const{sequenceNo:r,platform_type:i,winv_fee:d,winv_num:y,poCode:E}=l;c.value[r]||(c.value[r]={inv_fee:d,num:y,platform_type:i},v.value.push(l),t.value.remark+=n===0?E:";"+E)})}const x=p({}),N=p({});function M(o,l){if(!l)return o?x.value={}:N.value={};if(o){const{invoiceType:n,denomination:r}=l;L.value=Number(r)*1e4;const i=n.split(",");t.value.invtype="",U.value=Ne.filter(({value:d})=>i.includes(d))}o?x.value=K(ze(l)):N.value=K(l)}const se=M.bind(null,!0),de=M.bind(null,!1);async function pe(o){t.value.companyNo=o;const{code:l,data:n,message:r}=await Re({companyNo:o});Ve(()=>{F.value&&F.value.validateField("companyNo")}),O({code:l,message:r,handler:()=>se(n.list[0])})}$(()=>t.value.platform_type,()=>{t.value.remark="",v.value=[],c.value={}},{immediate:!0}),be(()=>{pe(ee.value.companyNo)});const B=p("0.00");return $(()=>c.value,o=>{B.value="0.00",Object.keys(c.value).map(n=>{const{inv_fee:r}=c.value[n];B.value=Number(Fe(B.value,r)).toFixed(2)})},{deep:!0}),(o,l)=>{const n=m("el-option"),r=m("el-select"),i=m("el-form-item"),d=m("el-col"),y=m("el-input"),E=m("el-switch"),V=m("el-tag"),k=m("el-button"),s=m("el-table-column"),ce=m("el-table"),me=m("el-row"),ve=De("loading");return w(),I("div",qe,[H((w(),S(_(Ae),{ref_key:"formRef",ref:F,model:t.value,rules:q,"status-icon":"",size:"small"},{default:a(()=>[e(me,null,{default:a(()=>[e(d,{span:12},{default:a(()=>[e(i,{label:"\u9500\u552E\u65B9\u516C\u53F8\u62AC\u5934",prop:"companyNo"},{default:a(()=>[e(r,{style:{width:"100%"},placeholder:"\u9500\u552E\u65B9\u516C\u53F8\u62AC\u5934",disabled:"",modelValue:t.value.companyNo,"onUpdate:modelValue":l[0]||(l[0]=u=>t.value.companyNo=u)},{default:a(()=>[(w(!0),I(G,null,Q(_(Y),u=>(w(),S(n,{key:u.companyCode,value:u.companyCode,label:u.companyName},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1}),e(J,{detail:x.value},null,8,["detail"])]),_:1}),e(d,{span:12},{default:a(()=>[e(i,{label:"\u8D2D\u4E70\u65B9\u516C\u53F8\u62AC\u5934",prop:"buy_id"},{default:a(()=>[e(_(Be),{"is-root":"",value:t.value.buy_id,"onUpdate:value":l[1]||(l[1]=u=>t.value.buy_id=u),api:_(Ee),style:{width:"100%"},placeholder:"\u8D2D\u4E70\u65B9\u516C\u53F8\u62AC\u5934","request-prop":"name","response-label-prop":"invoice_title","response-val-prop":"id",onItemChange:_(de)},null,8,["value","api","onItemChange"])]),_:1}),e(J,{detail:N.value},null,8,["detail"])]),_:1}),e(d,{span:6},{default:a(()=>[e(i,{label:"\u53D1\u7968\u7C7B\u578B",prop:"invtype"},{default:a(()=>[e(r,{modelValue:t.value.invtype,"onUpdate:modelValue":l[2]||(l[2]=u=>t.value.invtype=u),style:{width:"100%"},onChange:ne,placeholder:"\u53D1\u7968\u7C7B\u578B","no-data-text":"\u8BF7\u9009\u62E9\u5176\u4ED6\u9500\u552E\u65B9\u516C\u53F8"},{default:a(()=>[(w(!0),I(G,null,Q(U.value,u=>(w(),S(n,{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),e(i,{label:"\u7535\u5B50\u90AE\u7BB1",prop:"email"},{default:a(()=>[e(y,{modelValue:t.value.email,"onUpdate:modelValue":l[3]||(l[3]=u=>t.value.email=u),placeholder:"\u7535\u5B50\u90AE\u7BB1"},null,8,["modelValue"])]),_:1}),e(i,{label:"\u5E73\u53F0\u7C7B\u578B",prop:"platform_type"},{default:a(()=>[e(E,{modelValue:t.value.platform_type,"onUpdate:modelValue":l[4]||(l[4]=u=>t.value.platform_type=u),size:"small","active-text":"toC","inactive-text":"toB","active-value":"2","inactive-value":"1"},null,8,["modelValue"])]),_:1})]),_:1}),e(d,{span:18},{default:a(()=>[e(i,{label:"\u7533\u8BF7\u5907\u6CE8",prop:"exam_remark"},{default:a(()=>[e(y,{"w-full":"",modelValue:t.value.exam_remark,"onUpdate:modelValue":l[5]||(l[5]=u=>t.value.exam_remark=u),rows:5,type:"textarea",maxlength:"2000",placeholder:"\u7533\u8BF7\u5907\u6CE8","show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1}),H(e(d,{span:24},{default:a(()=>[e(i,{label:"\u8BA2\u5355\u5217\u8868"},{default:a(()=>[A("div",je,[A("div",Me,[e(V,{type:v.value.length>D?"danger":"info"},{default:a(()=>[f(h(v.value.length)+" / "+h(D),1)]),_:1},8,["type"]),e(V,{style:{"margin-left":"10px"},type:"primary",size:"small"},{default:a(()=>[f(h(B.value)+"\u5143",1)]),_:1})]),e(k,{type:"primary",onClick:re},{default:a(()=>[f("\u6DFB\u52A0")]),_:1})]),e(ce,{data:v.value,stripe:"",border:"","max-height":"300"},{default:a(()=>[e(s,{prop:"sequenceNo",label:"\u9500\u552E\u8BA2\u5355\u7F16\u7801","show-overflow-tooltip":"",width:"150"}),e(s,{prop:"cxCode",label:"\u9500\u552E\u8BA2\u5355\u4E3B\u7F16\u7801","show-overflow-tooltip":"",width:"150"}),e(s,{prop:"poCode",label:"\u5E73\u53F0\u8BA2\u5355\u7F16\u7801","show-overflow-tooltip":"",width:"150"}),e(s,{prop:"customerNo",label:"\u8D2D\u4E70\u65B9\u516C\u53F8\u7F16\u7801",width:"150","show-overflow-tooltip":""}),e(s,{prop:"inv_cat_code",label:"\u7C7B\u76EE\u7F16\u7801","show-overflow-tooltip":"",width:"110"}),e(s,{prop:"inv_cat_name",label:"\u8D27\u7269\u548C\u52B3\u52A1\u540D\u79F0","show-overflow-tooltip":"",width:"110"}),e(s,{prop:"inv_good_name",label:"\u5F00\u7968\u5546\u54C1\u540D\u79F0","show-overflow-tooltip":"",width:"110"}),e(s,{prop:"inv_tax",label:"\u5F00\u7968\u7A0E\u7387","show-overflow-tooltip":"",width:"80"},{default:a(({row:u})=>[f(h(u.inv_tax?Number(u.inv_tax)*100+"%":""),1)]),_:1}),e(s,{prop:"customerName",label:"\u8D2D\u4E70\u65B9\u516C\u53F8\u540D\u79F0","show-overflow-tooltip":"",width:"200"}),e(s,{prop:"winv_num",label:"\u672A\u5F00\u7968\u6570\u91CF","show-overflow-tooltip":"",width:"110"}),e(s,{prop:"winv_fee",label:"\u672A\u5F00\u7968\u91D1\u989D","show-overflow-tooltip":"",width:"110"}),e(s,{label:"\u5E73\u53F0\u7C7B\u578B",width:"110","show-overflow-tooltip":""},{default:a(({row:u})=>[e(V,{size:"small"},{default:a(()=>{var g;return[f(h((g=_(ke).find(_e=>_e.value===String(u.platform_type)))==null?void 0:g.label),1)]}),_:2},1024)]),_:1}),e(s,{label:"\u5F00\u7968\u91D1\u989D",width:"110","show-overflow-tooltip":""},{default:a(({row:u})=>[f(h(c.value[u.sequenceNo].inv_fee),1)]),_:1}),e(s,{label:"\u5F00\u7968\u6570\u91CF","show-overflow-tooltip":""},{default:a(({row:u})=>[f(h(c.value[u.sequenceNo].num),1)]),_:1}),e(s,{label:"\u4E1A\u52A1\u5458","show-overflow-tooltip":"",prop:"ownerName",width:"80"}),e(s,{fixed:"right",width:"70"},{header:a(()=>[Pe]),default:a(u=>[e(k,{size:"small",type:"primary",link:"",icon:_(Z)("edits"),onClick:g=>le(u.$index,u.row)},null,8,["icon","onClick"]),e(k,{size:"small",type:"danger",link:"",icon:_(Z)("delete"),onClick:g=>te(u.$index)},null,8,["icon","onClick"])]),_:1})]),_:1},8,["data"])]),_:1})]),_:1},512),[[ge,W.value==="order"]]),e(d,{span:24},{default:a(()=>[e(i,{label:"\u53D1\u7968\u5907\u6CE8",prop:"remark"},{default:a(()=>[A("div",$e,[e(y,{"w-full":"",modelValue:t.value.remark,"onUpdate:modelValue":l[6]||(l[6]=u=>t.value.remark=u),rows:3,type:"textarea",maxlength:"2000","show-word-limit":"",placeholder:"\u53D1\u7968\u5907\u6CE8"},null,8,["modelValue"])])]),_:1})]),_:1}),e(d,{span:24,flex:"","justify-end":""},{default:a(()=>[e(k,{loading:z.value,type:"primary",onClick:ae},{default:a(()=>[f("\u4FDD\u5B58")]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1},8,["model","rules"])),[[ve,z.value]]),e(Te,{ref_key:"modelRef",ref:R,onSaveBtnClick:ie},null,512),e(Oe,{ref_key:"editOrderRef",ref:T,onSaveBtnClick:ue},null,512)])}}});var tl=fe(He,[["__scopeId","data-v-9bdd5bf4"],["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/InvoiceSales/invoiceApply/components/add-edit-form/add-edit-form.vue"]]);export{tl as default};