添加工作空间标识功能
- 在创作页面中新增 `isFromWorkspace` 状态,用于标识用户是否从工作空间进入创作模式。 - 更新表单项,基于 `isFromWorkspace` 状态禁用输入控件,提升用户交互体验和数据一致性。
This commit is contained in:
@@ -238,6 +238,7 @@
|
|||||||
v-if="field.type === 'input'"
|
v-if="field.type === 'input'"
|
||||||
v-model="creationFormValues[`${node.id}_${field.label}`]"
|
v-model="creationFormValues[`${node.id}_${field.label}`]"
|
||||||
:placeholder="field.required ? '必填' : '选填'"
|
:placeholder="field.required ? '必填' : '选填'"
|
||||||
|
:disabled="isFromWorkspace"
|
||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
<el-input-number
|
<el-input-number
|
||||||
@@ -245,6 +246,7 @@
|
|||||||
v-model="creationFormValues[`${node.id}_${field.label}`]"
|
v-model="creationFormValues[`${node.id}_${field.label}`]"
|
||||||
class="w100"
|
class="w100"
|
||||||
:controls="true"
|
:controls="true"
|
||||||
|
:disabled="isFromWorkspace"
|
||||||
/>
|
/>
|
||||||
<el-input
|
<el-input
|
||||||
v-else-if="field.type === 'textarea'"
|
v-else-if="field.type === 'textarea'"
|
||||||
@@ -252,6 +254,7 @@
|
|||||||
type="textarea"
|
type="textarea"
|
||||||
:rows="4"
|
:rows="4"
|
||||||
:placeholder="field.required ? '必填' : '选填'"
|
:placeholder="field.required ? '必填' : '选填'"
|
||||||
|
:disabled="isFromWorkspace"
|
||||||
show-word-limit
|
show-word-limit
|
||||||
:maxlength="500"
|
:maxlength="500"
|
||||||
/>
|
/>
|
||||||
@@ -260,6 +263,7 @@
|
|||||||
v-model="creationFormValues[`${node.id}_${field.label}`]"
|
v-model="creationFormValues[`${node.id}_${field.label}`]"
|
||||||
active-text="开启"
|
active-text="开启"
|
||||||
inactive-text="关闭"
|
inactive-text="关闭"
|
||||||
|
:disabled="isFromWorkspace"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
@@ -284,6 +288,7 @@
|
|||||||
:type="node.config.fieldMetadata?.[key]?.type === 'textarea' || String(value).length > 50 ? 'textarea' : 'text'"
|
:type="node.config.fieldMetadata?.[key]?.type === 'textarea' || String(value).length > 50 ? 'textarea' : 'text'"
|
||||||
:rows="4"
|
:rows="4"
|
||||||
:placeholder="node.config.fieldMetadata?.[key]?.required ? '必填' : '选填'"
|
:placeholder="node.config.fieldMetadata?.[key]?.required ? '必填' : '选填'"
|
||||||
|
:disabled="isFromWorkspace"
|
||||||
clearable
|
clearable
|
||||||
:show-word-limit="node.config.fieldMetadata?.[key]?.type === 'textarea'"
|
:show-word-limit="node.config.fieldMetadata?.[key]?.type === 'textarea'"
|
||||||
:maxlength="500"
|
:maxlength="500"
|
||||||
@@ -295,12 +300,14 @@
|
|||||||
:controls="true"
|
:controls="true"
|
||||||
:precision="2"
|
:precision="2"
|
||||||
:step="0.1"
|
:step="0.1"
|
||||||
|
:disabled="isFromWorkspace"
|
||||||
/>
|
/>
|
||||||
<el-switch
|
<el-switch
|
||||||
v-else-if="typeof value === 'boolean'"
|
v-else-if="typeof value === 'boolean'"
|
||||||
v-model="creationFormValues[`${node.id}_${key}`]"
|
v-model="creationFormValues[`${node.id}_${key}`]"
|
||||||
active-text="开启"
|
active-text="开启"
|
||||||
inactive-text="关闭"
|
inactive-text="关闭"
|
||||||
|
:disabled="isFromWorkspace"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
@@ -638,6 +645,7 @@ const selectedFiles = ref<File[]>([]);
|
|||||||
const selectedCreationSkill = ref<SkillItem | null>(null);
|
const selectedCreationSkill = ref<SkillItem | null>(null);
|
||||||
const showCreationSkillSelector = ref(false);
|
const showCreationSkillSelector = ref(false);
|
||||||
const currentSessionId = ref<string | null>(null); // 当前会话的 sessionId(从工作空间进入时使用)
|
const currentSessionId = ref<string | null>(null); // 当前会话的 sessionId(从工作空间进入时使用)
|
||||||
|
const isFromWorkspace = ref(false); // 是否从工作空间进入创作模式
|
||||||
const isCreating = ref(false);
|
const isCreating = ref(false);
|
||||||
// 预览相关状态
|
// 预览相关状态
|
||||||
const previewDialogVisible = ref(false);
|
const previewDialogVisible = ref(false);
|
||||||
@@ -937,6 +945,7 @@ const createNewWorkflow = () => {
|
|||||||
isCreationMode.value = false;
|
isCreationMode.value = false;
|
||||||
currentWorkflowForCreation.value = null;
|
currentWorkflowForCreation.value = null;
|
||||||
currentSessionId.value = null; // 清空会话 ID
|
currentSessionId.value = null; // 清空会话 ID
|
||||||
|
isFromWorkspace.value = false; // 清空工作空间标识
|
||||||
|
|
||||||
// 清空当前编辑状态
|
// 清空当前编辑状态
|
||||||
currentEditingWorkflowId.value = null;
|
currentEditingWorkflowId.value = null;
|
||||||
@@ -1089,6 +1098,7 @@ const editWorkflow = async (workflow: WorkflowItem) => {
|
|||||||
isCreationMode.value = false;
|
isCreationMode.value = false;
|
||||||
currentWorkflowForCreation.value = null;
|
currentWorkflowForCreation.value = null;
|
||||||
currentSessionId.value = null; // 清空会话 ID
|
currentSessionId.value = null; // 清空会话 ID
|
||||||
|
isFromWorkspace.value = false; // 清空工作空间标识
|
||||||
|
|
||||||
// 等待 DOM 更新后再加载工作流
|
// 等待 DOM 更新后再加载工作流
|
||||||
await nextTick();
|
await nextTick();
|
||||||
@@ -1110,6 +1120,7 @@ const backToCanvas = async () => {
|
|||||||
isCreationMode.value = false;
|
isCreationMode.value = false;
|
||||||
currentWorkflowForCreation.value = null;
|
currentWorkflowForCreation.value = null;
|
||||||
currentSessionId.value = null; // 清空会话 ID
|
currentSessionId.value = null; // 清空会话 ID
|
||||||
|
isFromWorkspace.value = false; // 清空工作空间标识
|
||||||
|
|
||||||
// 等待 DOM 更新后重新渲染画布
|
// 等待 DOM 更新后重新渲染画布
|
||||||
await nextTick();
|
await nextTick();
|
||||||
@@ -1298,6 +1309,8 @@ const handleTreeNodeClick = async (data: TreeNode) => {
|
|||||||
if (res.data) {
|
if (res.data) {
|
||||||
// 设置当前会话的 sessionId(从工作空间进入)
|
// 设置当前会话的 sessionId(从工作空间进入)
|
||||||
currentSessionId.value = data.sessionId || null;
|
currentSessionId.value = data.sessionId || null;
|
||||||
|
// 标记为从工作空间进入
|
||||||
|
isFromWorkspace.value = true;
|
||||||
|
|
||||||
// 切换到创作模式
|
// 切换到创作模式
|
||||||
isCreationMode.value = true;
|
isCreationMode.value = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user