3328350766
6 天以前 761eb03d6b3bebd0b197179564c84d89d3d12a0d
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
<template>
  <el-dialog
    :title="hasCreate ? '新建' : '模板'"
    :visible.sync="dialogVisible"
    width="50%"
    class="bs-dialog-wrap bs-el-dialog"
    :before-close="handleClose"
  >
    <TemplateList
      ref="templateList"
      :has-create="hasCreate"
      :page-info="pageInfo"
      :loading="loading"
      @addNew="addNew"
      @useIt="useIt"
      @replaceItByTemplate="replaceItByTemplate"
    />
  </el-dialog>
</template>
 
<script>
import TemplateList from 'data-room-ui/TemplateList'
export default {
  name: 'ChooseTemplistDialog',
  components: {
    TemplateList
  },
  props: {
    loading: {
      type: Boolean,
      default: false
    },
    hasCreate: {
      type: Boolean,
      default: false
    },
    pageInfo: {
      type: Object,
      default: () => {}
    }
  },
  data () {
    return {
      dialogVisible: false,
      parentNode: null,
      type: null
    }
  },
  mounted () {
 
  },
  methods: {
    init (parentNode, type) {
      this.parentNode = parentNode
      this.type = type
      this.dialogVisible = true
      this.$nextTick(() => {
        this.$refs.templateList.getTemplateList(type)
      })
    },
    handleClose () {
      this.dialogVisible = false
    },
    addNew () {
      this.$emit('addNew', this.parentNode, this.type)
    },
    useIt (id) {
      this.$emit('useIt', id, this.parentNode, this.type)
    },
    replaceItByTemplate (config) {
      this.$emit('replaceItByTemplate', config)
      this.dialogVisible = false
    }
  }
}
</script>
 
<style lang="scss" scoped>
</style>