|
@@ -5,7 +5,11 @@
|
|
|
<div class="historyContent">
|
|
|
<div v-for="item in historyData" :key="item.id" class="historyItem">
|
|
|
<span style="float: left"> {{ item.question }}</span>
|
|
|
+ <i class="el-icon-delete historyMore" style="margin-left: 10px" @click="deleteHistory(item.id)"></i>
|
|
|
<i class="el-icon-more historyMore" @click="historyDetail(item.id)"></i>
|
|
|
+ <!-- <el-tooltip class="item" effect="dark" content="详情" placement="top">
|
|
|
+
|
|
|
+ </el-tooltip> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -22,7 +26,7 @@
|
|
|
<div class="answer">{{ item.answer }}</div>
|
|
|
<!-- <div class="graph"></div> -->
|
|
|
<graphECharts v-if="item.graph" :graphData="item.graph" class="charts"></graphECharts>
|
|
|
- <i v-if="item.answer" class="el-icon-more more" @click="handleMore(item)"></i>
|
|
|
+ <i v-if="item.user_id && item.ossID" class="el-icon-more more" @click="handleMore(item)"></i>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -37,6 +41,11 @@
|
|
|
</div>
|
|
|
<div class="statistics">
|
|
|
<div class="statisticsTitle">统计列表</div>
|
|
|
+ <ul class="statisticsContent">
|
|
|
+ <li v-for="item in statisticsData" :key="item.question" class="statisticsItem">
|
|
|
+ <span style="padding-left: 30px"> {{ item.question }}</span>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
</div>
|
|
|
<el-dialog title="更多" :visible.sync="dialogVisible" width="1500px" :before-close="handleClose">
|
|
|
<div class="dialogContent">
|
|
@@ -77,7 +86,7 @@
|
|
|
|
|
|
<script>
|
|
|
import store from '@/store'
|
|
|
-import { handlerAsk, getQAHistoryList, getQAHistoryDetail } from '@/api/als/intelligentQA'
|
|
|
+import { handlerAsk, getQAHistoryList, getGroup, getQAHistoryListAll, getQAHistoryDetail, removeQAHistory } from '@/api/als/intelligentQA'
|
|
|
import graphECharts from '@/views/als/components/Charts/graph.vue'
|
|
|
import axios from 'axios'
|
|
|
import { getListByIdsApi } from '@/api/als/oss'
|
|
@@ -105,11 +114,13 @@ export default {
|
|
|
graph: {}
|
|
|
},
|
|
|
historyData: [],
|
|
|
- fileInfo: {}
|
|
|
+ fileInfo: {},
|
|
|
+ statisticsData: []
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.getHistory()
|
|
|
+ this.getHistoryAll()
|
|
|
+ this.getGroupAPI()
|
|
|
this.adjustHeight()
|
|
|
},
|
|
|
watch: {},
|
|
@@ -132,16 +143,21 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- async getHistory() {
|
|
|
+ async getHistoryAll() {
|
|
|
try {
|
|
|
- const {
|
|
|
- data: { list, total }
|
|
|
- } = await getQAHistoryList()
|
|
|
- this.historyData = list
|
|
|
+ const { data } = await getQAHistoryListAll()
|
|
|
+ this.historyData = data
|
|
|
// console.log('this.historyData', this.historyData)
|
|
|
} catch (error) {}
|
|
|
},
|
|
|
|
|
|
+ async getGroupAPI() {
|
|
|
+ try {
|
|
|
+ const { data } = await getGroup()
|
|
|
+ this.statisticsData = data
|
|
|
+ } catch (error) {}
|
|
|
+ },
|
|
|
+
|
|
|
handleKeydown(event) {
|
|
|
if (event.key === 'Enter') {
|
|
|
if (event.ctrlKey) {
|
|
@@ -177,39 +193,41 @@ export default {
|
|
|
answer: '正在解析您的问题,请稍后......'
|
|
|
})
|
|
|
this.questionInput = ''
|
|
|
- // const { code, data } = await handlerAsk(sendInput)
|
|
|
- const { code, data } = {
|
|
|
- code: 200,
|
|
|
- msg: '',
|
|
|
- data: {
|
|
|
- user_id: 'user',
|
|
|
- answer: '解决办法为:更换电池或遥控器',
|
|
|
- file_name: '排故手册',
|
|
|
- // ossID: '225825878820585472',//pdf
|
|
|
- ossID: '225840762526433280', //word
|
|
|
- graph: {
|
|
|
- data: [
|
|
|
- { name: '202310150010', category: 'HMC' },
|
|
|
- { name: '电视', category: '成品' },
|
|
|
- { name: '电视遥控器失灵', category: '故障描述' },
|
|
|
- { name: '家用电器', category: '系统' },
|
|
|
- { name: '更换电池或遥控器', category: '维修策略' }
|
|
|
- ],
|
|
|
- links: [
|
|
|
- { source: '202310150010', target: '电视', value: '成品' },
|
|
|
- { source: '202310150010', target: '电视遥控器失灵', value: '故障描述' },
|
|
|
- { source: '202310150010', target: '家用电器', value: '系统' },
|
|
|
- { source: '202310150010', target: '更换电池或遥控器', value: '维修策略' }
|
|
|
- ]
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ const { code, data } = await handlerAsk(sendInput)
|
|
|
+ // const { code, data } = {
|
|
|
+ // code: 200,
|
|
|
+ // msg: '',
|
|
|
+ // data: {
|
|
|
+ // user_id: 'user',
|
|
|
+ // answer: '解决办法为:更换电池或遥控器',
|
|
|
+ // file_name: '排故手册',
|
|
|
+ // // ossID: '225825878820585472',//pdf
|
|
|
+ // ossID: '225840762526433280', //word
|
|
|
+ // graph: {
|
|
|
+ // data: [
|
|
|
+ // { name: '202310150010', category: 'HMC' },
|
|
|
+ // { name: '电视', category: '成品' },
|
|
|
+ // { name: '电视遥控器失灵', category: '故障描述' },
|
|
|
+ // { name: '家用电器', category: '系统' },
|
|
|
+ // { name: '更换电池或遥控器', category: '维修策略' }
|
|
|
+ // ],
|
|
|
+ // links: [
|
|
|
+ // { source: '202310150010', target: '电视', value: '成品' },
|
|
|
+ // { source: '202310150010', target: '电视遥控器失灵', value: '故障描述' },
|
|
|
+ // { source: '202310150010', target: '家用电器', value: '系统' },
|
|
|
+ // { source: '202310150010', target: '更换电池或遥控器', value: '维修策略' }
|
|
|
+ // ]
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
if (code == 200) {
|
|
|
- // const newData = this.handleData(JSON.parse(data))
|
|
|
- const newData = this.handleData(data)
|
|
|
+ console.log(1111)
|
|
|
+ const newData = this.handleData(JSON.parse(data))
|
|
|
+ // const newData = this.handleData(data)
|
|
|
this.chatInfo.pop()
|
|
|
this.chatInfo.push(newData)
|
|
|
+ // this.getHistoryAll()
|
|
|
}
|
|
|
// 等处理过返回数据后,调用使视图保持在最底部
|
|
|
let main = this.$refs.main
|
|
@@ -220,22 +238,25 @@ export default {
|
|
|
},
|
|
|
|
|
|
handleData(data) {
|
|
|
- // const graphData = eval('(' + data.graph + ')')
|
|
|
- // data.graph = graphData
|
|
|
- const categories = []
|
|
|
- data.graph.data.forEach((node) => {
|
|
|
- const flag = categories.find((item) => {
|
|
|
- return item.name === node.category
|
|
|
+ if (data.graph) {
|
|
|
+ const graphData = eval('(' + data.graph + ')')
|
|
|
+ data.graph = graphData
|
|
|
+ const categories = []
|
|
|
+ data.graph.data.forEach((node) => {
|
|
|
+ const flag = categories.find((item) => {
|
|
|
+ return item.name === node.category
|
|
|
+ })
|
|
|
+ if (!flag) {
|
|
|
+ categories.push({ name: node.category })
|
|
|
+ }
|
|
|
})
|
|
|
- if (!flag) {
|
|
|
- categories.push({ name: node.category })
|
|
|
- }
|
|
|
- })
|
|
|
- data.graph.categories = categories
|
|
|
+ data.graph.categories = categories
|
|
|
+ }
|
|
|
return data
|
|
|
},
|
|
|
|
|
|
handleMore(data) {
|
|
|
+ console.log('data', data)
|
|
|
this.getListById(data.ossID)
|
|
|
this.moreData = data
|
|
|
this.dialogVisible = true
|
|
@@ -248,6 +269,7 @@ export default {
|
|
|
|
|
|
handleClose() {
|
|
|
this.dialogVisible = false
|
|
|
+ this.fileInfo = {}
|
|
|
},
|
|
|
|
|
|
async historyDetail(id) {
|
|
@@ -257,6 +279,31 @@ export default {
|
|
|
this.chatInfo = []
|
|
|
this.chatInfo.push(newData)
|
|
|
} catch (error) {}
|
|
|
+ },
|
|
|
+
|
|
|
+ deleteHistory(id) {
|
|
|
+ this.$confirm('是否删除该条记录?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.removeQAHistoryAPI(id)
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ },
|
|
|
+
|
|
|
+ async removeQAHistoryAPI(params) {
|
|
|
+ try {
|
|
|
+ const { code } = await removeQAHistory(params)
|
|
|
+ if (code === 200) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '操作成功!'
|
|
|
+ })
|
|
|
+ this.getHistoryAll()
|
|
|
+ }
|
|
|
+ } catch (error) {}
|
|
|
}
|
|
|
|
|
|
// const { code, data } = {
|
|
@@ -288,6 +335,6 @@ export default {
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style lang="scss">
|
|
|
+<style scoped lang="scss">
|
|
|
@import './index.scss';
|
|
|
</style>
|