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

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: '...',
// 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) => {
item.currentScore = 0
@ -203,7 +203,7 @@ const assessmentCriteriaRulesByCkProjectId = async function (ckProjectId) {
const selectorCheckedType = ref<string>('')
const selectorType = ref<CkProjectListByType[]>()
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)
if (res.data?.length === 0) {
@ -326,7 +326,7 @@ const onSubmit = async function () {
}
Object.assign(assessmentRecordParams, _form)
assessmentRecordParams.assessmentRecordDetails = [...assessmentRecordDetails.value]
const result = await api.post('/assessmentCriteria/submitAssessmentRecord', assessmentRecordParams)
const result = await api.post('/m2/sa/submitAssessmentRecord', assessmentRecordParams)
clearData() //
if (result.code === 200) {

View File

@ -1,40 +1,40 @@
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";
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 }> = {}
const { data } = await api.get<DeductedDetailRes[]>('/m1/ar/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}
groupRowSpan[item.ckGroupId] = { count: 1, firstIndex: index }
} else {
groupRowSpan[item.ckGroupId].count++;
groupRowSpan[item.ckGroupId].count++
data[index].groupRowSpan = 0
}
}
if (item.ckItemId) {
if (!itemRowSpan[item.ckItemId]) {
itemRowSpan[item.ckItemId] = {count: 1, firstIndex: index}
itemRowSpan[item.ckItemId] = { count: 1, firstIndex: index }
} else {
itemRowSpan[item.ckItemId].count++;
itemRowSpan[item.ckItemId].count++
data[index].itemRowSpan = 0
}
}
})
Object.values(groupRowSpan).forEach(({count, firstIndex}) => {
data[firstIndex].groupRowSpan = count;
Object.values(groupRowSpan).forEach(({ count, firstIndex }) => {
data[firstIndex].groupRowSpan = count
})
Object.values(itemRowSpan).forEach(({count, firstIndex}) => {
data[firstIndex].itemRowSpan = count;
Object.values(itemRowSpan).forEach(({ count, firstIndex }) => {
data[firstIndex].itemRowSpan = count
})
const ckProjectDetailTableColumns: ColumnsType<DeductedDetailRes> = [
@ -43,44 +43,57 @@ export const deductedDetail = async (assessmentRecord: AssessmentRecordPagerVo)
title: '考核分组',
customCell: (_record) => {
return {
rowspan: _record.groupRowSpan
rowspan: _record.groupRowSpan,
}
},
customRender: ({record: _record}) => {
return <div>
<p>{_record.groupName}({_record.groupTotalScore})</p>
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
rowspan: _record.itemRowSpan,
}
},
customRender: ({record: _record}) => {
customRender: ({ record: _record }) => {
if (!_record.ckItemId) {
return '/'
}
return <div>
<p>{_record.itemName}({_record.itemType?.label})
return (
<div>
<p>
{_record.itemName}({_record.itemType?.label})
</p>
</div>
}
}, {
)
},
},
{
dataIndex: 'standardName',
title: '标准',
customRender: ({record: _record}) => {
customRender: ({ record: _record }) => {
if (!_record.ckStandardId) {
return '/'
}
return <div>
<p style={{color: _record.isSelected ? 'red' : ''}}>{_record.standardName}{_record.deductionPoints}</p>
return (
<div>
<p style={{ color: _record.isSelected ? 'red' : '' }}>
{_record.standardName}{_record.deductionPoints}
</p>
</div>
}
}
)
},
},
]
Modal.info({
@ -88,16 +101,10 @@ export const deductedDetail = async (assessmentRecord: AssessmentRecordPagerVo)
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>
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>
<div>
<TableProMax ref="tableRef" :request-api="reqApi" :columns="columns">
</TableProMax>
<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";
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) //
type TableProps = TableProMaxProps<AssessmentRecordPagerVo, AssessmentRecordPagerQueryParams>
const reqApi: TableProps['requestApi'] = (params) => api.post('/m1/ar/pager', params) //
const columns: TableProps['columns'] = [
{
dataIndex: 'enterprisesUnitName',
title: '单位名称'
}, {
title: '单位名称',
},
{
dataIndex: 'type',
title: '类型',
customRender: ({text}) => text?.label
}, {
customRender: ({ text }) => text?.label,
},
{
dataIndex: 'ckProjectName',
title: '考核项目'
}, {
title: '考核项目',
},
{
dataIndex: 'totalScore',
title: '总分'
}, {
title: '总分',
},
{
dataIndex: 'deductionPointsTotal',
title: '扣分',
customRender:({record})=>{
customRender: ({ record }) => {
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',
title: '得分',
customRender: ({record}) => record.totalScore - record.deductionPointsTotal
}, {
customRender: ({ record }) => record.totalScore - record.deductionPointsTotal,
},
{
dataIndex: 'policeUnitName',
title: '考核单位'
}, {
title: '考核单位',
},
{
dataIndex: 'createUserName',
title: '考核人'
}, {
title: '考核人',
},
{
dataIndex: 'createTime',
title: '考核时间'
}, {
title: '考核时间',
},
{
dataIndex: 'remark',
title: '考核备注'
}, {
title: '考核备注',
},
{
dataIndex: 'signature',
title: '签字',
customRender:({record})=>{
return <a-button onClick={()=>{
customRender: ({ record }) => {
return (
<a-button
onClick={() => {
Modal.info({
title: `${record.enterprisesUnitName}${record.ckProjectName} 签字结果`,
content: () => <>
<div>审核人签字: <a-image src={record.assessmentUserSignature}/>
content: () => (
<>
<div>
审核人签字: <a-image src={record.assessmentUserSignature} />
</div>
<div>
被审核单位人员签字: <a-image src={record.byAssessmentEnterprisesUnitUserSignature} />
</div>
<div>被审核单位人员签字: <a-image src={record.byAssessmentEnterprisesUnitUserSignature}/></div>
</>
),
})
}}>查看</a-button>
}}
>
查看
</a-button>
)
},
},
}
]
</script>
<style scoped lang="scss">
</style>
<style scoped lang="scss"></style>