mirror of https://github.com/certd/certd
perf: 阶段、任务、步骤全面支持拖动排序
parent
1e9b5638aa
commit
bd73a163cd
|
@ -22,15 +22,14 @@ h1, h2, h3, h4, h5, h6 {
|
|||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.fs-desc{
|
||||
.fs-desc {
|
||||
font-size: 12px;
|
||||
color:#888888;
|
||||
color: #888888;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.ant-btn-link {
|
||||
height: 24px;
|
||||
}
|
||||
|
@ -45,75 +44,88 @@ h1, h2, h3, h4, h5, h6 {
|
|||
vertical-align: 0 !important;
|
||||
}
|
||||
|
||||
.pointer{
|
||||
.pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.flex-center{
|
||||
.flex-center {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.flex-o{
|
||||
|
||||
.flex-o {
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.flex{
|
||||
.flex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.flex-1{
|
||||
.flex-1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.mb-2{
|
||||
margin-bottom:2px;
|
||||
}
|
||||
.ml-5{
|
||||
margin-left:5px;
|
||||
}
|
||||
.ml-10{
|
||||
margin-left:10px;
|
||||
}
|
||||
.ml-20{
|
||||
margin-left:20px;
|
||||
}
|
||||
.ml-15{
|
||||
margin-left:15px;
|
||||
.mb-2 {
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.mr-5{
|
||||
.ml-5 {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.ml-10 {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.ml-20 {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.ml-15 {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
.mr-5 {
|
||||
margin-right: 5px;
|
||||
}
|
||||
.mr-10{
|
||||
|
||||
.mr-10 {
|
||||
margin-right: 10px;
|
||||
}
|
||||
.mr-20{
|
||||
|
||||
.mr-20 {
|
||||
margin-right: 20px;
|
||||
}
|
||||
.mr-15{
|
||||
|
||||
.mr-15 {
|
||||
margin-right: 15px;
|
||||
}
|
||||
.mt-5{
|
||||
margin-top:5px;
|
||||
}
|
||||
.mt-10{
|
||||
margin-top:10px;
|
||||
}
|
||||
.mb-10{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.m-10{
|
||||
margin:10px;
|
||||
|
||||
.mt-5 {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.p-5{
|
||||
padding:5px;
|
||||
.mt-10 {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.p-10{
|
||||
padding:10px;
|
||||
|
||||
.mb-10 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.m-10 {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.p-5 {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.p-10 {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.ellipsis {
|
||||
|
@ -122,18 +134,31 @@ h1, h2, h3, h4, h5, h6 {
|
|||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.w-100{
|
||||
.w-100 {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.block-header{
|
||||
margin:3px;
|
||||
.block-header {
|
||||
margin: 3px;
|
||||
padding-top: 15px;
|
||||
padding-bottom:3px;
|
||||
padding-bottom: 3px;
|
||||
border-bottom: 1px solid #dedede;
|
||||
}
|
||||
|
||||
|
||||
.color-blue{
|
||||
.color-blue {
|
||||
color: #1890ff;
|
||||
}
|
||||
|
||||
|
||||
.icon-box {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.fs-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
|
@ -43,7 +43,7 @@
|
|||
<a-button type="primary" @click="stepAdd(currentTask)">添加步骤</a-button>
|
||||
</template>
|
||||
</a-descriptions>
|
||||
<v-draggable v-model="currentTask.steps" class="step-list" handle=".handle">
|
||||
<v-draggable v-model="currentTask.steps" class="step-list" handle=".handle" item-key="id">
|
||||
<template #item="{ element, index }">
|
||||
<div class="step-row">
|
||||
<div class="text">
|
||||
|
|
|
@ -20,14 +20,15 @@
|
|||
<div class="layout-left">
|
||||
<div class="pipeline-container">
|
||||
<div class="pipeline">
|
||||
<div class="stages">
|
||||
<v-draggable v-model="pipeline.stages" class="stages" item-key="id" handle=".stage-move-handle">
|
||||
<template #header>
|
||||
<div class="stage first-stage">
|
||||
<div class="title">
|
||||
<div class="title stage-move-handle">
|
||||
<pi-editable model-value="触发源" :disabled="true" />
|
||||
</div>
|
||||
<div class="tasks">
|
||||
<div class="task-container first-task">
|
||||
<div class="line">
|
||||
<div class="line line-right">
|
||||
<div class="flow-line"></div>
|
||||
</div>
|
||||
<div class="task">
|
||||
|
@ -38,7 +39,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div v-for="(trigger, index) of pipeline.triggers" :key="trigger.id" class="task-container">
|
||||
<div class="line">
|
||||
<div class="line line-right">
|
||||
<div class="flow-line"></div>
|
||||
</div>
|
||||
<div class="task">
|
||||
|
@ -50,7 +51,7 @@
|
|||
</div>
|
||||
|
||||
<div v-if="editMode" class="task-container is-add">
|
||||
<div class="line">
|
||||
<div class="line line-right">
|
||||
<div class="flow-line"></div>
|
||||
</div>
|
||||
<div class="task">
|
||||
|
@ -62,12 +63,17 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div v-for="(stage, index) of pipeline.stages" :key="stage.id" class="stage" :class="{ 'last-stage': isLastStage(index) }">
|
||||
<template #item="{ element: stage, index }">
|
||||
<div :key="stage.id" class="stage" :class="{ 'last-stage': isLastStage(index) }">
|
||||
<div class="title">
|
||||
<pi-editable v-model="stage.title" :disabled="!editMode"></pi-editable>
|
||||
<div class="icon-box stage-move-handle">
|
||||
<fs-icon v-if="editMode" title="拖动排序" icon="ion:move-outline"></fs-icon>
|
||||
</div>
|
||||
<v-draggable v-model="stage.tasks" item-key="id" class="tasks" handle=".handle">
|
||||
</div>
|
||||
<v-draggable v-model="stage.tasks" item-key="id" class="tasks" group="task" handle=".task-move-handle">
|
||||
<template #item="{ element: task, index: taskIndex }">
|
||||
<div
|
||||
class="task-container"
|
||||
|
@ -75,10 +81,13 @@
|
|||
'first-task': taskIndex === 0
|
||||
}"
|
||||
>
|
||||
<div class="line">
|
||||
<div class="line line-left">
|
||||
<div class="flow-line"></div>
|
||||
<fs-icon v-if="editMode" class="add-stage-btn" title="添加新阶段" icon="ion:add-circle" @click="stageAdd(index)"></fs-icon>
|
||||
</div>
|
||||
<div class="line line-right">
|
||||
<div class="flow-line"></div>
|
||||
</div>
|
||||
<div class="task">
|
||||
<a-button shape="round" @click="taskEdit(stage, index, task, taskIndex)">
|
||||
<a-popover title="步骤" :trigger="editMode ? 'none' : 'hover'">
|
||||
|
@ -102,20 +111,21 @@
|
|||
</span>
|
||||
</a-popover>
|
||||
</a-button>
|
||||
<fs-icon
|
||||
v-if="editMode"
|
||||
class="action copy"
|
||||
title="复制"
|
||||
icon="ion:copy-outline"
|
||||
@click="taskCopy(stage, index, task)"
|
||||
></fs-icon>
|
||||
<fs-icon v-if="editMode" class="handle action drag" title="拖动排序" icon="ion:move-outline"></fs-icon>
|
||||
<div class="icon-box action copy">
|
||||
<fs-icon v-if="editMode" title="复制" icon="ion:copy-outline" @click="taskCopy(stage, index, task)"></fs-icon>
|
||||
</div>
|
||||
<div class="icon-box task-move-handle action drag">
|
||||
<fs-icon v-if="editMode" title="拖动排序" icon="ion:move-outline"></fs-icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<div v-if="editMode" class="task-container is-add">
|
||||
<div class="line">
|
||||
<div class="line line-left">
|
||||
<div class="flow-line"></div>
|
||||
</div>
|
||||
<div class="line line-right">
|
||||
<div class="flow-line"></div>
|
||||
</div>
|
||||
<div class="task">
|
||||
|
@ -130,14 +140,15 @@
|
|||
</template>
|
||||
</v-draggable>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<template #footer>
|
||||
<div v-if="editMode" class="stage last-stage">
|
||||
<div class="title">
|
||||
<pi-editable model-value="新阶段" :disabled="true" />
|
||||
</div>
|
||||
<div class="tasks">
|
||||
<div class="task-container first-task">
|
||||
<div class="line">
|
||||
<div class="line line-left">
|
||||
<div class="flow-line"></div>
|
||||
<fs-icon class="add-stage-btn" title="添加新阶段" icon="ion:add-circle" @click="stageAdd()"></fs-icon>
|
||||
</div>
|
||||
|
@ -149,7 +160,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="task-container">
|
||||
<div class="line">
|
||||
<div class="line line-left">
|
||||
<div class="flow-line"></div>
|
||||
</div>
|
||||
<div class="task">
|
||||
|
@ -161,7 +172,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div v-for="(item, ii) of pipeline.notifications" :key="ii" class="task-container">
|
||||
<div class="line">
|
||||
<div class="line line-left">
|
||||
<div class="flow-line"></div>
|
||||
</div>
|
||||
<div class="task">
|
||||
|
@ -179,7 +190,7 @@
|
|||
</div>
|
||||
<div v-if="pipeline.notifications?.length > 0" class="tasks">
|
||||
<div v-for="(item, index) of pipeline.notifications" :key="index" class="task-container" :class="{ 'first-task': index == 0 }">
|
||||
<div class="line">
|
||||
<div class="line line-left">
|
||||
<div class="flow-line"></div>
|
||||
</div>
|
||||
<div class="task">
|
||||
|
@ -193,7 +204,7 @@
|
|||
</div>
|
||||
<div v-else class="tasks">
|
||||
<div class="task-container first-task">
|
||||
<div class="line">
|
||||
<div class="line line-left">
|
||||
<div class="flow-line"></div>
|
||||
</div>
|
||||
<div class="task">
|
||||
|
@ -205,7 +216,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</v-draggable>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -715,39 +727,39 @@ export default defineComponent({
|
|||
.title {
|
||||
padding: 20px;
|
||||
color: gray;
|
||||
}
|
||||
&.first-stage {
|
||||
.line {
|
||||
width: 50% !important;
|
||||
.flow-line {
|
||||
border-left: 0;
|
||||
display: flex;
|
||||
.stage-move-handle {
|
||||
cursor: move;
|
||||
margin-left: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.last-stage {
|
||||
.line {
|
||||
width: 50% !important;
|
||||
left: 0;
|
||||
right: auto;
|
||||
.flow-line {
|
||||
border-right: 0;
|
||||
}
|
||||
.add-stage-btn {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//.sortable-ghost {
|
||||
// .line {
|
||||
// visibility: hidden;
|
||||
// }
|
||||
//}
|
||||
.line {
|
||||
height: 50px;
|
||||
position: absolute;
|
||||
top: -25px;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
width: 25px;
|
||||
|
||||
&.line-left {
|
||||
left: 25px;
|
||||
.flow-line {
|
||||
border-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&.line-right {
|
||||
right: 25px;
|
||||
.flow-line {
|
||||
border-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.flow-line {
|
||||
height: 100%;
|
||||
margin-left: 28px;
|
||||
margin-right: 28px;
|
||||
border: 1px solid #c7c7c7;
|
||||
border-top: 0;
|
||||
}
|
||||
|
@ -766,6 +778,52 @@ export default defineComponent({
|
|||
}
|
||||
}
|
||||
|
||||
.task-container:first-child {
|
||||
.line {
|
||||
width: 50px;
|
||||
|
||||
&.line-left {
|
||||
left: 0;
|
||||
.flow-line {
|
||||
border-right: 0;
|
||||
border-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&.line-right {
|
||||
right: 0;
|
||||
.flow-line {
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.add-stage-btn {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.first-stage {
|
||||
.line {
|
||||
.flow-line {
|
||||
border-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.last-stage {
|
||||
.line {
|
||||
width: 50% !important;
|
||||
right: auto;
|
||||
.flow-line {
|
||||
border-right: 0;
|
||||
}
|
||||
.add-stage-btn {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tasks {
|
||||
.task-container {
|
||||
width: 100%;
|
||||
|
@ -775,18 +833,6 @@ export default defineComponent({
|
|||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
&.first-task {
|
||||
.line {
|
||||
.flow-line {
|
||||
margin: 0;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
}
|
||||
.add-stage-btn {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
.task {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
@ -816,6 +862,7 @@ export default defineComponent({
|
|||
}
|
||||
&.drag {
|
||||
right: 60px;
|
||||
cursor: move;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue