FormMarco.vm 94 KB

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