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