public.js 1.44 KB
/*
 * @Description:
 * @Autor: renchao
 * @LastEditTime: 2024-01-23 10:23:02
 */
import { getForm } from "../flowform";
import { getHomeNoticeList } from "@/api/home.js"
export default {
  data () {
    return {
      noticeList: []
    }
  },
  created () {
    this.getHomeNotice()
  },
  mounted () {
    let _this = this
    window.addEventListener('message', function (messageEvent) {
      _this.getHomeNotice()
    }, false)
  },
  methods: {
    /**
     * @description: getHomeNotice
     * @author: renchao
     */
    getHomeNotice () {
      getHomeNoticeList().then(res => {
        if (res.result) {
          this.noticeList = res.result.noticeList
        }
      })
    },
    /**
     * @description: 右侧表单选项卡事件
     * @param {*} activeName
     * @param {*} oldActiveName
     * @author: renchao
     */
    beforeLeave (activeName, oldActiveName) {
      sessionStorage.setItem('activeName', activeName);
      this.getFromRouter(activeName)
    },
    /**
     * @description: 切换选项卡内容组件
     * @param {*} tabname
     * @author: renchao
     */
    getFromRouter (tabname) {
      //根据tabname获取选中的表单  此操作为了获取后端返回的表单对象,使用里面的是否可操作的属性
      for (let item of this.tabList) {
        if (item.value === tabname) {
          this.currentSelectTab = item;
          break;
        }
      }
      this.componentTag = getForm(tabname);
    }
  }
}