|
@@ -5,15 +5,17 @@
|
5
|
5
|
:close-on-click-modal="false"
|
6
|
6
|
:close-on-press-escape="false"
|
7
|
7
|
class="group-dialog"
|
8
|
|
- width="350px"
|
|
8
|
+ width="400px"
|
9
|
9
|
>
|
10
|
10
|
<div slot="title">
|
11
|
11
|
<span>批量分组</span>
|
12
|
12
|
</div>
|
13
|
13
|
<div class="form-wrap" v-loading="loading">
|
14
|
|
- <div class="batchHint">已选中 <span>{{ media_ids.length }}</span> 张图片,请选择分组</div>
|
15
|
|
- <div class="imgItemInfo">
|
16
|
|
- <div class="form-item">
|
|
14
|
+ <div class="batchHint" style="margin-bottom:30px">已选中 <span>{{ media_ids.length }}</span> 张图片,请 选择分组 或 自定义分组</div>
|
|
15
|
+ <el-radio v-model="radioGroup" :label="1">选择分组</el-radio>
|
|
16
|
+ <el-radio v-model="radioGroup" :label="2">自定义分组</el-radio>
|
|
17
|
+ <div class="imgItemInfo" style="margin-top:20px;">
|
|
18
|
+ <div class="form-item" v-if="radioGroup==1">
|
17
|
19
|
<span class="lable">分 组</span>
|
18
|
20
|
<el-select v-model="group_id" size="small" clearable placeholder="请选择">
|
19
|
21
|
<el-option
|
|
@@ -24,6 +26,10 @@
|
24
|
26
|
</el-option>
|
25
|
27
|
</el-select>
|
26
|
28
|
</div>
|
|
29
|
+ <div class="form-item" v-if="radioGroup==2">
|
|
30
|
+ <span class="lable" style="width: 65px"><em>*</em>分组名称</span>
|
|
31
|
+ <el-input v-model="groupName" size="small" placeholder="请输入名称" clearable />
|
|
32
|
+ </div>
|
27
|
33
|
</div>
|
28
|
34
|
</div>
|
29
|
35
|
|
|
@@ -54,7 +60,9 @@ export default {
|
54
|
60
|
data () {
|
55
|
61
|
return{
|
56
|
62
|
loading: false,
|
57
|
|
- group_id:''
|
|
63
|
+ group_id:'',
|
|
64
|
+ radioGroup: 1,
|
|
65
|
+ groupName: ''
|
58
|
66
|
}
|
59
|
67
|
},
|
60
|
68
|
created(){
|
|
@@ -64,34 +72,66 @@ export default {
|
64
|
72
|
handleCancel() {
|
65
|
73
|
this.$emit('cancel')
|
66
|
74
|
this.group_id = ''
|
|
75
|
+ this.groupName = ''
|
|
76
|
+ this.radioGroup = 1
|
67
|
77
|
},
|
68
|
78
|
// 点击确定
|
69
|
79
|
handleConfirm(){
|
70
|
|
- if ( this.group_id == '') {
|
71
|
|
- this.$confirm(`您选择的分组为空,默认对 ${this.media_ids.length} 个素材移除原有分组, 是否继续?`, '提示', {
|
72
|
|
- confirmButtonText: '继续',
|
73
|
|
- cancelButtonText: '取消',
|
74
|
|
- type: 'warning'
|
75
|
|
- }).then(() => {
|
76
|
|
- this.changeGroup()
|
77
|
|
- }).catch(() => {});
|
|
80
|
+ if ( this.radioGroup == 2 ) {
|
|
81
|
+ this.createdGroup()
|
78
|
82
|
} else {
|
79
|
|
- this.changeGroup()
|
|
83
|
+ if ( this.group_id == '') {
|
|
84
|
+ this.$confirm(`您选择的分组为空,默认对 ${this.media_ids.length} 个素材移除原有分组, 是否继续?`, '提示', {
|
|
85
|
+ confirmButtonText: '继续',
|
|
86
|
+ cancelButtonText: '取消',
|
|
87
|
+ type: 'warning'
|
|
88
|
+ }).then(() => {
|
|
89
|
+ this.changeGroup()
|
|
90
|
+ }).catch(() => {});
|
|
91
|
+ } else {
|
|
92
|
+ this.changeGroup()
|
|
93
|
+ }
|
|
94
|
+ }
|
|
95
|
+ },
|
|
96
|
+ // 自定义 新建分组
|
|
97
|
+ createdGroup(){
|
|
98
|
+ if ( this.groupName == '' ) {
|
|
99
|
+ this.$message({ message: '请填写分组名称!', type: 'fail' })
|
|
100
|
+ return
|
80
|
101
|
}
|
|
102
|
+ this.$loading(this.$loadingConfig);
|
|
103
|
+ this.$axios.post(this.URL.BASEURL + this.URL.media_editGroup, {
|
|
104
|
+ name: this.groupName
|
|
105
|
+ }).then((data)=>{
|
|
106
|
+ this.$loading(this.$loadingConfig).close();
|
|
107
|
+ const res = data.data;
|
|
108
|
+ if (res && res.errno == 0) {
|
|
109
|
+ this.changeGroup(res.rst.group_id)
|
|
110
|
+ } else if (res.errno != 4002) {
|
|
111
|
+ this.$message.warning(res.err)
|
|
112
|
+ }
|
|
113
|
+ }).catch((err)=>{
|
|
114
|
+ this.$loading(this.$loadingConfig).close();
|
|
115
|
+ })
|
81
|
116
|
},
|
82
|
|
- async changeGroup(){
|
|
117
|
+ async changeGroup(id){
|
83
|
118
|
try {
|
84
|
119
|
this.$loading(this.$loadingConfig);
|
85
|
120
|
const url = `${this.URL.BASEURL}${this.URL.media_changeGroup}`
|
86
|
121
|
const params = {
|
87
|
122
|
media_ids: this.media_ids.join(),
|
88
|
|
- group_id: this.group_id,
|
|
123
|
+ group_id: id ? id : this.group_id,
|
89
|
124
|
}
|
90
|
125
|
const { data: res = {} } = await this.$axios.post(url, params)
|
91
|
126
|
if (res && res.errno == 0 && res.rst) {
|
92
|
127
|
this.$message.success('成功!')
|
93
|
128
|
this.group_id = ''
|
|
129
|
+ this.groupName = ''
|
|
130
|
+ this.radioGroup = 1
|
94
|
131
|
this.$emit('cancel', 'success')
|
|
132
|
+ if (id) { // 更新分组列表
|
|
133
|
+ this.$emit('renewGroupList')
|
|
134
|
+ }
|
95
|
135
|
} else if (res.errno != 4002) {
|
96
|
136
|
this.$message.warning(res.err)
|
97
|
137
|
}
|