From c0c770d935f9230c6970222f91fd88405b022a2a Mon Sep 17 00:00:00 2001 From: caofengbin <1050430934@qq.com> Date: Mon, 4 Sep 2023 11:29:04 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=89=8D=E7=AB=AFUI=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E5=9C=A8=E5=BD=93=E5=89=8D=E8=A1=8C=E7=9A=84=E4=B8=8B=E6=96=B9?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E6=AD=A5=E9=AA=A4=E7=9A=84=E8=83=BD=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/StepDraggable.vue | 39 +++++++++++++++++++++++--------- src/components/StepList.vue | 3 ++- src/locales/lang/zh_CN.js | 4 +++- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/components/StepDraggable.vue b/src/components/StepDraggable.vue index 4a63c27f..6002fb0c 100644 --- a/src/components/StepDraggable.vue +++ b/src/components/StepDraggable.vue @@ -113,8 +113,13 @@ const remove = (e) => { emit('remove', e); }; -const copyStep = (id) => { - emit('copyStep', id); +/** + * 拷贝步骤的方法 + * @param {*} id 步骤id + * @param {*} toLast 是否复制到最后一行 + */ + const copyStep = (id, toLast) => { + emit('copyStep', id, toLast); }; @@ -266,16 +271,28 @@ const copyStep = (id) => { - + - - - - + + + diff --git a/src/components/StepList.vue b/src/components/StepList.vue index 474e2b64..6732f20c 100644 --- a/src/components/StepList.vue +++ b/src/components/StepList.vue @@ -116,11 +116,12 @@ const getStepsList = () => { const runStep = () => { emit('runStep'); }; -const copyStep = (id) => { +const copyStep = (id, toLast) => { axios .get('/controller/steps/copy/steps', { params: { id, + toLast }, }) .then((resp) => { diff --git a/src/locales/lang/zh_CN.js b/src/locales/lang/zh_CN.js index 63ea9a4b..ab43b0d2 100644 --- a/src/locales/lang/zh_CN.js +++ b/src/locales/lang/zh_CN.js @@ -104,7 +104,9 @@ const steps = { loading: '加载中', loadDone: '加载完毕', loadMore: '加载更多', - + copyStepTips: '确定复制该步骤吗?点击周围空白处取消', + copyToNextLine: '复制到当前行', + copyToLastLine: '复制到最后行', }; const code = { placeholder: '请选择', From 1dc13ba4250682fdd12407ec850873de44165284 Mon Sep 17 00:00:00 2001 From: caofengbin <1050430934@qq.com> Date: Mon, 4 Sep 2023 14:27:37 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=89=8D=E7=AB=AFUI=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E5=B0=86=E6=96=B0=E5=A2=9E=E5=8A=A0=E7=9A=84=E6=AD=A5=E9=AA=A4?= =?UTF-8?q?=EF=BC=8C=E8=87=AA=E5=8A=A8=E6=B7=BB=E5=8A=A0=E5=88=B0=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E6=AD=A5=E9=AA=A4=E7=9A=84=E4=B8=8A=E9=9D=A2=E6=88=96?= =?UTF-8?q?=E4=B8=8B=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/StepDraggable.vue | 34 ++++++++++++++++++++++++++++++-- src/components/StepList.vue | 33 +++++++++++++++++++++++++++++-- src/locales/lang/zh_CN.js | 3 +++ 3 files changed, 66 insertions(+), 4 deletions(-) diff --git a/src/components/StepDraggable.vue b/src/components/StepDraggable.vue index 6002fb0c..f9755444 100644 --- a/src/components/StepDraggable.vue +++ b/src/components/StepDraggable.vue @@ -121,6 +121,14 @@ const remove = (e) => { const copyStep = (id, toLast) => { emit('copyStep', id, toLast); }; +/** + * 添加步骤到特定位置的方法 + * @param {*} id 点选的位置 + * @param {*} toNext true添加到下一行,false添加到上一行 + */ + const addStepTotarget = (id, toNext) => { + emit('addStepTotarget', id, toNext); +}; - + diff --git a/src/components/StepList.vue b/src/components/StepList.vue index 6732f20c..ba997321 100644 --- a/src/components/StepList.vue +++ b/src/components/StepList.vue @@ -19,6 +19,8 @@ const props = defineProps({ const emit = defineEmits(['runStep']); const dialogVisible = ref(false); const stepId = ref(0); +const addToTargetStepId = ref(0); +const addToTargetStepNext = ref(false); const parentId = ref(0); watch(dialogVisible, (newValue, oldValue) => { if (!newValue) { @@ -33,12 +35,38 @@ const editStep = async (id) => { const setParent = (id) => { parentId.value = id; }; +// 条件语句中的添加步骤方法 const addStep = () => { dialogVisible.value = true; }; +// 普通类型中的添加步骤方法 +const addStepTotarget = (id, toNext) => { + dialogVisible.value = true; + addToTargetStepId.value = id; + addToTargetStepNext.value = toNext +}; const flush = () => { - dialogVisible.value = false; - getStepsList(); + if (addToTargetStepId.value > 0) { + // 需要将新增的步骤挪动到目标行的上面或下面 + axios + .get('/controller/steps/stepSortTarget', { + params: { + targetStepId: addToTargetStepId.value, + addToTargetNext: addToTargetStepNext.value, + }, + }) + .then((resp) => { + if (resp.code === 2000) { + dialogVisible.value = false; + addToTargetStepNext.value = false; + addToTargetStepId.value = 0; + getStepsList(); + } + }); + } else { + dialogVisible.value = false; + getStepsList(); + } }; const deleteStep = (id) => { axios @@ -213,5 +241,6 @@ onMounted(() => { @editStep="editStep" @copyStep="copyStep" @deleteStep="deleteStep" + @addStepTotarget="addStepTotarget" /> diff --git a/src/locales/lang/zh_CN.js b/src/locales/lang/zh_CN.js index ab43b0d2..1e169ce2 100644 --- a/src/locales/lang/zh_CN.js +++ b/src/locales/lang/zh_CN.js @@ -107,6 +107,9 @@ const steps = { copyStepTips: '确定复制该步骤吗?点击周围空白处取消', copyToNextLine: '复制到当前行', copyToLastLine: '复制到最后行', + addStepTips: '选择添加步骤的位置,点击周围空白处取消', + addToNextLine: '添加到下一行', + addToBeforeLine: '添加到上一行', }; const code = { placeholder: '请选择', From 9798895dc41e29c244a148376e157a1c106fc0fd Mon Sep 17 00:00:00 2001 From: caofengbin <1050430934@qq.com> Date: Mon, 4 Sep 2023 14:55:34 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=85=AC=E5=85=B1=E6=AD=A5=E9=AA=A4?= =?UTF-8?q?=E7=9A=84=E5=9C=BA=E6=99=AF=E4=B8=8B=EF=BC=8C=E5=B1=8F=E8=94=BD?= =?UTF-8?q?=E6=8E=89=E6=96=B0=E5=A2=9E=E7=9A=84=E4=B8=A4=E4=B8=AA=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/StepDraggable.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/StepDraggable.vue b/src/components/StepDraggable.vue index f9755444..f6c3c3d2 100644 --- a/src/components/StepDraggable.vue +++ b/src/components/StepDraggable.vue @@ -282,7 +282,7 @@ const remove = (e) => { { Date: Mon, 4 Sep 2023 15:51:42 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8B=B1=E6=96=87?= =?UTF-8?q?=EF=BC=8C=E6=97=A5=E8=AF=AD=EF=BC=8C=E7=B9=81=E4=BD=93=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E4=B8=AD=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=9A=84key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/lang/en_US.js | 6 ++++++ src/locales/lang/ja_JP.js | 6 ++++++ src/locales/lang/zh_TW.js | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/src/locales/lang/en_US.js b/src/locales/lang/en_US.js index c182ffbc..98090951 100644 --- a/src/locales/lang/en_US.js +++ b/src/locales/lang/en_US.js @@ -109,6 +109,12 @@ const steps = { loading: 'Loading', loadDone: 'Load completed', loadMore: 'Load more', + copyStepTips: 'Are you sure you want to replicate this step? Click on the surrounding space to cancel', + copyToNextLine: 'copy to current line', + copyToLastLine: 'copy to last line', + addStepTips: 'Select the location to add the step and click on the surrounding space to cancel.', + addToNextLine: 'add to next line', + addToBeforeLine: 'add to previous line', }; const code = { placeholder: 'Please choose language', diff --git a/src/locales/lang/ja_JP.js b/src/locales/lang/ja_JP.js index f9cafbd7..5b8c2edd 100644 --- a/src/locales/lang/ja_JP.js +++ b/src/locales/lang/ja_JP.js @@ -104,6 +104,12 @@ const steps = { loading: '加载中', loadDone: '加载完毕', loadMore: '加载更多', + copyStepTips: '确定复制该步骤吗?点击周围空白处取消', + copyToNextLine: '复制到当前行', + copyToLastLine: '复制到最后行', + addStepTips: '选择添加步骤的位置,点击周围空白处取消', + addToNextLine: '添加到下一行', + addToBeforeLine: '添加到上一行', }; const code = { placeholder: '请选择', diff --git a/src/locales/lang/zh_TW.js b/src/locales/lang/zh_TW.js index f287e719..141fc42a 100644 --- a/src/locales/lang/zh_TW.js +++ b/src/locales/lang/zh_TW.js @@ -104,6 +104,12 @@ const steps = { loading: '加载中', loadDone: '加载完毕', loadMore: '加载更多', + copyStepTips: '确定复制该步骤吗?点击周围空白处取消', + copyToNextLine: '复制到当前行', + copyToLastLine: '复制到最后行', + addStepTips: '选择添加步骤的位置,点击周围空白处取消', + addToNextLine: '添加到下一行', + addToBeforeLine: '添加到上一行', }; const code = { placeholder: '请选择',