|
@@ -3,8 +3,18 @@
|
|
<div class="framework">
|
|
<div class="framework">
|
|
<el-container>
|
|
<el-container>
|
|
<el-header>
|
|
<el-header>
|
|
- <div>
|
|
|
|
- <p style="margin-left: 10px;">产品名称:{{ row.productName }}</p>
|
|
|
|
|
|
+ <div style="display: flex;justify-content: space-between;">
|
|
|
|
+ <div style="margin-left: 10px;">
|
|
|
|
+ <p>产品名称:{{ row.productName }}</p>
|
|
|
|
+ </div>
|
|
|
|
+ <div>
|
|
|
|
+ <el-dropdown split-button type="primary" @click="handleCommand('0')" @command="handleCommand($event)">
|
|
|
|
+ <p>导 入</p>
|
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
|
+ <el-dropdown-item command="1">复制</el-dropdown-item>
|
|
|
|
+ </el-dropdown-menu>
|
|
|
|
+ </el-dropdown>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</el-header>
|
|
</el-header>
|
|
<el-container>
|
|
<el-container>
|
|
@@ -15,7 +25,8 @@
|
|
<el-button type="primary" size="small" @click="handleAppend">新增分类节点</el-button>
|
|
<el-button type="primary" size="small" @click="handleAppend">新增分类节点</el-button>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
- <el-tree ref="tree" :data="treeData" :props="defaultProps" @node-click="handleNodeClick" :default-expanded-keys="expandedKeys">
|
|
|
|
|
|
+ <el-tree ref="tree" :data="treeData" :props="defaultProps" @node-click="handleNodeClick"
|
|
|
|
+ :default-expanded-keys="expandedKeys">
|
|
<!-- <el-tree ref="tree" :data="treeData" :props="treeProps" :current-node-key="parentId" @node-click="handleNodeClick" node-key="id" :default-checked-keys="expandedKeys" :highlight-current="true" :default-expanded-keys="expandedKeys" :expand-on-click-node="false"> -->
|
|
<!-- <el-tree ref="tree" :data="treeData" :props="treeProps" :current-node-key="parentId" @node-click="handleNodeClick" node-key="id" :default-checked-keys="expandedKeys" :highlight-current="true" :default-expanded-keys="expandedKeys" :expand-on-click-node="false"> -->
|
|
<span class="custom-tree-node" slot-scope="{ node, data }">
|
|
<span class="custom-tree-node" slot-scope="{ node, data }">
|
|
<span>{{ node.label }}</span>
|
|
<span>{{ node.label }}</span>
|
|
@@ -46,7 +57,8 @@
|
|
</el-aside>
|
|
</el-aside>
|
|
<el-container>
|
|
<el-container>
|
|
<el-main>
|
|
<el-main>
|
|
- <component :is="componentType" :tableData="tableData" :queryParams="queryParams" @option="handleOption"></component>
|
|
|
|
|
|
+ <component :is="componentType" :tableData="tableData" :queryParams="queryParams" @option="handleOption">
|
|
|
|
+ </component>
|
|
</el-main>
|
|
</el-main>
|
|
<el-footer>
|
|
<el-footer>
|
|
<el-pagination background layout="total, prev, pager, next, jumper" :current-page.sync="queryParams.current"
|
|
<el-pagination background layout="total, prev, pager, next, jumper" :current-page.sync="queryParams.current"
|
|
@@ -57,7 +69,7 @@
|
|
</el-container>
|
|
</el-container>
|
|
</el-container>
|
|
</el-container>
|
|
|
|
|
|
- <classifyNode ref="classifyNode" :treeDataPath="treeDataPath"></classifyNode>
|
|
|
|
|
|
+ <classifyNode ref="classifyNode" :treeDataPath="treeDataPath" @isSuccess="handleSuccess"></classifyNode>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -66,7 +78,7 @@ import frameworkTable from './view/table.vue'
|
|
import classifyNode from '../dialog/classifyNode.vue';
|
|
import classifyNode from '../dialog/classifyNode.vue';
|
|
export default {
|
|
export default {
|
|
props: {
|
|
props: {
|
|
- row:Object,
|
|
|
|
|
|
+ row: Object,
|
|
},
|
|
},
|
|
components: {
|
|
components: {
|
|
frameworkTable,
|
|
frameworkTable,
|
|
@@ -178,7 +190,7 @@ export default {
|
|
label: 'structureName'
|
|
label: 'structureName'
|
|
},
|
|
},
|
|
// 架构路径数组
|
|
// 架构路径数组
|
|
- treeDataPath:[],
|
|
|
|
|
|
+ treeDataPath: [],
|
|
// 查询架构表格数据字段
|
|
// 查询架构表格数据字段
|
|
queryParams: {
|
|
queryParams: {
|
|
current: 1,
|
|
current: 1,
|
|
@@ -215,9 +227,9 @@ export default {
|
|
}
|
|
}
|
|
],
|
|
],
|
|
// 节点的展开
|
|
// 节点的展开
|
|
- expandedKeys:[],
|
|
|
|
|
|
+ expandedKeys: [],
|
|
// 当前节点下的所有数据
|
|
// 当前节点下的所有数据
|
|
- nodeChildrenData:[],
|
|
|
|
|
|
+ nodeChildrenData: [],
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
@@ -227,7 +239,31 @@ export default {
|
|
// this.getPath()
|
|
// this.getPath()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- handleNode() {//请求新数据后保持刷新前所点击的节点高亮并展开
|
|
|
|
|
|
+ //导入、复制等按钮事件
|
|
|
|
+ handleCommand(event) {
|
|
|
|
+ switch (event) {
|
|
|
|
+ case '0'://导入专利
|
|
|
|
+ this.importProject()
|
|
|
|
+ break;
|
|
|
|
+ case '1'://复制其他分类节点
|
|
|
|
+ this.nodeCopy()
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 专利导入
|
|
|
|
+ importProject() { },
|
|
|
|
+ // 节点复制
|
|
|
|
+ nodeCopy(){},
|
|
|
|
+ // 子组件传来的消息,新增成功、编辑成功
|
|
|
|
+ handleSuccess(val) {
|
|
|
|
+ this.getList()
|
|
|
|
+ this.getPath()
|
|
|
|
+ },
|
|
|
|
+ //请求新数据后保持刷新前所点击的节点高亮并展开
|
|
|
|
+ handleNode() {
|
|
this.expandedKeys = []
|
|
this.expandedKeys = []
|
|
if (sessionStorage.getItem('parentId')) {
|
|
if (sessionStorage.getItem('parentId')) {
|
|
this.parentId = JSON.parse(sessionStorage.getItem('parentId'))
|
|
this.parentId = JSON.parse(sessionStorage.getItem('parentId'))
|
|
@@ -244,19 +280,38 @@ export default {
|
|
console.log(val, row);
|
|
console.log(val, row);
|
|
switch (val) {
|
|
switch (val) {
|
|
case '0'://编辑
|
|
case '0'://编辑
|
|
- this.$refs.classifyNode.open(row,this.row.productName)
|
|
|
|
|
|
+ this.$refs.classifyNode.open(row, this.row.productName)
|
|
break;
|
|
break;
|
|
case '1'://预览图片
|
|
case '1'://预览图片
|
|
-
|
|
|
|
|
|
+ this.commandPackage(row)
|
|
break;
|
|
break;
|
|
case '2'://删除
|
|
case '2'://删除
|
|
this.deleNode(row)
|
|
this.deleNode(row)
|
|
break;
|
|
break;
|
|
-
|
|
|
|
|
|
+
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ // 预览图片
|
|
|
|
+ commandPackage(row) {
|
|
|
|
+ if (row.pictures && row.pictures.length > 0) {
|
|
|
|
+ var item = row.pictures[0]//item是图片每条信息
|
|
|
|
+ var FileUrl = this.$p + row.pictures[0].url//FileUrl是每张图片的url
|
|
|
|
+ var isPicture = 1
|
|
|
|
+ const router = this.$router.resolve({
|
|
|
|
+ path: '/checkFile',
|
|
|
|
+ query: {
|
|
|
|
+ row: JSON.stringify(item),
|
|
|
|
+ FileUrl: FileUrl,
|
|
|
|
+ isPicture: isPicture,
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ window.open(router.href, '_blank');
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.info("暂无图片,请先上传图片再进行预览!")
|
|
|
|
+ }
|
|
|
|
+ },
|
|
// 删除
|
|
// 删除
|
|
deleNode(row) {
|
|
deleNode(row) {
|
|
this.$confirm('此操作将删除当前节点及其下属节点, 是否继续?', '提示', {
|
|
this.$confirm('此操作将删除当前节点及其下属节点, 是否继续?', '提示', {
|
|
@@ -266,7 +321,7 @@ export default {
|
|
}).then(() => {
|
|
}).then(() => {
|
|
// 调用接口
|
|
// 调用接口
|
|
this.deleData.push(row)
|
|
this.deleData.push(row)
|
|
- let params = [ row.id ]
|
|
|
|
|
|
+ let params = [row.id]
|
|
this.$api.deleteEvent(params).then(res => {
|
|
this.$api.deleteEvent(params).then(res => {
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
this.getList()
|
|
this.getList()
|
|
@@ -280,20 +335,35 @@ export default {
|
|
// 按钮新增分类节点/树节点新增
|
|
// 按钮新增分类节点/树节点新增
|
|
handleAppend() {
|
|
handleAppend() {
|
|
// console.log(this.row);
|
|
// console.log(this.row);
|
|
- this.$refs.classifyNode.open(null,this.row.productName)
|
|
|
|
|
|
+ this.$refs.classifyNode.open(null, this.row.productName)
|
|
},
|
|
},
|
|
// 根据产品名称查询产品
|
|
// 根据产品名称查询产品
|
|
handleQuery() {
|
|
handleQuery() {
|
|
this.getList()
|
|
this.getList()
|
|
|
|
+ // 遍历返回的数据,对有相同搜索值进行高亮
|
|
|
|
+ this.treeData.forEach(item => {
|
|
|
|
+ this.getChildrenHeight(item)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 递归查询每一个children是否有与搜索相同的字段
|
|
|
|
+ getChildrenHeight(data) {
|
|
|
|
+ if (data.name.indexOf(this.productName) != -1) {
|
|
|
|
+ data.name.replace(this.productName, `<span style="color:red;font-weight:700;">${this.productName}</span>`)
|
|
|
|
+ }
|
|
|
|
+ if (data.children && data.children.length > 0) {
|
|
|
|
+ this.getChildrenHeight(data.children)
|
|
|
|
+ } else {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
},
|
|
},
|
|
// 树节点上的新增
|
|
// 树节点上的新增
|
|
append(data, node) {
|
|
append(data, node) {
|
|
- this.$refs.classifyNode.open(data,this.row.productName)
|
|
|
|
|
|
+ this.$refs.classifyNode.open(null, this.row.productName,data)
|
|
// console.log(data, node);
|
|
// console.log(data, node);
|
|
},
|
|
},
|
|
// 树节点上的编辑
|
|
// 树节点上的编辑
|
|
edit(data, node) {
|
|
edit(data, node) {
|
|
- this.$refs.classifyNode.open(data,this.row.productName)
|
|
|
|
|
|
+ this.$refs.classifyNode.open(data, this.row.productName)
|
|
// console.log(data, node);
|
|
// console.log(data, node);
|
|
},
|
|
},
|
|
// 树节点上的删除
|
|
// 树节点上的删除
|
|
@@ -302,9 +372,9 @@ export default {
|
|
// console.log(data, node);
|
|
// console.log(data, node);
|
|
},
|
|
},
|
|
// 树节点点击事件
|
|
// 树节点点击事件
|
|
- handleNodeClick(data, node) {
|
|
|
|
|
|
+ handleNodeClick(data, node) {
|
|
// console.log(data, node);
|
|
// console.log(data, node);
|
|
- if (data.children && data.children.length>0) {
|
|
|
|
|
|
+ if (data.children && data.children.length > 0) {
|
|
// this.tableData =
|
|
// this.tableData =
|
|
this.nodeChildrenData = data.children
|
|
this.nodeChildrenData = data.children
|
|
this.handleCurrent()
|
|
this.handleCurrent()
|
|
@@ -313,10 +383,10 @@ export default {
|
|
// 请求数据(tree)
|
|
// 请求数据(tree)
|
|
getList() {
|
|
getList() {
|
|
let params = {
|
|
let params = {
|
|
- productName:this.productName,//事件名称
|
|
|
|
|
|
+ name: this.productName,//事件名称
|
|
}
|
|
}
|
|
this.$api.queryList(params).then(res => {
|
|
this.$api.queryList(params).then(res => {
|
|
- if (res.code == 200 ) {
|
|
|
|
|
|
+ if (res.code == 200) {
|
|
this.treeData = res.data
|
|
this.treeData = res.data
|
|
this.nodeChildrenData = res.data.children
|
|
this.nodeChildrenData = res.data.children
|
|
this.handleCurrent()
|
|
this.handleCurrent()
|
|
@@ -326,24 +396,24 @@ export default {
|
|
// 请求架构路径
|
|
// 请求架构路径
|
|
getPath() {
|
|
getPath() {
|
|
let params = {
|
|
let params = {
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
this.$api.path(params).then(res => {
|
|
this.$api.path(params).then(res => {
|
|
- if (res.code == 200 ) {
|
|
|
|
|
|
+ if (res.code == 200) {
|
|
this.treeDataPath = res.data
|
|
this.treeDataPath = res.data
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
// 分页
|
|
// 分页
|
|
- handleCurrentChange(val) {
|
|
|
|
|
|
+ handleCurrentChange(val) {
|
|
this.queryParams.current = val;
|
|
this.queryParams.current = val;
|
|
this.handleCurrent()
|
|
this.handleCurrent()
|
|
},
|
|
},
|
|
// 分页处理
|
|
// 分页处理
|
|
handleCurrent() {
|
|
handleCurrent() {
|
|
- this.total=this.nodeChildrenData.length
|
|
|
|
|
|
+ this.total = this.nodeChildrenData.length
|
|
let start = this.queryParams.size * (this.queryParams.current - 1)
|
|
let start = this.queryParams.size * (this.queryParams.current - 1)
|
|
- let end =this.queryParams.size * this.queryParams.current
|
|
|
|
|
|
+ let end = this.queryParams.size * this.queryParams.current
|
|
this.tableData = this.nodeChildrenData.slice(start, end)
|
|
this.tableData = this.nodeChildrenData.slice(start, end)
|
|
},
|
|
},
|
|
},
|
|
},
|
|
@@ -355,11 +425,9 @@ export default {
|
|
.el-divider--horizontal {
|
|
.el-divider--horizontal {
|
|
margin: 15px 0,
|
|
margin: 15px 0,
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
-.framework {
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
|
|
+.framework {}
|
|
</style>
|
|
</style>
|