<template>
|
<div class="list">
|
<TableCustom
|
:queryForm="queryForm"
|
:height="0"
|
:total="total"
|
@currentChange="handleCurrentChange"
|
@sizeChange="handleSizeChange"
|
>
|
<template #search>
|
<el-form
|
ref="searchForm"
|
:model="form"
|
:rules="rules"
|
label-width="auto"
|
inline
|
>
|
<el-form-item label="所属项目组:">
|
<el-input v-model="form.teamName" placeholder="请输入"></el-input>
|
</el-form-item>
|
<el-form-item label="检测项名称:">
|
<el-input v-model="form.itemName" placeholder="请输入"></el-input>
|
</el-form-item>
|
<el-form-item label="检测项编号:">
|
<el-input v-model="form.itemCode" placeholder="请输入"></el-input>
|
</el-form-item>
|
<el-form-item label="报告内容:">
|
<el-select v-model="form.reportContent" placeholder="请选择">
|
<el-option label="国家标准" value="1"></el-option>
|
<el-option label="分析方法开发" value="2"></el-option>
|
<el-option label="方法验证报告" value="3"></el-option>
|
<el-option label="方法确认" value="4"></el-option>
|
<el-option label="操作规程" value="5"></el-option>
|
<el-option label="方法转移记录清单" value="6"></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="状态:">
|
<el-select v-model="form.status" placeholder="请选择">
|
<el-option label="全部" value=""></el-option>
|
<el-option label="草稿箱" value="-1"></el-option>
|
<el-option label="已提交" value="1"></el-option>
|
<el-option label="待评定" value="2"></el-option>
|
<el-option label="已评定" value="3"></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="" style="margin-left: 63px">
|
<el-button
|
type="default"
|
style="margin-right: 10px"
|
@click="handleReset"
|
>重置</el-button
|
>
|
<el-button type="primary" @click="handleSearch">查询</el-button>
|
</el-form-item>
|
</el-form>
|
</template>
|
<template #setting>
|
<div class="table-setting">
|
<div class="flex a-center">
|
<div class="table-title active">项目检测项、检验包列表</div>
|
</div>
|
</div>
|
</template>
|
<template #tableCustom>
|
<Table
|
:data="tableData"
|
:total="total"
|
@row-click="handleRowClick"
|
row-key="id"
|
:height="null"
|
@currentChange="handleCurrentChange"
|
@sizeChange="handleSizeChange"
|
:expand-row-keys="expandRowKeys"
|
>
|
<el-table-column type="expand" width="1">
|
<template #default="{ row }">
|
<div class="expand-box">
|
<div style="display: flex; align-items: center">
|
<div class="expand-box-title">报告列表</div>
|
</div>
|
<Table
|
:data="reportList[row.id] || []"
|
:total="0"
|
:height="null"
|
>
|
<el-table-column prop="reportContent" label="报告内容">
|
<template #default="{ row }">
|
<span>{{ getReportContentText(row.reportContent) }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="developPerson" label="制订人" />
|
<el-table-column prop="createTime" label="制订日期" />
|
<el-table-column prop="auditPersonName" label="审批人" />
|
<el-table-column prop="auditTime" label="审批时间" />
|
<el-table-column prop="status" label="状态">
|
<template #default="{ row }">
|
<el-tag v-if="row.status == 1" type="info" color="#fff"
|
>待审核</el-tag
|
>
|
<el-tag v-if="row.status == 2" type="success" color="#fff"
|
>已通过</el-tag
|
>
|
<el-tag v-if="row.status == 3" type="danger"
|
>已驳回</el-tag
|
>
|
<el-tag v-if="row.status == 4" type="danger"
|
>已撤销</el-tag
|
>
|
</template>
|
</el-table-column>
|
<el-table-column prop="age" label="操作">
|
<template #default="{ row }">
|
<el-button type="text" v-if="row.status == 2" @click="handleApprove(row)"
|
>详情</el-button
|
>
|
</template>
|
</el-table-column>
|
</Table>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column prop="teamName" label="所属项目组" />
|
<el-table-column prop="itemName" label="检测项名称" />
|
<el-table-column prop="itemCode" label="检测项编号" />
|
<el-table-column prop="remark" label="备注" />
|
<el-table-column prop="createBy" label="创建人" />
|
<el-table-column prop="createTime" label="创建时间" />
|
<el-table-column prop="age" label="状态">
|
<template #default="{ row }">
|
<el-tag v-if="row.status == -1" type="info" color="#fff"
|
>草稿箱</el-tag
|
>
|
<el-tag v-else-if="row.status == 1" type="warning">已提交</el-tag>
|
<el-tag v-else-if="row.status == 2" type="primary">待评定</el-tag>
|
<el-tag v-else-if="row.status == 3" type="success">已评定</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column prop="age" label="操作">
|
<template #default="{ row }">
|
<template>
|
<el-button
|
v-if="row.status == 2 && isProcessEngineer"
|
type="text"
|
@click="handleReportDetail(row, 'approve')"
|
>评定</el-button
|
>
|
<el-button
|
v-else
|
type="text"
|
@click="handleReportDetail(row, 'detail')"
|
>详情</el-button
|
>
|
</template>
|
</template>
|
</el-table-column>
|
</Table>
|
</template>
|
</TableCustom>
|
|
<Approval
|
:visible="showApproval"
|
@close="closeApproval"
|
:data="rowData"
|
:type="approvalType"
|
/>
|
<AssessmentDialog
|
:modelValue="showAssessmentDialog"
|
:reportData="assessmentDialogData"
|
:id="assessmentDialogId"
|
:type="assessmentDialogType"
|
@close="handleCloseAssessmentDialog"
|
/>
|
</div>
|
</template>
|
|
<script>
|
import Approval from "./components/approval";
|
import AssessmentDialog from "./components/AssessmentDialog.vue";
|
import { getDataList, getListByItemId } from "./service";
|
|
export default {
|
name: "ProjectList",
|
components: {
|
Approval,
|
AssessmentDialog,
|
},
|
data() {
|
return {
|
form: {
|
itemCode: "", // 检测项编号
|
itemName: "", // 检测项名称
|
reportContent: "", // 报告内容
|
status: "", // 状态,默认为空字符串表示全部
|
teamName: "", // 项目组名称
|
pageNum: 1,
|
pageSize: 10,
|
},
|
rules: {
|
itemCode: [
|
{ max: 50, message: "检测项编号不能超过50个字符", trigger: "blur" },
|
],
|
itemName: [
|
{ max: 100, message: "检测项名称不能超过100个字符", trigger: "blur" },
|
],
|
teamName: [
|
{ max: 100, message: "项目组名称不能超过100个字符", trigger: "blur" },
|
],
|
},
|
showSubmitConfirm: false,
|
showDelConfirm: false,
|
confirmTitle: "", // 确认框标题
|
confirmTip: "", // 确认框提示
|
confirmType: "", // 确认框类型:'deleteReport'-删除报告, 'deleteItem'-删除检测项, 'revoke'-撤销审批
|
rowId: "",
|
showApproval: false,
|
approvalType: "", // 新增:审批类型
|
submitTitle: "", // 新增:提交评定确认框标题
|
submitTip: "", // 新增:提交评定确认框提示
|
queryForm: {
|
pageSize: 10,
|
pageNum: 1,
|
},
|
tableData: [],
|
expandRowKeys: [],
|
total: 0,
|
rowData: {},
|
reportList: {}, // 修改为对象,用行ID作为key
|
currentRow: null,
|
currentAction: "",
|
showItemApproval: false,
|
loading: false,
|
showAssessmentDialog: false,
|
assessmentDialogData: {},
|
assessmentDialogId: "",
|
assessmentDialogType: "detail",
|
};
|
},
|
computed: {
|
isChemist() {
|
const userInfo = JSON.parse(sessionStorage.getItem("userInfo") || "{}");
|
return userInfo.roleType == 4; // 2是化验师
|
},
|
isProcessEngineer() {
|
const userInfo = JSON.parse(sessionStorage.getItem("userInfo") || "{}");
|
return userInfo.roleType == 3; // 3是工艺工程师
|
},
|
isApprovaler() {
|
const userInfo = JSON.parse(sessionStorage.getItem("userInfo") || "{}");
|
return userInfo.roleType == 2; // 2是审批人
|
},
|
},
|
methods: {
|
closeApproval() {
|
this.showApproval = false;
|
this.rowData = {};
|
this.approvalType = "";
|
this.getList();
|
},
|
handleCloseAssessmentDialog(){
|
this.showAssessmentDialog = false;
|
this.assessmentDialogData = {};
|
this.assessmentDialogId = '';
|
this.assessmentDialogType = ''; // 或 'evaluate',根据业务调整
|
this.getList();
|
},
|
async handleRowClick(row, column, event) {
|
if (column.label == "操作") return;
|
const currentOpenId = this.expandRowKeys[0];
|
if (currentOpenId === row.id) {
|
// 如果点的是当前已展开的,关闭它
|
this.expandRowKeys = [];
|
delete this.reportList[row.id];
|
} else {
|
// 如果有其他已展开的,先关闭
|
if (currentOpenId) {
|
this.expandRowKeys = [];
|
delete this.reportList[currentOpenId];
|
}
|
// 展开新行
|
this.expandRowKeys = [row.id];
|
try {
|
const res = await getListByItemId({ id: row.id });
|
if (res) {
|
this.$set(this.reportList, row.id, res || []);
|
} else {
|
this.msgError(res.msg || "获取报告列表失败");
|
}
|
} catch (error) {
|
console.error("获取报告列表失败:", error);
|
this.msgError("获取报告列表失败");
|
}
|
}
|
},
|
handleApprove(row) {
|
this.showApproval = true;
|
this.rowId = row.id;
|
this.rowData = row;
|
this.approvalType = "detail";
|
},
|
handleCurrentChange(page) {
|
this.queryForm.pageNum = page;
|
this.getList();
|
},
|
handleSizeChange(size) {
|
this.queryForm.pageSize = size;
|
this.getList();
|
},
|
async getList() {
|
if (this.loading) return;
|
try {
|
this.loading = true;
|
const params = {
|
...this.form,
|
pageNum: this.queryForm.pageNum,
|
pageSize: this.queryForm.pageSize,
|
};
|
let res;
|
res = await getDataList(params);
|
if (res.code === 200) {
|
this.tableData = res.data.records || [];
|
this.total = res.data.total || 0;
|
} else {
|
this.$message.error(res.msg || "获取列表失败");
|
}
|
} catch (error) {
|
console.error("获取列表失败:", error);
|
this.$message.error("获取列表失败,请重试");
|
} finally {
|
this.loading = false;
|
}
|
},
|
// 打开评定弹窗
|
handleReportDetail(row, type) {
|
this.assessmentDialogData = row;
|
this.assessmentDialogId = row.id;
|
this.assessmentDialogType = type; // 或 'evaluate',根据业务调整
|
this.showAssessmentDialog = true;
|
},
|
getReportContentText(value) {
|
const contentMap = {
|
1: "国家标准",
|
2: "分析方法开发",
|
3: "方法验证报告",
|
4: "方法确认",
|
5: "操作规程",
|
6: "方法转移记录清单",
|
};
|
return contentMap[value] || value;
|
},
|
async handleSearch() {
|
try {
|
console.log("111111111");
|
// this.loading = true;
|
await this.$refs.searchForm.validate();
|
this.queryForm.pageNum = 1;
|
await this.getList();
|
} catch (error) {
|
// 如果是校验失败,error会是false,此时不做任何处理,因为el-form会展示错误信息
|
if (error !== false) {
|
this.$message.error("查询失败,请重试");
|
}
|
} finally {
|
this.loading = false;
|
}
|
},
|
async handleReset() {
|
try {
|
// this.loading = true;
|
this.$refs.searchForm.resetFields();
|
// resetFields会把status也置为初始值'',需要根据当前tab重新设置
|
this.form = {
|
itemCode: "",
|
itemName: "",
|
reportContent: "",
|
status: "",
|
teamName: "",
|
pageNum: 1,
|
pageSize: 10,
|
};
|
this.queryForm.pageNum = 1;
|
await this.getList();
|
} catch (error) {
|
this.$message.error("重置失败,请重试");
|
} finally {
|
this.loading = false;
|
}
|
},
|
},
|
mounted() {
|
this.getList();
|
},
|
};
|
</script>
|
|
<style scoped lang="less">
|
.el-icon-plus {
|
margin-bottom: 20px;
|
}
|
|
.header-content {
|
font-family: PingFangSC, PingFang SC;
|
font-weight: 400;
|
font-size: 14px;
|
color: rgba(0, 0, 0, 0.88);
|
margin-left: 30px;
|
}
|
|
.box-title {
|
font-family: SourceHanSansCN, SourceHanSansCN;
|
font-weight: bold;
|
font-size: 18px;
|
color: #222222;
|
line-height: 27px;
|
display: flex;
|
align-items: center;
|
}
|
|
.header-icon {
|
width: 20px;
|
height: 20px;
|
margin-right: 10px;
|
}
|
|
.header-box {
|
border-radius: 16px;
|
margin-bottom: 30px;
|
}
|
|
.table-setting {
|
display: flex;
|
padding-bottom: 20px;
|
justify-content: space-between;
|
align-items: center;
|
}
|
|
.flex {
|
display: flex;
|
align-items: center;
|
}
|
|
.table-title {
|
width: 220px;
|
height: 50px;
|
background: #fafafc;
|
border-radius: 8px 8px 0px 0px;
|
border: 1px solid #dcdfe6;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
font-family: SourceHanSansCN, SourceHanSansCN;
|
font-weight: bold;
|
font-size: 18px;
|
color: #606266;
|
line-height: 27px;
|
cursor: pointer;
|
transition: all 0.3s ease;
|
|
&.active {
|
color: #049c9a;
|
background: #ffffff;
|
border: 1px solid #049c9a;
|
}
|
}
|
|
.table-tit {
|
width: 166px;
|
height: 50px;
|
background: #fafafc;
|
border-radius: 8px 8px 0px 0px;
|
border: 1px solid #dcdfe6;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
font-family: SourceHanSansCN, SourceHanSansCN;
|
font-weight: bold;
|
font-size: 18px;
|
color: #606266;
|
line-height: 27px;
|
margin-left: 16px;
|
cursor: pointer;
|
transition: all 0.3s ease;
|
|
&.active {
|
color: #049c9a;
|
background: #ffffff;
|
border: 1px solid #049c9a;
|
}
|
}
|
|
.list {
|
height: 100%;
|
}
|
|
.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;
|
}
|
}
|
</style>
|