12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955 |
- ##通用参数
- #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')
- <a-col :span="${formModel.span}" class="ant-col-item">
- <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
- #else
- </a-row>
- </a-col>
- #end
- #elseif(${jnpfKey}=='card' && $pcshow == true)
- #if(${isEnd}=='0')
- <a-col #if(${span}) :span="${span}" #else :span="24" #end class="ant-col-item">
- <a-card class="mb-20" #if(${formModel.shadow}=='hover') hoverable #end>
- #if(${formModel.header} || ${formModel.headerI18nCode})
- <template #title>#if(${formModel.headerI18nCode}) {{t('${formModel.headerI18nCode}','${formModel.header}')}} #else ${formModel.header} #end
- #if((${formModel.header} || ${formModel.headerI18nCode}) && ( ${config.tipLabel} || ${config.tipLabelI18nCode}))
- <BasicHelp #if(${config.tipLabelI18nCode}) :text="t('${config.tipLabelI18nCode}','${config.tipLabel}')" #else text="${config.tipLabel}" #end />
- #end
- </template>
- #end
- <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
- #else
- </a-row>
- </a-card>
- </a-col>
- #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')
- <a-col :span="${formModel.span}" class="ant-col-item">
- <${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>
- <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
- #end
- #else
- #if(${outermost}=='0')
- </${tabs}>
- </a-col>
- #else
- </a-row>
- </${tabs} >
- #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)
- <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
- #end
- #end
- #else
- #if($tabs)
- #if($needRow)
- </a-row>
- #end
- </${tabs}>
- #end
- #if(${jnpfKey}=='tableGrid')
- </${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')
- <a-col :span="${formModel.span}" class="ant-col-item">
- <${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>
- <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
- #end
- #else
- #if(${outermost}=='0')
- </${collapse}>
- </a-col>
- #else
- </a-row>
- </${collapse}>
- #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')
- <a-col :span="${formModel.span}" class="ant-col-item">
- <a-steps type=#if($!{formModel.simple}) 'navigation' #else 'default' #end status="${formModel.processStatus}" v-model:current="state.${formModel.model}" class="mb-10px">
- #foreach($itemStep in $config.children)
- <a-step #if(${itemStep.titleI18nCode}):title="t('${itemStep.titleI18nCode}','${itemStep.title}')" #else title="${itemStep.title}"#end key="${itemStep.name}">
- #if($!{itemStep.icon})
- <template #icon>
- <span class="${itemStep.icon} custom-icon"></span>
- </template>
- #end
- </a-step>
- #end
- </a-steps>
- #else
- <a-row key="${formModel.name}" class="!pt-12px w-full" v-show="${config.childNum} == state.${formModel.model}" :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
- #end
- #else
- #if(${outermost}=='0')
- </a-col>
- #else
- </a-row>
- #end
- #end
- #elseif(${jnpfKey}=='groupTitle' || ${jnpfKey}=='text'|| ${jnpfKey} == 'button' || ${jnpfKey} == 'link' || ${jnpfKey} == 'alert'|| ${jnpfKey} == 'divider')
- #if($pcshow== true)
- <a-col :span="${span}" class="ant-col-item">
- <a-form-item>
- <${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>
- </${config.tag}>
- </a-form-item>
- </a-col>
- #end
- #elseif(${jnpfKey}=='qrcode' || ${jnpfKey}=='barcode')
- #if($pcshow== true)
- <a-col :span="${span}" class="ant-col-item">
- <a-form-item>
- #if($config.showLabel)<template #label>#if(${config.labelI18nCode}) {{t('${config.labelI18nCode}','${config.label}')}} #else${config.label} #end
- #if((${config.label} || ${config.labelI18nCode}) && ${context.labelSuffix})${context.labelSuffix}#end
- #if((${config.label} || ${config.labelI18nCode}) && (${config.tipLabel} || ${config.tipLabelI18nCode}))
- <BasicHelp #if(${config.tipLabelI18nCode}) :text="t('${config.tipLabelI18nCode}','${config.tipLabel}')" #else text="${config.tipLabel}" #end />#end</template> #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 >
- </${config.tag}>
- </a-form-item>
- </a-col>
- #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')
- <a-col :span="${config.span}" class="ant-col-item" #if($context.isFlow) #if(${vModel}) v-if="judgeShow('${beforeVmodel}')"
- #elseif($mastKey == 'relationFormAttr' || $mastKey == 'popupAttr') v-if="judgeShow('${html.relationField}')" #end
- #elseif(${context.columnData.useFormPermission}) #if(${vModel}) v-if="hasFormP('${beforeVmodel}')"
- #elseif($mastKey == 'relationFormAttr' || $mastKey == 'popupAttr') v-if="hasFormP('${html.relationField}')" #end #end >
- <a-form-item #if($config.showLabel == true) #if($config.labelWidth && ${context.labelPosition}!="top") :labelCol="{ style: { width: '${config.labelWidth}px' } }"#end
- #else :labelCol="{ style: { width: '0px' } }"#end #if($vModel) name="${beforeVmodel}" #end>
- #if($config.showLabel)<template #label>#if(${config.labelI18nCode}) {{t('${config.labelI18nCode}','${config.label}')}} #else${config.label} #end
- #if((${config.label} || ${config.labelI18nCode}) && ${context.labelSuffix})${context.labelSuffix}#end
- #if((${config.label} || ${config.labelI18nCode}) && (${config.tipLabel} || ${config.tipLabelI18nCode}))
- <BasicHelp #if(${config.tipLabelI18nCode}) :text="t('${config.tipLabelI18nCode}','${config.tipLabel}')" #else text="${config.tipLabel}" #end />#end</template> #end
- #CreateFieldTag($mastKey,$html,$config,$mastModel,$beforeVmodel,-1,true)
- </a-form-item>
- </a-col>
- #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)
- <template slot="prepend">${html.slot.prepend}</template>
- #end
- #if($html.slot.append)
- <template slot="append">${html.slot.append}</template>
- #end
- #end
- </${config.tag}>
- #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
- <a-col :span="${child.span}" class="ant-col-item mb-20px" #if($context.isFlow) v-if="judgeShow('${aliasname}List')" #else
- #if(${context.columnData.useFormPermission})v-if="hasFormP('${child.tableModel}')"#end #end >
- #if($!{child.layoutType} == 'list')
- ## 子表平铺
- <div class="jnpf-child-list" >
- <a-collapse expandIconPosition="right" :bordered="false" class="outer-collapse" v-model:activeKey="state.${aliasname}outerActiveKey">
- <a-collapse-panel forceRender>
- <template #header>
- <span class="min-h-22px inline-block">#if($child.showTitle== true)#if(${child.labelI18nCode}) {{t('${child.labelI18nCode}','${child.label}')}} #else ${child.label} #end#end</span>
- #if($child.showTitle== true && $child.tipLabel)<BasicHelp #if(${child.tipLabelI18nCode}) :text="t('${child.tipLabelI18nCode}','${child.tipLabel}')" #else text="${child.tipLabel}" #end />#end
- </template>
- <a-collapse :bordered="false" v-model:activeKey="state.${aliasname}innerActiveKey">
- <template #expandIcon="{ isActive }">
- <CaretRightOutlined :rotate="isActive ? 90 : 0" />
- </template>
- <a-collapse-panel v-for="(record, index) in dataForm.${aliasname}List" :key="record.jnpfId" forceRender>
- <template #header>
- <span class="min-h-22px inline-block">#if(${child.labelI18nCode}) {{t('${child.labelI18nCode}','${child.label}')}} #else ${child.label} #end({{ index + 1 }})</span>
- </template>
- <template #extra #if($context.isFlow) v-if="!judgeWrite('${aliasname}List')" #end>
- <a-space>
- #foreach($item in $child.columnBtnsList)
- #if(${item.value} == "copy" && ${item.show})
- <a-button class="action-btn" type="link" @click.stop="copy${aliasName}Row(index)" size="small">#if(${item.labelI18nCode})
- {{t('${item.labelI18nCode}','${item.label}')}} #else ${item.label}#end</a-button>
- #end
- #if(${item.value} == "remove" && ${item.show})
- <a-button class="action-btn" type="link" color="error" @click.stop="remove${aliasName}Row(index,${item.showConfirm})" size="small">#if(${item.labelI18nCode})
- {{t('${item.labelI18nCode}','${item.label}')}} #else ${item.label}#end</a-button>
- #end
- #end
- </a-space>
- </template>
- <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
- #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')
- <a-col :span="${config.span}" class="ant-col-item" #if($context.isFlow) v-if="judgeShow('${aliasname}List-${fieLdsModel.vModel}')" #else
- #if(${context.columnData.useFormPermission})v-if="hasFormP('${child.tableModel}-${fieLdsModel.vModel}')"#end #end >
- <a-form-item #if($config.labelWidth && ${context.labelPosition}!="top") :labelCol="{ style: { width: '${config.labelWidth}px' } }"#end
- #if($vModel) :name="['${aliasname}List', index, '${vModel}']" #end>
- ## 子表各字段标题生成
- <template #label>
- #if(${context.isFlow})
- #if($mastKey== 'popupAttr'||$mastKey== 'relationFormAttr')
- #set($judgeWriteName= "${aliasname}List-${fieLdsModel.relationField}")
- #else
- #set($judgeWriteName= "${aliasname}List-${fieLdsModel.vModel}")
- #end
- <span class="required-sign" v-if="judgeRequired('${judgeWriteName}')">*</span>
- #else
- #if(${config.required})
- <span class="required-sign">*</span>
- #end
- #end
- #if(${config.labelI18nCode}) {{t('${config.labelI18nCode}','${config.label}')}} #else ${config.label} #end
- #if((${config.label} || ${config.labelI18nCode}) && (${config.tipLabel} || ${config.tipLabelI18nCode}))
- <BasicHelp #if(${config.tipLabelI18nCode}) :text="t('${config.tipLabelI18nCode}','${config.tipLabel}')"#else text="${config.tipLabel}"#end />#end
- </template>
- ## 子表标签生成
- #CreateFieldTag($mastKey,$fieLdsModel,$config,$mastModel,$beforeVmodel,'index',true)
- </a-form-item>
- </a-col>
- #end
- #end
- </a-row>
- </a-collapse-panel>
- #if($child.showSummary)
- #set($childSummary=true)
- #set($summaryField = '[]')
- #if(${child.summaryField})
- #set($summaryField = ${child.summaryField})
- #end
- <a-collapse-panel key="summary" v-if="dataForm.${aliasname}List?.length">
- <template #header>
- <span class="min-h-22px inline-block">{{ t('component.table.summary') }}</span>
- </template>
- <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
- <template v-for="(column, cIndex) in ${aliasname}Columns" :key="column.key">
- <a-col :span="column.span" class="ant-col-item" v-if='${summaryField}.includes(column.key)'>
- <a-form-item #if(${context.labelPosition}!="top") :labelCol="{ style: { width: (column.labelWidth||'${context.labelWidth}')+'px' } }"#end>
- <template #label>{{column.title}}<BasicHelp v-if="column.title && column.tipLabel" :text="column.tipLabel" /></template>
- <JnpfInput :value="get${aliasName}ColumnSum[cIndex]" disabled :style="column.style" />
- </a-form-item>
- </a-col>
- </template>
- </a-row>
- </a-collapse-panel>
- #end
- </a-collapse>
- #if($child.footerBtnsList.size()>0)
- #if($child.footerBtnsList.size()>2)#set($isSelectDialog = true) #end
- <a-space class="input-table-footer-btn" #if($context.isFlow) v-if="!judgeWrite('${aliasname}List')" #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)
- <a-button type =#if(${footerBtn.btnType} == 'text')'link'#else'${footerBtn.btnType}'#end preIcon="${footerBtn.btnIcon}"
- @click="$btnName">#if(${footerBtn.labelI18nCode}) {{t('${footerBtn.labelI18nCode}','${footerBtn.label}')}} #else ${footerBtn.label}#end</a-button>
- #end
- #end
- </a-space>
- #end
- </a-collapse-panel>
- </a-collapse>
- </div>
- #else
- ## 子表表格
- <a-form-item>
- #if($child.showTitle== true)
- <JnpfGroupTitle #if(${child.labelI18nCode}) :content="t('${child.labelI18nCode}', '${child.label}')" #else content="${child.label}" #end :bordered="false"
- #if(${child.tipLabelI18nCode}) :helpMessage="t('${child.tipLabelI18nCode}', '${child.tipLabel}')" #else helpMessage="${child.tipLabel}" #end />
- #end
- <a-table :data-source="dataForm.${aliasname}List" #if(${child.complexHeaderList.size()}>0) :bordered="true" #end
- :columns="${aliasname}Columns" size="small" :pagination="false" :scroll="{ x: 'max-content' }"
- :rowSelection="get${aliasname}RowSelection" rowKey="jnpfId">
- <template #headerCell="{ column }">
- <span class="required-sign" v-if="column.required">*</span>
- {{ column.title }}
- <BasicHelp :text="column.tipLabel" v-if="column.tipLabel && column.title" />
- </template>
- ## 子表字段
- <template #bodyCell="{ column, index, record }">
- <template v-if="column.key === 'index'">{{ index + 1 }}</template>
- #foreach($itemModel in ${child.childList})
- #set($fieLdsModel = ${itemModel.fieLdsModel})
- #set($config = ${fieLdsModel.config})
- #set($mastKey = "${config.jnpfKey}")
- #set($beforeVmodel ="${aliasname}${fieLdsModel.vModel}")
- #set($mastModel="record.${fieLdsModel.vModel}")
- #set($startTime=${fieLdsModel.startTime})
- #set($endTime=${fieLdsModel.endTime})
- #if(${mastKey}=='datePicker'||${mastKey}=='timePicker')
- #GetStartAndEndTime($mastKey,$config,$fieLdsModel,$startTime,$endTime)
- #end
- #if(${mastKey}!='calculate')
- <template v-if="column.key === #if($!{fieLdsModel.vModel}) '${fieLdsModel.vModel}' #else '${config.formId}' #end">
- ## 子表标签生成
- #CreateFieldTag($mastKey,$fieLdsModel,$config,$mastModel,$beforeVmodel,'index',true)
- </template>
- #end
- #end
- ## 判断子表行内有几个按键---底下生成子表字段信息时也要使用这个变量
- #set($hasLineBtnNum = 0)
- #foreach($item in $child.columnBtnsList)
- #if($item.show)
- #set($hasLineBtnNum = ${hasLineBtnNum} + 50)
- #end
- #end
- ## 子表行操作按键生成
- #if($hasLineBtnNum>0)
- <template v-if="column.key === 'action'">
- <a-space>
- #foreach($item in $child.columnBtnsList)
- #if(${item.value} == "copy" && ${item.show})
- <a-button class="action-btn" type="link" @click="copy${aliasName}Row(index)" size="small">#if(${item.labelI18nCode})
- {{t('${item.labelI18nCode}', '${item.label}')}} #else ${item.label} #end</a-button>
- #end
- #if(${item.value} == "remove" && ${item.show})
- <a-button class="action-btn" type="link" color="error" @click="remove${aliasName}Row(index,${item.showConfirm})" size="small">#if(${item.labelI18nCode})
- {{t('${item.labelI18nCode}', '${item.label}')}} #else ${item.label} #end</a-button>
- #end
- #end
- </a-space>
- </template>
- #end
- </template>
- ## 子表合计
- #if($child.showSummary)
- #set($childSummary=true)
- <template #summary v-if="dataForm.${aliasname}List?.length">
- <a-table-summary fixed>
- <a-table-summary-row>
- <a-table-summary-cell :index="0">{{ t('component.table.summary') }}</a-table-summary-cell>
- <a-table-summary-cell v-for="(item, index) in get${aliasName}ColumnSum" :key="index" :index="index + 1" :align="get${aliasName}SummaryCellAlign(index)">{{ item }}</a-table-summary-cell>
- <a-table-summary-cell #if($context.isFlow) v-if="!judgeWrite('${aliasname}List')"#end :index="get${aliasName}ColumnSum.length + 1"></a-table-summary-cell>
- </a-table-summary-row>
- </a-table-summary>
- </template>
- #end
- </a-table>
- #if($child.footerBtnsList.size()>0)
- #if($child.footerBtnsList.size()>2)#set($isSelectDialog = true) #end
- <a-space class="input-table-footer-btn" #if($context.isFlow) v-if="!judgeWrite('${aliasname}List')" #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)
- <a-button type =#if(${footerBtn.btnType} == 'text')'link'#else'${footerBtn.btnType}'#end preIcon="${footerBtn.btnIcon}"
- @click="$btnName">#if(${footerBtn.labelI18nCode}) {{t('${footerBtn.labelI18nCode}','${footerBtn.label}')}} #else ${footerBtn.label} #end</a-button>
- #end
- #end
- </a-space>
- #end
- </a-form-item>
- #end
- </a-col>
- #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<state.dataForm.${aliasname}List.length;i++){
- const e = state.dataForm.${aliasname}List[i];
- #foreach($childListAll in ${itemModel.childList})
- #set($html = $childListAll.fieLdsModel)
- #set($model = "${html.vModel}")
- #set($config = ${html.config})
- #set($jnpfKey = "${config.jnpfKey}")
- #set($takeEnd = true)
- #set($req = $config.required)
- #set($regular = ${config.regList})
- #if($multipleUnit.contains($mastKey))
- #set($messages="t('sys.validate.arrayRequiredPrefix ','请至少选择一个')")
- #else
- #set($messages="t('sys.validate.textRequiredSuffix','不能为空')")
- #end
- #if(${model} && ${req}==true && !${DonotJudgeNull.contains(${jnpfKey})})
- #if(${jnpfKey}=='cascader'||${jnpfKey}=='checkbox' || ${jnpfKey}=='areaSelect'|| ${jnpfKey} == 'organizeSelect' ||
- ${jnpfKey}=='uploadImg'||${jnpfKey}=='uploadFile' || ${jnpfKey}=='timeRange' || ${jnpfKey}=='dateRange')
- if (!e.${model} || !e.${model}.length) {
- #elseif(${jnpfKey}=='select' || ${jnpfKey}=='userSelect'|| ${jnpfKey}=='depSelect' || ${jnpfKey}=='posSelect' ||
- ${jnpfKey}=='treeSelect'|| ${jnpfKey}=='roleSelect'|| ${control}=='groupSelect'|| ${control}=='popupTableSelect')
- #if(${html.multiple}=='true')
- if (!e.${model} || !e.${model}.length) {
- #else
- if (!e.${model}) {
- #end
- #elseif(${control}!='switch')
- if (!e.${model}) {
- #else
- #set($takeEnd = false)
- #end
- createMessage.error(#if(${config.labelI18nCode}) t('${config.labelI18nCode}','${config.label}') #else '${config.label}' #end + $messages);
- isOk = false;
- break;
- #if($takeEnd == true)
- }
- #end
- #end
- #if(${model} && ${regular})
- if (e.${model}) {
- var regPos = ${regular}
- for (let i = 0; i < regPos.length; i++) {
- const element = regPos[i];
- if (element.pattern && !eval(element.pattern).test(e.${model})) {
- let msg = element.messageI18nCode ? t(element.messageI18nCode,element.message) : element.message;
- createMessage.error(msg);
- isOk = false;
- break;
- }
- }
- }
- #end
- #end
- }
- return isOk;
- }
- #end
- ## 平铺布局时设置默认展开
- #if(${itemModel.layoutType} == 'list')
- // 平铺布局时设置默认展开
- function set${aliasname}ActiveKey() {
- state.${aliasname}outerActiveKey = [0];
- state.${aliasname}innerActiveKey = [];
- #if(${itemModel.defaultExpandAll})
- state.${aliasname}innerActiveKey = ['summary'];
- if (!state.dataForm.${aliasname}List.length) return;
- for (let i = 0; i < state.dataForm.${aliasname}List.length; i++) {
- state.${aliasname}innerActiveKey.push(state.dataForm.${aliasname}List[i].jnpfId);
- }
- #end
- }
- #end
- #end
- #end
- ## dataform属性生成
- #macro(CreateDataform)
- #foreach($fieLdsModel in ${context.fields})
- #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
- #set($fieLdsModel =$fieLdsModel.formColumnModel.fieLdsModel)
- #set($vModel = "${html.vModel}")
- #if($vModel !='')
- #set($config = $html.config)
- #set($jk = $html.config.jnpfKey)
- #set($dataType = "$!{config.dataType}")
- #set($defaultCurrent = $config.defaultCurrent)
- #set($defult = $config.defaultValue)
- #set($format = $html.format)
- #if($jk!='text' && $jk!='divider')
- #GetFeildDefaultValue("")
- #end
- #end
- #end
- #foreach($mast in ${context.mastTable})
- #set($mastField = $mast.formMastTableModel.mastTable.fieLdsModel)
- #set($fieLdsModel = $mast.formMastTableModel.mastTable.fieLdsModel)
- #set($config =$mastField.config)
- #set($jk = ${config.jnpfKey})
- #set($vModel = ${mast.formMastTableModel.vModel})
- #set($dataType = "$!{config.dataType}")
- #set($defaultCurrent = $config.defaultCurrent)
- #set($defult = $config.defaultValue)
- #set($format = $mastField.format)
- #if($jk!='text' && $jk!='divider')
- #GetFeildDefaultValue("")
- #end
- #end
- #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:[],
- #end
- #if($context.version)
- version: 0,
- #end
- #end
- ## 字段-默认值取值方法
- #macro(GetFeildDefaultValue $aliasLowName)
- #set($multiple=${fieLdsModel.multiple})
- #set($selectType=${fieLdsModel.selectType})
- #if(${jk}=='datePicker' && ${defaultCurrent} == true)
- ${vModel}:dayjs().startOf(getDateTimeUnit('${format}')).valueOf(),
- #elseif($jk=='timePicker')
- #if(${defaultCurrent} == true)
- ${vModel}:dayjs().format('${format}'),
- #else
- ${vModel}:'$!{defult}',
- #end
- #elseif(${jk}=='areaSelect' && ${defult} =='[]')
- ${vModel}:[],
- #elseif(${jk}=='depSelect' && ${defaultCurrent} == true)
- #if($multiple == true)
- ${vModel}: userInfo.departmentId?[userInfo.departmentId]:[],
- #else
- ${vModel}: userInfo.departmentId?userInfo.departmentId:'',
- #end
- #elseif(${jk}=='organizeSelect' && ${defaultCurrent} == true)
- #if($multiple == true)
- ${vModel}: userInfo.organizeIdList?[userInfo.organizeIdList]:[],
- #else
- ${vModel}: userInfo.organizeIdList?userInfo.organizeIdList:'',
- #end
- #elseif((${jk}=='userSelect' || ${jk}=='usersSelect') && ${defaultCurrent} == true)
- #if($multiple == true)
- ${vModel}: userInfo.userId?[userInfo.userId]:[],
- #else
- ${vModel}: userInfo.userId?userInfo.userId:'',
- #end
- #elseif(${jk}=='posSelect' && ${defaultCurrent} == true)
- #if($multiple == true)
- ${vModel}: userInfo.positionIds.length?userInfo.positionIds.map(o => 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
|