editForm.vue.vm 9.6 KB

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