<template>
|
<div class="app-container">
|
<div class="hand">
|
<PageTitle title="企业管理"></PageTitle>
|
<el-form ref="form" :model="searchParams" label-width="90px" style="padding:10px 0 5px 0">
|
<el-row>
|
<el-col :span="6">
|
<el-form-item label="公司名称">
|
<el-input v-model="searchParams.companyName"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="负责人">
|
<el-input v-model="searchParams.companyDirector"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="证书编号">
|
<el-input v-model="searchParams.certificateNum"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="是否到期">
|
<el-select clearable v-model="searchParams.isValid" style="width: 100%">
|
<el-option label="否" value="0"></el-option>
|
<el-option label="是" value="1"></el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
|
<el-col :span="6">
|
<el-form-item label="所在地区">
|
<el-cascader
|
v-model="searchParams.areaInfo"
|
style="width: 100%"
|
:options="areaInfo"
|
:props="{ expandTrigger: 'hover' }"
|
clearable
|
@change="handleChangeArea"
|
></el-cascader>
|
</el-form-item>
|
</el-col>
|
|
<el-col :span="7" :offset="11" align="center">
|
<el-form-item>
|
<el-button plain type="primary" icon="el-icon-search" size="small" @click="getData">
|
查询
|
</el-button>
|
<el-button plain type="primary" size="small" icon="el-icon-plus" @click="addCompany"
|
style="margin-left: 0px"
|
>
|
新增
|
</el-button>
|
<!-- <el-upload action="" :auto-upload="false" :multiple="false" :show-file-list="false"-->
|
<!-- :on-change="uploadByJsqd" :file-list="fileList" style="display: inline;"-->
|
<!-- >-->
|
<el-button plain icon="el-icon-upload2" @click="showExportDiv=true" type="primary" size="small">
|
导入
|
</el-button>
|
<!-- </el-upload>-->
|
<el-button plain icon="el-icon-download" type="primary" size="small" @click="handleDownload">
|
导出
|
</el-button>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
</div>
|
<ul class="infinite-list" v-infinite-scroll="load" :infinite-scroll-delay="200" infinite-scroll-distance="1">
|
<li v-for="(item,index) in dataList" :key="index" class="infinite-list-item">
|
<div class="box">
|
<el-row class="box-net">
|
<el-col :span="4">
|
<img v-show="item.companyImageUrl!= null && item.companyImageUrl != ''" class="images"
|
:src="item.companyImageUrl" alt=""
|
/>
|
<img v-show="item.companyImageUrl== null || item.companyImageUrl == ''" class="images"
|
src="../../assets/bg.png" alt=""
|
/>
|
</el-col>
|
<el-col :span="19" :offset="1">
|
<div>
|
<img class="expireImages" v-show="item.isExpire" src="../../assets/expire.png"
|
style="" alt=""
|
/>
|
</div>
|
<div class="className">
|
<span @click="showDetails(item)">{{ item.companyName }}</span>
|
<el-button style="float: right;margin-left: 10px;" type="danger" icon="el-icon-delete" circle
|
@click="deleteCompany(item)"
|
></el-button>
|
<el-button style="float: right;" type="primary" icon="el-icon-edit" circle
|
@click="editCompany(item)"
|
></el-button>
|
</div>
|
<el-row class="title">
|
<el-col :span="6">负责人:<span>{{ item.companyDirector }}</span></el-col>
|
<el-col :span="6">证书编号:<span>{{ item.certificateNum }}</span></el-col>
|
<el-col :span="6">有效期:<span>{{ item.validityDateStart }} - {{ item.validityDateEnd }}</span></el-col>
|
<el-col :span="6">重大危险源数量:<span style="color: red">{{ item.majorHazardSources }}</span></el-col>
|
</el-row>
|
<el-row class="title">
|
<el-col :span="6">所在地区:<span>{{ item.companyCity }}</span></el-col>
|
</el-row>
|
<p class="information">
|
{{ item.companyInfo }}
|
</p>
|
</el-col>
|
</el-row>
|
</div>
|
</li>
|
</ul>
|
|
<el-dialog title="数据导入" :visible.sync="showExportDiv" width="30%" center>
|
|
<el-form
|
ref="importForm"
|
label-position="right"
|
label-width="120px"
|
style="margin-left:50px;width:500px;"
|
element-loading-text="导入中..."
|
>
|
<el-form-item label="导入文件:">
|
<input ref="importLabInput" type="file" accept=".xls, .xlsx" style="color: red">
|
</el-form-item>
|
<el-form-item label="excel参考模板:">
|
<el-button type="text" @click="downLoadTemplate">下载模板</el-button>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="showExportDiv = false">取消</el-button>
|
<el-button :disabled="importDisabled" type="primary" @click="importHandle()">导入</el-button>
|
</div>
|
|
|
</el-dialog>
|
|
<el-dialog :title="title" :visible.sync="centerDialogVisible" width="70%" center>
|
<el-form :model="companyInfo" :rules="rules" ref="ruleForm" label-position="center" label-width="120 rpm"
|
class="demo-form-inline"
|
>
|
|
<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="companyDirector">
|
<el-input v-model="companyInfo.companyDirector" placeholder="企业负责人"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="10">
|
<el-form-item label=" 证书编号" prop="certificateNum">
|
<el-input v-model="companyInfo.certificateNum" placeholder="证书编号">
|
</el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="10" :offset="4">
|
<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-row>
|
<el-row>
|
<el-col :span="10">
|
<el-form-item label="所在地区" prop="companyCity">
|
<el-cascader
|
v-model="companyInfo.companyCityValue"
|
:options="areaInfo"
|
:props="{ expandTrigger: 'hover' }"
|
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="majorHazardSources">
|
<el-input v-model="companyInfo.majorHazardSources" style="width: 100%"
|
placeholder="重大危险源数量"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-dialog :visible.sync="dialogVisible" style="z-index: 999999">
|
<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-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 type="primary" :loading="loading" @click="saveData">确 定</el-button>
|
</span>
|
</el-dialog>
|
</div>
|
</template>
|
<script>
|
import PageTitle from '@/components/PageTitle/index.vue'
|
import FileSaver from 'file-saver'
|
import XLSX from 'xlsx'
|
import {
|
searchCompanyList,
|
saveCompanyInfo,
|
updateCompanyInfo,
|
deleteById,
|
importCompanyData,
|
exportCompanyData,
|
getAreaInfo,
|
downLoadTemplate
|
} from '@/api/company'
|
|
export default {
|
components: {
|
PageTitle
|
},
|
data() {
|
return {
|
fileList: [],
|
companyImageList: [],
|
businessLicenseList: [],
|
securityCertificateList: [],
|
dialogVisible: false,
|
dialogImageUrl: '',
|
importFile: {},
|
importDisabled: false,
|
searchParams: {
|
companyName: '',
|
companyDirector: '',
|
certificateNum: '',
|
pageNum: 1,
|
pageSize: 5
|
},
|
areaInfo: [],
|
companyInfo: {
|
areaInfo: null
|
},
|
centerDialogVisible: false,
|
showExportDiv: false,
|
title: '',
|
alPosition: 'left',
|
dataList: [],
|
loading: false,
|
rules: {
|
companyCity: [
|
{required: true, message: '请输入企业所在城市', trigger: 'blur'}
|
],
|
companyName: [
|
{required: true, message: '请输入企业名称', trigger: 'blur'}
|
],
|
companyDirector: [
|
{required: true, message: '请输入企业负责人', trigger: 'blur'}
|
],
|
certificateNum: [
|
{required: true, message: '请输入证书编号', trigger: 'blur'}
|
],
|
validityDate: [
|
{
|
type: 'array',
|
required: true,
|
message: '请选择日期区间',
|
fields: {
|
//tpye类型试情况而定,所以如果返回的是date就改成date
|
0: {type: 'string', required: true, message: '请选择开始日期'},
|
1: {type: 'string', required: true, message: '请选择结束日期'}
|
}
|
}
|
],
|
majorHazardSources: [
|
{required: true, message: '请输入重大危险源数量', trigger: 'blur'}
|
]
|
}
|
}
|
|
},
|
mounted() {
|
this.getAreaInfo();
|
this.getData()
|
},
|
watch: {
|
centerDialogVisible(newValue, oldValue) {
|
if (!newValue) {
|
this.companyImageList = []
|
this.businessLicenseList = []
|
this.securityCertificateList = []
|
}
|
}
|
},
|
methods: {
|
|
getAreaInfo() {
|
getAreaInfo().then(res => {
|
this.areaInfo = res.data;
|
})
|
},
|
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
|
}
|
},
|
handlePictureCardPreview(file) {
|
this.dialogImageUrl = file.url
|
this.dialogVisible = true
|
},
|
getData() {
|
this.searchParams.pageNum = 1
|
this.dataList = []
|
this.loading = true;
|
searchCompanyList(this.searchParams).then(res => {
|
this.loading = false;
|
this.dataList = res.data.list
|
this.dataList.forEach(n => {
|
if (n.companyImage) {
|
n.companyImageUrl = process.env.VUE_APP_BASE_API + n.companyImage
|
}
|
})
|
})
|
},
|
load() {
|
this.searchParams.pageNum++
|
var _this = this
|
this.loading = true;
|
searchCompanyList(this.searchParams).then(res => {
|
this.loading = false;
|
if (res.code == 200) {
|
if (res.data.list.length > 0) {
|
for (let i = 0; i < res.data.list.length; i++) {
|
_this.dataList.push(res.data.list[i])
|
_this.dataList.forEach(n => {
|
if (n.companyImage) {
|
n.companyImageUrl = process.env.VUE_APP_BASE_API + n.companyImage
|
}
|
})
|
}
|
}
|
}else {
|
this.$message(res.msg || '查询失败!请重试', 'errot', 3 * 1000)
|
}
|
|
})
|
},
|
changeTime(e) {
|
if (this.companyInfo.validityDate == null) {
|
this.companyInfo.validityDate = new Array()
|
this.companyInfo.validityDate[0] = ''
|
this.companyInfo.validityDate[1] = ''
|
}
|
this.$forceUpdate()
|
},
|
addCompany() {
|
this.companyInfo = {}
|
this.title = '企业信息新增'
|
this.centerDialogVisible = true
|
},
|
editCompany(row) {
|
this.title = '企业信息修改'
|
this.companyInfo = row
|
this.companyImageList = []
|
this.businessLicenseList = []
|
this.securityCertificateList = []
|
if (row.companyImage) {
|
this.companyImageList.push({'url': process.env.VUE_APP_BASE_API + row.companyImage})
|
}
|
if (row.businessLicense) {
|
this.businessLicenseList.push({'url': process.env.VUE_APP_BASE_API + row.businessLicense})
|
}
|
if (row.securityCertificate) {
|
this.securityCertificateList.push({'url': process.env.VUE_APP_BASE_API + row.securityCertificate})
|
}
|
|
this.$set(this.companyInfo, 'validityDate', [row.validityDateStart != null ? row.validityDateStart : '', row.validityDateEnd != null ? row.validityDateEnd : ''])
|
this.centerDialogVisible = true
|
this.$forceUpdate()
|
},
|
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
|
},
|
saveData() {
|
this.loading = true
|
this.$refs['ruleForm'].validate((valid) => {
|
if (valid) {
|
this.companyInfo.validityDateStart = this.companyInfo.validityDate[0]
|
this.companyInfo.validityDateEnd = this.companyInfo.validityDate[1]
|
var formData = this.initFile()
|
if (this.companyInfo.id == null) {
|
saveCompanyInfo(formData).then(res => {
|
if (res.code == 200) {
|
this.loading = false
|
this.$message(res.msg, 'success', 3 * 1000)
|
this.centerDialogVisible = false
|
this.getData()
|
} else {
|
this.loading = false
|
this.$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) {
|
this.loading = false
|
this.$message(res.msg, 'success', 3 * 1000)
|
this.centerDialogVisible = false
|
this.getData()
|
} else {
|
this.loading = false
|
this.$message(res.msg, 'errot', 3 * 1000)
|
}
|
}).catch(function () {
|
this.$message('修改失败!请重试', 'error', 3 * 1000)
|
this.loading = false
|
})
|
}
|
} else {
|
this.loading = false
|
return false
|
}
|
})
|
},
|
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;
|
// console.log(this.companyInfo.companyImageFile)
|
// }
|
// 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
|
},
|
httpRequestCompanyImage(data) {
|
let _this = this
|
let rd = new FileReader() // 创建文件读取对象
|
let file = data.file
|
const isLt2M = file.size / 1024 / 1024 < 3
|
if (!isLt2M) {
|
// this.$refs.upload.clearFiles()
|
this.$message('上传图片大小不能超过 3MB!', 'warn', 3 * 1000)
|
this.companyImageList = [];
|
return;
|
}
|
_this.companyInfo.companyImageFile = file
|
rd.readAsDataURL(file) // 文件读取装换为base64类型
|
rd.onloadend = function (e) {
|
_this.imageUrl = this.result // this指向当前方法onloadend的作用域
|
}
|
},
|
httpRequestBusinessLicense(data) {
|
let _this = this
|
let rd = new FileReader() // 创建文件读取对象
|
let file = data.file
|
const isLt2M = file.size / 1024 / 1024 < 3
|
if (!isLt2M) {
|
// this.$refs.upload.clearFiles()
|
this.$message('上传图片大小不能超过 3MB!', 'warn', 3 * 1000)
|
this.businessLicenseList = [];
|
return;
|
}
|
_this.companyInfo.businessLicenseFile = file
|
rd.readAsDataURL(file) // 文件读取装换为base64类型
|
rd.onloadend = function (e) {
|
_this.imageUrl = this.result // this指向当前方法onloadend的作用域
|
}
|
},
|
httpRequestSecurityCertificate(data) {
|
let _this = this
|
let rd = new FileReader() // 创建文件读取对象
|
let file = data.file
|
const isLt2M = file.size / 1024 / 1024 < 3
|
if (!isLt2M) {
|
// this.$refs.upload.clearFiles()
|
this.$message('上传图片大小不能超过 3MB!', 'warn', 3 * 1000)
|
this.securityCertificateList = [];
|
return;
|
}
|
_this.companyInfo.securityCertificateFile = file
|
rd.readAsDataURL(file) // 文件读取装换为base64类型
|
rd.onloadend = function (e) {
|
_this.imageUrl = this.result // this指向当前方法onloadend的作用域
|
}
|
},
|
showDetails(item) {
|
this.$router.push({path: '/managementDetails', query: {'data': item}})
|
},
|
deleteCompany(item) {
|
this.$confirm('确定要删除数据吗?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
deleteById(item).then(res => {
|
this.$message(res.msg, 'success', 5 * 1000)
|
this.getData()
|
})
|
})
|
},
|
//文件校验方法
|
beforeAvatarUpload(file) {
|
// 通过split方法和fileArr方法获取到文件的后缀名
|
let fileArr = file.name.split('.')
|
let suffix = fileArr[fileArr.length - 1]
|
//只能导入.xls和.xlsx文件
|
if (!/(xls|xlsx)/i.test(suffix)) {
|
this.$message('文件格式不正确', 'warn', 3 * 1000)
|
return false
|
}
|
//不能导入大小超过2Mb的文件
|
if (file.size > 2 * 1024 * 1024) {
|
this.$message('文件过大,请上传小于2MB的文件〜', 'warn', 3 * 1000)
|
return false
|
}
|
return true
|
},
|
//文件发生改变就会触发的事件
|
uploadByJsqd(file) {
|
//判断是否符合beforeAvatarUpload方法中的条件
|
if (this.beforeAvatarUpload(file)) {
|
this.fileList.name = file.name
|
this.fileList.url = ''
|
var formdata = new FormData()
|
formdata.append('file', file.raw)
|
//importDevice:请求接口 formdata:传递参数
|
importCompanyData(formdata).then((res) => {
|
if (res.code == 200) {
|
this.$message(res.msg, 'success', 3 * 1000)
|
this.getData()//调用表格方法,刷新页面
|
} else {
|
this.$message(res.msg, 'error', 3 * 1000)
|
}
|
|
})
|
}
|
},
|
handleDownload() { //导出
|
exportCompanyData(this.searchParams).then(res => {
|
var blob = new Blob([res])
|
var downloadElement = document.createElement('a')
|
var href = window.URL.createObjectURL(blob) //创建下载的链接
|
downloadElement.href = href
|
downloadElement.download = '企业管理.xlsx' //下载后文件名
|
document.body.appendChild(downloadElement)
|
downloadElement.click() //点击下载
|
document.body.removeChild(downloadElement) //下载完成移除元素
|
window.URL.revokeObjectURL(href) //释放掉blob对象
|
}).catch(err => {
|
this.$message("导出失败!请联系管理员", 'error', 3 * 1000)
|
|
})
|
},
|
handleChangeArea(row) {
|
this.searchParams.companyCity = row[1];
|
},
|
handleChangeAddArea(row) {
|
this.companyInfo.companyCity = row[1];
|
},
|
downLoadTemplate() {
|
downLoadTemplate(this.searchParams).then(res => {
|
var blob = new Blob([res])
|
var downloadElement = document.createElement('a')
|
var href = window.URL.createObjectURL(blob) //创建下载的链接
|
downloadElement.href = href
|
downloadElement.download = '导入模板.xlsx' //下载后文件名
|
document.body.appendChild(downloadElement)
|
downloadElement.click() //点击下载
|
document.body.removeChild(downloadElement) //下载完成移除元素
|
window.URL.revokeObjectURL(href) //释放掉blob对象
|
}).catch(err => {
|
this.$message("模板下载失败!请联系管理员", 'error', 3 * 1000)
|
})
|
},
|
importHandle() {
|
const _this = this
|
const formData = new FormData()
|
const files = this.$refs['importLabInput'].files
|
if (files && files.length > 0) {
|
formData.append('file', files[0])
|
} else {
|
this.$message("请选择需要导入的文件", 'error', 3 * 1000)
|
return;
|
}
|
importCompanyData(formData).then((res) => {
|
this.$refs['importLabInput'].value = "";
|
if (res.code == 200) {
|
this.$message(res.msg, 'success', 3 * 1000)
|
this.getData()//调用表格方法,刷新页面
|
this.showExportDiv = false;
|
} else {
|
this.$message(res.msg, 'error', 3 * 1000)
|
}
|
|
})
|
}
|
}
|
}
|
</script>
|
<style scoped>
|
.hand {
|
background-color: #fff;
|
margin-bottom: 20px;
|
}
|
|
.box {
|
background-color: #fff;
|
}
|
|
.box-net {
|
padding: 20px;
|
}
|
|
.images {
|
width: 263px;
|
height: 170px;
|
padding: 10px;
|
}
|
|
.className {
|
font-size: 18px;
|
font-weight: bolder;
|
line-height: 30px;
|
|
}
|
|
.className:hover {
|
cursor: pointer
|
}
|
|
.title {
|
padding: 10px 0;
|
}
|
|
.information {
|
width: 100%;
|
margin: 0px;
|
word-wrap: break-word;
|
word-break: break-all;
|
display: -webkit-box;
|
-webkit-box-orient: vertical;
|
-webkit-line-clamp: 3;
|
overflow: hidden;
|
position: relative;
|
}
|
|
.types {
|
position: absolute;
|
top: 38px;
|
right: 4px;
|
background-color: #fff;
|
}
|
|
.types span {
|
color: dodgerblue;
|
}
|
|
.expireImages {
|
position: absolute;
|
width: 50px;
|
height: 50px;
|
left: 23%;
|
top: -5%
|
}
|
|
.infinite-list {
|
overflow: auto;
|
list-style-type: none;
|
height: 650px
|
}
|
|
::v-deep .el-dialog__header {
|
text-align: left;
|
padding: 20px 31px 10px;
|
}
|
|
::v-deep .el-dialog__title:before {
|
content: '';
|
position: absolute;
|
left: 20px;
|
top: 22px;
|
width: 4px;
|
height: 18px;
|
background-color: #108EE9;
|
}
|
|
::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;
|
}
|
|
::v-deep .el-date-editor.el-input, .el-date-editor.el-input__inner {
|
width: 100%;
|
}
|
|
::v-deep .el-textarea__inner {
|
height: 110px;
|
}
|
</style>
|