GenerateColItem.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <a-row
  3. :class="{
  4. [element.options && element.options.customClass]: element.options && element.options.customClass?true: false
  5. }"
  6. :type="element.options.flex ? 'flex' : ''"
  7. :gutter="element.options.gutter || 0"
  8. :justify="element.options.justify"
  9. :align="element.options.align"
  10. v-if="elementDisplay"
  11. >
  12. <template v-for="(item, index) in element.columns" :key="index">
  13. <a-col
  14. v-if="!hideCols.includes(index)"
  15. :xs="item.options ? getColXS(item.options) : item.span"
  16. :sm="item.options ? getColXS(item.options) : item.span"
  17. :md="item.options ? getColSM(item.options) : item.span"
  18. :lg="item.options ? getColMD(item.options) : item.span"
  19. :offset="item.options ? item.options.offset : 0"
  20. :push="item.options ? item.options.push : 0"
  21. :pull="item.options ? item.options.pull : 0"
  22. :class="{
  23. [item.options && item.options.customClass]: item.options && item.options.customClass?true: false
  24. }"
  25. >
  26. <template v-for="col in item.list">
  27. <generate-col-item
  28. v-if="col.type == 'grid'"
  29. :key="`grid-${col.key}`"
  30. :model="dataModels"
  31. :rules="rules"
  32. :element="col"
  33. :remote="remote"
  34. :blanks="blanks"
  35. :display="display"
  36. :sub-hide-fields="subHideFields"
  37. :sub-disabled-fields="subDisabledFields"
  38. :edit="edit"
  39. :remote-option="remoteOption"
  40. :platform="platform"
  41. :preview="preview"
  42. :container-key="containerKey"
  43. :data-source-value="dataSourceValue"
  44. :event-function="eventFunction"
  45. :print-read="printRead"
  46. :config="config"
  47. :is-subform="isSubform"
  48. :row-index="rowIndex"
  49. :sub-name="subName"
  50. :is-dialog="isDialog"
  51. :dialog-name="dialogName"
  52. :is-group="isGroup"
  53. :group="group"
  54. :field-node="fieldNode"
  55. >
  56. <template v-slot:[blank.name]="scope" v-for="blank in blanks">
  57. <slot :name="blank.name" :model="scope.model"></slot>
  58. </template>
  59. </generate-col-item>
  60. <generate-tab-item
  61. v-else-if="col.type == 'tabs'"
  62. :key="`tabs-${col.key}`"
  63. :model="dataModels"
  64. :rules="rules"
  65. :element="col"
  66. :remote="remote"
  67. :blanks="blanks"
  68. :display="display"
  69. :sub-hide-fields="subHideFields"
  70. :sub-disabled-fields="subDisabledFields"
  71. :edit="edit"
  72. :remote-option="remoteOption"
  73. :platform="platform"
  74. :preview="preview"
  75. :container-key="containerKey"
  76. :data-source-value="dataSourceValue"
  77. :event-function="eventFunction"
  78. :print-read="printRead"
  79. :config="config"
  80. :is-subform="isSubform"
  81. :row-index="rowIndex"
  82. :sub-name="subName"
  83. :is-dialog="isDialog"
  84. :dialog-name="dialogName"
  85. :is-group="isGroup"
  86. :group="group"
  87. :field-node="fieldNode"
  88. >
  89. <template v-slot:[blank.name]="scope" v-for="blank in blanks">
  90. <slot :name="blank.name" :model="scope.model"></slot>
  91. </template>
  92. </generate-tab-item>
  93. <generate-collapse
  94. v-else-if="col.type == 'collapse'"
  95. :key="`collapse-${col.key}`"
  96. :model="dataModels"
  97. :rules="rules"
  98. :element="col"
  99. :remote="remote"
  100. :blanks="blanks"
  101. :display="display"
  102. :sub-hide-fields="subHideFields"
  103. :sub-disabled-fields="subDisabledFields"
  104. :edit="edit"
  105. :remote-option="remoteOption"
  106. :platform="platform"
  107. :preview="preview"
  108. :container-key="containerKey"
  109. :data-source-value="dataSourceValue"
  110. :event-function="eventFunction"
  111. :print-read="printRead"
  112. :config="config"
  113. :is-subform="isSubform"
  114. :row-index="rowIndex"
  115. :sub-name="subName"
  116. :is-dialog="isDialog"
  117. :dialog-name="dialogName"
  118. :is-group="isGroup"
  119. :group="group"
  120. :field-node="fieldNode"
  121. >
  122. <template v-slot:[blank.name]="scope" v-for="blank in blanks">
  123. <slot :name="blank.name" :model="scope.model"></slot>
  124. </template>
  125. </generate-collapse>
  126. <generate-report
  127. v-else-if="col.type == 'report'"
  128. :key="`report-${col.key}`"
  129. :model="dataModels"
  130. :rules="rules"
  131. :element="col"
  132. :remote="remote"
  133. :blanks="blanks"
  134. :display="display"
  135. :sub-hide-fields="subHideFields"
  136. :sub-disabled-fields="subDisabledFields"
  137. :edit="edit"
  138. :remote-option="remoteOption"
  139. :platform="platform"
  140. :preview="preview"
  141. :container-key="containerKey"
  142. :data-source-value="dataSourceValue"
  143. :event-function="eventFunction"
  144. :print-read="printRead"
  145. :config="config"
  146. :is-subform="isSubform"
  147. :row-index="rowIndex"
  148. :sub-name="subName"
  149. :is-dialog="isDialog"
  150. :dialog-name="dialogName"
  151. :is-group="isGroup"
  152. :group="group"
  153. :field-node="fieldNode"
  154. >
  155. <template v-slot:[blank.name]="scope" v-for="blank in blanks">
  156. <slot :name="blank.name" :model="scope.model"></slot>
  157. </template>
  158. </generate-report>
  159. <generate-card
  160. v-else-if="col.type == 'card'"
  161. :key="`card-${col.key}`"
  162. :model="dataModels"
  163. :rules="rules"
  164. :element="col"
  165. :remote="remote"
  166. :blanks="blanks"
  167. :display="display"
  168. :sub-hide-fields="subHideFields"
  169. :sub-disabled-fields="subDisabledFields"
  170. :edit="edit"
  171. :remote-option="remoteOption"
  172. :platform="platform"
  173. :preview="preview"
  174. :container-key="containerKey"
  175. :data-source-value="dataSourceValue"
  176. :event-function="eventFunction"
  177. :print-read="printRead"
  178. :config="config"
  179. :is-subform="isSubform"
  180. :row-index="rowIndex"
  181. :sub-name="subName"
  182. :is-dialog="isDialog"
  183. :dialog-name="dialogName"
  184. :is-group="isGroup"
  185. :group="group"
  186. :field-node="fieldNode"
  187. >
  188. <template v-slot:[blank.name]="scope" v-for="blank in blanks">
  189. <slot :name="blank.name" :model="scope.model"></slot>
  190. </template>
  191. </generate-card>
  192. <generate-inline
  193. v-else-if="col.type == 'inline'"
  194. :key="`inline-${col.key}`"
  195. :model="dataModels"
  196. :rules="rules"
  197. :element="col"
  198. :remote="remote"
  199. :blanks="blanks"
  200. :display="display"
  201. :sub-hide-fields="subHideFields"
  202. :sub-disabled-fields="subDisabledFields"
  203. :edit="edit"
  204. :remote-option="remoteOption"
  205. :platform="platform"
  206. :preview="preview"
  207. :container-key="containerKey"
  208. :data-source-value="dataSourceValue"
  209. :event-function="eventFunction"
  210. :print-read="printRead"
  211. :config="config"
  212. :is-subform="isSubform"
  213. :row-index="rowIndex"
  214. :sub-name="subName"
  215. :is-dialog="isDialog"
  216. :dialog-name="dialogName"
  217. :is-group="isGroup"
  218. :group="group"
  219. :field-node="fieldNode"
  220. >
  221. <template v-slot:[blank.name]="scope" v-for="blank in blanks">
  222. <slot :name="blank.name" :model="scope.model"></slot>
  223. </template>
  224. </generate-inline>
  225. <generate-form-item
  226. v-else
  227. :key="`form-item-${col.key}`"
  228. :models="dataModels"
  229. :rules="rules"
  230. :widget="col"
  231. :remote="remote"
  232. :blanks="blanks"
  233. :display="display"
  234. :sub-hide-fields="subHideFields"
  235. :sub-disabled-fields="subDisabledFields"
  236. :edit="edit"
  237. :remote-option="remoteOption"
  238. :platform="platform"
  239. :preview="preview"
  240. :container-key="containerKey"
  241. :data-source-value="dataSourceValue"
  242. :event-function="eventFunction"
  243. :print-read="printRead"
  244. :config="config"
  245. :is-subform="isSubform"
  246. :row-index="rowIndex"
  247. :sub-name="subName"
  248. :is-dialog="isDialog"
  249. :dialog-name="dialogName"
  250. :is-group="isGroup"
  251. :group="group"
  252. :field-node="fieldNode"
  253. >
  254. <template v-slot:[blank.name]="scope" v-for="blank in blanks">
  255. <slot :name="blank.name" :model="scope.model"></slot>
  256. </template>
  257. </generate-form-item>
  258. </template>
  259. </a-col>
  260. </template>
  261. </a-row>
  262. </template>
  263. <script>
  264. import GenerateFormItem from './GenerateFormItem.vue'
  265. import GenerateInline from './GenereteInline.vue'
  266. import { defineAsyncComponent } from 'vue'
  267. import { generateColItemMixin } from '../../mixins/generateColItem'
  268. export default {
  269. name: 'generate-col-item',
  270. components: {
  271. GenerateFormItem,
  272. GenerateInline,
  273. GenerateReport: defineAsyncComponent(() => import('./GenerateReport.vue')),
  274. GenerateCollapse: defineAsyncComponent(() => import('./GenerateCollapse.vue')),
  275. GenerateTabItem: defineAsyncComponent(() => import('./GenerateTabItem.vue')),
  276. GenerateCard: defineAsyncComponent(() => import('./GenerateCard.vue')),
  277. },
  278. mixins: [generateColItemMixin],
  279. }
  280. </script>