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
<template>
<div class=''>
<el-dialog :visible.sync="userDialogParams.show" width="70%" append-to-body>
<div class="secTitle" >手动选择用户</div>
<el-form label-width="90px">
<el-row>
<el-col :span="3" >
<el-form-item>
<el-button style="float: right" type="primary" plain @click="getUser">搜索</el-button>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="ID">
<el-input v-model="searchUserFrom.userId"></el-input>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="昵称">
<el-input v-model="searchUserFrom.nickName"></el-input>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="电话">
<el-input v-model="searchUserFrom.mobile"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="userDialogParams.show = false">取 消</el-button>
<el-button type="primary" @click="onConfirm">确 定</el-button>
</span>
<div class="tableBox" >
<div class="item" >
<p>筛选列表</p>
<el-table
:data="userList"
ref="multipleTable"
@select="handleSelectionChange"
@select-all="handleSelectionAll"
style="width: 100%">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
className="f-c"
label="用户">
<template slot-scope="scope">
<img style="margin-right:5px;width: 50px;height: 50px;border-radius: 50px" :src="scope.row.avatar">{{scope.row.nickname}}(ID:{{scope.row.user_id}})
</template>
</el-table-column>
<el-table-column
prop="mobile"
label="手机号">
</el-table-column>
</el-table>
</div>
<div class="item" >
<p>已选中列表</p>
<el-table
:data="handSecUser"
ref="multipleTable"
style="width: 100%">
<el-table-column
className="f-c"
label="用户">
<template slot-scope="scope">
<img style="margin-right:5px;width: 50px;height: 50px;border-radius: 50px" :src="scope.row.avatar">{{scope.row.nickname}}(ID:{{scope.row.user_id}})
</template>
</el-table-column>
<el-table-column
prop="mobile"
label="手机号">
</el-table-column>
<el-table-column
label="操作"
width="148" v-if="!$store.state.readonly" fixed="right">
<template slot-scope="scope">
<el-button size="mini" type="danger" plain @click="userdel(scope.row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<page :total="userDialogParams.total" :limit="userDialogParams.limit" @pageChange="onUserPageChange" @sizeChange="onUserSizeChange"/>
</el-dialog>
</div>
</template>
<script>
import tinymce from 'tinymce/tinymce'
import page from "../framework/page";
import {
getUserListApi,
} from "../../service/api";
export default {
name: 'tinymce1',
props:[
'lookData1'
],
data () {
return {
userDialogParams: {
total: 0,
limit: 5,
nowPage: 1,
show: false
},
userList:[],
searchUserFrom: {},
handSecUser:[],
}
},
activated(){
this.show = true
},
created:function(){
},
components: {page},
methods:{
getUser() {
let json = {
page: this.userDialogParams.nowPage,
limit: this.userDialogParams.limit
};
if (this.searchUserFrom.userId) {
json.user_id = this.searchUserFrom.userId;
}
if (this.searchUserFrom.nickName) {
json.nickname = this.searchUserFrom.nickName;
}
if (this.searchUserFrom.mobile) {
json.mobile = this.searchUserFrom.mobile;
}
getUserListApi(json).then(res => {
this.userList = res.list;
this.userDialogParams.total = res.total;
});
},
onUserPageChange(val) {
this.userDialogParams.nowPage = val;
this.getUser();
},
onUserSizeChange(val) {
this.userDialogParams.nowPage = 1;
this.userDialogParams.limit = val;
this.getUser();
},
handleSelectionChange(val,el) {
this.multipleSelection = val;
for(let i=0;i<this.handSecUser.length;i++){
if(el.user_id==this.handSecUser[i].user_id){
return
}
}
this.handSecUser.push(el)
},
handleSelectionAll(val){
if(this.handSecUser.length==0){
this.handSecUser = [...val]
}else{
let length = this.handSecUser.length
for(let j=0;j<val.length;j++){
for(let i=0;i<=length;i++){
if(val[j].user_id==this.handSecUser[i].user_id){
break
}else{
if(i==length-1){
this.handSecUser.push(val[j])
break
}
}
}
}
}
},
userdel(el){
for(let i=0;i<this.handSecUser.length;i++){
if(el.user_id==this.handSecUser[i].user_id){
this.handSecUser.splice(i,1)
}
}
},
onSelectUser() {
this.userDialogParams.show = true;
this.getUser();
},
onConfirm() {
this.$emit('userConfirm',this.handSecUser)
console.log(this.handSecUser)
},
}
}
</script>
<style scoped lang="less">
.tableBox{display: flex;}
.tableBox .item{flex: 1;}
</style>