初始项目

This commit is contained in:
liupopo
2023-02-11 12:55:02 +08:00
parent 1748bda84a
commit 0b89e36064
3363 changed files with 506201 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
<template>
<div>
<div class="app-container">
<el-col :span="12">
<img :src="img_404" alt="404" class="img-style">
</el-col>
<el-col :span="12">
<div style="margin-left: 100px;margin-top: 60px">
<h1 class="color-main">OOPS!</h1>
<h2 style="color: #606266">很抱歉页面它不小心迷路了</h2>
<div style="color:#909399;font-size: 14px">请检查您输入的网址是否正确请点击以下按钮返回主页或者发送错误报告</div>
<el-button style="margin-top: 20px" type="primary" round @click="handleGoMain">返回首页</el-button>
</div>
</el-col>
</div>
</div>
</template>
<script>
import img_404 from '@/assets/images/gif_404.gif';
export default {
name: 'wrongPage',
data() {
return {
img_404
}
},
methods: {
handleGoMain() {
this.$router.push({path: '/'})
}
},
}
</script>
<style scoped>
.app-container {
width: 80%;
margin: 120px auto;
}
.img-style {
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
}
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<adv-detail :is-edit='false'></adv-detail>
</template>
<script>
import AdvDetail from './components/AdvDetail'
export default {
name: 'addAdv',
components: { AdvDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,173 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="adv"
:rules="rules"
ref="advFrom"
label-width="150px"
size="small">
<el-form-item label="小区名称:" prop="floorNum">
<el-form-item :label="cname" readonly="readonly"></el-form-item>
</el-form-item>
<el-form-item label="广告名称:" prop="name">
<el-input v-model="adv.name" class="input-width"></el-input>
</el-form-item>
<el-form-item label="开始时间:" prop="startTime">
<el-date-picker
type="datetime"
placeholder="选择日期"
v-model="adv.startTime"></el-date-picker>
</el-form-item>
<el-form-item label="到期时间:" prop="endTime">
<el-date-picker
type="datetime"
placeholder="选择日期"
v-model="adv.endTime"></el-date-picker>
</el-form-item>
<el-form-item label="上线/下线:">
<el-radio-group v-model="adv.status">
<el-radio :label="0">下线</el-radio>
<el-radio :label="1">上线</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="广告图片:">
<single-upload v-model="adv.pic"></single-upload>
</el-form-item>
<el-form-item label="排序:">
<el-input v-model="adv.sort" class="input-width"></el-input>
</el-form-item>
<el-form-item label="广告备注:">
<el-input
class="input-width"
type="textarea"
:rows="5"
placeholder="请输入内容"
v-model="adv.note">
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('advFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('advFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createAdv, getAdv, updateAdv} from '@/api/build/adv'
import SingleUpload from '@/components/Upload/singleUpload'
import {formatDate} from '@/utils/date';
const defaultAdv={
name: ''
};
export default {
name: 'AdvDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
adv:Object.assign({}, defaultAdv),
cname:'',
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
this.cname=this.$route.query.cname;
if (this.isEdit) {
getAdv(this.$route.query.id).then(response => {
this.adv = response.data;
});
}else{
this.adv = Object.assign({},defaultAdv);
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.adv.communityId=this.$route.query.cid
if (this.isEdit) {
updateAdv(this.$route.query.id, this.adv).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
} else {
createAdv(this.adv).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.adv = Object.assign({},defaultAdv);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.adv = Object.assign({},defaultAdv);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,285 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchAdvList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button v-if="cid>0"
class="btn-add"
@click="addAdv()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="advTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" width="120" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="广告名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="广告图片" width="120" align="center">
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.pic"></template>
</el-table-column>
<el-table-column label="时间" width="220" align="center">
<template slot-scope="scope">
<p>开始时间{{scope.row.startTime | formatCreateTime}}</p>
<p>到期时间{{scope.row.endTime | formatCreateTime}}</p>
</template>
</el-table-column>
<el-table-column label="上线/下线" width="120" align="center">
<template slot-scope="scope">
<el-switch
@change="handleUpdateStatus(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.status">
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteAdv,updateStatus} from '@/api/build/adv'
import {formatDate} from '@/utils/date';
export default {
name: 'advList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showAdv"
},
{
label: "隐藏品牌",
value: "hideAdv"
}
],
cid:0,
cname:'',
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '未开始';
} else if (value === 2) {
return '活动中';
} else if (value === 3) {
return '已结束';
} else if (value === 4) {
return '已失效';
}
},
},
methods: {
getList() {
this.listLoading = true;
this.cid=this.$route.query.cid;
if (this.cid) {
this.listQuery.communityId=this.cid;
}
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
//this.total = response.data.records.length;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleUpdateStatus(index,row){
this.$confirm('是否要修改上线/下线状态?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateStatus(row.id,{status:row.status}).then(response=>{
this.getList();
this.$message({
type: 'success',
message: '修改成功!'
});
});
}).catch(() => {
this.$message({
type: 'success',
message: '已取消操作!'
});
this.getList();
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
addAdv() {
this.$router.push({path:'/build/addAdv',query:{cid:this.$route.query.cid,cname:this.$route.query.cname}});
},
handleUpdate(index, row) {
this.$router.push({path: '/build/updateAdv', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteAdv(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchAdvList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showAdv') {
showStatus = 1;
} else if (this.operateType === 'hideAdv') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<adv-detail :is-edit='true'></adv-detail>
</template>
<script>
import AdvDetail from './components/AdvDetail'
export default {
name: 'updateAdv',
components: { AdvDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<community-detail :is-edit='false'></community-detail>
</template>
<script>
import CommunityDetail from './components/CommunityDetail'
export default {
name: 'addCommunity',
components: { CommunityDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,215 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="community" :rules="rules" ref="communityFrom" label-width="100px">
<el-form-item label="小区名称:" prop="name">
<el-input v-model="community.name"></el-input>
</el-form-item>
<el-form-item label="小区栋数:" prop="counts">
<el-input v-model="community.counts"></el-input>
</el-form-item>
<el-form-item label="小区地址:" prop="address">
<el-input v-model="community.address"></el-input>
</el-form-item>
<el-form-item label="地标:" prop="nearbyLandmarks">
<el-input v-model="community.nearbyLandmarks"></el-input>
</el-form-item>
<el-form-item label="电话:" prop="phone">
<el-input v-model="community.phone"></el-input>
</el-form-item>
<el-form-item label="地图:" prop="phone">
<input v-model.number="center.lng" />
<input v-model.number="center.lat" />
<!--<label>关键词<input v-model="keyword"></label>
<label>地区<input v-model="location"></label>-->
<baidu-map ak="15BWmtGEGGkZ8lSPUGah30XZ6IGw57HE"
class="map bm-view"
:scroll-wheel-zoom="true"
:center="center"
:zoom="zoom"
:auto-resize="true"
@moving="syncCenterAndZoom"
@moveend="syncCenterAndZoom"
@zoomend="syncCenterAndZoom">
<bm-copyright
anchor="BMAP_ANCHOR_TOP_RIGHT"
:copyright="[{id: 1, content: 'Copyright Message', bounds: {ne: {lng: 110, lat: 40}, sw:{lng: 0, lat: 0}}}, {id: 2, content: '<a>宇运动多租户商城</a>'}]">
</bm-copyright>
<bm-city-list anchor="BMAP_ANCHOR_TOP_LEFT" @changeAfter="changeAfters"></bm-city-list>
<!-- <bm-local-search :keyword="keyword" :auto-viewport="true" :location="location"></bm-local-search>-->
</baidu-map>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('communityFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('communityFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import BaiduMap from 'vue-baidu-map/components/map/Map.vue'
import BmLocalSearch from 'vue-baidu-map/components/search/LocalSearch';
import BmCityList from 'vue-baidu-map/components/controls/CityList';
import BmCopyright from 'vue-baidu-map/components/controls/Copyright';
import BmView from 'vue-baidu-map/components/map/MapView';
import {createCommunity, getCommunity, updateCommunity} from '@/api/build/community'
import SingleUpload from '@/components/Upload/singleUpload'
import {formatDate} from '@/utils/date';
const defaultCommunity={
name: ''
};
export default {
name: 'CommunityDetail',
components:{SingleUpload,BaiduMap,BmLocalSearch,BmCityList,BmView,BmCopyright},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
community:Object.assign({}, defaultCommunity),
rules: {
name: [
{required: true, message: '请输入名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
},
location: '北京',
keyword: '百度',
center: {
lng: 116.404,
lat: 39.915
},
zoom: 15
}
},
mounted (){
// this.handleScroll()
// window.addEventListener('mousewheel',this.handleScroll,false)
},
created() {
if (this.isEdit) {
getCommunity(this.$route.query.id).then(response => {
this.community = response.data;
});
}else{
this.community = Object.assign({},defaultCommunity);
}
},
methods: {
changeAfters(e){
console.log('123')
console.log(e)
},
handleScroll (e) {
//修复body高度为100%百度地图鼠标滚轮滚动产生位移问题以及全景鼠标hover后未显示全景信息问题
document.body.scrollTop=0
document.documentElement.scrollTop =0
},
syncCenterAndZoom (e) {
const {lng, lat} = e.target.getCenter()
this.center.lng = lng
this.center.lat = lat
this.zoom = e.target.getZoom()
},
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.community.companyId=this.$route.query.cid
this.community.latitude=this.center.lat;
this.community.longitude=this.center.lng;
if (this.isEdit) {
updateCommunity(this.$route.query.id, this.community).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
} else {
createCommunity(this.community).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.community = Object.assign({},defaultCommunity);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.community = Object.assign({},defaultCommunity);
},
},
}
</script>
<style>
.bm-view {
width: 100%;
height: 400px;
}
</style>

View File

@@ -0,0 +1,346 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchCommunityList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button v-if="cid>0"
class="btn-add" type="success" icon="el-icon-download"
@click="addCommunity()"
size="mini">
添加
</el-button>
<el-button @click="exportExcel" type="success" size="mini" icon="el-icon-download">导出</el-button>
<el-upload
style="display: inline"
:show-file-list="false"
:on-success="onSuccess"
:on-error="onError"
:before-upload="beforeUpload"
:action="importExcel">
<el-button size="mini" type="success" :disabled="!enabledUploadBtn" :icon="uploadBtnIcon">导入</el-button>
</el-upload>
</el-card>
<div class="table-container">
<el-table ref="communityTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="小区ID" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="小区名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="电话" align="center">
<template slot-scope="scope">{{scope.row.phone}}</template>
</el-table-column>
<el-table-column label="小区栋数" align="center">
<template slot-scope="scope">{{scope.row.counts}}</template>
</el-table-column>
<el-table-column label="小区地址" align="center">
<template slot-scope="scope">{{scope.row.address}}</template>
</el-table-column>
<el-table-column label="根据定位获取城市编码" align="center">
<template slot-scope="scope">{{scope.row.cityCode}}</template>
</el-table-column>
<el-table-column label="地标" align="center">
<template slot-scope="scope">{{scope.row.nearbyLandmarks}}</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<template slot-scope="scope">{{scope.row.createTime|formatCreateTime}}</template>
</el-table-column>
<!-- <el-table-column label="状态" align="center">
<template slot-scope="scope">{{scope.row.status|formatStatus}}</template>
</el-table-column>-->
<el-table-column label="操作" width="250" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="getAttrList(scope.$index, scope.row)">添加楼
</el-button>
<el-button
size="mini"
@click="getAttrList1(scope.$index, scope.row)">添加缴费规则
</el-button>
<el-button
size="mini"
@click="getAttrList2(scope.$index, scope.row)">添加缴费记录
</el-button>
<el-button
size="mini"
@click="getAttrList3(scope.$index, scope.row)">添加通知
</el-button>
<el-button
size="mini"
@click="getAttrList4(scope.$index, scope.row)">添加轮播图
</el-button>
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteCommunity,exportExcel} from '@/api/build/community'
import {formatDate} from '@/utils/date';
export default {
name: 'communityList',
data() {
return {
importExcel: process.env.BASE_API+'/building/community/importExcel',
uploadBtnIcon:'el-icon-upload2',
enabledUploadBtn:true,
dialogVisible:false,
btnText:'数据导入',
cid:0,
operates: [
{
label: "显示品牌",
value: "showCommunity"
},
{
label: "隐藏品牌",
value: "hideCommunity"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '申请';
} else if (value === 2) {
return '审核失败';
} else if (value === 3) {
return '审核成功';
}
},
},
methods: {
onSuccess(response,file,fileList){
this.enabledUploadBtn=true;
this.uploadBtnIcon="el-icon-upload2";
this.btnText='数据导入';
alert("数据导入成功!");
},
onError(err,file,fileList){
this.enabledUploadBtn=true;
this.uploadBtnIcon="el-icon-upload2";
this.btnText='数据导入';
alert("数据导入失败!请检查是否有重复数据,和网络连接状况!");
},
beforeUpload(file){
this.enabledUploadBtn=false;
this.uploadBtnIcon="el-icon-loading";
this.btnText='正在导入';
},
exportExcel(){
window.open(process.env.BASE_API+'/building/community/exportExcel')
},
getAttrList(index, row) {
this.$router.push({path: '/build/floor',query:{cid:row.id,cname:row.name}})
},
getAttrList1(index, row) {
this.$router.push({path: '/build/typePrice',query:{cid:row.id,cname:row.name}})
},
getAttrList2(index, row) {
this.$router.push({path: '/build/wuyePrice',query:{cid:row.id,cname:row.name}})
},
getAttrList3(index, row) {
this.$router.push({path: '/build/notice',query:{cid:row.id,cname:row.name}})
},
getAttrList4(index, row) {
this.$router.push({path: '/build/adv',query:{cid:row.id,cname:row.name}})
},
getList() {
this.listLoading = true;
this.cid=this.$route.query.cid;
if (this.cid) {
this.listQuery.companyId=this.cid;
}
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({path: '/build/updateCommunity', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteCommunity(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchCommunityList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showCommunity') {
showStatus = 1;
} else if (this.operateType === 'hideCommunity') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addCommunity() {
this.$router.push({path: '/build/addCommunity',query:{cid:this.$route.query.cid,cname:this.$route.query.cname}});
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<community-detail :is-edit='true'></community-detail>
</template>
<script>
import CommunityDetail from './components/CommunityDetail'
export default {
name: 'updateCommunity',
components: { CommunityDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<floor-detail :is-edit='false'></floor-detail>
</template>
<script>
import FloorDetail from './components/FloorDetail'
export default {
name: 'addFloor',
components: { FloorDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,188 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="floor" :rules="rules" ref="floorFrom" label-width="150px">
<!--<el-form-item label="小区:" prop="categoryId" c>
<el-select
v-model="floor.communityId"
@change="handlecateChange"
placeholder="请选择小区">
<el-option
v-for="item in cateOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>-->
<el-form-item label="小区名称:" prop="floorNum">
<el-form-item :label="cname" readonly="readonly"></el-form-item>
</el-form-item>
<el-form-item label="楼编号:" prop="floorNum">
<el-input v-model="floor.floorNum"></el-input>
</el-form-item>
<el-form-item label="小区楼名称:" prop="name">
<el-input v-model="floor.name"></el-input>
</el-form-item>
<el-form-item label="楼层:" prop="layerCount">
<el-input v-model="floor.layerCount"></el-input>
</el-form-item>
<el-form-item label="是否有电梯:">
<el-radio-group v-model="floor.lift">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注:" prop="remark">
<el-input v-model="floor.remark"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('floorFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('floorFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createFloor, getFloor, updateFloor} from '@/api/build/floor'
import {fetchList, deleteSubjectCategory} from '@/api/build/community'
import SingleUpload from '@/components/Upload/singleUpload'
import {formatDate} from '@/utils/date';
const defaultFloor={
name: ''
};
export default {
name: 'FloorDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
floor:Object.assign({}, defaultFloor),
cateOptions:null,
cname:'',
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
this.cname=this.$route.query.cname;
if (this.isEdit) {
getFloor(this.$route.query.id).then(response => {
this.floor = response.data;
});
}else{
this.floor = Object.assign({},defaultFloor);
}
// this.getCateList();
},
methods: {
handlecateChange1(val) {
let brandName = '';
for (let i = 0; i < this.cateOptions.length; i++) {
if (this.cateOptions[i].value === val) {
brandName = this.cateOptions[i].label;
break;
}
}
this.categoryName = brandName;
},
getCateList() {
fetchList({pageNum: 1, pageSize: 100}).then(response => {
this.cateOptions = [];
let brandList = response.data.records;
for (let i = 0; i < brandList.length; i++) {
this.cateOptions.push({label: brandList[i].name, value: brandList[i].id});
}
});
},
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.floor.communityId=this.$route.query.cid
if (this.isEdit) {
updateFloor(this.$route.query.id, this.floor).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
} else {
createFloor(this.floor).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.floor = Object.assign({},defaultFloor);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.floor = Object.assign({},defaultFloor);
this.floor.communityId = Number(this.$route.query.cid);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,299 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchFloorList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入小区编号:">
<el-input style="width: 203px" v-model="listQuery.communityId" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button v-if="cid>0"
class="btn-add"
@click="addFloor()"
size="mini">
添加
</el-button>
<el-button @click="exportExcel" type="success" size="mini" icon="el-icon-download">导出</el-button>
<el-upload
style="display: inline"
:show-file-list="false"
:on-success="onSuccess"
:on-error="onError"
:before-upload="beforeUpload"
:action="importExcel">
<el-button size="mini" type="success" :disabled="!enabledUploadBtn" :icon="uploadBtnIcon">导入</el-button>
</el-upload>
</el-card>
<div class="table-container">
<el-table ref="floorTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="楼ID" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="小区编号" align="center">
<template slot-scope="scope">{{scope.row.communityId}}</template>
</el-table-column>
<el-table-column label="小区楼名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="楼层" align="center">
<template slot-scope="scope">{{scope.row.layerCount}}</template>
</el-table-column>
<el-table-column label="电梯" align="center">
<template slot-scope="scope">{{scope.row.lift |formatStatus}}</template>
</el-table-column>
<el-table-column label="备注" align="center">
<template slot-scope="scope">{{scope.row.remark}}</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<template slot-scope="scope">{{scope.row.createTime|formatCreateTime}}</template>
</el-table-column>
<el-table-column label="操作" width="250" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="getAttrList(scope.$index, scope.row)">添加单元
</el-button>
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteFloor} from '@/api/build/floor'
import {formatDate} from '@/utils/date';
export default {
name: 'floorList',
data() {
return {
importExcel: process.env.BASE_API+'/building/floor/importExcel',
uploadBtnIcon:'el-icon-upload2',
enabledUploadBtn:true,
dialogVisible:false,
btnText:'数据导入',
cid:0,
cname:'',
operates: [
{
label: "显示品牌",
value: "showFloor"
},
{
label: "隐藏品牌",
value: "hideFloor"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '电梯房';
}
return '无电梯';
},
},
methods: {
onSuccess(response,file,fileList){
this.enabledUploadBtn=true;
this.uploadBtnIcon="el-icon-upload2";
this.btnText='数据导入';
alert("数据导入成功!");
},
onError(err,file,fileList){
this.enabledUploadBtn=true;
this.uploadBtnIcon="el-icon-upload2";
this.btnText='数据导入';
alert("数据导入失败!请检查是否有重复数据,和网络连接状况!");
},
beforeUpload(file){
this.enabledUploadBtn=false;
this.uploadBtnIcon="el-icon-loading";
this.btnText='正在导入';
},
exportExcel(){
window.open(process.env.BASE_API+'/building/floor/exportExcel')
},
getAttrList(index, row) {
this.$router.push({path: '/build/unit',query:{cid:row.id,cname:row.name}})
},
getList() {
this.listLoading = true;
this.cid=this.$route.query.cid;
if (this.cid) {
this.listQuery.communityId=this.cid;
}
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({path: '/build/updateFloor', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteFloor(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchFloorList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showFloor') {
showStatus = 1;
} else if (this.operateType === 'hideFloor') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addFloor() {
this.$router.push({path: '/build/addFloor',query:{cid:this.$route.query.cid,cname:this.$route.query.cname}});
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<floor-detail :is-edit='true'></floor-detail>
</template>
<script>
import FloorDetail from './components/FloorDetail'
export default {
name: 'updateFloor',
components: { FloorDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<group-detail :is-edit='false'></group-detail>
</template>
<script>
import GroupDetail from './components/GroupDetail'
export default {
name: 'addGroup',
components: { GroupDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,207 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="group" :rules="rules" ref="groupFrom" label-width="150px">
<el-form-item label="商品:" prop="goodsId">
<el-select
v-model="group.goodsId"
@change="handleBrandChange"
placeholder="请选择商品">
<el-option
v-for="item in goodsOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="拼团价格:" prop="groupPrice">
<el-input v-model="group.groupPrice"></el-input>
</el-form-item>
<el-form-item label="开始时间:" prop="startTime">
<el-date-picker
class="input-width"
v-model="group.startTime"
type="datetime"
:picker-options="pickerOptions1"
placeholder="请选择开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间:" prop="endTime">
<el-date-picker
class="input-width"
v-model="group.endTime"
type="datetime"
:picker-options="pickerOptions1"
placeholder="请选择结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="拼团总人数:" prop="maxPeople">
<el-input v-model="group.maxPeople"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('groupFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('groupFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createGroup, getGroup, updateGroup} from '@/api/build/group'
import SingleUpload from '@/components/Upload/singleUpload'
import {
fetchList
} from '@/api/product'
import {formatDate} from '@/utils/date';
const defaultGroup={
name: ''
};
export default {
name: 'GroupDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
//日期选择器配置
pickerOptions1: {
disabledDate(time) {
return time.getTime() < Date.now();
}
},
group:Object.assign({}, defaultGroup),
goodsOptions:null,
goodsName:'',
originPrice:'',
rules: {
groupPrice: [
{required: true, message: '请输入拼团价格', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
maxPeople: [
{required: true, message: '请输入总人数', trigger: 'blur'}
],
startTime: [
{required: true, message: '请输入开始时间', trigger: 'blur'}
],
endTime: [
{required: true, message: '请输入结束时间', trigger: 'blur'}
],
}
}
},
created() {
this.getGoodsList();
if (this.isEdit) {
getGroup(this.$route.query.id).then(response => {
this.group = response.data;
});
}else{
this.group = Object.assign({},defaultGroup);
}
},
methods: {
getGoodsList() {
fetchList({pageNum: 1, pageSize: 1000}).then(response => {
this.goodsOptions = [];
let brandList = response.data.records;
for (let i = 0; i < brandList.length; i++) {
this.goodsOptions.push({label: brandList[i].price+','+brandList[i].name, value: brandList[i].id});
}
});
},
handleBrandChange(val) {
let brandName = '';
let originPrice = '';
for (let i = 0; i < this.goodsOptions.length; i++) {
if (this.goodsOptions[i].value === val) {
originPrice = this.goodsOptions[i].label.split(",")[0];
brandName = this.goodsOptions[i].label.split(",")[1];
break;
}
}
this.originPrice =originPrice;
this.goodsName = brandName;
},
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.group.goodsName=this.goodsName
this.group.originPrice=this.originPrice
if (this.isEdit) {
updateGroup(this.$route.query.id, this.group).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
} else {
createGroup(this.group).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.group = Object.assign({},defaultGroup);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.group = Object.assign({},defaultGroup);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,284 @@
<template> 
<div class="app-container">
<div class="table-layout">
<el-row>
<el-col :span="4" class="table-cell-title">商品</el-col>
<el-col :span="4" class="table-cell-title">商品价格</el-col>
<el-col :span="4" class="table-cell-title">拼团价格</el-col>
<el-col :span="4" class="table-cell-title">开始时间</el-col>
<el-col :span="4" class="table-cell-title">结束时间</el-col>
<el-col :span="4" class="table-cell-title">拼团小时</el-col>
</el-row>
<el-row>
<el-col :span="4" class="table-cell">{{group.goodsName}}</el-col>
<el-col :span="4" class="table-cell">{{group.originPrice }}</el-col>
<el-col :span="4" class="table-cell">{{group.groupPrice}}</el-col>
<el-col :span="4" class="table-cell">{{group.startTime|formatDate}}</el-col>
<el-col :span="4" class="table-cell">{{group.endTime|formatDate}}</el-col>
<el-col :span="4" class="table-cell">{{group.hours}}</el-col>
</el-row>
<el-row>
<el-col :span="4" class="table-cell-title">拼团总人数</el-col>
<el-col :span="4" class="table-cell-title">状态</el-col>
<el-col :span="4" class="table-cell-title">创建时间</el-col>
</el-row>
<el-row>
<el-col :span="4" class="table-cell">{{group.maxPeople}}</el-col>
<el-col :span="4" class="table-cell">{{group.endTime | formatStatus}}</el-col>
<el-col :span="4" class="table-cell">{{group.createTime | formatDate}}</el-col>
</el-row>
</div>
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float:right"
type="primary"
@click="handleSearchList()"
size="small">
查询搜索
</el-button>
<el-button
style="float:right;margin-right: 15px"
@click="handleResetSearch()"
size="small">
重置
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="使用状态:">
<el-select v-model="listQuery.status" placeholder="全部" clearable class="input-width">
<el-option v-for="item in useTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
</el-card>
<div class="table-container">
<el-table ref="groupHistoryTable"
:data="list"
style="width: 100%;"
v-loading="listLoading" border>
<el-table-column label="商品编码" width="160" align="center">
<template slot-scope="scope">{{scope.row.goodsId}}</template>
</el-table-column>
<el-table-column label="订单编码" width="160" align="center">
<template slot-scope="scope">{{scope.row.orderId}}</template>
</el-table-column>
<el-table-column label="发起人" width="140" align="center">
<template slot-scope="scope">{{scope.row.mainId}}</template>
</el-table-column>
<el-table-column label="会员编码" width="140" align="center">
<template slot-scope="scope">{{scope.row.memberId}}</template>
</el-table-column>
<el-table-column label="会员图像" width="100" align="center">
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.name"></template>
</el-table-column>
<el-table-column label="状态" width="100" align="center">
<template slot-scope="scope">{{scope.row.status | formatMemberStatus}}</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<template slot-scope="scope">{{scope.row.createTime | formatDate}}</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:current-page.sync="listQuery.pageNum"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {formatDate} from '@/utils/date';
import {listGroupMember,getGroup} from '@/api/sms/group';
const defaultListQuery = {
pageNum: 1,
pageSize: 10,
groupId:''
};
const defaultUseTypeOptions= [
{
label: "未开始",
value: 1
},
{
label: "活动中",
value: 2
},
{
label: "已结束",
value: 3
},
{
label: "已失效",
value: 4
}
];
export default {
name: 'groupHistoryList',
data() {
return {
group: {},
listQuery: Object.assign({}, defaultListQuery),
useTypeOptions:Object.assign({},defaultUseTypeOptions),
list:null,
total:null,
listLoading:false
}
},
created() {
getGroup(this.$route.query.id).then(response => {
this.group = response.data;
});
this.listQuery.groupId=this.$route.query.id;
this.getList();
},
filters: {
formatType(type) {
for (let i = 0; i < defaultTypeOptions.length; i++) {
if (type === defaultTypeOptions[i].value) {
return defaultTypeOptions[i].label;
}
}
return '';
},
formatDate(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatMemberStatus(value) {
if (value === 1) {
return '成功';
} else if (value === 2) {
return '失败';
}
},
formatStatus(endTime){
let now = new Date().getTime();
let date = new Date(endTime);
if(date.getTime()>now){
return '未过期'
}else{
return '已过期';
}
},
formatGetType(type) {
if(type===1){
return '主动获取';
}else{
return '后台赠送';
}
},
formatCouponHistoryUseType(useType) {
if (useType === 0) {
return '未使用';
} else if (useType === 1) {
return '已使用';
} else {
return '已过期';
}
},
formatTime(time) {
if (time == null || time === '') {
return 'N/A';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
},
methods: {
getList(){
this.listLoading=true;
listGroupMember(this.listQuery).then(response=>{
this.listLoading=false;
this.list=response.data;
this.total=response.data.total;
});
},
handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery);
this.listQuery.groupId=this.$route.query.id;
},
handleSearchList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
}
}
}
</script>
<style scoped>
.app-container {
width: 80%;
margin: 20px auto;
}
.filter-container {
margin-top: 20px;
}
.table-layout {
margin-top: 20px;
border-left: 1px solid #DCDFE6;
border-top: 1px solid #DCDFE6;
}
.table-cell {
height: 60px;
line-height: 40px;
border-right: 1px solid #DCDFE6;
border-bottom: 1px solid #DCDFE6;
padding: 10px;
font-size: 14px;
color: #606266;
text-align: center;
overflow: hidden;
}
.table-cell-title {
border-right: 1px solid #DCDFE6;
border-bottom: 1px solid #DCDFE6;
padding: 10px;
background: #F2F6FC;
text-align: center;
font-size: 14px;
color: #303133;
}
</style>

View File

@@ -0,0 +1,268 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchGroupList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button
class="btn-add"
@click="addGroup()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="groupTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="商品ID" align="center">
<template slot-scope="scope">{{scope.row.goodsId}}</template>
</el-table-column>
<el-table-column label="商品名称" align="center">
<template slot-scope="scope">{{scope.row.goodsName}}</template>
</el-table-column>
<el-table-column label="商品价格" align="center">
<template slot-scope="scope">{{scope.row.originPrice}}</template>
</el-table-column>
<el-table-column label="拼团价格" align="center">
<template slot-scope="scope">{{scope.row.groupPrice}}</template>
</el-table-column>
<el-table-column label="开始时间" align="center">
<template slot-scope="scope">{{scope.row.startTime | formatCreateTime}}</template>
</el-table-column>
<el-table-column label="结束时间" align="center">
<template slot-scope="scope">{{scope.row.endTime | formatCreateTime}}</template>
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">{{scope.row.endTime | formatStatus}}</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<template slot-scope="scope">{{scope.row.createTime | formatCreateTime}}</template>
</el-table-column>
<el-table-column label="拼团总人数" align="center">
<template slot-scope="scope">{{scope.row.maxPeople}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button size="mini"
type="text"
@click="handleView(scope.$index, scope.row)">查看</el-button>
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteGroup} from '@/api/build/group'
import {formatDate} from '@/utils/date';
export default {
name: 'groupList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showGroup"
},
{
label: "隐藏品牌",
value: "hideGroup"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(endTime){
let now = new Date().getTime();
let date = new Date(endTime);
if(date.getTime()>now){
return '未过期'
}else{
return '已过期';
}
},
},
methods: {
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
//this.total = response.data.records.length;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleView(index, row) {
this.$router.push({path: '/build/buildGroupHistory', query: {id: row.id}})
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
addGroup() {
this.$router.push({path:'/build/addBuildGroup'})
},
handleUpdate(index, row) {
this.$router.push({path: '/build/updateBuildGroup', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteGroup(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchGroupList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showGroup') {
showStatus = 1;
} else if (this.operateType === 'hideGroup') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<group-detail :is-edit='true'></group-detail>
</template>
<script>
import GroupDetail from './components/GroupDetail'
export default {
name: 'updateGroup',
components: { GroupDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<groupMember-detail :is-edit='false'></groupMember-detail>
</template>
<script>
import GroupMemberDetail from './components/GroupMemberDetail'
export default {
name: 'addGroupMember',
components: { GroupMemberDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,154 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="groupMember" :rules="rules" ref="groupMemberFrom" label-width="150px">
<el-form-item label="" prop="id">
<el-input v-model="groupMember.id"></el-input>
</el-form-item>
<el-form-item label="" prop="groupId">
<el-input v-model="groupMember.groupId"></el-input>
</el-form-item>
<el-form-item label="" prop="memberId">
<el-input v-model="groupMember.memberId"></el-input>
</el-form-item>
<el-form-item label="" prop="createTime">
<el-input v-model="groupMember.createTime"></el-input>
</el-form-item>
<el-form-item label="发起人:" prop="applyId">
<el-input v-model="groupMember.applyId"></el-input>
</el-form-item>
<el-form-item label="" prop="name">
<el-input v-model="groupMember.name"></el-input>
</el-form-item>
<el-form-item label="" prop="goodsId">
<el-input v-model="groupMember.goodsId"></el-input>
</el-form-item>
<el-form-item label="状态:" prop="status">
<el-input v-model="groupMember.status"></el-input>
</el-form-item>
<el-form-item label="" prop="orderId">
<el-input v-model="groupMember.orderId"></el-input>
</el-form-item>
<el-form-item label="" prop="exipreTime">
<el-input v-model="groupMember.exipreTime"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('groupMemberFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('groupMemberFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createGroupMember, getGroupMember, updateGroupMember} from '@/api/build/groupMember'
import SingleUpload from '@/components/Upload/singleUpload'
import {formatDate} from '@/utils/date';
const defaultGroupMember={
name: ''
};
export default {
name: 'GroupMemberDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
groupMember:Object.assign({}, defaultGroupMember),
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
if (this.isEdit) {
getGroupMember(this.$route.query.id).then(response => {
this.groupMember = response.data;
});
}else{
this.groupMember = Object.assign({},defaultGroupMember);
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.isEdit) {
updateGroupMember(this.$route.query.id, this.groupMember).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
} else {
createGroupMember(this.groupMember).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.groupMember = Object.assign({},defaultGroupMember);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.groupMember = Object.assign({},defaultGroupMember);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,262 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchGroupMemberList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button
class="btn-add"
@click="addGroupMember()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="groupMemberTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="" align="center">
<template slot-scope="scope">{{scope.row.groupId}}</template>
</el-table-column>
<el-table-column label="" align="center">
<template slot-scope="scope">{{scope.row.memberId}}</template>
</el-table-column>
<el-table-column label="" align="center">
<template slot-scope="scope">{{scope.row.createTime}}</template>
</el-table-column>
<el-table-column label="发起人" align="center">
<template slot-scope="scope">{{scope.row.applyId}}</template>
</el-table-column>
<el-table-column label="" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="" align="center">
<template slot-scope="scope">{{scope.row.goodsId}}</template>
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">{{scope.row.status}}</template>
</el-table-column>
<el-table-column label="" align="center">
<template slot-scope="scope">{{scope.row.orderId}}</template>
</el-table-column>
<el-table-column label="" align="center">
<template slot-scope="scope">{{scope.row.exipreTime}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteGroupMember} from '@/api/build/groupMember'
import {formatDate} from '@/utils/date';
export default {
name: 'groupMemberList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showGroupMember"
},
{
label: "隐藏品牌",
value: "hideGroupMember"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '未开始';
} else if (value === 2) {
return '活动中';
} else if (value === 3) {
return '已结束';
} else if (value === 4) {
return '已失效';
}
},
},
methods: {
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
//this.total = response.data.records.length;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
addGroupMember() {
this.$router.push({path:'/build/add${className}'})
},
handleUpdate(index, row) {
this.$router.push({path: '/build/updateGroupMember', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteGroupMember(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchGroupMemberList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showGroupMember') {
showStatus = 1;
} else if (this.operateType === 'hideGroupMember') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<groupMember-detail :is-edit='true'></groupMember-detail>
</template>
<script>
import GroupMemberDetail from './components/GroupMemberDetail'
export default {
name: 'updateGroupMember',
components: { GroupMemberDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<notice-detail :is-edit='false'></notice-detail>
</template>
<script>
import NoticeDetail from './components/NoticeDetail'
export default {
name: 'addNotice',
components: { NoticeDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,140 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="notice" :rules="rules" ref="noticeFrom" label-width="150px">
<el-form-item label="小区名称:" prop="floorNum">
<el-form-item :label="cname" readonly="readonly"></el-form-item>
</el-form-item>
<el-form-item label="公告标题:" prop="title">
<el-input v-model="notice.title"></el-input>
</el-form-item>
<el-form-item label="公告内容:" prop="content">
<el-input v-model="notice.content"></el-input>
</el-form-item>
<el-form-item label="排序:" prop="sort">
<el-input v-model="notice.sort"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('noticeFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('noticeFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createNotice, getNotice, updateNotice} from '@/api/build/notice'
import SingleUpload from '@/components/Upload/singleUpload'
import {formatDate} from '@/utils/date';
const defaultNotice={
name: ''
};
export default {
name: 'NoticeDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
notice:Object.assign({}, defaultNotice),
cname:'',
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
}
}
},
created() {
this.cname=this.$route.query.cname;
if (this.isEdit) {
getNotice(this.$route.query.id).then(response => {
this.notice = response.data;
});
}else{
this.notice = Object.assign({},defaultNotice);
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.notice.communityId=this.$route.query.cid
if (this.isEdit) {
updateNotice(this.$route.query.id, this.notice).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
} else {
createNotice(this.notice).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.notice = Object.assign({},defaultNotice);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.notice = Object.assign({},defaultNotice);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,253 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchNoticeList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button v-if="cid>0"
class="btn-add"
@click="addNotice()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="noticeTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="公告标题" align="center">
<template slot-scope="scope">{{scope.row.title}}</template>
</el-table-column>
<el-table-column label="公告内容" align="center">
<template slot-scope="scope">{{scope.row.content}}</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<template slot-scope="scope">{{scope.row.createTime | formatCreateTime}}</template>
</el-table-column>
<el-table-column label="排序" align="center">
<template slot-scope="scope">{{scope.row.sort}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteNotice} from '@/api/build/notice'
import {formatDate} from '@/utils/date';
export default {
name: 'noticeList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showNotice"
},
{
label: "隐藏品牌",
value: "hideNotice"
}
],
cid:0,
cname:'',
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '未开始';
} else if (value === 2) {
return '活动中';
} else if (value === 3) {
return '已结束';
} else if (value === 4) {
return '已失效';
}
},
},
methods: {
getList() {
this.listLoading = true;
this.cid=this.$route.query.cid;
if (this.cid) {
this.listQuery.communityId=this.cid;
}
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
//this.total = response.data.records.length;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
addNotice() {
this.$router.push({path:'/build/addNotice',query:{cid:this.$route.query.cid,cname:this.$route.query.cname}});
},
handleUpdate(index, row) {
this.$router.push({path: '/build/updateNotice', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteNotice(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchNoticeList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showNotice') {
showStatus = 1;
} else if (this.operateType === 'hideNotice') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<notice-detail :is-edit='true'></notice-detail>
</template>
<script>
import NoticeDetail from './components/NoticeDetail'
export default {
name: 'updateNotice',
components: { NoticeDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<owner-detail :is-edit='false'></owner-detail>
</template>
<script>
import OwnerDetail from './components/OwnerDetail'
export default {
name: 'addOwner',
components: { OwnerDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,169 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="owner" :rules="rules" ref="ownerFrom" label-width="150px">
<el-form-item label="类型:">
<el-radio-group v-model="owner.type">
<el-radio :label="1">业主本人</el-radio>
<el-radio :label="2">家庭成员</el-radio>
<el-radio :label="3">租户</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="业主名称:" prop="name">
<el-input v-model="owner.name"></el-input>
</el-form-item>
<el-form-item label="性别:" prop="sex">
<el-select
v-model="owner.sex"
placeholder="请选择室">
<el-option
v-for="item in genders"
:key="item.label"
:label="item.label"
:value="item.label">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="年龄:" prop="age">
<el-input v-model="owner.age"></el-input>
</el-form-item>
<el-form-item label="联系人手机号:" prop="phone">
<el-input v-model="owner.phone"></el-input>
</el-form-item>
<el-form-item label="备注:" prop="remark">
<el-input v-model="owner.remark"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('ownerFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('ownerFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createOwner, getOwner, updateOwner} from '@/api/build/owner'
import SingleUpload from '@/components/Upload/singleUpload'
import {formatDate} from '@/utils/date';
const defaultOwner={
name: ''
};
export default {
name: 'OwnerDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
owner:Object.assign({}, defaultOwner),
genders: [
{
label: "男"
},
{
label: "女"
}
],
rules: {
name: [
{required: true, message: '请输入业主名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
phone: [
{required: true, message: '请输入手机', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
if (this.isEdit) {
getOwner(this.$route.query.id).then(response => {
this.owner = response.data;
});
}else{
this.owner = Object.assign({},defaultOwner);
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.owner.roomId=this.$route.query.cid
if (this.isEdit) {
updateOwner(this.$route.query.id, this.owner).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
} else {
createOwner(this.owner).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.owner = Object.assign({},defaultOwner);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.owner = Object.assign({},defaultOwner);
this.owner.unitId = Number(this.$route.query.cid);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,301 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchOwnerList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button v-if="cid>0"
class="btn-add"
@click="addOwner()"
size="mini">
添加
</el-button>
<el-button @click="exportExcel" type="success" size="mini" icon="el-icon-download">导出</el-button>
<el-upload
style="display: inline"
:show-file-list="false"
:on-success="onSuccess"
:on-error="onError"
:before-upload="beforeUpload"
:action="importExcel">
<el-button size="mini" type="success" :disabled="!enabledUploadBtn" :icon="uploadBtnIcon">导入</el-button>
</el-upload>
</el-card>
<div class="table-container">
<el-table ref="ownerTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="业主成员ID" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="业主ID" align="center">
<template slot-scope="scope">{{scope.row.ownerId}}</template>
</el-table-column>
<el-table-column label="房间ID" align="center">
<template slot-scope="scope">{{scope.row.roomId}}</template>
</el-table-column>
<el-table-column label="类型" align="center">
<template slot-scope="scope">{{scope.row.type |formatStatus}}</template>
</el-table-column>
<el-table-column label="业主名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="性别" align="center">
<template slot-scope="scope">{{scope.row.sex}}</template>
</el-table-column>
<el-table-column label="年龄" align="center">
<template slot-scope="scope">{{scope.row.age}}</template>
</el-table-column>
<el-table-column label="联系人手机号" align="center">
<template slot-scope="scope">{{scope.row.phone}}</template>
</el-table-column>
<el-table-column label="备注" align="center">
<template slot-scope="scope">{{scope.row.remark}}</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<template slot-scope="scope">{{scope.row.createTime|formatCreateTime}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteOwner} from '@/api/build/owner'
import {formatDate} from '@/utils/date';
export default {
name: 'ownerList',
data() {
return {
importExcel: process.env.BASE_API+'/building/owner/importExcel',
uploadBtnIcon:'el-icon-upload2',
enabledUploadBtn:true,
dialogVisible:false,
btnText:'数据导入',
operates: [
{
label: "显示品牌",
value: "showOwner"
},
{
label: "隐藏品牌",
value: "hideOwner"
}
],
operateType: null,
cid:0,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '业主本人';
} else if (value === 2) {
return '家庭成员';
}
},
},
methods: {
onSuccess(response,file,fileList){
this.enabledUploadBtn=true;
this.uploadBtnIcon="el-icon-upload2";
this.btnText='数据导入';
alert("数据导入成功!");
},
onError(err,file,fileList){
this.enabledUploadBtn=true;
this.uploadBtnIcon="el-icon-upload2";
this.btnText='数据导入';
alert("数据导入失败!请检查是否有重复数据,和网络连接状况!");
},
beforeUpload(file){
this.enabledUploadBtn=false;
this.uploadBtnIcon="el-icon-loading";
this.btnText='正在导入';
},
exportExcel(){
window.open(process.env.BASE_API+'/building/owner/exportExcel')
},
getList() {
this.listLoading = true;
this.cid=this.$route.query.cid;
if (this.cid) {
this.listQuery.roomId=this.cid;
}
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({path: '/build/updateOwner', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteOwner(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchOwnerList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showOwner') {
showStatus = 1;
} else if (this.operateType === 'hideOwner') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addOwner() {
this.$router.push({path: '/build/addOwner',query:{cid:this.$route.query.cid}});
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<owner-detail :is-edit='true'></owner-detail>
</template>
<script>
import OwnerDetail from './components/OwnerDetail'
export default {
name: 'updateOwner',
components: { OwnerDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<repair-detail :is-edit='false'></repair-detail>
</template>
<script>
import RepairDetail from './components/RepairDetail'
export default {
name: 'addRepair',
components: { RepairDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,154 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="repair" :rules="rules" ref="repairFrom" label-width="150px">
<el-form-item label="编号:" prop="id">
<el-input v-model="repair.id"></el-input>
</el-form-item>
<el-form-item label="房屋编号:" prop="roomId">
<el-input v-model="repair.roomId"></el-input>
</el-form-item>
<el-form-item label="创建时间:" prop="createTime">
<el-input v-model="repair.createTime"></el-input>
</el-form-item>
<el-form-item label="解决时间:" prop="solveTime">
<el-input v-model="repair.solveTime"></el-input>
</el-form-item>
<el-form-item label="报修原因:" prop="resons">
<el-input v-model="repair.resons"></el-input>
</el-form-item>
<el-form-item label="报修者电话:" prop="phone">
<el-input v-model="repair.phone"></el-input>
</el-form-item>
<el-form-item label="解决记录:" prop="solveResons">
<el-input v-model="repair.solveResons"></el-input>
</el-form-item>
<el-form-item label="房屋具体位置:" prop="roomDesc">
<el-input v-model="repair.roomDesc"></el-input>
</el-form-item>
<el-form-item label="价格:" prop="price">
<el-input v-model="repair.price"></el-input>
</el-form-item>
<el-form-item label="1 申请 2 处理中 3 已处理:" prop="status">
<el-input v-model="repair.status"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('repairFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('repairFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createRepair, getRepair, updateRepair} from '@/api/build/repair'
import SingleUpload from '@/components/Upload/singleUpload'
import {formatDate} from '@/utils/date';
const defaultRepair={
name: ''
};
export default {
name: 'RepairDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
repair:Object.assign({}, defaultRepair),
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
if (this.isEdit) {
getRepair(this.$route.query.id).then(response => {
this.repair = response.data;
});
}else{
this.repair = Object.assign({},defaultRepair);
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.isEdit) {
updateRepair(this.$route.query.id, this.repair).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
} else {
createRepair(this.repair).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.repair = Object.assign({},defaultRepair);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.repair = Object.assign({},defaultRepair);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,262 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchRepairList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<!--<el-button
class="btn-add"
@click="addRepair()"
size="mini">
添加
</el-button>-->
</el-card>
<div class="table-container">
<el-table ref="repairTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="房屋编号" align="center">
<template slot-scope="scope">{{scope.row.roomId}}</template>
</el-table-column>
<el-table-column label="报修者电话" align="center">
<template slot-scope="scope">{{scope.row.phone}}</template>
</el-table-column>
<el-table-column label="房屋具体位置" align="center">
<template slot-scope="scope">{{scope.row.roomDesc}}</template>
</el-table-column>
<el-table-column label="申请时间" align="center">
<template slot-scope="scope">{{scope.row.createTime | formatCreateTime}}</template>
</el-table-column>
<el-table-column label="解决时间" align="center">
<template slot-scope="scope">{{scope.row.solveTime | formatCreateTime}}</template>
</el-table-column>
<el-table-column label="报修原因" align="center">
<template slot-scope="scope">{{scope.row.resons}}</template>
</el-table-column>
<el-table-column label="解决记录" align="center">
<template slot-scope="scope">{{scope.row.solveResons}}</template>
</el-table-column>
<el-table-column label="价格" align="center">
<template slot-scope="scope">{{scope.row.price}}</template>
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">{{scope.row.status | formatStatus}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteRepair} from '@/api/build/repair'
import {formatDate} from '@/utils/date';
export default {
name: 'repairList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showRepair"
},
{
label: "隐藏品牌",
value: "hideRepair"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '已申请';
} else if (value === 2) {
return '处理中';
} else if (value === 3) {
return '已处理';
}
},
},
methods: {
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
//this.total = response.data.records.length;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
addRepair() {
this.$router.push({path:'/build/addRepair'})
},
handleUpdate(index, row) {
this.$router.push({path: '/build/updateRepair', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteRepair(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchRepairList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showRepair') {
showStatus = 1;
} else if (this.operateType === 'hideRepair') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<repair-detail :is-edit='true'></repair-detail>
</template>
<script>
import RepairDetail from './components/RepairDetail'
export default {
name: 'updateRepair',
components: { RepairDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<room-detail :is-edit='false'></room-detail>
</template>
<script>
import RoomDetail from './components/RoomDetail'
export default {
name: 'addRoom',
components: { RoomDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,221 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="room" :rules="rules" ref="roomFrom" label-width="150px">
<el-form-item label="房屋编号:" prop="roomNum">
<el-input v-model="room.roomNum"></el-input>
</el-form-item>
<el-form-item label="室:" prop="section">
<el-select
v-model="room.section"
placeholder="请选择室">
<el-option
v-for="item in cateOptions1"
:key="item.id"
:label="item.id"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="户型:" prop="apartment">
<el-select
v-model="room.apartment"
placeholder="请选择户型">
<el-option
v-for="item in cateOptions2"
:key="item.id"
:label="item.id"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="建筑面积:" prop="builtUpArea">
<el-input v-model="room.builtUpArea"></el-input>
</el-form-item>
<el-form-item label="每平米单价:" prop="unitPrice">
<el-input v-model="room.unitPrice"></el-input>
</el-form-item>
<el-form-item label="备注:" prop="remark">
<el-input v-model="room.remark"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('roomFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('roomFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createRoom, getRoom, updateRoom} from '@/api/build/room'
import SingleUpload from '@/components/Upload/singleUpload'
import {formatDate} from '@/utils/date';
const defaultRoom={
name: ''
};
export default {
name: 'RoomDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
room:Object.assign({}, defaultRoom),
cateOptions1:[
{
id: "一室",
name: "一室",
},
{
id: "二室",
name: "二室",
},
{
id: "三室",
name: "三室",
},
{
id: "四室",
name: "四室",
},
{
id: "五室",
name: "五室",
},
{
id: "六室",
name: "六室",
},
],
cateOptions2:[
{
id: "一厅",
name: "一厅",
},
{
id: "二厅",
name: "二厅",
},
{
id: "三厅",
name: "三厅",
},
{
id: "四厅",
name: "四厅",
},
{
id: "五厅",
name: "五厅",
},
{
id: "六厅",
name: "六厅",
},
],
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
if (this.isEdit) {
getRoom(this.$route.query.id).then(response => {
this.room = response.data;
});
}else{
this.room = Object.assign({},defaultRoom);
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.room.unitId=this.$route.query.cid
if (this.isEdit) {
updateRoom(this.$route.query.id, this.room).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
} else {
createRoom(this.room).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.room = Object.assign({},defaultRoom);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.room = Object.assign({},defaultRoom);
this.room.unitId = Number(this.$route.query.cid);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,310 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchRoomList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button v-if="cid>0"
class="btn-add"
@click="addRoom()"
size="mini">
添加
</el-button>
<el-button @click="exportExcel" type="success" size="mini" icon="el-icon-download">导出</el-button>
<el-upload
style="display: inline"
:show-file-list="false"
:on-success="onSuccess"
:on-error="onError"
:before-upload="beforeUpload"
:action="importExcel">
<el-button size="mini" type="success" :disabled="!enabledUploadBtn" :icon="uploadBtnIcon">导入</el-button>
</el-upload>
</el-card>
<div class="table-container">
<el-table ref="roomTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="房屋ID" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="房屋编号" align="center">
<template slot-scope="scope">{{scope.row.roomNum}}</template>
</el-table-column>
<el-table-column label="单元ID" align="center">
<template slot-scope="scope">{{scope.row.unitId}}</template>
</el-table-column>
<el-table-column label="层数" align="center">
<template slot-scope="scope">{{scope.row.layer}}</template>
</el-table-column>
<el-table-column label="户型" align="center">
<template slot-scope="scope">{{scope.row.section}}{{scope.row.apartment}}</template>
</el-table-column>
<el-table-column label="建筑面积" align="center">
<template slot-scope="scope">{{scope.row.builtUpArea}}</template>
</el-table-column>
<el-table-column label="每平米单价" align="center">
<template slot-scope="scope">{{scope.row.unitPrice}}</template>
</el-table-column>
<el-table-column label="详细地址" align="center">
<template slot-scope="scope">{{scope.row.roomDesc}}</template>
</el-table-column>
<el-table-column label="备注" align="center">
<template slot-scope="scope">{{scope.row.remark}}</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<template slot-scope="scope">{{scope.row.createTime|formatCreateTime}}</template>
</el-table-column>
<el-table-column label="操作" width="250" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="getAttrList(scope.$index, scope.row)">添加业主
</el-button>
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteRoom} from '@/api/build/room'
import {formatDate} from '@/utils/date';
export default {
name: 'roomList',
data() {
return {
importExcel: process.env.BASE_API+'/building/room/importExcel',
uploadBtnIcon:'el-icon-upload2',
enabledUploadBtn:true,
dialogVisible:false,
btnText:'数据导入',
operates: [
{
label: "显示品牌",
value: "showRoom"
},
{
label: "隐藏品牌",
value: "hideRoom"
}
],
cid:0,
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '未开始';
} else if (value === 2) {
return '活动中';
} else if (value === 3) {
return '已结束';
} else if (value === 4) {
return '已失效';
}
},
},
methods: {
onSuccess(response,file,fileList){
this.enabledUploadBtn=true;
this.uploadBtnIcon="el-icon-upload2";
this.btnText='数据导入';
alert("数据导入成功!");
},
onError(err,file,fileList){
this.enabledUploadBtn=true;
this.uploadBtnIcon="el-icon-upload2";
this.btnText='数据导入';
alert("数据导入失败!请检查是否有重复数据,和网络连接状况!");
},
beforeUpload(file){
this.enabledUploadBtn=false;
this.uploadBtnIcon="el-icon-loading";
this.btnText='正在导入';
},
exportExcel(){
window.open(process.env.BASE_API+'/building/room/exportExcel')
},
getAttrList(index, row) {
this.$router.push({path: '/build/owner',query:{cid:row.id,cname:row.name}})
},
getList() {
this.cid=this.$route.query.cid;
if (this.cid) {
this.listQuery.unitId=this.cid;
}
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({path: '/build/updateRoom', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteRoom(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchRoomList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showRoom') {
showStatus = 1;
} else if (this.operateType === 'hideRoom') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addRoom() {
this.$router.push({path: '/build/addRoom',query:{cid:this.$route.query.cid}});
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<room-detail :is-edit='true'></room-detail>
</template>
<script>
import RoomDetail from './components/RoomDetail'
export default {
name: 'updateRoom',
components: { RoomDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<typePrice-detail :is-edit='false'></typePrice-detail>
</template>
<script>
import TypePriceDetail from './components/TypePriceDetail'
export default {
name: 'addTypePrice',
components: { TypePriceDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,141 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="typePrice" :rules="rules" ref="typePriceFrom" label-width="150px">
<el-form-item label="小区名称:" prop="floorNum">
<el-form-item :label="cname" readonly="readonly"></el-form-item>
</el-form-item>
<el-form-item label="名称:" prop="name">
<el-input v-model="typePrice.name"></el-input>
</el-form-item>
<el-form-item label="单价:" prop="price">
<el-input v-model="typePrice.price"></el-input>
</el-form-item>
<el-form-item label="单位:" prop="remark">
<el-input v-model="typePrice.remark"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('typePriceFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('typePriceFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createTypePrice, getTypePrice, updateTypePrice} from '@/api/build/typePrice'
import SingleUpload from '@/components/Upload/singleUpload'
import {formatDate} from '@/utils/date';
const defaultTypePrice={
name: ''
};
export default {
name: 'TypePriceDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
typePrice:Object.assign({}, defaultTypePrice),
cname:'',
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
this.cname=this.$route.query.cname;
if (this.isEdit) {
getTypePrice(this.$route.query.id).then(response => {
this.typePrice = response.data;
});
}else{
this.typePrice = Object.assign({},defaultTypePrice);
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.typePrice.communityId=this.$route.query.cid
if (this.isEdit) {
updateTypePrice(this.$route.query.id, this.typePrice).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
} else {
createTypePrice(this.typePrice).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.typePrice = Object.assign({},defaultTypePrice);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.typePrice = Object.assign({},defaultTypePrice);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,253 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchTypePriceList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button v-if="cid>0"
class="btn-add"
@click="addTypePrice()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="typePriceTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="单价" align="center">
<template slot-scope="scope">{{scope.row.price}}</template>
</el-table-column>
<el-table-column label="单位" align="center">
<template slot-scope="scope">{{scope.row.remark}}</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<template slot-scope="scope">{{scope.row.createTime|formatCreateTime}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteTypePrice} from '@/api/build/typePrice'
import {formatDate} from '@/utils/date';
export default {
name: 'typePriceList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showTypePrice"
},
{
label: "隐藏品牌",
value: "hideTypePrice"
}
],
cid:0,
cname:'',
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '未开始';
} else if (value === 2) {
return '活动中';
} else if (value === 3) {
return '已结束';
} else if (value === 4) {
return '已失效';
}
},
},
methods: {
getList() {
this.listLoading = true;
this.cid=this.$route.query.cid;
if (this.cid) {
this.listQuery.communityId=this.cid;
}
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
//this.total = response.data.records.length;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
addTypePrice() {
this.$router.push({path:'/build/addTypePrice',query:{cid:this.$route.query.cid,cname:this.$route.query.cname}});
},
handleUpdate(index, row) {
this.$router.push({path: '/build/updateTypePrice', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteTypePrice(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchTypePriceList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showTypePrice') {
showStatus = 1;
} else if (this.operateType === 'hideTypePrice') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<typePrice-detail :is-edit='true'></typePrice-detail>
</template>
<script>
import TypePriceDetail from './components/TypePriceDetail'
export default {
name: 'updateTypePrice',
components: { TypePriceDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<unit-detail :is-edit='false'></unit-detail>
</template>
<script>
import UnitDetail from './components/UnitDetail'
export default {
name: 'addUnit',
components: { UnitDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,135 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="unit" :rules="rules" ref="unitFrom" label-width="150px">
<el-form-item label="单元编号:" prop="unitNum">
<el-input v-model="unit.unitNum"></el-input>
</el-form-item>
<el-form-item label="备注:" prop="remark">
<el-input v-model="unit.remark"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('unitFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('unitFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createUnit, getUnit, updateUnit} from '@/api/build/unit'
import SingleUpload from '@/components/Upload/singleUpload'
import {formatDate} from '@/utils/date';
const defaultUnit={
name: ''
};
export default {
name: 'UnitDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
unit:Object.assign({}, defaultUnit),
rules: {
unitNum: [
{required: true, message: '请输入单元编号', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
if (this.isEdit) {
getUnit(this.$route.query.id).then(response => {
this.unit = response.data;
});
}else{
this.unit = Object.assign({},defaultUnit);
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.unit.floorId=this.$route.query.cid
if (this.isEdit) {
updateUnit(this.$route.query.id, this.unit).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
} else {
createUnit(this.unit).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.unit = Object.assign({},defaultUnit);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.unit = Object.assign({},defaultUnit);
this.unit.floorId = Number(this.$route.query.cid);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,296 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchUnitList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button v-if="cid>0"
class="btn-add"
@click="addUnit()"
size="mini">
添加
</el-button>
<el-button @click="exportExcel" type="success" size="mini" icon="el-icon-download">导出</el-button>
<el-upload
style="display: inline"
:show-file-list="false"
:on-success="onSuccess"
:on-error="onError"
:before-upload="beforeUpload"
:action="importExcel">
<el-button size="mini" type="success" :disabled="!enabledUploadBtn" :icon="uploadBtnIcon">导入</el-button>
</el-upload>
</el-card>
<div class="table-container">
<el-table ref="unitTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="单元ID" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="单元编号" align="center">
<template slot-scope="scope">{{scope.row.unitNum}}</template>
</el-table-column>
<el-table-column label="楼ID" align="center">
<template slot-scope="scope">{{scope.row.floorId}}</template>
</el-table-column>
<el-table-column label="备注" align="center">
<template slot-scope="scope">{{scope.row.remark}}</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<template slot-scope="scope">{{scope.row.createTime|formatCreateTime}}</template>
</el-table-column>
<el-table-column label="操作" width="250" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="getAttrList(scope.$index, scope.row)">添加房屋
</el-button>
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteUnit} from '@/api/build/unit'
import {formatDate} from '@/utils/date';
export default {
name: 'unitList',
data() {
return {
importExcel: process.env.BASE_API+'/building/unit/importExcel',
uploadBtnIcon:'el-icon-upload2',
enabledUploadBtn:true,
dialogVisible:false,
btnText:'数据导入',
cid:0,
operates: [
{
label: "显示品牌",
value: "showUnit"
},
{
label: "隐藏品牌",
value: "hideUnit"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '未开始';
} else if (value === 2) {
return '活动中';
} else if (value === 3) {
return '已结束';
} else if (value === 4) {
return '已失效';
}
},
},
methods: {
onSuccess(response,file,fileList){
this.enabledUploadBtn=true;
this.uploadBtnIcon="el-icon-upload2";
this.btnText='数据导入';
alert("数据导入成功!");
},
onError(err,file,fileList){
this.enabledUploadBtn=true;
this.uploadBtnIcon="el-icon-upload2";
this.btnText='数据导入';
alert("数据导入失败!请检查是否有重复数据,和网络连接状况!");
},
beforeUpload(file){
this.enabledUploadBtn=false;
this.uploadBtnIcon="el-icon-loading";
this.btnText='正在导入';
},
exportExcel(){
window.open(process.env.BASE_API+'/building/unit/exportExcel')
},
getAttrList(index, row) {
this.$router.push({path: '/build/room',query:{cid:row.id,cname:row.name}})
},
getList() {
this.listLoading = true;
this.cid=this.$route.query.cid;
if (this.cid) {
this.listQuery.floorId=this.cid;
}
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({path: '/build/updateUnit', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteUnit(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchUnitList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showUnit') {
showStatus = 1;
} else if (this.operateType === 'hideUnit') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addUnit() {
this.$router.push({path: '/build/addUnit',query:{cid:this.$route.query.cid}});
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<unit-detail :is-edit='true'></unit-detail>
</template>
<script>
import UnitDetail from './components/UnitDetail'
export default {
name: 'updateUnit',
components: { UnitDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<wuyeCompany-detail :is-edit='false'></wuyeCompany-detail>
</template>
<script>
import WuyeCompanyDetail from './components/WuyeCompanyDetail'
export default {
name: 'addWuyeCompany',
components: { WuyeCompanyDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,169 @@
<template> 
<div style="margin-top: 50px">
<el-form :model="role" :rules="rules" ref="roleFrom"
label-width="120px" style="width: 680px"
size="small">
<el-form-item label="用户名称:" prop="name">
<el-input v-model="role.nickName"></el-input>
</el-form-item>
<el-form-item label="关联权限:">
<el-transfer
style="display: inline-block"
filterable
:filter-method="filterMethod"
filter-placeholder="请输入权限名称"
v-model="selectSubject"
:titles="subjectTitles"
:data="subjectList">
</el-transfer>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('roleFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('roleFrom')">重置</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { getAdmin,userCommunityRelate,communityList } from '@/api/admin'
import {fetchList as fetchSubjectList} from '@/api/build/community'
import SingleUpload from '@/components/Upload/singleUpload'
const defaultRole={
name: ''
};
export default {
name: 'RoleDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
role:Object.assign({}, defaultRole),
//所有专题列表
subjectList: [],
//专题左右标题
subjectTitles: ['待选择', '已选择'],
communityIds:null,
rules: {
}
}
},
created() {
this.getSubjectList();
communityList(this.$route.query.id).then(res => {
this.communityIds=res.data;
});
getAdmin(this.$route.query.id).then(response => {
this.role = response.data;
});
},
computed:{
//选中的专题
selectSubject:{
get:function () {
let subjects =[];
if(this.communityIds==null||this.communityIds.length<=0){
return subjects;
}
for(let i=0;i<this.communityIds.length;i++){
subjects.push(this.communityIds[i].communityId);
}
return subjects;
},
set:function (newValue) {
console.log(newValue)
this.communityIds=[];
for(let i=0;i<newValue.length;i++){
this.communityIds.push({communityId:newValue[i]});
}
}
},
},
methods: {
getSubjectList() {
fetchSubjectList().then(response => {
let list = response.data.records;
for (let i = 0; i < list.length; i++) {
this.subjectList.push({
label: list[i].name,
key: list[i].id
});
}
});
},
filterMethod(query, item) {
return item.label.indexOf(query) > -1;
},
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let serviceIds='';
for(let i=0;i<this.communityIds.length;i++){
serviceIds += this.communityIds[i].communityId + ',';
}
if (serviceIds.endsWith(',')) {
serviceIds = serviceIds.substr(0, serviceIds.length - 1)
}
this.role.communityIds = serviceIds;
this.role.userId=this.role.id;
if (this.isEdit) {
userCommunityRelate( this.role).then(response => {
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
});
} else {
userCommunityRelate(this.role).then(response => {
this.$refs[formName].resetFields();
this.role = Object.assign({},defaultRole);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.role = Object.assign({},defaultRole);
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,149 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="wuyeCompany" :rules="rules" ref="wuyeCompanyFrom" label-width="150px">
<el-form-item label="名称:" prop="name">
<el-input v-model="wuyeCompany.name"></el-input>
</el-form-item>
<el-form-item label="联系方式:" prop="phone">
<el-input v-model="wuyeCompany.phone"></el-input>
</el-form-item>
<!--<el-form-item label="状态:">
<el-radio-group v-model="wuyeCompany.status">
<el-radio :label="1">申请</el-radio>
<el-radio :label="2">审核失败</el-radio>
<el-radio :label="3">审核成功</el-radio>
</el-radio-group>
</el-form-item>-->
<el-form-item label="照片:" prop="pic">
<single-upload v-model="wuyeCompany.pic"></single-upload>
</el-form-item>
<el-form-item label="位置:" prop="address">
<el-input v-model="wuyeCompany.address"></el-input>
</el-form-item>
<!-- <el-form-item label="审核内容:" prop="statusDesc">
<el-input v-model="wuyeCompany.statusDesc"></el-input>
</el-form-item>-->
<el-form-item>
<el-button type="primary" @click="onSubmit('wuyeCompanyFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('wuyeCompanyFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createWuyeCompany, getWuyeCompany, updateWuyeCompany} from '@/api/build/wuyeCompany'
import SingleUpload from '@/components/Upload/singleUpload'
import {formatDate} from '@/utils/date';
const defaultWuyeCompany={
name: ''
};
export default {
name: 'WuyeCompanyDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
wuyeCompany:Object.assign({}, defaultWuyeCompany),
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
if (this.isEdit) {
getWuyeCompany(this.$route.query.id).then(response => {
this.wuyeCompany = response.data;
});
}else{
this.wuyeCompany = Object.assign({},defaultWuyeCompany);
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.isEdit) {
updateWuyeCompany(this.$route.query.id, this.wuyeCompany).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
} else {
createWuyeCompany(this.wuyeCompany).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.wuyeCompany = Object.assign({},defaultWuyeCompany);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.wuyeCompany = Object.assign({},defaultWuyeCompany);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,262 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchWuyeCompanyList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button
class="btn-add"
@click="addWuyeCompany()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="wuyeCompanyTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="联系方式" align="center">
<template slot-scope="scope">{{scope.row.phone}}</template>
</el-table-column>
<!-- <el-table-column label="状态" align="center">
<template slot-scope="scope">{{scope.row.status|formatStatus}}</template>
</el-table-column>-->
<el-table-column label="照片" align="center">
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.pic"></template>
</el-table-column>
<el-table-column label="位置" align="center">
<template slot-scope="scope">{{scope.row.address}}</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<template slot-scope="scope">{{scope.row.createTime|formatCreateTime}}</template>
</el-table-column>
<!-- <el-table-column label="审核内容" align="center">
<template slot-scope="scope">{{scope.row.statusDesc}}</template>
</el-table-column>-->
<el-table-column label="操作" width="250" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleCommunity(scope.$index, scope.row)">绑定小区
</el-button>
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteWuyeCompany} from '@/api/build/wuyeCompany'
import {formatDate} from '@/utils/date';
export default {
name: 'wuyeCompanyList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showWuyeCompany"
},
{
label: "隐藏品牌",
value: "hideWuyeCompany"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '已申请';
} else if (value === 2) {
return '处理中';
} else if (value === 3) {
return '已处理';
}
},
},
methods: {
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
//this.total = response.data.records.length;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleCommunity(index, row) {
this.$router.push({path: '/build/community',query:{cid:row.id,cname:row.name}})
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
addWuyeCompany() {
this.$router.push({path:'/build/addWuyeCompany'})
},
handleUpdate(index, row) {
this.$router.push({path: '/build/updateWuyeCompany', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteWuyeCompany(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchWuyeCompanyList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showWuyeCompany') {
showStatus = 1;
} else if (this.operateType === 'hideWuyeCompany') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<wuyeCompany-detail :is-edit='true'></wuyeCompany-detail>
</template>
<script>
import WuyeCompanyDetail from './components/WuyeCompanyDetail'
export default {
name: 'updateWuyeCompany',
components: { WuyeCompanyDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<wuyePrice-detail :is-edit='false'></wuyePrice-detail>
</template>
<script>
import WuyePriceDetail from './components/WuyePriceDetail'
export default {
name: 'addWuyePrice',
components: { WuyePriceDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,218 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="wuyePrice" :rules="rules" ref="wuyePriceFrom" label-width="150px">
<el-form-item label="小区名称:" prop="floorNum">
<el-form-item :label="cname" readonly="readonly"></el-form-item>
</el-form-item>
<el-form-item v-if="wuyePrice.roomId !== 0" style="margin-bottom: 0px;" label="房屋">
<treeselect v-model="wuyePrice.roomId" :options="rooms"
:disable-branch-nodes="true" style="width: 370px;" placeholder="房屋" />
</el-form-item>
<el-form-item label="收费类别:" prop="priceId">
<el-select
v-model="wuyePrice.priceId"
@change="handlecateChange"
placeholder="请选择收费类别">
<el-option
v-for="item in cateOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="单价:" prop="price">
<el-form-item :label="wuyePrice.price" readonly="readonly"></el-form-item>
</el-form-item>
<el-form-item label="用量:" prop="amount">
<el-input v-model="wuyePrice.amount"></el-input>
</el-form-item>
<el-form-item label="总额:" prop="moneys">
<el-form-item :label="wuyePrice.price*wuyePrice.amount" readonly="readonly"></el-form-item>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('wuyePriceFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('wuyePriceFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createWuyePrice, getWuyePrice, updateWuyePrice} from '@/api/build/wuyePrice'
import {fetchList} from '@/api/build/typePrice'
import {withChilds} from '@/api/build/room'
import SingleUpload from '@/components/Upload/singleUpload'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import {formatDate} from '@/utils/date';
const defaultWuyePrice={
name: ''
};
export default {
name: 'WuyePriceDetail',
components:{SingleUpload,Treeselect},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
wuyePrice:Object.assign({}, defaultWuyePrice),
cname:'',
cateOptions:null,
price:0,
//选中商品分类的值
rooms: [],
types: [],
priceName:null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 1000
},
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
this.cname=this.$route.query.cname;
if (this.isEdit) {
getWuyePrice(this.$route.query.id).then(response => {
this.wuyePrice = response.data;
});
}else{
this.wuyePrice = Object.assign({},defaultWuyePrice);
}
this.getProductCateList();
this.getTypeList();
},
methods: {
getProductCateList() {
this.listQuery.communityId=this.$route.query.cid
withChilds(this.listQuery).then(response => {
let list = response.data;
this.rooms = list;
});
},
getTypeList() {
this.listQuery.communityId=this.$route.query.cid
this.cateOptions = [];
fetchList(this.listQuery).then(response => {
let list = response.data.records;
for (let i = 0; i < list.length; i++) {
this.cateOptions.push({label: list[i].name+'每'+list[i].remark, value: list[i].id, price: list[i].price});
}
});
},
handlecateChange(val) {
let brandName = '';
let price = '';
for (let i = 0; i < this.cateOptions.length; i++) {
if (this.cateOptions[i].value === val) {
brandName = this.cateOptions[i].label;
price=this.cateOptions[i].price;
break;
}
}
this.wuyePrice.price = price;
this.wuyePrice.priceName=brandName
this.priceName = brandName;
},
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.wuyePrice.priceName=this.priceName
this.wuyePrice.communityId=this.$route.query.cid
if (this.isEdit) {
updateWuyePrice(this.$route.query.id, this.wuyePrice).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
} else {
createWuyePrice(this.wuyePrice).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.wuyePrice = Object.assign({},defaultWuyePrice);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.wuyePrice = Object.assign({},defaultWuyePrice);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,125 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增部门' : '编辑部门'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" style="width: 370px;"/>
</el-form-item>
<el-form-item v-if="form.pid !== 0" label="状态" prop="enabled">
<el-radio v-for="item in dicts" :key="item.id" v-model="form.enabled" :label="item.value">{{ item.label }}</el-radio>
</el-form-item>
<el-form-item v-if="form.pid !== 0" style="margin-bottom: 0px;" label="上级部门">
<treeselect v-model="form.pid" :options="depts" style="width: 370px;" placeholder="选择上级类目" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default {
components: { Treeselect },
props: {
isAdd: {
type: Boolean,
required: true
},
dicts: {
type: Array,
required: true
}
},
data() {
return {
loading: false, dialog: false, depts: [],
form: {
id: '',
name: '',
pid: 1,
enabled: 'true'
},
rules: {
name: [
{ required: true, message: '请输入名称', trigger: 'blur' }
]
}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.form.pid !== undefined) {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
} else {
this.$message({
message: '上级部门不能为空',
type: 'warning'
})
}
}
})
},
doAdd() {
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
doEdit() {
edit(this.form).then(res => {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
name: '',
pid: 1,
enabled: 'true'
}
},
getDepts() {
getDepts({ enabled: true }).then(res => {
this.depts = res.content
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,264 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchWuyePriceList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button v-if="cid>0"
class="btn-add"
@click="addWuyePrice()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="wuyePriceTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="房屋" align="center">
<template slot-scope="scope">{{scope.row.roomId}}</template>
</el-table-column>
<el-table-column label="房屋详细地址" align="center">
<template slot-scope="scope">{{scope.row.roomDesc}}</template>
</el-table-column>
<el-table-column label="收费名称" align="center">
<template slot-scope="scope">{{scope.row.priceName}}</template>
</el-table-column>
<el-table-column label="单价" align="center">
<template slot-scope="scope">{{scope.row.price}}</template>
</el-table-column>
<el-table-column label="用量" align="center">
<template slot-scope="scope">{{scope.row.amount}}</template>
</el-table-column>
<el-table-column label="总额" align="center">
<template slot-scope="scope">{{scope.row.moneys}}</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<template slot-scope="scope">{{scope.row.createDate|formatCreateTime}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteWuyePrice} from '@/api/build/wuyePrice'
import {formatDate} from '@/utils/date';
export default {
name: 'wuyePriceList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showWuyePrice"
},
{
label: "隐藏品牌",
value: "hideWuyePrice"
}
],
cid:0,
cname:'',
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '未开始';
} else if (value === 2) {
return '活动中';
} else if (value === 3) {
return '已结束';
} else if (value === 4) {
return '已失效';
}
},
},
methods: {
getList() {
this.listLoading = true;
this.cid=this.$route.query.cid;
if (this.cid) {
this.listQuery.communityId=this.cid;
}
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
//this.total = response.data.records.length;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
addWuyePrice() {
this.$router.push({path:'/build/addWuyePrice',query:{cid:this.$route.query.cid,cname:this.$route.query.cname}});
},
handleUpdate(index, row) {
this.$router.push({path: '/build/updateWuyePrice', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteWuyePrice(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchWuyePriceList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showWuyePrice') {
showStatus = 1;
} else if (this.operateType === 'hideWuyePrice') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<wuyePrice-detail :is-edit='true'></wuyePrice-detail>
</template>
<script>
import WuyePriceDetail from './components/WuyePriceDetail'
export default {
name: 'updateWuyePrice',
components: { WuyePriceDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,16 @@
<template> 
<cmsZhaoPin-detail :is-edit='false'>
</cmsZhaoPin-detail>
</template>
<script>
import CmsZhaoPinDetail from './components/detail'
export default {
name: 'addCmsZhaoPin',
components: {CmsZhaoPinDetail}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,240 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="cmsZhaoPin" :rules="rules" ref="CmsZhaoPinFrom" label-width="150px">
<el-form-item
label="编号"
prop="id">
<el-input v-model="cmsZhaoPin.id" style="width: 370px;"/>
</el-form-item>
<el-form-item
label="姓名"
prop="name">
<el-input v-model="cmsZhaoPin.name" style="width: 370px;"/>
</el-form-item>
<el-form-item
label="年龄"
prop="age">
<el-input v-model="cmsZhaoPin.age" style="width: 370px;"/>
</el-form-item>
<el-form-item
label="性别"
prop="sex">
<el-input v-model="cmsZhaoPin.sex" style="width: 370px;"/>
</el-form-item>
<el-form-item
label="地址"
prop="address">
<el-input v-model="cmsZhaoPin.address" style="width: 370px;"/>
</el-form-item>
<el-form-item
label="学历"
prop="xueli">
<el-input v-model="cmsZhaoPin.xueli" style="width: 370px;"/>
</el-form-item>
<el-form-item
label="备注"
prop="remark">
<el-input v-model="cmsZhaoPin.remark" style="width: 370px;"/>
</el-form-item>
<el-form-item
label="身份证"
prop="idcard">
<el-input v-model="cmsZhaoPin.idcard" style="width: 370px;"/>
</el-form-item>
<el-form-item
label="身份证照片"
prop="idcardpic">
<el-input v-model="cmsZhaoPin.idcardpic" style="width: 370px;"/>
</el-form-item>
<el-form-item
label="期望薪水"
prop="xinshui">
<el-input v-model="cmsZhaoPin.xinshui" style="width: 370px;"/>
</el-form-item>
<el-form-item
label="爱好"
prop="hobby">
<el-input v-model="cmsZhaoPin.hobby" style="width: 370px;"/>
</el-form-item>
<el-form-item
label="区域编号"
prop="areaId">
<el-input v-model="cmsZhaoPin.areaId" style="width: 370px;"/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('CmsZhaoPinFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('CmsZhaoPinFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createCmsZhaoPin, getCmsZhaoPin, updateCmsZhaoPin} from '@/api/cms/cmsZhaoPin'
import SingleUpload from '@/components/Upload/singleUpload'
const defaultCmsZhaoPin
= {
name: ''
};
export default {
name: 'CmsZhaoPinDetail',
components: {SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
cmsZhaoPin:
Object.assign({},
defaultCmsZhaoPin),
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo
:
[
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort
:
[
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
if (this.isEdit) {
getCmsZhaoPin(this.$route.query.id).then(response => {
this.cmsZhaoPin = response.data;
})
;
} else {
this.cmsZhaoPin = Object.assign({},
defaultCmsZhaoPin)
;
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if(valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if(this.isEdit
)
{
updateCmsZhaoPin(this.$route.query.id, this.cmsZhaoPin).then(response => {
if(response.code == 200
)
{
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
this.$router.back();
}
else
{
this.$message({
message: response.msg,
type: 'error',
duration: 1000
});
}
})
;
}
else
{
createCmsZhaoPin(this.cmsZhaoPin).then(response => {
if(response.code == 200
)
{
this.$refs[formName].resetFields();
this.cmsZhaoPin = Object.assign({},
defaultCmsZhaoPin)
;
this.$message({
message: '提交成功',
type: 'success',
duration: 1000
});
this.$router.back();
}
else
{
this.$message({
message: response.msg,
type: 'error',
duration: 1000
});
}
})
;
}
})
;
} else {
this.$message({
message: '验证失败',
type: 'error',
duration: 1000
});
return false;
}
})
;
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.cmsZhaoPin = Object.assign({},
defaultCmsZhaoPin)
;
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,324 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchCmsZhaoPinList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="类型名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button
class="btn-add"
@click="addCmsZhaoPin()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="cmsZhaoPinTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column prop="id"
label="编号">
<template slot-scope="scope">
{{scope.row.id }}
</template>
</el-table-column>
<el-table-column prop="name"
label="姓名">
<template slot-scope="scope">
{{scope.row.name }}
</template>
</el-table-column>
<el-table-column prop="age"
label="年龄">
<template slot-scope="scope">
{{scope.row.age }}
</template>
</el-table-column>
<el-table-column prop="sex"
label="性别">
<template slot-scope="scope">
{{scope.row.sex }}
</template>
</el-table-column>
<el-table-column prop="address"
label="地址">
<template slot-scope="scope">
{{scope.row.address }}
</template>
</el-table-column>
<el-table-column prop="xueli"
label="学历">
<template slot-scope="scope">
{{scope.row.xueli }}
</template>
</el-table-column>
<el-table-column prop="remark"
label="备注">
<template slot-scope="scope">
{{scope.row.remark }}
</template>
</el-table-column>
<el-table-column prop="idcard"
label="身份证">
<template slot-scope="scope">
{{scope.row.idcard }}
</template>
</el-table-column>
<el-table-column prop="idcardpic"
label="身份证照片">
<template slot-scope="scope">
{{scope.row.idcardpic }}
</template>
</el-table-column>
<el-table-column prop="xinshui"
label="期望薪水">
<template slot-scope="scope">
{{scope.row.xinshui }}
</template>
</el-table-column>
<el-table-column prop="hobby"
label="爱好">
<template slot-scope="scope">
{{scope.row.hobby }}
</template>
</el-table-column>
<el-table-column prop="areaId"
label="区域编号">
<template slot-scope="scope">
{{scope.row.areaId }}
</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
//将$都替换为$
import {fetchList, deleteCmsZhaoPin} from '@/api/cms/cmsZhaoPin'
import {formatDate} from '@/utils/date';
export default {
name: 'cmsZhaoPinList',
data() {
return {
operates: [],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '未开始';
} else if (value === 2) {
return '活动中';
} else if (value === 3) {
return '已结束';
} else if (value === 4) {
return '已失效';
}
},
},
methods: {
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
})
;
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push(
{path: '/cms/updateCmsZhaoPin', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该类型', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteCmsZhaoPin(row.id
).
then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
})
;
})
;
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchCmsZhaoPinList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showCmsZhaoPin') {
showStatus = 1;
} else if (this.operateType === 'hideCmsZhaoPin') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
})
;
},
addCmsZhaoPin() {
//手动将router,改成$router
this.$router.push({path: '/cms/addCmsZhaoPin'})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,16 @@
<template> 
<cmsZhaoPin-detail :is-edit='true'>
</cmsZhaoPin-detail>
</template>
<script>
import CmsZhaoPinDetail from './components/detail'
export default {
name: 'updateCmsZhaoPin',
components: {CmsZhaoPinDetail}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<help-detail :is-edit='false'></help-detail>
</template>
<script>
import HelpDetail from './components/HelpDetail'
export default {
name: 'addHelp',
components: { HelpDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,173 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="help" :rules="rules" ref="helpFrom" label-width="150px">
<el-form-item label="类别:" prop="categoryId">
<el-select
v-model="help.categoryId"
@change="handlecateChange"
placeholder="请选择分类">
<el-option
v-for="item in cateOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="标题:" prop="title">
<el-input v-model="help.title"></el-input>
</el-form-item>
<el-form-item label="图片:" prop="icon">
<single-upload v-model="help.icon"></single-upload>
</el-form-item>
<el-form-item label="是否显示:">
<el-radio-group v-model="help.showStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="内容:" prop="content">
<el-tabs v-model="activeHtmlName" type="card">
<el-tab-pane label="电脑端详情" name="pc">
<tinymce :width="595" :height="300" v-model="help.content"></tinymce>
</el-tab-pane>
<el-tab-pane label="移动端详情" name="mobile">
<tinymce :width="595" :height="300" v-model="help.content"></tinymce>
</el-tab-pane>
</el-tabs>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('helpFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('helpFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createHelp, getHelp, updateHelp} from '@/api/cms/help'
import {fetchList, deleteSubjectCategory} from '@/api/cms/helpCategory'
import SingleUpload from '@/components/Upload/singleUpload'
import Tinymce from '@/components/Tinymce'
import MultiUpload from '@/components/Upload/multiUpload'
const defaultHelp={
name: ''
};
export default {
name: 'HelpDetail',
components:{SingleUpload, MultiUpload, Tinymce},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
help:Object.assign({}, defaultHelp),
categoryName:'',
album_pics:null,
cateOptions:null,
activeHtmlName: 'pc',
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
if (this.isEdit) {
getHelp(this.$route.query.id).then(response => {
this.help = response.data;
});
}else{
this.help = Object.assign({},defaultHelp);
}
this.getCateList();
},
methods: {
getCateList() {
fetchList({pageNum: 1, pageSize: 100}).then(response => {
this.cateOptions = [];
let brandList = response.data.records;
for (let i = 0; i < brandList.length; i++) {
this.cateOptions.push({label: brandList[i].name, value: brandList[i].id});
}
});
},
handlecateChange(val) {
let brandName = '';
for (let i = 0; i < this.cateOptions.length; i++) {
if (this.cateOptions[i].value === val) {
brandName = this.cateOptions[i].label;
break;
}
}
this.categoryName = brandName;
},
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.help.categoryName=this.categoryName
if (this.isEdit) {
updateHelp(this.$route.query.id, this.help).then(response => {
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
});
} else {
createHelp(this.help).then(response => {
this.$refs[formName].resetFields();
this.help = Object.assign({},defaultHelp);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.help = Object.assign({},defaultHelp);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,291 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchHelpList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button
class="btn-add"
@click="addHelp()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="helpTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="类别" align="center">
<template slot-scope="scope">{{scope.row.categoryId}}</template>
</el-table-column>
<el-table-column label="图片" align="center">
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.icon"></template>
</el-table-column>
<el-table-column label="标题" align="center">
<template slot-scope="scope">{{scope.row.title}}</template>
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<el-switch
@change="handleShowChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.showStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<template slot-scope="scope">{{scope.row.createTime |formatCreateTime}}</template>
</el-table-column>
<el-table-column label="点击量" align="center">
<template slot-scope="scope">{{scope.row.readCount}}</template>
</el-table-column>
<el-table-column label="内容" align="center">
<template slot-scope="scope">{{scope.row.content}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operates"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteHelp,updateShowStatus,fetchBlanceList} from '@/api/cms/help'
import {formatDate} from '@/utils/date';
export default {
name: 'helpList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showHelp"
},
{
label: "隐藏品牌",
value: "hideHelp"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '未开始';
} else if (value === 2) {
return '活动中';
} else if (value === 3) {
return '已结束';
} else if (value === 4) {
return '已失效';
}
},
},
methods: {
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleShowChange(index, row) {
let params = new URLSearchParams();
params.append('ids', row.id);
params.append('showStatus', row.showStatus);
updateShowStatus(params).then(response => {
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({path: '/cms/updateHelp', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteHelp(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchHelpList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showHelp') {
showStatus = 1;
} else if (this.operateType === 'hideHelp') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addHelp() {
this.$router.push({path: '/cms/addHelp'})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<help-detail :is-edit='true'></help-detail>
</template>
<script>
import HelpDetail from './components/HelpDetail'
export default {
name: 'updateHelp',
components: { HelpDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<helpCategory-detail :is-edit='false'></helpCategory-detail>
</template>
<script>
import HelpCategoryDetail from './components/HelpCategoryDetail'
export default {
name: 'addHelpCategory',
components: { HelpCategoryDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,121 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="helpCategory" :rules="rules" ref="helpCategoryFrom" label-width="150px">
<el-form-item label="标题:" prop="name">
<el-input v-model="helpCategory.name"></el-input>
</el-form-item>
<el-form-item label="分类图标:" prop="icon">
<single-upload v-model="helpCategory.icon"></single-upload>
</el-form-item>
<el-form-item label="是否显示:">
<el-radio-group v-model="helpCategory.showStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="排序:" prop="sort">
<el-input v-model.number="helpCategory.sort"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('helpCategoryFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('helpCategoryFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createHelpCategory, getHelpCategory, updateHelpCategory} from '@/api/cms/helpCategory'
import SingleUpload from '@/components/Upload/singleUpload'
const defaultHelpCategory={
name: ''
};
export default {
name: 'HelpCategoryDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
helpCategory:Object.assign({}, defaultHelpCategory),
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
if (this.isEdit) {
getHelpCategory(this.$route.query.id).then(response => {
this.helpCategory = response.data;
});
}else{
this.helpCategory = Object.assign({},defaultHelpCategory);
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.isEdit) {
updateHelpCategory(this.$route.query.id, this.helpCategory).then(response => {
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
});
} else {
createHelpCategory(this.helpCategory).then(response => {
this.$refs[formName].resetFields();
this.helpCategory = Object.assign({},defaultHelpCategory);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.helpCategory = Object.assign({},defaultHelpCategory);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,237 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchHelpCategoryList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.name" placeholder="名称"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button
class="btn-add"
@click="addHelpCategory()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="helpCategoryTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="标题" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="分类图标" align="center">
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.icon"></template>
</el-table-column>
<el-table-column label="专题数量" align="center">
<template slot-scope="scope">{{scope.row.helpCount}}</template>
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<el-switch
@change="handleStatusStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.showStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="排序" align="center">
<template slot-scope="scope">{{scope.row.sort}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteHelpCategory} from '@/api/cms/helpCategory'
export default {
name: 'helpCategoryList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showHelpCategory"
},
{
label: "隐藏品牌",
value: "hideHelpCategory"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
methods: {
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({path: '/cms/updateHelpCategory', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteHelpCategory(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchHelpCategoryList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showHelpCategory') {
showStatus = 1;
} else if (this.operateType === 'hideHelpCategory') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addHelpCategory() {
this.$router.push({path: '/cms/addHelpCategory'})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<helpCategory-detail :is-edit='true'></helpCategory-detail>
</template>
<script>
import HelpCategoryDetail from './components/HelpCategoryDetail'
export default {
name: 'updateHelpCategory',
components: { HelpCategoryDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<memberReport-detail :is-edit='false'></memberReport-detail>
</template>
<script>
import MemberReportDetail from './components/MemberReportDetail'
export default {
name: 'addMemberReport',
components: { MemberReportDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,124 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="memberReport" :rules="rules" ref="memberReportFrom" label-width="150px">
<el-form-item label="举报类型:" prop="reportType">
<el-input v-model="memberReport.reportType"></el-input>
</el-form-item>
<el-form-item label="举报人:" prop="reportMemberName">
<el-input v-model="memberReport.reportMemberName"></el-input>
</el-form-item>
<el-form-item label="举报对象:" prop="reportObject">
<el-input v-model="memberReport.reportObject"></el-input>
</el-form-item>
<el-form-item label="举报状态:" prop="reportStatus">
<el-input v-model="memberReport.reportStatus"></el-input>
</el-form-item>
<el-form-item label="处理结果:" prop="handleStatus">
<el-input v-model="memberReport.handleStatus"></el-input>
</el-form-item>
<el-form-item label="内容:" prop="note">
<el-input v-model="memberReport.note"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('memberReportFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('memberReportFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createMemberReport, getMemberReport, updateMemberReport} from '@/api/cms/memberReport'
import SingleUpload from '@/components/Upload/singleUpload'
const defaultMemberReport={
name: ''
};
export default {
name: 'MemberReportDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
memberReport:Object.assign({}, defaultMemberReport),
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
if (this.isEdit) {
getMemberReport(this.$route.query.id).then(response => {
this.memberReport = response.data;
});
}else{
this.memberReport = Object.assign({},defaultMemberReport);
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.isEdit) {
updateMemberReport(this.$route.query.id, this.memberReport).then(response => {
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
});
} else {
createMemberReport(this.memberReport).then(response => {
this.$refs[formName].resetFields();
this.memberReport = Object.assign({},defaultMemberReport);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.memberReport = Object.assign({},defaultMemberReport);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,253 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchMemberReportList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button
class="btn-add"
@click="addMemberReport()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="memberReportTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="举报类型" align="center">
<template slot-scope="scope">{{scope.row.reportType}}</template>
</el-table-column>
<el-table-column label="举报人" align="center">
<template slot-scope="scope">{{scope.row.reportMemberName}}</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<template slot-scope="scope">{{scope.row.createTime}}</template>
</el-table-column>
<el-table-column label="举报对象" align="center">
<template slot-scope="scope">{{scope.row.reportObject}}</template>
</el-table-column>
<el-table-column label="举报状态" align="center">
<template slot-scope="scope">{{scope.row.reportStatus}}</template>
</el-table-column>
<el-table-column label="处理结果" align="center">
<template slot-scope="scope">{{scope.row.handleStatus}}</template>
</el-table-column>
<el-table-column label="内容" align="center">
<template slot-scope="scope">{{scope.row.note}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operates"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteMemberReport} from '@/api/cms/memberReport'
export default {
name: 'memberReportList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showMemberReport"
},
{
label: "隐藏品牌",
value: "hideMemberReport"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
methods: {
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({path: '/cms/updateMemberReport', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteMemberReport(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchMemberReportList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showMemberReport') {
showStatus = 1;
} else if (this.operateType === 'hideMemberReport') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addMemberReport() {
this.$router.push({path: '/cms/addMemberReport'})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<memberReport-detail :is-edit='true'></memberReport-detail>
</template>
<script>
import MemberReportDetail from './components/MemberReportDetail'
export default {
name: 'updateMemberReport',
components: { MemberReportDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<prefrenceArea-detail :is-edit='false'></prefrenceArea-detail>
</template>
<script>
import PrefrenceAreaDetail from './components/PrefrenceAreaDetail'
export default {
name: 'addPrefrenceArea',
components: { PrefrenceAreaDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,124 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="prefrenceArea" :rules="rules" ref="prefrenceAreaFrom" label-width="150px">
<el-form-item label="标题:" prop="name">
<el-input v-model="prefrenceArea.name"></el-input>
</el-form-item>
<el-form-item label="子标题:" prop="subTitle">
<el-input v-model="prefrenceArea.subTitle"></el-input>
</el-form-item>
<el-form-item label="展示图片:" prop="pic">
<single-upload v-model="prefrenceArea.pic"></single-upload>
</el-form-item>
<el-form-item label="排序:" prop="sort">
<el-input v-model="prefrenceArea.sort"></el-input>
</el-form-item>
<el-form-item label="是否显示:">
<el-radio-group v-model="prefrenceArea.showStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('prefrenceAreaFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('prefrenceAreaFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createPrefrenceArea, getPrefrenceArea, updatePrefrenceArea} from '@/api/cms/prefrenceArea'
import SingleUpload from '@/components/Upload/singleUpload'
const defaultPrefrenceArea={
name: ''
};
export default {
name: 'PrefrenceAreaDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
prefrenceArea:Object.assign({}, defaultPrefrenceArea),
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
if (this.isEdit) {
getPrefrenceArea(this.$route.query.id).then(response => {
this.prefrenceArea = response.data;
});
}else{
this.prefrenceArea = Object.assign({},defaultPrefrenceArea);
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.isEdit) {
updatePrefrenceArea(this.$route.query.id, this.prefrenceArea).then(response => {
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
});
} else {
createPrefrenceArea(this.prefrenceArea).then(response => {
this.$refs[formName].resetFields();
this.prefrenceArea = Object.assign({},defaultPrefrenceArea);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.prefrenceArea = Object.assign({},defaultPrefrenceArea);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,254 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchPrefrenceAreaList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button
class="btn-add"
@click="addPrefrenceArea()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="prefrenceAreaTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="标题" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="子标题" align="center">
<template slot-scope="scope">{{scope.row.subTitle}}</template>
</el-table-column>
<el-table-column label="展示图片" align="center">
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.pic"></template>
</el-table-column>
<el-table-column label="排序" align="center">
<template slot-scope="scope">{{scope.row.sort}}</template>
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<el-switch
@change="handleStatusStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.showStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operates"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deletePrefrenceArea} from '@/api/cms/prefrenceArea'
export default {
name: 'prefrenceAreaList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showPrefrenceArea"
},
{
label: "隐藏品牌",
value: "hidePrefrenceArea"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
methods: {
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({path: '/cms/updatePrefrenceArea', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deletePrefrenceArea(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchPrefrenceAreaList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showPrefrenceArea') {
showStatus = 1;
} else if (this.operateType === 'hidePrefrenceArea') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addPrefrenceArea() {
this.$router.push({path: '/cms/addPrefrenceArea'})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<prefrenceArea-detail :is-edit='true'></prefrenceArea-detail>
</template>
<script>
import PrefrenceAreaDetail from './components/PrefrenceAreaDetail'
export default {
name: 'updatePrefrenceArea',
components: { PrefrenceAreaDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<subject-detail :is-edit='false'></subject-detail>
</template>
<script>
import SubjectDetail from './components/SubjectDetail'
export default {
name: 'addSubject',
components: { SubjectDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,232 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="subject" :rules="rules" ref="subjectFrom" label-width="150px">
<el-form-item label="分类:" prop="categoryId">
<el-select
v-model="subject.categoryId"
@change="handlecateChange"
placeholder="请选择分类">
<el-option
v-for="item in cateOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="标题:" prop="title">
<el-input v-model="subject.title"></el-input>
</el-form-item>
<el-form-item label="专题主图:" prop="pic">
<single-upload v-model="subject.pic"></single-upload>
</el-form-item>
<el-form-item label="推荐:" prop="recommendStatus">
<el-radio-group v-model="subject.recommendStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="画册:">
<multi-upload v-model="selectProductPics"></multi-upload>
</el-form-item>
<el-form-item label="是否显示:">
<el-radio-group v-model="subject.showStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="描述:" prop="description">
<el-input
:autoSize="true"
v-model="subject.description"
type="textarea"
placeholder="请输入描述"></el-input>
</el-form-item>
<el-form-item label="内容:" prop="content">
<el-tabs v-model="activeHtmlName" type="card">
<el-tab-pane label="电脑端详情" name="pc">
<tinymce :width="595" :height="300" v-model="subject.content"></tinymce>
</el-tab-pane>
<el-tab-pane label="移动端详情" name="mobile">
<tinymce :width="595" :height="300" v-model="subject.content"></tinymce>
</el-tab-pane>
</el-tabs>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('subjectFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('subjectFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createSubject, getSubject, updateSubject} from '@/api/cms/subject'
import {fetchList, deleteSubjectCategory} from '@/api/cms/subjectCategory'
import SingleUpload from '@/components/Upload/singleUpload'
import Tinymce from '@/components/Tinymce'
import MultiUpload from '@/components/Upload/multiUpload'
const defaultSubject={
name: ''
};
export default {
name: 'SubjectDetail',
components:{SingleUpload, MultiUpload, Tinymce},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
subject:Object.assign({}, defaultSubject),
categoryName:'',
albumPics:null,
cateOptions:null,
activeHtmlName: 'pc',
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
computed: {
//商品的主图和画册图片
selectProductPics:{
get:function () {
let pics=[];
if(this.albumPics===undefined||this.albumPics==null||this.albumPics===''){
return pics;
}
let albumPics = this.albumPics.split(',');
for(let i=0;i<albumPics.length;i++){
pics.push(albumPics[i]);
}
return pics;
},
set:function (newValue) {
if (newValue == null || newValue.length === 0) {
this.albumPics = null;
} else {
this.albumPics = '';
if (newValue.length > 0) {
for (let i = 0; i < newValue.length; i++) {
this.albumPics += newValue[i];
if (i !== newValue.length - 1) {
this.albumPics += ',';
}
}
}
}
}
}
},
created() {
if (this.isEdit) {
getSubject(this.$route.query.id).then(response => {
this.subject = response.data;
this.albumPics = response.data.albumPics;
});
}else{
this.subject = Object.assign({},defaultSubject);
}
this.getCateList();
},
methods: {
getCateList() {
fetchList({pageNum: 1, pageSize: 100}).then(response => {
this.cateOptions = [];
let brandList = response.data.records;
for (let i = 0; i < brandList.length; i++) {
this.cateOptions.push({label: brandList[i].name, value: brandList[i].id});
}
});
},
handlecateChange(val) {
let brandName = '';
for (let i = 0; i < this.cateOptions.length; i++) {
if (this.cateOptions[i].value === val) {
brandName = this.cateOptions[i].label;
break;
}
}
this.categoryName = brandName;
},
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.subject.categoryName=this.categoryName;
this.subject.albumPics=this.albumPics;
console.log(this.albumPics);
console.log(this.subject.albumPics);
if (this.isEdit) {
updateSubject(this.$route.query.id, this.subject).then(response => {
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
});
} else {
createSubject(this.subject).then(response => {
this.$refs[formName].resetFields();
this.subject = Object.assign({},defaultSubject);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.subject = Object.assign({},defaultSubject);
},
handleBrandChange(val) {
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,311 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchSubjectList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button
class="btn-add"
@click="addSubject()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="subjectTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="分类" align="center">
<template slot-scope="scope">{{scope.row.categoryId}}</template>
</el-table-column>
<el-table-column label="专题分类名称" align="center">
<template slot-scope="scope">{{scope.row.categoryName}}</template>
</el-table-column>
<el-table-column label="标题" align="center">
<template slot-scope="scope">{{scope.row.title}}</template>
</el-table-column>
<el-table-column label="专题主图" align="center">
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.pic"></template>
</el-table-column>
<el-table-column label="关联产品数量" align="center">
<template slot-scope="scope">{{scope.row.productCount}}</template>
</el-table-column>
<el-table-column label="推荐" align="center">
<template slot-scope="scope">
<el-switch
@change="handleRecomChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.recommendStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="收藏量" align="center">
<template slot-scope="scope">{{scope.row.collectCount}}</template>
</el-table-column>
<el-table-column label="点击量" align="center">
<template slot-scope="scope">{{scope.row.readCount}}</template>
</el-table-column>
<el-table-column label="评论量" align="center">
<template slot-scope="scope">{{scope.row.commentCount}}</template>
</el-table-column>
<el-table-column label="显示状态" align="center">
<template slot-scope="scope">
<el-switch
@change="handleShowChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.showStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="转发数" align="center">
<template slot-scope="scope">{{scope.row.forwardCount}}</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<template slot-scope="scope">{{scope.row.createTime|formatCreateTime}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {formatDate} from '@/utils/date';
import {fetchList, deleteSubject,updateRecommendStatus,updateShowStatus} from '@/api/cms/subject'
export default {
name: 'subjectList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showSubject"
},
{
label: "隐藏品牌",
value: "hideSubject"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '未开始';
} else if (value === 2) {
return '活动中';
} else if (value === 3) {
return '已结束';
} else if (value === 4) {
return '已失效';
}
},
},
methods: {
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleRecomChange(index, row) {
let params = new URLSearchParams();
params.append('ids', row.id);
params.append('recommendStatus', row.recommendStatus);
updateRecommendStatus(params).then(response => {
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
handleShowChange(index, row) {
let params = new URLSearchParams();
params.append('ids', row.id);
params.append('showStatus', row.showStatus);
updateShowStatus(params).then(response => {
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({path: '/cms/updateSubject', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteSubject(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchSubjectList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showSubject') {
showStatus = 1;
} else if (this.operateType === 'hideSubject') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addSubject() {
this.$router.push({path: '/cms/addSubject'})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<subject-detail :is-edit='true'></subject-detail>
</template>
<script>
import SubjectDetail from './components/SubjectDetail'
export default {
name: 'updateSubject',
components: { SubjectDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<subjectCategory-detail :is-edit='false'></subjectCategory-detail>
</template>
<script>
import SubjectCategoryDetail from './components/SubjectCategoryDetail'
export default {
name: 'addSubjectCategory',
components: { SubjectCategoryDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,120 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="subjectCategory" :rules="rules" ref="subjectCategoryFrom" label-width="150px">
<el-form-item label="标题:" prop="name">
<el-input v-model="subjectCategory.name"></el-input>
</el-form-item>
<el-form-item label="分类图标:" prop="icon">
<single-upload v-model="subjectCategory.icon"></single-upload>
</el-form-item>
<el-form-item label="是否显示:">
<el-radio-group v-model="subjectCategory.showStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="排序:" prop="sort">
<el-input v-model.number="subjectCategory.sort"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('subjectCategoryFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('subjectCategoryFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createSubjectCategory, getSubjectCategory, updateSubjectCategory} from '@/api/cms/subjectCategory'
import SingleUpload from '@/components/Upload/singleUpload'
const defaultSubjectCategory={
name: ''
};
export default {
name: 'SubjectCategoryDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
subjectCategory:Object.assign({}, defaultSubjectCategory),
rules: {
name: [
{required: true, message: '请输入名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
]
,
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
if (this.isEdit) {
getSubjectCategory(this.$route.query.id).then(response => {
this.subjectCategory = response.data;
});
}else{
this.subjectCategory = Object.assign({},defaultSubjectCategory);
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.isEdit) {
updateSubjectCategory(this.$route.query.id, this.subjectCategory).then(response => {
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
});
} else {
createSubjectCategory(this.subjectCategory).then(response => {
this.$refs[formName].resetFields();
this.subjectCategory = Object.assign({},defaultSubjectCategory);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.subjectCategory = Object.assign({},defaultSubjectCategory);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,254 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchSubjectCategoryList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button
class="btn-add"
@click="addSubjectCategory()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="subjectCategoryTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="标题" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="分类图标" align="center">
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.icon"></template>
</el-table-column>
<el-table-column label="专题数量" align="center">
<template slot-scope="scope">{{scope.row.subjectCount}}</template>
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<el-switch
@change="handleStatusStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.showStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="排序" align="center">
<template slot-scope="scope">{{scope.row.sort}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operates"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteSubjectCategory} from '@/api/cms/subjectCategory'
export default {
name: 'subjectCategoryList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showSubjectCategory"
},
{
label: "隐藏品牌",
value: "hideSubjectCategory"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
methods: {
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({path: '/cms/updateSubjectCategory', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteSubjectCategory(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchSubjectCategoryList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showSubjectCategory') {
showStatus = 1;
} else if (this.operateType === 'hideSubjectCategory') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addSubjectCategory() {
this.$router.push({path: '/cms/addSubjectCategory'})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<subjectCategory-detail :is-edit='true'></subjectCategory-detail>
</template>
<script>
import SubjectCategoryDetail from './components/SubjectCategoryDetail'
export default {
name: 'updateSubjectCategory',
components: { SubjectCategoryDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<subjectComment-detail :is-edit='false'></subjectComment-detail>
</template>
<script>
import SubjectCommentDetail from './components/SubjectCommentDetail'
export default {
name: 'addSubjectComment',
components: { SubjectCommentDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,250 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchSubjectCommentList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.memberNickName" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
</el-card>
<div class="table-container">
<el-table ref="subjectCommentTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="所属专题" align="center">
<template slot-scope="scope">{{scope.row.subjectId}}</template>
</el-table-column>
<el-table-column label="用户名" align="center">
<template slot-scope="scope">{{scope.row.memberNickName}}</template>
</el-table-column>
<el-table-column label="用户图标" align="center">
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.memberIcon"></template>
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<el-switch
@change="handleStatusStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.showStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="内容" align="center">
<template slot-scope="scope">{{scope.row.content}}</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<template slot-scope="scope">{{scope.row.createTime |formatCreateTime}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteSubjectComment} from '@/api/cms/subjectComment'
import {formatDate} from '@/utils/date';
export default {
name: 'subjectCommentList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showSubjectComment"
},
{
label: "隐藏品牌",
value: "hideSubjectComment"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '未开始';
} else if (value === 2) {
return '活动中';
} else if (value === 3) {
return '已结束';
} else if (value === 4) {
return '已失效';
}
},
},
methods: {
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({path: '/cms/updateSubjectComment', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteSubjectComment(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchSubjectCommentList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showSubjectComment') {
showStatus = 1;
} else if (this.operateType === 'hideSubjectComment') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addSubjectComment() {
this.$router.push({path: '/cms/addSubjectComment'})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<subjectComment-detail :is-edit='true'></subjectComment-detail>
</template>
<script>
import SubjectCommentDetail from './components/SubjectCommentDetail'
export default {
name: 'updateSubjectComment',
components: { SubjectCommentDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<topic-detail :is-edit='false'></topic-detail>
</template>
<script>
import TopicDetail from './components/TopicDetail'
export default {
name: 'addTopic',
components: { TopicDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,180 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="topic" :rules="rules" ref="topicFrom" label-width="150px">
<el-form-item label="所属分类:" prop="categoryId">
<el-select
v-model="topic.categoryId"
@change="handlecateChange"
placeholder="请选择分类">
<el-option
v-for="item in cateOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="标题:" prop="name">
<el-input v-model="topic.name"></el-input>
</el-form-item>
<el-form-item label="开始时间:" prop="startTime">
<el-date-picker
class="input-width"
v-model="topic.startTime"
type="datetime"
:picker-options="pickerOptions1"
placeholder="请选择开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间:" prop="endTime">
<el-date-picker
class="input-width"
v-model="topic.endTime"
type="datetime"
:picker-options="pickerOptions1"
placeholder="请选择结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="奖品名称:" prop="awardName">
<el-input v-model="topic.awardName"></el-input>
</el-form-item>
<el-form-item label="参与方式:" prop="attendType">
<el-input v-model="topic.attendType"></el-input>
</el-form-item>
<el-form-item label="内容:" prop="content">
<el-tabs v-model="activeHtmlName" type="card">
<el-tab-pane label="电脑端详情" name="pc">
<tinymce :width="595" :height="300" v-model="topic.content"></tinymce>
</el-tab-pane>
<el-tab-pane label="移动端详情" name="mobile">
<tinymce :width="595" :height="300" v-model="topic.content"></tinymce>
</el-tab-pane>
</el-tabs>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('topicFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('topicFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createTopic, getTopic, updateTopic} from '@/api/cms/topic'
import SingleUpload from '@/components/Upload/singleUpload'
import {fetchList, deleteSubjectCategory} from '@/api/cms/topicCategory'
import Tinymce from '@/components/Tinymce'
const defaultTopic={
name: ''
};
export default {
name: 'TopicDetail',
components:{SingleUpload,Tinymce},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
//日期选择器配置
pickerOptions1: {
disabledDate(time) {
return time.getTime() < Date.now();
}
},
cateOptions:null,
activeHtmlName: 'pc',
topic:Object.assign({}, defaultTopic),
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
if (this.isEdit) {
getTopic(this.$route.query.id).then(response => {
this.topic = response.data;
});
}else{
this.topic = Object.assign({},defaultTopic);
}
this.getCateList();
},
methods: {
getCateList() {
fetchList({pageNum: 1, pageSize: 100}).then(response => {
this.cateOptions = [];
let brandList = response.data.records;
for (let i = 0; i < brandList.length; i++) {
this.cateOptions.push({label: brandList[i].name, value: brandList[i].id});
}
});
},
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.isEdit) {
updateTopic(this.$route.query.id, this.topic).then(response => {
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
});
} else {
createTopic(this.topic).then(response => {
this.$refs[formName].resetFields();
this.topic = Object.assign({},defaultTopic);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.topic = Object.assign({},defaultTopic);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,338 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchTopicList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button
class="btn-add"
@click="addTopic()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="topicTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="所属分类" align="center">
<template slot-scope="scope">{{scope.row.categoryId}}</template>
</el-table-column>
<el-table-column label="标题" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="开始时间" align="center">
<template slot-scope="scope">{{scope.row.startTime|formatCreateTime}}</template>
</el-table-column>
<el-table-column label="结束时间" align="center">
<template slot-scope="scope">{{scope.row.endTime|formatCreateTime}}</template>
</el-table-column>
<el-table-column label="参与人数" align="center">
<template slot-scope="scope">
<p>{{scope.row.attendCount}}</p>
<p>
<el-button
type="text"
@click="handleShowVeriyEditDialog(scope.$index, scope.row)">参与人数列表
</el-button>
</p>
</template>
</el-table-column>
<el-table-column label="关注人数" align="center">
<template slot-scope="scope">{{scope.row.attentionCount}}</template>
</el-table-column>
<el-table-column label="点击人数" align="center">
<template slot-scope="scope">{{scope.row.readCount}}</template>
</el-table-column>
<el-table-column label="奖品名称" align="center">
<template slot-scope="scope">{{scope.row.awardName}}</template>
</el-table-column>
<el-table-column label="参与方式" align="center">
<template slot-scope="scope">{{scope.row.attendType}}</template>
</el-table-column>
<el-table-column label="话题内容" align="center">
<template slot-scope="scope">{{scope.row.content}}</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<template slot-scope="scope">{{scope.row.createTime|formatCreateTime}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
<el-dialog
title="审核信息"
:visible.sync="vertyProduct.dialogVisible"
width="40%">
<el-table style="width: 100%;margin-top: 20px"
:data="vertyProduct.list"
border>
<el-table-column label="申请状态" width="160" align="center">
<template slot-scope="scope">
{{scope.row.status}}
<el-switch
@change="handleEditVConfirm(scope.$index, scope.row)"
:active-value="1"
:inactive-value="2"
v-model="scope.row.status">
</el-switch>
</template>
</el-table-column>
<el-table-column label="申请人" width="160" align="center">
<template slot-scope="scope">{{scope.row.username}}</template>
</el-table-column>
<el-table-column label="申请时间" align="center">
<template slot-scope="scope">{{scope.row.createTime|formatCreateTime}}</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script>
import {fetchList, deleteTopic,updateVerifyStatus,fetchCmsTopicMember} from '@/api/cms/topic'
import {formatDate} from '@/utils/date';
export default {
name: 'topicList',
data() {
return {
vertyProduct:{
dialogVisible:false,
topicId:'',
list:null
},
operates: [
{
label: "显示品牌",
value: "showTopic"
},
{
label: "隐藏品牌",
value: "hideTopic"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '未开始';
} else if (value === 2) {
return '活动中';
} else if (value === 3) {
return '已结束';
} else if (value === 4) {
return '已失效';
}
},
},
methods: {
handleShowVeriyEditDialog(index,row){
this.vertyProduct.dialogVisible=true;
this.vertyProduct.topicId=row.id;
fetchCmsTopicMember(row.id).then(response=>{
this.vertyProduct.list=response.data;
});
},
handleEditVConfirm(index,row){
this.$confirm('是否要进行审核', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(()=>{
let params = new URLSearchParams();
params.append('topicId', this.vertyProduct.topicId);
params.append('ids', row.id);
params.append('verifyStatus', row.status);
updateVerifyStatus(params).then(response => {
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
this.getList();
});
this.vertyProduct.dialogVisible=false;
});
},
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({path: '/cms/updateTopic', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteTopic(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchTopicList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showTopic') {
showStatus = 1;
} else if (this.operateType === 'hideTopic') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addTopic() {
this.$router.push({path: '/cms/addTopic'})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<topic-detail :is-edit='true'></topic-detail>
</template>
<script>
import TopicDetail from './components/TopicDetail'
export default {
name: 'updateTopic',
components: { TopicDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<topicCategory-detail :is-edit='false'></topicCategory-detail>
</template>
<script>
import TopicCategoryDetail from './components/TopicCategoryDetail'
export default {
name: 'addTopicCategory',
components: { TopicCategoryDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,122 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="topicCategory" :rules="rules" ref="topicCategoryFrom" label-width="150px">
<el-form-item label="标题:" prop="name">
<el-input v-model="topicCategory.name"></el-input>
</el-form-item>
<el-form-item label="分类图标:" prop="icon">
<single-upload v-model="topicCategory.icon"></single-upload>
</el-form-item>
<el-form-item label="是否显示:">
<el-radio-group v-model="topicCategory.showStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="排序:" prop="sort">
<el-input v-model.number="topicCategory.sort"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('topicCategoryFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('topicCategoryFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {createTopicCategory, getTopicCategory, updateTopicCategory} from '@/api/cms/topicCategory'
import SingleUpload from '@/components/Upload/singleUpload'
const defaultTopicCategory={
name: ''
};
export default {
name: 'TopicCategoryDetail',
components:{SingleUpload},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
topicCategory:Object.assign({}, defaultTopicCategory),
rules: {
name: [
{required: true, message: '请输入分类名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
}
}
},
created() {
if (this.isEdit) {
getTopicCategory(this.$route.query.id).then(response => {
this.topicCategory = response.data;
});
}else{
this.topicCategory = Object.assign({},defaultTopicCategory);
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.isEdit) {
updateTopicCategory(this.$route.query.id, this.topicCategory).then(response => {
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
});
} else {
createTopicCategory(this.topicCategory).then(response => {
this.$refs[formName].resetFields();
this.topicCategory = Object.assign({},defaultTopicCategory);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.topicCategory = Object.assign({},defaultTopicCategory);
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,254 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchTopicCategoryList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<el-button
class="btn-add"
@click="addTopicCategory()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="topicCategoryTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="标题" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="分类图标" align="center">
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.icon"></template>
</el-table-column>
<el-table-column label="专题数量" align="center">
<template slot-scope="scope">{{scope.row.subjectCount}}</template>
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<el-switch
@change="handleStatusStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.showStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="排序" align="center">
<template slot-scope="scope">{{scope.row.sort}}</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operates"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteTopicCategory} from '@/api/cms/topicCategory'
export default {
name: 'topicCategoryList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showTopicCategory"
},
{
label: "隐藏品牌",
value: "hideTopicCategory"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
methods: {
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({path: '/cms/updateTopicCategory', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteTopicCategory(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchTopicCategoryList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showTopicCategory') {
showStatus = 1;
} else if (this.operateType === 'hideTopicCategory') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addTopicCategory() {
this.$router.push({path: '/cms/addTopicCategory'})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,14 @@
<template> 
<topicCategory-detail :is-edit='true'></topicCategory-detail>
</template>
<script>
import TopicCategoryDetail from './components/TopicCategoryDetail'
export default {
name: 'updateTopicCategory',
components: { TopicCategoryDetail }
}
</script>
<style>
</style>

View File

@@ -0,0 +1,250 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchTopicCommentList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
</el-card>
<div class="table-container">
<el-table ref="topicCommentTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
<el-table-column label="编号" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="用户名" align="center">
<template slot-scope="scope">{{scope.row.memberNickName}}</template>
</el-table-column>
<el-table-column label="主题" align="center">
<template slot-scope="scope">{{scope.row.topicId}}</template>
</el-table-column>
<el-table-column label="图标" align="center">
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.memberIcon"></template>
</el-table-column>
<el-table-column label="内容" align="center">
<template slot-scope="scope">{{scope.row.content}}</template>
</el-table-column>
<el-table-column label="创建时间" align="center">
<template slot-scope="scope">{{scope.row.createTime}}</template>
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<el-switch
@change="handleStatusStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.showStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-select
size="small"
v-model="operateType" placeholder="批量操作">
<el-option
v-for="item in operates"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-button
style="margin-left: 20px"
class="search-button"
@click="handleBatchOperate()"
type="primary"
size="small">
确定
</el-button>
</div>
<div class="pagination-container">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes,prev, pager, next,jumper"
:page-size="listQuery.pageSize"
:page-sizes="[5,10,15]"
:current-page.sync="listQuery.pageNum"
:total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import {fetchList, deleteTopicComment} from '@/api/cms/topicComment'
export default {
name: 'topicCommentList',
data() {
return {
operates: [
{
label: "显示品牌",
value: "showTopicComment"
},
{
label: "隐藏品牌",
value: "hideTopicComment"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
methods: {
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({path: '/cms/updateTopicComment', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteTopicComment(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchTopicCommentList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showTopicComment') {
showStatus = 1;
} else if (this.operateType === 'hideTopicComment') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addTopicComment() {
this.$router.push({path: '/cms/addTopicComment'})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

View File

@@ -0,0 +1,59 @@
<template>
<div>
<div ref="editor" class="text"/>
<div style="margin: 12px 5px;font-size: 16px;font-weight: bold;color: #696969">HTML渲染如下</div>
<div class="editor-content" v-html="editorContent"/>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import E from 'wangeditor'
import { getToken } from '@/utils/auth'
export default {
name: 'Editor',
data() {
return {
headers: {
'Authorization': 'Bearer ' + getToken()
},
editorContent:
`<h3 style="text-align: center;">欢迎使用 wangEditor 富文本编辑器!</h3>
<ul>
<li>富文本中图片上传使用的是sm.ms图床支持上传到七牛云<a style="color: #42b983" target="_blank" href="https://sm.ms/">sm.ms</a></li>
<li>更多帮助请查看官方文档:<a style="color: #42b983" target="_blank" href="https://www.kancloud.cn/wangfupeng/wangeditor3/332599">wangEditor</a></li>
</ul>`
}
},
computed: {
...mapGetters([
'imagesUploadApi'
])
},
mounted() {
var editor = new E(this.$refs.editor)
editor.customConfig.uploadImgShowBase64 = true // 使用 base64 保存图片
// 不可修改
editor.customConfig.uploadImgHeaders = this.headers
// 自定义文件名,不可修改,修改后会上传失败
editor.customConfig.uploadFileName = 'file'
editor.customConfig.uploadImgServer = this.imagesUploadApi // 上传图片到服务器
editor.customConfig.onchange = (html) => {
this.editorContent = html
}
editor.create()
// 初始化数据
editor.txt.html(this.editorContent)
}
}
</script>
<style scoped>
.editor-content{
padding-left: 5px;
}
.text {
text-align:left;
margin: 5px
}
</style>

View File

@@ -0,0 +1,70 @@
<template>
<div class="icons-container">
<p class="warn-content">
使用教程参考 <a href="https://panjiachen.github.io/vue-element-admin-site/guide/advanced/icon.html" target="_blank">Documentation</a>
</p>
<div class="icons-wrapper">
<div v-for="item of iconsMap" :key="item" @click="handleClipboard(generateIconCode(item),$event)">
<el-tooltip placement="top">
<div slot="content">
{{ generateIconCode(item) }}
</div>
<div class="icon-item">
<svg-icon :icon-class="item" class-name="disabled" />
<span>{{ item }}</span>
</div>
</el-tooltip>
</div>
</div>
</div>
</template>
<script>
import icons from '@/components/IconSelect/requireIcons'
import clipboard from '@/utils/clipboard'
export default {
name: 'Icons',
data() {
return {
iconsMap: icons
}
},
methods: {
generateIconCode(symbol) {
return `<svg-icon icon-class="${symbol}" />`
},
handleClipboard(text, event) {
clipboard(text, event)
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.icons-container {
margin: 10px 20px 0;
overflow: hidden;
.icons-wrapper {
margin: 0 auto;
}
.icon-item {
margin: 16px;
height: 110px;
text-align: center;
width: 100px;
float: left;
font-size: 30px;
color: #24292e;
cursor: pointer;
}
span {
display: block;
font-size: 24px;
margin-top: 10px;
}
.disabled{
pointer-events: none;
}
}
</style>

View File

@@ -0,0 +1,70 @@
<template>
<div class="app-container">
<p class="warn-content">
Markdown 基于
<a href="https://github.com/hinesboy/mavonEditor" target="_blank">mavonEditor</a>
</p>
<mavon-editor ref="md" :style="'height:' + height" @imgAdd="imgAdd" @imgDel="imgDel"/>
</div>
</template>
<script>
import axios from 'axios'
import { mapGetters } from 'vuex'
import { getToken } from '@/utils/auth'
import { del } from '@/api/picture'
export default {
name: 'Markdown',
data() {
return {
height: document.documentElement.clientHeight - 200 + 'px',
data: null,
images: {}
}
},
computed: {
...mapGetters([
'imagesUploadApi'
])
},
mounted() {
this.$refs.md.$refs.toolbar_left.img_file = []
const that = this
window.onresize = function temp() {
that.height = document.documentElement.clientHeight - 200 + 'px'
}
},
methods: {
imgAdd(pos, $file) {
var formdata = new FormData()
formdata.append('file', $file)
axios({
url: this.imagesUploadApi,
method: 'post',
data: formdata,
headers: { 'Content-Type': 'multipart/form-data', 'Authorization': 'Bearer ' + getToken() }
}).then((data) => {
this.data = data.data
this.$refs.md.$img2Url(pos, this.data.data[0])
this.images[this.data.data[0]] = this.data
}).catch((error) => {
console.log('image upload error', error)
this.$refs.md.$refs.toolbar_left.$imgDel(pos)
})
},
imgDel(file, pos) {
const image = this.images[file[1]]
if (image) {
del(image.id).then(res => {
}).catch(err => {
console.log(err.response.data.message)
})
}
}
}
}
</script>
<style scoped>
</style>

Some files were not shown because too many files have changed in this diff Show More