康来智慧冷链系统 - 前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

219 lines
3.9 KiB

import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
/** 表格列配置 */
export const columns: BasicColumn[] = [
{
title: '应用名称',
dataIndex: 'name'
},
{
title: '状态',
dataIndex: 'status',
width: 120,
customRender: ({record}) => {
const status = record.status;
const enable = ~~status === 0;
const color = enable ? 'green' : 'red';
const text = enable ? '开通' : '关闭';
return h(Tag, { color: color }, () => text);
}
},
{
title: '限制ip',
dataIndex: 'ip'
},
{
title: '创建人',
dataIndex: 'createByName'
},
{
title: '创建时间',
dataIndex: 'createTime',
width: 200
},
{
title: '备注',
dataIndex: 'remarks',
width: 200,
customRender: ({record}) => {
return record.remarks || h(Tag, { color: 'red' }, () => '暂无数据');
}
}
];
/** 搜索表单配置 */
export const searchFormSchema: FormSchema[] = [
{
field: 'name',
label: '应用名称',
component: 'Input',
componentProps: {
placeholder: '请输入应用名称',
},
colProps: { span: 6 }
}
];
/** 表单配置 */
export const formSchema: FormSchema[] = [
{
field: 'id',
label: 'ID',
component: 'Input',
show: false
},
{
field: 'name',
label: '应用名称',
component: 'Input',
required: true,
colProps: {
span: 24
}
},
{
field: 'ip',
label: '限制ip',
component: 'Input',
colProps: {
span: 12
}
},
{
field: 'status',
label: '状态',
component: 'RadioGroup',
defaultValue: '0',
componentProps: {
options: [
{ label: '开通', value: '0' },
{ label: '停止', value: '1' }
]
},
colProps: {
span: 12
}
},
{
label: '备注',
field: 'remarks',
component: 'InputTextArea',
componentProps: {
rows: 6
},
colProps: {
span: 24
}
}
];
export const sendFormSchema: FormSchema[] = [
{
field: 'fromUserId',
label: '发送方用户id',
component: 'Input',
show: false
},
{
field: 'messageSecret',
label: 'app发送密钥',
component: 'Input',
show: false
},
{
field: 'title',
label: '标题',
component: 'Input',
required: true,
colProps: {
span: 24
}
},
{
label: '通知文字描述',
field: 'text',
component: 'InputTextArea',
required: true,
componentProps: {
rows: 6
},
colProps: {
span: 24
}
},
{
label: '自定义通知声音',
field: 'sound',
component: 'Input',
componentProps: {
placeholder: '格式为R.raw.[sound]',
},
colProps: {
span: 24
}
},
{
label: '自定义播放文件名称',
field: 'customPlayFileName',
component: 'Input',
colProps: {
span: 24
}
},
{
field: 'customTypeId',
label: '自定义推送类型ID',
component: 'Input',
colProps: {
span: 12
}
},
{
field: 'playVibrate',
label: '收到通知是否震动',
component: 'RadioGroup',
defaultValue: '0',
componentProps: {
options: [
{ label: '是', value: '0' },
{ label: '否', value: '1' }
]
},
colProps: {
span: 12
}
},
{
field: 'playLights',
label: '收到通知是否闪灯',
component: 'RadioGroup',
defaultValue: '0',
componentProps: {
options: [
{ label: '是', value: '0' },
{ label: '否', value: '1' }
]
},
colProps: {
span: 12
}
},
{
field: 'playSound',
label: '收到通知是否发出声音',
component: 'RadioGroup',
defaultValue: '0',
componentProps: {
options: [
{ label: '是', value: '0' },
{ label: '否', value: '1' }
]
},
colProps: {
span: 12
}
},
];