9 Commits

10 changed files with 51 additions and 45 deletions

View File

@ -10,6 +10,7 @@ import org.apache.velocity.VelocityContext;
import org.dromara.common.core.utils.DateUtils; import org.dromara.common.core.utils.DateUtils;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.json.utils.JsonUtils; import org.dromara.common.json.utils.JsonUtils;
import org.dromara.common.mybatis.enums.DataBaseType;
import org.dromara.common.mybatis.helper.DataBaseHelper; import org.dromara.common.mybatis.helper.DataBaseHelper;
import org.dromara.generator.constant.GenConstants; import org.dromara.generator.constant.GenConstants;
import org.dromara.generator.domain.GenTable; import org.dromara.generator.domain.GenTable;
@ -58,7 +59,7 @@ public class VelocityUtils {
velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】"); velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】");
velocityContext.put("ClassName", genTable.getClassName()); velocityContext.put("ClassName", genTable.getClassName());
velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName())); velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName()));
velocityContext.put("moduleName", genTable.getModuleName()); velocityContext.put("moduleName", StrUtil.toSymbolCase(genTable.getModuleName(), '-'));
velocityContext.put("BusinessName", StringUtils.capitalize(genTable.getBusinessName())); velocityContext.put("BusinessName", StringUtils.capitalize(genTable.getBusinessName()));
velocityContext.put("businessName", genTable.getBusinessName()); velocityContext.put("businessName", genTable.getBusinessName());
velocityContext.put("business_name", StrUtil.toUnderlineCase(genTable.getBusinessName())); velocityContext.put("business_name", StrUtil.toUnderlineCase(genTable.getBusinessName()));
@ -124,11 +125,12 @@ public class VelocityUtils {
templates.add("vm/java/serviceImpl.java.vm"); templates.add("vm/java/serviceImpl.java.vm");
templates.add("vm/java/controller.java.vm"); templates.add("vm/java/controller.java.vm");
templates.add("vm/xml/mapper.xml.vm"); templates.add("vm/xml/mapper.xml.vm");
if (DataBaseHelper.isOracle()) { DataBaseType dataBaseType = DataBaseHelper.getDataBaseType();
if (dataBaseType.isOracle()) {
templates.add("vm/sql/oracle/sql.vm"); templates.add("vm/sql/oracle/sql.vm");
} else if (DataBaseHelper.isPostgerSql()) { } else if (dataBaseType.isPostgreSql()) {
templates.add("vm/sql/postgres/sql.vm"); templates.add("vm/sql/postgres/sql.vm");
} else if (DataBaseHelper.isSqlServer()) { } else if (dataBaseType.isSqlServer()) {
templates.add("vm/sql/sqlserver/sql.vm"); templates.add("vm/sql/sqlserver/sql.vm");
} else { } else {
templates.add("vm/sql/sql.vm"); templates.add("vm/sql/sql.vm");
@ -163,7 +165,7 @@ public class VelocityUtils {
String javaPath = PROJECT_PATH + "/" + StringUtils.replace(packageName, ".", "/"); String javaPath = PROJECT_PATH + "/" + StringUtils.replace(packageName, ".", "/");
String mybatisPath = MYBATIS_PATH + "/" + moduleName; String mybatisPath = MYBATIS_PATH + "/" + moduleName;
String soybeanPath = "soy"; String soybeanPath = "soy";
String soybeanModuleName = StrUtil.toSymbolCase(moduleName, '-');
if (template.contains("domain.java.vm")) { if (template.contains("domain.java.vm")) {
fileName = StringUtils.format("{}/domain/{}.java", javaPath, className); fileName = StringUtils.format("{}/domain/{}.java", javaPath, className);
} }
@ -186,17 +188,17 @@ public class VelocityUtils {
} else if (template.contains("sql.vm")) { } else if (template.contains("sql.vm")) {
fileName = businessName + "Menu.sql"; fileName = businessName + "Menu.sql";
} else if (template.contains("index.vue.vm")) { } else if (template.contains("index.vue.vm")) {
fileName = StringUtils.format("{}/views/{}/{}/index.vue", soybeanPath, moduleName, StrUtil.toSymbolCase(businessName, '-')); fileName = StringUtils.format("{}/views/{}/{}/index.vue", soybeanPath, soybeanModuleName, StrUtil.toSymbolCase(businessName, '-'));
} else if (template.contains("index-tree.vue.vm")) { } else if (template.contains("index-tree.vue.vm")) {
fileName = StringUtils.format("{}/views/{}/{}/index.vue", soybeanPath, moduleName, StrUtil.toSymbolCase(businessName, '-')); fileName = StringUtils.format("{}/views/{}/{}/index.vue", soybeanPath, soybeanModuleName, StrUtil.toSymbolCase(businessName, '-'));
} else if (template.contains("api.d.ts.vm")) { } else if (template.contains("api.d.ts.vm")) {
fileName = StringUtils.format("{}/typings/api/{}.{}.api.d.ts", soybeanPath, moduleName, StrUtil.toSymbolCase(businessName, '-')); fileName = StringUtils.format("{}/typings/api/{}.{}.api.d.ts", soybeanPath, soybeanModuleName, StrUtil.toSymbolCase(businessName, '-'));
} else if (template.contains("api.ts.vm")) { } else if (template.contains("api.ts.vm")) {
fileName = StringUtils.format("{}/service/api/{}/{}.ts", soybeanPath, moduleName, StrUtil.toSymbolCase(businessName, '-')); fileName = StringUtils.format("{}/service/api/{}/{}.ts", soybeanPath, soybeanModuleName, StrUtil.toSymbolCase(businessName, '-'));
} else if (template.contains("search.vue.vm")) { } else if (template.contains("search.vue.vm")) {
fileName = StringUtils.format("{}/views/{}/{}/modules/{}-search.vue", soybeanPath, moduleName, StrUtil.toSymbolCase(businessName, '-'), StrUtil.toSymbolCase(businessName, '-')); fileName = StringUtils.format("{}/views/{}/{}/modules/{}-search.vue", soybeanPath, soybeanModuleName, StrUtil.toSymbolCase(businessName, '-'), StrUtil.toSymbolCase(businessName, '-'));
} else if (template.contains("operate-drawer.vue.vm")) { } else if (template.contains("operate-drawer.vue.vm")) {
fileName = StringUtils.format("{}/views/{}/{}/modules/{}-operate-drawer.vue", soybeanPath, moduleName, StrUtil.toSymbolCase(businessName, '-'), StrUtil.toSymbolCase(businessName, '-')); fileName = StringUtils.format("{}/views/{}/{}/modules/{}-operate-drawer.vue", soybeanPath, soybeanModuleName, StrUtil.toSymbolCase(businessName, '-'), StrUtil.toSymbolCase(businessName, '-'));
} }
return fileName; return fileName;
} }

View File

@ -2,6 +2,7 @@
import { computed } from 'vue'; import { computed } from 'vue';
import hljs from 'highlight.js/lib/core'; import hljs from 'highlight.js/lib/core';
import json from 'highlight.js/lib/languages/json'; import json from 'highlight.js/lib/languages/json';
import { twMerge } from 'tailwind-merge';
hljs.registerLanguage('json', json); hljs.registerLanguage('json', json);
@ -10,15 +11,19 @@ defineOptions({
}); });
interface Props { interface Props {
class?: string;
code?: string; code?: string;
showLineNumbers?: boolean; showLineNumbers?: boolean;
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
class: '',
code: '', code: '',
showLineNumbers: false showLineNumbers: false
}); });
const DEFAULT_CLASS = 'max-h-500px';
/** 格式化JSON数据 */ /** 格式化JSON数据 */
const jsonData = computed<string>(() => { const jsonData = computed<string>(() => {
if (!props.code) return ''; if (!props.code) return '';
@ -33,9 +38,9 @@ const jsonData = computed<string>(() => {
</script> </script>
<template> <template>
<div class="json-preview"> <NScrollbar :class="twMerge(DEFAULT_CLASS, props.class)">
<NCode :code="jsonData" :hljs="hljs" language="json" :show-line-numbers="showLineNumbers" /> <NCode :code="jsonData" :hljs="hljs" language="json" :show-line-numbers="showLineNumbers" :word-wrap="true" />
</div> </NScrollbar>
</template> </template>
<style lang="scss"> <style lang="scss">
@ -44,18 +49,4 @@ html[class='dark'] {
background-color: #7c7777; background-color: #7c7777;
} }
} }
.json-preview {
width: 100%;
max-height: 500px;
overflow-y: auto;
@include scrollbar();
.empty-data {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
color: #999;
font-size: 14px;
}
}
</style> </style>

View File

@ -150,7 +150,13 @@ watch(visible, () => {
:native-scrollbar="false" :native-scrollbar="false"
> >
<NSpin :show="loading"> <NSpin :show="loading">
<NDescriptions :title="taskInfo?.flowName" label-placement="left" :column="2" size="small" bordered> <NDescriptions
:title="`${taskInfo?.flowName} (${taskInfo?.flowCode})`"
label-placement="left"
:column="2"
size="small"
bordered
>
<NDescriptionsItem label="任务名称"> <NDescriptionsItem label="任务名称">
{{ taskInfo?.nodeName }} {{ taskInfo?.nodeName }}
</NDescriptionsItem> </NDescriptionsItem>

View File

@ -112,6 +112,7 @@ function createDefaultStartWorkflowModel(): StartWorkflowModel {
return { return {
flowCode: null, flowCode: null,
businessId: null, businessId: null,
flowInstanceBizExtBo: null,
variables: {} variables: {}
}; };
} }
@ -205,6 +206,10 @@ async function handleSubmit() {
// 提交流程 // 提交流程
startWorkflowModel.businessId = respLeave.value?.id; startWorkflowModel.businessId = respLeave.value?.id;
startWorkflowModel.flowCode = model.flowCode; startWorkflowModel.flowCode = model.flowCode;
startWorkflowModel.flowInstanceBizExtBo = {
businessCode: respLeave.value?.applyCode,
businessTitle: '请假申请'
};
taskVariables.value = { taskVariables.value = {
leaveDays: respLeave.value?.leaveDays, leaveDays: respLeave.value?.leaveDays,
userList: ['1', '3', '4'] userList: ['1', '3', '4']

View File

@ -33,7 +33,7 @@ const toGitee = () => {
</NBadge> </NBadge>
</NButton> </NButton>
</template> </template>
消息 {{ $t('page.home.message') }}
</NTooltip> </NTooltip>
</template> </template>
<NCard <NCard

View File

@ -6,6 +6,7 @@ html,
body, body,
#app { #app {
height: 100%; height: 100%;
font-family: inherit;
} }
html { html {

View File

@ -22,8 +22,8 @@ declare namespace Api {
type Leave = Common.CommonRecord<{ type Leave = Common.CommonRecord<{
/** id */ /** id */
id: CommonType.IdType; id: CommonType.IdType;
/** 租户编号 */ /** 申请编码 */
tenantId: CommonType.IdType; applyCode: string;
/** 请假类型 */ /** 请假类型 */
leaveType: LeaveType; leaveType: LeaveType;
/** 开始时间 */ /** 开始时间 */
@ -275,12 +275,20 @@ declare namespace Api {
message: string; message: string;
}>; }>;
type BusinessInfo = CommonType.RecordNullable<{
/** 业务编码 */
businessCode: string;
/** 业务名称 */
businessTitle: string;
}>;
/** 启动流程操作参数 */ /** 启动流程操作参数 */
type StartWorkflowOperateParams = CommonType.RecordNullable<{ type StartWorkflowOperateParams = CommonType.RecordNullable<{
/** 流程定义ID */ /** 流程定义ID */
flowCode: string; flowCode: string;
/** 业务ID */ /** 业务ID */
businessId: CommonType.IdType; businessId: CommonType.IdType;
/** 业务信息 */
flowInstanceBizExtBo: BusinessInfo;
/** 变量 */ /** 变量 */
variables: { [key: string]: any }; variables: { [key: string]: any };
}>; }>;

View File

@ -47,15 +47,10 @@ declare module 'vue' {
'IconMaterialSymbols:deleteOutline': typeof import('~icons/material-symbols/delete-outline')['default'] 'IconMaterialSymbols:deleteOutline': typeof import('~icons/material-symbols/delete-outline')['default']
'IconMaterialSymbols:downloadRounded': typeof import('~icons/material-symbols/download-rounded')['default'] 'IconMaterialSymbols:downloadRounded': typeof import('~icons/material-symbols/download-rounded')['default']
'IconMaterialSymbols:driveFileRenameOutlineOutline': typeof import('~icons/material-symbols/drive-file-rename-outline-outline')['default'] 'IconMaterialSymbols:driveFileRenameOutlineOutline': typeof import('~icons/material-symbols/drive-file-rename-outline-outline')['default']
'IconMaterialSymbols:editDocument': typeof import('~icons/material-symbols/edit-document')['default']
'IconMaterialSymbols:imageOutline': typeof import('~icons/material-symbols/image-outline')['default'] 'IconMaterialSymbols:imageOutline': typeof import('~icons/material-symbols/image-outline')['default']
'IconMaterialSymbols:refreshRounded': typeof import('~icons/material-symbols/refresh-rounded')['default'] 'IconMaterialSymbols:refreshRounded': typeof import('~icons/material-symbols/refresh-rounded')['default']
'IconMaterialSymbols:syncOutline': typeof import('~icons/material-symbols/sync-outline')['default']
'IconMaterialSymbols:uploadRounded': typeof import('~icons/material-symbols/upload-rounded')['default'] 'IconMaterialSymbols:uploadRounded': typeof import('~icons/material-symbols/upload-rounded')['default']
'IconMaterialSymbols:warningOutlineRounded': typeof import('~icons/material-symbols/warning-outline-rounded')['default'] 'IconMaterialSymbols:warningOutlineRounded': typeof import('~icons/material-symbols/warning-outline-rounded')['default']
IconMaterialSymbolsAddRounded: typeof import('~icons/material-symbols/add-rounded')['default']
IconMaterialSymbolsDeleteOutline: typeof import('~icons/material-symbols/delete-outline')['default']
IconMaterialSymbolsDriveFileRenameOutlineOutline: typeof import('~icons/material-symbols/drive-file-rename-outline-outline')['default']
'IconMdi:github': typeof import('~icons/mdi/github')['default'] 'IconMdi:github': typeof import('~icons/mdi/github')['default']
IconMdiArrowDownThin: typeof import('~icons/mdi/arrow-down-thin')['default'] IconMdiArrowDownThin: typeof import('~icons/mdi/arrow-down-thin')['default']
IconMdiArrowUpThin: typeof import('~icons/mdi/arrow-up-thin')['default'] IconMdiArrowUpThin: typeof import('~icons/mdi/arrow-up-thin')['default']
@ -97,8 +92,6 @@ declare module 'vue' {
NDrawer: typeof import('naive-ui')['NDrawer'] NDrawer: typeof import('naive-ui')['NDrawer']
NDrawerContent: typeof import('naive-ui')['NDrawerContent'] NDrawerContent: typeof import('naive-ui')['NDrawerContent']
NDropdown: typeof import('naive-ui')['NDropdown'] NDropdown: typeof import('naive-ui')['NDropdown']
NDynamicInput: typeof import('naive-ui')['NDynamicInput']
NDynamicTags: typeof import('naive-ui')['NDynamicTags']
NEllipsis: typeof import('naive-ui')['NEllipsis'] NEllipsis: typeof import('naive-ui')['NEllipsis']
NEmpty: typeof import('naive-ui')['NEmpty'] NEmpty: typeof import('naive-ui')['NEmpty']
NForm: typeof import('naive-ui')['NForm'] NForm: typeof import('naive-ui')['NForm']
@ -109,7 +102,6 @@ declare module 'vue' {
NGridItem: typeof import('naive-ui')['NGridItem'] NGridItem: typeof import('naive-ui')['NGridItem']
NInput: typeof import('naive-ui')['NInput'] NInput: typeof import('naive-ui')['NInput']
NInputGroup: typeof import('naive-ui')['NInputGroup'] NInputGroup: typeof import('naive-ui')['NInputGroup']
NInputGroupLabel: typeof import('naive-ui')['NInputGroupLabel']
NInputNumber: typeof import('naive-ui')['NInputNumber'] NInputNumber: typeof import('naive-ui')['NInputNumber']
NLayout: typeof import('naive-ui')['NLayout'] NLayout: typeof import('naive-ui')['NLayout']
NLayoutContent: typeof import('naive-ui')['NLayoutContent'] NLayoutContent: typeof import('naive-ui')['NLayoutContent']

View File

@ -40,6 +40,7 @@ const deptData = ref<Api.System.Dept[]>([]);
const userOptions = ref<CommonType.Option<CommonType.IdType>[]>([]); const userOptions = ref<CommonType.Option<CommonType.IdType>[]>([]);
const placeholder = ref<string>($t('page.system.dept.placeholder.defaultLeaderPlaceHolder')); const placeholder = ref<string>($t('page.system.dept.placeholder.defaultLeaderPlaceHolder'));
const disabled = ref<boolean>(false); const disabled = ref<boolean>(false);
const expandedKeys = ref<CommonType.IdType[]>([]);
const title = computed(() => { const title = computed(() => {
const titles: Record<NaiveUI.TableOperateType, string> = { const titles: Record<NaiveUI.TableOperateType, string> = {
@ -55,7 +56,7 @@ const model: Model = reactive(createDefaultModel());
function createDefaultModel(): Model { function createDefaultModel(): Model {
return { return {
parentId: '', parentId: props.rowData?.deptId || '',
deptName: '', deptName: '',
deptCategory: '', deptCategory: '',
orderNum: null, orderNum: null,
@ -80,7 +81,6 @@ const rules: Record<RuleKey, App.Global.FormRule> = {
function handleUpdateModelWhenEdit() { function handleUpdateModelWhenEdit() {
if (props.operateType === 'add') { if (props.operateType === 'add') {
Object.assign(model, createDefaultModel()); Object.assign(model, createDefaultModel());
model.parentId = props.rowData?.deptId || 0;
} }
if (props.operateType === 'edit' && props.rowData) { if (props.operateType === 'edit' && props.rowData) {
@ -144,6 +144,7 @@ async function getDeptData() {
if (data) { if (data) {
deptData.value = handleTree(data, { idField: 'deptId' }); deptData.value = handleTree(data, { idField: 'deptId' });
expandedKeys.value = [deptData.value[0].deptId];
} }
endDeptLoading(); endDeptLoading();
} }
@ -186,15 +187,15 @@ watch(visible, () => {
<NDrawer v-model:show="visible" :title="title" display-directive="show" :width="800" class="max-w-90%"> <NDrawer v-model:show="visible" :title="title" display-directive="show" :width="800" class="max-w-90%">
<NDrawerContent :title="title" :native-scrollbar="false" closable> <NDrawerContent :title="title" :native-scrollbar="false" closable>
<NForm ref="formRef" :model="model" :rules="rules"> <NForm ref="formRef" :model="model" :rules="rules">
<NFormItem v-if="model.parentId != 0" :label="$t('page.system.dept.parentId')" path="parentId"> <NFormItem v-if="model.parentId !== 0" :label="$t('page.system.dept.parentId')" path="parentId">
<NTreeSelect <NTreeSelect
v-model:value="model.parentId" v-model:value="model.parentId"
v-model:expanded-keys="expandedKeys"
:loading="deptLoading" :loading="deptLoading"
clearable clearable
:options="deptData" :options="deptData"
label-field="deptName" label-field="deptName"
key-field="deptId" key-field="deptId"
default-expand-all
:placeholder="$t('page.system.dept.form.parentId.required')" :placeholder="$t('page.system.dept.form.parentId.required')"
/> />
</NFormItem> </NFormItem>

View File

@ -356,7 +356,7 @@ const columns: NaiveUI.TableColumn<Api.Tool.GenTableColumn>[] = [
<NFormItemGi span="24 s:12" path="moduleName"> <NFormItemGi span="24 s:12" path="moduleName">
<template #label> <template #label>
<div class="flex-center"> <div class="flex-center">
<FormTip content="可理解为子系统名,例如 system" /> <FormTip content="可理解为子系统名,例如 systemflow-instance。避免驼峰命名" />
<span class="pl-3px">生成模块名</span> <span class="pl-3px">生成模块名</span>
</div> </div>
</template> </template>