|
@@ -97,58 +97,20 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<add-safety-info-config :propsData="propsData" v-if="pageType==2"></add-safety-info-config>
|
|
|
- <!-- 添加或修改安全分级对话框 -->
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :before-close="closeDialog" :close-on-click-modal="false">
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="80px" >
|
|
|
- <el-form-item label="信息名称" prop="infoName">
|
|
|
- <el-input v-model="form.infoName" maxlength="100" placeholder="请输入名称" style="width:320px;"/>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="信息类目" prop="brandId" class="form-item">
|
|
|
- <el-select placeholder="请选择类目" v-model="form.brandId" style="width:320px;" @change="categoryClick()">
|
|
|
- <el-option
|
|
|
- v-for="dict in categoryList"
|
|
|
- :key="dict.brandId"
|
|
|
- :label="dict.brandName"
|
|
|
- :value="dict.brandId"
|
|
|
- ></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="信息类型">
|
|
|
- <el-input v-model="form.infoType==1?'文字':'图片'" 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" maxlength="200" placeholder="请输入内容" style="width:320px;"/>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="信息内容" prop="infoContent" v-if="form.infoType==2">
|
|
|
- <el-upload
|
|
|
- class="certificate-avatar-uploader"
|
|
|
- :action="uploadImgUrl"
|
|
|
- :show-file-list="false"
|
|
|
- :on-success="handleAvatarSuccess"
|
|
|
- :headers="headers"
|
|
|
- :before-upload="beforeAvatarUpload">
|
|
|
- <div style="display: flex;">
|
|
|
- <img v-if="form.infoContent" :src="form.infoContent" style="width: 80px;height: 80px;margin-right: 10px">
|
|
|
- <i v-if="!form.infoContent" class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
- </div>
|
|
|
- </el-upload>
|
|
|
- </el-form-item>
|
|
|
- <P v-if="form.infoType==2" style="margin-left: 80px">图片最大上传630*78,建议尺寸58*78</P>
|
|
|
- </el-form>
|
|
|
- <div slot="footer" class="dialog-footer dialog-footer-box">
|
|
|
- <p class="dialog-footer-button-null"></p>
|
|
|
- <p class="dialog-footer-button-info" @click="cancel">取消</p>
|
|
|
- <p class="dialog-footer-button-primary" @click="submitForm">提交</p>
|
|
|
- <p class="dialog-footer-button-null"></p>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import addSafetyInfoConfig from "./addSafetyInfoConfig";
|
|
|
import { getToken } from "@/utils/auth";
|
|
|
-import { laboratoryInfoBrandList , laboratoryBrandDetailAdd, laboratoryBrandDetailList, laboratoryBrandDetailUpdate, laboratoryBrandDetailDelete } from '@/api/integratedManagement/index'
|
|
|
+import {
|
|
|
+ laboratoryInfoBrandList,
|
|
|
+ laboratoryBrandDetailAdd,
|
|
|
+ laboratoryBrandDetailList,
|
|
|
+ laboratoryBrandDetailUpdate,
|
|
|
+ laboratoryBrandDetailDelete,
|
|
|
+ laboratoryBrandDetailDetail, laboratoryClassTypeUpdate
|
|
|
+} from '@/api/integratedManagement/index'
|
|
|
export default {
|
|
|
name: "Approval",
|
|
|
components: {
|
|
@@ -158,11 +120,6 @@ export default {
|
|
|
return {
|
|
|
tableButtonType:this.hasPermiDom(['lab:infoBrand:edit','lab:infoBrand:del',]),
|
|
|
uploadImgUrl: this.uploadUrl(), // 上传的图片服务器地址
|
|
|
- activeName: '',
|
|
|
- // 弹出层标题
|
|
|
- title: "",
|
|
|
- // 是否显示弹出层
|
|
|
- open: false,
|
|
|
//页面状态
|
|
|
pageType:1,
|
|
|
loading:false,
|
|
@@ -185,26 +142,9 @@ export default {
|
|
|
propsData:{},
|
|
|
// 表单参数
|
|
|
infoType:null,
|
|
|
- form: {
|
|
|
- brandId:'',
|
|
|
- infoName:'',
|
|
|
- infoType:'',
|
|
|
- infoContent:'',
|
|
|
- isCollective:'',
|
|
|
- },
|
|
|
+
|
|
|
currentIndex:0,
|
|
|
- // 表单校验
|
|
|
- rules: {
|
|
|
- infoName: [
|
|
|
- { required: true, message: "请输入名称", trigger: "blur" },
|
|
|
- ],
|
|
|
- brandId: [
|
|
|
- { required: true, message: "请选择类目", trigger: "blur" },
|
|
|
- ],
|
|
|
- infoContent: [
|
|
|
- { required: true, message: "请添加信息内容", trigger: "blur" },
|
|
|
- ],
|
|
|
- }
|
|
|
+
|
|
|
};
|
|
|
|
|
|
|
|
@@ -213,11 +153,6 @@ export default {
|
|
|
titleClick(type){
|
|
|
this.$parent.titleClick(type);
|
|
|
},
|
|
|
-
|
|
|
- closeDialog(){
|
|
|
- this.$refs['form'].clearValidate()
|
|
|
- this.open=false
|
|
|
- },
|
|
|
handleTabClick(item,index){
|
|
|
this.currentIndex = index
|
|
|
this.queryParams.brandId=item.brandId;
|
|
@@ -230,29 +165,29 @@ export default {
|
|
|
let obj={
|
|
|
brandId:this.queryParams.brandId,
|
|
|
infoType:this.infoType,
|
|
|
+ listHazardModel:[],
|
|
|
}
|
|
|
- /* this.title='新增安全信息';
|
|
|
- this.$set(this,'form',{
|
|
|
- brandId:this.queryParams.brandId,
|
|
|
- infoType:this.infoType,
|
|
|
- infoName:'',
|
|
|
- infoContent:'',
|
|
|
- });
|
|
|
- this.open = true; */
|
|
|
this.$set(this,'propsData',obj)
|
|
|
this.$set(this,'pageType',2)
|
|
|
}else if(doType=='edit'){//编辑
|
|
|
- this.title='编辑安全信息';
|
|
|
- this.$set(this,'form',{
|
|
|
- detailId:row.detailId,
|
|
|
- brandId:row.brandId,
|
|
|
- infoName:row.infoName,
|
|
|
- infoType:row.infoType,
|
|
|
- infoContent:row.infoContent,
|
|
|
- isCollective:row.isCollective,
|
|
|
- orderNum:row.orderNum,
|
|
|
+
|
|
|
+ laboratoryBrandDetailDetail({detailId:row.detailId}).then( response => {
|
|
|
+ if (response.code==200){
|
|
|
+ let obj={
|
|
|
+ detailId:response.data.detailId,
|
|
|
+ brandId:response.data.brandId,
|
|
|
+ infoName:response.data.infoName,
|
|
|
+ infoType:response.data.infoType,
|
|
|
+ infoContent:response.data.infoContent,
|
|
|
+ isCollective:response.data.isCollective,
|
|
|
+ orderNum:response.data.orderNum,
|
|
|
+ listHazardModel:response.data.listHazardModel,
|
|
|
+ }
|
|
|
+ this.$set(this,'propsData',obj)
|
|
|
+ this.$set(this,'pageType',2)
|
|
|
+ }
|
|
|
});
|
|
|
- this.open = true;
|
|
|
+
|
|
|
}else if(doType=='deploy'){//信息牌配置
|
|
|
//self.pageType=2;
|
|
|
}else if(doType=='delete'){//删除
|
|
@@ -337,55 +272,6 @@ export default {
|
|
|
this.$refs['form'].clearValidate()
|
|
|
this.open = false;
|
|
|
},
|
|
|
- /** 提交按钮 */
|
|
|
- submitForm() {
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- if (this.form.detailId) {
|
|
|
- laboratoryBrandDetailUpdate(this.form).then( response => {
|
|
|
- this.msgSuccess(response.message);
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- });
|
|
|
- } else {
|
|
|
- laboratoryBrandDetailAdd(this.form).then( response => {
|
|
|
- this.msgSuccess(response.message);
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- //上传
|
|
|
- handleAvatarSuccess(res, file) {
|
|
|
- this.form.infoContent = res.data.url;
|
|
|
- this.$forceUpdate()
|
|
|
- },
|
|
|
- beforeAvatarUpload(file) {
|
|
|
- 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 = _=>{
|
|
|
- if(image.width <= 630 && image.height <= 78){
|
|
|
- resolve()
|
|
|
- }else{
|
|
|
- this.msgError('尺寸限制为最大630*78px,支持PNG格式')
|
|
|
- reject();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }else{
|
|
|
- this.msgError('请上传PNG格式');
|
|
|
- reject();
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
//查询信息类目列表
|
|
|
getCategoryList(){
|
|
|
let obj={
|