##通用参数 #parse("PublicMacro/ConstantMarco.vm") #ConstantParams() ## 编辑-表单渲染通用模块 #macro(FormRendering) #foreach($fieLdsModel in ${context.form}) #set($jnpfKey = "${fieLdsModel.jnpfKey}") #set($isEnd = "${fieLdsModel.isEnd}") #set($formModel = ${fieLdsModel.formModel}) #set($config=$formModel.config) #set($span=$config.span) #set($outermost = ${formModel.outermost}) #set($borderType = ${formModel.borderType}) #set($borderColor = ${formModel.borderColor}) #set($borderWidth = ${formModel.borderWidth}) #set($pcshow = $config.pc) #if(${jnpfKey}=='row' && $pcshow == true) #if(${isEnd}=='0') #else #end #elseif(${jnpfKey}=='card' && $pcshow == true) #if(${isEnd}=='0') #if(${formModel.header} || ${formModel.headerI18nCode}) #end #else #end #elseif(${jnpfKey}=='tab' && $pcshow == true) #set($tabs = "a-tabs") #if(${outermost}=='1') #set($tabs = "a-tab-pane") #end #if(${isEnd}=='0') #if(${outermost}=='0') <${tabs} v-model:activeKey="state.${formModel.model}" #if($formModel.type)type="${formModel.type}"#end tabPosition="${formModel.tabPosition}" class="mb-20" > #else <${tabs} #if(${formModel.titleI18nCode}):tab="t('${formModel.titleI18nCode}','${formModel.title}')" #else tab="${formModel.title}"#end key="${formModel.name}" forceRender> #end #else #if(${outermost}=='0') #else #end #end #elseif(${jnpfKey}=='tableGrid' || ${jnpfKey}=='tableGridTd' || ${jnpfKey}=='tableGridTr') #set($tabs = "tbody") #set($tableGrid = "table") #set($needRow = false) #if(${jnpfKey}=='tableGridTr') #set($tabs = "tr") #elseif(${jnpfKey}=='tableGridTd') #set($tabs = "") #if(${config.merged}==false) #set($tabs = "td") #set($needRow = true) #end #end #if(${config.pc}==true) #if(${isEnd}=='0') #if(${jnpfKey}=='tableGrid') <${tableGrid} class="table-grid-box" :style='{"--borderType":"${borderType}","--borderColor":"${borderColor}","--borderWidth":"${borderWidth}px"}'> #end #if($tabs) <${tabs}#if(${config.colspan}) colspan="${config.colspan}"#end#if(${config.rowspan}) rowspan="${config.rowspan}"#end #if($!{config.backgroundColor}) :style="{ '--backgroundColor': '${config.backgroundColor}' }"#end> #if($needRow) #end #end #else #if($tabs) #if($needRow) #end #end #if(${jnpfKey}=='tableGrid') #end #end #end #elseif(${jnpfKey}=='collapse' && $pcshow == true) #set($collapse = "a-collapse") #if(${outermost}=='1') #set($collapse = "a-collapse-panel") #end #if(${isEnd}=='0') #if(${outermost}=='0') <${collapse} ghost expandIconPosition="right" :accordion="${formModel.accordion}" v-model:activeKey="state.${formModel.model}" class="mb-20px"> #else <${collapse} #if(${formModel.titleI18nCode}):header="t('${formModel.titleI18nCode}','${formModel.title}')" #else header="${formModel.title}"#end key="${formModel.name}" forceRender> #end #else #if(${outermost}=='0') #else #end #end #elseif(${jnpfKey}=='steps' && $pcshow == true) #set($step = "a-steps") #if(${outermost}=='1') #set($step = "a-step") #end #if(${isEnd}=='0') #if(${outermost}=='0') #foreach($itemStep in $config.children) #if($!{itemStep.icon}) #end #end #else #end #else #if(${outermost}=='0') #else #end #end #elseif(${jnpfKey}=='groupTitle' || ${jnpfKey}=='text'|| ${jnpfKey} == 'button' || ${jnpfKey} == 'link' || ${jnpfKey} == 'alert'|| ${jnpfKey} == 'divider') #if($pcshow== true) <${config.tag} #if($formModel.style) :style='${formModel.style}'#end #if($formModel.href) href = "$formModel.href"#end #if($formModel.target) target = "$formModel.target"#end #if($formModel.showIcon) :show-icon= "$formModel.showIcon"#end #if($formModel.align) align="${formModel.align}" #end #if($formModel.disabled) :disabled="${formModel.disabled}" #end #if($formModel.buttonText || $formModel.buttonTextI18nCode) #if(${formModel.buttonTextI18nCode}) :buttonText="t('${formModel.buttonTextI18nCode}', '${formModel.buttonText}')" #else buttonText="${formModel.buttonText}" #end#end #if($formModel.type) type="${formModel.type}" #end #if($formModel.textStyle) :textStyle='${formModel.textStyle}'#end #if($formModel.contentPosition) contentPosition="${formModel.contentPosition}" #end #if(${jnpfKey} == 'alert' && $!{formModel.closable}) :closable= "$formModel.closable" #end #if($formModel.title || $formModel.titleI18nCode) #if(${formModel.titleI18nCode}) :title="t('${formModel.titleI18nCode}', '${formModel.title}')" #else title="${formModel.title}" #end#end #if($formModel.closeText || $formModel.closeTextI18nCode) #if(${formModel.closeTextI18nCode}) :closeText="t('${formModel.closeTextI18nCode}', '${formModel.closeText}')" #else closeText="${formModel.closeText}" #end#end #if($formModel.description || $formModel.descriptionI18nCode) #if(${formModel.descriptionI18nCode}) :description="t('${formModel.descriptionI18nCode}', '${formModel.description}')" #else description="${formModel.description}" #end#end #if(${formModel.helpMessage} || ${formModel.helpMessageI18nCode}) #if(${formModel.helpMessageI18nCode}) :helpMessage ="t('${formModel.helpMessageI18nCode}', '${formModel.helpMessage}')" #else helpMessage ="${formModel.helpMessage}" #end #end #if(${formModel.content} || ${formModel.contentI18nCode}) #if(${formModel.contentI18nCode}) :content ="t('${formModel.contentI18nCode}', '${formModel.content}')" #else content ="${formModel.content}" #end #end> #end #elseif(${jnpfKey}=='qrcode' || ${jnpfKey}=='barcode') #if($pcshow== true) #if($config.showLabel) #end <${config.tag} #if(${formModel.format}) format='${formModel.format}'#end #if(${formModel.lineColor}) lineColor = "${formModel.lineColor}"#end #if(${formModel.colorLight}) colorLight = "${formModel.colorLight}"#end #if(${formModel.colorDark}) colorDark = "${formModel.colorDark}"#end #if(${formModel.background}) background = "${formModel.background}"#end #if(${formModel.width}) width = "${formModel.width}"#end #if(${formModel.height}) height = "${formModel.height}"#end #if(${formModel.relationField}) :staticText = "dataForm.${formModel.relationField}" #else staticText = "${formModel.staticText}"#end > #end #elseif(${jnpfKey}=='mast' || ${jnpfKey}=='mastTable') #EachItemRender(${jnpfKey}) #elseif($jnpfKey == 'table') #CreateChildTable() #end #end #end ## 编辑-主表副表-字段渲染 #macro(EachItemRender $tableType) #set($html = $fieLdsModel.formColumnModel.fieLdsModel) #set($beforeVmodel =${html.vModel}) ## 副表参数 #if($tableType=='mastTable') #set($html = $fieLdsModel.formMastTableModel.mastTable.fieLdsModel) #set($beforeVmodel =${fieLdsModel.formMastTableModel.vModel}) #end #set($vModel = "${html.vModel}") #set($mastModel="${context.formModel}.${beforeVmodel}") #set($config = $html.config) #set($mastKey = "${config.jnpfKey}") #set($show = $config.noShow) #set($pcshow = $config.pc) #set($startTime=${html.startTime}) #set($endTime=${html.endTime}) ## 时间处理 #if(${mastKey}=='datePicker'||${mastKey}=='timePicker') #GetStartAndEndTime($mastKey,$config,$html,$startTime,$endTime) #end #if($show == false && $pcshow == true && ${mastKey}!='calculate') #if($config.showLabel) #end #CreateFieldTag($mastKey,$html,$config,$mastModel,$beforeVmodel,-1,true) #end #end ## 编辑-生成字段标签 #macro(CreateFieldTag $mastKey,$html,$config,$mastModel,$beforeVmodel,$index,$isChangeData) <${config.tag} #if($html.vModel) v-model:value="${mastModel}" #if($isChangeData) @change="changeData('${beforeVmodel}',${index})" #end #end #if($mastKey!='text') #if(${html.placeholder} || ${html.placeholderI18nCode}) #if(${html.placeholderI18nCode}) :placeholder="t('${html.placeholderI18nCode}', '${html.placeholder}')" #else placeholder="${html.placeholder}" #end #end #end #if(!$context.lineEdit && ($mastKey =='popupSelect' || $mastKey =='popupTableSelect'|| $mastKey =='calculate')) #if($index == 'index') :rowIndex="index"#end :formData="${context.formModel}" #end #if($mastKey== 'uploadFile' || $mastKey== 'uploadImg') #if(${html.fileSize}) :fileSize="${html.fileSize}" #end #end #if($html.maxlength) :maxlength="${html.maxlength}" #end #if($html.readonly == true ) readonly #end #if($context.isFlow) #if($mastKey== 'popupAttr'||$mastKey== 'relationFormAttr') #set($judgeWriteName="${html.relationField}") #else #set($judgeWriteName="${beforeVmodel}") #end ## 子表,xxxlist-input #if($index == 'index') #if($mastKey== 'popupAttr'||$mastKey== 'relationFormAttr') #set($judgeWriteName= "${aliasname}List-${html.relationField}") #else #set($judgeWriteName= "${aliasname}List-${html.vModel}") #end #end :disabled="judgeWrite('${judgeWriteName}')" #else #if($html.disabled == true ):disabled="${html.disabled}"#end #end #if($html.expression) :expression ='${html.expression}' #end #if($html.templateJson && $InterfaceHasJson.contains($mastKey) && !$context.lineEdit) :templateJson="state.interfaceRes.${beforeVmodel}"#end #if($!html.clearable || $html.clearable=='false') :allowClear='${html.clearable}' #end #if($html.prefixIcon) prefix-icon='${html.prefixIcon}' #end #if($html.suffixIcon) suffix-icon='${html.suffixIcon}' #end #if($html.style) :style='${html.style}'#end #if($html.showWordLimit == true ) ${html.showWordLimit} #end #if($html.size) size="${html.size}" #end #if($html.min) :min="${html.min}" #end #if($html.max) :max="${html.max}" #end #if($html.count) :count="${html.count}" #end #if($html.type) type="${html.type}" #end #if($html.showLevel) showLevel="${html.showLevel}" #end #if($html.autoSize) :autoSize='${html.autoSize}' #end #if($html.step) :step="${html.step}" #end #if($html.precision) :precision="${html.precision}" #end #if($html.stepstrictly==true) stepstrictly #end #if($html.textStyle) :textStyle='${html.textStyle}' #end #if($html.lineHeight) :lineHeight="${html.lineHeight}" #end #if($html.fontSize) :fontSize="${html.fontSize}" #end #if($html.showChinese) :showChinese="${html.showChinese}" #end #if($html.showPassword) show-password #end #if($html.filterable || $html.filterable=='false') :showSearch='${html.filterable}' #end #if($html.multiple) :multiple="${html.multiple}" #end #if($html.separator) separator="${html.separator}" #end #if($html.isrange==true) is-range #end #if($html.rangeseparator) range-separator="${html.rangeseparator}" #end #if($html.format) format="${html.format}" #end #if($html.colorformat) color-format="${html.colorformat}" #end #if($html.valueformat) value-format="${html.valueformat}" #end #if($!html.activecolor) active-color="${html.activecolor}" #end #if($!html.inactivecolor) inactive-color="${html.inactivecolor}" #end #if($!html.activevalue) :checkedValue="${html.activevalue}" #end #if($!html.inactivevalue) :unCheckedValue="${html.inactivevalue}" #end ## #if($!html.activeTxt) checkedChildren="${html.activeTxt}" #end ## #if($!html.inactiveTxt) unCheckedChildren="${html.inactiveTxt}" #end #if($html.showScore == true ) show-score #end #if($html.showText == true ) show-text #end #if($html.allowhalf == true ) allow-half #end #if($html.showAlpha == true ) show-alpha #end #if($html.showStops == true ) show-stops #end #if($html.range == true ) range #end #if($html.showTip == true ) :showTip="${html.showTip}" #end #if($html.accept) accept="${html.accept}" #end #if($html.sizeUnit) sizeUnit="${html.sizeUnit}" #end #if($html.limit) :limit="${html.limit}" #end #if($html.pathType) pathType="${html.pathType}" #end #if($html.sortRule) :sortRule='${html.sortRule}' #end #if($html.timeFormat) timeFormat="${html.timeFormat}" #end #if($html.folder) folder="${html.folder}" #end #if($html.buttonText || $html.buttonTextI18nCode) #if(${html.buttonTextI18nCode}) :buttonText="t('${html.buttonTextI18nCode}', '${html.buttonText}')" #else buttonText="${html.buttonText}" #end#end #if($html.contentposition) content-position="${html.contentposition}" #end #if($!html.level || $html.level=='0') :level=${html.level} #end #if($html.isAmountChinese) isAmountChinese #end #if($html.thousands) thousands #end #if($html.addonAfter) addonAfter="${html.addonAfter}" #end #if($html.addonBefore) addonBefore="${html.addonBefore}" #end #if($html.controls) :controls="${html.controls}" #end #if($startTime) :startTime="${startTime}" #end #if($endTime) :endTime="${endTime}" #end #if($html.tipText) tipText="${html.tipText}" #end #if($html.href) href = "$html.href"#end #if($html.height) :height = "$html.height"#end #if($html.useMask) :useMask = "${html.useMask}"#end #if($html.maskConfig) :maskConfig = "maskConfig.${beforeVmodel}"#end #if($html.autoLocation) :autoLocation = "$html.autoLocation" #end #if($html.enableLocationScope) :enableLocationScope = "$html.enableLocationScope" #end #if($html.adjustmentScope) :adjustmentScope = "$html.adjustmentScope" #end #if($html.enableDesktopLocation) :enableDesktopLocation = "$html.enableDesktopLocation" #end #if($html.locationScope) :locationScope = "state.locationScope.${beforeVmodel}" #end #if($html.showCount || $html.showCount == 'false') :showCount = "${html.showCount}" #end #if($html.borderType) borderType = "$html.borderType" #end #if($html.borderColor) borderColor = "$html.borderColor" #end #if($html.borderWidth) :borderWidth = "$html.borderWidth" #end #if($html.isInvoke) :isInvoke="$html.isInvoke" #end #if($mastKey == 'relationFormAttr' || $mastKey == 'popupAttr') #set($lineEidtRelationField = $html.relationField) ## 行内格式是guanlianbiaodan_jnpfTable_test_salesordecopy_copy11==刚好没有子表删除表格 #if($html.relationField && $html.relationField.contains("_jnpfTable_")) #if($html.relationField.contains("$config.tableName")) ## 主表 #set($lineEidtRelationField = $html.relationField.split("_jnpfTable_")[0]) #else ## 副表 #set($lineEidtRelationField = "jnpf_"+$config.tableName+"_jnpf_"+$html.relationField.split("_jnpfTable_")[0]) #end #end #if($html.relationField) :relationField=#if(${index}=="index") "'${lineEidtRelationField}'+index" #else "'${lineEidtRelationField}'" #end#end #if($html.showField) showField="${html.showField}" #end #if($html.isStorage) isStorage=${html.isStorage} #end #end #if($html.selectType) selectType="$html.selectType" #end #if($html.selectType == 'custom' || $mastKey == 'signature') #if($html.ableDepIds) :ableDepIds = 'ableAll.${beforeVmodel}ableDepIds' #end #if($html.ablePosIds) :ablePosIds = 'ableAll.${beforeVmodel}ablePosIds' #end #if($html.ableUserIds) :ableUserIds = 'ableAll.${beforeVmodel}ableUserIds' #end #if($html.ableRoleIds) :ableRoleIds = 'ableAll.${beforeVmodel}ableRoleIds' #end #if($html.ableGroupIds) :ableGroupIds = 'ableAll.${beforeVmodel}ableGroupIds' #end #if($html.ableIds) :ableIds = 'ableAll.${beforeVmodel}ableIds' #end #elseif($html.selectType == 'dep' || $html.selectType == 'pos' || $html.selectType == 'role' || $html.selectType == 'group') #set($ableRelationIds="dataForm.${html.relationField}") #if($html.relationChild) #set($ableRelationIds="record.${html.relationField}") #end #if($html.relationField) :ableRelationIds="Array.isArray(${ableRelationIds}) ? ${ableRelationIds} : [${ableRelationIds}]" #end #end #if($mastKey == 'relationForm') :field=#if(${index}=="index")"'${html.vModel}'+index"#else"'${beforeVmodel}'"#end modelId ="${html.modelId}" :columnOptions="optionsObj.${beforeVmodel}columnOptions" relationField="${html.relationField}" popupWidth="${html.popupWidth}" propsValue="${html.propsValue}" #if($html.hasPage) hasPage :pageSize="$html.pageSize" #end :queryType=#if(${html.queryType})"${html.queryType}"#else"0"#end #end #if($mastKey == 'popupSelect' || $mastKey =='popupTableSelect') :field=#if(${index}=="index")"'${html.vModel}'+index"#else"'${beforeVmodel}'"#end interfaceId="${html.interfaceId}" :columnOptions="optionsObj.${beforeVmodel}columnOptions" propsValue="${html.propsValue}" relationField="${html.relationField}" popupType="${html.popupType}" #if(${html.popupTitle}) popupTitle="${html.popupTitle}" #end popupWidth="${html.popupWidth}" #if($html.hasPage) hasPage :pageSize="$html.pageSize" #end #end #if($mastKey=='cascader' || $mastKey=='treeSelect' || $mastKey=='checkbox'|| $mastKey=='radio'|| $mastKey=='select') ##有index时说明时子表,子表动态可选值 取当前行内option #if(${index}=="index" && ${config.dataType}=="dynamic"):options="record.${beforeVmodel}Options" #else :options="optionsObj.${beforeVmodel}Options" #end :fieldNames="optionsObj.${beforeVmodel}Props" #if(${html.direction}) direction="${html.direction}" #end #if(${html.optionType}) optionType="${html.optionType}" #end #end #if($mastKey == 'autoComplete') relationField="${html.relationField}" interfaceId="${html.interfaceId}" #if(${html.total}) :total="${html.total}" #end #if($index == 'index') :rowIndex="index" #end :formData="${context.formModel}" #end #if($index != 'index' && ($mastKey == 'relationForm' || $mastKey == 'popupSelect')) :extraOptions = "state.extraOptions.${beforeVmodel}" #end > #if($mastKey!='checkbox' && $mastKey!='radio' && $mastKey!='select') #if($html.slot.prepend) #end #if($html.slot.append) #end #end #end ## 编辑-子表生成 #macro(CreateChildTable) #set($child = $fieLdsModel.childList) #set($aliasname = "") #foreach($children in ${context.children}) #if(${children.tableModel}==${child.tableModel}) #set($aliasname = "${children.aliasLowName}") #set($aliasName = "${children.aliasUpName}") #end #end #if($!{child.layoutType} == 'list') ## 子表平铺
#foreach($itemModel in ${child.childList}) #set($fieLdsModel = ${itemModel.fieLdsModel}) #set($config = ${fieLdsModel.config}) #set($mastKey = "${config.jnpfKey}") #set($vModel="${fieLdsModel.vModel}") #set($mastModel="dataForm.${aliasname}List[index].${vModel}") #set($beforeVmodel ="${aliasname}${fieLdsModel.vModel}") #set($startTime=${fieLdsModel.startTime}) #set($endTime=${fieLdsModel.endTime}) #if(${mastKey}=='datePicker'||${mastKey}=='timePicker') #GetStartAndEndTime($mastKey,$config,$fieLdsModel,$startTime,$endTime) #end #if(${config.noShow} == false && ${config.pc}==true && ${config.jnpfKey}!='calculate') ## 子表各字段标题生成 ## 子表标签生成 #CreateFieldTag($mastKey,$fieLdsModel,$config,$mastModel,$beforeVmodel,'index',true) #end #end #if($child.showSummary) #set($childSummary=true) #set($summaryField = '[]') #if(${child.summaryField}) #set($summaryField = ${child.summaryField}) #end #end #if($child.footerBtnsList.size()>0) #if($child.footerBtnsList.size()>2)#set($isSelectDialog = true) #end #foreach($footerBtn in ${child.footerBtnsList}) #set($btnName="openSelectDialog('${child.aliasLowName}List','$!{footerBtn.value}')") #if($footerBtn.value =="add") #set($btnName="add${aliasName}Row") #end #if($footerBtn.show && $footerBtn.value !="batchRemove" && $footerBtn.actionType!=2) #if(${footerBtn.labelI18nCode}) {{t('${footerBtn.labelI18nCode}','${footerBtn.label}')}} #else ${footerBtn.label}#end #end #end #end
#else ## 子表表格 #if($child.showTitle== true) #end 0) :bordered="true" #end :columns="${aliasname}Columns" size="small" :pagination="false" :scroll="{ x: 'max-content' }" :rowSelection="get${aliasname}RowSelection" rowKey="jnpfId"> ## 子表字段 ## 子表合计 #if($child.showSummary) #set($childSummary=true) #end #if($child.footerBtnsList.size()>0) #if($child.footerBtnsList.size()>2)#set($isSelectDialog = true) #end #foreach($footerBtn in ${child.footerBtnsList}) #set($btnName="openSelectDialog('${child.aliasLowName}List','$!{footerBtn.value}')") #if($footerBtn.value =="add") #set($btnName="add${aliasName}Row") #elseif($footerBtn.value =="batchRemove") #set($btnName="batchRemove${aliasName}Row($!{footerBtn.showConfirm})") #end #if($footerBtn.show && $footerBtn.actionType!=2) #if(${footerBtn.labelI18nCode}) {{t('${footerBtn.labelI18nCode}','${footerBtn.label}')}} #else ${footerBtn.label} #end #end #end #end #end
#end ## 子表字段对象列表生成 #macro(GetChildTableColumns) ## 子表列表字段属性 #foreach($itemModel in ${context.children}) #set($itemChildHasBatch = false) #foreach($itemBtn in ${itemModel.footerBtnsList}) #if(${itemBtn.value} == 'batchRemove') #set($itemChildHasBatch = true) #end #end const ${itemModel.aliasLowName}Columns: any[] = computed(() => { let list = [ #set($childList = ${itemModel.childList}) #foreach($html in ${childList}) #set($fieLdsModel = ${html.fieLdsModel}) #set($config = ${fieLdsModel.config}) #if(($context.isFlow || !${config.noShow}) && ${config.jnpfKey}!='calculate') { title: #if(${config.labelI18nCode}) t('${config.labelI18nCode}','${config.label}') #else '${config.label}' #end, dataIndex: #if($!{fieLdsModel.vModel}) '${fieLdsModel.vModel}' #else '${config.formId}' #end, key: #if($!{fieLdsModel.vModel}) '${fieLdsModel.vModel}' #else '${config.formId}' #end, #if($!{config.columnWidth}) width: $!{config.columnWidth}, #end labelWidth:#if($!{config.labelWidth})'$!{config.labelWidth}' #else '' #end, span:'$!{config.span}', tipLabel: #if($!{config.tipLabel}|| ${config.tipLabelI18nCode})#if(${config.tipLabelI18nCode}) t('${config.tipLabelI18nCode}','${config.tipLabel}') #else '${config.tipLabel}' #end #else '' #end, #set($vModelRequired="#if($!{fieLdsModel.vModel})${itemModel.aliasLowName}List-${fieLdsModel.vModel}#else${itemModel.aliasLowName}List-${config.formId}#end") required: #if($context.isFlow)judgeRequired('$vModelRequired'), #else ${config.required},#end #if($!{fieLdsModel.thousands}==true) thousands: ${fieLdsModel.thousands}, #end style: #if(${fieLdsModel.style})${fieLdsModel.style} #else ''#end, align: #if($!{config.tableAlign}) '$!{config.tableAlign}'#else 'left'#end , fixed: #if($!{config.tableFixed} == 'left' || $!{config.tableFixed} == 'right') '$!{config.tableFixed}' #else false #end, formP: #if($!{fieLdsModel.vModel}) '${fieLdsModel.vModel}' #else '${fieLdsModel.relationField}' #end, }, #end #end ]; ##子表行内按键操作字段判断是否生成。及其宽度 #if($context.isFlow) list = list.filter(o => judgeShow('${itemModel.aliasLowName}List-' + o.formP)); #if($hasLineBtnNum>0) if (!judgeWrite('${itemModel.aliasLowName}List')) { list.push({ title: t('component.table.action'), showLabel: true, dataIndex: 'action', key: 'action', align: 'center', fixed: 'right', width: $hasLineBtnNum }); } #end #else #if(${context.columnData.useFormPermission})list = list.filter(o => hasFormP('${itemModel.tableModel}-' + o.formP)); #end #if($hasLineBtnNum>0)list.push({ title: t('component.table.action'), showLabel: true, dataIndex: 'action', key: 'action', align: 'center', fixed: 'right', width: $hasLineBtnNum });#end #end ## 表格子表和平铺子表代码区别 #if($!{itemModel.layoutType} == 'list') return list; #else const indexColumn = { title: t('component.table.index'), showLabel: true, dataIndex: 'index', key: 'index', align: 'center', fixed: 'left', width: 50 }; //子表复杂表头-处理 let columnList = list; let complexHeaderList: any[] = #if(${itemModel.complexHeaderList}) ${itemModel.complexHeaderList}; #else []; #end if (complexHeaderList.length) { let childColumns: any[] = []; let firstChildColumns: string[] = []; for (let i = 0; i < complexHeaderList.length; i++) { const e = complexHeaderList[i]; e.title = e.fullNameI18nCode ? t(e.fullNameI18nCode,e.fullName) : e.fullName; e.align = e.align; e.children = []; e.jnpfKey = 'complexHeader'; if (e.childColumns?.length) { childColumns.push(...e.childColumns); for (let k = 0; k < e.childColumns.length; k++) { const item = e.childColumns[k]; for (let j = 0; j < list.length; j++) { const o = list[j]; if (o.key == item && o.fixed !== 'left' && o.fixed !== 'right') e.children.push({ ...o }); } } } if (e.children.length) firstChildColumns.push(e.children[0].key); } complexHeaderList = complexHeaderList.filter(o => o.children.length); let newList: any[] = []; for (let i = 0; i < list.length; i++) { const e = list[i]; if (!childColumns.includes(e.key) || e.fixed === 'left' || e.fixed === 'right') { newList.push(e); } else { if (firstChildColumns.includes(e.key)) { const item = complexHeaderList.find(o => o.childColumns.includes(e.key)); newList.push(item); } } } columnList = newList; } let columns = [indexColumn, ...columnList] const leftFixedList = columns.filter(o => o.fixed === 'left'); const rightFixedList = columns.filter(o => o.fixed === 'right'); const noFixedList = columns.filter(o => o.fixed !== 'left' && o.fixed !== 'right'); return [...leftFixedList, ...noFixedList, ...rightFixedList]; #end }); ## 子表选择框是否展示 const get${itemModel.aliasLowName}HasBatchBtn = computed(() =>{ let flist:any[] = #if(${itemModel.footerBtnsList})${itemModel.footerBtnsList}#else [] #end return flist?.length && flist.some(o => o.value == 'batchRemove' && !!o.show) }); const get${itemModel.aliasLowName}RowSelection = computed(() => { if (!unref(get${itemModel.aliasLowName}HasBatchBtn )) return undefined; const rowSelection = { selectedRowKeys: state.selected${itemModel.aliasLowName}RowKeys, onChange: (selectedRowKeys: string[]) => { state.selected${itemModel.aliasLowName}RowKeys = selectedRowKeys; }, }; return rowSelection; }); ## 子表合计参数 #if($itemModel.showSummary) //子表合计字段 const ${itemModel.aliasLowName}SummaryColumn = computed(() => { let defaultColumns = unref(${itemModel.aliasLowName}Columns);//子表字段 let columns: any[] = []; for (let i = 0; i < defaultColumns.length; i++) { const e = defaultColumns[i]; if (e.jnpfKey === 'table' || e.jnpfKey === 'complexHeader') { if (e.children?.length) columns.push(...e.children); } else { columns.push(e); } if (e.fixed && e.children?.length) { for (let j = 0; j < e.children.length; j++) { e.children[j].fixed = e.fixed; } } } return columns.filter(o => o?.key != 'index' && o?.key != 'action'); }); //合计方法 const get${itemModel.aliasUpName}ColumnSum = computed(() => { const sums: any[] = []; const summaryField: any[] = #if(${itemModel.summaryField}) ${itemModel.summaryField} #else [] #end; const useThousands = key => unref(${itemModel.aliasLowName}SummaryColumn).some(o => o.key === key && o.thousands); const isSummary = key => summaryField.includes(key); const list = unref(${itemModel.aliasLowName}SummaryColumn).filter(o => o.key !== 'index' && o.key !== 'action'); list.forEach((column, index) => { let sumVal = state.dataForm.${itemModel.aliasLowName}List.reduce((sum, d) => sum + Number(getCmpValOfRow(d, column.key, summaryField || [])), 0); if (!isSummary(column.key)) sumVal = ''; sumVal = Number.isNaN(sumVal) ? '' : sumVal; const realVal = sumVal && !Number.isInteger(Number(sumVal)) ? Number(sumVal).toFixed(2) : sumVal; sums[index] = useThousands(column.key) ? thousandsFormat(realVal) : realVal.toString(); }); #if($!{itemModel.layoutType} != 'list') if (unref(get${itemModel.aliasLowName}HasBatchBtn )) sums.unshift(''); #end return sums; }); //合计对齐 function get${itemModel.aliasUpName}SummaryCellAlign(index) { if (!unref(${itemModel.aliasLowName}SummaryColumn).length) return; if ($itemChildHasBatch) index--; return unref(${itemModel.aliasLowName}SummaryColumn)[index]?.align || 'left'; } #end #end #end ## 子表方法生成 #macro(CreateChildTableMethod) #foreach($itemModel in ${context.children}) #set($aliasname =$!{itemModel.aliasLowName}) #set($aliasName =$!{itemModel.aliasUpName}) #set($childList = ${itemModel.childList}) ## 子表非弹窗生成添加方法 function add${aliasName}Row(){ let item = { #foreach($html in $childList) #set($fieLdsModel = ${html.fieLdsModel}) #set($vModel = "${html.fieLdsModel.vModel}") #set($config = ${html.fieLdsModel.config}) #set($jk = $html.fieLdsModel.config.jnpfKey) #set($dataType = "$!{config.dataType}") #set($defaultCurrent = $html.fieLdsModel.config.defaultCurrent) #set($defult = $html.fieLdsModel.config.defaultValue) #set($format = $html.fieLdsModel.format) #if($vModel) #GetFeildDefaultValue($!{aliasname}) #end #end jnpfId: buildUUID(), } state.dataForm.${aliasname}List.push(item) state.childIndex=state.dataForm.${aliasname}List.length-1 #foreach($childList in$childList) #set($fieLdsModel = $childList.fieLdsModel) #set($vModel = "${fieLdsModel.vModel}") #set($field = "${fieLdsModel.vModel}") #set($config = ${fieLdsModel.config}) #set($dataType = "$!{config.dataType}") #if(${dataType}=='dynamic') get${aliasname}${vModel}Options() #end #end state.childIndex = -1 #if($!{itemModel.layoutType} == 'list' && $!{itemModel.defaultExpandAll} ) state.${aliasname}innerActiveKey.push(item.jnpfId); #end } function remove${aliasName}Row(index,showConfirm=false){ if(showConfirm){ createConfirm({ iconType: 'warning', title: '提示', content: '此操作将永久删除该数据, 是否继续?', onOk: () => { state.dataForm.${aliasname}List.splice(index, 1); }, }); }else{ state.dataForm.${aliasname}List.splice(index, 1); } } function copy${aliasName}Row(index){ let item = cloneDeep(state.dataForm.${aliasname}List[index]); ## 系统控件置空 #foreach($html in $childList) #set($fieLdsModel = ${html.fieLdsModel}) #set($vModel = "${html.fieLdsModel.vModel}") #set($config = ${html.fieLdsModel.config}) #set($jk = $html.fieLdsModel.config.jnpfKey) #set($dataType = "$!{config.dataType}") #set($defaultCurrent = $html.fieLdsModel.config.defaultCurrent) #set($defult = $html.fieLdsModel.config.defaultValue) #set($format = $html.fieLdsModel.format) #if($vModel) #if(${systemJnpfKey.contains(${jk})}) item.${vModel} = ''; #end #end #end let copyData = {}; for (let i = 0; i < unref(${aliasname}Columns).length; i++) { const cur = unref(${aliasname}Columns)[i]; if (cur.key != 'index' && cur.key != 'action') { if (cur.children?.length && cur.jnpfKey == 'complexHeader') { for (let j = 0; j < cur.children.length; j++) { copyData[cur.children[j].key] = item[cur.children[j].key]; } } else { copyData[cur.key] = item[cur.key]; } } } const copyItem = { ...copyData, jnpfId: buildUUID() }; state.dataForm.${aliasname}List.push(copyItem); #if($!{itemModel.layoutType} == 'list' && $!{itemModel.defaultExpandAll} ) state.${aliasname}innerActiveKey.push(copyItem.jnpfId); #end state.childIndex=state.dataForm.${aliasname}List.length-1 #foreach($childList in$childList) #set($fieLdsModel = $childList.fieLdsModel) #set($vModel = "${fieLdsModel.vModel}") #set($field = "${fieLdsModel.vModel}") #set($config = ${fieLdsModel.config}) #set($dataType = "$!{config.dataType}") #if(${dataType}=='dynamic') get${aliasname}${vModel}Options() #end #end state.childIndex = -1 } function batchRemove${aliasName}Row(showConfirm=false){ if (!state.selected${aliasname}RowKeys.length) return createMessage.error('请选择一条数据'); const handleRemove = ()=>{ state.dataForm.${aliasname}List = state.dataForm.${aliasname}List.filter( o => !state.selected${aliasname}RowKeys.includes(o.jnpfId), ); nextTick(() => { state.selected${aliasname}RowKeys = []; }); } if(showConfirm){ createConfirm({ iconType: 'warning', title: '提示', content: '此操作将永久删除该数据, 是否继续?', onOk: ()=>{ handleRemove() }, }); }else{ handleRemove() } } ## 非流程的子表必填验证方法 #if(!$context.isFlow) function ${aliasname}Exist(){ let isOk = true; for(let i=0;i o.id):[], #else ${vModel}: userInfo.positionIds.length?userInfo.positionIds[0].id:'', #end #elseif(${jk}=='roleSelect' && ${defaultCurrent} == true) #if($multiple == true) ${vModel}: userInfo.roleIds.length?userInfo.roleIds:[], #else ${vModel}: userInfo.roleIds.length?userInfo.roleIds[0]:'', #end #elseif(${jk}=='groupSelect' && ${defaultCurrent} == true) #if($multiple == true) ${vModel}: userInfo.groupIds.length?userInfo.groupIds:[], #else ${vModel}: userInfo.groupIds.length?userInfo.groupIds[0]:'', #end #elseif(${jk}=='sign' && ${defaultCurrent} == true) ${vModel}: userInfo.signImg?userInfo.signImg: #if(${defult}) ${defult} #else '' #end, #elseif(${defult} == "") ${vModel}:'', #elseif(${defult} =='[]') ${vModel}:[], #elseif(${defult} || ${defult}=='0') #if(${jk}=='input' || ${jk}=='colorPicker'|| ${jk}=='editor'|| ${jk}=='radio'|| ${jk}=='textarea' || ${jk}=='popupAttr' || ${jk}=='relationForm' || ${jk}=='relationFormAttr' || ${jk}=='sign' || ${jk}=='autoComplete' || ${jk}=='location') ${vModel}:'$!{defult}', #elseif($multiple == false && $multipleUnit.contains(${jk}) && ${jk}!='checkbox' && ${jk}!='areaSelect' && ${jk}!='cascader') ${vModel}:'${defult}', #else ${vModel}:${defult}, #end #else ${vModel}:undefined, #end #if(${dataType}=='dynamic' && $!{aliasLowName}) $!{aliasLowName}${vModel}Options:[], #elseif((${dataType}=='static' || ${dataType}=='dictionary') && $!{aliasLowName}) $!{aliasLowName}${vModel}Options:state.optionsObj.$!{aliasLowName}${vModel}Options, #end #end ## 生成表单参数 -interface State 值any const state 值类型 #macro(createStateParam $any) dataForm: #if($any) $any; #else { #CreateDataform() }, #end tableRows:#if($any) $any; #else { #foreach($child in ${context.children}) #set($aliasname = "") #foreach($children in ${context.children}) #if(${children.tableModel}==${child.tableModel}) #set($aliasname = "${children.aliasLowName}") #end #end ${aliasname}List:{ #foreach($childListAll in ${child.childList}) #set($html = $childListAll.fieLdsModel) #set($model = "${html.vModel}") #set($config = ${html.config}) #set($jnpfKey = "${config.jnpfKey}") #if($model) #if(${jnpfKey}=='cascader'||${jnpfKey}=='checkbox' || ${jnpfKey}=='areaSelect') ${model} : [], #elseif(${jnpfKey}=='select' || ${jnpfKey}=='userSelect' || ${jnpfKey}=='depSelect' || ${jnpfKey}=='posSelect' || ${jnpfKey}=='treeSelect') #if(${html.multiple}=='true') ${model} : [], #else ${model} : '', #end #elseif(${jnpfKey} == 'organizeSelect') ${model} : [], #elseif(${jnpfKey}=='uploadImg'||${jnpfKey}=='uploadFile' || ${jnpfKey}=='timeRange' || ${jnpfKey}=='dateRange') ${model} : [], #elseif(${jnpfKey}=='switch'||${jnpfKey}=='slider'||${jnpfKey}=='rate') ${model} : 0, #elseif(${jnpfKey}=='inputNumber'||${jnpfKey}=='calculate') ${model} : undefined, #else ${model} : '', #end #end #end enabledmark:undefined }, #end }, #end dataRule: #if($any) $any; #else { #foreach($fieLdsModel in ${context.fields}) #set($html = $fieLdsModel.formColumnModel.fieLdsModel) #set($vModel = "${html.vModel}") #set($config = $html.config) #set($mastKey = "${config.jnpfKey}") #set($listSize=$!{config.regList}) #set($defaultValue=${config.defaultValue}) #set($defaultValueSize=$!{config.defaultValue}) #set($trigger = ${config.trigger}) #if(${trigger.substring(0,1)}!='[') #set($trigger = "'"+ ${config.trigger}+ "'") #end #if($mastKey!='text' && $mastKey!='divider') #if($multipleUnit.contains($mastKey)) #set($messages="t('sys.validate.arrayRequiredPrefix ','请至少选择一个')") #else #set($messages="t('sys.validate.textRequiredSuffix','不能为空')") #end #if($config.required==true || (${listSize} && $listSize.size()>0)) ${vModel}: [ #if($config.required==true) { required: true, message: $!{messages}, trigger: ${trigger} }, #end #if($listSize.size()>0) #foreach($regList in ${config.regList}) { pattern: ${regList.pattern}, message: #if(${regList.messageI18nCode}) t('${regList.messageI18nCode}','${regList.message}'), #else '${regList.message}',#end trigger: ${trigger} }, #end #end ], #end #end #end #foreach($ChildField in ${context.columnChildren}) #foreach($FormMastTableModel in ${ChildField.fieLdsModelList}) #set($html = ${FormMastTableModel.mastTable.fieLdsModel}) #set($vModel = "${html.vModel}") #set($config = $html.config) #set($mastKey = "${config.jnpfKey}") #set($listSize=$!{config.regList}) #set($defaultValue=${config.defaultValue}) #set($defaultValueSize=$!{config.defaultValue}) #set($trigger = ${config.trigger}) #if(${trigger.substring(0,1)}!='[') #set($trigger = "'"+ ${config.trigger}+ "'") #end #if($mastKey!='text' && $mastKey!='divider' && $mastKey!='switch') #if($multipleUnit.contains($mastKey)) #set($messages="t('sys.validate.arrayRequiredPrefix ','请至少选择一个')") #else #set($messages="t('sys.validate.textRequiredSuffix','不能为空')") #end #if($config.required==true|| (${listSize} && $listSize.size()>0)) ${FormMastTableModel.vModel}: [ #if($config.required==true) { required: true, message: $!{messages}, trigger: ${trigger} }, #end #if($listSize.size()>0) #foreach($regList in ${config.regList}) { pattern: ${regList.pattern}, message: #if(${regList.messageI18nCode}) t('${regList.messageI18nCode}','${regList.message}'), #else '${regList.message}',#end trigger: ${trigger} }, #end #end ], #end #end #end #end }, #end optionsObj:#if($any) $any; #else { #foreach($fieLdsModel in ${context.fields}) #set($html = $fieLdsModel.formColumnModel.fieLdsModel) #set($vModel = "${html.vModel}") #set($config = $html.config) #set($jnpfkey = $config.jnpfKey) #if($!{config.dataType}=='dictionary'||$!{config.dataType}=='dynamic') ${vModel}Options:[], #elseif($!{config.dataType} == "static") #if($html.slot.options) ${vModel}Options:${html.slot.options}, #elseif($html.options) ${vModel}Options:${html.options}, #end #end #if($jnpfkey == "relationForm" || $jnpfkey == "popupSelect" || $jnpfkey== "popupTableSelect") ${vModel}columnOptions:[#foreach($options in ${html.columnOptions}) {"label":"${options.label}","value":"${options.value}"},#end], #end #if($html.props) #set($propsModel = ${html.props}) $!{vModel}Props:{"label":"${propsModel.label}","value":"${propsModel.value}" #if($!{propsModel.multiple}) ,"multiple":$propsModel.multiple #end #if($!{propsModel.children}),"children":"${propsModel.children}" #end}, #end #end #foreach($child in ${context.children}) #set($aliasname = "${child.aliasLowName}") #foreach($fieLdsModel in ${child.childList}) #set($html = $fieLdsModel.fieLdsModel) #set($vModel = "${html.vModel}") #set($config = $html.config) #set($jnpfkey = $config.jnpfKey) #if($!{config.dataType}=='dictionary'||$!{config.dataType}=='dynamic') ${aliasname}${vModel}Options:[], #elseif($!{config.dataType} == "static") #if($html.slot.options) ${aliasname}${vModel}Options:${html.slot.options}, #elseif($html.options) ${aliasname}${vModel}Options:${html.options}, #end #end #if($jnpfkey == "relationForm" || $jnpfkey == "popupSelect" || $jnpfkey == "popupTableSelect") ${aliasname}${vModel}columnOptions:[#foreach($options in ${html.columnOptions}) {"label":"${options.label}","value":"${options.value}"},#end], #end #if($html.props) #set($propsModel = ${html.props}) ${aliasname}$!{vModel}Props:{"label":"${propsModel.label}","value":"${propsModel.value}" #if($!{propsModel.multiple}) ,"multiple":$propsModel.multiple #end #if($!{propsModel.children}),"children":"${propsModel.children}" #end}, #end #end #end #foreach($ChildField in ${context.columnChildren}) #foreach($FormMastTableModel in ${ChildField.fieLdsModelList}) #set($html = ${FormMastTableModel.mastTable.fieLdsModel}) #set($jnpfKey = ${html.config.jnpfKey}) #set($ChildVmodel =${FormMastTableModel.vModel}) #set($ClDataType = ${html.config.dataType}) #if(${ClDataType}=='dictionary'||${ClDataType}=='dynamic') ${ChildVmodel}Options:[], #elseif(${ClDataType} == "static") #if($html.slot.options) ${ChildVmodel}Options:${html.slot.options}, #elseif($html.options) ${ChildVmodel}Options:${html.options}, #end #end #if(${jnpfKey} == "relationForm" || ${jnpfKey} == "popupSelect" || $jnpfKey == "popupTableSelect") ${ChildVmodel}columnOptions:[#foreach($options in ${html.columnOptions}) {"label":"${options.label}","value":"${options.value}"},#end], #end #if($html.props) #set($propsModel = ${html.props}) $!{ChildVmodel}Props:{"label":"${propsModel.label}","value":"${propsModel.value}" #if($!{propsModel.multiple}) ,"multiple":$propsModel.multiple #end #if($!{propsModel.children}),"children":"${propsModel.children}" #end}, #end #end #end }, #end childIndex:#if($any) $any; #else -1, #end isEdit:#if($any) $any; #else false, #end interfaceRes: #if($any) $any; #else ${context.templateJsonAll}, #end //可选范围默认值 ableAll:#if($any) $any; #else { #foreach($fieLdsModel in ${context.ableAll}) #set($jnpfKey = "${fieLdsModel.jnpfKey}") #if(${jnpfKey}=='mast') #set($html = $fieLdsModel.formColumnModel.fieLdsModel) #set($mastModel="${html.vModel}") #if($html.selectType == 'custom' || $html.config.jnpfKey =='signature') #ableAll(${html}, ${mastModel},false) #end #elseif(${jnpfKey}=='mastTable') #set($html = $fieLdsModel.formMastTableModel.mastTable.fieLdsModel) #set($vmodelTable =${fieLdsModel.formMastTableModel.table}) #set($vmodelFeild =${fieLdsModel.formMastTableModel.vModel}) #if($html.selectType == 'custom' || $html.config.jnpfKey =='signature') #ableAll(${html}, "${vmodelFeild}",true) #end #elseif(${jnpfKey}=='table') #set($child = $fieLdsModel.childList) #set($aliasname = ${child.aliasLowName}) #foreach($htmlChild in ${child.childList}) #set($html = $htmlChild.fieLdsModel) #set($childvModel = ${html.vModel}) #if($html.selectType == 'custom' || $html.config.jnpfKey =='signature') #ableAll(${html},"${aliasname}${childvModel}",true) #end #end #end #end }, #end //掩码配置 maskConfig:#if($any)$any; #else { #foreach($fieLdsModel in ${context.fields}) #set($html = $fieLdsModel.formColumnModel.fieLdsModel) #set($vModel = "${html.vModel}") #set($config = $html.config) #set($jnpfkey = $config.jnpfKey) #if($jnpfkey == "input") ${vModel}:#if(${html.maskConfig}) ${html.maskConfig} #else {}#end, #end #end #foreach($child in ${context.children}) #set($aliasname = "${child.aliasLowName}") #foreach($fieLdsModel in ${child.childList}) #set($html = $fieLdsModel.fieLdsModel) #set($vModel = "${html.vModel}") #set($config = $html.config) #set($jnpfkey = $config.jnpfKey) #if($jnpfkey == "input") ${aliasname}${vModel}:#if(${html.maskConfig}) ${html.maskConfig} #else {}#end, #end #end #end #foreach($ChildField in ${context.columnChildren}) #foreach($FormMastTableModel in ${ChildField.fieLdsModelList}) #set($html = ${FormMastTableModel.mastTable.fieLdsModel}) #set($jnpfKey = ${html.config.jnpfKey}) #set($ChildVmodel =${FormMastTableModel.vModel}) #if(${jnpfKey} == "input") ${ChildVmodel}:#if(${html.maskConfig}) ${html.maskConfig} #else {}#end, #end #end #end }, #end //定位属性 locationScope:#if($any)$any; #else { #foreach($fieLdsModel in ${context.fields}) #set($html = $fieLdsModel.formColumnModel.fieLdsModel) #set($vModel = "${html.vModel}") #set($config = $html.config) #set($jnpfkey = $config.jnpfKey) #if($jnpfkey == "location") ${vModel}:#if(${html.locationScope}) ${html.locationScope} #else []#end, #end #end #foreach($child in ${context.children}) #set($aliasname = "${child.aliasLowName}") #foreach($fieLdsModel in ${child.childList}) #set($html = $fieLdsModel.fieLdsModel) #set($vModel = "${html.vModel}") #set($config = $html.config) #set($jnpfkey = $config.jnpfKey) #if($jnpfkey == "location") ${aliasname}${vModel}:#if(${html.locationScope}) ${html.locationScope} #else []#end, #end #end #end #foreach($ChildField in ${context.columnChildren}) #foreach($FormMastTableModel in ${ChildField.fieLdsModelList}) #set($html = ${FormMastTableModel.mastTable.fieLdsModel}) #set($jnpfKey = ${html.config.jnpfKey}) #set($ChildVmodel =${FormMastTableModel.vModel}) #if(${jnpfKey} == "location") ${ChildVmodel}:#if(${html.locationScope}) ${html.locationScope} #else []#end, #end #end #end }, #end ## 活动面板参数 #foreach($fieLdsModel in ${context.form}) #set($jnpfKey = "${fieLdsModel.jnpfKey}") #set($formModel = ${fieLdsModel.formModel}) #set($outermost = ${formModel.outermost}) #set($isEnd = "${fieLdsModel.isEnd}") #if(${isEnd}=='0') #if($jnpfKey=='collapse') #if(${outermost}=='0') #if($any) ${formModel.model}:$any; #else ${formModel.model}:${formModel.active}, #end #end #end #if($jnpfKey=='tab') #if(${outermost}=='0') #if($any) ${formModel.model}:$any; #else ${formModel.model}:'${formModel.active}', #end #end #end #if($jnpfKey=='steps') #if(${outermost}=='0') #if($any) ${formModel.model}:$any; #else ${formModel.model}:${formModel.active}, #end #end #end #end #end ## 子表弹窗数据选择 #if($isSelectDialog == true) //子表弹窗数据选择 currVmodel:#if($any) $any; #else '', #end currTableConf:#if($any) $any; #else {}, #end addTableConf:#if($any) $any; #else { #foreach($children in ${context.children}) #set($aliasname = "${children.aliasLowName}") #foreach($item in ${children.footerBtnsList}) #if($item.value != 'add' && $item.value != 'batchRemove' && $item.actionType!=2) "${aliasname}List${item.value}":${item.actionConfig}, #end #end #end }, #end #end ## 子表多选框选中行数组变量 #foreach($children in ${context.children}) #set($aliasname = "${children.aliasLowName}") selected${aliasname}RowKeys :#if($any) $any; #else [], #end #if($!{children.layoutType} == 'list') ${aliasname}outerActiveKey: #if($any) $any; #else [0], #end ${aliasname}innerActiveKey: #if($any) $any; #else [], #end #end #end ## 关联表单和弹窗选择展示多字段 extraOptions:#if($any) $any; #else { #foreach($fieLdsModel in ${context.fields}) #set($html = $fieLdsModel.formColumnModel.fieLdsModel) #set($vModel = "${html.vModel}") #set($jnpfkey = $html.config.jnpfKey) #if($jnpfkey == "relationForm" || $jnpfkey == "popupSelect") ${vModel}:[#foreach($options in ${html.extraOptions}) {"label":"${options.label}","value":"${options.value}"},#end], #end #end #foreach($ChildField in ${context.columnChildren}) #foreach($FormMastTableModel in ${ChildField.fieLdsModelList}) #set($html = ${FormMastTableModel.mastTable.fieLdsModel}) #set($jnpfKey = ${html.config.jnpfKey}) #set($ChildVmodel =${FormMastTableModel.vModel}) #if(${jnpfKey} == "relationForm" || ${jnpfKey} == "popupSelect") ${ChildVmodel}:[#foreach($options in ${html.extraOptions}) {"label":"${options.label}","value":"${options.value}"},#end], #end #end #end }, #end #end ##控件默认值取值范围 #macro(ableAll $html,$feildFullName,$flag) #if($html.ableDepIds) ${feildFullName}ableDepIds: ${html.ableDepIds}, #end #if($html.ablePosIds) ${feildFullName}ablePosIds: ${html.ablePosIds}, #end #if($html.ableUserIds) ${feildFullName}ableUserIds: ${html.ableUserIds}, #end #if($html.ableRoleIds) ${feildFullName}ableRoleIds: ${html.ableRoleIds}, #end #if($html.ableGroupIds) ${feildFullName}ableGroupIds: ${html.ableGroupIds}, #end #if($html.ableIds) ${feildFullName}ableIds: ${html.ableIds}, #end #end ##############################数据选项方法######################################## ## 数据选项-生成方法 #macro(GetOptionMethod $childTableName) #set($isChildType = '1') #if($!childTableName) #set($isChildType = '2') #end #if(${dataType}=='dictionary') //数据选项--数据字典初始化方法 function get${methodName}Options() { getDictionaryDataSelector('${config.dictionaryType}').then(res => { state.optionsObj.${methodName}Options = res.data.list }) } #elseif(${dataType}=='dynamic') //数据选项--远端数据初始化方法 function get${methodName}Options(isClear = false) { const index = state.childIndex let templateJsonList = JSON.parse(JSON.stringify(state.interfaceRes.${methodName})) #if(!$context.lineEdit) for (let i = 0; i < templateJsonList.length; i++) { let json = templateJsonList[i]; if(json.relationField&&json.sourceType ==1){ let relationFieldAll = json.relationField.split("-"); let val = json.defaultValue; if(relationFieldAll.length>1 && index>-1){ if(relationFieldAll[0].endsWith("List")){ val = state.dataForm[relationFieldAll[0]]&&state.dataForm[relationFieldAll[0]].length? state.dataForm[relationFieldAll[0]][index][relationFieldAll[1]]:'' }else{ val = state.dataForm[relationFieldAll[0]+'List']&&state.dataForm[relationFieldAll[0]+'List'].length? state.dataForm[relationFieldAll[0]+'List'][index][relationFieldAll[1]]:'' } }else { val = state.dataForm[relationFieldAll] } json.defaultValue = val ? val : ''; } } #end let template ={ paramList:templateJsonList } getDataInterfaceRes('${config.propsUrl}',template).then(res => { let data = res.data state.optionsObj.${methodName}Options = data if(index==-1) return ## 子表设置到行内options #if($!{childTableName}) state.dataForm.${childTableName}List[index].${methodName}Options =data #end if(isClear){ changeDataFormData(${isChildType},'${childTableName}List','$vModel',index,'') } }) } #elseif(${jnpfkey}=='popupSelect'|| ${jnpfkey}=='popupTableSelect') #if($childTableName) #set($vModel="$childTableName$vModel") #end function get${vModel}Options() { const index = state.childIndex changeDataFormData(${isChildType},'${childTableName}List','${methodName}',index,${defaultValue}) } #end #end ## 数据选项---数据字典和远端数据获取初始化 #macro(GetDataOptionsMethod) ##主表 #foreach($fieLdsModel in ${context.fields}) #set($html = $fieLdsModel.formColumnModel.fieLdsModel) #set($vModel = "${html.vModel}") #set($config = $html.config) #set($dataType = "$!{config.dataType}") #set($jnpfkey="${config.jnpfKey}") #set($defaultValue='""') #if($!config.valueType=='String') #set($defaultValue="'$!{config.defaultValue}'") #elseif($!config.valueType=='undefined') #set($defaultValue='""') #else #set($defaultValue=$!{config.defaultValue}) #end #set($methodName = "${html.vModel}") #GetOptionMethod("") #end ##副表 #foreach($ColumnFieldModel in ${context.mastTable}) #set($html =${ColumnFieldModel.formMastTableModel}) #set($vModel = "${html.vModel}") #set($config = $html.mastTable.fieLdsModel.config) #set($dataType = "$!{config.dataType}") #set($jnpfkey="${config.jnpfKey}") #set($defaultValue='""') #if($!config.valueType=='String') #set($defaultValue="'$!{config.defaultValue}'") #elseif($!config.valueType=='undefined') #set($defaultValue='""') #else #set($defaultValue=$!{config.defaultValue}) #end #set($methodName = "${html.vModel}") #GetOptionMethod("") #end ##子表 #foreach($child in ${context.children}) #foreach($fieLdsModel in ${child.childList}) #set($html = $fieLdsModel.fieLdsModel) #set($vModel = "${html.vModel}") #set($config = $html.config) #set($dataType = "$!{config.dataType}") #set($jnpfkey="${config.jnpfKey}") #set($defaultValue='""') #if($!config.valueType=='String') #set($defaultValue="'$!{config.defaultValue}'") #elseif($!config.valueType=='undefined') #set($defaultValue='""') #else #set($defaultValue=$!{config.defaultValue}) #end #set($methodName = "${child.aliasLowName}${html.vModel}") #GetOptionMethod(${child.aliasLowName}) #end #end #end ## 数据联系,changeData方法 #macro(ChangeData) function changeData(model, index) { state.isEdit = false state.childIndex = index for (let key in state.interfaceRes) { if (key != model) { let faceReList = state.interfaceRes[key] for (let i = 0; i < faceReList.length; i++) { let relationField = faceReList[i].relationField; if(relationField){ let modelAll = relationField.split('-'); let faceMode = ''; let faceMode2 = modelAll.length == 2?modelAll[0].substring(0, modelAll[0].length-4) +modelAll[1]:"" for (let i = 0; i < modelAll.length; i++) { faceMode += modelAll[i]; } if (faceMode == model || faceMode2 == model ) { let options = 'get' + key + 'Options'; eval(options)(true); changeData(key, index) } } } } } } function changeDataFormData(type, data, model,index,defaultValue) { if(!state.isEdit) { if (type == 2) { for (let i = 0; i < state.dataForm[data].length; i++) { if (index == -1) { state.dataForm[data][i][model] = defaultValue } else if (index == i) { state.dataForm[data][i][model] = defaultValue } } } else { state.dataForm[data] = defaultValue } } } #end ## 编辑,初始化当前Options $isEdit是否编辑。true编辑 false 新增 #macro(EditGetOption $isEdit) ##主表options #foreach($fieLdsModel in ${context.fields}) #set($html = $fieLdsModel.formColumnModel.fieLdsModel) #set($vModel = "${html.vModel}") #set($config = $html.config) #set($dataType = "$!{config.dataType}") #if($!{config.dataType}=='dictionary'||$!{config.dataType}=='dynamic') get${vModel}Options(); #end #end ##副表options #foreach($ColumnFieldModel in ${context.mastTable}) #set($html =${ColumnFieldModel.formMastTableModel}) #set($vModel = "${html.vModel}") #set($config = $html.mastTable.fieLdsModel.config) #if($!{config.dataType}=='dictionary'||$!{config.dataType}=='dynamic') get${vModel}Options(); #end #end ##子表表options #foreach($itemModel in ${context.children}) #set($aliasname =$itemModel.aliasLowName) #set($aliasName =$itemModel.aliasUpName) #set($childList = ${itemModel.childList}) #foreach($childList in $childList) #set($fieLdsModel = $childList.fieLdsModel) #set($vModel = "${fieLdsModel.vModel}") #set($field = "${fieLdsModel.vModel}") #set($config = ${fieLdsModel.config}) #set($dataType = "$!{config.dataType}") ## 新增修改时获取字典的options #if($!{config.dataType}=='dictionary') get${aliasname}${vModel}Options() #end #end ## 编辑时-获取子表动态options if (state.dataForm.${aliasname}List) { for (let i = 0; i < state.dataForm.${aliasname}List.length; i++) { state.childIndex = i; state.dataForm.${aliasname}List[i].jnpfId = buildUUID(); #foreach($item in $childList) #set($fieLdsModel = $item.fieLdsModel) #set($vModel = "${fieLdsModel.vModel}") #set($field = "${fieLdsModel.vModel}") #set($config = ${fieLdsModel.config}) #set($dataType = "$!{config.dataType}") #if($isEdit) #if(${dataType}=='dynamic') get${aliasname}${vModel}Options(false) #end #end #end } } ## 子表平铺展开方法调用 #if($!{itemModel.layoutType} == 'list') set${aliasname}ActiveKey(); #end #end #end ##子表弹窗相关函数, #macro(ChildDialogMethod) function openSelectDialog(key,value) { state.currTableConf=state.addTableConf[key+value] state.currVmodel=key nextTick(() => { (selectModal.value as any)?.openSelectModal(); }) } //子表弹窗选择数据-添加初始化下拉options function addForSelect(data) { let currSize= state.dataForm[state.currVmodel].length for (let i = 0; i < data.length; i++) { let item={...state.tableRows[state.currVmodel],...data[i], jnpfId: buildUUID()} state.dataForm[state.currVmodel].push(cloneDeep(item)) state.childIndex= currSize + i; #foreach($itemModel in ${context.children}) #set($aliasname =$!{itemModel.aliasLowName}) #set($aliasName =$!{itemModel.aliasUpName}) #set($childList = ${itemModel.childList}) #if($!{itemModel.layoutType} == 'list' && $!{itemModel.defaultExpandAll} ) state.${aliasname}innerActiveKey.push(item.jnpfId); #end if(state.currVmodel === "${aliasname}List"){ #foreach($childList in$childList) #set($fieLdsModel = $childList.fieLdsModel) #set($vModel = "${fieLdsModel.vModel}") #set($field = "${fieLdsModel.vModel}") #set($config = ${fieLdsModel.config}) #set($dataType = "$!{config.dataType}") #if(${dataType}=='static' || ${dataType}=='dictionary') item.$!{aliasname}${vModel}Options = state.optionsObj.$!{aliasname}${vModel}Options; #end #if(${dataType}=='dynamic') get${aliasname}${vModel}Options(false); #end #end } #end state.childIndex = -1 } } #end ##面板参数初始化 #macro(InitActiveValue) #foreach($fieLdsModel in ${context.form}) #set($jnpfKey = "${fieLdsModel.jnpfKey}") #set($formModel = ${fieLdsModel.formModel}) #set($outermost = ${formModel.outermost}) #set($isEnd = "${fieLdsModel.isEnd}") #if(${isEnd}=='0') #if($jnpfKey=='collapse') #if(${outermost}=='0') state.${formModel.model}=${formModel.active}; #end #end #if($jnpfKey=='tab') #if(${outermost}=='0') state.${formModel.model}='${formModel.active}'; #end #end #if($jnpfKey=='steps') #if(${outermost}=='0') state.${formModel.model}=${formModel.active}; #end #end #end #end #end ################################################################################ ## 时间处理方法 #macro(GetStartAndEndTime $mastKey,$config,$html,$startTime,$endTime) #set($startRelationField="''") #if($config.startRelationField) #set($startRelationField="${context.formModel}.${config.startRelationField}") #if($config.startChild) #set($startRelationField="record.${config.startRelationField}") #end #end #set($startTimeValue="#if(${config.startTimeValue})'${config.startTimeValue}'#else''#end") #set($startTimeType="#if(${config.startTimeType})${config.startTimeType}#else''#end") #set($startTimeTarget="#if(${config.startTimeTarget})${config.startTimeTarget}#else''#end") #set($endRelationField="''") #if($config.endRelationField) #set($endRelationField="${context.formModel}.${config.endRelationField}") #if($config.endChild) #set($endRelationField="record.${config.endRelationField}") #end #end #set($endTimeValue="#if(${config.endTimeValue})'${config.endTimeValue}'#else''#end") #set($endTimeType="#if(${config.endTimeType})${config.endTimeType}#else''#end") #set($endTimeTarget="#if(${config.endTimeTarget})${config.endTimeTarget}#else''#end") #set($startTime="getRelationDate(${config.startTimeRule},${startTimeType},${startTimeTarget},${startTimeValue},${startRelationField})") #set($endTime="getRelationDate(${config.endTimeRule},${endTimeType},${endTimeTarget},${endTimeValue},${endRelationField})") #if($mastKey=='timePicker') #set($startTime="getRelationTime(${config.startTimeRule},${startTimeType},${startTimeTarget},${startTimeValue},'${html.format}',${startRelationField})") #set($endTime="getRelationTime(${config.endTimeRule},${endTimeType},${endTimeTarget},${endTimeValue},'${html.format}',${endRelationField})") #end #if(${startTimeType} == 2) #set($startTime="$startRelationField") #end #if(${endTimeType} == 2) #set($endTime="$endRelationField") #end #end ## 时间处理方法-js #macro(GetRelationDate) function getRelationDate(timeRule, timeType, timeTarget, timeValueData, dataValue) { let timeDataValue: any = null; let timeValue = Number(timeValueData); if (timeRule) { if (timeType == 1) { timeDataValue = timeValue; } else if (timeType == 2) { timeDataValue = dataValue; } else if (timeType == 3) { timeDataValue = new Date().getTime(); } else if (timeType == 4 || timeType == 5) { const type = getTimeUnit(timeTarget); const method = timeType == 4 ? 'subtract' : 'add'; timeDataValue = dayjs()[method](timeValue, type).valueOf(); } } return timeDataValue; } function getRelationTime(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) { let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType; let timeDataValue: any = null; if (timeRule) { if (timeType == 1) { timeDataValue = timeValue || '00:00:00'; if (timeDataValue.split(':').length == 3) { timeDataValue = timeDataValue; } else { timeDataValue = timeDataValue + ':00'; } } else if (timeType == 2) { timeDataValue = dataValue; } else if (timeType == 3) { timeDataValue = dayjs().format(format); } else if (timeType == 4 || timeType == 5) { const type = getTimeUnit(timeTarget + 3); const method = timeType == 4 ? 'subtract' : 'add'; timeDataValue = dayjs()[method](timeValue, type).format(format); } } return timeDataValue; } #end