1 |
- import{_ as z,d as G,w as p,Z as Y,br as q,ag as L,a0 as M,r,o as f,G as V,C as t,l as a,u as i,aR as O,c as N,F as S,D as H,a as P,b as Z,M as J,aY as g,ae as Q}from"./index.fd765376.js";import{i as W}from"./status.4c13d767.js";import{f as T}from"./status.0f05917e.js";import{l as X}from"./index.d7755e1d.js";const ee={class:"flex justify-end"},ue=G({__name:"back-modal",emits:["refresh"],setup(le,{expose:j,emit:I}){const R={10:"electronic",20:"special_electronic","01":"special","04":"normal"},b=p(""),A=p(""),B=p(!1),x=p(null),U=Y({inv_code:[{required:!0,message:"\u53D1\u7968\u4EE3\u7801\u683C\u5F0F\u4E0D\u6B63\u786E",trigger:"blur",validator(n,e){return e?q(e):new Error("\u53D1\u7968\u4EE3\u7801\u4E0D\u80FD\u4E3A\u7A7A")}}],inv_number:[{required:!0,message:"\u53D1\u7968\u53F7\u7801\u683C\u5F0F\u4E0D\u6B63\u786E",trigger:"blur",validator(n,e){return e?q(e):new Error("\u53D1\u7968\u53F7\u7801\u4E0D\u80FD\u4E3A\u7A7A")}}],open_date:[{required:!0,message:"\u8BF7\u9009\u62E9\u5F00\u7968\u65E5\u671F",trigger:"change"}],inv_total:[{required:!0,message:"\u8BF7\u8F93\u5165\u7A0E\u540E\u91D1\u989D",trigger:"blur"}],inv_subtotal:[{required:!0,message:"\u8BF7\u8F93\u5165\u7A0E\u524D\u91D1\u989D",trigger:"blur"}],check_code:[{required:!1,message:"\u8BF7\u8F93\u5165\u6821\u9A8C\u7801",trigger:"change"}]}),m=p(""),F=L(()=>l.input_type==="1"),k=p(!1),_=p(""),l=Y({input_type:"1",remark:"",inv_code:"",inv_number:"",open_date:null,inv_subtotal:0,check_code:""});function $(){x.value.validate(async n=>{if(!n)return;const{input_type:e,inv_subtotal:s,check_code:v,...o}=l;let c=null;const d=R[m.value];if(m.value&&String(b.value)!==String(d))return g.error("\u626B\u63CF\u8BC6\u522B\u7684\u53D1\u7968\u7C7B\u578B\u4E0E\u5F00\u7968\u7C7B\u578B\u4E0D\u4E00\u81F4");c={invNo:A.value,inv_subtotal:s.toFixed(2),...v?{check_code:v}:{},...o},k.value=!0;const{code:D,message:E}=await X(c);switch(k.value=!1,D){case 0:B.value=!1,I("refresh");break;default:g.warning(E);break}})}function K(n){const{keyCode:e}=n;if(e!==13)return;if(_.value.indexOf("\uFF0C")>=0)return g.error("\u4E0D\u80FD\u5305\u542B\u4E2D\u6587\u9017\u53F7"),_.value="";const s=_.value.split(",");if(s.length!==9){g.error("\u626B\u7801\u67AA\u8BC6\u522B\u6570\u636E\u683C\u5F0F\u4E0D\u6B63\u786E,\u8BF7\u91CD\u65B0\u626B\u63CF\u3002");return}const[v,o,...c]=s,[d,D,E,y,C]=c;m.value=o;const w=y.slice(0,4),u=y.slice(4,6),h=y.slice(6);l.inv_code=d,l.check_code=C,l.inv_number=D,l.inv_subtotal=Number(E),l.open_date=Q(`${w}-${u}-${h}`).format("YYYY-MM-DD HH:mm:ss"),_.value=""}return M(()=>{U.check_code[0].required=b.value==="normal"||b.value==="electronic"}),M(()=>{const{input_type:n}=l;if(n==="2"){const e=T.find(({value:s})=>s===b.value);e&&(m.value=e.scanValue)}}),j({onDisplay:(n,e)=>{B.value=!0,b.value=n,A.value=e}}),(n,e)=>{const s=r("el-option"),v=r("el-select"),o=r("el-form-item"),c=r("el-col"),d=r("el-input"),D=r("el-row"),E=r("el-date-picker"),y=r("el-input-number"),C=r("el-button"),w=r("el-dialog");return f(),V(w,{modelValue:B.value,"onUpdate:modelValue":e[8]||(e[8]=u=>B.value=u)},{default:t(()=>[a(i(O),{ref_key:"formRef",ref:x,model:l,rules:U,"label-width":"90px",class:"demo-ruleForm",size:"small","status-icon":""},{default:t(()=>[a(D,null,{default:t(()=>[a(c,{span:12},{default:t(()=>[a(o,{label:"\u8F93\u5165\u7C7B\u578B",prop:"input_type"},{default:t(()=>[a(v,{modelValue:l.input_type,"onUpdate:modelValue":e[0]||(e[0]=u=>l.input_type=u),style:{width:"100%"},placeholder:"\u83DC\u5355\u7C7B\u578B"},{default:t(()=>[(f(!0),N(S,null,H(i(W),(u,h)=>(f(),V(s,{key:"type"+u.value+h,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.input_type==="1"?(f(),V(c,{key:0,span:24,style:{padding:"12px 12px 12px 16px"}},{default:t(()=>[a(d,{clearable:"",modelValue:_.value,"onUpdate:modelValue":e[1]||(e[1]=u=>_.value=u),rows:3,type:"textarea",placeholder:"\u626B\u7801\u67AA\u8F93\u5165\u5904",onKeydown:K},null,8,["modelValue"])]),_:1})):P("v-if",!0)]),_:1}),a(o,{label:"\u53D1\u7968\u7C7B\u578B"},{default:t(()=>[a(v,{style:{width:"100%"},modelValue:m.value,"onUpdate:modelValue":e[2]||(e[2]=u=>m.value=u),disabled:""},{default:t(()=>[(f(!0),N(S,null,H(i(T),u=>(f(),V(s,{key:u.scanValue,value:u.scanValue,label:u.label},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(o,{label:"\u53D1\u7968\u53F7\u7801",prop:"inv_number"},{default:t(()=>[a(d,{modelValue:l.inv_number,"onUpdate:modelValue":e[3]||(e[3]=u=>l.inv_number=u),placeholder:"\u53D1\u7968\u53F7\u7801",disabled:i(F)},null,8,["modelValue","disabled"])]),_:1}),a(o,{label:"\u53D1\u7968\u4EE3\u7801",prop:"inv_code"},{default:t(()=>[a(d,{modelValue:l.inv_code,"onUpdate:modelValue":e[4]||(e[4]=u=>l.inv_code=u),placeholder:"\u53D1\u7968\u4EE3\u7801",disabled:i(F)},null,8,["modelValue","disabled"])]),_:1}),a(o,{label:"\u5F00\u7968\u65E5\u671F",prop:"open_date"},{default:t(()=>[a(E,{style:{width:"100%"},"value-format":"YYYY-MM-DD HH:mm:ss",modelValue:l.open_date,"onUpdate:modelValue":e[5]||(e[5]=u=>l.open_date=u),disabled:i(F)},null,8,["modelValue","disabled"])]),_:1}),a(o,{label:"\u7A0E\u524D\u91D1\u989D",prop:"inv_subtotal"},{default:t(()=>[a(y,{modelValue:l.inv_subtotal,"onUpdate:modelValue":e[6]||(e[6]=u=>l.inv_subtotal=u),precision:2,style:{width:"100%"},min:0,max:999999,disabled:i(F)},null,8,["modelValue","disabled"])]),_:1}),a(o,{label:"\u6821\u9A8C\u7801",prop:"check_code"},{default:t(()=>[a(d,{placeholde:"\u8BF7\u8F93\u5165\u6821\u9A8C\u7801",modelValue:l.check_code,"onUpdate:modelValue":e[7]||(e[7]=u=>l.check_code=u),disabled:i(F)},null,8,["modelValue","disabled"])]),_:1}),Z("div",ee,[a(C,{type:"primary",loading:k.value,onClick:$},{default:t(()=>[J("\u4FDD\u5B58")]),_:1},8,["loading"])])]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])}}});var re=z(ue,[["__file","C:/Users/63107/Desktop/projects/accout-vue3-ui/src/views/InvoiceSales/invoiceApply/components/back-modal.vue"]]);export{re as default};
|