<template>
|
<el-dialog :title="title" :visible.sync="centerDialogVisible" width="70%" center @close='reset()'>
|
<el-form :model="companyInfo" :rules="rules" ref="ruleForm" label-width="120px">
|
<el-row>
|
<el-col :span="10">
|
<el-form-item label="企业名称" prop="companyName">
|
<el-input v-model="companyInfo.companyName" placeholder="企业名称"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="10" :offset="4">
|
<el-form-item label="法定负责人" prop="companyLegalRepresentative">
|
<el-input v-model="companyInfo.companyLegalRepresentative" placeholder="企业负责人"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="10">
|
<el-form-item label="许可证类型" prop="certificateType">
|
<el-radio-group v-model="companyInfo.certificateType">
|
<el-radio border :label="1">生产</el-radio>
|
<el-radio border :label="2">经营</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
</el-col>
|
<el-col :span="10" :offset="4">
|
<el-form-item label="许可证编号" prop="certificateNum">
|
<el-input v-model="companyInfo.certificateNum" placeholder="证书编号">
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="10">
|
<el-form-item label="证书有效期" prop="validityDate">
|
<el-date-picker
|
v-model="companyInfo.validityDate"
|
@input="changeTime"
|
@blur="changeTime"
|
value-format="yyyy-MM-dd"
|
type="daterange"
|
start-placeholder="开始日期"
|
end-placeholder="结束日期"
|
>
|
</el-date-picker>
|
</el-form-item>
|
</el-col>
|
<el-col :span="10" :offset="4" style='display: flex;align-items: center;justify-content: space-between'>
|
<el-form-item label="工艺类型" prop="technologyType" style='margin-bottom: 0'>
|
<el-select clearable v-model="companyInfo.technologyType" style="width: 100%">
|
<el-option v-for='(item,index) in techTypeList' :label="item.technologyName" :value="item.id" :key='index'></el-option>
|
</el-select>
|
</el-form-item>
|
<el-button type='primary' @click='openTypeDialog()'>管理</el-button>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="10">
|
<el-form-item label="所在地区" prop="companyCityValue">
|
<el-cascader
|
v-model="companyInfo.companyCityValue"
|
:options="areaInfo"
|
:props="{ expandTrigger: 'hover', value: 'label' }"
|
style="width: 100%"
|
@change="handleChangeAddArea"
|
></el-cascader>
|
<!-- <el-input v-model="companyInfo.companyCity" style="width: 100%" placeholder="所在城市">-->
|
<!-- </el-input>-->
|
</el-form-item>
|
</el-col>
|
<el-col :span="10" :offset="4">
|
<el-form-item label="住所" prop='companyAddress'>
|
<el-input type='textarea' v-model="companyInfo.companyAddress" style="width: 100%" placeholder="请输入详细地址"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="24">
|
<el-form-item label="许可范围" prop="licenseScope">
|
<el-input v-model="companyInfo.licenseScope" type="textarea" style="width: 100%;" placeholder="请描述许可范围">
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="10">
|
<el-form-item label="发证机关" prop="licenceIssuingAuthority">
|
<el-input v-model="companyInfo.licenceIssuingAuthority" style="width: 100%" placeholder=""></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="10" :offset="4">
|
<el-form-item label="发证时间" prop="licenceIssuingTime">
|
<el-date-picker
|
v-model="companyInfo.licenceIssuingTime"
|
type="date"
|
value-format="yyyy-MM-dd"
|
placeholder="选择日期">
|
</el-date-picker>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<!-- <el-dialog :visible.sync="dialogVisible">-->
|
<!-- <img width="100%" :src="dialogImageUrl" alt="">-->
|
<!-- </el-dialog>-->
|
<el-row>
|
<el-col :span="8">
|
<el-form-item label="企业图片 " prop="companyImage">
|
<el-upload
|
action="#" ref="upload" :http-request="httpRequestCompanyImage" list-type="picture-card"
|
v-model="companyInfo.companyImage"
|
:on-success="fileUploadSuccess" :before-upload="addFileList"
|
:limit="1"
|
:file-list="companyImageList"
|
accept=".jpg,.jpeg,.png"
|
:on-change="(file, fileList) => {handleChangeFile(file, fileList, 1)}"
|
:on-remove="(file, fileList) => {handleRemove(file, fileList, 1)}"
|
>
|
<i class="el-icon-plus"></i>
|
</el-upload>
|
</el-form-item>
|
</el-col>
|
|
<el-col :span="8">
|
<el-form-item label="营业执照 " prop="businessLicense">
|
<el-upload size="small"
|
action="#" ref="upload" :http-request="httpRequestBusinessLicense" list-type="picture-card"
|
v-model="companyInfo.businessLicense"
|
:on-success="fileUploadSuccess"
|
:before-upload="addFileList"
|
:limit="1"
|
:file-list="businessLicenseList"
|
:on-change="(file, fileList) => {handleChangeFile(file, fileList, 2)}"
|
accept=".jpg,.jpeg,.png"
|
:on-remove="(file, fileList) => {handleRemove(file, fileList, 2)}"
|
>
|
<i class="el-icon-plus"></i>
|
</el-upload>
|
</el-form-item>
|
</el-col>
|
|
<el-col :span="8">
|
<el-form-item label="经营许可证书 " prop="securityCertificate">
|
<el-upload
|
action="#" ref="upload" :http-request="httpRequestSecurityCertificate" list-type="picture-card"
|
v-model="companyInfo.securityCertificate"
|
:on-success="fileUploadSuccess" :before-upload="addFileList"
|
:limit="1"
|
:file-list="securityCertificateList"
|
:on-change="(file, fileList) => {handleChangeFile(file, fileList, 3)}"
|
accept=".jpg,.jpeg,.png"
|
:on-remove="(file, fileList) => {handleRemove(file, fileList, 3)}"
|
>
|
<i class="el-icon-plus"></i>
|
</el-upload>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="10">
|
<el-form-item label="重大危险源总数" label-width='140px'>
|
<el-input readonly v-model.number="totalRisk" style="width: 100%" placeholder=""></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="10">
|
<el-form-item label="一级重大危险源总数" label-width='140px' prop='levelOneMajorHazardSourceSum'>
|
<el-input type='number' v-model.number="companyInfo.levelOneMajorHazardSourceSum" style="width: 100%" placeholder=""></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="10" :offset="4" v-if='companyInfo.levelOneMajorHazardSourceSum > 0'>
|
<el-form-item label="一级重大危险源描述" label-width='140px' prop='levelOneMajorHazardSourceDesc'>
|
<el-input type='textarea' v-model="companyInfo.levelOneMajorHazardSourceDesc" style="width: 100%" placeholder="请简单描述一级重大危险源"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="10">
|
<el-form-item label="二级重大危险源总数" label-width='140px' prop='levelTwoMajorHazardSourceSum'>
|
<el-input type='number'v-model.number="companyInfo.levelTwoMajorHazardSourceSum" style="width: 100%" placeholder=""></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="10" :offset="4" v-if='companyInfo.levelTwoMajorHazardSourceSum > 0'>
|
<el-form-item label="二级重大危险源描述" label-width='140px' prop='levelTwoMajorHazardSourceDesc'>
|
<el-input type='textarea' v-model="companyInfo.levelTwoMajorHazardSourceDesc" style="width: 100%" placeholder="请简单描述二级重大危险源"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="10">
|
<el-form-item label="三级重大危险源总数" label-width='140px' prop='levelThreeMajorHazardSourceSum'>
|
<el-input type='number' v-model.number="companyInfo.levelThreeMajorHazardSourceSum" style="width: 100%" placeholder=""></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="10" :offset="4" v-if='companyInfo.levelThreeMajorHazardSourceSum > 0'>
|
<el-form-item label="三级重大危险源描述" label-width='140px' prop='levelThreeMajorHazardSourceDesc'>
|
<el-input type='textarea' v-model="companyInfo.levelThreeMajorHazardSourceDesc" style="width: 100%" placeholder="请简单描述三级重大危险源"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="10">
|
<el-form-item label="四级重大危险源总数" label-width='140px' prop='levelFourMajorHazardSourceSum'>
|
<el-input type='number' v-model.number="companyInfo.levelFourMajorHazardSourceSum" style="width: 100%" placeholder=""></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="10" :offset="4" v-if='companyInfo.levelFourMajorHazardSourceSum > 0'>
|
<el-form-item label="四级重大危险源描述" label-width='140px' prop='levelFourMajorHazardSourceDesc'>
|
<el-input type='textarea' v-model="companyInfo.levelFourMajorHazardSourceDesc" style="width: 100%" placeholder="请简单描述四级重大危险源"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
|
<el-form :model="companyInfo" class="demo-form-inline" style="padding-left: 40px;">
|
<el-row>
|
<el-col :span="24">
|
<el-form-item label="企业基本情况">
|
<el-input v-model="companyInfo.companyInfo" type="textarea" style="width: 100%;" placeholder="">
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="24">
|
<el-form-item label="“两重点一重大”情况">
|
<el-input v-model="companyInfo.keynoteGreatSituation" type="textarea" style="width: 100%"
|
placeholder=""
|
></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="24">
|
<el-form-item label="安全生产情况">
|
<el-input v-model="companyInfo.safetyProductionLicenseSituation" type="textarea" style="width: 100%"
|
placeholder=""
|
></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="24">
|
<el-form-item label="主要安全风险">
|
<el-input v-model="companyInfo.mainSafetyRisks" style="width: 100%" type="textarea" placeholder="">
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="24">
|
<el-form-item label="当前存在问题">
|
<el-input v-model="companyInfo.currentProblems" style="width: 100%" type="textarea"
|
placeholder=""
|
></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="24">
|
<el-form-item label="安全风险主要控制措施">
|
<el-input v-model="companyInfo.safetyRiskControlMeasures" style="width: 100%" type="textarea"
|
placeholder=""
|
></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="centerDialogVisible = false">取 消</el-button>
|
<el-button v-stop-re-click type="primary" @click="saveData">确 定</el-button>
|
</span>
|
<el-dialog title="工艺类型管理" :visible.sync="typeDialog" :append-to-body="true">
|
<el-button type="primary" size="medium" @click='editType(null)'>新增</el-button>
|
<el-table :data="techTypeList" border :header-cell-style="{ background: '#f4f4f4' }" style="width: 100%; margin-top: 20px">
|
<el-table-column prop="technologyName" label="工艺类型" align='center'></el-table-column>
|
<el-table-column label="操作" align='center'>
|
<template slot-scope="scope">
|
<el-button type="text" size="medium" @click='editType(scope.row)'>编辑</el-button>
|
<el-button type="text" size="medium" @click='deleteType(scope.row.id)'>删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-dialog>
|
<el-dialog title="工艺类型编辑" :visible.sync="typeEditDialog" @close='closeEdit()' :append-to-body="true">
|
<el-form ref="typeForm" :model="typeForm" :rules="typeRules" label-width="80px">
|
<el-form-item label="类型名称" prop="technologyName">
|
<el-input v-model="typeForm.technologyName"></el-input>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="typeEditDialog = false">取 消</el-button>
|
<el-button v-stop-re-click type="primary" @click="confirmTypeAdd('typeForm')">确 定</el-button>
|
</div>
|
</el-dialog>
|
</el-dialog>
|
</template>
|
|
<script>
|
import {
|
getTechType,
|
addTechType,
|
updateTechType,
|
deleteTechType,
|
saveCompanyInfo,
|
updateCompanyInfo,
|
getAreaInfo,
|
getEnterpriseInfoById
|
} from '@/api/company';
|
|
export default {
|
name: "companyDialog",
|
props: {
|
typeList:{
|
type: Array
|
}
|
},
|
data(){
|
return{
|
centerDialogVisible:false,
|
techTypeList: [],
|
areaInfo: [],
|
typeForm: {
|
id: null,
|
technologyName: ''
|
},
|
typeDialog: false,
|
typeEditDialog: false,
|
typeRules: {
|
technologyName: [{ required: true, message: '请输入工艺类型名称', trigger: 'blur' }],
|
},
|
title: '',
|
companyInfo: {
|
id: null,
|
companyName: '',
|
companyLegalRepresentative: '',
|
certificateType: null,
|
certificateNum: '',
|
validityDate: [],
|
validityDateStart: '',
|
validityDateEnd: '',
|
technologyType: null,
|
companyCityValue: [],
|
companyCity: '',
|
companyArea: '',
|
companyAddress: '',
|
licenseScope: '',
|
licenceIssuingAuthority: '',
|
licenceIssuingTime: '',
|
levelOneMajorHazardSourceSum: 0,
|
levelOneMajorHazardSourceDesc: '',
|
levelTwoMajorHazardSourceSum: 0,
|
levelTwoMajorHazardSourceDesc: '',
|
levelThreeMajorHazardSourceSum: 0,
|
levelThreeMajorHazardSourceDesc: '',
|
levelFourMajorHazardSourceSum: 0,
|
levelFourMajorHazardSourceDesc: '',
|
companyInfo: '',
|
keynoteGreatSituation: '',
|
safetyProductionLicenseSituation: '',
|
mainSafetyRisks: '',
|
currentProblems: '',
|
safetyRiskControlMeasures: '',
|
companyImageFile: null,
|
businessLicenseFile: null,
|
securityCertificateFile: null
|
},
|
rules: {
|
companyCityValue: [{required: true, message: '请选择企业所在区域', trigger: 'blur'}],
|
companyName: [{required: true, message: '请输入企业名称', trigger: 'blur'}],
|
companyLegalRepresentative: [{required: true, message: '请输入企业负责人', trigger: 'blur'}],
|
certificateType: [{required: true, message: '请选择许可证类型', trigger: 'blur'}],
|
certificateNum: [{required: true, message: '请输入证书编号', trigger: 'blur'}],
|
validityDate: [{required: true, message: '请选择日期区间', trigger: 'blur'}],
|
technologyType: [{required: true, message: '请输入工艺类型', trigger: 'blur'}],
|
companyAddress: [{required: true, message: '请输入详细地址', trigger: 'blur'}],
|
licenseScope: [{required: true, message: '请输入许可范围', trigger: 'blur'}],
|
licenceIssuingAuthority: [{required: true, message: '请输入发证机关', trigger: 'blur'}],
|
licenceIssuingTime: [{required: true, message: '请选择发证时间', trigger: 'blur'}],
|
levelOneMajorHazardSourceSum: [{required: true, message: '请输入一级重大危险源总数', trigger: 'blur'}],
|
levelTwoMajorHazardSourceSum: [{required: true, message: '请输入二级重大危险源总数', trigger: 'blur'}],
|
levelThreeMajorHazardSourceSum: [{required: true, message: '请输入三级重大危险源总数', trigger: 'blur'}],
|
levelFourMajorHazardSourceSum: [{required: true, message: '请输入四级重大危险源总数', trigger: 'blur'}],
|
levelOneMajorHazardSourceDesc: [{required: true, message: '请填写描述信息', trigger: 'blur'}],
|
levelTwoMajorHazardSourceDesc: [{required: true, message: '请填写描述信息', trigger: 'blur'}],
|
levelThreeMajorHazardSourceDesc: [{required: true, message: '请填写描述信息', trigger: 'blur'}],
|
levelFourMajorHazardSourceDesc: [{required: true, message: '请填写描述信息', trigger: 'blur'}]
|
},
|
dialogImageUrl: '',
|
fileList: [],
|
companyImageList: [],
|
businessLicenseList: [],
|
securityCertificateList: [],
|
}
|
},
|
created() {
|
|
},
|
mounted() {
|
const t = this
|
t.getAreaInfo()
|
},
|
watch: {
|
},
|
computed:{
|
totalRisk:{
|
get(){
|
return Number(this.companyInfo.levelOneMajorHazardSourceSum) + Number(this.companyInfo.levelTwoMajorHazardSourceSum) + Number(this.companyInfo.levelThreeMajorHazardSourceSum) + Number(this.companyInfo.levelFourMajorHazardSourceSum)
|
},
|
set(newValue){
|
return newValue;
|
}
|
}
|
},
|
methods:{
|
changeTime(e) {
|
if (this.companyInfo.validityDate == null) {
|
this.companyInfo.validityDate = new Array()
|
this.companyInfo.validityDate[0] = ''
|
this.companyInfo.validityDate[1] = ''
|
}
|
this.$forceUpdate()
|
},
|
getTechType() {
|
getTechType().then(res => {
|
if(res.code == 200){
|
this.techTypeList = res.data;
|
}else{
|
this.$message(res.msg || '查询失败!请重试', 'error', 3 * 1000)
|
}
|
|
})
|
},
|
getAreaInfo() {
|
getAreaInfo().then(res => {
|
if(res.code == 200){
|
this.areaInfo = res.data;
|
}else{
|
this.$message(res.msg || '查询失败!请重试', 'error', 3 * 1000)
|
}
|
})
|
},
|
getEnterpriseInfo(id){
|
const t = this
|
getEnterpriseInfoById({ id: id }).then(res =>{
|
if(res.code == 200){
|
t.companyInfo=res.data
|
// t.companyInfo.technologyType = t.typeList.find((item) => item.id == res.data.technologyType).technologyName
|
t.companyInfo.technologyType = res.data.technologyType
|
t.companyInfo.companyCityValue = new Array()
|
t.companyInfo.companyCityValue[0] = res.data.companyCity
|
t.companyInfo.companyCityValue[1] = res.data.companyArea
|
t.totalRisk = res.data.levelOneMajorHazardSourceSum + res.data.levelTwoMajorHazardSourceSum + res.data.levelThreeMajorHazardSourceSum + res.data.levelFourMajorHazardSourceSum
|
t.companyInfo.validityDate = new Array()
|
t.companyInfo.validityDate[0] = res.data.validityDateStart
|
t.companyInfo.validityDate[1] = res.data.validityDateEnd
|
if (res.data.companyImage) {
|
t.companyImageList.push({'url': process.env.VUE_APP_BASE_API + res.data.companyImage})
|
}
|
if (res.data.businessLicense) {
|
t.businessLicenseList.push({'url': process.env.VUE_APP_BASE_API + res.data.businessLicense})
|
}
|
if (res.data.securityCertificate) {
|
t.securityCertificateList.push({'url': process.env.VUE_APP_BASE_API + res.data.securityCertificate})
|
}
|
// t.$set(t.companyInfo, 'validityDate', [t.companyInfo.validityDateStart != null ?t.companyInfo.validityDateStart : '', t.companyInfo.validityDateEnd != null ? t.companyInfo.validityDateEnd : ''])
|
}else{
|
t.$message(res.msg || '查询失败!请重试', 'error', 3 * 1000)
|
}
|
}).catch((error)=>{
|
console.log(error)
|
})
|
},
|
openTypeDialog(){
|
const t = this
|
t.getTechType()
|
t.typeDialog = true
|
},
|
editType(row){
|
const t = this
|
if(row != null){
|
t.typeForm.id = row.id
|
t.typeForm.technologyName = row.technologyName
|
}
|
t.typeEditDialog = true
|
},
|
|
confirmTypeAdd(formName) {
|
this.$refs[formName].validate((valid) => {
|
if (valid) {
|
const t = this
|
if(t.typeForm.id == null){
|
addTechType(t.typeForm).then((res)=>{
|
if(res.code == 200){
|
t.$message(res.msg || '添加成功!')
|
t.typeEditDialog = false
|
t.getTechType()
|
}else{
|
t.$message(res.msg || '添加失败,请重试', 'error', 3 * 1000)
|
}
|
}).catch((error)=>{
|
console.log(error)
|
})
|
}else{
|
updateTechType(t.typeForm).then((res)=>{
|
if(res.code == 200){
|
t.$message(res.msg || '修改成功!')
|
t.typeEditDialog = false
|
t.getTechType()
|
}else{
|
t.$message(res.msg || '修改失败,请重试', 'error', 3 * 1000)
|
}
|
}).catch((error)=>{
|
console.log(error)
|
})
|
}
|
} else {
|
console.log('error submit!!');
|
return false;
|
}
|
});
|
},
|
deleteType(id){
|
const t = this
|
t.$confirm('此操作将删除该工艺类型, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
deleteTechType({ id: id }).then((res)=>{
|
if(res.code == 200){
|
t.$message(res.msg || '删除成功!')
|
t.getTechType()
|
}else{
|
t.$message(res.msg || '删除失败,请重试', 'error', 3 * 1000)
|
}
|
}).catch((error)=>{
|
console.log(error)
|
})
|
}).catch(() => {
|
t.$message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
closeEdit(){
|
this.typeForm = {
|
id: null,
|
technologyName: ''
|
}
|
},
|
handleChangeAddArea(row) {
|
if(row){
|
this.companyInfo.companyCity = row[0];
|
this.companyInfo.companyArea = row[1];
|
}
|
},
|
httpRequestCompanyImage(data) {
|
let t = this
|
let rd = new FileReader() // 创建文件读取对象
|
let file = data.file
|
const isLt2M = file.size / 1024 / 1024 < 3
|
if (!isLt2M) {
|
// this.$refs.upload.clearFiles()
|
t.$message('上传图片大小不能超过 3MB!', 'warn', 3 * 1000)
|
t.companyImageList = [];
|
return;
|
}
|
t.companyInfo.companyImageFile = file
|
rd.readAsDataURL(file) // 文件读取装换为base64类型
|
rd.onloadend = function (e) {
|
t.imageUrl = this.result // this指向当前方法onloadend的作用域
|
}
|
},
|
httpRequestBusinessLicense(data) {
|
let t = this
|
let rd = new FileReader() // 创建文件读取对象
|
let file = data.file
|
const isLt2M = file.size / 1024 / 1024 < 3
|
if (!isLt2M) {
|
// this.$refs.upload.clearFiles()
|
t.$message('上传图片大小不能超过 3MB!', 'warn', 3 * 1000)
|
t.businessLicenseList = [];
|
return;
|
}
|
t.companyInfo.businessLicenseFile = file
|
rd.readAsDataURL(file) // 文件读取装换为base64类型
|
rd.onloadend = function (e) {
|
t.imageUrl = t.result // this指向当前方法onloadend的作用域
|
}
|
},
|
httpRequestSecurityCertificate(data) {
|
let t = this
|
let rd = new FileReader() // 创建文件读取对象
|
let file = data.file
|
const isLt2M = file.size / 1024 / 1024 < 3
|
if (!isLt2M) {
|
// this.$refs.upload.clearFiles()
|
t.$message('上传图片大小不能超过 3MB!', 'warn', 3 * 1000)
|
t.securityCertificateList = [];
|
return;
|
}
|
t.companyInfo.securityCertificateFile = file
|
rd.readAsDataURL(file) // 文件读取装换为base64类型
|
rd.onloadend = function (e) {
|
t.imageUrl = t.result // this指向当前方法onloadend的作用域
|
}
|
},
|
fileUploadSuccess(response, file, fileList) {
|
},
|
|
addFileList(file) {
|
},
|
|
handleRemove(file, fileList, index) {
|
if (index == 1) {
|
this.companyInfo.deleteCompanyImage = true
|
}
|
if (index == 2) {
|
this.companyInfo.deleteBusinessLicense = true
|
}
|
if (index == 3) {
|
this.companyInfo.deleteSecurityCertificate = true
|
}
|
},
|
handleChangeFile(file, fileList, index) {
|
this.isDisabled = false
|
if (!file) return
|
const isLt2M = file.size / 1024 / 1024 < 3
|
if (!isLt2M) {
|
// this.$refs.upload.clearFiles()
|
this.$message('上传图片大小不能超过 3MB!', 'warn', 3 * 1000)
|
if (index == 1) {
|
console.log(index)
|
this.companyImageList = []
|
this.companyInfo.companyImageFile = null;
|
}
|
if (index == 2) {
|
console.log(index)
|
this.businessLicenseList = []
|
this.companyInfo.businessLicenseFile = null;
|
}
|
if (index == 3) {
|
console.log(index)
|
this.securityCertificateList = []
|
this.companyInfo.securityCertificateFile = null;
|
}
|
}
|
this.fileName = file.name
|
},
|
|
// handlePictureCardPreview(file) {
|
// this.dialogImageUrl = file.url
|
// this.dialogVisible = true
|
// },
|
|
saveData() {
|
const t = this
|
t.loading = true
|
t.$refs['ruleForm'].validate((valid) => {
|
if (valid) {
|
t.companyInfo.validityDateStart = t.companyInfo.validityDate[0]
|
t.companyInfo.validityDateEnd = t.companyInfo.validityDate[1]
|
t.companyInfo.companyCity = t.companyInfo.companyCityValue[0]
|
t.companyInfo.companyArea = t.companyInfo.companyCityValue[1]
|
if(t.companyInfo.levelOneMajorHazardSourceSum == 0){
|
t.companyInfo.levelOneMajorHazardSourceDesc = ''
|
}
|
if(t.companyInfo.levelTwoMajorHazardSourceSum == 0){
|
t.companyInfo.levelTwoMajorHazardSourceDesc = ''
|
}
|
if(t.companyInfo.levelThreeMajorHazardSourceSum == 0){
|
t.companyInfo.levelThreeMajorHazardSourceDesc = ''
|
}
|
if(t.companyInfo.levelFourMajorHazardSourceSum == 0){
|
t.companyInfo.levelFourMajorHazardSourceDesc = ''
|
}
|
// const {validityDate,companyCityValue, ...data} = t.companyInfo
|
var formData = t.initFile()
|
// return
|
if (t.companyInfo.id == null) {
|
saveCompanyInfo(formData).then(res => {
|
if (res.code == 200) {
|
t.loading = false
|
t.$message(res.msg, 'success', 3 * 1000)
|
} else {
|
t.loading = false
|
t.$message(res.msg, 'errot', 3 * 1000)
|
}
|
}).catch(function () {
|
this.$message('添加失败!请重试', 'error', 3 * 1000)
|
this.loading = false
|
})
|
} else {
|
updateCompanyInfo(formData).then(res => {
|
if (res.code == 200) {
|
t.loading = false
|
t.$message(res.msg, 'success', 3 * 1000)
|
} else {
|
t.loading = false
|
t.$message(res.msg, 'errot', 3 * 1000)
|
}
|
}).catch(function () {
|
t.$message('修改失败!请重试', 'error', 3 * 1000)
|
t.loading = false
|
})
|
}
|
t.$parent.getProInfo()
|
if(t.$parent.pageStatus==1){
|
t.$parent.getData()
|
}else{
|
t.$parent.getAllCompany()
|
}
|
t.centerDialogVisible = false
|
} else {
|
t.loading = false
|
return false
|
}
|
})
|
},
|
initFile() {
|
let formData = new FormData()
|
for (const fileName in this.companyInfo) {
|
if (this.companyInfo[fileName] != null && fileName != 'params' && fileName != 'imageBase64') {
|
formData.append(fileName, this.companyInfo[fileName])
|
}
|
}
|
return formData
|
},
|
reset(){
|
this.companyImageList = []
|
this.businessLicenseList = []
|
this.securityCertificateList = []
|
this.companyInfo = {
|
id: null,
|
companyName: '',
|
companyLegalRepresentative: '',
|
certificateType: null,
|
certificateNum: '',
|
validityDate: [],
|
validityDateStart: '',
|
validityDateEnd: '',
|
technologyType: null,
|
companyCityValue: [],
|
companyCity: '',
|
companyArea: '',
|
companyAddress: '',
|
licenseScope: '',
|
licenceIssuingAuthority: '',
|
licenceIssuingTime: '',
|
levelOneMajorHazardSourceSum: 0,
|
levelOneMajorHazardSourceDesc: '',
|
levelTwoMajorHazardSourceSum: 0,
|
levelTwoMajorHazardSourceDesc: '',
|
levelThreeMajorHazardSourceSum: 0,
|
levelThreeMajorHazardSourceDesc: '',
|
levelFourMajorHazardSourceSum: 0,
|
levelFourMajorHazardSourceDesc: '',
|
companyInfo: '',
|
keynoteGreatSituation: '',
|
safetyProductionLicenseSituation: '',
|
mainSafetyRisks: '',
|
currentProblems: '',
|
safetyRiskControlMeasures: '',
|
companyImageFile: null,
|
businessLicenseFile: null,
|
securityCertificateFile: null
|
}
|
}
|
},
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
::v-deep .el-upload--picture-card {
|
background-color: #fbfdff;
|
border: 1px dashed #c0ccda;
|
border-radius: 6px;
|
-webkit-box-sizing: border-box;
|
box-sizing: border-box;
|
width: 100px;
|
height: 100px;
|
line-height: 100px;
|
vertical-align: top;
|
}
|
.el-date-editor.el-input {
|
width: 100%;
|
}
|
</style>
|