郑永安
2023-06-19 2befd4a5d3733520b69ed97da88e675b6b086a3c
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
<template>
    <el-dialog
        :visible.sync="dialogVisible"
        :close-on-click-modal="false"
        width="70%"
    >
        <el-tabs type="border-card" class="active" v-model="activeName">
            <el-tab-pane label="企业基本信息" name="enterpriseBasicInformation">
                <enterpriseBasicInformation ref="enterpriseBasicInformation" @getinfo="submitEnterprise" @cancel="dialogVisible = false" :title="title" :passForm="dataFormPass"></enterpriseBasicInformation>
            </el-tab-pane>
            <el-tab-pane label="许可证件信息" name="permitInformation" v-if="ifShowOther">
                <permitInformation ref="permitInformation" :enterpriseId="enterpriseId"></permitInformation>
            </el-tab-pane>
            <el-tab-pane label="存储库房" name="storeHouse" v-if="ifShowOther">
                <storeHouse ref="storeHouse" :enterpriseId="enterpriseId"></storeHouse>
            </el-tab-pane>
            <el-tab-pane label="安全生产标准化" name="safetyProductionStandard" v-if="ifShowOther">
                <safetyProductionStandard ref="safetyProductionStandard" @getinfo="refreshData" :enterpriseId="enterpriseId"></safetyProductionStandard>
            </el-tab-pane>
            <el-tab-pane label="安全人员资格" name="safetyPersonQualification" v-if="ifShowOther">
                <safetyPersonQualification ref="safetyPersonQualification" :enterpriseId="enterpriseId"></safetyPersonQualification>
            </el-tab-pane>
            <el-tab-pane label="特种人员资格" name="specialPersonQualification" v-if="ifShowOther">
                <specialPersonQualification ref="specialPersonQualification" :enterpriseId="enterpriseId"></specialPersonQualification>
            </el-tab-pane>
            <el-tab-pane label="应急救援预案" name="emergencyResponsePlan" v-if="ifShowOther">
                <emergencyResponsePlan ref="emergencyResponsePlan" :enterpriseId="enterpriseId"></emergencyResponsePlan>
            </el-tab-pane>
            <el-tab-pane label="流向信息管理承诺书" name="flowInformationCommitment" v-if="ifShowOther">
                <flowInformationCommitment ref="flowInformationCommitment" :enterpriseId="enterpriseId"></flowInformationCommitment>
            </el-tab-pane>
            <el-tab-pane label="年度库存" name="annualInventory" v-if="ifShowOther">
                <annualInventory ref="annualInventory" :enterpriseId="enterpriseId"></annualInventory>
            </el-tab-pane>
            <el-tab-pane label="信息反馈" name="feed" v-if="ifShowOther">
                <feed ref="feed" :enterpriseId="enterpriseId"></feed>
            </el-tab-pane>
        </el-tabs>
    </el-dialog>
</template>
 
<script>
import enterpriseBasicInformation from "./components/enterpriseBasicInformation";
import permitInformation from "./components/permitInformation";
import storeHouse from "./components/storeHouse";
import safetyPersonQualification from "./components/safetyPersonQualification";
import safetyProductionStandard from "./components/safetyProductionStandard";
import specialPersonQualification from "./components/specialPersonQualification";
import emergencyResponsePlan from "./components/emergencyResponsePlan";
import flowInformationCommitment from "./components/flowInformationCommitment";
import annualInventory from "./components/annualInventory";
import feed from "./components/feed";
import { addNewEnterprise , updateNewEnterprise } from "../../api/enterprise";
import {parseError} from "../../utils/messageDialog";
 
export default {
    name: "detailForm",
    data(){
        return{
            title:'',
            dataFormPass:{},
            ifShowOther:'',
            enterpriseId:'',
            activeName:'enterpriseBasicInformation',
            dialogVisible:false,
        }
    },
    components:{
        enterpriseBasicInformation,
        permitInformation,
        storeHouse,
        safetyProductionStandard,
        safetyPersonQualification,
        specialPersonQualification,
        emergencyResponsePlan,
        flowInformationCommitment,
        annualInventory,
        feed
    },
    methods:{
        openEnterpriseDetailForm(operateName,value,economicTypeList,jobList,safetySuperVisionList,economicIndustryList){
            this.enterpriseId = value.id
            this.activeName = 'enterpriseBasicInformation'
            this.title = operateName
            this.dialogVisible = true
            if(operateName === '新增'){
                this.ifShowOther = false
                setTimeout(() =>{
                    this.$refs.enterpriseBasicInformation.dataForm = {
                        safetysupervision: '',
                        economicindustry: '',
                        enterprisenumber: '',
                        enterprisename: '',
                        enterpriseemail: '',
                        enterprisesize: '',
                        enterprisestatus: '',
                        department: '',
                        devicenumber: '',
                        officeaddress: '',
                        province: '',
                        city: '',
                        district: '',
                        street: '',
                        committee: '',
                        securitysupervisory: '',
                        officephone: '',
                        faxphone: '',
                        registeraddress: '',
                        registertype: '',
                        establishtime: '',
                        qqnumber: '',
                        postcode: '',
                        roomnumber: '',
                        economictype: '',
                        productioncontent: '',
                        businessregisternumber: '',
                        organizationstructurecode: '',
                        validstarttime: '',
                        validendtime: '',
                        employeenumber: '',
                        ispaysafetyinsurance: '',
                        insurancecontractnumber: '',
                        insureamount: '',
                        insurestarttime: '',
                        insureendtime: '',
                        ismajorhazard: '',
                        isspecialequipment: '',
                        isoccupationalhealthinfo: '',
                        isspecialpersonnel: '',
                        selfrecordingcycle: '',
                        isparententerprise: '',
                        parententerprisename: '',
                        latitude:'',
                        longitude:'',
                        legalrepresentative:{
                            belongid: 1,
                            belongname: "",
                            id: null,
                            name: "",
                            number: "",
                            identify:"",
                            officephone: "",
                            phone: "",
                            post: "",
                            type: "",
                            validendtime:"",
                            validstarttime:"",
                        },
                        informationofficer:{
                            belongid: 1,
                            belongname: "",
                            id: null,
                            name: "",
                            number: "",
                            officephone: "",
                            phone: "",
                            post: "",
                            type: "",
                            validendtime:"",
                            validstarttime:"",
                        },
                        mainprincipal:{
                            belongid: 1,
                            belongname: "",
                            id: null,
                            name: "",
                            number: "",
                            officephone: "",
                            phone: "",
                            post: "",
                            type: "",
                            validendtime:"",
                            validstarttime:"",
                        },
                        securityofficer:{
                            belongid: 1,
                            belongname: "",
                            id: null,
                            name: "",
                            number: "",
                            officephone: "",
                            phone: "",
                            post: "",
                            type: "",
                            validendtime:"",
                            validstarttime:"",
                        },
                    },
                    this.$refs.enterpriseBasicInformation.isEdit = false
                    this.$refs.enterpriseBasicInformation.jobList = jobList
                    this.$refs.enterpriseBasicInformation.economicTypeList = economicTypeList
                    this.$refs.enterpriseBasicInformation.safetySuperVisionList = safetySuperVisionList
                    this.$refs.enterpriseBasicInformation.economicIndustryList = economicIndustryList
                    this.$refs.enterpriseBasicInformation.resetFormRules()
                })
            }else{
                this.dataFormPass = value
                this.ifShowOther = true
                setTimeout(() =>{
                    this.$refs.enterpriseBasicInformation.legalRepresentativeTime = [value.legalrepresentative.validstarttime,value.legalrepresentative.validendtime]
                    this.$refs.enterpriseBasicInformation.informationofficerTime = [value.informationofficer.validstarttime,value.informationofficer.validendtime]
                    this.$refs.enterpriseBasicInformation.mainprincipalTime = [value.mainprincipal.validstarttime,value.mainprincipal.validendtime]
                    this.$refs.enterpriseBasicInformation.securityOfficerTime = [value.securityofficer.validstarttime,value.securityofficer.validendtime]
                    if(this.$refs.enterpriseBasicInformation.legalRepresentativeTime[0] === null){
                        this.$refs.enterpriseBasicInformation.legalRepresentativeTime[0] = ""
                    }
                    if(this.$refs.enterpriseBasicInformation.legalRepresentativeTime[1] === null){
                        this.$refs.enterpriseBasicInformation.legalRepresentativeTime[1] = ""
                    }
                    if(this.$refs.enterpriseBasicInformation.informationofficerTime[0] === null){
                        this.$refs.enterpriseBasicInformation.informationofficerTime[0] = ""
                    }
                    if(this.$refs.enterpriseBasicInformation.informationofficerTime[1] === null){
                        this.$refs.enterpriseBasicInformation.informationofficerTime[1] = ""
                    }
                    if(this.$refs.enterpriseBasicInformation.mainprincipalTime[0] === null){
                        this.$refs.enterpriseBasicInformation.mainprincipalTime[0] = ""
                    }
                    if(this.$refs.enterpriseBasicInformation.mainprincipalTime[1] === null){
                        this.$refs.enterpriseBasicInformation.mainprincipalTime[1] = ""
                    }
                    if(this.$refs.enterpriseBasicInformation.securityOfficerTime[0] === null){
                        this.$refs.enterpriseBasicInformation.securityOfficerTime[0] = ""
                    }
                    if(this.$refs.enterpriseBasicInformation.securityOfficerTime[1] === null){
                        this.$refs.enterpriseBasicInformation.securityOfficerTime[1] = ""
                    }
                    this.$refs.enterpriseBasicInformation.dataForm = JSON.parse(JSON.stringify(value))
                    if(JSON.parse(JSON.stringify(value)).validendtime === null || JSON.parse(JSON.stringify(value)).validstarttime === null){
                        this.$refs.enterpriseBasicInformation.validTime = ['','']
                    }else{
                        this.$refs.enterpriseBasicInformation.validTime = [JSON.parse(JSON.stringify(value)).validstarttime,JSON.parse(JSON.stringify(value)).validendtime]
                    }
                    this.$refs.enterpriseBasicInformation.isEdit = true
                    this.$refs.enterpriseBasicInformation.jobList = jobList
                    this.$refs.enterpriseBasicInformation.economicTypeList = economicTypeList
                    this.$refs.enterpriseBasicInformation.safetySuperVisionList = safetySuperVisionList
                    this.$refs.enterpriseBasicInformation.economicIndustryList = economicIndustryList
                    this.$refs.permitInformation.getPermitInformationListData()
                    this.$refs.storeHouse.getEnterpriseWarehouseListData()
                    this.$refs.safetyPersonQualification.getSafetyPersonQualificationListData()
                    this.$refs.specialPersonQualification.getSpecialPersonQualificationListData()
                    this.$refs.emergencyResponsePlan.getEmergencyData()
                    this.$refs.flowInformationCommitment.getFlowInformationData()
                    this.$refs.annualInventory.getAnnualInventoryDataListData()
                    this.$refs.enterpriseBasicInformation.resetFormRules()
                    this.$refs.enterpriseBasicInformation.qrcode()
                    this.$refs.safetyProductionStandard.getSafetyProductionStandard()
                    this.$refs.feed.getFeedBackListData()
                })
            }
        },
        async submitEnterprise(){
            this.$refs.enterpriseBasicInformation.justifyRules()
            if(this.$refs.enterpriseBasicInformation.correct === false){
                this.$notify({
                    title:'警告',
                    message:'请完善基本信息',
                    type:'warning'
                })
            }else{
                if(this.title === '新增'){
                    let addForm = this.$refs.enterpriseBasicInformation.dataForm
                    if(addForm.validstarttime == null){
                        this.$notify({
                            title:'警告',
                            message:'请填写许可证期限',
                            type:'warning'
                        })
                    }else {
                        let res = await addNewEnterprise(addForm)
                        if(res.data.code === "200"){
                            this.$emit('getinfo')
                            this.dialogVisible = false
                            this.$notify({
                                type:'success',
                                duration:2000,
                                message:'成功',
                                title:'成功',
                            })
                        }else {
                            this.$message({
                                type:'warning',
                                message:res.data.message
                            })
                        }
                    }
 
                }
                else{
                    let updateForm = this.$refs.enterpriseBasicInformation.dataForm
                    if(updateForm.validstarttime == null){
                        this.$notify({
                            title:'警告',
                            message:'请填写许可证期限',
                            type:'warning'
                        })
                    }else {
                        let res = await updateNewEnterprise(updateForm)
                        if(res.data.code === "200"){
                            this.$emit('getinfo')
                            this.dialogVisible = false
                            this.$notify({
                                type:'success',
                                duration:2000,
                                message:'成功',
                                title:'成功',
                            })
                        }else {
                            this.$message({
                                type:'warning',
                                message:res.data.message
                            })
                        }
                    }
 
                }
            }
        },
        refreshData(){
            this.$refs.safetyProductionStandard.getSafetyProductionStandard()
        }
    }
}
</script>
 
<style scoped>
.enterpriseBasicInformation_footer{
    padding-top:10px;
    text-align: right;
}
</style>