123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- <template>
- <div class="view-table-content">
- <div style="width: 100%">
- <div style="width: 80%; margin-left: 10%">
- <!-- 分句、抽取、审核、入库 -->
- <el-steps :active="active" finish-status="success" process-status="finish">
- <!-- 需要判断分句中、抽取中、。。。。 -->
- <el-step title="分句"></el-step>
- <el-step title="抽取"></el-step>
- <el-step title="审核"></el-step>
- <el-step title="入库"></el-step>
- </el-steps>
- </div>
- <div class="view-dataType-title-btn" style="float: right; margin: 10px">
- <el-button v-if="active === 0" type="primary">返 回</el-button>
- <el-button style="margin-right: 300px" v-if="active === 0" type="warning" @click="handleClause">分 句</el-button>
- <el-button v-if="active === 1" type="warning" @click="handleExtract">抽 取</el-button>
- <div style="clear: both"></div>
- </div>
- <div class="view-dataType-table">
- <div v-if="active === 0" style="width: 500px; margin: 50px 0px 0px 300px">
- <el-form ref="taskFormRef" disabled :model="taskForm" label-width="80px">
- <el-form-item label="任务名称" prop="taskName">
- <el-input v-model="taskForm.taskName" />
- </el-form-item>
- <el-form-item label="抽取文件" prop="fileName">
- <el-input v-model="taskForm.fileName" />
- </el-form-item>
- </el-form>
- </div>
- <LTable ref="table" v-if="active === 1" @selection-change="selection" :defaultFetch="false" :fetch="fetch" :columns="clauseColumns" :dataSource="clauseTableData" :options="clauseOptions" :pagination="clauseTableRequset"></LTable>
- </div>
- <!-- 添加或修改模型信息对话框 -->
- <el-dialog :title="clauseDialogTitle" :visible.sync="clauseDialogVisible" width="600px" :before-close="handleClauseClose">
- <el-form ref="clauseFormRef" :model="clauseForm" label-width="80px">
- <el-form-item label="内容" prop="content">
- <el-input type="textarea" :rows="2" v-model="clauseForm.content" />
- </el-form-item>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="handleClauseClose">取 消</el-button>
- <el-button type="primary" @click="clauseSubmit">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </div>
- </template>
- <script>
- import { getTaskListAPI, addTaskAPI, getTaskInfoAPI, getClauseListAPI, updateClauseAPI, removeClauseAPI } from '@/api/als/knowledgeExtraction'
- import { getAtlasFile } from '@/api/als/atlasFile'
- import { getOssIdDataAPI } from '@/api/als/algorithm'
- import { deepClone, debounce } from '@/utils/index'
- // import FileUpload from '@/views/als/components/FileUpload'
- export default {
- name: 'ExtractList',
- components: {},
- data() {
- // 这里存放数据
- return {
- dialogTitle: '新增',
- dialogVisible: false,
- clauseDialogTitle: '编辑',
- clauseDialogVisible: false,
- keyWordData: '',
- searchValue: '',
- clauseColumns: [
- {
- prop: 'content',
- label: '内容'
- },
- {
- prop: 'status',
- label: '状态',
- width: '240px',
- render: (h, params) => {
- return h('span', { class: 'success-state' }, '已分句')
- }
- },
- {
- button: true,
- label: '操作',
- width: '240px',
- group: [
- {
- name: '编辑',
- type: 'text',
- round: false,
- plain: false,
- onClick: (row, index, scope) => {
- this.clauseHandUpdate(row)
- }
- },
- {
- name: '删除',
- type: 'text',
- round: false,
- plain: false,
- onClick: (row, index, scope) => {
- this.clauseRemove([row])
- }
- }
- ]
- }
- ],
- clauseOptions: {
- stripe: false, // 斑马纹
- mutiSelect: false, // 多选框
- index: true, // 显示序号, 多选则 mutiSelect
- loading: false, // 表格动画
- initTable: false, // 是否一挂载就加载数据
- border: true,
- height: 'calc(100vh - 335px)'
- },
- tableCheckItems: [],
- clauseTableData: [{ content: 'XXXXXXXXX水水水水水水水' }, { content: 'mmmmmmmmmmmAAAAAAAAAAA' }],
- clauseTableRequset: {
- total: 0,
- pageIndex: 1,
- pageSize: 20,
- searchValue: ''
- },
- form: {
- id: '',
- file: ''
- },
- debounceFn: debounce(this.fetch, 500),
- fileList: [],
- extractId: '',
- active: 0,
- taskForm: {
- id: '',
- taskName: '任务名称',
- fileName: '抽取文件'
- },
- clauseForm: {
- content: ''
- }
- }
- },
- watch: {
- keyWord() {
- this.clauseTableRequset.pageIndex = 1
- this.debounceFn()
- }
- },
- mounted() {
- this.extractId = this.$route.query.id
- this.getAtlasFileAPI()
- },
- methods: {
- async getAtlasFileAPI(params) {
- const {
- data: { list, total }
- } = await getAtlasFile()
- this.fileList = list
- },
- async removeknowledgeExtractionAPI(params) {
- try {
- const { code } = await removeknowledgeExtraction(params)
- if (code === 200) {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- await this.getknowledgeExtractionAPI()
- this.handleClose()
- }
- } catch (error) {}
- },
- async getknowledgeExtractionAPI(params) {
- if (this.$refs.table) this.$refs.table.clearSelection()
- const { keyWord } = this
- const { pageSize, pageIndex } = this.clauseTableRequset
- const {
- data: { list, total }
- } = await getknowledgeExtraction({ pageSize, pageNum: pageIndex, ...params })
- this.clauseTableData = list
- this.clauseTableRequset.total = total
- },
- fetch() {
- this.getknowledgeExtractionAPI()
- },
- async searchClick() {
- this.getknowledgeExtractionAPI({ name: keyWordData })
- },
- async updateknowledgeExtractionAPI() {
- try {
- const { code } = await updateknowledgeExtraction({ ...this.clauseForm })
- if (code === 200) {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- this.handleClose()
- this.getknowledgeExtractionAPI()
- }
- } catch (error) {}
- },
- openDialog() {
- this.dialogTitle = '新增'
- this.clauseDialogVisible = true
- },
- handleClose() {
- this.taskForm = {
- id: '',
- taskName: '',
- fileName: ''
- }
- },
- handleClauseClose() {
- this.clauseDialogVisible = false
- this.clauseForm = {
- content: ''
- }
- },
- handleClause() {
- // 调用分句接口
- this.active = 1
- },
- handleExtract() {
- // 调用抽取
- this.active = 2
- },
- clauseHandUpdate(row) {
- this.clauseDialogTitle = '编辑'
- this.clauseForm = deepClone(row)
- this.clauseDialogVisible = true
- },
- clauseSubmit() {
- switch (this.clauseDialogTitle) {
- case '编辑':
- // this.updateknowledgeExtractionAPI()
- break
- }
- },
- selection(val) {
- this.tableCheckItems = val
- },
- clauseRemove(row) {
- this.$confirm('是否删除该数据', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- this.removeknowledgeExtractionAPI(row.map((e) => e.id))
- })
- .catch(() => {})
- },
- async handleFile() {
- const res = await getOssIdDataAPI(this.form.file)
- console.log('res', res)
- // const res =await getknowledgeExtraction()
- },
- checkExtractList() {}
- }
- }
- </script>
- <style lang="scss" scoped>
- @import '../index.scss';
- </style>
|