data.ts.btl 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. import { listDictModel } from '/@/api/common';
  2. import { DescItem } from '/@/components/Description';
  3. import { BasicColumn, FormSchema } from '/@/components/Table';
  4. import { radioBoolean } from '/@/utils/filters';
  5. export const columns: BasicColumn[] = [
  6. <% for(var i = 0; i < configList.~size; i++) { %>
  7. <% if(configList[i].fieldNameCamelCase != "createBy" &&configList[i].fieldNameCamelCase != "updateBy" && configList[i].fieldNameCamelCase != "tenantId" && configList[i].fieldNameCamelCase!= "deleted" && configList[i].whetherTable) {%>
  8. {
  9. title: '${configList[i].fieldRemark}',
  10. dataIndex: '${configList[i].fieldNameCamelCase}',
  11. },
  12. <% } %>
  13. <% } %>
  14. ];
  15. // 表单列定义
  16. export const searchFormSchema: FormSchema[] = [
  17. <% for(var i = 0; i < configList.~size; i++) { %>
  18. <% if(configList[i].fieldNameCamelCase != "createBy" &&configList[i].fieldNameCamelCase != "updateBy" && configList[i].fieldNameCamelCase != "tenantId" && configList[i].fieldNameCamelCase!= "deleted" && configList[i].queryWhether) {%>
  19. {
  20. label: '${configList[i].fieldRemark}',
  21. field: '${configList[i].fieldNameCamelCase}',
  22. <% if(configList[i].effectType == "input"){ %>
  23. component: 'Input',
  24. componentProps: {
  25. placeholder: '请输入${configList[i].fieldRemark}',
  26. }
  27. <% } %>
  28. <% if(configList[i].effectType == "inputTextArea"){ %>
  29. component: 'InputTextArea',
  30. componentProps: {
  31. placeholder: '请输入${configList[i].fieldRemark}',
  32. }
  33. <% } %>
  34. <% if(configList[i].effectType == "inputNumber"){ %>
  35. component: 'InputNumber',
  36. componentProps: {
  37. placeholder: '请输入${configList[i].fieldRemark}',
  38. }
  39. <% } %>
  40. <% if(configList[i].effectType == "select"){ %>
  41. component: 'Select',
  42. componentProps: {
  43. options: [{ label: '', value: '' }],
  44. },
  45. <% } %>
  46. <% if(configList[i].effectType == "apiSelect"){ %>
  47. component: 'ApiSelect',
  48. componentProps: {
  49. api: listDictModel,
  50. params: {
  51. dictCode: '${configList[i].dictTypeCode}',
  52. },
  53. }
  54. <% } %>
  55. <% if(configList[i].effectType == "switch"){ %>
  56. component: 'Switch',
  57. componentProps: {
  58. options: radioBoolean,
  59. }
  60. <% } %>
  61. <% if(configList[i].effectType == "radioGroup"){ %>
  62. component: 'RadioGroup',
  63. required: true,
  64. componentProps: {
  65. options: radioBoolean,
  66. }
  67. <% } %>
  68. <% if(configList[i].effectType == "apiRadioGroup"){ %>
  69. component: 'ApiRadioGroup',
  70. componentProps: {
  71. api: listDictModel,
  72. params: {
  73. dictCode: '${configList[i].dictTypeCode}',
  74. }
  75. }
  76. <% } %>
  77. <% if(configList[i].effectType == "checkboxGroup"){ %>
  78. component: 'CheckboxGroup',
  79. componentProps: {
  80. options: [{label: '选项1',value: '1',}]
  81. }
  82. <% } %>
  83. <% if(configList[i].effectType == "datePicker"){ %>
  84. component: 'DatePicker',
  85. componentProps: {
  86. placeholder: '请选择时间',
  87. format: 'YYYY-MM-DD HH:mm:ss',
  88. showTime: { format: 'YYYY-MM-DD HH:mm:ss' },
  89. }
  90. <% } %>
  91. <% if(configList[i].effectType == "upload"){ %>
  92. component: 'Input',
  93. slot: 'upload',
  94. componentProps: {
  95. placeholder: '请上传图片',
  96. },
  97. <% } %>
  98. <% if(configList[i].effectType == "textEditor"){ %>
  99. component: 'textEditor',
  100. componentProps: ({ formModel }) => {
  101. return {
  102. height: 300,
  103. onChange: (e) => {
  104. formModel.${configList[i].fieldNameCamelCase} = e;
  105. },
  106. };
  107. }
  108. <% } %>
  109. },
  110. <% } %>
  111. <% } %>
  112. ];
  113. // 表单新增编辑
  114. export const dataFormSchema: FormSchema[] = [
  115. <% for(var i = 0; i < configList.~size; i++) { %>
  116. <% if(configList[i].fieldNameCamelCase != "createBy" &&configList[i].fieldNameCamelCase != "updateBy" && configList[i].fieldNameCamelCase != "tenantId" && configList[i].fieldNameCamelCase!= "deleted" && configList[i].whetherAddUpdate) {%>
  117. {
  118. label: '${configList[i].fieldRemark}',
  119. field: '${configList[i].fieldNameCamelCase}',
  120. <% if(configList[i].effectType == "input"){ %>
  121. required: true,
  122. <% } %>
  123. <% if(configList[i].effectType == "input"){ %>
  124. component: 'Input',
  125. componentProps: {
  126. placeholder: '请输入${configList[i].fieldRemark}',
  127. }
  128. <% } %>
  129. <% if(configList[i].effectType == "inputTextArea"){ %>
  130. component: 'InputTextArea',
  131. componentProps: {
  132. placeholder: '请输入${configList[i].fieldRemark}',
  133. }
  134. <% } %>
  135. <% if(configList[i].effectType == "inputNumber"){ %>
  136. component: 'InputNumber',
  137. componentProps: {
  138. placeholder: '请输入${configList[i].fieldRemark}',
  139. }
  140. <% } %>
  141. <% if(configList[i].effectType == "select"){ %>
  142. component: 'Select',
  143. componentProps: {
  144. options: [{ label: '', value: '' }],
  145. },
  146. <% } %>
  147. <% if(configList[i].effectType == "apiSelect"){ %>
  148. component: 'ApiSelect',
  149. componentProps: {
  150. api: listDictModel,
  151. params: {
  152. dictCode: '${configList[i].dictTypeCode}',
  153. },
  154. }
  155. <% } %>
  156. <% if(configList[i].effectType == "switch"){ %>
  157. component: 'Switch',
  158. componentProps: {
  159. options: radioBoolean,
  160. }
  161. <% } %>
  162. <% if(configList[i].effectType == "radioGroup"){ %>
  163. component: 'RadioGroup',
  164. required: true,
  165. componentProps: {
  166. options: radioBoolean,
  167. }
  168. <% } %>
  169. <% if(configList[i].effectType == "apiRadioGroup"){ %>
  170. component: 'ApiRadioGroup',
  171. componentProps: {
  172. api: listDictModel,
  173. params: {
  174. dictCode: '${configList[i].dictTypeCode}',
  175. }
  176. }
  177. <% } %>
  178. <% if(configList[i].effectType == "checkboxGroup"){ %>
  179. component: 'CheckboxGroup',
  180. componentProps: {
  181. options: [{label: '选项1',value: '1',}]
  182. }
  183. <% } %>
  184. <% if(configList[i].effectType == "datePicker"){ %>
  185. component: 'DatePicker',
  186. componentProps: {
  187. placeholder: '请选择时间',
  188. format: 'YYYY-MM-DD HH:mm:ss',
  189. showTime: { format: 'YYYY-MM-DD HH:mm:ss' },
  190. }
  191. <% } %>
  192. <% if(configList[i].effectType == "upload"){ %>
  193. component: 'Input',
  194. slot: 'upload',
  195. componentProps: {
  196. placeholder: '请上传图片',
  197. },
  198. <% } %>
  199. <% if(configList[i].effectType == "textEditor"){ %>
  200. component: 'textEditor',
  201. componentProps: ({ formModel }) => {
  202. return {
  203. height: 300,
  204. onChange: (e) => {
  205. formModel.${configList[i].fieldNameCamelCase} = e;
  206. },
  207. };
  208. }
  209. <% } %>
  210. },
  211. <% } %>
  212. <% } %>
  213. ];
  214. // 表单详情查看
  215. export const viewSchema: DescItem[] = [
  216. <% for(var i = 0; i < configList.~size; i++) { %>
  217. <% if(configList[i].fieldNameCamelCase != "createBy" &&configList[i].fieldNameCamelCase != "updateBy" && configList[i].fieldNameCamelCase != "tenantId" && configList[i].fieldNameCamelCase!= "deleted" ) {%>
  218. {
  219. label: '${configList[i].fieldRemark}',
  220. field: '${configList[i].fieldNameCamelCase}',
  221. },
  222. <% } %>
  223. <% } %>
  224. ];