|
@@ -62,6 +62,11 @@
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="匹配内容" align="center" prop="content" />
|
|
<el-table-column label="匹配内容" align="center" prop="content" />
|
|
|
|
|
+ <el-table-column label="绑定客服" align="center" prop="roles" min-width="120">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ {{ getRoleNameById(scope.row.roles) }}
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
<el-button
|
|
@@ -109,6 +114,23 @@
|
|
|
<el-form-item label="匹配内容" v-if="form.type==1" required >
|
|
<el-form-item label="匹配内容" v-if="form.type==1" required >
|
|
|
<el-input type="textarea" :rows="2" v-model="form.content" placeholder="请输入回复内容" />
|
|
<el-input type="textarea" :rows="2" v-model="form.content" placeholder="请输入回复内容" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <el-form-item label="绑定客服" prop="roles">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="form.roles"
|
|
|
|
|
+ multiple
|
|
|
|
|
+ placeholder="请选择客服"
|
|
|
|
|
+ filterable
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in roleOptions"
|
|
|
|
|
+ :key="item.roleId"
|
|
|
|
|
+ :label="item.roleName"
|
|
|
|
|
+ :value="item.roleId"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
<!-- <el-form-item label="所属应用" prop="roles">-->
|
|
<!-- <el-form-item label="所属应用" prop="roles">-->
|
|
|
<!-- <el-input v-model="form.roles" placeholder="请输入所属应用" />-->
|
|
<!-- <el-input v-model="form.roles" placeholder="请输入所属应用" />-->
|
|
|
<!-- </el-form-item>-->
|
|
<!-- </el-form-item>-->
|
|
@@ -123,6 +145,7 @@
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import { listFastgptChatKeyword, getFastgptChatKeyword, delFastgptChatKeyword, addFastgptChatKeyword, updateFastgptChatKeyword, exportFastgptChatKeyword } from "@/api/fastGpt/fastGptChatKeyword";
|
|
import { listFastgptChatKeyword, getFastgptChatKeyword, delFastgptChatKeyword, addFastgptChatKeyword, updateFastgptChatKeyword, exportFastgptChatKeyword } from "@/api/fastGpt/fastGptChatKeyword";
|
|
|
|
|
+import { getAllRoleList } from "@/api/fastGpt/fastGptRole";
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: "FastgptChatKeyword",
|
|
name: "FastgptChatKeyword",
|
|
@@ -134,6 +157,8 @@ export default {
|
|
|
exportLoading: false,
|
|
exportLoading: false,
|
|
|
// 选中数组
|
|
// 选中数组
|
|
|
ids: [],
|
|
ids: [],
|
|
|
|
|
+ roleOptions: [],
|
|
|
|
|
+ roleMap: {},
|
|
|
// 非单个禁用
|
|
// 非单个禁用
|
|
|
single: true,
|
|
single: true,
|
|
|
// 非多个禁用
|
|
// 非多个禁用
|
|
@@ -175,7 +200,7 @@ export default {
|
|
|
{ required: true, message: "内容不能为空", trigger: "blur" }
|
|
{ required: true, message: "内容不能为空", trigger: "blur" }
|
|
|
],
|
|
],
|
|
|
roles: [
|
|
roles: [
|
|
|
- { required: true, message: "角色不能为空", trigger: "blur"}
|
|
|
|
|
|
|
+ { required: true, message: "请至少选择一个客服", trigger: "change", type: "array" }
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -186,8 +211,25 @@ export default {
|
|
|
this.typeOptions = response.data;
|
|
this.typeOptions = response.data;
|
|
|
});
|
|
});
|
|
|
this.getList();
|
|
this.getList();
|
|
|
|
|
+ getAllRoleList().then(response => {
|
|
|
|
|
+ this.roleOptions = response.data || [];
|
|
|
|
|
+ this.roleMap = this.roleOptions.reduce((map, role) => {
|
|
|
|
|
+ map[role.roleId] = role.roleName;
|
|
|
|
|
+ return map;
|
|
|
|
|
+ }, {});
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ getRoleNameById(roles) {
|
|
|
|
|
+ if (!roles) {
|
|
|
|
|
+ return "-";
|
|
|
|
|
+ }
|
|
|
|
|
+ const idArray = Array.isArray(roles) ? roles : roles.split(",").map(id => id.trim());
|
|
|
|
|
+ return idArray
|
|
|
|
|
+ .map(id => this.roleMap[id])
|
|
|
|
|
+ .filter(name => name)
|
|
|
|
|
+ .join("、") || "-";
|
|
|
|
|
+ },
|
|
|
/** 查询关键字列表 */
|
|
/** 查询关键字列表 */
|
|
|
getList() {
|
|
getList() {
|
|
|
this.loading = true;
|
|
this.loading = true;
|
|
@@ -212,7 +254,7 @@ export default {
|
|
|
companyId: null,
|
|
companyId: null,
|
|
|
createTime: null,
|
|
createTime: null,
|
|
|
updateTime: null,
|
|
updateTime: null,
|
|
|
- roles: null
|
|
|
|
|
|
|
+ roles: []
|
|
|
};
|
|
};
|
|
|
this.resetForm("form");
|
|
this.resetForm("form");
|
|
|
},
|
|
},
|
|
@@ -243,8 +285,12 @@ export default {
|
|
|
this.reset();
|
|
this.reset();
|
|
|
const keywordId = row.keywordId || this.ids
|
|
const keywordId = row.keywordId || this.ids
|
|
|
getFastgptChatKeyword(keywordId).then(response => {
|
|
getFastgptChatKeyword(keywordId).then(response => {
|
|
|
- this.form = response.data;
|
|
|
|
|
- this.form.type = response.data.type.toString();
|
|
|
|
|
|
|
+ const data = response.data;
|
|
|
|
|
+ this.form = {
|
|
|
|
|
+ ...data,
|
|
|
|
|
+ type: data.type != null ? data.type.toString() : "1",
|
|
|
|
|
+ roles: data.roles ? data.roles.split(",").map(Number) : []
|
|
|
|
|
+ };
|
|
|
this.open = true;
|
|
this.open = true;
|
|
|
this.title = "修改关键字";
|
|
this.title = "修改关键字";
|
|
|
});
|
|
});
|
|
@@ -253,14 +299,18 @@ export default {
|
|
|
submitForm() {
|
|
submitForm() {
|
|
|
this.$refs["form"].validate(valid => {
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
if (valid) {
|
|
|
- if (this.form.keywordId != null) {
|
|
|
|
|
- updateFastgptChatKeyword(this.form).then(response => {
|
|
|
|
|
|
|
+ const submitData = {
|
|
|
|
|
+ ...this.form,
|
|
|
|
|
+ roles: Array.isArray(this.form.roles) ? this.form.roles.join(",") : this.form.roles
|
|
|
|
|
+ };
|
|
|
|
|
+ if (submitData.keywordId != null) {
|
|
|
|
|
+ updateFastgptChatKeyword(submitData).then(response => {
|
|
|
this.msgSuccess("修改成功");
|
|
this.msgSuccess("修改成功");
|
|
|
this.open = false;
|
|
this.open = false;
|
|
|
this.getList();
|
|
this.getList();
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
- addFastgptChatKeyword(this.form).then(response => {
|
|
|
|
|
|
|
+ addFastgptChatKeyword(submitData).then(response => {
|
|
|
this.msgSuccess("新增成功");
|
|
this.msgSuccess("新增成功");
|
|
|
this.open = false;
|
|
this.open = false;
|
|
|
this.getList();
|
|
this.getList();
|