<template>
    <div class="app-container">
        <el-form :model="queryForm" ref="queryForm" size="small" :inline="true" label-width="88px">
            <el-form-item label="实验级部">
                <el-select v-model="queryForm.gradeId" placeholder="请选择级部" clearable>
                    <el-option v-for="(item, index) in gradeLists" :key="index" :label="item.gradeName"
                        :value="item.id"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="实验名称">
                <el-input v-model="queryForm.experimentName" placeholder="请输入"></el-input>
            </el-form-item>
            <el-form-item label="实验时间" prop="time">
                <el-date-picker v-model="queryForm.plannedStartTime" type="date" placeholder="选择" value-format="yyyy-MM-dd">
                </el-date-picker>
                <el-date-picker v-model="queryForm.plannedEndTime" type="date" placeholder="选择" value-format="yyyy-MM-dd">
                </el-date-picker>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="getList">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
            <el-row :gutter="10" class="mb8">
                <el-col :span="1.5">
                    <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleOption(0)">新增</el-button>
                </el-col>
            </el-row>

        </el-form>
        <el-table :data="tableData" border style="width: 100%">
            <el-table-column align="center" type="index" label="序号" width="55" />
            <el-table-column align="center" prop="sub" label="学科">
                <template slot-scope="{ row }">
                    <div>{{ selectDictLabel(dict.type.lab_sub, row.sub) }}</div>
                </template>
            </el-table-column>
            <el-table-column align="center" prop="grade" label="级部" />
            <el-table-column align="center" prop="schoolYear" label="学年" />
            <el-table-column align="center" prop="plannedTime" label="规划时间" width="200" />
            <el-table-column align="center" prop="experimentName" label="实验名称" />
            <el-table-column align="center" prop="experimentClassify" label="实验分类">
                <template slot-scope="{ row }">
                    <div>{{ selectDictLabel(dict.type.experiment_classify, row.experimentClassify) }}</div>
                </template>
            </el-table-column>
            <el-table-column align="center" prop="experimentUseGoods" label="实验用品" />
            <el-table-column align="center" prop="schoolTeacherExperimentApplyLabsList" label="实验室">
                <template slot-scope="scope">
                    <div v-if="scope.row.schoolTeacherExperimentApplyLabsList">
                        {{ scope.row.schoolTeacherExperimentApplyLabsList.map(lab => lab.labName).join(", ") }}
                    </div>
                </template>
            </el-table-column>
            <el-table-column align="center" prop="schoolAccessoryList" label="实验结果" width="200px">
                <template slot-scope="scope">
                    <div v-for="(accessory, index) in scope.row.accessoryList" :key="index">
                        <a :href="baseUrl + accessory.accessoryUrl" target="_blank">{{ accessory.accessoryName }}</a>
                    </div>
                </template>
            </el-table-column>
            <el-table-column align="center" prop="declareState" label="申报状态">
                <template slot-scope="{ row }">
                    <div>{{ selectDictLabel(dict.type.declare_state, row.declareState) }}</div>
                </template>
            </el-table-column>
            <el-table-column align="center" fixed="right" label="操作" width="180">
                <template slot-scope="{ row }">
                    <div v-if="row.declareState === '0'">
                        <el-button type="text" size="small" @click="handleOption(2, row)">查看</el-button>
                        <el-button type="text" size="small" @click="handleOption(1, row)">修改</el-button>
                        <el-button type="text" size="small" @click="handleDelete(row.id)">删除</el-button>
                    </div>
                    <div v-else-if="['3', '2', '1'].includes(row.declareState) && row.state === '1'">
                        <el-button type="text" size="small" @click="handleOption(2, row)">查看</el-button>
                    </div>
                    <div v-else-if="['3', '2', '1'].includes(row.declareState) && row.state === '0'">
                        <el-button type="text" size="small" @click="handleOption(2, row)">查看</el-button>
                        <el-button @click="handleResult(row)" type="text" size="small">实验结果</el-button>
                    </div>
                </template>
            </el-table-column>



        </el-table>
        <!-- 弹窗 -->
        <el-dialog title="申请信息" :visible.sync="dialogTableVisible" width="60%">
            <el-form :model="form" ref="form" size="small" :rules="rules" label-width="110px">
                <el-row :gutter="30">
                    <el-col :span="10">
                        <el-form-item label="学科" prop="sub">
                            <el-select v-model="form.sub" placeholder="请选择" clearable :style="{ width: '100%' }">
                                <el-option v-for="(item, index) in subList" :key="index" :label="item.subName"
                                    :value="item.sub"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10">
                        <el-form-item label="级部" prop="gradeId">
                            <el-select v-model="form.gradeId" placeholder="请选择级部" clearable style="width: 100%;">
                                <el-option v-for="(item, index) in gradeList" :key="index" :label="item.gradeName"
                                    :value="item.id"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="30">
                    <el-col :span="10">
                        <el-form-item label="学年" prop="schoolYear">
                            <el-date-picker v-model="form.schoolYear" type="year" value-format="yyyy" placeholder="选择年"
                                style="width: 100%;">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10">
                        <el-form-item label="学期" prop="semester">
                            <el-select v-model="form.semester" placeholder="请选择学期" style="width: 100%;">
                                <el-option label="上学期" value="1"></el-option>
                                <el-option label="下学期" value="2"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>

                </el-row>
                <el-row :gutter="30">
                    <el-col :span="10">
                        <el-form-item label="开始时间" prop="plannedStartTime">
                            <el-date-picker v-model="form.plannedStartTime" type="date" placeholder="选择"
                                value-format="yyyy-MM-dd" style="width: 100%;">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10">
                        <el-form-item label="结束时间" prop="plannedEndTime">
                            <el-date-picker v-model="form.plannedEndTime" type="date" placeholder="选择" style="width: 100%;"
                                value-format="yyyy-MM-dd">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="30">
                    <el-col :span="10">
                        <el-form-item label="实验名称" prop="experimentName">
                            <el-input v-model="form.experimentName" placeholder="请输入" clearable />
                        </el-form-item>
                    </el-col>
                    <el-col :span="10">
                        <el-form-item label="实验分类" prop="experimentClassify">
                            <el-select v-model="form.experimentClassify" placeholder="请选择" clearable style="width: 100%;">
                                <el-option v-for="dict in dict.type.experiment_classify" :key="dict.value"
                                    :label="dict.label" :value="dict.value" />
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="30">
                    <el-col :span="10">
                        <el-form-item label="实验用品" prop="experimentUseGoods">
                            <el-input v-model="form.experimentUseGoods" placeholder="请输入" clearable />
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <div class="dialog-footer" style="text-align: center;">
                <div class="dialog-footer" style="text-align: center;">
                    <el-button v-if="nowType === 0" type="primary" @click="save">保 存</el-button>
                    <el-button v-if="nowType === 0 || nowType === 1" type="primary" @click="submitForm">提 交</el-button>
                    <el-button v-if="nowType === 1" type="primary" @click="savexg">保 存</el-button>
                    <el-button type="primary" v-if="nowType === 2" @click="cancel">确 定</el-button>
                    <el-button v-if="nowType === 2" @click="cancel">取 消</el-button>

                </div>

            </div>
        </el-dialog>

        <!--查看弹窗 -->
        <el-dialog title="申请信息" :visible.sync="open" width="60%">
            <el-form :model="form" ref="form" size="small" label-width="110px" :disabled="isEdit">
                <el-row :gutter="30">
                    <el-col :span="10">
                        <el-form-item label="学科">
                            <el-select v-model="form.sub" placeholder="请选择" clearable style="width: 100%;">
                                <el-option v-for="dict in dict.type.lab_sub" :key="dict.value" :label="dict.label"
                                    :value="dict.value" />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10">
                        <el-form-item label="级部">
                            <el-input v-model="form.grade" placeholder="请输入" clearable />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="30">
                    <el-col :span="10">
                        <el-form-item label="学年">
                            <el-date-picker v-model="form.schoolYear" type="year" value-format="yyyy" placeholder="选择年"
                                style="width: 100%;">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10">
                        <el-form-item label="学期">
                            <el-select v-model="form.semester" placeholder="请选择学期" style="width: 100%;">
                                <el-option label="上学期" value="1"></el-option>
                                <el-option label="下学期" value="2"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>

                </el-row>
                <el-row :gutter="30">
                    <el-col :span="10">
                        <el-form-item label="开始时间" prop="plannedStartTime">
                            <el-date-picker v-model="form.plannedStartTime" type="date" placeholder="选择"
                                value-format="yyyy-MM-dd" style="width: 100%;">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10">
                        <el-form-item label="结束时间" prop="plannedEndTime">
                            <el-date-picker v-model="form.plannedEndTime" type="date" placeholder="选择" style="width: 100%;"
                                value-format="yyyy-MM-dd">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="30">
                    <el-col :span="24">
                        <el-form-item label="实验室选择">
                            <el-checkbox-group v-model="form.schoolTeacherExperimentApplyLabsList">
                                <el-checkbox v-for="classItem in schoolTeacherExperimentApplyLabsList"
                                    :key="classItem.labId" :label="classItem.labId">
                                    {{ classItem.labName }}
                                </el-checkbox>
                            </el-checkbox-group>
                        </el-form-item>

                    </el-col>
                </el-row>

                <el-row :gutter="30">
                    <el-col :span="10">
                        <el-form-item label="实验名称">
                            <el-input v-model="form.experimentName" placeholder="请输入" clearable />
                        </el-form-item>
                    </el-col>
                    <el-col :span="10">
                        <el-form-item label="实验分类">
                            <el-select v-model="form.experimentClassify" placeholder="请选择" clearable style="width: 100%;">
                                <el-option v-for="dict in dict.type.experiment_classify" :key="dict.value"
                                    :label="dict.label" :value="dict.value" />
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="30">
                    <el-col :span="10">
                        <el-form-item label="实验用品">
                            <el-input v-model="form.experimentUseGoods" placeholder="请输入" clearable />
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <div slot="footer" class="dialog-footer" style="text-align: center;">
                <el-button type="primary" @click="submitForm">确 定</el-button>
                <el-button type="primary" @click="cancel">取 消</el-button>
            </div>

        </el-dialog>
        <!-- 导入弹出框 -->
        <el-dialog :title="upload.title" :visible.sync="opendr" width="400px" append-to-body>
            <el-form ref="postForm" :model="postForm" label-width="110px">
                <FileUploadlab @input="getFileList" :limit="1" :value="fileList"></FileUploadlab>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="submitFileForm()"> 确 定 </el-button>
                <el-button @click="cancel">取 消</el-button>
            </div>
        </el-dialog>
        <pagination v-show="total > 0" :total="total" :page.sync="queryForm.pageNum" :limit.sync="queryForm.pageSize"
            @pagination="getList" />
    </div>
</template>

<script>
import {
    getNewYear,//获取学年+学期
    getGrade,// 查询级部
    getGradelist,//级部搜索
    addExperimentPlan,//新增个人实验申请
    updateExperimentPlan,// 修改个人实验申请
    deleteExperimentPlan,// 删除个人实验申请
    getApplylist,// 查询个人实验申请列表
    getListxq,//查看详情
    getResult,//附件
    getSub,//获取科目
} from '@/api/smartSchool/classTeacherWork/laboratoryManagement/personalLaboratoryapp';
import FileUploadlab from '@/components/FileUploadlab';
import { getToken } from '@/utils/auth';
export default {
    name: 'index',
    dicts: ['experiment_classify', 'lab_sub', 'declare_state'],
    components: {
        FileUploadlab
    },
    data() {
        return {
            baseUrl: process.env.VUE_APP_BASE_API,
            queryForm: {
                pageNum: 1,
                pageSize: 10,
                gradeId: "",
                experimentName: "",
                plannedStartTime: "",
                plannedEndTime: "",
            },
            //表格数据
            tableData: [

            ],
            fileList: [],
            nowType: 0, // 0新增、1编辑、2查看
            isEdit: false,
            form: {
                id: '',
                sub: "",
                gradeId: "",
                grade: "",
                schoolYear: "",
                semester: "",
                plannedStartTime: "",
                plannedEndTime: "",
                experimentName: "",
                experimentClassify: "",
                experimentUseGoods: "",
                declareState: "",
                state: "",
            },
            upload: {
                // 是否显示弹出层（学生导入）
                open: false,
                // 弹出层标题（学生导入）
                title: '',
                // 是否禁用上传
                isUploading: false,
                // 是否更新已经存在的学生数据
                updateSupport: 0,
                // 设置上传的请求头部
                headers: { Authorization: 'Bearer ' + getToken() },
                // 上传的地址
                url: process.env.VUE_APP_BASE_API + '/school/student/importData'
            },
            schoolTeacherExperimentApplyLabsList: [],
            schoolAccessoryList: [],
            //级部
            gradeList: [],
            gradeLists: [],
            //科目
            subList: [],
            total: 0,
            postForm: {
                id: '',
                accessoryUrl: '',
                accessoryName: '',
            },
            dialogTableVisible: false,
            open: false,
            opendr: false,
            rules: {
                sub: [
                    { required: true, message: "学科不能为空", trigger: "blur" }
                ],
                gradeId: [
                    { required: true, message: "级部不能为空", trigger: "blur" }
                ],
                schoolYear: [
                    { required: true, message: "学年不能为空", trigger: "blur" }
                ],
                semester: [
                    { required: true, message: "学期不能为空", trigger: "blur" }
                ],
                experimentClassify: [
                    { required: true, message: "实验分类不能为空", trigger: "blur" }
                ],
                experimentName: [
                    { required: true, message: "实验名称不能为空", trigger: "blur" }
                ],
                experimentUseGoods: [
                    { required: true, message: "实验用品不能为空", trigger: "blur" }
                ],
                plannedStartTime: [
                    { required: true, message: "开始时间不能为空", trigger: "blur" }
                ],
                plannedEndTime: [
                    { required: true, message: "结束时间不能为空", trigger: "blur" }
                ],

            },
        }
    },
    created() {
        this.getList();
        this.getGradelist();
        this.getGrade();
        this.getSubiect();


    },
    methods: {
        getList() {
            getApplylist(this.queryForm).then(response => {
                this.tableData = response.rows;
                this.tableData = response.rows.map(item => {
                    item.accessoryList = item.schoolAccessoryList; // 将附件信息赋值给accessoryList属性
                    return item;
                });
                console.log('response', response);
                console.log(response.rows.a);
                this.total = response.total;
                this.loading = false;
            })
                .catch(error => {
                    this.loading = false;
                    console.log(error);
                });
        },
        //查询级部
        getGrade() {
            getGrade().then(response => {
                this.loading = false;
                this.gradeList = response.data;
                console.log("this.gradeList", this.gradeList);

            });
        },
        //查询级部搜索
        getGradelist() {
            getGradelist().then(response => {
                this.loading = false;
                this.gradeLists = response.data;
                console.log("this.gradeList", this.gradeList);

            });
        },
        // 0新增、1修改、2查看
        handleOption(type, row) {
            this.form = {
                id: '',
                sub: "",
                gradeId: "",
                grade: "",
                schoolYear: "",
                semester: "",
                plannedStartTime: "",
                plannedEndTime: "",
                experimentName: "",
                experimentClassify: "",
                experimentUseGoods: "",
                declareState: "",
                state: "",
                schoolTeacherExperimentApplyLabsList: [], // 添加默认的 schoolTeacherExperimentApplyLabsList 列表
            }
            this.getSemester();
            this.nowType = type;
            if (type === 2) {
                const id = row.id;
                getListxq(id).then(response => {
                    if (response.code === 200) {
                        console.log(response);
                        Object.keys(this.form).forEach(key => {
                            if (response.data[key]) {
                                this.$set(this.form, key, response.data[key]);
                            }
                        });
                        if (
                            response.data.schoolTeacherExperimentApplyLabsList &&
                            response.data.schoolTeacherExperimentApplyLabsList.length > 0
                        ) {
                            this.schoolTeacherExperimentApplyLabsList = response.data.schoolTeacherExperimentApplyLabsList;
                            console.log('this.form.schoolTeacherExperimentApplyLabsList', this.schoolTeacherExperimentApplyLabsList);
                            this.form.schoolTeacherExperimentApplyLabsList = [];
                            for (let i = 0; i < this.schoolTeacherExperimentApplyLabsList.length; i++) {
                                const labId = this.schoolTeacherExperimentApplyLabsList[i].labId;
                                const labName = this.schoolTeacherExperimentApplyLabsList[i].labName;
                                this.form.schoolTeacherExperimentApplyLabsList.push({ labId, labName }); // 将 labId 和 labName 封装为对象并添加到列表中
                                console.log(this.form.schoolTeacherExperimentApplyLabsList, '查看 ');
                            }
                        }

                        this.open = true;
                        this.isEdit = true;
                    }
                });
            } else if (type === 1) {
                const id = row.id;
                getListxq(id).then(response => {
                    if (response.code === 200) {
                        console.log(response);
                        Object.keys(this.form).forEach(key => {
                            if (response.data[key]) {
                                this.$set(this.form, key, response.data[key]);
                            }
                        });
                    }
                });

                this.dialogTableVisible = true;
            }
            else if (type === 0) {
                this.dialogTableVisible = true;
            }
        },

        getSemester() {
            getNewYear()
                .then(response => {
                    this.form.semester = response.semester;
                    this.form.schoolYear = response.schoolYear + '';
                })


        },
        //获取科目
        getSubiect() {
            getSub().then(response => {
                this.subList = response.data;
                console.log(this.subList, 'this.subList');
            })


        },

        //上传按钮
        getFileList(data) {
            console.log('data', data);
            this.fileList = data;
            console.log(this.fileList);
            if (this.fileList.length != 0) {
                this.postForm.accessoryUrl = data[0].fjlj;
                this.postForm.accessoryName = data[0].fjmc;
                console.log(this.postForm.accessoryName);
                console.log(this.postForm.accessoryUrl);
                console.log('this.postForm', this.postForm);
            } else {
                this.postForm.accessoryUrl = '';
                this.postForm.accessoryName = '';


            }
        },

        //提交按钮
        submitFileForm() {
            // 将 fileList 中的数据转换成 schoolAccessoryList 格式的数组
            const schoolAccessoryList = this.fileList.map(item => ({
                accessoryUrl: item.fjlj,
                accessoryName: item.fjmc
            }));

            // 定义请求的参数对象
            const params = {
                id: this.postForm.id,
                schoolAccessoryList: schoolAccessoryList
            };
            console.log(params);
            // 发送上传文件列表请求
            getResult(params).then(response => {
                console.log(params);
                this.opendr = false;
                this.getList();
                console.log("schoolAccessoryList", schoolAccessoryList);
            });
        },
        //删除按钮操作
        handleDelete(id) {
            this.$confirm("此操作将永久删除该数据，是否继续？", '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                deleteExperimentPlan(id).then(res => {
                    if (res.code == 200) {
                        this.$message.success("删除成功！")
                    }
                    this.getList()
                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消删除！'
                });
            });

        },
        resetQuery() {
            this.queryForm = {
                pageNum: 1,
                pageSize: 10,
                gradeId: "",
                experimentName: "",
                plannedStartTime: "",
                plannedEndTime: "",
            },
                this.getList();
        },

        // 保存按钮
        save() {
            const gradeId = this.form.gradeId;
            this.form.grade = gradeId == '' ? '' : this.gradeList.find(item => item.id == gradeId).gradeName
            this.$refs['form'].validate(valid => {
                if (valid) {
                    if (this.form.id === "") {
                        console.log('新增', this.form);
                        const params = {
                            sub: this.form.sub,
                            grade: this.form.grade,
                            gradeId: this.form.gradeId,
                            schoolYear: this.form.schoolYear,
                            semester: this.form.semester,
                            plannedStartTime: this.form.plannedStartTime,
                            plannedEndTime: this.form.plannedEndTime,
                            experimentName: this.form.experimentName,
                            experimentClassify: this.form.experimentClassify,
                            experimentUseGoods: this.form.experimentUseGoods,
                            declareState: '0',
                        };
                        addExperimentPlan(params).then(response => {
                            this.$modal.msgSuccess('保存成功');
                            this.dialogTableVisible = false;
                            this.getList();
                        });
                    }
                }
            });
        },
        // 保存按钮
        savexg() {
            const gradeId = this.form.gradeId;
            this.form.grade = gradeId == '' ? '' : this.gradeList.find(item => item.id == gradeId).gradeName
            this.$refs['form'].validate(valid => {
                if (valid) {
                    if (this.form.id !== "") {
                        const params = {
                            id: this.form.id,
                            sub: this.form.sub,
                            grade: this.form.grade,
                            gradeId: this.form.gradeId,
                            schoolYear: this.form.schoolYear,
                            semester: this.form.semester,
                            plannedStartTime: this.form.plannedStartTime,
                            plannedEndTime: this.form.plannedEndTime,
                            experimentName: this.form.experimentName,
                            experimentClassify: this.form.experimentClassify,
                            experimentUseGoods: this.form.experimentUseGoods,
                            declareState: '0',

                        };

                        updateExperimentPlan(params).then(response => {
                            this.$modal.msgSuccess('保存成功');
                            this.dialogTableVisible = false;
                            this.getList();
                        });
                    }
                }
            });
        },

        /** 提交按钮 */
        submitForm() {
            const gradeId = this.form.gradeId;
            this.form.grade = gradeId == '' ? '' : this.gradeList.find(item => item.id == gradeId).gradeName
            this.$refs['form'].validate(valid => {
                if (valid) {
                    if (this.form.id !== "") {
                        // 修改已有数据的逻辑
                        const params = {
                            id: this.form.id,
                            sub: this.form.sub,
                            grade: this.form.grade,
                            gradeId: this.form.gradeId,
                            schoolYear: this.form.schoolYear,
                            semester: this.form.semester,
                            plannedStartTime: this.form.plannedStartTime,
                            plannedEndTime: this.form.plannedEndTime,
                            experimentName: this.form.experimentName,
                            experimentClassify: this.form.experimentClassify,
                            experimentUseGoods: this.form.experimentUseGoods,
                            declareState: '1',
                        };
                        updateExperimentPlan(params).then(response => {
                            this.$modal.msgSuccess('提交成功');
                            this.dialogTableVisible = false;
                            this.getList();
                        });
                    } else {
                        // 新增数据的逻辑
                        const params = {
                            sub: this.form.sub,
                            grade: this.form.grade,
                            gradeId: this.form.gradeId,
                            schoolYear: this.form.schoolYear,
                            semester: this.form.semester,
                            plannedStartTime: this.form.plannedStartTime,
                            plannedEndTime: this.form.plannedEndTime,
                            experimentName: this.form.experimentName,
                            experimentClassify: this.form.experimentClassify,
                            experimentUseGoods: this.form.experimentUseGoods,
                            declareState: '1',
                        };
                        addExperimentPlan(params).then(response => {
                            this.$modal.msgSuccess("提交成功");
                            this.dialogTableVisible = false;
                            this.getList();
                        });
                    }
                }
            });
        },

        //上传附件按钮操作
        handleResult(row) {
            console.log(row);
            this.upload.title = '实验结果'
            this.opendr = true;
            this.postForm.id = row.id;
        },
        //取消按钮
        cancel() {
            this.dialogTableVisible = false;
            this.open = false;
            this.opendr = false;
        },

    },
}
</script>

<style lang="scss" scoped></style>