<template>
|
<div class="safety_body">
|
<div class="safety_title">
|
许可证信息
|
</div>
|
<div class="safety_left">
|
<el-row>
|
<el-col :span="5" class="safety_left_left">
|
标准化级别:
|
</el-col>
|
<el-col :span="19" class="safety_left_right">
|
<el-input v-model="form.level"></el-input>
|
</el-col>
|
</el-row>
|
</div>
|
<div class="safety_left">
|
<el-row>
|
<el-col :span="5" class="safety_left_left">
|
证书编号:
|
</el-col>
|
<el-col :span="19" class="safety_left_right">
|
<el-input v-model="form.licensenumber"></el-input>
|
</el-col>
|
</el-row>
|
</div>
|
<div class="safety_left">
|
<el-row>
|
<el-col :span="5" class="safety_left_left">
|
评审单位:
|
</el-col>
|
<el-col :span="19" class="safety_left_right">
|
<el-input v-model="form.reviewunit"></el-input>
|
</el-col>
|
</el-row>
|
</div>
|
<div class="safety_left">
|
<el-row>
|
<el-col :span="5" class="safety_left_left">
|
发牌单位:
|
</el-col>
|
<el-col :span="19" class="safety_left_right">
|
<el-input v-model="form.licensingunit"></el-input>
|
</el-col>
|
</el-row>
|
</div>
|
<div class="safety_left">
|
<el-row>
|
<el-col :span="5" class="safety_left_left">
|
考核得分:
|
</el-col>
|
<el-col :span="19" class="safety_left_right">
|
<el-input type="number" v-model="form.score"></el-input>
|
</el-col>
|
</el-row>
|
</div>
|
<div class="safety_left">
|
<el-row>
|
<el-col :span="5" class="safety_left_left">
|
有效期:
|
</el-col>
|
<el-col :span="19" class="safety_left_right">
|
<el-date-picker
|
value-format="yyyy-MM-dd"
|
v-model="validtime"
|
type="daterange"
|
range-separator="至"
|
start-placeholder="开始日期"
|
end-placeholder="结束日期"
|
@change="giveData"
|
>
|
</el-date-picker>
|
</el-col>
|
</el-row>
|
</div>
|
<div class="safety_footer">
|
<el-row>
|
<el-col :span="5" class="safety_left_left">
|
安全生产图片:
|
</el-col>
|
<el-col :span="19" class="safety_left_right">
|
<el-row>
|
<el-col :span="6">
|
<input id="upload" ref="upload" type="file" accept="image/*" multiple/>
|
</el-col>
|
<el-col :span="18">
|
<img v-for="(item,index) in form.enterpriseResources" :src="item.url" :key="index" style="width:100px;height:100px;margin-left:10px;cursor:pointer" @click="showPic(item)"></img>
|
</el-col>
|
</el-row>
|
</el-col>
|
</el-row>
|
</div>
|
<div class="enterpriseBasicInformation_footer">
|
<el-button @click="dialogVisible = false">取消</el-button>
|
<el-button type="primary" @click="submitStandard()">确认</el-button>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { getToken } from '@/utils/auth'
|
import {uploadUrl} from '@/assets/upload/url'
|
import { getPicListData , deletePicData , getBasic} from '@/api/enterprise'
|
import {parseError} from "../../../utils/messageDialog";
|
import { getSafetyProductionStandardData ,addSafetyProductionStandard ,updateSafetyProductionStandard} from "../../../api/safetyProductionStandard";
|
|
export default {
|
name: "safetyProductionStandard",
|
props:["enterpriseId"],
|
data(){
|
return{
|
uploadUrl,
|
header:{
|
'Authorization': getToken()
|
},
|
validtime:['',''],
|
pageSize: 10,
|
recordTotal: 0,
|
currentPage: 1,
|
pageTotal: 0,
|
dialogImageUrl: '',
|
dialogVisible: false,
|
disabled: false,
|
fileList:[],
|
form:{
|
id: 1,
|
level: '',
|
licensenumber:'',
|
reviewunit:'',
|
licensingunit:'',
|
score:'',
|
validstarttime:'',
|
validendtime:'',
|
files: [
|
],
|
},
|
}
|
},
|
created(){
|
this.getSafetyProductionStandard()
|
},
|
methods: {
|
async getSafetyProductionStandard(){
|
const params = {}
|
params['pageIndex'] = this.currentPage
|
params['pageSize'] = this.pageSize
|
let res = await getSafetyProductionStandardData(params,this.enterpriseId)
|
if (res.data.code === '200'){
|
if(res.data.result === null){
|
this.form = {
|
id: '',
|
level: '',
|
licensenumber:'',
|
reviewunit:'',
|
licensingunit:'',
|
score:'',
|
validstarttime:'',
|
validendtime:'',
|
file: [],
|
}
|
this.validtime = [this.form.validstarttime,this.form.validendtime]
|
}else{
|
this.form = res.data.result
|
this.form = Object.assign(this.form,{imgids:[]})
|
this.validtime = [res.data.result.validstarttime,res.data.result.validendtime]
|
if(this.form.enterpriseResources != null) {
|
for (let j = 0; j < this.form.enterpriseResources.length; j++) {
|
this.form.enterpriseResources[j].url = uploadUrl() + this.form.enterpriseResources[j].url
|
this.form.imgids.push(this.form.enterpriseResources[j].id)
|
}
|
}
|
}
|
}else {
|
this.$message({
|
type:'warning',
|
message:res.data.message
|
})
|
}
|
},
|
|
showPic(val){
|
window.open(val.url, '_blank')
|
},
|
|
async submitStandard(){
|
const formData = new FormData();
|
if(this.$refs["upload"].files.length === 0){
|
this.form.imgids = []
|
}
|
for (const i in this.form) {
|
if (
|
this.form[i] != undefined &&
|
this.form[i].toString() != ""
|
) {
|
formData.append(i, this.form[i]);
|
}
|
}
|
formData.append("enterpriseid",this.enterpriseId)
|
|
const files1 = this.$refs["upload"].files;
|
if (files1 && files1.length > 0) {
|
for (let i = 0; i < files1.length; i++)
|
formData.append("file", files1[i]);
|
}
|
|
if(this.form.id == ''){
|
let res = await addSafetyProductionStandard(formData)
|
if(res.data.code === "200"){
|
this.$refs["upload"].value = ''
|
this.$emit('getinfo')
|
this.$notify({
|
type:'success',
|
duration:2000,
|
message:'成功',
|
title:'成功',
|
})
|
}else {
|
this.$message({
|
type:'warning',
|
message:res.data.message
|
})
|
}
|
}else{
|
let res = await updateSafetyProductionStandard(formData)
|
if(res.data.code === "200"){
|
this.$refs["upload"].value = ''
|
this.$emit('getinfo')
|
this.$notify({
|
type:'success',
|
duration:2000,
|
message:'成功',
|
title:'成功',
|
})
|
}else {
|
this.$message({
|
type:'warning',
|
message:res.data.message
|
})
|
}
|
}
|
|
|
},
|
|
// async getBasic(){
|
// const params = {}
|
// params['pageIndex'] = this.currentPage
|
// params['pageSize'] = this.pageSize
|
// let res = await getPicListData(params,{id:this.enterpriseId})
|
// if (res.data.code === '200'){
|
// if(res.data.result === null){
|
// this.form = {
|
// id: '',
|
// level: '',
|
// licensenumber:'',
|
// reviewunit:'',
|
// licensingunit:'',
|
// score:'',
|
// file: [],
|
// }
|
// }else{
|
// this.form = res.data.result
|
// }
|
// }else {
|
// this.$message({
|
// type:'warning',
|
// message:res.data.message
|
// })
|
// }
|
// },
|
// async getPicList(){
|
// this.fileList = []
|
// const params = {}
|
// params['pageIndex'] = this.currentPage
|
// params['pageSize'] = this.pageSize
|
// let res = await getPicListData(params,{id:this.enterpriseId})
|
// if (res.data.code == 200){
|
// if (res.data != null){
|
// for (let i=0;i<res.data.result.records.length;i++){
|
// this.fileList.push({id:res.data.result.records[i].enterpriseResources[0].id, url: "http://192.168.0.7:8100/upload/enterprise/" + res.data.result.records[i].enterpriseResources[0].url})
|
// }
|
// }else {
|
// parseError({ error: res.message, vm: _this })
|
// }
|
// }
|
// }, // 获取已上传的附件列表
|
// async onPreview(file) {
|
// window.open(file.url, '_blank')
|
// },// 点击附件
|
// beforeUpload() {
|
// if (this.uploadData.fileType == '') {
|
// this.$message({
|
// type: 'info',
|
// message: '请选择要上传的附件类型'
|
// })
|
// return false
|
// }
|
// },
|
// onSuccess(response, file, fileList) {
|
// if (response.code == 200) {
|
// this.$notify({
|
// title: '成功',
|
// message: '上传成功',
|
// type: 'success',
|
// duration: 2000
|
// })
|
// }
|
// },
|
// beforeRemove(file, fileList) {
|
// return this.$confirm(`确定移除 ${file.name}?`);
|
// },
|
// async onRemove(file, fileList) {
|
// if (file.status == "success"){
|
// let res = await deletePicData(file.id)
|
// if (res.data.code == 200){
|
// this.$notify({
|
// title: '成功',
|
// message: '删除成功',
|
// type: 'success',
|
// duration: 2000
|
// })
|
// this.getPicListData()
|
// } else {
|
// this.$message({
|
// message: res.msg,
|
// type: 'warning'
|
// });
|
// }
|
// }
|
// },
|
// uploadFiles(file,fileList){
|
// this.$refs.upload.submit()
|
// },
|
// submitStandard(){
|
// let file = this.$refs.upload.files
|
// },
|
giveData(){
|
this.form.validstarttime = this.validtime[0]
|
this.form.validendtime = this.validtime[1]
|
}
|
},
|
}
|
</script>
|
|
<style scoped>
|
.safety_title{
|
font-family: 'Microsoft YaHei',Verdana, Arial, "宋体";
|
border: 1px solid #d4d4d4;
|
background: #d4d4d4;
|
border-top: none;
|
line-height: 32px;
|
padding-left: 5px;
|
text-align: center;
|
}
|
.safety_left{
|
clear:both;
|
font-family: 'Microsoft YaHei',Verdana, Arial, "宋体";
|
border: 1px solid #d4d4d4;
|
border-top: none;
|
line-height: 32px;
|
}
|
.safety_left_left{
|
border-right: 1px solid #d4d4d4;
|
text-align: right;
|
float:left;
|
background: #F5F7F7;
|
}
|
.safety_left_right{
|
}
|
.safety_footer{
|
clear:both;
|
font-family: 'Microsoft YaHei',Verdana, Arial, "宋体";
|
border: 1px solid #d4d4d4;
|
border-top: none;
|
line-height: 250px;
|
}
|
/deep/ .el-upload {
|
display: inline-block;
|
text-align: center;
|
cursor: pointer;
|
outline: 0;
|
margin-top: 30px;
|
}
|
/deep/.el-upload-list--picture-card .el-upload-list__item {
|
overflow: hidden;
|
background-color: #fff;
|
border: 1px solid #c0ccda;
|
border-radius: 6px;
|
-webkit-box-sizing: border-box;
|
box-sizing: border-box;
|
width: 148px;
|
height: 148px;
|
margin: 30px 8px 8px 0;
|
display: inline-block;
|
}
|
/deep/ .upload-demo{
|
line-height:120px;
|
}
|
.enterpriseBasicInformation_footer{
|
padding-top:10px;
|
text-align: right;
|
}
|
/deep/.el-input--medium .el-input__inner {
|
height: 32px;
|
}
|
</style>
|