Merge remote-tracking branch 'gitee/master'

This commit is contained in:
2026-11-07 11:25:55 +08:00
10 changed files with 82 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
module.exports = {
export default {
// 继承的规则
extends: ["@commitlint/config-conventional"],
// 自定义规则

View File

@@ -1,7 +1,7 @@
{
"name": "vue3-element-admin",
"description": "Vue3 + Vite + TypeScript + Element-Plus 的后台管理模板,vue-element-admin 的 Vue3 版本",
"version": "4.11.1",
"version": "4.12.0",
"private": true,
"type": "module",
"scripts": {

View File

@@ -287,6 +287,8 @@ export interface CompleteTaskFormData {
comment?: string;
/** 流程变量(驱动后续网关条件) */
variables?: Record<string, unknown>;
/** 发起表单数据(发起人节点重新提交时填写) */
formData?: Record<string, unknown>;
}
/**

View File

@@ -109,13 +109,13 @@
<el-col :span="12">
<el-form-item label="页面类型">
<el-radio-group v-model="formData.pageType">
<el-radio-button value="classic">
<el-icon><DocumentChecked /></el-icon>
普通
</el-radio-button>
<el-radio-button value="crud">
<el-icon><SetUp /></el-icon>
封装(CRUD)
封装 CRUD(推荐)
</el-radio-button>
<el-radio-button value="classic">
<el-icon><DocumentChecked /></el-icon>
普通(兼容)
</el-radio-button>
</el-radio-group>
</el-form-item>

View File

@@ -131,6 +131,7 @@
:key="key"
:label="item.label"
:value="item.value"
:disabled="isQueryTypeDisabled(row, key)"
/>
</el-select>
</div>
@@ -212,9 +213,20 @@ const props = defineProps<{
aiChanges?: Record<string, AiChangeItem[]>;
}>();
type FieldConfig = NonNullable<GenConfigForm["fieldConfigs"]>[number];
const formTypeOptions: Record<string, OptionItem> = FormTypeEnum;
const queryTypeOptions: Record<string, OptionItem> = QueryTypeEnum;
/**
* 判断查询方式是否适用于字段类型
*/
function isQueryTypeDisabled(row: FieldConfig, key: string): boolean {
if (key === "IN") return row.fieldType === "byte[]";
if (key === "BETWEEN") return row.fieldType === "Boolean" || row.fieldType === "byte[]";
return false;
}
const listRef = ref<HTMLElement>();
const sortFlag = ref<Sortable | null>(null);

View File

@@ -387,7 +387,7 @@ async function handleAiFill() {
snapshotConfig(genConfigFormData.value);
const filled = await GeneratorAPI.aiFillConfig(currentTableName.value);
// 接口按表结构重建配置,页面类型等非字段项可能为空,沿用当前选择再补默认
filled.pageType = filled.pageType || genConfigFormData.value.pageType || "classic";
filled.pageType = filled.pageType || genConfigFormData.value.pageType || "crud";
const diff = resolveDiff(filled);
genConfigFormData.value = applyDefaults(filled);
if (diff.changeCount === 0) {
@@ -484,7 +484,7 @@ async function handleNext() {
}
if (currentStep.value === STEP.PREVIEW) {
const pageType = genConfigFormData.value.pageType || "classic";
const pageType = genConfigFormData.value.pageType || "crud";
await GeneratorAPI.download(currentTableName.value, pageType as "classic" | "crud", "ts");
}
}

View File

@@ -228,7 +228,7 @@ const fileCount = computed(() => {
* 下载生成的代码
*/
function handleDownload() {
const pageType = props.genConfigFormData.pageType || "classic";
const pageType = props.genConfigFormData.pageType || "crud";
return GeneratorAPI.download(props.tableName, pageType as "classic" | "crud", "ts");
}

View File

@@ -37,7 +37,7 @@ export function useCodePreview(genConfigFormData: Ref<GenConfigForm>) {
*/
async function handlePreview(tableName: string) {
treeData.value = [];
const pageType = genConfigFormData.value.pageType || "classic";
const pageType = genConfigFormData.value.pageType || "crud";
const data = await GeneratorAPI.getPreviewData(tableName, pageType as "classic" | "crud", "ts");
const previewList = data || [];

View File

@@ -11,7 +11,7 @@ import type { OptionItem } from "@/api/common";
export function useGenConfig() {
const genConfigFormData = ref<GenConfigForm>({
fieldConfigs: [],
pageType: "classic",
pageType: "crud",
});
const genConfigFormRules = {
@@ -63,11 +63,11 @@ export function useGenConfig() {
);
/**
* 未保存过的表页面类型为空,统一补成普通表单
* 未保存过的表页面类型为空,统一补成 CrudPage 页面
*/
function applyDefaults(config: GenConfigForm): GenConfigForm {
if (!config.pageType) {
config.pageType = "classic";
config.pageType = "crud";
}
return config;
}

View File

@@ -106,8 +106,15 @@
<el-tabs class="todo-approve__tabs">
<el-tab-pane label="申请信息">
<form-create
v-if="isInitiatorTask && detail.formJson"
v-model="editFormData"
v-model:api="editFormApi"
:rule="editRule"
:option="editOption"
/>
<FormDetail
v-if="detail.formJson"
v-else-if="detail.formJson"
:form-json="detail.formJson"
:options-json="detail.optionsJson"
:data-json="detail.dataJson"
@@ -179,6 +186,8 @@ import { useFullscreen } from "@vueuse/core";
import { ElMessage, type FormInstance } from "element-plus";
import { MagicStick, Refresh } from "@element-plus/icons-vue";
import type { Options, Rule } from "@form-create/element-ui";
import WorkflowAPI from "@/api/workflow";
import type {
RejectTargetItem,
@@ -239,6 +248,39 @@ const approveState = reactive({
// 当前任务详情
const detail = ref<TaskDetailData>();
// 发起人节点可编辑表单:只有该节点允许修改申请内容,其余节点保持只读
const editFormApi = ref();
const editFormData = ref<Record<string, unknown>>({});
const editRule = shallowRef<Rule[]>([]);
const editOption = ref<Options>({ submitBtn: false, resetBtn: false });
const isInitiatorTask = computed(() => Boolean(detail.value?.taskFormKey));
watch(
() => [
detail.value?.taskFormKey,
detail.value?.formJson,
detail.value?.optionsJson,
detail.value?.dataJson,
],
() => {
if (!isInitiatorTask.value) return;
try {
editRule.value = JSON.parse(detail.value?.formJson || "[]") as Rule[];
editOption.value = {
...(JSON.parse(detail.value?.optionsJson || "{}") as Options),
submitBtn: false,
resetBtn: false,
};
editFormData.value = JSON.parse(detail.value?.dataJson || "{}") as Record<string, unknown>;
} catch {
editRule.value = [];
editOption.value = { submitBtn: false, resetBtn: false };
editFormData.value = {};
}
},
{ immediate: true },
);
// 审批意见(通过/驳回共用)
const comment = ref("");
@@ -326,7 +368,17 @@ function closeRejectMode(): void {
async function handleComplete(): Promise<void> {
submitting.value = true;
try {
await WorkflowAPI.task.complete(detail.value!.taskId, { comment: comment.value });
if (isInitiatorTask.value) {
const valid = await editFormApi.value
?.validate()
.then(() => true)
.catch(() => false);
if (!valid) return;
}
await WorkflowAPI.task.complete(detail.value!.taskId, {
comment: comment.value,
formData: isInitiatorTask.value ? { ...editFormData.value } : undefined,
});
ElMessage.success("审批通过");
approveState.visible = false;
fetchData();