lyh
6 天以前 73e6916dfb4956e733be0542bb3f8bf87fd89925
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<template>
  <div class="grid-content">
    <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane label="NC文档" name="ncTab">
        <el-row :gutter="20">
          <el-col :span="7" :class="'grid-table-height'">
            <process-table
              v-if="tabRefresh.ncTab"
              ref="ProcessTable"
              @showProcessAddDialog="showProcessAddDialog"
              @showProcessEditDialog="showProcessEditDialog"
              @showUploadDialog="showUploadDialog"
              v-on:indexChange="setIndex($event)"
              :nodeList="nodeList"></process-table>
          </el-col>
          <el-col :span="17">
            <file-table
              v-if="tabRefresh.ncTab"
              ref="FileTable"
              @showDocEditDialog="showDocEditDialog"
              @showUploadDialog="showUploadDialog"
              v-on:indexChange="setInd($event)"
              :nodeList="nodeData"></file-table>
          </el-col>
        </el-row>
      </el-tab-pane>
      <el-tab-pane label="其他文档"  name="othTab">
        <el-row>
          <el-col :span="24">
            <others-table
              v-if="tabRefresh.othTab"
              ref="OthersTable"
              @showDocEditDialog="showDocEditDialog"
              @showUploadDialog="showUploadDialog"
              v-on:indexChange="setInds($event)"
              :nodeList="nodeList"></others-table>
          </el-col>
        </el-row>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
 
<script>
  import * as productApi from '../api/product'
  import utilApi from '@/common/utils'
  import ProcessTable from '@/module/productManager/components/process_table_info.vue';
  import FileTable from '@/module/productManager/components/nc_file_table_info.vue';
  import OthersTable from '@/module/productManager/components/other_file_table_info.vue';
    export default {
      name: "file_tab_info",
      props:['nodeList'],
      components:{
        ProcessTable,
        FileTable,
        OthersTable,
      },
      data(){
        return{
          activeName: 'ncTab',
          nodeData:{
            index:'',
            list:[]
          },
          nodeDataC:{
            index:'',
            list:[]
          },
          nodeDataO:{
            index:'',
            list:[]
          },
          tabRefresh: {
            ncTab: true,
            othTab: false,
          }
        }
      },
      methods:{
        handleClick(tab){
          this.activeName = tab.name;
          switch (this.activeName) {
            case 'ncTab':
              this.switchTab('ncTab');
              break;
            case 'othTab':
              this.switchTab('othTab');
              break;
          }
        },
        switchTab (tab) {
          for (let key in this.tabRefresh) {
            if (key === tab) {
              this.tabRefresh[key] = true
            } else {
              this.tabRefresh[key] = false
            }
          }
        },
        showDocEditDialog(params){
          this.$emit('showDocEditDialog',params)
        },
        showProcessAddDialog(){
          this.$emit('showProcessAddDialog')
        },
        showProcessEditDialog(params){
          this.$emit('showProcessEditDialog',params)
        },
        showUploadDialog(params){
          this.$emit('showUploadDialog',params)
        },
        setIndex(msg){
          this.nodeData = msg;
          this.$emit('indexChange', this.nodeData); // 调用父组件传递过来的方法,同时把数据传递出去
        },
        setInd(msg){
          this.nodeDataC = msg;
          this.$emit('indexChange', this.nodeDataC); // 调用父组件传递过来的方法,同时把数据传递出去
        },
        setInds(msg){
          this.nodeDataO = msg;
          this.$emit('indexChange', this.nodeDataO); // 调用父组件传递过来的方法,同时把数据传递出去
        }
      },
      //监听
      watch:{
        nodeData:{
          deep: true,  // 深度监听
          handler(newValue, oldValue) {
            this.nodeData = newValue;
          }
        },
        nodeDataO:{
          deep: true,  // 深度监听
          handler(newValue, oldValue) {
            this.nodeDataO = newValue;
          }
        },
        nodeDataC:{
          deep: true,  // 深度监听
          handler(newValue, oldValue) {
            this.nodeDataC = newValue;
          }
        },
      },
      deactivated(){
        this.$destroy('FileTab');
      },
      mounted(){
 
      }
    }
</script>
 
<style scoped>
 
</style>