马宇豪
2023-08-07 7ed4982b8f2a345bfad95a96070143c32142bc61
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<template>
    <div class="system-menu-dialog-container">
        <el-dialog :title="applyStartDialogState.title" v-model="applyStartDialogState.applyStartDialogVisible" width="600px">
            <el-form ref="applyStartFormRef" :rules="applyStartDialogState.applyStartFormRules" :model="applyStartDialogState.applyStartForm" size="default" label-width="160px">
                <el-row :gutter="35">
                    <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                        <el-form-item label="实验开始时间" prop="startTime">
                            <el-date-picker type="datetime" format="YYYY/MM/DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" v-model="applyStartDialogState.applyStartForm.startTime" class="input-length"/>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                        <el-form-item label="是否使用安全信息化系统" prop="sisStatus">
                            <el-radio-group v-model="applyStartDialogState.applyStartForm.sisStatus">
                                <el-radio :label="1">是</el-radio>
                                <el-radio :label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20" v-if="applyStartDialogState.applyStartForm.sisStatus==1">
                        <el-form-item label="安全信息化系统名称" prop="safeInformationSystem">
                            <el-input v-model="applyStartDialogState.applyStartForm.safeInformationSystem" placeholder="材料类型" class="input-length">
                            </el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <template #footer>
                <span class="dialog-footer">
                    <el-button @click="applyStartDialogState.applyStartDialogVisible = !applyStartDialogState.applyStartDialogVisible" size="default">取 消</el-button>
                    <el-button type="primary" @click="onSubmitApplyStart" size="default">确定</el-button>
                </span>
            </template>
        </el-dialog>
    </div>
</template>
 
<script setup lang="ts">
import { reactive, ref } from "vue";
import {ElMessage} from "element-plus";
import {projectApi} from "/@/api/experiment/project";
 
const applyStartFormRef = ref()
 
const applyStartDialogState = reactive<ApplyStartDialogType>({
    title: '转为已开展',
    applyStartDialogVisible: false,
    applyStartForm: {
        id: null,
        sisStatus: null,
        safeInformationSystem: '',
        startTime: '',
    },
    applyStartFormRules: {
 
    },
})
 
const showApplyStartDialog = (value: ProjectType) => {
    applyStartDialogState.applyStartDialogVisible = true;
    applyStartDialogState.applyStartForm = {
      id: null,
      sisStatus: null,
      safeInformationSystem: '',
      startTime: ''
    },
    applyStartDialogState.applyStartForm.id = <number>value.id
};
 
const onSubmitApplyStart = () => {
    applyStartFormRef.value.validate(async(valid: boolean) => {
        if(valid){
            if(applyStartDialogState.applyStartForm.sisStatus == 2){
              applyStartDialogState.applyStartForm.safeInformationSystem = ''
            }
            let res = await projectApi().applyProject([applyStartDialogState.applyStartForm]);
            if(res.data.code === 100){
                emit('refresh')
                applyStartDialogState.applyStartDialogVisible = false;
                ElMessage({
                    type: 'success',
                    message: '申请开展成功'
                })
            }else{
                ElMessage({
                    type: 'warning',
                    message: res.data.msg,
                });
            }
        }else{
            ElMessage({
                type: 'warning',
                message: '请完善基本信息',
            });
        }
    })
};
 
const emit = defineEmits(['refresh'])
 
defineExpose({
    showApplyStartDialog
})
</script>
 
<style scoped>
 
</style>