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
<template>
  <div>
    <examine-cell
      v-for="(item, index) in list"
      :key="index"
      :data="item"
      @on-handle="examineCellHandle"/>
    <slot name="load"/>
    <examine-detail
      v-if="showDview"
      :id="rowID"
      class="d-view"
      @on-examine-handle="handleResult('examine-detail')"
      @hide-view="showDview=false"/>
    <c-r-m-all-detail
      :visible.sync="showRelatedDetail"
      :crm-type="relatedCRMType"
      :listener-ids="['workbench-main-container']"
      :no-listener-ids="['examine-list-box']"
      :id="relatedID"/>
    <examine-handle
      :show="showExamineHandle"
      :id="rowID"
      :record-id="rowData.examineRecordId"
      :detail="rowData"
      examine-type="oa_examine"
      status="4"
      @close="showExamineHandle = false"
      @save="handleResult('examine-handle')"/>
    <examine-create-view
      v-if="isCreate"
      :category-id="createInfo.categoryId"
      :type="createInfo.type"
      :category-title="createInfo.title"
      :action="createAction"
      @save-success="handleResult('edit')"
      @hiden-view="isCreate = false"/>
  </div>
</template>
 
<script>
// import { oaExamineDelete } from '@/api/oamanagement/examine'
import ExamineCell from './examineCell'
import ExamineDetail from './examineDetail'
import CRMAllDetail from '@/views/clients/components/CRMAllDetail'
import ExamineHandle from '@/components/Examine/ExamineHandle' // 审批操作理由
import ExamineCreateView from './examineCreateView'
 
export default {
  components: {
    ExamineCell,
    ExamineDetail,
    CRMAllDetail,
    ExamineHandle,
    ExamineCreateView
  },
 
  props: {
    list: Array
  },
 
  data () {
    return {
      // 控制详情展示
      rowID: '',
      rowData: {}, // 行全部信息
      showDview: false,
 
      // 相关详情的查看
      relatedID: '',
      relatedCRMType: '',
      showRelatedDetail: false,
 
      // 撤回操作
      showExamineHandle: false,
 
      // 编辑操作
      isCreate: false, // 是编辑
      createAction: { type: 'update' },
      createInfo: {} // 编辑所需要的id 标题名信息
    }
  },
 
  watch: {
    list () {
      this.showRelatedDetail = false
      this.showDview = false
    }
  },
 
  mounted () {},
 
  methods: {
    /**
     * 操作
     */
    examineCellHandle (data) {
      // 编辑
      if (data.type === 'edit') {
        const item = data.data.item
        item.title = item.categoryName
        this.createInfo = item
        this.createAction = { type: 'update', id: item.examineId, data: item }
        this.isCreate = true
        // 删除
      } else if (data.type === 'delete') {
        this.$confirm('确定删除?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
          .then(() => {
            // oaExamineDelete({
            //   examineId: data.data.item.examineId
            // }).then(res => {
            //   this.searchBtn()
            //   this.$message({
            //     type: 'success',
            //     message: '删除成功!'
            //   })
            // })
          })
          .catch(() => {
            this.$message({
              type: 'info',
              message: '已取消删除'
            })
          })
        // 撤回
      } else if (data.type === 'withdraw') {
        this.rowID = data.data.item.examineId
        this.rowData = data.data.item
        this.showExamineHandle = true
        // 详情
      } else if (data.type === 'view') {
        this.showRelatedDetail = false
        this.rowID = data.data.item.examineId
        this.showDview = true
      } else if (data.type === 'related-detail') {
        this.showDview = false
        this.relatedID = data.data.item[data.data.type + 'Id']
        this.relatedCRMType = data.data.type
        this.showRelatedDetail = true
      }
    },
 
    /**
     * 审批操作
     */
    handleResult (type) {
      this.$emit('handle', type)
    }
  }
}
</script>
 
<style scoped lang="scss">
.d-view {
 position: fixed;
  // width: 950px;
  // top: 0px;
  width: 100%;
  top: 300px;
  bottom: 0px;
  right: 0px;
  // background: #FFFFFF;
  box-shadow: 0px -4px 12px 0px rgba(61, 121, 204, 0.2);
  border-radius: 24px 24px 0px 0px;
}
</style>