123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- import { Time } from '/@/components/Time';
- import { FormProps, BasicColumn } from '/@/components/Table';
- import { h, computed } from 'vue';
- import { FormSchema } from '/@/components/Form/index';
- import { useI18n } from '/@/hooks/web/useI18n';
- import { useLocaleStore } from '/@/store/modules/locale';
- const { t } = useI18n();
- const localeStore = useLocaleStore();
- const isEn = computed(() => localeStore.getLocale === 'en');
- import { dincrementList } from '/@/api/equity';
- export const columnsDown: BasicColumn[] = [
- {
- title: t('routes.equity.count'),
- dataIndex: 'userName',
- },
- {
- title: t('routes.equity.dowmCount'),
- dataIndex: 'count',
- // slots: { customRender: 'orderStatus' },
- },
- {
- title: t('routes.equity.timeList'),
- dataIndex: 'createTime',
- // slots: { customRender: 'orderStatus' },
- },
- ];
- export const columns: BasicColumn[] = [
- {
- title: t('routes.equity.id'),
- dataIndex: 'id',
- ellipsis: false,
- width: 180,
- },
- {
- title: t('routes.equity.userName'),
- dataIndex: 'userName',
- ellipsis: false,
- width: 180,
- },
- {
- title: t('routes.equity.Type'),
- dataIndex: 'incrementTypeId',
- width: 120,
- customRender: ({ record }) => {
- return t(`routes.equity.equityType.${record.incrementTypeId}`);
- },
- },
- {
- title: t('routes.equity.time'),
- dataIndex: 'incrementStartTime',
- width: 150,
- customRender: ({ record }) => {
- return (
- record.incrementStartTime &&
- h(Time, {
- value: record.incrementStartTime,
- mode: 'datetime',
- })
- );
- },
- },
- {
- title: t('routes.equity.expiryTime'),
- dataIndex: 'incrementEndTime',
- width: 150,
- customRender: ({ record }) => {
- return (
- record.incrementEndTime &&
- h(Time, {
- value: record.incrementEndTime,
- mode: 'datetime',
- })
- );
- },
- },
- {
- title: t('routes.equity.newTime'),
- dataIndex: 'invoiceTime',
- width: 150,
- customRender: ({ record }) => {
- return (
- record.updateTime &&
- h(Time, {
- value: record.updateTime,
- mode: 'datetime',
- })
- );
- },
- },
- ];
- export const searchForm: Partial<FormProps> = {
- labelWidth: 100,
- schemas: [
- {
- field: 'id',
- label: t('routes.equity.id'),
- component: 'Input',
- componentProps: {
- maxLength: 100,
- },
- colProps: {
- xl: 6,
- xxl: 6,
- },
- rules: [
- {
- required: false,
- // @ts-ignore
- validator: async (rule, value) => {
- // var reg = /\S+@\S+\.\S+/;
- const regPos = /^[0-9]*$/
- if (!value) {
- return Promise.reject(t('common.inputText') + t('routes.equity.id'));
- }
- if (!regPos.test(value)) {
- /* eslint-disable-next-line */
- return Promise.reject(t('routes.equity.rules.id'));
- }
- return Promise.resolve();
- },
- trigger: 'change',
- },
- ],
- },
- {
- field: 'userName',
- label: t('routes.equity.userName'),
- component: 'Input',
- componentProps: {
- maxLength: 100,
- },
- colProps: {
- xl: 6,
- xxl: 6,
- },
- },
- {
- field: 'incrementTypeId',
- component: 'ApiSelect',
- label: t('routes.equity.Type'),
- colProps: {
- xl: 6,
- xxl: 6,
- },
- componentProps: {
- maxLength: 50,
- api: async function () {
- const list = await dincrementList();
- return list.map((ele) => {
- return { name: t(`routes.finance.equityType.${ele.validTimeType}`), value: ele.id };
- });
- },
- numberToString: true,
- labelField: 'name',
- valueField: 'value',
- immediate: true,
- },
- },
- ],
- };
- export const DownSchemas: Partial<FormProps> = {
- labelWidth: isEn.value ? 125 : 100,
- schemas: [
- {
- field: 'userName',
- label: t('routes.equity.userName'),
- component: 'Input',
- componentProps: {
- maxLength: 100,
- },
- colProps: {
- xl: 6,
- xxl: 6,
- },
- },
- {
- field: 'timeList',
- label: t('routes.equity.timeList'),
- component: 'RangePicker',
- componentProps: {
- maxLength: 100,
- valueFormat: 'YYYY-MM-DD',
- format: 'YYYY-MM-DD',
- },
- 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('不支持中文字符');
- }
- 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,
- },
- },
- ];
|