特征库对接

This commit is contained in:
aixianling
2023-08-23 16:55:51 +08:00
parent 9038477862
commit a90f9be052
4 changed files with 193 additions and 75 deletions

View File

@@ -7,17 +7,18 @@
<template #content>
<ai-search-bar>
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="add('')">添加</el-button>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="edit()">添加</el-button>
</template>
<template #right>
<el-input size="small" placeholder="特征词搜索" v-model="search.wordName" clearable
@clear="search.current = 1, search.wordName = '', getTableData()" suffix-icon="iconfont iconSearch"
v-throttle="() => {(search.current = 1), getTableData();}"/>
<el-input size="small" placeholder="特征词搜索" v-model="search.keywords" clearable
@clear="search.current = 1, search.keywords = '', getTableData()"
suffix-icon="iconfont iconSearch"
v-throttle="() => {(search.current = 1), getTableData();}"/>
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :total="total" :current.sync="search.current" :size.sync="search.size"
@getList="getTableData()" :col-configs="colConfigs" :dict="dict">
<el-table-column slot="options" label="操作" width="200" align="center">
<el-table-column slot="options" label="操作" width="200" align="center">
<template slot-scope="{ row }">
<el-button type="text" @click="changeStatus(row, '停用')" v-if="row.status == 1">停用</el-button>
<el-button type="text" @click="changeStatus(row, '启用')" v-else>启用</el-button>
@@ -28,28 +29,13 @@
</ai-table>
</template>
</ai-list>
<ai-dialog
:title="form.id ? '编辑特征词' : '添加特征词'"
:visible.sync="dialog"
:destroyOnClose="true"
width="720px"
@onConfirm="onConfirm"
@closed="form={}">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="特征词" prop="wordName">
<el-input v-model.trim="form.wordName" type="textarea" :rows="2" placeholder="多个特征词以;隔开"></el-input>
</el-form-item>
<el-form-item label="事件类型" prop="eventType">
<ai-select v-model="form.eventType" :selectList="dict.getDict('xbotReportEventType')" placeholder="请选择" />
</el-form-item>
</el-form>
</ai-dialog>
</section>
</template>
<script>
import { mapState } from "vuex";
import {mapState} from "vuex";
export default {
name: "Setting",
label: '工单特征库',
@@ -57,24 +43,18 @@ export default {
instance: Function,
dict: Object,
permissions: Function,
menuName:String
menuName: String
},
data() {
return {
search: {
wordName: '',
keywords: '',
current: 1,
size: 10,
},
total: 0,
tableData: [],
current: 1,
form: {
wordName: '',
eventType: ''
},
dialog: false,
flag: false,
}
},
created() {
@@ -86,29 +66,23 @@ export default {
...mapState(['user']),
colConfigs() {
return [
{ prop: "wordName", label: '特征词', align: "left"},
{ prop: "eventType", label: '事件类型', width: 200, align: 'center', dict: 'xbotReportEventType'},
{ prop: "createTime", label: '创建时间', width: 200, align: 'center'},
{ prop: "createUserName", label: '创建人', width: 200, align: 'center'},
{ prop: "status", label: '状态', width: 200, dict: 'processDefStatus', align: 'center'},
{ slot: "options"},
{prop: "keywords", label: '特征词', align: "left"},
{prop: "eventType", label: '事件类型', width: 200, align: 'center', dict: 'xbotReportEventType'},
{prop: "createTime", label: '创建时间', width: 200, align: 'center'},
{prop: "createUserName", label: '创建人', width: 200, align: 'center'},
{prop: "status", label: '状态', width: 200, dict: 'processDefStatus', align: 'center'},
{slot: "options"},
]
},
rules() {
return {
wordName: [{required: true, message: '请输入特征词', trigger: 'blur' }],
eventType: [{required: true, message: '请选择事件类型', trigger: 'blur' }],
}
},
},
methods: {
getTableData() {
this.instance.post(`/app/appsessionarchivefeaturelibrary/list`,null,{
this.instance.post(`/app/appsessionarchivefeaturelibrary/list`, null, {
params: {
...this.search
}
}).then(res => {
if(res?.data) {
if (res?.data) {
this.tableData = res.data.records
this.total = res.data.total
}
@@ -134,34 +108,9 @@ export default {
})
})
},
edit(row) {
this.form = {...row}
this.dialog = true
},
add() {
this.dialog = true
},
onConfirm() {
if(this.flag) return
this.$refs.form.validate((valid)=> {
if(valid) {
this.flag = true
this.instance.post(`/app/appsessionarchivefeaturelibrary/addOrUpdate`,{
...this.form,
}).then(res => {
if(res?.code == 0) {
this.$message.success(this.form.id ? '特征词编辑成功' : '特征词添加成功')
setTimeout(() =>{
this.dialog = false
this.getTableData()
this.flag = false
}, 600)
} else {
this.flag = false
}
})
}
})
edit(row = {}) {
const {id} = row
this.$router.push({hash: "#sd", query: {id}})
},
cancel() {
this.$router.push({})
@@ -183,6 +132,7 @@ export default {
display: flex;
justify-content: space-between;
cursor: pointer;
.el-icon-arrow-down {
line-height: 32px;
}
@@ -190,7 +140,7 @@ export default {
:deep .is-error {
.time-select {
border: 1px solid #f46!important;
border: 1px solid #f46 !important;
}
}
}