新增钉钉 Stream SDK 依赖,支持无 HTTP 上下文的后台线程显式传入 token 进行审批回调。同时,完善了 MES 审批台账功能,新增审批记录同步、批量发起审批时的门禁与台账写入逻辑,增强了系统的审批流管理能力。

This commit is contained in:
geht
2026-06-05 10:44:30 +08:00
parent 4785c55e52
commit fc4e3211ad
73 changed files with 5225 additions and 240 deletions

View File

@@ -0,0 +1,13 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslApprovalRecord/list',
queryById = '/xslmes/mesXslApprovalRecord/queryById',
exportXls = '/xslmes/mesXslApprovalRecord/exportXls',
}
export const getExportUrl = Api.exportXls;
export const list = (params) => defHttp.get({ url: Api.list, params });
export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params });

View File

@@ -0,0 +1,78 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
export const columns: BasicColumn[] = [
{ title: '业务单据', align: 'center', dataIndex: 'bizTableName', width: 120, ellipsis: true },
{ title: '业务标题', align: 'center', dataIndex: 'bizTitle', width: 180, ellipsis: true },
{ title: '审批通道', align: 'center', dataIndex: 'channel_dictText', width: 100 },
{ title: '状态', align: 'center', dataIndex: 'status_dictText', width: 100 },
{ title: '发起次数', align: 'center', dataIndex: 'launchNo', width: 80 },
{ title: '发起人', align: 'center', dataIndex: 'applyUserName', width: 100 },
{
title: '发起时间',
align: 'center',
dataIndex: 'applyTime',
width: 165,
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
},
{
title: '办结时间',
align: 'center',
dataIndex: 'finishTime',
width: 165,
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
},
{ title: 'MES审批流', align: 'center', dataIndex: 'flowName', width: 140, ellipsis: true },
{ title: '钉钉模板', align: 'center', dataIndex: 'templateName', width: 140, ellipsis: true },
{ title: '外部实例ID', align: 'center', dataIndex: 'externalInstanceId', width: 160, ellipsis: true },
{ title: '备注', align: 'center', dataIndex: 'remark', width: 160, ellipsis: true },
];
export const searchFormSchema: FormSchema[] = [
{ label: '业务单据', field: 'bizTableName', component: 'Input', colProps: { span: 6 } },
{ label: '业务标题', field: 'bizTitle', component: 'Input', colProps: { span: 6 } },
{
label: '审批通道',
field: 'channel',
component: 'JDictSelectTag',
componentProps: { dictCode: 'mes_xsl_approval_channel', placeholder: '请选择' },
colProps: { span: 6 },
},
{
label: '状态',
field: 'status',
component: 'JDictSelectTag',
componentProps: { dictCode: 'mes_xsl_approval_record_status', placeholder: '请选择' },
colProps: { span: 6 },
},
{ label: '发起人', field: 'applyUserName', component: 'Input', colProps: { span: 6 } },
];
export const detailFormSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{ label: '业务单据', field: 'bizTableName', component: 'Input', componentProps: { readonly: true } },
{ label: '业务表名', field: 'bizTable', component: 'Input', componentProps: { readonly: true } },
{ label: '业务数据ID', field: 'bizDataId', component: 'Input', componentProps: { readonly: true } },
{ label: '业务标题', field: 'bizTitle', component: 'Input', componentProps: { readonly: true } },
{ label: '业务编码', field: 'bizCode', component: 'Input', componentProps: { readonly: true } },
{
label: '审批通道',
field: 'channel',
component: 'JDictSelectTag',
componentProps: { dictCode: 'mes_xsl_approval_channel', disabled: true },
},
{
label: '状态',
field: 'status',
component: 'JDictSelectTag',
componentProps: { dictCode: 'mes_xsl_approval_record_status', disabled: true },
},
{ label: '发起次数', field: 'launchNo', component: 'InputNumber', componentProps: { disabled: true, style: { width: '100%' } } },
{ label: '发起人账号', field: 'applyUser', component: 'Input', componentProps: { readonly: true } },
{ label: '发起人姓名', field: 'applyUserName', component: 'Input', componentProps: { readonly: true } },
{ label: '发起时间', field: 'applyTime', component: 'Input', componentProps: { readonly: true } },
{ label: '办结时间', field: 'finishTime', component: 'Input', componentProps: { readonly: true } },
{ label: 'MES审批流', field: 'flowName', component: 'Input', componentProps: { readonly: true } },
{ label: '钉钉模板', field: 'templateName', component: 'Input', componentProps: { readonly: true } },
{ label: '外部实例ID', field: 'externalInstanceId', component: 'Input', componentProps: { readonly: true } },
{ label: '备注', field: 'remark', component: 'InputTextArea', componentProps: { rows: 3, readonly: true } },
];

View File

@@ -0,0 +1,68 @@
<template>
<div>
<BasicTable @register="registerTable">
<template #tableTitle>
<a-button
type="primary"
v-auth="'xslmes:mes_xsl_approval_record:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
</template>
<template #action="{ record }">
<TableAction
:actions="[
{
label: '详情',
onClick: handleDetail.bind(null, record),
auth: 'xslmes:mes_xsl_approval_record:list',
},
]"
/>
</template>
</BasicTable>
<MesXslApprovalRecordDetailModal @register="registerModal" />
</div>
</template>
<script lang="ts" name="xslmes-mesXslApprovalRecord" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import MesXslApprovalRecordDetailModal from './components/MesXslApprovalRecordDetailModal.vue';
import { columns, searchFormSchema } from './MesXslApprovalRecord.data';
import { list, getExportUrl } from './MesXslApprovalRecord.api';
const [registerModal, { openModal }] = useModal();
const { tableContext, onExportXls } = useListPage({
tableProps: {
title: '审批台账',
api: list,
columns,
canResize: true,
formConfig: {
schemas: searchFormSchema,
labelWidth: 100,
autoSubmitOnEnter: true,
showAdvancedButton: true,
},
actionColumn: {
width: 100,
fixed: 'right',
},
},
exportConfig: {
name: 'MES审批台账',
url: getExportUrl,
},
});
const [registerTable] = tableContext;
function handleDetail(record: Recordable) {
openModal(true, { record });
}
</script>

View File

@@ -0,0 +1,33 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" title="审批台账详情" width="720px" :showOkBtn="false" cancelText="关闭">
<BasicForm @register="registerForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, unref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form';
import { detailFormSchema } from '../MesXslApprovalRecord.data';
import { queryById } from '../MesXslApprovalRecord.api';
const [registerForm, { setFieldsValue, resetFields }] = useForm({
labelWidth: 110,
schemas: detailFormSchema,
showActionButtonGroup: false,
baseColProps: { span: 24 },
});
const recordId = ref('');
const [registerModal, { setModalProps }] = useModalInner(async (data) => {
await resetFields();
setModalProps({ confirmLoading: false });
recordId.value = data?.record?.id || '';
if (!unref(recordId)) {
return;
}
const res = await queryById({ id: unref(recordId) });
await setFieldsValue({ ...res });
});
</script>