index.9c7237ce.js 4.7 KB

1
  1. import{_ as O,d as I,db as T,m as y,r as E,o as _,A as h,x as g,b as x,h as f,a as B,u as v,c as D,F as H,y as L,cZ as P,H as A,cc as F,cs as Z,L as R,M as q}from"./index.62ae038d.js";import{e as G}from"./execl-upload.2b101cff.js";import{c as w}from"./createRequset.2509add7.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\u6210\u672C"},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-7ddf98c1"),n=n(),q(),n),W={style:{width:"300px",display:"flex","margin-bottom":"10px","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 d=T({visible:!1,loading:!1}),m=y(""),r=y([]);function U(u,e){if(u.length!==e.length)return F.warning("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),!1;for(const t in u)if(e[t]!==u[t])return F.warning("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),!1;return!0}function j(u){const e=[],t=[];let l=!0;for(const o in u){const a=u[o];let i=!0,p="";const c=/^(?=.*[a-zA-Z])(?=.*\d)[a-zA-Z\d]+$/;String(a[s.orderCode]).trim()===""?(i=!1,p+=",\u9500\u552E\u4E3B\u8BA2\u5355\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A"):c.test(String(a[s.orderCode]).trim())===!1&&(i=!1,p+=",\u9500\u552E\u4E3B\u8BA2\u5355\u7F16\u53F7\u5FC5\u987B\u7531\u5B57\u6BCD\u548C\u6570\u5B57\u7EC4\u6210");const C=/^[+-]?(\d+(\.\d+)?|\.\d+)([eE][+-]?\d+)?$/;String(a[s.corr]).trim()===""?(i=!1,p+=",\u4FEE\u6539\u540E\u7684\u63D0\u6210\u7CFB\u6570\u4E0D\u80FD\u4E3A\u7A7A"):C.test(String(a[s.corr]).trim())===!1&&(i=!1,p+=",\u4FEE\u6539\u540E\u7684\u63D0\u6210\u7CFB\u6570\u5FC5\u987B\u4E3A\u6570\u5B57"),i||(l=!1),t.push(p),e.push({orderCode:a[s.orderCode],corr:a[s.corr]})}return{list:e,isValid:l,messages:t}}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){F.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}r.value=l},z=async()=>{if(!m.value){F.warning("\u8BF7\u9009\u62E9\u4FEE\u6539\u90E8\u95E8");return}try{const u="3",e=m.value,t=r.value.map(({orderCode:o,corr:a})=>({orderCode:o,after:a})),l=await J.create({change_type:u,depart_type:e,list:t});if(Number(l.code)!==1){F.warning(l.message);return}S("refresh"),d.visible=!1}catch{}finally{d.loading=!1}},N=()=>{d.visible=!1,r.value=[],m.value=""};return b({onDisplay:()=>(d.visible=!0,r.value=[])}),(u,e)=>{const t=E("el-option"),l=E("el-select"),o=E("el-table-column"),a=E("el-table"),i=E("el-button"),p=E("el-dialog");return _(),h(p,{title:"\u9500\u552E\u63D0\u6210(\u8BA2\u5355\u5546\u54C1\u6210\u672C\u4FEE\u6539\uFF09","close-on-click-modal":!1,modelValue:v(d).visible,"onUpdate:modelValue":e[2]||(e[2]=c=>v(d).visible=c),onClose:N,width:"1040px",top:"8vh",center:""},{default:g(()=>[x("div",W,[X,Y,f(l,{modelValue:m.value,"onUpdate:modelValue":e[0]||(e[0]=c=>m.value=c)},{default:g(()=>[f(t,{value:"1",label:"\u5BA2\u670D\u90E8@\u767E\u8FB0\u8363\u8FBE"}),B(' <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"])]),r.value.length===0?(_(),h(v(G),{key:0,onOnSuccess:$})):B("v-if",!0),f(a,{data:r.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:g(()=>[(_(!0),D(H,null,L(v(Q),(c,C)=>(_(),h(o,P(c,{key:C,"show-overflow-tooltip":""}),null,16))),128))]),_:1},8,["data"]),r.value.length!==0?(_(),D("div",ee,[f(i,{size:"small",onClick:e[1]||(e[1]=c=>r.value=[])},{default:g(()=>[A("\u53D6\u6D88")]),_:1}),f(i,{size:"small",type:"primary",loading:v(d).loading,onClick:z},{default:g(()=>[A("\u4FDD\u5B58")]),_:1},8,["loading"])])):B("v-if",!0)]),_:1},8,["modelValue"])}}});var te=O(ue,[["__scopeId","data-v-7ddf98c1"],["__file","C:/Users/63107/Desktop/projects/report-v3/src/views/update/correctedCost/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};