demand-modify-modal.0b7f4feb.js 4.4 KB

1
  1. import{_ as $,d as j,cl as Y,m as f,r as m,o as P,A as O,x as n,h as l,u as T,ct as Q,d4 as H,H as F,G as C,b as z,ce as D,S as k}from"./index.56449854.js";import{o as G}from"./index.96b4109c.js";import{c as v}from"./createRequset.56e9fc42.js";import{b as x}from"./calc.f00124e1.js";const y="admin/Tips/";var h={list:v(`${y}inv_list`),create:v(`${y}inv_create`),update:v(`${y}inv_update`),delete:v(`${y}inv_delete`)};const J={class:"w-full flex justify-end"},K=j({__name:"demand-modify-modal",props:{isBusiness:{type:Boolean,required:!1}},emits:["refresh"],setup(W,{expose:w,emit:I}){const c=Y(!1),g=Y(!1),M=f(null),i=f("create"),b=()=>({date:"",companyNo:"",totalTip1:"",totalTip2:""}),t=f(b()),N=f(null),U={date:[{required:!0,message:"\u8BF7\u9009\u62E9\u6570\u636E\u65F6\u95F4",trigger:"change"}],companyNo:[{required:!0,message:"\u8BF7\u9009\u62E9\u4E1A\u52A1\u516C\u53F8",trigger:"change"}],totalTip1:[{required:!0,message:"\u8BF7\u8F93\u5165\u8425\u6536\u76EE\u6807",trigger:"change"}],totalTip2:[{required:!0,message:"\u8BF7\u8F93\u5165\u6BDB\u5229\u76EE\u6807",trigger:"change"}]};function B(o,e){Number(o)>=1e8?t.value[e]=9999999999e-2:t.value[e]=G(o)}async function A(o,e){var s;try{await((s=N.value)==null?void 0:s.validate());const{companyNo:u,date:r,totalTip1:p,totalTip2:d,id:a}=t.value;if(Number(d)>Number(p)){D.warning("\u6BDB\u5229\u76EE\u6807\u4E0D\u80FD\u529F\u5927\u4E8E\u5E94\u6536\u76EE\u6807");return}g.value=!0;const[q,R]=r.split("-"),V={id:a,inv_tips:p,cost_tips:d,companyNo:u,month:R,year:q},_=i.value==="update";_||delete V.id;const E=await(_?h.update:h.create)(V);E.code==0||E.code==1?(D.success((_?"\u4FEE\u6539":"\u6DFB\u52A0")+"\u6210\u529F"),c.value=!1,I("refresh")):D.warning(E.message),g.value=!1}catch{}}function S(o){const e=k(new Date).format("YYYY"),s=k(o).format("YYYY"),u=new Date(2023,0,1);return s-e>=2||o.getTime()<u.getTime()}return w({onDisplay:o=>{if(c.value=!0,o.id){i.value="update";const{id:e,year:s,month:u,cost_tips:r,inv_tips:p,companyNo:d}=o;t.value={id:e,companyNo:d,date:`${s}-${String(u).length===1?"0"+u:u}`,totalTip1:p,totalTip2:r},setTimeout(()=>t.value.companyNo=o.companyNo,500)}else i.value="create",t.value={date:"",companyNo:o.companyNo,totalTip1:"",totalTip2:""},setTimeout(()=>t.value.companyNo=o.companyNo,500)}}),(o,e)=>{const s=m("ElDatePicker"),u=m("ElFormItem"),r=m("ElInput"),p=m("ElButton"),d=m("el-dialog");return P(),O(d,{modelValue:c.value,"onUpdate:modelValue":e[6]||(e[6]=a=>c.value=a),title:(i.value==="update"?"\u4FEE\u6539":"\u6DFB\u52A0")+"\u516C\u53F8\u6307\u6807",center:"",onClose:e[7]||(e[7]=()=>t.value=b()),"close-on-click-modal":!1,"close-on-press-escape":!1},{default:n(()=>[l(T(Q),{"label-width":"90px",rules:U,model:t.value,ref_key:"formRef",ref:N},{default:n(()=>[l(u,{label:"\u6307\u6807\u6708\u4EFD",prop:"date"},{default:n(()=>[l(s,{modelValue:t.value.date,"onUpdate:modelValue":e[0]||(e[0]=a=>t.value.date=a),type:"month",style:{width:"100%"},placeholder:"\u6307\u6807\u6708\u4EFD","value-format":"YYYY-MM",disabled:i.value==="update",disabledDate:S},null,8,["modelValue","disabled"])]),_:1}),l(u,{label:"\u6307\u6807\u516C\u53F8",prop:"companyNo"},{default:n(()=>[l(H,{ref_key:"businessQueryRef",ref:M,disabled:i.value==="update",modelValue:t.value.companyNo,"onUpdate:modelValue":e[1]||(e[1]=a=>t.value.companyNo=a),placeholder:"\u6307\u6807\u516C\u53F8"},null,8,["disabled","modelValue"])]),_:1}),l(u,{label:"\u5F00\u7968\u6307\u6807",prop:"totalTip1"},{default:n(()=>[l(r,{placeholder:"\u5F00\u7968\u6307\u6807",modelValue:t.value.totalTip1,"onUpdate:modelValue":e[2]||(e[2]=a=>t.value.totalTip1=a),onInput:e[3]||(e[3]=a=>B(a,"totalTip1"))},{append:n(()=>[F(C(T(x)(t.value.totalTip1)),1)]),_:1},8,["modelValue"])]),_:1}),l(u,{label:"\u5229\u6DA6\u6307\u6807",prop:"totalTip2"},{default:n(()=>[l(r,{placeholder:"\u5229\u6DA6\u6307\u6807",modelValue:t.value.totalTip2,"onUpdate:modelValue":e[4]||(e[4]=a=>t.value.totalTip2=a),onInput:e[5]||(e[5]=a=>B(a,"totalTip2"))},{append:n(()=>[F(C(T(x)(t.value.totalTip2)),1)]),_:1},8,["modelValue"])]),_:1}),l(u,null,{default:n(()=>[z("div",J,[l(p,{class:"float-right",loading:g.value,onClick:A,type:"primary"},{default:n(()=>[F(" \u4FDD\u5B58 ")]),_:1},8,["loading"])])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});var L=$(K,[["__file","C:/Users/89793/Desktop/projects/report-v3/src/views/tipsSetting/invCompanyTotalTips/components/demand-modify-modal.vue"]]),ue=Object.freeze(Object.defineProperty({__proto__:null,default:L},Symbol.toStringTag,{value:"Module"}));export{L as D,h as a,ue as d};