Admin
2022-08-09 9cb42e93ea6fc79268b7c43a4115b8f0076c84e1
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<template>
    <div class="comp-container">
        <el-form :model="teForm" label-width="150px" :rules="teRules" ref="teRef">
            <div class="homeCard">
                <el-row>
                    <el-col :span="8">
                        <el-form-item label="申请部门" prop="teDepartment">
                            <el-select v-model="teForm.teDepartment" placeholder="请选择部门">
                                <el-option label="机修班" value="机修班" />
                                <el-option label="火工班" value="火工班" />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="申请人" prop="teApplyName">
                            <el-input
                                    v-model="teForm.teApplyName"
                                    placeholder="请输入"
                                    class="input-with-select"
                            >
                                <template #append>
                                    <el-button :icon="Search" />
                                </template>
                            </el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="8">
                        <el-form-item label="作业等级" prop="teLevel">
                            <el-select v-model="teForm.teLevel" placeholder="请选择等级">
                                <el-option label="等级一" value="等级一" />
                                <el-option label="等级二" value="等级二" />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="作业高度" prop="teHeight">
                            <el-input
                                    v-model="teForm.teHeight"
                                    placeholder="请输入"
                                    class="input-with-select"
                            />
                        </el-form-item>
                    </el-col>
                </el-row>
            </div>
        </el-form>
    </div>
</template>
 
<script lang="ts">
    import { toRefs, reactive, defineComponent, ref } from 'vue';
    import { storeToRefs } from 'pinia';
    import { initBackEndControlRoutes } from '/@/router/backEnd';
    import {useUserInfo} from "/@/stores/userInfo";
    import { Session } from '/@/utils/storage';
    import { Search } from '@element-plus/icons-vue'
    import type { FormInstance, FormRules } from 'element-plus'
    let global: any = {
        homeChartOne: null,
        homeChartTwo: null,
        homeCharThree: null,
        dispose: [null, '', undefined],
    };
 
    interface stateType {
        homeOne: Array <type>
    }
    interface type {
 
    }
    export default defineComponent({
        name: 'tempElectForm',
        props: {
            teForm: Object
        },
        setup(props) {
            const userInfo = useUserInfo()
            const { userInfos } = storeToRefs(userInfo);
            const state  = reactive<stateType>({});
            const teForm1 = reactive(props.teForm)
            const teRef = ref<FormInstance>()
            const teRules = reactive<FormRules>({
                teDepartment:[{required: true,message: '此处不可为空',trigger: 'blur'}],
                teApplyName:[{required: true,message: '此处不可为空',trigger: 'blur'}],
                teLevel: [{required: true,message: '此处不可为空',trigger: 'blur'}],
                teHeight: [{required: true,message: '此处不可为空',trigger: 'blur'}]
            })
            const validateForm = async () => {
                let flag = null
                await teRef.value.validate(valid=>{
                    if(valid){
                        flag = true
                    }else{
                        flag = false
                    }
                })
                return flag
            }
            // 折线图
            const renderMenu = async (value: string) => {
                Session.set('projectId',value)
                userInfos.value.projectId = value
                await initBackEndControlRoutes();
            };
            return {
                renderMenu,
                teForm1,
                teRef,
                teRules,
                validateForm,
                ...toRefs(state),
            };
        },
    });
</script>
 
<style scoped lang="scss">
    .comp-container {
        height: 100%;
        overflow: hidden;
        .homeCard{
            width: 100%;
            padding: 20px;
            background: #fff;
            border-radius: 4px;
            margin-bottom: 20px;
        }
        .el-row{
            margin-bottom: 20px;
        }
        .el-row:last-child {
            margin-bottom: 0;
        }
        .el-input{
            width: 100% !important;
        }
        .el-date-editor::v-deep{
            width: 100%;
        }
        .el-select{
            width: 100%;
        }
        .el-cascader{
            width: 100% !important;
        }
        .submitBtn{
            display: flex;
            justify-content: center;
        }
    }
</style>