update
init
This commit is contained in:
@@ -0,0 +1,200 @@
|
||||
import { BasicColumn } from '/@/components/Table';
|
||||
import { FormSchema } from '/@/components/Table';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import { h } from 'vue';
|
||||
import { Image } from 'ant-design-vue';
|
||||
import { getDefaultImage, getFileAccessHttpUrl } from '/@/utils/common/compUtils';
|
||||
import { EyeOutlined } from '@ant-design/icons-vue';
|
||||
import { getKnowledge } from '/@/views/consult/conKnowledge/ConKnowledge.api';
|
||||
//列表数据
|
||||
// @ts-ignore
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '文章标题',
|
||||
align: 'center',
|
||||
dataIndex: 'knowTitle',
|
||||
},
|
||||
{
|
||||
title: '知识类型',
|
||||
align: 'center',
|
||||
dataIndex: 'knowType',
|
||||
customRender: ({ text }) => {
|
||||
return render.renderDict(text, 'know_type');
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '知识分类',
|
||||
align: 'center',
|
||||
dataIndex: 'knowClassName',
|
||||
},
|
||||
{
|
||||
title: '知识图片',
|
||||
align: 'center',
|
||||
dataIndex: 'knowPic',
|
||||
width: 100,
|
||||
customRender: ({ text }) => {
|
||||
return h(Image, {
|
||||
placeholder: true,
|
||||
src: getFileAccessHttpUrl(text),
|
||||
height: 50,
|
||||
width: 50,
|
||||
fallback: getDefaultImage(),
|
||||
previewMask: () => {
|
||||
return h(EyeOutlined, {
|
||||
style: {
|
||||
color: 'white',
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
// {
|
||||
// title: '已学习次数',
|
||||
// align: 'center',
|
||||
// dataIndex: 'knowLookNumber',
|
||||
// },
|
||||
{
|
||||
title: '是否推荐',
|
||||
align: 'center',
|
||||
dataIndex: 'tfRecommend',
|
||||
customRender: ({ text }) => (text === '0' ? '否' : '是'),
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
align: 'center',
|
||||
dataIndex: 'status',
|
||||
customRender: ({ text }) => {
|
||||
return render.renderDict(text, 'freeze_status');
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
align: 'center',
|
||||
dataIndex: 'sort',
|
||||
width: '70px',
|
||||
},
|
||||
];
|
||||
//查询数据
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '标题',
|
||||
field: 'knowTitle',
|
||||
component: 'Input',
|
||||
},
|
||||
];
|
||||
//表单数据
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
label: '知识标题',
|
||||
field: 'knowTitle',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: '知识类型',
|
||||
field: 'knowType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
// dictCode: 'know_type',
|
||||
options: [
|
||||
{
|
||||
label: '图文',
|
||||
value: '0',
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultValue: '0',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: '知识图片',
|
||||
field: 'knowPic',
|
||||
component: 'JImageUpload',
|
||||
componentProps: {
|
||||
fileMax: 1,
|
||||
},
|
||||
rules: [{ required: true, message: '请选择知识图片' }],
|
||||
},
|
||||
{
|
||||
label: '知识分类',
|
||||
field: 'knowClass',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: getKnowledge,
|
||||
resultField: 'list',
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
immediate: true,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
// {
|
||||
// label: '已学习次数',
|
||||
// field: 'knowLookNumber',
|
||||
// component: 'InputNumber',
|
||||
// required: true,
|
||||
// },
|
||||
{
|
||||
label: '是否推荐',
|
||||
field: 'tfRecommend',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
type: 'radio',
|
||||
options: [
|
||||
{
|
||||
value: '1',
|
||||
label: '是',
|
||||
},
|
||||
{
|
||||
value: '0',
|
||||
label: '否',
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultValue: '1',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
field: 'status',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
type: 'radio',
|
||||
dictCode: 'freeze_status',
|
||||
},
|
||||
defaultValue: '1',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: '知识内容',
|
||||
field: 'knowContent',
|
||||
component: 'JEditor',
|
||||
componentProps: {
|
||||
showImageUpload: true,
|
||||
},
|
||||
rules: [{ required: true, message: '请输入知识内容' }],
|
||||
},
|
||||
{
|
||||
label: '排序',
|
||||
field: 'sort',
|
||||
component: 'Input',
|
||||
rules: [{ required: true, message: '请输入排序' }],
|
||||
},
|
||||
// TODO 主键隐藏字段,目前写死为ID
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* 流程表单调用这个方法获取formSchema
|
||||
* @param param
|
||||
*/
|
||||
export function getBpmFormSchema(_formData): FormSchema[] {
|
||||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
||||
return formSchema;
|
||||
}
|
||||
Reference in New Issue
Block a user