<template>
|
<el-dialog
|
:title="dialogTitle"
|
:visible.sync="visible"
|
width="80%"
|
:close-on-click-modal="false"
|
@close="handleClose"
|
>
|
<div class="approval-dialog">
|
<!-- 左侧审批内容 -->
|
<div class="approval-content">
|
<Card class="approval-content-card">
|
<template style="position: relative">
|
<div class="header-title">
|
<div class="header-title-left">
|
<img src="@/assets/public/headercard.png" />
|
<span>项目课题方案信息</span>
|
</div>
|
</div>
|
<el-form
|
ref="form"
|
:model="form"
|
:rules="rules"
|
inline
|
label-position="top"
|
style="margin-top: 38px"
|
>
|
<el-form-item prop="projectName" label="项目课题方案名称">
|
<el-input
|
v-model="form.projectName"
|
placeholder="请输入"
|
disabled
|
/>
|
</el-form-item>
|
<el-form-item prop="projectStage" label="项目阶段">
|
<el-select
|
v-model="form.projectStage"
|
placeholder="请选择"
|
disabled
|
>
|
<el-option label="实验室开发阶段" :value="1" />
|
<el-option label="中式试验阶段" :value="2" />
|
<el-option label="生产验证试验阶段" :value="3" />
|
</el-select>
|
</el-form-item>
|
<el-form-item prop="projectCode" label="项目课题方案编号">
|
<el-input
|
v-model="form.projectCode"
|
placeholder="请输入"
|
disabled
|
/>
|
</el-form-item>
|
</el-form>
|
<div class="header-title">
|
<div class="header-title-left">
|
<img src="@/assets/public/headercard.png" />
|
<div>一 、实验目的</div>
|
</div>
|
</div>
|
<AiEditor
|
ref="purposeEditor"
|
:value="form.experimentObjective"
|
height="200px"
|
:readOnly="true"
|
/>
|
<div class="header-title">
|
<div class="header-title-left">
|
<img src="@/assets/public/headercard.png" />
|
<div>二 、实验拆料和设备</div>
|
</div>
|
</div>
|
<div class="item-title">
|
<span>1.实验材料</span>
|
</div>
|
<AiEditor
|
ref="materialEditor"
|
:value="form.experimentMaterial"
|
height="200px"
|
:readOnly="true"
|
/>
|
<div class="item-title">
|
<span>2.实验设备</span>
|
</div>
|
<AiEditor
|
ref="equipmentEditor"
|
:value="form.experimentDevice"
|
height="200px"
|
:readOnly="true"
|
/>
|
<div class="header-title">
|
<div class="header-title-left">
|
<img src="@/assets/public/headercard.png" />
|
<div>三 、检测方法及开发</div>
|
</div>
|
</div>
|
<AiEditor
|
ref="methodEditor"
|
:value="form.experimentTestMethod"
|
height="200px"
|
:readOnly="true"
|
/>
|
<div class="header-title">
|
<div class="header-title-left">
|
<img src="@/assets/public/headercard.png" />
|
<div>四 、实验步骤</div>
|
</div>
|
</div>
|
<AiEditor
|
ref="stepsEditor"
|
:value="form.experimentProcedure"
|
height="200px"
|
:readOnly="true"
|
/>
|
<div class="header-title">
|
<div class="header-title-left">
|
<img src="@/assets/public/headercard.png" />
|
<div>五 、数据采集及分析</div>
|
</div>
|
</div>
|
<AiEditor
|
ref="dataAnalysisEditor"
|
:value="form.dataAcquisition"
|
height="200px"
|
:readOnly="true"
|
/>
|
<div class="header-title">
|
<div class="header-title-left">
|
<img src="@/assets/public/headercard.png" />
|
<div>六 、结果评估</div>
|
</div>
|
</div>
|
<AiEditor
|
ref="evaluationEditor"
|
:value="form.resultEvaluation"
|
height="200px"
|
:readOnly="true"
|
/>
|
<div class="header-title">
|
<div class="header-title-left">
|
<img src="@/assets/public/headercard.png" />
|
<span>注意事项</span>
|
</div>
|
</div>
|
<AiEditor
|
ref="notesEditor"
|
:value="form.precautions"
|
height="200px"
|
:readOnly="true"
|
/>
|
</template>
|
</Card>
|
</div>
|
<!-- 右侧审批流程 -->
|
<div class="approval-flow">
|
<div class="flow-content">
|
<approval-process :processData="form.processData" />
|
</div>
|
</div>
|
</div>
|
<div class="approval-dialog-approve" v-if="type === 'approve'">
|
<div class="status">
|
<div class="status-title">审批结果</div>
|
<div class="status-content">
|
<div
|
class="resolve"
|
:class="status == '1' && 'activeStatus'"
|
@click.stop="status = 1"
|
>
|
通过
|
</div>
|
<div
|
class="reject"
|
:class="status == '2' && 'activeStatus'"
|
@click.stop="status = 2"
|
>
|
驳回
|
</div>
|
</div>
|
</div>
|
<div class="remark">
|
<div class="remark-title">审批意见</div>
|
<el-input
|
type="textarea"
|
v-model="remark"
|
placeholder="请输入审批意见"
|
/>
|
</div>
|
</div>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="handleClose">取 消</el-button>
|
<el-button
|
type="primary"
|
style="margin-left: 20px"
|
@click="handleApprove"
|
v-if="type === 'approve'"
|
>通过</el-button
|
>
|
</div>
|
</el-dialog>
|
</template>
|
|
<script>
|
import ApprovalProcess from "@/components/approvalProcess";
|
import { getDetailById, audit } from "../service";
|
import AiEditor from "@/components/AiEditor";
|
|
export default {
|
name: "ApprovalDialog",
|
components: {
|
ApprovalProcess,
|
AiEditor,
|
},
|
props: {
|
visible: {
|
type: Boolean,
|
default: false,
|
},
|
type: {
|
type: String,
|
default: "approve", // approve-审批,view-查看
|
},
|
data: {
|
type: Object,
|
default: () => ({}),
|
},
|
},
|
data() {
|
return {
|
form: {
|
projectName: "",
|
projectCode: "",
|
projectStage: "",
|
experimentObjective: "",
|
experimentMaterial: "",
|
experimentDevice: "",
|
experimentTestMethod: "",
|
experimentProcedure: "",
|
dataAcquisition: "",
|
resultEvaluation: "",
|
precautions: "",
|
auditStatus: "",
|
createTime: "",
|
approver: "",
|
approveTime: "",
|
processData: [],
|
},
|
rules: {},
|
status: "1",
|
remark: "",
|
};
|
},
|
computed: {
|
dialogTitle() {
|
return this.type === "approve" ? "审批" : "审批详情";
|
},
|
},
|
watch: {
|
visible: {
|
handler(val) {
|
console.log("visible", val, "22", this.data);
|
if (val && this.data && this.data.id) {
|
this.getDetail(this.data.id);
|
}
|
},
|
immediate: true,
|
},
|
},
|
methods: {
|
// 获取详情
|
getDetail(id) {
|
console.log("获取详情参数:", { id });
|
getDetailById({ id })
|
.then((res) => {
|
console.log("获取详情:", res);
|
if (res) {
|
this.form = { ...res, processData: [] };
|
// 组装流程数据
|
let processData = [];
|
// 提交节点
|
processData.push({
|
type: "primary",
|
mode: "list",
|
fields: [
|
{ label: "提交人:", value: res.updateBy || "" },
|
{ label: "提交时间:", value: res.createTime || "" },
|
],
|
});
|
if (res.auditStatus == 2 || res.auditStatus == 3) {
|
processData.push({
|
type:
|
res.auditStatus === 2
|
? "primary"
|
: res.auditStatus === 3
|
? "danger"
|
: "warning",
|
mode: "list",
|
fields: [
|
{
|
label: "审核结果:",
|
value:
|
res.auditStatus === 2
|
? "通过"
|
: res.auditStatus === 3
|
? "驳回"
|
: "待审批",
|
},
|
{ label: "审批意见:", value: res.auditRemark || "" },
|
{ label: "审核人:", value: res.auditPersonName || "" },
|
{ label: "审核时间:", value: res.auditTime || "" },
|
],
|
});
|
}else{
|
processData.push({
|
type: "warning",
|
mode: "list",
|
fields: [
|
{ label: "等待审核"},
|
],
|
});
|
}
|
// 如有卡片模式,按前述结构 push
|
|
this.$nextTick(() => {
|
this.form.processData = processData;
|
})
|
}
|
})
|
.catch((err) => {
|
console.error("获取详情失败:", err);
|
this.$message.error("获取详情失败");
|
});
|
},
|
handleClose() {
|
this.$emit("update:visible", false);
|
this.remark = "";
|
this.status = "1";
|
},
|
handleApprove() {
|
if (!this.remark) {
|
this.$message.warning("请输入审批意见");
|
return;
|
}
|
const params = {
|
id: this.form.id,
|
auditStatus: this.status === "1" ? 2 : 3, // 2-已通过,3-已驳回
|
auditRemark: this.remark,
|
};
|
console.log('审批请求参数:', params);
|
audit(params)
|
.then((res) => {
|
console.log('审批返回结果:', res);
|
if (res.code === 200) {
|
this.$message.success("审批成功");
|
this.$emit("update:visible", false);
|
this.$emit("success");
|
} else {
|
this.$message.error(res.msg || "审批失败");
|
}
|
})
|
.catch((err) => {
|
console.error("审批失败:", err);
|
this.$message.error("审批失败");
|
});
|
},
|
},
|
};
|
</script>
|
|
<style scoped lang="less">
|
::v-deep .el-dialog__header {
|
border-bottom: 1px solid #e4e7ed;
|
}
|
|
.approval-dialog {
|
display: flex;
|
height: 300px;
|
|
.approval-content {
|
flex: 1;
|
margin-right: 20px;
|
background: #ffffff;
|
box-shadow: 0px 4px 12px 4px rgba(0, 0, 0, 0.08);
|
border-radius: 10px;
|
}
|
|
.approval-flow {
|
padding: 40px 20px;
|
width: 405px;
|
background: #ffffff;
|
box-shadow: 0px 4px 12px 4px rgba(0, 0, 0, 0.08);
|
border-radius: 10px;
|
|
.flow-title {
|
font-size: 16px;
|
font-weight: bold;
|
margin-bottom: 20px;
|
color: #303133;
|
}
|
|
.flow-content {
|
height: calc(100% - 40px);
|
overflow-y: auto;
|
|
.el-form--inline .el-form-item {
|
margin-right: 83px;
|
}
|
}
|
}
|
}
|
|
.approval-content-card {
|
height: calc(100% - 100px) !important;
|
box-shadow: none !important;
|
}
|
|
.header-title {
|
display: flex;
|
align-items: center;
|
flex-wrap: wrap;
|
gap: 13px;
|
|
.header-title-left {
|
display: flex;
|
align-items: center;
|
gap: 13px;
|
margin-top: 38px;
|
|
img {
|
width: 12px;
|
height: 19px;
|
}
|
|
div {
|
flex-shrink: 0;
|
font-weight: bold;
|
font-size: 18px;
|
color: #222222;
|
line-height: 27px;
|
font-family: "Source Han Sans CN Bold Bold";
|
|
&:before {
|
content: "*";
|
color: #f56c6c;
|
margin-right: 4px;
|
}
|
}
|
|
span {
|
flex-shrink: 0;
|
font-weight: bold;
|
font-size: 18px;
|
color: #222222;
|
line-height: 27px;
|
font-family: "Source Han Sans CN Bold Bold";
|
}
|
}
|
|
.header-title-left :first-child {
|
margin-top: 0;
|
}
|
}
|
|
.header-title:first-child {
|
.header-title-left {
|
margin-top: 0;
|
}
|
}
|
|
.item-title {
|
padding-left: 25px;
|
|
span {
|
flex-shrink: 0;
|
font-weight: bold;
|
font-size: 14px;
|
color: #222222;
|
line-height: 27px;
|
font-family: "Source Han Sans CN Bold Bold";
|
margin: 18px 0;
|
|
&:before {
|
content: "*";
|
color: #f56c6c;
|
margin-right: 4px;
|
}
|
}
|
}
|
|
.approval-dialog-approve {
|
padding: 38px 20px;
|
display: flex;
|
align-content: center;
|
.status {
|
margin-right: 40px;
|
}
|
// align-items: center;
|
.status-title {
|
color: #222222;
|
font-family: "SourceHanSansCN-Medium";
|
line-height: 14px;
|
margin-bottom: 16px;
|
}
|
.status-content {
|
display: flex;
|
align-items: center;
|
gap: 16px;
|
background: #ffffff;
|
border-radius: 10px;
|
border: 1px solid rgba(4, 156, 154, 0.5);
|
.resolve {
|
border-radius: 10px;
|
font-size: 16px;
|
padding: 5px 55px;
|
font-weight: 400;
|
color: #333333;
|
cursor: pointer;
|
}
|
.reject {
|
border-radius: 10px;
|
font-size: 16px;
|
padding: 5px 55px;
|
font-weight: 400;
|
color: #333333;
|
cursor: pointer;
|
}
|
.activeStatus {
|
background: #ebfefd;
|
color: #049c9a;
|
box-shadow: 0px 0px 6px 0px rgba(10, 109, 108, 0.25);
|
border-radius: 10px;
|
}
|
}
|
.remark-title {
|
color: #222222;
|
font-family: "SourceHanSansCN-Medium";
|
line-height: 14px;
|
margin-bottom: 16px;
|
}
|
}
|
|
.dialog-footer {
|
align-items: center;
|
display: flex;
|
justify-content: center;
|
button {
|
width: 150px;
|
}
|
}
|
|
.content-display {
|
padding: 10px 20px;
|
min-height: 100px;
|
background: #f5f7fa;
|
border-radius: 4px;
|
margin: 10px 0;
|
}
|
</style>
|