175 lines
4.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { BasicColumn, FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
export const columns: BasicColumn[] = [
{
title: '标题',
width: 150,
dataIndex: 'titile',
},
{
title: '消息类型',
dataIndex: 'msgCategory',
width: 100,
customRender: ({ text }) => {
return render.renderDict(text, 'msg_category');
},
},
{
title: '发布人',
width: 100,
dataIndex: 'sender',
},
{
title: '优先级',
dataIndex: 'priority',
width: 70,
customRender: ({ text }) => {
const color = text == 'L' ? 'blue' : text == 'M' ? 'yellow' : 'red';
return render.renderTag(render.renderDict(text, 'priority'), color);
},
},
{
title: '通告对象',
dataIndex: 'msgType',
width: 100,
customRender: ({ text }) => {
return render.renderDict(text, 'msg_type');
},
},
{
title: '发布状态',
dataIndex: 'sendStatus',
width: 70,
customRender: ({ text }) => {
const color = text == '0' ? 'red' : text == '1' ? 'green' : 'gray';
return render.renderTag(render.renderDict(text, 'send_status'), color);
},
},
{
title: '发布时间',
width: 100,
dataIndex: 'sendTime',
},
{
title: '撤销时间',
width: 100,
dataIndex: 'cancelTime',
},
];
export const searchFormSchema: FormSchema[] = [
{
field: 'titile',
label: '标题',
component: 'JInput',
colProps: { span: 8 },
},
];
export const formSchema: FormSchema[] = [
{
field: 'id',
label: 'id',
component: 'Input',
show: false,
},
{
field: 'msgCategory',
label: '消息类型',
required: true,
component: 'JDictSelectTag',
defaultValue: '1',
componentProps: {
type: 'radio',
dictCode: 'msg_category',
placeholder: '请选择类型',
},
},
{
field: 'titile',
label: '标题',
component: 'Input',
required: true,
componentProps: {
placeholder: '请输入标题',
},
// update-begin--author:liaozhiyang---date:20240701---for【TV360X-1632】标题过长保存报错长度校验
dynamicRules() {
return [
{
validator: (_, value) => {
return new Promise<void>((resolve, reject) => {
if (value.length > 100) {
reject('最长100个字符');
}
resolve();
});
},
},
];
},
// update-end--author:liaozhiyang---date:20240701---for【TV360X-1632】标题过长保存报错长度校验
},
{
field: 'msgAbstract',
label: '摘要',
component: 'InputTextArea',
required: true,
},
// {
// field: 'endTime',
// label: '截至日期',
// component: 'DatePicker',
// componentProps: {
// showTime: true,
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
// placeholder: '请选择截至日期',
// },
// dynamicRules: ({ model }) => rules.endTime(model.startTime, true),
// },
{
field: 'msgType',
label: '接收用户',
defaultValue: 'ALL',
component: 'JDictSelectTag',
required: true,
componentProps: {
type: 'radio',
dictCode: 'msg_type',
placeholder: '请选择发布范围',
},
},
{
field: 'userIds',
label: '指定用户',
component: 'JSelectUserByDepartment',
required: true,
componentProps: {
rowKey: 'id',
// update-begin--author:liaozhiyang---date:20240701---for【TV360X-1627】通知公告用户选择组件没翻译
labelKey: 'realname',
// update-end--author:liaozhiyang---date:20240701---for【TV360X-1627】通知公告用户选择组件没翻译
},
ifShow: ({ values }) => values.msgType == 'USER',
},
{
field: 'priority',
label: '优先级',
defaultValue: 'H',
component: 'JDictSelectTag',
componentProps: {
dictCode: 'priority',
type: 'radio',
placeholder: '请选择优先级',
},
},
{
field: 'msgContent',
label: '内容',
component: 'Input',
render: render.renderTinymce,
},
];