FormMarco.vm 92 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955
  1. ##通用参数
  2. #parse("PublicMacro/ConstantMarco.vm")
  3. #ConstantParams()
  4. ## 编辑-表单渲染通用模块
  5. #macro(FormRendering)
  6. #foreach($fieLdsModel in ${context.form})
  7. #set($jnpfKey = "${fieLdsModel.jnpfKey}")
  8. #set($isEnd = "${fieLdsModel.isEnd}")
  9. #set($formModel = ${fieLdsModel.formModel})
  10. #set($config=$formModel.config)
  11. #set($span=$config.span)
  12. #set($outermost = ${formModel.outermost})
  13. #set($borderType = ${formModel.borderType})
  14. #set($borderColor = ${formModel.borderColor})
  15. #set($borderWidth = ${formModel.borderWidth})
  16. #set($pcshow = $config.pc)
  17. #if(${jnpfKey}=='row' && $pcshow == true)
  18. #if(${isEnd}=='0')
  19. <a-col :span="${formModel.span}" class="ant-col-item">
  20. <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
  21. #else
  22. </a-row>
  23. </a-col>
  24. #end
  25. #elseif(${jnpfKey}=='card' && $pcshow == true)
  26. #if(${isEnd}=='0')
  27. <a-col #if(${span}) :span="${span}" #else :span="24" #end class="ant-col-item">
  28. <a-card class="mb-20" #if(${formModel.shadow}=='hover') hoverable #end>
  29. #if(${formModel.header} || ${formModel.headerI18nCode})
  30. <template #title>#if(${formModel.headerI18nCode}) {{t('${formModel.headerI18nCode}','${formModel.header}')}} #else ${formModel.header} #end
  31. #if((${formModel.header} || ${formModel.headerI18nCode}) && ( ${config.tipLabel} || ${config.tipLabelI18nCode}))
  32. <BasicHelp #if(${config.tipLabelI18nCode}) :text="t('${config.tipLabelI18nCode}','${config.tipLabel}')" #else text="${config.tipLabel}" #end />
  33. #end
  34. </template>
  35. #end
  36. <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
  37. #else
  38. </a-row>
  39. </a-card>
  40. </a-col>
  41. #end
  42. #elseif(${jnpfKey}=='tab' && $pcshow == true)
  43. #set($tabs = "a-tabs")
  44. #if(${outermost}=='1')
  45. #set($tabs = "a-tab-pane")
  46. #end
  47. #if(${isEnd}=='0')
  48. #if(${outermost}=='0')
  49. <a-col :span="${formModel.span}" class="ant-col-item">
  50. <${tabs} v-model:activeKey="state.${formModel.model}" #if($formModel.type)type="${formModel.type}"#end tabPosition="${formModel.tabPosition}" class="mb-20" >
  51. #else
  52. <${tabs} #if(${formModel.titleI18nCode}):tab="t('${formModel.titleI18nCode}','${formModel.title}')" #else tab="${formModel.title}"#end key="${formModel.name}" forceRender>
  53. <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
  54. #end
  55. #else
  56. #if(${outermost}=='0')
  57. </${tabs}>
  58. </a-col>
  59. #else
  60. </a-row>
  61. </${tabs} >
  62. #end
  63. #end
  64. #elseif(${jnpfKey}=='tableGrid' || ${jnpfKey}=='tableGridTd' || ${jnpfKey}=='tableGridTr')
  65. #set($tabs = "tbody")
  66. #set($tableGrid = "table")
  67. #set($needRow = false)
  68. #if(${jnpfKey}=='tableGridTr')
  69. #set($tabs = "tr")
  70. #elseif(${jnpfKey}=='tableGridTd')
  71. #set($tabs = "")
  72. #if(${config.merged}==false)
  73. #set($tabs = "td")
  74. #set($needRow = true)
  75. #end
  76. #end
  77. #if(${config.pc}==true)
  78. #if(${isEnd}=='0')
  79. #if(${jnpfKey}=='tableGrid')
  80. <${tableGrid} class="table-grid-box" :style='{"--borderType":"${borderType}","--borderColor":"${borderColor}","--borderWidth":"${borderWidth}px"}'>
  81. #end
  82. #if($tabs)
  83. <${tabs}#if(${config.colspan}) colspan="${config.colspan}"#end#if(${config.rowspan}) rowspan="${config.rowspan}"#end
  84. #if($!{config.backgroundColor}) :style="{ '--backgroundColor': '${config.backgroundColor}' }"#end>
  85. #if($needRow)
  86. <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
  87. #end
  88. #end
  89. #else
  90. #if($tabs)
  91. #if($needRow)
  92. </a-row>
  93. #end
  94. </${tabs}>
  95. #end
  96. #if(${jnpfKey}=='tableGrid')
  97. </${tableGrid}>
  98. #end
  99. #end
  100. #end
  101. #elseif(${jnpfKey}=='collapse' && $pcshow == true)
  102. #set($collapse = "a-collapse")
  103. #if(${outermost}=='1')
  104. #set($collapse = "a-collapse-panel")
  105. #end
  106. #if(${isEnd}=='0')
  107. #if(${outermost}=='0')
  108. <a-col :span="${formModel.span}" class="ant-col-item">
  109. <${collapse} ghost expandIconPosition="right" :accordion="${formModel.accordion}" v-model:activeKey="state.${formModel.model}" class="mb-20px">
  110. #else
  111. <${collapse} #if(${formModel.titleI18nCode}):header="t('${formModel.titleI18nCode}','${formModel.title}')" #else header="${formModel.title}"#end key="${formModel.name}" forceRender>
  112. <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
  113. #end
  114. #else
  115. #if(${outermost}=='0')
  116. </${collapse}>
  117. </a-col>
  118. #else
  119. </a-row>
  120. </${collapse}>
  121. #end
  122. #end
  123. #elseif(${jnpfKey}=='steps' && $pcshow == true)
  124. #set($step = "a-steps")
  125. #if(${outermost}=='1')
  126. #set($step = "a-step")
  127. #end
  128. #if(${isEnd}=='0')
  129. #if(${outermost}=='0')
  130. <a-col :span="${formModel.span}" class="ant-col-item">
  131. <a-steps type=#if($!{formModel.simple}) 'navigation' #else 'default' #end status="${formModel.processStatus}" v-model:current="state.${formModel.model}" class="mb-10px">
  132. #foreach($itemStep in $config.children)
  133. <a-step #if(${itemStep.titleI18nCode}):title="t('${itemStep.titleI18nCode}','${itemStep.title}')" #else title="${itemStep.title}"#end key="${itemStep.name}">
  134. #if($!{itemStep.icon})
  135. <template #icon>
  136. <span class="${itemStep.icon} custom-icon"></span>
  137. </template>
  138. #end
  139. </a-step>
  140. #end
  141. </a-steps>
  142. #else
  143. <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">
  144. #end
  145. #else
  146. #if(${outermost}=='0')
  147. </a-col>
  148. #else
  149. </a-row>
  150. #end
  151. #end
  152. #elseif(${jnpfKey}=='groupTitle' || ${jnpfKey}=='text'|| ${jnpfKey} == 'button' || ${jnpfKey} == 'link' || ${jnpfKey} == 'alert'|| ${jnpfKey} == 'divider')
  153. #if($pcshow== true)
  154. <a-col :span="${span}" class="ant-col-item">
  155. <a-form-item>
  156. <${config.tag}
  157. #if($formModel.style) :style='${formModel.style}'#end
  158. #if($formModel.href) href = "$formModel.href"#end
  159. #if($formModel.target) target = "$formModel.target"#end
  160. #if($formModel.showIcon) :show-icon= "$formModel.showIcon"#end
  161. #if($formModel.align) align="${formModel.align}" #end
  162. #if($formModel.disabled) :disabled="${formModel.disabled}" #end
  163. #if($formModel.buttonText || $formModel.buttonTextI18nCode) #if(${formModel.buttonTextI18nCode}) :buttonText="t('${formModel.buttonTextI18nCode}', '${formModel.buttonText}')"
  164. #else buttonText="${formModel.buttonText}" #end#end
  165. #if($formModel.type) type="${formModel.type}" #end
  166. #if($formModel.textStyle) :textStyle='${formModel.textStyle}'#end
  167. #if($formModel.contentPosition) contentPosition="${formModel.contentPosition}" #end
  168. #if(${jnpfKey} == 'alert' && $!{formModel.closable}) :closable= "$formModel.closable" #end
  169. #if($formModel.title || $formModel.titleI18nCode) #if(${formModel.titleI18nCode}) :title="t('${formModel.titleI18nCode}', '${formModel.title}')"
  170. #else title="${formModel.title}" #end#end
  171. #if($formModel.closeText || $formModel.closeTextI18nCode) #if(${formModel.closeTextI18nCode}) :closeText="t('${formModel.closeTextI18nCode}', '${formModel.closeText}')"
  172. #else closeText="${formModel.closeText}" #end#end
  173. #if($formModel.description || $formModel.descriptionI18nCode) #if(${formModel.descriptionI18nCode}) :description="t('${formModel.descriptionI18nCode}', '${formModel.description}')"
  174. #else description="${formModel.description}" #end#end
  175. #if(${formModel.helpMessage} || ${formModel.helpMessageI18nCode}) #if(${formModel.helpMessageI18nCode}) :helpMessage ="t('${formModel.helpMessageI18nCode}', '${formModel.helpMessage}')"
  176. #else helpMessage ="${formModel.helpMessage}" #end #end
  177. #if(${formModel.content} || ${formModel.contentI18nCode}) #if(${formModel.contentI18nCode}) :content ="t('${formModel.contentI18nCode}', '${formModel.content}')"
  178. #else content ="${formModel.content}" #end #end>
  179. </${config.tag}>
  180. </a-form-item>
  181. </a-col>
  182. #end
  183. #elseif(${jnpfKey}=='qrcode' || ${jnpfKey}=='barcode')
  184. #if($pcshow== true)
  185. <a-col :span="${span}" class="ant-col-item">
  186. <a-form-item>
  187. #if($config.showLabel)<template #label>#if(${config.labelI18nCode}) {{t('${config.labelI18nCode}','${config.label}')}} #else${config.label} #end
  188. #if((${config.label} || ${config.labelI18nCode}) && ${context.labelSuffix})${context.labelSuffix}#end
  189. #if((${config.label} || ${config.labelI18nCode}) && (${config.tipLabel} || ${config.tipLabelI18nCode}))
  190. <BasicHelp #if(${config.tipLabelI18nCode}) :text="t('${config.tipLabelI18nCode}','${config.tipLabel}')" #else text="${config.tipLabel}" #end />#end</template> #end
  191. <${config.tag} #if(${formModel.format}) format='${formModel.format}'#end
  192. #if(${formModel.lineColor}) lineColor = "${formModel.lineColor}"#end
  193. #if(${formModel.colorLight}) colorLight = "${formModel.colorLight}"#end
  194. #if(${formModel.colorDark}) colorDark = "${formModel.colorDark}"#end
  195. #if(${formModel.background}) background = "${formModel.background}"#end
  196. #if(${formModel.width}) width = "${formModel.width}"#end
  197. #if(${formModel.height}) height = "${formModel.height}"#end
  198. #if(${formModel.relationField}) :staticText = "dataForm.${formModel.relationField}"
  199. #else staticText = "${formModel.staticText}"#end >
  200. </${config.tag}>
  201. </a-form-item>
  202. </a-col>
  203. #end
  204. #elseif(${jnpfKey}=='mast' || ${jnpfKey}=='mastTable')
  205. #EachItemRender(${jnpfKey})
  206. #elseif($jnpfKey == 'table')
  207. #CreateChildTable()
  208. #end
  209. #end
  210. #end
  211. ## 编辑-主表副表-字段渲染
  212. #macro(EachItemRender $tableType)
  213. #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
  214. #set($beforeVmodel =${html.vModel})
  215. ## 副表参数
  216. #if($tableType=='mastTable')
  217. #set($html = $fieLdsModel.formMastTableModel.mastTable.fieLdsModel)
  218. #set($beforeVmodel =${fieLdsModel.formMastTableModel.vModel})
  219. #end
  220. #set($vModel = "${html.vModel}")
  221. #set($mastModel="${context.formModel}.${beforeVmodel}")
  222. #set($config = $html.config)
  223. #set($mastKey = "${config.jnpfKey}")
  224. #set($show = $config.noShow)
  225. #set($pcshow = $config.pc)
  226. #set($startTime=${html.startTime})
  227. #set($endTime=${html.endTime})
  228. ## 时间处理
  229. #if(${mastKey}=='datePicker'||${mastKey}=='timePicker')
  230. #GetStartAndEndTime($mastKey,$config,$html,$startTime,$endTime)
  231. #end
  232. #if($show == false && $pcshow == true && ${mastKey}!='calculate')
  233. <a-col :span="${config.span}" class="ant-col-item" #if($context.isFlow) #if(${vModel}) v-if="judgeShow('${beforeVmodel}')"
  234. #elseif($mastKey == 'relationFormAttr' || $mastKey == 'popupAttr') v-if="judgeShow('${html.relationField}')" #end
  235. #elseif(${context.columnData.useFormPermission}) #if(${vModel}) v-if="hasFormP('${beforeVmodel}')"
  236. #elseif($mastKey == 'relationFormAttr' || $mastKey == 'popupAttr') v-if="hasFormP('${html.relationField}')" #end #end >
  237. <a-form-item #if($config.showLabel == true) #if($config.labelWidth && ${context.labelPosition}!="top") :labelCol="{ style: { width: '${config.labelWidth}px' } }"#end
  238. #else :labelCol="{ style: { width: '0px' } }"#end #if($vModel) name="${beforeVmodel}" #end>
  239. #if($config.showLabel)<template #label>#if(${config.labelI18nCode}) {{t('${config.labelI18nCode}','${config.label}')}} #else${config.label} #end
  240. #if((${config.label} || ${config.labelI18nCode}) && ${context.labelSuffix})${context.labelSuffix}#end
  241. #if((${config.label} || ${config.labelI18nCode}) && (${config.tipLabel} || ${config.tipLabelI18nCode}))
  242. <BasicHelp #if(${config.tipLabelI18nCode}) :text="t('${config.tipLabelI18nCode}','${config.tipLabel}')" #else text="${config.tipLabel}" #end />#end</template> #end
  243. #CreateFieldTag($mastKey,$html,$config,$mastModel,$beforeVmodel,-1,true)
  244. </a-form-item>
  245. </a-col>
  246. #end
  247. #end
  248. ## 编辑-生成字段标签
  249. #macro(CreateFieldTag $mastKey,$html,$config,$mastModel,$beforeVmodel,$index,$isChangeData)
  250. <${config.tag} #if($html.vModel) v-model:value="${mastModel}" #if($isChangeData) @change="changeData('${beforeVmodel}',${index})" #end #end
  251. #if($mastKey!='text')
  252. #if(${html.placeholder} || ${html.placeholderI18nCode}) #if(${html.placeholderI18nCode}) :placeholder="t('${html.placeholderI18nCode}', '${html.placeholder}')"
  253. #else placeholder="${html.placeholder}" #end #end
  254. #end
  255. #if(!$context.lineEdit && ($mastKey =='popupSelect' || $mastKey =='popupTableSelect'|| $mastKey =='calculate'))
  256. #if($index == 'index') :rowIndex="index"#end :formData="${context.formModel}"
  257. #end
  258. #if($mastKey== 'uploadFile' || $mastKey== 'uploadImg')
  259. #if(${html.fileSize}) :fileSize="${html.fileSize}" #end #end
  260. #if($html.maxlength) :maxlength="${html.maxlength}" #end
  261. #if($html.readonly == true ) readonly #end
  262. #if($context.isFlow)
  263. #if($mastKey== 'popupAttr'||$mastKey== 'relationFormAttr')
  264. #set($judgeWriteName="${html.relationField}")
  265. #else
  266. #set($judgeWriteName="${beforeVmodel}")
  267. #end
  268. ## 子表,xxxlist-input
  269. #if($index == 'index')
  270. #if($mastKey== 'popupAttr'||$mastKey== 'relationFormAttr')
  271. #set($judgeWriteName= "${aliasname}List-${html.relationField}")
  272. #else
  273. #set($judgeWriteName= "${aliasname}List-${html.vModel}")
  274. #end
  275. #end
  276. :disabled="judgeWrite('${judgeWriteName}')"
  277. #else
  278. #if($html.disabled == true ):disabled="${html.disabled}"#end
  279. #end
  280. #if($html.expression) :expression ='${html.expression}' #end
  281. #if($html.templateJson && $InterfaceHasJson.contains($mastKey) && !$context.lineEdit) :templateJson="state.interfaceRes.${beforeVmodel}"#end
  282. #if($!html.clearable || $html.clearable=='false') :allowClear='${html.clearable}' #end
  283. #if($html.prefixIcon) prefix-icon='${html.prefixIcon}' #end
  284. #if($html.suffixIcon) suffix-icon='${html.suffixIcon}' #end
  285. #if($html.style) :style='${html.style}'#end
  286. #if($html.showWordLimit == true ) ${html.showWordLimit} #end
  287. #if($html.size) size="${html.size}" #end
  288. #if($html.min) :min="${html.min}" #end
  289. #if($html.max) :max="${html.max}" #end
  290. #if($html.count) :count="${html.count}" #end
  291. #if($html.type) type="${html.type}" #end
  292. #if($html.showLevel) showLevel="${html.showLevel}" #end
  293. #if($html.autoSize) :autoSize='${html.autoSize}' #end
  294. #if($html.step) :step="${html.step}" #end
  295. #if($html.precision) :precision="${html.precision}" #end
  296. #if($html.stepstrictly==true) stepstrictly #end
  297. #if($html.textStyle) :textStyle='${html.textStyle}' #end
  298. #if($html.lineHeight) :lineHeight="${html.lineHeight}" #end
  299. #if($html.fontSize) :fontSize="${html.fontSize}" #end
  300. #if($html.showChinese) :showChinese="${html.showChinese}" #end
  301. #if($html.showPassword) show-password #end
  302. #if($html.filterable || $html.filterable=='false') :showSearch='${html.filterable}' #end
  303. #if($html.multiple) :multiple="${html.multiple}" #end
  304. #if($html.separator) separator="${html.separator}" #end
  305. #if($html.isrange==true) is-range #end
  306. #if($html.rangeseparator) range-separator="${html.rangeseparator}" #end
  307. #if($html.format) format="${html.format}" #end
  308. #if($html.colorformat) color-format="${html.colorformat}" #end
  309. #if($html.valueformat) value-format="${html.valueformat}" #end
  310. #if($!html.activecolor) active-color="${html.activecolor}" #end
  311. #if($!html.inactivecolor) inactive-color="${html.inactivecolor}" #end
  312. #if($!html.activevalue) :checkedValue="${html.activevalue}" #end
  313. #if($!html.inactivevalue) :unCheckedValue="${html.inactivevalue}" #end
  314. ## #if($!html.activeTxt) checkedChildren="${html.activeTxt}" #end
  315. ## #if($!html.inactiveTxt) unCheckedChildren="${html.inactiveTxt}" #end
  316. #if($html.showScore == true ) show-score #end
  317. #if($html.showText == true ) show-text #end
  318. #if($html.allowhalf == true ) allow-half #end
  319. #if($html.showAlpha == true ) show-alpha #end
  320. #if($html.showStops == true ) show-stops #end
  321. #if($html.range == true ) range #end
  322. #if($html.showTip == true ) :showTip="${html.showTip}" #end
  323. #if($html.accept) accept="${html.accept}" #end
  324. #if($html.sizeUnit) sizeUnit="${html.sizeUnit}" #end
  325. #if($html.limit) :limit="${html.limit}" #end
  326. #if($html.pathType) pathType="${html.pathType}" #end
  327. #if($html.sortRule) :sortRule='${html.sortRule}' #end
  328. #if($html.timeFormat) timeFormat="${html.timeFormat}" #end
  329. #if($html.folder) folder="${html.folder}" #end
  330. #if($html.buttonText || $html.buttonTextI18nCode) #if(${html.buttonTextI18nCode}) :buttonText="t('${html.buttonTextI18nCode}', '${html.buttonText}')"
  331. #else buttonText="${html.buttonText}" #end#end
  332. #if($html.contentposition) content-position="${html.contentposition}" #end
  333. #if($!html.level || $html.level=='0') :level=${html.level} #end
  334. #if($html.isAmountChinese) isAmountChinese #end
  335. #if($html.thousands) thousands #end
  336. #if($html.addonAfter) addonAfter="${html.addonAfter}" #end
  337. #if($html.addonBefore) addonBefore="${html.addonBefore}" #end
  338. #if($html.controls) :controls="${html.controls}" #end
  339. #if($startTime) :startTime="${startTime}" #end
  340. #if($endTime) :endTime="${endTime}" #end
  341. #if($html.tipText) tipText="${html.tipText}" #end
  342. #if($html.href) href = "$html.href"#end
  343. #if($html.height) :height = "$html.height"#end
  344. #if($html.useMask) :useMask = "${html.useMask}"#end
  345. #if($html.maskConfig) :maskConfig = "maskConfig.${beforeVmodel}"#end
  346. #if($html.autoLocation) :autoLocation = "$html.autoLocation" #end
  347. #if($html.enableLocationScope) :enableLocationScope = "$html.enableLocationScope" #end
  348. #if($html.adjustmentScope) :adjustmentScope = "$html.adjustmentScope" #end
  349. #if($html.enableDesktopLocation) :enableDesktopLocation = "$html.enableDesktopLocation" #end
  350. #if($html.locationScope) :locationScope = "state.locationScope.${beforeVmodel}" #end
  351. #if($html.showCount || $html.showCount == 'false') :showCount = "${html.showCount}" #end
  352. #if($html.borderType) borderType = "$html.borderType" #end
  353. #if($html.borderColor) borderColor = "$html.borderColor" #end
  354. #if($html.borderWidth) :borderWidth = "$html.borderWidth" #end
  355. #if($html.isInvoke) :isInvoke="$html.isInvoke" #end
  356. #if($mastKey == 'relationFormAttr' || $mastKey == 'popupAttr')
  357. #set($lineEidtRelationField = $html.relationField)
  358. ## 行内格式是guanlianbiaodan_jnpfTable_test_salesordecopy_copy11==刚好没有子表删除表格
  359. #if($html.relationField && $html.relationField.contains("_jnpfTable_"))
  360. #if($html.relationField.contains("$config.tableName"))
  361. ## 主表
  362. #set($lineEidtRelationField = $html.relationField.split("_jnpfTable_")[0])
  363. #else
  364. ## 副表
  365. #set($lineEidtRelationField = "jnpf_"+$config.tableName+"_jnpf_"+$html.relationField.split("_jnpfTable_")[0])
  366. #end
  367. #end
  368. #if($html.relationField) :relationField=#if(${index}=="index") "'${lineEidtRelationField}'+index" #else "'${lineEidtRelationField}'" #end#end
  369. #if($html.showField) showField="${html.showField}" #end
  370. #if($html.isStorage) isStorage=${html.isStorage} #end
  371. #end
  372. #if($html.selectType) selectType="$html.selectType" #end
  373. #if($html.selectType == 'custom' || $mastKey == 'signature')
  374. #if($html.ableDepIds) :ableDepIds = 'ableAll.${beforeVmodel}ableDepIds' #end
  375. #if($html.ablePosIds) :ablePosIds = 'ableAll.${beforeVmodel}ablePosIds' #end
  376. #if($html.ableUserIds) :ableUserIds = 'ableAll.${beforeVmodel}ableUserIds' #end
  377. #if($html.ableRoleIds) :ableRoleIds = 'ableAll.${beforeVmodel}ableRoleIds' #end
  378. #if($html.ableGroupIds) :ableGroupIds = 'ableAll.${beforeVmodel}ableGroupIds' #end
  379. #if($html.ableIds) :ableIds = 'ableAll.${beforeVmodel}ableIds' #end
  380. #elseif($html.selectType == 'dep' || $html.selectType == 'pos' || $html.selectType == 'role' || $html.selectType == 'group')
  381. #set($ableRelationIds="dataForm.${html.relationField}")
  382. #if($html.relationChild)
  383. #set($ableRelationIds="record.${html.relationField}")
  384. #end
  385. #if($html.relationField)
  386. :ableRelationIds="Array.isArray(${ableRelationIds}) ? ${ableRelationIds} : [${ableRelationIds}]"
  387. #end
  388. #end
  389. #if($mastKey == 'relationForm') :field=#if(${index}=="index")"'${html.vModel}'+index"#else"'${beforeVmodel}'"#end modelId ="${html.modelId}"
  390. :columnOptions="optionsObj.${beforeVmodel}columnOptions" relationField="${html.relationField}" popupWidth="${html.popupWidth}" propsValue="${html.propsValue}"
  391. #if($html.hasPage) hasPage :pageSize="$html.pageSize" #end :queryType=#if(${html.queryType})"${html.queryType}"#else"0"#end #end
  392. #if($mastKey == 'popupSelect' || $mastKey =='popupTableSelect') :field=#if(${index}=="index")"'${html.vModel}'+index"#else"'${beforeVmodel}'"#end interfaceId="${html.interfaceId}"
  393. :columnOptions="optionsObj.${beforeVmodel}columnOptions" propsValue="${html.propsValue}" relationField="${html.relationField}" popupType="${html.popupType}"
  394. #if(${html.popupTitle}) popupTitle="${html.popupTitle}" #end popupWidth="${html.popupWidth}" #if($html.hasPage) hasPage :pageSize="$html.pageSize" #end #end
  395. #if($mastKey=='cascader' || $mastKey=='treeSelect' || $mastKey=='checkbox'|| $mastKey=='radio'|| $mastKey=='select')
  396. ##有index时说明时子表,子表动态可选值 取当前行内option
  397. #if(${index}=="index" && ${config.dataType}=="dynamic"):options="record.${beforeVmodel}Options" #else :options="optionsObj.${beforeVmodel}Options" #end
  398. :fieldNames="optionsObj.${beforeVmodel}Props"
  399. #if(${html.direction}) direction="${html.direction}" #end
  400. #if(${html.optionType}) optionType="${html.optionType}" #end
  401. #end
  402. #if($mastKey == 'autoComplete')
  403. relationField="${html.relationField}"
  404. interfaceId="${html.interfaceId}"
  405. #if(${html.total}) :total="${html.total}" #end
  406. #if($index == 'index') :rowIndex="index" #end
  407. :formData="${context.formModel}"
  408. #end
  409. #if($index != 'index' && ($mastKey == 'relationForm' || $mastKey == 'popupSelect'))
  410. :extraOptions = "state.extraOptions.${beforeVmodel}"
  411. #end
  412. >
  413. #if($mastKey!='checkbox' && $mastKey!='radio' && $mastKey!='select')
  414. #if($html.slot.prepend)
  415. <template slot="prepend">${html.slot.prepend}</template>
  416. #end
  417. #if($html.slot.append)
  418. <template slot="append">${html.slot.append}</template>
  419. #end
  420. #end
  421. </${config.tag}>
  422. #end
  423. ## 编辑-子表生成
  424. #macro(CreateChildTable)
  425. #set($child = $fieLdsModel.childList)
  426. #set($aliasname = "")
  427. #foreach($children in ${context.children})
  428. #if(${children.tableModel}==${child.tableModel})
  429. #set($aliasname = "${children.aliasLowName}")
  430. #set($aliasName = "${children.aliasUpName}")
  431. #end
  432. #end
  433. <a-col :span="${child.span}" class="ant-col-item mb-20px" #if($context.isFlow) v-if="judgeShow('${aliasname}List')" #else
  434. #if(${context.columnData.useFormPermission})v-if="hasFormP('${child.tableModel}')"#end #end >
  435. #if($!{child.layoutType} == 'list')
  436. ## 子表平铺
  437. <div class="jnpf-child-list" >
  438. <a-collapse expandIconPosition="right" :bordered="false" class="outer-collapse" v-model:activeKey="state.${aliasname}outerActiveKey">
  439. <a-collapse-panel forceRender>
  440. <template #header>
  441. <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>
  442. #if($child.showTitle== true && $child.tipLabel)<BasicHelp #if(${child.tipLabelI18nCode}) :text="t('${child.tipLabelI18nCode}','${child.tipLabel}')" #else text="${child.tipLabel}" #end />#end
  443. </template>
  444. <a-collapse :bordered="false" v-model:activeKey="state.${aliasname}innerActiveKey">
  445. <template #expandIcon="{ isActive }">
  446. <CaretRightOutlined :rotate="isActive ? 90 : 0" />
  447. </template>
  448. <a-collapse-panel v-for="(record, index) in dataForm.${aliasname}List" :key="record.jnpfId" forceRender>
  449. <template #header>
  450. <span class="min-h-22px inline-block">#if(${child.labelI18nCode}) {{t('${child.labelI18nCode}','${child.label}')}} #else ${child.label} #end({{ index + 1 }})</span>
  451. </template>
  452. <template #extra #if($context.isFlow) v-if="!judgeWrite('${aliasname}List')" #end>
  453. <a-space>
  454. #foreach($item in $child.columnBtnsList)
  455. #if(${item.value} == "copy" && ${item.show})
  456. <a-button class="action-btn" type="link" @click.stop="copy${aliasName}Row(index)" size="small">#if(${item.labelI18nCode})
  457. {{t('${item.labelI18nCode}','${item.label}')}} #else ${item.label}#end</a-button>
  458. #end
  459. #if(${item.value} == "remove" && ${item.show})
  460. <a-button class="action-btn" type="link" color="error" @click.stop="remove${aliasName}Row(index,${item.showConfirm})" size="small">#if(${item.labelI18nCode})
  461. {{t('${item.labelI18nCode}','${item.label}')}} #else ${item.label}#end</a-button>
  462. #end
  463. #end
  464. </a-space>
  465. </template>
  466. <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
  467. #foreach($itemModel in ${child.childList})
  468. #set($fieLdsModel = ${itemModel.fieLdsModel})
  469. #set($config = ${fieLdsModel.config})
  470. #set($mastKey = "${config.jnpfKey}")
  471. #set($vModel="${fieLdsModel.vModel}")
  472. #set($mastModel="dataForm.${aliasname}List[index].${vModel}")
  473. #set($beforeVmodel ="${aliasname}${fieLdsModel.vModel}")
  474. #set($startTime=${fieLdsModel.startTime})
  475. #set($endTime=${fieLdsModel.endTime})
  476. #if(${mastKey}=='datePicker'||${mastKey}=='timePicker')
  477. #GetStartAndEndTime($mastKey,$config,$fieLdsModel,$startTime,$endTime)
  478. #end
  479. #if(${config.noShow} == false && ${config.pc}==true && ${config.jnpfKey}!='calculate')
  480. <a-col :span="${config.span}" class="ant-col-item" #if($context.isFlow) v-if="judgeShow('${aliasname}List-${fieLdsModel.vModel}')" #else
  481. #if(${context.columnData.useFormPermission})v-if="hasFormP('${child.tableModel}-${fieLdsModel.vModel}')"#end #end >
  482. <a-form-item #if($config.labelWidth && ${context.labelPosition}!="top") :labelCol="{ style: { width: '${config.labelWidth}px' } }"#end
  483. #if($vModel) :name="['${aliasname}List', index, '${vModel}']" #end>
  484. ## 子表各字段标题生成
  485. <template #label>
  486. #if(${context.isFlow})
  487. #if($mastKey== 'popupAttr'||$mastKey== 'relationFormAttr')
  488. #set($judgeWriteName= "${aliasname}List-${fieLdsModel.relationField}")
  489. #else
  490. #set($judgeWriteName= "${aliasname}List-${fieLdsModel.vModel}")
  491. #end
  492. <span class="required-sign" v-if="judgeRequired('${judgeWriteName}')">*</span>
  493. #else
  494. #if(${config.required})
  495. <span class="required-sign">*</span>
  496. #end
  497. #end
  498. #if(${config.labelI18nCode}) {{t('${config.labelI18nCode}','${config.label}')}} #else ${config.label} #end
  499. #if((${config.label} || ${config.labelI18nCode}) && (${config.tipLabel} || ${config.tipLabelI18nCode}))
  500. <BasicHelp #if(${config.tipLabelI18nCode}) :text="t('${config.tipLabelI18nCode}','${config.tipLabel}')"#else text="${config.tipLabel}"#end />#end
  501. </template>
  502. ## 子表标签生成
  503. #CreateFieldTag($mastKey,$fieLdsModel,$config,$mastModel,$beforeVmodel,'index',true)
  504. </a-form-item>
  505. </a-col>
  506. #end
  507. #end
  508. </a-row>
  509. </a-collapse-panel>
  510. #if($child.showSummary)
  511. #set($childSummary=true)
  512. #set($summaryField = '[]')
  513. #if(${child.summaryField})
  514. #set($summaryField = ${child.summaryField})
  515. #end
  516. <a-collapse-panel key="summary" v-if="dataForm.${aliasname}List?.length">
  517. <template #header>
  518. <span class="min-h-22px inline-block">{{ t('component.table.summary') }}</span>
  519. </template>
  520. <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
  521. <template v-for="(column, cIndex) in ${aliasname}Columns" :key="column.key">
  522. <a-col :span="column.span" class="ant-col-item" v-if='${summaryField}.includes(column.key)'>
  523. <a-form-item #if(${context.labelPosition}!="top") :labelCol="{ style: { width: (column.labelWidth||'${context.labelWidth}')+'px' } }"#end>
  524. <template #label>{{column.title}}<BasicHelp v-if="column.title && column.tipLabel" :text="column.tipLabel" /></template>
  525. <JnpfInput :value="get${aliasName}ColumnSum[cIndex]" disabled :style="column.style" />
  526. </a-form-item>
  527. </a-col>
  528. </template>
  529. </a-row>
  530. </a-collapse-panel>
  531. #end
  532. </a-collapse>
  533. #if($child.footerBtnsList.size()>0)
  534. #if($child.footerBtnsList.size()>2)#set($isSelectDialog = true) #end
  535. <a-space class="input-table-footer-btn" #if($context.isFlow) v-if="!judgeWrite('${aliasname}List')" #end>
  536. #foreach($footerBtn in ${child.footerBtnsList})
  537. #set($btnName="openSelectDialog('${child.aliasLowName}List','$!{footerBtn.value}')")
  538. #if($footerBtn.value =="add")
  539. #set($btnName="add${aliasName}Row")
  540. #end
  541. #if($footerBtn.show && $footerBtn.value !="batchRemove" && $footerBtn.actionType!=2)
  542. <a-button type =#if(${footerBtn.btnType} == 'text')'link'#else'${footerBtn.btnType}'#end preIcon="${footerBtn.btnIcon}"
  543. @click="$btnName">#if(${footerBtn.labelI18nCode}) {{t('${footerBtn.labelI18nCode}','${footerBtn.label}')}} #else ${footerBtn.label}#end</a-button>
  544. #end
  545. #end
  546. </a-space>
  547. #end
  548. </a-collapse-panel>
  549. </a-collapse>
  550. </div>
  551. #else
  552. ## 子表表格
  553. <a-form-item>
  554. #if($child.showTitle== true)
  555. <JnpfGroupTitle #if(${child.labelI18nCode}) :content="t('${child.labelI18nCode}', '${child.label}')" #else content="${child.label}" #end :bordered="false"
  556. #if(${child.tipLabelI18nCode}) :helpMessage="t('${child.tipLabelI18nCode}', '${child.tipLabel}')" #else helpMessage="${child.tipLabel}" #end />
  557. #end
  558. <a-table :data-source="dataForm.${aliasname}List" #if(${child.complexHeaderList.size()}>0) :bordered="true" #end
  559. :columns="${aliasname}Columns" size="small" :pagination="false" :scroll="{ x: 'max-content' }"
  560. :rowSelection="get${aliasname}RowSelection" rowKey="jnpfId">
  561. <template #headerCell="{ column }">
  562. <span class="required-sign" v-if="column.required">*</span>
  563. {{ column.title }}
  564. <BasicHelp :text="column.tipLabel" v-if="column.tipLabel && column.title" />
  565. </template>
  566. ## 子表字段
  567. <template #bodyCell="{ column, index, record }">
  568. <template v-if="column.key === 'index'">{{ index + 1 }}</template>
  569. #foreach($itemModel in ${child.childList})
  570. #set($fieLdsModel = ${itemModel.fieLdsModel})
  571. #set($config = ${fieLdsModel.config})
  572. #set($mastKey = "${config.jnpfKey}")
  573. #set($beforeVmodel ="${aliasname}${fieLdsModel.vModel}")
  574. #set($mastModel="record.${fieLdsModel.vModel}")
  575. #set($startTime=${fieLdsModel.startTime})
  576. #set($endTime=${fieLdsModel.endTime})
  577. #if(${mastKey}=='datePicker'||${mastKey}=='timePicker')
  578. #GetStartAndEndTime($mastKey,$config,$fieLdsModel,$startTime,$endTime)
  579. #end
  580. #if(${mastKey}!='calculate')
  581. <template v-if="column.key === #if($!{fieLdsModel.vModel}) '${fieLdsModel.vModel}' #else '${config.formId}' #end">
  582. ## 子表标签生成
  583. #CreateFieldTag($mastKey,$fieLdsModel,$config,$mastModel,$beforeVmodel,'index',true)
  584. </template>
  585. #end
  586. #end
  587. ## 判断子表行内有几个按键---底下生成子表字段信息时也要使用这个变量
  588. #set($hasLineBtnNum = 0)
  589. #foreach($item in $child.columnBtnsList)
  590. #if($item.show)
  591. #set($hasLineBtnNum = ${hasLineBtnNum} + 50)
  592. #end
  593. #end
  594. ## 子表行操作按键生成
  595. #if($hasLineBtnNum>0)
  596. <template v-if="column.key === 'action'">
  597. <a-space>
  598. #foreach($item in $child.columnBtnsList)
  599. #if(${item.value} == "copy" && ${item.show})
  600. <a-button class="action-btn" type="link" @click="copy${aliasName}Row(index)" size="small">#if(${item.labelI18nCode})
  601. {{t('${item.labelI18nCode}', '${item.label}')}} #else ${item.label} #end</a-button>
  602. #end
  603. #if(${item.value} == "remove" && ${item.show})
  604. <a-button class="action-btn" type="link" color="error" @click="remove${aliasName}Row(index,${item.showConfirm})" size="small">#if(${item.labelI18nCode})
  605. {{t('${item.labelI18nCode}', '${item.label}')}} #else ${item.label} #end</a-button>
  606. #end
  607. #end
  608. </a-space>
  609. </template>
  610. #end
  611. </template>
  612. ## 子表合计
  613. #if($child.showSummary)
  614. #set($childSummary=true)
  615. <template #summary v-if="dataForm.${aliasname}List?.length">
  616. <a-table-summary fixed>
  617. <a-table-summary-row>
  618. <a-table-summary-cell :index="0">{{ t('component.table.summary') }}</a-table-summary-cell>
  619. <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>
  620. <a-table-summary-cell #if($context.isFlow) v-if="!judgeWrite('${aliasname}List')"#end :index="get${aliasName}ColumnSum.length + 1"></a-table-summary-cell>
  621. </a-table-summary-row>
  622. </a-table-summary>
  623. </template>
  624. #end
  625. </a-table>
  626. #if($child.footerBtnsList.size()>0)
  627. #if($child.footerBtnsList.size()>2)#set($isSelectDialog = true) #end
  628. <a-space class="input-table-footer-btn" #if($context.isFlow) v-if="!judgeWrite('${aliasname}List')" #end>
  629. #foreach($footerBtn in ${child.footerBtnsList})
  630. #set($btnName="openSelectDialog('${child.aliasLowName}List','$!{footerBtn.value}')")
  631. #if($footerBtn.value =="add")
  632. #set($btnName="add${aliasName}Row")
  633. #elseif($footerBtn.value =="batchRemove")
  634. #set($btnName="batchRemove${aliasName}Row($!{footerBtn.showConfirm})")
  635. #end
  636. #if($footerBtn.show && $footerBtn.actionType!=2)
  637. <a-button type =#if(${footerBtn.btnType} == 'text')'link'#else'${footerBtn.btnType}'#end preIcon="${footerBtn.btnIcon}"
  638. @click="$btnName">#if(${footerBtn.labelI18nCode}) {{t('${footerBtn.labelI18nCode}','${footerBtn.label}')}} #else ${footerBtn.label} #end</a-button>
  639. #end
  640. #end
  641. </a-space>
  642. #end
  643. </a-form-item>
  644. #end
  645. </a-col>
  646. #end
  647. ## 子表字段对象列表生成
  648. #macro(GetChildTableColumns)
  649. ## 子表列表字段属性
  650. #foreach($itemModel in ${context.children})
  651. #set($itemChildHasBatch = false)
  652. #foreach($itemBtn in ${itemModel.footerBtnsList})
  653. #if(${itemBtn.value} == 'batchRemove')
  654. #set($itemChildHasBatch = true)
  655. #end
  656. #end
  657. const ${itemModel.aliasLowName}Columns: any[] = computed(() => {
  658. let list = [
  659. #set($childList = ${itemModel.childList})
  660. #foreach($html in ${childList})
  661. #set($fieLdsModel = ${html.fieLdsModel})
  662. #set($config = ${fieLdsModel.config})
  663. #if(($context.isFlow || !${config.noShow}) && ${config.jnpfKey}!='calculate')
  664. {
  665. title: #if(${config.labelI18nCode}) t('${config.labelI18nCode}','${config.label}') #else '${config.label}' #end,
  666. dataIndex: #if($!{fieLdsModel.vModel}) '${fieLdsModel.vModel}' #else '${config.formId}' #end,
  667. key: #if($!{fieLdsModel.vModel}) '${fieLdsModel.vModel}' #else '${config.formId}' #end,
  668. #if($!{config.columnWidth})
  669. width: $!{config.columnWidth},
  670. #end
  671. labelWidth:#if($!{config.labelWidth})'$!{config.labelWidth}' #else '' #end,
  672. span:'$!{config.span}',
  673. tipLabel: #if($!{config.tipLabel}|| ${config.tipLabelI18nCode})#if(${config.tipLabelI18nCode}) t('${config.tipLabelI18nCode}','${config.tipLabel}') #else '${config.tipLabel}' #end #else '' #end,
  674. #set($vModelRequired="#if($!{fieLdsModel.vModel})${itemModel.aliasLowName}List-${fieLdsModel.vModel}#else${itemModel.aliasLowName}List-${config.formId}#end")
  675. required: #if($context.isFlow)judgeRequired('$vModelRequired'), #else ${config.required},#end
  676. #if($!{fieLdsModel.thousands}==true)
  677. thousands: ${fieLdsModel.thousands},
  678. #end
  679. style: #if(${fieLdsModel.style})${fieLdsModel.style} #else ''#end,
  680. align: #if($!{config.tableAlign}) '$!{config.tableAlign}'#else 'left'#end ,
  681. fixed: #if($!{config.tableFixed} == 'left' || $!{config.tableFixed} == 'right') '$!{config.tableFixed}' #else false #end,
  682. formP: #if($!{fieLdsModel.vModel}) '${fieLdsModel.vModel}' #else '${fieLdsModel.relationField}' #end,
  683. },
  684. #end
  685. #end
  686. ];
  687. ##子表行内按键操作字段判断是否生成。及其宽度
  688. #if($context.isFlow)
  689. list = list.filter(o => judgeShow('${itemModel.aliasLowName}List-' + o.formP));
  690. #if($hasLineBtnNum>0)
  691. if (!judgeWrite('${itemModel.aliasLowName}List')) {
  692. list.push({ title: t('component.table.action'), showLabel: true, dataIndex: 'action', key: 'action', align: 'center', fixed: 'right', width: $hasLineBtnNum });
  693. }
  694. #end
  695. #else
  696. #if(${context.columnData.useFormPermission})list = list.filter(o => hasFormP('${itemModel.tableModel}-' + o.formP)); #end
  697. #if($hasLineBtnNum>0)list.push({ title: t('component.table.action'), showLabel: true, dataIndex: 'action', key: 'action', align: 'center', fixed: 'right', width: $hasLineBtnNum });#end
  698. #end
  699. ## 表格子表和平铺子表代码区别
  700. #if($!{itemModel.layoutType} == 'list')
  701. return list;
  702. #else
  703. const indexColumn = { title: t('component.table.index'), showLabel: true, dataIndex: 'index', key: 'index', align: 'center', fixed: 'left', width: 50 };
  704. //子表复杂表头-处理
  705. let columnList = list;
  706. let complexHeaderList: any[] = #if(${itemModel.complexHeaderList}) ${itemModel.complexHeaderList}; #else []; #end
  707. if (complexHeaderList.length) {
  708. let childColumns: any[] = [];
  709. let firstChildColumns: string[] = [];
  710. for (let i = 0; i < complexHeaderList.length; i++) {
  711. const e = complexHeaderList[i];
  712. e.title = e.fullNameI18nCode ? t(e.fullNameI18nCode,e.fullName) : e.fullName;
  713. e.align = e.align;
  714. e.children = [];
  715. e.jnpfKey = 'complexHeader';
  716. if (e.childColumns?.length) {
  717. childColumns.push(...e.childColumns);
  718. for (let k = 0; k < e.childColumns.length; k++) {
  719. const item = e.childColumns[k];
  720. for (let j = 0; j < list.length; j++) {
  721. const o = list[j];
  722. if (o.key == item && o.fixed !== 'left' && o.fixed !== 'right') e.children.push({ ...o });
  723. }
  724. }
  725. }
  726. if (e.children.length) firstChildColumns.push(e.children[0].key);
  727. }
  728. complexHeaderList = complexHeaderList.filter(o => o.children.length);
  729. let newList: any[] = [];
  730. for (let i = 0; i < list.length; i++) {
  731. const e = list[i];
  732. if (!childColumns.includes(e.key) || e.fixed === 'left' || e.fixed === 'right') {
  733. newList.push(e);
  734. } else {
  735. if (firstChildColumns.includes(e.key)) {
  736. const item = complexHeaderList.find(o => o.childColumns.includes(e.key));
  737. newList.push(item);
  738. }
  739. }
  740. }
  741. columnList = newList;
  742. }
  743. let columns = [indexColumn, ...columnList]
  744. const leftFixedList = columns.filter(o => o.fixed === 'left');
  745. const rightFixedList = columns.filter(o => o.fixed === 'right');
  746. const noFixedList = columns.filter(o => o.fixed !== 'left' && o.fixed !== 'right');
  747. return [...leftFixedList, ...noFixedList, ...rightFixedList];
  748. #end
  749. });
  750. ## 子表选择框是否展示
  751. const get${itemModel.aliasLowName}HasBatchBtn = computed(() =>{
  752. let flist:any[] = #if(${itemModel.footerBtnsList})${itemModel.footerBtnsList}#else [] #end
  753. return flist?.length && flist.some(o => o.value == 'batchRemove' && !!o.show)
  754. });
  755. const get${itemModel.aliasLowName}RowSelection = computed(() => {
  756. if (!unref(get${itemModel.aliasLowName}HasBatchBtn )) return undefined;
  757. const rowSelection = {
  758. selectedRowKeys: state.selected${itemModel.aliasLowName}RowKeys,
  759. onChange: (selectedRowKeys: string[]) => {
  760. state.selected${itemModel.aliasLowName}RowKeys = selectedRowKeys;
  761. },
  762. };
  763. return rowSelection;
  764. });
  765. ## 子表合计参数
  766. #if($itemModel.showSummary)
  767. //子表合计字段
  768. const ${itemModel.aliasLowName}SummaryColumn = computed(() => {
  769. let defaultColumns = unref(${itemModel.aliasLowName}Columns);//子表字段
  770. let columns: any[] = [];
  771. for (let i = 0; i < defaultColumns.length; i++) {
  772. const e = defaultColumns[i];
  773. if (e.jnpfKey === 'table' || e.jnpfKey === 'complexHeader') {
  774. if (e.children?.length) columns.push(...e.children);
  775. } else {
  776. columns.push(e);
  777. }
  778. if (e.fixed && e.children?.length) {
  779. for (let j = 0; j < e.children.length; j++) {
  780. e.children[j].fixed = e.fixed;
  781. }
  782. }
  783. }
  784. return columns.filter(o => o?.key != 'index' && o?.key != 'action');
  785. });
  786. //合计方法
  787. const get${itemModel.aliasUpName}ColumnSum = computed(() => {
  788. const sums: any[] = [];
  789. const summaryField: any[] = #if(${itemModel.summaryField}) ${itemModel.summaryField} #else [] #end;
  790. const useThousands = key => unref(${itemModel.aliasLowName}SummaryColumn).some(o => o.key === key && o.thousands);
  791. const isSummary = key => summaryField.includes(key);
  792. const list = unref(${itemModel.aliasLowName}SummaryColumn).filter(o => o.key !== 'index' && o.key !== 'action');
  793. list.forEach((column, index) => {
  794. let sumVal = state.dataForm.${itemModel.aliasLowName}List.reduce((sum, d) => sum + Number(getCmpValOfRow(d, column.key, summaryField || [])), 0);
  795. if (!isSummary(column.key)) sumVal = '';
  796. sumVal = Number.isNaN(sumVal) ? '' : sumVal;
  797. const realVal = sumVal && !Number.isInteger(Number(sumVal)) ? Number(sumVal).toFixed(2) : sumVal;
  798. sums[index] = useThousands(column.key) ? thousandsFormat(realVal) : realVal.toString();
  799. });
  800. #if($!{itemModel.layoutType} != 'list')
  801. if (unref(get${itemModel.aliasLowName}HasBatchBtn )) sums.unshift('');
  802. #end
  803. return sums;
  804. });
  805. //合计对齐
  806. function get${itemModel.aliasUpName}SummaryCellAlign(index) {
  807. if (!unref(${itemModel.aliasLowName}SummaryColumn).length) return;
  808. if ($itemChildHasBatch) index--;
  809. return unref(${itemModel.aliasLowName}SummaryColumn)[index]?.align || 'left';
  810. }
  811. #end
  812. #end
  813. #end
  814. ## 子表方法生成
  815. #macro(CreateChildTableMethod)
  816. #foreach($itemModel in ${context.children})
  817. #set($aliasname =$!{itemModel.aliasLowName})
  818. #set($aliasName =$!{itemModel.aliasUpName})
  819. #set($childList = ${itemModel.childList})
  820. ## 子表非弹窗生成添加方法
  821. function add${aliasName}Row(){
  822. let item = {
  823. #foreach($html in $childList)
  824. #set($fieLdsModel = ${html.fieLdsModel})
  825. #set($vModel = "${html.fieLdsModel.vModel}")
  826. #set($config = ${html.fieLdsModel.config})
  827. #set($jk = $html.fieLdsModel.config.jnpfKey)
  828. #set($dataType = "$!{config.dataType}")
  829. #set($defaultCurrent = $html.fieLdsModel.config.defaultCurrent)
  830. #set($defult = $html.fieLdsModel.config.defaultValue)
  831. #set($format = $html.fieLdsModel.format)
  832. #if($vModel)
  833. #GetFeildDefaultValue($!{aliasname})
  834. #end
  835. #end
  836. jnpfId: buildUUID(),
  837. }
  838. state.dataForm.${aliasname}List.push(item)
  839. state.childIndex=state.dataForm.${aliasname}List.length-1
  840. #foreach($childList in$childList)
  841. #set($fieLdsModel = $childList.fieLdsModel)
  842. #set($vModel = "${fieLdsModel.vModel}")
  843. #set($field = "${fieLdsModel.vModel}")
  844. #set($config = ${fieLdsModel.config})
  845. #set($dataType = "$!{config.dataType}")
  846. #if(${dataType}=='dynamic')
  847. get${aliasname}${vModel}Options()
  848. #end
  849. #end
  850. state.childIndex = -1
  851. #if($!{itemModel.layoutType} == 'list' && $!{itemModel.defaultExpandAll} )
  852. state.${aliasname}innerActiveKey.push(item.jnpfId);
  853. #end
  854. }
  855. function remove${aliasName}Row(index,showConfirm=false){
  856. if(showConfirm){
  857. createConfirm({
  858. iconType: 'warning',
  859. title: '提示',
  860. content: '此操作将永久删除该数据, 是否继续?',
  861. onOk: () => {
  862. state.dataForm.${aliasname}List.splice(index, 1);
  863. },
  864. });
  865. }else{
  866. state.dataForm.${aliasname}List.splice(index, 1);
  867. }
  868. }
  869. function copy${aliasName}Row(index){
  870. let item = cloneDeep(state.dataForm.${aliasname}List[index]);
  871. ## 系统控件置空
  872. #foreach($html in $childList)
  873. #set($fieLdsModel = ${html.fieLdsModel})
  874. #set($vModel = "${html.fieLdsModel.vModel}")
  875. #set($config = ${html.fieLdsModel.config})
  876. #set($jk = $html.fieLdsModel.config.jnpfKey)
  877. #set($dataType = "$!{config.dataType}")
  878. #set($defaultCurrent = $html.fieLdsModel.config.defaultCurrent)
  879. #set($defult = $html.fieLdsModel.config.defaultValue)
  880. #set($format = $html.fieLdsModel.format)
  881. #if($vModel)
  882. #if(${systemJnpfKey.contains(${jk})})
  883. item.${vModel} = '';
  884. #end
  885. #end
  886. #end
  887. let copyData = {};
  888. for (let i = 0; i < unref(${aliasname}Columns).length; i++) {
  889. const cur = unref(${aliasname}Columns)[i];
  890. if (cur.key != 'index' && cur.key != 'action') {
  891. if (cur.children?.length && cur.jnpfKey == 'complexHeader') {
  892. for (let j = 0; j < cur.children.length; j++) {
  893. copyData[cur.children[j].key] = item[cur.children[j].key];
  894. }
  895. } else {
  896. copyData[cur.key] = item[cur.key];
  897. }
  898. }
  899. }
  900. const copyItem = { ...copyData, jnpfId: buildUUID() };
  901. state.dataForm.${aliasname}List.push(copyItem);
  902. #if($!{itemModel.layoutType} == 'list' && $!{itemModel.defaultExpandAll} )
  903. state.${aliasname}innerActiveKey.push(copyItem.jnpfId);
  904. #end
  905. state.childIndex=state.dataForm.${aliasname}List.length-1
  906. #foreach($childList in$childList)
  907. #set($fieLdsModel = $childList.fieLdsModel)
  908. #set($vModel = "${fieLdsModel.vModel}")
  909. #set($field = "${fieLdsModel.vModel}")
  910. #set($config = ${fieLdsModel.config})
  911. #set($dataType = "$!{config.dataType}")
  912. #if(${dataType}=='dynamic')
  913. get${aliasname}${vModel}Options()
  914. #end
  915. #end
  916. state.childIndex = -1
  917. }
  918. function batchRemove${aliasName}Row(showConfirm=false){
  919. if (!state.selected${aliasname}RowKeys.length) return createMessage.error('请选择一条数据');
  920. const handleRemove = ()=>{
  921. state.dataForm.${aliasname}List = state.dataForm.${aliasname}List.filter(
  922. o => !state.selected${aliasname}RowKeys.includes(o.jnpfId),
  923. );
  924. nextTick(() => {
  925. state.selected${aliasname}RowKeys = [];
  926. });
  927. }
  928. if(showConfirm){
  929. createConfirm({
  930. iconType: 'warning',
  931. title: '提示',
  932. content: '此操作将永久删除该数据, 是否继续?',
  933. onOk: ()=>{
  934. handleRemove()
  935. },
  936. });
  937. }else{
  938. handleRemove()
  939. }
  940. }
  941. ## 非流程的子表必填验证方法
  942. #if(!$context.isFlow)
  943. function ${aliasname}Exist(){
  944. let isOk = true;
  945. for(let i=0;i<state.dataForm.${aliasname}List.length;i++){
  946. const e = state.dataForm.${aliasname}List[i];
  947. #foreach($childListAll in ${itemModel.childList})
  948. #set($html = $childListAll.fieLdsModel)
  949. #set($model = "${html.vModel}")
  950. #set($config = ${html.config})
  951. #set($jnpfKey = "${config.jnpfKey}")
  952. #set($takeEnd = true)
  953. #set($req = $config.required)
  954. #set($regular = ${config.regList})
  955. #if($multipleUnit.contains($mastKey))
  956. #set($messages="t('sys.validate.arrayRequiredPrefix ','请至少选择一个')")
  957. #else
  958. #set($messages="t('sys.validate.textRequiredSuffix','不能为空')")
  959. #end
  960. #if(${model} && ${req}==true && !${DonotJudgeNull.contains(${jnpfKey})})
  961. #if(${jnpfKey}=='cascader'||${jnpfKey}=='checkbox' || ${jnpfKey}=='areaSelect'|| ${jnpfKey} == 'organizeSelect' ||
  962. ${jnpfKey}=='uploadImg'||${jnpfKey}=='uploadFile' || ${jnpfKey}=='timeRange' || ${jnpfKey}=='dateRange')
  963. if (!e.${model} || !e.${model}.length) {
  964. #elseif(${jnpfKey}=='select' || ${jnpfKey}=='userSelect'|| ${jnpfKey}=='depSelect' || ${jnpfKey}=='posSelect' ||
  965. ${jnpfKey}=='treeSelect'|| ${jnpfKey}=='roleSelect'|| ${control}=='groupSelect'|| ${control}=='popupTableSelect')
  966. #if(${html.multiple}=='true')
  967. if (!e.${model} || !e.${model}.length) {
  968. #else
  969. if (!e.${model}) {
  970. #end
  971. #elseif(${control}!='switch')
  972. if (!e.${model}) {
  973. #else
  974. #set($takeEnd = false)
  975. #end
  976. createMessage.error(#if(${config.labelI18nCode}) t('${config.labelI18nCode}','${config.label}') #else '${config.label}' #end + $messages);
  977. isOk = false;
  978. break;
  979. #if($takeEnd == true)
  980. }
  981. #end
  982. #end
  983. #if(${model} && ${regular})
  984. if (e.${model}) {
  985. var regPos = ${regular}
  986. for (let i = 0; i < regPos.length; i++) {
  987. const element = regPos[i];
  988. if (element.pattern && !eval(element.pattern).test(e.${model})) {
  989. let msg = element.messageI18nCode ? t(element.messageI18nCode,element.message) : element.message;
  990. createMessage.error(msg);
  991. isOk = false;
  992. break;
  993. }
  994. }
  995. }
  996. #end
  997. #end
  998. }
  999. return isOk;
  1000. }
  1001. #end
  1002. ## 平铺布局时设置默认展开
  1003. #if(${itemModel.layoutType} == 'list')
  1004. // 平铺布局时设置默认展开
  1005. function set${aliasname}ActiveKey() {
  1006. state.${aliasname}outerActiveKey = [0];
  1007. state.${aliasname}innerActiveKey = [];
  1008. #if(${itemModel.defaultExpandAll})
  1009. state.${aliasname}innerActiveKey = ['summary'];
  1010. if (!state.dataForm.${aliasname}List.length) return;
  1011. for (let i = 0; i < state.dataForm.${aliasname}List.length; i++) {
  1012. state.${aliasname}innerActiveKey.push(state.dataForm.${aliasname}List[i].jnpfId);
  1013. }
  1014. #end
  1015. }
  1016. #end
  1017. #end
  1018. #end
  1019. ## dataform属性生成
  1020. #macro(CreateDataform)
  1021. #foreach($fieLdsModel in ${context.fields})
  1022. #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
  1023. #set($fieLdsModel =$fieLdsModel.formColumnModel.fieLdsModel)
  1024. #set($vModel = "${html.vModel}")
  1025. #if($vModel !='')
  1026. #set($config = $html.config)
  1027. #set($jk = $html.config.jnpfKey)
  1028. #set($dataType = "$!{config.dataType}")
  1029. #set($defaultCurrent = $config.defaultCurrent)
  1030. #set($defult = $config.defaultValue)
  1031. #set($format = $html.format)
  1032. #if($jk!='text' && $jk!='divider')
  1033. #GetFeildDefaultValue("")
  1034. #end
  1035. #end
  1036. #end
  1037. #foreach($mast in ${context.mastTable})
  1038. #set($mastField = $mast.formMastTableModel.mastTable.fieLdsModel)
  1039. #set($fieLdsModel = $mast.formMastTableModel.mastTable.fieLdsModel)
  1040. #set($config =$mastField.config)
  1041. #set($jk = ${config.jnpfKey})
  1042. #set($vModel = ${mast.formMastTableModel.vModel})
  1043. #set($dataType = "$!{config.dataType}")
  1044. #set($defaultCurrent = $config.defaultCurrent)
  1045. #set($defult = $config.defaultValue)
  1046. #set($format = $mastField.format)
  1047. #if($jk!='text' && $jk!='divider')
  1048. #GetFeildDefaultValue("")
  1049. #end
  1050. #end
  1051. #foreach($child in ${context.children})
  1052. #set($aliasname = "")
  1053. #foreach($children in ${context.children})
  1054. #if(${children.tableModel}==${child.tableModel})
  1055. #set($aliasname = "${children.aliasLowName}")
  1056. #end
  1057. #end
  1058. ${aliasname}List:[],
  1059. #end
  1060. #if($context.version)
  1061. version: 0,
  1062. #end
  1063. #end
  1064. ## 字段-默认值取值方法
  1065. #macro(GetFeildDefaultValue $aliasLowName)
  1066. #set($multiple=${fieLdsModel.multiple})
  1067. #set($selectType=${fieLdsModel.selectType})
  1068. #if(${jk}=='datePicker' && ${defaultCurrent} == true)
  1069. ${vModel}:dayjs().startOf(getDateTimeUnit('${format}')).valueOf(),
  1070. #elseif($jk=='timePicker')
  1071. #if(${defaultCurrent} == true)
  1072. ${vModel}:dayjs().format('${format}'),
  1073. #else
  1074. ${vModel}:'$!{defult}',
  1075. #end
  1076. #elseif(${jk}=='areaSelect' && ${defult} =='[]')
  1077. ${vModel}:[],
  1078. #elseif(${jk}=='depSelect' && ${defaultCurrent} == true)
  1079. #if($multiple == true)
  1080. ${vModel}: userInfo.departmentId?[userInfo.departmentId]:[],
  1081. #else
  1082. ${vModel}: userInfo.departmentId?userInfo.departmentId:'',
  1083. #end
  1084. #elseif(${jk}=='organizeSelect' && ${defaultCurrent} == true)
  1085. #if($multiple == true)
  1086. ${vModel}: userInfo.organizeIdList?[userInfo.organizeIdList]:[],
  1087. #else
  1088. ${vModel}: userInfo.organizeIdList?userInfo.organizeIdList:'',
  1089. #end
  1090. #elseif((${jk}=='userSelect' || ${jk}=='usersSelect') && ${defaultCurrent} == true)
  1091. #if($multiple == true)
  1092. ${vModel}: userInfo.userId?[userInfo.userId]:[],
  1093. #else
  1094. ${vModel}: userInfo.userId?userInfo.userId:'',
  1095. #end
  1096. #elseif(${jk}=='posSelect' && ${defaultCurrent} == true)
  1097. #if($multiple == true)
  1098. ${vModel}: userInfo.positionIds.length?userInfo.positionIds.map(o => o.id):[],
  1099. #else
  1100. ${vModel}: userInfo.positionIds.length?userInfo.positionIds[0].id:'',
  1101. #end
  1102. #elseif(${jk}=='roleSelect' && ${defaultCurrent} == true)
  1103. #if($multiple == true)
  1104. ${vModel}: userInfo.roleIds.length?userInfo.roleIds:[],
  1105. #else
  1106. ${vModel}: userInfo.roleIds.length?userInfo.roleIds[0]:'',
  1107. #end
  1108. #elseif(${jk}=='groupSelect' && ${defaultCurrent} == true)
  1109. #if($multiple == true)
  1110. ${vModel}: userInfo.groupIds.length?userInfo.groupIds:[],
  1111. #else
  1112. ${vModel}: userInfo.groupIds.length?userInfo.groupIds[0]:'',
  1113. #end
  1114. #elseif(${jk}=='sign' && ${defaultCurrent} == true)
  1115. ${vModel}: userInfo.signImg?userInfo.signImg: #if(${defult}) ${defult} #else '' #end,
  1116. #elseif(${defult} == "")
  1117. ${vModel}:'',
  1118. #elseif(${defult} =='[]')
  1119. ${vModel}:[],
  1120. #elseif(${defult} || ${defult}=='0')
  1121. #if(${jk}=='input' || ${jk}=='colorPicker'|| ${jk}=='editor'|| ${jk}=='radio'|| ${jk}=='textarea'
  1122. || ${jk}=='popupAttr' || ${jk}=='relationForm' || ${jk}=='relationFormAttr' || ${jk}=='sign'
  1123. || ${jk}=='autoComplete' || ${jk}=='location')
  1124. ${vModel}:'$!{defult}',
  1125. #elseif($multiple == false && $multipleUnit.contains(${jk}) && ${jk}!='checkbox' && ${jk}!='areaSelect' && ${jk}!='cascader')
  1126. ${vModel}:'${defult}',
  1127. #else
  1128. ${vModel}:${defult},
  1129. #end
  1130. #else
  1131. ${vModel}:undefined,
  1132. #end
  1133. #if(${dataType}=='dynamic' && $!{aliasLowName})
  1134. $!{aliasLowName}${vModel}Options:[],
  1135. #elseif((${dataType}=='static' || ${dataType}=='dictionary') && $!{aliasLowName})
  1136. $!{aliasLowName}${vModel}Options:state.optionsObj.$!{aliasLowName}${vModel}Options,
  1137. #end
  1138. #end
  1139. ## 生成表单参数 -interface State 值any const state 值类型
  1140. #macro(createStateParam $any)
  1141. dataForm: #if($any) $any; #else
  1142. {
  1143. #CreateDataform()
  1144. },
  1145. #end
  1146. tableRows:#if($any) $any; #else
  1147. {
  1148. #foreach($child in ${context.children})
  1149. #set($aliasname = "")
  1150. #foreach($children in ${context.children})
  1151. #if(${children.tableModel}==${child.tableModel})
  1152. #set($aliasname = "${children.aliasLowName}")
  1153. #end
  1154. #end
  1155. ${aliasname}List:{
  1156. #foreach($childListAll in ${child.childList})
  1157. #set($html = $childListAll.fieLdsModel)
  1158. #set($model = "${html.vModel}")
  1159. #set($config = ${html.config})
  1160. #set($jnpfKey = "${config.jnpfKey}")
  1161. #if($model)
  1162. #if(${jnpfKey}=='cascader'||${jnpfKey}=='checkbox' || ${jnpfKey}=='areaSelect')
  1163. ${model} : [],
  1164. #elseif(${jnpfKey}=='select' || ${jnpfKey}=='userSelect' || ${jnpfKey}=='depSelect' || ${jnpfKey}=='posSelect' || ${jnpfKey}=='treeSelect')
  1165. #if(${html.multiple}=='true')
  1166. ${model} : [],
  1167. #else
  1168. ${model} : '',
  1169. #end
  1170. #elseif(${jnpfKey} == 'organizeSelect')
  1171. ${model} : [],
  1172. #elseif(${jnpfKey}=='uploadImg'||${jnpfKey}=='uploadFile' || ${jnpfKey}=='timeRange' || ${jnpfKey}=='dateRange')
  1173. ${model} : [],
  1174. #elseif(${jnpfKey}=='switch'||${jnpfKey}=='slider'||${jnpfKey}=='rate')
  1175. ${model} : 0,
  1176. #elseif(${jnpfKey}=='inputNumber'||${jnpfKey}=='calculate')
  1177. ${model} : undefined,
  1178. #else
  1179. ${model} : '',
  1180. #end
  1181. #end
  1182. #end
  1183. enabledmark:undefined
  1184. },
  1185. #end
  1186. },
  1187. #end
  1188. dataRule: #if($any) $any; #else
  1189. {
  1190. #foreach($fieLdsModel in ${context.fields})
  1191. #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
  1192. #set($vModel = "${html.vModel}")
  1193. #set($config = $html.config)
  1194. #set($mastKey = "${config.jnpfKey}")
  1195. #set($listSize=$!{config.regList})
  1196. #set($defaultValue=${config.defaultValue})
  1197. #set($defaultValueSize=$!{config.defaultValue})
  1198. #set($trigger = ${config.trigger})
  1199. #if(${trigger.substring(0,1)}!='[')
  1200. #set($trigger = "'"+ ${config.trigger}+ "'")
  1201. #end
  1202. #if($mastKey!='text' && $mastKey!='divider')
  1203. #if($multipleUnit.contains($mastKey))
  1204. #set($messages="t('sys.validate.arrayRequiredPrefix ','请至少选择一个')")
  1205. #else
  1206. #set($messages="t('sys.validate.textRequiredSuffix','不能为空')")
  1207. #end
  1208. #if($config.required==true || (${listSize} && $listSize.size()>0))
  1209. ${vModel}: [
  1210. #if($config.required==true)
  1211. {
  1212. required: true,
  1213. message: $!{messages},
  1214. trigger: ${trigger}
  1215. },
  1216. #end
  1217. #if($listSize.size()>0)
  1218. #foreach($regList in ${config.regList})
  1219. {
  1220. pattern: ${regList.pattern},
  1221. message: #if(${regList.messageI18nCode}) t('${regList.messageI18nCode}','${regList.message}'), #else '${regList.message}',#end
  1222. trigger: ${trigger}
  1223. },
  1224. #end
  1225. #end
  1226. ],
  1227. #end
  1228. #end
  1229. #end
  1230. #foreach($ChildField in ${context.columnChildren})
  1231. #foreach($FormMastTableModel in ${ChildField.fieLdsModelList})
  1232. #set($html = ${FormMastTableModel.mastTable.fieLdsModel})
  1233. #set($vModel = "${html.vModel}")
  1234. #set($config = $html.config)
  1235. #set($mastKey = "${config.jnpfKey}")
  1236. #set($listSize=$!{config.regList})
  1237. #set($defaultValue=${config.defaultValue})
  1238. #set($defaultValueSize=$!{config.defaultValue})
  1239. #set($trigger = ${config.trigger})
  1240. #if(${trigger.substring(0,1)}!='[')
  1241. #set($trigger = "'"+ ${config.trigger}+ "'")
  1242. #end
  1243. #if($mastKey!='text' && $mastKey!='divider' && $mastKey!='switch')
  1244. #if($multipleUnit.contains($mastKey))
  1245. #set($messages="t('sys.validate.arrayRequiredPrefix ','请至少选择一个')")
  1246. #else
  1247. #set($messages="t('sys.validate.textRequiredSuffix','不能为空')")
  1248. #end
  1249. #if($config.required==true|| (${listSize} && $listSize.size()>0))
  1250. ${FormMastTableModel.vModel}: [
  1251. #if($config.required==true)
  1252. {
  1253. required: true,
  1254. message: $!{messages},
  1255. trigger: ${trigger}
  1256. },
  1257. #end
  1258. #if($listSize.size()>0)
  1259. #foreach($regList in ${config.regList})
  1260. {
  1261. pattern: ${regList.pattern},
  1262. message: #if(${regList.messageI18nCode}) t('${regList.messageI18nCode}','${regList.message}'), #else '${regList.message}',#end
  1263. trigger: ${trigger}
  1264. },
  1265. #end
  1266. #end
  1267. ],
  1268. #end
  1269. #end
  1270. #end
  1271. #end
  1272. },
  1273. #end
  1274. optionsObj:#if($any) $any; #else
  1275. {
  1276. #foreach($fieLdsModel in ${context.fields})
  1277. #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
  1278. #set($vModel = "${html.vModel}")
  1279. #set($config = $html.config)
  1280. #set($jnpfkey = $config.jnpfKey)
  1281. #if($!{config.dataType}=='dictionary'||$!{config.dataType}=='dynamic')
  1282. ${vModel}Options:[],
  1283. #elseif($!{config.dataType} == "static")
  1284. #if($html.slot.options)
  1285. ${vModel}Options:${html.slot.options},
  1286. #elseif($html.options)
  1287. ${vModel}Options:${html.options},
  1288. #end
  1289. #end
  1290. #if($jnpfkey == "relationForm" || $jnpfkey == "popupSelect" || $jnpfkey== "popupTableSelect")
  1291. ${vModel}columnOptions:[#foreach($options in ${html.columnOptions}) {"label":"${options.label}","value":"${options.value}"},#end],
  1292. #end
  1293. #if($html.props)
  1294. #set($propsModel = ${html.props})
  1295. $!{vModel}Props:{"label":"${propsModel.label}","value":"${propsModel.value}" #if($!{propsModel.multiple}) ,"multiple":$propsModel.multiple #end #if($!{propsModel.children}),"children":"${propsModel.children}" #end},
  1296. #end
  1297. #end
  1298. #foreach($child in ${context.children})
  1299. #set($aliasname = "${child.aliasLowName}")
  1300. #foreach($fieLdsModel in ${child.childList})
  1301. #set($html = $fieLdsModel.fieLdsModel)
  1302. #set($vModel = "${html.vModel}")
  1303. #set($config = $html.config)
  1304. #set($jnpfkey = $config.jnpfKey)
  1305. #if($!{config.dataType}=='dictionary'||$!{config.dataType}=='dynamic')
  1306. ${aliasname}${vModel}Options:[],
  1307. #elseif($!{config.dataType} == "static")
  1308. #if($html.slot.options)
  1309. ${aliasname}${vModel}Options:${html.slot.options},
  1310. #elseif($html.options)
  1311. ${aliasname}${vModel}Options:${html.options},
  1312. #end
  1313. #end
  1314. #if($jnpfkey == "relationForm" || $jnpfkey == "popupSelect" || $jnpfkey == "popupTableSelect")
  1315. ${aliasname}${vModel}columnOptions:[#foreach($options in ${html.columnOptions}) {"label":"${options.label}","value":"${options.value}"},#end],
  1316. #end
  1317. #if($html.props)
  1318. #set($propsModel = ${html.props})
  1319. ${aliasname}$!{vModel}Props:{"label":"${propsModel.label}","value":"${propsModel.value}" #if($!{propsModel.multiple}) ,"multiple":$propsModel.multiple #end #if($!{propsModel.children}),"children":"${propsModel.children}" #end},
  1320. #end
  1321. #end
  1322. #end
  1323. #foreach($ChildField in ${context.columnChildren})
  1324. #foreach($FormMastTableModel in ${ChildField.fieLdsModelList})
  1325. #set($html = ${FormMastTableModel.mastTable.fieLdsModel})
  1326. #set($jnpfKey = ${html.config.jnpfKey})
  1327. #set($ChildVmodel =${FormMastTableModel.vModel})
  1328. #set($ClDataType = ${html.config.dataType})
  1329. #if(${ClDataType}=='dictionary'||${ClDataType}=='dynamic')
  1330. ${ChildVmodel}Options:[],
  1331. #elseif(${ClDataType} == "static")
  1332. #if($html.slot.options)
  1333. ${ChildVmodel}Options:${html.slot.options},
  1334. #elseif($html.options)
  1335. ${ChildVmodel}Options:${html.options},
  1336. #end
  1337. #end
  1338. #if(${jnpfKey} == "relationForm" || ${jnpfKey} == "popupSelect" || $jnpfKey == "popupTableSelect")
  1339. ${ChildVmodel}columnOptions:[#foreach($options in ${html.columnOptions}) {"label":"${options.label}","value":"${options.value}"},#end],
  1340. #end
  1341. #if($html.props)
  1342. #set($propsModel = ${html.props})
  1343. $!{ChildVmodel}Props:{"label":"${propsModel.label}","value":"${propsModel.value}" #if($!{propsModel.multiple}) ,"multiple":$propsModel.multiple #end #if($!{propsModel.children}),"children":"${propsModel.children}" #end},
  1344. #end
  1345. #end
  1346. #end
  1347. },
  1348. #end
  1349. childIndex:#if($any) $any; #else -1, #end
  1350. isEdit:#if($any) $any; #else false, #end
  1351. interfaceRes: #if($any) $any; #else ${context.templateJsonAll}, #end
  1352. //可选范围默认值
  1353. ableAll:#if($any) $any; #else
  1354. {
  1355. #foreach($fieLdsModel in ${context.ableAll})
  1356. #set($jnpfKey = "${fieLdsModel.jnpfKey}")
  1357. #if(${jnpfKey}=='mast')
  1358. #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
  1359. #set($mastModel="${html.vModel}")
  1360. #if($html.selectType == 'custom' || $html.config.jnpfKey =='signature')
  1361. #ableAll(${html}, ${mastModel},false)
  1362. #end
  1363. #elseif(${jnpfKey}=='mastTable')
  1364. #set($html = $fieLdsModel.formMastTableModel.mastTable.fieLdsModel)
  1365. #set($vmodelTable =${fieLdsModel.formMastTableModel.table})
  1366. #set($vmodelFeild =${fieLdsModel.formMastTableModel.vModel})
  1367. #if($html.selectType == 'custom' || $html.config.jnpfKey =='signature')
  1368. #ableAll(${html}, "${vmodelFeild}",true)
  1369. #end
  1370. #elseif(${jnpfKey}=='table')
  1371. #set($child = $fieLdsModel.childList)
  1372. #set($aliasname = ${child.aliasLowName})
  1373. #foreach($htmlChild in ${child.childList})
  1374. #set($html = $htmlChild.fieLdsModel)
  1375. #set($childvModel = ${html.vModel})
  1376. #if($html.selectType == 'custom' || $html.config.jnpfKey =='signature')
  1377. #ableAll(${html},"${aliasname}${childvModel}",true)
  1378. #end
  1379. #end
  1380. #end
  1381. #end
  1382. },
  1383. #end
  1384. //掩码配置
  1385. maskConfig:#if($any)$any; #else
  1386. {
  1387. #foreach($fieLdsModel in ${context.fields})
  1388. #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
  1389. #set($vModel = "${html.vModel}")
  1390. #set($config = $html.config)
  1391. #set($jnpfkey = $config.jnpfKey)
  1392. #if($jnpfkey == "input")
  1393. ${vModel}:#if(${html.maskConfig}) ${html.maskConfig} #else {}#end,
  1394. #end
  1395. #end
  1396. #foreach($child in ${context.children})
  1397. #set($aliasname = "${child.aliasLowName}")
  1398. #foreach($fieLdsModel in ${child.childList})
  1399. #set($html = $fieLdsModel.fieLdsModel)
  1400. #set($vModel = "${html.vModel}")
  1401. #set($config = $html.config)
  1402. #set($jnpfkey = $config.jnpfKey)
  1403. #if($jnpfkey == "input")
  1404. ${aliasname}${vModel}:#if(${html.maskConfig}) ${html.maskConfig} #else {}#end,
  1405. #end
  1406. #end
  1407. #end
  1408. #foreach($ChildField in ${context.columnChildren})
  1409. #foreach($FormMastTableModel in ${ChildField.fieLdsModelList})
  1410. #set($html = ${FormMastTableModel.mastTable.fieLdsModel})
  1411. #set($jnpfKey = ${html.config.jnpfKey})
  1412. #set($ChildVmodel =${FormMastTableModel.vModel})
  1413. #if(${jnpfKey} == "input")
  1414. ${ChildVmodel}:#if(${html.maskConfig}) ${html.maskConfig} #else {}#end,
  1415. #end
  1416. #end
  1417. #end
  1418. },
  1419. #end
  1420. //定位属性
  1421. locationScope:#if($any)$any; #else
  1422. {
  1423. #foreach($fieLdsModel in ${context.fields})
  1424. #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
  1425. #set($vModel = "${html.vModel}")
  1426. #set($config = $html.config)
  1427. #set($jnpfkey = $config.jnpfKey)
  1428. #if($jnpfkey == "location")
  1429. ${vModel}:#if(${html.locationScope}) ${html.locationScope} #else []#end,
  1430. #end
  1431. #end
  1432. #foreach($child in ${context.children})
  1433. #set($aliasname = "${child.aliasLowName}")
  1434. #foreach($fieLdsModel in ${child.childList})
  1435. #set($html = $fieLdsModel.fieLdsModel)
  1436. #set($vModel = "${html.vModel}")
  1437. #set($config = $html.config)
  1438. #set($jnpfkey = $config.jnpfKey)
  1439. #if($jnpfkey == "location")
  1440. ${aliasname}${vModel}:#if(${html.locationScope}) ${html.locationScope} #else []#end,
  1441. #end
  1442. #end
  1443. #end
  1444. #foreach($ChildField in ${context.columnChildren})
  1445. #foreach($FormMastTableModel in ${ChildField.fieLdsModelList})
  1446. #set($html = ${FormMastTableModel.mastTable.fieLdsModel})
  1447. #set($jnpfKey = ${html.config.jnpfKey})
  1448. #set($ChildVmodel =${FormMastTableModel.vModel})
  1449. #if(${jnpfKey} == "location")
  1450. ${ChildVmodel}:#if(${html.locationScope}) ${html.locationScope} #else []#end,
  1451. #end
  1452. #end
  1453. #end
  1454. },
  1455. #end
  1456. ## 活动面板参数
  1457. #foreach($fieLdsModel in ${context.form})
  1458. #set($jnpfKey = "${fieLdsModel.jnpfKey}")
  1459. #set($formModel = ${fieLdsModel.formModel})
  1460. #set($outermost = ${formModel.outermost})
  1461. #set($isEnd = "${fieLdsModel.isEnd}")
  1462. #if(${isEnd}=='0')
  1463. #if($jnpfKey=='collapse')
  1464. #if(${outermost}=='0')
  1465. #if($any)
  1466. ${formModel.model}:$any;
  1467. #else
  1468. ${formModel.model}:${formModel.active},
  1469. #end
  1470. #end
  1471. #end
  1472. #if($jnpfKey=='tab')
  1473. #if(${outermost}=='0')
  1474. #if($any)
  1475. ${formModel.model}:$any;
  1476. #else
  1477. ${formModel.model}:'${formModel.active}',
  1478. #end
  1479. #end
  1480. #end
  1481. #if($jnpfKey=='steps')
  1482. #if(${outermost}=='0')
  1483. #if($any)
  1484. ${formModel.model}:$any;
  1485. #else
  1486. ${formModel.model}:${formModel.active},
  1487. #end
  1488. #end
  1489. #end
  1490. #end
  1491. #end
  1492. ## 子表弹窗数据选择
  1493. #if($isSelectDialog == true)
  1494. //子表弹窗数据选择
  1495. currVmodel:#if($any) $any; #else '', #end
  1496. currTableConf:#if($any) $any; #else {}, #end
  1497. addTableConf:#if($any) $any; #else
  1498. {
  1499. #foreach($children in ${context.children})
  1500. #set($aliasname = "${children.aliasLowName}")
  1501. #foreach($item in ${children.footerBtnsList})
  1502. #if($item.value != 'add' && $item.value != 'batchRemove' && $item.actionType!=2)
  1503. "${aliasname}List${item.value}":${item.actionConfig},
  1504. #end
  1505. #end
  1506. #end
  1507. },
  1508. #end
  1509. #end
  1510. ## 子表多选框选中行数组变量
  1511. #foreach($children in ${context.children})
  1512. #set($aliasname = "${children.aliasLowName}")
  1513. selected${aliasname}RowKeys :#if($any) $any; #else [], #end
  1514. #if($!{children.layoutType} == 'list')
  1515. ${aliasname}outerActiveKey: #if($any) $any; #else [0], #end
  1516. ${aliasname}innerActiveKey: #if($any) $any; #else [], #end
  1517. #end
  1518. #end
  1519. ## 关联表单和弹窗选择展示多字段
  1520. extraOptions:#if($any) $any; #else
  1521. {
  1522. #foreach($fieLdsModel in ${context.fields})
  1523. #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
  1524. #set($vModel = "${html.vModel}")
  1525. #set($jnpfkey = $html.config.jnpfKey)
  1526. #if($jnpfkey == "relationForm" || $jnpfkey == "popupSelect")
  1527. ${vModel}:[#foreach($options in ${html.extraOptions}) {"label":"${options.label}","value":"${options.value}"},#end],
  1528. #end
  1529. #end
  1530. #foreach($ChildField in ${context.columnChildren})
  1531. #foreach($FormMastTableModel in ${ChildField.fieLdsModelList})
  1532. #set($html = ${FormMastTableModel.mastTable.fieLdsModel})
  1533. #set($jnpfKey = ${html.config.jnpfKey})
  1534. #set($ChildVmodel =${FormMastTableModel.vModel})
  1535. #if(${jnpfKey} == "relationForm" || ${jnpfKey} == "popupSelect")
  1536. ${ChildVmodel}:[#foreach($options in ${html.extraOptions}) {"label":"${options.label}","value":"${options.value}"},#end],
  1537. #end
  1538. #end
  1539. #end
  1540. },
  1541. #end
  1542. #end
  1543. ##控件默认值取值范围
  1544. #macro(ableAll $html,$feildFullName,$flag)
  1545. #if($html.ableDepIds)
  1546. ${feildFullName}ableDepIds: ${html.ableDepIds},
  1547. #end
  1548. #if($html.ablePosIds)
  1549. ${feildFullName}ablePosIds: ${html.ablePosIds},
  1550. #end
  1551. #if($html.ableUserIds)
  1552. ${feildFullName}ableUserIds: ${html.ableUserIds},
  1553. #end
  1554. #if($html.ableRoleIds)
  1555. ${feildFullName}ableRoleIds: ${html.ableRoleIds},
  1556. #end
  1557. #if($html.ableGroupIds)
  1558. ${feildFullName}ableGroupIds: ${html.ableGroupIds},
  1559. #end
  1560. #if($html.ableIds)
  1561. ${feildFullName}ableIds: ${html.ableIds},
  1562. #end
  1563. #end
  1564. ##############################数据选项方法########################################
  1565. ## 数据选项-生成方法
  1566. #macro(GetOptionMethod $childTableName)
  1567. #set($isChildType = '1')
  1568. #if($!childTableName)
  1569. #set($isChildType = '2')
  1570. #end
  1571. #if(${dataType}=='dictionary')
  1572. //数据选项--数据字典初始化方法
  1573. function get${methodName}Options() {
  1574. getDictionaryDataSelector('${config.dictionaryType}').then(res => {
  1575. state.optionsObj.${methodName}Options = res.data.list
  1576. })
  1577. }
  1578. #elseif(${dataType}=='dynamic')
  1579. //数据选项--远端数据初始化方法
  1580. function get${methodName}Options(isClear = false) {
  1581. const index = state.childIndex
  1582. let templateJsonList = JSON.parse(JSON.stringify(state.interfaceRes.${methodName}))
  1583. #if(!$context.lineEdit)
  1584. for (let i = 0; i < templateJsonList.length; i++) {
  1585. let json = templateJsonList[i];
  1586. if(json.relationField&&json.sourceType ==1){
  1587. let relationFieldAll = json.relationField.split("-");
  1588. let val = json.defaultValue;
  1589. if(relationFieldAll.length>1 && index>-1){
  1590. if(relationFieldAll[0].endsWith("List")){
  1591. val = state.dataForm[relationFieldAll[0]]&&state.dataForm[relationFieldAll[0]].length?
  1592. state.dataForm[relationFieldAll[0]][index][relationFieldAll[1]]:''
  1593. }else{
  1594. val = state.dataForm[relationFieldAll[0]+'List']&&state.dataForm[relationFieldAll[0]+'List'].length?
  1595. state.dataForm[relationFieldAll[0]+'List'][index][relationFieldAll[1]]:''
  1596. }
  1597. }else {
  1598. val = state.dataForm[relationFieldAll]
  1599. }
  1600. json.defaultValue = val ? val : '';
  1601. }
  1602. }
  1603. #end
  1604. let template ={
  1605. paramList:templateJsonList
  1606. }
  1607. getDataInterfaceRes('${config.propsUrl}',template).then(res => {
  1608. let data = res.data
  1609. state.optionsObj.${methodName}Options = data
  1610. if(index==-1) return
  1611. ## 子表设置到行内options
  1612. #if($!{childTableName})
  1613. state.dataForm.${childTableName}List[index].${methodName}Options =data
  1614. #end
  1615. if(isClear){
  1616. changeDataFormData(${isChildType},'${childTableName}List','$vModel',index,'')
  1617. }
  1618. })
  1619. }
  1620. #elseif(${jnpfkey}=='popupSelect'|| ${jnpfkey}=='popupTableSelect')
  1621. #if($childTableName)
  1622. #set($vModel="$childTableName$vModel")
  1623. #end
  1624. function get${vModel}Options() {
  1625. const index = state.childIndex
  1626. changeDataFormData(${isChildType},'${childTableName}List','${methodName}',index,${defaultValue})
  1627. }
  1628. #end
  1629. #end
  1630. ## 数据选项---数据字典和远端数据获取初始化
  1631. #macro(GetDataOptionsMethod)
  1632. ##主表
  1633. #foreach($fieLdsModel in ${context.fields})
  1634. #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
  1635. #set($vModel = "${html.vModel}")
  1636. #set($config = $html.config)
  1637. #set($dataType = "$!{config.dataType}")
  1638. #set($jnpfkey="${config.jnpfKey}")
  1639. #set($defaultValue='""')
  1640. #if($!config.valueType=='String')
  1641. #set($defaultValue="'$!{config.defaultValue}'")
  1642. #elseif($!config.valueType=='undefined')
  1643. #set($defaultValue='""')
  1644. #else
  1645. #set($defaultValue=$!{config.defaultValue})
  1646. #end
  1647. #set($methodName = "${html.vModel}")
  1648. #GetOptionMethod("")
  1649. #end
  1650. ##副表
  1651. #foreach($ColumnFieldModel in ${context.mastTable})
  1652. #set($html =${ColumnFieldModel.formMastTableModel})
  1653. #set($vModel = "${html.vModel}")
  1654. #set($config = $html.mastTable.fieLdsModel.config)
  1655. #set($dataType = "$!{config.dataType}")
  1656. #set($jnpfkey="${config.jnpfKey}")
  1657. #set($defaultValue='""')
  1658. #if($!config.valueType=='String')
  1659. #set($defaultValue="'$!{config.defaultValue}'")
  1660. #elseif($!config.valueType=='undefined')
  1661. #set($defaultValue='""')
  1662. #else
  1663. #set($defaultValue=$!{config.defaultValue})
  1664. #end
  1665. #set($methodName = "${html.vModel}")
  1666. #GetOptionMethod("")
  1667. #end
  1668. ##子表
  1669. #foreach($child in ${context.children})
  1670. #foreach($fieLdsModel in ${child.childList})
  1671. #set($html = $fieLdsModel.fieLdsModel)
  1672. #set($vModel = "${html.vModel}")
  1673. #set($config = $html.config)
  1674. #set($dataType = "$!{config.dataType}")
  1675. #set($jnpfkey="${config.jnpfKey}")
  1676. #set($defaultValue='""')
  1677. #if($!config.valueType=='String')
  1678. #set($defaultValue="'$!{config.defaultValue}'")
  1679. #elseif($!config.valueType=='undefined')
  1680. #set($defaultValue='""')
  1681. #else
  1682. #set($defaultValue=$!{config.defaultValue})
  1683. #end
  1684. #set($methodName = "${child.aliasLowName}${html.vModel}")
  1685. #GetOptionMethod(${child.aliasLowName})
  1686. #end
  1687. #end
  1688. #end
  1689. ## 数据联系,changeData方法
  1690. #macro(ChangeData)
  1691. function changeData(model, index) {
  1692. state.isEdit = false
  1693. state.childIndex = index
  1694. for (let key in state.interfaceRes) {
  1695. if (key != model) {
  1696. let faceReList = state.interfaceRes[key]
  1697. for (let i = 0; i < faceReList.length; i++) {
  1698. let relationField = faceReList[i].relationField;
  1699. if(relationField){
  1700. let modelAll = relationField.split('-');
  1701. let faceMode = '';
  1702. let faceMode2 = modelAll.length == 2?modelAll[0].substring(0, modelAll[0].length-4) +modelAll[1]:""
  1703. for (let i = 0; i < modelAll.length; i++) {
  1704. faceMode += modelAll[i];
  1705. }
  1706. if (faceMode == model || faceMode2 == model ) {
  1707. let options = 'get' + key + 'Options';
  1708. eval(options)(true);
  1709. changeData(key, index)
  1710. }
  1711. }
  1712. }
  1713. }
  1714. }
  1715. }
  1716. function changeDataFormData(type, data, model,index,defaultValue) {
  1717. if(!state.isEdit) {
  1718. if (type == 2) {
  1719. for (let i = 0; i < state.dataForm[data].length; i++) {
  1720. if (index == -1) {
  1721. state.dataForm[data][i][model] = defaultValue
  1722. } else if (index == i) {
  1723. state.dataForm[data][i][model] = defaultValue
  1724. }
  1725. }
  1726. } else {
  1727. state.dataForm[data] = defaultValue
  1728. }
  1729. }
  1730. }
  1731. #end
  1732. ## 编辑,初始化当前Options $isEdit是否编辑。true编辑 false 新增
  1733. #macro(EditGetOption $isEdit)
  1734. ##主表options
  1735. #foreach($fieLdsModel in ${context.fields})
  1736. #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
  1737. #set($vModel = "${html.vModel}")
  1738. #set($config = $html.config)
  1739. #set($dataType = "$!{config.dataType}")
  1740. #if($!{config.dataType}=='dictionary'||$!{config.dataType}=='dynamic')
  1741. get${vModel}Options();
  1742. #end
  1743. #end
  1744. ##副表options
  1745. #foreach($ColumnFieldModel in ${context.mastTable})
  1746. #set($html =${ColumnFieldModel.formMastTableModel})
  1747. #set($vModel = "${html.vModel}")
  1748. #set($config = $html.mastTable.fieLdsModel.config)
  1749. #if($!{config.dataType}=='dictionary'||$!{config.dataType}=='dynamic')
  1750. get${vModel}Options();
  1751. #end
  1752. #end
  1753. ##子表表options
  1754. #foreach($itemModel in ${context.children})
  1755. #set($aliasname =$itemModel.aliasLowName)
  1756. #set($aliasName =$itemModel.aliasUpName)
  1757. #set($childList = ${itemModel.childList})
  1758. #foreach($childList in $childList)
  1759. #set($fieLdsModel = $childList.fieLdsModel)
  1760. #set($vModel = "${fieLdsModel.vModel}")
  1761. #set($field = "${fieLdsModel.vModel}")
  1762. #set($config = ${fieLdsModel.config})
  1763. #set($dataType = "$!{config.dataType}")
  1764. ## 新增修改时获取字典的options
  1765. #if($!{config.dataType}=='dictionary')
  1766. get${aliasname}${vModel}Options()
  1767. #end
  1768. #end
  1769. ## 编辑时-获取子表动态options
  1770. if (state.dataForm.${aliasname}List) {
  1771. for (let i = 0; i < state.dataForm.${aliasname}List.length; i++) {
  1772. state.childIndex = i;
  1773. state.dataForm.${aliasname}List[i].jnpfId = buildUUID();
  1774. #foreach($item in $childList)
  1775. #set($fieLdsModel = $item.fieLdsModel)
  1776. #set($vModel = "${fieLdsModel.vModel}")
  1777. #set($field = "${fieLdsModel.vModel}")
  1778. #set($config = ${fieLdsModel.config})
  1779. #set($dataType = "$!{config.dataType}")
  1780. #if($isEdit)
  1781. #if(${dataType}=='dynamic')
  1782. get${aliasname}${vModel}Options(false)
  1783. #end
  1784. #end
  1785. #end
  1786. }
  1787. }
  1788. ## 子表平铺展开方法调用
  1789. #if($!{itemModel.layoutType} == 'list')
  1790. set${aliasname}ActiveKey();
  1791. #end
  1792. #end
  1793. #end
  1794. ##子表弹窗相关函数,
  1795. #macro(ChildDialogMethod)
  1796. function openSelectDialog(key,value) {
  1797. state.currTableConf=state.addTableConf[key+value]
  1798. state.currVmodel=key
  1799. nextTick(() => {
  1800. (selectModal.value as any)?.openSelectModal();
  1801. })
  1802. }
  1803. //子表弹窗选择数据-添加初始化下拉options
  1804. function addForSelect(data) {
  1805. let currSize= state.dataForm[state.currVmodel].length
  1806. for (let i = 0; i < data.length; i++) {
  1807. let item={...state.tableRows[state.currVmodel],...data[i], jnpfId: buildUUID()}
  1808. state.dataForm[state.currVmodel].push(cloneDeep(item))
  1809. state.childIndex= currSize + i;
  1810. #foreach($itemModel in ${context.children})
  1811. #set($aliasname =$!{itemModel.aliasLowName})
  1812. #set($aliasName =$!{itemModel.aliasUpName})
  1813. #set($childList = ${itemModel.childList})
  1814. #if($!{itemModel.layoutType} == 'list' && $!{itemModel.defaultExpandAll} )
  1815. state.${aliasname}innerActiveKey.push(item.jnpfId);
  1816. #end
  1817. if(state.currVmodel === "${aliasname}List"){
  1818. #foreach($childList in$childList)
  1819. #set($fieLdsModel = $childList.fieLdsModel)
  1820. #set($vModel = "${fieLdsModel.vModel}")
  1821. #set($field = "${fieLdsModel.vModel}")
  1822. #set($config = ${fieLdsModel.config})
  1823. #set($dataType = "$!{config.dataType}")
  1824. #if(${dataType}=='static' || ${dataType}=='dictionary')
  1825. item.$!{aliasname}${vModel}Options = state.optionsObj.$!{aliasname}${vModel}Options;
  1826. #end
  1827. #if(${dataType}=='dynamic')
  1828. get${aliasname}${vModel}Options(false);
  1829. #end
  1830. #end
  1831. }
  1832. #end
  1833. state.childIndex = -1
  1834. }
  1835. }
  1836. #end
  1837. ##面板参数初始化
  1838. #macro(InitActiveValue)
  1839. #foreach($fieLdsModel in ${context.form})
  1840. #set($jnpfKey = "${fieLdsModel.jnpfKey}")
  1841. #set($formModel = ${fieLdsModel.formModel})
  1842. #set($outermost = ${formModel.outermost})
  1843. #set($isEnd = "${fieLdsModel.isEnd}")
  1844. #if(${isEnd}=='0')
  1845. #if($jnpfKey=='collapse')
  1846. #if(${outermost}=='0')
  1847. state.${formModel.model}=${formModel.active};
  1848. #end
  1849. #end
  1850. #if($jnpfKey=='tab')
  1851. #if(${outermost}=='0')
  1852. state.${formModel.model}='${formModel.active}';
  1853. #end
  1854. #end
  1855. #if($jnpfKey=='steps')
  1856. #if(${outermost}=='0')
  1857. state.${formModel.model}=${formModel.active};
  1858. #end
  1859. #end
  1860. #end
  1861. #end
  1862. #end
  1863. ################################################################################
  1864. ## 时间处理方法
  1865. #macro(GetStartAndEndTime $mastKey,$config,$html,$startTime,$endTime)
  1866. #set($startRelationField="''")
  1867. #if($config.startRelationField)
  1868. #set($startRelationField="${context.formModel}.${config.startRelationField}")
  1869. #if($config.startChild)
  1870. #set($startRelationField="record.${config.startRelationField}")
  1871. #end
  1872. #end
  1873. #set($startTimeValue="#if(${config.startTimeValue})'${config.startTimeValue}'#else''#end")
  1874. #set($startTimeType="#if(${config.startTimeType})${config.startTimeType}#else''#end")
  1875. #set($startTimeTarget="#if(${config.startTimeTarget})${config.startTimeTarget}#else''#end")
  1876. #set($endRelationField="''")
  1877. #if($config.endRelationField)
  1878. #set($endRelationField="${context.formModel}.${config.endRelationField}")
  1879. #if($config.endChild)
  1880. #set($endRelationField="record.${config.endRelationField}")
  1881. #end
  1882. #end
  1883. #set($endTimeValue="#if(${config.endTimeValue})'${config.endTimeValue}'#else''#end")
  1884. #set($endTimeType="#if(${config.endTimeType})${config.endTimeType}#else''#end")
  1885. #set($endTimeTarget="#if(${config.endTimeTarget})${config.endTimeTarget}#else''#end")
  1886. #set($startTime="getRelationDate(${config.startTimeRule},${startTimeType},${startTimeTarget},${startTimeValue},${startRelationField})")
  1887. #set($endTime="getRelationDate(${config.endTimeRule},${endTimeType},${endTimeTarget},${endTimeValue},${endRelationField})")
  1888. #if($mastKey=='timePicker')
  1889. #set($startTime="getRelationTime(${config.startTimeRule},${startTimeType},${startTimeTarget},${startTimeValue},'${html.format}',${startRelationField})")
  1890. #set($endTime="getRelationTime(${config.endTimeRule},${endTimeType},${endTimeTarget},${endTimeValue},'${html.format}',${endRelationField})")
  1891. #end
  1892. #if(${startTimeType} == 2)
  1893. #set($startTime="$startRelationField")
  1894. #end
  1895. #if(${endTimeType} == 2)
  1896. #set($endTime="$endRelationField")
  1897. #end
  1898. #end
  1899. ## 时间处理方法-js
  1900. #macro(GetRelationDate)
  1901. function getRelationDate(timeRule, timeType, timeTarget, timeValueData, dataValue) {
  1902. let timeDataValue: any = null;
  1903. let timeValue = Number(timeValueData);
  1904. if (timeRule) {
  1905. if (timeType == 1) {
  1906. timeDataValue = timeValue;
  1907. } else if (timeType == 2) {
  1908. timeDataValue = dataValue;
  1909. } else if (timeType == 3) {
  1910. timeDataValue = new Date().getTime();
  1911. } else if (timeType == 4 || timeType == 5) {
  1912. const type = getTimeUnit(timeTarget);
  1913. const method = timeType == 4 ? 'subtract' : 'add';
  1914. timeDataValue = dayjs()[method](timeValue, type).valueOf();
  1915. }
  1916. }
  1917. return timeDataValue;
  1918. }
  1919. function getRelationTime(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
  1920. let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType;
  1921. let timeDataValue: any = null;
  1922. if (timeRule) {
  1923. if (timeType == 1) {
  1924. timeDataValue = timeValue || '00:00:00';
  1925. if (timeDataValue.split(':').length == 3) {
  1926. timeDataValue = timeDataValue;
  1927. } else {
  1928. timeDataValue = timeDataValue + ':00';
  1929. }
  1930. } else if (timeType == 2) {
  1931. timeDataValue = dataValue;
  1932. } else if (timeType == 3) {
  1933. timeDataValue = dayjs().format(format);
  1934. } else if (timeType == 4 || timeType == 5) {
  1935. const type = getTimeUnit(timeTarget + 3);
  1936. const method = timeType == 4 ? 'subtract' : 'add';
  1937. timeDataValue = dayjs()[method](timeValue, type).format(format);
  1938. }
  1939. }
  1940. return timeDataValue;
  1941. }
  1942. #end