<#include "/common/utils.ftl">
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
 <#list columns as po>
   <#-- update-begin---author:chenrui ---date:20240108  for：[issues/5755]vue代码不加入逻辑删除字段---------- -->
   <#if po.isShowList =='Y' && po.fieldName !='id' && po.fieldName !='delFlag'>
   <#-- update-end---author:chenrui ---date:20240108  for：[issues/5755]vue代码不加入逻辑删除字段---------- -->
   {
    title: '${po.filedComment}',
    align:"center",
    <#if po.sort=='Y'>
    sorter: true,
   </#if>
    <#if po.classType=='date'>
    dataIndex: '${po.fieldName}',
    customRender:({text}) =>{
      text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
      <#if po.extendParams?exists && po.extendParams.picker?exists>
      if(text) {
        return getWeekMonthQuarterYear(text)['${po.extendParams.picker}'];
      } else {
        return text;
      }
      <#else>
      return text;
      </#if>
    },
    <#elseif po.fieldDbType=='Blob'>
    dataIndex: '${po.fieldName}String'
    <#elseif po.classType=='umeditor'>
    dataIndex: '${po.fieldName}',
    <#elseif po.classType=='pca'>
    dataIndex: '${po.fieldName}',
   <#elseif po.classType=='file'>
    dataIndex: '${po.fieldName}',
   <#elseif po.classType=='image'>
    dataIndex: '${po.fieldName}',
    customRender:render.renderImage,
   <#elseif po.classType=='switch'>
    dataIndex: '${po.fieldName}',
<#assign switch_extend_arr=['Y','N']>
<#if po.dictField?default("")?contains("[")>
<#assign switch_extend_arr=po.dictField?eval>
</#if>
<#list switch_extend_arr as a>
<#if a_index == 0>
<#assign switch_extend_arr1=a>
<#else>
<#assign switch_extend_arr2=a>
</#if>
</#list>
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
     },
   <#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user' || po.classType=='popup_dict'>
    dataIndex: '${po.fieldName}_dictText'
   <#elseif po.classType=='cat_tree'>
    dataIndex: '${po.fieldName}',
    <#if po.dictText?default("")?trim?length == 0>
    customRender:({text}) => {
       return  render.renderCategoryTree(text,'${po.dictField?default("")}')
   },
   <#else>
    customRender: ({text, record}) => (text ? record['${po.dictText}'] : '')
   </#if>
   <#else>
    dataIndex: '${po.fieldName}'
   </#if>
   },
   </#if>
 </#list>
];
//查询数据
export const searchFormSchema: FormSchema[] = [
<#-- 开始循环 -->
<#list columns as po>
<#if po.fieldDbName=='bpm_status'>
  <#assign bpm_flag=true>
</#if>
<#-- update-begin---author:chenrui ---date:20240108  for：[issues/5755]vue代码不加入逻辑删除字段---------- -->
<#if po.isQuery=='Y' && po.fieldName !='delFlag'>
<#-- update-end---author:chenrui ---date:20240108  for：[issues/5755]vue代码不加入逻辑删除字段---------- -->
<#assign query_flag=true>
	<#assign query_field_dictCode="">
	<#if po.dictTable?default("")?trim?length gt 1>
	    <#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
    <#elseif po.dictField?default("")?trim?length gt 1>
        <#assign query_field_dictCode="${po.dictField}">
    </#if>
<#if po.queryMode=='single'>
	{
      label: "${po.filedComment}",
      field: ${autoStringSuffix(po)},
<#if po.classType=='sel_search'>
      component: 'JSearchSelect',
      componentProps:{
         dict:"${po.dictTable},${po.dictText},${po.dictField}"
      },
<#elseif po.classType=='sel_user'>
<#-- update-begin---author:chenrui ---date:20240102  for：[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
      component: 'JSelectUser',
<#-- update-end---author:chenrui ---date:20240102  for：[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
     componentProps:{
   <#if po.extendParams?exists && po.extendParams.text?exists>
       labelKey: '${po.extendParams.text}',
   </#if>
   <#if po.extendParams?exists && po.extendParams.store?exists>
       rowKey: '${po.extendParams.store}',
   </#if>
     },
<#elseif po.classType=='switch'>
      component: 'JSwitch',
      componentProps:{
           query:true,
           <#if po.dictField != 'is_open'>
           options:${po.dictField}
           </#if>
       },
 <#elseif po.classType=='sel_depart'>
      component: 'JSelectDept',
      componentProps:{
   <#if po.extendParams?exists && po.extendParams.text?exists>
       labelKey: '${po.extendParams.text}',
   </#if>
   <#if po.extendParams?exists && po.extendParams.store?exists>
       rowKey: '${po.extendParams.store}',
   </#if>
      },
 <#elseif po.classType=='list_multi'>
      component: 'JSelectMultiple',
       componentProps:{
      <#if po.dictTable?default("")?trim?length gt 1>
         dictCode:"${po.dictTable},${po.dictText},${po.dictField}",
      <#elseif po.dictField?default("")?trim?length gt 1>
         dictCode:"${po.dictField}",
      </#if>
         triggerChange: true
      },
 <#elseif po.classType=='cat_tree'>
      component: 'JCategorySelect',
      componentProps:{
          pcode:"${po.dictField?default("")}",//back和事件未添加，暂时有问题
      },
<#elseif po.classType=='date'>
      component: 'DatePicker',
      componentProps: {
        <#if po.extendParams?exists && po.extendParams.picker?exists>
        picker: '${po.extendParams.picker}',
        </#if>
        valueFormat: 'YYYY-MM-DD'
      },      
<#elseif po.classType=='datetime'>
      component: 'DatePicker',
      componentProps: {
         showTime:true,
         valueFormat: 'YYYY-MM-DD HH:mm:ss'
       },
<#elseif po.classType=='pca'>
      component: 'JAreaLinkage',
      componentProps: {
        saveCode: 'region',
      },
<#elseif po.classType=='popup'>
    <#include "/common/form/vue3popup.ftl">
<#elseif po.classType=='popup_dict'>
      component: 'JPopupDict',
      componentProps: {
        placeholder: '请选择${po.filedComment}',
        dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
        multi: ${po.extendParams.popupMulti?c}
      },
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
<#--  ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
      component: 'JDictSelectTag',
      componentProps:{
       <#if po.dictTable?default("")?trim?length gt 1>
          dictCode:"${po.dictTable},${po.dictText},${po.dictField}"
       <#elseif po.dictField?default("")?trim?length gt 1>
          dictCode:"${po.dictField}"
        </#if>
      },
<#elseif po.classType == 'sel_tree'>
      component: 'JTreeSelect',
      componentProps:{
          <#if po.dictText??>
          <#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??>
          dict:"${po.dictTable},${po.dictText?split(',')[2]},${po.dictText?split(',')[0]}",
          <#elseif po.dictText?split(',')[1]??>
          pidField:"${po.dictText?split(',')[1]}",
          <#elseif po.dictText?split(',')[3]??>
          hasChildField:"${po.dictText?split(',')[3]}",
          </#if>
          </#if>
          pidValue:"${po.dictField}",
      },
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
      component: 'InputNumber',
<#else>
      component: 'Input',
</#if>
      //colProps: {span: 6},
 	},
<#else>
     {
      label: "${po.filedComment}",
      field: "${po.fieldName}",
<#if po.classType=='date'>
      component: 'RangePicker',
      componentProps: {
        <#if po.extendParams?exists && po.extendParams.picker?exists>
        picker: '${po.extendParams.picker}',
        </#if>
        valueType: 'Date',
      },
<#elseif po.classType=='datetime'>
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:true
      },
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
      component: 'JRangeNumber',
<#-- update-begin---author:chenrui ---date:20240527  for：[TV360X-388]时间范围查询控件---------- -->
<#elseif po.classType=='time'>
      component: 'RangeTime',
<#-- update-end---author:chenrui ---date:20240527  for：[TV360X-388]时间范围查询控件---------- -->
<#else>
      component: 'Input', //TODO 范围查询
</#if>
      //colProps: {span: 6},
	},
</#if>
</#if>
</#list>
<#-- 结束循环 -->
];
//表单数据
export const formSchema: FormSchema[] = [
<#assign form_cat_tree = false>
<#assign form_cat_back = "">
<#assign bpm_flag=false>
<#assign id_exists = false>
<#list columns as po><#rt/>
<#if po.fieldDbName=='bpm_status'>
  <#assign bpm_flag=true>
</#if>
<#if po.fieldDbName == 'id'>
	<#assign id_exists = true>
</#if>
<#-- update-begin---author:chenrui ---date:20240108  for：[issues/5755]vue代码不加入逻辑删除字段---------- -->
<#if po.isShow =='Y' && po.fieldName !='delFlag'>
<#-- update-end---author:chenrui ---date:20240108  for：[issues/5755]vue代码不加入逻辑删除字段---------- -->
<#assign form_field_dictCode="">
	<#if po.dictTable?default("")?trim?length gt 1 && po.dictText?default("")?trim?length gt 1 && po.dictField?default("")?trim?length gt 1>
		<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
	<#elseif po.dictField?default("")?trim?length gt 1>
		<#assign form_field_dictCode="${po.dictField}">
	</#if>
  {
    label: '${po.filedComment}',
    field: ${autoStringSuffix(po)},
<#-- update-begin-author:taoyan date:2022-6-24 for: VUEN-1190【代码生成】默认值未生成 -->
  <#if po.defaultVal??>
    <#if po.fieldDbType=="BigDecimal" || po.fieldDbType=="double" || po.fieldDbType=="int">
    defaultValue: ${po.defaultVal},
    <#else>
    defaultValue: "${po.defaultVal}",
    </#if>
  </#if>
<#-- update-end-author:taoyan date:2022-6-24 for: VUEN-1190【代码生成】默认值未生成 -->
    <#if po.classType =='date'>
    component: 'DatePicker',
    componentProps: {
        <#if po.extendParams?exists && po.extendParams.picker?exists>
        picker: '${po.extendParams.picker}',
        </#if>
      valueFormat: 'YYYY-MM-DD'
    },
     <#elseif po.classType =='datetime'>
    component: 'DatePicker',
    componentProps: {
       showTime:true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
     <#elseif po.classType =='time'>
    component: 'TimePicker',
    componentProps: {
      valueFormat: 'HH:mm:ss'
    },
    <#elseif po.classType =='popup'>
    <#include "/common/form/vue3popup.ftl">
    <#elseif po.classType=='popup_dict'>
    component: 'JPopupDict',
    componentProps: {
      placeholder: '请选择${po.filedComment}',
      dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
      multi: ${po.extendParams.popupMulti?c}
    },
    <#elseif po.classType =='sel_depart'>
     component: 'JSelectDept',
     componentProps:{
   <#if po.extendParams?exists && po.extendParams.text?exists>
       labelKey: '${po.extendParams.text}',
   </#if>
   <#if po.extendParams?exists && po.extendParams.store?exists>
       rowKey: '${po.extendParams.store}',
   </#if>
     },
     <#elseif po.classType =='switch'>
     component: 'JSwitch',
     componentProps:{
         <#if po.dictField != 'is_open'>
         options:${po.dictField}
         </#if>
     },
     <#elseif po.classType =='pca'>
    component: 'JAreaLinkage',
    componentProps: {
      saveCode: 'region',
    },
    <#elseif po.classType =='markdown'>
    component: 'JMarkdownEditor',//注意string转换问题
     <#elseif po.classType =='password'>
    component: 'InputPassword',
     <#elseif po.classType =='sel_user'>
<#-- update-begin---author:chenrui ---date:20240102  for：[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
    component: 'JSelectUser',
<#-- update-end---author:chenrui ---date:20240102  for：[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
     componentProps:{
   <#if po.extendParams?exists && po.extendParams.text?exists>
       labelKey: '${po.extendParams.text}',
   </#if>
   <#if po.extendParams?exists && po.extendParams.store?exists>
       rowKey: '${po.extendParams.store}',
   </#if>
     },
    <#elseif po.classType =='textarea'>
    component: 'InputTextArea',
    <#elseif po.classType=='list'>
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"${form_field_dictCode}"
     },
    <#elseif po.classType=='radio'>
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"${form_field_dictCode}",
        type: "radio"
     },
     <#-- update-begin---author:chenrui ---date:20231228  for：[QQYUN-7583] Vue3风格表单页面多选控件渲染成了下拉多选---------- -->
    <#elseif po.classType=='list_multi'>
    component: 'JSelectMultiple',
    componentProps:{
        dictCode:"${form_field_dictCode}"
     },
    <#elseif po.classType=='checkbox'>
    component: 'JCheckbox',
    componentProps:{
        dictCode:"${form_field_dictCode}"
     },
     <#-- update-end---author:chenrui ---date:20231228  for：[QQYUN-7583] Vue3风格表单页面多选控件渲染成了下拉多选---------- -->
    <#elseif po.classType=='sel_search'>
    component: 'JSearchSelect',
    componentProps:{
       dict:"${form_field_dictCode}"
    },
<#elseif po.classType=='cat_tree'>
    <#assign form_cat_tree = true>
    component: 'JCategorySelect',
    componentProps:{
       pcode:"${po.dictField?default("")}", //TODO back和事件未添加，暂时有问题
    },
    <#if po.dictText?default("")?trim?length gt 1>
    <#assign form_cat_back = "${po.dictText}">
    </#if>
    <#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
    component: 'InputNumber',
    <#elseif po.classType=='file'>
    component: 'JUpload',
    componentProps:{
    <#if po.uploadnum??>
       maxCount:${po.uploadnum}
   </#if>
     },
 <#elseif po.classType=='image'>
     component: 'JImageUpload',
     componentProps:{
     <#if po.uploadnum??>
        fileMax:${po.uploadnum}
     <#else>
        fileMax: 0
     </#if>
      },
  <#elseif po.classType=='umeditor'>
    component: 'JEditor',
  <#elseif po.classType == 'sel_tree'>
    component: 'JTreeSelect',
    componentProps:{
        <#if po.dictText??>
        <#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??>
        dict:"${po.dictTable},${po.dictText?split(',')[2]},${po.dictText?split(',')[0]}",
        <#elseif po.dictText?split(',')[1]??>
        pidField:"${po.dictText?split(',')[1]}",
        <#elseif po.dictText?split(',')[3]??>
        hasChildField:"${po.dictText?split(',')[3]}",
        </#if>
        </#if>
        pidValue:"${po.dictField}",
    },
   <#else>
    component: 'Input',
    </#if>
     <#include "/common/utils.ftl">
    <#if po.isShow == 'Y' && poHasCheck(po)>
    dynamicRules: ({model,schema}) => {
    <#if po.fieldName != 'id'>
    <#assign fieldValidType = po.fieldValidType!''>
          return [
            <#-- 非空校验 -->
           <#if po.nullable == 'N' || fieldValidType == '*'>
                 { required: true, message: '请输入${po.filedComment}!'},
           <#elseif fieldValidType!=''>
                 { required: false},
           </#if>
       <#-- 唯一校验 -->
           <#if fieldValidType == 'only'>
                 {...rules.duplicateCheckRule(<#if sub?default("")?trim?length gt 1>'${sub.tableName}'<#else>'${tableName}'</#if>, '${po.fieldDbName}',model,schema)[0]},
           <#-- 6到16位数字 -->
           <#elseif fieldValidType == 'n6-16'>
                 { pattern: /^\d{6,16}$|^(?=\d+\.\d+)[\d.]{7,17}$/, message: '请输入6到16位数字!'},
           <#-- 6到16位任意字符 -->
           <#elseif fieldValidType == '*6-16'>
                 { pattern: /^.{6,16}$/, message: '请输入6到16位任意字符!'},
           <#-- 6到18位字母 -->
           <#elseif fieldValidType == 's6-18'>
                 { pattern:/^[a-z|A-Z]{6,18}$/, message: '请输入6到18位字母!'},
           <#-- 网址 -->
           <#elseif fieldValidType == 'url'>
                 { pattern: /^((ht|f)tps?):\/\/[\w\-]+(\.[\w\-]+)+([\w\-.,@?^=%&:\/~+#]*[\w\-@?^=%&\/~+#])?$/, message: '请输入正确的网址!'},
           <#-- 电子邮件 -->
           <#elseif fieldValidType == 'e'>
                 { pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/, message: '请输入正确的电子邮件!'},
           <#-- 手机号码 -->
           <#elseif fieldValidType == 'm'>
                 { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'},
           <#-- 邮政编码 -->
           <#elseif fieldValidType == 'p'>
                 { pattern: /^[0-9]\d{5}$/, message: '请输入正确的邮政编码!'},
           <#-- 字母 -->
           <#elseif fieldValidType == 's'>
                 { pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'},
           <#-- 数字 -->
           <#elseif fieldValidType == 'n'>
                 { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
           <#-- 整数 -->
           <#elseif fieldValidType == 'z'>
                 { pattern: /^-?\d+$/, message: '请输入整数!'},
           <#-- 金额 -->
           <#elseif fieldValidType == 'money'>
                 { pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!'},
           <#-- 正则校验 -->
           <#elseif fieldValidType != '' && fieldValidType != '*'>
                 { pattern: '${fieldValidType}', message: '不符合校验规则!'},
           <#-- 无校验 -->
           <#else>
               <#t>
           </#if>
          ];
     </#if>
     },
    </#if>
    <#if po.readonly=='Y'>
    dynamicDisabled:true
    </#if>
  },
</#if>
</#list>
<#if id_exists == false>
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
</#if>
];
//子表单数据
<#list subTables as sub>
//子表列表数据
export const ${sub.entityName?uncap_first}Columns: BasicColumn[] = [
 <#list sub.originalColumns as po>
   <#-- update-begin---author:chenrui ---date:20240108  for：[issues/5755]vue代码不加入逻辑删除字段---------- -->
   <#if po.isShowList =='Y' && po.fieldName !='id' && po.fieldName !='delFlag'>
   <#-- update-end---author:chenrui ---date:20240108  for：[issues/5755]vue代码不加入逻辑删除字段---------- -->
   {
    title: '${po.filedComment}',
    align:"center",
    <#if po.sort=='Y'>
    sorter: true,
   </#if>
    <#if po.classType=='date'>
    dataIndex: '${po.fieldName}',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
    <#elseif po.fieldDbType=='Blob'>
    dataIndex: '${po.fieldName}String'
    <#elseif po.classType=='umeditor'>
    dataIndex: '${po.fieldName}',
    <#elseif po.classType=='pca'>
    dataIndex: '${po.fieldName}',
   <#elseif po.classType=='file'>
    dataIndex: '${po.fieldName}',
   <#elseif po.classType=='image'>
    dataIndex: '${po.fieldName}',
    customRender:render.renderImage,
   <#elseif po.classType=='switch'>
    dataIndex: '${po.fieldName}',
<#assign switch_extend_arr=['Y','N']>
<#if po.dictField?default("")?contains("[")>
<#assign switch_extend_arr=po.dictField?eval>
</#if>
<#list switch_extend_arr as a>
<#if a_index == 0>
<#assign switch_extend_arr1=a>
<#else>
<#assign switch_extend_arr2=a>
</#if>
</#list>
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
     },
   <#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user' || po.classType=='popup_dict'>
    dataIndex: '${po.fieldName}_dictText'
   <#elseif po.classType=='cat_tree'>
    dataIndex: '${po.fieldName}',
    <#if po.dictText?default("")?trim?length == 0>
    customRender:({text}) => {
       return  render.renderCategoryTree(text,'${po.dictField?default("")}')
   },
   <#else>
    customRender: ({text, record}) => (text ? record['${po.dictText}'] : '')
   </#if>
   <#else>
    dataIndex: '${po.fieldName}'
   </#if>
   },
   </#if>
 </#list>
];
<#if sub.foreignRelationType =='1'>
export const ${sub.entityName?uncap_first}FormSchema: FormSchema[] = [
<#assign form_cat_tree = false>
<#assign form_cat_back = "">
<#assign bpm_flag=false>
<#assign sub_id_exists=false>
<#list sub.colums as po><#rt/>
<#if po.fieldDbName=='bpm_status'>
  <#assign bpm_flag=true>
</#if>
<#if po.fieldDbName=='id'>
  <#assign sub_id_exists=true>
</#if>
<#if po.isShow =='Y'>
<#assign form_field_dictCode="">
	<#if po.dictTable?default("")?trim?length gt 1 && po.dictText?default("")?trim?length gt 1 && po.dictField?default("")?trim?length gt 1>
		<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
	<#elseif po.dictField?default("")?trim?length gt 1>
		<#assign form_field_dictCode="${po.dictField}">
	</#if>
  {
    label: '${po.filedComment}',
    field: ${autoStringSuffix(po)},
<#-- update-begin-author:taoyan date:2022-6-24 for: VUEN-1190【代码生成】默认值未生成 -->
  <#if po.defaultVal??>
    <#if po.fieldDbType=="BigDecimal" || po.fieldDbType=="double" || po.fieldDbType=="int">
    defaultValue: ${po.defaultVal},
    <#else>
    defaultValue: "${po.defaultVal}",
    </#if>
  </#if>
<#-- update-end-author:taoyan date:2022-6-24 for: VUEN-1190【代码生成】默认值未生成 -->
    <#if po.classType =='date'>
    component: 'DatePicker',
    componentProps: {
      <#if po.extendParams?exists && po.extendParams.picker?exists>
      picker: '${po.extendParams.picker}',
      </#if>
      valueFormat: 'YYYY-MM-DD'
    },    
     <#elseif po.classType =='datetime'>
    component: 'DatePicker',
    componentProps: {
       showTime:true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
     <#elseif po.classType =='time'>
    component: 'TimePicker',
    componentProps: {
      valueFormat: 'HH:mm:ss'
    },
    <#elseif po.classType =='popup'>
    <#include "/common/form/vue3popup.ftl">
    <#elseif po.classType=='popup_dict'>
    component: 'JPopupDict',
    componentProps: {
      placeholder: '请选择${po.filedComment}',
      dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
      multi: ${po.extendParams.popupMulti?c}
    },
     <#elseif po.classType =='sel_depart'>
     component: 'JSelectDept',
     componentProps:{
   <#if po.extendParams?exists && po.extendParams.text?exists>
       labelKey: '${po.extendParams.text}',
   </#if>
   <#if po.extendParams?exists && po.extendParams.store?exists>
       rowKey: '${po.extendParams.store}',
   </#if>
     },
     <#elseif po.classType =='switch'>
     component: 'JSwitch',
     componentProps:{
         <#if po.dictField != 'is_open'>
         options:${po.dictField}
         </#if>
     },
     <#elseif po.classType =='pca'>
    component: 'JAreaLinkage',
    componentProps: {
      saveCode: 'region',
    },
    <#elseif po.classType =='markdown'>
    component: 'JMarkdownEditor',//注意string转换问题
     <#elseif po.classType =='password'>
    component: 'InputPassword',
     <#elseif po.classType =='sel_user'>
<#-- update-begin---author:chenrui ---date:20240102  for：[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
    component: 'JSelectUser',
<#-- update-end---author:chenrui ---date:20240102  for：[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
     componentProps:{
   <#if po.extendParams?exists && po.extendParams.text?exists>
       labelKey: '${po.extendParams.text}',
   </#if>
   <#if po.extendParams?exists && po.extendParams.store?exists>
       rowKey: '${po.extendParams.store}',
   </#if>
     },
    <#elseif po.classType =='textarea'>
    component: 'InputTextArea',
    <#elseif po.classType=='list'>
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"${form_field_dictCode}"
     },
    <#elseif po.classType=='radio'>
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"${form_field_dictCode}",
        type: "radio"
     },
     <#-- update-begin---author:chenrui ---date:20231228  for：[QQYUN-7583] Vue3风格表单页面多选控件渲染成了下拉多选---------- -->
    <#elseif po.classType=='list_multi'>
    component: 'JSelectMultiple',
    componentProps:{
        dictCode:"${form_field_dictCode}"
     },
    <#elseif po.classType=='checkbox'>
    component: 'JCheckbox',
    componentProps:{
        dictCode:"${form_field_dictCode}"
     },
     <#-- update-end---author:chenrui ---date:20231228  for：[QQYUN-7583] Vue3风格表单页面多选控件渲染成了下拉多选---------- -->
    <#elseif po.classType=='sel_search'>
    component: 'JSearchSelect',
    componentProps:{
       dict:"${form_field_dictCode}"
    },
<#elseif po.classType=='cat_tree'>
    <#assign form_cat_tree = true>
    component: 'JCategorySelect',
    componentProps:{
       pcode:"${po.dictField?default("")}", //TODO back和事件未添加，暂时有问题
    },
    <#if po.dictText?default("")?trim?length gt 1>
    <#assign form_cat_back = "${po.dictText}">
    </#if>
    <#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
    component: 'InputNumber',
    <#elseif po.classType=='file'>
    component: 'JUpload',
    componentProps:{
    <#if po.uploadnum??>
       maxCount:${po.uploadnum}
   </#if>
     },
 <#elseif po.classType=='image'>
     component: 'JImageUpload',
     componentProps:{
     <#if po.uploadnum??>
        fileMax:${po.uploadnum}
     <#else>
        fileMax: 0
     </#if>
    },
  <#elseif po.classType=='umeditor'>
    component: 'JEditor',
  <#elseif po.classType == 'sel_tree'>
    component: 'JTreeSelect',
    componentProps:{
        <#if po.dictText??>
        <#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??>
        dict:"${po.dictTable},${po.dictText?split(',')[2]},${po.dictText?split(',')[0]}",
        <#elseif po.dictText?split(',')[1]??>
        pidField:"${po.dictText?split(',')[1]}",
        <#elseif po.dictText?split(',')[3]??>
        hasChildField:"${po.dictText?split(',')[3]}",
        </#if>
        </#if>
        pidValue:"${po.dictField}",
    },
   <#else>
    component: 'Input',
    </#if>
     <#include "/common/utils.ftl">
    <#if po.isShow == 'Y' && poHasCheck(po)>
    dynamicRules: ({model,schema}) => {
    <#if po.fieldName != 'id'>
    <#assign fieldValidType = po.fieldValidType!''>
          return [
            <#-- 非空校验 -->
           <#if po.nullable == 'N' || fieldValidType == '*'>
                 { required: true, message: '请输入${po.filedComment}!'},
           <#elseif fieldValidType!=''>
                 { required: false},
           </#if>
       <#-- 唯一校验 -->
           <#if fieldValidType == 'only'>
                 {...rules.duplicateCheckRule(<#if sub?default("")?trim?length gt 1>'${sub.tableName}'<#else>'${tableName}'</#if>, '${po.fieldDbName}',model,schema)[0]},
           <#-- 6到16位数字 -->
           <#elseif fieldValidType == 'n6-16'>
                 { pattern: /^\d{6,16}$|^(?=\d+\.\d+)[\d.]{7,17}$/, message: '请输入6到16位数字!'},
           <#-- 6到16位任意字符 -->
           <#elseif fieldValidType == '*6-16'>
                 { pattern: /^.{6,16}$/, message: '请输入6到16位任意字符!'},
           <#-- 6到18位字母 -->
           <#elseif fieldValidType == 's6-18'>
                 { pattern: /^[a-z|A-Z]{6,18}$/, message: '请输入6到18位字母!'},
           <#-- 网址 -->
           <#elseif fieldValidType == 'url'>
                 { pattern: /^((ht|f)tps?):\/\/[\w\-]+(\.[\w\-]+)+([\w\-.,@?^=%&:\/~+#]*[\w\-@?^=%&\/~+#])?$/, message: '请输入正确的网址!'},
           <#-- 电子邮件 -->
           <#elseif fieldValidType == 'e'>
                 { pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/, message: '请输入正确的电子邮件!'},
           <#-- 手机号码 -->
           <#elseif fieldValidType == 'm'>
                 { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'},
           <#-- 邮政编码 -->
           <#elseif fieldValidType == 'p'>
                 { pattern: /^[0-9]\d{5}$/, message: '请输入正确的邮政编码!'},
           <#-- 字母 -->
           <#elseif fieldValidType == 's'>
                 { pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'},
           <#-- 数字 -->
           <#elseif fieldValidType == 'n'>
                 { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
           <#-- 整数 -->
           <#elseif fieldValidType == 'z'>
                 { pattern: /^-?\d+$/, message: '请输入整数!'},
           <#-- 金额 -->
           <#elseif fieldValidType == 'money'>
                 { pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!'},
           <#-- 正则校验 -->
           <#elseif fieldValidType != '' && fieldValidType != '*'>
                 { pattern: '${fieldValidType}', message: '不符合校验规则!'},
           <#-- 无校验 -->
           <#else>
               <#t>
           </#if>
          ];
     </#if>
     },
    </#if>
    <#if po.readonly=='Y'>
    dynamicDisabled:true
    </#if>
  },
</#if>
</#list>
<#if sub_id_exists == false>
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
</#if>
];
</#if>
</#list>
//子表表格配置
<#list subTables as sub>
<#if sub.foreignRelationType =='0'>
export const ${sub.entityName?uncap_first}JVxeColumns: JVxeColumn[] = [
<#assign popupBackFields = "">

<#-- 循环子表的列 开始 -->
<#list sub.colums as col><#rt/>
<#-- update-begin---author:chenrui ---date:20240108  for：[issues/5755]vue代码不加入逻辑删除字段---------- -->
<#if col.isShow =='Y' && col.fieldName !='delFlag'>
<#-- update-end---author:chenrui ---date:20240108  for：[issues/5755]vue代码不加入逻辑删除字段---------- -->
<#if col.filedComment !='外键' >
    {
      title: '${col.filedComment}',
      key: '${autoStringSuffixForModel(col)}',
<#if col.classType =='date'>
      type: JVxeTypes.date,
      <#if col.extendParams?exists && col.extendParams.picker?exists>
      picker: '${col.extendParams.picker}',
      </#if>
      <#if col.readonly=='Y'>
      disabled:true,
      </#if>
<#elseif col.classType =='datetime'>
      type: JVxeTypes.datetime,
      <#if col.readonly=='Y'>
      disabled:true,
      </#if>
<#elseif col.classType =='time'>
      type: JVxeTypes.time,
      <#if col.readonly=='Y'>
      disabled:true,
      </#if>
<#elseif col.classType =='textarea'>
      type: JVxeTypes.textarea,
       <#if col.readonly=='Y'>
      disabled:true,
       </#if>
<#-- update-begin-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对，数字或者金额类型 -->
<#-- elseif "int,decimal,double,"?contains(col.classType) -->
<#elseif col.fieldDbType=='int' || col.fieldDbType=='double' || col.fieldDbType=='BigDecimal'>
<#-- update-end-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对，数字或者金额类型 -->
      type: JVxeTypes.inputNumber,
      <#if col.readonly=='Y'>
      disabled:true,
      </#if>
<#elseif col.classType =='list' || col.classType =='radio'>
      type: JVxeTypes.select,
      options:[],
      <#if col.dictTable?default("")?trim?length gt 1>
      dictCode:"${col.dictTable},${col.dictText},${col.dictField}",
      <#else>
      dictCode:"${col.dictField}",
      </#if>
      <#if col.readonly=='Y'>
      disabled:true,
      </#if>
<#elseif col.classType =='list_multi' || col.classType =='checkbox'>
      type: JVxeTypes.selectMultiple,
      options:[],
      <#if col.dictTable?default("")?trim?length gt 1>
      dictCode:"${col.dictTable},${col.dictText},${col.dictField}",
      <#else>
      dictCode:"${col.dictField}",
      </#if>
      <#if col.readonly=='Y'>
      disabled:true,
      </#if>
<#elseif col.classType =='sel_search'>
      type: JVxeTypes.selectSearch,
      <#if col.dictTable?default("")?trim?length gt 1>
      dictCode:"${col.dictTable},${col.dictText},${col.dictField}",
      <#else>
      dictCode:"${col.dictField}",
      </#if>
      <#if col.readonly=='Y'>
      disabled:true,
      </#if>
<#elseif col.classType =='sel_depart'>
      type: JVxeTypes.departSelect,
      props:{
    <#if col.extendParams?exists && col.extendParams.text?exists>
        labelKey: '${col.extendParams.text}',
    </#if>
    <#if col.extendParams?exists && col.extendParams.store?exists>
        rowKey: '${col.extendParams.store}',
    </#if>
      },
      <#if col.readonly=='Y'>
      disabled:true,
      </#if>
<#elseif col.classType =='sel_user'>
      type: JVxeTypes.userSelect,
      props:{
    <#if col.extendParams?exists && col.extendParams.text?exists>
        labelKey: '${col.extendParams.text}',
    </#if>
    <#if col.extendParams?exists && col.extendParams.store?exists>
        rowKey: '${col.extendParams.store}',
    </#if>
      },
      <#if col.readonly=='Y'>
      disabled:true,
      </#if>
<#elseif col.classType =='image'>
      type: JVxeTypes.image,
      token:true,
      responseName:"message",
      <#if col.readonly=='Y'>
      disabled:true,
      </#if>
      <#if col.uploadnum??>
      number: ${col.uploadnum},
      </#if>
<#elseif col.classType =='file'>
      type: JVxeTypes.file,
      token:true,
      responseName:"message",
      <#if col.readonly=='Y'>
      disabled:true,
      </#if>
      <#if col.uploadnum??>
      number: ${col.uploadnum},
      </#if>
<#elseif col.classType =='switch'>
      type: JVxeTypes.checkbox,
       <#if col.dictField == 'is_open'>
      customValue: ['Y', 'N'],
        <#else>
      customValue: ${col.dictField},
        </#if>
      <#if col.readonly=='Y'>
      disabled:true,
      </#if>
<#elseif col.classType =='popup'>
<#if popupBackFields?length gt 0>
    <#assign popupBackFields = "${popupBackFields}"+","+"${col.dictText}">
<#else>
    <#assign popupBackFields = "${col.dictText}">
</#if>
    <#include "/common/form/vue3Jvxepopup.ftl">
<#else>
      type: JVxeTypes.input,
       <#if col.readonly=='Y'>
      disabled:true,
       </#if>
</#if>
<#if col.classType =='list_multi' || col.classType =='checkbox'>
      width:"250px",
<#else>
      width:"200px",
</#if>
<#if col.classType =='file'>
      placeholder: '请选择文件',
<#else>
      placeholder: '请输入${'$'}{title}',
</#if>
<#if col.defaultVal??>
<#if col.fieldDbType=="BigDecimal" || col.fieldDbType=="double" || col.fieldDbType=="int">
      defaultValue:${col.defaultVal},
      <#else>
      defaultValue:"${col.defaultVal}",
</#if>
<#else>
      defaultValue:'',
</#if>
<#-- 子表的校验 -->
 <#include "/common/validatorRulesTemplate/sub-vue3.ftl">
    },
</#if>
</#if>
</#list>
<#-- 循环子表的列 结束 -->
  ]
</#if>
</#list>

<#-- update-begin---author:chenrui ---date:20231228  for：[QQYUN-7527]vue3代码生成默认带上高级查询---------- -->
// 高级查询数据
export const superQuerySchema = {
  <#list columns as po>
  <#-- update-begin---author:chenrui ---date:20240108  for：[issues/5755]vue代码不加入逻辑删除字段---------- -->
  <#if po.isShowList =='Y' && po.fieldName !='id' && po.fieldName !='delFlag'>
  <#-- update-end---author:chenrui ---date:20240108  for：[issues/5755]vue代码不加入逻辑删除字段---------- -->
  ${superQueryFieldListForVue3(po,po_index)},
  </#if>
  </#list>
  //子表高级查询
  <#list subTables as sub>
  ${sub.entityName?uncap_first}: {
    title: '${sub.ftlDescription}',
    view: 'table',
    fields: {
      <#list sub.colums as subCol>
        <#-- update-begin---author:chenrui ---date:20240108  for：[issues/5755]vue代码不加入逻辑删除字段---------- -->
        <#if subCol.isShowList =='Y' && subCol.fieldName !='id' && subCol.fieldName !='delFlag'>
        <#-- update-end---author:chenrui ---date:20240108  for：[issues/5755]vue代码不加入逻辑删除字段---------- -->
        ${superQueryFieldListForVue3(subCol,subCol_index)},
        </#if>
      </#list>
    }
  },
  </#list>
};
<#-- update-end---author:chenrui ---date:20231228  for：[QQYUN-7527]vue3代码生成默认带上高级查询---------- -->

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}