席位,工单,特征库

This commit is contained in:
liuye
2023-08-14 10:43:09 +08:00
parent f342e7d672
commit c99a9a1332
5 changed files with 261 additions and 481 deletions

View File

@@ -1,178 +1,190 @@
<template>
<ai-list class="notice">
<template slot="title">
<ai-title isShowBack isShowBottomBorder title="事件类型" @onBackClick="cancel(false)"></ai-title>
</template>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="isShowAdd = true">添加事件类型</el-button>
</template>
<template slot="right">
<el-input
v-model="search.groupName"
class="search-input"
size="small"
v-throttle="() => {search.current = 1, getList()}"
placeholder="请输入事件类型名称"
clearable
@change="getList"
@clear="search.current = 1, search.groupName = '', 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>
<section class="Setting">
<ai-list>
<template slot="title">
<ai-title title="工单特征库" isShowBack isShowBottomBorder @onBackClick="cancel"></ai-title>
</template>
<template #content>
<ai-search-bar>
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="add('')">添加</el-button>
</template>
</el-table-column>
<el-table-column slot="options" width="120px" fixed="right" label="操作" align="center">
<div class="table-options" slot-scope="{ row }">
<el-button type="text" @click="edit(row)">编辑</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</el-table-column>
</ai-table>
<ai-dialog
:visible.sync="isShowAdd"
width="780px"
height="580px"
:title="id ? '编辑事件类型' : '添加事件类型'"
@close="onClose"
@onConfirm="onConfirm">
<el-form ref="form" class="ai-form" :model="form" label-width="110px" label-position="right">
<el-form-item label="事件类型" prop="groupName" style="width: 100%;" :rules="[{ required: true, message: '请输入事件类型名称', trigger: 'blur' }]">
<el-input size="small" :maxlength="10" show-word-limit placeholder="请输入事件类型名称" v-model="form.groupName"></el-input>
</el-form-item>
<el-form-item label="排序" prop="showIndex" style="width: 100%;" :rules="[{ required: true, message: '请输入排序', trigger: 'blur' }]">
<el-input-number size="small" v-model="form.showIndex" :min="1" :max="100" label="请输入排序"></el-input-number>
</el-form-item>
</el-form>
</ai-dialog>
</template>
</ai-list>
<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();}"/>
</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="操作" 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>
<el-button type="text" @click="edit(row)">编辑</el-button>
<el-button type="text" @click="del(row)">删除</el-button>
</template>
</el-table-column>
</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>
</ai-dialog>
</section>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'List',
props: {
instance: Function,
dict: Object
import { mapState } from "vuex";
export default {
name: "Setting",
label: '工单特征库',
props: {
instance: Function,
dict: Object,
permissions: Function,
menuName:String
},
data() {
return {
search: {
wordName: '',
current: 1,
size: 10,
},
tableData: [],
current: 1,
form: {
wordName: '',
},
dialog: false,
flag: false,
}
},
created() {
this.dict.load(['processDefStatus']).then(() => {
this.getTableData()
})
},
computed: {
...mapState(['user']),
colConfigs() {
return [
{ prop: "wordName", label: '特征词', align: "left"},
{ prop: "createTime", label: '创建时间', width: 200},
{ prop: "createUserName", label: '创建人', width: 200},
{ prop: "status", label: '状态', width: 200, dict: 'processDefStatus'},
{ slot: "options" },
]
},
data() {
rules() {
return {
search: {
current: 1,
size: 10,
groupName: ''
},
form: {
groupName: '',
showIndex: ''
},
id: '',
isShowAdd: false,
total: 0,
colConfigs: [
{prop: 'groupName', label: '事件类型', align: 'left'},
{prop: 'showIndex', label: '排序', align: 'center'},
{slot: 'options', label: '操作'}
],
tableData: []
wordName: [{required: true, message: '请输入特征词', trigger: 'blur' }],
}
},
computed: {
...mapState(['user'])
},
methods: {
getTableData() {
this.instance.post(`/app/appsessionarchivefeaturelibrary/list`,null,{
params: {
...this.search
}
}).then(res => {
if(res?.data) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
mounted() {
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appresidentreportgroup/list`, null, {
params: {
...this.search
}
}).then(res => {
del(row) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appsessionarchivefeaturelibrary/delete?ids=${row.id}`).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
this.$message.success('删除成功!')
this.getTableData()
}
})
},
edit (e) {
this.id = e.id
this.form.groupName = e.groupName
this.form.showIndex = ''
this.$nextTick(() => {
this.isShowAdd = true
})
},
onClose () {
this.id = ''
this.form.showIndex = ''
this.form.groupName = ''
},
onConfirm () {
this.$refs.form.validate((valid) => {
if (valid) {
this.instance.post(`/app/appresidentreportgroup/addOrUpdate`, {
...this.form,
id: this.id || null
}).then(res => {
if (res.code === 0) {
this.$message.success('添加成功')
this.isShowAdd = false
this.getList()
}
})
})
},
changeStatus(row, text) {
this.$confirm(`确定${text}该特征词?`).then(() => {
this.instance.post(`/app/appsessionarchivefeaturelibrary/enable?id=${row.id}`).then(res => {
if (res.code == 0) {
this.$message.success('操作成功!')
this.getTableData()
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'list',
isRefresh: !!isRefresh
})
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appresidentreportgroup/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
})
},
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
}
})
})
}
}
})
},
cancel() {
this.$router.push({})
}
}
},
}
</script>
<style lang="scss" scoped>
.Setting {
height: 100%;
.time-select {
padding: 0 16px;
height: 32px;
line-height: 32px;
border: 1px solid #d0d4dc;
border-radius: 4px;
display: flex;
justify-content: space-between;
cursor: pointer;
.el-icon-arrow-down {
line-height: 32px;
}
}
:deep .is-error {
.time-select {
border: 1px solid #f46!important;
}
}
}
</style>