新增配方日志查询功能,记录配方和混炼示方的创建、更新与删除操作,增强数据追溯能力。
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslFormulaSpecEditLog/list',
|
||||
queryById = '/xslmes/mesXslFormulaSpecEditLog/queryById',
|
||||
exportXls = '/xslmes/mesXslFormulaSpecEditLog/exportXls',
|
||||
}
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
|
||||
@@ -0,0 +1,84 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
|
||||
export const SPEC_TYPE_DICT = 'xslmes_formula_spec_edit_log_type';
|
||||
export const ACTION_TYPE_DICT = 'xslmes_formula_spec_edit_log_action';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '示方分类',
|
||||
align: 'center',
|
||||
dataIndex: 'specType_dictText',
|
||||
width: 110,
|
||||
},
|
||||
{ title: '示方标识', align: 'center', dataIndex: 'specTitle', width: 180, ellipsis: true },
|
||||
{ title: '发行编号', align: 'center', dataIndex: 'issueNumber', width: 140 },
|
||||
{
|
||||
title: '操作类型',
|
||||
align: 'center',
|
||||
dataIndex: 'actionType_dictText',
|
||||
width: 90,
|
||||
},
|
||||
{
|
||||
title: '修改内容',
|
||||
align: 'left',
|
||||
dataIndex: 'changeSummary',
|
||||
width: 320,
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '修改时间',
|
||||
align: 'center',
|
||||
dataIndex: 'modifyTime',
|
||||
width: 165,
|
||||
},
|
||||
{ title: '修改人', align: 'center', dataIndex: 'modifyByName', width: 110 },
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '示方分类',
|
||||
field: 'specType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: SPEC_TYPE_DICT, placeholder: '全部' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '示方标识', field: 'specTitle', component: 'JInput', colProps: { span: 6 } },
|
||||
{ label: '发行编号', field: 'issueNumber', component: 'JInput', colProps: { span: 6 } },
|
||||
{
|
||||
label: '操作类型',
|
||||
field: 'actionType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: ACTION_TYPE_DICT, placeholder: '全部' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '修改人', field: 'modifyByName', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '修改时间',
|
||||
field: 'modifyTime',
|
||||
component: 'RangePicker',
|
||||
colProps: { span: 8 },
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export const changeItemColumns: BasicColumn[] = [
|
||||
{ title: '区块', align: 'center', dataIndex: 'sectionLabel', width: 120 },
|
||||
{ title: '字段/行', align: 'center', dataIndex: 'fieldLabel', width: 160 },
|
||||
{
|
||||
title: '变更前',
|
||||
align: 'left',
|
||||
dataIndex: 'beforeValue',
|
||||
width: 280,
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '变更后',
|
||||
align: 'left',
|
||||
dataIndex: 'afterValue',
|
||||
width: 280,
|
||||
ellipsis: true,
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_formula_spec_edit_log:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '查看对比',
|
||||
onClick: handleCompare.bind(null, record),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslFormulaSpecEditLogCompareModal @register="registerCompareModal" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslFormulaSpecEditLog" setup>
|
||||
import { reactive } from 'vue';
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import MesXslFormulaSpecEditLogCompareModal from './components/MesXslFormulaSpecEditLogCompareModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslFormulaSpecEditLog.data';
|
||||
import { list, getExportUrl } from './MesXslFormulaSpecEditLog.api';
|
||||
|
||||
const queryParam = reactive<any>({});
|
||||
const [registerCompareModal, { openModal: openCompareModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '配方日志查询',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
showIndexColumn: true,
|
||||
tableSetting: { cacheKey: 'mesXslFormulaSpecEditLog_v20260526' },
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 90,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
fieldMapToTime: [['modifyTime', ['modifyTime_begin', 'modifyTime_end'], 'YYYY-MM-DD HH:mm:ss']],
|
||||
},
|
||||
actionColumn: {
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
width: 110,
|
||||
fixed: 'right',
|
||||
slots: { customRender: 'action' },
|
||||
},
|
||||
beforeFetch: (params) => Object.assign(params, queryParam),
|
||||
},
|
||||
exportConfig: {
|
||||
name: '配方日志查询',
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable] = tableContext;
|
||||
|
||||
function handleCompare(record: Recordable) {
|
||||
openCompareModal(true, { record });
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
@register="registerModal"
|
||||
title="配方修改对比"
|
||||
:width="1100"
|
||||
destroyOnClose
|
||||
:showOkBtn="false"
|
||||
cancelText="关闭"
|
||||
>
|
||||
<a-spin :spinning="loading">
|
||||
<a-descriptions bordered :column="2" size="small" class="mb-4">
|
||||
<a-descriptions-item label="示方分类">{{ detail?.specType_dictText || detail?.specType || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="操作类型">{{ detail?.actionType_dictText || detail?.actionType || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="示方标识">{{ detail?.specTitle || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="发行编号">{{ detail?.issueNumber || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="修改人">{{ detail?.modifyByName || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="修改时间">{{ detail?.modifyTime || '-' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="修改内容" :span="2">{{ detail?.changeSummary || '-' }}</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
|
||||
<a-tabs v-model:activeKey="activeTab">
|
||||
<a-tab-pane key="changes" tab="字段对比">
|
||||
<BasicTable
|
||||
:columns="changeItemColumns"
|
||||
:dataSource="changeItems"
|
||||
:pagination="false"
|
||||
:canResize="false"
|
||||
size="small"
|
||||
bordered
|
||||
rowKey="rowKey"
|
||||
/>
|
||||
<a-empty v-if="!loading && changeItems.length === 0" description="暂无字段级差异(新增/删除或无变更字段)" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="before" tab="变更前快照">
|
||||
<pre class="snapshot-pre">{{ formatSnapshot(detail?.beforeData) }}</pre>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="after" tab="变更后快照">
|
||||
<pre class="snapshot-pre">{{ formatSnapshot(detail?.afterData) }}</pre>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-spin>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicTable } from '/@/components/Table';
|
||||
import { changeItemColumns } from '../MesXslFormulaSpecEditLog.data';
|
||||
import { queryById } from '../MesXslFormulaSpecEditLog.api';
|
||||
|
||||
defineEmits(['register']);
|
||||
|
||||
const loading = ref(false);
|
||||
const activeTab = ref('changes');
|
||||
const detail = ref<Recordable | null>(null);
|
||||
const changeItems = ref<Recordable[]>([]);
|
||||
|
||||
const [registerModal, { setModalProps }] = useModalInner(async (data) => {
|
||||
activeTab.value = 'changes';
|
||||
detail.value = null;
|
||||
changeItems.value = [];
|
||||
setModalProps({ confirmLoading: false });
|
||||
const id = data?.record?.id;
|
||||
if (!id) {
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
try {
|
||||
const result = await queryById({ id });
|
||||
detail.value = result || {};
|
||||
changeItems.value = (result?.changeItems || []).map((item, index) => ({
|
||||
...item,
|
||||
rowKey: `${item.section || ''}_${item.fieldKey || ''}_${index}`,
|
||||
}));
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
});
|
||||
|
||||
function formatSnapshot(data: unknown) {
|
||||
if (data == null) {
|
||||
return '(无)';
|
||||
}
|
||||
try {
|
||||
return JSON.stringify(data, null, 2);
|
||||
} catch {
|
||||
return String(data);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.snapshot-pre {
|
||||
max-height: 480px;
|
||||
overflow: auto;
|
||||
margin: 0;
|
||||
padding: 12px;
|
||||
background: #fafafa;
|
||||
border: 1px solid #f0f0f0;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user