Commit ad69e459 authored by 徐俊's avatar 徐俊

xujun

parent 3c3031de
......@@ -468,6 +468,9 @@ export default {
projectExport (params) {
return fetch(`/v1/science-admin/com-project/projectExport/${params.id}`, params, 'get', 'json')
},
updateDefenseScore (params) {
return fetch(`/v1/science-admin/com-project/updateDefenseScore`, params, 'post', 'json')
},
},
talent: {
getListByPage (params) {
......
......@@ -43,6 +43,9 @@
<template slot="projName" slot-scope="record">
<a @click="recordClick(record, 'view')">{{record.projName}}</a>
</template>
<template slot="defenseInfo" slot-scope="record">
<editable-cell :text="record.defenseScore" @change="onCellChange(record.id, 'defenseScore', $event)" />
</template>
<template slot="auditResultName" slot-scope="record">
<span v-if="record">
{{ record }}
......@@ -99,10 +102,46 @@ import projectView from '@/views/report/project/components/projectView'
import unitTreeSelect from '@/views/components/common/unitTreeSelect'
import scoreView from '@/views/evaluation/components/scoreView'
const EditableCell = {
template: `
<div class="editable-cell">
<div v-if="editable" class="editable-cell-input-wrapper">
<a-input-number :value="value" :min="0" :max="100" :step="1" @change="handleChange" @pressEnter="check" />
<a-icon type="check" class="editable-cell-icon-check" @click="check"/>
</div>
<div v-else class="editable-cell-text-wrapper">
{{ value || ' ' }}
<a-icon type="edit" class="editable-cell-icon" @click="edit" />
</div>
</div>
`,
props: {
text: Number,
},
data() {
return {
value: this.text,
editable: false,
};
},
methods: {
handleChange(value) {
this.value = value;
},
check() {
this.editable = false;
this.$emit('change', this.value);
},
edit() {
this.editable = true;
},
},
};
export default {
name: "projectFinal",
components: {
projectView, paraSelect, audit, unitTreeSelect, projectAssignDetail, scoreView, batchAudit
projectView, paraSelect, audit, unitTreeSelect, projectAssignDetail, scoreView, batchAudit, EditableCell,
},
data () {
return {
......@@ -134,8 +173,9 @@ export default {
],
itemCount: [0, 0, 0, 0, 0],
columns: [
{ title: "项目名称", scopedSlots: { customRender: 'projName' } },
{ title: "项目名称", scopedSlots: { customRender: 'projName' }, ellipsis: true, width: 300 },
{ title: "项目编号", dataIndex: "projNo", align: 'center' },
{ title: "答辩分数", scopedSlots: { customRender: 'defenseInfo' }, align: 'center', width: 150 },
{ title: "项目类别", dataIndex: 'projClassName' , align: 'center' },
{ title: '申报单位', dataIndex: 'appUnitName', align: 'center' },
{ title: '申报人', dataIndex: 'appPersonName', align: 'center' },
......@@ -359,7 +399,68 @@ export default {
this.loading = false
}
}).catch(() => { this.loading = false })
},
onCellChange(key, dataIndex, value) {
const target = this.tableData.find(item => item.id === key);
if (target) {
target[dataIndex] = value;
// 调用API更新数据
this.$api.project.updateDefenseScore({
id: target.id,
defenseScore: value
}).then(() => {
this.$message.success('答辩分数更新成功')
this.getListByPage()
}).catch(() => {
this.$message.error('答辩分数更新失败,请稍后再试')
});
}
}
},
};
</script>
\ No newline at end of file
</script>
<style>
.editable-cell {
position: relative;
}
.editable-cell-input-wrapper,
.editable-cell-text-wrapper {
padding-right: 24px;
}
.editable-cell-text-wrapper {
padding: 5px 24px 5px 5px;
}
.editable-cell-icon,
.editable-cell-icon-check {
position: absolute;
right: 0;
width: 20px;
cursor: pointer;
}
.editable-cell-icon {
line-height: 18px;
display: none;
}
.editable-cell-icon-check {
line-height: 28px;
}
.editable-cell:hover .editable-cell-icon {
display: inline-block;
}
.editable-cell-icon:hover,
.editable-cell-icon-check:hover {
color: #108ee9;
}
.editable-add-btn {
margin-bottom: 8px;
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment