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

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,40 +1,40 @@
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 (item.ckItemId) {
if (!itemRowSpan[item.ckItemId]) { if (!itemRowSpan[item.ckItemId]) {
itemRowSpan[item.ckItemId] = {count: 1, firstIndex: index} itemRowSpan[item.ckItemId] = { count: 1, firstIndex: index }
} else { } else {
itemRowSpan[item.ckItemId].count++; itemRowSpan[item.ckItemId].count++
data[index].itemRowSpan = 0 data[index].itemRowSpan = 0
} }
} }
}) })
Object.values(groupRowSpan).forEach(({count, firstIndex}) => { Object.values(groupRowSpan).forEach(({ count, firstIndex }) => {
data[firstIndex].groupRowSpan = count; data[firstIndex].groupRowSpan = count
}) })
Object.values(itemRowSpan).forEach(({count, firstIndex}) => { Object.values(itemRowSpan).forEach(({ count, firstIndex }) => {
data[firstIndex].itemRowSpan = count; data[firstIndex].itemRowSpan = count
}) })
const ckProjectDetailTableColumns: ColumnsType<DeductedDetailRes> = [ const ckProjectDetailTableColumns: ColumnsType<DeductedDetailRes> = [
@ -43,44 +43,57 @@ export const deductedDetail = async (assessmentRecord: AssessmentRecordPagerVo)
title: '考核分组', title: '考核分组',
customCell: (_record) => { customCell: (_record) => {
return { return {
rowspan: _record.groupRowSpan rowspan: _record.groupRowSpan,
} }
}, },
customRender: ({record: _record}) => { customRender: ({ record: _record }) => {
return <div> return (
<p>{_record.groupName}({_record.groupTotalScore})</p> <div>
<p>
{_record.groupName}({_record.groupTotalScore})
</p>
<p>{_record.groupRemark}</p> <p>{_record.groupRemark}</p>
</div> </div>
} )
}, { },
},
{
dataIndex: 'itemName', dataIndex: 'itemName',
title: '考核项', title: '考核项',
customCell: (_record) => { customCell: (_record) => {
return { return {
rowspan: _record.itemRowSpan rowspan: _record.itemRowSpan,
} }
}, },
customRender: ({record: _record}) => { customRender: ({ record: _record }) => {
if (!_record.ckItemId) { if (!_record.ckItemId) {
return '/' return '/'
} }
return <div> return (
<p>{_record.itemName}({_record.itemType?.label}) <div>
<p>
{_record.itemName}({_record.itemType?.label})
</p> </p>
</div> </div>
} )
}, { },
},
{
dataIndex: 'standardName', dataIndex: 'standardName',
title: '标准', title: '标准',
customRender: ({record: _record}) => { customRender: ({ record: _record }) => {
if (!_record.ckStandardId) { if (!_record.ckStandardId) {
return '/' return '/'
} }
return <div> return (
<p style={{color: _record.isSelected ? 'red' : ''}}>{_record.standardName}{_record.deductionPoints}</p> <div>
<p style={{ color: _record.isSelected ? 'red' : '' }}>
{_record.standardName}{_record.deductionPoints}
</p>
</div> </div>
} )
} },
},
] ]
Modal.info({ Modal.info({
@ -88,16 +101,10 @@ export const deductedDetail = async (assessmentRecord: AssessmentRecordPagerVo)
icon: ' ', icon: ' ',
width: '80%', width: '80%',
centered: true, centered: true,
content: () => <div style={{height: '80vh', overflow: 'auto'}}> content: () => (
<Table <div style={{ height: '80vh', overflow: 'auto' }}>
size="small" <Table size='small' bordered pagination={false} class='margin-top-xs' columns={ckProjectDetailTableColumns} data-source={data}></Table>
bordered
pagination={false}
class="margin-top-xs"
columns={ckProjectDetailTableColumns}
data-source={data}
></Table>
</div> </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 (
<a-button
onClick={() => {
Modal.info({ Modal.info({
title: `${record.enterprisesUnitName}${record.ckProjectName} 签字结果`, title: `${record.enterprisesUnitName}${record.ckProjectName} 签字结果`,
content: () => <> content: () => (
<div>审核人签字: <a-image src={record.assessmentUserSignature}/> <>
<div>
审核人签字: <a-image src={record.assessmentUserSignature} />
</div>
<div>
被审核单位人员签字: <a-image src={record.byAssessmentEnterprisesUnitUserSignature} />
</div> </div>
<div>被审核单位人员签字: <a-image src={record.byAssessmentEnterprisesUnitUserSignature}/></div>
</> </>
),
}) })
}}>查看</a-button> }}
>
查看
</a-button>
)
},
}, },
}
] ]
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss"></style>
</style>