123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- <template>
- <div>
- <el-container>
- <el-header>
- <el-steps :active="parseInt(task.status)" simple direction finish-status="wait" process-status="finish">
- <el-step title="知识加工" icon="el-icon-cpu"></el-step>
- <el-step title="人工审核" icon="el-icon-s-custom"></el-step>
- <el-step title="数据入库" icon="el-icon-document-checked"></el-step>
- </el-steps>
- </el-header>
- <el-main>
- <el-table v-loading="loading" :data="subTaskList">
- <el-table-column type="index" width="50"/>
- <el-table-column label="子任务名称" align="center" prop="type">
- <template slot-scope="scope">
- <dict-tag :options="dict.type.extract_sub_task_list" :value="scope.row.type"/>
- </template>
- </el-table-column>
- <el-table-column label="任务状态" align="center" prop="status">
- <template slot-scope="scope">
- <dict-tag :options="dict.type.extract_sub_task_status" :value="scope.row.status"/>
- </template>
- </el-table-column>
- <el-table-column label="启动时间" align="center" prop="createTime" width="180">
- </el-table-column>
- <el-table-column label="花费时间(s)" align="center" prop="costTime" />
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
- <template slot-scope="scope">
- <el-button
- v-show="scope.row.status >= 1"
- size="mini"
- type="text"
- icon="el-icon-warning-outline"
- @click="viewSentence(scope.row)"
- v-hasPermi="['extract:subTask:edit']"
- >查看分句</el-button>
- <el-button
- v-show="scope.row.status == 1"
- size="mini"
- type="text"
- icon="el-icon-warning-outline"
- @click="handleApprove(scope.row)"
- v-hasPermi="['extract:subTask:edit']"
- >审核</el-button>
- <el-button
- v-show="scope.row.status == 3"
- size="mini"
- type="text"
- icon="el-icon-warning-outline"
- @click="viewResult(scope.row)"
- v-hasPermi="['extract:subTask:edit']"
- >查看抽取结果</el-button>
- <el-button
- v-show="scope.row.status == 4"
- size="mini"
- type="text"
- icon="el-icon-finished"
- @click="handleViewLog(scope.row)"
- v-hasPermi="['extract:subTask:edit']"
- >查看日志</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getListByTaskId"
- />
- </el-main>
- </el-container>
- <!-- 添加或修改知识抽取子任务对话框 -->
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
- <el-form-item label="抽取任务id" prop="taskId">
- <el-input v-model="form.taskId" placeholder="请输入抽取任务id" />
- </el-form-item>
- <el-form-item label="子任务类型" prop="type">
- <el-select v-model="form.type" placeholder="请选择子任务类型">
- <el-option
- v-for="dict in dict.type.extract_sub_task_list"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="任务状态">
- <el-radio-group v-model="form.status">
- <el-radio
- v-for="dict in dict.type.extract_sub_task_status"
- :key="dict.value"
- :label="dict.value"
- >{{dict.label}}</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="日志" prop="log">
- <el-input v-model="form.log" type="textarea" placeholder="请输入内容" />
- </el-form-item>
- <el-form-item label="完成时间" prop="completedDate">
- <el-date-picker clearable
- v-model="form.completedDate"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="请选择完成时间">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="花费时间(s)" prop="costTime">
- <el-input v-model="form.costTime" placeholder="请输入花费时间(s)" />
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- <el-dialog :title="tripletInfoOpenTitle" v-if="tripletInfoOpen" :visible.sync="tripletInfoOpen" width="80%" append-to-body destroy-on-close :close-on-click-modal="false">
- <!-- <TripletInfo :subTask="subTask" :subTaskOpen.sync="tripletInfoOpen" @closeInfo="closeInfo"></TripletInfo> -->
- <IndexV2 :subTask="subTask" @closeInfo="closeInfo" :readonly="tripletInfoReadOnly"/>
- </el-dialog>
- <el-dialog title="分句结果" v-if="viewSentenceOpen" :visible.sync="viewSentenceOpen" width="80%" append-to-body destroy-on-close :close-on-click-modal="false">
- <p v-for="sentence in sentenceList" :key="sentence.id">
- {{ sentence.id }}. {{ sentence.text }}
- </p>
- </el-dialog>
- </div>
- </template>
- <script>
- import { listSubTask, getSubTask, delSubTask, addSubTask, updateSubTask } from "@/api/extract/subTask";
- import { getSentence } from "@/api/extract/result";
- import TripletInfo from '@/views/extract/info';
- import IndexV2 from '@/views/extract/info/indexV2';
- export default {
- name: "SubTask",
- dicts: ['extract_sub_task_status', 'extract_sub_task_list'],
- components: { TripletInfo,IndexV2 },
- props: {
- task: {
- type: Object,
- },
- subTaskOpen: {
- type: Boolean,
- },
- },
-
- data() {
- return {
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 知识抽取子任务表格数据
- subTaskList: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 步骤
- setp: 1,
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- taskId: this.task.id,
- },
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- taskId: [
- { required: true, message: "抽取任务id不能为空", trigger: "blur" }
- ],
- },
- tripletInfoOpenTitle: "",
- tripletInfoOpen: false,
- subTask: {},
- viewSentenceOpen: false,
- sentenceList: [],
- tripletInfoReadOnly: false,
- };
- },
- created() {
- this.getListByTaskId();
- },
- methods: {
- /** 查询知识抽取子任务列表 */
- // getList() {
- // this.loading = true;
- // listSubTask(this.queryParams).then(response => {
- // this.subTaskList = response.rows;
- // this.total = response.total;
- // this.loading = false;
- // });
- // },
- /** 查询知识抽取子任务列表 */
- getListByTaskId() {
- this.loading = true;
- listSubTask(this.queryParams).then(response => {
- this.subTaskList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- id: null,
- taskId: null,
- type: null,
- status: "0",
- log: null,
- completedDate: null,
- costTime: null,
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.handleQuery();
- },
- // 多选框选中数据
- // handleSelectionChange(selection) {
- // this.ids = selection.map(item => item.id)
- // this.single = selection.length!==1
- // this.multiple = !selection.length
- // },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- this.open = true;
- this.title = "添加知识抽取子任务";
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- const id = row.id || this.ids
- getSubTask(id).then(response => {
- this.form = response.data;
- this.open = true;
- this.title = "修改知识抽取子任务";
- });
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- if (this.form.id != null) {
- updateSubTask(this.form).then(response => {
- this.$modal.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- });
- } else {
- addSubTask(this.form).then(response => {
- this.$modal.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- });
- }
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const ids = row.id || this.ids;
- this.$modal.confirm('是否确认删除知识抽取子任务编号为"' + ids + '"的数据项?').then(function() {
- return delSubTask(ids);
- }).then(() => {
- this.getList();
- this.$modal.msgSuccess("删除成功");
- }).catch(() => {});
- },
- /** 导出按钮操作 */
- handleExport() {
- this.download('extract/subTask/export', {
- ...this.queryParams
- }, `subTask_${new Date().getTime()}.xlsx`)
- },
- closeSubTask() {
- this.subTaskOpen = false;
- },
- handleApprove(row){
- this.tripletInfoReadOnly = false
- this.tripletInfoOpen = true
- this.tripletInfoOpenTitle = this.dict.label.extract_sub_task_list[row.type]
- this.subTask = row
- },
- handleViewLog(row){
- this.$alert(row.log, '日志', {
- confirmButtonText: '确定',
- });
- },
- closeInfo(){
- this.tripletInfoOpen = false
- this.tripletInfoOpenTitle = ''
- this.subTask = {}
- this.getListByTaskId()
- },
- viewSentence(row){
- getSentence(row.id).then(resp => {
- this.sentenceList = resp.data
- this.viewSentenceOpen = true
- })
- },
- viewResult(row){
- debugger
- this.tripletInfoReadOnly = true
- this.tripletInfoOpen = true
- this.tripletInfoOpenTitle = this.dict.label.extract_sub_task_list[row.type]
- this.subTask = row
- }
- }
- };
- </script>
- <style scoped>
- .el-dialog__body {
- padding: 0px
- }
- </style>
|