addForm.vue.vm 7.3 KB

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