Browse Source

绩效评分设计

master
wbc 1 week ago
parent
commit
5e47f96927
  1. 138
      src/views/performanceIndicator/projectAssessment/addModal.vue
  2. 36
      src/views/performanceIndicator/projectAssessment/index.vue
  3. 2
      src/views/performanceIndicator/projectAssessment/projectAssessment.api.ts
  4. 11
      src/views/performanceIndicator/templateContent/templateContent.api.ts

138
src/views/performanceIndicator/projectAssessment/addModal.vue

@ -5,16 +5,21 @@
<a-form :model="form" layout="vertical" ref="formRef" :rules="rules"> <a-form :model="form" layout="vertical" ref="formRef" :rules="rules">
<a-row :gutter="[16, 16]"> <a-row :gutter="[16, 16]">
<a-col :span="12"> <a-col :span="12">
<a-form-item label="项目名称" name="projectName"> <a-form-item label="项目名称" name="projectId">
<a-input v-model:value="form.projectName" placeholder="请输入考核项目" /> <a-select
v-model:value="form.projectId"
:options="projectNameOptions"
placeholder="请选择项目名称"
:disabled="!isDisabled"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="[16, 16]"> <a-row :gutter="[16, 16]">
<a-col :span="12"> <a-col :span="12">
<a-form-item label="模板名称" name="templateName"> <a-form-item label="模板名称" name="templateId">
<a-select <a-select
v-model:value="form.templateName" v-model:value="form.templateId"
:options="templateNameOptions" :options="templateNameOptions"
@change="templateNameChange" @change="templateNameChange"
placeholder="请选择模板" placeholder="请选择模板"
@ -23,6 +28,7 @@
value: 'type', value: 'type',
options: 'options', options: 'options',
}" }"
:disabled="!isDisabled"
/> />
</a-form-item> </a-form-item>
</a-col> </a-col>
@ -30,20 +36,51 @@
<a-row :gutter="[16, 16]"> <a-row :gutter="[16, 16]">
<a-col :span="24"> <a-col :span="24">
<a-table <a-table
:dataSource="form.dataSource" :dataSource="form.performancescoreList"
:columns="columns" :columns="columns"
bordered bordered
:pagination="false" :pagination="false"
> >
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column && record && column.dataIndex === 'realScores'&&record.primaryIndicator!='附加分'"> <template
v-if="
column &&
record &&
column.dataIndex === 'realScores' &&
record.primaryIndicator != '附加分'
"
>
<a-input-number <a-input-number
v-model:value="record.realScores" v-model:value="record.realScores"
:min="0" :min="0"
:max="record.scores" :max="record.scores"
:disabled="!isDisabled"
/> />
</template> </template>
</template> </template>
<template #summary>
<a-table-summary-row>
<a-table-summary-cell>总计</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text />
</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text />
</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text />
</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text />
</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text>{{ totals.scores }}</a-typography-text>
</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text type="danger">{{ totals.realScores }}</a-typography-text>
</a-table-summary-cell>
</a-table-summary-row>
</template>
</a-table> </a-table>
</a-col> </a-col>
</a-row> </a-row>
@ -55,13 +92,23 @@
<script> <script>
import { computed, reactive, ref } from 'vue'; import { computed, reactive, ref } from 'vue';
import { getPerformancescore, getPerforman } from '../templateContent/templateContent.api'; import {
getPerformancescore,
getPerforman,
getSubProjectNames,
submitRating,
getRatingDetail,
updateRatingDetail,
deleteRating,
} from '../templateContent/templateContent.api';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { e } from 'unocss';
export default { export default {
setup() { setup(props,{emit}) {
const title = ref('新增绩效考核'); const title = ref('新增绩效考核');
const visible = ref(false); const visible = ref(false);
const formRef = ref(); const formRef = ref();
const isDisabled = ref(true)
const columns = [ const columns = [
{ {
title: '评价维度', title: '评价维度',
@ -150,46 +197,77 @@
}, },
]; ];
const form = reactive({ const form = reactive({
projectName: '', projectId: '',
templateName: null, templateId: null,
dataSource: [], performancescoreList: [],
assessmentId: null,
}); });
const showModal = async (type, id) => { const showModal = async (id,isEdit) => {
visible.value = true; visible.value = true;
isDisabled.value = isEdit
const data = await getPerforman(); const data = await getPerforman();
templateNameOptions.value = data; templateNameOptions.value = data;
const data1 = await getSubProjectNames();
projectNameOptions.value = data1;
if (id) {
const formData = await getRatingDetail({id:id});
const data2 = formData.data
console.log(data2)
for (let i in form) {
form[i] = data2[i];
}
}
};
const totals = computed(() => {
let scores = 0;
let realScores = 0;
form.performancescoreList?.forEach((i) => {
i.realScores = Number(i.realScores);
scores += i.scores;
realScores += i.realScores;
});
return {
scores,
realScores,
}; };
});
// //
const projectNameOptions = ref([]); const projectNameOptions = ref([]);
const templateNameOptions = ref([]); const templateNameOptions = ref([]);
const templateNameChange = async (val) => { const templateNameChange = async (val) => {
const data = await getPerformancescore({ type: val }); const data = await getPerformancescore({ type: val });
form.dataSource = data; form.performancescoreList = data;
}; };
const handleOk = () => { const handleOk = () => {
// let params = {}; if (form.performancescoreList && form.performancescoreList.length > 0) {
// for (let i in form) {
// params[i] = form[i];
// }
// add(params).then((_) => {
// message.success('');
// emit('success');
// closeModal();
// });
if (form.dataSource && form.dataSource.length > 0) {
let scored = true; let scored = true;
for (let i = 0; i < form.dataSource.length; i++) { for (let i = 0; i < form.performancescoreList.length; i++) {
if (!form.dataSource[i].realScores&&form.dataSource[i].primaryIndicator!='附加分') { if (form.performancescoreList[i].realScores==null && form.performancescoreList[i].primaryIndicator != '附加分') {
message.warning('请完成评分后再提交'); message.warning('请完成评分后再提交');
console.log(i) console.log(i);
scored = false; scored = false;
break; break;
} }
} }
if (scored) { if (scored) {
console.log(form); const params = {};
for (let i in form) {
params[i] = form[i];
}
if (params.assessmentId) {
updateRatingDetail(params).then((res) => {
message.success('编辑成功');
emit('success');
closeModal();
});
} else {
submitRating(params).then((res) => {
message.success('新增成功');
emit('success');
closeModal();
});
}
} }
} else { } else {
message.warning('请完成评分后再提交'); message.warning('请完成评分后再提交');
@ -197,7 +275,7 @@
}; };
const closeModal = () => { const closeModal = () => {
formRef.value.resetFields(); formRef.value.resetFields();
form.dataSource = []; form.performancescoreList = [];
}; };
return { return {
visible, visible,
@ -211,6 +289,8 @@
projectNameOptions, projectNameOptions,
templateNameOptions, templateNameOptions,
templateNameChange, templateNameChange,
totals,
isDisabled
}; };
}, },
}; };

36
src/views/performanceIndicator/projectAssessment/index.vue

@ -19,7 +19,7 @@
</ProjectinfoComponent> </ProjectinfoComponent>
<addProjectAssessment @register="registerProjectAssessment" @close="closeModel" /> <addProjectAssessment @register="registerProjectAssessment" @close="closeModel" />
<detailTabel @register="registerDetailTable" /> --> <detailTabel @register="registerDetailTable" /> -->
<addModal ref="addModalRef"></addModal> <addModal ref="addModalRef" @success="reload()"></addModal>
</PageWrapper> </PageWrapper>
</template> </template>
@ -38,6 +38,10 @@ import { projectAssessmentColumns } from '@/views/performanceIndicator/projectAs
import detailTabel from './detailTabel.vue' import detailTabel from './detailTabel.vue'
import ProjectinfoComponent from '@/views/ProcessApprovalSubPage/component/ProjectinfoComponent.vue' import ProjectinfoComponent from '@/views/ProcessApprovalSubPage/component/ProjectinfoComponent.vue'
import addProjectAssessment from './addProjectAssessment.vue' import addProjectAssessment from './addProjectAssessment.vue'
import {
deleteRating,
} from '../templateContent/templateContent.api';
import { message } from "ant-design-vue";
const [registerProjectAssessment, { openModal: openModalProjectAssessment, closeModal: closeModalProjectAssessment }] = useModal(); const [registerProjectAssessment, { openModal: openModalProjectAssessment, closeModal: closeModalProjectAssessment }] = useModal();
const [registerProjectinfo, { openModal: openModalProjectinfo, closeModal: closeModalProjectinfo }] = useModal(); const [registerProjectinfo, { openModal: openModalProjectinfo, closeModal: closeModalProjectinfo }] = useModal();
const [registerDetailTable, { openModal: openModalDetailTable }] = useModal(); const [registerDetailTable, { openModal: openModalDetailTable }] = useModal();
@ -81,28 +85,27 @@ function getTableAction(record): ActionItem[] {
onClick: handleModify.bind(null, record), onClick: handleModify.bind(null, record),
}, },
// { {
// label: '', label: '删除',
// ifShow: () => { ifShow: () => {
// return isShowByRoles("manageOrg") && (record.children == null || record.projectId != null) return isShowByRoles("manageOrg") && (record.children == null || record.projectId != null)
// }, },
// popConfirm: { popConfirm: {
// title: '?', title: '确定删除吗?',
// confirm: handleDelete.bind(null, record), confirm: handleDelete.bind(null, record),
// }, },
// } }
]; ];
} }
function handledetail(record) { function handledetail(record) {
openModalDetailTable(true, { projectid: record.projectId }) addModalRef.value.showModal(record.id,false)
} }
/** /**
* 修改 * 修改
*/ */
function handleModify(record) { function handleModify(record) {
console.log(record, projectid.value) addModalRef.value.showModal(record.id,true)
openModalProjectAssessment(true, { projectid: record.projectId, type: record.type,ismodify:true })
} }
/** /**
@ -121,7 +124,8 @@ function openModalProjectr(value) {
openModalProjectAssessment(true, { projectid: value.id,type: type,ismodify:false }) openModalProjectAssessment(true, { projectid: value.id,type: type,ismodify:false })
} }
async function handleDelete(record) { async function handleDelete(record) {
await deleteProjectassessment({ projectId: record.projectId}) await deleteRating(record.id)
message.success('删除成功')
reload() reload()
} }
@ -135,7 +139,7 @@ function closeModel() {
// } // }
const addModalRef = ref() const addModalRef = ref()
function handleAdd() { function handleAdd() {
addModalRef.value.showModal() addModalRef.value.showModal(null,true)
} }
</script> </script>

2
src/views/performanceIndicator/projectAssessment/projectAssessment.api.ts

@ -10,6 +10,7 @@ export enum Api {
getProjectassessmentByprojectId="/huzhouProjectassessment/getProjectassessmentByprojectId", getProjectassessmentByprojectId="/huzhouProjectassessment/getProjectassessmentByprojectId",
uploadProjectassessmentFile="/huzhouProjectassessment/uploadProjectassessmentFile", uploadProjectassessmentFile="/huzhouProjectassessment/uploadProjectassessmentFile",
getProjectassessmentIncludeSys="/huzhouProjectassessment/getProjectassessmentIncludeSys", getProjectassessmentIncludeSys="/huzhouProjectassessment/getProjectassessmentIncludeSys",
getSubProjectNames="/huzhouSubProjectinfo/getSubProjectNames",
} }
/** /**
@ -25,3 +26,4 @@ export const getProjectassessmentIncludeSys = (params?) => defHttp.get({ url: Ap
export const getProjectassessmentProjectPageList = (params?) => defHttp.get({ url: Api.getProjectassessmentProjectPageList, params }); export const getProjectassessmentProjectPageList = (params?) => defHttp.get({ url: Api.getProjectassessmentProjectPageList, params });
export const uploadProjectassessmentFile = (params?) =>defHttp.post({ url: Api.uploadProjectassessmentFile,headers:{ "Content-Type": "multipart/form-data" }, params }) export const uploadProjectassessmentFile = (params?) =>defHttp.post({ url: Api.uploadProjectassessmentFile,headers:{ "Content-Type": "multipart/form-data" }, params })
export const getSubProjectNames = () => defHttp.get({ url: Api.getSubProjectNames });

11
src/views/performanceIndicator/templateContent/templateContent.api.ts

@ -6,6 +6,11 @@ export enum Api {
getPerformancescore = '/huzhouPerformancescore/getPerformancescore', getPerformancescore = '/huzhouPerformancescore/getPerformancescore',
getPerforman = "/huzhouPerformancescore/getPerforman", getPerforman = "/huzhouPerformancescore/getPerforman",
addPerformance = "/huzhouPerformancescore/addPerformance", addPerformance = "/huzhouPerformancescore/addPerformance",
getSubProjectNames = "/huzhouSubProjectinfo/getSubProjectNames",
submitRating = "/huzhouProjectassessment/submitRating",
getRatingDetail = "/huzhouProjectassessment/getRatingDetail",
deleteRating = "/huzhouProjectassessment",
updateRatingDetail = "/huzhouProjectassessment/updateRatingDetail",
} }
@ -17,4 +22,8 @@ export const importPerformancescore = (params?) =>defHttp.post({ url: Api.impor
export const getPerformancescore = (params?) => defHttp.get({ url: Api.getPerformancescore, params }); export const getPerformancescore = (params?) => defHttp.get({ url: Api.getPerformancescore, params });
export const getPerforman = (params?) => defHttp.get({ url: Api.getPerforman, params }); export const getPerforman = (params?) => defHttp.get({ url: Api.getPerforman, params });
export const addPerformance = (params?) => defHttp.post({ url: Api.addPerformance, headers: { 'Content-Type': 'multipart/form-data' }, params }); export const addPerformance = (params?) => defHttp.post({ url: Api.addPerformance, headers: { 'Content-Type': 'multipart/form-data' }, params });
export const getSubProjectNames = () => defHttp.get({ url: Api.getSubProjectNames });
export const submitRating = (params?) => defHttp.post({ url: Api.submitRating, params });
export const getRatingDetail = (params?) => defHttp.get({ url: Api.getRatingDetail,params});
export const updateRatingDetail = (params?) => defHttp.put({ url: Api.updateRatingDetail,params});
export const deleteRating = (params?) => defHttp.delete({ url: `${Api.deleteRating}/${params}`});

Loading…
Cancel
Save