123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- import { BasicColumn } from '/@/components/Table';
- import { FormSchema } from '/@/components/Table';
- import { rules } from '/@/utils/helper/validator';
- import { render } from '/@/utils/common/renderUtils';
- import { getWeekMonthQuarterYear } from '/@/utils';
- import { h } from 'vue';
- import { Switch } from 'ant-design-vue';
- import { saveOrUpdate } from './hot.api';
- //列表数据
- export const columns: BasicColumn[] = [
- {
- title: '名称',
- align: 'center',
- dataIndex: 'searchContent',
- },
- {
- title: '显示顺序',
- align: 'center',
- dataIndex: 'sort',
- },
- {
- title: '有效时间',
- align: 'center',
- dataIndex: 'isActive',
- customRender: ({ record }) => {
- return `${record.startTime} 至 ${record.endTime}`;
- },
- },
- {
- title: '搜索次数',
- align: 'center',
- dataIndex: 'searchCount',
- },
- {
- title: '状态',
- align: 'center',
- dataIndex: 'isRecommend',
- customRender: ({ record }) => {
- return h(Switch, {
- checked: record.isActive,
- unCheckedValue: 0,
- checkedValue: 1,
- onChange(e) {
- record.isActive = e;
- saveOrUpdate({ ...record, isActive: e, id: record.id }, true);
- },
- });
- },
- },
- ];
- //查询数据
- export const searchFormSchema: FormSchema[] = [
- {
- field: 'name',
- label: '名称',
- component: 'Input',
- colProps: {
- span: 6,
- },
- },
- ];
- //表单数据
- export const formSchema: FormSchema[] = [
- {
- label: '名称',
- field: 'searchContent',
- component: 'Input',
- required: true,
- },
- {
- label: '显示顺序',
- field: 'sort',
- required: true,
- component: 'InputNumber',
- },
- {
- label: '有效时间',
- field: 'Time',
- component: 'RangePicker',
- required: true,
- componentProps: {
- format: 'YYYY-MM-DD',
- valueFormat: 'YYYY-MM-DD',
- },
- },
- // {
- // label: '搜索次数',
- // field: 'searchCount',
- // required: true,
- // component: 'InputNumber',
- // },
- {
- label: '状态',
- field: 'isActive',
- required: true,
- component: 'Switch',
- defaultValue: 1,
- componentProps: {
- checkedChildren: '启用',
- unCheckedChildren: '禁用',
- unCheckedValue: 0,
- checkedValue: 1,
- },
- },
- // TODO 主键隐藏字段,目前写死为ID
- {
- label: '',
- field: 'id',
- component: 'Input',
- show: false,
- },
- ];
- /**
- * 流程表单调用这个方法获取formSchema
- * @param param
- */
- export function getBpmFormSchema(_formData): FormSchema[] {
- // 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
- return formSchema;
- }
|