Blame view

src/views/workflow/mixin/public.js 1.47 KB
1
/*
xiaomiao committed
2
 * @Description:
3
 * @Autor: renchao
4
 * @LastEditTime: 2023-09-21 14:16:39
5
 */
任超 committed
6
import { getForm } from "../flowform";
7
import { getHomeNoticeList } from "@/api/home.js"
任超 committed
8
export default {
任超 committed
9 10
  data () {
    return {
11
      noticeList: []
任超 committed
12 13 14
    }
  },
  created () {
任超 committed
15 16 17
    this.getHomeNotice()
  },
  mounted () {
18
    let _this = this
任超 committed
19
    window.addEventListener('message', function (messageEvent) {
20
      _this.getHomeNotice()
任超 committed
21
    }, false)
任超 committed
22
  },
任超 committed
23
  methods: {
yuanbo committed
24 25 26 27
    /**
     * @description: getHomeNotice
     * @author: renchao
     */
任超 committed
28 29 30 31 32 33 34
    getHomeNotice () {
      getHomeNoticeList().then(res => {
        if (res.result) {
          this.noticeList = res.result.noticeList
        }
      })
    },
yuanbo committed
35 36 37 38 39 40
    /**
     * @description: 右侧表单选项卡事件
     * @param {*} activeName
     * @param {*} oldActiveName
     * @author: renchao
     */
任超 committed
41
    beforeLeave (activeName, oldActiveName) {
42
      sessionStorage.setItem('activeName', activeName);
任超 committed
43 44
      if (activeName && activeName != 0) this.getFromRouter(activeName)
    },
yuanbo committed
45 46 47 48 49
    /**
     * @description: 切换选项卡内容组件
     * @param {*} tabname
     * @author: renchao
     */
任超 committed
50
    getFromRouter (tabname) {
蔡俊立 committed
51
      //根据tabname获取选中的表单  此操作为了获取后端返回的表单对象,使用里面的是否可操作的属性
任超 committed
52 53
      for (let item of this.tabList) {
        if (item.value === tabname) {
xiaomiao committed
54
          this.currentSelectTab = item;
蔡俊立 committed
55 56 57
          break;
        }
      }
58
      this.componentTag = getForm(tabname);
任超 committed
59 60 61
    }
  }
}