<template>
|
<div class="list">
|
<TableCustom :queryForm="queryForm" :tableData="tableData" :total="total" @handleCurrentChange="handleCurrentChange"
|
@handleSizeChange="handleSizeChange">
|
<template #search>
|
<el-form :model="form" label-width="140px" inline>
|
<el-form-item label="所属项目课题方案:">
|
<el-input v-model="form.projectName" placeholder="请输入" />
|
</el-form-item>
|
<el-form-item label="实验编号:">
|
<el-input v-model="form.experimentNo" placeholder="请输入" />
|
</el-form-item>
|
<el-form-item label="实验名称:">
|
<el-input v-model="form.experimentName" placeholder="请输入" />
|
</el-form-item>
|
<el-form-item label="评定时间:">
|
<el-date-picker v-model="form.dateRange" type="daterange" range-separator="至" start-placeholder="开始日期"
|
end-placeholder="结束日期">
|
</el-date-picker>
|
</el-form-item>
|
<el-form-item class="search-btn-box">
|
<el-button @click="handleReset">重置</el-button>
|
<el-button type="primary" @click="handleSearch">查询</el-button>
|
</el-form-item>
|
</el-form>
|
</template>
|
<template #setting>
|
<div class="tableTitle">
|
<div class="flex a-center">
|
<div class="title active">实验员工作评定列表</div>
|
</div>
|
<el-button @click="handleAdd" class="el-icon-plus" type="primary">
|
新增实验员工作评定</el-button>
|
</div>
|
</template>
|
<template #table>
|
<el-table-column prop="projectName" label="所属项目课题方案" />
|
<el-table-column prop="experimentCode" label="实验编号" />
|
<el-table-column prop="experimentName" label="实验名称" />
|
<el-table-column prop="testerName" label="被评定实验员" />
|
<el-table-column prop="chemistIntegral" label="评定分数">
|
<template #default="{ row }">
|
<div>
|
{{
|
row.evaluateTotal
|
}}
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column prop="evaluateTime" label="评定时间" />
|
<el-table-column label="操作" width="180">
|
<template #default="{ row }">
|
<el-button type="text" style="color: #1890ff" @click="handleDetail(row)">详情</el-button>
|
<el-button type="text" style="color: #1890ff" @click="handleEdit(row)">编辑</el-button>
|
<!-- <el-button type="text" style="color: #1890ff" @click="handleDelete(row)">删除</el-button> -->
|
</template>
|
</el-table-column>
|
</template>
|
</TableCustom>
|
<ShowDelConfirm title="确认要删除这条信息吗?" tip="删除后信息无法找回" :show="changeStatus" @close="changeStatus = false"
|
@confirm="handleChangeStatusConfirm" />
|
</div>
|
</template>
|
|
<script>
|
import { chemistEvaluateList, deleteById } from "./service";
|
export default {
|
name: "TesterWorkerEvaluate",
|
data() {
|
return {
|
currentType: "list", // 当前显示类型:list-列表,draft-草稿箱
|
form: {
|
projectName: "",
|
experimentNo: "",
|
experimentName: "",
|
dateRange: [],
|
},
|
tableData: [],
|
queryForm: {
|
pageSize: 10,
|
pageNum: 1,
|
},
|
changeStatus: false,
|
total: 0,
|
rowed:{},
|
loading: false,
|
};
|
},
|
methods: {
|
calcEvaluateTotal(item) {
|
try {
|
if (item && item.resultEvaluateJson) {
|
const parsed = typeof item.resultEvaluateJson === 'string'
|
? JSON.parse(item.resultEvaluateJson)
|
: item.resultEvaluateJson
|
|
const arr = Array.isArray(parsed)
|
? parsed
|
: (Array.isArray(parsed?.activeIndex) ? parsed.activeIndex : null)
|
|
if (arr) {
|
const total = arr.reduce((sum, it) => {
|
const val = Number(it?.score)
|
return Number.isFinite(val) ? sum + val : sum
|
}, 0)
|
if (Number.isFinite(total)) return total
|
}
|
|
const direct = Number(parsed?.score)
|
if (Number.isFinite(direct)) return direct
|
}
|
} catch (e) { }
|
|
const fields = [
|
item?.evaluateOne,
|
item?.evaluateTwo,
|
item?.evaluateThree,
|
item?.evaluateFour,
|
item?.evaluateFive,
|
item?.evaluateSix,
|
]
|
return fields.reduce((sum, v) => {
|
const num = Number(v)
|
return Number.isFinite(num) ? sum + num : sum
|
}, 0)
|
},
|
async getList() {
|
this.loading = true;
|
const params = {
|
...this.queryForm,
|
projectName: this.form.projectName,
|
experimentNo: this.form.experimentNo,
|
experimentName: this.form.experimentName,
|
startTime:
|
this.form.dateRange && this.form.dateRange[0]
|
? this.form.dateRange[0]
|
: "",
|
endTime:
|
this.form.dateRange && this.form.dateRange[1]
|
? this.form.dateRange[1]
|
: "",
|
};
|
try {
|
const res = await chemistEvaluateList(params);
|
if (res && res.code === 200) {
|
const records = res.data?.records || [];
|
this.tableData = records.map((item) => ({
|
...item,
|
evaluateTotal: this.calcEvaluateTotal(item),
|
}));
|
this.total = res.data?.total || 0;
|
} else {
|
this.tableData = [];
|
this.total = 0;
|
}
|
} finally {
|
this.loading = false;
|
}
|
},
|
handleSearch() {
|
this.queryForm.pageNum = 1;
|
this.getList();
|
},
|
handleReset() {
|
this.form = {
|
projectName: "",
|
experimentNo: "",
|
experimentName: "",
|
dateRange: [],
|
};
|
this.queryForm.pageNum = 1;
|
this.getList();
|
},
|
|
handleCurrentChange(page) {
|
this.queryForm.pageNum = page;
|
this.getList();
|
},
|
handleSizeChange(size) {
|
this.queryForm.pageSize = size;
|
this.getList();
|
},
|
handleAdd() {
|
this.$router.push({
|
path: "/deliveryAssessment/addTesterWorkerEvaluate",
|
});
|
},
|
handleDetail(row) {
|
this.$router.push({
|
path: "/deliveryAssessment/detailTesterWorkerEvaluate",
|
query: { id: row.id },
|
});
|
},
|
handleEdit(row) {
|
this.$router.push({
|
path: "/deliveryAssessment/editTesterWorkerEvaluate",
|
query: { id: row.id },
|
});
|
},
|
handleDelete(row) {
|
// 删除逻辑后续补充
|
this.changeStatus = true;
|
this.rowed = row;
|
},
|
handleChangeStatusConfirm() {
|
deleteById({ id: this.rowed.id }).then(() => {
|
this.$message.success('删除成功');
|
this.changeStatus = false;
|
this.getList();
|
})
|
.catch(() => {
|
this.$message.error('删除失败');
|
});
|
}
|
},
|
mounted() {
|
this.getList();
|
},
|
};
|
</script>
|
|
<style scoped lang="less">
|
.list {
|
height: 100%;
|
}
|
|
.top-box-integral {
|
display: flex;
|
justify-content: space-between;
|
flex-wrap: wrap;
|
gap: 28px;
|
|
&-card {
|
flex: 1;
|
background: #e8faf6;
|
box-shadow: 0px 10px 10px 0px rgba(0, 0, 0, 0.06);
|
border-radius: 10px;
|
padding: 21px 20px;
|
|
&-title {
|
font-family: "SourceHanSansCN-Medium";
|
font-size: 14px;
|
color: rgba(0, 0, 0, 0.8);
|
}
|
|
&-num {
|
font-family: "SF Compact Display Black";
|
text-align: center;
|
font-weight: 900;
|
font-size: 50px;
|
color: #049c9a;
|
line-height: 60px;
|
}
|
}
|
}
|
|
.tip-warring {
|
margin-top: 20px;
|
color: rgba(255, 73, 85, 1);
|
}
|
|
.table-title {
|
width: 220px;
|
height: 50px;
|
background: #ffffff;
|
border-radius: 8px 8px 0px 0px;
|
border: 1px solid #049c9a;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
font-family: SourceHanSansCN, SourceHanSansCN;
|
font-weight: bold;
|
font-size: 18px;
|
color: #049c9a;
|
line-height: 27px;
|
}
|
|
.expand-box {
|
padding: 20px;
|
background: linear-gradient(180deg, #049c9a 0%, #0acbca 100%);
|
border-radius: 20px;
|
|
&-title {
|
font-weight: 500;
|
font-size: 16px;
|
color: #ffffff;
|
line-height: 24px;
|
margin-bottom: 20px;
|
}
|
}
|
|
.flex {
|
display: flex;
|
align-items: center;
|
}
|
|
.tableTitle {
|
display: flex;
|
padding-bottom: 20px;
|
justify-content: space-between;
|
align-items: center;
|
|
.title {
|
background: #fafafc;
|
border-radius: 8px 8px 0px 0px;
|
border: 1px solid #dcdfe6;
|
padding: 16px 29px;
|
font-weight: bold;
|
font-size: 18px;
|
color: #606266;
|
width: unset;
|
cursor: pointer;
|
}
|
|
.drafts {
|
padding: 16px 65px;
|
background: #fafafc;
|
border-radius: 8px 8px 0px 0px;
|
border: 1px solid #dcdfe6;
|
font-weight: 400;
|
font-size: 18px;
|
color: #606266;
|
margin-left: 16px;
|
cursor: pointer;
|
}
|
|
.active {
|
color: #049c9a;
|
background: #ffffff;
|
border-radius: 8px 8px 0px 0px;
|
border: 1px solid #049c9a;
|
}
|
}
|
</style>
|