|
|
@ -7,22 +7,25 @@ |
|
|
|
<p>通知列表</p> |
|
|
|
<el-card class="box-card" style="padding: 20px;"> |
|
|
|
<el-table |
|
|
|
ref="table" |
|
|
|
:data="tableData" |
|
|
|
style="width: 100%" |
|
|
|
max-height="360" |
|
|
|
@selection-change="selectionChangeHandler" |
|
|
|
@row-click="clickRowHandler" |
|
|
|
> |
|
|
|
<el-table-column type="selection" align="center" width="55" /> |
|
|
|
<el-table-column prop="name" label="标题" width="200" /> |
|
|
|
<el-table-column prop="title" label="标题" width="200" /> |
|
|
|
<el-table-column prop="startTime" label="开始时间" width="200" /> |
|
|
|
<el-table-column prop="endTime" label="结束时间" width="200" /> |
|
|
|
<el-table-column fixed="right" label="操作" width="100"> |
|
|
|
<template> |
|
|
|
<!-- slot-scope="scope" --> |
|
|
|
<el-button style="padding: 5px 6px !important;"><i class="iconfont icon-bianji" />编辑</el-button> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button style="padding: 5px 6px !important;" @click="initForm('notice','edit',scope.row)"><i class="iconfont icon-bianji" />编辑</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<el-pagination |
|
|
|
v-if="tableData.length !== 0" |
|
|
|
style="margin: 34px 0 10px 0 !important;" |
|
|
|
:current-page="page.page" |
|
|
|
:total="page.total" |
|
|
@ -35,11 +38,11 @@ |
|
|
|
</el-card> |
|
|
|
<!-- @click="toDelete(crud.selections)" --> |
|
|
|
<div style="display: flex; flex-direction: column; justify-content: flex-start; margin-left: 15px;"> |
|
|
|
<el-button size="mini" @click="noticeDialogVisible=true"> |
|
|
|
<el-button size="mini" @click="initForm('notice','add')"> |
|
|
|
<i class="iconfont icon-xinzeng" /> |
|
|
|
新增 |
|
|
|
</el-button> |
|
|
|
<el-button size="mini" style="margin-left: 0; margin-top: 14px;"> |
|
|
|
<el-button :loading="deleteLoading" :disabled="selections.length === 0" size="mini" style="margin-left: 0; margin-top: 14px;" @click="toDelete('notice',selections)"> |
|
|
|
<i class="iconfont icon-shanchu" /> |
|
|
|
删除 |
|
|
|
</el-button> |
|
|
@ -55,22 +58,25 @@ |
|
|
|
<p>视频列表</p> |
|
|
|
<el-card class="box-card" style="padding: 20px;"> |
|
|
|
<el-table |
|
|
|
ref="videoTable" |
|
|
|
:data="videoTableData" |
|
|
|
style="width: 100%" |
|
|
|
max-height="360" |
|
|
|
@selection-change="selectionVideoChangeHandler" |
|
|
|
@row-click="clickVideoRowHandler" |
|
|
|
> |
|
|
|
<el-table-column type="selection" align="center" width="55" /> |
|
|
|
<el-table-column prop="name" label="标题" width="200" /> |
|
|
|
<el-table-column prop="startTime" label="开始时间" width="200" /> |
|
|
|
<el-table-column prop="endTime" label="结束时间" width="200" /> |
|
|
|
<el-table-column fixed="right" label="操作" width="100"> |
|
|
|
<template> |
|
|
|
<!-- slot-scope="scope" --> |
|
|
|
<el-button style="padding: 5px 6px !important;"><i class="iconfont icon-bianji" />编辑</el-button> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button style="padding: 5px 6px !important;" @click="initForm('video','edit',scope.row)"><i class="iconfont icon-bianji" />编辑</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<el-pagination |
|
|
|
v-if="videoTableData.length !== 0" |
|
|
|
style="margin: 34px 0 10px 0 !important;" |
|
|
|
:current-page="videoPage.page" |
|
|
|
:total="videoPage.total" |
|
|
@ -81,13 +87,12 @@ |
|
|
|
@current-change="handleVideoCurrentPage" |
|
|
|
/> |
|
|
|
</el-card> |
|
|
|
<!-- @click="toDelete(crud.selections)" --> |
|
|
|
<div style="display: flex; flex-direction: column; justify-content: flex-start; margin-left: 15px;"> |
|
|
|
<el-button size="mini" @click="videoDialogVisible=true"> |
|
|
|
<el-button size="mini" @click="initForm('video','add')"> |
|
|
|
<i class="iconfont icon-xinzeng" /> |
|
|
|
新增 |
|
|
|
</el-button> |
|
|
|
<el-button size="mini" style="margin-left: 0; margin-top: 14px;"> |
|
|
|
<el-button :loading="deleteVideoLoading" :disabled="videoSelections.length === 0" size="mini" style="margin-left: 0; margin-top: 14px;" @click="toDelete('video',videoSelections)"> |
|
|
|
<i class="iconfont icon-shanchu" /> |
|
|
|
删除 |
|
|
|
</el-button> |
|
|
@ -96,7 +101,7 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<el-dialog class="auto-dialog" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :before-close="handleClose" :visible.sync="noticeDialogVisible" title="新增通知"> |
|
|
|
<el-dialog class="auto-dialog" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :before-close="handleClose" :visible.sync="noticeDialogVisible" :title="noticeTitle"> |
|
|
|
<div class="setting-dialog"> |
|
|
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="90px"> |
|
|
|
<div> |
|
|
@ -109,7 +114,13 @@ |
|
|
|
v-model="form.startTime" |
|
|
|
type="datetime" |
|
|
|
placeholder="选择日期时间" |
|
|
|
default-time="12:00:00" |
|
|
|
format="yyyy-MM-dd HH:mm:ss" |
|
|
|
value-format="yyyy-MM-dd HH:mm:ss" |
|
|
|
:picker-options="{ |
|
|
|
disabledDate: (time) =>{ |
|
|
|
return time.getTime() < Date.now() - 8.64e7 |
|
|
|
} |
|
|
|
}" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="结束时间" prop="endTime"> |
|
|
@ -117,12 +128,15 @@ |
|
|
|
v-model="form.endTime" |
|
|
|
type="datetime" |
|
|
|
placeholder="选择日期时间" |
|
|
|
default-time="12:00:00" |
|
|
|
:picker-options="endPickerOptions" |
|
|
|
format="yyyy-MM-dd HH:mm:ss" |
|
|
|
value-format="yyyy-MM-dd HH:mm:ss" |
|
|
|
default-time="['23:59:59']" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<div> |
|
|
|
<el-form-item label="通知内容" prop="remarks"> |
|
|
|
<el-input v-model="form.remarks" type="textarea" rows="5" placeholder="请输入" style="width: 586px;" /> |
|
|
|
<el-form-item label="通知内容" prop="context"> |
|
|
|
<el-input v-model="form.context" type="textarea" rows="5" placeholder="请输入" style="width: 586px;" /> |
|
|
|
</el-form-item> |
|
|
|
</div> |
|
|
|
</el-form> |
|
|
@ -133,7 +147,7 @@ |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<el-dialog class="auto-dialog" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :before-close="handleClose" :visible.sync="videoDialogVisible" title="新增宣传视频"> |
|
|
|
<el-dialog class="auto-dialog" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :before-close="handleClose" :visible.sync="videoDialogVisible" :title="videoTitle"> |
|
|
|
<div class="setting-dialog"> |
|
|
|
<el-form ref="videoForm" :inline="true" :model="videoForm" :rules="rules" size="small" label-width="90px"> |
|
|
|
<div> |
|
|
@ -146,7 +160,8 @@ |
|
|
|
v-model="videoForm.startTime" |
|
|
|
type="datetime" |
|
|
|
placeholder="选择日期时间" |
|
|
|
default-time="12:00:00" |
|
|
|
format="yyyy-MM-dd HH:mm:ss" |
|
|
|
value-format="yyyy-MM-dd HH:mm:ss" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="结束时间" prop="endTime"> |
|
|
@ -154,7 +169,9 @@ |
|
|
|
v-model="videoForm.endTime" |
|
|
|
type="datetime" |
|
|
|
placeholder="选择日期时间" |
|
|
|
default-time="12:00:00" |
|
|
|
format="yyyy-MM-dd HH:mm:ss" |
|
|
|
value-format="yyyy-MM-dd HH:mm:ss" |
|
|
|
default-time="['23:59:59']" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<div> |
|
|
@ -179,7 +196,7 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { FetchInitScreenNotice } from '@/api/digitalScreen/index' |
|
|
|
import { FetchInitScreenNotice, FetchEditScreenNotice, FetchDeleteScreenNotice } from '@/api/digitalScreen/index' |
|
|
|
import { mapGetters } from 'vuex' |
|
|
|
|
|
|
|
export default { |
|
|
@ -188,10 +205,11 @@ export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
btnLoading: false, |
|
|
|
tableData: [ |
|
|
|
{ name: 'XXXX通知', startTime: '2025-05-01 10:05:00', endTime: '2025-05-01 10:05:00' }, |
|
|
|
{ name: 'XXXX通知', startTime: '2025-05-01 10:05:00', endTime: '2025-05-01 10:05:00' } |
|
|
|
], |
|
|
|
deleteLoading: false, |
|
|
|
formType: '', |
|
|
|
noticeTitle: '新增通知', |
|
|
|
tableData: [], |
|
|
|
selections: [], |
|
|
|
page: { |
|
|
|
page: 0, |
|
|
|
size: 10, |
|
|
@ -202,12 +220,12 @@ export default { |
|
|
|
title: '', |
|
|
|
startTime: '', |
|
|
|
endTime: '', |
|
|
|
remarks: '' |
|
|
|
context: '' |
|
|
|
}, |
|
|
|
videoTableData: [ |
|
|
|
{ name: 'XXXX宣传视频', startTime: '2025-05-01 10:05:00', endTime: '2025-05-01 10:05:00' }, |
|
|
|
{ name: 'XXXX宣传视频', startTime: '2025-05-01 10:05:00', endTime: '2025-05-01 10:05:00' } |
|
|
|
], |
|
|
|
videoTitle: '新增宣传视频', |
|
|
|
deleteVideoLoading: false, |
|
|
|
videoSelections: [], |
|
|
|
videoTableData: [], |
|
|
|
videoDialogVisible: false, |
|
|
|
videoForm: { |
|
|
|
title: '', |
|
|
@ -225,11 +243,33 @@ export default { |
|
|
|
{ required: true, message: '标题不可为空', trigger: 'blur' } |
|
|
|
], |
|
|
|
startTime: [ |
|
|
|
{ required: true, message: '请选择开始时间', trigger: 'change' } |
|
|
|
{ required: true, message: '请选择', trigger: 'change' } |
|
|
|
], |
|
|
|
endTime: [ |
|
|
|
{ required: true, message: '请选择结束时间', trigger: 'change' } |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
validator: (rule, value, callback) => { |
|
|
|
if (!value) { |
|
|
|
callback(new Error('请选择结束时间')) |
|
|
|
} else if (this.form.startTime > value) { |
|
|
|
callback(new Error('开始时间不得大于结束时间')) |
|
|
|
} else { |
|
|
|
callback() |
|
|
|
} |
|
|
|
}, |
|
|
|
trigger: 'change' |
|
|
|
} |
|
|
|
] |
|
|
|
}, |
|
|
|
endPickerOptions: { |
|
|
|
disabledDate: (time) => { |
|
|
|
const startTime = new Date(this.form.startTime).getTime() |
|
|
|
if (startTime) { |
|
|
|
return (time.getTime()) <= startTime - 8.64e7 |
|
|
|
} else { |
|
|
|
return time.getTime() < Date.now() - 8.64e7 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
@ -264,16 +304,153 @@ export default { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
}, |
|
|
|
initScreenVideo() { |
|
|
|
const params = { |
|
|
|
'libcode': this.user.fonds.fondsNo, |
|
|
|
'page': this.videoPage.page, |
|
|
|
'size': this.videoPage.size |
|
|
|
} |
|
|
|
FetchInitScreenNotice(params).then((res) => { |
|
|
|
console.log('videoTableData', res.content) |
|
|
|
if (res.content.length !== 0) { |
|
|
|
this.videoTableData = res.content |
|
|
|
this.videoPage.total = res.totalElements |
|
|
|
} else { |
|
|
|
this.videoTableData = [] |
|
|
|
this.videoPage.total = 0 |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
}, |
|
|
|
initForm(tableType, type, data) { |
|
|
|
this.formType = type |
|
|
|
if (tableType === 'notice') { |
|
|
|
if (type === 'add') { |
|
|
|
this.noticeTitle = '新增通知' |
|
|
|
} else { |
|
|
|
this.noticeTitle = '编辑通知' |
|
|
|
this.form = data |
|
|
|
} |
|
|
|
this.noticeDialogVisible = true |
|
|
|
} else { |
|
|
|
if (type === 'add') { |
|
|
|
this.videoTitle = '新增宣传视频' |
|
|
|
} else { |
|
|
|
this.videoTitle = '编辑宣传视频' |
|
|
|
this.videoForm = data |
|
|
|
} |
|
|
|
this.videoDialogVisible = true |
|
|
|
} |
|
|
|
}, |
|
|
|
handleClose() { |
|
|
|
this.noticeDialogVisible = false |
|
|
|
this.videoDialogVisible = false |
|
|
|
if (this.$refs.form) { |
|
|
|
this.$refs.form.resetFields() |
|
|
|
this.$refs.form.clearValidate() |
|
|
|
} |
|
|
|
this.form = { title: '', startTime: '', endTime: '', context: '' } |
|
|
|
if (this.$refs.videoForm) { |
|
|
|
this.$refs.videoForm.resetFields() |
|
|
|
this.$refs.videoForm.clearValidate() |
|
|
|
} |
|
|
|
this.videoForm = { title: '', startTime: '', endTime: '', videoUrl: '' } |
|
|
|
this.btnLoading = false |
|
|
|
}, |
|
|
|
handleComfired(form) { |
|
|
|
this.$refs[form].validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
console.log(form) |
|
|
|
this.btnLoading = true |
|
|
|
if (form === 'form') { |
|
|
|
this.form.libcode = this.user.fonds.fondsNo |
|
|
|
console.log(this.form) |
|
|
|
FetchEditScreenNotice(this.form).then((res) => { |
|
|
|
if (res.code !== 500) { |
|
|
|
this.$message({ message: this.formType === 'add' ? '新增通知成功' : '编辑通知成功', type: 'success', offset: 8 }) |
|
|
|
this.initScreenNotice() |
|
|
|
} else { |
|
|
|
this.$message({ message: '操作失败', type: 'error', offset: 8 }) |
|
|
|
} |
|
|
|
this.handleClose() |
|
|
|
}).catch(err => { |
|
|
|
console.log(err) |
|
|
|
this.handleClose() |
|
|
|
}) |
|
|
|
} else { |
|
|
|
console.log('宣传视频表单提交') |
|
|
|
} |
|
|
|
} else { |
|
|
|
console.log('error submit!!') |
|
|
|
this.btnLoading = false |
|
|
|
return false |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
toDelete(type, selections) { |
|
|
|
if (type === 'notice') { |
|
|
|
this.deleteLoading = true |
|
|
|
} else { |
|
|
|
this.deleteVideoLoading = true |
|
|
|
} |
|
|
|
this.$confirm(`确定要删除所选的数据吗?`, '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning' |
|
|
|
}).then(() => { |
|
|
|
const ids = [] |
|
|
|
selections.forEach(book => { |
|
|
|
ids.push(book.id) |
|
|
|
}) |
|
|
|
console.log('ids', ids) |
|
|
|
if (type === 'notice') { |
|
|
|
FetchDeleteScreenNotice(ids).then((res) => { |
|
|
|
console.log('res', res) |
|
|
|
if (res.code !== 500) { |
|
|
|
this.$message({ message: '删除成功', type: 'success', offset: 8 }) |
|
|
|
this.initScreenNotice() |
|
|
|
} else { |
|
|
|
this.$message({ message: '删除失败', type: 'error', offset: 8 }) |
|
|
|
} |
|
|
|
this.deleteLoading = false |
|
|
|
}).catch(err => { |
|
|
|
console.log(err) |
|
|
|
this.deleteLoading = false |
|
|
|
}) |
|
|
|
} else { |
|
|
|
console.log('视频列表删除') |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
if (type === 'notice') { |
|
|
|
this.deleteLoading = true |
|
|
|
} else { |
|
|
|
this.deleteVideoLoading = true |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
selectionChangeHandler(val) { |
|
|
|
this.selections = val |
|
|
|
}, |
|
|
|
clickRowHandler(row) { |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.$refs.table.toggleRowSelection(row) |
|
|
|
}, |
|
|
|
selectionVideoChangeHandler(val) { |
|
|
|
this.videoSelections = val |
|
|
|
}, |
|
|
|
clickVideoRowHandler(row) { |
|
|
|
this.$refs.videoTable.clearSelection() |
|
|
|
this.$refs.videoTable.toggleRowSelection(row) |
|
|
|
}, |
|
|
|
handleSizeChange(size) { |
|
|
|
this.page.size = size |
|
|
|
this.page.page = 1 |
|
|
|
this.page.page = 0 |
|
|
|
this.initScreenNotice() |
|
|
|
}, |
|
|
|
handleCurrentPage(val) { |
|
|
|
this.page.page = val |
|
|
|
this.initScreenNotice() |
|
|
|
}, |
|
|
|
handleVideoSizeChange(size) { |
|
|
|
this.videoPage.size = size |
|
|
@ -281,32 +458,6 @@ export default { |
|
|
|
}, |
|
|
|
handleVideoCurrentPage(val) { |
|
|
|
this.videoPage.page = val |
|
|
|
}, |
|
|
|
handleComfired(form) { |
|
|
|
this.$refs[form].validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
this.addBookDialogVisible = false |
|
|
|
// const ids = [] |
|
|
|
// this.selectBookData.forEach(val => { |
|
|
|
// ids.push(val.id) |
|
|
|
// }) |
|
|
|
// const params = { |
|
|
|
// 'gridId': this.selectGridVal.id, |
|
|
|
// 'ids': ids |
|
|
|
// } |
|
|
|
// console.log('params', params) |
|
|
|
// FetchManualShelving(params).then(() => { |
|
|
|
// this.$message({ message: '批量上架成功', type: 'success', offset: 8 }) |
|
|
|
// this.handleCloseDialog() |
|
|
|
// }).catch(err => { |
|
|
|
// console.log(err) |
|
|
|
// this.addBookDialogVisible = false |
|
|
|
// }) |
|
|
|
} else { |
|
|
|
console.log('error submit!!') |
|
|
|
return false |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|