4 changed files with 211 additions and 166 deletions
@ -1,144 +0,0 @@ |
|||||||
import { BasicColumn } from '/@/components/Table'; |
|
||||||
import { FormSchema } from '/@/components/Table'; |
|
||||||
import { listPushFile } from '/@/api/platform/common/controller/pushFile'; |
|
||||||
import {useUserStore} from '/@/store/modules/user'; |
|
||||||
|
|
||||||
const userStore = useUserStore(); |
|
||||||
const userInfoStore = userStore.getUserInfo; |
|
||||||
|
|
||||||
/** 表格列配置 */ |
|
||||||
export const columns: BasicColumn[] = [ |
|
||||||
{ |
|
||||||
title: '类型名称', |
|
||||||
dataIndex: 'name' |
|
||||||
}, |
|
||||||
{ |
|
||||||
title: '是否播放声音', |
|
||||||
dataIndex: 'playSound', |
|
||||||
customRender: ({record}) => { |
|
||||||
return ~~record?.playSound === 0 ? '是' : '否'; |
|
||||||
} |
|
||||||
}, |
|
||||||
{ |
|
||||||
title: '是否震动', |
|
||||||
dataIndex: 'playVibrate', |
|
||||||
customRender: ({record}) => { |
|
||||||
return ~~record?.playVibrate === 0 ? '是' : '否'; |
|
||||||
} |
|
||||||
}, |
|
||||||
{ |
|
||||||
title: '是否闪光', |
|
||||||
dataIndex: 'playLights', |
|
||||||
customRender: ({record}) => { |
|
||||||
return ~~record?.playLights === 0 ? '是' : '否'; |
|
||||||
} |
|
||||||
}, |
|
||||||
{ |
|
||||||
title: '自定义播放文件名称', |
|
||||||
dataIndex: 'customPlayFileName' |
|
||||||
}, |
|
||||||
{ |
|
||||||
title: '创建人', |
|
||||||
dataIndex: 'createByName' |
|
||||||
}, |
|
||||||
{ |
|
||||||
title: '创建时间', |
|
||||||
dataIndex: 'createTime', |
|
||||||
width: 200 |
|
||||||
} |
|
||||||
]; |
|
||||||
|
|
||||||
/** 搜索表单配置 */ |
|
||||||
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: 'playSound', |
|
||||||
label: '是否播放声音', |
|
||||||
component: 'RadioGroup', |
|
||||||
required: true, |
|
||||||
defaultValue: '0', |
|
||||||
componentProps: { |
|
||||||
options: [ |
|
||||||
{ label: '是', value: '0' }, |
|
||||||
{ label: '否', value: '1' } |
|
||||||
] |
|
||||||
}, |
|
||||||
colProps: { |
|
||||||
span: 12 |
|
||||||
} |
|
||||||
}, |
|
||||||
{ |
|
||||||
field: 'playVibrate', |
|
||||||
label: '是否震动', |
|
||||||
component: 'RadioGroup', |
|
||||||
required: true, |
|
||||||
defaultValue: '0', |
|
||||||
componentProps: { |
|
||||||
options: [ |
|
||||||
{ label: '是', value: '0' }, |
|
||||||
{ label: '否', value: '1' } |
|
||||||
] |
|
||||||
}, |
|
||||||
colProps: { |
|
||||||
span: 12 |
|
||||||
} |
|
||||||
}, |
|
||||||
{ |
|
||||||
field: 'playLights', |
|
||||||
label: '是否闪光', |
|
||||||
component: 'RadioGroup', |
|
||||||
required: true, |
|
||||||
defaultValue: '0', |
|
||||||
componentProps: { |
|
||||||
options: [ |
|
||||||
{ label: '是', value: '0' }, |
|
||||||
{ label: '否', value: '1' } |
|
||||||
] |
|
||||||
}, |
|
||||||
colProps: { |
|
||||||
span: 12 |
|
||||||
} |
|
||||||
}, |
|
||||||
{ |
|
||||||
field: 'customPlayFileName', |
|
||||||
label: '播放文件名称', |
|
||||||
component: 'ApiSelect', |
|
||||||
componentProps: { |
|
||||||
api: listPushFile, |
|
||||||
params: { |
|
||||||
size: 99, |
|
||||||
createById: userInfoStore.id |
|
||||||
}, |
|
||||||
labelField: 'original', |
|
||||||
valueField: 'original', |
|
||||||
resultField: 'data' |
|
||||||
}, |
|
||||||
}, |
|
||||||
]; |
|
@ -0,0 +1,195 @@ |
|||||||
|
import { BasicColumn } from '/@/components/Table'; |
||||||
|
import { FormSchema } from '/@/components/Table'; |
||||||
|
import { listPushRingtone } from '/@/api/platform/common/controller/pushRingtone'; |
||||||
|
import { h } from 'vue'; |
||||||
|
import { Tag } from 'ant-design-vue'; |
||||||
|
|
||||||
|
/** 表格列配置 */ |
||||||
|
export const columns: BasicColumn[] = [ |
||||||
|
{ |
||||||
|
title: '类型名称', |
||||||
|
dataIndex: 'name' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '播放声音', |
||||||
|
dataIndex: 'playSound', |
||||||
|
width: 80, |
||||||
|
customRender: ({ record }) => { |
||||||
|
const playSound = record?.playSound; |
||||||
|
const enable = ~~playSound === 0; |
||||||
|
const color = enable ? 'green' : 'red'; |
||||||
|
const text = enable ? '是' : '否'; |
||||||
|
return h(Tag, { color: color }, () => text); |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '震动', |
||||||
|
dataIndex: 'playVibrate', |
||||||
|
width: 80, |
||||||
|
customRender: ({ record }) => { |
||||||
|
const playVibrate = record?.playVibrate; |
||||||
|
const enable = ~~playVibrate === 0; |
||||||
|
const color = enable ? 'green' : 'red'; |
||||||
|
const text = enable ? '是' : '否'; |
||||||
|
return h(Tag, { color: color }, () => text); |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '闪光', |
||||||
|
dataIndex: 'playLights', |
||||||
|
width: 80, |
||||||
|
customRender: ({ record }) => { |
||||||
|
const playLights = record?.playLights; |
||||||
|
const enable = ~~playLights === 0; |
||||||
|
const color = enable ? 'green' : 'red'; |
||||||
|
const text = enable ? '是' : '否'; |
||||||
|
return h(Tag, { color: color }, () => text); |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '文字转语音', |
||||||
|
dataIndex: 'playToText', |
||||||
|
width: 120, |
||||||
|
customRender: ({ record }) => { |
||||||
|
const playToText = record?.playToText; |
||||||
|
const enable = ~~playToText === 1; |
||||||
|
const color = enable ? 'green' : 'red'; |
||||||
|
const text = enable ? '是': '否'; |
||||||
|
return h(Tag, { color: color }, () => text); |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '在线铃声', |
||||||
|
dataIndex: 'onlineRingtone' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '创建人', |
||||||
|
dataIndex: 'createByName' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '创建时间', |
||||||
|
dataIndex: 'createTime', |
||||||
|
width: 200 |
||||||
|
} |
||||||
|
]; |
||||||
|
|
||||||
|
/** 搜索表单配置 */ |
||||||
|
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: 'playSound', |
||||||
|
label: '播放声音', |
||||||
|
component: 'RadioGroup', |
||||||
|
required: true, |
||||||
|
defaultValue: '0', |
||||||
|
componentProps: { |
||||||
|
options: [ |
||||||
|
{ label: '是', value: '0' }, |
||||||
|
{ label: '否', value: '1' } |
||||||
|
] |
||||||
|
}, |
||||||
|
colProps: { |
||||||
|
span: 12 |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'playVibrate', |
||||||
|
label: '震动', |
||||||
|
component: 'RadioGroup', |
||||||
|
required: true, |
||||||
|
defaultValue: '0', |
||||||
|
componentProps: { |
||||||
|
options: [ |
||||||
|
{ label: '是', value: '0' }, |
||||||
|
{ label: '否', value: '1' } |
||||||
|
] |
||||||
|
}, |
||||||
|
colProps: { |
||||||
|
span: 12 |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'playLights', |
||||||
|
label: '闪光', |
||||||
|
component: 'RadioGroup', |
||||||
|
required: true, |
||||||
|
defaultValue: '0', |
||||||
|
componentProps: { |
||||||
|
options: [ |
||||||
|
{ label: '是', value: '0' }, |
||||||
|
{ label: '否', value: '1' } |
||||||
|
] |
||||||
|
}, |
||||||
|
colProps: { |
||||||
|
span: 12 |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'playToText', |
||||||
|
label: '文字转语音', |
||||||
|
component: 'RadioGroup', |
||||||
|
required: true, |
||||||
|
defaultValue: '0', |
||||||
|
componentProps: { |
||||||
|
options: [ |
||||||
|
{ label: '否', value: '0' }, |
||||||
|
{ label: '是', value: '1' } |
||||||
|
] |
||||||
|
}, |
||||||
|
colProps: { |
||||||
|
span: 12 |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'offlineRingtone', |
||||||
|
label: '离线铃声', |
||||||
|
component: 'Input', |
||||||
|
componentProps: { |
||||||
|
placeholder: '格式为R.raw.[sound]', |
||||||
|
}, |
||||||
|
colProps: { |
||||||
|
span: 12 |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'onlineRingtone', |
||||||
|
label: '在线铃声', |
||||||
|
component: 'ApiSelect', |
||||||
|
componentProps: { |
||||||
|
api: listPushRingtone, |
||||||
|
params: { |
||||||
|
size: 99 |
||||||
|
}, |
||||||
|
labelField: 'name', |
||||||
|
valueField: 'id', |
||||||
|
resultField: 'data' |
||||||
|
}, |
||||||
|
}, |
||||||
|
]; |
Loading…
Reference in new issue