|
|
@ -1,7 +1,10 @@ |
|
|
|
import { BasicColumn } from '/@/components/Table'; |
|
|
|
import { BasicColumn } from '/@/components/Table'; |
|
|
|
import { FormSchema } from '/@/components/Table'; |
|
|
|
import { FormSchema } from '/@/components/Table'; |
|
|
|
import { h } from 'vue'; |
|
|
|
import { h } from 'vue'; |
|
|
|
import { Tag } from 'ant-design-vue'; |
|
|
|
import { Tag, Switch } from 'ant-design-vue'; |
|
|
|
|
|
|
|
import { setDefaultType } from '/@/api/platform/common/controller/pushConcernFanType'; |
|
|
|
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'; |
|
|
|
|
|
|
|
const { createConfirm } = useMessage(); |
|
|
|
|
|
|
|
|
|
|
|
/** 表格列配置 */ |
|
|
|
/** 表格列配置 */ |
|
|
|
export const columns: BasicColumn[] = [ |
|
|
|
export const columns: BasicColumn[] = [ |
|
|
@ -116,3 +119,112 @@ export const formSchema: FormSchema[] = [ |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 推送类型表格列配置 */ |
|
|
|
|
|
|
|
export const pushTypeColumns = (refreshPushType: Function) => [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
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: 'defaultType', |
|
|
|
|
|
|
|
width: 120, |
|
|
|
|
|
|
|
customRender: ({ record }) => { |
|
|
|
|
|
|
|
// 设置请求加载状态标识
|
|
|
|
|
|
|
|
if (!Reflect.has(record, 'pendingStatus')) { |
|
|
|
|
|
|
|
record.pendingStatus = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return h(Switch, { |
|
|
|
|
|
|
|
checked: record.defaultType === '1', |
|
|
|
|
|
|
|
checkedChildren: '已启用', |
|
|
|
|
|
|
|
unCheckedChildren: '已禁用', |
|
|
|
|
|
|
|
loading: record.pendingStatus, |
|
|
|
|
|
|
|
onChange(checked: boolean) { |
|
|
|
|
|
|
|
const text = checked ? '启用' : '禁用'; |
|
|
|
|
|
|
|
createConfirm({ |
|
|
|
|
|
|
|
iconType: 'warning', |
|
|
|
|
|
|
|
title: '警告', |
|
|
|
|
|
|
|
content: `确认要"${text}${record.name}推送类型吗?`, |
|
|
|
|
|
|
|
onOk: async () => { |
|
|
|
|
|
|
|
record.pendingStatus = true; |
|
|
|
|
|
|
|
const { createMessage } = useMessage(); |
|
|
|
|
|
|
|
const defaultType = checked ? '1' : '0'; |
|
|
|
|
|
|
|
setDefaultType({ |
|
|
|
|
|
|
|
id: record.id, |
|
|
|
|
|
|
|
concernFanId: record.concernFanId, |
|
|
|
|
|
|
|
defaultType |
|
|
|
|
|
|
|
}).then(() => { |
|
|
|
|
|
|
|
refreshPushType(); |
|
|
|
|
|
|
|
createMessage.success(`${text}成功`); |
|
|
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
|
|
createMessage.error(`${text}失败`); |
|
|
|
|
|
|
|
}).finally(() => record.pendingStatus = false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] as BasicColumn[]; |
|
|
|