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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
| <template>
| <el-bus-crud ref="crud" v-bind="tableConfig" />
| </template>
|
| <script>
| export default {
| data() {
| return {
| tableConfig: {
| url: 'flower/api/filmWorks/list',
| newUrl: 'flower/api/filmWorks/new',
| editUrl: 'flower/api/filmWorks/edit',
| deleteUrl: 'flower/api/filmWorks/delete',
| dialogNeedRequest: true,
| persistSelection: true,
| columns: [
| { type: 'selection' },
| { label: '中文名称', prop: 'nameCn', minWidth: 120 },
| { label: '英文名称', prop: 'nameEn', minWidth: 120 },
| { label: '作品类型', prop: 'typeStr' , minWidth: 150 },
| { label: '上映年份', prop: 'releaseYear' },
| { label: '导演', prop: 'director', minWidth: 150 },
| { label: '制片方', prop: 'producer', minWidth: 150 },
| { label: '主要演员', prop: 'actors', minWidth: 300 },
| { label: '剧情关键词', prop: 'keywords' },
| { label: '剧情简介', prop: 'synopsis' , minWidth: 400 },
| { label: '封面图片' ,formatter: this.formatterImage, minWidth: 200 },
| { label: '封面图片描述', prop: 'coverAlt', minWidth: 120 },
| { label: '用户类型', prop: 'userTypeStr' },
| { label: '置顶权重', prop: 'stickyWeight' , minWidth: 80 },
| { label: '状态', prop: 'statusStr' , minWidth: 80 },
| { label: '收藏量', prop: 'collectCount' , minWidth: 80 },
| { label: '点赞量', prop: 'likeCount', minWidth: 80 },
| { label: '评论量', prop: 'commentCount', minWidth: 80 },
| { label: '分享量', prop: 'shareCount', minWidth: 80 },
| { label: '创建日期', prop: 'createDate', minWidth: 80 },
| ],
| searchForm: [
| {
| type: 'row',
| items: [
| { label: '中文名称', id: 'nameCn', type: 'input' },
| { label: '英文名称', id: 'nameEn', type: 'input' },
| { label: '作品类型', id: 'type', type: 'input' },
| { label: '上映年份', id: 'releaseYear', type: 'input' },
| {
| label: '创建日期',
| id: 'createDateBeginStr',
| component: 'el-bus-date-range',
| commonFormat: true,
| commonFormatProps: ['createDateBeginStr', 'createDateEndStr'],
| customClass: 'in-bus-form',
| },
| ],
| },
| ],
| form: [
| {
| label: '中文名称:',
| id: 'nameCn',
| type: 'input',
| rules: {
| required: true,
| message: '请输入标题',
| trigger: 'blur',
| },
| },
| {
| label: '英文名称:',
| id: 'nameEn',
| type: 'input',
| rules: {
| required: true,
| message: '请输入标题',
| trigger: 'blur',
| },
| },
| {
| label: '作品类型:',
| id: 'type',
| type: 'bus-select-dict',
| el: {
| code: 'FILMSET_TYPE',
| style: 'width:100%',
| clearable: true,
| },
| rules: {
| required: true,
| message: '请选择影视作品类型',
| },
| },
| {
| label: '上映年份:',
| id: 'releaseYear',
| type: 'input',
| rules: {
| required: true,
| message: '请输入上映年份',
| trigger: 'blur',
| },
| },
| {
| label: '导演:',
| id: 'director',
| type: 'input',
| rules: {
| required: true,
| message: '请输入导演,多个导演,分割',
| trigger: 'blur',
| },
| },
| {
| label: '制片方:',
| id: 'producer',
| type: 'input',
| rules: {
| required: true,
| message: '请输入制片方,多个制片方,分割',
| trigger: 'blur',
| },
| },
| {
| label: '主要演员:',
| id: 'actors',
| type: 'input',
| rules: {
| required: true,
| message: '请输入主要演员,多个主要演员,分割',
| trigger: 'blur',
| },
| },
| {
| label: '剧情关键词:',
| id: 'keywords',
| type: 'input',
| rules: {
| required: true,
| message: '请输入剧情关键词',
| trigger: 'blur',
| },
| },
| {
| label: '剧情简介:',
| id: 'synopsis',
| component: 'base-editor',
| richText: true,
| rules: { required: true, message: '请输入剧情简介', trigger: 'blur' },
| },
| {
| label: '封面图片:',
| id: 'coverUrl',
| type: 'bus-upload',
| el: {
| listType: 'picture-card',
| limitSize: 2,
| limit: 1,
| tipText: '大小不超过2M',
| valueType: 'string',
| },
| forceDisabled: true,
| },
| {
| label: '封面图片描述:',
| id: 'coverAlt',
| type: 'input',
| rules: {
| required: true,
| message: '请输入封面图片描述',
| trigger: 'blur',
| },
| },
| {
| label: '用户类型:',
| id: 'userType',
| type: 'bus-select-dict',
| el: {
| code: 'FILMSET_CREATE_TYPE',
| style: 'width:100%',
| clearable: true,
| },
| rules: {
| required: true,
| message: '请选择用户类型',
| },
| },
| {
| label: '置顶权重:',
| id: 'stickyWeight',
| type: 'input',
| rules: {
| required: true,
| message: '请输入置顶权重描述',
| trigger: 'blur',
| },
| },
| {
| label: '收藏量:',
| id: 'collectCount',
| type: 'input',
| rules: {
| required: true,
| message: '请输入收藏量',
| trigger: 'blur',
| },
| },
| {
| label: '点赞量:',
| id: 'likeCount',
| type: 'input',
| rules: {
| required: true,
| message: '请输入点赞量',
| trigger: 'blur',
| },
| },
| {
| label: '评论量:',
| id: 'commentCount',
| type: 'input',
| rules: {
| required: true,
| message: '请输入评论量',
| trigger: 'blur',
| },
| },
| {
| label: '分享量:',
| id: 'shareCount',
| type: 'input',
| rules: {
| required: true,
| message: '请输入分享量',
| trigger: 'blur',
| },
| },
| ],
| extraButtons: [
| {
| text: (row) => (row.status === 'unpublished' ? '发布' : '下架'),
| atClick: async (row) => {
| const action = row.status === 'unpublished' ? '发布' : '下架'
| try {
| await this.$elBusUtil.confirm(`确定要${action}吗?`)
| const { code } = await this.$elBusHttp.request(
| 'flower/api/filmWorks/changeStatus',
| { params: { id: row.id } }
| )
| if (code === 0) {
| this.$message.success(`${action}成功`)
| }
| } catch (e) {
| return false
| }
| },
| },
| ],
| headerButtons: [
| {
| text: '批量发布',
| type: 'primary',
| disabled: (selected) =>
| selected.filter((item) => item.status === 'unpublished')
| .length === 0,
| atClick: async (selected) => {
| const selectedNotice = selected.filter(
| (item) => item.status === 'unpublished'
| )
| try {
| await this.$elBusUtil.confirm(
| `确定要批量发布这${selectedNotice.length}个片场内容吗?`
| )
| const { code } = await this.$elBusHttp.request(
| 'flower/api/filmWorks/publish/batch',
| {
| method: 'post',
| data: {
| ids: selected.map((item) => item.id),
| },
| }
| )
| if (code === 0) {
| this.$message.success('操作成功')
| this.$refs.crud.clearSelection()
| }
| } catch (e) {
| return false
| }
| },
| },
| {
| text: '批量删除',
| type: 'danger',
| disabled: (selected) => selected.length === 0,
| atClick: async (selected) => {
| try {
| await this.$elBusUtil.confirm(
| `确定要批量删除这${selected.length}个片场内容吗?`
| )
| const { code } = await this.$elBusHttp.request(
| 'flower/api/filmWorks/delete/batch',
| {
| method: 'post',
| data: {
| ids: selected.map((item) => item.id),
| },
| }
| )
| if (code === 0) {
| this.$message.success('操作成功')
| this.$refs.crud.clearSelection()
| }
| } catch (e) {
| return false
| }
| },
| },
| ],
| },
| }
| },
| head() {
| return {
| title: '影视作品内容管理',
| }
| },
| methods: {
| formatterImage(row) {
| if (row.coverUrl) {
| // 使用第三方镜像服务(示例)
| const proxyUrl = `https://images.weserv.nl/?url=${encodeURIComponent(row.coverUrl)}`;
| return <el-bus-image src={proxyUrl} preview-src-list={[proxyUrl]} style="width:150px" />
| }
| return '无封面';
| }
| },
| }
| </script>
|
| <style lang="scss" scoped>
| ::v-deep {
| .el-upload {
| &-list__item {
| width: 345px;
| height: 128px;
| }
| &.el-upload--picture-card {
| width: 345px;
| height: 128px;
| }
| }
| }
| </style>
|
|