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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
| <template>
| <el-dialog class="filterDialog" :title="title" :visible.sync="dialogShow" :show-close="true"
| :close-on-click-modal="false" v-if="dialogShow" :append-to-body="appendToBody"
| :width="dialogWidth">
| <list-condition-template ref="table" :form="form" :formLabel="formLabel" v-loading="loading"
| element-loading-custom-class="customLoading" :tableData="tableData"
| :total="total" :multipleSelected="multipleSelected"
| @page-info-change="handlePageInfoChange" @selected="handleSelected"
| @handle-selected="handleCurrentRowChange" :dataKey="dataKey"
| :isDisplayScroll="false" defaultPadding="0px" :selectable="selectable"
| :isClearCheckItem="isClearCheckItem">
| <template slot="otherElement" slot-scope="scope">
| <el-form-item>
| <slot name="condition" :data="scope.data"></slot>
| </el-form-item>
| </template>
| <template slot="columns">
| <slot name="columns"></slot>
| </template>
| </list-condition-template>
| <div slot="footer" class="dialog-footer">
| <el-button size="mini" type="primary" v-if="multipleSelected || isSelectable"
| @click="closeDialog">确定</el-button>
| <el-button size="mini" v-if="closeBtn" @click="dialogShow = false">关闭</el-button>
| </div>
| </el-dialog>
| </template>
| <script>
| export default {
| props: {
| /**
| * 对话框显示状态
| */
| show: {
| type: Boolean,
| default: false
| },
| /**
| * 数据行
| */
| tableData: {
| type: Array,
| default: function () {
| return []
| }
| },
| /**
| * 数据总数
| */
| total: {
| type: Number,
| default: 0
| },
| title: {
| type: String,
| default: '添加品牌'
| },
| /**
| * 是否嵌套弹出框
| */
| appendToBody: {
| type: Boolean,
| default: false
| },
| /**
| * 表格遮罩
| */
| loading: {
| type: Boolean,
| default: false
| },
| /**
| * 查询条件
| */
| form: {
| type: Object,
| default: function () {
| return {}
| }
| },
| /**
| *标签数据
| */
| formLabel: {
| type: Array,
| default: function () {
| return []
| }
| },
| /**
| * 是否多选
| */
| multipleSelected: {
| type: Boolean,
| default: false
| },
| /**
| * 是否多选
| */
| isSelectable: {
| type: Boolean,
| default: false
| },
| /**
| * 数据行的键
| */
| dataKey: {
| type: String,
| default: 'id'
| },
| /**
| * 复选框是否可被点击
| */
| selectable: {
| type: Function,
| default: null
| },
| /**
| * 弹出框默认宽度
| */
| dialogWidth: {
| type: String,
| default: '50%'
| },
| /**
| * 关闭按钮是否显示
| */
| closeBtn: {
| type: Boolean,
| default: true
| },
| /**
| *查看条件变化,是否清空表格勾选项
| */
| isClearCheckItem: {
| type: Boolean,
| default: true
| }
| },
| data() {
| return {
| dialogShow: false
| }
| },
| watch: {
| /**
| * 监控外部显示变量变化
| * 传递到dialog组件
| */
| show: function (newShow, oldShow) {
| this.dialogShow = newShow
| if (this.dialogShow) {
| this.$emit('page-info-change', { pageNum: 1, pageSize: 10 })
| }
| },
| /**
| * 监控内部显示属性变化
| * 传递到外部调用变量
| */
| dialogShow: function (newDialogShow, oldDialogShow) {
| this.$emit('update:show', newDialogShow)
| },
| },
| methods: {
| /**
| * 重置条件
| */
| reloadCurrent() {
| this.$refs.table.reloadCurrent()
| },
| /**
| * 主动关闭对话框
| */
| closeDialog() {
| this.$emit('update:show', false)
| this.onClose()
| },
| /**
| * 触发关闭事件
| */
| onClose() {
| this.$emit('close')
| },
| /**
| * 行选中事件处理
| * @param {*} rows 行数据
| */
| handleSelected(rows) {
| this.$emit('selected', rows)
| },
| // 获取点击的当前行
| handleCurrentRowChange(rows, row) {
| this.$emit('current-row-change', rows, row)
| },
| /**
| * 当分页信息变动的时候
| */
| handlePageInfoChange(pageInfo) {
| this.onPageInfoChage(pageInfo)
| },
| /**
| * 触发分页信息变化事件
| */
| onPageInfoChage(pageInfo) {
| this.$emit('page-info-change', pageInfo)
| },
| /**
| * 重置条件并触发条件变化事件
| */
| changeCondition() {
| this.$refs.table.changeCondition()
| },
| /**
| * 获取table节点
| */
| getTableNode() {
| return this.$refs.table.tableNode();
| }
| }
| }
| </script>
| <style lang="scss">
| .filterDialog {
| .commonForm,
| .main-b-style {
| padding: 0;
| }
| .el-dialog {
| min-width: 725px;
| }
| }
| </style>
|
|