zjf
2023-03-03 bafa9dff4d9880c562f4d3a7b83bd4c1129240c5
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<template>
  <div class="journal oa-bgcolor">
    <div class="btn-select">
      <div class="select-group">
        <label>审批类型</label>
        <el-select
          v-model="categoryType"
          placeholder="请选择"
          size="mini">
          <el-option
            v-for="item in categoryOptions"
            :key="item.categoryId"
            :label="item.title"
            :value="item.categoryId"/>
        </el-select>
      </div>
      <el-button
        type="primary"
        class="new-btn"
        @click="newBtn">新建审批</el-button>
    </div>
    <el-tabs
      v-model="activeName"
      @tab-click="tabClick">
      <el-tab-pane
        v-for="(item, index) in tabsData"
        :name="item.key"
        :key="index">
        <el-badge
          slot="label"
          :hidden="item.key !== 'examine' || messageOANum.examineNum === 0"
          :max="99"
          :value="messageOANum.examineNum">
          <span>{{ item.label }}</span>
        </el-badge>
        <v-content
          id="examine-list-box"
          :by="item.key"
          :category-id="categoryType"
          :ref="'tabcontent' + item.key"
          @reset="reset"
          @edit="editDetail"/>
      </el-tab-pane>
    </el-tabs>
    <examine-category-select
      :show="showCategorySelect"
      @select="selcetExamineCategory"
      @close="showCategorySelect=false"/>
    <examine-create-view
      v-if="isCreate"
      :category-id="createInfo.categoryId"
      :type="createInfo.type"
      :category-title="createInfo.title"
      :action="createAction"
      @save-success="createSaveSuccess"
      @hiden-view="hideView"/>
  </div>
</template>
 
<script>
import { mapGetters } from 'vuex'
// import { oaExamineCategoryList } from '@/api/oamanagement/examine' // 审批类型数据
import VContent from './components/content'
import ExamineCategorySelect from './components/examineCategorySelect'
import ExamineCreateView from './components/examineCreateView'
 
export default {
  components: {
    VContent,
    ExamineCategorySelect,
    ExamineCreateView
  },
 
  data () {
    return {
      loading: false,
      activeName: 'my',
      tabsData: [
        { label: '我发起的', key: 'my' },
        { label: '我审批的', key: 'examine' }
      ],
      // 审批类型
      categoryType: '',
      categoryOptions: [],
      // 新建
      showCategorySelect: false,
      isCreate: false, // 是创建
      createAction: { type: 'save' },
      createInfo: {} // 创建所需要的id 标题名信息
    }
  },
 
  computed: {
    ...mapGetters(['messageOANum'])
  },
 
  mounted () {
    this.getExamineCategoryList()
  },
 
  methods: {
    // 审批类型列表
    getExamineCategoryList () {
      this.loading = true
      // oaExamineCategoryList()
      //   .then(res => {
      //     this.loading = false
      //     this.categoryOptions = [{ categoryId: '', title: '全部' }].concat(
      //       res.data
      //     )
      //   })
      //   .catch(() => {
      //     this.loading = false
      //   })
    },
 
    // 重置按钮
    reset () {
      this.categoryType = ''
    },
 
    editDetail (item) {
      item.title = item.categoryName
      this.createInfo = item
      this.createAction = { type: 'update', id: item.examineId, data: item }
      this.isCreate = true
    },
 
    // 创建
    newBtn () {
      this.showCategorySelect = true
    },
 
    // 审批类型选择
    selcetExamineCategory (item) {
      this.createInfo = item
      this.createAction = { type: 'save' }
      this.isCreate = true
    },
 
    createSaveSuccess () {
      this.$refs.tabcontentmy[0].searchBtn()
    },
 
    hideView () {
      this.isCreate = false
    },
 
    tabClick (val) {}
  }
}
</script>
 
<style scoped lang="scss">
@import '../styles/tabs.scss';
 
.journal {
  overflow: auto;
  position: relative;
  .btn-select {
    position: absolute;
    top: 10px;
    right: 40px;
    z-index: 999;
    .select-group {
      display: inline-block;
      .el-select {
        margin: 0 20px 0 10px;
        width: 116px;
      }
    }
  }
  .el-tabs {
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  .el-tabs /deep/ .el-tabs__content {
    padding: 0 30px;
    flex: 1;
    display: flex;
    flex-direction: column;
    // overflow: auto;
    .el-tab-pane {
      flex: 1;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
  }
}
 
// 消息效果
.el-badge /deep/ .el-badge__content.is-fixed {
  top: 15px;
}
</style>