DetailMarco.vm 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811
  1. ##详情-表单生成
  2. #macro(DetailFormRendering)
  3. #foreach($fieLdsModel in ${context.form})
  4. #set($jnpfKey = "${fieLdsModel.jnpfKey}")
  5. #set($isEnd = "${fieLdsModel.isEnd}")
  6. #set($formModel = ${fieLdsModel.formModel})
  7. #set($config= $formModel.config)
  8. #set($span=$config.span)
  9. #set($outermost = ${formModel.outermost})
  10. #set($borderType = ${formModel.borderType})
  11. #set($borderColor = ${formModel.borderColor})
  12. #set($borderWidth = ${formModel.borderWidth})
  13. #set($pcshow = $config.pc)
  14. #if(${jnpfKey}=='row' && $pcshow == true)
  15. #if(${isEnd}=='0')
  16. <a-col :span="${formModel.span}" class="ant-col-item">
  17. <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
  18. #else
  19. </a-row>
  20. </a-col>
  21. #end
  22. #elseif(${jnpfKey}=='card' && $pcshow == true)
  23. #if(${isEnd}=='0')
  24. <a-col #if(${span}) :span="${span}" #else :span="24" #end class="ant-col-item">
  25. <a-card class="mb-20" #if(${formModel.shadow}=='hover') hoverable #end>
  26. #if(${formModel.header} || ${formModel.headerI18nCode} )
  27. <template #title>#if(${formModel.headerI18nCode}) {{t('${formModel.headerI18nCode}','${formModel.header}')}} #else ${formModel.header} #end
  28. #if((${formModel.header} || ${formModel.headerI18nCode}) && (${config.tipLabel} || ${config.tipLabelI18nCode}))
  29. <BasicHelp #if(${config.tipLabelI18nCode}) :text="t('${config.tipLabelI18nCode}','${config.tipLabel}')" #end text="${config.tipLabel}" />#end
  30. </template>
  31. #end
  32. <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
  33. #else
  34. </a-row>
  35. </a-card>
  36. </a-col>
  37. #end
  38. #elseif(${jnpfKey}=='tab' && $pcshow == true)
  39. #set($tabs = "a-tabs")
  40. #if(${outermost}=='1')
  41. #set($tabs = "a-tab-pane")
  42. #end
  43. #if(${isEnd}=='0')
  44. #if(${outermost}=='0')
  45. <a-col :span="${formModel.span}" class="ant-col-item">
  46. <${tabs} v-model:activeKey="state.${formModel.model}" #if($formModel.type)type="${formModel.type}"#end tabPosition="${formModel.tabPosition}" class="mb-20" >
  47. #else
  48. <${tabs} #if(${formModel.titleI18nCode}):tab="t('${formModel.titleI18nCode}','${formModel.title}')" #else tab="${formModel.title}"#end key="${formModel.name}" forceRender>
  49. <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
  50. #end
  51. #else
  52. #if(${outermost}=='0')
  53. </${tabs}>
  54. </a-col>
  55. #else
  56. </a-row>
  57. </${tabs} >
  58. #end
  59. #end
  60. #elseif(${jnpfKey}=='tableGrid' || ${jnpfKey}=='tableGridTd' || ${jnpfKey}=='tableGridTr')
  61. #set($tabs = "tbody")
  62. #set($tableGrid = "table")
  63. #if(${jnpfKey}=='tableGridTr')
  64. #set($tabs = "tr")
  65. #elseif(${jnpfKey}=='tableGridTd')
  66. #set($tabs = "")
  67. #if(${config.merged}==false)
  68. #set($tabs = "td")
  69. #end
  70. #end
  71. #if(${config.pc}==true)
  72. #if(${isEnd}=='0')
  73. #if(${jnpfKey}=='tableGrid')
  74. <${tableGrid} class="table-grid-box" :style='{"--borderType":"${borderType}","--borderColor":"${borderColor}","--borderWidth":"${borderWidth}px"}'>
  75. #end
  76. #if($tabs)
  77. <${tabs}#if(${config.colspan}) colspan="${config.colspan}"#end#if(${config.rowspan}) rowspan="${config.rowspan}"#end>
  78. #end
  79. #else
  80. #if($tabs)
  81. </${tabs}>
  82. #end
  83. #if(${jnpfKey}=='tableGrid')
  84. </${tableGrid}>
  85. #end
  86. #end
  87. #end
  88. #elseif(${jnpfKey}=='groupTitle' || ${jnpfKey}=='text'|| ${jnpfKey} == 'button' || ${jnpfKey} == 'link' || ${jnpfKey} == 'alert'|| ${jnpfKey} == 'divider')
  89. #if($pcshow== true)
  90. <a-col :span="${span}" class="ant-col-item">
  91. <a-form-item>
  92. <${config.tag}
  93. #if($formModel.style) :style='${formModel.style}'#end
  94. #if($formModel.href) href= "$formModel.href"#end
  95. #if($formModel.target) target= "$formModel.target"#end
  96. #if($formModel.showIcon) :show-icon= "$formModel.showIcon"#end
  97. #if($formModel.align) align="${formModel.align}" #end
  98. #if($formModel.disabled) :disabled="${formModel.disabled}" #end
  99. #if($formModel.buttonText || $formModel.buttonTextI18nCode) #if(${formModel.buttonTextI18nCode}) :buttonText="t('${formModel.buttonTextI18nCode}', '${formModel.buttonText}')"
  100. #else buttonText="${formModel.buttonText}" #end#end
  101. #if($formModel.type) type="${formModel.type}" #end
  102. #if($formModel.textStyle) :textStyle='${formModel.textStyle}'#end
  103. #if($formModel.contentPosition) contentPosition="${formModel.contentPosition}" #end
  104. #if(${jnpfKey} == 'alert' && $!{formModel.closable}) :closable= "$formModel.closable" #end
  105. #if($formModel.title || $formModel.titleI18nCode) #if(${formModel.titleI18nCode}) :title="t('${formModel.titleI18nCode}', '${formModel.title}')"
  106. #else title="${formModel.title}" #end#end
  107. #if($formModel.closeText || $formModel.closeTextI18nCode) #if(${formModel.closeTextI18nCode}) :closeText="t('${formModel.closeTextI18nCode}', '${formModel.closeText}')"
  108. #else closeText="${formModel.closeText}" #end#end
  109. #if($formModel.description || $formModel.descriptionI18nCode) #if(${formModel.descriptionI18nCode}) :description="t('${formModel.descriptionI18nCode}', '${formModel.description}')"
  110. #else description="${formModel.description}" #end#end
  111. #if(${formModel.helpMessage} || ${formModel.helpMessageI18nCode}) #if(${formModel.helpMessageI18nCode}) :helpMessage ="t('${formModel.helpMessageI18nCode}', '${formModel.helpMessage}')"
  112. #else helpMessage="${formModel.helpMessage}" #end #end
  113. #if(${formModel.content} || ${formModel.contentI18nCode}) #if(${formModel.contentI18nCode}) :content="t('${formModel.contentI18nCode}', '${formModel.content}')"
  114. #else content="${formModel.content}" #end #end>
  115. </${config.tag}>
  116. </a-form-item>
  117. </a-col>
  118. #end
  119. #elseif(${jnpfKey}=='qrcode' || ${jnpfKey}=='barcode')
  120. #if($pcshow== true)
  121. <a-col :span="${span}" class="ant-col-item">
  122. <a-form-item>
  123. #if($config.showLabel)<template #label>#if(${config.labelI18nCode}) {{t('${config.labelI18nCode}','${config.label}')}} #else${config.label} #end
  124. #if((${config.label} || ${config.labelI18nCode}) && ${context.labelSuffix})${context.labelSuffix}#end
  125. #if((${config.label} || ${config.labelI18nCode}) && (${config.tipLabel} || ${config.tipLabelI18nCode}))
  126. <BasicHelp #if(${config.tipLabelI18nCode}) :text="t('${config.tipLabelI18nCode}','${config.tipLabel}')" #else text="${config.tipLabel}" #end />#end</template> #end
  127. <${config.tag} #if(${formModel.format}) format='${formModel.format}'#end
  128. #if(${formModel.lineColor}) lineColor = "${formModel.lineColor}"#end
  129. #if(${formModel.colorLight}) colorLight = "${formModel.colorLight}"#end
  130. #if(${formModel.colorDark}) colorDark = "${formModel.colorDark}"#end
  131. #if(${formModel.background}) background = "${formModel.background}"#end
  132. #if(${formModel.width}) width = "${formModel.width}"#end
  133. #if(${formModel.height}) height = "${formModel.height}"#end
  134. #if(${formModel.relationField}) :staticText = "dataForm.${formModel.relationField}_id"
  135. #else staticText = "${formModel.staticText}"#end >
  136. </${config.tag}>
  137. </a-form-item>
  138. </a-col>
  139. #end
  140. #elseif(${jnpfKey}=='collapse' && $pcshow == true)
  141. #set($collapse = "a-collapse")
  142. #if(${outermost}=='1')
  143. #set($collapse = "a-collapse-panel")
  144. #end
  145. #if(${isEnd}=='0')
  146. #if(${outermost}=='0')
  147. <a-col :span="${formModel.span}" class="ant-col-item">
  148. <${collapse} ghost expandIconPosition="right" :accordion="${formModel.accordion}" v-model:activeKey="state.${formModel.model}" class="mb-20">
  149. #else
  150. <${collapse} #if(${formModel.titleI18nCode}):header="t('${formModel.titleI18nCode}','${formModel.title}')" #else header="${formModel.title}"#end key="${formModel.name}" forceRender>
  151. <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
  152. #end
  153. #else
  154. #if(${outermost}=='0')
  155. </${collapse}>
  156. </a-col>
  157. #else
  158. </a-row>
  159. </${collapse}>
  160. #end
  161. #end
  162. #elseif(${jnpfKey}=='steps' && $pcshow == true)
  163. #set($step = "a-steps")
  164. #if(${outermost}=='1')
  165. #set($step = "a-step")
  166. #end
  167. #if(${isEnd}=='0')
  168. #if(${outermost}=='0')
  169. <a-col :span="${formModel.span}" class="ant-col-item">
  170. <a-steps type=#if($!{formModel.simple}) 'navigation' #else 'default' #end status="${formModel.processStatus}" v-model:current="state.${formModel.model}" class="mb-10px">
  171. #foreach($itemStep in $config.children)
  172. <a-step #if(${itemStep.titleI18nCode}) :title="t('${itemStep.titleI18nCode}','${itemStep.title}')" #else title="${itemStep.title}" #end key="${itemStep.name}">
  173. #if($!{itemStep.icon})
  174. <template #icon>
  175. <span class="${itemStep.icon} custom-icon"></span>
  176. </template>
  177. #end
  178. </a-step>
  179. #end
  180. </a-steps>
  181. #else
  182. <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">
  183. #end
  184. #else
  185. #if(${outermost}=='0')
  186. </a-col>
  187. #else
  188. </a-row>
  189. #end
  190. #end
  191. #elseif(${jnpfKey}=='mast' || ${jnpfKey}=='mastTable')
  192. #DetailMastTable(${jnpfKey})
  193. #elseif($jnpfKey == 'table')
  194. #DetailChildTable()
  195. #end
  196. #end
  197. #end
  198. ##详情-主副标签生成
  199. #macro(DetailMastTable $tableType)
  200. #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
  201. #set($beforeVmodel =${html.vModel})
  202. ## 副表参数
  203. #if($tableType=='mastTable')
  204. #set($html = $fieLdsModel.formMastTableModel.mastTable.fieLdsModel)
  205. #set($beforeVmodel =${fieLdsModel.formMastTableModel.vModel})
  206. #end
  207. #set($vModel = "${html.vModel}")
  208. #set($mastModel="${context.formModel}.${beforeVmodel}")
  209. #set($config = $html.config)
  210. #set($mastKey = "${config.jnpfKey}")
  211. #set($show = $config.noShow)
  212. #set($pcshow = $config.pc)
  213. #set($startTime=${html.startTime})
  214. #set($endTime=${html.endTime})
  215. ## 时间处理
  216. #if(${mastKey}=='datePicker'||${mastKey}=='timePicker')
  217. ## #GetStartAndEndTime($mastKey,$config,$html,$startTime,$endTime)
  218. #end
  219. #if($show == false && $pcshow == true && ${mastKey}!='calculate')
  220. <a-col :span="${config.span}" class="ant-col-item" #if(${context.columnData.useFormPermission}) #if(${vModel}) v-if="hasFormP('${beforeVmodel}')"
  221. #elseif($mastKey == 'relationFormAttr' || $mastKey == 'popupAttr') v-if="hasFormP('${html.relationField}')" #end #end >
  222. <a-form-item #if($config.showLabel == true) #if($config.labelWidth && ${context.labelPosition}!="top") :labelCol="{ style: { width: '${config.labelWidth}px' } }"#end
  223. #else :labelCol="{ style: { width: '0px' } }"#end #if($vModel) name="${beforeVmodel}" #end>
  224. #if($config.showLabel)<template #label>#if(${config.labelI18nCode}) {{t('${config.labelI18nCode}','${config.label}')}} #else${config.label} #end
  225. #if((${config.label} || ${config.labelI18nCode}) && ${context.labelSuffix})${context.labelSuffix}#end
  226. #if((${config.label} || ${config.labelI18nCode}) && (${config.tipLabel} || ${config.tipLabelI18nCode}))
  227. <BasicHelp #if(${config.tipLabelI18nCode}) :text="t('${config.tipLabelI18nCode}','${config.tipLabel}')" #else text="${config.tipLabel}" #end />#end</template> #end
  228. #DetailFieldTag($mastKey,$html,$config,$mastModel,$beforeVmodel,-1)
  229. </a-form-item>
  230. </a-col>
  231. #end
  232. #end
  233. ## 详情-生成字段标签
  234. #macro(DetailFieldTag $mastKey,$html,$config,$mastModel,$beforeVmodel,$index)
  235. #if($DetailTag.contains($mastKey))
  236. <${config.tag} #if($mastModel && $mastKey!='iframe') v-model:value="${mastModel}"#end
  237. #if($mastKey!='text')
  238. #if(${html.placeholder} || ${html.placeholderI18nCode}) #if(${html.placeholderI18nCode}) :placeholder="t('${html.placeholderI18nCode}', '${html.placeholder}')"
  239. #else placeholder="${html.placeholder}" #end #end
  240. #else
  241. #if($config.defaultValue) value="${config.defaultValue}"#end
  242. #end
  243. #if($html.maxlength) :maxlength="${html.maxlength}" #end disabled
  244. #if($mastKey =='uploadFile' || $mastKey =='uploadImg' || $mastKey =='inputNumber' || $mastKey =='calculate'
  245. || $mastKey =='sign' || $mastKey =='input' || $mastKey =='location' || $mastKey =='signature') detailed #end
  246. #if($html.readonly == true ) readonly #end
  247. #if($html.clearable == true ) allowClear #end
  248. #if($html.prefixIcon) prefix-icon='${html.prefixIcon}' #end
  249. #if($html.suffixIcon) suffix-icon='${html.suffixIcon}' #end
  250. #if($html.style) :style='${html.style}'#end
  251. #if($html.showWordLimit == true ) ${html.showWordLimit} #end
  252. #if($html.size) size="${html.size}" #end
  253. #if($html.min) :min="${html.min}" #end
  254. #if($html.max) :max="${html.max}" #end
  255. #if($html.count) :count="${html.count}" #end
  256. #if($html.type) type="${html.type}" #end
  257. #if($html.autoSize) :autoSize='${html.autoSize}' #end
  258. #if($html.step) :step="${html.step}" #end
  259. #if($html.precision) :precision="${html.precision}" #end
  260. #if($html.stepstrictly==true) stepstrictly #end
  261. #if($html.textStyle) :textStyle='${html.textStyle}' #end
  262. #if($html.lineHeight) :lineHeight="${html.lineHeight}" #end
  263. #if($html.fontSize) :fontSize="${html.fontSize}" #end
  264. #if($html.controls) :controls="${html.controls}" #end
  265. #if($html.showChinese) :showChinese="${html.showChinese}" #end
  266. #if($html.showPassword) show-password #end
  267. #if($html.filterable || $html.filterable=='false') :showSearch='${html.filterable}' #end
  268. #if($html.multiple) :multiple="${html.multiple}" #end
  269. #if($html.separator) separator="${html.separator}" #end
  270. #if($html.isrange==true) is-range #end
  271. #if($html.rangeseparator) range-separator="${html.rangeseparator}" #end
  272. ## #if($html.startplaceholder) start-placeholder="${html.startplaceholder}" #end
  273. ## #if($html.endplaceholder) end-placeholder="${html.endplaceholder}" #end
  274. #if($html.format) format="${html.format}" #end
  275. #if($html.colorformat) color-format="${html.colorformat}" #end
  276. #if($html.valueformat) value-format="${html.valueformat}" #end
  277. #if($html.activetext) active-text="${html.activetext}" #end
  278. #if($html.inactivetext) inactive-text="${html.inactivetext}" #end
  279. #if($html.activecolor) active-color="${html.activecolor}" #end
  280. #if($html.inactivecolor) inactive-color="${html.inactivecolor}" #end
  281. #if($html.activevalue) :active-value="${html.activevalue}" #end
  282. #if($html.inactivevalue) :inactive-value="${html.inactivevalue}" #end
  283. #if($html.pickeroptions) :picker-options='${html.pickeroptions}'#end
  284. #if($html.showScore == true ) show-score #end
  285. #if($html.showText == true ) show-text #end
  286. #if($html.allowhalf == true ) allow-half #end
  287. #if($html.showAlpha == true ) show-alpha #end
  288. #if($html.showStops == true ) show-stops #end
  289. #if($html.range == true ) range #end
  290. #if($html.showTip == true ) :showTip="${html.showTip}" #end
  291. #if($html.accept) accept="${html.accept}" #end
  292. #if($html.fileSize) :fileSize="${html.fileSize}" #end
  293. #if($html.sizeUnit) sizeUnit="${html.sizeUnit}" #end
  294. #if($html.limit) :limit="${html.limit}" #end
  295. #if($html.pathType) pathType="${html.pathType}" #end
  296. #if($html.sortRule) :sortRule='${html.sortRule}' #end
  297. #if($html.timeFormat) timeFormat="${html.timeFormat}" #end
  298. #if($html.folder) folder="${html.folder}" #end
  299. #if($html.buttonText || $html.buttonTextI18nCode) #if(${html.buttonTextI18nCode}) :buttonText="t('${html.buttonTextI18nCode}', '${html.buttonText}')"
  300. #else buttonText="${html.buttonText}" #end#end
  301. #if($html.contentposition) content-position="${html.contentposition}" #end
  302. #if($html.isAmountChinese) isAmountChinese #end
  303. #if($html.thousands) thousands #end
  304. #if($html.addonAfter) addonAfter="${html.addonAfter}" #end
  305. #if($html.addonBefore) addonBefore="${html.addonBefore}" #end
  306. #if($html.level || $html.level=='0') :level=${html.level} #end
  307. #if($html.href) href = "$html.href"#end
  308. #if($html.height) :height = "$html.height"#end
  309. #if($html.useMask) :useMask = "${html.useMask}"#end
  310. #if($html.maskConfig) :maskConfig = "maskConfig.${beforeVmodel}"#end
  311. #if($html.autoLocation) :autoLocation = "$html.autoLocation" #end
  312. #if($html.enableLocationScope) :enableLocationScope = "$html.enableLocationScope" #end
  313. #if($html.adjustmentScope) :adjustmentScope = "$html.adjustmentScope" #end
  314. #if($html.enableDesktopLocation) :enableDesktopLocation = "$html.enableDesktopLocation" #end
  315. #if($html.locationScope) :locationScope = "state.locationScope.${beforeVmodel}" #end
  316. #if($html.borderType) borderType = "$html.borderType" #end
  317. #if($html.borderColor) borderColor = "$html.borderColor" #end
  318. #if($html.borderWidth) :borderWidth = "$html.borderWidth" #end
  319. >
  320. </${config.tag}>
  321. #else
  322. #if(${mastKey} == 'relationFormAttr' || ${mastKey} == 'popupAttr')
  323. #if(${html.isStorage} == 0)
  324. #if($index=="index")
  325. #set($mastModel = "record.${html.relationField}_${html.showField}")
  326. #else
  327. #set($mastModel = "${context.formModel}.${html.relationField}_${html.showField}")
  328. #end
  329. #end
  330. #end
  331. #if($dataType=='static')
  332. <p>{{ ${mastModel} }} </p>
  333. #else
  334. #if(${mastKey} == 'relationForm')
  335. <p class="link-text leading-32px" @click="toDetail('${html.modelId}', ${mastModel}_id,'${html.propsValue}')">{{ ${mastModel} }}</p>
  336. #elseif(${mastKey} == 'popupSelect')
  337. <p class="leading-32px">{{${mastModel}}}</p>
  338. #elseif(${mastKey} == 'input')
  339. <p>#if($html.slot.prepend)${html.slot.prepend}#end{{${mastModel}}}#if($html.slot.append)${html.slot.append}#end</p>
  340. #elseif(${mastKey} == 'editor')
  341. ## 副文本内放标签
  342. <div v-html="${mastModel}"></div>
  343. #elseif(${mastKey} == 'calculate' && ${html.isStorage} == 0)
  344. <${config.tag}
  345. #if($index == 'index') :rowIndex="index"#end :formData="${context.formModel}"
  346. #if($html.expression) :expression ='${html.expression}' #end
  347. #if($html.isAmountChinese) isAmountChinese #end
  348. #if($html.thousands) thousands #end
  349. #if($html.precision) :precision="${html.precision}" #end
  350. detailed ></${config.tag}>
  351. #else
  352. <p>{{${mastModel}}}</p>
  353. #end
  354. ## 关联表单和弹窗选择 展示详情
  355. #if($index!="index" && (${mastKey} == 'relationForm' || ${mastKey} == 'popupSelect'))
  356. <ExtraRelationInfo :extraOptions="state.extraOptions.${beforeVmodel}" :data="state.extraData.${beforeVmodel}"
  357. v-if="state.extraOptions.${beforeVmodel}?.length && state.extraData.${beforeVmodel} && JSON.stringify(state.extraData.${beforeVmodel}) !== '{}'" />
  358. #end
  359. #end
  360. #end
  361. #end
  362. ##详情-子表生成
  363. #macro(DetailChildTable)
  364. #set($child = $fieLdsModel.childList)
  365. #set($aliasname = "")
  366. #foreach($children in ${context.children})
  367. #if(${children.tableModel}==${child.tableModel})
  368. #set($aliasname = "${children.aliasLowName}")
  369. #set($aliasName = "${children.aliasUpName}")
  370. #end
  371. #end
  372. <a-col :span="${child.span}" class="ant-col-item mb-20px" #if(${context.columnData.useFormPermission})v-if="hasFormP('${child.tableModel}')"#end>
  373. #if($!{child.layoutType} == 'list')
  374. ## 子表平铺
  375. <div class="jnpf-child-list" >
  376. <a-collapse expandIconPosition="right" :bordered="false" class="outer-collapse" v-model:activeKey="state.${aliasname}outerActiveKey">
  377. <a-collapse-panel forceRender>
  378. <template #header>
  379. <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>
  380. #if($child.showTitle== true && $child.tipLabel)<BasicHelp #if(${child.tipLabelI18nCode}) :text="t('${child.tipLabelI18nCode}','${child.tipLabel}')" #else text="${child.tipLabel}" #end />#end
  381. </template>
  382. <a-collapse :bordered="false" v-model:activeKey="state.${aliasname}innerActiveKey">
  383. <template #expandIcon="{ isActive }">
  384. <CaretRightOutlined :rotate="isActive ? 90 : 0" />
  385. </template>
  386. <a-collapse-panel v-for="(record, index) in dataForm.${aliasname}List" :key="record.jnpfId" forceRender>
  387. <template #header>
  388. <span class="min-h-22px inline-block">#if(${child.labelI18nCode}) {{t('${child.labelI18nCode}','${child.label}')}} #else ${child.label} #end({{ index + 1 }})</span>
  389. </template>
  390. <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
  391. #foreach($itemModel in ${child.childList})
  392. #set($fieLdsModel = ${itemModel.fieLdsModel})
  393. #set($config = ${fieLdsModel.config})
  394. #set($mastKey = "${config.jnpfKey}")
  395. #set($vModel="${fieLdsModel.vModel}")
  396. #set($mastModel="dataForm.${aliasname}List[index].${vModel}")
  397. #set($beforeVmodel ="${aliasname}${fieLdsModel.vModel}")
  398. #set($startTime=${fieLdsModel.startTime})
  399. #set($endTime=${fieLdsModel.endTime})
  400. #if(${mastKey}=='datePicker'||${mastKey}=='timePicker')
  401. #GetStartAndEndTime($mastKey,$config,$fieLdsModel,$startTime,$endTime)
  402. #end
  403. #if(${config.noShow} == false && ${config.pc}==true && ${config.jnpfKey}!='calculate')
  404. <a-col :span="${config.span}" class="ant-col-item" #if(${context.columnData.useFormPermission})v-if="hasFormP('${child.tableModel}-${fieLdsModel.vModel}')"#end>
  405. <a-form-item #if($config.labelWidth && ${context.labelPosition}!="top") :labelCol="{ style: { width: '${config.labelWidth}px' } }"#end
  406. #if($vModel) :name="['${aliasname}List', index, '${vModel}']" #end>
  407. <template #label>#if(${config.labelI18nCode}) {{t('${config.labelI18nCode}','${config.label}')}} #else ${config.label} #end
  408. #if((${config.label} || ${config.labelI18nCode}) && (${config.tipLabel} || ${config.tipLabelI18nCode}))
  409. <BasicHelp #if(${config.tipLabelI18nCode}) :text="t('${config.tipLabelI18nCode}','${config.tipLabel}')"#else text="${config.tipLabel}"#end />#end
  410. </template>
  411. ## 子表标签生成
  412. #DetailFieldTag($mastKey,$fieLdsModel,$config,$mastModel,$beforeVmodel,'index',true)
  413. </a-form-item>
  414. </a-col>
  415. #end
  416. #end
  417. </a-row>
  418. </a-collapse-panel>
  419. #if($child.showSummary)
  420. #set($childSummary=true)
  421. #set($summaryField = '[]')
  422. #if(${child.summaryField})
  423. #set($summaryField = ${child.summaryField})
  424. #end
  425. <a-collapse-panel key="summary" v-if="dataForm.${aliasname}List?.length">
  426. <template #header>
  427. <span class="min-h-22px inline-block">{{ t('component.table.summary') }}</span>
  428. </template>
  429. <a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
  430. <template v-for="(column, cIndex) in ${aliasname}Columns" :key="column.key">
  431. <a-col :span="column.span" class="ant-col-item" v-if='${summaryField}.includes(column.key)'>
  432. <a-form-item #if(${context.labelPosition}!="top") :labelCol="{ style: { width: (column.labelWidth||'${context.labelWidth}')+'px' } }"#end>
  433. <template #label>{{column.title}}<BasicHelp v-if="column.title && column.tipLabel" :text="column.tipLabel" /></template>
  434. <JnpfInput :value="get${aliasName}ColumnSum[cIndex]" disabled detailed :style="column.style" />
  435. </a-form-item>
  436. </a-col>
  437. </template>
  438. </a-row>
  439. </a-collapse-panel>
  440. #end
  441. </a-collapse>
  442. </a-collapse-panel>
  443. </a-collapse>
  444. </div>
  445. #else
  446. ## 子表表格
  447. <a-form-item>
  448. #if($child.showTitle== true)
  449. <JnpfGroupTitle #if(${child.labelI18nCode}) :content="t('${child.labelI18nCode}', '${child.label}')" #else content="${child.label}" #end :bordered="false"
  450. #if(${child.tipLabelI18nCode}) :helpMessage="t('${child.tipLabelI18nCode}', '${child.tipLabel}')" #else helpMessage="${child.tipLabel}" #end />
  451. #end
  452. <a-table :data-source="dataForm.${child.tableModel}" #if(${child.complexHeaderList.size()}>0) :bordered="true" #end
  453. :columns="${aliasname}Columns" size="small" :pagination="false" :scroll="{ x: 'max-content' }">
  454. <template #headerCell="{ column }">
  455. <span class="required-sign" v-if="column.required">*</span>
  456. {{ column.title }}
  457. <BasicHelp :text="column.tipLabel" v-if="column.tipLabel && column.title" />
  458. </template>
  459. ## 子表字段
  460. <template #bodyCell="{ column, index, record }">
  461. <template v-if="column.key === 'index'">{{ index + 1 }}</template>
  462. #foreach($itemModel in ${child.childList})
  463. #set($fieLdsModel = ${itemModel.fieLdsModel})
  464. #set($config = ${fieLdsModel.config})
  465. #set($mastKey = "${config.jnpfKey}")
  466. #set($beforeVmodel ="${aliasname}${fieLdsModel.vModel}")
  467. #set($mastModel="record.${fieLdsModel.vModel}")
  468. #if(${mastKey}!='calculate')
  469. <template v-if="column.key === #if($!{fieLdsModel.vModel}) '${fieLdsModel.vModel}' #else '${config.formId}' #end">
  470. ## 子表标签生成
  471. #DetailFieldTag($mastKey,$fieLdsModel,$config,$mastModel,$beforeVmodel,'index')
  472. </template>
  473. #end
  474. #end
  475. </template>
  476. ## 子表合计
  477. #if($child.showSummary)
  478. #set($childSummary=true)
  479. <template #summary v-if="dataForm.${child.tableModel}?.length">
  480. <a-table-summary fixed>
  481. <a-table-summary-row>
  482. <a-table-summary-cell :index="0">{{ t('component.table.summary') }}</a-table-summary-cell>
  483. <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>
  484. <a-table-summary-cell :index="get${aliasName}ColumnSum.length + 1"></a-table-summary-cell>
  485. </a-table-summary-row>
  486. </a-table-summary>
  487. </template>
  488. #end
  489. </a-table>
  490. </a-form-item>
  491. #end
  492. </a-col>
  493. #end
  494. ## 子表字段对象列表生成
  495. #macro(DetailChildTableColumns)
  496. ## 子表列表字段属性
  497. #foreach($itemModel in ${context.children})
  498. const ${itemModel.aliasLowName}Columns: any[] = computed(() => {
  499. let list = [
  500. #set($childList = ${itemModel.childList})
  501. #foreach($html in ${childList})
  502. #set($fieLdsModel = ${html.fieLdsModel})
  503. #set($config = ${fieLdsModel.config})
  504. #if(!${config.noShow} && ${config.jnpfKey}!='calculate')
  505. {
  506. title: #if(${config.labelI18nCode}) t('${config.labelI18nCode}','${config.label}') #else '${config.label}' #end,
  507. dataIndex: #if($!{fieLdsModel.vModel}) '${fieLdsModel.vModel}' #else '${config.formId}' #end,
  508. key: #if($!{fieLdsModel.vModel}) '${fieLdsModel.vModel}' #else '${config.formId}' #end,
  509. #if($!{config.columnWidth})
  510. width: $!{config.columnWidth},
  511. #end
  512. labelWidth:#if($!{config.labelWidth})'$!{config.labelWidth}' #else '' #end,
  513. span:'$!{config.span}',
  514. tipLabel: #if($!{config.tipLabel}|| ${config.tipLabelI18nCode})#if(${config.tipLabelI18nCode}) t('${config.tipLabelI18nCode}','${config.tipLabel}') #else '${config.tipLabel}' #end #else '' #end,
  515. #set($vModelRequired="#if($!{fieLdsModel.vModel})${itemModel.aliasLowName}List-${fieLdsModel.vModel}#else${itemModel.aliasLowName}List-${config.formId}#end")
  516. required: false,
  517. #if($!{fieLdsModel.thousands}==true)
  518. thousands: ${fieLdsModel.thousands},
  519. #end
  520. style: #if(${fieLdsModel.style})${fieLdsModel.style} #else ''#end,
  521. align: #if($!{config.tableAlign}) '$!{config.tableAlign}'#else 'left'#end,
  522. fixed: #if($!{config.tableFixed} == 'left' || $!{config.tableFixed} == 'right') '$!{config.tableFixed}' #else false #end,
  523. formP: #if($!{fieLdsModel.vModel}) '${fieLdsModel.vModel}' #else '${fieLdsModel.relationField}' #end,
  524. },
  525. #end
  526. #end
  527. ];
  528. ##子表行内按键操作字段判断是否生成。及其宽度
  529. #if($context.isFlow)
  530. list = list.filter(o => judgeShow('${itemModel.aliasLowName}List-' + o.formP));
  531. #else
  532. #if(${context.columnData.useFormPermission})list = list.filter(o => hasFormP('${itemModel.tableModel}-' + o.formP)); #end
  533. #end
  534. ## 表格子表和平铺子表代码区别
  535. #if($!{itemModel.layoutType} == 'list')
  536. return list;
  537. #else
  538. const indexColumn = { title: '序号', showLabel: true, dataIndex: 'index', key: 'index', align: 'center', fixed: 'left', width: 50 };
  539. //子表复杂表头-处理
  540. let columnList = list;
  541. let complexHeaderList: any[] = #if(${itemModel.complexHeaderList}) ${itemModel.complexHeaderList}; #else []; #end
  542. if (complexHeaderList.length) {
  543. let childColumns: any[] = [];
  544. let firstChildColumns: string[] = [];
  545. for (let i = 0; i < complexHeaderList.length; i++) {
  546. const e = complexHeaderList[i];
  547. e.title = e.fullNameI18nCode ? t(e.fullNameI18nCode,e.fullName) : e.fullName;
  548. e.align = e.align;
  549. e.children = [];
  550. e.jnpfKey = 'complexHeader';
  551. if (e.childColumns?.length) {
  552. childColumns.push(...e.childColumns);
  553. for (let k = 0; k < e.childColumns.length; k++) {
  554. const item = e.childColumns[k];
  555. for (let j = 0; j < list.length; j++) {
  556. const o = list[j];
  557. if (o.key == item && o.fixed !== 'left' && o.fixed !== 'right') e.children.push({ ...o });
  558. }
  559. }
  560. }
  561. if (e.children.length) firstChildColumns.push(e.children[0].key);
  562. }
  563. complexHeaderList = complexHeaderList.filter(o => o.children.length);
  564. let newList: any[] = [];
  565. for (let i = 0; i < list.length; i++) {
  566. const e = list[i];
  567. if (!childColumns.includes(e.key) || e.fixed === 'left' || e.fixed === 'right') {
  568. newList.push(e);
  569. } else {
  570. if (firstChildColumns.includes(e.key)) {
  571. const item = complexHeaderList.find(o => o.childColumns.includes(e.key));
  572. newList.push(item);
  573. }
  574. }
  575. }
  576. columnList = newList;
  577. }
  578. let columns = [indexColumn, ...columnList]
  579. const leftFixedList = columns.filter(o => o.fixed === 'left');
  580. const rightFixedList = columns.filter(o => o.fixed === 'right');
  581. const noFixedList = columns.filter(o => o.fixed !== 'left' && o.fixed !== 'right');
  582. return [...leftFixedList, ...noFixedList, ...rightFixedList];
  583. #end
  584. });
  585. ## 子表合计参数
  586. #if($itemModel.showSummary)
  587. //子表合计字段
  588. const ${itemModel.aliasLowName}SummaryColumn = computed(() => {
  589. let defaultColumns = unref(${itemModel.aliasLowName}Columns);//子表字段
  590. let columns: any[] = [];
  591. for (let i = 0; i < defaultColumns.length; i++) {
  592. const e = defaultColumns[i];
  593. if (e.jnpfKey === 'table' || e.jnpfKey === 'complexHeader') {
  594. if (e.children?.length) columns.push(...e.children);
  595. } else {
  596. columns.push(e);
  597. }
  598. if (e.fixed && e.children?.length) {
  599. for (let j = 0; j < e.children.length; j++) {
  600. e.children[j].fixed = e.fixed;
  601. }
  602. }
  603. }
  604. return columns.filter(o => o?.key != 'index' && o?.key != 'action');
  605. });
  606. //合计方法
  607. const get${itemModel.aliasUpName}ColumnSum = computed(() => {
  608. const sums: any[] = [];
  609. const summaryField: any[] = #if(${itemModel.summaryField}) ${itemModel.summaryField} #else [] #end;
  610. const useThousands = key => unref(${itemModel.aliasLowName}SummaryColumn).some(o => o.key === key && o.thousands);
  611. const isSummary = key => summaryField.includes(key);
  612. const list = unref(${itemModel.aliasLowName}SummaryColumn).filter(o => o.key !== 'index' && o.key !== 'action');
  613. list.forEach((column, index) => {
  614. let sumVal = state.dataForm.${itemModel.tableModel}.reduce((sum, d) => sum + + Number(getCmpValOfRow(d, column.key, summaryField || [])), 0);
  615. if (!isSummary(column.key)) sumVal = '';
  616. sumVal = Number.isNaN(sumVal) ? '' : sumVal;
  617. const realVal = sumVal && !Number.isInteger(Number(sumVal)) ? Number(sumVal).toFixed(2) : sumVal;
  618. sums[index] = useThousands(column.key) ? thousandsFormat(realVal) : realVal.toString();
  619. });
  620. return sums;
  621. });
  622. //合计对齐
  623. function get${itemModel.aliasUpName}SummaryCellAlign(index) {
  624. if (!unref(${itemModel.aliasLowName}SummaryColumn).length) return;
  625. return unref(${itemModel.aliasLowName}SummaryColumn)[index]?.align || 'left';
  626. }
  627. #end
  628. #end
  629. #end
  630. ## 生成掩码配置
  631. #macro(CreateMaskConfig)
  632. {
  633. #foreach($fieLdsModel in ${context.fields})
  634. #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
  635. #set($vModel = "${html.vModel}")
  636. #set($config = $html.config)
  637. #set($jnpfkey = $config.jnpfKey)
  638. #if($jnpfkey == "input")
  639. ${vModel}:#if(${html.maskConfig}) ${html.maskConfig} #else {}#end,
  640. #end
  641. #end
  642. #foreach($child in ${context.children})
  643. #set($aliasname = "${child.aliasLowName}")
  644. #foreach($fieLdsModel in ${child.childList})
  645. #set($html = $fieLdsModel.fieLdsModel)
  646. #set($vModel = "${html.vModel}")
  647. #set($config = $html.config)
  648. #set($jnpfkey = $config.jnpfKey)
  649. #if($jnpfkey == "input")
  650. ${aliasname}${vModel}:#if(${html.maskConfig}) ${html.maskConfig} #else {}#end,
  651. #end
  652. #end
  653. #end
  654. #foreach($ChildField in ${context.columnChildren})
  655. #foreach($FormMastTableModel in ${ChildField.fieLdsModelList})
  656. #set($html = ${FormMastTableModel.mastTable.fieLdsModel})
  657. #set($jnpfKey = ${html.config.jnpfKey})
  658. #set($ChildVmodel =${FormMastTableModel.vModel})
  659. #if(${jnpfKey} == "input")
  660. ${ChildVmodel}:#if(${html.maskConfig}) ${html.maskConfig} #else {}#end,
  661. #end
  662. #end
  663. #end
  664. }
  665. #end
  666. ## 生成定位配置
  667. #macro(CreateLocationScope)
  668. {
  669. #foreach($fieLdsModel in ${context.fields})
  670. #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
  671. #set($vModel = "${html.vModel}")
  672. #set($config = $html.config)
  673. #set($jnpfkey = $config.jnpfKey)
  674. #if($jnpfkey == "location")
  675. ${vModel}:#if(${html.locationScope}) ${html.locationScope} #else []#end,
  676. #end
  677. #end
  678. #foreach($child in ${context.children})
  679. #set($aliasname = "${child.aliasLowName}")
  680. #foreach($fieLdsModel in ${child.childList})
  681. #set($html = $fieLdsModel.fieLdsModel)
  682. #set($vModel = "${html.vModel}")
  683. #set($config = $html.config)
  684. #set($jnpfkey = $config.jnpfKey)
  685. #if($jnpfkey == "location")
  686. ${aliasname}${vModel}:#if(${html.locationScope}) ${html.locationScope} #else []#end,
  687. #end
  688. #end
  689. #end
  690. #foreach($ChildField in ${context.columnChildren})
  691. #foreach($FormMastTableModel in ${ChildField.fieLdsModelList})
  692. #set($html = ${FormMastTableModel.mastTable.fieLdsModel})
  693. #set($jnpfKey = ${html.config.jnpfKey})
  694. #set($ChildVmodel =${FormMastTableModel.vModel})
  695. #if(${jnpfKey} == "location")
  696. ${ChildVmodel}:#if(${html.locationScope}) ${html.locationScope} #else []#end,
  697. #end
  698. #end
  699. #end
  700. }
  701. #end
  702. ## 生成关联表单和弹窗展示配置
  703. #macro(CreateExtraOptions)
  704. {
  705. #foreach($fieLdsModel in ${context.fields})
  706. #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
  707. #set($vModel = "${html.vModel}")
  708. #set($jnpfkey = $html.config.jnpfKey)
  709. #if($jnpfkey == "relationForm" || $jnpfkey == "popupSelect")
  710. ${vModel}:[#foreach($options in ${html.extraOptions}) {"label":"${options.label}","value":"${options.value}"},#end],
  711. #end
  712. #end
  713. #foreach($ChildField in ${context.columnChildren})
  714. #foreach($FormMastTableModel in ${ChildField.fieLdsModelList})
  715. #set($html = ${FormMastTableModel.mastTable.fieLdsModel})
  716. #set($jnpfKey = ${html.config.jnpfKey})
  717. #set($ChildVmodel =${FormMastTableModel.vModel})
  718. #if(${jnpfKey} == "relationForm" || ${jnpfKey} == "popupSelect")
  719. ${ChildVmodel}:[#foreach($options in ${html.extraOptions}) {"label":"${options.label}","value":"${options.value}"},#end],
  720. #end
  721. #end
  722. #end
  723. }
  724. #end
  725. ## 生成关联表单和弹窗展示配置
  726. #macro(CreateExtraData)
  727. {
  728. #foreach($fieLdsModel in ${context.fields})
  729. #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
  730. #set($vModel = "${html.vModel}")
  731. #set($jnpfkey = $html.config.jnpfKey)
  732. #if($jnpfkey == "relationForm" || $jnpfkey == "popupSelect")
  733. ${vModel}:{},
  734. #end
  735. #end
  736. #foreach($ChildField in ${context.columnChildren})
  737. #foreach($FormMastTableModel in ${ChildField.fieLdsModelList})
  738. #set($html = ${FormMastTableModel.mastTable.fieLdsModel})
  739. #set($jnpfKey = ${html.config.jnpfKey})
  740. #set($ChildVmodel =${FormMastTableModel.vModel})
  741. #if(${jnpfKey} == "relationForm" || ${jnpfKey} == "popupSelect")
  742. ${ChildVmodel}:{},
  743. #end
  744. #end
  745. #end
  746. }
  747. #end
  748. #macro(ExtraInfoFun)
  749. #foreach($fieLdsModel in ${context.form})
  750. #if($fieLdsModel.jnpfKey != 'table')
  751. #if($fieLdsModel.jnpfKey =='mast')
  752. #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
  753. #set($vModel =${html.vModel})
  754. #else
  755. #set($html = ${fieLdsModel.formMastTableModel.mastTable.fieLdsModel})
  756. #set($vModel =${fieLdsModel.formMastTableModel.vModel})
  757. #end
  758. #set($jnpfkey = ${html.config.jnpfKey})
  759. #if($jnpfkey == "relationForm")
  760. function get${vModel}ExtraInfo(){
  761. if (!state.dataForm.${vModel}_id) return;
  762. let query: any = {
  763. id: state.dataForm.${vModel}_id,
  764. #if(${html.propsValue})propsValue: '${html.propsValue}'#end
  765. };
  766. getDataChange('${html.modelId}', query).then(res => {
  767. if (!res.data || !res.data.data) return;
  768. const data = JSON.parse(res.data.data);
  769. state.extraData.${vModel} = data;
  770. });
  771. }
  772. #end
  773. #if($jnpfkey == "popupSelect")
  774. function get${vModel}ExtraInfo() {
  775. if (!state.dataForm.${vModel}_id) return;
  776. const paramList = getParamList('${vModel}');
  777. const query = {
  778. ids: [state.dataForm.${vModel}_id],
  779. interfaceId: '${html.interfaceId}',
  780. propsValue: '${html.propsValue}',
  781. relationField: '${html.relationField}',
  782. paramList,
  783. };
  784. getDataInterfaceDataInfoByIds('${html.interfaceId}', query).then(res => {
  785. const data = res.data && res.data.length ? res.data[0] : {};
  786. state.extraData.${vModel} = data;
  787. });
  788. }
  789. #end
  790. #end
  791. #end
  792. #end
  793. #macro(runAllExtraFun)
  794. #foreach($fieLdsModel in ${context.form})
  795. #if($fieLdsModel.jnpfKey != 'table')
  796. #if($fieLdsModel.jnpfKey =='mast')
  797. #set($html = $fieLdsModel.formColumnModel.fieLdsModel)
  798. #set($vModel =${html.vModel})
  799. #else
  800. #set($html = ${fieLdsModel.formMastTableModel.mastTable.fieLdsModel})
  801. #set($vModel =${fieLdsModel.formMastTableModel.vModel})
  802. #end
  803. #set($jnpfkey = ${html.config.jnpfKey})
  804. #if($jnpfkey == "relationForm" || $jnpfkey == "popupSelect")
  805. get${vModel}ExtraInfo();
  806. #end
  807. #end
  808. #end
  809. #end