import{_ as O,d as I,dc as T,m as B,r as m,o as _,A as C,x as g,b as x,h as f,a as h,u as F,c as y,F as H,y as L,cZ as P,H as A,cc as v,cs as Z,L as R,M as q}from"./index.e80c366d.js";import{e as G}from"./execl-upload.39d2550d.js";import{d as J}from"./calc.3602fe08.js";import{c as w}from"./createRequset.60472412.js";const V="admin/reportChange/";var K={list:w(`${V}list`),create:w(`${V}create`)};const a={orderCode:"\u8D44\u91D1\u8BA4\u9886\u7F16\u53F7",corr:"\u4FEE\u6539\u540E\u7684\u7CFB\u6570(%)"},Q=Object.keys(a).map(r=>a[r]),W=[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"},...Object.keys(a).reduce((r,b)=>[...r,{prop:b,label:a[b]}],[])];const k=r=>(R("data-v-c9ff4826"),r=r(),q(),r),X={style:{width:"300px","margin-bottom":"10px",display:"flex","align-items":"center"}},Y=k(()=>x("p",{style:{color:"red","margin-right":"5px"}},"*",-1)),ee=k(()=>x("p",{style:{"white-space":"nowrap","margin-right":"5px"}},"\u4FEE\u6539\u90E8\u95E8:",-1)),ue={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},te=I({__name:"index",emits:["refresh"],setup(r,{expose:b,emit:S}){const i=T({visible:!1,loading:!1}),E=B(""),c=B([]);function U(u,e){if(u.length!==e.length)return v.warning("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),!1;for(const t in u)if(e[t]!==u[t])return v.warning("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),!1;return!0}function j(u){const e=[];let t=!0;const l=[];for(const o in u){const s=u[o];let n=!0,d="";const p=/^(?=.*[a-zA-Z])(?=.*\d)[a-zA-Z\d]+$/;String(s[a.orderCode]).trim()===""?(n=!1,d+=",\u8D44\u91D1\u8BA4\u9886\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A"):p.test(String(s[a.orderCode]).trim())===!1&&(n=!1,d+=",\u8D44\u91D1\u8BA4\u9886\u7F16\u53F7\u5FC5\u987B\u6709\u5B57\u6BCD\u548C\u6570\u5B57\u7EC4\u6210");const D=/^[+-]?(\d+(\.\d+)?|\.\d+)([eE][+-]?\d+)?$/;String(s[a.corr]).trim()===""?(n=!1,d+=",\u4FEE\u6539\u540E\u7684\u63D0\u6210\u7CFB\u6570\u4E0D\u80FD\u4E3A\u7A7A"):D.test(String(s[a.corr]).trim())===!1?(n=!1,d+=",\u4FEE\u6539\u540E\u7684\u63D0\u6210\u7CFB\u6570\u5FC5\u987B\u4E3A\u6570\u5B57"):Number(s[a.corr])>100&&(n=!1,d+=",\u4FEE\u6539\u540E\u7684\u63D0\u6210\u7CFB\u6570\u4E0D\u80FD\u8D85\u8FC7100%"),n||(t=!1),l.push(d),e.push({orderCode:s[a.orderCode],corr:s[a.corr]})}return{list:e,isValid:t,messages:l}}function M(u){return u.reduce((e,t,l)=>{const o=l===u.length-1?"</ul>":"";return e+(t?`<li><strong style="font-weight:700"> \u7B2C${Number(l)+1}\u884C</strong>${t}</li>`:"")+o},"<ul>")}const N=({results:u})=>{if(u.length===0){v.warning("\u4E0A\u4F20\u6570\u636E\u4E0D\u80FD\u4E3A\u7A7A!");return}const e=Object.keys(u[0]);if(!U(e,Q))return;const{isValid:t,list:l,messages:o}=j(u);if(!t){Z({type:"warning",title:"\u6570\u636E\u586B\u5199\u9519\u8BEF",dangerouslyUseHTMLString:!0,message:M(o)});return}c.value=l},$=async()=>{if(!E.value){v.warning("\u8BF7\u9009\u62E9\u4FEE\u6539\u90E8\u95E8");return}try{const u="1",e=E.value,t=c.value.map(({orderCode:o,corr:s})=>({orderCode:o,after:J(s,100)}));i.loading=!0;const l=await K.create({change_type:u,depart_type:e,list:t});if(Number(l.code)!==1){v.warning(l.message);return}S("refresh"),i.visible=!1}catch{}finally{i.loading=!1}},z=()=>{i.visible=!1,c.value=[],E.value=""};return b({onDisplay:()=>(i.visible=!0,c.value=[])}),(u,e)=>{const t=m("el-option"),l=m("el-select"),o=m("el-table-column"),s=m("el-table"),n=m("el-button"),d=m("el-dialog");return _(),C(d,{"close-on-click-modal":!1,modelValue:F(i).visible,"onUpdate:modelValue":e[2]||(e[2]=p=>F(i).visible=p),title:"\u9500\u552E\u63D0\u6210(\u63D0\u6210\u7CFB\u6570\u4FEE\u6539\uFF09",width:"1040px",top:"8vh",center:"",onClose:z},{default:g(()=>[x("div",X,[Y,ee,f(l,{modelValue:E.value,"onUpdate:modelValue":e[0]||(e[0]=p=>E.value=p)},{default:g(()=>[f(t,{value:"1",label:"\u5BA2\u670D\u90E8@\u767E\u8FB0\u8363\u8FBE"}),h(' <el-option value="2" label="\u65B0\u5A92\u4F53" /> '),f(t,{value:"3",label:"\u9879\u76EE\u90E8@\u666E\u6DA6\u5FC3\u5802"}),f(t,{value:"4",label:"\u9500\u552E\u90E8"})]),_:1},8,["modelValue"])]),c.value.length===0?(_(),C(F(G),{key:0,onOnSuccess:N})):h("v-if",!0),f(s,{data:c.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:g(()=>[(_(!0),y(H,null,L(F(W),(p,D)=>(_(),C(o,P(p,{key:D,"show-overflow-tooltip":""}),null,16))),128))]),_:1},8,["data"]),c.value.length!==0?(_(),y("div",ue,[f(n,{size:"small",onClick:e[1]||(e[1]=p=>c.value=[])},{default:g(()=>[A("\u53D6\u6D88")]),_:1}),f(n,{size:"small",type:"primary",loading:F(i).loading,onClick:$},{default:g(()=>[A("\u4FDD\u5B58")]),_:1},8,["loading"])])):h("v-if",!0)]),_:1},8,["modelValue"])}}});var le=O(te,[["__scopeId","data-v-c9ff4826"],["__file","C:/Users/63107/Desktop/projects/report-v3/src/views/update/commissionCoefficient/execl-files-upload/index.vue"]]),re=Object.freeze(Object.defineProperty({__proto__:null,default:le},Symbol.toStringTag,{value:"Module"}));export{le as E,K as a,re as i};
