Commit 0e99bda0 authored by 胡占生's avatar 胡占生 🇨🇳
Browse files

fix: 固有风险、新建完房间和评估完等级 清空表单问题

parent 4ef48267
Loading
Loading
Loading
Loading
+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({
+2 −2
Original line number Diff line number Diff line
@@ -33,9 +33,9 @@
                    <van-col span="15">{{ item.roomName }}</van-col>
                  </van-row>
                </van-col>
                <van-col span="7" :style="{ color: item.state == 1 ? '#0069e5' : '#03b615' }">
                <!-- <van-col span="7" :style="{ color: item.state == 1 ? '#0069e5' : '#03b615' }">
                  {{ "●待审批" }}
                </van-col>
                </van-col> -->
              </van-row>
              <van-overlay :show="showIndex == index">
                <div class="wrapper" @click.stop="showIndex = null">
+3 −6
Original line number Diff line number Diff line
@@ -47,15 +47,12 @@ import LHeader from "@/components/header.vue";
                })
            },
            resetClose(){
                this.$router.push({
                    name:'addInherent',
                    params:{
                        level:''
                    }
                })
                sessionStorage.setItem('level','')
                history.go(-1)
            },
            sureClose(){
                // this.$emit('',)
                sessionStorage.setItem('level',this.level)
                history.go(-1)
                // this.$router.push({
                //     name:'addInherent',
+1 −0
Original line number Diff line number Diff line
@@ -113,6 +113,7 @@
            />

            <van-field
              readonly
              clickable
              name="workUserNames"
              :value="form.workUserNames"
Loading