关键词管理
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
<template #content>
|
<template #content>
|
||||||
<ai-search-bar>
|
<ai-search-bar>
|
||||||
<template #left>
|
<template #left>
|
||||||
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button>
|
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="add('')">添加</el-button>
|
||||||
</template>
|
</template>
|
||||||
<template #right>
|
<template #right>
|
||||||
<el-input size="small" placeholder="关键词搜索" v-model="search.name" clearable
|
<el-input size="small" placeholder="关键词搜索" v-model="search.name" clearable
|
||||||
@@ -16,7 +16,8 @@
|
|||||||
@getList="getTableData()" :col-configs="colConfigs" :dict="dict">
|
@getList="getTableData()" :col-configs="colConfigs" :dict="dict">
|
||||||
<el-table-column slot="options" label="操作" align="center">
|
<el-table-column slot="options" label="操作" align="center">
|
||||||
<template slot-scope="{ row }">
|
<template slot-scope="{ row }">
|
||||||
<el-button type="text" @click="edit(row)">启用</el-button>
|
<el-button type="text" @click="changeStatus(row, '停用', 0)" v-if="row.status == 1">停用</el-button>
|
||||||
|
<el-button type="text" @click="changeStatus(row, '启用', 1)" v-else>启用</el-button>
|
||||||
<el-button type="text" @click="edit(row)">编辑</el-button>
|
<el-button type="text" @click="edit(row)">编辑</el-button>
|
||||||
<el-button type="text" @click="del(row)">删除</el-button>
|
<el-button type="text" @click="del(row)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
@@ -32,14 +33,20 @@
|
|||||||
@onConfirm="onConfirm"
|
@onConfirm="onConfirm"
|
||||||
@closed="form={}">
|
@closed="form={}">
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="敏感词" prop="registerCount">
|
<el-form-item label="敏感词" prop="wordName">
|
||||||
<el-input v-model.trim="form.registerCount" placeholder="请输入正整数" size="small"></el-input>
|
<el-input v-model.trim="form.wordName" placeholder="请输入敏感词" size="small"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="生效地区" prop="friendCount">
|
<el-form-item label="生效地区" prop="areaList">
|
||||||
<el-input v-model.trim="form.friendCount" placeholder="请输入正整数" size="small"></el-input>
|
<ai-area-get :instance="instance" :fullname.sync="form.areaName" v-model="form.areaList" :root="user.info.areaId" multiple></ai-area-get>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="生效部门" prop="confidantCount">
|
<el-form-item label="生效部门" prop="deptList">
|
||||||
<el-input v-model.trim="form.confidantCount" placeholder="请输入正整数" size="small"></el-input>
|
<ai-picker :instance="instance" v-model="form.deptList" @pick="e => onUserChange(e)" :multiple="true" dialogTitle="选择部门" action="/app/wxcp/wxdepartment/departList">
|
||||||
|
<div class="time-select">
|
||||||
|
<span class="dept-name" v-if="form.deptList && form.deptList.length">已选择{{form.deptList.length}}个部门</span>
|
||||||
|
<span class="dept-name" style="color:#999;" v-else>请选择</span>
|
||||||
|
<i class="el-icon-arrow-down"></i>
|
||||||
|
</div>
|
||||||
|
</ai-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</ai-dialog>
|
</ai-dialog>
|
||||||
@@ -61,66 +68,49 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
search: {
|
search: {
|
||||||
name: '',
|
wordName: '',
|
||||||
departmentId: '',
|
|
||||||
current: 1,
|
current: 1,
|
||||||
size: 10,
|
size: 10,
|
||||||
areaId: '',
|
|
||||||
},
|
},
|
||||||
departIdList: [],
|
|
||||||
tableData: [],
|
tableData: [],
|
||||||
size: 10,
|
size: 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
current: 1,
|
current: 1,
|
||||||
girdList: [],
|
|
||||||
form: {
|
form: {
|
||||||
registerCount: 0,
|
wordName: '',
|
||||||
friendCount: 0,
|
areaList: [],
|
||||||
confidantCount: 0
|
deptList: [],
|
||||||
},
|
},
|
||||||
personList: [],
|
|
||||||
dialog: false,
|
dialog: false,
|
||||||
girdOptions: [],
|
|
||||||
defaultProps: {
|
|
||||||
label: 'name',
|
|
||||||
value: 'id',
|
|
||||||
checkStrictly: true,
|
|
||||||
},
|
|
||||||
chooseUserList: [],
|
|
||||||
flag: false,
|
flag: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.$dict.load('integralCalcType')
|
|
||||||
this.getTableData()
|
this.getTableData()
|
||||||
this.getGridList()
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['user']),
|
...mapState(['user']),
|
||||||
colConfigs() {
|
colConfigs() {
|
||||||
return [
|
return [
|
||||||
{ prop: "name", label: '关键词', align: "left"},
|
{ prop: "wordName", label: '关键词', align: "left"},
|
||||||
{ prop: "areaName", label: '创建时间'},
|
{ prop: "createTime", label: '创建时间'},
|
||||||
{ prop: "departmentName", label: '创建人'},
|
{ prop: "createUserName", label: '创建人'},
|
||||||
{ prop: "phone", label: '生效地区'},
|
{ prop: "areaNames", label: '生效地区'},
|
||||||
{ prop: "registerCount", label: '生效部门'},
|
{ prop: "departmentNames", label: '生效部门'},
|
||||||
{ slot: "options" },
|
{ slot: "options" },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
rules() {
|
rules() {
|
||||||
return {
|
return {
|
||||||
registerCount: [{required: true, message: '请输入登记数', trigger: 'blur' },
|
wordName: [{required: true, message: '请输入敏感词', trigger: 'blur' }],
|
||||||
{pattern: /^[0-9]+$/, message: '请输入正整数'}],
|
areaList: [{required: true, message: '请选择生效地区', trigger: 'blur' }],
|
||||||
friendCount: [{required: true, message: '请输入朋友数', trigger: 'blur' },
|
deptList: [{required: true, message: '请选择生效部门', trigger: 'blur' }],
|
||||||
{pattern: /^[0-9]+$/, message: '请输入正整数'}],
|
|
||||||
confidantCount: [{required: true, message: '请输入知己数', trigger: 'blur' },
|
|
||||||
{pattern: /^[0-9]+$/, message: '请输入正整数'}],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getTableData() {
|
getTableData() {
|
||||||
this.instance.post(`/app/appwxuserfamiliarityrate/list`,null,{
|
this.instance.post(`/app/appsessionarchivekeywordinfo/list`,null,{
|
||||||
params: {
|
params: {
|
||||||
...this.search,
|
...this.search,
|
||||||
current: this.current,
|
current: this.current,
|
||||||
@@ -134,16 +124,9 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onAreaChange () {
|
|
||||||
this.search.current = 1
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.getTableData()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
del(row) {
|
del(row) {
|
||||||
this.$confirm('确定删除该数据?').then(() => {
|
this.$confirm('确定删除该数据?').then(() => {
|
||||||
this.instance.post(`/app/appwxuserfamiliarityrate/delete?id=${row.id}`).then(res => {
|
this.instance.post(`/app/appsessionarchivekeywordinfo/delete?ids=${row.id}`).then(res => {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
this.$message.success('删除成功!')
|
this.$message.success('删除成功!')
|
||||||
this.getTableData()
|
this.getTableData()
|
||||||
@@ -151,67 +134,52 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
changeStatus(row, text, status) {
|
||||||
edit(row) {
|
this.$confirm(`确定${text}该关键词?`).then(() => {
|
||||||
this.dialog = true
|
this.instance.post(`/app/appsessionarchivekeywordinfo/updateStatusById?id=${row.id}&status=${status}`).then(res => {
|
||||||
this.form = {...row}
|
if (res.code == 0) {
|
||||||
},
|
this.$message.success('操作成功!')
|
||||||
|
this.getTableData()
|
||||||
selectPerson(val) {
|
}
|
||||||
console.log(val)
|
})
|
||||||
if (val) {
|
|
||||||
this.personList = val
|
|
||||||
this.form.ids = [...this.personList.map(e => e.sysUserId)]
|
|
||||||
} else {
|
|
||||||
this.form.ids = this.chooseUserList.map(e => e.sysUserId)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
getGridList() {
|
|
||||||
this.instance.post(`/app/wxcp/wxdepartment/listAll`).then((res) => {
|
|
||||||
if (res.code == 0) {
|
|
||||||
this.girdOptions = this.toTree(res.data)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
edit(row) {
|
||||||
// 转树形结构
|
this.form = {...row}
|
||||||
toTree(data) {
|
this.form.deptList = []
|
||||||
let result = [];
|
this.form.areaList = this.form.areaIds.split(',')
|
||||||
if (!Array.isArray(data)) {
|
var deptList = row.departmentIds.split(',')
|
||||||
return result
|
var deptNameList = row.departmentNames.split(',')
|
||||||
}
|
deptList.map((item, index) => {
|
||||||
let map = {};
|
var i = {id: item, name: deptNameList[index], checked: true}
|
||||||
data.forEach(item => {
|
this.form.deptList[index] = i
|
||||||
map[item.id] = item;
|
})
|
||||||
});
|
this.dialog = true
|
||||||
data.forEach(item => {
|
|
||||||
let parent = map[item.parentid];
|
|
||||||
if (parent) {
|
|
||||||
(parent.children || (parent.children = [])).push(item);
|
|
||||||
} else {
|
|
||||||
result.push(item);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
},
|
},
|
||||||
|
add() {
|
||||||
gridChange(val) {
|
this.dialog = true
|
||||||
this.departIdList = val
|
},
|
||||||
this.search.departmentId = val?.[val.length - 1]
|
onUserChange (e) {
|
||||||
this.$refs.cascader1.dropDownVisible = false;
|
this.form.deptList = e
|
||||||
this.getTableData()
|
this.$forceUpdate()
|
||||||
},
|
},
|
||||||
|
|
||||||
onConfirm() {
|
onConfirm() {
|
||||||
if(this.flag) return
|
if(this.flag) return
|
||||||
|
|
||||||
this.$refs.form.validate((valid)=> {
|
this.$refs.form.validate((valid)=> {
|
||||||
if(valid) {
|
if(valid) {
|
||||||
this.flag = true
|
this.flag = true
|
||||||
this.instance.post(`/app/appwxuserfamiliarityrate/webUpdate`,{...this.form}).then(res => {
|
var departmentIds = []
|
||||||
|
this.form.deptList.map((item) => {
|
||||||
|
departmentIds.push(item.id)
|
||||||
|
})
|
||||||
|
this.instance.post(`/app/appsessionarchivekeywordinfo/addOrUpdate`,{
|
||||||
|
...this.form,
|
||||||
|
areaIds: this.form.areaList.join(','),
|
||||||
|
departmentIds: departmentIds.join(',')
|
||||||
|
}).then(res => {
|
||||||
if(res?.code == 0) {
|
if(res?.code == 0) {
|
||||||
this.$message.success('分类信息修改成功')
|
this.$message.success(this.form.id ? '关键词编辑成功' : '关键词添加成功')
|
||||||
setTimeout(() =>{
|
setTimeout(() =>{
|
||||||
this.dialog = false
|
this.dialog = false
|
||||||
this.getTableData()
|
this.getTableData()
|
||||||
@@ -225,15 +193,6 @@ export default {
|
|||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
toDetail(id) {
|
|
||||||
this.$emit('change', {
|
|
||||||
type: 'Detail',
|
|
||||||
params: {
|
|
||||||
id: id
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -242,68 +201,24 @@ export default {
|
|||||||
.AppKeywordManagement {
|
.AppKeywordManagement {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
:deep( .ai-dialog .ai-dialog__content ){
|
.time-select {
|
||||||
max-height: 600px!important;
|
padding: 0 16px;
|
||||||
}
|
height: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
border: 1px solid #d0d4dc;
|
||||||
|
border-radius: 4px;
|
||||||
.userlist {
|
display: flex;
|
||||||
display: inline-block;
|
justify-content: space-between;
|
||||||
}
|
cursor: pointer;
|
||||||
|
.el-icon-arrow-down {
|
||||||
.userlist, .user {
|
line-height: 32px;
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user {
|
|
||||||
position: relative;
|
|
||||||
width: 70px;
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
.remove-icon {
|
|
||||||
position: absolute;
|
|
||||||
right: 7px;
|
|
||||||
top: -4px;
|
|
||||||
line-height: 1;
|
|
||||||
padding: 6px 0;
|
|
||||||
font-size: 16px;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: crimson;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
img, h2 {
|
|
||||||
display: block;
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
line-height: 40px;
|
|
||||||
text-align: center;
|
|
||||||
margin: 0 auto 4px;
|
|
||||||
font-size: 14px;
|
|
||||||
color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
background-color: $primaryColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
color: #666;
|
|
||||||
font-size: 14px;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
word-break: break-all;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep( .selectCont .pagination ){
|
:deep .is-error {
|
||||||
width: 100%!important;
|
.time-select {
|
||||||
background: pink;
|
border: 1px solid #f46!important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user