extractList.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <div class="view-table-content">
  3. <div style="width: 100%">
  4. <div style="width: 80%; margin-left: 10%">
  5. <!-- 分句、抽取、审核、入库 -->
  6. <el-steps :active="active" finish-status="success" process-status="finish">
  7. <!-- 需要判断分句中、抽取中、。。。。 -->
  8. <el-step title="分句"></el-step>
  9. <el-step title="抽取"></el-step>
  10. <el-step title="审核"></el-step>
  11. <el-step title="入库"></el-step>
  12. </el-steps>
  13. </div>
  14. <div class="view-dataType-title-btn" style="float: right; margin: 10px">
  15. <el-button v-if="active === 0" type="primary">返 回</el-button>
  16. <el-button style="margin-right: 300px" v-if="active === 0" type="warning" @click="handleClause">分 句</el-button>
  17. <el-button v-if="active === 1" type="warning" @click="handleExtract">抽 取</el-button>
  18. <div style="clear: both"></div>
  19. </div>
  20. <div class="view-dataType-table">
  21. <div v-if="active === 0" style="width: 500px; margin: 50px 0px 0px 300px">
  22. <el-form ref="taskFormRef" disabled :model="taskForm" label-width="80px">
  23. <el-form-item label="任务名称" prop="taskName">
  24. <el-input v-model="taskForm.taskName" />
  25. </el-form-item>
  26. <el-form-item label="抽取文件" prop="fileName">
  27. <el-input v-model="taskForm.fileName" />
  28. </el-form-item>
  29. </el-form>
  30. </div>
  31. <LTable ref="table" v-if="active === 1" @selection-change="selection" :defaultFetch="false" :fetch="fetch" :columns="clauseColumns" :dataSource="clauseTableData" :options="clauseOptions" :pagination="clauseTableRequset"></LTable>
  32. </div>
  33. <!-- 添加或修改模型信息对话框 -->
  34. <el-dialog :title="clauseDialogTitle" :visible.sync="clauseDialogVisible" width="600px" :before-close="handleClauseClose">
  35. <el-form ref="clauseFormRef" :model="clauseForm" label-width="80px">
  36. <el-form-item label="内容" prop="content">
  37. <el-input type="textarea" :rows="2" v-model="clauseForm.content" />
  38. </el-form-item>
  39. </el-form>
  40. <span slot="footer" class="dialog-footer">
  41. <el-button @click="handleClauseClose">取 消</el-button>
  42. <el-button type="primary" @click="clauseSubmit">确 定</el-button>
  43. </span>
  44. </el-dialog>
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. import { getTaskListAPI, addTaskAPI, getTaskInfoAPI, getClauseListAPI, updateClauseAPI, removeClauseAPI } from '@/api/als/knowledgeExtraction'
  50. import { getAtlasFile } from '@/api/als/atlasFile'
  51. import { getOssIdDataAPI } from '@/api/als/algorithm'
  52. import { deepClone, debounce } from '@/utils/index'
  53. // import FileUpload from '@/views/als/components/FileUpload'
  54. export default {
  55. name: 'ExtractList',
  56. components: {},
  57. data() {
  58. // 这里存放数据
  59. return {
  60. dialogTitle: '新增',
  61. dialogVisible: false,
  62. clauseDialogTitle: '编辑',
  63. clauseDialogVisible: false,
  64. keyWordData: '',
  65. searchValue: '',
  66. clauseColumns: [
  67. {
  68. prop: 'content',
  69. label: '内容'
  70. },
  71. {
  72. prop: 'status',
  73. label: '状态',
  74. width: '240px',
  75. render: (h, params) => {
  76. return h('span', { class: 'success-state' }, '已分句')
  77. }
  78. },
  79. {
  80. button: true,
  81. label: '操作',
  82. width: '240px',
  83. group: [
  84. {
  85. name: '编辑',
  86. type: 'text',
  87. round: false,
  88. plain: false,
  89. onClick: (row, index, scope) => {
  90. this.clauseHandUpdate(row)
  91. }
  92. },
  93. {
  94. name: '删除',
  95. type: 'text',
  96. round: false,
  97. plain: false,
  98. onClick: (row, index, scope) => {
  99. this.clauseRemove([row])
  100. }
  101. }
  102. ]
  103. }
  104. ],
  105. clauseOptions: {
  106. stripe: false, // 斑马纹
  107. mutiSelect: false, // 多选框
  108. index: true, // 显示序号, 多选则 mutiSelect
  109. loading: false, // 表格动画
  110. initTable: false, // 是否一挂载就加载数据
  111. border: true,
  112. height: 'calc(100vh - 335px)'
  113. },
  114. tableCheckItems: [],
  115. clauseTableData: [{ content: 'XXXXXXXXX水水水水水水水' }, { content: 'mmmmmmmmmmmAAAAAAAAAAA' }],
  116. clauseTableRequset: {
  117. total: 0,
  118. pageIndex: 1,
  119. pageSize: 20,
  120. searchValue: ''
  121. },
  122. form: {
  123. id: '',
  124. file: ''
  125. },
  126. debounceFn: debounce(this.fetch, 500),
  127. fileList: [],
  128. extractId: '',
  129. active: 0,
  130. taskForm: {
  131. id: '',
  132. taskName: '任务名称',
  133. fileName: '抽取文件'
  134. },
  135. clauseForm: {
  136. content: ''
  137. }
  138. }
  139. },
  140. watch: {
  141. keyWord() {
  142. this.clauseTableRequset.pageIndex = 1
  143. this.debounceFn()
  144. }
  145. },
  146. mounted() {
  147. this.extractId = this.$route.query.id
  148. this.getAtlasFileAPI()
  149. },
  150. methods: {
  151. async getAtlasFileAPI(params) {
  152. const {
  153. data: { list, total }
  154. } = await getAtlasFile()
  155. this.fileList = list
  156. },
  157. async removeknowledgeExtractionAPI(params) {
  158. try {
  159. const { code } = await removeknowledgeExtraction(params)
  160. if (code === 200) {
  161. this.$message({
  162. type: 'success',
  163. message: '操作成功!'
  164. })
  165. await this.getknowledgeExtractionAPI()
  166. this.handleClose()
  167. }
  168. } catch (error) {}
  169. },
  170. async getknowledgeExtractionAPI(params) {
  171. if (this.$refs.table) this.$refs.table.clearSelection()
  172. const { keyWord } = this
  173. const { pageSize, pageIndex } = this.clauseTableRequset
  174. const {
  175. data: { list, total }
  176. } = await getknowledgeExtraction({ pageSize, pageNum: pageIndex, ...params })
  177. this.clauseTableData = list
  178. this.clauseTableRequset.total = total
  179. },
  180. fetch() {
  181. this.getknowledgeExtractionAPI()
  182. },
  183. async searchClick() {
  184. this.getknowledgeExtractionAPI({ name: keyWordData })
  185. },
  186. async updateknowledgeExtractionAPI() {
  187. try {
  188. const { code } = await updateknowledgeExtraction({ ...this.clauseForm })
  189. if (code === 200) {
  190. this.$message({
  191. type: 'success',
  192. message: '操作成功!'
  193. })
  194. this.handleClose()
  195. this.getknowledgeExtractionAPI()
  196. }
  197. } catch (error) {}
  198. },
  199. openDialog() {
  200. this.dialogTitle = '新增'
  201. this.clauseDialogVisible = true
  202. },
  203. handleClose() {
  204. this.taskForm = {
  205. id: '',
  206. taskName: '',
  207. fileName: ''
  208. }
  209. },
  210. handleClauseClose() {
  211. this.clauseDialogVisible = false
  212. this.clauseForm = {
  213. content: ''
  214. }
  215. },
  216. handleClause() {
  217. // 调用分句接口
  218. this.active = 1
  219. },
  220. handleExtract() {
  221. // 调用抽取
  222. this.active = 2
  223. },
  224. clauseHandUpdate(row) {
  225. this.clauseDialogTitle = '编辑'
  226. this.clauseForm = deepClone(row)
  227. this.clauseDialogVisible = true
  228. },
  229. clauseSubmit() {
  230. switch (this.clauseDialogTitle) {
  231. case '编辑':
  232. // this.updateknowledgeExtractionAPI()
  233. break
  234. }
  235. },
  236. selection(val) {
  237. this.tableCheckItems = val
  238. },
  239. clauseRemove(row) {
  240. this.$confirm('是否删除该数据', '提示', {
  241. confirmButtonText: '确定',
  242. cancelButtonText: '取消',
  243. type: 'warning'
  244. })
  245. .then(() => {
  246. this.removeknowledgeExtractionAPI(row.map((e) => e.id))
  247. })
  248. .catch(() => {})
  249. },
  250. async handleFile() {
  251. const res = await getOssIdDataAPI(this.form.file)
  252. console.log('res', res)
  253. // const res =await getknowledgeExtraction()
  254. },
  255. checkExtractList() {}
  256. }
  257. }
  258. </script>
  259. <style lang="scss" scoped>
  260. @import '../index.scss';
  261. </style>