|
@@ -62,8 +62,8 @@
|
|
|
</div>
|
|
|
<safety-Info-Config v-if="pageType == 2"></safety-Info-Config>
|
|
|
<!-- 添加或修改安全分级对话框 -->
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :before-close="closeDialog">
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="80px" >
|
|
|
<el-form-item label="信息名称" prop="infoName">
|
|
|
<el-input v-model="form.infoName" maxlength="10" placeholder="请输入名称" style="width:320px;"/>
|
|
|
</el-form-item>
|
|
@@ -81,7 +81,7 @@
|
|
|
<el-input v-model="form.infoTypeName" placeholder="" disabled style="width:320px;"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="信息内容" prop="infoContent" v-if="form.infoType==1">
|
|
|
- <el-input type="textarea" v-model="form.infoContent" placeholder="请输入内容" style="width:320px;"/>
|
|
|
+ <el-input type="textarea" v-model="form.infoContent" maxlength="200" placeholder="请输入内容" style="width:320px;"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="信息内容" prop="infoContent" v-if="form.infoType==2">
|
|
|
<el-upload
|
|
@@ -97,6 +97,7 @@
|
|
|
</div>
|
|
|
</el-upload>
|
|
|
</el-form-item>
|
|
|
+ <P v-if="form.infoType==2" style="margin-left: 80px">图片最大上传78*630,建议尺寸78*58</P>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
@@ -172,6 +173,10 @@ export default {
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
+ closeDialog(){
|
|
|
+ this.$refs['form'].clearValidate()
|
|
|
+ this.open=false
|
|
|
+ },
|
|
|
handleTabClick(tab){
|
|
|
this.queryParams.infoClassifyId=tab.name;
|
|
|
this.getList()
|
|
@@ -179,6 +184,7 @@ export default {
|
|
|
handleClick(index,row,doType){
|
|
|
let self=this;
|
|
|
if(doType=='add'){//添加
|
|
|
+ this.title='新增安全信息';
|
|
|
delete this.form.id
|
|
|
this.form.infoName='';
|
|
|
this.form.infoClassifyId='';
|
|
@@ -187,6 +193,7 @@ export default {
|
|
|
this.form.infoContent='';
|
|
|
this.open = true;
|
|
|
}else if(doType=='edit'){//编辑
|
|
|
+ this.title='编辑安全信息';
|
|
|
this.form.id=row.id
|
|
|
this.form.infoName=row.infoName
|
|
|
this.form.infoClassifyId=row.infoClassifyId
|
|
@@ -274,14 +281,30 @@ export default {
|
|
|
this.$forceUpdate()
|
|
|
},
|
|
|
beforeAvatarUpload(file) {
|
|
|
- let type = false;
|
|
|
- if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif') {
|
|
|
- type = true;
|
|
|
- }else{
|
|
|
- this.$message.error('只能上传png/jpeg/gif格式图片');
|
|
|
- type = false;
|
|
|
- }
|
|
|
- return type;
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ if (file.type == 'image/png') {
|
|
|
+ let reader = new FileReader()
|
|
|
+ reader.readAsDataURL(file) // 必须用file.raw
|
|
|
+ reader.onload = e => { // 让页面中的img标签的src指向读取的路径
|
|
|
+ let img = e.target.result;
|
|
|
+ const image = new Image()
|
|
|
+ image.src=img
|
|
|
+ image.onload = _=>{
|
|
|
+ console.log(image.width)
|
|
|
+ console.log(image.height)
|
|
|
+ if(image.width <= 78 && image.height <= 630){
|
|
|
+ resolve()
|
|
|
+ }else{
|
|
|
+ this.$message.error('尺寸限制为最大78*630px,支持PNG格式')
|
|
|
+ reject();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.$message.error('请上传PNG格式');
|
|
|
+ reject();
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
//获取危险源列表
|
|
|
getCategory(){
|