import{t as s,C as a}from"./index-b309bf9f-1782729249161v=1.0.0.js";const n=()=>({getInputType:l=>({input:"el-input",text:"el-input",time_second:"el-date-picker",number:"el-input-number",radio:"el-radio-group",checkbox:"el-checkbox-group",select:"el-select",img:"ImgsUpload"})[l]||l,formatQuestionList:l=>{let r=[];return l.forEach(e=>{var t;r.push({...e,formValue:null,selectValues:(t=e.selectValues)==null?void 0:t.split(",")})}),r},getFormQuestionList:(l,r=!1)=>{let e=[];return l.forEach(t=>{var i,o;r?t.commonUseFieldVal||e.push({...t,formValue:null,selectValues:(i=t.selectValues)==null?void 0:i.split(",")}):e.push({...t,formValue:null,selectValues:(o=t.selectValues)==null?void 0:o.split(",")})}),e},getFormRules:l=>{let r={};return l.forEach(e=>{Boolean(e.isFill)&&(r[e.fieldValue]=[{required:Boolean(e.isFill),message:e.prompt}])}),r},getFormValue:(l,r=!1)=>{let e={};return l.forEach(t=>{let i=null;(t.fieldType==="img"||t.fieldType==="checkbox")&&(i=[]),r&&t.commonUseFieldVal||(e[t.fieldValue]=i)}),e},getCustomtableConfig:l=>{let r=[];return l.forEach(e=>{r.push({fieldType:e.fieldType,fieldValue:e.fieldValue,fieldName:e.fieldName,commonUseFieldVal:e.commonUseFieldVal})}),r},formatSubmitForm:(l,r)=>{s().group("---\u683C\u5F0F\u5316\u63D0\u4EA4\u7684form\u8868\u5355---").log("data",l).log("tableConfig",r).groupEnd();let e=a(l),t={};r.forEach(i=>{t[i.fieldValue]=i});for(const i in e){let o=t[i];if(o)try{if(o.fieldType==="img"){let u=e[i].map(f=>({url:f.url,name:f.name}));e[i]=JSON.stringify(u)}o.fieldType==="checkbox"&&(e[i]=e[i].join(","))}catch{}}return e},formatEditForm:(l,r,e=!1)=>{let t={tsNo:l.commonUseFieldUnique,customFieldEntityId:l.customFieldEntityId};return(e?r.filter(o=>!o.commonUseFieldVal):r).forEach(o=>{let u=l[o.fieldValue];o.fieldType==="radio"&&(u=l[o.fieldValue+"Index"]?Number(l[o.fieldValue+"Index"]):null),o.fieldType==="checkbox"&&(u=l[o.fieldValue]?l[o.fieldValue].join(","):""),o.fieldType==="img"&&(u=l[o.fieldValue]?JSON.parse(l[o.fieldValue]):[]),o.fieldType&&(t[o.fieldValue]=u)}),t}}),b=n;export{b as u};
