Commit dbcffb2f by Lyan

零售新增图片资讯

parent 70ecdeb1
......@@ -39,54 +39,6 @@ const mainRoutes = {
{ path: '/demo-echarts', component: _import('demo/echarts'), name: 'demo-echarts', meta: { title: 'demo-echarts', isTab: true } },
{ path: '/demo-ueditor', component: _import('demo/ueditor'), name: 'demo-ueditor', meta: { title: 'demo-ueditor', isTab: true } }
// { path: '/picture-add', component: _import('modules/info/picture-add-or-update'), name: 'picture-add', meta: { title: '图片资讯添加', isTab: true } },
// { path: '/picture-update', component: _import('modules/info/picture-add-or-update'), name: 'picture-update', meta: { title: '图片资讯编辑', isTab: true } },
// { path: '/picture-info', component: _import('modules/info/picture-add-or-update'), name: 'picture-info', meta: { title: '图片资讯详情', isTab: true } },
// { path: '/news-add', component: _import('modules/info/news-add-or-update'), name: 'news-add', meta: { title: '文章添加', isTab: true } },
// { path: '/news-update', component: _import('modules/info/news-add-or-update'), name: 'news-update', meta: { title: '文章编辑', isTab: true } },
// { path: '/news-info', component: _import('modules/info/news-add-or-update'), name: 'news-info', meta: { title: '文章详情', isTab: true } },
// { path: '/indexcarouselmanage-add', component: _import('modules/info/indexcarouselmanage-add-or-update'), name: 'indexcarouselmanage-add', meta: { title: '首页轮播添加', isTab: true } },
// { path: '/indexcarouselmanage-update', component: _import('modules/info/indexcarouselmanage-add-or-update'), name: 'indexcarouselmanage-update', meta: { title: '首页轮播编辑', isTab: true } },
// { path: '/indexcarouselmanage-info', component: _import('modules/info/indexcarouselmanage-add-or-update'), name: 'indexcarouselmanage-info', meta: { title: '首页轮播详情', isTab: true } },
// { path: '/newtopic-add', component: _import('modules/info/newtopic-add-or-update'), name: 'newtopic-add', meta: { title: '深度专题添加', isTab: true } },
// { path: '/newtopic-update', component: _import('modules/info/newtopic-add-or-update'), name: 'newtopic-update', meta: { title: '深度专题编辑', isTab: true } },
// { path: '/newtopic-info', component: _import('modules/info/newtopic-add-or-update'), name: 'newtopic-info', meta: { title: '深度专题详情', isTab: true } },
// { path: '/newsmovie-add', component: _import('modules/info/newsmovie-add-or-update'), name: 'newsmovie-add', meta: { title: '视频添加', isTab: true } },
// { path: '/newsmovie-update', component: _import('modules/info/newsmovie-add-or-update'), name: 'newsmovie-update', meta: { title: '视频编辑', isTab: true } },
// { path: '/newsmovie-info', component: _import('modules/info/newsmovie-add-or-update'), name: 'newsmovie-info', meta: { title: '视频详情', isTab: true } },
// { path: '/medical-add', component: _import('modules/medical/medical-add-or-update'), name: 'medical-add', meta: { title: '医疗添加', isTab: true } },
// { path: '/medical-update', component: _import('modules/medical/medical-add-or-update'), name: 'medical-update', meta: { title: '医疗编辑', isTab: true } },
// { path: '/medical-info', component: _import('modules/medical/medical-add-or-update'), name: 'medical-info', meta: { title: '医疗详情', isTab: true } },
// { path: '/logistics-add', component: _import('modules/logistics/logistics-add-or-update'), name: 'logistics-add', meta: { title: '物流添加', isTab: true } },
// { path: '/logistics-update', component: _import('modules/logistics/logistics-add-or-update'), name: 'logistics-update', meta: { title: '物流编辑', isTab: true } },
// { path: '/logistics-info', component: _import('modules/logistics/logistics-add-or-update'), name: 'logistics-info', meta: { title: '物流详情', isTab: true } },
// { path: '/center-add', component: _import('modules/party/center-add-or-update'), name: 'center-add', meta: { title: '中央和总局精神添加', isTab: true } },
// { path: '/center-update', component: _import('modules/party/center-add-or-update'), name: 'center-update', meta: { title: '中央和总局精神编辑', isTab: true } },
// { path: '/center-info', component: _import('modules/party/center-add-or-update'), name: 'center-info', meta: { title: '中央和总局精神详情', isTab: true } },
// { path: '/topicnews-add', component: _import('modules/party/topicnews-add-or-update'), name: 'topicnews-add', meta: { title: '活动报道添加', isTab: true } },
// { path: '/topicnews-update', component: _import('modules/party/topicnews-add-or-update'), name: 'topicnews-update', meta: { title: '活动报道编辑', isTab: true } },
// { path: '/topicnews-info', component: _import('modules/party/topicnews-add-or-update'), name: 'topicnews-info', meta: { title: '活动报道详情', isTab: true } },
// { path: '/rules-add', component: _import('modules/party/rules-add-or-update'), name: 'rules-add', meta: { title: '规章制度添加', isTab: true } },
// { path: '/rules-update', component: _import('modules/party/rules-add-or-update'), name: 'rules-update', meta: { title: '规章制度编辑', isTab: true } },
// { path: '/rules-info', component: _import('modules/party/rules-add-or-update'), name: 'rules-info', meta: { title: '规章制度详情', isTab: true } },
// { path: '/hotFlow-add', component: _import('modules/party/hotFlow-add-or-update'), name: 'hotFlow-add', meta: { title: '热点关注添加', isTab: true } },
// { path: '/hotFlow-update', component: _import('modules/party/hotFlow-add-or-update'), name: 'hotFlow-update', meta: { title: '热点关注编辑', isTab: true } },
// { path: '/hotFlow-info', component: _import('modules/party/hotFlow-add-or-update'), name: 'hotFlow-info', meta: { title: '热点关注详情', isTab: true } },
// { path: '/policy-add', component: _import('modules/policy/policy-add-or-update'), name: 'policy-add', meta: { title: '政策法规添加', isTab: true } },
// { path: '/policy-update', component: _import('modules/policy/policy-add-or-update'), name: 'policy-update', meta: { title: '政策法规编辑', isTab: true } },
// { path: '/policy-info', component: _import('modules/policy/policy-add-or-update'), name: 'policy-info', meta: { title: '政策法规详情', isTab: true } }
],
beforeEnter (to, from, next) {
// let token = Vue.cookie.get('token')
......
......@@ -239,13 +239,7 @@ export default {
})
},
showMsg (data) {
if (!data.jumppath || data.jumppath === null) {
window.open(this.$store.state.config.urls + '/News/msg?id=' + data.pictureid, '_blank')
} else if (/^\//.test(data.jumppath)) {
window.open(this.$store.state.config.urls + data.jumppath, '_blank')
} else {
window.open(data.jumppath, '_blank')
}
window.open(`${this.$store.state.config.urls}/home?pictureId=${data.pictureid}`, '_blank')
},
// 删除
......
<template>
<el-dialog
:title="!dataForm.pictureid ? '新增' : this.showInfo?'详情':'修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form
:model='dataForm'
:rules='dataRule'
ref='dataForm'
@keyup.enter.native='dataFormSubmit()'
label-width='100px'
>
<el-form-item label='标题:' prop='title'>
<el-input v-model='dataForm.title' placeholder='请输入标题' v-show="!showInfo"></el-input>
<p v-show="showInfo">{{dataForm.title}}</p>
</el-form-item>
<el-form-item label='类别:' prop='pictureType'>
<el-select v-model="dataForm.pictureType" placeholder="请选择类别" v-show="!showInfo">
<el-option
v-for="item in pictureTypeList"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<p v-show="showInfo">{{dataForm.pictureType}}</p>
</el-form-item>
<el-form-item label='级别:' prop='piclevel'>
<el-select v-model="dataForm.piclevel" placeholder="请输入级别" v-show="!showInfo">
<el-option
v-for="item in piclevelList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
<p v-show="showInfo">{{dataForm.piclevel}}</p>
</el-form-item>
<el-form-item label='显示时间:' prop='showtime' class="setdes">
<el-row v-show="!showInfo">
<el-col :span="22">
<el-date-picker
v-show="!showInfo"
v-model="dataForm.showtime"
value-format='yyyy-MM-dd'
type="date"
placeholder="选择日期">
</el-date-picker>
</el-col>
<el-col :span="2" class="icon-list__tips">
<el-tooltip placement="top" effect="light">
<div slot="content">时间格式为:xxxx/xx/xx</div>
<i class="el-icon-warning"></i>
</el-tooltip>
</el-col>
</el-row>
<p v-show="showInfo">{{dataForm.showtime}}</p>
</el-form-item>
<el-form-item label='关键字:' prop='keyword'>
<el-input v-model='dataForm.keyword' placeholder='请输入关键字' v-show="!showInfo"></el-input>
<p v-show="showInfo">{{dataForm.keyword}}</p>
</el-form-item>
<el-form-item label='跳转:' prop='jumppath'>
<el-input v-model='dataForm.jumppath' placeholder='请输入跳转' v-show="!showInfo"></el-input>
<p v-show="showInfo">{{dataForm.jumppath}}</p>
</el-form-item>
<el-form-item label='图片:' prop='picFile' class="pic">
<el-upload
v-show="!showInfo"
class="avatar-uploader avatar2"
action=""
:show-file-list="false"
:http-request="Upload"
:before-upload="beforeAvatarUpload">
<img v-if="dialogVisible" :src="imgUrlStr" class="">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
<p><img :src="imgUrlStr" class="avatar2" v-show="showInfo"></p>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer" v-show="!showInfo">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
loading: false,
visible: false,
showInfo: false,
title: '',
dataForm: {
pictureid: 0,
title: '',
pictureType: '',
picFile: '',
editor: '',
piclevel: '',
status: '',
keyword: '',
jumppath: '',
showtime: ''
},
piclevelList: [1, 2, 3, 4, 5, 6, 7, 8, 9],
pictureTypeList: [
{
value: '图片信息',
label: '图片信息'
},
{
value: '静态页面图片',
label: '静态页面图片'
},
{
value: '不合格样本图片',
label: '不合格样本图片'
}
],
dataRule: {
title: [
{
required: true,
message: '不能为空',
trigger: 'blur'
}
],
pictureType: [
{
required: true,
message: '不能为空',
trigger: 'blur'
}
],
// picFile: [
// {
// required: true,
// message: '不能为空',
// trigger: 'blur'
// }
// ],
editor: [
{
required: true,
message: '不能为空',
trigger: 'blur'
}
],
piclevel: [
{
required: true,
message: '不能为空',
trigger: 'blur'
}
],
status: [
{
required: true,
message: '不能为空',
trigger: 'blur'
}
],
keyword: [
{
required: true,
message: '不能为空',
trigger: 'blur'
}
],
// jumppath: [
// {
// required: true,
// message: '不能为空',
// trigger: 'blur'
// }
// ],
showtime: [
{
required: true,
message: '不能为空',
trigger: 'blur'
}
]
},
imgUrl: new FormData(),
imgUrlStr: '',
dialogVisible: false
}
},
created () {
},
methods: {
init (pictureid, showInfo) {
this.dataForm.pictureid = pictureid || 0
this.visible = true
this.showInfo = showInfo
this.$nextTick(() => {
this.clearInp()
if (this.dataForm.pictureid) {
this.loading = true
this.$http({
url: this.$http.adornUrl(
`/office/retailpicture/info/${this.dataForm.pictureid}`
),
method: 'get',
params: this.$http.adornParams()
}).then(({ data }) => {
this.loading = false
if (data && data.code === 0) {
this.dataForm.title = data.picture.title
this.dataForm.pictureType = data.picture.pictureType
this.dataForm.picFile = data.picture.picFile
this.imgUrlStr = data.picture.picFile
this.dialogVisible = true
this.dataForm.inputdate = data.picture.inputdate
this.dataForm.piclevel = data.picture.piclevel
this.dataForm.keyword = data.picture.keyword
this.dataForm.jumppath = data.picture.jumppath
this.dataForm.showtime = data.picture.showtime
} else {
this.$message.error(data.msg)
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.loading = true
this.$refs['dataForm'].validate(valid => {
if (valid) {
if (this.dataForm.picFile === '' || this.dataForm.picFile === null) {
this.$message.error('图片未上传,请上传图片!')
return
}
this.$http({
url: this.$http.adornUrl(
`/office/retailpicture/${!this.dataForm.pictureid ? 'save' : 'update'}`
),
method: 'post',
data: this.$http.adornData({
pictureid: this.dataForm.pictureid || undefined,
title: this.dataForm.title,
pictureType: this.dataForm.pictureType,
picFile: this.dataForm.picFile,
piclevel: this.dataForm.piclevel,
keyword: this.dataForm.keyword,
jumppath: this.dataForm.jumppath,
showtime: this.dataForm.showtime
})
}).then(({ data }) => {
this.loading = false
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
},
// 上传之前校验
beforeAvatarUpload (file) {
this.imgUrl = new FormData()
const isJPG = file.type === 'image/jpeg'
const isPNG = file.type === 'image/png'
const isLt2M = file.size / 1024 / 1024 < 2
if (!isJPG) {
if (!isPNG) {
this.$message.error('上传图片只能是 JPG, PNG 格式!')
return
}
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 2MB!')
return
}
if (file) {
var windowURL = window.URL || window.webkitURL
this.imgUrlStr = windowURL.createObjectURL(file)
this.dialogVisible = true
this.imgUrl.append('file', file)
console.log(this.imgUrl.get('file'))
}
},
Upload () {
this.$http({
url: this.$http.adornUrl('/office/file/uploadFile'),
method: 'post',
data: this.imgUrl,
headers: {
'Content-Type': 'multipart/form-data'
}
})
.then(res => {
console.log(res)
this.dataForm.picFile = res.data.data
}).catch(err => {
console.log(err)
})
},
clearInp () {
this.$refs['dataForm'].resetFields()
this.imgUrlStr = ''
this.dialogVisible = false
}
}
}
</script>
<style scoped>
.icon-list__tips {
font-size: 18px;
text-align: center;
color: #e6a23c;
cursor: pointer;
}
</style>
<template>
<div class="mod-config mod-list-form">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataListSub()" label-width="80px">
<el-form-item label='标题' prop='title'>
<el-input v-model='dataForm.title' placeholder='请输入标题' clearable></el-input>
</el-form-item>
<el-form-item label='编辑' prop='editor'>
<el-input v-model='dataForm.editor' placeholder='请输入编辑' clearable></el-input>
</el-form-item>
<el-form-item label='关键字' prop='keyword'>
<el-input v-model='dataForm.keyword' placeholder='请输入关键字' clearable></el-input>
</el-form-item>
<el-form-item label='状态' prop='status'>
<el-select v-model="dataForm.status" placeholder="请选择状态" clearable>
<el-option
v-for="item in statusList"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label='类别' prop='pictureType'>
<el-select v-model="dataForm.pictureType" placeholder="请选择类别" clearable>
<el-option
v-for="item in pictureTypeList"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label='级别' prop='pictureLevel'>
<el-select v-model="dataForm.pictureLevel" placeholder="请输入级别" clearable>
<el-option
v-for="item in piclevelList"
:key="item.value"
:label="item.name"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label='发布日期' prop='releaseDate'>
<el-date-picker
clearable
v-model="releaseDate"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</el-form-item>
<el-button class="seach-btn" @click="getDataListSub()" type="primary" >搜索</el-button>
</el-form>
<div class="add-btn">
<el-button v-if="isAuth('manage:retailPicture:save')" type="primary" @click="addOrUpdateHandle()"> + 添加</el-button>
<!-- <el-button v-if="isAuth('manage:picture:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button> -->
</div>
<div class="table-list">
<el-table
:data="dataList"
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
border
style="width: 100%; "
>
<el-table-column prop="piclevel" header-align="center" align="center" label="级别"> </el-table-column>
<el-table-column prop="title" header-align="center" align="center" label="标题">
<template slot-scope="scope">
<div>
{{scope.row.title}}
</div>
</template>
</el-table-column>
<el-table-column prop="pictureType" header-align="center" align="center" label="分类"> </el-table-column>
<el-table-column prop="showtime" header-align="center" align="center" sortable label="显示时间"> </el-table-column>
<el-table-column prop="inputdate" header-align="center" align="center" sortable label="发布时间"> </el-table-column>
<el-table-column prop="keyword" header-align="center" align="center" label="关键字"> </el-table-column>
<el-table-column prop="editor" header-align="center" align="center" label="编辑"> </el-table-column>
<el-table-column prop="lasteditor" header-align="center" align="center" label="最后编辑"> </el-table-column>
<el-table-column prop="auditor" header-align="center" align="center" label="审核人"> </el-table-column>
<el-table-column prop="status" header-align="center" align="center" label="状态">
<template slot-scope="scope">
<div>
<span v-if="scope.row.status === 0">待审核</span>
<span v-if="scope.row.status === -1">失败</span>
<span v-if="scope.row.status === 1">成功</span>
</div>
</template>
</el-table-column>
<el-table-column fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button v-if="isAuth('manage:retailPicture:check')" type="text" size="small" @click="checkHandle(scope.row.pictureid,1)">[成功]</el-button>
<el-button v-if="isAuth('manage:retailPicture:check')" type="text" size="small" @click="checkHandle(scope.row.pictureid,-1)">[失败]</el-button>
<br v-if="isAuth('manage:retailPicture:check')" />
<el-button v-if="isAuth('manage:retailPicture:info')" type="text" size="small" @click="showMsg(scope.row)">预览</el-button>
<el-button v-if="isAuth('manage:retailPicture:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.pictureid)">修改</el-button>
<el-button v-if="isAuth('manage:retailPicture:delete')" type="text" size="small" @click="deleteHandle(scope.row.pictureid)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</div>
</template>
<script>
import { piclevelList } from '@/utils'
import AddOrUpdate from './picture-add-or-update'
export default {
data () {
return {
addOrUpdateVisible: false,
dataForm: {
title: '',
pictureLevel: null,
editor: '',
keyword: '',
status: '',
pictureType: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
statusList: [
{
value: '0',
label: '待审核'
},
{
value: '-1',
label: '失败'
},
{
value: '1',
label: '成功'
}
],
piclevelList,
pictureTypeList: [
{
value: '图片信息',
label: '图片信息'
},
{
value: '静态页面图片',
label: '静态页面图片'
},
{
value: '不合格样本图片',
label: '不合格样本图片'
}
],
releaseDate: []
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
getDataListSub () {
this.pageIndex = 1
this.getDataList()
},
// 获取数据列表
getDataList () {
console.log(this.releaseDate)
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/office/retailpicture/list'),
method: 'post',
data: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'title': this.dataForm.title,
'pictureLevel': this.dataForm.pictureLevel,
'editor': this.dataForm.editor,
'keyword': this.dataForm.keyword,
'status': this.dataForm.status,
'pictureType': this.dataForm.pictureType,
'inputDateStart': this.releaseDate && this.releaseDate[0] ? this.releaseDate[0] + ' 00:00:00' : '',
'inputDateEnd': this.releaseDate && this.releaseDate[1] ? this.releaseDate[1] + ' 23:59:59' : ''
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.$message.error(data.msg)
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (pictureid, showInfo) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(pictureid, showInfo)
})
},
showMsg (data) {
window.open(this.$store.state.config.urls + '/News/Retail?retailPictureId=' + data.pictureid, '_blank')
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/office/retailpicture/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
}).catch(e => e)
},
// 审核
checkHandle (id, status) {
let str = ''
if (status === 1) {
str = '成功'
} else {
str = '失败'
}
this.$confirm(`确定对[id=${id}]进行['审核${str}']操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/office/retailpicture/verifyPicture'),
method: 'post',
data: this.$http.adornData({
'pictureid': id,
'status': status
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
}).catch(e => e)
}
}
}
</script>
<style scoped>
/*
.el-select-dropdown__item,.el-form-item__label{
font-size: 12px!important;
} */
/* .el-table .cell, .el-table th div {
padding-right: 0;
} */
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment