整合工程
This commit is contained in:
@@ -1,66 +0,0 @@
|
||||
<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: 'AppBuddyMessage',
|
||||
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>
|
||||
@@ -1,380 +0,0 @@
|
||||
<template>
|
||||
<ai-detail>
|
||||
<template slot="title">
|
||||
<ai-title title="新建欢迎语" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
|
||||
</template>
|
||||
|
||||
<template slot="content">
|
||||
<ai-card>
|
||||
<template #title>
|
||||
<div class="ai-card__title">
|
||||
<h2>基本信息</h2>
|
||||
<span>*一个成员如果被设置了多个欢迎语,将会使用最新设置或修改的欢迎语</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #content>
|
||||
<el-form class="ai-form" :rules="rules" ref="userForm" :model="form" label-width="100px" label-position="right">
|
||||
<el-form-item label="使用成员" prop="users" style="width: 100%">
|
||||
<el-input v-model="users" placeholder="请选择使用成员" disabled style="width: 100%">
|
||||
<template #append>
|
||||
<ai-user-selecter refs="addTags" :instance="instance" v-model="form.users">
|
||||
<el-button size="small">选择</el-button>
|
||||
</ai-user-selecter>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
</ai-card>
|
||||
|
||||
<ai-card title="发送欢迎语">
|
||||
<template #content>
|
||||
<el-form class="ai-form" ref="form" :model="form" label-width="110px" label-position="right">
|
||||
<el-form-item class="el-form-item__textarea" label="文本内容" prop="explain" style="width: 100%">
|
||||
<span @click="insertNickname" class="el-form-item__btn" type="text">[插入居民昵称]</span>
|
||||
<el-input type="textarea" placeholder="请输入…" v-model="form.content" maxlength="1000" :rows="5" show-word-limit></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="其他类型" prop="explain" style="width: 100%">
|
||||
<el-radio-group v-model="form.type" @change="onTypeChange">
|
||||
<el-radio label="image">图片</el-radio>
|
||||
<el-radio label="link">链接</el-radio>
|
||||
<el-radio label="video">视频</el-radio>
|
||||
<el-radio label="miniapp">小程序</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="图片" prop="files" style="width: 100%" v-if="form.type === 'image'">
|
||||
<ai-uploader :instance="instance" isWechat v-model="form.files" :limit="1" url="/app/wxcp/upload/uploadFile?type=image"></ai-uploader>
|
||||
</el-form-item>
|
||||
<el-form-item label="链接" prop="linkUrl" style="width: 100%" v-if="form.type === 'link'">
|
||||
<el-input placeholder="链接地址请以http或https开头" :rows="2" type="textarea" v-model="form.linkUrl"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="链接图片地址" prop="picUrl" style="width: 100%" v-if="form.type === 'link'">
|
||||
<ai-uploader :instance="instance" v-model="form.picUrl" :limit="1"></ai-uploader>
|
||||
</el-form-item>
|
||||
<el-form-item label="链接标题" prop="title" style="width: 100%" v-if="form.type === 'link'">
|
||||
<el-input placeholder="请输入链接标题" v-model="form.title"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频" prop="files" style="width: 100%" v-if="form.type === 'video'">
|
||||
<ai-uploader :instance="instance" fileType="file" isWechat acceptType=".mp4" v-model="form.files" :limit="1" url="/app/wxcp/upload/uploadFile?type=video"></ai-uploader>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="小程序" prop="applets" style="width: 100%" v-if="form.type === 'miniapp'">
|
||||
<el-radio-group v-model="form.applets">
|
||||
<div class="appletss">
|
||||
<div class="applets-item" @click="form.applets = '0'" :class="[form.applets === '0' ? 'applets-active' : '']">
|
||||
<el-radio label="0"></el-radio>
|
||||
<img src="http://www.9665.com/uploadfile/2018/0607/20180607042142312.png">
|
||||
<span>小程序</span>
|
||||
</div>
|
||||
<div class="applets-item" @click="form.applets = '1'" :class="[form.applets === '1' ? 'applets-active' : '']">
|
||||
<el-radio label="1"></el-radio>
|
||||
<img src="http://www.9665.com/uploadfile/2018/0607/20180607042142312.png">
|
||||
<span>小程序</span>
|
||||
</div>
|
||||
<div class="applets-item" @click="form.applets = '2'" :class="[form.applets === '2' ? 'applets-active' : '']">
|
||||
<el-radio label="2"></el-radio>
|
||||
<img src="http://www.9665.com/uploadfile/2018/0607/20180607042142312.png">
|
||||
<span>小程序</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-radio-group>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="小程序标题" prop="title" style="width: 100%" v-if="form.type === 'miniapp'">
|
||||
<el-input placeholder="请输入小程序标题" v-model="form.title"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="小程序APPID" prop="appid" style="width: 100%" v-if="form.type === 'miniapp'">
|
||||
<el-input placeholder="请输入小程序APPID" v-model="form.appid"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="小程序跳转页面" prop="page" style="width: 100%" v-if="form.type === 'miniapp'">
|
||||
<el-input placeholder="如pages/home/Home" v-model="form.page"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="小程序图片" prop="files" style="width: 100%" v-if="form.type === 'miniapp'">
|
||||
<ai-uploader :instance="instance" v-model="form.files" isWechat :limit="1" url="/app/wxcp/upload/uploadFile?type=image"></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>
|
||||
const validateUser = (rule, value, callback) => {
|
||||
if (!value.length) {
|
||||
callback(new Error('请选择使用成员'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
export default {
|
||||
name: 'Add',
|
||||
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
params: Object
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
isShow: false,
|
||||
info: {},
|
||||
form: {
|
||||
users: [],
|
||||
appId: '',
|
||||
page: '',
|
||||
title: '',
|
||||
miniappImg: [],
|
||||
picUrl: [],
|
||||
content: '',
|
||||
files: [],
|
||||
linkUrl: '',
|
||||
isRemind: true,
|
||||
type: 'text'
|
||||
},
|
||||
rules: {
|
||||
users: [
|
||||
{ required: true, message: '请选择使用成员', trigger: 'change' },
|
||||
{ validator: validateUser, trigger: 'change' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
users () {
|
||||
return this.form.users.map(v => v.name).join(',')
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
},
|
||||
|
||||
methods: {
|
||||
getInfo (id) {
|
||||
this.instance.post(`/app/appleavemessage/queryDetailById?id=${id}`).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.info = res.data
|
||||
this.info.appLeaveMessageReplyList = res.data.appLeaveMessageReplyList.map(item => {
|
||||
item.images = JSON.parse(item.images).map(item => {
|
||||
return {
|
||||
...item,
|
||||
url: item.accessUrl
|
||||
}
|
||||
})
|
||||
|
||||
return item
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
validateUser (rule, value, callback) {
|
||||
if (!value.length) {
|
||||
callback(new Error('请选择使用成员'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
|
||||
onClose () {
|
||||
this.form.explain = ''
|
||||
},
|
||||
|
||||
onTypeChange () {
|
||||
this.form.files = []
|
||||
this.form.picUrl = []
|
||||
this.form.appId = ''
|
||||
this.form.page = ''
|
||||
this.form.title = ''
|
||||
this.form.miniappImg = []
|
||||
this.form.linkUrl = ''
|
||||
},
|
||||
|
||||
insertNickname () {
|
||||
this.form.content = this.form.content + '[用户昵称]'
|
||||
},
|
||||
|
||||
onChange () {
|
||||
|
||||
},
|
||||
|
||||
confirm () {
|
||||
this.$refs.userForm.validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.type === 'text' && !this.form.content) {
|
||||
return this.$message.error('请输入消息内容')
|
||||
}
|
||||
|
||||
if (this.form.type === 'image' && !this.form.files.length) {
|
||||
return this.$message.error('请上传图片')
|
||||
}
|
||||
// if (this.form.type === 'file' && !this.form.files.length) {
|
||||
// return this.$message.error('请上传附件')
|
||||
// }
|
||||
if (this.form.type === 'video' && !this.form.files.length) {
|
||||
return this.$message.error('请上传视频')
|
||||
}
|
||||
if (this.form.type === 'link' && !this.form.linkUrl) {
|
||||
return this.$message.error('请输入链接')
|
||||
}
|
||||
if (this.form.type === 'link' && !this.form.picUrl.length) {
|
||||
return this.$message.error('请输入链接图片')
|
||||
}
|
||||
if (this.form.type === 'link' && !this.form.title) {
|
||||
return this.$message.error('请输入链接标题')
|
||||
}
|
||||
if (this.form.type === 'miniapp' && !this.form.title) {
|
||||
return this.$message.error('请输入小程序标题')
|
||||
}
|
||||
if (this.form.type === 'miniapp' && !this.form.appid) {
|
||||
return this.$message.error('请输入小程序appid')
|
||||
}
|
||||
if (this.form.type === 'miniapp' && !this.form.page) {
|
||||
return this.$message.error('请输入小程序page')
|
||||
}
|
||||
if (this.form.type === 'miniapp' && !this.form.files.length) {
|
||||
return this.$message.error('请上传小程序图片')
|
||||
}
|
||||
|
||||
this.instance.post(`/app/wxcp/wxwelcomeword/add`, {
|
||||
type: '1',
|
||||
content: this.form.content || '',
|
||||
isNotify: '0',
|
||||
media: {
|
||||
createdAt: this.form.files.length ? this.form.files[0].media.createdAt : '',
|
||||
file: this.form.files.length ? this.form.files[0] : {},
|
||||
mediaId: this.form.files.length ? this.form.files[0].media.mediaId : '',
|
||||
sysFileId: this.form.files.length ? this.form.files[0].id : '',
|
||||
type: this.form.type,
|
||||
linkUrl: this.form.type === 'link' && this.form.linkUrl ? this.form.linkUrl : '',
|
||||
title: this.form.title,
|
||||
appId: this.form.appid,
|
||||
page: this.form.page,
|
||||
picUrl: this.form.type === 'link' ? this.form.picUrl[0].url : ''
|
||||
},
|
||||
users: this.form.users.map(item => {
|
||||
return {
|
||||
type: 0,
|
||||
objectId: item.id,
|
||||
objectName: item.name
|
||||
}
|
||||
})
|
||||
}).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">
|
||||
.ai-card__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
h2 {
|
||||
margin-right: 20px;
|
||||
color: #222222;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
span {
|
||||
color: #888888;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.appletss {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.applets-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 400px;
|
||||
height: 60px;
|
||||
margin-right: 8px;
|
||||
margin-bottom: 8px;
|
||||
padding: 0 17px;
|
||||
background: #FFFFFF;
|
||||
border-radius: 2px;
|
||||
border: 1px solid #D0D4DC;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
border-color: #2266FF;
|
||||
}
|
||||
|
||||
:deep( ){
|
||||
.el-radio__label {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
img {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin: 0 8px 0 13px;
|
||||
}
|
||||
|
||||
span {
|
||||
color: #222222;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.el-radio {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&.applets-active {
|
||||
border-color: #2266FF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tips {
|
||||
position: relative;
|
||||
top: 2px;
|
||||
padding-left: 8px;
|
||||
color: #222222;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.el-form-item-item__textarea {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.el-form-item__btn {
|
||||
position: absolute;
|
||||
bottom: 12px;
|
||||
left: 12px;
|
||||
line-height: 1;
|
||||
z-index: 1;
|
||||
color: #2266FF;
|
||||
font-size: 14px;
|
||||
user-select: none;
|
||||
background: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -1,235 +0,0 @@
|
||||
<template>
|
||||
<ai-list class="message">
|
||||
<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">
|
||||
</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="type" width="240px" label="消息内容" align="center">
|
||||
<template slot-scope="{ row }">
|
||||
<el-popover
|
||||
placement="bottom"
|
||||
width="400"
|
||||
:visible-arrow="false"
|
||||
popper-class="wechat-message__container"
|
||||
trigger="hover">
|
||||
<div class="count" slot="reference">共{{ row.count }}条</div>
|
||||
<div class="message-info">
|
||||
<h2 v-if="row.content" :style="{marginBottom: row.media ? '16px' : '0'}">{{ row.content }}</h2>
|
||||
<div class="message-info__wrapper" v-if="row.media && (row.media.file || row.media.type === 'link')">
|
||||
<img v-if="row.media.type === 'image' || row.media.type === 'miniapp'" :src="row.media.file.url">
|
||||
<video v-if="row.media.type === 'video'" :src="row.media.file.url"></video>
|
||||
<img v-if="row.media.type === 'link'" :src="row.media.picUrl">
|
||||
<div class="message-info__wrapper--right">
|
||||
<h3 v-if="row.media.type === 'miniapp'">{{ row.media.title }}</h3>
|
||||
<h3 v-if="row.media.type === 'image'">{{ row.media.file.name }}</h3>
|
||||
<h3 v-if="row.media.type === 'link'">{{ row.media.linkUrl }}</h3>
|
||||
<h3 v-if="row.media.type === 'video'">{{ row.media.file.name }}</h3>
|
||||
<p v-if="row.media.type === 'image'">{{ row.media.file.fileSizeStr }}</p>
|
||||
<p v-if="row.media.type === 'link'">{{ row.media.title }}</p>
|
||||
<p v-if="row.media.type === 'video'">{{ row.media.file.fileSizeStr }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-popover>
|
||||
</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" disabled @click="toAdd(row.id)" title="编辑">编辑</el-button> -->
|
||||
<el-button type="text" @click="remove(row.id)" title="删除">删除</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,
|
||||
size: 10,
|
||||
content: ''
|
||||
},
|
||||
currIndex: 0,
|
||||
total: 10,
|
||||
colConfigs: [
|
||||
{ prop: 'type', label: '类型', align: 'left', width: '160',
|
||||
render: (h, params) => {
|
||||
let str = ''
|
||||
|
||||
if (params.row.content) {
|
||||
str = '文字'
|
||||
}
|
||||
|
||||
if (params.row.media && params.row.media.type === 'link') {
|
||||
str += this.dict.getLabel('wxMsgType', params.row.media.type) ? (params.row.content ? '+' : '') + this.dict.getLabel('wxMsgType', params.row.media.type) : ''
|
||||
}
|
||||
|
||||
if (params.row.media && params.row.media.file) {
|
||||
str += this.dict.getLabel('wxMsgType', params.row.media.type) ? (params.row.content ? '+' : '') + this.dict.getLabel('wxMsgType', params.row.media.type) : ''
|
||||
}
|
||||
|
||||
return h('span', {
|
||||
style: {
|
||||
}
|
||||
}, str)
|
||||
}
|
||||
},
|
||||
{ slot: 'type' },
|
||||
{ prop: 'users', label: '使用成员', align: 'left', format: v => v.join(';') },
|
||||
{ prop: 'createUser', label: '创建人' },
|
||||
{ prop: 'createTime', label: '编辑时间' },
|
||||
{ slot: 'options', label: '操作' }
|
||||
],
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
|
||||
mounted () {
|
||||
this.dict.load(['wxMsgType']).then(() => {
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
getList() {
|
||||
this.instance.post(`/app/wxcp/wxwelcomeword/list`, null, {
|
||||
params: {
|
||||
...this.search
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.tableData = res.data.records.map(item => {
|
||||
let count = 0
|
||||
|
||||
if (item.content) {
|
||||
count = count + 1
|
||||
}
|
||||
|
||||
if (item.media && item.media.type !== 'text') {
|
||||
count = count + 1
|
||||
}
|
||||
|
||||
item.count = count
|
||||
return item
|
||||
})
|
||||
this.total = res.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
remove (id) {
|
||||
this.$confirm('确定删除该数据?').then(() => {
|
||||
this.instance.post(`/app/wxcp/wxwelcomeword/delete?id=${id}`).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('删除成功!')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
toAdd (id) {
|
||||
this.$emit('change', {
|
||||
type: 'Add',
|
||||
params: {
|
||||
id
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.message {
|
||||
.count {
|
||||
cursor: pointer;
|
||||
color: #2266FF;
|
||||
font-size: 14px;
|
||||
|
||||
&:hover {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.message-info {
|
||||
padding: 8px;
|
||||
min-height: 116px;
|
||||
|
||||
h2 {
|
||||
color: #222222;
|
||||
font-weight: 500;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.message-info__wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 368px;
|
||||
height: 60px;
|
||||
padding: 10px;
|
||||
background: #FFFFFF;
|
||||
border-radius: 2px;
|
||||
border: 1px solid #D0D4DC;
|
||||
|
||||
.message-info__wrapper--right {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
h3 {
|
||||
width: 100%;
|
||||
color: #222222;
|
||||
font-size: 14px;
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
white-space: nowrap;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
img, video {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin-right: 10px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 6px;
|
||||
font-size: 14px;
|
||||
color: #888888;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,47 +0,0 @@
|
||||
<template>
|
||||
<div class="doc-circulation ailist-wrapper">
|
||||
<keep-alive :include="['List']">
|
||||
<component ref="component" :is="component" :instance="instance" :dict="dict"></component>
|
||||
</keep-alive>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import List from './components/List'
|
||||
|
||||
export default {
|
||||
name: 'AppMaterialLibrary',
|
||||
label: '素材库',
|
||||
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
component: 'List',
|
||||
params: {},
|
||||
include: []
|
||||
}
|
||||
},
|
||||
|
||||
components: {
|
||||
List
|
||||
},
|
||||
|
||||
mounted () {
|
||||
},
|
||||
|
||||
methods: {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.doc-circulation {
|
||||
height: 100%;
|
||||
background: #F3F6F9;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
@@ -1,212 +0,0 @@
|
||||
<template>
|
||||
<div id="ChooseMaterial">
|
||||
<ai-dialog
|
||||
:visible.sync="isShow"
|
||||
width="890px"
|
||||
@onConfirm="onConfirm"
|
||||
title="选择素材">
|
||||
<div class="AppMaterialLibrary-title">
|
||||
<span
|
||||
v-for="(item, index) in typeList"
|
||||
:key="index"
|
||||
:class="[currIndex === index ? 'active' : '']" @click="currIndex = index, search.current = 1, getList()">
|
||||
{{ item }}
|
||||
</span>
|
||||
</div>
|
||||
<ai-search-bar class="search-bar">
|
||||
<template #left>
|
||||
</template>
|
||||
<template slot="right">
|
||||
<el-input
|
||||
v-model="search.title"
|
||||
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; width: 100%;"
|
||||
:current.sync="search.current"
|
||||
:size.sync="search.size"
|
||||
@selection-change="v=> ids = v.map((e) => e.id)"
|
||||
@getList="getList">
|
||||
</ai-table>
|
||||
</ai-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'ChooseMaterial',
|
||||
|
||||
props: {
|
||||
instance: Function
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
search: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
title: '',
|
||||
},
|
||||
ids: [],
|
||||
isShow: false,
|
||||
id: '',
|
||||
typeList: ['话术', '图片', '小程序', '文件', '视频', '网页'],
|
||||
currIndex: 0,
|
||||
tableData: [],
|
||||
total: 0
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
mpTitle () {
|
||||
return {
|
||||
'0': '话术标题',
|
||||
'1': '图片名称',
|
||||
'2': '小程序标题',
|
||||
'3': '文件名称',
|
||||
'4': '视频名称',
|
||||
'5': '网页名称'
|
||||
}[this.currIndex]
|
||||
},
|
||||
|
||||
colConfigs () {
|
||||
if (this.currIndex === 0) {
|
||||
return [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'title', label: this.mpTitle },
|
||||
{ prop: 'content', label: '话术内容', align: 'center' },
|
||||
{ prop: 'createUserName', label: '添加人', align: 'center' },
|
||||
{ prop: 'createTime', label: '添加时间', align: 'center' }
|
||||
]
|
||||
}
|
||||
|
||||
if (this.currIndex === 2) {
|
||||
return [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'title', label: this.mpTitle },
|
||||
{ prop: 'appId', label: '小程序APPID', align: 'center' },
|
||||
{ prop: 'createUserName', label: '添加人', align: 'center' },
|
||||
{ prop: 'createTime', label: '添加时间', align: 'center' }
|
||||
]
|
||||
}
|
||||
|
||||
if (this.currIndex === 5) {
|
||||
return [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'title', label: this.mpTitle },
|
||||
{ prop: 'pagePath', label: '外链网页', align: 'center' },
|
||||
{ prop: 'createUserName', label: '添加人', align: 'center' },
|
||||
{ prop: 'createTime', label: '添加时间', align: 'center' }
|
||||
]
|
||||
}
|
||||
|
||||
return [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'title', label: this.mpTitle },
|
||||
{ prop: 'fileSizeStr', label: '文件大小', align: 'center' },
|
||||
{ prop: 'createUserName', label: '添加人', align: 'center' },
|
||||
{ prop: 'createTime', label: '添加时间', align: 'center' }
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
this.getList()
|
||||
},
|
||||
|
||||
methods: {
|
||||
getList() {
|
||||
this.instance.post(`/app/appmaterialinfo/list`, null, {
|
||||
params: {
|
||||
...this.search,
|
||||
type: this.currIndex
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onConfirm () {
|
||||
if (!this.ids.length) {
|
||||
return this.$message.error('请选择素材')
|
||||
}
|
||||
|
||||
if (this.ids.length > 1) {
|
||||
return this.$message.error('素材不能多选')
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
open () {
|
||||
this.isShow = true
|
||||
},
|
||||
|
||||
close () {
|
||||
this.isShow = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
#ChooseMaterial {
|
||||
:deep( .ai-list__content--right-wrapper ) {
|
||||
padding: 0 20px!important;
|
||||
}
|
||||
|
||||
:deep( .el-dialog__header ) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep( .el-dialog__body ) {
|
||||
padding-top: 0!important;
|
||||
}
|
||||
|
||||
.AppMaterialLibrary-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
border-bottom: 1px solid #eee;
|
||||
|
||||
span {
|
||||
height: 100%;
|
||||
line-height: 56px;
|
||||
margin-right: 32px;
|
||||
color: #888888;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
transition: all ease 0.3s;
|
||||
border-bottom: 3px solid transparent;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
|
||||
&:hover {
|
||||
color: #222;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: #222222;
|
||||
border-bottom: 3px solid #2266FF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,394 +0,0 @@
|
||||
<template>
|
||||
<ai-list id="AppMaterialLibrary">
|
||||
<template slot="title">
|
||||
<ai-title title="素材管理" isShowBottomBorder>
|
||||
<template #sub>
|
||||
<span>可在聊天素材、宣发工具中选择素材发送给居民,提升服务效率;其中文件、视频和网页素材支持记录居民查看行为</span>
|
||||
</template>
|
||||
</ai-title>
|
||||
</template>
|
||||
<template slot="content">
|
||||
<div class="AppMaterialLibrary-title">
|
||||
<span
|
||||
v-for="(item, index) in typeList"
|
||||
:key="index"
|
||||
:class="[currIndex === index ? 'active' : '']" @click="currIndex = index, search.current = 1, getList()">
|
||||
{{ item }}
|
||||
</span>
|
||||
</div>
|
||||
<ai-search-bar class="search-bar">
|
||||
<template #left>
|
||||
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="isShow = true">添加{{ typeList[currIndex] }}</el-button>
|
||||
</template>
|
||||
<template slot="right">
|
||||
<el-input
|
||||
v-model="search.title"
|
||||
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; width: 100%;"
|
||||
:current.sync="search.current"
|
||||
:size.sync="search.size"
|
||||
@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="id = row.id, toAdd(row)">编辑</el-button>
|
||||
<el-button type="text" @click="remove(row.id)">删除</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
<ai-dialog
|
||||
:visible.sync="isShow"
|
||||
width="920px"
|
||||
:title="(id ? '编辑' : '添加') + typeList[currIndex]"
|
||||
@close="onClose"
|
||||
:close-on-click-modal="false"
|
||||
destroy-on-close
|
||||
@onConfirm="confirm">
|
||||
<el-form ref="form" v-if="isShow" :model="form" label-width="130px" label-position="right">
|
||||
<div class="ai-form">
|
||||
<el-form-item v-if="currIndex === 0" label="话术标题" style="width: 100%;" prop="title" :rules="[{ required: true, message: '请输入话术标题', trigger: 'blur' }]">
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="请输入话术标题"
|
||||
maxlength="42"
|
||||
show-word-limit
|
||||
v-model="form.title">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currIndex === 0" label="话术内容" style="width: 100%;" prop="content" :rules="[{ required: true, message: '请输入话术内容', trigger: 'blur' }]">
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="请输入话术内容"
|
||||
maxlength="682"
|
||||
show-word-limit
|
||||
v-model="form.content">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currIndex === 1" label="图片名称" style="width: 100%;" prop="title" :rules="[{ required: true, message: '请输入图片名称', trigger: 'blur' }]">
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="请输入图片名称"
|
||||
maxlength="42"
|
||||
show-word-limit
|
||||
v-model="form.title">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currIndex === 1" label="上传图片" style="width: 100%;" prop="fileUrl" :rules="[{ required: true, message: '请上传', trigger: 'change' }]">
|
||||
<ai-uploader :instance="instance" url="/admin/file/add3?type=image" v-model="form.fileUrl" :limit="1"></ai-uploader>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currIndex === 3" label="文件名称" style="width: 100%;" prop="title" :rules="[{ required: true, message: '请输入文件名称', trigger: 'blur' }]">
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="请输入图片名称"
|
||||
maxlength="42"
|
||||
show-word-limit
|
||||
v-model="form.title">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currIndex === 3" label="上传文件" style="width: 100%;" prop="fileUrl" :rules="[{ required: true, message: '请上传', trigger: 'change' }]">
|
||||
<ai-uploader fileType="file" url="/admin/file/add3?type=file" :instance="instance" v-model="form.fileUrl" :limit="1"></ai-uploader>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currIndex === 4" label="视频标题" style="width: 100%;" prop="title" :rules="[{ required: true, message: '请输入视频标题', trigger: 'blur' }]">
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="请输入视频标题"
|
||||
maxlength="42"
|
||||
show-word-limit
|
||||
v-model="form.title">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currIndex === 4" label="上传视频" style="width: 100%;" prop="fileUrl" :rules="[{ required: true, message: '请上传', trigger: 'change' }]">
|
||||
<ai-uploader :instance="instance" url="/admin/file/add3?type=video" fileType="file" v-model="form.fileUrl" :limit="1"></ai-uploader>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currIndex === 4" label="视频封面图" prop="pictureUrl" style="width: 100%;" :rules="[{ required: true, message: '请上传视频封面图', trigger: 'change' }]">
|
||||
<ai-uploader :instance="instance" url="/admin/file/add3?type=image" v-model="form.pictureUrl" :limit="1"></ai-uploader>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currIndex === 4" label="视频描述" style="width: 100%;" prop="content" :rules="[{ required: true, message: '请输入视频描述', trigger: 'blur' }]">
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="请输入视频描述"
|
||||
maxlength="682"
|
||||
show-word-limit
|
||||
v-model="form.content">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currIndex === 5" label="网页标题" style="width: 100%;" prop="title" :rules="[{ required: true, message: '请输入网页标题', trigger: 'blur' }]">
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="请输入网页标题"
|
||||
maxlength="42"
|
||||
show-word-limit
|
||||
v-model="form.title">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currIndex === 5" label="网页链接" style="width: 100%;" prop="pagePath" :rules="[{ required: true, message: '请输入网页链接链接', trigger: 'blur' }]">
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="请输入网页链接链接"
|
||||
maxlength="682"
|
||||
show-word-limit
|
||||
v-model="form.pagePath">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.currIndex === 5" label="网页描述" style="width: 100%;" prop="content">
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="请输入网页描述"
|
||||
maxlength="170"
|
||||
show-word-limit
|
||||
v-model="form.content">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currIndex === 5" label="网页封面图" prop="pictureUrl" style="width: 100%;" :rules="[{ required: true, message: '请上传封面图', trigger: 'change' }]">
|
||||
<ai-uploader :instance="instance" url="/admin/file/add3?type=image" v-model="form.pictureUrl" :limit="1"></ai-uploader>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currIndex === 2" label="小程序标题" style="width: 100%;" prop="title" :rules="[{ required: true, message: '请输入小程序标题', trigger: 'blur' }]">
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="请输入小程序标题"
|
||||
maxlength="20"
|
||||
show-word-limit
|
||||
v-model="form.title">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currIndex === 2" label="小程序appid" style="width: 100%;" prop="appId" :rules="[{ required: true, message: '小程序appid', trigger: 'blur' }]">
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="小程序appid"
|
||||
v-model="form.appId">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currIndex === 2" label="小程序路径" style="width: 100%;" prop="pagePath" :rules="[{ required: true, message: '请输入小程序路径', trigger: 'blur' }]">
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="请输入小程序page路径"
|
||||
v-model="form.pagePath">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currIndex === 2" label="小程序封面图" prop="pictureUrl" style="width: 100%;" :rules="[{ required: true, message: '请上传封面图', trigger: 'change' }]">
|
||||
<ai-uploader :instance="instance" url="/admin/file/add3?type=image" v-model="form.pictureUrl" :limit="1"></ai-uploader>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
</ai-dialog>
|
||||
</template>
|
||||
</ai-list>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'List',
|
||||
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
search: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
title: '',
|
||||
},
|
||||
isShow: false,
|
||||
form: {
|
||||
appId: '',
|
||||
content: '',
|
||||
fileUrl: [],
|
||||
pagePath: '',
|
||||
pictureUrl: [],
|
||||
title: ''
|
||||
},
|
||||
id: '',
|
||||
typeList: ['话术', '图片', '小程序', '文件', '视频', '网页'],
|
||||
currIndex: 0,
|
||||
tableData: [],
|
||||
total: 0
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
mpTitle () {
|
||||
return {
|
||||
'0': '话术标题',
|
||||
'1': '图片名称',
|
||||
'2': '小程序标题',
|
||||
'3': '文件名称',
|
||||
'4': '视频名称',
|
||||
'5': '网页名称'
|
||||
}[this.currIndex]
|
||||
},
|
||||
|
||||
colConfigs () {
|
||||
if (this.currIndex === 0) {
|
||||
return [
|
||||
{ prop: 'title', label: this.mpTitle },
|
||||
{ prop: 'content', label: '话术内容', align: 'center' },
|
||||
{ prop: 'createUserName', label: '添加人', align: 'center' },
|
||||
{ prop: 'createTime', label: '添加时间', align: 'center' }
|
||||
]
|
||||
}
|
||||
|
||||
if (this.currIndex === 2) {
|
||||
return [
|
||||
{ prop: 'title', label: this.mpTitle },
|
||||
{ prop: 'appId', label: '小程序APPID', align: 'center' },
|
||||
{ prop: 'createUserName', label: '添加人', align: 'center' },
|
||||
{ prop: 'createTime', label: '添加时间', align: 'center' }
|
||||
]
|
||||
}
|
||||
|
||||
if (this.currIndex === 5) {
|
||||
return [
|
||||
{ prop: 'title', label: this.mpTitle },
|
||||
{ prop: 'pagePath', label: '外链网页', align: 'center' },
|
||||
{ prop: 'createUserName', label: '添加人', align: 'center' },
|
||||
{ prop: 'createTime', label: '添加时间', align: 'center' }
|
||||
]
|
||||
}
|
||||
|
||||
return [
|
||||
{ prop: 'title', label: this.mpTitle },
|
||||
{ prop: 'fileSizeStr', label: '文件大小', align: 'center' },
|
||||
{ prop: 'createUserName', label: '添加人', align: 'center' },
|
||||
{ prop: 'createTime', label: '添加时间', align: 'center' }
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
this.getList()
|
||||
},
|
||||
|
||||
methods: {
|
||||
getList() {
|
||||
this.instance.post(`/app/appmaterialinfo/list`, null, {
|
||||
params: {
|
||||
...this.search,
|
||||
type: this.currIndex
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
toAdd (e) {
|
||||
this.form = {
|
||||
...this.form,
|
||||
...e,
|
||||
fileUrl: e.fileUrl ? [{
|
||||
url: e.fileUrl
|
||||
}] : '',
|
||||
pictureUrl: e.pictureUrl ? [{
|
||||
url: e.pictureUrl
|
||||
}] : ''
|
||||
}
|
||||
|
||||
this.isShow = true
|
||||
},
|
||||
|
||||
onClose () {
|
||||
this.form.content = ''
|
||||
this.form.appId = ''
|
||||
this.form.fileUrl = []
|
||||
this.form.pagePath = ''
|
||||
this.form.pictureUrl = []
|
||||
this.form.title = ''
|
||||
|
||||
this.id = ''
|
||||
},
|
||||
|
||||
confirm () {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.instance.post(`/app/appmaterialinfo/addOrUpdate`, {
|
||||
...this.form,
|
||||
type: this.currIndex,
|
||||
fileUrl: this.form.fileUrl.length ? this.form.fileUrl[0].url : '',
|
||||
fileId: this.form.fileUrl.length ? this.form.fileUrl[0].id : '',
|
||||
pictureId: this.form.pictureUrl.length ? this.form.pictureUrl[0].id : '',
|
||||
pictureUrl: this.form.pictureUrl.length ? this.form.pictureUrl[0].url : '',
|
||||
fileSize: this.form.fileUrl.length ? this.form.fileUrl[0].fileSize : '',
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('提交成功')
|
||||
this.isShow = false
|
||||
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
remove (id) {
|
||||
this.$confirm('确定删除该数据?').then(() => {
|
||||
this.instance.post(`/app/appmaterialinfo/delete?ids=${id}`).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('删除成功!')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
#AppMaterialLibrary {
|
||||
:deep( .ai-list__content--right-wrapper ) {
|
||||
padding: 0 20px!important;
|
||||
}
|
||||
|
||||
.AppMaterialLibrary-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
border-bottom: 1px solid #eee;
|
||||
|
||||
span {
|
||||
height: 100%;
|
||||
line-height: 56px;
|
||||
margin-right: 32px;
|
||||
color: #888888;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
transition: all ease 0.3s;
|
||||
border-bottom: 3px solid transparent;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
|
||||
&:hover {
|
||||
color: #222;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: #222222;
|
||||
border-bottom: 3px solid #2266FF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,617 +0,0 @@
|
||||
<template>
|
||||
<section style="height: 100%;">
|
||||
<ai-list>
|
||||
<template slot="title">
|
||||
<ai-title title="话术库" :isShowBottomBorder="true"></ai-title>
|
||||
</template>
|
||||
<template #left>
|
||||
<div class="left-tree">
|
||||
<div class="tree-title">
|
||||
<label>分组</label>
|
||||
<el-button icon="iconfont iconAdd" style="height: 28px;line-height: 0;" @click="groupDialog = true">添加分组
|
||||
</el-button>
|
||||
</div>
|
||||
<el-scrollbar style="height: calc(100% - 40px)">
|
||||
<el-menu style="height: 100%;" default-active="0" active-text-color="#26f" text-color="#222"
|
||||
mode="vertical">
|
||||
<el-menu-item v-for="(item, index) in sortList" :key="index" class="menu-item" @click="currentMenu(item)"
|
||||
:index="index.toString()">
|
||||
<label class="item-title">{{ item.name }}</label>
|
||||
<el-popover style="width: 30px" placement="left" trigger="click">
|
||||
<div style="display: flex;flex-direction: column;align-items: center;">
|
||||
<div style="cursor: pointer;" @click="editGroup(item, index)">编辑</div>
|
||||
<div style="cursor: pointer;" @click="delteGroup(item, index)">删除</div>
|
||||
</div>
|
||||
<span class="iconfont iconMore" slot="reference"></span>
|
||||
</el-popover>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</template>
|
||||
<template slot="content">
|
||||
<ai-search-bar>
|
||||
<template slot="left">
|
||||
<el-select v-model="search.contentType" placeholder="类型" size="small" clearable @change="getList()">
|
||||
<el-option v-for="(item, index) in types" :key="index" :label="item.name" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
<template slot="right">
|
||||
<el-input v-model="search.title" class="search-input" size="small"
|
||||
@keyup.enter.native=";(search.current = 1), getList()" placeholder="请输入标题或话术内容或创建人" clearable
|
||||
@clear=";(search.current = 1), (search.title = ''), getList()" suffix-icon="iconfont iconSearch"/>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-search-bar>
|
||||
<template slot="left">
|
||||
<el-button icon="iconfont iconAdd" type="primary" @click="add">添加话术</el-button>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table :tableData="tableData" :col-configs="colConfigs" :stripe="true" :total="total" ref="aitableex"
|
||||
style="margin-top: 8px;" :current.sync="search.current" :size.sync="search.size" @getList="getList">\
|
||||
|
||||
<el-table-column slot="content" label="话术内容" align="left" width="280">
|
||||
<template slot-scope="{ row }">
|
||||
<div class="table-left__wrapper">
|
||||
<video :src="row.file && row.file.url" v-if="row.file && row.contentType == 'video'"
|
||||
class="media"></video>
|
||||
<img :src="row.file && row.file.url" v-if="row.file && row.contentType == 'image'" class="media"/>
|
||||
<audio :src="row.file && row.file.url" v-if="row.file && row.contentType == 'voice'"
|
||||
class="media"></audio>
|
||||
<div class="table-left__wrapper--right">
|
||||
<el-tooltip class="item" effect="dark" :content="row.content" placement="top">
|
||||
<div class="table-left__wrapper--text" v-if="row.contentType == 'text'">{{ row.content }}</div>
|
||||
</el-tooltip>
|
||||
<div class="ellipsis" v-if="row.contentType !== 'text' && row.file && row.file.name">{{ row.file.name }}</div>
|
||||
<div v-if="row.contentType !== 'text' && row.file && row.file.size">{{ row.file.size | size }}KB</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column slot="options" label="操作" width="160px" align="center" fixed="right">
|
||||
<template slot-scope="{ row }">
|
||||
<span class="table-btn" title="编辑" @click="editTrick(row)">编辑</span>
|
||||
<span class="table-btn" title="删除" @click="deleteTrick(row)">删除</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
</template>
|
||||
</ai-list>
|
||||
<ai-dialog :visible.sync="groupDialog" @closed="sortForm = {},sortForm.type=1" width="800px" title="添加分组"
|
||||
@onConfirm="onConfirm">
|
||||
<el-form size="small" label-width="100px" ref="groupForm" :model="sortForm" :rules="sortRules">
|
||||
<el-form-item label="分组名称" prop="name">
|
||||
<el-input clearable v-model.trim="sortForm.name" placeholder="请输入..." :maxlength="10" show-word-limit/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="可见范围" prop="type">-->
|
||||
<!-- <el-radio-group v-model="sortForm.type">-->
|
||||
<!-- <el-radio label="0">个人话术</el-radio>-->
|
||||
<!-- <el-radio label="1">公共话术</el-radio>-->
|
||||
<!-- </el-radio-group>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="可用部门" prop="documentName">-->
|
||||
<!-- <el-row type="flex">-->
|
||||
<!-- <div class="input"></div>-->
|
||||
<!-- <ai-person-select :instance="instance" url="/app/appvillagecadres/list" :isMultiple="true"-->
|
||||
<!-- btnText="选择" dialogTitle="选择">-->
|
||||
<!-- <template name="option" v-slot:option="{ item }">-->
|
||||
<!-- <span class="iconfont iconProlife">{{ item.name }}</span>-->
|
||||
<!-- <ai-id mode="show" :show-eyes="false" :value="item.idNumber"/>-->
|
||||
<!-- </template>-->
|
||||
<!-- </ai-person-select>-->
|
||||
<!-- </el-row>-->
|
||||
<!-- </el-form-item>-->
|
||||
</el-form>
|
||||
</ai-dialog>
|
||||
|
||||
<ai-dialog :visible.sync="trickDialog" @close="onClose" @onConfirm="trickConfirm" width="800px" title="添加话术">
|
||||
<el-form size="small" label-width="100px" ref="trickFom" :model="trickForm" :rules="trickRules">
|
||||
<!-- <el-form-item label="分组" prop="handleResult">-->
|
||||
<!-- <ai-select-->
|
||||
<!-- v-model="search.type"-->
|
||||
<!-- @change="search.current = 1, getList()"-->
|
||||
<!-- placeholder="类型"-->
|
||||
<!-- :selectList="sortList"-->
|
||||
<!-- ></ai-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input clearable placeholder="请输入..." v-model="trickForm.title" show-word-limit :maxlength="20"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="话术类型" prop="contentType">
|
||||
<el-radio-group v-model="trickForm.contentType" @change="onChange">
|
||||
<el-radio :label="item.value" v-for="(item, index) in types" :key="index">{{ item.name }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="文本内容" class="el-form-item__textarea" prop="content" v-if="trickForm.contentType == 'text'">
|
||||
<span @click="insertNickname" class="el-form-item__btn" type="text">[插入用户昵称]</span>
|
||||
<span @click="insertRemark" class="el-form-item__remark" type="text">[插入备注名]</span>
|
||||
<el-input type="textarea" v-model="trickForm.content" placeholder="请输入..." :rows="5" show-word-limit
|
||||
:maxlength="255"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="compLabel" prop="fileId" v-else>
|
||||
<ai-uploader :instance="instance" v-model="fileList" :acceptType="acceptType"
|
||||
:url="'/app/wxcp/upload/uploadFile?type=' + trickForm.contentType" isWechat :fileType="fileType"
|
||||
:limit="1" @change="change"></ai-uploader>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ai-dialog>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState} from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'AppVerbalTrick',
|
||||
label: '话术库',
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
permissions: Function,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
groupDialog: false,
|
||||
trickDialog: false,
|
||||
search: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
contentType: '',
|
||||
},
|
||||
sortForm: {
|
||||
name: '',
|
||||
type: '1',
|
||||
},
|
||||
trickForm: {
|
||||
title: '',
|
||||
contentType: 'text',
|
||||
content: '',
|
||||
fileId: '',
|
||||
mediaId: '',
|
||||
},
|
||||
row: {},
|
||||
current: {},
|
||||
sortList: [],
|
||||
total: 0,
|
||||
tableData: [],
|
||||
fileList: [],
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
acceptType() {
|
||||
return {
|
||||
"image": ".jpg,.png,.jpeg",
|
||||
"video": ".mp4"
|
||||
}[this.trickForm.contentType]
|
||||
},
|
||||
compLabel() {
|
||||
return this.types.find((e) => e.value == this.trickForm.contentType)?.name
|
||||
},
|
||||
fileType() {
|
||||
return this.trickForm.contentType == 'image' ? 'img' : 'file'
|
||||
},
|
||||
types() {
|
||||
return [
|
||||
{name: '文本', value: 'text'},
|
||||
{name: '图片', value: 'image'},
|
||||
{name: '视频', value: 'video'},
|
||||
// // {name: "附件", value: "file"},
|
||||
// {name: "音频", value: "voice"},
|
||||
]
|
||||
},
|
||||
trickRules() {
|
||||
return {
|
||||
title: [{required: true, message: '请输入标题', trigger: 'blur'}],
|
||||
contentType: [{required: true, message: '请选择话术类型', trigger: 'change'}],
|
||||
content: [{required: true, validator: (rule, value, callback)=>{
|
||||
if(this.trickForm.contentType == 'text' && !value){
|
||||
return callback("请输入文本内容")
|
||||
}else {
|
||||
callback()
|
||||
}
|
||||
}}],
|
||||
fileId: [{required: true, validator: (rule, value, callback)=>{
|
||||
if(this.trickForm.contentType != 'text' && !value){
|
||||
return callback("请上传文件")
|
||||
}else {
|
||||
callback()
|
||||
}
|
||||
}}],
|
||||
}
|
||||
},
|
||||
// message() {
|
||||
// return (() => {
|
||||
// if (this.trickForm.contentType == 'text') {
|
||||
// return '请输入文本内容'
|
||||
// } else if (this.trickForm.contentType == 'image') {
|
||||
// return '请上传图片'
|
||||
// } else if (this.trickForm.contentType == 'file') {
|
||||
// return '请上传文件'
|
||||
// } else if (this.trickForm.contentType == 'video') {
|
||||
// return '请上传视频'
|
||||
// } else if (this.trickForm.contentType == 'voice') {
|
||||
// return '请上传音频'
|
||||
// }
|
||||
// })()
|
||||
// },
|
||||
sortRules() {
|
||||
return {
|
||||
name: [{required: true, message: '请输入分组名称', trigger: 'blur'}],
|
||||
type: [{required: true, message: '请选择可见范围', trigger: 'change'}],
|
||||
}
|
||||
},
|
||||
colConfigs() {
|
||||
return [
|
||||
{slot: 'type'},
|
||||
{slot: 'content'},
|
||||
{prop: 'title', label: '标题'},
|
||||
{
|
||||
prop: 'contentType',
|
||||
label: '类型',
|
||||
align: 'center',
|
||||
render: (h, {row}) => {
|
||||
return h('span', {}, this.types.find((e) => row.contentType == e.value)?.name)
|
||||
},
|
||||
},
|
||||
{prop: 'userName', label: '创建人', align: 'center'},
|
||||
{prop: 'createTime', label: '创建时间', align: 'center'},
|
||||
{slot: 'options', label: '操作', align: 'center'},
|
||||
]
|
||||
},
|
||||
},
|
||||
|
||||
created() {
|
||||
this.getSortList()
|
||||
},
|
||||
|
||||
filters: {
|
||||
size(size) {
|
||||
return (size / 1024).toFixed(1)
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
insertNickname() {
|
||||
this.trickForm.content += '[用户昵称]'
|
||||
},
|
||||
insertRemark() {
|
||||
this.trickForm.content += '[备注名]'
|
||||
},
|
||||
onClose() {
|
||||
this.trickForm.title = ''
|
||||
this.trickForm.content = ''
|
||||
this.trickForm.fileId = ''
|
||||
this.trickForm.mediaId = ''
|
||||
this.trickForm.createdAt = ''
|
||||
this.trickForm.contentType = 'text'
|
||||
this.fileList = []
|
||||
},
|
||||
onChange() {
|
||||
this.trickForm.fileId = ''
|
||||
this.trickForm.content = ''
|
||||
this.trickForm.mediaId = ''
|
||||
this.trickForm.createdAt = ''
|
||||
this.fileList = []
|
||||
},
|
||||
add() {
|
||||
if (this.sortList.length == 0) return this.$message.error('请先添加分组')
|
||||
this.$nextTick(() => {
|
||||
this.trickDialog = true
|
||||
})
|
||||
},
|
||||
change(e) {
|
||||
if(e.length){
|
||||
this.trickForm.fileId = e[0].id
|
||||
this.trickForm.mediaId = e[0].media.mediaId
|
||||
this.trickForm.createdAt = e[0].media.createdAt
|
||||
}else {
|
||||
this.trickForm.fileId =""
|
||||
this.trickForm.mediaId = ""
|
||||
this.trickForm.createdAt = ""
|
||||
}
|
||||
},
|
||||
editTrick(row) {
|
||||
this.row = row
|
||||
this.trickForm = {...row}
|
||||
row.file && (this.trickForm.fileId = row.file.id)
|
||||
this.$nextTick(() => {
|
||||
this.trickDialog = true
|
||||
})
|
||||
this.fileList.push(row.file)
|
||||
},
|
||||
deleteTrick(row) {
|
||||
this.$confirm('确认要删除吗?').then(() => {
|
||||
this.instance
|
||||
.post(`/app/wxcp/wxspeechtechnique/delete`, null, {
|
||||
params: {
|
||||
id: row.id,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('删除成功')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
trickConfirm() {
|
||||
this.$refs['trickFom'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.instance
|
||||
.post(`/app/wxcp/wxspeechtechnique/addOrUpdate`, {
|
||||
...this.trickForm,
|
||||
category: this.current.id,
|
||||
userId: this.user.info.id,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code == 0) {
|
||||
this.trickDialog = false
|
||||
this.$message.success(this.trickForm.id ? '编辑成功' : '添加成功')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
currentMenu(item) {
|
||||
this.current = item
|
||||
this.getList()
|
||||
},
|
||||
delteGroup(item, index) {
|
||||
this.$confirm('是否要删除?').then(() => {
|
||||
this.instance
|
||||
.post(`/app/wxcp/wxspeechtechniquecategory/delete`, null, {
|
||||
params: {
|
||||
id: item.id,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('删除成功')
|
||||
this.getSortList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
editGroup(item, index) {
|
||||
this.sortForm = {...item}
|
||||
this.groupDialog = true
|
||||
},
|
||||
onConfirm() {
|
||||
this.$refs['groupForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.instance
|
||||
.post(`/app/wxcp/wxspeechtechniquecategory/addOrUpdate`, {
|
||||
...this.sortForm,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code == 0) {
|
||||
this.groupDialog = false
|
||||
this.$message.success(this.sortForm.id ? '编辑成功' : '添加成功')
|
||||
this.getSortList()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getSortList() {
|
||||
this.instance
|
||||
.post(`/app/wxcp/wxspeechtechniquecategory/listAll`, null, {
|
||||
params: {
|
||||
// type: 1,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
if (res && res.data.length) {
|
||||
this.sortList = res.data
|
||||
this.current = res.data[0]
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
},
|
||||
getList(item) {
|
||||
this.instance
|
||||
.post(`/app/wxcp/wxspeechtechnique/list`, null, {
|
||||
params: {
|
||||
category: this.current.id,
|
||||
...this.search,
|
||||
status: 1,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code == 0) {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.left-tree {
|
||||
width: 264px;
|
||||
background: #fafafb;
|
||||
box-shadow: -1px 0px 0px 0px #e5e5e5;
|
||||
border-radius: 2px 0px 0px 2px;
|
||||
|
||||
.tree-title {
|
||||
height: 40px;
|
||||
box-sizing: border-box;
|
||||
padding: 0 8px 0 16px;
|
||||
background: #eeeff1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
& > label {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: #222222;
|
||||
}
|
||||
}
|
||||
|
||||
.tree-item {
|
||||
box-sizing: border-box;
|
||||
padding: 8px 16px 8px 24px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-right: 2px solid transparent;
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
height: 40px;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.item-title {
|
||||
display: inline-block;
|
||||
width: 160px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 14px;
|
||||
color: #222222;
|
||||
}
|
||||
|
||||
.iconMore {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
:deep( .el-scrollbar__wrap ){
|
||||
overflow-x: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
:deep( .ai-list__content--right ){
|
||||
|
||||
.ai-list__content--right-wrapper {
|
||||
min-height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
:deep( .has-gutter tr ){
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
:deep( .el-table__row td ){
|
||||
height: 68px;
|
||||
}
|
||||
|
||||
// :deep( .el-table__row td .cell ){
|
||||
// width: 240px;
|
||||
// height: 44px;
|
||||
// }
|
||||
|
||||
.table-btn {
|
||||
font-size: 14px;
|
||||
color: #2266ff;
|
||||
cursor: pointer;
|
||||
|
||||
&:nth-child(1) {
|
||||
margin-right: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.input {
|
||||
width: 100%;
|
||||
min-height: 32px;
|
||||
line-height: 32px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #d0d4dc;
|
||||
color: #666;
|
||||
display: inline-block;
|
||||
font-size: inherit;
|
||||
cursor: pointer;
|
||||
|
||||
&:after {
|
||||
content: '请选择...';
|
||||
color: #888888;
|
||||
padding-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
:deep( .media ){
|
||||
object-fit: fill;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
vertical-align: middle;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
:deep( .AiPersonSelect ){
|
||||
& > button {
|
||||
background: #f5f5f5;
|
||||
border-radius: 0px 2px 2px 0px;
|
||||
border: 1px solid #d0d4dc;
|
||||
color: #222222;
|
||||
}
|
||||
}
|
||||
|
||||
:deep( .is-active ){
|
||||
border-right: 2px solid #2266ff;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.el-popper {
|
||||
min-width: 76px !important;
|
||||
}
|
||||
|
||||
.table-left__wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.table-left__wrapper--text {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ellipsis {
|
||||
width: 170px;
|
||||
height: 24px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
img,
|
||||
video {
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.el-form-item__textarea {
|
||||
position: relative;
|
||||
|
||||
.el-form-item__btn, .el-form-item__remark {
|
||||
position: absolute;
|
||||
bottom: 12px;
|
||||
left: 12px;
|
||||
line-height: 1;
|
||||
z-index: 1;
|
||||
color: #2266FF;
|
||||
font-size: 14px;
|
||||
user-select: none;
|
||||
background: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.el-form-item__remark {
|
||||
left: 108px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,66 +0,0 @@
|
||||
<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: 'AppVillageCode',
|
||||
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>
|
||||
@@ -1,119 +0,0 @@
|
||||
<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>
|
||||
<el-form class="ai-form" ref="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 label="二维码名称" prop="codeName" :rules="[{ required: true, message: '请输入二维码名称', trigger: 'blur' }]">
|
||||
<el-input size="small" maxlength="30" show-word-limit placeholder="请输入二维码名称" style="width: 328px;" v-model="form.codeName"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 100%;" label="二维码类型" prop="type" :rules="[{ required: true, message: '请选择二维码类型', trigger: 'change' }]">
|
||||
<el-radio-group v-model="form.type">
|
||||
<el-radio label="0">群二维码</el-radio>
|
||||
<el-radio label="1">个人二维码</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传二维码" prop="codeUrl" style="width: 100%;" :rules="[{ required: true, message: '请上传二维码', trigger: 'change' }]">
|
||||
<ai-uploader :instance="instance" v-model="form.codeUrl" :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: '',
|
||||
codeName: '',
|
||||
areaName: '',
|
||||
code: '',
|
||||
codeUrl: [],
|
||||
type: '',
|
||||
},
|
||||
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/appeveryvillagecode/queryDetailById?id=${id}`).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.form = res.data
|
||||
this.form.codeUrl = [{
|
||||
url: res.data.codeUrl
|
||||
}]
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onClose () {
|
||||
this.form.explain = ''
|
||||
},
|
||||
|
||||
confirm () {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.instance.post(`/app/appeveryvillagecode/addOrUpdate`, {
|
||||
...this.form,
|
||||
codeUrl: this.form.codeUrl[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>
|
||||
@@ -1,413 +0,0 @@
|
||||
<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" :disabled="isShowAdd" 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="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">
|
||||
<template slot-scope="{ row }">
|
||||
<div class="table-options">
|
||||
<el-popover
|
||||
placement="bottom"
|
||||
width="160"
|
||||
:visible-arrow="false"
|
||||
popper-class="wechat-message__container"
|
||||
trigger="hover">
|
||||
<el-button type="text" slot="reference">二维码</el-button>
|
||||
<div style="font-size: 0;">
|
||||
<img class="message-info__img" :src="row.codeUrl">
|
||||
</div>
|
||||
</el-popover>
|
||||
<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,
|
||||
status: 0,
|
||||
title: '',
|
||||
areaId: ''
|
||||
},
|
||||
defaultExpanded: [],
|
||||
defaultChecked: [],
|
||||
areaTree: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
currIndex: -1,
|
||||
total: 10,
|
||||
colConfigs: [
|
||||
{prop: 'codeName', label: '名称', align: 'left'},
|
||||
{prop: 'type', label: '二维码类型', align: 'left', format: v => v === '0' ? '群二维码' : '个人二维码'},
|
||||
{prop: 'createUserName', label: '创建人'},
|
||||
{prop: 'createTime', label: '创建时间'},
|
||||
{slot: 'options', label: '操作'}
|
||||
],
|
||||
areaName: '',
|
||||
unitName: '',
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
|
||||
isShowAdd () {
|
||||
const str = this.search.areaId.substr(this.search.areaId.length - 3)
|
||||
|
||||
return str === '000'
|
||||
}
|
||||
},
|
||||
|
||||
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/appeveryvillagecode/list`, null, {
|
||||
params: {
|
||||
...this.search
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
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/appeveryvillagecode/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;
|
||||
:deep( input ){
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.el-button {
|
||||
width: 84px;
|
||||
flex-shrink: 1;
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
span {
|
||||
color: #222222;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
: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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.villagecode-left {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
background: #FAFAFB;
|
||||
|
||||
.villagecode-left__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 40px;
|
||||
padding: 0 16px;
|
||||
background: #E5E5E5;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep( .ai-list__content--right ){
|
||||
|
||||
.ai-list__content--right-wrapper {
|
||||
min-height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.message-info__img {
|
||||
font-size: 0;
|
||||
width: 144px;
|
||||
height: 144px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user