ludc
2023-10-31 608ba76865266795b4b43bc7d9c8ab68ac0bb83d
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<template>
    <basic-container>
        <avue-crud :table-loading="loading" :data="data" :option="option" :search.sync="searchParam" :page.sync="page" :permission="permissionList"
            ref="crud" @refresh-change="getDataList" @search-change="handleSearch" @search-reset="handleReset"
            @size-change="handleSizePage" @current-change="handleCurrentPage" @on-load="getDataList"
            @selection-change="selectionChange" @row-click="handleRowClick">
            <template slot="menuLeft">
                <el-button icon="el-icon-document" size="small" type="primary" @click="handleStatus" v-if="permissionList.status">集团申请状态
                </el-button>
            </template>
        </avue-crud>
    </basic-container>
</template>
 
<script>
import { getList, queryApplyStat } from '@/api/integration/application.js'
import { dateFormat } from '@/util/date.js'
import {mapGetters} from 'vuex'
export default {
    data() {
        return {
            loading: false,
            data: [],
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            searchParam: {},
            stateParam: {},
        }
    },
    computed:{
      ...mapGetters(["permission"]),
      permissionList(){
        return{
          searchBtn:this.vaildData(this.permission.applicationForm.applicationForm_search,false),
          emptyBtn:this.vaildData(this.permission.applicationForm.applicationForm_search,false),
          status:this.vaildData(this.permission.applicationForm.applicationForm_status,false)
        }
      },
      option(){
        return{
            height: "auto",
            tip:false,
            index: true,
            border: true,
            addBtn: false,
            columnBtn: false,
            searchBtn:this.permissionList.searchBtn,
            emptyBtn:this.permissionList.emptyBtn,
            searchMenuSpan: 8,
            highlightCurrentRow: true,
            menu: false,
            selection: true,
            column: [
              {
                label: '申请单号',
                prop: 'id',
                width: 300,
                fixed: true,
                search: true,
              }, {
                label: '集团码',
                width: 200,
                prop: 'groupCode',
                search: true,
              }, {
                label: '操作类型',
                width: 200,
                prop: 'operationType',
                type: 'select',
                search: true,
                dicData: [{
                  label: '申请',
                  value: '1'
                }, {
                  label: '更改',
                  value: '2'
                }]
              }, {
                label: '申请单数据信息',
                width: 300,
                prop: 'description'
              },
              {
                label: '创建时间',
                width: 200,
                prop: 'createTime',
                type: 'datetime',
                search: true,
              },
              {
                label: '更改时间',
                width: 200,
                prop: 'lastModifyTime',
                type: 'datetime',
                search: true,
              }, {
                label: '返回标识',
                width: 100,
                prop: 'code'
              },
              {
                label: '返回信息',
                width: 300,
                prop: 'content'
              },
              {
                label: '消息信息',
                width: 300,
                prop: 'msg'
              }
            ]
        }
      }
    },
    methods: {
        async handleStatus() {
            const { oids } = this.stateParam
            if (this.$utilFunc.isEmpty(oids)) {
                this.$message({
                    type: "error",
                    message: "请至少选择一条数据!"
                })
            } else {
                // console.log(this.stateParam)
                const response = await queryApplyStat(this.stateParam)
                if (response.status === 200) {
                    // console.log(response)
                }
            }
        },
        async getDataList() {
            this.loading = true
            const { pageSize, currentPage, total } = this.page
            let param = { size: pageSize, current: currentPage }
            // console.log(this.searchParam)
            this.searchParam = Object.keys(this.searchParam)
                .filter((key) => this.searchParam[key] !== null && this.searchParam[key] !== undefined && this.searchParam[key] !== "")
                .reduce((acc, key) => ({ ...acc, [key]: this.searchParam[key] }), {});
            // console.log(this.searchParam)
            const response = await getList({ ...param, ...this.searchParam })
            if (response.status === 200) {
                this.loading = false
                // console.log(response)
                const data = response.data.data
                this.data = data.records
                this.page.total = data.total
            } else this.loading = false
        },
        handleSizePage(event) {
            this.page.pageSize = event
        },
        handleCurrentPage(event) {
            this.page.currentPage = event
        },
        handleReset() {
            this.searchParam = {}
            this.getDataList()
        },
        handleSearch(form, done) {
            // console.log(form)
            const { id, groupCode, operationType } = form
            let dataTime = { id, groupCode, operationType }
            if (form.hasOwnProperty('createTime')) {
                dataTime = { createTime: dateFormat(form.createTime), ...dataTime }
            }
            if (form.hasOwnProperty('lastModifyTime')) {
                dataTime = { lastModifyTime: dateFormat(form.lastModifyTime), ...dataTime }
            }
            this.searchParam = dataTime
            this.page.currentPage = 1
            this.getDataList()
            done()
        },
        selectionChange(list) {
            // console.log(list)
            let newData = list.map(item => {
                const { dataOid } = item
                return dataOid
            })
            this.stateParam = { oids: newData.toString() }
            // console.log(newData)
        },
        handleRowClick(row) {
            this.$refs.crud.toggleRowSelection(row, true)
        },
    }
}
</script>
<style lang="scss" scoped>
//固定列高度
/deep/ .el-table__fixed {
  height: calc(100vh - 345px)!important;
}
// 滚动条样式修改
// 滚动条的宽度
/deep/ .el-table__body-wrapper::-webkit-scrollbar {
  height: 15px; // 纵向滚动条 必写
  background: white;
  border: white;
  width: 10px;
 
}
// 滚动条的滑块
/deep/ .el-table__body-wrapper::-webkit-scrollbar-thumb {
  background-color: #ececec;
  border-radius: 20px;
  border: #ececec;
}
 
</style>