| | |
| | | </template> |
| | | |
| | | <script> |
| | | import dayjs from 'dayjs' |
| | | import 'dayjs/locale/zh-cn' |
| | | dayjs.locale('zh-cn') |
| | | export default { |
| | | data() { |
| | | const currentDate = this.$elBusUtil.toDate(new Date()) |
| | | return { |
| | | tableConfig: { |
| | | url: 'flower/api/filmWorks/list', |
| | |
| | | { label: '封面图片描述', prop: 'coverAlt', minWidth: 120 }, |
| | | { label: '用户类型', prop: 'userTypeStr' }, |
| | | { label: '置顶权重', prop: 'stickyWeight' , minWidth: 80 }, |
| | | { label: '状态', prop: 'statusStr' , minWidth: 80 }, |
| | | { label: '发布状态', prop: 'statusStr' , minWidth: 80 }, |
| | | { label: '收藏量', prop: 'collectCount' , minWidth: 80 }, |
| | | { label: '点赞量', prop: 'likeCount', minWidth: 80 }, |
| | | { label: '评论量', prop: 'commentCount', minWidth: 80 }, |
| | |
| | | items: [ |
| | | { label: '中文名称', id: 'nameCn', type: 'input' }, |
| | | { label: '英文名称', id: 'nameEn', type: 'input' }, |
| | | { label: '作品类型', id: 'type', type: 'input' }, |
| | | { |
| | | label: '作品类型', |
| | | id: 'type', |
| | | type: 'bus-select-dict', |
| | | el: { |
| | | code: 'FILMSET_TYPE', |
| | | style: 'width:100%', |
| | | clearable: true, |
| | | }, |
| | | }, |
| | | { label: '上映年份', id: 'releaseYear', type: 'input' }, |
| | | { |
| | | label: '用户类型', |
| | | id: 'userType', |
| | | type: 'bus-select-dict', |
| | | el: { |
| | | code: 'FILMSET_CREATE_TYPE', |
| | | style: 'width:100%', |
| | | clearable: true, |
| | | }, |
| | | }, |
| | | { |
| | | label: '发布状态', |
| | | id: 'status', |
| | | type: 'bus-select-dict', |
| | | el: { |
| | | code: 'COMMON_PUBLISH_STATUS', |
| | | style: 'width:100%', |
| | | clearable: true, |
| | | }, |
| | | }, |
| | | { |
| | | label: '创建日期', |
| | | id: 'createDateBeginStr', |
| | |
| | | commonFormat: true, |
| | | commonFormatProps: ['createDateBeginStr', 'createDateEndStr'], |
| | | customClass: 'in-bus-form', |
| | | default: [currentDate, currentDate], |
| | | }, |
| | | ], |
| | | }, |
| | |
| | | trigger: 'blur', |
| | | }, |
| | | }, |
| | | { |
| | | label: '取景地图片:', |
| | | id: 'filmPictures', |
| | | component: 'el-bus-upload', |
| | | el: { |
| | | listType: 'picture-card', |
| | | }, |
| | | forceDisabled: true, |
| | | commonFormat: true, |
| | | span: 24, |
| | | // rules: { required: true, message: '请上传取景地对应的图片' }, |
| | | }, |
| | | { |
| | | label: '取景地内容:', |
| | | id: 'filmContent', |
| | | component: 'base-editor', |
| | | richText: true, |
| | | rules: { required: true, message: '请输入取景地内容', trigger: 'blur' }, |
| | | }, |
| | | { |
| | | label: '封面主题:', |
| | | id: 'coverTitle', |
| | | type: 'input', |
| | | rules: { |
| | | required: true, |
| | | message: '请输入剧情关键词', |
| | | trigger: 'blur', |
| | | }, |
| | | }, |
| | | { |
| | | label: '标签:', |
| | | id: 'tag', |
| | | type: 'input', |
| | | rules: { |
| | | required: true, |
| | | message: '请输入剧情关键词', |
| | | trigger: 'blur', |
| | | }, |
| | | }, |
| | | ], |
| | | extraButtons: [ |
| | | { |
| | | text: (row) => (row.status === 'unpublished' ? '发布' : '下架'), |
| | | text: (row) => (row.status === 'unpublished' || row.status === 'approved' ? '发布' : '下架'), |
| | | atClick: async (row) => { |
| | | const action = row.status === 'unpublished' ? '发布' : '下架' |
| | | const action = row.status === 'unpublished' || row.status === 'approved' ? '发布' : '下架' |
| | | try { |
| | | await this.$elBusUtil.confirm(`确定要${action}吗?`) |
| | | const { code } = await this.$elBusHttp.request( |
| | |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | text: '置顶', |
| | | atClick: async (row) => { |
| | | try { |
| | | await this.$elBusUtil.confirm(`确定要置顶吗?`) |
| | | const { code } = await this.$elBusHttp.request( |
| | | 'flower/api/filmWorks/setTop', |
| | | { params: { id: row.id } } |
| | | ) |
| | | if (code === 0) { |
| | | this.$message.success(`置顶成功`) |
| | | } |
| | | } catch (e) { |
| | | return false |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | text: '清除权重', |
| | | atClick: async (row) => { |
| | | try { |
| | | await this.$elBusUtil.confirm(`确定要清除权重吗?`) |
| | | const { code } = await this.$elBusHttp.request( |
| | | 'flower/api/filmWorks/setDown', |
| | | { params: { id: row.id } } |
| | | ) |
| | | if (code === 0) { |
| | | this.$message.success(`清除权重成功`) |
| | | } |
| | | } catch (e) { |
| | | return false |
| | | } |
| | | }, |
| | | }, |
| | | ], |
| | | headerButtons: [ |
| | | { |
| | | text: '批量发布', |
| | | type: 'primary', |
| | | disabled: (selected) => |
| | | selected.filter((item) => item.status === 'unpublished') |
| | | selected.filter((item) => item.status === 'unpublished' || item.status === 'approved') |
| | | .length === 0, |
| | | atClick: async (selected) => { |
| | | const selectedNotice = selected.filter( |
| | | (item) => item.status === 'unpublished' |
| | | (item) => item.status === 'unpublished' || item.status === 'approved' |
| | | ) |
| | | try { |
| | | await this.$elBusUtil.confirm( |
| | |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | text: '批量通过', |
| | | type: 'primary', |
| | | disabled: (selected) => |
| | | selected.filter((item) => item.status === 'pending_review' || item.status === 'rejected') |
| | | .length === 0, |
| | | atClick: async (selected) => { |
| | | const selectedNotice = selected.filter( |
| | | (item) => item.status === 'pending_review' || item.status === 'rejected' |
| | | ) |
| | | try { |
| | | await this.$elBusUtil.confirm( |
| | | `确定要批量通过这${selectedNotice.length}个片场内容吗?` |
| | | ) |
| | | const { code } = await this.$elBusHttp.request( |
| | | 'flower/api/filmWorks/approved/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: 'primary', |
| | | disabled: (selected) => |
| | | selected.filter((item) => item.status === 'approved' || item.status === 'pending_review') |
| | | .length === 0, |
| | | atClick: async (selected) => { |
| | | const selectedNotice = selected.filter( |
| | | (item) => item.status === 'approved' || item.status === 'pending_review' |
| | | ) |
| | | try { |
| | | await this.$elBusUtil.confirm( |
| | | `确定要批量驳回这${selectedNotice.length}个片场内容吗?` |
| | | ) |
| | | const { code } = await this.$elBusHttp.request( |
| | | 'flower/api/filmWorks/rejected/batch', |
| | | { |
| | | method: 'post', |
| | | data: { |
| | | ids: selected.map((item) => item.id), |
| | | }, |
| | | } |
| | | ) |
| | | if (code === 0) { |
| | | this.$message.success('操作成功') |
| | | this.$refs.crud.clearSelection() |
| | | } |
| | | } catch (e) { |
| | | return false |
| | | } |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | } |
对比新文件 |
| | |
| | | <template> |
| | | <el-bus-crud ref="crud" v-bind="tableConfig" /> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | tableConfig: { |
| | | url: 'flower/api/home/homeConfig/list', |
| | | newUrl: 'flower/api/home/homeConfig/new', |
| | | editUrl: 'flower/api/home/homeConfig/edit', |
| | | deleteUrl: 'flower/api/home/homeConfig/delete', |
| | | dialogNeedRequest: true, |
| | | persistSelection: true, |
| | | columns: [ |
| | | { type: 'selection' }, |
| | | { label: '主标题', prop: 'mainTitle' }, |
| | | { label: '副标题', prop: 'subTitle' }, |
| | | { label: '按钮1文本', prop: 'btnText1' }, |
| | | { label: '按钮2文本', prop: 'btnText2' }, |
| | | { label: '按钮1图标', prop: 'btnIcon1' }, |
| | | { label: '按钮2图标', prop: 'btnIcon2' }, |
| | | { label: '图标1颜色', prop: 'iconColor1' }, |
| | | { label: '图标2颜色', prop: 'iconColor2' }, |
| | | { label: '动作类型', prop: 'actionType' }, |
| | | { label: '动作目标', prop: 'actionTarget' }, |
| | | { label: '状态', prop: 'statusStr' }, |
| | | { label: '版本号', prop: 'version' }, |
| | | ], |
| | | searchForm: [ |
| | | { |
| | | type: 'row', |
| | | items: [ |
| | | { label: '主标题', id: 'mainTitle', type: 'input' }, |
| | | { label: '版本号', id: 'version', type: 'input' }, |
| | | ], |
| | | }, |
| | | ], |
| | | form: [ |
| | | { |
| | | label: '主标题:', |
| | | id: 'mainTitle', |
| | | type: 'input', |
| | | rules: { |
| | | required: true, |
| | | message: '请输入标题', |
| | | trigger: 'blur', |
| | | }, |
| | | }, |
| | | { |
| | | label: '副标题:', |
| | | id: 'subTitle', |
| | | type: 'input', |
| | | rules: { |
| | | required: true, |
| | | message: '请输入副标题', |
| | | trigger: 'blur', |
| | | }, |
| | | }, |
| | | { |
| | | label: '按钮1文本:', |
| | | id: 'btnText1', |
| | | type: 'input', |
| | | rules: { |
| | | required: true, |
| | | message: '请输入按钮1文本', |
| | | trigger: 'blur', |
| | | }, |
| | | },{ |
| | | label: '按钮2文本:', |
| | | id: 'btnText2', |
| | | type: 'input', |
| | | rules: { |
| | | required: true, |
| | | message: '请输入按钮2文本', |
| | | trigger: 'blur', |
| | | }, |
| | | },{ |
| | | label: '按钮1图标:', |
| | | id: 'btnIcon1', |
| | | type: 'input', |
| | | rules: { |
| | | required: true, |
| | | message: '请输入按钮1图标', |
| | | trigger: 'blur', |
| | | }, |
| | | },{ |
| | | label: '按钮2图标:', |
| | | id: 'btnIcon2', |
| | | type: 'input', |
| | | rules: { |
| | | required: true, |
| | | message: '请输入按钮2图标', |
| | | trigger: 'blur', |
| | | }, |
| | | },{ |
| | | label: '图标1颜色:', |
| | | id: 'iconColor1', |
| | | type: 'input', |
| | | rules: { |
| | | required: true, |
| | | message: '请输入图标1颜色', |
| | | trigger: 'blur', |
| | | }, |
| | | },{ |
| | | label: '图标2颜色:', |
| | | id: 'iconColor2', |
| | | type: 'input', |
| | | rules: { |
| | | required: true, |
| | | message: '请输入图标2颜色', |
| | | trigger: 'blur', |
| | | }, |
| | | },{ |
| | | label: '动作类型:', |
| | | id: 'actionType', |
| | | type: 'input', |
| | | rules: { |
| | | required: true, |
| | | message: '请输入动作类型', |
| | | trigger: 'blur', |
| | | }, |
| | | },{ |
| | | label: '动作目标:', |
| | | id: 'actionTarget', |
| | | type: 'input', |
| | | rules: { |
| | | required: true, |
| | | message: '请输入动作目标', |
| | | trigger: 'blur', |
| | | }, |
| | | },{ |
| | | label: '版本号:', |
| | | id: 'version', |
| | | 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/home/homeConfig/changeStatus', |
| | | { params: { id: row.id } } |
| | | ) |
| | | if (code === 0) { |
| | | this.$message.success(`${action}成功`) |
| | | } |
| | | } catch (e) { |
| | | return false |
| | | } |
| | | }, |
| | | }, |
| | | ], |
| | | headerButtons: [ |
| | | { |
| | | 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/announcement/page/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: '主页配置管理', |
| | | } |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | ::v-deep { |
| | | .el-upload { |
| | | &-list__item { |
| | | width: 345px; |
| | | height: 128px; |
| | | } |
| | | &.el-upload--picture-card { |
| | | width: 345px; |
| | | height: 128px; |
| | | } |
| | | } |
| | | } |
| | | </style> |