修改样式

This commit is contained in:
王振 2020-05-11 23:40:19 +08:00
parent 96b8c89071
commit 833050a9ef
18 changed files with 198 additions and 153 deletions

View File

@ -1,7 +1,7 @@
<template>
<div class="container" v-loading="result.loading">
<div class="main-content">
<el-card>
<el-card class="table-card">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="search" :title="$t('commons.test')"
:show-create="false"/>

View File

@ -1,7 +1,7 @@
<template>
<div class="container" v-loading="result.loading">
<div class="main-content">
<el-card>
<el-card class="table-card">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="search" :title="$t('commons.test')"
@create="create" :createTip="$t('load_test.create')"/>

View File

@ -2,7 +2,7 @@
<div class="container" v-loading="result.loading">
<div class="main-content">
<el-card>
<el-card class="table-card">
<template v-slot:header>
<div>
<el-row type="flex" justify="space-between" align="middle">

View File

@ -1,7 +1,7 @@
<template>
<div class="container" v-loading="result.loading">
<div class="main-content">
<el-card>
<el-card class="table-card">
<template v-slot:header>
<div>
<el-row type="flex" justify="space-between" align="middle">

View File

@ -1,7 +1,7 @@
<template>
<div class="container">
<div class="main-content">
<el-card v-loading="result.loading">
<el-card class="table-card" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="search" @create="create"
:create-tip="btnTips" :title="title"/>

View File

@ -1,6 +1,6 @@
<template>
<div v-loading="result.loading">
<el-card>
<el-card class="table-card">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="initTableData" @create="create"
:create-tip="btnTips" :title="$t('commons.member')"/>

View File

@ -1,6 +1,6 @@
<template>
<div>
<el-card v-loading="result.loading">
<el-card class="table-card" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="list" @create="create"
:create-tip="btnTips" :title="$t('commons.workspace')"/>

View File

@ -1,6 +1,6 @@
<template>
<div v-loading="result.loading">
<el-card>
<el-card class="table-card">
<template v-slot:header>
<div>
<el-row type="flex" just ify="space-between" align="middle">

View File

@ -1,7 +1,7 @@
<template>
<div v-loading="result.loading">
<el-card>
<el-card class="table-card">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="initTableData" @create="create"
:create-tip="btnTips" :title="$t('commons.organization')"/>

View File

@ -1,6 +1,6 @@
<template>
<div>
<el-card v-loading="result.loading">
<el-card class="table-card" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="list" @create="create"
:create-tip="btnTips" :title="$t('commons.workspace')"/>

View File

@ -1,7 +1,7 @@
<template>
<div v-loading="result.loading">
<el-card>
<el-card class="table-card">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="search" @create="create"
:create-tip="btnTips" :title="$t('commons.test_resource_pool')"/>

View File

@ -1,7 +1,7 @@
<template>
<div v-loading="result.loading">
<el-card>
<el-card class="table-card">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="search" @create="create"
:create-tip="btnTips" :title="$t('commons.member')"/>

View File

@ -1,6 +1,6 @@
<template>
<div v-loading="result.loading">
<el-card>
<el-card class="table-card">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="initTableData" @create="create"
:create-tip="btnTips" :title="$t('commons.member')"/>

View File

@ -1,7 +1,7 @@
<template>
<div>
<el-card v-loading="result.loading">
<el-card class="table-card" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="initTableData"

View File

@ -1,8 +1,6 @@
<template>
<div v-loading="result.loading">
<el-input :placeholder="$t('test_track.module.search')" v-model="filterText"
size="small">
<el-input :placeholder="$t('test_track.module.search')" v-model="filterText" size="small">
<template v-if="type == 'edit'" v-slot:append>
<el-button icon="el-icon-folder-add" @click="openEditNodeDialog('add')"></el-button>
</template>
@ -17,100 +15,130 @@
:expand-on-click-node="false"
highlight-current
draggable
ref="tree">
ref="tree"
>
<template v-slot:default="{node,data}">
<span class="custom-tree-node father" @click="handleNodeSelect(node)">
<span class="node-icon">
<i class="el-icon-folder"></i>
</span>
<span>{{node.label}}</span>
<span class="node-title">{{node.label}}</span>
<el-dropdown v-if="type == 'edit'" class="node-dropdown child">
<span class="el-dropdown-link">
<i class="el-icon-folder-add"></i>
</span>
<el-dropdown-menu v-slot:default>
<el-dropdown-item>
<div @click="openEditNodeDialog('edit', data)">{{$t('test_track.module.rename')}}</div>
</el-dropdown-item>
<el-dropdown-item>
<div @click="openEditNodeDialog('add', data)">{{$t('test_track.module.add_submodule')}}</div>
</el-dropdown-item>
<el-dropdown-item>
<div @click="remove(node, data)">{{$t('commons.delete')}}</div>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<span v-if="type == 'edit'" class="node-operate child">
<el-tooltip
class="item"
effect="dark"
open-delay="200"
:content="$t('test_track.module.rename')"
placement="top"
>
<i @click="openEditNodeDialog('edit', data)" class="el-icon-edit"></i>
</el-tooltip>
<el-tooltip
class="item"
effect="dark"
open-delay="200"
:content="$t('test_track.module.add_submodule')"
placement="top"
>
<i @click="openEditNodeDialog('add', data)" class="el-icon-circle-plus-outline"></i>
</el-tooltip>
<el-tooltip class="item" effect="dark"
open-delay="200" :content="$t('commons.delete')" placement="top">
<i @click="remove(node, data)" class="el-icon-delete"></i>
</el-tooltip>
</span>
<!-- <el-dropdown v-if="type == 'edit'" class="node-dropdown child">
<span class="el-dropdown-link">
<i class="el-icon-folder-add"></i>
</span>
<el-dropdown-menu v-slot:default>
<el-dropdown-item>
<div @click="openEditNodeDialog('edit', data)">{{$t('test_track.module.rename')}}</div>
</el-dropdown-item>
<el-dropdown-item>
<div
@click="openEditNodeDialog('add', data)"
>{{$t('test_track.module.add_submodule')}}</div>
</el-dropdown-item>
<el-dropdown-item>
<div @click="remove(node, data)">{{$t('commons.delete')}}</div>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>-->
</span>
</template>
</el-tree>
<node-edit ref="nodeEdit" :tree-nodes="treeNodes" @refresh="refreshNode"/>
<node-edit ref="nodeEdit" :tree-nodes="treeNodes" @refresh="refreshNode" />
</div>
</template>
<script>
import NodeEdit from "./NodeEdit";
import NodeEdit from './NodeEdit';
export default {
name: "NodeTree",
components: {NodeEdit},
data() {
return {
result: {},
filterText: '',
defaultProps: {
children: 'children',
label: 'label'
}
};
},
props: {
type: {
type: String,
default: 'view'
},
treeNodes: {
type: Array
},
selectNode: {
type: Object
export default {
name: "NodeTree",
components: { NodeEdit },
data() {
return {
result: {},
filterText: "",
defaultProps: {
children: "children",
label: "label"
}
};
},
props: {
type: {
type: String,
default: "view"
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
}
treeNodes: {
type: Array
},
methods: {
handleDragEnd(draggingNode, dropNode, dropType, ev) {
let param = {};
param.id = draggingNode.data.id;
if (dropType === 'inner') {
param.parentId = dropNode.data.id;
param.level = dropNode.data.level + 1;
selectNode: {
type: Object
}
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
}
},
methods: {
handleDragEnd(draggingNode, dropNode, dropType, ev) {
let param = {};
param.id = draggingNode.data.id;
if (dropType === "inner") {
param.parentId = dropNode.data.id;
param.level = dropNode.data.level + 1;
} else {
if (dropNode.parent.id === 0) {
param.parentId = 0;
param.level = 1;
} else {
if (dropNode.parent.id === 0) {
param.parentId = 0;
param.level = 1;
} else {
param.parentId = dropNode.parent.data.id;
param.level = dropNode.parent.data.level + 1;
}
param.parentId = dropNode.parent.data.id;
param.level = dropNode.parent.data.level + 1;
}
this.$post('/case/node/edit', param);
},
remove(node, data) {
this.$alert(this.$t('test_track.module.delete_confirm') + data.label + "" +
this.$t('test_track.module.delete_all_resource') + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
}
this.$post("/case/node/edit", param);
},
remove(node, data) {
this.$alert(
this.$t("test_track.module.delete_confirm") +
data.label +
"" +
this.$t("test_track.module.delete_all_resource") +
"",
"",
{
confirmButtonText: this.$t("commons.confirm"),
callback: action => {
if (action === "confirm") {
let nodeIds = [];
this.getChildNodeId(node, nodeIds);
this.$post("/case/node/delete", nodeIds, () => {
@ -118,81 +146,94 @@
const children = parent.data.children || parent.data;
const index = children.findIndex(d => d.id === data.id);
children.splice(index, 1);
this.$success(this.$t('commons.delete_success'));
this.$success(this.$t("commons.delete_success"));
this.$emit("refresh");
});
}
}
});
},
handleNodeSelect(node) {
let nodeIds = [];
let nodeNames = [];
this.getChildNodeId(node, nodeIds);
this.getParentNodeName(node, nodeNames);
this.$emit("nodeSelectEvent", nodeIds, nodeNames);
this.$emit("update:selectNode", node);
},
getChildNodeId(rootNode, nodeIds) {
//ID
nodeIds.push(rootNode.data.id);
for (let i = 0; i < rootNode.childNodes.length; i++) {
this.getChildNodeId(rootNode.childNodes[i], nodeIds);
}
},
getParentNodeName(rootNode, nodeNames) {
if (rootNode.parent && rootNode.parent.id != 0) {
this.getParentNodeName(rootNode.parent, nodeNames)
}
if (rootNode.data.name && rootNode.data.name != '') {
nodeNames.push(rootNode.data.name);
}
},
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
openEditNodeDialog(type, data) {
this.$refs.nodeEdit.open(type, data);
},
refreshNode() {
this.$emit('refresh');
);
},
handleNodeSelect(node) {
let nodeIds = [];
let nodeNames = [];
this.getChildNodeId(node, nodeIds);
this.getParentNodeName(node, nodeNames);
this.$emit("nodeSelectEvent", nodeIds, nodeNames);
this.$emit("update:selectNode", node);
},
getChildNodeId(rootNode, nodeIds) {
//ID
nodeIds.push(rootNode.data.id);
for (let i = 0; i < rootNode.childNodes.length; i++) {
this.getChildNodeId(rootNode.childNodes[i], nodeIds);
}
},
getParentNodeName(rootNode, nodeNames) {
if (rootNode.parent && rootNode.parent.id != 0) {
this.getParentNodeName(rootNode.parent, nodeNames);
}
if (rootNode.data.name && rootNode.data.name != "") {
nodeNames.push(rootNode.data.name);
}
},
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
openEditNodeDialog(type, data) {
this.$refs.nodeEdit.open(type, data);
},
refreshNode() {
this.$emit("refresh");
}
}
};
</script>
<style scoped>
.el-dropdown-link {
cursor: pointer;
color: #409eff;
}
.el-dropdown-link {
cursor: pointer;
color: #409EFF;
}
.el-icon-arrow-down {
font-size: 12px;
}
.el-icon-arrow-down {
font-size: 12px;
}
.custom-tree-node {
flex: 1 1 auto;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right: 8px;
width: 100%;
}
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right: 8px;
width: 100%;
}
.node-tree {
margin-top: 15px;
}
.node-tree {
margin-top: 15px;
}
.father .child {
display: none;
}
.father .child {
display: none;
}
.father:hover .child {
display: block;
}
.father:hover .child {
display: block;
}
.node-title {
width: 0px;
text-overflow: ellipsis;
white-space: nowrap;
flex: 1 1 auto;
padding: 0px 5px;
overflow: hidden;
}
.node-operate > i {
color: #409eff;
margin: 0px 5px;
}
</style>

View File

@ -2,7 +2,7 @@
<div class="container">
<el-main class="main-content">
<el-card v-loading="result.loading">
<el-card class="table-card" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="initTableData" @create="testPlanCreate"
:create-tip="$t('test_track.plan.create_plan')" :title="$t('test_track.plan.test_plan')"/>

View File

@ -1,5 +1,5 @@
<template>
<el-card v-loading="result.loading">
<el-card class="table-card" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="initTableData" :show-create="false">
<template v-slot:title>

View File

@ -32,3 +32,7 @@ body {
display: table;
clear: both;
}
.table-card > .el-card__body {
padding-top: 0;
}