123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463 |
- import { FormProps, BasicColumn } from '/@/components/Table';
- import { FormSchema } from '/@/components/Form/index';
- import { adapt } from '/@/utils/adapt';
- import moment from 'moment';
- import { Tinymce } from '/@/components/Tinymce/index';
- import { h } from 'vue';
- import UploadFile from '/@/views/general/config/customComponents/UploadFile.vue';
- import CustomInput from './customCom/CustomInput.vue';
- const adaptWidth = adapt();
- export const columns: BasicColumn[] = [
- {
- title: 'ID',
- dataIndex: 'id',
- editComponentProps: {
- prefix: '$',
- },
- width: 100,
- sorter: true,
- },
- {
- title: '活动名称',
- dataIndex: 'name',
- width: 130,
- sorter: true,
- },
- {
- title: '开始日期',
- dataIndex: 'starttime',
- width: 200,
- customRender({ record }) {
- return moment(record.starttime * 1000).format('YYYY-MM-DD HH:mm:ss');
- },
- sorter: true,
- },
- {
- title: '地点',
- dataIndex: 'place',
- width: 130,
- sorter: true,
- },
- {
- title: '计划人数',
- dataIndex: 'plan',
- width: 130,
- sorter: true,
- },
- {
- title: '报名人数',
- dataIndex: 'apply',
- width: 130,
- sorter: true,
- },
- {
- title: '参加人数',
- dataIndex: 'actual',
- width: 130,
- sorter: true,
- },
- {
- title: '活动状态',
- dataIndex: 'status',
- width: 130,
- customRender({ record }) {
- const options = ['筹备', '完成', '取消'];
- return options[record.status];
- },
- sorter: true,
- },
- {
- title: '操作员',
- dataIndex: 'manager',
- width: 130,
- sorter: true,
- },
- {
- title: '备注',
- dataIndex: 'remark',
- width: 160,
- sorter: true,
- },
- {
- title: '创建日期',
- dataIndex: 'createtime',
- width: 200,
- customRender: ({ record }) => {
- const createtime = record.createtime * 1000;
- return moment(createtime).format('YYYY-MM-DD HH:mm:ss');
- },
- sorter: true,
- },
- ];
- export function getFormConfig(): Partial<FormProps> {
- return {
- labelWidth: 100,
- schemas: [
- {
- field: `id`,
- label: `ID`,
- component: 'Input',
- componentProps: {
- placeholder: 'ID',
- },
- colProps: {
- xl: 12,
- xxl: 8,
- },
- },
- {
- field: `name`,
- label: `活动名称`,
- component: 'Input',
- componentProps: {
- placeholder: '活动名称',
- },
- colProps: {
- xl: 12,
- xxl: 8,
- },
- },
- {
- field: `starttime`,
- label: `开始日期`,
- component: 'DatePicker',
- componentProps: {
- placeholder: '开始日期',
- },
- colProps: {
- xl: 12,
- xxl: 8,
- },
- },
- {
- field: `place`,
- label: `地点`,
- component: 'Input',
- componentProps: {
- placeholder: '地点',
- },
- colProps: {
- xl: 12,
- xxl: 8,
- },
- },
- {
- field: `plan`,
- label: `计划人数`,
- component: 'Input',
- componentProps: {
- placeholder: '计划人数',
- },
- colProps: {
- xl: 12,
- xxl: 8,
- },
- },
- {
- field: `apply`,
- label: `报名人数`,
- component: 'Input',
- componentProps: {
- placeholder: '报名人数',
- },
- colProps: {
- xl: 12,
- xxl: 8,
- },
- },
- {
- field: `actual`,
- label: `参加人数`,
- component: 'Input',
- componentProps: {
- placeholder: '参加人数',
- },
- colProps: {
- xl: 12,
- xxl: 8,
- },
- },
- {
- field: `status`,
- label: `活动状态`,
- component: 'Select',
- componentProps: {
- options: [
- {
- label: '筹备',
- value: 0,
- },
- {
- label: '完成',
- value: 1,
- },
- {
- label: '取消',
- value: 2,
- },
- ],
- },
- colProps: {
- xl: 12,
- xxl: 8,
- },
- },
- {
- field: `manager`,
- label: `操作员`,
- component: 'Input',
- componentProps: {
- placeholder: '操作员',
- },
- colProps: {
- xl: 12,
- xxl: 8,
- },
- },
- {
- field: `remark`,
- label: `备注`,
- component: 'Input',
- componentProps: {
- placeholder: '备注',
- },
- colProps: {
- xl: 12,
- xxl: 8,
- },
- },
- {
- field: `createtime`,
- label: `创建日期`,
- component: 'DatePicker',
- componentProps: {
- placeholder: '创建日期',
- },
- colProps: {
- xl: 12,
- xxl: 8,
- },
- },
- ],
- };
- }
- // =================popup================================
- export const schemas: FormSchema[] = [
- {
- field: 'name',
- component: 'Input',
- label: '活动名称',
- labelWidth: adaptWidth.labelWidth,
- colProps: {
- span: adaptWidth.elContainer,
- },
- componentProps: {
- placeholder: '活动名称',
- },
- required: true,
- },
- {
- field: 'starttime',
- component: 'DatePicker',
- label: '开始时间',
- labelWidth: adaptWidth.labelWidth,
- colProps: {
- span: adaptWidth.elContainer,
- },
- componentProps: {
- placeholder: '开始时间',
- showTime: true,
- },
- required: true,
- },
- {
- field: 'endtime',
- component: 'DatePicker',
- label: '结束时间',
- labelWidth: adaptWidth.labelWidth,
- colProps: {
- span: adaptWidth.elContainer,
- },
- componentProps: {
- placeholder: '结束时间',
- showTime: true,
- },
- required: true,
- },
- {
- field: 'place',
- component: 'Input',
- label: '地点',
- labelWidth: adaptWidth.labelWidth,
- colProps: {
- span: adaptWidth.elContainer,
- },
- componentProps: {
- placeholder: '地点',
- },
- required: true,
- },
- {
- field: 'plan',
- component: 'Input',
- label: '计划参加人员',
- labelWidth: adaptWidth.labelWidth,
- colProps: {
- span: adaptWidth.elContainer,
- },
- render: ({ model, field }) => {
- return h(CustomInput, {
- value: model.plan,
- placeholder: '计划参加人员',
- onChange(value) {
- model[field] = value;
- },
- });
- },
- },
- {
- field: 'apply',
- component: 'Input',
- label: '报名参加人员',
- labelWidth: adaptWidth.labelWidth,
- colProps: {
- span: adaptWidth.elContainer,
- },
- render: ({ model, field }) => {
- return h(CustomInput, {
- value: model.apply,
- placeholder: '报名参加人员',
- onChange(value) {
- model[field] = value;
- },
- });
- },
- },
- {
- field: 'actual',
- component: 'Input',
- label: '实际参加人员',
- labelWidth: adaptWidth.labelWidth,
- colProps: {
- span: adaptWidth.elContainer,
- },
- render: ({ model, field }) => {
- return h(CustomInput, {
- value: model.actual,
- placeholder: '实际参加人员',
- onChange(value) {
- model[field] = value;
- },
- });
- },
- },
- {
- field: 'content',
- component: 'InputTextArea',
- label: '活动内容',
- labelWidth: adaptWidth.labelWidth,
- colProps: {
- span: adaptWidth.elContainer,
- },
- render: ({ model, field }) => {
- return h(Tinymce, {
- value: model[field],
- onChange: (value: string) => {
- model[field] = value;
- },
- });
- },
- },
- {
- field: 'hire',
- component: 'InputTextArea',
- label: '集体租赁',
- labelWidth: adaptWidth.labelWidth,
- colProps: {
- span: adaptWidth.elContainer,
- },
- componentProps: {
- placeholder: '集体租赁',
- },
- required: true,
- },
- {
- field: 'car',
- component: 'CarArrayCom',
- label: '车辆登记',
- labelWidth: adaptWidth.labelWidth,
- colProps: {
- span: adaptWidth.elContainer,
- },
- defaultValue: [],
- componentProps: ({ formModel }) => {
- return {
- placeholder: '车辆登记',
- value: formModel.car,
- onChange: () => {},
- };
- },
- },
- {
- field: 'status',
- component: 'Select',
- label: '活动状态',
- labelWidth: adaptWidth.labelWidth,
- colProps: {
- span: adaptWidth.elContainer,
- },
- componentProps: {
- placeholder: '活动状态',
- options: [
- {
- label: '筹备',
- value: 0,
- },
- {
- label: '完成',
- value: 1,
- },
- {
- label: '取消',
- value: 2,
- },
- ],
- },
- required: true,
- },
- {
- field: 'attachment',
- component: 'Select',
- label: '附件',
- labelWidth: adaptWidth.labelWidth,
- colProps: {
- span: adaptWidth.elContainer,
- },
- render: ({ model, field }) => {
- return h(UploadFile, {
- value: model.attachment,
- type: 'files',
- style: { width: '100%' },
- onChange(value) {
- model[field] = value;
- },
- });
- },
- },
- {
- field: 'remark',
- component: 'Input',
- label: '备注',
- labelWidth: adaptWidth.labelWidth,
- colProps: {
- span: adaptWidth.elContainer,
- },
- componentProps: {
- placeholder: '备注',
- },
- },
- ];
|