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"
>
<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({
......
<template>
<!-- 表单渲染 -->
<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="type">
<div class="cell-box">
<el-select disabled v-model="formData.type" placeholder="无" class="cell-select">
<el-option v-for="item in dict.home_setting" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
</el-form-item>
<div v-if="formData.type==='1'">
<el-form-item label="操作名称:" class="form-cell" prop="operationName">
<div class="cell-box">
<el-input disabled v-model="formData.operationName" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="频道名称:" class="form-cell" prop="channelName">
<div class="cell-box">
<el-input disabled v-model="formData.channelName" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="链接:" class="form-cell" prop="url">
<div class="cell-box">
<el-input disabled v-model="formData.url" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="顺序:" class="form-cell" prop="operatingPeriod">
<div class="cell-box">
<el-input disabled v-model.number="formData.sort" type="number" placeholder="请输入数字" class="cell-input" />
</div>
</el-form-item>
</div>
<div v-if="formData.type==='2'">
<el-form-item label="操作名称:" class="form-cell" prop="operationName">
<div class="cell-box">
<el-input disabled v-model="formData.operationName" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="搜索类型:" class="form-cell" prop="searchType">
<div class="cell-box">
<el-select disabled v-model="formData.searchType" placeholder="无" class="cell-select">
<el-option v-for="item in dict.home_setting_2" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
</el-form-item>
<el-form-item label="内容:" class="form-cell" prop="content">
<div class="cell-box">
<el-input disabled v-model="formData.content" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="顺序:" class="form-cell" prop="sort">
<div class="cell-box">
<el-input disabled v-model.number="formData.sort" type="number" placeholder="请输入数字" class="cell-input" />
</div>
</el-form-item>
</div>
<div v-if="formData.type==='3'">
<el-form-item label="操作名称:" class="form-cell" prop="operationName">
<div class="cell-box">
<el-input disabled v-model="formData.operationName" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="供应商ID:" class="form-cell" prop="supplierId">
<div class="cell-box">
<el-input disabled v-model="formData.supplierId" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="供应商名称:" class="form-cell" prop="supplierName">
<div class="cell-box">
<el-autocomplete
disabled 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">
<div class="cell-box">
<el-radio-group disabled v-model="formData.diamondSupplier" size="mini">
<el-radio label=""></el-radio>
<el-radio label="1"></el-radio>
</el-radio-group>
</div>
</el-form-item>
<el-form-item label="是否设置为热门供应商:" class="form-cell" prop="popularSupplier">
<div class="cell-box">
<el-radio-group disabled v-model="formData.popularSupplier" size="mini">
<el-radio label=""></el-radio>
<el-radio label="1"></el-radio>
</el-radio-group>
</div>
</el-form-item>
<el-form-item label="顺序:" class="form-cell" prop="sort">
<div class="cell-box">
<el-input disabled v-model.number="formData.sort" type="number" placeholder="请输入数字" class="cell-input" />
</div>
</el-form-item>
</div>
<div v-if="formData.type==='4'">
<el-form-item label="操作名称:" class="form-cell" prop="operationName">
<div class="cell-box">
<el-input disabled v-model="formData.operationName" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="产品分类:" class="form-cell" prop="productType">
<div class="cell-box">
<el-select disabled v-model="formData.productType" placeholder="无" class="cell-select">
<el-option v-for="item in dict.product_type" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
</el-form-item>
<el-form-item label="产品ID:" class="form-cell" prop="productId">
<div class="cell-box">
<el-input disabled v-model="formData.productId" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="产品运营名称:" class="form-cell" prop="productOperationName">
<div class="cell-box">
<el-input disabled v-model="formData.productOperationName" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="是否设置为信得过产品:" class="form-cell" prop="trustworthyProduct">
<div class="cell-box">
<el-radio-group disabled v-model="formData.trustworthyProduct" size="mini">
<el-radio label=""></el-radio>
<el-radio label="1"></el-radio>
</el-radio-group>
</div>
</el-form-item>
<el-form-item label="是否设置为热门产品:" class="form-cell" prop="popularProduct">
<div class="cell-box">
<el-radio-group disabled v-model="formData.popularProduct" size="mini">
<el-radio label=""></el-radio>
<el-radio label="1"></el-radio>
</el-radio-group>
</div>
</el-form-item>
<el-form-item label="顺序:" class="form-cell" prop="index">
<div class="cell-box">
<el-input disabled v-model.number="formData.sort" type="number" placeholder="请输入数字" class="cell-input" />
</div>
</el-form-item>
</div>
<div v-if="formData.type==='5'">
<el-form-item label="操作名称:" class="form-cell" prop="operationName">
<div class="cell-box">
<el-input disabled v-model="formData.operationName" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="排行榜类型:" class="form-cell" prop="rankingType">
<div class="cell-box">
<el-select disabled v-model="formData.rankingType" placeholder="无" class="cell-select">
<el-option v-for="item in dict.home_setting_5" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
</el-form-item>
<el-form-item v-if="formData.rankingType==='1'" label="供应商ID:" class="form-cell" prop="supplierId">
<div class="cell-box">
<el-input disabled v-model="formData.supplierId" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item v-else label="产品ID:" class="form-cell" prop="productId">
<div class="cell-box">
<el-input disabled v-model="formData.productId" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item v-if="formData.rankingType==='1'" label="供应商名称:" class="form-cell" prop="supplierName">
<div class="cell-box">
<el-input disabled v-model="formData.supplierName" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item v-else label="产品运营名称:" class="form-cell" prop="productOperationName">
<div class="cell-box">
<el-input disabled v-model="formData.productOperationName" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="顺序:" class="form-cell" prop="sort">
<div class="cell-box">
<el-input disabled v-model.number="formData.sort" type="number" placeholder="请输入数字" class="cell-input" />
</div>
</el-form-item>
</div>
<div v-if="formData.type==='6'">
<el-form-item label="操作名称:" class="form-cell" prop="operationName">
<div class="cell-box">
<el-input disabled v-model="formData.operationName" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="合作伙伴名称名称:" class="form-cell" prop="partnerName">
<div class="cell-box">
<el-input disabled v-model="formData.partnerName" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="合作伙伴LOGO:" class="form-cell" prop="partnerLogo">
<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+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>
<span class="el-upload-list__item-delete" @click="handleRemoveImg(item)"><i class="el-icon-delete" /></span>
</span>
</li>
</ul>
<el-dialog append-to-body :visible.sync="dialogImgVisible">
<img width="100%" :src="imgSrcStart+dialogImgUrl">
</el-dialog>
</div>
<div style="display: block;clear: both">{{ formData.partnerLogo }}</div>
</el-form-item>
<el-form-item label="链接:" class="form-cell" prop="url">
<div class="cell-box">
<el-input disabled v-model="formData.url" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="顺序:" class="form-cell" prop="sort">
<div class="cell-box">
<el-input disabled v-model.number="formData.sort" type="number" placeholder="请输入数字" class="cell-input" />
</div>
</el-form-item>
</div>
<div v-if="formData.type==='7'">
<el-form-item label="操作名称:" class="form-cell" prop="operationName">
<div class="cell-box">
<el-input disabled v-model="formData.operationName" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="链接名称:" class="form-cell" prop="linkName">
<div class="cell-box">
<el-input disabled v-model="formData.linkName" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="链接:" class="form-cell" prop="url">
<div class="cell-box">
<el-input disabled v-model="formData.url" placeholder="暂无" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="顺序:" class="form-cell" prop="sort">
<div class="cell-box">
<el-input disabled v-model.number="formData.sort" type="number" placeholder="请输入数字" class="cell-input" />
</div>
</el-form-item>
</div>
</el-form>
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button @click="cancelView">关闭</el-button>
<!-- <el-button type="danger" @click="submitForm()">预览</el-button>-->
<el-button type="primary" @click="submitForm()">保存</el-button>
<el-button v-if="formData.homePageId" type="success" @click="submitForm(true)">发布</el-button>
</div>
</el-dialog>
</template>
<script>
import { getToken } from '@/utils/auth'
import { HttpReq } from '@/api/common'
export default {
dicts: ['home_setting', 'home_setting_2', 'home_setting_5', 'product_type'],
data() {
return {
uploadHeaders: { 'Authorization': getToken() },
imgSrcStart: process.env.VUE_APP_BASE_API,
editor: false, // 富文本对象
dialogImageUrl: '',
dialogImageVisible: false,
imgList: [],
dialogImgUrl: '',
dialogImgVisible: false,
visible: false,
title: '添加首页内容',
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
},
rules: {}
}
},
mounted() {
this.$nextTick(() => {
})
},
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() {
this.$refs.formViewRef.resetFields()
this.visible = false
},
cancelView() {
this.hideView()
},
release() {
HttpReq.backstageApi.releaseHomePage({ ids: [this.formData.homePageId] }).then((res) => {
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error',
duration: 2500
})
if (res.code === 200) {
this.cancelView()
this.$parent.loadData()
}
})
},
submitForm(isRelease) {
this.$refs.formViewRef.validate((valid, obj) => {
if (valid) {
if (this.formData.homePageId) {
HttpReq.backstageApi.updateHomePage(this.formData).then((res) => {
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error'
})
if (res.code === 200) {
if (isRelease) {
this.release()
} else {
this.cancelView()
this.$parent.loadData()
}
}
})
} else {
HttpReq.backstageApi.addHomePage(this.formData).then((res) => {
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error'
})
if (res.code === 200) {
if (isRelease) {
this.release()
} else {
this.cancelView()
this.$parent.loadData()
}
}
})
}
} else {
this.$message({
message: '表单信息有误,请核对无误后提交!',
type: 'error'
})
}
})
},
loadData(homePageId) {
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
}
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,
type: 'error'
})
}
})
} else {
this.title = '添加首页内容'
}
this.showView()
},
handleExceed() {
this.$message({
message: '超出最大上传数量限制',
type: 'info'
})
},
handleRemoveImg(item) {
this.imgList.splice(this.imgList.indexOf(item), 1)
const arr = this.formData.partnerLogo.split(';')
arr.splice(arr.indexOf(item), 1)
this.formData.partnerLogo = arr.join(';')
},
handleRemove(file, fileList) {
HttpReq.backstageApi.deletePicture({
multipartFile: file.response.pictures
}).then((res) => {
this.$notify({
title: res.msg,
type: 'success',
duration: 2500
})
const arr = []
fileList.forEach(item => {
arr.push(item.response.pictures)
})
this.formData.partnerLogo = arr.join(';')
})
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url
this.dialogImageVisible = true
},
handleImported(response, file, fileList) {
this.$nextTick(() => {
const arr = this.formData.partnerLogo ? this.formData.partnerLogo.split(';') : []
arr.push(response.pictures)
this.formData.partnerLogo = arr.join(';')
this.$notify({
title: '上传成功!',
type: 'success',
duration: 2500
})
})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.cell-box {
min-width: 120px;
.cell-input {
width: 420px;
}
.cell-select {
width: 220px;
}
>>>.el-input__inner {
border: 1px solid rgba(100, 100, 100, 0.1);
border-bottom: 1px solid rgba(100, 100, 100, 0.2);
border-radius: 5px;
}
>>>.el-input.is-disabled .el-input__inner {
border-radius: 0;
border: 0;
border-bottom: 1px solid rgba(100, 100, 100, 0.4);
background: white;
cursor: text;
}
>>>.el-input.is-disabled .el-input__icon {
cursor: text;
}
>>>.el-icon-circle-check {
color: #13ce66;
}
//>>>.el-icon-arrow-up:before {
// content: '';
//}
}
</style>
......@@ -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"
>
<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"
>
<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"
>
<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