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

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

@ -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 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>
</template>
<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';
const columns = [
{
@ -85,6 +86,7 @@
sorter: true
},
];
// props
interface Props {
visible: boolean;
@ -113,16 +115,8 @@ const emit = defineEmits<{
// 使refvisible
const visible = ref(props.visible);
// props.visiblevisible
watch(() => props.visible, (newVal) => {
visible.value = newVal;
console.log(visible.value, 42424)
getLogData()
});
// visible
watch(visible, (newVal) => {
console.log(visible.value, 42425)
emit('update:visible', newVal);
});
@ -144,9 +138,30 @@ console.log(props.logId, 444, props.logPath)
// const data: DataItem[] = [];
const data = ref<DataItem[]>([]);
async function getLogData() {
data.value = await getDataLog(props.logId, {},props.logPath)
// props.visiblevisible
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)
}

View File

@ -14,7 +14,7 @@ import { setupStore } from '/@/store';
import { setupGlobDirectives } from '/@/directives';
import { setupI18n } from '/@/locales/setupI18n';
import { registerGlobComp } from '/@/components/registerGlobComp';
import DataLog from '/@/views/mdm/Bank/components/DataLog.vue';
import axios from 'axios';
import VueGridLayout from 'vue-grid-layout';
import Antd from 'ant-design-vue';
@ -74,7 +74,6 @@ async function bootstrap() {
app.use(Antd);
app.use(VueGridLayout);
app.component('DataLog', DataLog);
//如果需要使用葡萄城报表 放开代码注释
//这里是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
? `
@ -683,9 +662,14 @@ export function buildListCode(model: GeneratorConfig): string {
? ` <SetRuleUserModal @register="registerRuleUserModal" @success="handleSuccess" />`
: ''
}
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
</PageWrapper>
</template>
<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, ${
hasBatchDeleteButton || hasDeleteButton || (hasSetUserIdButton && !isSetDataAuth)
? 'createVNode,'
@ -719,7 +703,7 @@ ${hasTemplatePrint ? ' reactive ' : ''}
import { useFormConfig } from '/@/hooks/web/useFormConfig';
import { useRouter } from 'vue-router';
import { setIndexFlowStatus } from '/@/utils/flow/index'
import { get${pascalMainTableName} } from '/@/api/${
import { get${pascalMainTableName}${hasEnableButton?`,enable${pascalMainTableName},disable${pascalMainTableName}`:''} } from '/@/api/${
model.outputConfig.outputValue
}/${lowerClassName}';
@ -1079,6 +1063,11 @@ ${hasTemplatePrint ? ' reactive ' : ''}
}
btnEvent[code]();
}
function handleDatalog (record: Recordable) {
modalVisible.value = true
logId.value = record.id
console.log('日志', modalVisible.value, record)
}
${
hasAddButton
? `

View File

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