GenerateColItem.vue 10 KB

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