148 lines
4.6 KiB
Vue
148 lines
4.6 KiB
Vue
<template>
|
|
<div>
|
|
<TableProMax ref="tableRef" :request-api="reqApi" :columns="columns">
|
|
</TableProMax>
|
|
<div>
|
|
<a-modal v-model:open="open" title="扣分项" @ok="open = false" width="80%">
|
|
<a-table :columns="TableColumns" :data-source="dataSource" :pagination="false" bordered>
|
|
<template #bodyCell="{ column, record }">
|
|
<template v-if="column.key === 'itemName'">
|
|
<ul>
|
|
<li v-for="(item, index) in record.itemName" :key="index">
|
|
{{ item.itemName }}
|
|
</li>
|
|
</ul>
|
|
</template>
|
|
<template v-if="column.key === 'deductionStandards'">
|
|
<ul>
|
|
<li v-for="(item, index) in record.itemName" :key="index">
|
|
<ul>
|
|
<li v-for="(standard, standardIndex) in item.standards" :key="standardIndex">
|
|
{{ standard.standardName }}
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</template>
|
|
</template>
|
|
</a-table>
|
|
</a-modal>>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="tsx">
|
|
|
|
import TableProMax from "@/components/table/TableProMax.vue";
|
|
import api from "@/axios";
|
|
import {TableProMaxProps} from "@/types/components/table";
|
|
import {
|
|
AssessmentRecordPagerQueryParams,
|
|
AssessmentRecordPagerVo,
|
|
} from "@/types/views/assessmentRecord.ts";
|
|
import {ComponentExposed} from "vue-component-type-helpers";
|
|
import {computed, ref} from "vue";
|
|
import {Modal} from "ant-design-vue";
|
|
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
|
|
type TableProps = TableProMaxProps<AssessmentRecordPagerVo,AssessmentRecordPagerQueryParams>
|
|
|
|
const open = ref<boolean>(false);
|
|
const reqApi: TableProps['requestApi'] = (params) => api.post('/assessmentRecord/pager', params) //分页
|
|
const columns: TableProps['columns'] = [
|
|
{
|
|
dataIndex: 'enterprisesUnitName',
|
|
title: '单位名称'
|
|
}, {
|
|
dataIndex: 'type',
|
|
title: '类型',
|
|
customRender: ({text}) => text?.label
|
|
}, {
|
|
dataIndex: 'ckProjectName',
|
|
title: '考核项目'
|
|
}, {
|
|
dataIndex: 'totalScore',
|
|
title: '总分'
|
|
}, {
|
|
dataIndex: 'deductionPointsTotal',
|
|
title: '扣分',
|
|
customRender:({record})=>{
|
|
if (!record.deductionPointsTotal) {
|
|
return <a-tag color="green">0</a-tag>
|
|
}
|
|
return <a-tag class="pointer" color="red" onClick={()=>deductionPointsTotalTable(record)}>{record.deductionPointsTotal}</a-tag>
|
|
}
|
|
}, {
|
|
dataIndex: 'result',
|
|
title: '得分',
|
|
customRender: ({record}) => record.totalScore - record.deductionPointsTotal
|
|
}, {
|
|
dataIndex: 'policeUnitName',
|
|
title: '考核单位'
|
|
}, {
|
|
dataIndex: 'createUserName',
|
|
title: '考核人'
|
|
}, {
|
|
dataIndex: 'createTime',
|
|
title: '考核时间'
|
|
}, {
|
|
dataIndex: 'remark',
|
|
title: '考核备注'
|
|
}, {
|
|
dataIndex: 'signature',
|
|
title: '签字',
|
|
customRender:({record})=>{
|
|
return <a-button onClick={()=>{
|
|
Modal.info({
|
|
title: `${record.enterprisesUnitName}${record.ckProjectName} 签字结果`,
|
|
content: () => <>
|
|
<div>审核人签字: <a-image src={record.assessmentUserSignature}/>
|
|
</div>
|
|
<div>被审核单位人员签字: <a-image src={record.byAssessmentEnterprisesUnitUserSignature}/></div>
|
|
</>
|
|
})
|
|
}}>查看</a-button>
|
|
},
|
|
}
|
|
]
|
|
const groupRow = ref({})
|
|
const TableColumns = [
|
|
{ title: '考核分组', dataIndex: 'groupName', key: 'groupName' },
|
|
{ title: '考核项', dataIndex: 'itemName', key: 'itemName', slots: { customRender: 'bodyCell' } },
|
|
{ title: '扣分标准', dataIndex: 'deductionStandards', key: 'deductionStandards', slots: { customRender: 'bodyCell' } }
|
|
];
|
|
|
|
const dataSource = computed(() => {
|
|
return Object.keys(groupRow.value).map(groupName => ({
|
|
key: groupName,
|
|
groupName: groupName,
|
|
itemName: Object.values(groupRow.value[groupName])
|
|
}));
|
|
});
|
|
|
|
|
|
const deductionPointsTotalTable =async(record:AssessmentRecordPagerVo)=>{
|
|
const resp = await api.get('/assessmentRecord/deductedDetail',{assessmentRecordId:record.snowFlakeId})
|
|
resp.data.forEach((item,index)=>{
|
|
if (!groupRow.value[item.groupName]) {
|
|
groupRow.value[item.groupName] = {};
|
|
}
|
|
if (!groupRow.value[item.groupName][item.ckItemId]) {
|
|
groupRow.value[item.groupName][item.ckItemId] = {
|
|
itemName: item.itemName,
|
|
standards: []
|
|
};
|
|
}
|
|
groupRow.value[item.groupName][item.ckItemId].standards.push(item);
|
|
})
|
|
open.value = true
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
|
|
</style> |