import{_ as O,d as I,dc as T,m as y,r as f,o as _,A as B,x as g,b as x,h as p,u as F,a as C,c as A,F as H,y as L,cZ as P,H as D,cc as v,cs as Z,L as R,M as q}from"./index.e80c366d.js";import{c as w}from"./createRequset.60472412.js";import{e as G}from"./execl-upload.39d2550d.js";const V="admin/reportChange/";var J={list:w(`${V}list`),create:w(`${V}create`)};const s={orderCode:"\u9500\u552E\u4E3B\u8BA2\u5355\u7F16\u53F7",corr:"\u4FEE\u6539\u540E\u521B\u5EFA\u65F6\u95F4"},K=Object.keys(s).map(n=>s[n]),Q=[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"},...Object.keys(s).reduce((n,b)=>[...n,{prop:b,label:s[b]}],[])];const k=n=>(R("data-v-207ed5c1"),n=n(),q(),n),W={style:{width:"300px","margin-bottom":"10px",display:"flex","align-items":"center"}},X=k(()=>x("p",{style:{color:"red","margin-right":"5px"}},"*",-1)),Y=k(()=>x("p",{style:{"white-space":"nowrap","margin-right":"5px"}},"\u4FEE\u6539\u90E8\u95E8:",-1)),ee={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},ue=I({__name:"index",emits:["refresh"],setup(n,{expose:b,emit:S}){const r=T({visible:!1,loading:!1}),m=y(""),i=y([]);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 a=u[o];let c=!0,E="";const d=/^\d{4}-\d{2}-\d{2}$/,h=/^(?=.*[a-zA-Z])(?=.*\d)[a-zA-Z\d]+$/;String(a[s.orderCode]).trim()===""?(c=!1,E+=",\u9500\u552E\u4E3B\u8BA2\u5355\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A"):h.test(String(a[s.orderCode]).trim())===!1&&(c=!1,E+=",\u9500\u552E\u4E3B\u8BA2\u5355\u7F16\u53F7\u5FC5\u987B\u6709\u5B57\u6BCD\u548C\u6570\u5B57\u7EC4\u6210"),String(a[s.corr]).trim()===""?(c=!1,E+=",\u4FEE\u6539\u540E\u7684\u521B\u5EFA\u65F6\u95F4\u4E0D\u80FD\u4E3A\u7A7A"):d.test(String(a[s.corr]).trim())===!1&&(c=!1,E+=",\u4FEE\u6539\u540E\u7684\u521B\u5EFA\u65F6\u95F4\u683C\u5F0F\u4E0D\u6B63\u786E"),c||(t=!1),l.push(E),e.push({orderCode:a[s.orderCode],corr:a[s.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 $=({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,K))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}i.value=l},z=async()=>{if(!m.value){v.warning("\u8BF7\u9009\u62E9\u4FEE\u6539\u90E8\u95E8");return}try{const u="2",e=m.value,t=i.value.map(({orderCode:o,corr:a})=>({orderCode:o,after:a}));r.loading=!0;const l=await J.create({change_type:u,depart_type:e,list:t});if(Number(l.code)!==1){v.warning(l.message);return}S("refresh"),r.visible=!1}catch{}finally{r.loading=!1}},N=()=>{r.visible=!1,i.value=[],m.value=""};return b({onDisplay:()=>(r.visible=!0,i.value=[])}),(u,e)=>{const t=f("el-option"),l=f("el-select"),o=f("el-table-column"),a=f("el-table"),c=f("el-button"),E=f("el-dialog");return _(),B(E,{"close-on-click-modal":!1,modelValue:F(r).visible,"onUpdate:modelValue":e[2]||(e[2]=d=>F(r).visible=d),title:"\u9500\u552E\u63D0\u6210(\u4E0B\u5355\u65F6\u95F4\u4FEE\u6539)",width:"1040px",top:"8vh",center:"",onClose:N},{default:g(()=>[x("div",W,[X,Y,p(l,{modelValue:m.value,"onUpdate:modelValue":e[0]||(e[0]=d=>m.value=d)},{default:g(()=>[p(t,{value:"1",label:"\u5BA2\u670D\u90E8@\u767E\u8FB0\u8363\u8FBE"}),p(t,{value:"2",label:"\u65B0\u5A92\u4F53"}),p(t,{value:"3",label:"\u9879\u76EE\u90E8@\u666E\u6DA6\u5FC3\u5802"}),p(t,{value:"4",label:"\u9500\u552E\u90E8"})]),_:1},8,["modelValue"])]),i.value.length===0?(_(),B(F(G),{key:0,onOnSuccess:$})):C("v-if",!0),p(a,{data:i.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:g(()=>[(_(!0),A(H,null,L(F(Q),(d,h)=>(_(),B(o,P(d,{key:h,"show-overflow-tooltip":""}),null,16))),128))]),_:1},8,["data"]),i.value.length!==0?(_(),A("div",ee,[p(c,{size:"small",onClick:e[1]||(e[1]=d=>i.value=[])},{default:g(()=>[D("\u53D6\u6D88")]),_:1}),p(c,{size:"small",type:"primary",loading:F(r).loading,onClick:z},{default:g(()=>[D("\u4FDD\u5B58")]),_:1},8,["loading"])])):C("v-if",!0)]),_:1},8,["modelValue"])}}});var te=O(ue,[["__scopeId","data-v-207ed5c1"],["__file","C:/Users/63107/Desktop/projects/report-v3/src/views/update/correctedTime/execl-files-upload/index.vue"]]),oe=Object.freeze(Object.defineProperty({__proto__:null,default:te},Symbol.toStringTag,{value:"Module"}));export{te as E,J as a,oe as i};
