Admin
2022-06-30 6d5dbde08fc4c167ed253f8607d591a17f32b718
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<template>
    <div class="home-container">
        <div v-for="(item,index) in approveSteps" class="stepItem">
            <div class="stepNum">{{index+1}}</div>
            <div class="stepCard">
                <el-card class="box-card" shadow="hover">
                    <template #header>
                        <div class="card-header">
                            <div>步骤<span>{{index+1}}</span></div>
                            <div>
                                <el-button type="primary" size="default" @click="addFlow(index)">新增</el-button>
                                <el-button type="danger" size="default" @click="deleteFlow(index)">删除</el-button>
                            </div>
                        </div>
                    </template>
                    <div class="text item">审批部门:<span>{{item.department}}</span></div>
                    <div class="text item">审批人员:<span>{{item.manager}}</span></div>
                    <div class="text item">其他参数:<span>{{item.others}}</span></div>
                </el-card>
            </div>
        </div>
        <el-drawer v-model="showAdd" direction="rtl">
            <template #title>
                <h4>新增审批流</h4>
            </template>
            <template #default>
                <el-form :model="addProgress" label-width="120px">
                    <el-form-item label="审批部门">
                        <el-select v-model="addProgress.department" placeholder="请选择审批部门">
                            <el-option label="动土" value="动土" />
                            <el-option label="动火" value="动火" />
                        </el-select>
                    </el-form-item>
                    <el-form-item label="审批人员">
                        <el-select v-model="addProgress.manager" placeholder="请选择审批人员">
                            <el-option label="人员1" value="人员1" />
                            <el-option label="人员2" value="人员2" />
                        </el-select>
                    </el-form-item>
                    <el-form-item label="其他参数">
                        <el-input v-model="addProgress.others" />
                    </el-form-item>
                </el-form>
            </template>
            <template #footer>
                <div style="flex: auto">
                    <el-button @click="cancelClick">取消</el-button>
                    <el-button type="primary" @click="confirmClick(ruleFormRef)">确认</el-button>
                </div>
            </template>
        </el-drawer>
        <el-dialog v-model="deleteDialog" title="提示" width="30%" center>
            <span>您确定要删除该审批流吗?</span>
            <template #footer>
              <span class="dialog-footer">
                <el-button @click="deleteDialog = false">取消</el-button>
                <el-button type="primary" @click="conFirmDelete">确认</el-button>
              </span>
            </template>
        </el-dialog>
    </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 { ElMessage } 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: 'approveProcessSetting',
        setup() {
            const userInfo = useUserInfo()
            const { userInfos } = storeToRefs(userInfo);
            const approveSteps = [
                {
                    department: '动土',
                    manager: '',
                    others: ''
                },
                {
                    department: '动土',
                    manager: '',
                    others: ''
                },
                {
                    department: '动土',
                    manager: '',
                    others: ''
                }
            ];
            const showAdd = ref(false)
            const deleteDialog = ref(false)
            const chosenIndex = ref('')
            const addProgress = ref({
                department: '',
                manager: '',
                others: ''
            })
            const confirmClick = () => {
                approveSteps.splice(chosenIndex.value+1,0,addProgress.value)
                addProgress.value = {
                    department: '',
                    manager: '',
                    others: ''
                }
                showAdd.value = false
            }
            const addFlow = (index) => {
                showAdd.value = true
                chosenIndex.value = index
            }
            const deleteFlow = (index) => {
                if(approveSteps.length>1){
                    deleteDialog.value = true
                    chosenIndex.value = index
                }else{
                    ElMessage({
                        message: '抱歉最后一条无法删除',
                        type: 'warning',
                    })
                }
            }
            const conFirmDelete = () => {
                const i = chosenIndex.value
                approveSteps.splice( i,1)
                deleteDialog.value = false
            }
            const state  = reactive<stateType>({});
            // 折线图
            const renderMenu = async (value: string) => {
                Session.set('projectId',value)
                userInfos.value.projectId = value
                await initBackEndControlRoutes();
            };
            return {
                renderMenu,
                showAdd,
                approveSteps,
                addProgress,
                chosenIndex,
                deleteDialog,
                conFirmDelete,
                deleteFlow,
                addFlow,
                confirmClick,
                ...toRefs(state),
            };
        },
    });
</script>
 
<style scoped lang="scss">
    $homeNavLengh: 8;
    .home-container {
        overflow: hidden;
        padding: 80px;
        .stepItem{
            display: flex;
            align-items: flex-start;
            margin-bottom: 30px;
            padding-bottom: 30px;
            border-left: 2px solid #ccc;
            &:last-of-type{
                margin-bottom: 0;
                border-left: none;
            }
            .stepNum {
                width: 30px;
                height: 30px;
                border-radius: 15px;
                box-sizing: border-box;
                color: #333;
                border: 2px solid #999;
                line-height: 26px;
                text-align: center;
                margin-right: 40px;
                margin-left: -16px;
                margin-top: -30px;
            }
            .stepCard {
                margin-top: -30px;
 
                .box-card {
                    width: 480px;
 
                    .card-header {
                        display: flex;
                        justify-content: space-between;
                        align-items: center;
 
                        span{
                            font-weight: bold;
                            margin-left: 10px;
                        }
                    }
 
                    .text {
                        font-size: 14px;
                    }
 
                    .item {
                        margin-bottom: 18px;
                    }
                }
            }
            &:hover .card-header{
                color: #0098F5;
            }
            &:hover .stepNum{
                border: 2px solid #0098F5;
                color: #0098F5;
            }
        }
 
        .el-form{
            padding: 40px 20px;
        }
    }
</style>