editForm.vue.vm 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <a-drawer
  3. width="${modalWidth}"
  4. :title="formTitle"
  5. :label-col="4"
  6. :wrapper-col="14"
  7. :visible="open"
  8. :body-style="{height:'calc(100vh - 100px)',overflow:'auto'}"
  9. @close="cancel">
  10. <a-form-model ref="form" :model="form" :rules="rules" layout="vertical">
  11. <a-spin :spinning="spinning" :delay="delayTime" tip="Loading...">
  12. <a-row :gutter="32">
  13. #foreach($column in $editColumns)
  14. #set( $listSize = $!{editColumns.size()})
  15. #set( $next = $!velocityCount - 2 )
  16. #set($dictType=$column.dictType)
  17. #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
  18. #set($parentheseIndex=$column.columnComment.indexOf("("))
  19. #if($parentheseIndex != -1)
  20. #set($comment=$column.columnComment.substring(0, $parentheseIndex))
  21. #else
  22. #set($comment=$column.columnComment)
  23. #end
  24. ##这里根据不同新行概念而定,如果需要选择新行后独占一行则开启注释部分
  25. ###if($column.isNewRow == '1' && $velocityCount !=1 && ($next>=0 && $editColumns.get($next).isNewRow != '1'))
  26. ## </a-row>
  27. ## <a-row :gutter="32">
  28. ###end
  29. #if(${colSpans} == '1')
  30. #set($colSpan = $column.colSpan * 24)
  31. #elseif(${colSpans} == '2')
  32. #set($colSpan = $column.colSpan * 12)
  33. #elseif(${colSpans} == '3')
  34. #set($colSpan = $column.colSpan * 8)
  35. #elseif(${colSpans} == '4')
  36. #set($colSpan = $column.colSpan * 6)
  37. #else
  38. #set($colSpan = $column.colSpan * 12)
  39. #end
  40. #if($column.htmlType == "input")
  41. <a-col :span="${colSpan}">
  42. <a-form-model-item label="${comment}" prop="${column.javaField}">
  43. <a-input v-model="form.${column.javaField}" placeholder="请输入${comment}"/>
  44. </a-form-model-item>
  45. </a-col>
  46. #elseif($column.htmlType == "textarea")
  47. <a-col :span="${colSpan}">
  48. <a-form-model-item label="${comment}" prop="${column.javaField}">
  49. <a-textarea v-model="form.${column.javaField}" placeholder="请输入${comment}" :rows="4"/>
  50. </a-form-model-item>
  51. </a-col>
  52. #elseif(($column.htmlType == "number"))
  53. <a-col :span="${colSpan}">
  54. <a-form-model-item label="${comment}" prop="${column.javaField}">
  55. <a-input-number v-model="form.${column.javaField}" :min="0" style="width: 100%"/>
  56. </a-form-model-item>
  57. </a-col>
  58. #elseif(($column.htmlType == "datetime"))
  59. <a-col :span="${colSpan}">
  60. <a-form-model-item label="${comment}" prop="${column.javaField}">
  61. <a-date-picker
  62. v-model="form.${column.javaField}"
  63. valueFormat="YYYY-MM-DD"
  64. :show-today="true"
  65. placeholder="选择日期"
  66. style="width: 100%"
  67. />
  68. </a-form-model-item>
  69. </a-col>
  70. #elseif(($column.htmlType == "time"))
  71. <a-col :span="${colSpan}" >
  72. <a-form-model-item label="${comment}" prop="${column.javaField}">
  73. <a-date-picker
  74. v-model="form.${column.javaField}"
  75. valueFormat="YYYY-MM-DD"
  76. :show-today="true"
  77. placeholder="选择日期"
  78. style="width: 100%"
  79. />
  80. </a-form-model-item>
  81. </a-col>
  82. #elseif(($column.htmlType == "select") && "" != $dictType)
  83. <a-col :span="${colSpan}" >
  84. <a-form-model-item label="${comment}" prop="${column.javaField}">
  85. <a-select
  86. placeholder="请选择${comment}"
  87. v-model="form.${column.javaField}"
  88. :getPopupContainer="
  89. triggerNode => {
  90. return triggerNode.parentNode || document.body
  91. }
  92. "
  93. style="width: 100%"
  94. allow-clear>
  95. <a-select-option v-for="(d, index) in ${column.javaField}Options" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option>
  96. </a-select>
  97. </a-form-model-item>
  98. </a-col>
  99. #elseif(($column.htmlType == "selectMultiple") && "" != $dictType)
  100. <a-col :span="${colSpan}" >
  101. <a-form-model-item label="${comment}" prop="${column.javaField}">
  102. <a-select
  103. placeholder="请选择${comment}"
  104. v-model="form.${column.javaField}"
  105. :getPopupContainer="
  106. triggerNode => {
  107. return triggerNode.parentNode || document.body
  108. }
  109. "
  110. style="width: 100%"
  111. mode="multiple"
  112. allow-clear>
  113. <a-select-option v-for="(dict, index) in ${column.javaField}Options" :key="index" :value="dict.dictValue">{{ dict.dictLabel }}</a-select-option>
  114. </a-select>
  115. </a-form-model-item>
  116. </a-col>
  117. #elseif(($column.htmlType == "radio") && "" != $dictType)
  118. <a-col :span="${colSpan}" >
  119. <a-form-model-item label="${comment}" prop="${column.javaField}">
  120. <a-radio-group v-model="form.${column.javaField}">
  121. <a-radio
  122. v-for="(dict, index) in ${column.javaField}Options"
  123. :key="index"
  124. :value="dict.dictValue"
  125. >
  126. {{ dict.dictLabel }}
  127. </a-radio>
  128. </a-radio-group>
  129. </a-form-model-item>
  130. </a-col>
  131. #elseif(($column.htmlType == "radioButton") && "" != $dictType)
  132. <a-col :span="${colSpan}" >
  133. <a-form-model-item label="${comment}" prop="${column.javaField}">
  134. <a-radio-group v-model="form.${column.javaField}" button-style="solid">
  135. <a-radio-button
  136. v-for="(dict, index) in ${column.javaField}Options"
  137. :key="index"
  138. :value="dict.dictValue"
  139. >
  140. {{ dict.dictLabel }}
  141. </a-radio-button>
  142. </a-radio-group>
  143. </a-form-model-item>
  144. </a-col>
  145. #elseif(($column.htmlType == "checkbox") && "" != $dictType)
  146. <a-col :span="${colSpan}" >
  147. <a-form-model-item label="${comment}" prop="${column.javaField}">
  148. <a-checkbox-group v-model="form.${column.javaField}" button-style="solid">
  149. <a-checkbox
  150. v-for="(dict, index) in ${column.javaField}Options"
  151. :key="index"
  152. :value="dict.dictValue"
  153. >
  154. {{ dict.dictLabel }}
  155. </a-checkbox >
  156. </a-checkbox-group>
  157. </a-form-model-item>
  158. </a-col>
  159. #elseif(($column.htmlType == "user"))
  160. <a-col :span="${colSpan}" >
  161. <a-form-model-item label="${comment}" prop="${column.javaField}">
  162. <select-user
  163. v-model="form.${column.javaField}"
  164. select-model="single"
  165. />
  166. </a-form-model-item>
  167. </a-col>
  168. #elseif(($column.htmlType == "dept"))
  169. <a-col :span="${colSpan}" >
  170. <a-form-model-item label="${comment}" prop="${column.javaField}">
  171. <select-dept
  172. v-model="form.${column.javaField}"
  173. select-model="single"
  174. select-scope="all"
  175. />
  176. </a-form-model-item>
  177. </a-col>
  178. #end
  179. #if($column.isNewRow == '1' && $listSize != $!velocityCount)
  180. </a-row>
  181. <a-row :gutter="32">
  182. #end
  183. #end
  184. #if($hasAttach)
  185. <a-col :lg="24" :md="24" :sm="24">
  186. <a-form-model-item label="附件">
  187. <sys-upload
  188. key="1"
  189. element-id="1"
  190. form-type="edit"
  191. :drag-uploader="true"
  192. :multiple="true"
  193. :file-size-limit="40"
  194. :ref="attachmentRefName"
  195. :allow-encry="false"
  196. :allow-same-name="false"
  197. :allow-preview="true"
  198. :allow-download="true"
  199. :allow-delete="true"
  200. :chunk-enabled="true"
  201. :colspan="2"
  202. :form-id="formId"
  203. :file-num-limit="10"
  204. table-name="${tableName}"
  205. @afterUpload="uploadCompleteFile"
  206. />
  207. </a-form-model-item>
  208. </a-col>
  209. #end
  210. </a-row>
  211. </a-spin>
  212. <div class="bottom-control">
  213. <a-space>
  214. <a-button :disabled="disabled" @click="cancel">
  215. 取消
  216. </a-button>
  217. <a-button type="primary" :disabled="disabled" @click="submitForm(true)">
  218. 保存
  219. </a-button>
  220. </a-space>
  221. </div>
  222. </a-form-model>
  223. </a-drawer>
  224. </template>
  225. <script>
  226. import ${BusinessName}EditForm from './${BusinessName}Form'
  227. export default {
  228. ...${BusinessName}EditForm
  229. }
  230. </script>