Commit 82e8cb59 authored by zhanglw's avatar zhanglw

内容管理

parent 1007d0fc
......@@ -194,6 +194,43 @@ export const HttpReq = {
return res
})
},
// 内容管理-新增供应商列表页面
addSupplierListPage: function(data) {
return request({
url: '/api/bsw/supplierListPage/addSupplierListPage',
method: 'post',
data: data
}).then((res) => {
return res
})
},
// 内容管理-修改供应商列表页中供应商详情(排序、展示产品)
updateSupplierListPage: function(data) {
return request({
url: '/api/bsw/supplierListPage/updateSupplierListPage',
method: 'put',
data: data
}).then((res) => {
return res
})
},
// 内容管理-供应商列表批量发布
releaseSupplierListPage: function(data) {
return request({
url: '/api/bsw/supplierListPage/releaseSupplierListPage',
method: 'put',
data: data
}).then((res) => {
return res
})
},
// 内容管理-查询单个供应商列表页
querySupplierListPageById: function(params) {
return request({
url: '/api/bsw/supplierListPage/querySupplierListPageById?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
// 内容管理-供应商列表查询
querySupplierListPage: function(params) {
return request({
......@@ -201,6 +238,57 @@ export const HttpReq = {
method: 'get'
})
},
// 内容管理-查询产品列表页
queryProductListPage: function(params) {
return request({
url: '/api/bsw/productListPage/queryProductListPage?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
// 内容管理-查询首页内容列表页
queryHomePage: function(params) {
return request({
url: '/api/bsw/homePage/queryHomePage?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
// 内容管理-查询单个首页内容列表页
queryHomePageById: function(params) {
return request({
url: '/api/bsw/homePage/queryHomePageById?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
// 内容管理-新增首页内容
addHomePage: function(data) {
return request({
url: '/api/bsw/homePage/addHomePage',
method: 'post',
data: data
}).then((res) => {
return res
})
},
// 内容管理-修改首页内容
updateHomePage: function(data) {
return request({
url: '/api/bsw/homePage/updateHomePage',
method: 'put',
data: data
}).then((res) => {
return res
})
},
// 内容管理-首页管理批量发布
releaseHomePage: function(data) {
return request({
url: '/api/bsw/homePage/releaseHomePage',
method: 'put',
data: data
}).then((res) => {
return res
})
},
xxx: null
}
}
......
......@@ -2,14 +2,14 @@
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<el-select v-model="query.area" clearable placeholder="请选择位置" style="width: 150px">
<el-option v-for="item in dict.product_type" :key="item.value" :label="item.label" :value="item.value" />
<el-select v-model="query.type" clearable placeholder="请选择位置" style="width: 150px">
<el-option v-for="item in dict.home_setting" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-input v-model="query.username" clearable placeholder="请输入操作名称" style="width:280px;" />
<el-input v-model="query.operationName" clearable placeholder="请输入操作名称" style="width:280px;" />
<el-select v-model="query.status" clearable placeholder="请选择状态" style="width: 120px">
<el-option v-for="item in dict.issue_status" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<date-range-picker v-model="query.createTime" start-placeholder="维护开始日期" style="width: 280px" />
<date-range-picker v-model="query.updateTime" start-placeholder="维护开始日期" style="width: 280px" />
<el-button type="success" icon="el-icon-search" @click="toSearch">搜索</el-button>
<el-button type="warning" icon="el-icon-refresh" @click="clearLimit">重置</el-button>
</div>
......@@ -18,7 +18,7 @@
<el-button type="primary" icon="el-icon-circle-plus-outline" @click="toAdd">添加</el-button>
</div>
<div style="text-align: right">
<el-button type="success" icon="el-icon-finished" :disabled="!multipleSelection.length" @click="batchOperate(true)">批量发布</el-button>
<el-button type="success" icon="el-icon-finished" :disabled="!multipleSelection.length" @click="batchOperate(1)">批量发布</el-button>
</div>
</div>
<!-- 表格 -->
......@@ -26,19 +26,19 @@
<el-table id="dataTable" ref="dataTable" v-loading="loading" :data="tableData" tooltip-effect="dark" style="width:auto;min-height: 70vh" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column type="index" width="55" label="序号" :index="indexMethod" />
<el-table-column prop="area" label="位置" width="200" />
<el-table-column prop="xxx" label="操作名称" />
<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 label="状态" width="100">
<template slot-scope="scope">
<div :style="'color:'+textColors[scope.row.status]">{{ dict.label.issue_status[scope.row.status] }}</div>
</template>
</el-table-column>
<el-table-column prop="xxx" label="最后维护日期" align="center" width="200" />
<el-table-column prop="xxx" label="操作" align="right" width="240">
<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 type="primary" icon="el-icon-edit-outline" @click="toEdit(scope.row)" /></el-tooltip>
<el-tooltip content="查看"><el-button round plain icon="el-icon-view" @click="toEdit(scope.row)" /></el-tooltip>
<el-tooltip content="查看"><el-button round plain icon="el-icon-view" @click="toView(scope.row)" /></el-tooltip>
<el-tooltip content="删除"><el-button round plain type="danger" icon="el-icon-delete" @click="toDelete(scope.row)" /></el-tooltip>
</template>
</el-table-column>
......@@ -56,7 +56,7 @@ import addPage from './add'
export default {
components: { DateRangePicker, addPage },
dicts: ['issue_status', 'product_type', 'area_province'],
dicts: ['issue_status', 'home_setting'],
data() {
return {
textColors: ['#ccc', '#bba', '#32cd32'],
......@@ -84,47 +84,44 @@ export default {
this.multipleSelection = val
},
loadData() {
var sort = 'id,desc'
var param = { ...this.query }
param.page = this.page
param.pageSize = this.pageSize
param.sort = sort
this.tableData = [
{ username: '张三', area: '火星', status: '1', enabled: false, xxx: '2023-05-09' },
{ username: '张三', area: '火星', status: '2', enabled: false, xxx: '2023-05-09' },
{ username: '张三', area: '火星', status: '1', enabled: false, xxx: '2023-05-09' }
]
this.total = 2
Object.keys(this.query).length !== 0 && Object.keys(this.query).forEach(item => {
if (this.query[item] === null || this.query[item] === '') this.query[item] = undefined
})
HttpReq.backstageApi.queryHomePage({
page: this.page - 1,
pageSize: this.pageSize,
...this.query
}).then((res) => {
this.tableData = res.data.data
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)
}
},
changeEnabled(data, val) {
this.$confirm('此操作将 "' + this.dict.label.user_status[val] + '" ' + data.username + ', 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
}).catch(() => {
data.enabled = !data.enabled
HttpReq.backstageApi.releaseHomePage({
ids: row ? [row.homePageId] : this.multipleSelection.map(item => { return item.homePageId })
}).then((res) => {
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error',
duration: 2500
})
this.loadData()
})
},
toAdd() {
this.$refs.addPage.showView()
this.$refs.addPage.loadData()
},
toEdit(item) {
this.$refs.addPage.loadData(item.homePageId)
},
toView(item) {
this.$refs.addPage.loadData(item.homePageId)
},
toDelete(item) {
......
......@@ -4,7 +4,9 @@
<el-form ref="formViewRef" :model="formData" :rules="rules" :status-icon="true" label-width="240px">
<el-form-item label="产品类型名称:" class="form-cell" prop="xxx">
<div class="cell-box">
<el-input v-model="formData.xxx" disabled placeholder="单行输入" class="cell-input" />
<el-select v-model="formData.productType" disabled 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="xxx">
......@@ -27,13 +29,13 @@ import { getToken } from '@/utils/auth'
import { HttpReq } from '@/api/common'
export default {
dicts: ['supplier_rank'],
dicts: ['product_type'],
data() {
return {
visible: false,
title: '内容管理供应商设置',
formData: {
xxx: '',
productType: '',
dataList: [
{ id: '123', index: '1' },
{ id: '222', index: '2' },
......@@ -84,7 +86,22 @@ export default {
}
})
},
loadData(id) {
loadData(productListPageId) {
// if (productListPageId) {
// HttpReq.backstageApi.querySupplierListPageById({ productListPageId }).then((res) => {
// if (res.code === 200) {
// this.formData = Object.assign(this.formData, res.data)
// if (this.formData.productIdList) {
// const arr = this.formData.productIdList.split(';')
// }
// } else {
// this.$message({
// message: res.msg,
// type: 'error'
// })
// }
// })
// }
this.showView()
}
}
......
......@@ -2,11 +2,13 @@
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<el-input v-model="query.username" clearable placeholder="请输入产品类型名称" style="width:280px;" />
<el-select v-model="query.productType" clearable placeholder="请选择产品类型" style="width: 150px">
<el-option v-for="item in dict.product_type" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-select v-model="query.status" clearable placeholder="请选择状态" style="width: 120px">
<el-option v-for="item in dict.issue_status" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<date-range-picker v-model="query.createTime" start-placeholder="维护开始日期" style="width: 280px" />
<date-range-picker v-model="query.updateTime" start-placeholder="维护开始日期" style="width: 280px" />
<el-button type="success" icon="el-icon-search" @click="toSearch">搜索</el-button>
<el-button type="warning" icon="el-icon-refresh" @click="clearLimit">重置</el-button>
</div>
......@@ -15,14 +17,14 @@
<div class="content">
<el-table id="dataTable" ref="dataTable" v-loading="loading" :data="tableData" tooltip-effect="dark" style="width:auto;min-height: 70vh">
<el-table-column type="index" width="55" label="序号" :index="indexMethod" />
<el-table-column prop="area" label="产品类型名称" />
<el-table-column prop="productType" label="产品类型名称" :formatter="(row, col, val)=>{return dict.label.product_type[val]}" />
<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>
</template>
</el-table-column>
<el-table-column prop="xxx" label="最后维护日期" align="center" width="200" />
<el-table-column prop="xxx" label="操作" align="right" width="240">
<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 content="设置"><el-button round plain icon="el-icon-s-tools" @click="toEdit(scope.row)" /></el-tooltip>
......@@ -70,17 +72,18 @@ export default {
this.multipleSelection = val
},
loadData() {
var sort = 'id,desc'
var param = { ...this.query }
param.page = this.page
param.pageSize = this.pageSize
param.sort = sort
this.tableData = [
{ username: '张三', area: '火星', status: '1', enabled: false, xxx: '2023-05-09' },
{ username: '张三', area: '火星', status: '2', enabled: false, xxx: '2023-05-09' },
{ username: '张三', area: '火星', status: '1', enabled: false, xxx: '2023-05-09' }
]
this.total = 2
// 清除参数无值的情况
Object.keys(this.query).length !== 0 && Object.keys(this.query).forEach(item => {
if (this.query[item] === null || this.query[item] === '') this.query[item] = undefined
})
HttpReq.backstageApi.queryProductListPage({
page: this.page - 1,
pageSize: this.pageSize,
...this.query
}).then((res) => {
this.tableData = res.data.data
this.total = res.data.total
})
},
batchOperate(opt) {
if (!this.multipleSelection.length) {
......@@ -95,19 +98,8 @@ export default {
console.log('启用', this.multipleSelection)
}
},
changeEnabled(data, val) {
this.$confirm('此操作将 "' + this.dict.label.user_status[val] + '" ' + data.username + ', 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
}).catch(() => {
data.enabled = !data.enabled
})
},
toEdit(item) {
this.$refs.editPage.loadData(item.customerId)
this.$refs.editPage.loadData(item.productListPageId)
},
toSearch() {
this.page = 1
......
......@@ -9,7 +9,7 @@
</el-form-item>
<el-form-item label="供应商ID:" class="form-cell" prop="xxx">
<div class="cell-box">
<el-input v-model="formData.supplierId" placeholder="单行输入" class="cell-input" />
<el-input v-model="formData.customerId" placeholder="单行输入" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="标识设置:" class="form-cell" prop="supplierLevel">
......@@ -21,25 +21,25 @@
</el-form-item>
<el-form-item label="顺序:" class="form-cell" prop="operatingPeriod">
<div class="cell-box">
<el-input v-model.number="formData.index" type="number" placeholder="请输入数字" class="cell-input" />
<el-input v-model.number="formData.sort" type="number" placeholder="请输入数字" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="展示产品ID:" class="form-cell" prop="xxx">
<el-form-item label="展示产品ID:" class="form-cell">
<div class="cell-box">
<el-input v-model="formData.xxx" placeholder="单行输入" class="cell-input" />
<el-input v-model="formData.pid0" placeholder="单行输入" class="cell-input" />
</div>
<div class="cell-box">
<el-input v-model="formData.xxx" placeholder="单行输入" class="cell-input" />
<el-input v-model="formData.pid1" placeholder="单行输入" class="cell-input" />
</div>
<div class="cell-box">
<el-input v-model="formData.xxx" placeholder="单行输入" class="cell-input" />
<el-input v-model="formData.pid2" placeholder="单行输入" class="cell-input" />
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button @click="cancelView">关闭</el-button>
<el-button type="primary" @click="saveForm()">保存</el-button>
<el-button type="success" @click="submitForm()">发布</el-button>
<el-button type="primary" @click="submitForm()">保存</el-button>
<el-button v-if="formData.supplierListPageId" type="success" @click="submitForm(true)">发布</el-button>
</div>
</el-dialog>
</template>
......@@ -55,9 +55,14 @@ export default {
title: '内容管理供应商设置',
formData: {
supplierName: '',
supplierId: '',
customerId: '',
mark: '1',
id: null
sort: '999',
pid0: '',
pid1: '',
pid2: '',
productIdList: '',
supplierListPageId: null
},
rules: {}
}
......@@ -71,34 +76,98 @@ export default {
hideView() {
this.$refs.formViewRef.resetFields()
this.visible = false
this.formData = {
supplierName: '',
customerId: '',
mark: '1',
sort: '999',
pid0: '',
pid1: '',
pid2: '',
productIdList: '',
supplierListPageId: null
}
},
cancelView() {
this.hideView()
},
saveForm() {},
submitForm() {
release() {
HttpReq.backstageApi.releaseSupplierListPage({ ids: [this.formData.supplierListPageId] }).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) {
// HttpReq.backstageApi.updateCustomerDetail(this.formData).then((res) => {
// this.$notify({
// title: res.msg,
// type: 'success',
// duration: 2500
// })
// if (res.code === 200) {
// this.cancelView()
// this.$parent.loadData()
// }
// })
// } else {
// this.$message({
// message: '表单信息有误,请核对无误后提交!',
// type: 'error'
// })
this.formData.productIdList = [this.formData.pid0, this.formData.pid1, this.formData.pid2].join(';')
if (this.formData.supplierListPageId) {
HttpReq.backstageApi.updateSupplierListPage(this.formData).then((res) => {
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error',
duration: 2500
})
if (res.code === 200) {
if (isRelease) {
this.release()
} else {
this.cancelView()
this.$parent.loadData()
}
}
})
} else {
HttpReq.backstageApi.addSupplierListPage(this.formData).then((res) => {
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error',
duration: 2500
})
if (res.code === 200) {
if (isRelease) {
this.release()
} else {
this.cancelView()
this.$parent.loadData()
}
}
})
}
} else {
this.$message({
message: '表单信息有误,请核对无误后提交!',
type: 'error'
})
}
})
},
loadData(id) {
loadData(supplierListPageId) {
if (supplierListPageId) {
HttpReq.backstageApi.querySupplierListPageById({ supplierListPageId }).then((res) => {
if (res.code === 200) {
this.formData = Object.assign(this.formData, res.data)
if (this.formData.productIdList) {
const arr = this.formData.productIdList.split(';')
this.formData.pid0 = arr[0]
this.formData.pid1 = arr[1]
this.formData.pid2 = arr[2]
}
} else {
this.$message({
message: res.msg,
type: 'error'
})
}
})
}
this.showView()
}
}
......
......@@ -5,14 +5,14 @@
<el-select v-model="query.area" clearable placeholder="请选择地区" style="width: 150px">
<el-option v-for="item in dict.area_province" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-select v-model="query.status" clearable placeholder="请选择标识" style="width: 120px">
<el-select v-model="query.mark" clearable placeholder="请选择标识" style="width: 120px">
<el-option v-for="item in dict.supplier_rank" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-input v-model="query.username" clearable placeholder="请输入供应商名称" style="width:280px;" />
<el-input v-model="query.supplierName" clearable placeholder="请输入供应商名称" style="width:280px;" />
<el-select v-model="query.status" clearable placeholder="请选择状态" style="width: 120px">
<el-option v-for="item in dict.issue_status" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<date-range-picker v-model="query.createTime" start-placeholder="维护开始日期" style="width: 280px" />
<date-range-picker v-model="query.updateTime" start-placeholder="维护开始日期" style="width: 280px" />
<el-button type="success" icon="el-icon-search" @click="toSearch">搜索</el-button>
<el-button type="warning" icon="el-icon-refresh" @click="clearLimit">重置</el-button>
</div>
......@@ -21,7 +21,7 @@
<el-button type="primary" icon="el-icon-circle-plus-outline" @click="toAdd">添加</el-button>
</div>
<div style="text-align: right">
<el-button type="success" icon="el-icon-finished" :disabled="!multipleSelection.length" @click="batchOperate(true)">批量发布</el-button>
<el-button type="success" icon="el-icon-finished" :disabled="!multipleSelection.length" @click="batchOperate(1)">批量发布</el-button>
</div>
</div>
<!-- 表格 -->
......@@ -30,7 +30,7 @@
<el-table-column type="selection" width="55" />
<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="supplierName" label="供应名称" />
<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>
......@@ -39,7 +39,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>
......@@ -98,35 +98,29 @@ 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)
}
},
changeEnabled(data, val) {
this.$confirm('此操作将 "' + this.dict.label.user_status[val] + '" ' + data.username + ', 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
}).catch(() => {
data.enabled = !data.enabled
HttpReq.backstageApi.releaseSupplierListPage({
ids: row ? [row.supplierListPageId] : this.multipleSelection.map(item => { return item.supplierListPageId })
}).then((res) => {
this.$notify({
title: res.msg,
type: res.code === 200 ? 'success' : 'error',
duration: 2500
})
this.loadData()
})
},
toAdd() {
this.$refs.editPage.loadData()
},
toEdit(item) {
this.$refs.editPage.loadData(item.customerId)
this.$refs.editPage.loadData(item.supplierListPageId)
},
toSearch() {
this.page = 1
......
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