hot.data.ts 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import { BasicColumn } from '/@/components/Table';
  2. import { FormSchema } from '/@/components/Table';
  3. import { rules } from '/@/utils/helper/validator';
  4. import { render } from '/@/utils/common/renderUtils';
  5. import { getWeekMonthQuarterYear } from '/@/utils';
  6. import { h } from 'vue';
  7. import { Switch } from 'ant-design-vue';
  8. import { saveOrUpdate } from './hot.api';
  9. //列表数据
  10. export const columns: BasicColumn[] = [
  11. {
  12. title: '名称',
  13. align: 'center',
  14. dataIndex: 'searchContent',
  15. },
  16. {
  17. title: '显示顺序',
  18. align: 'center',
  19. dataIndex: 'sort',
  20. },
  21. {
  22. title: '有效时间',
  23. align: 'center',
  24. dataIndex: 'isActive',
  25. customRender: ({ record }) => {
  26. return `${record.startTime} 至 ${record.endTime}`;
  27. },
  28. },
  29. {
  30. title: '搜索次数',
  31. align: 'center',
  32. dataIndex: 'searchCount',
  33. },
  34. {
  35. title: '状态',
  36. align: 'center',
  37. dataIndex: 'isRecommend',
  38. customRender: ({ record }) => {
  39. return h(Switch, {
  40. checked: record.isActive,
  41. unCheckedValue: 0,
  42. checkedValue: 1,
  43. onChange(e) {
  44. record.isActive = e;
  45. saveOrUpdate({ ...record, isActive: e, id: record.id }, true);
  46. },
  47. });
  48. },
  49. },
  50. ];
  51. //查询数据
  52. export const searchFormSchema: FormSchema[] = [
  53. {
  54. field: 'name',
  55. label: '名称',
  56. component: 'Input',
  57. colProps: {
  58. span: 6,
  59. },
  60. },
  61. ];
  62. //表单数据
  63. export const formSchema: FormSchema[] = [
  64. {
  65. label: '名称',
  66. field: 'searchContent',
  67. component: 'Input',
  68. required: true,
  69. },
  70. {
  71. label: '显示顺序',
  72. field: 'sort',
  73. required: true,
  74. component: 'InputNumber',
  75. },
  76. {
  77. label: '有效时间',
  78. field: 'Time',
  79. component: 'RangePicker',
  80. required: true,
  81. componentProps: {
  82. format: 'YYYY-MM-DD',
  83. valueFormat: 'YYYY-MM-DD',
  84. },
  85. },
  86. // {
  87. // label: '搜索次数',
  88. // field: 'searchCount',
  89. // required: true,
  90. // component: 'InputNumber',
  91. // },
  92. {
  93. label: '状态',
  94. field: 'isActive',
  95. required: true,
  96. component: 'Switch',
  97. defaultValue: 1,
  98. componentProps: {
  99. checkedChildren: '启用',
  100. unCheckedChildren: '禁用',
  101. unCheckedValue: 0,
  102. checkedValue: 1,
  103. },
  104. },
  105. // TODO 主键隐藏字段,目前写死为ID
  106. {
  107. label: '',
  108. field: 'id',
  109. component: 'Input',
  110. show: false,
  111. },
  112. ];
  113. /**
  114. * 流程表单调用这个方法获取formSchema
  115. * @param param
  116. */
  117. export function getBpmFormSchema(_formData): FormSchema[] {
  118. // 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
  119. return formSchema;
  120. }