update
init
This commit is contained in:
@@ -0,0 +1,162 @@
|
||||
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: {
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user