修改数据日志全局组件,并添加自动代码生成模板

This commit is contained in:
2025-10-24 08:30:42 +08:00
parent 3df6e12184
commit 53854c519f
9 changed files with 51 additions and 55 deletions

View File

@ -10,7 +10,7 @@ VITE_PUBLIC_PATH = /
# 如果接口地址匹配到则会转发到http://localhost:3000防止本地出现跨域问题 # 如果接口地址匹配到则会转发到http://localhost:3000防止本地出现跨域问题
# 可以有多个,注意多个不能换行,否则代理将会失效 # 可以有多个,注意多个不能换行,否则代理将会失效
#VITE_PROXY = [["/api","http://localhost:3000"],["/upload","http://localhost:3300/upload"]] #VITE_PROXY = [["/api","http://localhost:3000"],["/upload","http://localhost:3300/upload"]]
VITE_PROXY=[["/api","http://127.0.0.1:8090"]] VITE_PROXY=[["/api","http://47.94.165.164:9500"]]
# 是否删除Console.log # 是否删除Console.log
VITE_DROP_CONSOLE = false VITE_DROP_CONSOLE = false

View File

@ -4,8 +4,10 @@ FROM docker.tanuki.vip/nginx-amd64:1.29.0
MAINTAINER fucai MAINTAINER fucai
WORKDIR /usr/share/nginx/html WORKDIR /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/nginx.conf # 拷贝 nginx 配置文件 # 拷贝 nginx 配置文件
COPY ./dist/ /usr/share/nginx/html/ # 拷贝 dist 目录下的文件到 nginx 的 html 目录下 COPY ./nginx.conf /etc/nginx/nginx.conf
# 拷贝 dist 目录下的文件到 nginx 的 html 目录下
COPY ./dist/ /usr/share/nginx/html/
EXPOSE 8080 EXPOSE 8080

View File

@ -138,18 +138,3 @@ export async function disableLngBBank(ids: string[], mode: ErrorMessageMode = 'm
); );
} }
/**
* @description: 获取数据日志
*/
export async function getDataLog(id: string, mode: ErrorMessageMode = 'modal', path:string) {
return defHttp.get<boolean>(
{
url: path,
params: { id },
},
{
errorMessageMode: mode,
},
);
}

View File

@ -6,4 +6,4 @@ import pageFooter from './src/PageFooter.vue';
export const PageWrapper = withInstall(pageWrapper); export const PageWrapper = withInstall(pageWrapper);
export const PageFooter = withInstall(pageFooter); export const PageFooter = withInstall(pageFooter);
export const PageWrapperFixedHeightKey = 'PageWrapperFixedHeight'; export const PageWrapperFixedHeightKey = 'PageWrapperFixedHeight';

View File

@ -0,0 +1,5 @@
import { withInstall } from '/@/utils';
import dataLog from './src/DataLog.vue';
export const DataLog = withInstall(dataLog);

View File

@ -13,7 +13,8 @@
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { getDataLog } from '/@/api/mdm/Bank'; import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
import { watch, defineProps, ref, computed, onMounted, onUnmounted, createVNode, reactive, } from 'vue'; import { watch, defineProps, ref, computed, onMounted, onUnmounted, createVNode, reactive, } from 'vue';
const columns = [ const columns = [
{ {
@ -85,6 +86,7 @@
sorter: true sorter: true
}, },
]; ];
// props // props
interface Props { interface Props {
visible: boolean; visible: boolean;
@ -113,16 +115,8 @@ const emit = defineEmits<{
// 使refvisible // 使refvisible
const visible = ref(props.visible); const visible = ref(props.visible);
// props.visiblevisible
watch(() => props.visible, (newVal) => {
visible.value = newVal;
console.log(visible.value, 42424)
getLogData()
});
// visible // visible
watch(visible, (newVal) => { watch(visible, (newVal) => {
console.log(visible.value, 42425)
emit('update:visible', newVal); emit('update:visible', newVal);
}); });
@ -144,9 +138,30 @@ console.log(props.logId, 444, props.logPath)
// const data: DataItem[] = []; // const data: DataItem[] = [];
const data = ref<DataItem[]>([]); const data = ref<DataItem[]>([]);
async function getLogData() { // props.visiblevisible
data.value = await getDataLog(props.logId, {},props.logPath) watch(() => props.visible, (newVal) => {
visible.value = newVal;
if(newVal){
console.log('显示数据日志,加载数据')
getLog();
}else{
data.value = [];
}
});
/**
* @description: 获取数据日志
*/
async function getDataLogData(id: string,url:string, mode: ErrorMessageMode = 'modal') {
return defHttp.get<boolean>(
{url: url,params:{id}},{errorMessageMode: mode},
);
}
async function getLog() {
data.value = await getDataLogData(props.logId,props.logPath,{})
console.log(data.value, 88) console.log(data.value, 88)
} }

View File

@ -14,7 +14,7 @@ import { setupStore } from '/@/store';
import { setupGlobDirectives } from '/@/directives'; import { setupGlobDirectives } from '/@/directives';
import { setupI18n } from '/@/locales/setupI18n'; import { setupI18n } from '/@/locales/setupI18n';
import { registerGlobComp } from '/@/components/registerGlobComp'; import { registerGlobComp } from '/@/components/registerGlobComp';
import DataLog from '/@/views/mdm/Bank/components/DataLog.vue';
import axios from 'axios'; import axios from 'axios';
import VueGridLayout from 'vue-grid-layout'; import VueGridLayout from 'vue-grid-layout';
import Antd from 'ant-design-vue'; import Antd from 'ant-design-vue';
@ -74,7 +74,6 @@ async function bootstrap() {
app.use(Antd); app.use(Antd);
app.use(VueGridLayout); app.use(VueGridLayout);
app.component('DataLog', DataLog);
//如果需要使用葡萄城报表 放开代码注释 //如果需要使用葡萄城报表 放开代码注释
//这里是viewer的key //这里是viewer的key

View File

@ -249,27 +249,6 @@ export async function disable${pascalMainTableName}(ids: string[], mode: ErrorMe
: '' : ''
} }
${
hasDataLogButton?
`
/**
* @description: 获取数据日志${pascalMainTableName}
*/
export async function getDataLog${pascalMainTableName}(id: string, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.Datalog,
data: id,
},
{
errorMessageMode: mode,
},
);
}
`
:''
}
${ ${
hasSetUserIdButton hasSetUserIdButton
? ` ? `
@ -683,9 +662,14 @@ export function buildListCode(model: GeneratorConfig): string {
? ` <SetRuleUserModal @register="registerRuleUserModal" @success="handleSuccess" />` ? ` <SetRuleUserModal @register="registerRuleUserModal" @success="handleSuccess" />`
: '' : ''
} }
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
</PageWrapper> </PageWrapper>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
const modalVisible = ref(false);
const logId = ref('')
const logPath = ref('/${model.outputConfig.outputValue}/${lowerFirstPascalClassName}/datalog');
import { DataLog } from '/@/components/pcitc';
import { ref, computed, onMounted, onUnmounted, ${ import { ref, computed, onMounted, onUnmounted, ${
hasBatchDeleteButton || hasDeleteButton || (hasSetUserIdButton && !isSetDataAuth) hasBatchDeleteButton || hasDeleteButton || (hasSetUserIdButton && !isSetDataAuth)
? 'createVNode,' ? 'createVNode,'
@ -719,7 +703,7 @@ ${hasTemplatePrint ? ' reactive ' : ''}
import { useFormConfig } from '/@/hooks/web/useFormConfig'; import { useFormConfig } from '/@/hooks/web/useFormConfig';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { setIndexFlowStatus } from '/@/utils/flow/index' import { setIndexFlowStatus } from '/@/utils/flow/index'
import { get${pascalMainTableName} } from '/@/api/${ import { get${pascalMainTableName}${hasEnableButton?`,enable${pascalMainTableName},disable${pascalMainTableName}`:''} } from '/@/api/${
model.outputConfig.outputValue model.outputConfig.outputValue
}/${lowerClassName}'; }/${lowerClassName}';
@ -1079,6 +1063,11 @@ ${hasTemplatePrint ? ' reactive ' : ''}
} }
btnEvent[code](); btnEvent[code]();
} }
function handleDatalog (record: Recordable) {
modalVisible.value = true
logId.value = record.id
console.log('日志', modalVisible.value, record)
}
${ ${
hasAddButton hasAddButton
? ` ? `

View File

@ -34,6 +34,7 @@
const modalVisible = ref(false); const modalVisible = ref(false);
const logId = ref('') const logId = ref('')
const logPath = ref('/mdm/bank/datalog'); const logPath = ref('/mdm/bank/datalog');
import { DataLog } from '/@/components/pcitc';
import { Modal } from 'ant-design-vue'; import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table'; import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';