目录代码整合

This commit is contained in:
aixianling
2022-05-10 20:02:37 +08:00
parent 71049f7f65
commit 036ee91533
324 changed files with 4 additions and 8321 deletions

View File

@@ -0,0 +1,119 @@
<template>
<ai-list v-if="!isShowDetail">
<template slot="title">
<ai-title :title="moduleName" :isShowBottomBorder="false" :isShowArea="true" v-model="areaId" :instance="instance" @change="onAreaChange"></ai-title>
</template>
<template slot="tabs">
<el-tabs v-model="currIndex">
<el-tab-pane v-for="(tab,i) in tabs" :key="i" :label="tab.label">
<component :areaId="areaId" :moduleName="moduleName" :moduleId="moduleId" :ref="String(i)" v-if="currIndex == i" :is="tab.comp" @change="onChange" lazy :instance="instance" :dict="dict" :permissions="permissions"/>
</el-tab-pane>
</el-tabs>
</template>
</ai-list>
<Add v-else-if="component === 'Add'" :moduleName="moduleName" :moduleId="moduleId" :areaId="areaId" :params="params" :instance="instance" :dict="dict" :permissions="permissions" @change="onChange"></Add>
<Detail v-else-if="component === 'Detail'" :moduleName="moduleName" :moduleId="moduleId" :params="params" :instance="instance" :dict="dict" :permissions="permissions" @change="onChange"></Detail>
</template>
<script>
import List from './components/List'
import Add from './components/Add'
import Detail from './components/Detail'
import Audit from './components/Audit'
import { mapState } from 'vuex'
export default {
name: 'AppContentInfo',
label: '内容发布',
props: {
instance: Function,
dict: Object,
permissions: Function
},
data () {
return {
areaId: '',
component: 'List',
params: {},
moduleId: '',
include: [],
moduleName: '',
tabs: [],
currIndex: '0',
isShowDetail: false
}
},
components: {
Add,
List,
Audit,
Detail
},
computed: {
...mapState(['user'])
},
created () {
this.moduleId = this.$route.query.moduleId
this.areaId = this.user.info.areaId
this.instance.post('/app/appcontentmoduleinfo/queryDetailById?id=' + this.$route.query.moduleId).then(res => {
if (res.code === 0) {
this.moduleName = res.data.moduleName
this.tabs = [
{label: this.moduleName, name: 'List', comp: List, permission: ''},
{label: `${this.moduleName}审核`, name: 'Audit', comp: Audit, permission: 'app_appcontentinfo_examine'}
].filter(item => {
return item.name !== 'Audit' || (res.data.needExamine === '1' && item.name === 'Audit' && this.permissions(item.permission))
})
}
})
},
methods: {
onChange (data) {
if (data.type === 'Add') {
this.component = 'Add'
this.params = data.params
this.isShowDetail = true
}
if (data.type === 'Detail') {
this.component = 'Detail'
this.params = data.params
this.isShowDetail = true
}
if (data.type === 'Audit') {
this.component = 'Audit'
this.params = data.params
this.isShowDetail = false
}
if (data.type === 'List') {
this.component = 'List'
this.params = data.params
this.isShowDetail = false
}
},
onAreaChange () {
this.$nextTick(() => {
this.$refs[this.currIndex][0].getList()
})
}
}
}
</script>
<style lang="scss">
.doc-circulation {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,340 @@
<template>
<ai-detail class="content-add" v-loading="isLoading">
<template slot="title">
<ai-title :title="params.id ? '编辑' + moduleName : '添加' + moduleName" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<el-form class="ai-form" :model="form" label-width="120px" ref="form">
<el-form-item label="标题" style="width: 100%;" prop="title" :rules="[{required: true, message: '请输入标题', trigger: 'blur'}]">
<el-input size="small" v-model="form.title" clearable placeholder="请输入..." :maxlength="50" :show-word-limit="true"></el-input>
</el-form-item>
<el-form-item prop="areaId" style="width: 100%;" label="发布地区" :rules="[{required: true, message: '请选择地区', trigger: 'change'}]">
<ai-area-select clearable @fullname="v => form.areaName = v" always-show :instance="instance" v-model="form.areaId" :disabled-level="disabledLevel"></ai-area-select>
</el-form-item>
<el-form-item prop="contentType" label="文章类型" :rules="[{required: true, message: '请选择文章类型', trigger: 'change'}]">
<el-select style="width: 100%;" @change="onChange" v-model="form.contentType" size="small" placeholder="请选择文章类型">
<el-option
v-for="item in contentTypeList"
:key="item.value"
:label="item.name"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="categoryId" label="分类" v-if="cateList.length" :rules="[{required: true, message: '请选择分类', trigger: 'change'}]">
<el-select style="width: 100%;" v-model="form.categoryId" size="small" placeholder="请选择分类">
<el-option
v-for="item in cateList"
:key="item.id"
:label="item.categoryName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item v-if="form.contentType === '0'" label="正文" prop="content" style="width: 100%;" :rules="[{required: true, message: '请输入内容', trigger: 'change'}]">
<ai-editor v-model="form.content" :instance="instance"/>
</el-form-item>
<el-form-item v-if="form.contentType === '0' && !isHideCoverimg" label="封面图片" prop="files" style="width: 100%;">
<ai-uploader
:instance="instance"
v-model="form.files"
key="file"
:limit="9">
<template slot="tips">
<p>最多上传9张图片,单个文件最大10MB支持jpgjpegpng格式</p>
</template>
</ai-uploader>
</el-form-item>
<el-form-item v-if="form.contentType === '1'" label="视频" prop="files" style="width: 100%;" :rules="[{required: true, message: '请上传视频', trigger: 'change'}]">
<el-upload :show-file-list="false" ref="upload1" action :http-request="submitUpload" :accept="accept" :limit="1">
<div class="video" v-if="!form.files.length">
<div class="icon">
<ai-icon type="svg" icon="iconVideo"/>
<span>上传视频</span>
</div>
<span class="tips">支持mp4格式单个文件最大100MB</span>
</div>
</el-upload>
<video class="video-com" style="width:100%; height:100%; object-fit: fill;" muted
:src="form.files[0].url" controls="controls" v-if="form.files.length"></video>
<el-upload :show-file-list="false" ref="upload2" action :http-request="submitUpload" :accept="accept"
:limit="1" v-if="form.files.length">
<el-button style="margin-top: 10px;">重新选择</el-button>
</el-upload>
</el-form-item>
<el-form-item label="视频封面" prop="pictureUrl" style="width: 100%;" v-if="form.contentType === '1'" :rules="[{required: true, message: '请上传视频封面', trigger: 'change'}]">
<ai-uploader
:instance="instance"
isShowTip
v-model="form.pictureUrl"
:limit="1"
:cropOps="cropOps"
is-crop>
<template slot="tips">
<p>最多上传1张图片,单个文件最大10MB支持jpgjpegpng格式</p>
<p>图片比例1.61</p>
</template>
</ai-uploader>
</el-form-item>
</el-form>
</template>
</ai-card>
</template>
<template #footer>
<el-button @click="cancel">取消</el-button>
<el-button type="primary" :loading="isLoading" @click="confirm">提交</el-button>
</template>
</ai-detail>
</template>
<script>
import mp4box from 'mp4box'
import { mapState } from 'vuex'
export default {
name: 'Add',
props: {
instance: Function,
dict: Object,
params: Object,
areaId: String,
moduleName: String
},
data () {
return {
info: {},
accept: '.mp4',
form: {
title: '',
content: '',
areaId: '',
files: [],
categoryId: '',
pictureUrl: [],
contentType: '0',
areaName: '',
thumbUrl: []
},
isLoading: false,
cropOps: {
width: "336px",
height: "210px"
},
id: '',
contentTypeList: [
{
name: '文章',
value: '0'
},
{
name: '视频',
value: '1'
}
],
isHideCoverimg: false,
cateList: [],
needExamine: '0'
}
},
computed: {
...mapState(['user'])
},
created () {
this.getModuleInfo()
this.getCateList()
this.form.areaId = this.areaId
this.disabledLevel = this.user.info.areaList.length
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appcontentinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = res.data
this.form.pictureUrl = res.data.pictureUrl ? [{
url: res.data.pictureUrl
}] : []
}
})
},
getModuleInfo () {
this.instance.post(`/app/appcontentmoduleinfo/queryDetailById?id=${this.$route.query.moduleId}`).then(res => {
if (res.code === 0) {
this.isHideCoverimg = res.data.styleType === '0'
this.needExamine = res.data.needExamine
}
})
},
onChange () {
this.form.files = []
},
submitUpload(file) {
this.$refs['upload1']?.clearFiles();
this.$refs['upload2']?.clearFiles();
this.$refs['ruleForm']?.clearValidate('videoFile');
const fileType = file.file.name.split(".")[1];
const size = file.file.size / 1024 / 1024 > 100;
let mp4boxfile = mp4box.createFile();
const reader = new FileReader();
reader.readAsArrayBuffer(file.file);
reader.onload = (e) => {
const arrayBuffer = e.target.result;
arrayBuffer.fileStart = 0;
mp4boxfile.appendBuffer(arrayBuffer);
};
mp4boxfile.onReady = (info) => {
let codec = info.mime.match(/codecs="(\S*),/)[1]
if (codec.indexOf('avc') === -1) {
return this.$message.error("视频编码格式不支持")
}
if (size) {
return this.$message.error("视频大小不能超过100M");
}
if (fileType && this.accept.indexOf(fileType.toLocaleLowerCase()) > -1) {
let formData = new FormData()
formData.append('file', file.file);
this.isLoading = true
this.instance.post(`/admin/file/add-unlimited`, formData).then(res => {
if (res && res.data) {
let videoList = res.data[0].split(";");
this.form.files = [{
id: videoList[1],
url: videoList[0]
}]
}
this.isLoading = false
}).catch(() => {
this.isLoading = false
})
} else {
return this.$message.error("视频格式错误")
}
}
},
getCateList () {
this.instance.post(`/app/appcontentmodulecategory/list`, null, {
params: {
...this.cateSearch,
moduleId: this.$route.query.moduleId,
size: 100
}
}).then(res => {
if (res.code == 0) {
this.cateList = res.data.records
}
})
},
confirm () {
this.$refs.form.validate((valid) => {
if (valid) {
let categoryName = ''
if (this.cateList.length && this.form.categoryId) {
categoryName = this.cateList.filter(v => v.id === this.form.categoryId)[0].categoryName
}
this.isLoading = true
this.instance.post(`/app/appcontentinfo/addOrUpdate`, {
...this.form,
moduleId: this.$route.query.moduleId,
createUserName: this.user.info.name,
createUserId: this.user.info.id,
categoryName: categoryName,
pictureUrl: this.form.pictureUrl.length ? this.form.pictureUrl[0].url : ''
}).then(res => {
if (res.code == 0) {
if (this.needExamine === '1') {
this.$message.success('提交成功,等待管理员审核')
} else {
this.$message.success('提交成功')
}
setTimeout(() => {
this.cancel(true)
}, 600)
} else {
this.isLoading = false
}
}).catch(() => {
this.isLoading = false
})
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
.content-add {
.video {
width: 640px;
height: 360px;
border-radius: 4px;
border: 1px dashed #D0D4DC;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.icon {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
span:nth-child(2) {
display: inline-block;
font-size: 16px;
color: #333333;
line-height: 30px;
}
.iconfont {
display: inline-block;
font-size: 40px;
color: #2266FF;
}
}
.tips {
display: inline-block;
font-size: 12px;
color: #999999;
line-height: 26px;
}
}
.video-com {
width: 640px;
height: 360px;
background: rgba(0, 0, 0, 0.5);
border-radius: 2px;
border: 1px solid #D0D4DC;
margin-top: -40px;
}
}
</style>

View File

@@ -0,0 +1,201 @@
<template>
<ai-list class="notice" isTabs>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<ai-select
v-model="search.examineStatus"
@change="search.current = 1, getList()"
placeholder="审核状态"
:selectList="dict.getDict('auditStatus')">
</ai-select>
</template>
<template #right>
<el-input
v-model="search.title"
class="search-input"
size="small"
v-throttle="() => {search.current=1,getList()}"
placeholder="请输入标题"
clearable
@clear="search.current = 1, search.title = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 6px;"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="tags" label="标签">
<template slot-scope="{ row }">
<div class="table-tags">
<el-tag type="info" v-for="(item, index) in row.tags" size="small" :key="index">{{ item }}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column slot="options" width="120px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="audit(row.id)">审核</el-button>
<el-button type="text" @click="toDetail(row.id)">详情</el-button>
</div>
</template>
</el-table-column>
</ai-table>
<ai-dialog
:visible.sync="isShow"
width="800px"
@close="onClose"
title="审核"
@onConfirm="onConfirm">
<el-form class="ai-form" label-width="120px" :model="form" ref="form">
<el-form-item label="是否通过审核" prop="pass" style="width: 100%;" :rules="[{ required: true, message: '请选择是否通过审核' }]">
<el-radio-group v-model="form.pass" @change="onStatusChange">
<el-radio label="0"></el-radio>
<el-radio label="1"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="form.pass === '0'" label="审核意见" prop="opinion" style="width: 100%;" :rules="[{ required: form.pass === '0', message: '请输入审核意见' }]">
<el-input type="textarea" :rows="5" :maxlength="200" v-model="form.opinion" clearable placeholder="请输入审核意见" show-word-limit></el-input>
</el-form-item>
</el-form>
</ai-dialog>
</template>
</ai-list>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'Audit',
props: {
instance: Function,
dict: Object,
moduleName: String,
areaId: String
},
data() {
return {
search: {
current: 1,
size: 10,
title: '',
examineStatus: ''
},
form: {
opinion: '',
pass: ''
},
id: '',
isShow: false,
total: 0,
colConfigs: [
{ prop: 'title', label: '标题', align: 'left', width: '200px' },
{ prop: 'areaName', label: '地区', align: 'left' },
{ prop: 'examineStatus', label: '状态', align: 'center', formart: v => this.dict.getLabel('auditStatus', v) },
{ prop: 'examineOpinion', label: '审核意见', align: 'center' },
{ prop: 'createUserName', label: '发布人', align: 'center' },
{ prop: 'createTime', label: '发布时间', align: 'center' },
{ slot: 'options', label: '操作', align: 'center' }
],
areaName: '',
unitName: '',
tableData: []
}
},
computed: {
...mapState(['user'])
},
created () {
this.dict.load('auditStatus').then(() => {
this.getList()
})
},
methods: {
getList() {
this.instance.post(`/app/appcontentinfo/list-web`, null, {
params: {
moduleId: this.$route.query.moduleId,
...this.search,
areaId: this.areaId,
queryType: 1
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
onStatusChange () {
this.form.opinion = ''
this.$refs.form.clearValidate()
},
onClose () {
this.form.opinion = ''
this.form.pass = ''
},
onConfirm () {
this.$refs.form.validate(v => {
if (v) {
this.instance.post('/app/appcontentinfo/examine', null, {
params: {
...this.form,
id: this.id
}
}).then(res => {
if (res?.code == 0) {
this.isShow = false
this.getList()
this.$message.success('审核成功!')
}
})
}
})
},
audit (id) {
this.id = id
this.isShow = true
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appcontentinfo/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
toDetail(id) {
this.$emit('change', {
type: 'Detail',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
.notice {
}
</style>

View File

@@ -0,0 +1,93 @@
<template>
<ai-detail>
<template slot="title">
<ai-title title="详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<ai-wrapper
label-width="120px">
<ai-info-item label="标题" isLine :value="info.title"></ai-info-item>
<ai-info-item label="发布地区" isLine :value="info.areaName"></ai-info-item>
<ai-info-item label="文章类型" isLine :value="info.contentType === '0' ? '文章' : '视频'"></ai-info-item>
<ai-info-item label="分类" v-if="info.categoryName" isLine :value="info.categoryName"></ai-info-item>
<ai-info-item label="正文" v-if="info.contentType === '0'" isLine>
<AiArticle :value="info.content"></AiArticle>
</ai-info-item>
<ai-info-item v-if="info.contentType === '0'" isLine label="封面图片">
<ai-uploader
:instance="instance"
disabled
v-model="info.files"
:limit="9">
</ai-uploader>
</ai-info-item>
<ai-info-item v-if="info.contentType === '1'" isLine label="封面图片">
<video style="width:100%; height:100%; object-fit: fill;" :src="info.files[0].url" controls></video>
</ai-info-item>
<ai-info-item v-if="info.contentType === '1'" isLine label="视频封面">
<ai-uploader
:instance="instance"
disabled
v-model="info.pictureUrl"
:limit="1">
</ai-uploader>
</ai-info-item>
</ai-wrapper>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object,
moduleId: String
},
data () {
return {
info: {},
id: ''
}
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appcontentinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.info = res.data
this.info.pictureUrl = res.data.pictureUrl ? [{
url: res.data.pictureUrl
}] : []
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,149 @@
<template>
<ai-list class="notice" isTabs>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button>
</template>
<template #right>
<el-input
v-model="search.title"
class="search-input"
size="small"
v-throttle="() => {search.current = 1, getList()}"
placeholder="请输入标题"
clearable
@clear="search.current = 1, search.title = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 6px;"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="tags" label="标签">
<template slot-scope="{ row }">
<div class="table-tags">
<el-tag type="info" v-for="(item, index) in row.tags" size="small" :key="index">{{ item }}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column slot="options" width="160px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
<el-button type="text" @click="toDetail(row.id)">详情</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'List',
props: {
instance: Function,
dict: Object,
moduleName: String,
areaId: String
},
data() {
return {
search: {
current: 1,
size: 10,
title: ''
},
currIndex: -1,
areaList: [],
total: 10,
colConfigs: [
{ prop: 'title', label: '标题', align: 'left', width: '200px' },
{ prop: 'areaName', label: '地区', align: 'left' },
{ prop: 'examineStatus', label: '状态', align: 'center', formart: v => this.dict.getLabel('auditStatus', v) },
{ prop: 'examineOpinion', label: '审核意见', align: 'center' },
{ prop: 'viewCount', label: '浏览次数', align: 'center' },
{ prop: 'createUserName', label: '发布人', align: 'center' },
{ prop: 'createTime', label: '发布时间', align: 'center' },
{ slot: 'options', label: '操作', align: 'center' }
],
areaName: '',
unitName: '',
tableData: []
}
},
computed: {
...mapState(['user'])
},
created() {
this.dict.load('auditStatus').then(() => {
this.getList()
})
},
methods: {
getList() {
this.instance.post(`/app/appcontentinfo/list-web`, null, {
params: {
moduleId: this.$route.query.moduleId,
...this.search,
areaId: this.areaId
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appcontentinfo/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
toAdd(id) {
this.$emit('change', {
type: 'Add',
params: {
id: id || ''
}
})
},
toDetail(id) {
this.$emit('change', {
type: 'Detail',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
.notice {
}
</style>

View File

@@ -0,0 +1,73 @@
<template>
<div class="doc-circulation ailist-wrapper">
<keep-alive :include="['List']">
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component>
</keep-alive>
</div>
</template>
<script>
import List from './components/List'
import Add from './components/Add'
import Detail from './components/Detail'
export default {
name: 'AppContentManage',
label: '内容管理',
props: {
instance: Function,
dict: Object
},
data () {
return {
component: 'List',
params: {},
include: []
}
},
components: {
Add,
List,
Detail
},
mounted () {
},
methods: {
onChange (data) {
if (data.type === 'Add') {
this.component = 'Add'
this.params = data.params
}
if (data.type === 'Detail') {
this.component = 'Detail'
this.params = data.params
}
if (data.type === 'list') {
this.component = 'List'
this.params = data.params
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
}
}
}
}
</script>
<style lang="scss">
.doc-circulation {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,184 @@
<template>
<ai-detail>
<template slot="title">
<ai-title :title="params.id ? '编辑模块' : '添加模块'" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<el-form class="ai-form" :model="form" label-width="120px" ref="form">
<el-form-item label="模块名称" style="width: 100%;" prop="moduleName" :rules="[{required: true, message: '请输入模块名称', trigger: 'blur'}]">
<el-input type="input" style="width: 300px" size="small" v-model="form.moduleName" clearable placeholder="请输入模块名称" maxlength="30" show-word-limit></el-input>
</el-form-item>
<el-form-item prop="menuName" label="菜单名称" :rules="[{required: true, message: '请选择菜单', trigger: 'change'}]">
<el-input type="input" style="width: 300px" disabled size="small" v-model="form.menuName" clearable placeholder="请选择菜单">
<template slot="append">
<el-button size="small" @click="showAdd">选择</el-button>
</template>
</el-input>
</el-form-item>
<el-form-item label="是否审核" style="width: 100%;" prop="needExamine" :rules="[{required: true, message: '请选择是否审核', trigger: 'change'}]">
<el-radio-group v-model="form.needExamine">
<el-radio label="0"></el-radio>
<el-radio label="1"></el-radio>
</el-radio-group>
</el-form-item>
</el-form>
</template>
</ai-card>
<ai-dialog
:visible.sync="isShowAdd"
width="880px"
height="580px"
title="选择菜单"
@close="onClose"
@onConfirm="onConfirm">
<el-tree
:data="treeData"
node-key="id"
ref="tree"
@node-click="onChange"
highlight-current
:default-expanded-keys="defaultExpandedKeys"
:default-checked-keys="defaulCheckedKeys"
:props="defaultProps">
</el-tree>
</ai-dialog>
</template>
<template #footer>
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="confirm">提交</el-button>
</template>
</ai-detail>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'Add',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
form: {
moduleName: '',
menuId: '',
menuName: '',
needExamine: '0'
},
isShowAdd: false,
treeData: [],
id: '',
chooseNode: {},
defaultExpandedKeys: [],
defaulCheckedKeys: [],
defaultProps: {
children: 'subSet',
label: 'name',
disabled: e => {
return e.type !== '1'
}
}
}
},
computed: {
...mapState(['user'])
},
created () {
this.getMenuList()
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appcontentmoduleinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = res.data
}
})
},
showAdd () {
this.isShowAdd = true
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.form.menuId)
this.defaultExpandedKeys = [this.form.menuId]
this.chooseNode = {
menuId: this.form.menuId,
menuName: this.form.menuName,
type: '1'
}
})
},
onClose () {
},
onConfirm () {
if (this.chooseNode.type === '1') {
this.form.menuId = this.chooseNode.id
this.form.menuName = this.chooseNode.name
this.isShowAdd = false
} else {
this.$message.error('无法选择')
}
},
onChange (e) {
this.chooseNode = e
},
getMenuList () {
this.instance.post(`/admin/menu/menuTree?containPermission=0`).then(res => {
if (res.code === 0) {
this.treeData = res.data
}
})
},
confirm () {
this.$refs.form.validate((valid) => {
if (valid) {
this.instance.post(`/app/appcontentmoduleinfo/addOrUpdate`, {
...this.form,
id: this.params.id || ''
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
setTimeout(() => {
this.cancel(true)
}, 600)
}
})
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'list',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,63 @@
<template>
<ai-detail>
<template slot="title">
<ai-title title="详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
id: ''
}
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appeveryvillagecode/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = res.data
this.form.codeUrl = [{
url: res.data.codeUrl
}]
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'list',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,227 @@
<template>
<ai-list class="notice">
<template slot="title">
<ai-title title="内容管理" isShowBottomBorder></ai-title>
</template>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加模块</el-button>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 6px;"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="options" width="160px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
<el-button type="text" @click="moduleId = row.id, form.moduleId = row.id, getCateList(), isShowAdd = true">分类</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
<ai-dialog
:visible.sync="isShowAdd"
width="880px"
height="580px"
title="文章分类"
@close="onClose"
@onConfirm="onConfirm(false)">
<el-form ref="form" class="ai-form" :model="form" label-width="110px" label-position="right">
<el-form-item label="分类名称" style="width: 500px;" prop="categoryName" :rules="[{ required: true, message: '请输入分类名称', trigger: 'blur' }]">
<div class="catewrapper">
<el-input size="small" style="width: 300px;" placeholder="请输入分类名称" v-model="form.categoryName">
</el-input>
<el-button style="margin-left: 20px;" size="small" type="primary" icon="iconfont iconAdd" v-if="!id" @click="onConfirm(true)">添加</el-button>
</div>
</el-form-item>
</el-form>
<ai-table
v-if="!id"
class="detail-table__table"
:border="true"
tableSize="small"
:total="cateTotal"
:tableData="cateList"
:col-configs="cateColConfigs"
:current.sync="cateSearch.current"
:size.sync="cateSearch.size"
:stripe="false"
@getList="getCateList">
<el-table-column slot="options" width="220px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="id = row.id, form.categoryName = row.categoryName">编辑</el-button>
<el-button type="text" @click="removeCate(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</ai-dialog>
</template>
</ai-list>
</template>
<script>
export default {
name: 'List',
props: {
instance: Function,
dict: Object
},
data() {
return {
search: {
current: 1,
size: 10,
title: ''
},
moduleId: '',
cateSearch: {
current: 1,
size: 10
},
total: 10,
cateList: [],
colConfigs: [
{ prop: 'moduleName', label: '模块名称', align: 'left', width: '200px' },
{ prop: 'menuName', label: '关联菜单', align: 'center' },
{ prop: 'categoryStr', label: '文章分类', align: 'center' },
{ prop: 'needExamine', label: '是否审核', align: 'center', formart: v => v === '0' ? '否' : '是' }
],
cateColConfigs: [
{prop: 'categoryName', label: '分类名称', align: 'center'}
],
form: {
categoryName: '',
moduleId: '',
showIndex: 1
},
cateTotal: 0,
isShowAdd: false,
id: '',
tableData: []
}
},
mounted() {
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appcontentmoduleinfo/list`, null, {
params: {
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
getCateList () {
this.instance.post(`/app/appcontentmodulecategory/list`, null, {
params: {
...this.cateSearch,
moduleId: this.moduleId
}
}).then(res => {
if (res.code == 0) {
this.cateList = res.data.records
this.cateTotal = res.data.total
}
})
},
removeCate(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appcontentmodulecategory/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
this.getCateList()
}
})
})
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appcontentmoduleinfo/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
onConfirm (flag) {
if (!flag && !this.id) {
this.isShowAdd = false
return false
}
this.$refs.form.validate((valid) => {
if (valid) {
this.instance.post(`/app/appcontentmodulecategory/addOrUpdate`, {
...this.form,
id: this.id || ''
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
this.getList()
this.getCateList()
this.form.categoryName = ''
if (this.id) {
this.id = ''
return false
}
}
})
}
})
},
onClose () {
this.id = ''
this.moduleId = ''
this.form.categoryName = ''
this.form.moduleId = ''
},
toAdd(id) {
this.$emit('change', {
type: 'Add',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
.notice {
.catewrapper {
display: flex;
align-items: center;
}
}
</style>

View File

@@ -0,0 +1,158 @@
<template>
<div class="AppHotTopic">
<ai-list v-if="showList">
<template slot="title">
<ai-title title="热点话题" :isShowBottomBorder="false" :isShowArea="false"></ai-title>
</template>
<template slot="content">
<ai-search-bar>
<template slot="left">
<el-button type="primary" icon="iconfont iconAdd" size="small" @click="add">添加</el-button>
</template>
<template slot="right">
<el-input
v-model="page.title"
size="small"
placeholder="搜索标题"
clearable
v-throttle="() => {page.current = 1, getList()}"
@clear="page.current = 1, page.title = '', getList()"
suffix-icon="iconfont iconSearch"/>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
:current.sync="page.current"
:size.sync="page.size"
@getList="getList">
<el-table-column slot="option" label="操作" fixed="right" width="300" align="center">
<template slot-scope="{ row }">
<el-button type="text" title="发布" class="btn" v-if="row.status==0" @click="handlePublish(row)">发布
</el-button>
<el-button type="text" title="取消发布" class="btn" v-else @click="handlePublish(row)">取消发布</el-button>
<el-button type="text" title="详情" @click="toDetail(row)">详情</el-button>
<el-button type="text" title="编辑" @click="add(row)">编辑</el-button>
<el-button type="text" title="删除" @click="handleDel(row)">删除</el-button>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
<component v-else :is="currentPage" :detail="detail" :instance="instance" :dict="dict" :permissions="permissions"
@goBack="goBack"/>
</div>
</template>
<script>
import addHot from "./components/addHot";
import hotDetail from "./components/hotDetail";
export default {
name: "AppHotTopic",
label: "热点话题",
components: {addHot, hotDetail},
props: {
instance: Function,
dict: Object,
permissions: Function
},
data() {
return {
showList: true,
currentPage: "",
detail: {},
page: {
title:"",
current: 1,
size: 10
},
total: 0,
tableData: []
}
},
computed: {
colConfigs() {
return [
{prop: 'title', label: '话题标题'},
{prop: 'subjectTotal', label: '话题数', align: 'center'},
{prop: 'viewTotal', label: '浏览数', align: 'center'},
{prop: 'publishUserName', label: '发布人'},
{prop: 'publishTime', label: '发布时间'},
{prop: 'status', label: '发布状态', align: 'center',render:(h,{row})=>[<span>{this.$dict.getLabel('newsCenterStatus',row.status)}</span>]},
{slot: 'option'},
]
}
},
methods: {
toDetail(row) {
this.detail = row
this.showList = false
this.currentPage = "hotDetail"
},
add(row) {
row && (this.detail = row)
this.showList = false
this.currentPage = "addHot"
},
handlePublish(row) {
this.$confirm(`是否${!!+row.status ? '取消' : ''}发布?`).then(() => {
this.instance.post(`/app/apphotsubject/setStatus`, null, {
params: {
id: row.id,
status: !!+row.status ? 0 : 1
}
}).then(res => {
if (res.code == 0) {
this.$message.success(`${!!+row.status ? '取消' : ''}发布成功`)
this.getList()
}
})
})
},
handleDel({id}) {
this.$confirm("是否删除?").then(() => {
this.instance.post(`/app/apphotsubject/delete`, null, {
params: {ids: id}
}).then(res => {
if (res.code == 0) {
this.$message.success("删除成功")
this.getList()
}
})
})
},
goBack() {
this.showList = true
this.getList()
},
getList() {
this.instance.post(`/app/apphotsubject/list`, null, {
params: {
...this.search,
...this.page
}
}).then(res => {
if (res && res.data) {
this.tableData = res.data.records
this.total = res.data.total
}
})
}
},
mounted(){
this.$dict.load("newsCenterStatus").then(()=>this.getList())
}
}
</script>
<style lang="scss" scoped>
.AppHotTopic {
height: 100%;
.btn {
width: 74px;
}
}
</style>

View File

@@ -0,0 +1,313 @@
<template>
<div class="addHot">
<ai-detail>
<template slot="title">
<ai-title :title="isEdit?'编辑话题':'添加话题'" :isShowBack="true" :isShowBottomBorder="true"
@onBackClick="$emit('goBack')"></ai-title>
</template>
<template slot="content">
<ai-card title="标题信息">
<template #content>
<el-form ref="baseForm" :model="baseForm" :rules="baseRules" label-width="80px" label-position="right">
<el-form-item label="话题标题" prop="title">
<el-input v-model.trim="baseForm.title" placeholder="请输入..." size="small" show-word-limit
:maxlength="100"></el-input>
</el-form-item>
<el-form-item label="封面图片" prop="thumbUrl">
<ai-uploader :instance="instance" :limit="1" v-model="baseForm.thumbUrl" isShowTip></ai-uploader>
</el-form-item>
<el-form-item label="关键词" prop="keyWords">
<el-tag
:key="tag"
v-for="tag in baseForm.keyWords"
closable
:disable-transitions="false"
effect="plain"
@close="handleClose(tag)">
{{tag}}
</el-tag>
<el-input
class="input-new-tag"
v-if="inputVisible"
v-model="inputValue"
ref="saveTagInput"
size="small"
show-word-limit
:maxlength="15"
@keyup.enter.native="handleInputConfirm"
@blur="handleInputConfirm"
>
</el-input>
<el-button v-else class="button-new-tag" icon="iconfont iconAdd" size="small" @click="showInput">添加
</el-button>
</el-form-item>
</el-form>
</template>
</ai-card>
<ai-card title="热点话题">
<template #content>
<div class="wrap" :class="{active:currentIndex==index}" v-for="(item,index) in topicForm" :key="index"
@click="onClick(index)">
<!-- <el-row type="flex" justify="space-between">-->
<!-- <header class="header">热点话题</header>-->
<!-- </el-row>-->
<el-form :ref="('topicForm'+ index)" :model="topicForm[index]" :rules="topicRules" label-width="80px"
label-position="right">
<el-form-item label="话题来源" prop="questionSource">
<el-input v-model="topicForm[index].questionSource" placeholder="请输入..." size="small" show-word-limit
:maxlength="50"></el-input>
</el-form-item>
<el-form-item label="话题描述" prop="question">
<el-input v-model="topicForm[index].question" type="textarea" :rows="5" placeholder="请输入话题描述"
size="small" show-word-limit :maxlength="500"></el-input>
</el-form-item>
<el-form-item label="回复来源" prop="answerSource">
<el-input v-model="topicForm[index].answerSource" placeholder="请输入..." size="small" show-word-limit
:maxlength="50"></el-input>
</el-form-item>
<el-form-item label="回复描述" prop="answer">
<el-input v-model="topicForm[index].answer" type="textarea" :rows="5" placeholder="请输入回复内容"
size="small" show-word-limit :maxlength="500"></el-input>
</el-form-item>
<el-form-item label="描述图片" prop="files">
<ai-uploader :instance="instance" :limit="3" isShowTip
v-model="topicForm[index]['files']"></ai-uploader>
</el-form-item>
</el-form>
</div>
</template>
</ai-card>
</template>
<template slot="footer">
<el-button @click="$emit('goBack')">取消</el-button>
<el-button type="primary" @click="handleSubmit">提交</el-button>
</template>
</ai-detail>
<div class="options">
<el-button type="primary" size="small" icon="iconfont iconAdd" @click="add">添加话题</el-button>
<el-button type="danger" size="small" icon="iconfont iconDelete" @click="handDel" :disabled="topicForm.length==1">
删除话题
</el-button>
</div>
</div>
</template>
<script>
export default {
name: "addHot",
label: "添加话题",
props: {
instance: Function,
dict: Object,
permissions: Function,
areaId: String,
detail: Object
},
data() {
return {
baseForm: {
areaId: this.areaId,
title: "",
thumbUrl: [],
keyWords: [],
},
topicForm: [{
questionSource: "",
question: "",
answerSource: "",
answer: "",
files: [],
}],
inputVisible: false,
inputValue: '',
ids: [],
currentIndex: 0,
}
},
methods: {
onClick(index) {
this.currentIndex = index
},
handleSubmit() {
Promise.all([new Promise(resolve => {
this.$refs['baseForm'].validate(valid => {
if (valid) {
resolve()
}
})
}), new Promise(resolve => {
let result = []
this.topicForm.forEach((item, index) => {
this.$refs[('topicForm' + index)][0].validate(valid => result.push(valid))
})
result.every(e=>e) && resolve()
})]).then(() => {
this.instance.post(`/app/apphotsubject/addOrUpdate`, {
hotSubject: {
...this.baseForm,
thumbUrl: this.baseForm.thumbUrl[0].url,
id: this.isEdit ? this.detail.id : null,
keyWords: this.baseForm.keyWords.join(",")
},
contents: this.topicForm,
deleteIds: this.ids,
}).then(res => {
if (res.code == 0) {
this.$message.success(this.isEdit ? "编辑成功" : "保存成功")
this.$emit("goBack")
}
})
})
},
add() {
this.topicForm.splice(this.currentIndex + 1, 0, {
questionSource: "",
question: "",
answerSource: "",
answer: "",
files: [],
})
this.currentIndex = this.topicForm.length - 1
},
handDel() {
this.$confirm("是否删除").then(() => {
this.topicForm[this.currentIndex] && this.ids.push(this.topicForm[this.currentIndex].id)
this.topicForm.splice(this.currentIndex, 1)
this.currentIndex = this.topicForm.length - 1
})
},
handleClose(tag) {
this.baseForm.keyWords.splice(this.baseForm.keyWords.indexOf(tag), 1);
},
showInput() {
this.inputVisible = true;
this.$nextTick(_ => this.$refs.saveTagInput.$refs.input.focus());
},
getDetail() {
this.instance.post(`/app/apphotsubject/detail`, null, {
params: {id: this.detail.id}
}).then(res => {
if (res && res.data) {
this.baseForm.areaId = res.data.areaId
this.baseForm.title = res.data.title
this.baseForm.thumbUrl.push({url: res.data.thumbUrl})
this.baseForm.keyWords = res.data.keyWords.split(",")
this.topicForm = res.data.contents
}
})
},
handleInputConfirm() {
let inputValue = this.inputValue
if (inputValue) {
this.baseForm.keyWords.push(inputValue);
}
this.inputVisible = false;
this.inputValue = '';
}
},
computed: {
baseRules() {
return {
title: [{required: true, message: '请输入话题标题', trigger: 'blur'}],
thumbUrl: [{required: true, message: '请上传封面图片', trigger: 'change'}],
keyWords: [{required: true, message: '请输入关键词', trigger: 'blur'}],
}
},
topicRules() {
return {
// questionSource: [{required: true, message: '请输入话题来源', trigger: 'blur'}],
question: [{required: true, message: '请输入话题描述', trigger: 'blur'}],
// answerSource: [{required: true, message: '请输入回复来源', trigger: 'blur'}],
answer: [{required: true, message: '请输入回复描述', trigger: 'blur'}],
// files: [{required: true, message: '请上传描述图片', trigger: 'change'}],
}
},
isEdit() {
return !!this.detail.id;
}
},
created() {
if (this.isEdit) {
this.getDetail()
}
}
}
</script>
<style lang="scss" scoped>
.addHot {
height: 100%;
overflow: hidden;
position: relative;
.wrap {
background-color: #F5F6F9;
box-sizing: border-box;
padding: 16px;
&:not(:last-child) {
margin-bottom: 20px;
}
.header {
font-size: 16px;
color: #222222;
line-height: 24px;
font-weight: 700;
}
}
.active {
background: #FFFFFF;
box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.05);
}
.el-tag + .el-tag {
margin-left: 10px;
}
::v-deep .el-tag {
color: #222222;
border-color: #D0D4DC;
& .el-icon-close {
color: #222222;
&:hover {
background-color: transparent;
}
}
}
.button-new-tag {
margin-left: 10px;
height: 32px;
line-height: 30px;
padding-top: 0;
padding-bottom: 0;
}
.input-new-tag {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}
.options {
position: fixed;
right: 6%;
top: 50%;
display: flex;
flex-direction: column;
::v-deep .el-button--danger {
margin-left: 0;
margin-top: 4px;
}
}
}
</style>

View File

@@ -0,0 +1,159 @@
<template>
<div class="hotDetail">
<ai-detail>
<template slot="title">
<ai-title title="热点话题详情" :isShowBack="true" :isShowBottomBorder="true"
@onBackClick="$emit('goBack')"></ai-title>
</template>
<template slot="content">
<ai-card title="标题信息">
<template slot="content">
<ai-wrapper label-width="70px" :columnsNumber="1">
<ai-info-item label="话题标题">{{detailObj.title}}</ai-info-item>
<ai-info-item label="关键字" v-if="detailObj.keyWords">
<el-tag
v-for="tag in detailObj.keyWords.split(',')"
:key="tag"
effect="plain">
{{tag}}
</el-tag>
</ai-info-item>
<ai-info-item label="封面图片">
<img :src="detailObj.thumbUrl" v-viewer
alt="">
</ai-info-item>
</ai-wrapper>
</template>
</ai-card>
<ai-card class="card" v-for="(item,index) in detailObj.contents" :key="index">
<template slot="title">{{item.question}}</template>
<template slot="right">话题来源{{item.questionSource}}</template>
<template slot="content">
<div class="wrap">
<header>
<b>{{item.answerSource}}</b>&nbsp;&nbsp;回复
</header>
<p>{{item.answer}}</p>
<div v-viewer>
<img :src="p.url"
v-for="(p,q) in item.files" :key="q" alt="">
</div>
</div>
</template>
</ai-card>
</template>
</ai-detail>
</div>
</template>
<script>
import Viewer from 'v-viewer' ;
import Vue from 'vue' ;
Vue.use(Viewer);
export default {
name: "hotDetail",
label: "热点详情",
props: {
instance: Function,
dict: Object,
permissions: Function,
areaId: String,
detail: Object
},
data() {
return {
detailObj: {},
}
},
methods: {
getDetail() {
this.instance.post(`/app/apphotsubject/detail`, null, {
params: {id: this.detail.id}
}).then(res => {
if (res && res.data) {
this.detailObj = res.data
}
})
},
},
created() {
this.getDetail()
}
}
</script>
<style lang="scss" scoped>
.hotDetail {
height: 100%;
overflow: hidden;
.card {
::v-deep .aibar {
height: 94px !important;
flex-direction: column;
align-items: flex-start;
margin-bottom: 0px !important;
padding: 16px !important;
& > div {
line-height: 24px;
&:last-child {
font-size: 14px;
color: #888888;
}
}
}
::v-deep .ai-card__body {
padding: 12px 20px 22px !important;
}
.wrap {
background-color: #F5F6F9;
box-sizing: border-box;
padding: 16px;
header {
height: 40px;
font-size: 16px;
color: #222222;
line-height: 24px;
display: flex;
align-items: center;
border-bottom: 1px solid #EEEEEE;
b {
color: #2266FF;
}
}
p {
margin-top: 16px;
font-size: 16px;
color: #222222;
line-height: 32px;
text-indent: 2em;
}
}
}
::v-deep .el-tag{
background: #F3F4F7;
border-radius: 2px;
color: #222222;
border: 1px solid #D0D4DC;
margin-right: 8px;
}
img {
width: 160px;
height: 160px;
border-radius: 2px;
margin-top: 16px;
margin-right: 8px;
}
}
</style>

View File

@@ -0,0 +1,105 @@
<template>
<ai-list v-if="!isShowDetail">
<template slot="title">
<ai-title title="招工就业" :isShowBottomBorder="false"></ai-title>
</template>
<template slot="tabs">
<el-tabs v-model="currIndex">
<el-tab-pane v-for="(tab,i) in tabs" :key="i" :label="tab.label">
<component :ref="String(i)" v-if="currIndex == i" :is="tab.comp" @change="onChange" lazy :instance="instance" :dict="dict" :permissions="permissions"/>
</el-tab-pane>
</el-tabs>
</template>
</ai-list>
<AddJob v-else-if="componentName === 'AddJob' && isShowDetail" :params="params" :instance="instance" :dict="dict" :permissions="permissions" @change="onChange"></AddJob>
<Add v-else-if="componentName === 'Add' && isShowDetail" :params="params" :instance="instance" :dict="dict" :permissions="permissions" @change="onChange"></Add>
</template>
<script>
import List from './components/List.vue'
import JobList from './components/JobList'
import Add from './components/Add'
import AddJob from './components/AddJob'
import { mapState } from 'vuex'
export default {
name: 'AppJob',
label: '招工就业',
components: {
JobList,
AddJob,
List,
Add
},
props: {
instance: Function,
dict: Object,
permissions: Function
},
computed: {
...mapState(['user']),
tabs () {
const tabList = [
{label: '找能人', name: 'List', comp: List, permission: ''},
{label: '找工作', name: 'Statistics', comp: JobList, permission: ''}
].filter(item => {
return true
})
return tabList
}
},
data () {
return {
activeName: 'List',
currIndex: '0',
componentName: '',
params: {},
isShowDetail: false
}
},
created () {
if (this.$route.query.id) {
this.componentName = this.$route.query?.type
this.params = {id: this.$route.query?.id}
this.isShowDetail = true
}
},
methods: {
onChange (data) {
if (data.type === 'List') {
this.componentName = 'List'
this.isShowDetail = false
this.params = data.params
}
if (data.type === 'Add') {
this.componentName = 'Add'
this.isShowDetail = true
this.params = data.params
}
if (data.type === 'JobList') {
this.componentName = 'JobList'
this.isShowDetail = false
this.params = data.params
}
if (data.type === 'AddJob') {
this.componentName = 'AddJob'
this.isShowDetail = true
this.params = data.params
}
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,204 @@
<template>
<ai-detail>
<!-- 返回按钮 -->
<template #title>
<ai-title title="添加招工就业信息" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
</template>
<!-- 内容 -->
<template #content>
<el-form class="ai-form" :model="formData" ref="ruleForm" :rules="formRules">
<ai-card title="岗位信息">
<div slot="content" class="ai-content">
<!-- 招聘岗位 -->
<el-form-item label="招聘岗位" prop="title" style="width: 45%">
<el-input size="small" placeholder="请输入" v-model="formData.title" maxlength="30" show-word-limit></el-input>
</el-form-item>
<!-- 招聘人数 -->
<el-form-item label="招聘人数" prop="total" style="width: 45%">
<el-input size="small" placeholder="请输入" v-model="formData.total" show-word-limit></el-input>
</el-form-item>
<!-- 学历 -->
<el-form-item label="学历" prop="education" style="width: 45%">
<el-input size="small" placeholder="请输入" v-model="formData.education" show-word-limit></el-input>
</el-form-item>
<!-- 性别 -->
<el-form-item label="招聘性别" prop="gender" style="width: 45%">
<ai-select size="small" v-model="formData.gender" :selectList="$dict.getDict('JobGender')"></ai-select>
</el-form-item>
<!-- 年龄 -->
<el-form-item label="年龄" prop="age" style="width: 45%">
<el-input size="small" placeholder="请输入如“18-60”" v-model="formData.age" show-word-limit></el-input>
</el-form-item>
<!-- 薪酬待遇 -->
<el-form-item label="薪酬待遇" prop="salary" style="width: 45%">
<el-input size="small" placeholder="请输入如“5k-10k”" v-model="formData.salary" maxlength="10" show-word-limit></el-input>
</el-form-item>
<!-- 岗位说明 -->
<el-form-item label="岗位说明" prop="remark" style="width: 100%">
<el-input type="textarea" placeholder="请输入" maxlength="500" v-model="formData.remark" show-word-limit :rows="4"></el-input>
</el-form-item>
<!-- / -->
</div>
</ai-card>
<ai-card title="企业信息">
<div slot="content" class="ai-content">
<!-- 单位名称 -->
<el-form-item label="单位名称" prop="companyName" style="width: 45%">
<el-input size="small" placeholder="请输入" v-model="formData.companyName" maxlength="30" show-word-limit></el-input>
</el-form-item>
<!-- 联系人 -->
<el-form-item label="联系人" prop="linkName" style="width: 45%">
<el-input size="small" placeholder="请输入" v-model="formData.linkName" show-word-limit></el-input>
</el-form-item>
<!-- 联系方式 -->
<el-form-item label="联系方式" prop="linkPhone" style="width: 100%">
<el-input size="small" placeholder="请输入" v-model="formData.linkPhone" show-word-limit></el-input>
</el-form-item>
</div>
</ai-card>
</el-form>
</template>
<!-- 底部按钮 -->
<template #footer>
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="confirm('ruleForm')">提交</el-button>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Add',
// 组件
components: {},
props: {
instance: Function,
dict: Object,
params: Object,
},
data() {
return {
info: {},
id: '',
formData: {
title: '',
total: '',
education: '',
gender: '',
age: '',
salary: '',
remark: '',
companyName: '',
linkName: '',
linkPhone: '',
status: '0',
},
formRules: {
title: [{ required: true, message: '请输入招聘岗位', trigger: 'change' }],
total: [{ required: true, message: '请输入招聘人数位', trigger: 'change' }],
education: [{ required: true, message: '请输入招聘学历', trigger: 'change' }],
age: [{ required: true, message: '请输入招聘年龄', trigger: 'change' }],
gender: [{ required: true, message: '请输入招聘性别', trigger: 'change' }],
salary: [{ required: true, message: '请输入薪酬待遇', trigger: 'change' }],
remark: [
{ required: true, message: '请输入岗位说明', trigger: 'change' }
],
companyName: [{ required: true, message: '请输入单位名称', trigger: 'change' }],
linkName: [{ required: true, message: '请输入联系人', trigger: 'change' }],
linkPhone: [{ required: true, message: '请输入联系方式', trigger: 'change' }],
},
}
},
// 计算
computed: {},
// 监听
watch: {},
created() {
this.dict.load('JobGender').then(() => {})
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfoList(this.params.id)
}
},
// 实例创建后
onShow() {},
// 实例渲染后
mounted() {},
// 方法
methods: {
getInfoList(id) {
this.instance.post(`/app/appjob/detail?id=${id}`).then((res) => {
if (res.code === 0) {
this.formData = res.data
window.console.log(this.info)
}
})
},
// 确定新增
confirm() {
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
this.instance
.post(`/app/appjob/addOrUpdate`, {
title: this.formData.title,
total: this.formData.total,
education: this.formData.education,
gender: this.formData.gender,
age: this.formData.age,
salary: this.formData.salary,
remark: this.formData.remark,
companyName: this.formData.companyName,
linkName: this.formData.linkName,
linkPhone: this.formData.linkPhone,
status: this.formData.status,
id: this.id,
type: 0
})
.then((res) => {
if (res.code == 0) {
this.$message.success('提交成功')
setTimeout(() => {
this.cancel(true)
}, 1000)
}
})
}
})
},
// 返回按钮
cancel(isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: isRefresh ? true : false,
})
},
},
}
</script>
<style scoped lang="scss">
::v-deep.ai-form {
display: flex;
flex-direction: column;
.ai-card {
.ai-content {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
}
}
</style>

View File

@@ -0,0 +1,116 @@
<template>
<ai-detail>
<template #title>
<ai-title title="添加招工就业信息" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
</template>
<template #content>
<el-form class="ai-form" :model="formData" ref="ruleForm" :rules="formRules">
<ai-card title="基础信息">
<div slot="content" class="ai-content">
<el-form-item label="标题" prop="title" style="width: 100%">
<el-input placeholder="请输入" size="small" v-model="formData.title" maxlength="30" show-word-limit></el-input>
</el-form-item>
<el-form-item label="联系人" prop="linkName" style="width: 100%">
<el-input size="small" placeholder="请输入联系人" v-model="formData.linkName" maxlength="20" show-word-limit></el-input>
</el-form-item>
<el-form-item label="联系方式" prop="linkPhone" style="width: 100%">
<el-input size="small" placeholder="请输入联系方式" :maxlength="20" v-model="formData.linkPhone" show-word-limit></el-input>
</el-form-item>
</div>
</ai-card>
</el-form>
</template>
<template #footer>
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="confirm('ruleForm')">提交</el-button>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Add',
props: {
instance: Function,
dict: Object,
params: Object,
},
data() {
return {
info: {},
id: '',
formData: {
title: '',
linkPhone: '',
linkName: '',
type: 1
},
formRules: {
title: [{ required: true, message: '请输入标题', trigger: 'blur' }],
linkPhone: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
linkName: [{ required: true, message: '请输入联系方式', trigger: 'blur' }]
},
}
},
created() {
this.dict.load('JobGender').then(() => {})
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfoList(this.params.id)
}
},
methods: {
getInfoList(id) {
this.instance.post(`/app/appjob/detail?id=${id}`).then((res) => {
if (res.code === 0) {
this.formData = res.data
window.console.log(this.info)
}
})
},
confirm() {
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
this.instance.post(`/app/appjob/addOrUpdate`, {
...this.formData,
type: 1,
id: this.id || ''
})
.then((res) => {
if (res.code == 0) {
this.$message.success('提交成功')
setTimeout(() => {
this.cancel(true)
}, 600)
}
})
}
})
},
cancel(isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: isRefresh ? true : false,
})
},
},
}
</script>
<style scoped lang="scss">
::v-deep.ai-form {
display: flex;
flex-direction: column;
.ai-card {
.ai-content {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
}
}
</style>

View File

@@ -0,0 +1,124 @@
<template>
<ai-list class="notice" isTabs>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button>
</template>
<template #right>
<el-input
v-model="search.title"
class="search-input"
size="small"
v-throttle="() => {search.current=1,getList()}"
placeholder="请输入标题"
clearable
@clear="search.current = 1, search.title = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 6px;"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="options" width="140px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'JobList',
props: {
instance: Function,
dict: Object
},
data() {
return {
search: {
current: 1,
size: 10,
title: ''
},
currIndex: -1,
areaList: [],
total: 10,
colConfigs: [
{ prop: 'title', label: '标题', align: 'left', width: '200px' },
{ prop: 'linkPhone', label: '联系方式', align: 'center' },
{ prop: 'createUserName', label: '发布人', align: 'center' },
{ prop: 'createTime', label: '发布时间', align: 'center' },
{ slot: 'options', label: '操作', align: 'center' }
],
areaName: '',
unitName: '',
tableData: []
}
},
computed: {
...mapState(['user'])
},
mounted() {
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appjob/list`, null, {
params: {
...this.search,
type: 1
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appjob/delete?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
toAdd(id) {
this.$emit('change', {
type: 'AddJob',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
.notice {
}
</style>

View File

@@ -0,0 +1,274 @@
<template>
<ai-list isTabs class="list">
<template #content>
<div class="statistics-top">
<div class="statistics-top__item">
<span>招聘单位总数</span>
<h2 style="color: #2266FF;">{{ staData.countCompany || 0 }}</h2>
</div>
<div class="statistics-top__item">
<span>招聘岗位总数</span>
<h2 style="color: #22AA99;">{{ staData.countTotal || 0 }}</h2>
</div>
<div class="statistics-top__item">
<span>招聘人员总数</span>
<h2 style="color: #F8B425">{{ staData.countUser || 0 }}</h2>
</div>
</div>
<div class="content">
<ai-search-bar bottomBorder>
<template slot="left">
<!-- 性别下拉选择框 -->
<ai-select v-model="searchObj.gender" placeholder="请选择性别" clearable @change=";(page.current = 1), getList()" :selectList="dict.getDict('JobGender')"></ai-select>
</template>
<!-- 搜索 -->
<template slot="right"> <el-input v-model="searchObj.title" size="small" placeholder="请输入单位名称" clearable v-throttle="() => {page.current = 1, getList()}" @clear=";(page.current = 1), (searchObj.title = ''), getList()" suffix-icon="iconfont iconSearch"/></template>
</ai-search-bar>
<ai-search-bar style="margin-top: 16px;">
<!-- 添加 -->
<template #left>
<el-button type="primary" icon="iconfont iconAdd" size="small" @click="add('')">添加</el-button>
<el-button icon="iconfont iconDelete" size="small" @click="toDelete()" :disabled="ids.length == 0">删除</el-button>
</template>
<!-- 导入导出 -->
<template #right>
<ai-import :instance="instance" :dict="dict" type="appjob" name="招工就业" @success="getList(), $message.success('导入成功!')">
<el-button icon="iconfont iconImport">导入</el-button>
</ai-import>
<ai-download :instance="instance" url="/app/appjob/listExport" :params="param" fileName="招工就业模板" />
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :colConfigs="colConfigs" :total="page.total" :current.sync="page.current" :size.sync="page.size" @selection-change="(v) => (ids = v.map((e) => e.id))" @getList="getList">
<!-- 是否启用 -->
<el-table-column label="是否启用" slot="status" align="center" width="80">
<template v-slot="{ row }">
<el-switch v-model="row.status" @change="onChange(row)" active-value="1" inactive-value="0" active-color="#5088FF" inactive-color="#D0D4DC"> </el-switch>
</template>
</el-table-column>
<!-- 操作 -->
<el-table-column label="操作" align="center" width="140" slot="options">
<template slot-scope="{ row }">
<el-button type="text" @click="add(row.id)">编辑</el-button>
<el-button type="text" @click="toDelete(row.id)">删除</el-button>
</template>
</el-table-column>
</ai-table>
</div>
</template>
</ai-list>
</template>
<script>
export default {
name: 'list',
// 组件
components: {},
props: {
params: Object,
instance: Function,
dict: Object,
},
data() {
return {
tableData: [],
page: {
size: 10,
current: 1,
total: 0,
},
searchObj: {
gender: '',
title: '',
},
colConfigs: [
{ type: 'selection' },
{ prop: 'companyName', label: '单位名称', width: '180px' },
{ prop: 'title', label: '招聘岗位', width: '150px' },
{ prop: 'total', label: '招聘人数', width: '80px' },
{ prop: 'education', label: '学历', width: '80px' },
{
prop: 'gender',
label: '性别',
width: '60px',
render: (h, { row }) => {
return h('span', null, this.dict.getLabel('JobGender', row.gender))
},
},
{ prop: 'age', label: '年龄' },
{ prop: 'salary', label: '薪酬待遇' },
{ prop: 'linkName', label: '联系人', width: '80px' },
{ prop: 'linkPhone', label: '联系方式' },
{ prop: 'createUserName', label: '添加人' },
{ prop: 'createTime', label: '添加日期', width: '160px' },
{ slot: 'status', label: '是否启用' },
],
staData: [],
ids: [],
}
},
// 计算
computed: {
param() {
let params = {}
//导出搜索条件
if (this.ids.length) {
params = {
...params,
ids: this.ids,
}
} else {
params = {
...params,
...this.searchObj,
}
}
return params
},
},
// 监听
watch: {},
// 实例创建后
created() {
this.dict.load('JobGender').then(() => {
this.getList()
this.getStaData()
})
},
// 实例创建后
onShow() {},
// 实例渲染后
mounted() {
this.dict.load('JobGender').then(() => {
this.$nextTick(() => this.getList())
})
},
// 方法
methods: {
getList() {
this.instance
.post(`/app/appjob/list`, null, {
params: {
...this.page,
...this.searchObj,
type: 0
},
})
.then((res) => {
if (res.code == 0) {
// console.log(res.data.records)
this.tableData = res.data.records
this.page.total = res.data.total
}
})
.catch(() => {})
},
// 添加
add(id) {
this.$emit('change', {
type: 'Add',
params: {
id: id || '',
},
})
},
// 删除
toDelete(id) {
this.$confirm('删除后不可恢复,是否要删除该事项?').then(() => {
this.instance
.post('/app/appjob/delete', null, {
params: { ids: id || this.ids.join(',') },
})
.then((res) => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
this.getStaData()
}
})
})
},
// 启用停用
onChange(row) {
this.instance.post(`/app/appjob/setStatus?id=${row.id}&status=${row.status}`).then((res) => {
if (res.code == 0) {
this.$message.success(+row.status ? '已启用' : '不启用')
this.getList()
}
})
},
// 统计
getStaData() {
this.instance.post('/app/appjob/statistic').then((res) => {
if (res?.data) {
this.staData = res.data
}
})
},
},
}
</script>
<style scoped lang="scss">
.list {
::v-deep .ai-list__content {
padding: 0!important;
.ai-list__content--right-wrapper {
background: transparent!important;
box-shadow: none!important;
margin: 0!important;
padding: 0 0 12px!important;
}
}
.statistics-top {
display: flex;
align-items: center;
margin-bottom: 20px;
& > div {
flex: 1;
height: 96px;
line-height: 1;
margin-right: 20px;
padding: 16px 24px;
background: #FFFFFF;
box-shadow: 0px 4px 6px -2px rgba(15, 15, 21, 0.15);
border-radius: 4px;
&:last-child {
margin-right: 0;
}
h3 {
font-size: 24px;
}
span {
display: block;
margin-bottom: 16px;
color: #888888;
font-size: 16px;
}
}
}
.content {
padding: 16px;
background: #FFFFFF;
box-shadow: 0px 4px 6px -2px rgba(15, 15, 21, 0.15);
}
}
</style>

View File

@@ -0,0 +1,73 @@
<template>
<div class="doc-circulation ailist-wrapper">
<keep-alive :include="['List']">
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component>
</keep-alive>
</div>
</template>
<script>
import List from './components/List'
import Add from './components/Add'
import Detail from './components/Detail'
export default {
name: 'AppNotice',
label: '小程序公告',
props: {
instance: Function,
dict: Object
},
data () {
return {
component: 'List',
params: {},
include: []
}
},
components: {
Add,
List,
Detail
},
mounted () {
},
methods: {
onChange (data) {
if (data.type === 'Add') {
this.component = 'Add'
this.params = data.params
}
if (data.type === 'Detail') {
this.component = 'Detail'
this.params = data.params
}
if (data.type === 'list') {
this.component = 'List'
this.params = data.params
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
}
}
}
}
</script>
<style lang="scss">
.doc-circulation {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,113 @@
<template>
<ai-detail>
<template slot="title">
<ai-title :title="params.id ? '编辑小程序公告' : '添加小程序公告'" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<el-form ref="form" class="ai-form" :model="form" label-width="110px" label-position="right">
<el-form-item label="标题" style="width: 100%;" prop="title" :rules="[{ required: true, message: '请输入标题', trigger: 'blur' }]">
<el-input size="small" placeholder="请输入标题" :maxlength="30" v-model="form.title"></el-input>
</el-form-item>
<el-form-item label="发布组织" style="width: 100%;" prop="publishUnitName" :rules="[{ required: true, message: '请输入发布组织', trigger: 'blur' }]">
<el-input size="small" placeholder="请输入发布组织" :maxlength="50" v-model="form.publishUnitName"></el-input>
</el-form-item>
<el-form-item label="正文" style="width: 100%;" prop="content">
<ai-editor v-model="form.content" :instance="instance" />
</el-form-item>
<el-form-item label="图片" style="width: 100%;" prop="images">
<ai-uploader v-model="form.images" :instance="instance" :limit="9" isShowTip></ai-uploader>
</el-form-item>
</el-form>
</template>
</ai-card>
</template>
<template #footer>
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="confirm">提交</el-button>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Add',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
form: {
title: '',
content: '',
publishUnitName: '',
images: []
},
id: ''
}
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appmininotice/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = {
...res.data,
images: res.data.images ? JSON.parse(res.data.images) : []
}
}
})
},
onClose () {
this.form.explain = ''
},
confirm () {
this.$refs.form.validate((valid) => {
if (valid) {
if (!this.form.content && !this.form.images.length) {
return this.$message.error('请输入正文或上传图片')
}
this.instance.post(`/app/appmininotice/addOrUpdate`, {
...this.form,
images: this.form.images ? JSON.stringify(this.form.images) : []
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
setTimeout(() => {
this.cancel(true)
}, 600)
}
})
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'list',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,71 @@
<template>
<ai-detail>
<template slot="title">
<ai-title title="详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<ai-wrapper>
<ai-info-item label="标题" isLine :value="info.title"></ai-info-item>
<ai-info-item label="发布组织" isLine :value="info.publishUnitName"></ai-info-item>
<ai-info-item label="正文" isLine>
<AiArticle :value="info.content"></AiArticle>
</ai-info-item>
<ai-info-item label="图片" isLine>
<ai-uploader v-model="info.images" disabled :instance="instance" :limit="9"></ai-uploader>
</ai-info-item>
</ai-wrapper>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
id: ''
}
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appmininotice/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.info = res.data
this.info.images = res.data.images ? JSON.parse(res.data.images) : []
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'list',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,138 @@
<template>
<ai-list class="notice">
<template slot="title">
<ai-title title="小程序公告" isShowBottomBorder></ai-title>
</template>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button>
</template>
<template slot="right">
<el-input
v-model="search.title"
class="search-input"
size="small"
v-throttle="() => {search.current = 1, getList()}"
placeholder="请输入标题"
clearable
@change="getList"
@clear="search.current = 1, search.title = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 6px;"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="tags" label="标签">
<template slot-scope="{ row }">
<div class="table-tags">
<el-tag type="info" v-for="(item, index) in row.tags" size="small" :key="index">{{ item }}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column slot="options" width="180px" fixed="right" label="操作" align="center">
<div class="table-options" slot-scope="{ row }">
<el-button type="text" @click="toDetail(row.id)">详情</el-button>
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'List',
props: {
instance: Function,
dict: Object
},
data() {
return {
search: {
current: 1,
size: 10,
title: ''
},
currIndex: -1,
areaList: [],
total: 10,
colConfigs: [
{prop: 'title', label: '标题', align: 'left'},
{prop: 'createUserName', label: '发布人', align: 'center' },
{prop: 'publishUnitName', label: '发布组织', align: 'center'},
{prop: 'createTime', label: '发布时间', align: 'center' },
{slot: 'options', label: '操作'}
],
tableData: []
}
},
computed: {
...mapState(['user'])
},
mounted() {
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appmininotice/list`, null, {
params: {
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appmininotice/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
toDetail (id) {
this.$emit('change', {
type: 'Detail',
params: {
id: id || ''
}
})
},
toAdd(id) {
this.$emit('change', {
type: 'Add',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,134 @@
<template>
<div class="appPressCenter">
<ai-list v-show="showList">
<template slot="title">
<ai-title
title="新闻中心"
:isShowBottomBorder="false"
@change="changeAreaId"
:isShowArea="true"
:instance="instance"
v-model="areaId"
:hideLevel="hideLevel"/>
</template>
<template slot="tabs">
<el-tabs v-model="currIndex">
<el-tab-pane
v-for="(tab, i) in tabs"
:key="i"
:label="tab.label"
:name="String(i)"
>
<component
:is="tab.comp"
v-if="currIndex === String(i)"
:ref="currIndex"
:instance="instance"
:dict="dict"
:permissions="permissions"
:areaId="areaId"
@goPage="goPage"
/>
</el-tab-pane>
</el-tabs>
</template>
</ai-list>
<component
v-if="!showList"
:is="currentPage"
:detail="detail"
:instance="instance"
:dict="dict"
:permissions="permissions"
:areaId="areaId"
@goBack="goBack"
@goPage="goPage"
/>
</div>
</template>
<script>
import {mapState} from 'vuex'
import {addArticle, addVideo, commentList, newsDetail, newsList, videoDetail} from './components'
export default {
name: 'AppPressCenter',
label: '新闻中心',
props: {
instance: Function,
dict: Object,
permissions: Function
},
components: {
newsList,
commentList,
addVideo,
addArticle,
newsDetail,
videoDetail
},
data() {
return {
areaId: '',
currIndex: '0',
detail: {}
}
},
computed: {
...mapState(['user']),
tabs() {
return [
{
label: '内容管理',
name: 'newsList',
comp: newsList,
addVideo: addVideo,
addArticle: addArticle,
newsDetail: newsDetail,
videoDetail: videoDetail
},
{label: '评论管理', name: 'commentList', comp: commentList}
]
},
showList() {
return !this.$route.hash
},
hideLevel() {
return this.user.info.areaList?.length - 1
},
currentPage() {
return this.$route.hash?.substring(1)
}
},
methods: {
changeAreaId() {
this.$nextTick(() => {
this.$refs[this.currIndex][0].getList()
})
},
goBack() {
this.$router.push({})
},
goPage(obj) {
let hash = "#" + obj.key
if (obj.row) {
let {id} = obj.row
this.$router.push({query: {id}, hash})
} else {
this.$router.push({hash})
}
}
},
created() {
this.areaId = this.user.info.areaId
}
}
</script>
<style lang="scss" scoped>
.appPressCenter {
width: 100%;
height: 100%;
}
</style>

View File

@@ -0,0 +1,154 @@
<template>
<ai-detail class="add-article">
<template slot="title">
<ai-title :title="isEdit?'编辑文章':'发布文章'" :isShowBack="true" :isShowBottomBorder="true"
@onBackClick="$emit('goBack')"></ai-title>
</template>
<template slot="content">
<ai-card title="发布文章">
<template #content>
<el-form ref="ruleForm" :model="articInfo" :rules="rules" label-width="120px" label-position="right">
<el-form-item prop="title" label="标题:">
<el-input v-model="articInfo.title" size="small" placeholder="请输入…" maxlength="30"
show-word-limit></el-input>
</el-form-item>
<el-form-item prop="policyType" label="类型:">
<ai-select
v-model="articInfo.policyType"
placeholder="选择新闻类型"
:selectList="dict.getDict('newsCenterPolicyType')">
</ai-select>
</el-form-item>
<el-form-item label="发布地区:" prop="areaId">
<ai-area-get v-model="articInfo.areaId" :instance="instance" :root="areaId"/>
</el-form-item>
<el-form-item prop="content" label="正文:">
<ai-editor v-model="articInfo.content" :instance="instance"/>
</el-form-item>
<el-form-item prop="coverFile" label="封面:">
<ai-uploader :instance="instance" v-model="articInfo.coverFile" :limit="1" :isShowTip="true"
@change="$refs['ruleForm'].clearValidate('coverFile')" :cropOps="cropOps" is-crop>
<template slot="tips">最多上传1张图片,单个文件最大10MB支持jpgjpegpng<br/>格式图片比例1.61</template>
</ai-uploader>
</el-form-item>
</el-form>
</template>
</ai-card>
</template>
<template slot="footer">
<el-button class="footer_btn" @click="$emit('goBack')">取消</el-button>
<el-button type="primary" class="footer_btn" @click="handleSubmit('1')" v-if="!isEdit">发布</el-button>
<el-button class="footer_btn" @click="handleSubmit('0')">保存</el-button>
</template>
</ai-detail>
</template>
<script>
export default {
name: "addArticle",
props: {
instance: Function,
dict: Object,
permissions: Function,
areaId: String,
detail: Object,
},
data() {
return {
articInfo: {
areaId: '',
title: "",
content: "",
policyType: '',
coverFile: [],
},
rules: {
title: {required: true, message: '请输入标题', trigger: 'blur'},
areaId: {required: true, message: '请选择 发布地区', trigger: 'blur'},
policyType: {required: true, message: '请选择类型', trigger: 'change'},
content: {required: true, message: '请填写内容', trigger: 'blur'},
coverFile: {required: true, message: '请上传封面', trigger: 'blur'},
},
cropOps: {
fixedNumber: [1.8, 1],
fixed: true
}
}
},
computed: {
isEdit() {
return !!this.$route.query.id;
}
},
methods: {
/**
* 发布、保存新闻
* @param status
*/
handleSubmit(status) {
this.$refs["ruleForm"].validate(valid => {
if (valid) {
this.addOrUpdate(status);
}
})
},
/**
* 新增、修改
* */
addOrUpdate(status) {
const msg = +status ? '发布成功' : this.isEdit ? '编辑成功' : '保存成功';
this.instance.post(`/app/appnewscenterinfo/addOrUpdate`, {
...this.articInfo,
coverFile: {
id: this.articInfo.coverFile[0].id
},
type: 0,
id: this.$route.query.id,
status: status
}).then(res => {
if (res.code == 0) {
this.$message.success(msg);
this.$emit("goBack");
}
})
},
/**
* 根据id查询详情
*/
getDetail() {
let {id} = this.$route.query
id && this.instance.post(`/app/appnewscenterinfo/queryDetailById`, null, {
params: {id}
}).then(res => {
if (res?.data) {
this.articInfo = res.data
this.articInfo.areaId = res.data.areaId
this.articInfo.title = res.data.title;
this.articInfo.content = res.data.content;
this.articInfo.policyType = res.data.policyType
this.articInfo.coverFile = [{...res.data.coverFile, url: res.data.coverFile.accessUrl}];
}
})
}
},
created() {
if (this.isEdit) {
this.getDetail();
}
}
}
</script>
<style lang="scss" scoped>
.add-article {
height: 100%;
overflow: auto;
background: #F3F6F9;
.footer_btn {
width: 106px;
}
}
</style>

View File

@@ -0,0 +1,262 @@
<template>
<ai-detail class="add-video">
<template slot="title">
<ai-title :title="isEdit?'编辑视频':'发布视频'" :isShowBack="true" :isShowBottomBorder="true"
@onBackClick="$emit('goBack')"></ai-title>
</template>
<template slot="content">
<ai-card title="发布视频">
<template #content>
<el-form ref="ruleForm" :model="newsInfo" :rules="rules" label-width="120px" label-position="right">
<el-form-item prop="title" label="标题:">
<el-input v-model="newsInfo.title" size="small" placeholder="请输入…" maxlength="30"
show-word-limit></el-input>
</el-form-item>
<el-form-item prop="policyType" label="类型:">
<ai-select
v-model="newsInfo.policyType"
placeholder="选择新闻类型"
:selectList="$dict.getDict('newsCenterPolicyType')">
</ai-select>
</el-form-item>
<el-form-item label="发布地区:" prop="areaId">
<ai-area-get v-model="newsInfo.areaId" :instance="instance" :root="areaId"/>
</el-form-item>
<el-form-item prop="videoFile" label="视频:">
<el-upload :show-file-list="false" ref="upload1"
action :http-request="submitUpload" :accept="accept" :limit="1">
<div class="video" v-if="!newsInfo.videoFile.length">
<div class="icon">
<ai-icon type="svg" icon="iconVideo"/>
<span>上传视频</span>
</div>
<span class="tips">支持mp4格式单个文件最大100MB</span>
</div>
</el-upload>
<video class="video-com" style="width:100%; height:100%; object-fit: fill;" muted
:src="newsInfo.videoFile[0].url" controls="controls" v-if="newsInfo.videoFile.length"></video>
<el-upload :show-file-list="false" ref="upload2" action :http-request="submitUpload" :accept="accept"
:limit="1" v-if="newsInfo.videoFile.length">
<el-button style="margin-top: 10px;">重新选择</el-button>
</el-upload>
</el-form-item>
<el-form-item prop="coverFile" label="封面:">
<ai-uploader :instance="instance" v-model="newsInfo.coverFile" :limit="1"
@change="$refs['ruleForm'].clearValidate('coverFile')" :cropOps="cropOps" is-crop>
<template slot="tips">图片比例1.81</template>
</ai-uploader>
</el-form-item>
</el-form>
</template>
</ai-card>
</template>
<template slot="footer">
<el-button class="footer_btn" @click="$emit('goBack')">取消</el-button>
<el-button type="primary" class="footer_btn" @click="handleSubmit('1')" v-if="!isEdit">发布</el-button>
<el-button class="footer_btn" @click="handleSubmit('0')">保存</el-button>
</template>
</ai-detail>
</template>
<script>
import mp4box from 'mp4box'
export default {
name: "addVideo",
props: {
instance: Function,
dict: Object,
permissions: Function,
areaId: String,
detail: Object,
},
data() {
return {
newsInfo: {
areaId: '',
title: "",
policyType: '',
videoFile: [],
coverFile: []
},
accept: ".mp4",
rules: {
title: {required: true, message: '请输入标题', trigger: 'blur'},
areaId: {required: true, message: '请选择 发布地区', trigger: 'blur'},
policyType: {required: true, message: '请选择类型', trigger: 'change'},
videoFile: {required: true, message: '请上传视频', trigger: 'blur'},
coverFile: {required: true, message: '请上传封面', trigger: 'blur'},
},
cropOps: {
width: "320px",
height: "180px"
},
}
},
computed: {
isEdit() {
return !!this.$route.query.id;
}
},
methods: {
handleSubmit(status) {
this.$refs["ruleForm"].validate(valid => {
if (valid) {
this.addOrUpdate(status);
}
})
},
/**
* 上传视频
*/
submitUpload(file) {
this.$refs['upload1']?.clearFiles();
this.$refs['upload2']?.clearFiles();
this.$refs['ruleForm']?.clearValidate('videoFile');
const fileType = file.file.name.split(".")[1];
const size = file.file.size / 1024 / 1024 > 100;
let mp4boxfile = mp4box.createFile();
const reader = new FileReader();
reader.readAsArrayBuffer(file.file);
reader.onload = (e) => {
const arrayBuffer = e.target.result;
arrayBuffer.fileStart = 0;
mp4boxfile.appendBuffer(arrayBuffer);
};
mp4boxfile.onReady = (info) => {
let codec = info.mime.match(/codecs="(\S*),/)[1]
if (codec.indexOf('avc') === -1) {
return this.$message.error("视频编码格式不支持")
}
if (size) {
return this.$message.error("视频大小不能超过100M");
}
if (fileType && this.accept.indexOf(fileType.toLocaleLowerCase()) > -1) {
let formData = new FormData()
formData.append('file', file.file);
this.instance.post(`/admin/file/add-unlimited`, formData).then(res => {
if (res && res.data) {
let videoList = res.data[0].split(";");
this.newsInfo.videoFile.splice(0, 1, {
id: videoList[1],
url: videoList[0]
})
}
})
} else {
return this.$message.error("视频格式错误");
}
};
},
addOrUpdate(status) {
const msg = +status ? '发布成功' : this.isEdit ? '编辑成功' : '保存成功';
this.instance.post(`/app/appnewscenterinfo/addOrUpdate`, {
title: this.newsInfo.title,
videoFile: {
id: this.newsInfo.videoFile[0].id
},
coverFile: {
id: this.newsInfo.coverFile[0].id
},
policyType: this.newsInfo.policyType,
areaId: this.areaId,
type: 1,
id: this.detail.id,
status: this.isEdit ? this.detail.status : status
}).then(res => {
if (res.code == 0) {
this.$message.success(msg);
this.$emit("goBack");
}
})
},
getDetail() {
let {id} = this.$route.query
this.instance.post(`/app/appnewscenterinfo/queryDetailById`, null, {
params: {id}
}).then(res => {
if (res?.data) {
this.newsInfo.areaId = res.data.areaId
this.newsInfo.title = res.data.title;
this.newsInfo.policyType = res.data.policyType
this.newsInfo.videoFile = [{...res.data.videoFile, url: res.data.videoFile.accessUrl}];
this.newsInfo.coverFile = [{...res.data.coverFile, url: res.data.coverFile.accessUrl}];
}
})
}
},
created() {
if (this.isEdit) {
this.getDetail();
}
}
}
</script>
<style lang="scss" scoped>
.add-video {
height: 100%;
overflow: auto;
.video {
width: 640px;
height: 360px;
border-radius: 4px;
border: 1px dashed #D0D4DC;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.icon {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
span:nth-child(2) {
display: inline-block;
font-size: 16px;
color: #333333;
line-height: 30px;
}
.iconfont {
display: inline-block;
font-size: 40px;
color: #2266FF;
}
}
.tips {
display: inline-block;
font-size: 12px;
color: #999999;
line-height: 26px;
}
}
.video-com {
width: 640px;
height: 360px;
background: rgba(0, 0, 0, 0.5);
border-radius: 2px;
border: 1px solid #D0D4DC;
margin-top: -40px;
}
::v-deep .AiIcon {
width: 38px;
height: 38px;
}
.footer_btn {
width: 106px;
}
}
</style>

View File

@@ -0,0 +1,123 @@
<template>
<ai-list class="comment-list" isTabs>
<template slot="content">
<ai-search-bar>
<template slot="right">
<el-input
v-model="searchObj.title"
size="small"
placeholder="搜索内容/用户"
clearable
v-throttle="() => {page.current = 1, getList()}"
@clear="page.current = 1, searchObj.title = '', getList()"
suffix-icon="iconfont iconSearch" />
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
stripe
:total="total"
:current.sync="page.current"
:size.sync="page.size"
style="margin-top: 10px;"
@getList="getList">
<el-table-column slot="options" label="操作" fixed="right" width="120" align="center" >
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" title="删除" :disabled="!permissions('app_appnewscentercomment_del')" @click="handleDelete(row)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import moment from "dayjs"
export default {
name: "commentList",
props: {
instance: Function,
dict: Object,
permissions: Function,
areaId:String
},
data() {
return {
tableData:[],
total:0,
isClick: false,
page:{
current:1,
size:10
},
searchObj:{
title:'',
},
}
},
computed:{
colConfigs () {
return [
{prop: 'title', label: '评论对象',align:'left', width:180},
{prop: 'content', label: '评论内容',width:280},
{prop: 'name', label: '用户',align: "center"},
{prop: 'commentTime', label: '评论时间'},
{slot: 'options', label: '操作'}
]
},
},
methods: {
resetSearch() {
this.searchObj.title = "";
this.getList();
},
handleDelete({id}){
this.$confirm("是否删除?").then(()=>this.deleteComment(id));
},
/**
* 删除评论
*/
deleteComment(id){
this.instance.post(`/app/appnewscentercomment/delete?id=${id}`).then(res=>{
if(res.code==0){
this.$message.success("删除成功");
this.getList();
}
})
},
getList() {
this.instance.post(`/app/appnewscentercomment/list`, null, {
params: {
...this.page,
...this.searchObj,
areaId: this.areaId
}
}).then(res => {
if (res && res.data) {
this.tableData = res.data.records.map(e=>{
return{
...e,
commentTime:moment(e.commentTime).format("YYYY-MM-DD HH:mm")
}
});
this.total = res.data.total;
}
})
},
},
mounted(){
this.getList();
}
}
</script>
<style lang="scss" scoped>
.comment-list{
height: 100%;
overflow: auto;
background: #f3f6f9;
}
</style>

View File

@@ -0,0 +1,6 @@
export {default as newsList} from "./newsList";
export {default as commentList} from "./commentList";
export {default as addVideo} from "./addVideo";
export {default as addArticle} from "./addArticle";
export {default as newsDetail} from "./newsDetail";
export {default as videoDetail} from "./videoDetail";

View File

@@ -0,0 +1,143 @@
<template>
<ai-detail class="news-detail">
<template slot="title">
<ai-title title="新闻文章详情" isShowBack isShowBottomBorder @onBackClick="$emit('goBack')"></ai-title>
</template>
<template slot="content">
<ai-card titlePosition="center">
<template #title>
<h2>{{ detail.title }}</h2>
<p class="subTitle">类型{{ dict.getLabel('newsCenterPolicyType', +detail.policyType) }}</p>
</template>
<template slot="right">
<el-button type="text" size="small" icon="iconfont iconEdit" @click="handleEdit">修改</el-button>
</template>
<template #content>
<ai-article :value="detail.content"></ai-article>
</template>
</ai-card>
<ai-card title="封面信息">
<template #content>
<div class="content">
<div class="img">
<span>封面</span>
<img v-if="detail.coverFile" :src="detail.coverFile.url" alt="" v-viewer>
</div>
</div>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
import Viewer from 'v-viewer';
import Vue from 'vue';
Vue.use(Viewer);
export default {
name: "newsDetail",
props: {
instance: Function,
dict: Object,
},
data() {
return {
detail: {},
}
},
methods: {
/**
* 修改
* */
handleEdit() {
this.$emit("goPage", {key: "addArticle", row: this.detail});
},
/**
* 根据id查询详情
*/
getDetail() {
let {id} = this.$route.query
id && this.instance.post(`/app/appnewscenterinfo/queryDetailById`, null, {
params: {id}
}).then(res => {
if (res?.data) {
this.detail = res.data;
}
})
}
},
created() {
this.getDetail();
}
}
</script>
<style lang="scss" scoped>
.news-detail {
height: 100%;
overflow: auto;
::v-deep .ai-detail__content {
background: #F3F6F9 !important;
}
.content {
height: 100%;
width: 100%;
position: relative;
label {
display: flex;
align-items: center;
justify-content: center;
border-bottom: 1px solid #eee;
margin-bottom: 24px;
p {
font-size: 16px;
color: #333333;
line-height: 21px;
box-sizing: border-box;
padding-bottom: 24px;
text-align: center;
}
.iconfont {
font-size: 14px;
color: #5088FF;
line-height: 16px;
text-align: right;
position: absolute;
right: 16px;
top: 16px;
}
}
.title {
font-size: 16px;
color: #333333;
line-height: 21px;
border-bottom: 1px solid #eee;
padding-bottom: 24px;
margin-bottom: 17px;
}
.img {
display: flex;
span {
font-size: 14px;
color: #999999;
line-height: 19px;
}
img {
width: 319px;
height: 179px;
border-radius: 1px;
}
}
}
}
</style>

View File

@@ -0,0 +1,278 @@
<template>
<ai-list class="news-list" isTabs>
<template slot="content">
<ai-search-bar>
<template slot="left">
<ai-select
v-model="searchObj.type"
@change="page.current = 1, getList()"
placeholder="选择新闻类别"
:selectList="$dict.getDict('newsCenterType')">
</ai-select>
</template>
<template slot="right">
<el-input
v-model="searchObj.title"
size="small"
placeholder="搜索标题/发布地区"
clearable
v-throttle="() => {page.current = 1, getList()}"
@clear="page.current = 1, searchObj.title = '', getList()"
suffix-icon="iconfont iconSearch"/>
</template>
</ai-search-bar>
<ai-search-bar>
<template slot="left">
<el-dropdown @visible-change="v=>isClick=v" @command="addNews"
v-if="permissions('app_appnewscenterinfo_edit')">
<el-button type="primary" icon="iconfont iconAdd" size="small">发布新闻
<i class="el-icon--right" :class="dropIcon"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="video">发布视频</el-dropdown-item>
<el-dropdown-item command="article">发布文章</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
stripe
:current.sync="page.current"
:size.sync="page.size"
@getList="getList">
<el-table-column slot="title" label="标题" width="280" align="left" show-overflow-tooltip>
<template slot-scope="{ row }">
<span style="color: #2266FF;margin-right:40px;" v-if="row.isTop == 1">[置顶]</span>
<span>{{ row.title }}</span>
</template>
</el-table-column>
<el-table-column slot="options" label="操作" fixed="right" width="260" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" title="取消置顶" v-if="row.isTop==1" @click="setTop(row)">取消置顶</el-button>
<el-button type="text" title="置顶" v-else @click="setTop(row)">置顶</el-button>
<el-button type="text" title="取消发布" v-if="+row.status" @click="changeStatus(row)">取消发布</el-button>
<el-button type="text" v-else title="发布" @click="changeStatus(row)">发布</el-button>
<el-button type="text" title="查看" @click="hangeleDetail(row)"
:disabled="!permissions('app_appnewscenterinfo_detail')">查看
</el-button>
<el-button type="text" title="编辑" @click="handleEdit(row)"
:disabled="!permissions('app_appnewscenterinfo_edit')">编辑
</el-button>
<el-button type="text" title="删除" @click="handleDelete(row)"
:disabled="!permissions('app_appnewscenterinfo_del')">删除
</el-button>
<el-button type="text" title="分享" @click="handleCopyShare(row)">小程序链接</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import moment from "dayjs"
export default {
name: "newsList",
props: {
instance: Function,
dict: Object,
permissions: Function,
areaId: String
},
data() {
return {
tableData: [],
total: 0,
isClick: false,
page: {
current: 1,
size: 10
},
searchObj: {
title: '',
type: ''
},
}
},
computed: {
colConfigs() {
return [
{slot: 'title', label: '标题', width: 280},
{
prop: 'type', label: '类别', align: 'center',
render: (h, {row}) => {
return h('span', null, this.dict.getLabel('newsCenterType', +row.type))
}
},
{
prop: 'policyType', label: '类型', align: 'center',
render: (h, {row}) => {
return h('span', null, this.dict.getLabel('newsCenterPolicyType', +row.policyType))
}
},
{
prop: 'viewCount', label: '浏览/播放量', align: "center",
render: (h, {row}) => {
return h('span', null, row.viewCount >= 10000 ? ((row.viewCount / 10000).toFixed(2) + '万') : row.viewCount)
}
},
{prop: 'msgCount', label: '评论数', align: "center"},
{prop: 'areaName', label: '发布地区', align: 'center'},
{prop: 'createTime', label: '发布时间'},
{
prop: 'status', label: '发布状态', align: 'center',
render: (h, {row}) => {
return h('span', {
style: {
color: row.status ? this.$dict.getColor('newsCenterStatus', row.status) : 'auto'
}
}, this.$dict.getLabel('newsCenterStatus', row.status))
}
},
{slot: 'options', label: '操作'}
]
},
dropIcon() {
return this.isClick ? 'el-icon-arrow-up' : 'el-icon-arrow-down'
},
},
methods: {
/**
* 查看详情
* */
hangeleDetail(row) {
if (+row.type) {
this.$emit("goPage", {key: "videoDetail", row});
} else {
this.$emit("goPage", {key: "newsDetail", row});
}
},
/**
* 编辑
* */
handleEdit(row) {
if (+row.type) {
this.$emit("goPage", {key: "addVideo", row});
} else {
this.$emit("goPage", {key: "addArticle", row});
}
},
/**
* 修改新闻中心状态-发布、取消发布
* */
changeStatus(row) {
const msg = +row.status ? "是否取消发布" : "是否发布";
this.$confirm(msg).then(() => this.changeInfo(row));
},
/**
* 置顶新闻
* */
setTop(row) {
const msg = !row.topping ? "是否要置顶" : "是否要取消置顶"
this.$confirm(msg).then(() => this.setTopInfo(row));
},
/**
* 删除新闻
* */
handleDelete({id}) {
this.$confirm("是否要删除").then(() => this.deleteInfo(id));
},
resetSearch() {
this.searchObj.title = "";
this.searchObj.type = "";
this.getList();
},
/**
* 添加新闻、视频
* */
addNews(command) {
switch (command) {
case "video":
this.$emit('goPage', {key: "addVideo"});
break;
case "article":
this.$emit('goPage', {key: "addArticle"});
break;
}
},
/**
* 修改发布状态
* */
changeInfo({id, status}) {
const msg = +status ? "取消发布成功" : "发布成功";
status = +status ? 0 : 1;
this.instance.post(`/app/appnewscenterinfo/release?id=${id}&status=${status}`).then(() => {
this.$message.success(msg);
this.getList();
})
},
/**
* 置顶新闻
* */
setTopInfo(row) {
const msg = !row.topping ? "置顶成功" : "取消置顶成功";
this.instance.post(`/app/appnewscenterinfo/topping?id=${row.id}&areaId=${this.areaId}`).then(() => {
this.$message.success(msg);
this.getList();
})
},
/**
* 删除新闻
* @param id
*/
deleteInfo(id) {
this.instance.post(`/app/appnewscenterinfo/delete?ids=${id}`).then(() => {
this.$message.success("删除成功");
this.getList();
})
},
getList() {
this.instance.post(`/app/appnewscenterinfo/list`, null, {
params: {
...this.page,
...this.searchObj,
areaId: this.areaId
}
}).then(res => {
if (res && res.data) {
this.tableData = res.data.records.map(e => {
return {
...e,
createTime: +e.status ? moment(e.createTime).format("YYYY-MM-DD HH:mm") : ''
}
});
this.total = res.data.total;
}
})
},
handleCopyShare(row) {
navigator.clipboard.writeText(`/subPages/live/newsDetail?id=${row.id}`)
this.$message.success("小程序链接已复制!")
}
},
created() {
this.dict.load('newsCenterType', 'newsCenterStatus', 'newsCenterPolicyType').then(() => this.getList());
},
}
</script>
<style lang="scss" scoped>
.news-list {
height: 100%;
overflow: auto;
background: #f3f6f9;
::v-deep.has-gutter th:nth-child(1) div {
margin-left: 40px;
}
}
</style>

View File

@@ -0,0 +1,90 @@
<template>
<ai-detail class="video-detail">
<template slot="title">
<ai-title title="视频新闻详情" isShowBack isShowBottomBorder @onBackClick="$emit('goBack')"/>
</template>
<template slot="content">
<ai-card title="视频信息">
<template slot="right">
<el-button type="text" icon="iconfont iconEdit" @click="handleEdit">修改</el-button>
</template>
<template #content>
<ai-wrapper
:columnsNumber="1">
<ai-info-item label="标题:" :value="detail.title"></ai-info-item>
<ai-info-item label="类型:"
:value="dict.getLabel('newsCenterPolicyType', + detail.policyType)"></ai-info-item>
<ai-info-item label="视频:" isLine>
<video :src="detail.videoFile && detail.videoFile.url"
style="width: 100%; height:100%; object-fit: fill;" muted controls="controls"></video>
</ai-info-item>
<ai-info-item label="封面:" isLine v-viewer>
<img :src="detail.videoFile && detail.coverFile.url" alt="">
</ai-info-item>
</ai-wrapper>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
import Viewer from 'v-viewer';
export default {
name: "videoDetail",
components: {Viewer},
props: {
instance: Function,
dict: Object,
},
data() {
return {
detail: {}
}
},
methods: {
handleEdit() {
this.$emit("goPage", {key: "addVideo", row: this.detail});
},
/**
* 根据id查询详情
*/
getDetail() {
let {id} = this.$route.query
this.instance.post(`/app/appnewscenterinfo/queryDetailById`, null, {
params: {id}
}).then(res => {
if (res?.data) {
this.detail = res.data;
}
})
}
},
created() {
this.getDetail();
}
}
</script>
<style lang="scss" scoped>
.video-detail {
height: 100%;
overflow: hidden;
video {
width: 640px;
height: 360px;
background: rgba(0, 0, 0, 0.5);
border-radius: 2px;
border: 1px solid #D0D4DC;
}
img {
width: 319px;
height: 179px;
border-radius: 1px;
}
}
</style>

View File

@@ -0,0 +1,235 @@
<template>
<section class="Add">
<ai-detail>
<ai-title slot="title" :title="addTitle" isShowBottomBorder isShowBack @onBackClick="back"/>
<template #content>
<el-form :model="form" ref="ruleForm" :rules="rules" label-width="130px" label-position="right" size="small">
<ai-card title="基本信息">
<template #content>
<el-form-item label="标题" prop="title">
<el-input v-model="form.title" placeholder="请输入标题" :maxlength="50" show-word-limit/>
</el-form-item>
<el-form-item label="发布地区" prop="areaId">
<ai-area-get :instance="instance" v-model="form.areaId" :root="rootArea" />
</el-form-item>
<el-form-item label="文章类型" prop="moduleId" style="width:50%;" v-if="miniTypeList.length">
<ai-select v-model="form.moduleId" :selectList="miniTypeList" @change="getNewTypeList"/>
</el-form-item>
<el-form-item label="分类" prop="categoryId" style="width:50%;">
<ai-select v-model="form.categoryId" :selectList="newTypeList"/>
</el-form-item>
<el-form-item label="正文" prop="content" style="width: 100%;">
<ai-editor v-model="form.content" :instance="instance"/>
</el-form-item>
<el-form-item label="封面图片" >
<ai-uploader
:isShowTip="true"
:instance="instance"
v-model="form.pictureUrlList"
fileType="img"
acceptType=".png,.jpg,.jpeg"
:limit="1">
<template slot="tips">最多上传1张图片,单张图片最大10MB<br/>支持.png,.jpg,.jpeg格式</template>
</ai-uploader>
</el-form-item>
<el-form-item label="附件附件" prop="files">
<el-upload
class="upload-demo"
action
multiple
accept=".zip,.rar,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.txt,.jpg,.png"
:http-request="uploadFile"
:on-exceed="()=>$message.error('最多只能上传9个附件!')"
:on-remove="handleRemove"
:on-change="handleChange"
:limit="9"
:file-list="form.files">
<el-button size="mini"> 添加附件</el-button>
<div slot="tip" class="el-upload__tip">
<p style="line-height: 0;">最多上传9个附件,单个文件最大10MB </p>
<p style="line-height: 40px;">
支持.zip.rar.doc.docx.xls.xlsx.ppt.pptx.pdf.txt.jpg.png格式</p>
</div>
</el-upload>
</el-form-item>
</template>
</ai-card>
</el-form>
</template>
<template #footer>
<el-button @click="back">取消</el-button>
<el-button type="primary" @click="submit">提交</el-button>
</template>
</ai-detail>
</section>
</template>
<script>
import {mapState} from "vuex";
export default {
name: "Add",
props: {
instance: Function,
dict: Object,
permissions: Function
},
computed: {
...mapState(['user']),
isEdit() {
return !!this.$route.query.id
},
addTitle() {
return this.isEdit ? "编辑新闻发布" : "添加新闻发布"
},
rules() {
return {
title: [{required: true, message: "请输入标题"}],
areaId: [
{message: "请选择发布地区", required: true, trigger: "blur"},
{validator: (r, v, cb) => v && /0{3}$/g.test(v) ? cb('发布地区必须选到村级') : cb(), trigger: "blur"}
],
moduleId: [{required: true, message: "请选择文章类型"}],
categoryId: [{required: true, message: "选择分类"}],
content: [{required: true, message: "请输入正文"}],
}
},
rootArea() {
return this.user.info?.areaId?.replace(/(\d{6})\d+/g, '$1' + Array(7).join("0")) || ""
}
},
data() {
return {
form: {
pictureUrlList: [],
pictureUrl: '',
files: []
},
miniTypeList: [],
newTypeList: [],
}
},
methods: {
// 上传附件
uploadFile: function (file) {
const isLt10M = file.file.size / 1024 / 1024 < 10;
if (!isLt10M) {
this.$message.error("附件大小不超过10mb!");
for (let i = 0; i < this.form.files.length; i++) {
if (this.form.files[i].uid == file.file.uid) {
this.form.files.splice(i, 1);
}
}
return;
}
let formData = new FormData();
formData.append("file", file.file);
this.instance.post(`/admin/file/add`, formData, {withCredentials: false}).then(res => {
if (res && res.code == 0) {
let img = res.data[0].split(';');
this.form.files.forEach((item, index) => {
if (item.uid == file.file.uid) {
this.form.files[index].id = img[1];
}
})
}
});
},
handleRemove(file, fileList) {
this.form.files = fileList;
},
handleChange(file, fileList) {
this.form.files = fileList;
},
back() {
this.$router.push({})
},
submit() {
this.$refs.ruleForm.validate(v => {
if (v) {
if(this.form.pictureUrlList && this.form.pictureUrlList.length) {
this.form.pictureUrl = this.form.pictureUrlList[0].url
}
this.instance.post(`/app/apppublicityinfo/addOrUpdate`, this.form).then(res => {
if (res.code == 0) {
this.$message.success('提交成功!');
this.back()
}
})
}
})
},
getDetail() {
let {id} = this.$route.query
id && this.instance.post("/app/apppublicityinfo/queryDetailById", null, {
params: {id}
}).then(res => {
if (res?.data) {
res.data.pictureUrlList = []
if(res.data.pictureUrl) {
res.data.pictureUrlList = [{url: res.data.pictureUrl}]
}
this.form = {...res.data}
this.getNewTypeList()
}
})
},
getTypeList() {
let {parentId} = this.$route.query
this.instance.post(`/app/apppublicitycategory/list?categoryType=1&size=100&parentId=${parentId}`).then(res => {
if (res.code == 0) {
this.miniTypeList = res.data.records.map((item) => {
return {
dictName: item.categoryName,
dictValue: item.id
}
})
console.log(this.miniTypeList)
if(this.$route.query.id) {
this.getDetail()
}
}
})
},
getNewTypeList() {
this.instance.post(`/app/apppublicitycategory/list?categoryType=2&size=100&parentId=${this.form.moduleId}`).then(res => {
if (res.code == 0) {
res.data.records
this.newTypeList = res.data.records.map((item) => {
return {
dictName: item.categoryName,
dictValue: item.id
}
})
}
})
},
},
created() {
this.getTypeList()
}
}
</script>
<style lang="scss" scoped>
.Add {
height: 100%;
.half {
align-items: flex-start;
& > .el-form-item, & > div {
width: 50%;
.el-form-item {
width: 100%;
}
}
}
.el-date-editor {
width: 100%;
}
}
</style>

View File

@@ -0,0 +1,40 @@
<template>
<section class="AppPublicizeInformation">
<keep-alive :include="['List']">
<component :is="currentComponent" :instance="instance" :dict="dict" :permissions="permissions"/>
</keep-alive>
</section>
</template>
<script>
import Add from "./Add";
import List from "./List";
export default {
name: "AppPublicizeInformation",
components: {List, Add},
label: "宣传资讯",
props: {
instance: Function,
dict: Object,
permissions: Function
},
computed: {
currentComponent() {
return this.$route.hash == "#add" ? Add : List
}
},
created() {
this.dict.load("sex", "fpNation", "fpPrtpStatus", "fpHealth", "fpStudentsInSchool", 'fpYesOrNo', "fpRelationship", "yesOrNo", "fpLaborSkills",
"fpEducation", "fpType", "fpPoliticalOutlook", "fpPublicWelfarePostAssistance","fpHealthAssistance","fpFnancialAssistance","fpEmploymentAssistance",
"fpEducationalAssistance","fpIndustrialAssistance","fpSocialAssistance")
}
}
</script>
<style lang="scss" scoped>
.AppPublicizeInformation {
height: 100%;
}
</style>

View File

@@ -0,0 +1,359 @@
<template>
<section class="List">
<ai-list>
<ai-title slot="title" title="宣传资讯" isShowBottomBorder isShowArea v-model="search.areaId" :instance="instance"
@change="page.current=1,getTableData()">
</ai-title>
<template #content>
<div class="flex fill">
<div class="type">
<div class="title">宣传板块
<span>
<el-button type="text" @click="addType(0, typeList.length+1, '')">添加</el-button></span>
</div>
<div class="list">
<div class="item" v-for="(item, index) in typeList" :key="index"
:class="typeIndex == index ? 'active' : ''" @click="typeClick(index)">
{{ item.categoryName }}
</div>
<div class="item" v-if="!typeList.length">暂无数据</div>
</div>
</div>
<div class="type mini-type">
<div class="title">模块名称<span><el-button type="text"
@click="addType(1, miniTypeList.length+1, typeList[typeIndex].id)">添加</el-button></span>
</div>
<div class="list">
<div class="item" v-for="(item, index) in miniTypeList" :key="index"
:class="miniTypeIndex == index ? 'active' : ''" @click="miniTypeClick(index)">
<span class="text">{{ item.categoryName }}</span>
<span class="icon">
<i class="el-icon-circle-plus-outline" @click="addNewType(index)"></i>
<i class="el-icon-edit" @click="editMini(index)"></i>
<i class="el-icon-delete" @click="delMini(miniTypeList[index].id)"></i>
</span>
</div>
<div class="item" v-if="!miniTypeList.length">暂无数据</div>
</div>
</div>
<div class="content">
<template v-if="typeList.length && miniTypeList.length">
<ai-search-bar>
<template #left>
<el-button type="primary" icon="iconfont iconAdd" @click="showEdit('')">添加</el-button>
<!-- <el-button icon="iconfont iconDelete" :disabled="!ids.length" @click="handleDelete(ids)">删除</el-button> -->
</template>
<template #right>
<el-input size="small" placeholder="请输入标题" v-model="search.title" clearable
@change="page.current=1,getTableData()"/>
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :total="page.total" :current.sync="page.current" :size.sync="page.size"
@getList="getTableData" :col-configs="colConfigs" :dict="dict"
@selection-change="v=>ids=v.map(e=>e.id)">
<el-table-column slot="options" label="操作" fixed="right" align="center" width='150px'>
<template slot-scope="{row}">
<el-button type="text" @click="showEdit(row.id)">编辑</el-button>
<el-button type="text" @click="handleDelete(row.id)">删除</el-button>
</template>
</el-table-column>
</ai-table>
</template>
<ai-empty v-else>请选择或者添加模块</ai-empty>
</div>
</div>
</template>
</ai-list>
<ai-dialog :visible.sync="dialog" :title="dialogTitle" @closed="form={}" @onConfirm="submitDialog" width="600px">
<el-form :model="form" :rules="rules" ref="DialogForm" size="small" label-width="100px">
<el-form-item :label="addLabelText" prop="categoryName">
<el-input v-model.number="form.categoryName" placeholder="请输入" maxlength="10" show-word-limit/>
</el-form-item>
<el-form-item label="排序" prop="showIndex" v-if="type != 2">
<el-input-number v-model="form.showIndex" @change="handleChange" :min="1" :max="100"></el-input-number>
</el-form-item>
</el-form>
<ai-table :tableData="newTypeList" :total="newPage.total" :current.sync="newPage.current"
:size.sync="newPage.size"
:col-configs="colConfigsNew" v-if="type == 2">
<el-table-column slot="options" label="操作" fixed="right" align="center">
<template slot-scope="{row}">
<el-button type="text" @click="editNew(row)">编辑</el-button>
<el-button type="text" @click="delMini(row.id)">删除</el-button>
</template>
</el-table-column>
</ai-table>
</ai-dialog>
</section>
</template>
<script>
import {mapState} from "vuex";
export default {
name: "List",
props: {
instance: Function,
dict: Object,
permissions: Function
},
computed: {
...mapState(['user'])
},
data() {
return {
search: {title: ""},
page: {current: 1, size: 10, total: 0},
newPage: {current: 1, size: 10, total: 0},
tableData: [],
colConfigs: [
{label: "标题", prop: "title"},
{label: "地区", prop: "areaName", align: "center", width: '150px'},
{label: "浏览次数", prop: "viewCount", align: "center", width: '100px'},
{label: "发布人", prop: "createUserName", align: "center", width: '100px'},
{label: "发布时间", prop: "createTime", align: "center", width: '100px'},
{slot: "options"}
],
colConfigsNew: [
{label: "分类名称", prop: "categoryName", align: "center"},
{slot: "options"}
],
ids: [],
dialog: false,
form: {},
rules: {
categoryName: '',
showIndex: [{required: true, message: "请输入排序", trigger: "change"}],
},
typeList: [], //大分类模块
miniTypeList: [], //模块子
newTypeList: [], //文章分类
type: 0, //0、宣传板块1、宣传模块2、文章分类
dialogTitle: '',
addLabelText: '',
parentId: '',
typeIndex: 0,
miniTypeIndex: 0
}
},
methods: {
getTableData() {
this.instance.post("/app/apppublicityinfo/list", null, {
params: {...this.page, ...this.search, moduleId: this.miniTypeList[this.miniTypeIndex].id || ''}
}).then(res => {
if (res?.data) {
this.tableData = res.data?.records
this.page.total = res.data.total
}
})
},
showEdit(id) {
this.$router.push({
query: {
id: id,
parentId: this.typeList[this.typeIndex].id,
moduleId: this.miniTypeList[this.miniTypeIndex].id
}, hash: "#add"
})
},
handleDelete(ids) {
this.$confirm("是否删除该条宣传资讯信息").then(() => {
this.instance.post("/app/apppublicityinfo/delete", null, {
params: {ids: ids?.toString()}
}).then(res => {
if (res?.code == 0) {
this.$message.success("删除成功!")
this.getTableData()
}
})
}).catch(() => 0)
},
handleChange(value) {
this.form.showIndex = value
},
submitDialog() {
this.$refs.DialogForm.validate(v => {
if (v) {
this.form.categoryType = this.type
this.form.parentId = this.parentId
this.instance.post(`/app/apppublicitycategory/addPublicityCategory`, this.form).then(res => {
if (res.code == 0) {
this.$message.success('添加成功');
if (this.type == 0) {
this.getTypeList()
}
if (this.type == 1) {
this.getMiniTypeList(this.typeList[this.typeIndex].id)
}
this.dialog = false
}
})
}
})
},
addType(e, index, parentId) {
this.type = e
this.parentId = parentId
this.form.showIndex = index
this.dialogTitle = ['宣传板块', '宣传模块', '文章分类'][e]
this.addLabelText = ['板块名称', '模块名称', '分类名称'][e]
this.rules.categoryName = [{required: true, message: "请输入" + this.addLabelText, trigger: "change"}]
this.dialog = true
},
getTypeList() {
this.instance.post(`/app/apppublicitycategory/list?categoryType=0&size=100`).then(res => {
if (res.code == 0 && res.data.records && res.data.records.length) {
this.typeList = res.data.records
this.getMiniTypeList(res.data.records[0].id)
}
})
},
getMiniTypeList(parentId) {
this.instance.post(`/app/apppublicitycategory/list?categoryType=1&size=100&parentId=${parentId}`).then(res => {
if (res.code == 0) {
this.miniTypeList = res.data.records
if (res.data.records && res.data.records.length) {
this.miniTypeClick(0)
}
}
})
},
getNewTypeList(parentId) {
this.instance.post(`/app/apppublicitycategory/list?categoryType=2&size=10&parentId=${parentId}`).then(res => {
if (res.code == 0) {
this.newTypeList = res.data.records
this.newPage.total = res.data.total
}
})
},
typeClick(e) {
this.typeIndex = e
this.getMiniTypeList(this.typeList[e].id)
},
miniTypeClick(e) {
this.miniTypeIndex = e
this.current = 1
this.tableData = []
this.getTableData()
},
editMini(index) {
this.form = {...this.miniTypeList[index]}
this.addType(this.miniTypeList[index].categoryType, this.miniTypeList[index].showIndex, this.typeList[this.typeIndex].id)
},
delMini(id) {
this.$confirm("确认删除", {
type: 'error'
}).then(() => {
this.instance.post(`/app/apppublicitycategory/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.getNewTypeList(this.miniTypeList[this.miniTypeIndex].id)
this.getMiniTypeList(this.typeList[this.typeIndex].id)
this.$message.success('删除成功');
}
}).catch((err) => {
this.$message.error(err);
})
})
},
addNewType(index) {
this.getNewTypeList(this.miniTypeList[index].id)
this.addType(2, '', this.miniTypeList[index].id)
},
editNew(row) {
this.form = {...row}
this.addType(2, '', row.parentId)
}
},
created() {
this.search.areaId = this.user.info.areaId
this.getTypeList()
this.getTableData()
}
}
</script>
<style lang="scss" scoped>
.List {
height: 100%;
.flex {
display: flex;
.type {
width: 250px;
border: 1px solid #ddd;
box-sizing: border-box;
.title {
font-size: 16px;
line-height: 40px;
border-bottom: 1px solid #ddd;
padding: 0 16px;
font-weight: 600;
span {
color: #26f;
font-size: 12px;
font-weight: 400;
float: right;
}
}
.list {
.item {
padding: 0 16px;
display: flex;
justify-content: space-between;
line-height: 32px;
font-size: 14px;
color: #333;
box-sizing: border-box;
.text {
width: calc(100% - 70px);
cursor: pointer;
}
.icon {
width: 70px;
text-align: right;
i {
font-size: 14px;
cursor: pointer;
margin-left: 8px;
}
.el-icon-delete {
color: #f46;
}
.el-icon-circle-plus-outline {
color: #26f;
}
}
}
.active {
// color: #26f;
background-color: #f3f6f9;
}
}
}
.mini-type {
margin-right: 16px;
}
.content {
width: calc(100% - 516px);
}
}
::v-deep .ai-list__content--right-wrapper {
min-height: calc(100% - 6px) !important;
display: flex;
}
}
</style>

View File

@@ -0,0 +1,365 @@
<template>
<ai-list class="AppRuralTourism" v-if="!addShowType">
<template #title>
<ai-title title="乡村旅游" :isShowBottomBorder="false" :instance="instance" :isShowArea="true" v-model="areaId" @change="changeArea"></ai-title>
</template>
<template #tabs>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane v-for="(item, index) in paneList" :key="index" :label="item.label" :name="item.name" lazy>
<ruralList
ref="ruralListref"
v-if="activeName"
:instance="instance"
:dict="dict"
@goto="goto"
:type="type"
@showAddRoral="showAddRoral"
:activeName="activeName"
@showEditRoral="showEditRoral" />
</el-tab-pane>
</el-tabs>
</template>
</ai-list>
<addRural
v-else-if="addShowType == 'addRural'"
:instance="instance"
:dict="dict"
:detailId="detailId"
:detailTitle="detailTitle"
:isEdit="isEdit"
:areaId="areaId"
:type="type"
:disabledLevel="disabledLevel"
@goto="goto">
</addRural>
<addProducts
v-else-if="addShowType == 'addProduct'"
:instance="instance"
:dict="dict"
:detailId="detailId"
:detailTitle="detailTitle"
:isEdit="isEdit"
:areaId="areaId"
:disabledLevel="disabledLevel"
@goto="goto">
</addProducts>
</template>
<script>
import {mapState} from 'vuex'
import ruralList from './components/ruralList'
import addRural from './components/addRural'
import addProducts from './components/addProducts'
export default {
name: 'AppRuralTourism',
label: "乡村旅游",
props: {
instance: Function,
dict: Object,
permissions: Function,
openim: Function
},
components: {
ruralList,
addRural,
addProducts
},
provide() {
return {
home: this
}
},
data() {
return {
activeName: 'ruralAddress',
paneList: [
{
label: '地区简介',
name: 'ruralAddress',
type: '0'
},
{
label: '特色农产品',
name: 'ruralProdect',
type: '3'
},
{
label: '旅游故事',
name: 'ruralStory',
type: '1'
},
{
label: '旅游服务',
name: 'ruralWork',
type: '2'
}
],
areaId: '',
addShowType: '', //新增 addRural其他 addProduce //新增农产品
detailTitle: '地区简介', //详情标题
isEdit: false, //详情编辑或查看
detailId: '', //详情内容id
areaType: '',
type: '0', //新增类型
disabledLevel: 0, //新增页面地区冻结层数
};
},
computed: {
...mapState(['user'])
},
methods: {
changeArea() {
let activeName = this.activeName
this.activeName = ''
this.$nextTick(() => {
this.activeName = activeName
});
this.instance.post(`admin/area/queryAreaFullNameByList?ids=` + this.areaId).then(res => {
if (this.areaId) {
this.disabledLevel = res.data[this.areaId].length
console.log(this.disabledLevel)
}
})
},
openIM() {
if (this.openim) this.openim();
},
handleClick(tab) {
this.detailTitle = this.paneList[tab.index].label
this.type = this.paneList[tab.index].type
this.activeName = ''
this.$nextTick(() => {
this.activeName = tab.name;
});
},
goto() {
this.addShowType = ''
this.isEdit = false
},
showAddRoral() {
this.detailId = ''
this.isAddType()
},
showEditRoral(item) {
console.log(item)
this.detailId = item.id
this.isEdit = true
this.isAddType()
},
isAddType() {
if (this.activeName == 'ruralProdect') {
this.addShowType = 'addProduct'
} else {
this.addShowType = 'addRural'
}
}
},
created() {
this.areaId = this.user.info.areaId;
this.areaType = this.user.info.areaMap[this.user.info.areaId].length;
this.disabledLevel = this.areaType
}
}
</script>
<style lang="scss" scoped>
.AppPatientFiles {
height: 100%;
background: #f3f6f9;
.application-header {
width: 100%;
background-color: #fff;
// border-bottom: 1px solid #D8DCE3;
padding: 0 16px;
box-sizing: border-box;
.el-row {
height: 100%;
.el-col {
height: 100%;
line-height: 48px;
text-align: left;
.left-img {
width: 16px;
height: 16px;
margin-right: 8px;
font-size: 16px;
color: #333;
// vertical-align: text-top;
}
.search {
float: right;
.el-input {
width: 280px;
height: 32px;
border-radius: 0 !important;
}
button {
width: 40px;
}
}
}
}
}
.table-content {
width: 100%;
.table-list {
width: 100%;
height: 636px;
background-color: #fff;
padding: 12px 16px 0;
box-sizing: border-box;
position: relative;
.table-title {
padding-bottom: 8px;
border-bottom: 1px solid #eee;
.el-select {
width: 160px;
height: 32px;
background-color: #fff;
margin-right: 8px;
}
.input-title {
display: inline-block;
width: 72px;
height: 32px;
background: rgba(245, 245, 245, 1);
font-size: 14px;
color: #666;
border: 1px solid rgba(208, 212, 220, 1);
box-sizing: border-box;
line-height: 30px;
text-align: center;
border-right: 0;
}
.el-date-editor {
margin-right: 8px;
}
.down {
width: 100%;
padding-top: 12px;
.down-line {
display: inline-block;
width: 534px;
height: 24px;
border-top: 1px solid #eee;
}
.down-content {
display: inline-block;
width: 108px;
height: 24px;
line-height: 24px;
border-radius: 0 0 8px 8px;
border: 1px solid #eee;
border-top: 0;
box-sizing: border-box;
color: #333;
font-size: 12px;
vertical-align: top;
text-align: center;
transition: all 0.3s ease-in-out;
i {
transition: all 0.3s ease-in-out;
}
.icon-down {
transform: rotate(90deg);
}
.icon-top {
transform: rotate(270deg);
}
}
}
.complete-date {
margin-top: 12px;
}
}
.el-table {
width: 100%;
box-sizing: border-box;
.item-status {
display: inline-block;
width: 40px;
height: 20px;
line-height: 20px;
text-align: center;
font-size: 12px;
margin: 0 12px 8px 16px;
}
.status-red {
background-color: #ffecef;
color: #ff4466;
}
.status-org {
background-color: #fff3e8;
color: #ff8822;
}
.status-blue {
background-color: #eff6ff;
color: #2266ff;
}
}
.pagination {
position: absolute;
bottom: 32px;
left: 0;
width: 100%;
text-align: center;
}
.el-table::before {
height: 0;
}
}
}
table {
width: 100%;
}
}
</style>
<style lang="scss" scoped>
.AppRuralTourism {
.el-tabs__item {
height: 32px;
line-height: 32px;
font-size: 14px;
background-color: #f5f5f5;
color: #666666;
box-sizing: border-box;
border-bottom: solid 1px #d0d4dc !important;
}
.el-tabs__item.is-active {
color: #5088ff;
background-color: #fff;
border-bottom: solid 1px transparent !important;
}
}
</style>

View File

@@ -0,0 +1,202 @@
<template>
<ai-detail class="add-products">
<template #title>
<ai-title title="特色农产品" isShowBack :isShowBottomBorder="true" @onBackClick="$emit('goto')"></ai-title>
</template>
<template #content>
<ai-card title="基本信息">
<template #content>
<el-form :model="ruleForm" label-width="120px" ref="ruleForm" :rules="rules" style="padding-top:16px;">
<el-form-item label="产品名称" prop="title">
<el-input size="small" v-model="ruleForm.title" clearable placeholder="请输入..." style="width: 240px;" maxLength="100"></el-input>
</el-form-item>
<el-form-item label="经营单位" prop="businessUnit">
<el-input size="small" v-model="ruleForm.businessUnit" clearable placeholder="请输入..." style="width: 240px;" maxLength="50"></el-input>
</el-form-item>
<el-form-item label="联系人" prop="contactPerson">
<el-input size="small" v-model="ruleForm.contactPerson" clearable placeholder="请输入..." style="width: 240px;" maxLength="50"></el-input>
</el-form-item>
<el-form-item label="联系方式" prop="contactPhone">
<el-input size="small" v-model="ruleForm.contactPhone" clearable placeholder="请输入..." style="width: 240px;" maxLength="11"></el-input>
</el-form-item>
<el-form-item label="地址" prop="address">
<el-input size="small" v-model="ruleForm.address" clearable placeholder="请输入..." style="width: 240px;" maxLength="20"></el-input>
</el-form-item>
<el-form-item label="文字介绍" prop="content">
<el-input
type="textarea"
:rows="2"
placeholder="请输入内容"
maxLength="200"
v-model="ruleForm.content">
</el-input>
</el-form-item>
<el-form-item prop="areaId" label="发布地区">
<ai-area-select clearable always-show :instance="instance"
v-model="ruleForm.areaId"
:disabled-level="disabledLevel">
</ai-area-select>
</el-form-item>
<el-form-item label="图片介绍">
<span class="upload-more" style="left:-70px">(最多5张)</span>
<ai-uploader :instance="instance" v-model="ruleForm.photo" :limit="5"></ai-uploader>
<!-- <el-upload
class="upload-demo upload-list-mini"
ref="upload"
multiple
action
list-type="picture-card"
:file-list="fileList"
:limit="5"
:disabled="fileList.length === 5"
:http-request="uploadFile"
:on-remove="handleRemove"
:on-change="handleChange"
accept=".jpeg,.jpg,.png">
<div class="upload-img-small mar-t16">
<span class="iconfont iconPhoto iconPhoto2"></span>
<div class="upload-text">上传照片</div>
</div>
</el-upload> -->
</el-form-item>
</el-form>
</template>
</ai-card>
</template>
<template #footer>
<template class="bottom-bar" v-if="!isEdit">
<el-button size="small" style="width: 92px;" @click="$emit('goto')">取消</el-button>
<el-button type="primary" size="small" style="width: 92px;" @click="confirm('ruleForm', '0')">保存</el-button>
<el-button type="primary" size="small" style="width: 92px;" @click="confirm('ruleForm', '1')">保存并发布</el-button>
</template>
<template class="bottom-bar" v-if="isEdit && ruleForm.status != '1'">
<el-button size="small" style="width: 92px;" @click="$emit('goto')">取消</el-button>
<el-button type="primary" size="small" style="width: 92px;" @click="confirm('ruleForm', '0')">修改</el-button>
<el-button type="primary" size="small" style="width: 92px;" @click="confirm('ruleForm', '1')">修改并发布</el-button>
</template>
<template class="bottom-bar" v-if="isEdit && ruleForm.status == '1'">
<el-button size="small" style="width: 92px;" @click="$emit('goto')">取消</el-button>
<el-button type="primary" size="small" style="width: 92px;" @click="confirm('ruleForm', '1')">修改</el-button>
</template>
</template>
</ai-detail>
</template>
<script>
import { mapState } from 'vuex';
export default {
name: 'add-products',
props: {
instance: Function,
dict: Object,
permissions: Function,
detailTitle: String,
isEdit: Boolean,
areaId: String,
detailId: String,
disabledLevel: Number
},
data() {
var transferInAreaIdPass = (rule, value, callback) => {
this.instance.post(`admin/area/queryAreaFullNameByList?ids=` + value).then(res => {
if (value) {
let list = res.data[value]
if (list.length < 5) {
callback(new Error('发布地区需选到村级'));
} else {
callback();
}
}
})
}
return {
ruleForm: {
type: '3',
title: '',
content: '',
areaId: '',
createUnitName: '',
createUserName: '',
status: '',
businessUnit: '',
contactPerson: '',
contactPhone: '',
photo: [],
address: '',
},
rules: {
title: [
{required: true, message: '请输入产品名称', trigger: 'change'}
],
businessUnit: [
{required: true, message: '请输入经营单位', trigger: 'change'}
],
contactPerson: [
{required: true, message: '请输入联系人', trigger: 'change'}
],
contactPhone: [
{required: true, message: '请输入联系方式', trigger: 'change'}
],
address: [
{required: true, message: '请输入地址', trigger: 'change'}
],
content: [
{required: true, message: '请输入文字介绍', trigger: 'change'}
],
areaId: [
// {required: true, validator: transferInAreaIdPass, trigger: 'blur'}
{required: true, message: '请选择发布地区', trigger: 'change'}
],
},
fileList: []
};
},
methods: {
cancel() {
this.$emit('goto');
},
confirm(formName, status) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.ruleForm.status = status
this.confirmAjax();
} else {
return false;
}
});
},
confirmAjax() {
this.instance.post('/app/appcountrysidetourism/addOrUpdate', {
...this.ruleForm,
photo: JSON.stringify(this.ruleForm.photo)
}).then(res => {
if (res && res.code == 0) {
this.detailId ? this.$message.success('编辑成功') : this.$message.success('添加成功');
this.cancel();
}
});
},
getDetail() {
this.instance.post(`/app/appcountrysidetourism/queryDetailById?id=${this.detailId}`).then(res => {
if (res && res.code == 0) {
this.ruleForm = {...res.data}
this.ruleForm.photo = JSON.parse(this.ruleForm.photo)
}
});
}
},
mounted() {
if (this.detailId) { //编辑
this.getDetail()
} else { //新增
this.ruleForm.areaId = this.areaId
this.ruleForm.createUnitName = this.user.info.unitName
this.ruleForm.createUserName = this.user.info.name
}
},
computed: {
...mapState(['user'])
},
};
</script>

View File

@@ -0,0 +1,374 @@
<template>
<ai-detail class="addRural">
<template slot="title">
<ai-title :title="detailTitle" isShowBack :isShowBottomBorder="true" @onBackClick="$emit('goto')"></ai-title>
</template>
<template #content>
<ai-card title="基本信息">
<template #content>
<el-form :model="ruleForm" label-width="120px" ref="ruleForm" :rules="rules" style="padding-top:16px;">
<el-form-item label="标题" prop="title">
<el-input type="textarea" :rows="2" v-model="ruleForm.title" clearable placeholder="请输入..." maxlength="30"
show-word-limit></el-input>
</el-form-item>
<el-form-item prop="areaId" label="发布地区">
<ai-area-select clearable always-show :instance="instance"
v-model="ruleForm.areaId"
:disabled-level="disabledLevel">
</ai-area-select>
</el-form-item>
<el-form-item label="正文" prop="content">
<!-- <vue-ueditor-wrap v-model="ruleForm.content" :config="$ueditor_config" maxLength="3000"></vue-ueditor-wrap> -->
<ai-editor v-model="ruleForm.content" :instance="instance"/>
</el-form-item>
<el-form-item label="缩略图" prop="thumbUrl">
<ai-uploader
:instance="instance"
isShowTip
v-model="ruleForm.thumbUrl"
:limit="1"
:cropOps="cropOps"
is-crop>
<template slot="tips">
<p>最多上传1张图片,单个文件最大10MB支持jpgjpegpng格式</p>
<p>图片比例1.61</p>
</template>
</ai-uploader>
</el-form-item>
<el-form-item label="图片信息" v-if="detailTitle == '旅游服务'">
<span class="upload-more" style="left:-70px">(最多9张)</span>
<ai-uploader
:instance="instance"
v-model="fileList"
:limit="9">
</ai-uploader>
</el-form-item>
</el-form>
</template>
</ai-card>
</template>
<template #footer>
<template v-if="!isEdit">
<el-button size="small" style="width: 92px;" @click="$emit('goto')">取消</el-button>
<el-button type="primary" size="small" style="width: 92px;" @click="confirm('ruleForm', '0')">保存</el-button>
<el-button type="primary" size="small" style="width: 92px;" @click="confirm('ruleForm', '1')">保存并发布</el-button>
</template>
<template v-if="isEdit && ruleForm.status != '1'">
<el-button size="small" style="width: 92px;" @click="$emit('goto')">取消</el-button>
<el-button type="primary" size="small" style="width: 92px;" @click="confirm('ruleForm', '0')">修改</el-button>
<el-button type="primary" size="small" style="width: 92px;" @click="confirm('ruleForm', '1')">修改并发布</el-button>
</template>
<template v-if="isEdit && ruleForm.status == '1'">
<el-button size="small" style="width: 92px;" @click="$emit('goto')">取消</el-button>
<el-button type="primary" size="small" style="width: 92px;" @click="confirm('ruleForm', '1')">修改</el-button>
</template>
</template>
</ai-detail>
<!-- <div class="addRural detail-content details-page no-content-border">
<el-row type="flex" style="position: relative;height: calc(100% - 112px);">
<div class="right-content">
<div :style=" isEdit ? 'width: 790px;margin: 0 auto;position:relative;' : 'width: 790px;margin: 0 auto;position:relative;padding-bottom: 80px;' ">
<el-form :model="ruleForm" label-width="120px" ref="ruleForm" :rules="rules" style="padding-top:16px;">
<el-form-item label="标题" prop="title">
<el-input size="small" v-model="ruleForm.title" clearable placeholder="请输入..." style="width: 240px;" maxLength="20"></el-input>
</el-form-item>
<el-form-item prop="areaId" label="发布地区">
<ai-area-select clearable always-show :instance="instance"
v-model="ruleForm.areaId"
:disabled-level="disabledLevel">
</ai-area-select>
</el-form-item>
<el-form-item label="正文" prop="content">
<ai-editor v-model="ruleForm.content" :instance="instance" />
</el-form-item>
<el-form-item label="缩略图" prop="thumbUrl">
<ai-uploader
:instance="instance"
v-model="ruleForm.thumbUrl"
:limit="1"
:cropOps="cropOps"
is-crop>
<template slot="tips">图片比例1.61</template>
</ai-uploader>
</el-form-item>
<el-form-item label="图片信息" v-if="detailTitle == '旅游服务'">
<span class="upload-more" style="left:-70px">(最多9张)</span>
<el-upload
class="upload-demo upload-list"
ref="upload"
multiple
action
list-type="picture-card"
:file-list="fileList"
:http-request="uploadFile"
:on-remove="handleRemoveFile"
:on-change="fileChange"
accept=".jpeg,.jpg,.png">
<div class="upload-img">
<div class="iconfont iconPhoto"></div>
<div class="upload-text">上传照片</div>
</div>
</el-upload>
</el-form-item>
</el-form>
</div>
</div>
</el-row>
</div> -->
</template>
<script>
import {mapState} from 'vuex';
export default {
name: 'add-rural',
props: {
instance: Function,
dict: Object,
permissions: Function,
detailTitle: String,
isEdit: Boolean,
areaId: String,
type: String,
detailId: String,
disabledLevel: Number
},
data() {
return {
ruleForm: {
title: '',
content: '',
areaId: '',
createUnitName: '',
createUserName: '',
status: '',
thumbUrl: []
},
cropOps: {
width: "336px",
height: "210px"
},
rules: {
title: [
{required: true, message: '请输入标题', trigger: 'change'}
],
content: [
{required: true, message: '请输入内容', trigger: 'change'}
],
areaId: [
// {required: true, validator: transferInAreaIdPass, trigger: 'change'}
{required: true, message: '请选择发布地区', trigger: 'change'}
],
photo: [
{required: true, message: '请上传图片', trigger: 'blur'}
],
},
fileList: []
};
},
filters: {
timeVal(val) {
if (val) {
return val.substring(0, 10);
}
}
},
methods: {
// 上传照片
uploadFile(file) {
var isPng = true
isPng = file.file.type == 'image/jpeg' || file.file.type == 'image/png' || file.file.type == 'image/jpg';
if (!isPng) {
this.$message.warning('上传图片信息必须是jpeg/png/jpg格式!');
for (let i = 0; i < this.fileList.length; i++) {
if (this.fileList[i].uid == file.file.uid) {
this.fileList.splice(i, 1);
}
}
return
}
const isLt10M = file.file.size / 1024 / 1024 < 10;
if (!isLt10M) {
this.$message.warning("图片大小不能超过 10MB!");
for (let i = 0; i < this.fileList.length; i++) {
if (this.fileList[i].uid == file.file.uid) {
this.fileList.splice(i, 1);
}
}
return;
}
if (this.fileList.length > 9) {
this.$message.error('图片信息不能超过9张')
this.fileList.map((item, index) => {
if (item.uid == file.file.uid) {
this.fileList.splice(index, 1)
}
return this.fileList
})
return
}
let formData = new FormData();
formData.append("file", file.file);
this.instance.post(`/admin/file/add`, formData).then(res => {
if (res.msg == "success") {
this.$message({message: '图片上传成功', type: 'success'})
let imgInfo = res.data[0].split(';');
let img = {
'fileId': imgInfo[1],
'accessUrl': imgInfo[0]
}
this.fileList.map((item, index) => {
if (item.uid == file.file.uid) {
this.fileList[index].fileId = img.fileId
this.fileList[index].accessUrl = img.accessUrl
this.fileList[index].url = img.accessUrl
}
return this.fileList
})
}
})
},
handleRemoveFile(file, fileList) {
this.fileList = fileList
},
fileChange(file, fileList) {
if (fileList.lenth == 9) {
this.$message.error('图片信息不能超过9张')
return
}
this.fileList = fileList
},
cancel() {
this.$emit('goto');
},
confirm(formName, status) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.ruleForm.status = status
this.confirmAjax();
} else {
return false;
}
});
},
confirmAjax() {
this.ruleForm.photo = JSON.stringify(this.fileList)
this.instance.post('/app/appcountrysidetourism/addOrUpdate', {
...this.ruleForm,
thumbUrl: this.ruleForm.thumbUrl.length ? JSON.stringify([{
url: this.ruleForm.thumbUrl[0].url
}]) : ''
}).then(res => {
if (res && res.code == 0) {
this.detailId ? this.$message.success('修改成功') : this.$message.success('添加成功');
this.cancel();
}
});
},
getDetail() {
this.instance.post(`/app/appcountrysidetourism/queryDetailById?id=${this.detailId}`).then(res => {
if (res && res.code == 0) {
this.ruleForm = {...res.data}
this.ruleForm.thumbUrl = res.data.thumbUrl ? JSON.parse(res.data.thumbUrl) : []
if (this.ruleForm.photo) {
this.fileList = JSON.parse(this.ruleForm.photo)
}
}
});
},
contentInput() {
this.$refs.ruleForm.validateField('content')
}
},
mounted() {
if (this.detailId) { //编辑
this.getDetail()
} else { //新增
this.ruleForm.areaId = this.areaId
this.ruleForm.type = this.type
this.ruleForm.createUnitName = this.user.info.unitName
this.ruleForm.createUserName = this.user.info.name
}
},
computed: {
...mapState(['user'])
},
};
</script>
<style scoped lang="scss">
.cover {
display: block;
width: 300px;
height: 140px;
margin: 20px auto;
}
.addRural {
::v-deep .upload-list .el-upload-list--picture-card {
.el-upload-list__item-actions {
width: 84px !important;
height: 84px !important;
}
}
::v-deep .upload-list .el-upload-list__item {
margin-right: 16px;
}
::v-deep .upload-list .el-upload-list__item, .el-upload-list__item {
img {
width: 84px !important;
height: 84px !important;
border-radius: 2px !important;
}
}
.upload-list {
padding-bottom: 100px;
::v-deep .el-upload-list__item {
width: 84px !important;
height: 84px !important;
border-radius: 2px !important;
}
}
.upload-img {
width: 84px;
height: 84px;
background: rgba(245, 245, 245, 1);
border-radius: 2px;
border: 1px solid rgba(208, 212, 220, 1);
.iconPhoto {
margin-top: 20px;
font-size: 32px;
color: #8B9CB6;
}
}
.upload-demo {
// padding: 0 15px;
}
.upload-text {
color: rgba(102, 102, 102, 1);
font-size: 12px;
height: 16px;
line-height: 16px;
}
::v-deep .upload-list .el-upload--picture-card {
width: 84px !important;
height: 84px !important;
line-height: 30px !important;
background: rgba(245, 245, 245, 1) !important;
border-radius: 2px !important;
border: none !important;
}
}
</style>

View File

@@ -0,0 +1,314 @@
<template>
<ai-list isTabs class="appCountrysideTourism bg369">
<template #content>
<ai-search-bar>
<template slot="left">
<el-button type="primary" icon="el-icon-circle-plus-outline" size="small" @click="toAdd()" v-if="$permissions('app_appcountrysidetourism_edit')">添加
</el-button>
<el-button icon="el-icon-delete-solid" size="small" class="del-btn-list" @click="deleteList()" v-if="$permissions('app_appcountrysidetourism_del')" :disabled="!multipleSelection.length">删除
</el-button>
</template>
<template #right>
<el-input
v-model="search.title"
class="search-input"
size="small"
@keyup.enter.native="search.current = 1, search.title, getAppCountrysideTourism()"
placeholder="请输入标题"
clearable
@clear="search.current = 1, search.title = '', getAppCountrysideTourism()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
ref="aitableex"
:current.sync="page.current"
@selection-change="handleSelectionChange"
:size.sync="page.size"
@getList="getAppCountrysideTourism">
<el-table-column width="160" slot="options" label="操作" align="center" fixed="right">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" :title="row.status == 1 ? '取消发布' : '发布'" @click="changeStatus(row)">{{ row.status == 1 ? '取消发布' : '发布' }}</el-button>
<el-button type="text" title="编辑" @click="viewDetail(row)" :disabled="!$permissions('app_appcountrysidetourism_edit')">编辑</el-button>
<el-button type="text" title="删除" @click="deleteItem(row)" :disabled="!$permissions('app_appcountrysidetourism_del')">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
<!-- <el-table ref="multipleTable" :data="tableData" style="margin-top:8px;" header-cell-class-name="table-header"
tooltip-effect="light" row-class-name="table-row" cell-class-name="table-cell"
@selection-change="handleSelectionChange">
<el-table-column prop="title" label="产品名称" v-if="activeName == 'ruralProdect'" align="center"
show-overflow-tooltip>
<div slot-scope="{row}">
{{ row.title || "-" }}
</div>
</el-table-column>
<el-table-column prop="status" label="发布状态" align="center">
<div slot-scope="{row}" v-if="row.status == 1"> 已发布</div>
<div slot-scope="{row}" v-else> 未发布</div>
</el-table-column>
<el-table-column slot="operate" label="操作" align="center">
<div slot-scope="{row}">
<span class="iconfont iconChange icon-color89B mar-r8" :title="row.status==1?'取消发布':'发布'"
style="cursor: pointer;" @click="changeStatus(row)"/>
<span class="iconfont iconEdit icon-color89B mar-r8" title="编辑" style="cursor: pointer;"
@click="viewDetail(row)" v-if="$permissions('app_appcountrysidetourism_edit')"/>
<span class="iconfont iconDelete icon-color89B" title="删除" style="cursor: pointer;" @click="deleteItem(row)"
v-if="$permissions('app_appcountrysidetourism_del')"/>
</div>
</el-table-column>
</el-table> -->
</template>
</ai-list>
</template>
<script>
import {mapState} from 'vuex'
export default {
name: 'appCountrysideTourism',
props: {
instance: Function,
dict: Object,
permissions: Function,
activeName: String,
type: String,
areaId: String
},
inject: ['home'],
data() {
return {
tableData: [],
columns: [
{
label: '标题',
prop: 'title',
type: '',
dict: ''
},
{
label: '地区',
prop: 'areaName',
type: '',
dict: ''
},
{
label: '发布状态',
prop: 'status',
type: '',
dict: ''
},
{
label: '发布时间',
prop: 'createDate',
type: 'time',
dict: ''
},
// {
// label: '发布单位',
// prop: 'createUnitName',
// type: '',
// dict: ''
// },
{
label: '发布人',
prop: 'createUserName',
type: '',
dict: ''
},
{
label: '操作',
prop: 'operate',
type: '',
dict: ''
}
],
search: {
style: {},
title: ''
},
page: {
current: 1,
size: 10,
},
total: 0,
multipleSelection: [],
ids: []
}
},
computed: {
...mapState(['user']),
colConfigs () {
return [
{ type: 'selection', align: 'center'},
{ prop: 'title', label: this.activeName == 'ruralProdect' ? '产品名称' : '标题', align: 'left', width: '200px' },
{ prop: 'areaName', label: '地区', align: 'center' },
{ prop: 'status', label: '发布状态', align: 'center', formart: v => v === '1' ? '已发布' : '未发布' },
{ prop: 'createDate', label: '发布时间', align: 'center' },
{ prop: 'createUnitName', label: '发布单位', align: 'center' },
{ prop: 'createUserName', label: '发布人', align: 'center' },
{ slot: 'options', label: '操作', align: 'center' }
]
}
},
mounted() {
if (this.dict) this.dict.load(this.columns.map(e => (e.type == 'select' ? e.dict : '')))
this.resetSearch()
},
methods: {
isPermit(params) {
return this.permissions ? this.permissions(params) : false;
},
handleSelectionChange(val) {
this.multipleSelection = val;
this.ids = []
this.multipleSelection.forEach(e => {
this.ids.push(e.id);
});
},
deleteItem(item) {
this.ids = []
this.ids.push(item.id);
this.deleteList();
},
deleteList() {
this.$confirm('是否要删除这些信息?', {type: 'warning'})
.then(() => {
this.instance.post('/app/appcountrysidetourism/delete?ids=' + this.ids, null, {}).then(() => {
this.getAppCountrysideTourism();
this.ids = [];
this.$message.success('删除成功!');
});
})
.catch(() => {
});
},
viewDetail(item) {
this.$emit('showEditRoral', item);
},
handleSizeChange(val) {
this.page.size = val
this.getAppCountrysideTourism()
},
resetSearch() {
this.page.current = 1;
this.page.size = 10;
this.columns.map(c => {
if (c.type) this.search[c.prop] = null;
});
Object.keys(this.search).forEach(e => {
this.search[e] = null;
});
this.getAppCountrysideTourism();
},
getAppCountrysideTourism() {
this.instance.post(`/app/appcountrysidetourism/list?type=${this.type}&areaId=${this.home.areaId}`, null, {
params: {
...this.search,
...this.page
}
})
.then(res => {
if (res && res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
});
},
addOrUpdateAppCountrysideTourism() {
this.instance.post('/app/appcountrysidetourism/addOrUpdate', this.dialog.add).then(() => {
this.getAppCountrysideTourism();
this.$message.success('添加或修改成功!');
});
},
deleteAppCountrysideTourism(ids) {
this.$confirm('是否要删除这些账号?', {
type: 'warning'
})
.then(() => {
this.instance
.post('/app/appcountrysidetourism/delete', null, {
params: {
ids: ids
}
})
.then(() => {
this.getAppCountrysideTourism();
this.$message.success('删除成功!');
});
})
.catch(() => {
});
},
handleCurrentChange(val) {
this.page.current = val;
this.getAppCountrysideTourism();
},
toAdd() {
this.$emit('showAddRoral');
},
changeStatus(item) {
let title = item.status == '1' ? '是否要取消发布?' : '是否要发布?';
this.$confirm(title, {type: 'warning'})
.then(() => {
item.status = item.status == '1' ? '0' : '1';
this.instance.post('/app/appcountrysidetourism/addOrUpdate', item).then(res => {
if (res && res.code == 0) {
title == '是否要发布?' ? this.$message.success('发布成功') : this.$message.success('取消发布成功');
this.getAppCountrysideTourism();
}
});
})
.catch(() => {
});
}
}
}
</script>
<style lang="scss" scoped>
.appVillageCadres {
background-color: #f3f6f9;
width: 100%;
height: 100%;
.header {
padding: 0 16px;
width: 100%;
background-color: #ffffff;
height: 48px;
line-height: 48px;
box-shadow: inset 0px -1px 0px 0px #d8dce3;
}
.main-content {
margin: 16px;
background-color: white;
border: 1px solid #eee;
padding: 12px 16px;
.searchBar {
border-bottom: 1px solid #eee;
.el-col {
margin-bottom: 12px;
height: 32px;
}
}
.row-btn {
margin: 16px 0;
}
}
}
</style>

View File

@@ -0,0 +1,40 @@
<template>
<div class="AppShowProduce">
<List
slot="content"
:instance="instance"
:dict="dict"
:permissions="permissions">
</List>
</div>
</template>
<script>
import List from './components/List.vue'
export default {
name: 'AppShowProduce',
label: '晒农产品',
components: {
List
},
props: {
instance: Function,
dict: Object,
permissions: Function
},
data () {
return {
}
}
}
</script>
<style lang="scss" scoped>
.AppShowProduce {
height: 100%;
}
</style>

View File

@@ -0,0 +1,132 @@
<template>
<ai-list>
<ai-title slot="title" title="晒农产品" isShowBottomBorder></ai-title>
<template slot="content">
<ai-search-bar bottomBorder>
<template #left>
<ai-select v-model="search.type" clearable @change="search.current = 1, getList()" :selectList="dict.getDict('agriculturalType')"></ai-select>
<el-button icon="iconfont iconDelete" size="small" @click="removeAll" :disabled="ids.length == 0">删除 </el-button>
</template>
<template #right>
<el-input
v-model="search.title"
size="small"
placeholder="请输入标题/联系电话"
clearable
v-throttle="() => {search.current = 1, getList()}"
@clear="search.current = 1, search.title = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
v-loading="loading"
style="margin-top: 16px;"
:current.sync="search.current"
:size.sync="search.size"
@selection-change="v => (ids = v.map((e) => e.id))"
@getList="getList">
<el-table-column slot="options" width="120px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
export default {
name: 'List',
props: {
instance: Function,
dict: Object
},
data () {
return {
search: {
current: 1,
status: '',
size: 10,
type: '',
title: ''
},
ids: [],
tableData: [],
total: 0,
loading: false
}
},
computed: {
colConfigs () {
return [
{ type: 'selection' },
{ prop: 'title', label: '标题' },
{ prop: 'type', align: 'center', label: '类型', formart: v => this.dict.getLabel('agriculturalType', v) },
{ prop: 'phone', align: 'center', label: '联系电话' },
{ prop: 'contactPerson', align: 'center', label: '发布人' },
{ prop: 'createTime', align: 'center', label: '发布时间' }
]
}
},
created () {
this.dict.load('agriculturalType').then(() => {
this.getList()
})
},
mounted () {
this.loading = true
},
methods: {
getList () {
this.instance.post(`/app/appshowagriculturalproduce/list`, null, {
params: {
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
this.loading = false
} else {
this.loading = false
}
}).catch(() => {
this.loading = false
})
},
remove (id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appshowagriculturalproduce/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
removeAll() {
var id = this.ids.join(',')
this.remove(id)
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,66 @@
<template>
<div class="doc-circulation ailist-wrapper">
<keep-alive :include="['List']">
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component>
</keep-alive>
</div>
</template>
<script>
import List from './components/List'
import Add from './components/Add'
export default {
name: 'AppVillageAuxiliarPolice',
label: '驻村辅警',
props: {
instance: Function,
dict: Object
},
data () {
return {
component: 'List',
params: {},
include: []
}
},
components: {
Add,
List
},
mounted () {
},
methods: {
onChange (data) {
if (data.type === 'Add') {
this.component = 'Add'
this.params = data.params
}
if (data.type === 'list') {
this.component = 'List'
this.params = data.params
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
}
}
}
}
</script>
<style lang="scss">
.doc-circulation {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,126 @@
<template>
<ai-detail>
<template slot="title">
<ai-title :title="params.id ? '编辑驻村辅警' : '添加驻村辅警'" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<el-form ref="form" class="ai-form" :model="form" label-width="110px" label-position="right">
<el-form-item label="服务区域" style="width: 100%;" prop="codeName">
<span style="color: #666;">{{ form.areaName }}</span>
</el-form-item>
<el-form-item style="width: 100%" label="姓名" prop="name" :rules="[{ required: true, message: '请输入姓名', trigger: 'blur' }]">
<el-input size="small" placeholder="请输入姓名" v-model="form.name"></el-input>
</el-form-item>
<el-form-item style="width: 100%" label="电话" prop="phone" :rules="[{ required: true, message: '请输入电话', trigger: 'blur' }]">
<el-input size="small" placeholder="请输入电话" maxlength="20" v-model="form.phone"></el-input>
</el-form-item>
<el-form-item style="width: 100%;" label="是否公开" prop="isPublic" :rules="[{ required: true, message: '请选择是否公开', trigger: 'change' }]">
<el-radio-group v-model="form.isPublic">
<el-radio label="1"></el-radio>
<el-radio label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="图片" style="width: 100%;" prop="picture">
<ai-uploader
:instance="instance"
isShowTip
v-model="form.picture"
:limit="1">
</ai-uploader>
</el-form-item>
</el-form>
</template>
</ai-card>
</template>
<template #footer>
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="confirm">提交</el-button>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Add',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
form: {
areaId: '',
name: '',
areaName: '',
phone: '',
picture: [],
isPublic: '1'
},
id: ''
}
},
created () {
if (this.params && this.params.areaId && !this.params.id) {
this.form.areaId = this.params.areaId
this.form.areaName = this.params.areaName
}
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appvillageauxiliarypolice/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = res.data
this.form.picture = res.data.picture ? [{url: res.data.picture}] : []
}
})
},
onClose () {
this.form.explain = ''
},
confirm () {
this.$refs.form.validate((valid) => {
if (valid) {
this.instance.post(`/app/appvillageauxiliarypolice/addOrUpdate`, {
...this.form,
id: this.params.id || '',
picture: this.form.picture.length ? this.form.picture[0].url : ''
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
setTimeout(() => {
this.cancel(true)
}, 600)
}
})
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'list',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,425 @@
<template>
<ai-list class="villagecode">
<template slot="title">
<ai-title title="驻村辅警" isShowBottomBorder></ai-title>
</template>
<template #left>
<div class="villagecode-left">
<div class="villagecode-left__title">
<h2>地区</h2>
</div>
<div class="addressBook-left__list">
<div class="addressBook-left__list--title">
<el-input
class="addressBook-left__list--search"
size="mini"
clearable
placeholder="请输入地区名称"
v-model="unitName"
suffix-icon="iconfont iconSearch">
</el-input>
</div>
<el-tree
:filter-node-method="filterNode"
ref="tree"
:props="defaultProps"
node-key="id"
:data="areaTree"
highlight-current
:current-node-key="search.areaId"
:default-expanded-keys="defaultExpanded"
:default-checked-keys="defaultChecked"
@current-change="onTreeChange">
</el-tree>
</div>
</div>
</template>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button>
</template>
<template slot="right">
<el-input
v-model="search.name"
class="search-input"
size="small"
v-throttle="() => {search.current = 1, getList()}"
placeholder="请输入姓名/电话"
clearable
@change="getList"
@clear="search.current = 1, search.name = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 6px;"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="isPublic" label="是否公开">
<template slot-scope="{ row }">
<el-switch
v-model="row.isPublic"
active-value="1"
@change="e => onChange(row.id, e)"
inactive-value="0">
</el-switch>
</template>
</el-table-column>
<el-table-column slot="options" width="180px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'List',
props: {
instance: Function,
dict: Object
},
data() {
return {
search: {
current: 1,
size: 10,
name: '',
areaId: ''
},
defaultExpanded: [],
defaultChecked: [],
areaTree: [],
defaultProps: {
children: 'children',
label: 'name'
},
currIndex: -1,
total: 10,
colConfigs: [
{prop: 'name', label: '姓名', align: 'left'},
{prop: 'phone', label: '联系方式', align: 'center'},
{prop: 'areaName', label: '服务区域', align: 'center'},
{prop: 'createTime', label: '创建时间', align: 'center'},
{slot: 'isPublic', label: '是否公开', align: 'center'},
{slot: 'options', label: '操作'}
],
areaName: '',
unitName: '',
tableData: []
}
},
computed: {
...mapState(['user'])
},
watch: {
unitName (val) {
this.$refs.tree.filter(val)
}
},
mounted() {
this.search.areaId = this.user.info.areaId
this.areaName = this.user.info.areaName
this.getTree()
this.getList()
this.$nextTick(() => {
})
},
methods: {
getList() {
this.instance.post(`/app/appvillageauxiliarypolice/list`, null, {
params: {
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
onChange (id) {
this.instance.post(`/app/appvillageauxiliarypolice/enable?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('修改成功')
this.getList()
}
})
},
filterNode(value, data) {
if (!value) return true
return data.name.indexOf(value) !== -1
},
onTreeChange (e) {
this.search.areaId = e.id
this.areaName = e.name
this.search.current = 1
this.$nextTick(() => {
this.getList()
})
},
getTree () {
this.instance.post(`/admin/area/queryAllArea?id=${this.user.info.areaId}`).then(res => {
if (res.code === 0) {
let parent = res.data.map(v => {
v.label = v.name
v.children = []
return v
}).filter(e => !e.parentid)[0]
this.defaultExpanded = [parent.id]
this.defaultChecked = [parent.id]
this.search.areaId = parent.id
this.addChild(parent, res.data)
this.areaTree = [parent]
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(parent.id)
})
}
})
},
addChild (parent, list) {
for (let i = 0; i < list.length; i++) {
if (list[i].parentId === parent.id) {
parent.children.push(list[i])
}
}
if (list.length > 0) {
parent['children'].map(v => this.addChild(v, list))
}
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appvillageauxiliarypolice/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
toAdd(id) {
this.$emit('change', {
type: 'Add',
params: {
areaName: this.areaName,
id: id || '',
areaId: this.search.areaId
}
})
}
}
}
</script>
<style lang="scss" scoped>
.villagecode {
.table-tags {
.el-tag {
margin-right: 8px;
&:last-child {
margin-right: 0;
}
}
}
.addressBook-left__list {
height: calc(100% - 40px);
padding: 8px 8px;
overflow: auto;
.addressBook-left__tags--item {
display: flex;
align-items: center;
justify-content: space-between;
height: 40px;
padding: 0 8px 0 16px;
color: #222222;
&.addressBook-left__tags--item-active, &:hover {
background: #E8EFFF;
color: #2266FF;
i, span {
color: #2266FF;
}
}
span {
font-size: 14px;
}
i {
cursor: pointer;
color: #8e9ebf;
font-size: 16px;
}
}
.addressBook-left__list--title {
display: flex;
align-items: center;
margin-bottom: 8px;
.addressBook-left__list--search {
flex: 1;
::v-deep input {
width: 100%;
}
}
.el-button {
width: 84px;
flex-shrink: 1;
margin-right: 8px;
}
}
span {
color: #222222;
font-size: 14px;
}
::v-deep .el-tree {
background: transparent;
.el-tree-node__expand-icon.is-leaf {
color: transparent!important;
}
.el-tree-node__content > .el-tree-node__expand-icon {
padding: 4px;
}
.el-tree-node__content {
height: 32px;
}
.el-tree__empty-text {
color: #222;
font-size: 14px;
}
.el-tree-node__children .el-tree-node__content {
height: 32px;
}
.el-tree-node__content:hover {
background: #E8EFFF;
color: #222222;
border-radius: 2px;
}
.is-current > .el-tree-node__content {
&:hover {
background: #2266FF;
color: #fff;
}
background: #2266FF;
span {
color: #fff;
}
}
}
}
::v-deep .ai-list__content--left {
margin-right: 2px;
}
.villagecode-left {
width: 100%;
height: auto;
background: #FAFAFB;
.villagecode-left__title {
display: flex;
align-items: center;
height: 40px;
padding: 0 16px;
background: #fff;
h2 {
color: #222;
font-size: 14px;
}
}
.villagecode-left__list {
height: calc(100% - 40px);
padding: 8px 0;
overflow: auto;
span {
display: block;
height: 40px;
line-height: 40px;
padding: 0 24px;
color: #222222;
font-size: 14px;
cursor: pointer;
border-right: 2px solid transparent;
background: transparent;
&:hover {
color: #2266FF;
background: #E8EFFF;
}
&.left-active {
color: #2266FF;
border-color: #2266FF;
background: #E8EFFF;
}
}
}
}
::v-deep .ai-list__content--right {
.ai-list__content--right-wrapper {
min-height: 100%;
}
}
}
.message-info__img {
font-size: 0;
width: 144px;
height: 144px;
}
</style>

View File

@@ -0,0 +1,134 @@
<template>
<ai-list v-if="!isShowDetail">
<template slot="title">
<ai-title title="村务公开" :isShowBottomBorder="false" :hideLevel="hideLelev - 1" :instance="instance" :isShowArea="true" @change="areaChange" v-model="areaId">
</ai-title>
</template>
<template slot="tabs">
<el-tabs v-model="currIndex">
<el-tab-pane v-for="(tab,i) in tabs" :key="i" :label="tab.label">
<component :ref="String(i)" :areaId="areaId" :is="tab.comp" v-if="currIndex === String(i)" @change="onChange" :instance="instance" :dict="dict" :permissions="permissions"/>
</el-tab-pane>
</el-tabs>
</template>
</ai-list>
<Detail v-else-if="isShowDetail && componentName === 'Detail'" :areaId="areaId" @change="onChange" :params="params" :instance="instance" :dict="dict" :permissions="permissions" />
<Add v-else-if="isShowDetail && componentName === 'Add'" :areaId="areaId" @change="onChange" :params="params" :instance="instance" :dict="dict" :permissions="permissions" />
</template>
<script>
import Event from './components/Event'
import Comments from './components/Comments'
import Add from './components/Add'
import Detail from './components/Detail'
import { mapState } from 'vuex'
export default {
name: 'AppVillageInfo',
label: '村务公开',
components: {
Add,
Detail,
Event,
Comments
},
props: {
instance: Function,
dict: Object,
permissions: Function
},
computed: {
...mapState(['user']),
tabs () {
const tabList = [
{label: '事项管理', name: 'Event', comp: Event, permission: 'app_appvillageinfo'},
{label: '评论管理', name: 'Comments', comp: Comments, permission: 'app_appvillageinfocomment'}
].filter(item => {
return this.permissions(item.permission)
})
return tabList
}
},
data () {
return {
activeName: 'Event',
currIndex: '0',
componentName: '',
params: {},
areaId: '',
isHasPermiss: true,
isShowDetail: false
}
},
created () {
this.areaId = this.user.info.areaId
this.hideLelev = this.user.info.areaMap[this.user.info.areaId].length
},
methods: {
areaChange () {
console.log(this.$refs[this.currIndex])
this.$refs[this.currIndex][0].getList()
},
onChange (data) {
if (data.type === 'detail') {
this.componentName = 'Detail'
this.isShowDetail = true
this.params = data.params
}
if (data.type === 'add') {
this.componentName = 'Add'
this.isShowDetail = true
this.params = data.params
}
if (data.type === 'list') {
this.isShowDetail = false
this.$nextTick(() => {
if (data.isRefresh) {
// this.$refs[this.currIndex].getList()
}
})
}
}
}
}
</script>
<style lang="scss" scoped>
.no-permission__wrapper {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
height: 100%;
padding-bottom: 100px;
font-size: 16px;
color: #333;
h2 {
font-size: 16px;
color: #333;
}
i {
font-style: normal;
color: #2771ff;
}
.no-permission {
width: 120px;
margin-top: 0;
}
}
</style>

View File

@@ -0,0 +1,254 @@
<template>
<ai-detail showFooter class="add-detail">
<template slot="title">
<ai-title :title="params.id ? '编辑村务公开' : '添加村务公开'" :isShowBack="true" @onBackClick="onBack"
:isShowBottomBorder="true"></ai-title>
</template>
<template slot="content">
<ai-card title="基础信息">
<template #content>
<el-form :model="form" label-width="120px" ref="form">
<el-form-item label="类型" prop="type" :rules="[{required: true, message: '请选择类型', trigger: 'change'}]">
<el-select size="small" placeholder="请选择" v-model="form.type" style="width: 240px;" clearable>
<el-option
v-for="(item,i) in dict.getDict('villInfoType')" :key="i"
:label="item.dictName"
:value="item.dictValue">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="标题" prop="title" :rules="[{required: true, message: '请输入标题', trigger: 'blur'}]">
<el-input type="textarea" :rows="2" v-model="form.title" clearable placeholder="请输入..." maxlength="100"
show-word-limit></el-input>
</el-form-item>
<el-form-item label="发布地区" prop="areaId" :rules="[{required: true, message: '请选择发布地区'}]">
<ai-area-get v-model="form.areaId" :instance="instance" :root="areaId"/>
</el-form-item>
<el-form-item label="正文" prop="content" :rules="[{required: true, message: '请输入正文', trigger: 'blur'}]">
<ai-editor v-model="form.content" :instance="instance"/>
</el-form-item>
<!-- <el-form-item label="缩略图" prop="thumbUrl" :rules="[{required: true, message: '请上次缩略图', trigger: 'change'}]">-->
<!-- <ai-uploader-->
<!-- :isShowTip="true"-->
<!-- :instance="instance"-->
<!-- v-model="form.thumbUrl"-->
<!-- :limit="1"-->
<!-- :cropOps="cropOps"-->
<!-- is-crop>-->
<!-- <template slot="tips">最多上传1张图片,单个文件最大10MB支持jpgjpegpng<br/>格式图片比例1.61</template>-->
<!-- </ai-uploader>-->
<!-- </el-form-item>-->
<el-form-item label="附件">
<ai-uploader
:isShowTip="true"
:instance="instance"
v-model="fileList"
fileType="file"
:limit="9">
<template slot="tips">最多上传9个附件,单个文件最大10MB<br/>支持.doc.docx.xls.ppt.pptx.pdf.txt.jpg.png格式
</template>
</ai-uploader>
</el-form-item>
</el-form>
</template>
</ai-card>
</template>
<template slot="footer" class="footer">
<el-button class="delete-btn footer-btn" @click="cancel(false)">取消</el-button>
<el-button type="primary" size="small" @click="onSubmit(1)">保存</el-button>
<el-button type="primary" size="small" v-if="!params.id" @click="onSubmit(2)">保存并发布</el-button>
</template>
</ai-detail>
</template>
<script>
import {mapState} from 'vuex'
export default {
name: 'Add',
props: {
dict: Object,
params: Object,
instance: Function,
areaId: String
},
data() {
return {
form: {
title: '',
type: '',
content: '',
fileIds: [],
thumbUrl: []
},
fileList: [],
isDetail: true,
cropOps: {
width: "336px",
height: "210px"
}
}
},
computed: {
...mapState(['user'])
},
created() {
if (this.params && this.params.id) {
this.getInfo()
}
},
methods: {
onBack() {
this.cancel()
},
getInfo() {
this.instance.post(`/app/appvillageinfo/queryDetailById?id=${this.params.id}`).then(res => {
if (res.code === 0) {
this.form = {
...res.data
}
this.form.thumbUrl = res.data.thumbUrl ? JSON.parse(res.data.thumbUrl) : []
this.fileList = res.data.files || []
}
})
},
onSubmit(index) {
this.$refs.form.validate((valid) => {
if (valid) {
if (!this.id) {
if (index == 2) {
this.form.status = 1
} else {
this.form.status = 0
}
}
this.instance.post(`/app/appvillageinfo/addOrUpdate`, {
...this.form,
fileIds: this.fileList.map(v => v.id),
thumbUrl: this.form.thumbUrl.length ? JSON.stringify([{
url: this.form.thumbUrl[0].url
}]) : ''
}).then(res => {
if (res.code === 0) {
this.$message.success(`${this.params.id ? '编辑成功' : '提交成功'}`)
setTimeout(() => {
this.cancel(true)
}, 800)
}
})
}
})
},
cancel(isRefresh) {
this.$emit('change', {
type: 'list',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style lang="scss" scoped>
.add-detail {
height: 100%;
overflow: hidden;
background: #F2F4F6 !important;
.map-wrapper {
position: relative;
width: 100%;
height: 400px;
.search-input {
position: absolute;
top: 20px;
left: 20px;
z-index: 1111;
width: 220px !important;
height: 32px !important;
}
#map {
position: absolute;
top: 0;
left: 0;
z-index: 11;
width: 100%;
height: 400px;
}
}
::v-deep .el-form-item__content {
margin-left: 140px !important;
}
.add-detail__form {
display: flex;
justify-content: space-between;
.el-input {
width: 328px;
}
}
.add-form {
&:first-child {
margin-bottom: 20px;
}
}
.add-form__item, .add-detail__form {
display: flex;
align-items: center;
padding: 0 90px 0 50px;
}
::v-deep .ai-detail__footer {
background: #fff !important;
}
::v-deep .ai-detail {
div {
box-sizing: border-box;
}
}
::v-deep .ai-detail__content--active {
padding: 20px;
box-sizing: border-box;
.ai-detail__content--wrapper {
width: 100%;
}
.aibar {
padding: 0 16px;
}
.add-form {
background: #fff;
}
}
::v-deep .ai-wrapper {
align-items: inherit !important;
}
.footer-btn {
width: 92px;
}
el-form {
padding-bottom: 80px;
}
}
</style>

View File

@@ -0,0 +1,130 @@
<template>
<ai-list class="comments" :isTabs="true">
<template slot="content">
<div class="ai-table">
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column prop="type" slot="options" label="评论明细">
<div slot-scope="scope">
<el-row type="flex" justify="space-between">
<p class="comment_p">来自{{ scope.row.title }}</p>
<span title="删除" style="cursor: pointer;color: #26f;user-select: none;" @click="remove(scope.row.id)">删除</span>
</el-row>
<div style="display: flex;">
<b slot="label">回复内容:</b>
<ai-audio single-play v-if="scope.row.audioFile" :src="scope.row.audioFile"/>
<div v-html="scope.row.content" style="white-space: pre-wrap;"></div>
</div>
<p style="float:left;padding-right:8px;"><span style="font-weight:bold;padding-right:8px;">回复人:</span>{{ scope.row.createUser }}
</p>
<p style="float:left;">{{ scope.row.createDate }}</p>
</div>
</el-table-column>
</ai-table>
</div>
</template>
</ai-list>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'JoinEvent',
props: {
instance: Function,
dict: Object,
areaId: String,
permissions: Function
},
computed: {
...mapState(['user']),
colConfigs() {
return [
{ slot: 'options' }
]
}
},
data () {
return {
search: {
current: 1,
size: 10,
status: ''
},
total: 0,
ids: [],
tableData: [],
orderDetail: {}
}
},
created () {
this.getList()
},
methods: {
getList () {
this.instance.post(`/app/appvillageinfocomment/list`, null, {
params: {
...this.search,
areaId: this.areaId
}
}).then(res => {
if (res.data) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
remove (id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appvillageinfocomment/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
}
}
}
</script>
<style lang="scss" scoped>
.join-event {
::v-deep th {
font-weight: bold!important;
}
}
.table-btn {
margin-right: 16px;
font-size: 14px;
color: #2266FF;
cursor: pointer;
&:hover {
opacity: 0.6;
}
&:last-child {
margin-right: 0;
}
&:last-child:hover {
color: #f46;
opacity: 1;
}
}
</style>

View File

@@ -0,0 +1,78 @@
<template>
<ai-detail class="event-detail">
<template #title>
<ai-title title="村务公开详情" :isShowBack="true" @onBackClick="onBack" isShowBottomBorder>
</ai-title>
</template>
<template #content>
<ai-card :title="info.title" titlePosition="center">
<template #title>
<h2>{{ info.title }}</h2>
<p class="subTitle">{{ info.createDate }} {{ info.unitName || '-' }}</p>
</template>
<template #content>
<img class="cover" :src="info.thumbUrl[0].url" v-if="info.thumbUrl && info.thumbUrl.length">
<ai-article :value="info.content"></ai-article>
<ai-file-list v-if="info.files && info.files.length" :fileList="info.files" :fileOps="{name: 'fileName', size: 'postfix'}"></ai-file-list>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'detail',
props: {
instance: Function,
dict: Object,
permissions: Function,
params: Object
},
data () {
return {
info: {}
}
},
mounted () {
this.getInfo()
},
methods: {
getInfo () {
this.instance.post(`/app/appvillageinfo/queryDetailById?id=${this.params.id}`).then(res => {
if (res.code === 0) {
this.info = res.data
if (res.data.thumbUrl) {
this.info.thumbUrl = JSON.parse(res.data.thumbUrl)
}
}
})
},
onBack () {
this.$emit('change', {
type: 'list'
})
}
}
}
</script>
<style scoped lang="scss">
.cover {
display: block;
width: 300px;
height: 140px;
margin: 20px auto;
}
.subTitle {
text-align: center;
font-size: 12px;
font-weight: normal;
}
</style>

View File

@@ -0,0 +1,226 @@
<template>
<ai-list class="join-event" :isTabs="true">
<template slot="content">
<ai-search-bar>
<template slot="left">
<el-button v-if="permissions('app_appvillageinfo_edit')" icon="iconfont iconAdd" type="primary" size="small" @click="add">添加</el-button>
</template>
<template slot="right">
<el-input
placeholder="请输入标题"
size="small"
clearable
v-model="search.title"
v-throttle="() => {search.current = 1, getList()}"
@clear="search.current = 1, search.title = '', getList()"
suffix-icon="iconfont iconSearch" />
</template>
</ai-search-bar>
<div class="ai-table">
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="options" label="操作" align="center" width="250" fixed="right">
<template slot-scope="{ row }" class="fs-14">
<div class="table-options">
<el-button
type="text"
@click="publish(row)"
:title="row.status === '1' ? '取消发布' : '发布'"
:disabled="!permissions('app_appvillageinfo_edit')">
{{ row.status === '1' ? '取消发布' : '发布' }}
</el-button>
<el-button
type="text"
title="详情"
@click="toDetail(row.id)"
:disabled="!permissions('app_appvillageinfo_detail')">
详情
</el-button>
<el-button
type="text"
title="编辑"
@click="toAdd(row.id)"
:disabled="!permissions('app_appvillageinfo_edit')">
编辑
</el-button>
<el-button
@click="remove(row.id)"
type="text"
title="删除"
:disabled="!permissions('app_appvillageinfo_edit')">
删除
</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</div>
</template>
</ai-list>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'ReportEvent',
props: {
instance: Function,
dict: Object,
areaId: String,
permissions: Function
},
computed: {
...mapState(['user']),
colConfigs() {
return [
{ prop: 'type', label: '类型', formart: v => this.dict.getLabel('villInfoType', v) },
{ prop: 'title', label: '标题', align: 'left' },
{ prop: 'status', label: '发布状态', align: 'center', formart: v => this.dict.getLabel('villInfoStatus', v) },
{ prop: 'createDate', label: '发布时间', dateFormat: 'YYYY-MM-DD', align: 'center' },
{ prop: 'createUser', label: '发布人', align: 'center' },
{ prop: 'areaName', label: '来源地区', align: 'center' },
{ slot: 'options', label: '操作' }
]
}
},
data () {
return {
search: {
current: 1,
size: 10,
title: ''
},
total: 0,
ids: [],
tableData: [],
orderDetail: {}
}
},
mounted () {
this.dict.load('villInfoType', 'villInfoStatus', 'villInfoCommentStatus').then(() => {
this.getList()
})
},
methods: {
getList () {
this.instance.post(`/app/appvillageinfo/list`, null, {
params: {
...this.search,
areaId: this.areaId
}
}).then(res => {
if (res.data) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
publish (params) {
this.$confirm(`是否${params.status === '1' ? '取消发布' : '发布'}该条数据?`).then(() => {
this.instance.post(`/app/appvillageinfo/updateCountYardstatus`, {
id: params.id,
status: params.status === '1' ? 0 : 1
}).then(res => {
if (res.code == 0) {
this.$message.success(`${params.status === '1' ? '取消发布' : '发布'}成功!`)
this.getList()
}
})
})
},
toAdd (id) {
this.$emit('change', {
type: 'add',
params: {
id
}
})
},
add () {
this.$emit('change', {
type: 'add',
params: {
id: ''
}
})
},
toEdit (id) {
this.$emit('change', {
type: 'add',
params: {
type: 'ReportAdd',
id
}
})
},
toDetail (id) {
this.$emit('change', {
type: 'detail',
params: {
type: 'eventDetail',
id
}
})
},
remove (id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appvillageinfo/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
}
}
}
</script>
<style lang="scss" scoped>
.join-event {
::v-deep th {
font-weight: bold!important;
}
::v-deep .table-options{
span{
font-size: 14px!important;
}
}
}
.table-btn {
margin-right: 16px;
font-size: 14px;
color: #2266FF;
cursor: pointer;
&:hover {
opacity: 0.6;
}
&:last-child {
margin-right: 0;
}
&:last-child:hover {
color: #f46;
opacity: 1;
}
}
</style>

View File

@@ -0,0 +1,73 @@
<template>
<div class="doc-circulation ailist-wrapper">
<keep-alive :include="['List']">
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component>
</keep-alive>
</div>
</template>
<script>
import List from './components/List'
import Add from './components/Add'
import Detail from './components/Detail'
export default {
name: 'AppVillageIntroduction',
label: '本村简介',
props: {
instance: Function,
dict: Object
},
data () {
return {
component: 'List',
params: {},
include: []
}
},
components: {
Add,
List,
Detail
},
mounted () {
},
methods: {
onChange (data) {
if (data.type === 'Add') {
this.component = 'Add'
this.params = data.params
}
if (data.type === 'Detail') {
this.component = 'Detail'
this.params = data.params
}
if (data.type === 'list') {
this.component = 'List'
this.params = data.params
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
}
}
}
}
</script>
<style lang="scss">
.doc-circulation {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,132 @@
<template>
<ai-detail>
<template slot="title">
<ai-title :title="params.id ? '编辑本村简介' : '添加本村简介'" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<el-form :model="form" label-width="120px" ref="form">
<el-form-item label="标题" prop="title" :rules="[{required: true, message: '请输入标题', trigger: 'blur'}]">
<el-input type="input" v-model="form.title" clearable placeholder="请输入..." maxlength="30" show-word-limit></el-input>
</el-form-item>
<el-form-item prop="areaId" label="发布地区" :rules="[{required: true, message: '请选择地区', trigger: 'change'}]">
<ai-area-select clearable always-show :instance="instance" v-model="form.areaId" :disabled-level="disabledLevel"></ai-area-select>
</el-form-item>
<el-form-item label="正文" prop="content" :rules="[{required: true, message: '请输入内容', trigger: 'change'}]">
<ai-editor v-model="form.content" :instance="instance"/>
</el-form-item>
<el-form-item label="缩略图" prop="thumbUrl">
<ai-uploader
:instance="instance"
isShowTip
v-model="form.thumbUrl"
:limit="1"
:cropOps="cropOps"
is-crop>
<template slot="tips">
<p>最多上传1张图片,单个文件最大10MB支持jpgjpegpng格式</p>
<p>图片比例1.61</p>
</template>
</ai-uploader>
</el-form-item>
</el-form>
</template>
</ai-card>
</template>
<template #footer>
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="confirm">提交</el-button>
</template>
</ai-detail>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'Add',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
form: {
title: '',
content: '',
areaId: '',
createUnitName: '',
createUserName: '',
status: '',
thumbUrl: []
},
cropOps: {
width: "336px",
height: "210px"
},
id: ''
}
},
computed: {
...mapState(['user'])
},
created () {
this.form.areaId = this.user.info.areaId
this.disabledLevel = this.user.info.areaList.length
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appcountrysidetourism/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = res.data
this.form.thumbUrl = res.data.thumbUrl ? JSON.parse(res.data.thumbUrl) : []
}
})
},
confirm () {
this.$refs.form.validate((valid) => {
if (valid) {
this.instance.post(`/app/appcountrysidetourism/addOrUpdate`, {
...this.form,
type: 0,
createUserName: this.user.info.name,
thumbUrl: this.form.thumbUrl.length ? JSON.stringify([{
url: this.form.thumbUrl[0].url
}]) : ''
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
setTimeout(() => {
this.cancel(true)
}, 600)
}
})
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'list',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,63 @@
<template>
<ai-detail>
<template slot="title">
<ai-title title="详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
id: ''
}
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appeveryvillagecode/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = res.data
this.form.codeUrl = [{
url: res.data.codeUrl
}]
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'list',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,151 @@
<template>
<ai-list class="notice">
<template slot="title">
<ai-title title="本村简介" isShowBottomBorder isShowArea v-model="search.areaId" :instance="instance" @change="search.current = 1, getList()"></ai-title>
</template>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button>
</template>
<template #right>
<el-input
v-model="search.title"
class="search-input"
size="small"
v-throttle="() => {search.current = 1, getList()}"
placeholder="请输入标题"
clearable
@clear="search.current = 1, search.title = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 6px;"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="tags" label="标签">
<template slot-scope="{ row }">
<div class="table-tags">
<el-tag type="info" v-for="(item, index) in row.tags" size="small" :key="index">{{ item }}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column slot="options" width="220px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" :title="row.status == 1 ? '取消发布' : '发布'" @click="changeStatus(row)">{{ row.status == 1 ? '取消发布' : '发布' }}</el-button>
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'List',
props: {
instance: Function,
dict: Object
},
data() {
return {
search: {
current: 1,
size: 10,
title: '',
areaId: ''
},
currIndex: -1,
areaList: [],
total: 10,
colConfigs: [
{ prop: 'title', label: '标题', align: 'left', width: '200px' },
{ prop: 'areaName', label: '地区', align: 'center' },
{ prop: 'status', label: '发布状态', align: 'center', formart: v => v === '1' ? '已发布' : '未发布' },
{ prop: 'createUserName', label: '发布人', align: 'center' },
{ prop: 'createDate', label: '发布时间', align: 'center' },
{ slot: 'options', label: '操作', align: 'center' }
],
areaName: '',
unitName: '',
tableData: []
}
},
computed: {
...mapState(['user'])
},
mounted() {
this.search.areaId = this.user.info.areaId
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appcountrysidetourism/list`, null, {
params: {
type: 0,
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
changeStatus (item) {
let title = item.status == '1' ? '是否要取消发布?' : '是否要发布?';
this.$confirm(title, {type: 'warning'}).then(() => {
item.status = item.status == '1' ? '0' : '1'
this.instance.post('/app/appcountrysidetourism/addOrUpdate', item).then(res => {
if (res && res.code == 0) {
title == '是否要发布?' ? this.$message.success('发布成功') : this.$message.success('取消发布成功')
this.getList()
}
})
})
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appcountrysidetourism/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
toAdd(id) {
this.$emit('change', {
type: 'Add',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
.notice {
}
</style>

View File

@@ -0,0 +1,73 @@
<template>
<div class="doc-circulation ailist-wrapper">
<keep-alive :include="['List']">
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component>
</keep-alive>
</div>
</template>
<script>
import List from './components/List'
import Add from './components/Add'
import Detail from './components/Detail'
export default {
name: 'AppVillageRegulations',
label: '村规民约',
props: {
instance: Function,
dict: Object
},
data () {
return {
component: 'List',
params: {},
include: []
}
},
components: {
Add,
List,
Detail
},
mounted () {
},
methods: {
onChange (data) {
if (data.type === 'Add') {
this.component = 'Add'
this.params = data.params
}
if (data.type === 'Detail') {
this.component = 'Detail'
this.params = data.params
}
if (data.type === 'list') {
this.component = 'List'
this.params = data.params
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
}
}
}
}
</script>
<style lang="scss">
.doc-circulation {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,132 @@
<template>
<ai-detail>
<template slot="title">
<ai-title :title="params.id ? '编辑村规民约' : '添加村规民约'" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<el-form :model="form" label-width="120px" ref="form">
<el-form-item label="标题" prop="title" :rules="[{required: true, message: '请输入标题', trigger: 'blur'}]">
<el-input type="input" v-model="form.title" clearable placeholder="请输入..." maxlength="30" show-word-limit></el-input>
</el-form-item>
<el-form-item prop="areaId" label="发布地区" :rules="[{required: true, message: '请选择地区', trigger: 'change'}]">
<ai-area-select clearable always-show :instance="instance" v-model="form.areaId" :disabled-level="disabledLevel"></ai-area-select>
</el-form-item>
<el-form-item label="正文" prop="content" :rules="[{required: true, message: '请输入内容', trigger: 'change'}]">
<ai-editor v-model="form.content" :instance="instance"/>
</el-form-item>
<el-form-item label="缩略图" prop="thumbUrl">
<ai-uploader
:instance="instance"
isShowTip
v-model="form.thumbUrl"
:limit="1"
:cropOps="cropOps"
is-crop>
<template slot="tips">
<p>最多上传1张图片,单个文件最大10MB支持jpgjpegpng格式</p>
<p>图片比例1.61</p>
</template>
</ai-uploader>
</el-form-item>
</el-form>
</template>
</ai-card>
</template>
<template #footer>
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="confirm">提交</el-button>
</template>
</ai-detail>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'Add',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
form: {
title: '',
content: '',
areaId: '',
createUnitName: '',
createUserName: '',
status: '',
thumbUrl: []
},
cropOps: {
width: "336px",
height: "210px"
},
id: ''
}
},
computed: {
...mapState(['user'])
},
created () {
this.form.areaId = this.user.info.areaId
this.disabledLevel = this.user.info.areaList.length
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appcountrysidetourism/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = res.data
this.form.thumbUrl = res.data.thumbUrl ? JSON.parse(res.data.thumbUrl) : []
}
})
},
confirm () {
this.$refs.form.validate((valid) => {
if (valid) {
this.instance.post(`/app/appcountrysidetourism/addOrUpdate`, {
...this.form,
type: 4,
createUserName: this.user.info.name,
thumbUrl: this.form.thumbUrl.length ? JSON.stringify([{
url: this.form.thumbUrl[0].url
}]) : ''
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
setTimeout(() => {
this.cancel(true)
}, 600)
}
})
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'list',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,63 @@
<template>
<ai-detail>
<template slot="title">
<ai-title title="详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
id: ''
}
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appeveryvillagecode/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = res.data
this.form.codeUrl = [{
url: res.data.codeUrl
}]
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'list',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,151 @@
<template>
<ai-list class="notice">
<template slot="title">
<ai-title title="村规民约" isShowBottomBorder isShowArea v-model="search.areaId" :instance="instance" @change="search.current = 1, getList()"></ai-title>
</template>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button>
</template>
<template #right>
<el-input
v-model="search.title"
class="search-input"
size="small"
v-throttle="() => {search.current=1,getList()}"
placeholder="请输入标题"
clearable
@clear="search.current = 1, search.title = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 6px;"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="tags" label="标签">
<template slot-scope="{ row }">
<div class="table-tags">
<el-tag type="info" v-for="(item, index) in row.tags" size="small" :key="index">{{ item }}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column slot="options" width="220px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" :title="row.status == 1 ? '取消发布' : '发布'" @click="changeStatus(row)">{{ row.status == 1 ? '取消发布' : '发布' }}</el-button>
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'List',
props: {
instance: Function,
dict: Object
},
data() {
return {
search: {
current: 1,
size: 10,
title: '',
areaId: ''
},
currIndex: -1,
areaList: [],
total: 10,
colConfigs: [
{ prop: 'title', label: '标题', align: 'left', width: '200px' },
{ prop: 'areaName', label: '地区', align: 'center' },
{ prop: 'status', label: '发布状态', align: 'center', formart: v => v === '1' ? '已发布' : '未发布' },
{ prop: 'createUserName', label: '发布人', align: 'center' },
{ prop: 'createDate', label: '发布时间', align: 'center' },
{ slot: 'options', label: '操作', align: 'center' }
],
areaName: '',
unitName: '',
tableData: []
}
},
computed: {
...mapState(['user'])
},
mounted() {
this.search.areaId = this.user.info.areaId
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appcountrysidetourism/list`, null, {
params: {
type: 4,
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
changeStatus (item) {
let title = item.status == '1' ? '是否要取消发布?' : '是否要发布?';
this.$confirm(title, {type: 'warning'}).then(() => {
item.status = item.status == '1' ? '0' : '1'
this.instance.post('/app/appcountrysidetourism/addOrUpdate', item).then(res => {
if (res && res.code == 0) {
title == '是否要发布?' ? this.$message.success('发布成功') : this.$message.success('取消发布成功')
this.getList()
}
})
})
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appcountrysidetourism/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
toAdd(id) {
this.$emit('change', {
type: 'Add',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
.notice {
}
</style>