Blame view

src/mixins/generator/index.js 2.54 KB
4424f41c   monkeyhouyi   网信执法、清单管理静态页面
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
  import { getVisualDevList, Delete, Copy, exportData, exportAppData } from '@/api/onlineDev/visualDev'
  
  export default {
    data() {
      return {
        list: [],
        listLoading: false,
        formVisible: false,
        addVisible: false,
        categoryList: []
      }
    },
    created() {
      this.getDictionaryData()
      this.initData()
    },
    methods: {
      search() {
        this.initData()
      },
      reset() {
        this.query.keyword = ''
        this.initData()
      },
      getDictionaryData() {
        this.$store.dispatch('base/getDictionaryData', { sort: this.sort }).then((res) => {
          this.categoryList = res
        })
      },
      initData() {
        this.listLoading = true
        getVisualDevList(this.query).then(res => {
          this.list = res.data.list.map(o => ({ top: true, ...o }))
          this.listLoading = false
        })
      },
      handleDel(id) {
        this.$confirm(this.$t('common.delTip'), this.$t('common.tipTitle'), {
          type: 'warning'
        }).then(() => {
          Delete(id).then(res => {
            this.$message({
              type: 'success',
              message: res.msg,
              duration: 1000,
              onClose: () => {
                this.initData()
              }
            });
          })
        }).catch(() => {});
      },
      copy(id) {
        this.$confirm('您确定要复制该功能表单, 是否继续?', '提示', {
          type: 'warning'
        }).then(() => {
          Copy(id).then(res => {
            this.$message({
              type: 'success',
              message: res.msg,
              duration: 1000,
              onClose: () => {
                this.initData()
              }
            });
          })
        }).catch(() => {});
      },
      exportModel(id) {
        this.$confirm('您确定要导出该功能表单, 是否继续?', '提示', {
          type: 'warning'
        }).then(() => {
          let method = null
          if (this.query.type == 1) {
            method = exportData
          }
          if (this.query.type == 2) {
            method = exportAppData
          }
          method(id).then(res => {
            if (res.data.url) window.location.href = this.define.comUrl + res.data.url
          })
        }).catch(() => {});
      },
      handleAdd(webType) {
        this.addOrUpdateHandle('', webType)
      },
      addOrUpdateHandle(id, webType) {
        this.formVisible = true
        this.$nextTick(() => {
          this.$refs.Form.init(this.categoryList, id, this.query.type, webType)
        })
      },
      colseForm(isRefresh) {
        this.formVisible = false
        if (isRefresh) {
          this.query.keyword = ''
          this.initData()
        }
      }
    }
  }