2023-02-23 18:12:20 +08:00
|
|
|
|
<template>
|
2023-08-03 15:51:20 +08:00
|
|
|
|
<div style="height: 100%;overflow:auto;" class="knowledge-base">
|
|
|
|
|
|
<div class="top-title">
|
|
|
|
|
|
{{$t('overall.knowledgeBase')}}
|
2023-03-10 20:50:54 +08:00
|
|
|
|
</div>
|
2023-08-03 15:51:20 +08:00
|
|
|
|
<div class="knowledge-base__content" >
|
|
|
|
|
|
<div class="left-filter" style="">
|
|
|
|
|
|
<knowledge-filter ref="knowledgeFilter"
|
|
|
|
|
|
:keyWord="keyWord"
|
|
|
|
|
|
@reload="reload"
|
|
|
|
|
|
@clearList="clearList"></knowledge-filter>
|
2023-04-26 23:46:23 +08:00
|
|
|
|
</div>
|
2023-05-17 10:51:52 +08:00
|
|
|
|
<div class="right-list-card" >
|
|
|
|
|
|
<div class="top-tools" >
|
|
|
|
|
|
<div class="top-tools__left">
|
|
|
|
|
|
<button id="knowledge-base-add" :title="$t('knowledgeBase.createKnowledgeBase')" class="top-tool-btn margin-r-10 top-tool-btn--create"
|
|
|
|
|
|
style="width:72px;"
|
|
|
|
|
|
@click="jumpToCreatePage">
|
|
|
|
|
|
<i class="cn-icon-xinjian cn-icon"></i>
|
|
|
|
|
|
<span>{{$t('overall.create')}}</span>
|
2023-04-26 23:46:23 +08:00
|
|
|
|
</button>
|
2023-08-03 15:51:20 +08:00
|
|
|
|
<button v-if="listMode === 'block'" id="knowledge-base-select" :title="$t('knowledgeBase.select')" class="top-tool-btn margin-r-10"
|
|
|
|
|
|
style="width:72px;"
|
|
|
|
|
|
@click="toSelect">
|
|
|
|
|
|
<i class="cn-icon-select cn-icon" ></i>
|
|
|
|
|
|
<span>{{$t('overall.select')}}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button v-if="listMode === 'list'" id="knowledge-base-edit" :title="$t('knowledgeBase.editKnowledgeBase')" class="top-tool-btn margin-r-10" :disabled="disableEdit"
|
2023-05-29 13:00:28 +08:00
|
|
|
|
style="width:72px;"
|
|
|
|
|
|
@click="editSelectRecord">
|
|
|
|
|
|
<i class="cn-icon-edit cn-icon" ></i>
|
|
|
|
|
|
<span>{{$t('overall.edit')}}</span>
|
|
|
|
|
|
</button>
|
2023-05-17 10:51:52 +08:00
|
|
|
|
<button id="knowledge-base-delete" :title="$t('knowledgeBase.deleteKnowledgeBase')" class="top-tool-btn margin-r-10"
|
|
|
|
|
|
style="width:72px;" :disabled="disableDelete"
|
|
|
|
|
|
@click="toDelete">
|
|
|
|
|
|
<i class="cn-icon-delete cn-icon"></i>
|
|
|
|
|
|
<span>{{$t('overall.delete')}}</span>
|
|
|
|
|
|
</button>
|
2023-08-03 15:51:20 +08:00
|
|
|
|
<div class="top-tool-search margin-l-10" style="">
|
2023-05-17 10:51:52 +08:00
|
|
|
|
<el-input v-model="keyWord" size="small" @keyup.enter="onSearch"></el-input>
|
|
|
|
|
|
<button class="top-tool-btn top-tool-btn--search" style="border-radius: 0 2px 2px 0 !important;" @click="onSearch">
|
|
|
|
|
|
<i class="el-icon-search"></i>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2023-08-03 15:51:20 +08:00
|
|
|
|
<div class="top-tools__right" >
|
|
|
|
|
|
<el-button-group size="mini">
|
|
|
|
|
|
<el-button size="mini" @click="modeChange('list')" :class="{'active': listMode === 'list'}"><i class="cn-icon cn-icon-list"></i></el-button>
|
|
|
|
|
|
<el-button size="mini" @click="modeChange('block')" :class="{'active': listMode === 'block'}"><i class="cn-icon cn-icon-blocks"></i></el-button>
|
|
|
|
|
|
</el-button-group>
|
|
|
|
|
|
</div>
|
2023-04-26 23:46:23 +08:00
|
|
|
|
</div>
|
2023-08-03 15:51:20 +08:00
|
|
|
|
<!-- 列表式 -->
|
|
|
|
|
|
<template v-if="listMode === 'list'">
|
|
|
|
|
|
<div class="list-mode__row" style="position:relative;">
|
|
|
|
|
|
<loading :loading="loading"></loading>
|
|
|
|
|
|
<knowledge-base-table-for-row
|
|
|
|
|
|
ref="dataTable"
|
|
|
|
|
|
height="100%"
|
|
|
|
|
|
:api="url"
|
|
|
|
|
|
:isNoData="isNoData"
|
|
|
|
|
|
:custom-table-title="tools.customTableTitle"
|
|
|
|
|
|
:table-data="tableData"
|
|
|
|
|
|
:is-selected-status="isSelectedStatus"
|
|
|
|
|
|
:all-count="18"
|
|
|
|
|
|
@delete="toDelete"
|
|
|
|
|
|
@selectionChange="selectionChange"
|
|
|
|
|
|
@edit="edit"
|
|
|
|
|
|
@orderBy="tableDataSort"
|
|
|
|
|
|
@reload="reloadRowList"
|
|
|
|
|
|
@toggleLoading="toggleLoading"
|
|
|
|
|
|
></knowledge-base-table-for-row>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<!-- 卡片式 -->
|
|
|
|
|
|
<template v-else-if="listMode === 'block'">
|
|
|
|
|
|
<div class="list-mode__card" style="position:relative;">
|
|
|
|
|
|
<loading :loading="loading"></loading>
|
|
|
|
|
|
<knowledge-base-table-for-card
|
|
|
|
|
|
ref="dataTableCard"
|
|
|
|
|
|
:api="url"
|
|
|
|
|
|
:isNoData="isNoData"
|
|
|
|
|
|
:custom-table-title="tools.customTableTitle"
|
|
|
|
|
|
:table-data="tableData"
|
|
|
|
|
|
:is-selected-status="isSelectedStatus"
|
|
|
|
|
|
:all-count="18"
|
|
|
|
|
|
@delete="toDelete"
|
|
|
|
|
|
@checkboxStatusChange="checkboxStatusChange"
|
|
|
|
|
|
@reload="reloadRowList"
|
|
|
|
|
|
@toggleLoading="toggleLoading"
|
|
|
|
|
|
></knowledge-base-table-for-card>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<div class="knowledge-pagination" style="">
|
2023-04-26 23:46:23 +08:00
|
|
|
|
<pagination ref="pagination" :page-obj="pageObj" :table-id="tableId" @pageNo='pageNo' @pageSize='pageSize'></pagination>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2023-02-23 18:12:20 +08:00
|
|
|
|
</div>
|
2023-04-26 23:46:23 +08:00
|
|
|
|
<el-dialog v-model="showConfirmDialog"
|
|
|
|
|
|
:title="$t('overall.hint')"
|
|
|
|
|
|
width="480px"
|
|
|
|
|
|
custom-class="del-model-hint"
|
|
|
|
|
|
:before-close="handleClose">
|
|
|
|
|
|
<div class="dialog-message">{{$t('knowledge.deleteDataHint')}}</div>
|
|
|
|
|
|
<el-table v-model="delItemList"
|
|
|
|
|
|
ref="delDataTable"
|
|
|
|
|
|
:data="batchDeleteObjs"
|
|
|
|
|
|
@selection-change="secondSelectionChange"
|
|
|
|
|
|
height="156px"
|
|
|
|
|
|
width="100%"
|
|
|
|
|
|
class="dialog-table"
|
2023-08-03 15:51:20 +08:00
|
|
|
|
:row-style="rowStyle"
|
2023-04-26 23:46:23 +08:00
|
|
|
|
cell-style="padding:4px 0px;font-size: 12px;color: #353636;font-weight: 400;"
|
2023-08-03 15:51:20 +08:00
|
|
|
|
header-cell-style="padding:4px 0px;background: #F5F8FA;font-size: 12px;color: #353636;font-weight: 500;"
|
|
|
|
|
|
:header-row-style="tableHeaderRowStyle">
|
2023-04-26 23:46:23 +08:00
|
|
|
|
<el-table-column
|
|
|
|
|
|
:resizable="false"
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
type="selection"
|
|
|
|
|
|
width="50">
|
|
|
|
|
|
</el-table-column>
|
2023-08-03 15:51:20 +08:00
|
|
|
|
<el-table-column property="knowledgeId" label="ID" width="50"></el-table-column>
|
2023-05-29 13:00:28 +08:00
|
|
|
|
<el-table-column property="name" label="Name"></el-table-column>
|
2023-08-03 15:51:20 +08:00
|
|
|
|
<el-table-column property="category" label="Category" width="100" :formatter = "categoryFormat"></el-table-column>
|
|
|
|
|
|
<el-table-column property="source" label="Source" width="110" :formatter = "sourceFormat"></el-table-column>
|
2023-04-26 23:46:23 +08:00
|
|
|
|
</el-table>
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
<span class="dialog-footer">
|
|
|
|
|
|
<el-button @click="showConfirmDialog = false">{{ $t('overall.cancel') }}</el-button>
|
|
|
|
|
|
<el-button type="primary" @click="submit">{{ $t('tip.confirm') }}</el-button>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-dialog>
|
2023-02-23 18:12:20 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import dataListMixin from '@/mixins/data-list'
|
2023-05-17 10:51:52 +08:00
|
|
|
|
import KnowledgeBaseTableForCard from '@/components/table/setting/knowledgeBaseTableForCard'
|
|
|
|
|
|
import KnowledgeBaseTableForRow from '@/components/table/setting/KnowledgeBaseTableForRow'
|
2023-02-23 18:12:20 +08:00
|
|
|
|
import { api } from '@/utils/api'
|
2023-05-29 13:00:28 +08:00
|
|
|
|
import { urlParamsHandler, overwriteUrl } from '@/utils/tools'
|
2023-08-03 15:51:20 +08:00
|
|
|
|
import { knowledgeBaseCategory, knowledgeBaseSource } from '@/utils/constants'
|
2023-03-08 17:35:22 +08:00
|
|
|
|
import axios from 'axios'
|
2023-08-03 15:51:20 +08:00
|
|
|
|
import KnowledgeFilter from '@/views/setting/KnowledgeFilter'
|
2023-02-23 18:12:20 +08:00
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'knowledgeBase',
|
|
|
|
|
|
components: {
|
2023-05-17 10:51:52 +08:00
|
|
|
|
KnowledgeBaseTableForCard,
|
2023-08-03 15:51:20 +08:00
|
|
|
|
KnowledgeBaseTableForRow,
|
|
|
|
|
|
KnowledgeFilter
|
2023-02-23 18:12:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
mixins: [dataListMixin],
|
|
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
|
|
|
|
|
url: api.knowledgeBase,
|
2023-05-29 13:00:28 +08:00
|
|
|
|
listUrl: api.knowledgeBaseList,
|
2023-04-26 23:46:23 +08:00
|
|
|
|
tableId: 'knowledgeBaseTable', // 需要分页的table的id,用于记录每页数量
|
|
|
|
|
|
isSelectedStatus: false,
|
2023-06-11 10:52:28 +08:00
|
|
|
|
filterParams: {},
|
|
|
|
|
|
checkedCategoryIds: [],
|
|
|
|
|
|
checkedStatusIds: [],
|
2023-04-26 23:46:23 +08:00
|
|
|
|
keyWord: '',
|
|
|
|
|
|
showConfirmDialog: false,
|
|
|
|
|
|
delItemList: [],
|
2023-05-17 10:51:52 +08:00
|
|
|
|
secondBatchDeleteObjs: [],
|
2023-08-03 15:51:20 +08:00
|
|
|
|
listMode: 'list' // 列表的模式,list|block
|
2023-02-23 18:12:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2023-04-26 23:46:23 +08:00
|
|
|
|
watch: {
|
|
|
|
|
|
},
|
2023-02-23 18:12:20 +08:00
|
|
|
|
methods: {
|
2023-04-26 23:46:23 +08:00
|
|
|
|
onSearch () {
|
2023-06-16 17:51:08 +08:00
|
|
|
|
const params = {
|
2023-06-11 10:52:28 +08:00
|
|
|
|
...this.filterParams,
|
2023-06-04 21:18:41 +08:00
|
|
|
|
name: this.keyWord
|
2023-04-26 23:46:23 +08:00
|
|
|
|
}
|
2023-04-28 14:49:50 +08:00
|
|
|
|
this.clearList()
|
2023-04-26 23:46:23 +08:00
|
|
|
|
this.search(params)
|
2023-08-03 15:51:20 +08:00
|
|
|
|
this.$refs.knowledgeFilter.reloadFilter(this.checkedCategoryIds, this.checkedStatusIds)
|
2023-04-26 23:46:23 +08:00
|
|
|
|
},
|
2023-06-09 09:45:08 +08:00
|
|
|
|
reloadRowList () {
|
|
|
|
|
|
this.getTableData()
|
2023-08-03 15:51:20 +08:00
|
|
|
|
this.$refs.knowledgeFilter.reloadFilter()
|
2023-06-09 09:45:08 +08:00
|
|
|
|
},
|
|
|
|
|
|
categoryFormat (row, column) {
|
|
|
|
|
|
const category = row.category
|
|
|
|
|
|
const t = knowledgeBaseCategory.find(t => t.value === category)
|
|
|
|
|
|
return t ? t.name : category
|
|
|
|
|
|
},
|
|
|
|
|
|
sourceFormat (row, column) {
|
|
|
|
|
|
const source = row.source
|
|
|
|
|
|
const t = knowledgeBaseSource.find(t => t.value === source)
|
|
|
|
|
|
return t ? t.name : source
|
|
|
|
|
|
},
|
2023-04-26 23:46:23 +08:00
|
|
|
|
handleClose () {
|
|
|
|
|
|
this.showConfirmDialog = false
|
|
|
|
|
|
},
|
|
|
|
|
|
showDelDialog () {
|
|
|
|
|
|
this.showConfirmDialog = true
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.batchDeleteObjs.forEach((item) => {
|
|
|
|
|
|
this.$refs.delDataTable.toggleRowSelection(item, true)
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
secondSelectionChange (objs) {
|
|
|
|
|
|
this.secondBatchDeleteObjs = objs
|
|
|
|
|
|
},
|
2023-05-29 13:00:28 +08:00
|
|
|
|
selectionChange (objs) {
|
|
|
|
|
|
this.batchDeleteObjs = []
|
|
|
|
|
|
objs.forEach(obj => {
|
|
|
|
|
|
const delObj = this.batchDeleteObjs.find(item => item.knowledgeId === obj.knowledgeId)
|
|
|
|
|
|
if (delObj === undefined) {
|
|
|
|
|
|
this.batchDeleteObjs.push(obj)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2023-06-12 11:13:26 +08:00
|
|
|
|
if (this.batchDeleteObjs.length === 1) {
|
2023-05-29 13:00:28 +08:00
|
|
|
|
this.disableEdit = false
|
2023-06-12 11:13:26 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.disableEdit = true
|
2023-05-29 13:00:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (this.batchDeleteObjs.length >= 1) {
|
|
|
|
|
|
this.disableDelete = false
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.disableDelete = true
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
checkboxStatusChange (isCheck, data) {
|
|
|
|
|
|
if (isCheck) {
|
|
|
|
|
|
const delObj = this.batchDeleteObjs.find(item => item.knowledgeId === data.knowledgeId)
|
|
|
|
|
|
if (delObj === undefined) {
|
|
|
|
|
|
this.batchDeleteObjs.push(data)
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
const cancleObjIndex = this.batchDeleteObjs.findIndex(item => item.knowledgeId === data.knowledgeId)
|
|
|
|
|
|
if (cancleObjIndex > -1) {
|
|
|
|
|
|
this.batchDeleteObjs.splice(cancleObjIndex, 1)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-06-12 11:13:26 +08:00
|
|
|
|
if (this.batchDeleteObjs.length === 1) {
|
2023-05-29 13:00:28 +08:00
|
|
|
|
this.disableEdit = false
|
2023-06-12 11:13:26 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.disableEdit = true
|
2023-05-29 13:00:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (this.batchDeleteObjs.length >= 1) {
|
|
|
|
|
|
this.disableDelete = false
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.disableDelete = true
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2023-04-26 23:46:23 +08:00
|
|
|
|
delBatchKnowledge () {
|
|
|
|
|
|
const ids = []
|
|
|
|
|
|
if (this.secondBatchDeleteObjs && this.secondBatchDeleteObjs.length > 0) {
|
|
|
|
|
|
this.secondBatchDeleteObjs.forEach(item => {
|
2023-05-29 13:00:28 +08:00
|
|
|
|
ids.push(item.knowledgeId)
|
2023-04-26 23:46:23 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
if (ids.length === 0) {
|
|
|
|
|
|
this.$alert(this.$t('tip.pleaseSelect'), {
|
|
|
|
|
|
confirmButtonText: this.$t('tip.yes'),
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).catch(() => {})
|
|
|
|
|
|
} else {
|
2023-06-16 17:51:08 +08:00
|
|
|
|
this.toggleLoading(true)
|
2023-05-29 13:00:28 +08:00
|
|
|
|
axios.delete(this.url + '?knowledgeIds=' + ids).then(response => {
|
2023-04-26 23:46:23 +08:00
|
|
|
|
if (response.data.code === 200) {
|
|
|
|
|
|
this.delFlag = true
|
|
|
|
|
|
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') })
|
|
|
|
|
|
this.secondBatchDeleteObjs.forEach((item) => {
|
|
|
|
|
|
this.$refs.delDataTable.toggleRowSelection(item, false)
|
|
|
|
|
|
})
|
2023-08-03 15:51:20 +08:00
|
|
|
|
this.$refs.knowledgeFilter.reloadFilter()
|
2023-04-26 23:46:23 +08:00
|
|
|
|
this.secondBatchDeleteObjs = []
|
|
|
|
|
|
this.batchDeleteObjs = []
|
2023-08-03 15:51:20 +08:00
|
|
|
|
delete this.searchLabel.category
|
2023-06-08 17:17:41 +08:00
|
|
|
|
delete this.searchLabel.source
|
2023-04-26 23:46:23 +08:00
|
|
|
|
this.getTableData()
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.data.message)
|
|
|
|
|
|
}
|
|
|
|
|
|
}).finally(() => {
|
2023-06-16 17:51:08 +08:00
|
|
|
|
this.toggleLoading(false)
|
2023-04-26 23:46:23 +08:00
|
|
|
|
if (this.isSelectedStatus != undefined) {
|
|
|
|
|
|
this.isSelectedStatus = false
|
|
|
|
|
|
this.disableDelete = true
|
|
|
|
|
|
this.secondBatchDeleteObjs = []
|
|
|
|
|
|
this.batchDeleteObjs = []
|
|
|
|
|
|
this.showConfirmDialog = false
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2023-08-03 15:51:20 +08:00
|
|
|
|
tableHeaderRowStyle ({ row, rowIndex }) {
|
|
|
|
|
|
// if (rowIndex === 0) {
|
|
|
|
|
|
// return 'font-weight: 500;font-size: 14px;'
|
|
|
|
|
|
// }
|
|
|
|
|
|
},
|
|
|
|
|
|
rowStyle ({ row, rowIndex }) {
|
|
|
|
|
|
// return 'height:32px !important;'//font-size: 14px;color: #666666;font-weight: 400;
|
|
|
|
|
|
},
|
2023-04-26 23:46:23 +08:00
|
|
|
|
submit () {
|
|
|
|
|
|
this.delBatchKnowledge()
|
|
|
|
|
|
this.showConfirmDialog = false
|
|
|
|
|
|
},
|
2023-02-23 18:12:20 +08:00
|
|
|
|
edit (u) {
|
2023-03-23 16:13:55 +08:00
|
|
|
|
axios.get(`${this.url}/${u.id}`).then(response => {
|
2023-03-08 17:35:22 +08:00
|
|
|
|
if (response.data.code === 200) {
|
|
|
|
|
|
this.object = response.data.data.list[0]
|
2023-03-23 16:13:55 +08:00
|
|
|
|
console.info(this.object)
|
2023-02-23 18:12:20 +08:00
|
|
|
|
}
|
2023-03-14 19:39:40 +08:00
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
console.error(e)
|
|
|
|
|
|
if (e.response.data && e.response.data.message) {
|
|
|
|
|
|
this.$message.error(e.response.data.message)
|
|
|
|
|
|
} else {
|
2023-08-01 17:58:27 +08:00
|
|
|
|
this.$message.error(this.$t('tip.somethingWentWrong'))
|
2023-03-14 19:39:40 +08:00
|
|
|
|
}
|
2023-02-23 18:12:20 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2023-06-16 17:51:08 +08:00
|
|
|
|
reload (params, isAll, isClearType, checkedCategoryIds, checkedStatusIds) {
|
2023-04-26 23:46:23 +08:00
|
|
|
|
this.disableDelete = true
|
|
|
|
|
|
this.isSelectedStatus = false
|
|
|
|
|
|
this.batchDeleteObjs = []
|
|
|
|
|
|
this.secondBatchDeleteObjs = []
|
2023-06-11 10:52:28 +08:00
|
|
|
|
this.filterParams = params
|
|
|
|
|
|
this.checkedCategoryIds = checkedCategoryIds
|
|
|
|
|
|
this.checkedStatusIds = checkedStatusIds
|
2023-06-04 21:18:41 +08:00
|
|
|
|
params = {
|
|
|
|
|
|
...params,
|
|
|
|
|
|
name: this.keyWord
|
|
|
|
|
|
}
|
2023-04-26 23:46:23 +08:00
|
|
|
|
this.getTableData(params, isAll, isClearType)
|
|
|
|
|
|
},
|
|
|
|
|
|
clearList () {
|
|
|
|
|
|
this.disableDelete = true
|
|
|
|
|
|
this.isSelectedStatus = false
|
|
|
|
|
|
this.batchDeleteObjs = []
|
|
|
|
|
|
this.secondBatchDeleteObjs = []
|
2023-06-02 14:15:00 +08:00
|
|
|
|
this.tableData = []
|
2023-04-26 23:46:23 +08:00
|
|
|
|
this.pageObj.total = 0
|
|
|
|
|
|
},
|
|
|
|
|
|
toSelect () {
|
2023-05-29 13:00:28 +08:00
|
|
|
|
this.$refs.dataTableCard.clearSelect()
|
2023-04-26 23:46:23 +08:00
|
|
|
|
this.isSelectedStatus = !this.isSelectedStatus
|
2023-04-28 14:49:50 +08:00
|
|
|
|
this.disableDelete = true
|
|
|
|
|
|
this.batchDeleteObjs = []
|
|
|
|
|
|
this.secondBatchDeleteObjs = []
|
2023-04-26 23:46:23 +08:00
|
|
|
|
},
|
2023-03-23 16:13:55 +08:00
|
|
|
|
editSelectRecord () {
|
|
|
|
|
|
if (this.batchDeleteObjs.length === 0) {
|
|
|
|
|
|
this.$alert(this.$t('tip.pleaseSelectForEdit'), {
|
|
|
|
|
|
confirmButtonText: this.$t('tip.yes'),
|
|
|
|
|
|
type: 'warning'
|
2023-03-27 11:11:00 +08:00
|
|
|
|
}).catch(() => {})
|
2023-03-23 16:13:55 +08:00
|
|
|
|
} else {
|
2023-05-29 13:00:28 +08:00
|
|
|
|
this.jumpToEditPage(this.batchDeleteObjs[0].knowledgeId)
|
2023-03-23 16:13:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2023-04-26 23:46:23 +08:00
|
|
|
|
toDelete (data) {
|
2023-05-29 13:00:28 +08:00
|
|
|
|
if (data && data.knowledgeId) {
|
2023-04-26 23:46:23 +08:00
|
|
|
|
this.secondBatchDeleteObjs = []
|
|
|
|
|
|
this.batchDeleteObjs = []
|
|
|
|
|
|
this.secondBatchDeleteObjs.push(data)
|
|
|
|
|
|
this.batchDeleteObjs.push(data)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.showDelDialog()
|
|
|
|
|
|
},
|
2023-05-29 13:00:28 +08:00
|
|
|
|
modeChange (mode) {
|
2023-06-08 14:35:30 +08:00
|
|
|
|
this.disableDelete = true
|
|
|
|
|
|
this.isSelectedStatus = false
|
|
|
|
|
|
this.batchDeleteObjs = []
|
|
|
|
|
|
this.secondBatchDeleteObjs = []
|
2023-08-03 15:51:20 +08:00
|
|
|
|
this.listMode = mode
|
2023-06-09 09:45:08 +08:00
|
|
|
|
if (this.$refs.dataTableCard) {
|
|
|
|
|
|
this.$refs.dataTableCard.clearSelect()
|
|
|
|
|
|
}
|
2023-05-29 13:00:28 +08:00
|
|
|
|
const { query } = this.$route
|
2023-08-03 15:51:20 +08:00
|
|
|
|
const newUrl = urlParamsHandler(window.location.href, query, { listMode: mode })
|
2023-05-29 13:00:28 +08:00
|
|
|
|
overwriteUrl(newUrl)
|
|
|
|
|
|
},
|
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-06-16 17:51:08 +08:00
|
|
|
|
this.toggleLoading(true)
|
2023-05-29 13:00:28 +08:00
|
|
|
|
axios.delete(this.url + '?knowledgeIds=' + row.id).then(response => {
|
2023-03-08 17:35:22 +08:00
|
|
|
|
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') })
|
2023-08-03 15:51:20 +08:00
|
|
|
|
delete this.searchLabel.category
|
2023-06-08 17:17:41 +08:00
|
|
|
|
delete this.searchLabel.source
|
2023-03-06 14:19:29 +08:00
|
|
|
|
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-14 19:39:40 +08:00
|
|
|
|
}).catch(e => {
|
|
|
|
|
|
console.error(e)
|
|
|
|
|
|
if (e.response.data && e.response.data.message) {
|
|
|
|
|
|
this.$message.error(e.response.data.message)
|
|
|
|
|
|
} else {
|
2023-08-01 17:58:27 +08:00
|
|
|
|
this.$message.error(this.$t('tip.somethingWentWrong'))
|
2023-03-14 19:39:40 +08:00
|
|
|
|
}
|
2023-03-06 20:16:31 +08:00
|
|
|
|
}).finally(() => {
|
2023-06-16 17:51:08 +08:00
|
|
|
|
this.toggleLoading(false)
|
2023-03-06 14:19:29 +08:00
|
|
|
|
})
|
2023-03-27 11:11:00 +08:00
|
|
|
|
}).catch(() => {})
|
2023-03-06 14:19:29 +08:00
|
|
|
|
},
|
2023-03-23 16:13:55 +08:00
|
|
|
|
jumpToEditPage (id) {
|
2023-06-08 14:47:38 +08:00
|
|
|
|
const pageNo = this.$router.currentRoute.value.query.pageNo
|
2023-03-23 16:13:55 +08:00
|
|
|
|
this.$router.push({
|
2023-08-03 15:51:20 +08:00
|
|
|
|
path: '/knowledgeBase/edit',
|
2023-03-23 16:13:55 +08:00
|
|
|
|
query: {
|
|
|
|
|
|
t: +new Date(),
|
2023-06-08 14:47:38 +08:00
|
|
|
|
pageNoForTable: pageNo || 1,
|
2023-05-29 13:00:28 +08:00
|
|
|
|
id: id,
|
2023-08-03 15:51:20 +08:00
|
|
|
|
listMode: this.listMode
|
2023-03-23 16:13:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2023-02-24 18:51:17 +08:00
|
|
|
|
jumpToCreatePage () {
|
|
|
|
|
|
this.$router.push({
|
2023-08-03 15:51:20 +08:00
|
|
|
|
path: '/knowledgeBase/create',
|
2023-02-24 18:51:17 +08:00
|
|
|
|
query: {
|
2023-05-29 13:00:28 +08:00
|
|
|
|
t: +new Date(),
|
2023-08-03 15:51:20 +08:00
|
|
|
|
listMode: this.listMode
|
2023-02-24 18:51:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2023-02-23 18:12:20 +08:00
|
|
|
|
}
|
2023-04-26 23:46:23 +08:00
|
|
|
|
},
|
|
|
|
|
|
mounted () {
|
2023-08-03 15:51:20 +08:00
|
|
|
|
const curMode = this.$router.currentRoute.value.query.listMode
|
|
|
|
|
|
this.listMode = curMode || 'list'
|
2023-06-11 10:52:28 +08:00
|
|
|
|
this.filterParams = {}
|
2023-04-26 23:46:23 +08:00
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
2023-02-23 18:12:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
2023-04-26 23:46:23 +08:00
|
|
|
|
<style lang="scss">
|
|
|
|
|
|
.del-model__hint {
|
|
|
|
|
|
display:flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
padding-bottom:0px !important;
|
|
|
|
|
|
width:480px !important;
|
|
|
|
|
|
height:190px;
|
|
|
|
|
|
.el-message-box__header{
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
|
border-bottom:1px solid #eee;
|
|
|
|
|
|
height:42px;
|
|
|
|
|
|
background: #F7F7F7;
|
|
|
|
|
|
box-shadow: 0 1px 0 0 rgba(53,54,54,0.08);
|
|
|
|
|
|
padding-left:20px;
|
|
|
|
|
|
padding-top:14px;
|
|
|
|
|
|
padding-bottom:14px;
|
|
|
|
|
|
.el-message-box__headerbtn {
|
|
|
|
|
|
display: flex !important;
|
|
|
|
|
|
flex-direction: row-reverse;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
font-size: 10px;
|
|
|
|
|
|
line-height: 10px;
|
|
|
|
|
|
padding-right: 5px !important;
|
|
|
|
|
|
i {
|
|
|
|
|
|
width:10px;
|
|
|
|
|
|
height:10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.el-message-box__title {
|
|
|
|
|
|
font-size: 14px !important;
|
|
|
|
|
|
color: #353636;
|
|
|
|
|
|
letter-spacing: 0;
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.el-message-box__content {
|
|
|
|
|
|
height:96px;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
color: #353636;
|
|
|
|
|
|
letter-spacing: 0;
|
|
|
|
|
|
line-height: 22px;
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
padding-top:8px;
|
|
|
|
|
|
padding-right:20px;
|
|
|
|
|
|
padding-left:20px;
|
|
|
|
|
|
.el-message-box__message {
|
|
|
|
|
|
padding-left:0px !important;
|
|
|
|
|
|
padding-right:0px !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.el-message-box__btns {
|
|
|
|
|
|
height:52px;
|
|
|
|
|
|
border-top:1px solid #eee;
|
|
|
|
|
|
box-shadow: inset 0 -1px 0 0 rgba(0,0,0,0.07);
|
|
|
|
|
|
padding:11px 0px 12px!important;
|
|
|
|
|
|
.el-button--small {
|
|
|
|
|
|
padding:8px 21px !important;
|
|
|
|
|
|
line-height: 12px;
|
|
|
|
|
|
//font-family: NotoSansHans-Medium !important;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
min-height: 28px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.el-button:nth-child(1) {
|
|
|
|
|
|
margin-right:20px;
|
|
|
|
|
|
width:80px;
|
|
|
|
|
|
height:28px;
|
|
|
|
|
|
color: #353636;
|
|
|
|
|
|
}
|
|
|
|
|
|
.el-button:nth-child(2) {
|
|
|
|
|
|
width:80px;
|
|
|
|
|
|
height:28px;
|
|
|
|
|
|
margin-right:20px;
|
|
|
|
|
|
margin-left:0px !important;
|
|
|
|
|
|
background-color:#2d8cf0;
|
|
|
|
|
|
border-color:#2d8cf0;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-04-28 14:49:50 +08:00
|
|
|
|
.el-dialog {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column; // 水平分布
|
|
|
|
|
|
margin: 0 !important;
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: calc(50% - 150px);
|
|
|
|
|
|
left: calc(50% - 240px);
|
|
|
|
|
|
}
|
2023-04-26 23:46:23 +08:00
|
|
|
|
</style>
|