接口 替换 :小程序 考核、后台考核

This commit is contained in:
TimSpan 2024-11-22 15:36:05 +08:00
parent 559787c931
commit aa9d10083a
3 changed files with 179 additions and 162 deletions

View File

@ -166,7 +166,7 @@ const assessmentCriteriaRulesByCkProjectId = async function (ckProjectId) {
// title: '...', // title: '...',
// mask: true, // mask: true,
// }) // })
const res = await api.get<StarRating[]>(`/assessmentCriteria/assessmentCriteriaRulesByCkProjectId`, { ckProjectId }) const res = await api.get<StarRating[]>(`/m2/sa/assessmentCriteriaRulesByCkProjectId`, { ckProjectId })
res.data?.forEach((item) => { res.data?.forEach((item) => {
item.currentScore = 0 item.currentScore = 0
@ -203,7 +203,7 @@ const assessmentCriteriaRulesByCkProjectId = async function (ckProjectId) {
const selectorCheckedType = ref<string>('') const selectorCheckedType = ref<string>('')
const selectorType = ref<CkProjectListByType[]>() const selectorType = ref<CkProjectListByType[]>()
const ckProjectListByType = async function (type) { const ckProjectListByType = async function (type) {
const res = await api.get<CkProjectListByType[]>(`/assessmentCriteria/ckProjectListByType`, { type }) const res = await api.get<CkProjectListByType[]>(`/m2/sa/ckProjectListByType`, { type })
console.log(res.data) console.log(res.data)
if (res.data?.length === 0) { if (res.data?.length === 0) {
@ -326,7 +326,7 @@ const onSubmit = async function () {
} }
Object.assign(assessmentRecordParams, _form) Object.assign(assessmentRecordParams, _form)
assessmentRecordParams.assessmentRecordDetails = [...assessmentRecordDetails.value] assessmentRecordParams.assessmentRecordDetails = [...assessmentRecordDetails.value]
const result = await api.post('/assessmentCriteria/submitAssessmentRecord', assessmentRecordParams) const result = await api.post('/m2/sa/submitAssessmentRecord', assessmentRecordParams)
clearData() // clearData() //
if (result.code === 200) { if (result.code === 200) {

View File

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

@ -1,92 +1,102 @@
<template> <template>
<div> <div>
<TableProMax ref="tableRef" :request-api="reqApi" :columns="columns"> <TableProMax ref="tableRef" :request-api="reqApi" :columns="columns"> </TableProMax>
</TableProMax> </div>
</div>
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import TableProMax from "@/components/table/TableProMax.vue"; import TableProMax from '@/components/table/TableProMax.vue'
import api from "@/axios"; import api from '@/axios'
import {TableProMaxProps} from "@/types/components/table"; import { TableProMaxProps } from '@/types/components/table'
import { import { AssessmentRecordPagerQueryParams, AssessmentRecordPagerVo } from '@/types/views/assessmentRecord.ts'
AssessmentRecordPagerQueryParams, import { ComponentExposed } from 'vue-component-type-helpers'
AssessmentRecordPagerVo, import { ref } from 'vue'
} from "@/types/views/assessmentRecord.ts"; import { Modal } from 'ant-design-vue'
import {ComponentExposed} from "vue-component-type-helpers"; import { deductedDetail } from '@/views/query/assessmentIndex.tsx'
import { ref} from "vue";
import {Modal} from "ant-design-vue";
import {deductedDetail} from "@/views/query/assessmentIndex.tsx";
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!) const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
type TableProps = TableProMaxProps<AssessmentRecordPagerVo,AssessmentRecordPagerQueryParams> type TableProps = TableProMaxProps<AssessmentRecordPagerVo, AssessmentRecordPagerQueryParams>
const reqApi: TableProps['requestApi'] = (params) => api.post('/assessmentRecord/pager', params) // const reqApi: TableProps['requestApi'] = (params) => api.post('/m1/ar/pager', params) //
const columns: TableProps['columns'] = [ const columns: TableProps['columns'] = [
{ {
dataIndex: 'enterprisesUnitName', dataIndex: 'enterprisesUnitName',
title: '单位名称' title: '单位名称',
}, { },
{
dataIndex: 'type', dataIndex: 'type',
title: '类型', title: '类型',
customRender: ({text}) => text?.label customRender: ({ text }) => text?.label,
}, { },
{
dataIndex: 'ckProjectName', dataIndex: 'ckProjectName',
title: '考核项目' title: '考核项目',
}, { },
{
dataIndex: 'totalScore', dataIndex: 'totalScore',
title: '总分' title: '总分',
}, { },
{
dataIndex: 'deductionPointsTotal', dataIndex: 'deductionPointsTotal',
title: '扣分', title: '扣分',
customRender:({record})=>{ customRender: ({ record }) => {
if (!record.deductionPointsTotal) { if (!record.deductionPointsTotal) {
return <a-tag color="green">0</a-tag> return <a-tag color='green'>0</a-tag>
} }
return <a-tag class="pointer" color="red" onClick={()=>deductedDetail(record)}>{record.deductionPointsTotal}</a-tag> return (
} <a-tag class='pointer' color='red' onClick={() => deductedDetail(record)}>
}, { {record.deductionPointsTotal}
</a-tag>
)
},
},
{
dataIndex: 'result', dataIndex: 'result',
title: '得分', title: '得分',
customRender: ({record}) => record.totalScore - record.deductionPointsTotal customRender: ({ record }) => record.totalScore - record.deductionPointsTotal,
}, { },
{
dataIndex: 'policeUnitName', dataIndex: 'policeUnitName',
title: '考核单位' title: '考核单位',
}, { },
{
dataIndex: 'createUserName', dataIndex: 'createUserName',
title: '考核人' title: '考核人',
}, { },
{
dataIndex: 'createTime', dataIndex: 'createTime',
title: '考核时间' title: '考核时间',
}, { },
{
dataIndex: 'remark', dataIndex: 'remark',
title: '考核备注' title: '考核备注',
}, { },
{
dataIndex: 'signature', dataIndex: 'signature',
title: '签字', title: '签字',
customRender:({record})=>{ customRender: ({ record }) => {
return <a-button onClick={()=>{ return (
Modal.info({ <a-button
title: `${record.enterprisesUnitName}${record.ckProjectName} 签字结果`, onClick={() => {
content: () => <> Modal.info({
<div>审核人签字: <a-image src={record.assessmentUserSignature}/> title: `${record.enterprisesUnitName}${record.ckProjectName} 签字结果`,
</div> content: () => (
<div>被审核单位人员签字: <a-image src={record.byAssessmentEnterprisesUnitUserSignature}/></div> <>
</> <div>
}) 审核人签字: <a-image src={record.assessmentUserSignature} />
}}>查看</a-button> </div>
<div>
被审核单位人员签字: <a-image src={record.byAssessmentEnterprisesUnitUserSignature} />
</div>
</>
),
})
}}
>
查看
</a-button>
)
}, },
} },
] ]
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss"></style>
</style>