123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238 |
- import { Time } from '/@/components/Time';
- import { FormProps, BasicColumn } from '/@/components/Table';
- import { h, ref, computed } from 'vue';
- import { FormSchema } from '/@/components/Form/index';
- import { useI18n } from '/@/hooks/web/useI18n';
- const { t } = useI18n();
- import { dincrementList } from '/@/api/equity';
- import type { Dayjs } from 'dayjs';
- const selectPriceDate = ref('');
- import dayjs from 'dayjs';
- import { useLocaleStore } from '/@/store/modules/locale';
- const localeStore = useLocaleStore();
- const isEn = computed(() => localeStore.getLocale === 'en');
- export const columns: BasicColumn[] = [
- {
- title: t('routes.equity.timeList'),
- dataIndex: 'createTime',
- width: 150,
- customRender: ({ record }) => {
- return (
- record.createTime &&
- h(Time, {
- value: record.createTime,
- mode: 'datetime',
- })
- );
- },
- },
- {
- title: t('routes.equity.Type'),
- dataIndex: 'type',
- width: 120,
- customRender: ({ record }) => {
- return t(`routes.finance.equityType.${record.type}`) || '-';
- },
- },
- {
- title: t('routes.equity.nickName'),
- dataIndex: 'nickName',
- width: 100,
- },
- {
- title: t('routes.equity.userName1'),
- dataIndex: 'userName',
- width: 180,
- },
- {
- title: t('routes.equity.email'),
- dataIndex: 'email',
- // slots: { customRender: 'orderType' },
- width: 150,
- },
- {
- title: t('routes.equity.userCount'),
- dataIndex: 'count',
- // slots: { customRender: 'orderStatus' },
- width: 120,
- },
- {
- title: t('routes.finance.totalTime'),
- dataIndex: 'totalTime',
- // slots: { customRender: 'orderStatus' },
- width: 120,
- customRender: ({ record }) => {
- return record.type == 2?'-':record.totalTime;
- },
- },
- {
- title: t('routes.equity.giveType'),
- dataIndex: 'giveType',
- // slots: { customRender: 'orderStatus' },
- width: 180,
- customRender: ({ record }) => {
- return t(`routes.finance.giveType.${record.giveType}`) || '-';
- },
- },
- ];
- export const searchForm: Partial<FormProps> = {
- labelWidth: isEn.value ? 120 : 100,
- schemas: [
- {
- field: 'type',
- label: t('routes.equity.Type'),
- component: 'ApiSelect',
- componentProps: {
- maxLength: 50,
- api: async function () {
- const list = await dincrementList();
- let optionList = [];
- list.map((ele) => {
- optionList.push({
- name: t(`routes.finance.equityType.${ele.validTimeType}`),
- value: ele.validTimeType,
- key: ele.validTimeType,
- });
- });
- optionList.push({
- name: t('routes.finance.equityType.2'),
- value: 2,
- key: '2',
- });
- console.log('ele.id', optionList);
- return optionList;
- },
- numberToString: true,
- labelField: 'name',
- valueField: 'value',
- immediate: true,
- },
- colProps: {
- xl: 5,
- xxl: 5,
- },
- },
- {
- field: 'giveType',
- label: t('routes.equity.giveType'),
- component: 'Select',
- componentProps: {
- options: [
- {
- label: t('routes.finance.giveType.0'),
- value: 0,
- key: '0',
- },
- {
- label: t('routes.finance.giveType.1'),
- value: 1,
- key: '1',
- },
- {
- label: t('routes.finance.giveType.2'),
- value: 2,
- key: '2',
- },
- {
- label: t('routes.finance.giveType.3'),
- value: 3,
- key: '3',
- },
- ],
- },
- colProps: {
- xl: 5,
- xxl: 5,
- },
- },
- {
- field: 'timeList',
- label: t('routes.equity.timeList'),
- component: 'RangePicker',
- componentProps: {
- maxLength: 100,
- valueFormat: 'YYYY-MM-DD',
- format: 'YYYY-MM-DD',
- onCalendarChange: (date) => {
- console.log('current', date);
- selectPriceDate.value = date[0];
- },
- onOpenChange: (status) => {
- if (!status) {
- selectPriceDate.value = '';
- }
- },
- disabledDate: (current) => {
- if (selectPriceDate.value) {
- return (
- current > dayjs(selectPriceDate.value).add(3, 'year') ||
- current < dayjs(selectPriceDate.value).subtract(3, 'year')
- );
- } else {
- return false;
- }
- },
- },
- colProps: {
- xl: 7,
- xxl: 7,
- },
- },
- ],
- };
- export const InvoiceSchemas: FormSchema[] = [
- {
- field: 'type',
- component: 'Input',
- label: t('routes.product.types'),
- slot: 'text',
- colProps: {
- span: 24,
- },
- },
- {
- field: 'version',
- component: 'Input',
- label: t('routes.product.version'),
- required: true,
- colProps: {
- span: 24,
- },
- rules: [
- {
- required: true,
- // @ts-ignore
- validator: async (rule, value) => {
- if (!value) {
- return Promise.reject(t('common.inputText') + t('routes.product.version'));
- }
- if (/.*[\u4e00-\u9fa5]+.*$/.test(value)) {
- /* eslint-disable-next-line */
- return Promise.reject(t('routes.equity.zhTips'));
- }
- return Promise.resolve();
- },
- trigger: 'change',
- },
- ],
- componentProps: {
- maxLength: 15,
- onChange: (data) => {
- console.log('data', data);
- },
- },
- },
- {
- field: 'description',
- component: 'InputTextArea',
- required: true,
- label: t('routes.product.description'),
- componentProps: {
- rows: 4,
- },
- colProps: {
- span: 24,
- },
- },
- ];
|