This commit is contained in:
TimSpan 2024-11-15 17:24:35 +08:00
commit 6e98206c1e
7 changed files with 415 additions and 1 deletions

View File

@ -20,6 +20,7 @@ declare module 'vue' {
ADropdown: typeof import('ant-design-vue/es')['Dropdown']
AForm: typeof import('ant-design-vue/es')['Form']
AFormItem: typeof import('ant-design-vue/es')['FormItem']
AImage: typeof import('ant-design-vue/es')['Image']
AInput: typeof import('ant-design-vue/es')['Input']
AInputNumber: typeof import('ant-design-vue/es')['InputNumber']
AInputPassword: typeof import('ant-design-vue/es')['InputPassword']

View File

@ -82,6 +82,16 @@ export const staticRouter: RouteRecordRaw[] =
},
component: () => import('@/views/query/publicUnit.vue')
},
{
path: 'assessment-record', // 这里使用相对路径而不是 '/register'
name: 'assessment-record',
meta: {
title: '考核记录',
keepalive: true
},
component: () => import('@/views/query/assessmentRecord.vue')
}
// {
// path: 'weapp-user', // 这里使用相对路径而不是 '/register'
// name: 'weapp-user',

View File

@ -0,0 +1,61 @@
import {BaseTableRowRecord} from "@/types/components/table";
import {BaseEnum} from "../../../global";
export interface AssessmentRecordPagerVo extends BaseTableRowRecord {
/** 企事业单位名称 **/
enterprisesUnitName: string;
/** 考核项目名称 **/
ckProjectName: string;
/** 考核项目总分 **/
totalScore: number;
/** 考核项目类型 **/
type: BaseEnum<string>;
/** 考核项目备注 **/
ckProjectRemark: string;
/** 公安单位名称 **/
policeUnitName: string;
/** 考核人员签字 **/
assessmentUserSignature: string;
/** 被考核单位人员签字 **/
byAssessmentEnterprisesUnitUserSignature: string;
/** 考核备注 **/
remark: string;
/** 总扣分 **/
deductionPointsTotal: number;
}
export interface AssessmentRecordPagerQueryParams {
type: string
}
export interface DeductedDetailRes {
/*考核分组id */
ckGroupId: number;
groupRowSpan: number;
/*考核分组名字 */
groupName: string;
/*考核分组总分 */
groupTotalScore: number;
/*考核分组备注 */
groupRemark: string;
/*考核项id */
ckItemId: number;
itemRowSpan: number;
/*考核项名字 */
itemName: string;
/*组件类型,可用值:RADIO,MULTIPLE */
itemType: BaseEnum<string>;
/*考核项备注 */
itemRemark: string;
/*考核标准id */
ckStandardId: number;
/*考核标准 */
standardName: string;
/*扣分数 */
deductionPoints: Record<string, unknown>;
/*是否选中 */
isSelected: boolean;
}

View File

@ -0,0 +1,103 @@
import api from "@/axios";
import {AssessmentRecordPagerVo, DeductedDetailRes} from "@/types/views/assessmentRecord.ts";
import {ColumnsType} from "ant-design-vue/es/table";
import {Modal, Table} from "ant-design-vue";
export const deductedDetail = async (assessmentRecord: AssessmentRecordPagerVo) => {
const {data} = await api.get<DeductedDetailRes[]>('/assessmentRecord/deductedDetail', {assessmentRecordId: assessmentRecord.snowFlakeId})
const groupRowSpan: Record<string, { firstIndex: number, count: number }> = {}
const itemRowSpan: Record<string, { firstIndex: number, count: number }> = {}
data.forEach((item, index) => {
//如果第一次没有值
if (item.ckGroupId) {
if (!groupRowSpan[item.ckGroupId]) {
groupRowSpan[item.ckGroupId] = {count: 1, firstIndex: index}
} else {
groupRowSpan[item.ckGroupId].count++;
data[index].groupRowSpan = 0
}
}
if (item.ckItemId) {
if (!itemRowSpan[item.ckItemId]) {
itemRowSpan[item.ckItemId] = {count: 1, firstIndex: index}
} else {
itemRowSpan[item.ckItemId].count++;
data[index].itemRowSpan = 0
}
}
})
Object.values(groupRowSpan).forEach(({count, firstIndex}) => {
data[firstIndex].groupRowSpan = count;
})
Object.values(itemRowSpan).forEach(({count, firstIndex}) => {
data[firstIndex].itemRowSpan = count;
})
const ckProjectDetailTableColumns: ColumnsType<DeductedDetailRes> = [
{
dataIndex: 'groupName',
title: '考核分组',
customCell: (_record) => {
return {
rowspan: _record.groupRowSpan
}
},
customRender: ({record: _record}) => {
return <div>
<p>{_record.groupName}({_record.groupTotalScore})</p>
<p>{_record.groupRemark}</p>
</div>
}
}, {
dataIndex: 'itemName',
title: '考核项',
customCell: (_record) => {
return {
rowspan: _record.itemRowSpan
}
},
customRender: ({record: _record}) => {
if (!_record.ckItemId) {
return '/'
}
return <div>
<p>{_record.itemName}({_record.itemType?.label})
</p>
</div>
}
}, {
dataIndex: 'standardName',
title: '标准',
customRender: ({record: _record}) => {
if (!_record.ckStandardId) {
return '/'
}
return <div>
<p style={{color: _record.isSelected ? 'red' : ''}}>{_record.standardName}{_record.deductionPoints}</p>
</div>
}
}
]
Modal.info({
title: `${assessmentRecord.enterprisesUnitName}/${assessmentRecord.ckProjectName}】扣分详情`,
icon: ' ',
width: '80%',
centered: true,
content: () => <div style={{height: '80vh', overflow: 'auto'}}>
<Table
size="small"
bordered
pagination={false}
class="margin-top-xs"
columns={ckProjectDetailTableColumns}
data-source={data}
></Table>
</div>
})
}

View File

@ -0,0 +1,92 @@
<template>
<div>
<TableProMax ref="tableRef" :request-api="reqApi" :columns="columns">
</TableProMax>
</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 { ref} from "vue";
import {Modal} from "ant-design-vue";
import {deductedDetail} from "@/views/query/assessmentIndex.tsx";
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
type TableProps = TableProMaxProps<AssessmentRecordPagerVo,AssessmentRecordPagerQueryParams>
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={()=>deductedDetail(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>
},
}
]
</script>
<style scoped lang="scss">
</style>

View File

@ -0,0 +1,148 @@
<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>

View File

@ -26,7 +26,6 @@ import { publicUnitPagerQueryParams, FromItem } from '@/types/views/publicUnit.t
// import FormProMax from '@/components/form/FormProMax.vue'
import { FormProMaxItemOptions } from '@/types/components/form//index.ts'
import { FormExpose } from 'ant-design-vue/es/form/Form'
import { message } from 'ant-design-vue'
import { showEnterprisesUnit } from './index'
const formRef = ref<FormExpose>(null)
type TableProps = TableProMaxProps<publicUnitPagerQueryParams>