|
@@ -1,10 +1,15 @@
|
|
|
<!--新增危险源-->
|
|
|
<template>
|
|
|
- <div class="addLaboratory scrollbar-box" v-if="getType">
|
|
|
- <!--<p class="title-p color_one">添加危险源</p>-->
|
|
|
- <el-form :model="form" ref="form" :rules="rules" label-position="right" label-width="120px">
|
|
|
- <el-form-item label="危险源名称:" prop="chName" style="margin-bottom:40px;">
|
|
|
+ <div class="page-container addLaboratory">
|
|
|
+ <div class="page-top-title-box">
|
|
|
+ <p class="page-top-title-name-p">{{form.cabinetId?'编辑危险源':'新增危险源'}}</p>
|
|
|
+ <p class="page-top-title-out-p" @click="backPage">返回</p>
|
|
|
+ <p class="page-top-title-submit-p" @click="previewButton">提交</p>
|
|
|
+ </div>
|
|
|
+ <el-form :model="form" ref="form" :rules="rules" label-position="right" label-width="120px" style="margin-top: 46px">
|
|
|
+ <el-form-item label="名称:" prop="chName">
|
|
|
<el-input
|
|
|
+ style=width:600px;
|
|
|
v-model="form.chName"
|
|
|
maxlength="20"
|
|
|
placeholder="请输入危险源名称"
|
|
@@ -12,28 +17,39 @@
|
|
|
size="small"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="型号:" prop="code" style="margin-bottom:40px;">
|
|
|
+ <el-form-item label="编号:" prop="hazardCode">
|
|
|
<el-input
|
|
|
- v-model="form.code"
|
|
|
+ style=width:600px;
|
|
|
+ v-model="form.hazardCode"
|
|
|
maxlength="10"
|
|
|
- placeholder="请输入型号"
|
|
|
+ placeholder="请输入危险源编号"
|
|
|
clearable
|
|
|
size="small"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="危险源类型:" prop="hazardTypeMode">
|
|
|
- <el-select v-model="form.hazardTypeMode" placeholder="请选择">
|
|
|
- <el-option :label="item.dictLabel" :value="item.dictValue" v-for="(item,index) in materialTypeList" :key="index"></el-option>
|
|
|
+ <el-form-item label="大分类:" prop="bigTypeValue">
|
|
|
+ <el-select v-model="form.bigTypeValue" clearable placeholder="请选择大分类" @change="bigClassifyChange()" style="width: 600px">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in bigClassifyOptions"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="小分类:" prop="smallTypeValue">
|
|
|
+ <el-select v-model="form.smallTypeValue" clearable placeholder="请选择大分类" @change="smallClassifyChange()" style="width: 600px">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in smallClassifyOptions"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="详情:" prop="content">
|
|
|
<UEditor ref="UEditor" :content="form.content" :min-height="192" />
|
|
|
- <!--<ueditortwo :config=config ref="ueditor"></ueditortwo>-->
|
|
|
</el-form-item>
|
|
|
- <div class="button-box">
|
|
|
- <el-button class="color_99" @click="leftButtonClick">取消</el-button>
|
|
|
- <el-button class="color_ff back_one" @click="previewButton">提交</el-button>
|
|
|
- </div>
|
|
|
</el-form>
|
|
|
<el-dialog title="预览" class="richTextDialog" v-if="richTextDialogType" :close-on-click-modal="false" :visible.sync="richTextDialogType" append-to-body>
|
|
|
<div class="button-max-box">
|
|
@@ -45,7 +61,7 @@
|
|
|
:value="item.key">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
- <p class="add-button-one-90" style="margin-left:20px;" @click="rightButtonClick">提交</p>
|
|
|
+ <p class="page-inquire-common-style-button" style="margin-left:20px;" @click="rightButtonClick">提交</p>
|
|
|
</div>
|
|
|
<div class="text-max-box" :class="previewKey!=2?'move-text-max-box':''">
|
|
|
<p class="text-max-null-p"></p>
|
|
@@ -59,36 +75,44 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getHazard, addHazard, updateHazard,dangerList, gasCategoryList } from "@/api/hazardManagement/index";
|
|
|
+import {
|
|
|
+ laboratoryHazardAdd, laboratoryHazardUpdate
|
|
|
+} from '@/api/hazardManagement/index'
|
|
|
+import { getDicts } from '@/api/commonality/noPermission'
|
|
|
export default {
|
|
|
props:{
|
|
|
- hazardId: null,
|
|
|
+ propsData: null,
|
|
|
},
|
|
|
name: 'addLaboratory',
|
|
|
data() {
|
|
|
return {
|
|
|
- getType:false,
|
|
|
- form:{
|
|
|
- content:'',
|
|
|
- },
|
|
|
+ form:{},
|
|
|
+ //大分类
|
|
|
+ bigClassifyOptions:[],
|
|
|
+ //小分类
|
|
|
+ smallClassifyOptions:[],
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
chName: [
|
|
|
- { required: true, message: "请输入标题", trigger: "blur" },
|
|
|
- { required: true, message: "请输入标题", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
+ { required: true, message: "请输入危险源名称", trigger: "blur" },
|
|
|
+ { required: true, message: "请输入危险源名称", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
+ ],
|
|
|
+ hazardCode: [
|
|
|
+ { required: true, message: "请输入危险源编号", trigger: "blur" },
|
|
|
+ { required: true, message: "请输入危险源编号", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
+ ],
|
|
|
+ bigTypeValue: [
|
|
|
+ { required: true, message: "请选择大分类", trigger: "blur" },
|
|
|
+ { required: true, message: "请选择大分类", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
],
|
|
|
- code: [
|
|
|
- { required: true, message: "请输入编号", trigger: "blur" },
|
|
|
- { required: true, message: "请输入编号", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
+ smallTypeValue: [
|
|
|
+ { required: true, message: "请选择小分类", trigger: "blur" },
|
|
|
+ { required: true, message: "请选择小分类", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
],
|
|
|
content: [
|
|
|
{ required: true, message: "请编辑详情", trigger: "change" },
|
|
|
{ required: true, message: "请编辑详情", validator: this.spaceJudgmentHTML, trigger: "blur" }
|
|
|
],
|
|
|
- hazardTypeMode: [
|
|
|
- { required: true, message: "请选择危险源类型", trigger: "change" },
|
|
|
- { required: true, message: "请选择危险源类型", validator: this.spaceJudgmentHTML, trigger: "blur" }
|
|
|
- ],
|
|
|
|
|
|
|
|
|
},
|
|
@@ -105,24 +129,9 @@ export default {
|
|
|
serverUrl: '//'+this.judgmentNetworkReturnAddress()+'/base/exec',
|
|
|
UEDITOR_HOME_URL: '/public/ueditor-1.4.3.3/'
|
|
|
},
|
|
|
- materialTypeList:[],
|
|
|
richTextDialogType:false,
|
|
|
previewKey:0,
|
|
|
previewSetList:[
|
|
|
- // {
|
|
|
- // key:0,
|
|
|
- // name:"iphone 12 pro",
|
|
|
- // width:390,
|
|
|
- // height:884,
|
|
|
- // scale:0.203125,
|
|
|
- // },
|
|
|
- // {
|
|
|
- // key:1,
|
|
|
- // name:"iphone XR",
|
|
|
- // width:414,
|
|
|
- // height:896,
|
|
|
- // scale:0.215625,
|
|
|
- // },
|
|
|
{
|
|
|
key:0,
|
|
|
name:"iphone SE",
|
|
@@ -130,13 +139,6 @@ export default {
|
|
|
height:667,
|
|
|
scale:0.195312,
|
|
|
},
|
|
|
- // {
|
|
|
- // key:3,
|
|
|
- // name:"Samsung Galaxy A51/71",
|
|
|
- // width:412,
|
|
|
- // height:914,
|
|
|
- // scale:0.214583,
|
|
|
- // },
|
|
|
{
|
|
|
key:1,
|
|
|
name:"Samsung Galaxy S8+",
|
|
@@ -144,13 +146,6 @@ export default {
|
|
|
height:740,
|
|
|
scale:0.1875,
|
|
|
},
|
|
|
- // {
|
|
|
- // key:5,
|
|
|
- // name:"Samsung Galaxy S20",
|
|
|
- // width:412,
|
|
|
- // height:915,
|
|
|
- // scale:0.214583,
|
|
|
- // },
|
|
|
{
|
|
|
key:2,
|
|
|
name:"化学品终端",
|
|
@@ -163,18 +158,60 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.form.id = this.hazardId
|
|
|
- if(this.form.id){
|
|
|
- this.handleUpdate()
|
|
|
+ if(this.propsData){
|
|
|
+ this.getSmallDicts(this.propsData.bigTypeValue)
|
|
|
+ this.form = this.propsData
|
|
|
+ this.form.content = unescape(this.form.content);
|
|
|
+
|
|
|
}else{
|
|
|
- this.getType = true;
|
|
|
+ this.form={
|
|
|
+ chName: '',
|
|
|
+ hazardCode: '',
|
|
|
+ bigTypeValue: '',
|
|
|
+ smallTypeValue: '',
|
|
|
+ content: '',
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- this.getDicts("combustibility").then(response => {
|
|
|
- this.combustibilitys= response.data;
|
|
|
- })
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.getBigDicts();
|
|
|
},
|
|
|
methods: {
|
|
|
+ //大分类字典
|
|
|
+ getBigDicts(){
|
|
|
+ getDicts('classification_items').then(response => {
|
|
|
+ this.$set(this,'bigClassifyOptions',response.data);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //小分类字典
|
|
|
+ getSmallDicts(val){
|
|
|
+ getDicts(val).then(response => {
|
|
|
+ this.$set(this,'smallClassifyOptions',response.data);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //大分类选中
|
|
|
+ bigClassifyChange(){
|
|
|
+ let self=this;
|
|
|
+ for (let i=0;i<this.bigClassifyOptions.length;i++){
|
|
|
+ if (this.form.bigTypeValue==this.bigClassifyOptions[i].value){
|
|
|
+ this.$set(this.form,'bigTypeName',this.bigClassifyOptions[i].label);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.getSmallDicts(this.form.bigTypeValue)
|
|
|
+ },
|
|
|
+ //小分类选中
|
|
|
+ smallClassifyChange(){
|
|
|
+ let self=this;
|
|
|
+ for (let i=0;i<this.smallClassifyOptions.length;i++){
|
|
|
+ if (this.form.smallTypeValue==this.smallClassifyOptions[i].value){
|
|
|
+ this.$set(this.form,'smallTypeName',this.smallClassifyOptions[i].label);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 返回按钮
|
|
|
+ backPage(){
|
|
|
+ this.$parent.tableButton('out','');
|
|
|
+ },
|
|
|
//预览
|
|
|
previewButton(){
|
|
|
this.$set(this.form,'content',this.$refs.UEditor.text);
|
|
@@ -184,56 +221,29 @@ export default {
|
|
|
this.richTextDialogType = !this.richTextDialogType
|
|
|
}
|
|
|
});
|
|
|
- // if(this.$refs.UEditor.text){
|
|
|
- // this.$set(this,'text',this.$refs.UEditor.text);
|
|
|
- // this.richTextDialogType = !this.richTextDialogType
|
|
|
- // }else{
|
|
|
- // this.msgError('请编辑内容')
|
|
|
- // }
|
|
|
- },
|
|
|
- //获取危险源类型
|
|
|
- dangerList(){
|
|
|
- let _this=this;
|
|
|
- dangerList().then( response => {
|
|
|
- let res=response.rows;
|
|
|
- _this.materialTypeList=res;
|
|
|
- });
|
|
|
- },
|
|
|
- leftButtonClick(){
|
|
|
- this.$parent.offLaboratoryButton();
|
|
|
},
|
|
|
rightButtonClick(){
|
|
|
this.$set(this.form,'content',this.$refs.UEditor.text||"");
|
|
|
this.form.content = this.$refs.UEditor.text;
|
|
|
this.submitForm()
|
|
|
},
|
|
|
- /** 修改按钮操作 */
|
|
|
- handleUpdate() {
|
|
|
- getHazard(this.form.id).then(response => {
|
|
|
- this.form = response.data;
|
|
|
- this.form.hazardTypeMode=response.data.hazardTypeMode+''
|
|
|
- this.form.content = unescape(response.data.content);
|
|
|
- this.getType = true;
|
|
|
- });
|
|
|
- },
|
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
|
this.form.content = escape(this.form.content);
|
|
|
- // this.form.ignitionPoint = this.form.ignitionPoint + '℃';
|
|
|
- if (this.form.id != null) {
|
|
|
- updateHazard(this.form).then(response => {
|
|
|
+ if (this.form.hazardId) {
|
|
|
+ laboratoryHazardUpdate(this.form).then(response => {
|
|
|
if(response.code = 200){
|
|
|
this.msgSuccess("修改成功");
|
|
|
- this.$parent.clickPageTypeOne()
|
|
|
+ this.backPage()
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
- addHazard(this.form).then(response => {
|
|
|
+ laboratoryHazardAdd(this.form).then(response => {
|
|
|
if(response.code = 200){
|
|
|
this.msgSuccess("新增成功");
|
|
|
- this.$parent.clickPageTypeOne()
|
|
|
+ this.backPage()
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -241,38 +251,12 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
},
|
|
|
- mounted() {
|
|
|
- this.dangerList();
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.addLaboratory{
|
|
|
- padding:40px 20px;
|
|
|
- .button-box{
|
|
|
- margin:0 auto;
|
|
|
- width:220px;
|
|
|
- display: flex;
|
|
|
- p{
|
|
|
- cursor:pointer;
|
|
|
- width: 100px;
|
|
|
- height:40px;
|
|
|
- line-height:40px;
|
|
|
- font-size:14px;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
- p:nth-child(1){
|
|
|
- margin-right:20px;
|
|
|
- color:#999;
|
|
|
- background:#e0e0e0;
|
|
|
- border-radius:4px;
|
|
|
- }
|
|
|
- p:nth-child(2){
|
|
|
- color:#fff;
|
|
|
- border-radius:4px;
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
</style>
|
|
|
<style lang="scss">
|