2023-02-23 18:12:20 +08:00
|
|
|
|
<template>
|
2023-03-10 20:50:54 +08:00
|
|
|
|
<div style="height: 100%;" class="knowledge-base">
|
|
|
|
|
|
<div class="top-title">
|
|
|
|
|
|
{{$t('overall.knowledgeBase')}}
|
|
|
|
|
|
</div>
|
2023-02-23 18:12:20 +08:00
|
|
|
|
<cn-data-list
|
|
|
|
|
|
ref="dataList"
|
|
|
|
|
|
:tableId="tableId"
|
|
|
|
|
|
v-model:custom-table-title="tools.customTableTitle"
|
|
|
|
|
|
:api="url"
|
|
|
|
|
|
from="knowledge-base"
|
|
|
|
|
|
:layout="['columnCustomize','elementSet','search']"
|
|
|
|
|
|
@search="search"
|
|
|
|
|
|
>
|
2023-03-10 20:50:54 +08:00
|
|
|
|
<template v-slot:top-tool-left>
|
|
|
|
|
|
<button id="knowledge-base-add" :title="$t('knowledgeBase.createKnowledgeBase')" class="top-tool-btn margin-r-10 top-tool-btn--create"
|
2023-03-09 10:39:26 +08:00
|
|
|
|
@click="jumpToCreatePage">
|
2023-03-10 20:50:54 +08:00
|
|
|
|
<i class="cn-icon-xinjian cn-icon"></i>
|
|
|
|
|
|
<span>{{$t('overall.create')}}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<!--
|
|
|
|
|
|
<button id="knowledge-base-edit" :title="$t('knowledgeBase.editKnowledgeBase')" class="top-tool-btn margin-r-10" :disabled="disableEdit"
|
|
|
|
|
|
@click="edit">
|
|
|
|
|
|
<i class="cn-icon-edit cn-icon" ></i>
|
|
|
|
|
|
<span>{{$t('overall.edit')}}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
-->
|
|
|
|
|
|
<button id="knowledge-base-delete" :title="$t('knowledgeBase.deleteKnowledgeBase')" class="top-tool-btn margin-r-10"
|
|
|
|
|
|
@click="delBatch">
|
|
|
|
|
|
<i class="cn-icon-delete cn-icon"></i>
|
|
|
|
|
|
<span>{{$t('overall.delete')}}</span>
|
2023-02-23 18:12:20 +08:00
|
|
|
|
</button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-slot:default>
|
|
|
|
|
|
<knowledge-base-table
|
|
|
|
|
|
ref="dataTable"
|
|
|
|
|
|
v-loading="tools.loading"
|
|
|
|
|
|
:api="url"
|
|
|
|
|
|
:custom-table-title="tools.customTableTitle"
|
|
|
|
|
|
:height="mainTableHeight"
|
|
|
|
|
|
:table-data="tableData"
|
|
|
|
|
|
@delete="del"
|
|
|
|
|
|
@edit="edit"
|
|
|
|
|
|
@orderBy="tableDataSort"
|
|
|
|
|
|
@reload="getTableData"
|
|
|
|
|
|
@selectionChange="selectionChange"
|
|
|
|
|
|
></knowledge-base-table>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<!-- 分页组件 -->
|
|
|
|
|
|
<template #pagination>
|
|
|
|
|
|
<pagination ref="pagination" :page-obj="pageObj" :table-id="tableId" @pageNo='pageNo' @pageSize='pageSize'></pagination>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</cn-data-list>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import cnDataList from '@/components/table/CnDataList'
|
|
|
|
|
|
import dataListMixin from '@/mixins/data-list'
|
|
|
|
|
|
import KnowledgeBaseTable from '@/components/table/setting/KnowledgeBaseTable'
|
|
|
|
|
|
import { api } from '@/utils/api'
|
2023-03-08 17:35:22 +08:00
|
|
|
|
import axios from 'axios'
|
2023-02-23 18:12:20 +08:00
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'knowledgeBase',
|
|
|
|
|
|
components: {
|
|
|
|
|
|
cnDataList,
|
|
|
|
|
|
KnowledgeBaseTable
|
|
|
|
|
|
},
|
|
|
|
|
|
mixins: [dataListMixin],
|
|
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
|
|
|
|
|
url: api.knowledgeBase,
|
2023-02-24 18:51:17 +08:00
|
|
|
|
tableId: 'knowledgeBaseTable' // 需要分页的table的id,用于记录每页数量
|
2023-02-23 18:12:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
edit (u) {
|
2023-03-08 17:35:22 +08:00
|
|
|
|
axios.get(`${this.url}`, { params: { ids: u.id } }).then(response => {
|
|
|
|
|
|
if (response.data.code === 200) {
|
|
|
|
|
|
this.object = response.data.data.list[0]
|
2023-02-23 18:12:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2023-03-06 14:19:29 +08:00
|
|
|
|
del (row) {
|
|
|
|
|
|
this.$confirm(this.$t('tip.confirmDelete'), {
|
|
|
|
|
|
confirmButtonText: this.$t('tip.yes'),
|
|
|
|
|
|
cancelButtonText: this.$t('tip.no'),
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
2023-03-06 20:16:31 +08:00
|
|
|
|
this.tools.loading = true
|
2023-03-08 17:35:22 +08:00
|
|
|
|
axios.delete(this.url + '?ids=' + row.id).then(response => {
|
|
|
|
|
|
if (response.data.code === 200) {
|
2023-03-06 14:19:29 +08:00
|
|
|
|
this.delFlag = true
|
|
|
|
|
|
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') })
|
|
|
|
|
|
this.getTableData()
|
|
|
|
|
|
} else {
|
2023-03-08 17:35:22 +08:00
|
|
|
|
this.$message.error(response.data.message)
|
2023-03-06 14:19:29 +08:00
|
|
|
|
}
|
2023-03-06 20:16:31 +08:00
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
this.tools.loading = false
|
2023-03-06 14:19:29 +08:00
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2023-02-24 18:51:17 +08:00
|
|
|
|
jumpToCreatePage () {
|
|
|
|
|
|
this.$router.push({
|
|
|
|
|
|
path: '/knowledgeBase/form',
|
|
|
|
|
|
query: {
|
|
|
|
|
|
t: +new Date()
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2023-02-23 18:12:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|