dbsd_kczx/src/views/kc/detection/KcDetectionMain.data.ts

302 lines
6.0 KiB
TypeScript
Raw Normal View History

2024-05-09 22:23:08 +08:00
import { h } from 'vue';
import { Input } from 'ant-design-vue';
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
2024-05-09 22:23:08 +08:00
//列表数据
export const columns: BasicColumn[] = [
{
title: '学年学期',
align: "center",
dataIndex: 'xnxq'
},
{
2024-05-09 22:23:08 +08:00
title: '授课日期',
align: "center",
2024-05-09 22:23:08 +08:00
dataIndex: 'createTime'
},
{
2024-05-09 22:23:08 +08:00
title: '课程名称',
align: "center",
2024-05-09 22:23:08 +08:00
dataIndex: 'kcmc'
},
{
2024-05-09 22:23:08 +08:00
title: '节次',
align: "center",
2024-05-09 22:23:08 +08:00
dataIndex: ['ketangbiaoInfo', 'hh']
},
2024-05-09 22:23:08 +08:00
// {
// title: '任务编号',
// align: "center",
// dataIndex: 'rwbh',
// },
// {
// title: '课程编号',
// align: "center",
// dataIndex: 'kcbh'
// },
// {
// title: '教室编号',
// align: "center",
// dataIndex: 'jsbh'
// },
// {
// title: '检测url',
// align: "center",
// dataIndex: 'detectionUrl'
// },
{
2024-05-09 22:23:08 +08:00
title: '检测次数',
align: "center",
2024-05-09 22:23:08 +08:00
dataIndex: 'detectionNum'
},
{
2024-05-09 22:23:08 +08:00
title: '人数(累加)',
align: "center",
2024-05-09 22:23:08 +08:00
dataIndex: 'allNum'
},
{
2024-05-09 22:23:08 +08:00
title: '平均数',
align: "center",
2024-05-09 22:23:08 +08:00
dataIndex: 'averageNum',
},
{
2024-05-09 22:23:08 +08:00
title: '选课人数',
align: "center",
2024-05-09 22:23:08 +08:00
dataIndex: ['ketangbiaoInfo', 'xkrs'],
},
{
2024-05-09 22:23:08 +08:00
title: '出勤率',
align: "center",
dataIndex: 'averageNum',
2024-05-09 22:23:08 +08:00
customRender: ({ record }) => {
let { ketangbiaoInfo, averageNum } = record;
let { xkrs } = ketangbiaoInfo;
let xkrsNum = Number(xkrs);
if(!isNaN(xkrsNum) && xkrsNum != 0 && averageNum != 0) {
let num = averageNum / xkrsNum * 100;
return num.toFixed(2) + '%';
}else{
if(averageNum == 0){
return '0.00' + '%';
}else{
return '';
}
}
}
},
2024-05-09 22:23:08 +08:00
// {
// title: 'A',
// align: "center",
// dataIndex: ['ketangbiaoInfo', 'kcmc'],
// // customRender: ({ record }) => {
// // return record?.ketangbiaoInfo?.kcmc;
// // }
// },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
{
2024-05-09 22:23:08 +08:00
label: '学年学期',
field: 'xnxq',
component: 'Input',
},
{
2024-05-09 22:23:08 +08:00
label: '授课日期',
field: 'createTime',
component: 'Input',
},
{
label: '课程名称',
field: 'kcmc',
component: 'Input',
},
{
2024-05-09 22:23:08 +08:00
label: '节次',
field: 'ketangbiaoInfo',
component: 'Input',
2024-05-09 22:23:08 +08:00
render: ({ values }) => {
let text = values?.ketangbiaoInfo?.hh;
return h(Input, { value: text, disabled: true });
}
},
{
2024-05-09 22:23:08 +08:00
label: '任务编号',
field: 'rwbh',
component: 'Input',
show: false,
},
{
label: '课程编号',
field: 'kcbh',
component: 'Input',
show: false,
},
{
label: '教室编号',
field: 'jsbh',
component: 'Input',
2024-05-09 22:23:08 +08:00
show: false,
},
{
label: '检测url',
field: 'detectionUrl',
component: 'Input',
2024-05-09 22:23:08 +08:00
show: false,
},
{
label: '检测次数',
field: 'detectionNum',
component: 'InputNumber',
},
{
label: '人数(累加)',
field: 'allNum',
component: 'InputNumber',
},
{
label: '平均数',
field: 'averageNum',
component: 'InputNumber',
},
2024-05-09 22:23:08 +08:00
{
label: '选课人数',
field: 'xkrs',
component: "Input",
render: ({ values }) => {
let text = values?.ketangbiaoInfo?.xkrs;
return h(Input, { value: text, disabled: true });
}
},
{
label: '出勤率',
field: 'averageNum',
component: "Input",
render: ({ values }) => {
let text = '';
let { ketangbiaoInfo, averageNum } = values??{};
let { xkrs } = ketangbiaoInfo??{};
let xkrsNum = Number(xkrs);
if(!isNaN(xkrsNum) && xkrsNum != 0 && averageNum != 0) {
let num = averageNum / xkrsNum * 100;
text = num.toFixed(2) + '%';
}else{
if(averageNum == 0){
text ='0.00' + '%';
}
}
return h(Input, { value: text, disabled: true });
},
},
{
label: '',
field: 'detectionDetailedList',
component: 'Input',
slot: 'detectionDetailedList',
itemProps: {
labelCol: {
span: 0,
},
wrapperCol: {
span: 24,
},
},
//span: 24,
// colProps: {
// span:0
// },
// itemProps: {
// span:24
// }
},
// TODO 主键隐藏字段目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false
},
];
//表单里的子列表
export const detectionDetailedListColumns: BasicColumn[] = [
// {
// title: '学年学期',
// align: "center",
// dataIndex: 'xnxq'
// },
// {
// title: '课程名称',
// align: "center",
// dataIndex: 'kcmc'
// },
// {
// title: '任务编号',
// align: "center",
// dataIndex: 'rwbh'
// },
// {
// title: '课程编号',
// align: "center",
// dataIndex: 'kcbh'
// },
// {
// title: '教室编号',
// align: "center",
// dataIndex: 'jsbh'
// },
2024-05-09 22:23:08 +08:00
{
title: '检测序号',
align: "center",
dataIndex: 'detectionNum'
},
{
title: '截取图片',
align: "center",
dataIndex: 'detectionOutImgUrl',
slots: { customRender: 'imgSlot' },
},
{
2024-05-09 22:23:08 +08:00
title: '检测时间',
align: "center",
2024-05-09 22:23:08 +08:00
dataIndex: 'createTime'
},
{
title: '人数',
align: "center",
dataIndex: 'num'
},
2024-05-09 22:23:08 +08:00
// {
// title: '人数计算结果',
// align: "center",
// dataIndex: 'detectionOutImgRes'
// },
// {
// title: 'A',
// align: "center",
// dataIndex: ['ketangbiaoInfo', 'kcmc'],
// // customRender: ({ record }) => {
// // return record?.ketangbiaoInfo?.kcmc;
// // }
// },
];
/**
* formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
// 默认和原始表单保持一致 如果流程中配置了权限数据这里需要单独处理formSchema
return formSchema;
}