修改样式

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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