马宇豪
2024-11-12 77737f4e73f7267170b9b06fc73d1610c29c0661
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<template>
    <div class="home-container">
        <el-tabs type="border-card" v-model="activeName" @tab-click="handleClick" v-loading="loading">
            <el-tab-pane :lazy="true" label="动火作业" name="fire">
                <fire-form ref="fire" :lists="lists"></fire-form>
            </el-tab-pane>
            <el-tab-pane :lazy="true" label="受限空间作业" name="space">
                <space-form ref="space" :lists="lists"></space-form>
            </el-tab-pane>
            <el-tab-pane :lazy="true" label="吊装作业" name="hoist">
                <hoist-form ref="hoist" :lists="lists"></hoist-form>
            </el-tab-pane>
            <el-tab-pane :lazy="true" label="动土作业" name="ground">
                <ground-form ref="ground" :lists="lists"></ground-form>
            </el-tab-pane>
            <el-tab-pane :lazy="true" label="断路作业" name="broken">
                <broken-form ref="broken" :lists="lists"></broken-form>
            </el-tab-pane>
            <el-tab-pane :lazy="true" label="高处作业" name="height">
                <height-form ref="height" :lists="lists"></height-form>
            </el-tab-pane>
            <el-tab-pane :lazy="true" label="临时用电作业" name="power">
                <power-form ref="power" :lists="lists"></power-form>
            </el-tab-pane>
            <el-tab-pane :lazy="true" label="盲板抽堵作业" name="plate">
                <plate-form ref="plate" :lists="lists"></plate-form>
            </el-tab-pane>
      <el-tab-pane :lazy="true" label="打开作业" name="open">
        <open-form ref="open" :lists="lists"></open-form>
      </el-tab-pane>
        </el-tabs>
<!--    <material-dialog ref="material"></material-dialog>-->
<!--    <el-radio-group v-model="activeName" size="large" @change="(value)=>handleClick(value)">-->
<!--      <el-radio-button :label=0>动火作业</el-radio-button>-->
<!--      <el-radio-button :label=1>受限空间作业</el-radio-button>-->
<!--      <el-radio-button :label=2>吊装作业</el-radio-button>-->
<!--      <el-radio-button :label=3>动土作业</el-radio-button>-->
<!--      <el-radio-button :label=4>断路作业</el-radio-button>-->
<!--      <el-radio-button :label=5>高处作业</el-radio-button>-->
<!--      <el-radio-button :label=6>临时用电作业</el-radio-button>-->
<!--      <el-radio-button :label=7>盲板抽堵作业</el-radio-button>-->
<!--    </el-radio-group>:-->
<!--    <fire-form v-if="activeName == 0" ref="fire" :workerList = allWorkers :deviceList = allDevices :departList=departmentList :departList2=departmentList2 :otherWorks="otherWorks" :spList="spList"></fire-form>-->
<!--    <space-form v-if="activeName == 1" ref="space" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices :otherWorks="otherWorks" :spList="spList"></space-form>-->
<!--    <hoist-form v-if="activeName == 2" ref="hoist" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices :otherWorks="otherWorks" :spList="spList"></hoist-form>-->
<!--    <ground-form v-if="activeName == 3" ref="ground" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices :otherWorks="otherWorks" :spList="spList"></ground-form>-->
<!--    <broken-form v-if="activeName == 4" ref="broken" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices :otherWorks="otherWorks" :spList="spList"></broken-form>-->
<!--    <height-form v-if="activeName == 5" ref="height" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices :otherWorks="otherWorks" :spList="spList"></height-form>-->
<!--    <power-form v-if="activeName == 6" ref="power" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices :otherWorks="otherWorks" :spList="spList"></power-form>-->
<!--    <plate-form v-if="activeName == 7" ref="plate" :workerList = allWorkers :departList = departmentList :departList2=departmentList2 :deviceList = allDevices :otherWorks="otherWorks" :spList="spList"></plate-form>-->
    </div>
</template>
 
<script lang="ts">
    import {toRefs, reactive, defineComponent, ref, defineAsyncComponent, onMounted} 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 { ElMessage } from 'element-plus'
    import type { FormInstance, FormRules, TabsPaneContext } from 'element-plus'
    import { workApplyApi } from '/@/api/specialWorkSystem/workApply';
    import {teamManageApi} from "/@/api/systemManage/basicDateManage/personShiftManage/teamManage";
 
    interface stateType {
    activeName: string
        allWorkers: Array<any>
        departmentList: Array<any>
    departmentList2: Array<any>
    otherWorks: Array<any>
    allDevices: Array<any>
    loading: boolean
    lists: {}
    }
    export default defineComponent({
        name: 'apply',
        components: {
            fireForm: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/zysq/components/fire.vue')),
            spaceForm: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/zysq/components/space.vue')),
            hoistForm: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/zysq/components/hoist.vue')),
            groundForm: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/zysq/components/ground.vue')),
            brokenForm: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/zysq/components/broken.vue')),
            heightForm: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/zysq/components/height.vue')),
            powerForm: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/zysq/components/power.vue')),
            plateForm: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/zysq/components/plate.vue')),
      openForm: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/zysq/components/open.vue')),
        },
        setup() {
            const userInfo = useUserInfo()
            const { userInfos } = storeToRefs(userInfo);
            const state  = reactive<stateType>({
        loading: false,
        lists: {
          workerList: [],
          departList: [],
          departList2: [],
          deviceList: [],
          otherWorks: [],
          spList: [],
          riskList: []
        },
        activeName: 'fire',
                allWorkers: [],
                departmentList: [],
        departmentList2:[],
        otherWorks: [],
        allDevices: [],
            });
      const fire = ref()
      const space = ref()
      const hoist = ref()
      const ground = ref()
      const broken = ref()
      const height = ref()
      const power = ref()
      const plate = ref()
      const open = ref()
 
      const handleClick = (tab: TabsPaneContext, event: Event) => {
        state.loading = true
        setTimeout(()=>{
          state.loading = false
        },1000)
        // if(tab.index == 0){fire.value.getBasicData()}
        // if(tab.index == 1){space.value.getBasicData()}
        // if(tab.index == 2){hoist.value.getBasicData()}
        // if(tab.index == 3){ground.value.getBasicData()}
        // if(tab.index == 4){broken.value.getBasicData()}
        // if(tab.index == 5){height.value.getBasicData()}
        // if(tab.index == 6){power.value.getBasicData()}
        // if(tab.index == 7){plate.value.getBasicData()}
      }
 
      // const handleClick = (value: number) => {
      //   if(value == 0){fire.value.getBasicData()}
      //   if(value == 1){space.value.getBasicData()}
      //   if(value == 2){hoist.value.getBasicData()}
      //   if(value == 3){ground.value.getBasicData()}
      //   if(value == 4){broken.value.getBasicData()}
      //   if(value == 5){height.value.getBasicData()}
      //   if(value == 6){power.value.getBasicData()}
      //   if(value == 7){plate.value.getBasicData()}
      // }
 
      // 页面载入时执行方法
      onMounted(() => {
        getAll()
        getAllDepartment()
        getAllDevice()
        getOtherWork()
        spWorker()
        getOpList()
        getAllRisks()
      });
 
            // 获取用户列表
            const getAll = async ()=>{
                const res = await workApplyApi().getAllUsers()
                if (res.data.code === '200') {
                    state.allWorkers = JSON.parse(JSON.stringify(res.data.data))
          state.lists.workerList = JSON.parse(JSON.stringify(res.data.data))
                } else {
                    ElMessage({
                        type: 'warning',
                        message: res.data.msg
                    });
                }
            };
 
      const spWorker = async ()=>{
        for(let id of ['18','19']){
          const res = await workApplyApi().getSpList({roleId: id})
          // if(id == '17'){
          //   if (res.data.code === '200') {
          //     state.lists.spList.opList = JSON.parse(JSON.stringify(res.data.data))
          //   } else {
          //     ElMessage({
          //       type: 'warning',
          //       message: res.data.msg
          //     });
          //   }
          // }
          if(id == '18'){
            if (res.data.code === '200') {
              state.lists.spList.jhList = JSON.parse(JSON.stringify(res.data.data))
            } else {
              ElMessage({
                type: 'warning',
                message: res.data.msg
              });
            }
          }
          if(id == '19'){
            if (res.data.code === '200') {
              state.lists.spList.sfList = JSON.parse(JSON.stringify(res.data.data))
            } else {
              ElMessage({
                type: 'warning',
                message: res.data.msg
              });
            }
          }
        }
      }
 
      const getOpList = async()=>{
        const res = await workApplyApi().getOpList()
        if(res.data.code == '200'){
          if(res.data.data && res.data.data.length>0){
            state.lists.spList.opList = JSON.parse(JSON.stringify(res.data.data)).map(i=>{
              if(i.certList && i.certList.length>0){
                i.certList = i.certList.map(item=>{
                  item['realName'] = i.realName + '(' + item.certTypeName +':'+ item.certExpiredAt + ')'
                  item['uid'] = item.certNo + ',' + item.certExpiredAt
                  return item
                })
              }
              return i
            })
          }
        }else{
          ElMessage({
            type: 'warning',
            message: res.data.msg
          })
        }
      }
 
            // 获取部门列表
            const getAllDepartment = async () => {
                let res = await teamManageApi().getAllDepartment();
                if (res.data.code === '200') {
                    // state.departmentList = JSON.parse(JSON.stringify(res.data.data))
          // state.departmentList2 = state.departmentList[0].children[0].children.filter(i=>i.depId == 32 || i.depId == 48 || i.depId == 49 || i.depId == 50)
          state.lists.departList = JSON.parse(JSON.stringify(res.data.data))
          state.lists.departList2 = JSON.parse(JSON.stringify(res.data.data))[0].children[0].children.filter(i=>i.depId == 32 || i.depId == 48 || i.depId == 49 || i.depId == 50 || i.depId == 10 || i.depId == 41 || i.depId == 46 || i.depId == 47)
                } else {
                    ElMessage({
                        type: 'warning',
                        message: res.data.msg
                    });
                }
            };
 
      // 获取相关作业列表
      const getOtherWork = async () => {
        let res = await workApplyApi().getOtherWork({pageSize: 999, pageIndex: 1, searchParams: {workPermitNo: '', workType: null}})
        if (res.data.code === '200') {
          state.otherWorks = JSON.parse(JSON.stringify(res.data.data))
          state.lists.otherWorks = JSON.parse(JSON.stringify(res.data.data))
        } else {
          ElMessage({
            type: 'warning',
            message: res.data.msg
          });
        }
      };
 
      // 获取设备列表
      const getAllDevice = async ()=>{
        const res = await workApplyApi().getAllDevices()
        if (res.data.code === '200') {
          state.allDevices = JSON.parse(JSON.stringify(res.data.data))
          state.lists.deviceList = JSON.parse(JSON.stringify(res.data.data))
        } else {
          ElMessage({
            type: 'warning',
            message: res.data.msg
          });
        }
      };
 
      // 获取设备列表
      const getAllRisks = async ()=>{
        const res = await workApplyApi().getAllRiskIdentity()
        if (res.data.code === '200') {
          // state.allDevices = JSON.parse(JSON.stringify(res.data.data))
          state.lists.riskList = JSON.parse(JSON.stringify(res.data.data))
        } else {
          ElMessage({
            type: 'warning',
            message: res.data.msg
          });
        }
      };
 
            return {
                ...toRefs(state),
        fire,
        space,
        broken,
        ground,
        height,
        hoist,
        plate,
        power,
        open,
        handleClick,
        getOtherWork
            };
        },
    });
</script>
 
<style scoped lang="scss">
    .home-container {
        height: 100%;
        overflow: hidden;
        position: relative;
        .homeCard{
            width: 100%;
            padding: 20px;
            box-sizing: border-box;
            background: #fff;
            border-radius: 4px;
            margin-bottom: 20px;
        }
        .applyBtn{
            width: 100%;
            background: #fff;
            height: 80px;
            z-index: 5;
            box-shadow: 0 -3px 8px rgba(150,150,150,.1);
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .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;
        }
    }
</style>