Commit f5d652e4 authored by 杨帆's avatar 杨帆
Browse files

Merge branch 'develop' of http://git.censoft.com.cn/rongtong/rongtong-app into dev-yf'

parents cf637611 5d4ec285
Loading
Loading
Loading
Loading
+189 KiB
Loading image diff...
+105 −28
Original line number Diff line number Diff line
<template>
    <div class="wrap" ref="mapmidbox">
        <van-sticky>
        <van-sticky v-if="showHeader">
            <header class="header">
                <span @click="close" class="iconLeft"> 关闭</span>
                <span>{{text}}</span>
                <span  @click="confim" class="iconRight" v-show="!isView">确定</span>
                <span  class="iconRight" v-show="isView"></span>
                <span  @click="confim" class="iconRight" v-show="!isViews">确定</span>
                <span  class="iconRight" v-show="isViews"></span>
            </header>
        </van-sticky>
        <grid-layout :layout.sync="layout"
@@ -35,8 +35,8 @@
            </grid-item>
        </grid-layout>
        <div class="setBtns">
            <van-button @click="addItem" type="info" size="mini" v-if="!isView">添加房间</van-button>
            <van-grid direction="horizontal" :column-num="2" class="footer">
            <van-button @click="addItem" type="info" size="mini" v-if="!isViews">添加房间</van-button>
            <van-grid direction="horizontal" :column-num="2" class="footer" v-if="isViews">
                风险等级图例:
                <span class="riskTab type1"></span>重大风险
                <span class="riskTab type2"></span>较大风险
@@ -55,6 +55,9 @@
                placeholder="选择房间类型"
                @click="showPicker = true"
                />
                
            </van-cell-group>
        </van-dialog>
        <van-popup v-model="showPicker" round position="bottom">
            <van-picker
                show-toolbar
@@ -63,8 +66,6 @@
                @confirm="onConfirm"
            />
        </van-popup>
            </van-cell-group>
        </van-dialog>
    </div>
</template>

@@ -101,44 +102,99 @@ export default {
            roomName:'',
            columns: ['办公', '餐饮', '住宅', '超市'],
            colorList:['#FF4433','#FF9800','#FFFF00','#0091EA'],
            isView:true,// true:查看页面;  false: 添加页面
            isViews:false,// true:查看页面;  false: 添加页面
            showHeader:true
        }
    },
    props:{
        isView: {
            type: Boolean,
            default: false,
        },
    },
    mounted() {
        // screenfull.toggle(this.$refs.mapbox);
        // this.$nextTick(() => {
            // this.rotateBox();
        // });
        this.isView = this.$route.params.isView? true : false
        if (this._props.isView) {
            console.log('作为组件传值==>>',)
            this.isViews = true
            this.showHeader = false
        }
        if (this.$route.params.isView) {
            this.isViews =  true
            this.initRotate();
           window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", this.orientationChange, false);   
        }
        this.getRoomInfo()
    },
    methods: {
        orientationChange(){
            if (window.orientation === 180 || window.orientation === 0) {   
               console.log('竖屏状态!');  
            }   
            if (window.orientation === 90 || window.orientation === -90 ){   
                console.log('横屏状态!');  
            }    
            // let width = document.documentElement.clientWidth//页面宽度
            //    let  height = document.documentElement.clientHeight//页面高度
            //     console.log('width==>>',width)
            //     console.log('height==>>',height)
                  this.rotateBox()
        },
        initRotate(){
            let width = document.documentElement.clientWidth,//页面宽度
                height = document.documentElement.clientHeight,//页面高度
                wrapper = this.$refs.mapmidbox,//需要横屏的块,与全屏的块要区分开,不区分全屏的块无法显示横屏效果
                style = "";//样式
                console.log('width==>>',width)
                console.log('height==>>',height)
                 style += "width:" + height + "px;";
                style += "height:" + width + "px;";
                style += "-webkit-transform: rotate(90deg); transform: rotate(90deg);";
                // 注意旋转中点的处理
                style +=
                "-webkit-transform-origin: " + width / 2 + "px " + width / 2 + "px;";
                style += "transform-origin: " + width / 2 + "px " + width / 2 + "px;";
                wrapper.style.cssText = style;
        },
        rotateBox() {
            this.isScreenFull = !this.isScreenFull;//是否全屏状态
            let width = document.documentElement.clientWidth,//页面宽度
                height = document.documentElement.clientHeight,//页面高度
                wrapper = this.$refs.mapmidbox,//需要横屏的块,与全屏的块要区分开,不区分全屏的块无法显示横屏效果
                style = "";//样式
            if (height < width) {//注意原来就是宽屏时不用横屏
                return;
            }
            if (this.isScreenFull) {
                console.log('width==>>',width)
                console.log('height==>>',height)
            // if (height < width) {//注意原来就是宽屏时不用横屏
            //     return;
            // }
            if (height < width) {
                // 横屏
                style += "width:" + height + "px;";
                style += "height:" + width + "px;";
                style += "-webkit-transform: rotate(90deg); transform: rotate(90deg);";
                style += "-webkit-transform: rotate(0deg); transform: rotate(0deg);";
                // 注意旋转中点的处理
                style +=
                "-webkit-transform-origin: " + width / 2 + "px " + width / 2 + "px;";
                style += "transform-origin: " + width / 2 + "px " + width / 2 + "px;";
            } else {
                // 竖屏
                // style += "width:" + height + "px;";
                // style += "height:" + width + "px;";
                // style += "-webkit-transform: rotate(90deg); transform: rotate(90deg);";
                // // 注意旋转中点的处理
                // style +=
                // "-webkit-transform-origin: " + width / 2 + "px " + width / 2 + "px;";
                // style += "transform-origin: " + width / 2 + "px " + width / 2 + "px;";
                style += "width:100%";
                style += "height:100%;";
                style += "-webkit-transform: rotate(0); transform: rotate(0);";
                style += "-webkit-transform-origin: 0 0;";
                style += "transform-origin: 0 0;";
            }
            console.log('style==>>',style)
            wrapper.style.cssText = style;
            },
        getRoomInfo(){
@@ -153,14 +209,14 @@ export default {
                   item.position.i = item.id
                   item.position.isDraggable = false
                   item.position.isResizable = false
                   if (!this.isView) { //添加页面不显示颜色
                   if (!this.isViews) { //添加页面不显示颜色
                        item.position.c = '#eee'
                    }else{
                        item.position.c = this.colorList[Math.floor(Math.random()*4)]
                    }
                   this.layout.push(item.position)
                })
                console.log('layout==>>',this.layout)
                // console.log('layout==>>',this.layout)
              }
            }).catch((err) => {
               console.log('err==>>',err)
@@ -182,8 +238,11 @@ export default {
        },
        // 删除
        removeItem: function (val) {
            // const index = this.layout.map(item => item.i).indexOf(val);
            // this.layout.splice(index, 1);
            if (val == '') {
                const index = this.layout.map(item => item.i).indexOf(val);
                this.layout.splice(index, 1);
                return
            }
            postFun('/ledger/room/delete/'+val).then((res) => {
              if (res.code == 200) {
                Toast.success('删除成功');
@@ -211,6 +270,14 @@ export default {
        },
        // 确定  保存房间信息
        confim(){
            if (this.roomName == '') {
                 Toast.fail({
                    title: '提示',
                    forbidClick: true,
                    message: '请先添加房间!',
                })
                return
            }
            let data = {
                floorId: this.$route.params.floorId ? this.$route.params.floorId : '18',
                name:this.roomName,
@@ -221,6 +288,8 @@ export default {
                if (res.code == 200) {
                    Toast.success('提交成功');
                    this.getRoomInfo()
                    this.roomType = ''
                    this.roomName = ''
                }
            }).catch((err) => {
               console.log('err==>>',err)
@@ -235,13 +304,13 @@ export default {
                h: 3,
                i: '',
                name: this.roomName,
                c: '#eee',
                c: '#0091EA',
                type:this.roomType,
                isDraggable:true,
                isResizable:true
            }
            this.layout.push(this.layOutItem)
            console.log('layOutItem==>>',this.layOutItem)
            // console.log('layOutItem==>>',this.layOutItem)
        },
        onConfirm(value) {
            this.roomType = value;
@@ -252,11 +321,15 @@ export default {
</script>

<style scoped >
.router-view{
    padding-bottom: 0px !important;
}
.wrap{
    height: 100vh;
    width: 100vw;
    /* transform: rotate(90deg);
   transform-origin: bottom left; */
   position: relative;
}
.footer{
    /* position: fixed; */
@@ -298,9 +371,12 @@ export default {

/*************************************/
.setBtns{
    position: fixed;
    /* position: fixed;
    top:auto;
    right: auto;
    left: 0;
    bottom: 0;
    bottom: 0; */
    margin-top: 10px;
    font-size: 0.3rem;
    padding: 10px;
    vertical-align: middle;
@@ -342,6 +418,7 @@ export default {

.vue-grid-item .text {
    writing-mode:vertical-rl;
    -webkit-writing-mode: vertical-rl;
    font-size: 10cqw;
    display: flex;
    align-items: center;
+4 −4
Original line number Diff line number Diff line
@@ -270,7 +270,7 @@ import { getFun, postFun } from "@/service/table.js";
//     postRiskShowMeasures,
// } from "@/service/risk";
export default {
    name: "risk-add",
    name: "addCurrent",
    components: {
        LHeader,
    },
@@ -345,9 +345,9 @@ export default {
        };
    },
    created() {
        if (this.$route.params.inherentId) {
            this.inherentId = this.$route.params.inherentId
            this.buildingIds = this.$route.params.buildingId
        if (this.$route.params.inherentId || sessionStorage.getItem("inherentId")) {
            this.inherentId = this.$route.params.inherentId || sessionStorage.getItem("inherentId")
            this.buildingIds = this.$route.params.buildingId || sessionStorage.getItem("buildingId")
            this.postReturnEcho();
        }
        // this.getList();
+962 −689

File changed.

Preview size limit exceeded, changes collapsed.

+23 −57
Original line number Diff line number Diff line
@@ -297,7 +297,8 @@
                    </van-uploader>
                </template>
            </van-field>
            <div  v-if="this.$route.params.isView" style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" >
            <!-- v-if="this.$route.params.isView" -->
            <div   style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" >
            <img src="@/assets/accidentIcon/bookmark.svg" alt="" style="position: relative;top: 32%;transform: translateY(-50%);" >
            参考依据
            </div>
@@ -331,8 +332,8 @@
                    @cancel="showSource = false"
                />
            </van-popup>

            <div style="margin: 16px 16px 0" v-if="this.$route.params.isView" >
            <!-- v-if="this.$route.params.isView" -->
            <div style="margin: 16px 16px 0"  >
                <van-button round block type="info" native-type="submit"
                    >上报</van-button
                >
@@ -367,7 +368,8 @@
                    </van-row>
                </div>
            </van-dialog>
        <div v-if="this.$route.params.isView" style="margin: 10px 16px 0px; padding-bottom: 16px">
            <!-- v-if="this.$route.params.isView"  -->
            <div  style="margin: 10px 16px 0px; padding-bottom: 16px">
            <van-button round block type="warning" @click.native="cancel"
                >取消</van-button
            >
@@ -390,35 +392,23 @@ import { getFun, postFun } from "@/service/table.js";
//     postRiskShowMeasures,
// } from "@/service/risk";
export default {
    name: "risk-add",
    name: "addPresent",
    components: {
        LHeader,
    },
    activated() {
        this.showSetRank = false; // 再次关闭弹出层 以防万一
        if (this.$route.params.taskId) {
            this.isShowreturnCause = true;
            this.text = "风险上报退回";
            this.taskId = this.$route.params.taskId;
            this.postReturnEcho();
        }
        this.getList();
      
        this.$bus.$on("riskLevelBus", (res) => {
            this.showSetRank = false; // 再次关闭弹出层 以防万一
            console.log(Boolean(res));
            if (res) {
                this.riskRank = res;
            } else {
                this.setRank = "";
    },
    beforeRouteEnter(to, from, next){
    if(from.name=='addCurrent'){
        sessionStorage.setItem('presentForm','')
        sessionStorage.setItem('level','')
    }
            // 销毁一下监听事件 不然会越加越多
            this.$bus.$off("riskLevelBus");
        });
    next()
    },
    beforeRouteLeave(to, from, next) {
        if (to.name != "matrix-grad") {
    
        if (to.name != "riskInherent") {
            sessionStorage.setItem('presentForm',JSON.stringify(this.form))
        }
        next();
    },
@@ -445,15 +435,6 @@ export default {
            columnsProjectName: [],
            factor: "", //风险因素
            showFactor: false,
            columnsFactor: [],
            messageList: [
                {
                    title:'回显风险源名称',
                    time:'2022-12-12',
                    name:'Mr.周',
                    state:1
                }
            ],
            source: "", //风险源
            userPrefix: "", //风险源
            showSource: false,
@@ -515,6 +496,12 @@ export default {
        this.form.projectId='测试项目'
        
    },
    mounted(){
    if(sessionStorage.getItem('presentForm')!=''){
            this.form=JSON.parse(sessionStorage.getItem('presentForm')) 
            this.form.level = sessionStorage.getItem('level')
        }
    },
    methods: {
        seletFloor(name){
            this.$toast.loading({
@@ -709,27 +696,6 @@ export default {
            this.$toast.clear();
        },

        // 请求表单数据
        getList() {
            this.$toast.loading({
                message: "加载中...",
                forbidClick: true,
                loadingType: "spinner",
                duration: 0,
            });
            getFormList("/riskMain/add")
                .then((res) => {
                    this.$toast.clear();
                    this.columnsProjectName = res.data.projectInformations;
                    this.columnsFactor = res.data.riskInventories;
                    this.columnsMainDutyDept = res.data.organizationList;
                })
                .catch(() => {
                    this.$toast.clear();
                    this.$toast.fail("加载失败,请稍后再试");
                });
        },

        // 请求已退回详情数据
        postReturnEcho() {
            this.$toast.loading({
Loading