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