editForm.vue.vm 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <a-drawer
  3. width="45%"
  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. #set($colSpan = $column.colSpan * 6 )
  30. #if($column.htmlType == "input")
  31. <a-col :span="${colSpan}">
  32. <a-form-model-item label="${comment}" prop="${column.javaField}">
  33. <a-input v-model="form.${column.javaField}" placeholder="请输入${comment}"/>
  34. </a-form-model-item>
  35. </a-col>
  36. #elseif($column.htmlType == "textarea")
  37. <a-col :span="${colSpan}">
  38. <a-form-model-item label="${comment}" prop="${column.javaField}">
  39. <a-textarea v-model="form.${column.javaField}" placeholder="请输入${comment}" :rows="4"/>
  40. </a-form-model-item>
  41. </a-col>
  42. #elseif(($column.htmlType == "number"))
  43. <a-col :span="${colSpan}">
  44. <a-form-model-item label="${comment}" prop="${column.javaField}">
  45. <a-input-number v-model="form.${column.javaField}" :min="0" style="width: 100%"/>
  46. </a-form-model-item>
  47. </a-col>
  48. #elseif(($column.htmlType == "datetime"))
  49. <a-col :span="${colSpan}">
  50. <a-form-model-item label="${comment}" prop="${column.javaField}">
  51. <a-date-picker
  52. v-model="form.${column.javaField}"
  53. valueFormat="YYYY-MM-DD"
  54. :show-today="true"
  55. placeholder="选择日期"
  56. style="width: 100%"
  57. />
  58. </a-form-model-item>
  59. </a-col>
  60. #elseif(($column.htmlType == "time"))
  61. <a-col :span="${colSpan}" >
  62. <a-form-model-item label="${comment}" prop="${column.javaField}">
  63. <a-date-picker
  64. v-model="form.${column.javaField}"
  65. valueFormat="YYYY-MM-DD"
  66. :show-today="true"
  67. placeholder="选择日期"
  68. style="width: 100%"
  69. />
  70. </a-form-model-item>
  71. </a-col>
  72. #elseif(($column.htmlType == "select") && "" != $dictType)
  73. <a-col :span="${colSpan}" >
  74. <a-form-model-item label="${comment}" prop="${column.javaField}">
  75. <a-select
  76. placeholder="请选择${comment}"
  77. v-model="form.${column.javaField}"
  78. :getPopupContainer="
  79. triggerNode => {
  80. return triggerNode.parentNode || document.body
  81. }
  82. "
  83. style="width: 100%"
  84. allow-clear>
  85. <a-select-option v-for="(d, index) in ${column.javaField}Options" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option>
  86. </a-select>
  87. </a-form-model-item>
  88. </a-col>
  89. #elseif(($column.htmlType == "selectMultiple") && "" != $dictType)
  90. <a-col :span="${colSpan}" >
  91. <a-form-model-item label="${comment}" prop="${column.javaField}">
  92. <a-select
  93. placeholder="请选择${comment}"
  94. v-model="form.${column.javaField}"
  95. :getPopupContainer="
  96. triggerNode => {
  97. return triggerNode.parentNode || document.body
  98. }
  99. "
  100. style="width: 100%"
  101. mode="multiple"
  102. allow-clear>
  103. <a-select-option v-for="(dict, index) in ${column.javaField}Options" :key="index" :value="dict.dictValue">{{ dict.dictLabel }}</a-select-option>
  104. </a-select>
  105. </a-form-model-item>
  106. </a-col>
  107. #elseif(($column.htmlType == "radio") && "" != $dictType)
  108. <a-col :span="${colSpan}" >
  109. <a-form-model-item label="${comment}" prop="${column.javaField}">
  110. <a-radio-group v-model="form.${column.javaField}" button-style="solid">
  111. <a-radio-button
  112. v-for="(dict, index) in ${column.javaField}Options"
  113. :key="index"
  114. :value="dict.dictValue"
  115. >
  116. {{ dict.dictLabel }}
  117. </a-radio-button>
  118. </a-radio-group>
  119. </a-form-model-item>
  120. </a-col>
  121. #elseif(($column.htmlType == "checkbox") && "" != $dictType)
  122. <a-col :span="${colSpan}" >
  123. <a-form-model-item label="${comment}" prop="${column.javaField}">
  124. <a-checkbox-group v-model="form.${column.javaField}" button-style="solid">
  125. <a-checkbox
  126. v-for="(dict, index) in ${column.javaField}Options"
  127. :key="index"
  128. :value="dict.dictValue"
  129. >
  130. {{ dict.dictLabel }}
  131. </a-checkbox >
  132. </a-checkbox-group>
  133. </a-form-model-item>
  134. </a-col>
  135. #elseif(($column.htmlType == "user"))
  136. <a-col :span="${colSpan}" >
  137. <a-form-model-item label="${comment}" prop="${column.javaField}">
  138. <select-user
  139. v-model="form.${column.javaField}"
  140. select-model="single"
  141. />
  142. </a-form-model-item>
  143. </a-col>
  144. #elseif(($column.htmlType == "dept"))
  145. <a-col :span="${colSpan}" >
  146. <a-form-model-item label="${comment}" prop="${column.javaField}">
  147. <select-dept
  148. v-model="form.${column.javaField}"
  149. select-model="single"
  150. select-scope="all"
  151. />
  152. </a-form-model-item>
  153. </a-col>
  154. #end
  155. #if($column.isNewRow == '1' && $listSize != $!velocityCount)
  156. </a-row>
  157. <a-row :gutter="32">
  158. #end
  159. #end
  160. #if($hasAttach)
  161. <a-col :lg="24" :md="24" :sm="24">
  162. <a-form-model-item label="附件">
  163. <sys-upload
  164. key="1"
  165. element-id="1"
  166. form-type="edit"
  167. :drag-uploader="true"
  168. :multiple="true"
  169. :file-size-limit="40"
  170. :ref="attachmentRefName"
  171. :allow-encry="false"
  172. :allow-same-name="false"
  173. :allow-preview="true"
  174. :allow-download="true"
  175. :allow-delete="true"
  176. :chunk-enabled="true"
  177. :colspan="2"
  178. :form-id="formId"
  179. :file-num-limit="10"
  180. table-name="${tableName}"
  181. @afterUpload="uploadCompleteFile"
  182. />
  183. </a-form-model-item>
  184. </a-col>
  185. #end
  186. </a-row>
  187. </a-spin>
  188. <div class="bottom-control">
  189. <a-space>
  190. <a-button :disabled="disabled" @click="cancel">
  191. 取消
  192. </a-button>
  193. <a-button type="primary" :disabled="disabled" @click="submitForm">
  194. 保存
  195. </a-button>
  196. </a-space>
  197. </div>
  198. </a-form-model>
  199. </a-drawer>
  200. </template>
  201. <script>
  202. import ${BusinessName}EditForm from './${BusinessName}Form'
  203. export default {
  204. ...${BusinessName}EditForm
  205. }
  206. </script>