Commit 4bf9f221 authored by zhanglw's avatar zhanglw

内容管理

parent 700e23b0
......@@ -23,6 +23,15 @@ export const HttpReq = {
return res
})
},
deletePicture: function(data) {
return request({
url: '/api/bsw/common/deletePicture',
method: 'delete',
data: data
}).then((res) => {
return res
})
},
// 获取行政区划
findAreaByCodeAndType: function(params) {
return request({
......@@ -317,7 +326,7 @@ export const HttpReq = {
})
},
// 内容管理-首页管理批量删除
batchDelete: function(data) {
hpBatchDelete: function(data) {
return request({
url: '/api/bsw/homePage/batchDelete',
method: 'delete',
......
......@@ -68,7 +68,14 @@
</el-form-item>
<el-form-item label="供应商名称:" class="form-cell" prop="supplierName">
<div class="cell-box">
<el-input v-model="formData.supplierName" placeholder="单行输入" class="cell-input" />
<el-autocomplete
v-model="formData.supplierName"
class="cell-input"
:fetch-suggestions="querySearch"
placeholder="单行输入"
:trigger-on-focus="false"
@select="handleSelect"
/>
</div>
</el-form-item>
<el-form-item label="是否设置为钻石供应商:" class="form-cell" prop="diamondSupplier">
......@@ -192,7 +199,7 @@
<div class="cell-box">
<ul class="el-upload-list el-upload-list--picture-card" style="float: left">
<li v-for="(item, index) in imgList" :key="index" tabindex="0" class="el-upload-list__item is-success">
<img :src="imgSrcStart+'/productPic/'+item" class="el-upload-list__item-thumbnail">
<img :src="imgSrcStart+item" class="el-upload-list__item-thumbnail">
<label class="el-upload-list__item-status-label"><i class="el-icon-upload-success el-icon-check" /></label>
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="dialogImgUrl=item;dialogImgVisible=true"><i class="el-icon-zoom-in" /></span>
......@@ -201,21 +208,24 @@
</li>
</ul>
<el-dialog append-to-body :visible.sync="dialogImgVisible">
<img width="100%" :src="imgSrcStart+'/productPic/'+dialogImgUrl">
<img width="100%" :src="imgSrcStart+dialogImgUrl">
</el-dialog>
<el-upload
ref="uploadCom"
action="/api/bsw/product/uploadProductPic"
name="productPic"
action="/api/bsw/common/uploadPicture"
name="multipartFile"
:data="{mark:'logo'}"
list-type="picture-card"
:headers="uploadHeaders"
:limit="5"
:limit="1"
:on-exceed="handleExceed"
:on-success="handleImported"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
>
<i class="el-icon-plus" />
<div slot="trigger" @click="handlePushClick($event)">
<i class="el-icon-plus" />
</div>
</el-upload>
<el-dialog append-to-body :visible.sync="dialogImageVisible">
<img width="100%" :src="dialogImageUrl">
......@@ -315,11 +325,61 @@ export default {
})
},
methods: {
checkEnterpriseName(rule, value, callback) {
this.$nextTick(_ => {
HttpReq.backstageApi.checkEnterpriseName({
name: value, id: this.formData.supplierId
}).then((res) => {
if (res.data) {
callback()
} else {
callback(new Error(res.msg))
}
})
})
},
querySearch(queryString, cb) {
HttpReq.backstageApi.associateQueryEnterpriseName({
name: queryString
}).then((res) => {
cb(res.data)
})
},
handleSelect(item) {
this.formData.supplierId = item.id
},
showView() {
this.visible = true
},
hideView() {
if (this.$refs.uploadCom) {
this.$refs.uploadCom.clearFiles()
}
this.$refs.formViewRef.resetFields()
this.imgList = []
this.formData = {
type: '1',
operationName: '', // 操作名称
channelName: '', // 频道名称
url: '', // 链接
searchType: '', // 搜索类型
content: '', // 内容
supplierId: '', // 供应商id
supplierName: '', // 供应商名称
popularSupplier: '', // 是否热门供应商
diamondSupplier: '', // 是否设置为钻石供应商
productType: '', // 产品分类
productId: '', // 产品ID
productOperationName: '', // 产品运营名称
trustworthyProduct: '', // 是否设置为信得过产品
popularProduct: '', // 是否设置为热门产品
rankingType: '1', // 排行榜类型
partnerName: '', // 合作伙伴名称名称
partnerLogo: '', // 合作伙伴LOGO
linkName: '', // 链接名称
sort: 1, // 顺序
homePageId: null
}
this.visible = false
},
cancelView() {
......@@ -381,33 +441,14 @@ export default {
})
},
loadData(homePageId) {
this.formData = {
type: '1',
operationName: '', // 操作名称
channelName: '', // 频道名称
url: '', // 链接
searchType: '', // 搜索类型
content: '', // 内容
supplierId: '', // 供应商id
supplierName: '', // 供应商名称
popularSupplier: '', // 是否热门供应商
diamondSupplier: '', // 是否设置为钻石供应商
productType: '', // 产品分类
productId: '', // 产品ID
productOperationName: '', // 产品运营名称
trustworthyProduct: '', // 是否设置为信得过产品
popularProduct: '', // 是否设置为热门产品
rankingType: '1', // 排行榜类型
partnerName: '', // 合作伙伴名称名称
partnerLogo: '', // 合作伙伴LOGO
linkName: '', // 链接名称
sort: 1, // 顺序
homePageId: null
}
if (homePageId) {
this.title = '编辑首页内容'
HttpReq.backstageApi.queryHomePageById({ homePageId }).then((res) => {
if (res.code === 200) {
this.formData = Object.assign(this.formData, res.data)
if (this.formData.partnerLogo) {
this.imgList = this.formData.partnerLogo.split(';')
}
} else {
this.$message({
message: res.msg,
......@@ -415,6 +456,8 @@ export default {
})
}
})
} else {
this.title = '添加首页内容'
}
this.showView()
},
......@@ -424,15 +467,24 @@ export default {
type: 'info'
})
},
handlePushClick(event) {
if (this.formData.partnerLogo !== '') {
event.stopPropagation()
this.$message({
message: '超出最大上传数量限制',
type: 'info'
})
}
},
handleRemoveImg(item) {
this.imgList.splice(this.imgList.indexOf(item), 1)
const arr = this.formData.productPic.split(';')
const arr = this.formData.partnerLogo.split(';')
arr.splice(arr.indexOf(item), 1)
this.formData.productPic = arr.join(';')
this.formData.partnerLogo = arr.join(';')
},
handleRemove(file, fileList) {
HttpReq.backstageApi.deleteProductPic({
productPic: file.response.productPic
HttpReq.backstageApi.deletePicture({
multipartFile: file.response.pictures
}).then((res) => {
this.$notify({
title: res.msg,
......@@ -441,9 +493,9 @@ export default {
})
const arr = []
fileList.forEach(item => {
arr.push(item.response.productPic)
arr.push(item.response.pictures)
})
this.formData.productPic = arr.join(';')
this.formData.partnerLogo = arr.join(';')
})
},
handlePictureCardPreview(file) {
......@@ -452,9 +504,9 @@ export default {
},
handleImported(response, file, fileList) {
this.$nextTick(() => {
const arr = this.formData.productPic ? this.formData.productPic.split(';') : []
arr.push(response.productPic)
this.formData.productPic = arr.join(';')
const arr = this.formData.partnerLogo ? this.formData.partnerLogo.split(';') : []
arr.push(response.pictures)
this.formData.partnerLogo = arr.join(';')
this.$notify({
title: '上传成功!',
type: 'success',
......
......@@ -28,6 +28,7 @@
<el-table-column type="index" width="55" label="序号" :index="indexMethod" />
<el-table-column prop="type" label="位置" width="200" :formatter="(row, col, val)=>{return dict.label.home_setting[val]}" />
<el-table-column prop="operationName" label="操作名称" />
<el-table-column prop="sort" label="顺序" width="100" />
<el-table-column label="状态" width="100">
<template slot-scope="scope">
<div :style="'color:'+textColors[scope.row.status]">{{ dict.label.issue_status[scope.row.status] }}</div>
......@@ -47,15 +48,17 @@
<el-pagination :total="total" :current-page="page" :page-size="pageSize" style="margin-top: 8px;" layout="total, prev, pager, next, sizes" @size-change="sizeChange" @current-change="pageChange" />
</div>
<add-page ref="addPage" />
<view-page ref="viewPage" />
</div>
</template>
<script>
import { HttpReq } from '@/api/common'
import DateRangePicker from '@/components/DateRangePicker'
import addPage from './add'
import viewPage from './view'
export default {
components: { DateRangePicker, addPage },
components: { DateRangePicker, addPage, viewPage },
dicts: ['issue_status', 'home_setting'],
data() {
return {
......@@ -121,10 +124,10 @@ export default {
this.$refs.addPage.loadData(item.homePageId)
},
toView(item) {
this.$refs.addPage.loadData(item.homePageId)
this.$refs.viewPage.loadData(item.homePageId)
},
toDelete(item) {
HttpReq.backstageApi.batchDelete({
HttpReq.backstageApi.hpBatchDelete({
ids: [item.homePageId]
}).then((res) => {
this.$notify({
......
This diff is collapsed.
......@@ -26,7 +26,7 @@
<el-table-column prop="updateTime" label="最后维护日期" align="center" width="200" />
<el-table-column label="操作" align="right" width="240">
<template slot-scope="scope">
<el-tooltip v-if="scope.row.status==='1'" content="发布"><el-button round plain type="success" icon="el-icon-finished" @click="toEdit(scope.row)" /></el-tooltip>
<el-tooltip v-if="scope.row.status==='1'" content="发布"><el-button round plain type="success" icon="el-icon-finished" @click="batchOperate(1, scope.row)" /></el-tooltip>
<el-tooltip content="设置"><el-button round plain icon="el-icon-s-tools" @click="toEdit(scope.row)" /></el-tooltip>
</template>
</el-table-column>
......@@ -85,18 +85,23 @@ export default {
this.total = res.data.total
})
},
batchOperate(opt) {
if (!this.multipleSelection.length) {
batchOperate(type, row) {
if (!row && !this.multipleSelection.length) {
return this.$message({
message: '未选取数据',
type: 'info'
})
}
if (opt) {
console.log('启用', this.multipleSelection)
} else {
console.log('启用', this.multipleSelection)
}
HttpReq.backstageApi.releaseProductListPage({
ids: row ? [row.productListPageId] : this.multipleSelection.map(item => { return item.productListPageId })
}).then((res) => {
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error',
duration: 2500
})
this.loadData()
})
},
toEdit(item) {
this.$refs.editPage.loadData(item.productListPageId)
......
......@@ -2,24 +2,31 @@
<!-- 表单渲染 -->
<el-dialog append-to-body :close-on-click-modal="false" :before-close="cancelView" :visible="visible" :title="title" width="860px">
<el-form ref="formViewRef" :model="formData" :rules="rules" :status-icon="true" label-width="240px">
<el-form-item label="供应商名称:" class="form-cell" prop="xxx">
<el-form-item label="供应商名称:" class="form-cell" prop="supplierName">
<div class="cell-box">
<el-input v-model="formData.supplierName" placeholder="单行输入" class="cell-input" />
<el-autocomplete
v-model="formData.supplierName"
class="cell-input"
:fetch-suggestions="querySearch"
placeholder="单行输入"
:trigger-on-focus="false"
@select="handleSelect"
/>
</div>
</el-form-item>
<el-form-item label="供应商ID:" class="form-cell" prop="xxx">
<el-form-item label="供应商ID:" class="form-cell" prop="customerId">
<div class="cell-box">
<el-input v-model="formData.customerId" placeholder="单行输入" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="标识设置:" class="form-cell" prop="supplierLevel">
<el-form-item label="标识设置:" class="form-cell" prop="mark">
<div class="cell-box">
<el-select v-model="formData.mark" placeholder="无" class="cell-select">
<el-option v-for="item in dict.supplier_rank" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
</el-form-item>
<el-form-item label="顺序:" class="form-cell" prop="operatingPeriod">
<el-form-item label="顺序:" class="form-cell" prop="sort">
<div class="cell-box">
<el-input v-model.number="formData.sort" type="number" placeholder="请输入数字" class="cell-input" />
</div>
......@@ -44,7 +51,6 @@
</el-dialog>
</template>
<script>
import { getToken } from '@/utils/auth'
import { HttpReq } from '@/api/common'
export default {
......@@ -64,12 +70,40 @@ export default {
productIdList: '',
supplierListPageId: null
},
rules: {}
rules: {
supplierName: { validator: this.checkEnterpriseName, trigger: 'blur' }
}
}
},
mounted() {
},
methods: {
checkEnterpriseName(rule, value, callback) {
this.$nextTick(_ => {
HttpReq.backstageApi.checkEnterpriseName({
name: value, id: this.formData.customerId
}).then((res) => {
if (res.data) {
callback()
} else {
callback(new Error(res.msg))
}
})
})
},
querySearch(queryString, cb) {
HttpReq.backstageApi.associateQueryEnterpriseName({
name: queryString
}).then((res) => {
cb(res.data)
})
},
handleSelect(item) {
this.formData.customerId = item.id
this.$refs.formViewRef.validateField('supplierName', valid => {
return valid
})
},
showView() {
this.visible = true
},
......
......@@ -31,6 +31,7 @@
<el-table-column type="index" width="55" label="序号" :index="indexMethod" />
<el-table-column prop="mark" label="标识" width="200" :formatter="(row, col, val)=>{return dict.label.supplier_rank[val]}" />
<el-table-column prop="supplierName" label="供应商名称" />
<el-table-column prop="sort" label="顺序" width="100" />
<el-table-column label="状态" width="100">
<template slot-scope="scope">
<div :style="'color:'+textColors[scope.row.status]">{{ dict.label.issue_status[scope.row.status] }}</div>
......
......@@ -40,7 +40,7 @@
<div class="cell-box">
<el-upload
ref="uploadCom"
action="/api/bsw/users/updateBusinessLicense"
action="/api/bsw/users/uploadBusinessLicense"
name="businessLicense"
list-type="picture-card"
:headers="uploadHeaders"
......
......@@ -53,7 +53,7 @@
</el-dialog>
<el-upload
ref="uploadCom"
action="/api/bsw/users/updateBusinessLicense"
action="/api/bsw/users/uploadBusinessLicense"
name="businessLicense"
list-type="picture-card"
:headers="uploadHeaders"
......@@ -64,7 +64,9 @@
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
>
<i class="el-icon-plus" />
<div slot="trigger" @click="handlePushClick($event)">
<i class="el-icon-plus" />
</div>
</el-upload>
<el-dialog append-to-body :visible.sync="dialogImageVisible">
<img width="100%" :src="dialogImageUrl">
......@@ -300,6 +302,15 @@ export default {
arr.splice(arr.indexOf(item), 1)
this.formData.businessLicense = arr.join(';')
},
handlePushClick(event) {
if (this.formData.productPic.split(';') >= 2) {
event.stopPropagation()
this.$message({
message: '超出最大上传数量限制',
type: 'info'
})
}
},
handleRemove(file, fileList) {
if (!file.response) {
return
......
......@@ -201,7 +201,9 @@
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
>
<i class="el-icon-plus" />
<div slot="trigger" @click="handlePushClick($event)">
<i class="el-icon-plus" />
</div>
</el-upload>
<el-dialog append-to-body :visible.sync="dialogImageVisible">
<img width="100%" :src="dialogImageUrl">
......@@ -383,6 +385,15 @@ export default {
type: 'info'
})
},
handlePushClick(event) {
if (this.formData.productPic.split(';') >= 5) {
event.stopPropagation()
this.$message({
message: '超出最大上传数量限制',
type: 'info'
})
}
},
handleRemoveImg(item) {
this.imgList.splice(this.imgList.indexOf(item), 1)
const arr = this.formData.productPic.split(';')
......
......@@ -180,7 +180,9 @@
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
>
<i class="el-icon-plus" />
<div slot="trigger" @click="handlePushClick($event)">
<i class="el-icon-plus" />
</div>
</el-upload>
<el-dialog append-to-body :visible.sync="dialogImageVisible">
<img width="100%" :src="dialogImageUrl">
......@@ -384,6 +386,15 @@ export default {
this.formData.productPic = arr.join(';')
})
},
handlePushClick(event) {
if (this.formData.productPic.split(';') >= 5) {
event.stopPropagation()
this.$message({
message: '超出最大上传数量限制',
type: 'info'
})
}
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url
this.dialogImageVisible = true
......
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