209 lines
6.3 KiB
Vue
209 lines
6.3 KiB
Vue
<template>
|
|
<div>
|
|
<div class="menu-title">
|
|
知识图谱本体管理
|
|
</div>
|
|
<div class="menu-content">
|
|
<div>
|
|
<el-form :inline="true" :model="qo" class="demo-form-inline">
|
|
<el-form-item label="本体名称:">
|
|
<el-input v-model="qo.LIKES_name" placeholder="请输入本体名称" style="width: 300px"></el-input>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" icon="el-icon-search" @click="qo.pageNo=1;queryData()">搜 索</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</div>
|
|
<div style="margin: 0px 0 20px 0">
|
|
<el-button type="primary" @click="createRow()" icon="el-icon-plus">新建知识图谱本体</el-button>
|
|
</div>
|
|
<div>
|
|
<el-table :data="result.records" style="width: 100%">
|
|
<el-table-column type="index" label="行号" width="100"></el-table-column>
|
|
<el-table-column prop="name" label="本体名称"></el-table-column>
|
|
<el-table-column prop="description" label="本体描述"></el-table-column>
|
|
<el-table-column prop="createTime" label="创建时间"></el-table-column>
|
|
<el-table-column label="操作">
|
|
<template slot-scope="scope">
|
|
<el-button @click.native.prevent="modifyRow(scope.row)" type="text" size="small">
|
|
本体描述
|
|
</el-button>
|
|
<el-button @click.native.prevent="updateModel(scope.row)" type="text" size="small">
|
|
编辑本体
|
|
</el-button>
|
|
<el-button @click.native.prevent="removeRow(scope.row)" type="text" size="small">
|
|
删除
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</div>
|
|
<div class="page-box">
|
|
<el-pagination background
|
|
@current-change="handleCurrentChange"
|
|
:current-page="qo.pageNo"
|
|
:page-size="qo.pageSize"
|
|
layout="total, prev, pager, next"
|
|
:total="result.total">
|
|
</el-pagination>
|
|
</div>
|
|
</div>
|
|
<el-dialog
|
|
:title="dialogName"
|
|
:visible.sync="cmdDialogVisible"
|
|
width="40%">
|
|
<el-form ref="cmd" label-width="100px" :rules="rules" :model="cmd">
|
|
<el-form-item label="本体名称" prop="name">
|
|
<el-input v-model="cmd.name" placeholder="请输入本体名称"></el-input>
|
|
</el-form-item>
|
|
<!-- <el-form-item label="类型选择" prop="name">-->
|
|
<!-- <el-select v-model="cmd.sourceType">-->
|
|
<!-- <el-option v-for="item in sourceTypeList" :key="item.value" :label="item.name" :value="item.value"></el-option>-->
|
|
<!-- </el-select>-->
|
|
<!-- </el-form-item>-->
|
|
<el-form-item label="本体描述">
|
|
<el-input v-model="cmd.description" placeholder="请输入本体描述" type="textarea"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button @click="cmdDialogVisible = false">取 消</el-button>
|
|
<el-button type="primary" @click="submitModify">确 定</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import request from '@/utils/request';
|
|
|
|
var _this;
|
|
export default {
|
|
name: "company",
|
|
data() {
|
|
return {
|
|
qo: {
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
LIKES_name: '',
|
|
EQI_sourceType: 1
|
|
},
|
|
result: {
|
|
records: [],
|
|
total: 0
|
|
},
|
|
sourceTypeList: [
|
|
{name: '自定义本体', value: 1},
|
|
{name: '标注系统', value: 2}
|
|
],
|
|
dialogName: '编辑',
|
|
cmdDialogVisible: false,
|
|
cmd: {},
|
|
rules: {
|
|
name: [
|
|
{required: true, message: '请输入模型名称'}
|
|
],
|
|
}
|
|
}
|
|
},
|
|
mounted() {
|
|
_this = this;
|
|
let _pageNo = this.$route.query.pageNo;
|
|
let _name = this.$route.query.name;
|
|
if (_pageNo) {
|
|
_this.qo.pageNo = parseInt(_pageNo);
|
|
}
|
|
if (_name) {
|
|
_this.qo.LIKES_name = _name;
|
|
}
|
|
_this.queryData();
|
|
},
|
|
methods: {
|
|
queryData() {
|
|
request({
|
|
url: '/ontology/query_pages',
|
|
method: 'post',
|
|
data: _this.qo
|
|
}).then(res => {
|
|
_this.result.records = res.data.records;
|
|
_this.result.total = res.data.total;
|
|
});
|
|
},
|
|
handleCurrentChange(val) {
|
|
_this.qo.pageNo = val;
|
|
_this.queryData();
|
|
},
|
|
removeRow(item) {
|
|
_this.$confirm('此操作将永久删除记录, 是否继续?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
request({
|
|
url: '/ontology/remove/' + item.id,
|
|
method: 'post'
|
|
}).then(res => {
|
|
_this.$message.success("删除成功");
|
|
_this.queryData();
|
|
});
|
|
}).catch(() => {
|
|
});
|
|
},
|
|
updateModel(item) {
|
|
this.$router.push({
|
|
path: "/graphModel_g",
|
|
query: {id: item.id, pageNo: _this.qo.pageNo, name: _this.qo.LIKES_name, graphName: item.name}
|
|
})
|
|
},
|
|
createRow() {
|
|
_this.cmd = {
|
|
name: '',
|
|
sourceType: 1,
|
|
description: ''
|
|
};
|
|
_this.dialogName = '新建';
|
|
_this.cmdDialogVisible = true;
|
|
},
|
|
modifyRow(item) {
|
|
_this.cmd = JSON.parse(JSON.stringify(item));
|
|
_this.dialogName = '编辑';
|
|
_this.cmdDialogVisible = true;
|
|
},
|
|
submitModify() {
|
|
this.$refs.cmd.validate((valid) => {
|
|
if (valid) {
|
|
if (_this.cmd.id) {
|
|
request({
|
|
url: '/ontology/modify',
|
|
method: 'post',
|
|
data: _this.cmd
|
|
}).then(res => {
|
|
_this.$message.success("编辑成功");
|
|
_this.queryData();
|
|
_this.cmdDialogVisible = false;
|
|
});
|
|
} else { // 新建
|
|
request({
|
|
url: '/ontology/create',
|
|
method: 'post',
|
|
data: _this.cmd
|
|
}).then(res => {
|
|
_this.$message.success("添加成功");
|
|
// _this.queryData();
|
|
_this.cmdDialogVisible = false;
|
|
_this.updateModel(res.data);
|
|
});
|
|
}
|
|
|
|
}
|
|
});
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.ca {
|
|
color: rgb(51, 51, 51);
|
|
}
|
|
</style>
|