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

302 lines
6.0 KiB
TypeScript
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 { 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';
//列表数据
export const columns: BasicColumn[] = [
{
title: '学年学期',
align: "center",
dataIndex: 'xnxq'
},
{
title: '授课日期',
align: "center",
dataIndex: 'createTime'
},
{
title: '课程名称',
align: "center",
dataIndex: 'kcmc'
},
{
title: '节次',
align: "center",
dataIndex: ['ketangbiaoInfo', 'hh']
},
// {
// title: '任务编号',
// align: "center",
// dataIndex: 'rwbh',
// },
// {
// title: '课程编号',
// align: "center",
// dataIndex: 'kcbh'
// },
// {
// title: '教室编号',
// align: "center",
// dataIndex: 'jsbh'
// },
// {
// title: '检测url',
// align: "center",
// dataIndex: 'detectionUrl'
// },
{
title: '检测次数',
align: "center",
dataIndex: 'detectionNum'
},
{
title: '人数(累加)',
align: "center",
dataIndex: 'allNum'
},
{
title: '平均数',
align: "center",
dataIndex: 'averageNum',
},
{
title: '选课人数',
align: "center",
dataIndex: ['ketangbiaoInfo', 'xkrs'],
},
{
title: '出勤率',
align: "center",
dataIndex: 'averageNum',
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 '';
}
}
}
},
// {
// title: 'A',
// align: "center",
// dataIndex: ['ketangbiaoInfo', 'kcmc'],
// // customRender: ({ record }) => {
// // return record?.ketangbiaoInfo?.kcmc;
// // }
// },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '学年学期',
field: 'xnxq',
component: 'Input',
},
{
label: '授课日期',
field: 'createTime',
component: 'Input',
},
{
label: '课程名称',
field: 'kcmc',
component: 'Input',
},
{
label: '节次',
field: 'ketangbiaoInfo',
component: 'Input',
render: ({ values }) => {
let text = values?.ketangbiaoInfo?.hh;
return h(Input, { value: text, disabled: true });
}
},
{
label: '任务编号',
field: 'rwbh',
component: 'Input',
show: false,
},
{
label: '课程编号',
field: 'kcbh',
component: 'Input',
show: false,
},
{
label: '教室编号',
field: 'jsbh',
component: 'Input',
show: false,
},
{
label: '检测url',
field: 'detectionUrl',
component: 'Input',
show: false,
},
{
label: '检测次数',
field: 'detectionNum',
component: 'InputNumber',
},
{
label: '人数(累加)',
field: 'allNum',
component: 'InputNumber',
},
{
label: '平均数',
field: 'averageNum',
component: 'InputNumber',
},
{
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'
// },
{
title: '检测序号',
align: "center",
dataIndex: 'detectionNum'
},
{
title: '截取图片',
align: "center",
dataIndex: 'detectionOutImgUrl',
slots: { customRender: 'imgSlot' },
},
{
title: '检测时间',
align: "center",
dataIndex: 'createTime'
},
{
title: '人数',
align: "center",
dataIndex: 'num'
},
// {
// 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;
}