1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135 |
- <template>
- <div class="view-table-content">
- <div style="width: 100%">
- <div class="view-dataType-title">
- <div class="view-dataType-title-btn">
- <el-button type="success" @click="openDialog()">新增抽取任务</el-button>
- <el-button type="warning" @click="remove(tableCheckItems)" :disabled="tableCheckItems.length === 0">删除</el-button>
- </div>
- <div class="view-dataType-title-search">
- <el-input placeholder="请输入任务名称" v-model="keyWordData" class="input1">
- <el-button slot="append" icon="el-icon-search" @click="searchClick"></el-button>
- </el-input>
- </div>
- </div>
- <div class="view-dataType-table">
- <LTable ref="table" @selection-change="selection" :defaultFetch="false" :fetch="fetch" :columns="columns" :dataSource="tableData" :options="options" :pagination="tableRequest"></LTable>
- </div>
- <!-- 添加或修改抽取任务对话框 -->
- <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="600px" :before-close="handleClose">
- <el-form ref="form" :model="form" label-width="80px" :rules="rules">
- <el-form-item label="任务名称" prop="taskName">
- <el-input v-model="form.taskName" placeholder="请输入任务名称" />
- </el-form-item>
- <el-form-item label="选择抽取文件" label-width="110px" prop="ossId">
- <el-select v-model="form.ossId" placeholder="请选择文件">
- <el-option v-for="item in optionFileList" :key="item.id" :label="item.dataTitle" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="handleClose">取 消</el-button>
- <el-button type="primary" @click="submit">确 定</el-button>
- </span>
- </el-dialog>
- <el-dialog title="详情" :visible.sync="detailDialogVisible" top="10vh" width="90%" :before-close="detailHandleClose">
- <div style="width: 80%; margin-left: 10%">
- <!-- 分句、抽取、审核、入库 -->
- <el-steps :active="active" finish-status="success" process-status="finish">
- <!-- 需要判断分句中、抽取中、。。。。 -->
- <el-step :title="zeroTitle"></el-step>
- <el-step :title="oneTitle"></el-step>
- <el-step :title="twoTitle"></el-step>
- <el-step :title="threeTitle"></el-step>
- </el-steps>
- </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="ossId">
- <!-- <el-input v-model="taskForm.ossId" /> -->
- <el-select v-model="taskForm.ossId" placeholder="请选择文件">
- <el-option v-for="item in optionFileList" :key="item.id" :label="item.dataTitle" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-form>
- </div>
- <LTable
- ref="clauseTableRef"
- v-if="active === 1 || active === 2"
- @selection-change="clauseSelection"
- :defaultFetch="false"
- :fetch="clauseFetch"
- :showColumnSetting="false"
- :columns="clauseColumns"
- :dataSource="clauseTableData"
- :options="clauseOptions"
- :pagination="clauseTableRequest"
- ></LTable>
- <graphECharts v-if="active === 3" style="margin: 0 auto" :width="1400" :height="500" :graphData="graphData" class="charts"></graphECharts>
- <!-- <LTable ref="extractTable" v-if="active === 2" @selection-change="extractSelection" :defaultFetch="false" :fetch="fetch" :columns="extractColumns" :dataSource="extractTableData" :options="extractOptions" :pagination="extractTableRequest"></LTable> -->
- </div>
- <el-dialog width="50%" title="详情" :visible.sync="clauseDialogVisible" :before-close="clauseHandleClose" append-to-body>
- <el-form ref="clauseFormRef" :model="clauseForm" label-width="80px">
- <el-form-item label="内容" prop="clause">
- <el-input type="textarea" :rows="7" v-model="clauseForm.clause" placeholder="请输入内容" />
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="clauseDialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="clauseSubmit">确 定</el-button>
- </div>
- </el-dialog>
- <el-dialog width="80%" title="抽取详情" :visible.sync="extractDialogVisible" :before-close="extractHandleClose" append-to-body>
- <div class="content">
- <div class="left">
- <p>{{ this.extractData.content }}</p>
- </div>
- <div class="right">
- <LTable
- ref="extractDetailTableRef"
- :showColumnSetting="false"
- :defaultFetch="false"
- :fetch="extractDetailFetch"
- :columns="extractDetailColumns"
- :dataSource="extractData.extractDetailTable"
- :pagination="extractDetailRequest"
- :options="extractDetailOptions"
- ></LTable>
- </div>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button type="success" @click="addER">新增实体关系</el-button>
- <el-button @click="handleCancel">作 废</el-button>
- <el-button type="primary" @click="passThrough">通 过</el-button>
- </div>
- </el-dialog>
- <span slot="footer" class="dialog-footer">
- <!-- <el-button @click="handleClose">取 消</el-button> -->
- <el-button type="primary" v-if="active === 0 && zeroTitle !== '分句中'" :loading="clauseLoading" @click="handleClause">分 句</el-button>
- <el-button type="primary" v-if="active === 1 && oneTitle !== '抽取中'" :loading="extractLoading" @click="handleExtract">抽 取</el-button>
- <el-button type="primary" v-if="active === 2 && oneTitle !== '入库中'" :loading="storageLoading" @click="handleStorage">入 库</el-button>
- </span>
- </el-dialog>
- <el-dialog width="30%" title="增加实体关系" :visible.sync="addERDialogVisible" :before-close="addERHandleClose" append-to-body>
- <el-form ref="addERFormRef" :model="addERForm" label-width="80px">
- <el-form-item label="头实体" prop="headEntity">
- <el-input v-model="addERForm.headEntity" placeholder="请输入内容" />
- </el-form-item>
- <el-form-item label="头实体类" prop="headEntityClass">
- <!-- <el-input v-model="addERForm.headEntityClass" placeholder="请输入内容" /> -->
- <el-select v-model="addERForm.headEntityClass" placeholder="请选择实体类型">
- <el-option v-for="(item, index) in entityClassList" :key="index" :label="item" :value="item" />
- </el-select>
- </el-form-item>
- <el-form-item label="关系" prop="relation">
- <!-- <el-input v-model="addERForm.relation" placeholder="请输入内容" /> -->
- <el-select v-model="addERForm.relation" placeholder="请选择实体类型">
- <el-option v-for="(item, index) in relationClassList" :key="index" :label="item" :value="item" />
- </el-select>
- </el-form-item>
- <el-form-item label="尾实体" prop="tailEntity">
- <el-input v-model="addERForm.tailEntity" placeholder="请输入内容" />
- </el-form-item>
- <el-form-item label="尾实体类" prop="tailEntityClass">
- <el-select v-model="addERForm.tailEntityClass" placeholder="请选择实体类型">
- <el-option v-for="(item, index) in entityClassList" :key="index" :label="item" :value="item" />
- </el-select>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="addERHandleClose">取 消</el-button>
- <el-button type="primary" @click="addERSubmit">确 定</el-button>
- </div>
- </el-dialog>
- </div>
- </div>
- </template>
- <script>
- import {extractStatusss} from '@/utils/enum-data'
- import { listTechData, download, delTechData, addTechData, updateTechData } from "@/api/tech/techData";
- import { getTaskList, addTask, updateTask, removeTask, taskPro, getVisually, removeClause, updateClause, getClauseList, getExtractList, updateExtractInfo, removeExtractInfo, addER } from '@/api/als/knowledgeExtraction'
- import { getAllEntityClass } from '@/api/als/entityManage'
- import { getAllRelationClass } from '@/api/als/ERManage'
- import graphECharts from '@/views/components/Charts/graph.vue'
- import { getAtlasFile } from '@/api/als/atlasFile'
- // import { getOssIdDataAPI } from '@/api/als/algorithm'
- import { deepClone, debounce } from '@/utils'
- import LTable from '@/views/components/LTable/index.vue'
- export default {
- name: 'KnowledgeExtraction',
- components: { LTable, graphECharts },
- data() {
- // 这里存放数据
- return {
- dialogTitle: '新增',
- dialogVisible: false,
- detailDialogVisible: false,
- clauseDialogVisible: false,
- extractDialogVisible: false,
- addERDialogVisible: false,
- clauseLoading: false,
- extractLoading: false,
- storageLoading: false,
- keyWordData: '',
- searchValue: '',
- rules: {
- taskName: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
- ossId: [{ required: true, message: '抽取文件不能为空', trigger: 'change' }]
- },
- columns: [
- {
- prop: 'taskName',
- label: '任务名称'
- },
- {
- prop: 'ossId',
- label: '文件',
- render: (h, params) => {
- const matchedItem = this.fileList.find((item) => params.row.ossId.trim() === item.ossId.trim())
- if (matchedItem) {
- return h('span', matchedItem.fileName)
- } else {
- return h('span', {}, '')
- }
- }
- },
- {
- prop: 'status',
- label: '状态',
- render: (h, params) => {
- const matchedItem = extractStatusss.find((item) => params.row.status === item.key)
- if (matchedItem) {
- return h('span', matchedItem.name)
- // return h('span', { class: matchedItem.colorType }, matchedItem.name)
- } else {
- return h('span', {}, '')
- }
- }
- },
- {
- button: true,
- label: '操作',
- width: '240px',
- group: [
- {
- name: '查看',
- type: 'text',
- round: false,
- plain: false,
- onClick: (row, index, scope) => {
- this.checkProcess(row)
- }
- },
- {
- name: '编辑',
- type: 'text',
- round: false,
- plain: false,
- onClick: (row, index, scope) => {
- this.handUpdate(row)
- }
- },
- {
- name: '删除',
- type: 'text',
- round: false,
- plain: false,
- onClick: (row, index, scope) => {
- this.remove([row])
- }
- }
- ]
- }
- ],
- options: {
- stripe: false, // 斑马纹
- mutiSelect: true, // 多选框
- index: false, // 显示序号, 多选则 mutiSelect
- loading: false, // 表格动画
- initTable: false, // 是否一挂载就加载数据
- border: true,
- height: 'calc(100vh - 300px)'
- },
- tableCheckItems: [],
- tableData: [],
- tableRequest: {
- total: 0,
- pageIndex: 1,
- pageSize: 20,
- searchValue: ''
- },
- clauseColumns: [
- {
- prop: 'clause',
- label: '内容'
- },
- {
- prop: 'status',
- label: '状态',
- width: '240px',
- render: (h, params) => {
- if (params.row.status === '0') {
- return h('span', { class: 'danger-state' }, '未审核')
- } else if (params.row.status === '1') {
- return h('span', { class: 'success-state' }, '通过')
- } else if (params.row.status === '2') {
- return h('span', { class: 'warning-state' }, '作废')
- }
- }
- },
- // {
- // prop: 'statusKey',
- // label: '状态',
- // width: '240px',
- // render: (h, params) => {
- // // if (params.row.status !== ' ') {
- // // if (params.row.status == '0') {
- // // return h('span', { class: 'danger-state' }, '未审核')
- // // } else if (params.row.status == '1') {
- // // return h('span', { class: 'success-state' }, '通过')
- // // } else if (params.row.status == '2') {
- // // return h('span', { class: 'warning-state' }, '作废')
- // // }
- // // } else {
- // const matchedItem = this.$enumData.extractStatus.find((item) => params.row.statusKey === item.key)
- // if (matchedItem) {
- // return h('span', { class: 'success-state' }, matchedItem.name)
- // // return h('span', { class: matchedItem.colorType }, matchedItem.name)
- // } else {
- // return h('span', {}, '')
- // }
- // // }
- // }
- // },
- {
- button: true,
- label: '操作',
- width: '240px',
- group: [
- {
- name: '编辑',
- type: 'text',
- statusKey: 'statusKey',
- disableKey: [3, 4],
- round: false,
- plain: false,
- onClick: (row, index, scope) => {
- this.clauseHandUpdate(row)
- }
- },
- {
- name: '删除',
- type: 'text',
- statusKey: 'statusKey',
- disableKey: [3, 4],
- round: false,
- plain: false,
- onClick: (row, index, scope) => {
- this.clauseRemove([row])
- }
- },
- {
- name: '查看抽取结果',
- type: 'text',
- statusKey: 'statusKey',
- unDisableKey: '4',
- round: false,
- plain: false,
- onClick: (row, index, scope) => {
- this.getExtractListAPI({ clauseId: row.id })
- this.checkExtractResult(row)
- }
- }
- ]
- }
- ],
- clauseOptions: {
- stripe: false, // 斑马纹
- mutiSelect: false, // 多选框
- index: true, // 显示序号, 多选则 mutiSelect
- loading: false, // 表格动画
- initTable: false, // 是否一挂载就加载数据
- border: true,
- height: 'calc(100vh - 470px)'
- },
- clauseTableCheckItems: [],
- clauseTableData: [],
- clauseTableRequest: {
- total: 0,
- pageIndex: 1,
- pageSize: 20,
- searchValue: ''
- },
- form: {
- id: '',
- taskName: '',
- ossId: ''
- },
- taskForm: {
- id: '',
- ossId: '',
- status: '',
- taskName: '',
- fileName: '',
- taskType: ''
- },
- debounceFn: debounce(this.fetch, 500),
- fileList: [],
- active: 0,
- clauseForm: {
- id: '',
- taskId: '',
- clause: '',
- status: ''
- },
- extractData: {
- content: '',
- extractDetailTable: []
- },
- extractDetailColumns: [
- {
- prop: 'headEntity',
- label: '头实体',
- edit: true,
- editStatus: false,
- onChange: (scope, oldRow) => {
- const { row } = scope
- if (oldRow.headEntity === row.headEntity) return
- this.updateExtractInfoAPI(row)
- }
- },
- {
- prop: 'headEntityClass',
- label: '头实体类',
- edit: true,
- editStatus: false,
- onChange: (scope, oldRow) => {
- const { row } = scope
- if (oldRow.headEntity === row.headEntityClass) return
- this.updateExtractInfoAPI(row)
- }
- },
- {
- prop: 'relation',
- label: '关系',
- edit: true,
- editStatus: false,
- onChange: (scope, oldRow) => {
- const { row } = scope
- if (oldRow.headEntity === row.relation) return
- this.updateExtractInfoAPI(row)
- }
- },
- {
- prop: 'tailEntity',
- label: '尾实体',
- edit: true,
- editStatus: false,
- onChange: (scope, oldRow) => {
- const { row } = scope
- if (oldRow.headEntity === row.tailEntity) return
- this.updateExtractInfoAPI(row)
- }
- },
- {
- prop: 'tailEntityClass',
- label: '尾实体类',
- edit: true,
- editStatus: false,
- onChange: (scope, oldRow) => {
- const { row } = scope
- if (oldRow.headEntity === row.tailEntityClass) return
- this.updateExtractInfoAPI(row)
- }
- },
- {
- button: true,
- label: '操作',
- width: '120px',
- group: [
- {
- name: '删除',
- type: 'text',
- round: false,
- plain: false,
- onClick: (row, index, scope) => {
- this.removeExtractDetail([row])
- }
- }
- ]
- }
- ],
- extractDetailOptions: {
- stripe: false, // 斑马纹
- mutiSelect: false, // 多选框
- index: true, // 显示序号, 多选则 mutiSelect
- loading: false, // 表格动画
- initTable: false, // 是否一挂载就加载数据
- border: true,
- height: '450px'
- },
- extractDetailRequest: {
- total: 0,
- pageIndex: 1,
- pageSize: 20,
- searchValue: ''
- },
- // extractDetailTableData: [{ content: 'qqq' }, { content: 'www' }, { content: 'eee' }]
- zeroTitle: '分句',
- oneTitle: '抽取',
- twoTitle: '审核',
- threeTitle: '入库',
- taskStatus: null,
- optionFileList:[],
- entityClassList: [],
- relationClassList: [],
- addERForm: {
- clauseId: '',
- headEntity: '',
- headEntityClass: '',
- relation: '',
- tailEntity: '',
- tailEntityClass: ''
- },
- graphData: {}
- }
- },
- watch: {
- keyWord() {
- this.tableRequest.pageIndex = 1
- this.debounceFn()
- }
- },
- mounted() {
- this.init()
- },
- methods: {
- init() {
- this.getTaskListAPI()
- this.getAtlasFileAPI()
- // this.getEntityClassAPI()
- // this.getAllRelationClassAPI()
- },
- infoOptions(){
- listTechData().then(response => {
- this.optionFileList = response.rows;
- console.log('logData',this.optionFileList)
- });
- },
- async getAtlasFileAPI(params) {
- try {
- const {
- data: { list, total }
- } = await getAtlasFile()
- this.fileList = list
- } catch (error) {}
- },
- async getEntityClassAPI(params) {
- try {
- const {
- data: { dataList }
- } = await getAllEntityClass()
- dataList.forEach((item) => {
- this.entityClassList.push(item.name)
- })
- } catch (error) {}
- },
- async getAllRelationClassAPI(params) {
- try {
- const {
- data: { dataList }
- } = await getAllRelationClass()
- dataList.forEach((item) => {
- this.relationClassList.push(item.name)
- })
- } catch (error) {}
- },
- async removeTaskAPI(params) {
- try {
- const { code } = await removeTask(params)
- if (code === 200) {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- await this.getTaskListAPI()
- this.handleClose()
- }
- } catch (error) {}
- },
- async removeClauseAPI(params) {
- try {
- const { code } = await removeClause(params)
- if (code === 200) {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- await this.getClauseListAPI({ taskId: this.taskForm.id })
- this.clauseHandleClose()
- }
- } catch (error) {}
- },
- async getTaskListAPI(params) {
- if (this.$refs.table) this.$refs.table.clearSelection()
- const { keyWord } = this
- const { pageSize, pageIndex } = this.tableRequest
- await getTaskList({ pageSize, pageNum: pageIndex, ...params }).then(res=>{
- this.tableData= res.rows
- this.tableRequest.total= res.total
- })
- },
- async getClauseListAPI(params) {
- if (this.$refs.clauseTableRef) this.$refs.clauseTableRef.clearSelection()
- const { keyWord } = this
- const { pageSize, pageIndex } = this.clauseTableRequest
- await getClauseList({ pageSize, pageNum: pageIndex, ...params }).then(res=>{
- this.clauseTableRequest.total = res.total
- this.clauseTableData = res.rows.map((el) => {
- return { ...el, statusKey: this.taskStatus }
- })
- })
- },
- async getExtractListAPI(params) {
- if (this.$refs.extractDetailTableRef) this.$refs.extractDetailTableRef.clearSelection()
- const { keyWord } = this
- const { pageSize, pageIndex } = this.extractDetailRequest
- await getExtractList({ pageSize, pageNum: pageIndex, ...params }).then(res=>{
- this.extractData.extractDetailTable = res.data.records;
- this.extractDetailRequest.total = res.total
- })
- },
- fetch() {
- this.getTaskListAPI()
- },
- clauseFetch() {
- this.getClauseListAPI({ taskId: this.taskForm.id })
- },
- extractDetailFetch() {
- this.getExtractListAPI({ clauseId: this.clauseForm.id })
- },
- async searchClick() {
- await this.getTaskListAPI({ taskName: this.keyWordData })
- },
- async addTaskAPI() {
- try {
- delete this.form.aircaftModelName
- const { code } = await addTask({ ...this.form })
- if (code === 200) {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- this.handleClose()
- await this.getTaskListAPI()
- }
- } catch (error) {}
- },
- async updateTaskAPI() {
- try {
- const { code } = await updateTask({ ...this.form })
- if (code === 200) {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- this.handleClose()
- await this.getTaskListAPI()
- }
- } catch (error) {}
- },
- async updateClauseAPI() {
- try {
- const { code } = await updateClause({ ...this.clauseForm })
- if (code === 200) {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- this.clauseHandleClose()
- this.extractHandleClose()
- await this.getClauseListAPI({ taskId: this.taskForm.id })
- }
- } catch (error) {}
- },
- openDialog() {
- this.dialogTitle = '新增'
- this.infoOptions()
- this.dialogVisible = true
- },
- handleClose() {
- this.dialogVisible = false
- this.form = {
- id: '',
- taskName: '',
- ossId: ''
- }
- },
- handUpdate(row) {
- this.dialogTitle = '编辑'
- this.form = deepClone(row)
- this.dialogVisible = true
- },
- // 分句编辑
- clauseHandUpdate(row) {
- this.clauseForm = deepClone(row)
- this.clauseDialogVisible = true
- },
- // 查看抽取结果
- checkExtractResult(row) {
- this.clauseForm = deepClone(row)
- this.getExtractListAPI({ clauseId: row.id })
- this.extractData.content = row.clause
- console.log('this.extractData.content',this.extractData.content)
- this.extractDialogVisible = true
- },
- // 表格更新抽取结果
- async updateExtractInfoAPI(row) {
- if (this.handleVerify(row)) {
- try {
- console.log('row', row)
- const { code } = await updateExtractInfo({ ...row })
- if (code === 200) {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- // this.clauseHandleClose()
- // this.getClauseListAPI({ taskId: this.taskForm.id })
- this.getExtractListAPI({ clauseId: this.clauseForm.id })
- }
- } catch (error) {}
- }fen
- },
- // 校验实体关系
- handleVerify(data) {
- const { headEntity, headEntityClass, relation, tailEntity, tailEntityClass } = data
- let str = this.extractData.content
- if (str.indexOf(headEntity) === -1 || str.indexOf(tailEntity) === -1) {
- this.extractDetailFetch()
- this.$message({
- type: 'warning',
- message: '实体与文本中匹配有误,请重新输入'
- })
- return false
- }
- if (!this.entityClassList.includes(headEntityClass) || !this.entityClassList.includes(tailEntityClass)) {
- this.extractDetailFetch()
- this.$message({
- type: 'warning',
- message: `实体类有误,请重新输入。目前实体类有<${this.entityClassList}>`,
- duration: 5000
- })
- return false
- }
- if (!this.relationClassList.includes(relation)) {
- this.extractDetailFetch()
- this.$message({
- type: 'warning',
- message: `关系有误,请重新输入。目前关系有<${this.relationClassList}>`,
- duration: 5000
- })
- return false
- }
- return true
- },
- // 新增实体关系
- addER() {
- this.addERDialogVisible = true
- },
- async addERSubmit() {
- if (this.handleVerify(this.addERForm)) {
- try {
- this.addERForm.clauseId = this.clauseForm.id
- const { code } = await addER({ ...this.addERForm })
- if (code === 200) {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- this.addERHandleClose()
- this.getExtractListAPI({ clauseId: this.clauseForm.id })
- }
- } catch (error) {}
- }
- },
- // 作废
- handleCancel() {
- this.clauseForm.status = 2
- this.$confirm('是否将该抽取结果作废?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- // this.removeTaskAPI(row.map((e) => e.id))
- this.updateClauseAPI()
- })
- .catch(() => {})
- },
- // 通过
- passThrough() {
- this.clauseForm.status = 1
- this.updateClauseAPI()
- },
- submit() {
- this.$refs.form.validate((valid) => {
- if (valid) {
- switch (this.dialogTitle) {
- case '编辑':
- this.updateTaskAPI()
- break
- case '新增':
- this.addTaskAPI()
- break
- }
- }
- })
- },
- clauseSubmit() {
- this.updateClauseAPI()
- },
- extractSubmit() {
- // this.updateClauseAPI()
- },
- selection(val) {
- this.tableCheckItems = val
- },
- clauseSelection(val) {
- this.clauseTableCheckItems = val
- },
- // extractSelection(val) {
- // this.extractTableCheckItems = val
- // },
- remove(row) {
- this.$confirm('是否删除该数据', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- this.removeTaskAPI(row.map((e) => e.id))
- })
- .catch(() => {})
- },
- removeExtractDetail(row) {
- console.log('row', row)
- this.$confirm('是否删除该条实体关系', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- this.removeExtractInfoAPI(row.map((e) => e.id))
- })
- .catch(() => {})
- },
- async removeExtractInfoAPI(params) {
- try {
- const { code } = await removeExtractInfo(params)
- if (code === 200) {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- await this.getExtractListAPI({ clauseId: this.clauseForm.id })
- }
- } catch (error) {}
- },
- clauseRemove(row) {
- this.$confirm('是否删除该数据', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- this.removeClauseAPI(row.map((e) => e.id))
- })
- .catch(() => {})
- },
- checkProcess(row) {
- this.taskStatus = row.status
- this.taskForm = deepClone(row)
- switch (this.taskStatus) {
- case '0':
- this.active = 0
- this.zeroTitle = '待分句'
- break
- case '1':
- this.active = 0
- this.zeroTitle = '分句中'
- break
- case '2':
- this.active = 1
- this.zeroTitle = '分句'
- this.getClauseListAPI({ taskId: row.id })
- this.oneTitle = '待抽取'
- break
- case '3':
- this.active = 1
- this.oneTitle = '抽取中'
- this.getClauseListAPI({ taskId: row.id })
- break
- case '4':
- this.active = 2
- this.oneTitle = '抽取'
- this.getClauseListAPI({ taskId: row.id })
- this.twoTitle = '审核中'
- break
- case '5':
- this.active = 2
- this.getClauseListAPI({ taskId: row.id })
- this.twoTitle = '入库中'
- break
- case '6':
- this.twoTitle = '审核'
- this.threeTitle = '已入库'
- this.getVisuallyAPI(row)
- this.active = 3
- break
- default:
- break
- }
- this.detailDialogVisible = true
- },
- async getVisuallyAPI(row) {
- try {
- const { code, data } = await getVisually({ ossId: row.ossId })
- if (code === 200) {
- // const newData = this.handleData(JSON.parse(data))
- // console.log('newData', newData)
- const categories = []
- data.data.forEach((node) => {
- const flag = categories.find((item) => {
- return item.name === node.category
- })
- if (!flag) {
- categories.push({ name: node.category })
- }
- })
- data.categories = categories
- this.graphData = data
- console.log('this.graphData', this.graphData)
- }
- } catch (error) {}
- },
- handleData(data) {
- if (data) {
- // const newData = eval('(' + data + ')')
- // data.data = graphData
- const categories = []
- data.data.forEach((node) => {
- const flag = categories.find((item) => {
- return item.name === node.category
- })
- if (!flag) {
- categories.push({ name: node.category })
- }
- })
- data.categories = categories
- }
- return data
- },
- detailHandleClose() {
- this.detailDialogVisible = false
- this.taskForm = {
- id: '',
- ossId: '',
- status: '',
- taskName: '',
- fileName: '',
- taskType: ''
- }
- this.clauseForm = {
- id: '',
- taskId: '',
- clause: '',
- status: ''
- }
- },
- clauseHandleClose() {
- this.clauseDialogVisible = false
- this.clauseForm = {
- id: '',
- taskId: '',
- clause: '',
- status: ''
- }
- },
- extractHandleClose() {
- this.extractDialogVisible = false
- this.extractData = {
- content: '',
- extractDetailTable: []
- }
- },
- addERHandleClose() {
- this.addERDialogVisible = false
- this.addERForm = {
- clauseId: '',
- headEntity: '',
- headEntityClass: '',
- relation: '',
- tailEntity: '',
- tailEntityClass: ''
- }
- },
- async handleClause() {
- this.clauseLoading = true
- this.taskForm.taskType = 0
- try {
- const { code } = await taskPro(this.taskForm)
- if (code === 200) {
- this.$message({
- type: 'success',
- message: '文件开始分句中,稍后刷新页面查看进度',
- duration: 5000
- })
- this.getTaskListAPI()
- this.detailDialogVisible = false
- this.clauseLoading = false
- this.active = 1
- }
- } catch (error) {
- this.clauseLoading = false
- this.$message({
- type: 'warning',
- message: '接口错误请联系管理员'
- })
- }
- },
- async handleExtract() {
- this.extractLoading = true
- this.taskForm.taskType = 2
- try {
- const { code } = await taskPro(this.taskForm)
- if (code === 200) {
- this.$message({
- type: 'success',
- message: '文件开始抽取中,稍后刷新页面查看进度',
- duration: 5000
- })
- this.getTaskListAPI()
- this.detailDialogVisible = false
- this.extractLoading = false
- this.active = 2
- }
- } catch (error) {
- this.extractLoading = false
- this.$message({
- type: 'warning',
- message: '接口错误请联系管理员'
- })
- }
- },
- async handleStorage() {
- this.storageLoading = true
- this.taskForm.taskType = 4
- try {
- const { code } = await taskPro(this.taskForm)
- if (code === 200) {
- this.$message({
- type: 'success',
- message: '文件开始入库中,稍后刷新页面查看进度',
- duration: 5000
- })
- this.getTaskListAPI()
- this.detailDialogVisible = false
- this.storageLoading = false
- this.active = 2
- }
- } catch (error) {
- this.storageLoading = false
- this.$message({
- type: 'warning',
- message: '接口错误请联系管理员'
- })
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .content {
- width: 100%;
- height: 500px;
- display: flex;
- .left {
- width: 30%;
- padding: 20px;
- // font-size: 1.1rem;
- color: white;
- border-right: 1px solid #eeeeee;
- overflow: hidden;
- }
- .right {
- width: 70%;
- }
- }
- </style>
|