Files
xj-admin/src/views/consult/department/ConDepartment.data.ts
T
lianlonggang eeb1496483 feat(upload): 配置文件上传组件的业务路径和文本提示
- 在 JImageUpload 组件中添加 bizPath 属性以指定上传路径
- 为头像上传功能统一设置 bizPath: 'avatar'
- 为图片上传功能设置 bizPath: 'img'
- 为视频上传功能设置 bizPath: 'video'
- 为PDF文件上传设置 bizPath: 'bizfile'
- 为APP文件上传设置 bizPath: 'appfile'
- 添加 text 属性统一显示 '上传头像' 提示文本
- 在系统横幅管理中配置图片上传的业务路径
- 为新资源管理模块添加完整的数据结构定义
2026-04-30 08:56:14 +08:00

164 lines
4.2 KiB
TypeScript

import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
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 { listLevelOne } from '/@/views/consult/department/ConDepartment.api';
//列表数据
export const columns: BasicColumn[] = [
{
title: '科室名称',
align: 'center',
dataIndex: 'departmentName',
},
{
title: '图片',
align: 'center',
dataIndex: 'image',
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: 'doctorNum',
},
{
title: '简介',
align: 'left',
dataIndex: 'mark',
},
{
title: '是否置顶',
align: 'center',
dataIndex: 'tfTop',
customRender: ({ text }) => (text === 1 ? '是' : '否'),
},
{
title: '排序',
align: 'center',
dataIndex: 'sort',
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
{
label: '科室名称',
field: 'departmentName',
component: 'Input',
},
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '科室名称',
field: 'departmentName',
component: 'Input',
required: true,
},
{
label: '所属科室',
field: 'officeparid',
component: 'ApiSelect',
componentProps: ({ formModel }) => {
return {
api: listLevelOne,
labelField: 'departmentName',
valueField: 'id',
getPopupContainer: () => document.body,
immediate: true,
afterFetch: (res: any[]) => {
if (formModel.id && Array.isArray(res) && res.length > 0) {
return res?.filter((item) => item?.id !== formModel.id);
}
return res;
},
showSearch: true,
filterOption: (input: string, option: any): boolean => {
const str: string = input.toLowerCase();
return option.label.toLowerCase().indexOf(str) >= 0;
},
};
},
},
{
label: '科室图片',
field: 'image',
component: 'JImageUpload',
componentProps: {
bizPath: 'img',
fileMax: 1,
},
},
{
label: '科室简介',
field: 'mark',
component: 'InputTextArea',
componentProps: () => {
return {
minRows: 4,
};
},
},
{
label: '是否置顶',
field: 'tfTop',
component: 'RadioGroup',
componentProps: {
options: [
{
label: '是',
value: 1,
},
{
label: '否',
value: 0,
},
],
},
},
{
label: '排序',
field: 'sort',
component: 'InputNumber',
},
// TODO 主键隐藏字段,目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false,
},
{
label: '',
field: 'value',
component: 'Input',
show: false,
},
];
/**
* 流程表单调用这个方法获取formSchema
* @param _formData
*/
export function getBpmFormSchema(_formData): FormSchema[] {
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
return formSchema;
}