Rmengdi 4 ماه پیش
والد
کامیت
88ab96943c

+ 6 - 0
src/api/als/entityManage.js

@@ -0,0 +1,6 @@
+import { get } from '@/http/index'
+
+// 查询文件管理信息列表
+export const getEntityList = async (data) => {
+  return await get('/entity/getAllEntities/', data)
+}

+ 9 - 0
src/router/modules/als/knowledgeGraph.js

@@ -37,6 +37,15 @@ export const knowledgeExtraction = {
         title: '知识抽取'
       },
       sort: 2
+    },
+    {
+      path: '/knowledgeGraph/extractList',
+      component: () => import('@/views/als/knowledgeExtraction/extractList.vue'),
+      name: 'ExtractList',
+      meta: {
+        title: '抽取列表',
+        hide: true
+      }
     }
   ]
 }

+ 283 - 0
src/views/als/knowledgeExtraction/extractList.vue

@@ -0,0 +1,283 @@
+<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="tableRequset"></LTable>
+      </div>
+      <!-- 添加或修改模型信息对话框 -->
+      <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="600px" :before-close="handleClose">
+        <el-form ref="form" :model="form" label-width="80px">
+          <!-- <el-form-item label="文件名称" prop="fileName">
+            <el-input v-model="form.fileName" placeholder="请输入文件名称" />
+          </el-form-item>
+          <el-form-item label="文件类型" prop="fileType">
+            <el-select v-model="form.fileType" placeholder="请选择文件类型">
+              <el-option v-for="item in fileTypeList" :key="item.key" :label="item.name" :value="item.key" />
+            </el-select>
+          </el-form-item> -->
+          <el-form-item label="选择抽取文件" label-width="100px" prop="file">
+            <el-select v-model="form.file" placeholder="请选择文件" @change="handleFile">
+              <el-option v-for="item in fileList" :key="item.ossId" :label="item.fileName" :value="item.ossId" />
+            </el-select>
+            <!-- <FileUpload v-model="form.ossId" :limit="1" :fileSize="500" :fileType="['docx', 'doc', 'pdf', 'txt']" /> -->
+          </el-form-item>
+          <!-- <el-form-item label="备注" prop="remarks">
+            <el-input type="textarea" :rows="2" v-model="form.remarks" placeholder="请输入备注" />
+          </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>
+    </div>
+  </div>
+</template>
+
+<script>
+import { getknowledgeExtraction, addknowledgeExtraction, updateknowledgeExtraction, removeknowledgeExtraction } 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,
+      keyWordData: '',
+      searchValue: '',
+      columns: [
+        {
+          prop: 'file',
+          label: '文件'
+        },
+        {
+          prop: 'status',
+          label: '文件名称'
+        },
+        // {
+        //   prop: 'fileType',
+        //   label: '文件类型'
+        // },
+        // {
+        //   prop: 'ossId',
+        //   label: '文件编号'
+        // },
+        // {
+        //   prop: 'remarks',
+        //   label: '备注'
+        // },
+        {
+          button: true,
+          label: '操作',
+          width: '240px',
+          group: [
+            {
+              name: '查看抽取结果',
+              type: 'text',
+              round: false,
+              plain: false,
+              onClick: (row, index, scope) => {
+                this.checkExtractList(row)
+              }
+            }
+            // {
+            //   name: '删除',
+            //   type: 'text',
+            //   round: false,
+            //   plain: false,
+            //   onClick: (row, index, scope) => {
+            //     this.remove([row])
+            //   }
+            // }
+          ]
+        }
+      ],
+      options: {
+        stripe: true, // 斑马纹
+        mutiSelect: true, // 多选框
+        index: false, // 显示序号, 多选则 mutiSelect
+        loading: false, // 表格动画
+        initTable: false, // 是否一挂载就加载数据
+        border: true,
+        height: 'calc(100vh - 300px)'
+      },
+      tableCheckItems: [],
+      tableData: [],
+      tableRequset: {
+        total: 0,
+        pageIndex: 1,
+        pageSize: 10,
+        searchValue: ''
+      },
+      form: {
+        id: '',
+        file: ''
+      },
+      debounceFn: debounce(this.fetch, 500),
+      fileList: [],
+      extractId: ''
+    }
+  },
+  watch: {
+    keyWord() {
+      this.tableRequset.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.tableRequset
+      const {
+        data: { list, total }
+      } = await getknowledgeExtraction({ pageSize, pageNum: pageIndex, ...params })
+      this.tableData = list
+      this.tableRequset.total = total
+    },
+
+    fetch() {
+      this.getknowledgeExtractionAPI()
+    },
+
+    async searchClick() {
+      this.getknowledgeExtractionAPI({ name: keyWordData })
+    },
+
+    async addknowledgeExtractionAPI() {
+      try {
+        delete this.form.aircaftModelName
+        const { code } = await addknowledgeExtraction({ ...this.form })
+        if (code === 200) {
+          this.$message({
+            type: 'success',
+            message: '操作成功!'
+          })
+          this.handleClose()
+          this.getknowledgeExtractionAPI()
+        }
+      } catch (error) {}
+    },
+
+    async updateknowledgeExtractionAPI() {
+      try {
+        const { code } = await updateknowledgeExtraction({ ...this.form })
+        if (code === 200) {
+          this.$message({
+            type: 'success',
+            message: '操作成功!'
+          })
+          this.handleClose()
+          this.getknowledgeExtractionAPI()
+        }
+      } catch (error) {}
+    },
+
+    openDialog() {
+      this.dialogTitle = '新增'
+      this.dialogVisible = true
+    },
+
+    handleClose() {
+      this.dialogVisible = false
+      this.form = {
+        id: '',
+        fileName: '',
+        fileType: '',
+        ossId: '',
+        status: '',
+        remarks: ''
+      }
+    },
+
+    handUpdate(row) {
+      this.dialogTitle = '编辑'
+      this.form = deepClone(row)
+      this.dialogVisible = true
+    },
+
+    submit() {
+      switch (this.dialogTitle) {
+        case '编辑':
+          this.updateknowledgeExtractionAPI()
+
+          break
+        case '新增':
+          this.addknowledgeExtractionAPI()
+
+          break
+      }
+    },
+
+    selection(val) {
+      this.tableCheckItems = val
+    },
+
+    remove(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>

+ 18 - 15
src/views/als/knowledgeExtraction/index.vue

@@ -68,10 +68,10 @@ export default {
           prop: 'file',
           label: '文件'
         },
-        // {
-        //   prop: 'fileName',
-        //   label: '文件名称'
-        // },
+        {
+          prop: 'status',
+          label: '状态'
+        },
         // {
         //   prop: 'fileType',
         //   label: '文件类型'
@@ -90,23 +90,23 @@ export default {
           width: '240px',
           group: [
             {
-              name: '编辑',
+              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])
+                this.checkExtractList(row)
               }
             }
+            // {
+            //   name: '删除',
+            //   type: 'text',
+            //   round: false,
+            //   plain: false,
+            //   onClick: (row, index, scope) => {
+            //     this.remove([row])
+            //   }
+            // }
           ]
         }
       ],
@@ -271,6 +271,9 @@ export default {
       const res = await getOssIdDataAPI(this.form.file)
       console.log('res', res)
       // const res =await getknowledgeExtraction()
+    },
+    checkExtractList(row) {
+      this.$router.push({ name: 'ExtractList', query: { id: row.id } })
     }
   }
 }

+ 1 - 1
vue.config.js

@@ -16,7 +16,7 @@ module.exports = defineConfig({
         }
       },
       ['/api/kgqa']: {
-        target: 'http://192.168.0.105:8000',
+        target: 'http://192.168.0.106:8000',
         ws: false,
         changeOrigin: true,
         pathRewrite: {