|
|
@ -5,16 +5,21 @@ |
|
|
|
<a-form :model="form" layout="vertical" ref="formRef" :rules="rules"> |
|
|
|
<a-row :gutter="[16, 16]"> |
|
|
|
<a-col :span="12"> |
|
|
|
<a-form-item label="项目名称" name="projectName"> |
|
|
|
<a-input v-model:value="form.projectName" placeholder="请输入考核项目" /> |
|
|
|
<a-form-item label="项目名称" name="projectId"> |
|
|
|
<a-select |
|
|
|
v-model:value="form.projectId" |
|
|
|
:options="projectNameOptions" |
|
|
|
placeholder="请选择项目名称" |
|
|
|
:disabled="!isDisabled" |
|
|
|
/> |
|
|
|
</a-form-item> |
|
|
|
</a-col> |
|
|
|
</a-row> |
|
|
|
<a-row :gutter="[16, 16]"> |
|
|
|
<a-col :span="12"> |
|
|
|
<a-form-item label="模板名称" name="templateName"> |
|
|
|
<a-form-item label="模板名称" name="templateId"> |
|
|
|
<a-select |
|
|
|
v-model:value="form.templateName" |
|
|
|
v-model:value="form.templateId" |
|
|
|
:options="templateNameOptions" |
|
|
|
@change="templateNameChange" |
|
|
|
placeholder="请选择模板" |
|
|
@ -23,6 +28,7 @@ |
|
|
|
value: 'type', |
|
|
|
options: 'options', |
|
|
|
}" |
|
|
|
:disabled="!isDisabled" |
|
|
|
/> |
|
|
|
</a-form-item> |
|
|
|
</a-col> |
|
|
@ -30,20 +36,51 @@ |
|
|
|
<a-row :gutter="[16, 16]"> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-table |
|
|
|
:dataSource="form.dataSource" |
|
|
|
:dataSource="form.performancescoreList" |
|
|
|
:columns="columns" |
|
|
|
bordered |
|
|
|
:pagination="false" |
|
|
|
> |
|
|
|
<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 |
|
|
|
v-model:value="record.realScores" |
|
|
|
:min="0" |
|
|
|
:max="record.scores" |
|
|
|
:disabled="!isDisabled" |
|
|
|
/> |
|
|
|
</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-col> |
|
|
|
</a-row> |
|
|
@ -55,13 +92,23 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
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 { e } from 'unocss'; |
|
|
|
export default { |
|
|
|
setup() { |
|
|
|
setup(props,{emit}) { |
|
|
|
const title = ref('新增绩效考核'); |
|
|
|
const visible = ref(false); |
|
|
|
const formRef = ref(); |
|
|
|
const isDisabled = ref(true) |
|
|
|
const columns = [ |
|
|
|
{ |
|
|
|
title: '评价维度', |
|
|
@ -150,54 +197,85 @@ |
|
|
|
}, |
|
|
|
]; |
|
|
|
const form = reactive({ |
|
|
|
projectName: '', |
|
|
|
templateName: null, |
|
|
|
dataSource: [], |
|
|
|
projectId: '', |
|
|
|
templateId: null, |
|
|
|
performancescoreList: [], |
|
|
|
assessmentId: null, |
|
|
|
}); |
|
|
|
|
|
|
|
const showModal = async (type, id) => { |
|
|
|
const showModal = async (id,isEdit) => { |
|
|
|
visible.value = true; |
|
|
|
isDisabled.value = isEdit |
|
|
|
const data = await getPerforman(); |
|
|
|
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 templateNameOptions = ref([]); |
|
|
|
const templateNameChange = async (val) => { |
|
|
|
const data = await getPerformancescore({ type: val }); |
|
|
|
form.dataSource = data; |
|
|
|
form.performancescoreList = data; |
|
|
|
}; |
|
|
|
const handleOk = () => { |
|
|
|
// let params = {}; |
|
|
|
// for (let i in form) { |
|
|
|
// params[i] = form[i]; |
|
|
|
// } |
|
|
|
// add(params).then((_) => { |
|
|
|
// message.success('新增成功'); |
|
|
|
// emit('success'); |
|
|
|
// closeModal(); |
|
|
|
// }); |
|
|
|
|
|
|
|
if (form.dataSource && form.dataSource.length > 0) { |
|
|
|
if (form.performancescoreList && form.performancescoreList.length > 0) { |
|
|
|
let scored = true; |
|
|
|
for (let i = 0; i < form.dataSource.length; i++) { |
|
|
|
if (!form.dataSource[i].realScores&&form.dataSource[i].primaryIndicator!='附加分') { |
|
|
|
for (let i = 0; i < form.performancescoreList.length; i++) { |
|
|
|
if (form.performancescoreList[i].realScores==null && form.performancescoreList[i].primaryIndicator != '附加分') { |
|
|
|
message.warning('请完成评分后再提交'); |
|
|
|
console.log(i) |
|
|
|
console.log(i); |
|
|
|
scored = false; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
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('请完成评分后再提交'); |
|
|
|
} |
|
|
|
}; |
|
|
|
const closeModal = () => { |
|
|
|
formRef.value.resetFields(); |
|
|
|
form.dataSource = []; |
|
|
|
form.performancescoreList = []; |
|
|
|
}; |
|
|
|
return { |
|
|
|
visible, |
|
|
@ -211,6 +289,8 @@ |
|
|
|
projectNameOptions, |
|
|
|
templateNameOptions, |
|
|
|
templateNameChange, |
|
|
|
totals, |
|
|
|
isDisabled |
|
|
|
}; |
|
|
|
}, |
|
|
|
}; |
|
|
|