import"./index.ad3efb29.js";import{w as u}from"./columns.c1b3552e.js";import{E as l}from"./elementPlus.4833989a.js";import{u as c,r as m}from"./vue.adf17aba.js";function g(r){const e={};for(const a in r){const t=c(r[a]);a==="currentDate"?(t.dailyStartDate&&t.dailyTime&&(e.data_start_date=t.dailyStartDate,e.data_end_date=t.dailyTime),t.weekStartDate&&t.weekEndDate&&(e.data_start_date=t.weekStartDate,e.data_end_date=t.weekEndDate),t.startDate&&t.endDate&&(e.data_start_date=t.startDate,e.data_end_date=t.endDate)):a==="taskIds"?e.task_ids=t:e[a]=t}return e}function N(r){const e={};for(const a in r){const t=c(r[a]);a==="monthCurrentDate"?(e.month_start_date=t.startDate,e.month_end_date=t.endDate):a==="taskIds"?e.task_ids=t:e[a]=t}return e}function o(r){let e=[];return r.forEach(a=>{a.children&&a.children.length>0?e=e.concat(o(a.children)):e.push(a)}),e}function h(r,e){const a=["sales_original","total_sales_current_monthly_original","ad_sales_original","ad_cost_original","money_by_amazon","money_by_other","refundRate"],t=["impression","ad_click","ad_order","session","order","availableSalesDay","intransitInventory","overseasStorage"];for(const s of e){const n=r[s],f=m(o(u.value)).value.find(_=>_.field===s),i=f?f.title:s;if(a.includes(s)){if(n==null||n==="")return l.warning(`${i} 不能为空`),!1;if(isNaN(Number(n)))return l.warning(`${i} 必须为数字`),!1}else if(t.includes(s)){if(n==null||n==="")return l.warning(`${i} 不能为空`),!1;if(!Number.isInteger(Number(n))||isNaN(Number(n)))return l.warning(`${i} 必须为整数`),!1}}return!0}function w(r,e){if(e!==""&&isNaN(e)){const a=r.field,s=m(o(u.value)).value.find(d=>d.field===a),n=s?s.title:field;return n?new Error(`${n} 必须为数字`):new Error("输入值必须为数字")}return!0}export{h as a,o as f,N as m,g as p,w as v};
