|
@@ -3,34 +3,45 @@
|
|
<div style="width: 100%">
|
|
<div style="width: 100%">
|
|
<div class="view-dataType-title">
|
|
<div class="view-dataType-title">
|
|
<div class="view-dataType-title-btn">
|
|
<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>
|
|
|
|
|
|
+ <el-button type="success" @click="openDialog()">新增</el-button>
|
|
|
|
+ <el-button type="warning" @click="reset()">重置</el-button>
|
|
</div>
|
|
</div>
|
|
<div class="view-dataType-title-search">
|
|
<div class="view-dataType-title-search">
|
|
- <el-input placeholder="请输入名称" v-model="keyWordData" class="input1">
|
|
|
|
|
|
+ <el-input placeholder="请输入实体名称" v-model="keyWordData" class="input1">
|
|
<el-button slot="append" icon="el-icon-search" @click="searchClick"></el-button>
|
|
<el-button slot="append" icon="el-icon-search" @click="searchClick"></el-button>
|
|
</el-input>
|
|
</el-input>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="view-dataType-table">
|
|
<div class="view-dataType-table">
|
|
- <LTable ref="table" @selection-change="selection" :defaultFetch="false" :fetch="fetch" :columns="columns" :dataSource="tableData" :options="options" :pagination="tableRequset"></LTable>
|
|
|
|
|
|
+ <LTable ref="table" @selection-change="selection" :defaultFetch="false" :fetch="fetch" :columns="columns" :dataSource="tableData" :options="options"></LTable>
|
|
</div>
|
|
</div>
|
|
<!-- 添加或修改模型信息对话框 -->
|
|
<!-- 添加或修改模型信息对话框 -->
|
|
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="600px" :before-close="handleClose">
|
|
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="600px" :before-close="handleClose">
|
|
<el-form ref="form" :model="form" label-width="80px">
|
|
<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 label="主体类型" prop="subjectCategory">
|
|
|
|
+ <el-input :disabled="dialogTitle === '编辑'" v-model="form.subjectCategory" placeholder="请输入实体名称" />
|
|
|
|
+ <!-- <el-select v-model="form.subjectCategory" placeholder="请选择主体类型">
|
|
|
|
+ <el-option v-for="(item, index) in subjectList" :key="index" :label="item.name" :value="item.name" />
|
|
|
|
+ </el-select> -->
|
|
</el-form-item>
|
|
</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 label="主体名称" prop="subjectName">
|
|
|
|
+ <el-input v-model="form.subjectName" placeholder="请输入实体名称" :disabled="dialogTitle === '编辑'" />
|
|
|
|
+ <!-- <el-select v-model="form.subjectName" placeholder="请选择实体类型">
|
|
|
|
+ <el-option v-for="(item, index) in subjectList" :key="index" :label="item.name" :value="item.name" />
|
|
|
|
+ </el-select> -->
|
|
|
|
+ </el-form-item>
|
|
|
|
+
|
|
|
|
+ <el-form-item label="客体名称" prop="objectName">
|
|
|
|
+ <el-input :disabled="dialogTitle === '编辑'" v-model="form.objectName" placeholder="请输入实体名称" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="选择文件" prop="ossId">
|
|
|
|
- <FileUpload v-model="form.ossId" :limit="1" :fileSize="500" :fileType="['docx', 'doc', 'pdf']" />
|
|
|
|
|
|
+ <el-form-item label="客体类型" prop="objectCategory">
|
|
|
|
+ <el-input :disabled="dialogTitle === '编辑'" v-model="form.objectCategory" placeholder="请输入实体类型" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="备注" prop="remarks">
|
|
|
|
- <el-input type="textarea" :rows="2" v-model="form.remarks" placeholder="请输入备注" />
|
|
|
|
|
|
+ <el-form-item label="关系" prop="relationName">
|
|
|
|
+ <el-select v-model="form.relationName" placeholder="请选择实体类型">
|
|
|
|
+ <el-option v-for="(item, index) in relationList" :key="index" :label="item.name" :value="item.name" />
|
|
|
|
+ </el-select>
|
|
|
|
+ <!-- <el-input v-model="form.relationName" placeholder="请输入实体名称" /> -->
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
@@ -44,13 +55,13 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { getAtlasFile, addAtlasFile, updateAtlasFile, removeAtlasFile } from '@/api/als/atlasFile'
|
|
|
|
|
|
+import { getERList, getAllRelationClass, addRelation, updateRelation, deleteRelation } from '@/api/als/ERManage'
|
|
|
|
+import { getEntityList } from '@/api/als/entityManage'
|
|
import { deepClone, debounce } from '@/utils/index'
|
|
import { deepClone, debounce } from '@/utils/index'
|
|
-import FileUpload from '@/views/als/components/FileUpload'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
- name: 'AtlasFile',
|
|
|
|
- components: { FileUpload },
|
|
|
|
|
|
+ name: 'ERManage',
|
|
|
|
+ components: {},
|
|
data() {
|
|
data() {
|
|
// 这里存放数据
|
|
// 这里存放数据
|
|
return {
|
|
return {
|
|
@@ -60,20 +71,24 @@ export default {
|
|
searchValue: '',
|
|
searchValue: '',
|
|
columns: [
|
|
columns: [
|
|
{
|
|
{
|
|
- prop: 'fileName',
|
|
|
|
- label: '文件名称'
|
|
|
|
|
|
+ prop: 'subjectName',
|
|
|
|
+ label: '主体名称'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- prop: 'fileType',
|
|
|
|
- label: '文件类型'
|
|
|
|
|
|
+ prop: 'subjectCategory',
|
|
|
|
+ label: '主体类型'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- prop: 'ossId',
|
|
|
|
- label: '文件编号'
|
|
|
|
|
|
+ prop: 'objectName',
|
|
|
|
+ label: '客体名称'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- prop: 'remarks',
|
|
|
|
- label: '备注'
|
|
|
|
|
|
+ prop: 'objectCategory',
|
|
|
|
+ label: '客体类型'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ prop: 'relationName',
|
|
|
|
+ label: '关系'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
button: true,
|
|
button: true,
|
|
@@ -119,21 +134,17 @@ export default {
|
|
searchValue: ''
|
|
searchValue: ''
|
|
},
|
|
},
|
|
form: {
|
|
form: {
|
|
- id: '',
|
|
|
|
- fileName: '',
|
|
|
|
- fileType: '',
|
|
|
|
- ossId: '',
|
|
|
|
- status: '',
|
|
|
|
- remarks: ''
|
|
|
|
|
|
+ subjectId: '',
|
|
|
|
+ subjectName: '',
|
|
|
|
+ subjectCategory: '',
|
|
|
|
+ objectId: '',
|
|
|
|
+ objectName: '',
|
|
|
|
+ objectCategory: '',
|
|
|
|
+ relationId: '',
|
|
|
|
+ relationName: ''
|
|
},
|
|
},
|
|
debounceFn: debounce(this.fetch, 500),
|
|
debounceFn: debounce(this.fetch, 500),
|
|
- fileTypeList: [
|
|
|
|
- { key: '术语', name: '术语' },
|
|
|
|
- { key: '故障案例', name: '故障案例' },
|
|
|
|
- { key: '专业手册', name: '专业手册' },
|
|
|
|
- { key: '期刊', name: '期刊' },
|
|
|
|
- { key: '其它', name: '其它' }
|
|
|
|
- ]
|
|
|
|
|
|
+ relationList: []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -143,67 +154,140 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
- this.getAtlasFileAPI()
|
|
|
|
|
|
+ this.getInit()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- async removeAtlasFileAPI(params) {
|
|
|
|
|
|
+ async getInit() {
|
|
|
|
+ this.getRelationAPI()
|
|
|
|
+ this.getAllRelationClassAPI()
|
|
|
|
+ // try {
|
|
|
|
+ // if (this.$refs.table) this.$refs.table.clearSelection()
|
|
|
|
+ // const {
|
|
|
|
+ // data: { dataList }
|
|
|
|
+ // } = await getEntityList()
|
|
|
|
+ // this.tableData = dataList
|
|
|
|
+ // } catch (error) {
|
|
|
|
+
|
|
|
|
+ // }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ async deleteRelationAPI(row) {
|
|
try {
|
|
try {
|
|
- const { code } = await removeAtlasFile(params)
|
|
|
|
|
|
+ const deleteData = {
|
|
|
|
+ node_id_heard: row.subjectId,
|
|
|
|
+ node_id_last: row.objectId,
|
|
|
|
+ relation_name: row.relationName
|
|
|
|
+ }
|
|
|
|
+ const { code } = await deleteRelation(deleteData)
|
|
if (code === 200) {
|
|
if (code === 200) {
|
|
this.$message({
|
|
this.$message({
|
|
type: 'success',
|
|
type: 'success',
|
|
message: '操作成功!'
|
|
message: '操作成功!'
|
|
})
|
|
})
|
|
- await this.getAtlasFileAPI()
|
|
|
|
|
|
+ this.getRelationAPI()
|
|
this.handleClose()
|
|
this.handleClose()
|
|
}
|
|
}
|
|
} catch (error) {}
|
|
} catch (error) {}
|
|
},
|
|
},
|
|
|
|
+ reset() {
|
|
|
|
+ this.getRelationAPI()
|
|
|
|
+ this.keyWordData = ''
|
|
|
|
+ },
|
|
|
|
+ async getRelationAPI(params) {
|
|
|
|
+ try {
|
|
|
|
+ if (this.$refs.table) this.$refs.table.clearSelection()
|
|
|
|
+ const {
|
|
|
|
+ data: { dataList, total }
|
|
|
|
+ } = await getERList()
|
|
|
|
+ const tableData = this.handleERData(dataList)
|
|
|
|
+ this.tableData = tableData
|
|
|
|
+ // this.tableRequset.total = total
|
|
|
|
+ } catch (error) {}
|
|
|
|
+ },
|
|
|
|
|
|
- async getAtlasFileAPI(params) {
|
|
|
|
- if (this.$refs.table) this.$refs.table.clearSelection()
|
|
|
|
- const { keyWord } = this
|
|
|
|
- const { pageSize, pageIndex } = this.tableRequset
|
|
|
|
- const {
|
|
|
|
- data: { list, total }
|
|
|
|
- } = await getAtlasFile({ pageSize, pageNum: pageIndex, ...params })
|
|
|
|
- this.tableData = list
|
|
|
|
- this.tableRequset.total = total
|
|
|
|
|
|
+ handleERData(data) {
|
|
|
|
+ const tableData = []
|
|
|
|
+ data.forEach((item) => {
|
|
|
|
+ let subData = {},
|
|
|
|
+ obData = {},
|
|
|
|
+ reData = {}
|
|
|
|
+ for (const key in item) {
|
|
|
|
+ if (key === 'subject') {
|
|
|
|
+ subData.subjectId = item.subject.id
|
|
|
|
+ subData.subjectName = item.subject.name
|
|
|
|
+ subData.subjectCategory = item.subject.category
|
|
|
|
+ } else if (key === 'object') {
|
|
|
|
+ obData.objectId = item.object.id
|
|
|
|
+ obData.objectName = item.object.name
|
|
|
|
+ obData.objectCategory = item.object.category
|
|
|
|
+ } else if (key === 'relation') {
|
|
|
|
+ reData.relationId = item.relation.id
|
|
|
|
+ reData.relationName = item.relation.name
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ tableData.push({ ...subData, ...obData, ...reData })
|
|
|
|
+ })
|
|
|
|
+ return tableData
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ async getAllRelationClassAPI(params) {
|
|
|
|
+ try {
|
|
|
|
+ const {
|
|
|
|
+ data: { dataList }
|
|
|
|
+ } = await getAllRelationClass()
|
|
|
|
+ this.relationList = dataList
|
|
|
|
+ } catch (error) {}
|
|
},
|
|
},
|
|
|
|
|
|
fetch() {
|
|
fetch() {
|
|
- this.getAtlasFileAPI()
|
|
|
|
|
|
+ this.getRelationAPI()
|
|
},
|
|
},
|
|
|
|
|
|
async searchClick() {
|
|
async searchClick() {
|
|
- this.getAtlasFileAPI({ name: keyWordData })
|
|
|
|
|
|
+ try {
|
|
|
|
+ if (this.$refs.table) this.$refs.table.clearSelection()
|
|
|
|
+ const {
|
|
|
|
+ data: { dataList, total }
|
|
|
|
+ } = await checkRelation({ node_name: this.keyWordData })
|
|
|
|
+ this.tableData = dataList
|
|
|
|
+ this.tableRequset.total = total
|
|
|
|
+ } catch (error) {}
|
|
},
|
|
},
|
|
|
|
|
|
- async addAtlasFileAPI() {
|
|
|
|
|
|
+ async addRelationAPI() {
|
|
try {
|
|
try {
|
|
- delete this.form.aircaftModelName
|
|
|
|
- const { code } = await addAtlasFile({ ...this.form })
|
|
|
|
|
|
+ const addData = {
|
|
|
|
+ node_name: this.form.name,
|
|
|
|
+ node_label: this.form.category
|
|
|
|
+ }
|
|
|
|
+ const { code } = await addRelation(addData)
|
|
if (code === 200) {
|
|
if (code === 200) {
|
|
this.$message({
|
|
this.$message({
|
|
type: 'success',
|
|
type: 'success',
|
|
message: '操作成功!'
|
|
message: '操作成功!'
|
|
})
|
|
})
|
|
this.handleClose()
|
|
this.handleClose()
|
|
- this.getAtlasFileAPI()
|
|
|
|
|
|
+ this.getRelationAPI()
|
|
}
|
|
}
|
|
} catch (error) {}
|
|
} catch (error) {}
|
|
},
|
|
},
|
|
|
|
|
|
- async updateAtlasFileAPI() {
|
|
|
|
|
|
+ async updateRelationAPI() {
|
|
try {
|
|
try {
|
|
- const { code } = await updateAtlasFile({ ...this.form })
|
|
|
|
|
|
+ const updateData = {
|
|
|
|
+ head_node_id: this.form.subjectId,
|
|
|
|
+ tail_node_id: this.form.objectId,
|
|
|
|
+ new_relation_name: this.form.relationName
|
|
|
|
+ }
|
|
|
|
+ console.log('updateData', updateData)
|
|
|
|
+ const { code } = await updateRelation(updateData)
|
|
if (code === 200) {
|
|
if (code === 200) {
|
|
this.$message({
|
|
this.$message({
|
|
type: 'success',
|
|
type: 'success',
|
|
message: '操作成功!'
|
|
message: '操作成功!'
|
|
})
|
|
})
|
|
this.handleClose()
|
|
this.handleClose()
|
|
- this.getAtlasFileAPI()
|
|
|
|
|
|
+ this.getRelationAPI()
|
|
}
|
|
}
|
|
} catch (error) {}
|
|
} catch (error) {}
|
|
},
|
|
},
|
|
@@ -216,12 +300,14 @@ export default {
|
|
handleClose() {
|
|
handleClose() {
|
|
this.dialogVisible = false
|
|
this.dialogVisible = false
|
|
this.form = {
|
|
this.form = {
|
|
- id: '',
|
|
|
|
- fileName: '',
|
|
|
|
- fileType: '',
|
|
|
|
- ossId: '',
|
|
|
|
- status: '',
|
|
|
|
- remarks: ''
|
|
|
|
|
|
+ subjectId: '',
|
|
|
|
+ subjectName: '',
|
|
|
|
+ subjectCategory: '',
|
|
|
|
+ objectId: '',
|
|
|
|
+ objectName: '',
|
|
|
|
+ objectCategory: '',
|
|
|
|
+ relationId: '',
|
|
|
|
+ relationName: ''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
@@ -234,12 +320,10 @@ export default {
|
|
submit() {
|
|
submit() {
|
|
switch (this.dialogTitle) {
|
|
switch (this.dialogTitle) {
|
|
case '编辑':
|
|
case '编辑':
|
|
- this.updateAtlasFileAPI()
|
|
|
|
-
|
|
|
|
|
|
+ this.updateRelationAPI()
|
|
break
|
|
break
|
|
case '新增':
|
|
case '新增':
|
|
- this.addAtlasFileAPI()
|
|
|
|
-
|
|
|
|
|
|
+ this.addRelationAPI()
|
|
break
|
|
break
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -249,13 +333,14 @@ export default {
|
|
},
|
|
},
|
|
|
|
|
|
remove(row) {
|
|
remove(row) {
|
|
- this.$confirm('是否删除该模型', '提示', {
|
|
|
|
|
|
+ this.$confirm('是否删除该数据', '提示', {
|
|
confirmButtonText: '确定',
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
type: 'warning'
|
|
})
|
|
})
|
|
.then(() => {
|
|
.then(() => {
|
|
- this.removeAtlasFileAPI(row.map((e) => e.id))
|
|
|
|
|
|
+ // this.deleteRelationAPI(row.map((e) => e.id))
|
|
|
|
+ this.deleteRelationAPI(row[0])
|
|
})
|
|
})
|
|
.catch(() => {})
|
|
.catch(() => {})
|
|
}
|
|
}
|