云
8 小时以前 ec8ff4f6259404460a0b4437e29a40986c2c4b9d
feat(workflow): 集成自动化审批功能并优化多个业务模块

- 在认证存储中加载审计策略并重置时清空自动审批状态
- 在请假创建页面添加自动审批条件判断和初始化逻辑
- 将多个模块的时间格式化从日期时间改为仅日期格式
- 在CRM合同管理中添加复选框列和操作栏并移除公海天数字段
- 更新MES计量检测和来料检验的数据结构移除用户选择器
- 在物料管理中添加规格型号搜索功能
- 优化描述组件和表单适配器以支持自动审批模式隐藏字段
- 更新客户分配表单以支持批量操作
- 在工作台反馈历史标签页控制审批按钮显示
- 在BPM模型页面同步全局自动审批状态
- 优化CRM待办事项页面适配自动审批模式
- 在合同和发票提交时根据自动审批状态显示不同提示
- 扩展能耗分析模块添加导出和告警功能
- 在HRM模块的离职和调岗流程中指定流程定义键
- 更新API接口支持检测人姓名和供应商名称字段
已修改49个文件
已添加3个文件
794 ■■■■■ 文件已修改
dist.zip 补丁 | 查看 | 原始文档 | blame | 历史
src/adapter/form.ts 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/adapter/vxe-table.ts 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/bpm/autoApprove/index.ts 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/energy/index.ts 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/hrm/resignation/index.ts 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/hrm/transfer/index.ts 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/mes/dv/meteringcheck/index.ts 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/mes/qc/iqc/index.ts 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/description/description.vue 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/table-action/table-action.vue 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/audit-policy.ts 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/auth.ts 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/audit-ui-policy.ts 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/bpm/model/index.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/bpm/oa/leave/create.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/backlog/index.vue 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/contract/components/data.ts 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/contract/data.ts 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/contract/detail/approve/index.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/contract/detail/data.ts 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/contract/index.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/customer/data.ts 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/customer/detail/modules/distribute-form.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/customer/pool/data.ts 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/customer/pool/index.vue 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/invoice/index.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/crm/saleQuotation/data.ts 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/energy/alert/index.vue 145 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/energy/analysis/index.vue 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/energy/record/index.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/finance/payment/index.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/purchase/request/index.vue 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/sale/order/data.ts 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/sale/order/detail/index.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/sale/order/index.vue 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/sale/order/modules/form.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/erp/sale/order/modules/print.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hrm/attendance/exception/index.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hrm/leave/index.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hrm/overtime/index.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/dv/meteringcheck/data.ts 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/md/item/components/select.vue 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/md/item/data.ts 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/pd/project/detail/index.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/pd/project/index.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/qc/iqc/data.ts 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/qc/iqc/index.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/qc/oqc/data.ts 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/qc/pendinginspect/index.vue 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/workbench/components/tabs/FeedbackHistoryTab.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/srm/supplierApply/index.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dist.zip
Binary files differ
src/adapter/form.ts
@@ -8,6 +8,10 @@
import { setupVbenForm, useVbenForm as useForm, z } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { isMobile } from '@vben/utils';
import { watch } from 'vue';
import { automaticApproval } from '#/store/audit-policy';
import { isAuditField } from '#/utils/audit-ui-policy';
async function initSetupVbenForm() {
  setupVbenForm<ComponentType>({
@@ -61,7 +65,16 @@
  });
}
const useVbenForm = useForm<ComponentType, ComponentPropsMap>;
const useVbenForm = (options: FormProps<ComponentType, ComponentPropsMap>) => {
  const result = useForm<ComponentType, ComponentPropsMap>(options);
  const schema = options.schema;
  if (schema) {
    watch(automaticApproval, () => {
      result[1].setState({ schema: schema.filter((item) => !automaticApproval.value || !isAuditField(item)) });
    }, { immediate: true });
  }
  return result;
};
export { initSetupVbenForm, useVbenForm, z };
src/adapter/vxe-table.ts
@@ -3,7 +3,7 @@
import type { ComponentPropsMap, ComponentType } from './component';
import { h } from 'vue';
import { h, watch } from 'vue';
import { IconifyIcon } from '@vben/icons';
import { $te } from '@vben/locales';
@@ -35,6 +35,8 @@
import { DictTag } from '#/components/dict-tag';
import { $t } from '#/locales';
import { automaticApproval } from '#/store/audit-policy';
import { isAuditField } from '#/utils/audit-ui-policy';
import { useVbenForm } from './form';
@@ -403,6 +405,17 @@
export * from '#/components/table-action';
export const useVbenVxeGrid = <T extends Record<string, any>>(
  ...rest: Parameters<typeof useGrid<T, ComponentType, ComponentPropsMap>>
) => useGrid<T, ComponentType, ComponentPropsMap>(...rest);
) => {
  const options = rest[0];
  const columns = options.gridOptions?.columns;
  const schema = options.formOptions?.schema;
  const applyPolicy = () => ({
    ...(columns ? { gridOptions: { columns: columns.filter((item) => !automaticApproval.value || !isAuditField(item)) } } : {}),
    ...(schema ? { formOptions: { schema: schema.filter((item) => !automaticApproval.value || !isAuditField(item)) } } : {}),
  });
  const result = useGrid<T, ComponentType, ComponentPropsMap>(options);
  watch(automaticApproval, () => result[1].setState(applyPolicy()), { immediate: true });
  return result;
};
export type * from '@vben/plugins/vxe-table';
src/api/bpm/autoApprove/index.ts
@@ -1,4 +1,5 @@
import { requestClient } from '#/api/request';
import { automaticApproval } from '#/store/audit-policy';
export namespace BpmAutoApproveApi {
  /** æµç¨‹å…å®¡æ‰¹é…ç½® */
@@ -35,9 +36,11 @@
  if (remark) {
    params.append('remark', remark);
  }
  return requestClient.put<boolean>(
  const result = await requestClient.put<boolean>(
    `/bpm/process-auto-approve/update-global?${params.toString()}`,
  );
  automaticApproval.value = autoApprove;
  return result;
}
/** æŒ‰æµç¨‹å®šä¹‰çš„ Key è®¾ç½®å…å®¡æ‰¹å¼€å…³ï¼ˆä¸å­˜åœ¨åˆ™æ–°å¢žã€å­˜åœ¨åˆ™æ›´æ–°ï¼‰ */
src/api/energy/index.ts
@@ -55,3 +55,42 @@
export function getEnergyAnalysis(params: EnergyFilters & { startDate: string; endDate: string; groupBy: 'DAY' | 'MONTH' }) {
  return requestClient.get<EnergyAnalysis>('/energy/record/analysis', { params });
}
export function exportEnergyRecords(params: EnergyFilters) {
  return requestClient.download('/energy/record/export-excel', { params });
}
export function exportEnergyAnalysis(params: EnergyFilters & { startDate: string; endDate: string; groupBy: 'DAY' | 'MONTH' }) {
  return requestClient.download('/energy/record/analysis-export', { params });
}
export type EnergyAlertMetric = 'AMOUNT' | 'QUANTITY' | 'MONTH_AMOUNT' | 'MONTH_QUANTITY';
export interface EnergyAlertRule {
  id?: number;
  name: string;
  energyType: EnergyType;
  usageArea?: string;
  productCategory?: string;
  metric: EnergyAlertMetric;
  threshold: number;
  enabled: boolean;
  recipientIds: number[];
}
export interface EnergyAlertLog {
  id: number; ruleName: string; recordDate: string; energyType: EnergyType;
  scope: string; metric: EnergyAlertMetric; periodType: 'DAY' | 'MONTH'; actualValue: number; threshold: number;
  recipientName: string; status: 'FAILED' | 'SENT'; errorMessage: string; createTime: string;
}
export async function getEnergyAlertRules(params: { pageNo: number; pageSize: number }) {
  const result = await requestClient.get<PageResult<Omit<EnergyAlertRule, 'recipientIds'> & { recipientIds: string }>>('/energy/alert/page', { params });
  return { ...result, list: result.list.map(row => ({ ...row, recipientIds: row.recipientIds.split(',').filter(Boolean).map(Number) })) };
}
export function getEnergyAlertLogs(params: { pageNo: number; pageSize: number; date?: string; status?: string }) {
  return requestClient.get<PageResult<EnergyAlertLog>>('/energy/alert/logs', { params });
}
export function getEnergyAlertRecipients() {
  return requestClient.get<{ id: number; nickname: string }[]>('/energy/alert/recipients');
}
export function saveEnergyAlertRule(data: EnergyAlertRule) {
  return data.id ? requestClient.put('/energy/alert/update', data) : requestClient.post('/energy/alert/create', data);
}
export function deleteEnergyAlertRule(id: number) { return requestClient.delete('/energy/alert/delete', { params: { id } }); }
export function checkEnergyAlerts(date: string) { return requestClient.post<{ sent: number; failed: number }>('/energy/alert/check', undefined, { params: { date } }); }
src/api/hrm/resignation/index.ts
@@ -58,7 +58,7 @@
/** æäº¤ç¦»èŒç”³è¯·ï¼ˆå‘起审批) */
export function submitResignation(id: number) {
  return requestClient.post(`/hrm/resignation/submit?id=${id}`);
  return requestClient.post(`/hrm/resignation/submit?id=${id}&processDefinitionKey=hrm_resignation_approve`);
}
/** æ’¤é”€ç¦»èŒç”³è¯· */
src/api/hrm/transfer/index.ts
@@ -59,7 +59,7 @@
/** æäº¤è°ƒå²—申请(发起审批) */
export function submitTransfer(id: number) {
  return requestClient.post(`/hrm/transfer/submit?id=${id}`);
  return requestClient.post(`/hrm/transfer/submit?id=${id}&processDefinitionKey=hrm_transfer_approve`);
}
/** æ’¤é”€è°ƒå²—申请 */
src/api/mes/dv/meteringcheck/index.ts
@@ -15,6 +15,7 @@
    checkResult?: number; // æ£€æµ‹ç»“论(字典)
    certNo?: string; // è¯ä¹¦ç¼–号
    checkUserId?: number; // æ£€æµ‹äººç¼–号
    checkUserName?: string; // æ‰‹å·¥å¡«å†™çš„æ£€æµ‹äººå§“名
    checkUserNickname?: string; // æ£€æµ‹äººæ˜µç§°
    nextCheckDate?: string; // ä¸‹æ¬¡æ£€æµ‹æ—¥æœŸ
    remark?: string; // å¤‡æ³¨
src/api/mes/qc/iqc/index.ts
@@ -14,6 +14,7 @@
    sourceLineId?: number; // æ¥æºå•据行 ID
    sourceDocCode?: string; // æ¥æºå•据编号(关联查询)
    vendorId?: number; // ä¾›åº”商 ID
    vendorName?: string; // ä¾›åº”商名称(手填)
    vendorNickname?: string; // ä¾›åº”商简称(关联查询)
    vendorBatch?: string; // ä¾›åº”商批次号
    itemId?: number; // äº§å“ç‰©æ–™ ID
src/components/description/description.vue
@@ -11,6 +11,9 @@
import { Card, Descriptions } from 'ant-design-vue';
import { automaticApproval } from '#/store/audit-policy';
import { isAuditField } from '#/utils/audit-ui-policy';
const props = {
  bordered: { default: true, type: Boolean },
  column: {
@@ -99,6 +102,7 @@
      const { data, schema } = unref(getProps);
      return unref(schema)
        .map((item) => {
          if (automaticApproval.value && isAuditField(item)) return null;
          const { contentMinWidth, field, render, show, span } = item;
          if (show && isFunction(show) && !show(data)) {
src/components/table-action/table-action.vue
@@ -20,6 +20,9 @@
  Tooltip,
} from 'ant-design-vue';
import { automaticApproval } from '#/store/audit-policy';
import { auditActionMode } from '#/utils/audit-ui-policy';
const props = defineProps({
  actions: {
    type: Array as PropType<ActionItem[]>,
@@ -43,6 +46,7 @@
/** æ£€æŸ¥æ˜¯å¦æ˜¾ç¤º */
function isIfShow(action: ActionItem): boolean {
  if (auditActionMode(action.label, automaticApproval.value) === 'hidden') return false;
  const ifShow = action.ifShow;
  let isIfShow = true;
  if (isBoolean(ifShow)) {
@@ -61,15 +65,21 @@
/** å¤„理按钮 actions */
const getActions = computed(() => {
  const actions = props.actions || [];
  return actions.filter((action: ActionItem) => isIfShow(action));
  return actions.filter((action: ActionItem) => isIfShow(action)).map(displayAction);
});
/** å¤„理下拉菜单 actions */
const getDropdownList = computed(() => {
  const dropDownActions = props.dropDownActions || [];
  return dropDownActions.filter((action: ActionItem) => isIfShow(action));
  return dropDownActions.filter((action: ActionItem) => isIfShow(action)).map(displayAction);
});
function displayAction(action: ActionItem): ActionItem {
  return auditActionMode(action.label, automaticApproval.value) === 'activate'
    ? { ...action, label: '生效', tooltip: '提交后自动生效' }
    : action;
}
/** Space ç»„ä»¶çš„ size */
const spaceSize = computed(() => {
  const actions = unref(getActions);
src/store/audit-policy.ts
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
import { ref } from 'vue';
import { requestClient } from '#/api/request';
export const automaticApproval = ref(false);
/** Loaded with each authenticated session, before business pages are rendered. */
export async function loadAuditPolicy() {
  try {
    automaticApproval.value = await requestClient.get<boolean>('/bpm/process-auto-approve/ui-policy');
  } catch {
    // A failed policy request must not remove the normal submission path.
    automaticApproval.value = false;
  }
}
src/store/auth.ts
@@ -21,6 +21,7 @@
  socialLogin,
} from '#/api';
import { $t } from '#/locales';
import { automaticApproval, loadAuditPolicy } from '#/store/audit-policy';
export const useAuthStore = defineStore('auth', () => {
  const accessStore = useAccessStore();
@@ -134,6 +135,7 @@
    // eslint-disable-next-line no-useless-assignment
    let authPermissionInfo: AuthPermissionInfo | null = null;
    authPermissionInfo = await getAuthPermissionInfoApi();
    await loadAuditPolicy();
    // userStore
    userStore.setUserInfo(authPermissionInfo.user);
    userStore.setUserRoles(authPermissionInfo.roles);
@@ -145,6 +147,7 @@
  function $reset() {
    loginLoading.value = false;
    automaticApproval.value = false;
  }
  return {
src/utils/audit-ui-policy.ts
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
/** Review-only UI disappears in automatic mode; document status and activation remain. */
export function isAuditField(item: { field?: string; fieldName?: string; label?: unknown; title?: unknown }) {
  return /^(auditStatus|auditUserId|auditTime|approvalStatus|approvalUserId|approvalTime|processInstanceId)$/.test(item.field ?? item.fieldName ?? '')
    || /^(审批状态|审核状态|审批人|审核人|审批时间|审核时间|流程实例)$/.test(String(item.title ?? item.label ?? ''));
}
export function auditActionMode(label: string | undefined, automatic: boolean) {
  if (!automatic) return 'normal';
  if (/^(提交审批|提交审核|审核|审批|通过|审核通过)$/.test(label ?? '')) return 'activate';
  if (/^(查看审批|查看审核|审批进度|查看审批进度|反审核|撤销审批|取消审批|驳回|拒绝)$/.test(label ?? '')) return 'hidden';
  return 'normal';
}
src/views/bpm/model/index.vue
@@ -1,4 +1,5 @@
<script lang="ts" setup>
import { automaticApproval } from '#/store/audit-policy';
import type { ModelCategoryInfo } from '#/api/bpm/model';
import {
@@ -196,6 +197,7 @@
  globalAutoApproveLoading.value = true;
  try {
    await updateGlobalAutoApprove(checked);
    automaticApproval.value = checked;
    message.success(
      checked
        ? '已开启全局免审批:所有流程提交后将直接通过'
src/views/bpm/oa/leave/create.vue
@@ -18,6 +18,7 @@
import { getApprovalDetail as getApprovalDetailApi } from '#/api/bpm/processInstance';
import { $t } from '#/locales';
import { router } from '#/router';
import { automaticApproval } from '#/store/audit-policy';
import ProcessInstanceTimeline from '#/views/bpm/processInstance/detail/modules/time-line.vue';
import { useFormSchema } from './data';
@@ -67,7 +68,7 @@
    return;
  }
  // 1.2 å®¡æ‰¹ç›¸å…³ï¼šæ ¡éªŒæŒ‡å®šå®¡æ‰¹äºº
  if (startUserSelectTasks.value?.length > 0) {
  if (!automaticApproval.value && startUserSelectTasks.value?.length > 0) {
    for (const userTask of startUserSelectTasks.value) {
      const assignees = startUserSelectAssignees.value[userTask.id];
      if (Array.isArray(assignees) && assignees.length === 0) {
@@ -79,7 +80,7 @@
  // æäº¤è¡¨å•
  const data = (await formApi.getValues()) as LeaveCreateData;
  // å®¡æ‰¹ç›¸å…³ï¼šè®¾ç½®æŒ‡å®šå®¡æ‰¹äºº
  if (startUserSelectTasks.value?.length > 0) {
  if (!automaticApproval.value && startUserSelectTasks.value?.length > 0) {
    data.startUserSelectAssignees = startUserSelectAssignees.value;
  }
  // æ ¼å¼åŒ–开始时间和结束时间的值
@@ -118,6 +119,7 @@
/** å®¡æ‰¹ç›¸å…³ï¼šèŽ·å–å®¡æ‰¹è¯¦æƒ… */
async function getApprovalDetail() {
  if (automaticApproval.value) return;
  processTimeLineLoading.value = true;
  try {
    const data = await getApprovalDetailApi({
@@ -144,7 +146,7 @@
        BpmCandidateStrategyEnum.START_USER_SELECT === node.candidateStrategy,
    );
    // æ¢å¤ä¹‹å‰çš„选择审批人
    if (startUserSelectTasks.value?.length > 0) {
    if (!automaticApproval.value && startUserSelectTasks.value?.length > 0) {
      for (const node of startUserSelectTasks.value) {
        const tempAssignees = tempStartUserSelectAssignees.value[node.id];
        startUserSelectAssignees.value[node.id] = tempAssignees?.length
@@ -212,6 +214,10 @@
/** åˆå§‹åŒ– */
onMounted(async () => {
  if (automaticApproval.value) {
    if (query.id) await getDetail(Number(query.id));
    return;
  }
  const processDefinitionDetail: any = await getProcessDefinition(
    undefined,
    processDefineKey,
src/views/crm/backlog/index.vue
@@ -1,9 +1,10 @@
<script lang="ts" setup>
import { computed, onActivated, onMounted, ref } from 'vue';
import { computed, onActivated, onMounted, ref, watch } from 'vue';
import { Page } from '@vben/common-ui';
import { Badge, Card, List } from 'ant-design-vue';
import { automaticApproval } from '#/store/audit-policy';
import { getFollowClueCount } from '#/api/crm/clue';
import {
@@ -49,6 +50,14 @@
  receivableAuditCount,
  receivablePlanRemindCount,
);
const visibleLeftSides = computed(() => leftSides.filter((item) =>
  !automaticApproval.value || !['contractAudit', 'receivableAudit'].includes(item.menu),
));
watch(automaticApproval, (automatic) => {
  if (automatic && ['contractAudit', 'receivableAudit'].includes(leftMenu.value)) {
    leftMenu.value = 'customerTodayContact';
  }
});
const currentComponent = computed(() => {
  const components = {
@@ -75,9 +84,9 @@
  customerPutPoolRemindCount.value = await getPutPoolRemindCustomerCount();
  customerFollowCount.value = await getFollowCustomerCount();
  clueFollowCount.value = await getFollowClueCount();
  contractAuditCount.value = await getAuditContractCount();
  if (!automaticApproval.value) contractAuditCount.value = await getAuditContractCount();
  contractRemindCount.value = await getRemindContractCount();
  receivableAuditCount.value = await getAuditReceivableCount();
  if (!automaticApproval.value) receivableAuditCount.value = await getAuditReceivableCount();
  receivablePlanRemindCount.value = await getReceivablePlanRemindCount();
}
@@ -95,7 +104,7 @@
  <Page auto-content-height>
    <div class="flex h-full w-full">
      <Card class="w-1/5">
        <List item-layout="horizontal" :data-source="leftSides">
        <List item-layout="horizontal" :data-source="visibleLeftSides">
          <template #renderItem="{ item }">
            <List.Item
              @click="sideClick(item)"
src/views/crm/contract/components/data.ts
@@ -28,13 +28,13 @@
      title: '合同开始时间',
      field: 'startTime',
      minWidth: 150,
      formatter: 'formatDateTime',
      formatter: 'formatDate',
    },
    {
      title: '合同结束时间',
      field: 'endTime',
      minWidth: 150,
      formatter: 'formatDateTime',
      formatter: 'formatDate',
    },
    {
      title: '已回款金额(元)',
@@ -78,7 +78,7 @@
      title: '创建时间',
      field: 'createTime',
      minWidth: 150,
      formatter: 'formatDateTime',
      formatter: 'formatDate',
    },
    {
      title: '创建人',
src/views/crm/contract/data.ts
@@ -368,19 +368,19 @@
      title: '下单时间',
      field: 'orderDate',
      minWidth: 120,
      formatter: 'formatDateTime',
      formatter: 'formatDate',
    },
    {
      title: '合同开始时间',
      field: 'startTime',
      minWidth: 120,
      formatter: 'formatDateTime',
      formatter: 'formatDate',
    },
    {
      title: '合同结束时间',
      field: 'endTime',
      minWidth: 120,
      formatter: 'formatDateTime',
      formatter: 'formatDate',
    },
    {
      title: '客户签约人',
@@ -430,7 +430,7 @@
      title: '最后跟进时间',
      field: 'contactLastTime',
      minWidth: 180,
      formatter: 'formatDateTime',
      formatter: 'formatDate',
    },
    {
      title: '负责人',
@@ -446,13 +446,13 @@
      title: '更新时间',
      field: 'updateTime',
      minWidth: 180,
      formatter: 'formatDateTime',
      formatter: 'formatDate',
    },
    {
      title: '创建时间',
      field: 'createTime',
      minWidth: 180,
      formatter: 'formatDateTime',
      formatter: 'formatDate',
    },
    {
      title: '创建人',
src/views/crm/contract/detail/approve/index.vue
@@ -10,7 +10,7 @@
import {
  erpCountInputFormatter,
  erpPriceInputFormatter,
  formatDateTime,
  formatDate,
} from '@vben/utils';
import { Spin } from 'ant-design-vue';
@@ -116,17 +116,17 @@
    {
      label: '下单时间',
      field: 'orderDate',
      render: (val) => formatDateTime(val) as string,
      render: (val) => formatDate(val) as string,
    },
    {
      label: '合同开始时间',
      field: 'startTime',
      render: (val) => formatDateTime(val) as string,
      render: (val) => formatDate(val) as string,
    },
    {
      label: '合同结束时间',
      field: 'endTime',
      render: (val) => formatDateTime(val) as string,
      render: (val) => formatDate(val) as string,
    },
    { label: '客户签约人', field: 'signContactName', render: textRender },
    { label: '公司签约人', field: 'signUserName', render: textRender },
@@ -135,7 +135,7 @@
    {
      label: '创建时间',
      field: 'createTime',
      render: (val) => formatDateTime(val) as string,
      render: (val) => formatDate(val) as string,
    },
    {
      label: '合同状态',
src/views/crm/contract/detail/data.ts
@@ -3,7 +3,7 @@
import { h } from 'vue';
import { DICT_TYPE } from '@vben/constants';
import { erpPriceInputFormatter, formatDateTime } from '@vben/utils';
import { erpPriceInputFormatter, formatDate } from '@vben/utils';
import { DictTag } from '#/components/dict-tag';
@@ -27,7 +27,7 @@
    {
      field: 'orderDate',
      label: '下单时间',
      render: (val) => formatDateTime(val) as string,
      render: (val) => formatDate(val) as string,
    },
    {
      field: 'totalReceivablePrice',
@@ -88,17 +88,17 @@
    {
      field: 'orderDate',
      label: '下单时间',
      render: (val) => formatDateTime(val) as string,
      render: (val) => formatDate(val) as string,
    },
    {
      field: 'startTime',
      label: '合同开始时间',
      render: (val) => formatDateTime(val) as string,
      render: (val) => formatDate(val) as string,
    },
    {
      field: 'endTime',
      label: '合同结束时间',
      render: (val) => formatDateTime(val) as string,
      render: (val) => formatDate(val) as string,
    },
    {
      field: 'signContactName',
src/views/crm/contract/index.vue
@@ -20,6 +20,7 @@
  submitContract,
} from '#/api/crm/contract';
import { $t } from '#/locales';
import { automaticApproval } from '#/store/audit-policy';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
@@ -97,10 +98,15 @@
const submitLoading = ref(false);
async function handleSubmit(row: CrmContractApi.Contract) {
  const res = await getContractApproveProcessList();
  const res = automaticApproval.value ? [] : await getContractApproveProcessList();
  processList.value = res;
  currentRow.value = row;
  selectedProcessKey.value = undefined;
  if (automaticApproval.value) {
    selectedProcessKey.value = 'contract_approve';
    await confirmSubmit();
    return;
  }
  submitModalVisible.value = true;
}
@@ -112,7 +118,7 @@
  submitLoading.value = true;
  try {
    await submitContract(currentRow.value!.id!, selectedProcessKey.value);
    message.success('提交审批成功');
    message.success(automaticApproval.value ? '已提交生效' : '提交审批成功');
    submitModalVisible.value = false;
    handleRefresh();
  } finally {
src/views/crm/customer/data.ts
@@ -354,13 +354,6 @@
      minWidth: 180,
    },
    {
      field: 'poolDay',
      title: '距离进入公海天数',
      minWidth: 140,
      formatter: ({ cellValue }) =>
        cellValue === null ? '-' : `${cellValue} å¤©`,
    },
    {
      field: 'ownerUserName',
      title: '负责人',
      minWidth: 100,
src/views/crm/customer/detail/modules/distribute-form.vue
@@ -1,4 +1,6 @@
<script lang="ts" setup>
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
@@ -10,6 +12,7 @@
import { useDistributeFormSchema } from '../data';
const emit = defineEmits(['success']);
const customerIds = ref<number[]>([]);
const [Form, formApi] = useVbenForm({
  commonConfig: {
@@ -34,7 +37,7 @@
    // æäº¤è¡¨å•
    const data = await formApi.getValues();
    try {
      await distributeCustomer([data.id], data.ownerUserId);
      await distributeCustomer(customerIds.value, data.ownerUserId);
      // å…³é—­å¹¶æç¤º
      await modalApi.close();
      emit('success');
@@ -48,13 +51,15 @@
      return;
    }
    // åŠ è½½æ•°æ®
    const data = modalApi.getData();
    if (!data || !data.id) {
    const data = modalApi.getData<{ id?: number; ids?: number[] }>();
    customerIds.value = data?.ids ?? (data?.id ? [data.id] : []);
    if (customerIds.value.length === 0) {
      return;
    }
    modalApi.lock();
    try {
      await formApi.setValues(data);
      await formApi.resetForm();
      await formApi.setValues({ id: customerIds.value[0] });
    } finally {
      modalApi.unlock();
    }
src/views/crm/customer/pool/data.ts
@@ -60,6 +60,7 @@
export function useGridColumns(): VxeTableGridOptions['columns'] {
  return [
    { type: 'checkbox', width: 50, fixed: 'left' },
    {
      title: '客户名称',
      field: 'name',
@@ -157,5 +158,11 @@
      field: 'creatorName',
      minWidth: 100,
    },
    {
      title: '操作',
      width: 150,
      fixed: 'right',
      slots: { default: 'actions' },
    },
  ];
}
src/views/crm/customer/pool/index.vue
@@ -2,24 +2,86 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { CrmCustomerApi } from '#/api/crm/customer';
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { Page } from '@vben/common-ui';
import { confirm, Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart } from '@vben/utils';
import { Button } from 'ant-design-vue';
import { Button, message } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { exportCustomer, getCustomerPage } from '#/api/crm/customer';
import {
  exportCustomer,
  getCustomerPage,
  receiveCustomer,
} from '#/api/crm/customer';
import { $t } from '#/locales';
import DistributeForm from '../detail/modules/distribute-form.vue';
import { useGridColumns, useGridFormSchema } from './data';
const { push } = useRouter();
const receiving = ref(false);
const [DistributeModal, distributeModalApi] = useVbenModal({
  connectedComponent: DistributeForm,
  destroyOnClose: true,
});
function handleRefresh() {
  gridApi.grid.clearCheckboxRow();
  gridApi.query();
}
function getCustomerIds(row?: CrmCustomerApi.Customer): number[] {
  const records: CrmCustomerApi.Customer[] = row
    ? [row]
    : gridApi.grid.getCheckboxRecords();
  const ids = records.map((item) => item.id!);
  if (ids.length === 0) {
    message.warning('请先勾选客户');
  }
  return ids;
}
/** é¢†å–单条或勾选的公海客户 */
async function handleReceive(row?: CrmCustomerApi.Customer) {
  if (receiving.value) return;
  const ids = getCustomerIds(row);
  if (ids.length === 0) return;
  receiving.value = true;
  try {
    try {
      await confirm(
        row
          ? `确定领取客户【${row.name}】吗?`
          : `确定领取选中的 ${ids.length} ä¸ªå®¢æˆ·å—?`,
      );
    } catch {
      return;
    }
    await receiveCustomer(ids);
    message.success('领取客户成功');
    handleRefresh();
  } finally {
    receiving.value = false;
  }
}
/** åˆ†é…å•条或勾选的公海客户 */
function handleDistribute(row?: CrmCustomerApi.Customer) {
  const ids = getCustomerIds(row);
  if (ids.length === 0) return;
  distributeModalApi.setData({ ids }).open();
}
/** å¯¼å‡ºè¡¨æ ¼ */
async function handleExport() {
  const data = await exportCustomer(await gridApi.formApi.getValues());
  const data = await exportCustomer({
    ...(await gridApi.formApi.getValues()),
    pool: true,
    sceneType: 4,
  });
  downloadFileFromBlobPart({ fileName: '客户公海.xls', source: data });
}
@@ -62,10 +124,25 @@
</script>
<template>
  <Page auto-content-height><Grid>
  <Page auto-content-height>
    <DistributeModal @success="handleRefresh" />
    <Grid>
      <template #toolbar-tools>
        <TableAction
          :actions="[
            {
              label: '领取客户',
              type: 'primary',
              auth: ['crm:customer:receive'],
              disabled: receiving,
              onClick: () => handleReceive(),
            },
            {
              label: '分配客户',
              auth: ['crm:customer:distribute'],
              disabled: receiving,
              onClick: () => handleDistribute(),
            },
            {
              label: $t('ui.actionTitle.export'),
              type: 'primary',
@@ -76,6 +153,26 @@
          ]"
        />
      </template>
      <template #actions="{ row }">
        <TableAction
          :actions="[
            {
              label: '领取',
              type: 'link',
              auth: ['crm:customer:receive'],
              disabled: receiving,
              onClick: () => handleReceive(row),
            },
            {
              label: '分配',
              type: 'link',
              auth: ['crm:customer:distribute'],
              disabled: receiving,
              onClick: () => handleDistribute(row),
            },
          ]"
        />
      </template>
      <template #name="{ row }">
        <Button type="link" @click="handleDetail(row)">
          {{ row.name }}
src/views/crm/invoice/index.vue
@@ -18,6 +18,7 @@
  submitInvoice,
} from '#/api/crm/invoice';
import { $t } from '#/locales';
import { automaticApproval } from '#/store/audit-policy';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
@@ -90,12 +91,12 @@
/** æäº¤å®¡æ ¸ */
async function handleSubmit(row: CrmInvoiceApi.Invoice) {
  const hideLoading = message.loading({
    content: '提交审核中...',
    content: automaticApproval.value ? '正在提交生效...' : '提交审核中...',
    duration: 0,
  });
  try {
    await submitInvoice(row.id!);
    message.success('提交审核成功');
    message.success(automaticApproval.value ? '已提交生效' : '提交审核成功');
    handleRefresh();
  } finally {
    hideLoading();
src/views/crm/saleQuotation/data.ts
@@ -302,13 +302,13 @@
      field: 'quotationTime',
      title: '报价日期',
      minWidth: 120,
      formatter: 'formatDateTime',
      formatter: 'formatDate',
    },
    {
      field: 'validUntil',
      title: '有效期至',
      minWidth: 120,
      formatter: 'formatDateTime',
      formatter: 'formatDate',
    },
    {
      field: 'status',
@@ -330,7 +330,7 @@
      field: 'createTime',
      title: '创建时间',
      minWidth: 180,
      formatter: 'formatDateTime',
      formatter: 'formatDate',
    },
    {
      title: '操作',
src/views/energy/alert/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,145 @@
<script setup lang="ts">
import type { FormInstance, TablePaginationConfig } from 'ant-design-vue';
import type { EnergyAlertRule, EnergyAlertLog, EnergyType } from '#/api/energy';
import { computed, onMounted, reactive, ref } from 'vue';
import { Page } from '@vben/common-ui';
import { Alert, Button, Card, DatePicker, Form, FormItem, Input, InputNumber, Modal, Popconfirm, Select, Space, Switch, Table, Tabs, TabPane, Tag, message } from 'ant-design-vue';
import dayjs from 'dayjs';
import { checkEnergyAlerts, deleteEnergyAlertRule, getEnergyAlertLogs, getEnergyAlertRecipients, getEnergyAlertRules, saveEnergyAlertRule } from '#/api/energy';
import { energyInfo, energyOptions, numberText, productOptions } from '../shared';
defineOptions({ name: 'EnergyAlert' });
const tab = ref('rules');
const rules = ref<EnergyAlertRule[]>([]);
const logs = ref<EnergyAlertLog[]>([]);
const recipients = ref<{ label: string; value: number }[]>([]);
const loading = ref(false), error = ref(false), saving = ref(false), checking = ref(false), open = ref(false);
const rulePage = reactive({ current: 1, pageSize: 10, total: 0, showSizeChanger: true });
const logPage = reactive({ current: 1, pageSize: 10, total: 0, showSizeChanger: true });
const logFilters = reactive<{ date?: string; status?: string }>({});
const checkDate = ref(dayjs().format('YYYY-MM-DD'));
const initial = (): EnergyAlertRule => ({ name: '', energyType: 'WATER', metric: 'QUANTITY', threshold: 1, enabled: true, recipientIds: [], usageArea: '', productCategory: undefined });
const model = reactive<EnergyAlertRule>(initial());
const metricOptions = [
  { label: '每日用量', value: 'QUANTITY' }, { label: '每日费用', value: 'AMOUNT' },
  { label: '每月用量', value: 'MONTH_QUANTITY' }, { label: '每月费用', value: 'MONTH_AMOUNT' },
];
const metricLabel = (metric: string) => metricOptions.find(option => option.value === metric)?.label ?? metric;
const isAmount = (metric: string) => metric.endsWith('AMOUNT');
const formRef = ref<FormInstance>();
const unit = computed(() => isAmount(model.metric) ? '元' : energyInfo[model.energyType].unit);
const validation = {
  name: [{ required: true, whitespace: true, message: '请输入规则名称' }],
  threshold: [{ required: true, type: 'number' as const, min: 0.001, message: '阈值必须大于零' }],
  recipientIds: [{ required: true, type: 'array' as const, min: 1, max: 50, message: '请选择 1 è‡³ 50 ä½æŽ¥æ”¶äºº' }],
};
const ruleColumns = [
  { title: '规则名称', dataIndex: 'name', width: 180 }, { title: '能源', dataIndex: 'energyType', width: 80 },
  { title: '统计范围', key: 'scope', width: 200 }, { title: '统计指标 / é˜ˆå€¼', key: 'threshold', width: 190 },
  { title: '接收人', key: 'recipients', width: 180 }, { title: '状态', key: 'enabled', width: 80 },
  { title: '操作', key: 'action', width: 140, fixed: 'right' as const },
];
const logColumns = [
  { title: '统计周期', key: 'period', width: 120 }, { title: '规则名称', dataIndex: 'ruleName', width: 160 },
  { title: '能源 / èŒƒå›´', key: 'scope', width: 230 }, { title: '实际值 / é˜ˆå€¼', key: 'value', width: 210 },
  { title: '接收人', dataIndex: 'recipientName', width: 120 }, { title: '结果', key: 'status', width: 100 },
  { title: '失败原因', dataIndex: 'errorMessage', width: 300 },
];
let loadId = 0;
async function load() {
  const id = ++loadId; loading.value = true; error.value = false;
  try {
    if (tab.value === 'rules') {
      const result = await getEnergyAlertRules({ pageNo: rulePage.current, pageSize: rulePage.pageSize });
      if (id === loadId) { rules.value = result.list; rulePage.total = result.total; }
    } else {
      const result = await getEnergyAlertLogs({ ...logFilters, pageNo: logPage.current, pageSize: logPage.pageSize });
      if (id === loadId) { logs.value = result.list; logPage.total = result.total; }
    }
  } catch { if (id === loadId) error.value = true; }
  finally { if (id === loadId) loading.value = false; }
}
function changePage(page: TablePaginationConfig) {
  Object.assign(tab.value === 'rules' ? rulePage : logPage, { current: page.current ?? 1, pageSize: page.pageSize ?? 10 }); void load();
}
async function showForm(row?: EnergyAlertRule) {
  try { recipients.value = (await getEnergyAlertRecipients()).map(user => ({ label: user.nickname, value: user.id })); }
  catch { message.error('无法加载接收人,请重试'); return; }
  Object.keys(model).forEach(key => delete (model as unknown as Record<string, unknown>)[key]);
  Object.assign(model, row ? { ...row, recipientIds: [...row.recipientIds] } : initial());
  open.value = true; formRef.value?.clearValidate();
}
async function save() {
  await formRef.value?.validate(); saving.value = true;
  try { await saveEnergyAlertRule({ ...model }); open.value = false; message.success('规则已保存,后续录入自动检查;历史日期可手动检查'); await load(); }
  finally { saving.value = false; }
}
async function remove(id: number) { await deleteEnergyAlertRule(id); message.success('已删除,历史通知记录保留'); rulePage.current = 1; await load(); }
async function check() {
  if (!checkDate.value || checkDate.value > dayjs().format('YYYY-MM-DD')) { message.warning('请选择今天或之前的日期'); return; }
  checking.value = true;
  try {
    const result = await checkEnergyAlerts(checkDate.value);
    message[result.failed ? 'warning' : 'success'](`检查完成:新发送 ${result.sent} æ¡ï¼Œå¤±è´¥ ${result.failed} æ¡ã€‚已发送的通知不会重复发送。`);
    tab.value = 'logs'; logFilters.date = checkDate.value; logPage.current = 1; await load();
  } finally { checking.value = false; }
}
function recipientNames(ids: number[]) { return ids.map(id => recipients.value.find(user => user.value === id)?.label ?? `用户 ${id}`).join('、'); }
onMounted(async () => {
  await load();
  try { recipients.value = (await getEnergyAlertRecipients()).map(user => ({ label: user.nickname, value: user.id })); } catch { /* Rules remain viewable when recipient lookup fails. */ }
});
</script>
<template>
  <Page title="能耗预警" description="配置每日或每月用量、费用阈值,超过阈值时向指定人员发送站内通知。">
    <Alert class="mb-4" type="info" show-icon message="每日指标按天汇总,每月指标按自然月汇总本月已录入数据,超限即通知。同一规则、统计周期和接收人只成功通知一次。检查日期同时检查当天及所属月份。区域按名称精确匹配。" />
    <Card>
      <div class="mb-4 flex flex-wrap items-center justify-between gap-3">
        <Button v-access:code="['energy:alert:create']" type="primary" @click="showForm()">新增预警规则</Button>
        <Space wrap><span>检查日期</span><DatePicker v-model:value="checkDate" value-format="YYYY-MM-DD" :allow-clear="false" /><Button v-access:code="['energy:alert:check']" :loading="checking" @click="check">检查预警 / é‡è¯•失败通知</Button></Space>
      </div>
      <Alert v-if="error" class="mb-4" type="error" show-icon message="加载失败,请点击刷新重试。" />
      <Tabs v-model:active-key="tab" @change="load">
        <TabPane key="rules" tab="预警规则">
          <Table :columns="ruleColumns" :data-source="rules" row-key="id" :loading="loading" :pagination="rulePage" :scroll="{ x: 1100 }" :locale="{ emptyText: '暂无规则,请先设置阈值和通知接收人' }" @change="changePage">
            <template #bodyCell="{ column, record }">
              <template v-if="column.dataIndex === 'energyType'">{{ energyInfo[record.energyType as EnergyType].name }}</template>
              <template v-else-if="column.key === 'scope'">{{ record.usageArea || '全部区域' }} / {{ record.productCategory || '全部产品' }}</template>
              <template v-else-if="column.key === 'threshold'">{{ metricLabel(record.metric) }} &gt; {{ numberText(record.threshold) }} {{ isAmount(record.metric) ? '元' : energyInfo[record.energyType as EnergyType].unit }}</template>
              <template v-else-if="column.key === 'recipients'">{{ recipientNames(record.recipientIds) }}</template>
              <template v-else-if="column.key === 'enabled'"><Tag :color="record.enabled ? 'green' : 'default'">{{ record.enabled ? '启用' : '停用' }}</Tag></template>
              <template v-else-if="column.key === 'action'"><Space :size="0"><Button v-access:code="['energy:alert:update']" type="link" @click="showForm(record as EnergyAlertRule)">编辑</Button><Popconfirm title="删除此规则?历史通知仍会保留。" @confirm="remove(record.id)"><Button v-access:code="['energy:alert:delete']" type="link" danger>删除</Button></Popconfirm></Space></template>
            </template>
          </Table>
        </TabPane>
        <TabPane key="logs" tab="通知记录">
          <Space class="mb-4" wrap><DatePicker v-model:value="logFilters.date" value-format="YYYY-MM-DD" placeholder="统计日期" /><Select v-model:value="logFilters.status" :options="[{ label: '发送成功', value: 'SENT' }, { label: '发送失败', value: 'FAILED' }]" allow-clear placeholder="全部结果" style="width: 140px" /><Button @click="logPage.current = 1; load()">查询</Button></Space>
          <Table :columns="logColumns" :data-source="logs" row-key="id" :loading="loading" :pagination="logPage" :scroll="{ x: 1340 }" :locale="{ emptyText: '暂无预警通知记录' }" @change="changePage">
            <template #bodyCell="{ column, record }">
              <template v-if="column.key === 'period'">{{ record.periodType === 'MONTH' ? record.recordDate.slice(0, 7) : record.recordDate }}<div class="text-xs text-muted-foreground">{{ metricLabel(record.metric) }}</div></template>
              <template v-else-if="column.key === 'scope'">{{ energyInfo[record.energyType as EnergyType].name }} / {{ record.scope }}</template>
              <template v-else-if="column.key === 'value'">{{ numberText(record.actualValue) }} / {{ numberText(record.threshold) }} {{ isAmount(record.metric) ? '元' : energyInfo[record.energyType as EnergyType].unit }}</template>
              <template v-else-if="column.key === 'status'"><Tag :color="record.status === 'SENT' ? 'green' : 'red'">{{ record.status === 'SENT' ? '发送成功' : '发送失败' }}</Tag></template>
            </template>
          </Table>
        </TabPane>
        <template #rightExtra><Button :loading="loading" @click="load">刷新</Button></template>
      </Tabs>
    </Card>
    <Modal v-model:open="open" :title="model.id ? '编辑预警规则' : '新增预警规则'" :confirm-loading="saving" :mask-closable="false" :width="640" @ok="save">
      <Form ref="formRef" :model="model" :rules="validation" layout="vertical" class="mt-4">
        <FormItem label="规则名称" name="name"><Input v-model:value="model.name" :maxlength="100" placeholder="例如:燕窝生产区每日用水预警" /></FormItem>
        <div class="grid grid-cols-1 gap-x-4 sm:grid-cols-2">
          <FormItem label="能源"><Select v-model:value="model.energyType" :options="energyOptions" /></FormItem>
          <FormItem label="统计指标"><Select v-model:value="model.metric" :options="metricOptions" /></FormItem>
          <FormItem label="使用区域(精确匹配,可留空)"><Input v-model:value="model.usageArea" :maxlength="100" placeholder="留空统计全部区域" /></FormItem>
          <FormItem label="产品类别"><Select v-model:value="model.productCategory" :options="productOptions" allow-clear placeholder="全部产品" /></FormItem>
        </div>
        <FormItem :label="`${model.metric.startsWith('MONTH_') ? '每月' : '每日'}阈值(${unit},大于此值时通知)`" name="threshold"><InputNumber v-model:value="model.threshold" :min="0.001" :precision="3" style="width: 100%" /></FormItem>
        <FormItem label="通知接收人" name="recipientIds"><Select v-model:value="model.recipientIds" mode="multiple" :options="recipients" option-filter-prop="label" placeholder="选择本站内用户" /></FormItem>
        <FormItem label="启用规则"><Switch v-model:checked="model.enabled" /></FormItem>
      </Form>
    </Modal>
  </Page>
</template>
src/views/energy/analysis/index.vue
@@ -4,9 +4,10 @@
import { computed, nextTick, onMounted, reactive, ref, watch } from 'vue';
import { Page } from '@vben/common-ui';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { downloadFileFromBlobPart } from '@vben/utils';
import { Alert, Button, Card, DatePicker, Empty, Form, FormItem, Input, RadioGroup, Select, Space, Spin, Table, message } from 'ant-design-vue';
import dayjs from 'dayjs';
import { getEnergyAnalysis } from '#/api/energy';
import { exportEnergyAnalysis, getEnergyAnalysis } from '#/api/energy';
import { energyInfo, energyOptions, numberText, productOptions } from '../shared';
defineOptions({ name: 'EnergyAnalysis' });
@@ -16,6 +17,7 @@
const data = ref<EnergyAnalysis>();
const loading = ref(false);
const failed = ref(false);
const exporting = ref(false);
const selectedEnergy = ref<EnergyType>('WATER');
const trendRef = ref<EchartsUIType>();
const shareRef = ref<EchartsUIType>();
@@ -23,6 +25,18 @@
const trendChart = useEcharts(trendRef);
const shareChart = useEcharts(shareRef);
const areaChart = useEcharts(areaRef);
const costRef = ref<EchartsUIType>();
const areaShareRef = ref<EchartsUIType>();
const usageRef = ref<EchartsUIType>();
const costChart = useEcharts(costRef);
const areaShareChart = useEcharts(areaShareRef);
const usageChart = useEcharts(usageRef);
const toolbox = (name: string) => ({ right: 8, feature: { saveAsImage: { title: '下载 PNG å›¾ç‰‡', name, pixelRatio: 2 } } });
async function exportReport() {
  exporting.value = true;
  try { downloadFileFromBlobPart({ fileName: '能耗分析.xlsx', source: await exportEnergyAnalysis({ ...applied.value }) }); }
  finally { exporting.value = false; }
}
const hasRecords = computed(() => (data.value?.recordCount ?? 0) > 0);
const summaryColumns = [
  { title: '能源', dataIndex: 'energyType' },
@@ -80,6 +94,7 @@
  const values = new Map(data.value.trend.filter(row => row.energyType === selectedEnergy.value).map(row => [row.label, Number(row.quantity)]));
  await trendChart.renderEcharts({
    animation: false,
    toolbox: toolbox(`${info.name}用量趋势`),
    tooltip: { trigger: 'axis', confine: true },
    grid: { left: 20, right: 24, top: 40, bottom: 70, containLabel: true },
    xAxis: { type: 'category', data: periods },
@@ -87,21 +102,56 @@
    dataZoom: [{ type: 'inside' }, { type: 'slider', height: 18, bottom: 12 }],
    series: [{ name: `${info.name}(${info.unit})`, type: 'line', showSymbol: periods.length < 40, connectNulls: false, itemStyle: { color: info.color }, data: periods.map(period => values.get(period) ?? null) }],
  });
  const usage = data.value.areas.filter(row => row.energyType === selectedEnergy.value).sort((a, b) => Number(b.quantity) - Number(a.quantity)).slice(0, 10).reverse();
  await usageChart.renderEcharts({
    animation: false, toolbox: toolbox(`${info.name}区域用量`),
    tooltip: { trigger: 'axis', confine: true, axisPointer: { type: 'shadow' } },
    grid: { left: 16, right: 36, top: 40, bottom: 24, containLabel: true },
    xAxis: { type: 'value', name: info.unit },
    yAxis: { type: 'category', data: usage.map(row => row.label), axisLabel: { width: 100, overflow: 'truncate' } },
    series: [{ name: `${info.name}(${info.unit})`, type: 'bar', itemStyle: { color: info.color }, data: usage.map(row => Number(row.quantity)) }],
  });
  await costChart.renderEcharts({
    animation: false, toolbox: toolbox('能源费用趋势'),
    tooltip: { trigger: 'axis', confine: true }, legend: { bottom: 0 },
    grid: { left: 16, right: 24, top: 40, bottom: 70, containLabel: true },
    xAxis: { type: 'category', data: periods }, yAxis: { type: 'value', name: '费用(元)' },
    dataZoom: [{ type: 'inside' }],
    series: energyOptions.map(option => {
      const costs = new Map(data.value!.trend.filter(row => row.energyType === option.value).map(row => [row.label, Number(row.amount)]));
      return { name: option.label, type: 'line' as const, showSymbol: periods.length < 40, connectNulls: false,
        itemStyle: { color: energyInfo[option.value as EnergyType].color }, data: periods.map(period => costs.get(period) ?? null) };
    }),
  });
}
async function renderCharts() {
  if (!hasRecords.value || !data.value) return;
  await renderTrend();
  if (Number(data.value.totalAmount) > 0) await shareChart.renderEcharts({
    animation: false,
    toolbox: toolbox('能源费用占比'),
    tooltip: { trigger: 'item', confine: true, formatter: '{b}:{c} å…ƒï¼ˆ{d}%)' },
    legend: { bottom: 0 },
    series: [{ type: 'pie', radius: '65%', center: ['50%', '45%'], label: { formatter: '{b}\n{d}%' }, data: data.value.summary.filter(row => Number(row.amount) > 0).map(row => ({ name: energyInfo[row.energyType].name, value: Number(row.amount), itemStyle: { color: energyInfo[row.energyType].color } })) }],
  });
  const totals = new Map<string, number>();
  for (const row of data.value.areas) totals.set(row.label, (totals.get(row.label) ?? 0) + Number(row.amount));
  if (Number(data.value.totalAmount) > 0) {
    const sorted = [...totals].filter(([, amount]) => amount > 0).sort((a, b) => b[1] - a[1]);
    const shares = sorted.slice(0, 10).map(([name, value]) => ({ name, value }));
    const others = sorted.slice(10).reduce((sum, [, amount]) => sum + amount, 0);
    if (others > 0) shares.push({ name: '其他区域合计', value: others });
    await areaShareChart.renderEcharts({
      animation: false, toolbox: toolbox('区域费用占比'),
      tooltip: { trigger: 'item', confine: true, formatter: '{b}:{c} å…ƒï¼ˆ{d}%)' },
      legend: { type: 'scroll', bottom: 0 },
      series: [{ type: 'pie', radius: ['35%', '60%'], center: ['50%', '44%'], label: { formatter: '{b}\n{d}%', width: 85, overflow: 'truncate' }, data: shares }],
    });
  }
  const areaLabels = [...totals].sort((a, b) => b[1] - a[1]).slice(0, 10).map(([label]) => label).reverse();
  await areaChart.renderEcharts({
    animation: false,
    toolbox: toolbox('区域费用分布'),
    tooltip: { trigger: 'axis', confine: true, axisPointer: { type: 'shadow' } },
    legend: { bottom: 0 },
    grid: { left: 16, right: 24, top: 30, bottom: 45, containLabel: true },
@@ -127,7 +177,7 @@
        <FormItem label="能源"><Select v-model:value="filters.energyType" :options="energyOptions" allow-clear placeholder="全部能源" style="width: 130px" /></FormItem>
        <FormItem label="区域"><Input v-model:value="filters.usageArea" placeholder="区域关键词" allow-clear style="width: 150px" /></FormItem>
        <FormItem label="产品"><Select v-model:value="filters.productCategory" :options="productOptions" allow-clear placeholder="全部类别" style="width: 150px" /></FormItem>
        <FormItem><Space><Button type="primary" :loading="loading" @click="load">分析</Button><Button @click="reset">重置</Button></Space></FormItem>
        <FormItem><Space wrap><Button type="primary" :loading="loading" @click="load">分析</Button><Button @click="reset">重置</Button><Button v-access:code="['energy:analysis:export']" :disabled="!data || loading" :loading="exporting" @click="exportReport">导出分析报表</Button></Space></FormItem>
      </Form>
    </Card>
    <Alert v-if="failed" type="error" show-icon message="能耗分析加载失败,请点击分析重试。" class="mb-4" />
@@ -157,7 +207,11 @@
          <div class="mb-4 grid grid-cols-1 gap-4 lg:grid-cols-2">
            <Card title="能源费用占比"><EchartsUI v-if="Number(data.totalAmount) > 0" ref="shareRef" class="h-[330px] w-full" /><Empty v-else description="尚未录入费用,填写单价后显示费用占比。" /></Card>
            <Card title="区域费用分布(前 10)"><EchartsUI ref="areaRef" class="h-[330px] w-full" /></Card>
            <Card title="能源费用趋势"><EchartsUI ref="costRef" class="h-[330px] w-full" /></Card>
            <Card title="区域费用占比"><EchartsUI v-if="Number(data.totalAmount) > 0" ref="areaShareRef" class="h-[330px] w-full" /><Empty v-else description="尚无费用数据" /></Card>
            <Card class="lg:col-span-2" :title="`${energyInfo[selectedEnergy].name} Â· åŒºåŸŸç”¨é‡å¯¹æ¯”(前 10)`"><EchartsUI ref="usageRef" class="h-[330px] w-full" /></Card>
          </div>
          <p class="text-sm text-muted-foreground">图表右上角可下载 PNG;分析报表包含统计口径、能源汇总、日期趋势、区域汇总四个工作表,使用最近一次分析的筛选条件。</p>
          <Card title="趋势明细">
            <Table :columns="detailColumns" :data-source="data.trend" :row-key="row => `${row.label}-${row.energyType}`" :scroll="{ x: 600 }" :pagination="{ pageSize: 10, showSizeChanger: true }" size="small">
              <template #bodyCell="{ column, record }">
src/views/energy/record/index.vue
@@ -3,15 +3,23 @@
import type { EnergyFilters, EnergyRecord } from '#/api/energy';
import { computed, onMounted, reactive, ref } from 'vue';
import { Page } from '@vben/common-ui';
import { downloadFileFromBlobPart } from '@vben/utils';
import { Alert, AutoComplete, Button, Card, DatePicker, Form, FormItem, Input, InputNumber, Modal, Popconfirm, Select, Space, Table, Tag, message } from 'ant-design-vue';
import dayjs from 'dayjs';
import { createEnergyRecord, deleteEnergyRecord, getEnergyRecord, getEnergyRecordPage, updateEnergyRecord } from '#/api/energy';
import { createEnergyRecord, deleteEnergyRecord, exportEnergyRecords, getEnergyRecord, getEnergyRecordPage, updateEnergyRecord } from '#/api/energy';
import { areaOptions, energyInfo, energyOptions, numberText, productOptions, purposeOptions } from '../shared';
defineOptions({ name: 'EnergyRecord' });
const filters = reactive<EnergyFilters>({});
const rows = ref<EnergyRecord[]>([]);
const loading = ref(false);
const exporting = ref(false);
async function exportRecords() {
  if (filters.startDate && filters.endDate && filters.startDate > filters.endDate) { message.warning('开始日期不能晚于结束日期'); return; }
  exporting.value = true;
  try { downloadFileFromBlobPart({ fileName: '能耗台账.xlsx', source: await exportEnergyRecords({ ...filters }) }); }
  finally { exporting.value = false; }
}
const loadError = ref(false);
const pagination = reactive({ current: 1, pageSize: 10, total: 0, showSizeChanger: true });
const open = ref(false);
@@ -118,7 +126,7 @@
      </Form>
      <div class="mb-4 flex flex-wrap items-center justify-between gap-3">
        <span class="text-base font-semibold">能耗台账</span>
        <Button v-access:code="['energy:record:create']" type="primary" @click="showForm()">新增能耗记录</Button>
        <Space><Button v-access:code="['energy:record:export']" :loading="exporting" @click="exportRecords">导出台账</Button><Button v-access:code="['energy:record:create']" type="primary" @click="showForm()">新增能耗记录</Button></Space>
      </div>
      <Alert v-if="loadError" type="error" message="能耗记录加载失败,请点击查询重试。" show-icon class="mb-4" />
      <Table :columns="columns" :data-source="rows" row-key="id" :loading="loading" :pagination="pagination" :scroll="{ x: 1420 }" :locale="{ emptyText: '暂无能耗记录,请新增每日用能信息' }" @change="tableChange">
src/views/erp/finance/payment/index.vue
@@ -1,4 +1,6 @@
<script lang="ts" setup>
import { automaticApproval } from '#/store/audit-policy';
import { submitFinancePayment } from '#/api/erp/finance/payment';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ErpFinancePaymentApi } from '#/api/erp/finance/payment';
@@ -77,10 +79,17 @@
/** æäº¤å®¡æ‰¹ - å…ˆèŽ·å–æµç¨‹åˆ—è¡¨ */
async function handleSubmit(row: ErpFinancePaymentApi.FinancePayment) {
  const hideLoading = message.loading({
    content: '获取审批流程...',
    content: automaticApproval.value ? '正在提交生效...' : '获取审批流程...',
    duration: 0,
  });
  try {
    if (automaticApproval.value) {
      await submitFinancePayment(row.id!, 'finance_payment_approve');
      hideLoading();
      message.success('已提交生效');
      handleRefresh();
      return;
    }
    const processList = await getFinancePaymentApproveProcessList();
    hideLoading();
    if (!processList || processList.length === 0) {
@@ -88,6 +97,7 @@
      return;
    }
    // æ‰“开流程选择弹窗
    processModalApi.setData({ id: row.id, processList }).open();
  } catch {
    hideLoading();
src/views/erp/purchase/request/index.vue
@@ -1,4 +1,5 @@
<script lang="ts" setup>
import { automaticApproval } from '#/store/audit-policy';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ErpPurchaseRequestApi } from '#/api/erp/purchase/request';
@@ -96,10 +97,17 @@
/** æäº¤å®¡æ‰¹ - å…ˆèŽ·å–æµç¨‹åˆ—è¡¨ */
async function handleSubmit(row: ErpPurchaseRequestApi.PurchaseRequest) {
  const hideLoading = message.loading({
    content: '获取审批流程...',
    content: automaticApproval.value ? '正在提交生效...' : '获取审批流程...',
    duration: 0,
  });
  try {
    if (automaticApproval.value) {
      await submitPurchaseRequest(row.id!, 'purchase_request_approve');
      hideLoading();
      message.success('已提交生效');
      handleRefresh();
      return;
    }
    const processList = await getApproveProcessList(row.id!);
    hideLoading();
    if (!processList || processList.length === 0) {
@@ -107,6 +115,7 @@
      return;
    }
    // æ‰“开流程选择弹窗
    processModalApi.setData({ id: row.id, processList }).open();
  } catch {
    hideLoading();
src/views/erp/sale/order/data.ts
@@ -70,8 +70,8 @@
      component: 'DatePicker',
      componentProps: {
        placeholder: '选择订单时间',
        showTime: true,
        format: 'YYYY-MM-DD HH:mm:ss',
        showTime: false,
        format: 'YYYY-MM-DD',
        valueFormat: 'YYYY-MM-DD HH:mm:ss',
      },
      rules: 'required',
@@ -341,6 +341,8 @@
      component: 'RangePicker',
      componentProps: {
        ...getRangePickerDefaultProps(),
        showTime: false,
        format: 'YYYY-MM-DD',
        allowClear: true,
      },
    },
src/views/erp/sale/order/detail/index.vue
@@ -9,7 +9,7 @@
import {
  erpCountInputFormatter,
  erpPriceInputFormatter,
  formatDateTime,
  formatDate,
} from '@vben/utils';
import { Spin, Tag } from 'ant-design-vue';
@@ -67,7 +67,7 @@
    {
      label: '订单时间',
      field: 'orderTime',
      render: (val) => formatDateTime(val) as string,
      render: (val) => formatDate(val) as string,
    },
    {
      label: '合计数量',
@@ -109,7 +109,7 @@
    {
      label: '创建时间',
      field: 'createTime',
      render: (val) => formatDateTime(val) as string,
      render: (val) => formatDate(val) as string,
    },
    { label: '备注', field: 'remark', render: textRender },
  ] as DescriptionItemSchema[],
src/views/erp/sale/order/index.vue
@@ -9,6 +9,7 @@
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { message, Tag, Tooltip } from 'ant-design-vue';
import dayjs from 'dayjs';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
@@ -22,6 +23,7 @@
} from '#/api/erp/sale/order';
import { generateFromSaleOrder } from '#/api/mes/wm/salesnotice';
import { $t } from '#/locales';
import { automaticApproval } from '#/store/audit-policy';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
@@ -57,8 +59,25 @@
/** å¯¼å‡ºè¡¨æ ¼ */
async function handleExport() {
  const data = await exportSaleOrder(await gridApi.formApi.getValues());
  const data = await exportSaleOrder(
    normalizeDateRange(await gridApi.formApi.getValues()),
  );
  downloadFileFromBlobPart({ fileName: '销售订单.xls', source: data });
}
/** æ—¥æœŸç­›é€‰è¦†ç›–所选起止日期的全天,兼容后端时间类型。 */
function normalizeDateRange(values: Record<string, any>) {
  const range = values.orderTime;
  if (!Array.isArray(range) || range.length !== 2 || !range.every(Boolean)) {
    return values;
  }
  return {
    ...values,
    orderTime: [
      dayjs(range[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'),
      dayjs(range[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss'),
    ],
  };
}
/** å¯¼å…¥é”€å”®è®¢å• */
@@ -94,18 +113,18 @@
/** æäº¤é”€å”®è®¢å•审批(协同办公) */
async function handleSubmit(row: ErpSaleOrderApi.SaleOrder) {
  // èŽ·å–å¯ç”¨çš„å®¡æ‰¹æµç¨‹å®šä¹‰
  const processList = await getSaleOrderApproveProcessList();
  if (isEmpty(processList)) {
  const processList = automaticApproval.value ? [] : await getSaleOrderApproveProcessList();
  if (!automaticApproval.value && isEmpty(processList)) {
    message.error('销售订单审批流程未配置,请先在「协同办公→流程管理」中创建并发布销售订单审批流程');
    return;
  }
  const hideLoading = message.loading({
    content: '正在提交审批...',
    content: automaticApproval.value ? '正在提交生效...' : '正在提交审批...',
    duration: 0,
  });
  try {
    await submitSaleOrder(row.id!, processList[0].key);
    message.success('提交审批成功,请到协同办公中处理');
    await submitSaleOrder(row.id!, automaticApproval.value ? 'sale_order_approve' : processList[0]!.key);
    message.success(automaticApproval.value ? '已提交生效' : '提交审批成功,请到协同办公中处理');
    handleRefresh();
  } finally {
    hideLoading();
@@ -208,7 +227,7 @@
      ajax: {
        query: async ({ page }, formValues) => {
          // ç”Ÿäº§çŠ¶æ€æœç´¢å‚æ•°è½¬æ¢ï¼š-1(无需生产) â†’ needProduction=0
          const { productionStatus, ...rest } = formValues;
          const { productionStatus, ...rest } = normalizeDateRange(formValues);
          const params: Record<string, any> = { ...rest };
          if (productionStatus === -1) {
            params.needProduction = 0;
src/views/erp/sale/order/modules/form.vue
@@ -6,6 +6,7 @@
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { formatDate } from '@vben/utils';
import { message, Tag } from 'ant-design-vue';
@@ -133,7 +134,10 @@
    try {
      formData.value = await getSaleOrder(data.id);
      // è®¾ç½®åˆ° values
      await formApi.setValues(formData.value);
      await formApi.setValues({
        ...formData.value,
        productionFinishTime: formatDate(formData.value.productionFinishTime),
      });
      if (formData.value?.attachmentList?.length) {
        const blobIds = formData.value.attachmentList.map((item) => ({
          uid: String(item.id),
src/views/erp/sale/order/modules/print.vue
@@ -7,7 +7,7 @@
import { DICT_TYPE } from '@vben/constants';
import { getDictLabel } from '@vben/hooks';
import { useUserStore } from '@vben/stores';
import { erpPriceMultiply, formatDateTime } from '@vben/utils';
import { erpPriceMultiply, formatDate, formatDateTime } from '@vben/utils';
import { getCustomerSimpleList } from '#/api/crm/customer';
import { getAccountSimpleList } from '#/api/erp/finance/account';
@@ -216,7 +216,7 @@
        <div>订单单号:{{ printData.no || '-' }}</div>
        <div>
          è®¢å•时间:{{
            formatDateTime(printData.orderTime) || '-'
            formatDate(printData.orderTime) || '-'
          }}
        </div>
        <div>客户:{{ customerName }}</div>
@@ -229,7 +229,7 @@
        <div>创建人:{{ creatorName }}</div>
        <div>
          åˆ›å»ºæ—¶é—´ï¼š{{
            formatDateTime(printData.createTime) || '-'
            formatDate(printData.createTime) || '-'
          }}
        </div>
        <div class="col-span-3">备注:{{ printData.remark || '-' }}</div>
src/views/hrm/attendance/exception/index.vue
@@ -1,4 +1,5 @@
<script lang="ts" setup>
import { automaticApproval } from '#/store/audit-policy';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { HrmAttendanceExceptionApi } from '#/api/hrm/attendance/exception';
@@ -48,10 +49,15 @@
/** æäº¤è€ƒå‹¤å¼‚常申请 */
async function handleSubmit(row: HrmAttendanceExceptionApi.AttendanceException) {
  const res = await getAttendanceExceptionApproveProcessList();
  const res = automaticApproval.value ? [] : await getAttendanceExceptionApproveProcessList();
  processList.value = res;
  currentRow.value = row;
  selectedProcessKey.value = undefined;
  if (automaticApproval.value) {
    selectedProcessKey.value = 'hrm_attendance_exception';
    await confirmSubmit();
    return;
  }
  submitModalVisible.value = true;
}
@@ -64,7 +70,7 @@
  submitLoading.value = true;
  try {
    await submitAttendanceException(currentRow.value!.id!, selectedProcessKey.value);
    message.success('提交审批成功');
    message.success(automaticApproval.value ? '已提交生效' : '提交审批成功');
    submitModalVisible.value = false;
    handleRefresh();
  } finally {
src/views/hrm/leave/index.vue
@@ -1,4 +1,5 @@
<script lang="ts" setup>
import { automaticApproval } from '#/store/audit-policy';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { HrmLeaveApi } from '#/api/hrm/leave';
@@ -72,9 +73,14 @@
/** æäº¤è¯·å‡ç”³è¯·ï¼ˆå…ˆé€‰æ‹©å®¡æ‰¹æµç¨‹ï¼‰ */
async function handleSubmit(row: HrmLeaveApi.Leave) {
  processList.value = await getLeaveApproveProcessDefinitionList();
  processList.value = automaticApproval.value ? [] : await getLeaveApproveProcessDefinitionList();
  currentRow.value = row;
  selectedProcessKey.value = undefined;
  if (automaticApproval.value) {
    selectedProcessKey.value = 'hrm_leave';
    await confirmSubmit();
    return;
  }
  submitModalVisible.value = true;
}
src/views/hrm/overtime/index.vue
@@ -1,4 +1,5 @@
<script lang="ts" setup>
import { automaticApproval } from '#/store/audit-policy';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { HrmOvertimeApi } from '#/api/hrm/overtime';
@@ -64,9 +65,14 @@
const submitLoading = ref(false);
async function handleSubmit(row: HrmOvertimeApi.Overtime) {
  processList.value = await getOvertimeApproveProcessDefinitionList();
  processList.value = automaticApproval.value ? [] : await getOvertimeApproveProcessDefinitionList();
  currentRow.value = row;
  selectedProcessKey.value = undefined;
  if (automaticApproval.value) {
    selectedProcessKey.value = 'hrm_overtime';
    await confirmSubmit();
    return;
  }
  submitModalVisible.value = true;
}
@@ -78,7 +84,7 @@
  submitLoading.value = true;
  try {
    await submitOvertime(currentRow.value!.id!, selectedProcessKey.value);
    message.success('已提交至协同办公审批');
    message.success(automaticApproval.value ? '已提交生效' : '已提交至协同办公审批');
    submitModalVisible.value = false;
    handleRefresh();
  } finally {
src/views/mes/dv/meteringcheck/data.ts
@@ -7,7 +7,6 @@
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { getSimpleUserList } from '#/api/system/user';
import { DvMeteringSelect } from '#/views/mes/dv/metering/components';
/** è¡¨å•类型 */
@@ -83,15 +82,13 @@
      },
    },
    {
      fieldName: 'checkUserId',
      fieldName: 'checkUserName',
      label: '检测人',
      component: 'ApiSelect',
      component: 'Input',
      componentProps: {
        allowClear: true,
        api: getSimpleUserList,
        labelField: 'nickname',
        placeholder: '请选择检测人',
        valueField: 'id',
        placeholder: '请输入检测人姓名',
        maxlength: 100,
      },
    },
    {
@@ -193,7 +190,7 @@
      },
    },
    { field: 'certNo', title: '证书编号', minWidth: 130 },
    { field: 'checkUserNickname', title: '检测人', minWidth: 100 },
    { field: 'checkUserName', title: '检测人', minWidth: 100 },
    {
      field: 'nextCheckDate',
      title: '下次检测日期',
src/views/mes/md/item/components/select.vue
@@ -42,7 +42,9 @@
const displayLabel = computed(() => {
  if (selectedItems.value.length === 0) return '';
  return selectedItems.value.map(item => item.name ?? '').join('、');
  return selectedItems.value.map(item =>
    [item.name, item.specification, item.code ? `(${item.code})` : ''].filter(Boolean).join(' '),
  ).join('、');
});
const showClear = computed(
  () =>
src/views/mes/md/item/data.ts
@@ -216,8 +216,14 @@
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入物料名称',
        placeholder: '支持名称与规格组合查询',
      },
    },
    {
      fieldName: 'specification',
      label: '规格型号',
      component: 'Input',
      componentProps: { allowClear: true, placeholder: '请输入规格型号' },
    },
    {
      fieldName: 'status',
@@ -350,9 +356,15 @@
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入物料名称',
        placeholder: '支持名称与规格组合查询',
      },
    },
    {
      fieldName: 'specification',
      label: '规格型号',
      component: 'Input',
      componentProps: { allowClear: true, placeholder: '请输入规格型号' },
    },
  ];
}
src/views/mes/pd/project/detail/index.vue
@@ -1,4 +1,6 @@
<script lang="ts" setup>
import { automaticApproval } from '#/store/audit-policy';
import { submitPdProjectApproval } from '#/api/mes/pd/project';
import type { FormType } from '../data';
import type { MesPdProjectApi } from '#/api/mes/pd/project';
@@ -137,8 +139,15 @@
/** æäº¤å®¡æ‰¹ - å…ˆèŽ·å–æµç¨‹åˆ—è¡¨ */
async function handleSubmit() {
  const hideLoading = message.loading({ content: '获取审批流程...', duration: 0 });
  const hideLoading = message.loading({ content: automaticApproval.value ? '正在提交生效...' : '获取审批流程...', duration: 0 });
  try {
    if (automaticApproval.value) {
      await submitPdProjectApproval(projectId.value, 'pd_project_approve');
      hideLoading();
      message.success('已提交生效');
      await loadProjectDetail();
      return;
    }
    const processList = await getPdProjectApproveProcessList();
    hideLoading();
    if (!processList || processList.length === 0) {
@@ -146,6 +155,7 @@
      return;
    }
    // æ‰“开流程选择弹窗
    processModalApi.setData({ id: projectId.value, processList }).open();
  } catch {
    hideLoading();
src/views/mes/pd/project/index.vue
@@ -1,4 +1,6 @@
<script lang="ts" setup>
import { automaticApproval } from '#/store/audit-policy';
import { submitPdProjectApproval } from '#/api/mes/pd/project';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesPdProjectApi } from '#/api/mes/pd/project';
@@ -83,10 +85,17 @@
/** æäº¤å®¡æ‰¹ - å…ˆèŽ·å–æµç¨‹åˆ—è¡¨ */
async function handleSubmit(row: MesPdProjectApi.Project) {
  const hideLoading = message.loading({
    content: '获取审批流程...',
    content: automaticApproval.value ? '正在提交生效...' : '获取审批流程...',
    duration: 0,
  });
  try {
    if (automaticApproval.value) {
      await submitPdProjectApproval(row.id!, 'pd_project_approve');
      hideLoading();
      message.success('已提交生效');
      handleRefresh();
      return;
    }
    const processList = await getPdProjectApproveProcessList();
    hideLoading();
    if (!processList || processList.length === 0) {
@@ -94,6 +103,7 @@
      return;
    }
    // æ‰“开流程选择弹窗
    processModalApi.setData({ id: row.id, processList }).open();
  } catch {
    hideLoading();
src/views/mes/qc/iqc/data.ts
@@ -12,7 +12,6 @@
import { generateAutoCode } from '#/api/mes/md/autocode/record';
import { getTemplateItemOptionList } from '#/api/mes/qc/template/item';
import { getSupplierSimpleList } from '#/api/srm/supplier';
import { getSimpleUserList } from '#/api/system/user';
import { getRangePickerDefaultProps } from '#/utils';
import { MdmItemSelect } from '#/views/basicData/mdm/components';
@@ -163,26 +162,13 @@
      },
    },
    {
      fieldName: 'vendorId',
      fieldName: 'vendorName',
      label: '供应商',
      component: 'ApiSelect',
      component: 'Input',
      componentProps: {
        allowClear: true,
        api: getSupplierSimpleList,
        labelField: 'name',
        placeholder: '请选择供应商',
        valueField: 'id',
      },
      dependencies: {
        triggerFields: ['sourceDocId'],
        componentProps: (values) => ({
          disabled: !!values.sourceDocId,
          allowClear: true,
          api: getSupplierSimpleList,
          labelField: 'name',
          placeholder: '请选择供应商',
          valueField: 'id',
        }),
        maxlength: 255,
        placeholder: '请输入供应商名称(可留空)',
      },
    },
    {
@@ -309,15 +295,12 @@
      },
    },
    {
      fieldName: 'vendorId',
      fieldName: 'vendorName',
      label: '供应商',
      component: 'ApiSelect',
      component: 'Input',
      componentProps: {
        allowClear: true,
        api: getSupplierSimpleList,
        labelField: 'name',
        placeholder: '请选择供应商',
        valueField: 'id',
        placeholder: '请输入供应商名称',
      },
    },
    {
@@ -393,8 +376,8 @@
      minWidth: 180,
    },
    {
      field: 'vendorNickname',
      title: '供应商简称',
      field: 'vendorName',
      title: '供应商',
      width: 120,
    },
    {
src/views/mes/qc/iqc/index.vue
@@ -63,7 +63,7 @@
      fileName: '来料检验单导入模板.xls',
      hints: [
        '仅允许导入 xls、xlsx æ ¼å¼æ–‡ä»¶ï¼›å¿…填列:检验单名称、产品物料编码、合格品数量、不合格品数量、检测日期、来料日期。',
        '「产品物料编码」需与「物料管理」中的编码完全一致;「供应商名称」需与「供应商管理」中的名称一致,留空则该单无供应商。',
        '「产品物料编码」需与「物料管理」中的编码完全一致;「供应商名称」非必填,可直接填写名称,无需在系统中建立供应商档案。',
        '合格品数量 + ä¸åˆæ ¼å“æ•°é‡ å¿…须等于「本次接收数量」(留空时自动取两者之和);「检测结果」按字典名称填写(校验通过 / æ ¡éªŒä¸é€šè¿‡ï¼‰ã€‚',
        '「质检方案」填方案名称,留空则按物料自动匹配 IQC æ–¹æ¡ˆï¼›ã€Œæ£€æµ‹äººå‘˜ã€ç•™ç©ºå–当前登录用户;日期支持 2026-01-01 10:00:00 æˆ– 2026-01-01。',
        '逐行导入,失败行不影响成功行;导入后的检验单为「待检验」状态,可在列表中继续编辑、录入检测结果。',
src/views/mes/qc/oqc/data.ts
@@ -166,14 +166,15 @@
      label: '客户',
      component: markRaw(CrmCustomerSelect),
      componentProps: {
        placeholder: '请选择客户',
        allowClear: true,
        placeholder: '请选择客户(可不填)',
      },
      rules: 'selectRequired',
      dependencies: {
        triggerFields: ['sourceDocId'],
        componentProps: (values) => ({
          disabled: !!values.sourceDocId,
          placeholder: '请选择客户',
          allowClear: true,
          placeholder: '请选择客户(可不填)',
        }),
      },
    },
src/views/mes/qc/pendinginspect/index.vue
@@ -52,6 +52,7 @@
    sourceDocType: row.sourceDocType,
    sourceLineId: row.sourceLineId,
    vendorId: row.vendorId,
    vendorName: row.vendorName,
  };
  iqcFormModalApi.setData({ formType: 'create', prefill }).open();
}
src/views/mes/workbench/components/tabs/FeedbackHistoryTab.vue
@@ -1,4 +1,5 @@
<script lang="ts" setup>
import { automaticApproval } from '#/store/audit-policy';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesProFeedbackApi } from '#/api/mes/pro/feedback';
@@ -318,7 +319,7 @@
            </Popconfirm>
            <!-- å®¡æ‰¹ä¸­ï¼šæŸ¥çœ‹å®¡æ‰¹ -->
            <Button
              v-if="row.status === STATUS_APPROVING"
              v-if="!automaticApproval && row.status === STATUS_APPROVING"
              type="link"
              size="small"
              @click="handleViewProcess(row)"
src/views/srm/supplierApply/index.vue
@@ -1,4 +1,6 @@
<script lang="ts" setup>
import { automaticApproval } from '#/store/audit-policy';
import { submitApply } from '#/api/srm/supplierApply';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { SrmSupplierApplyApi } from '#/api/srm/supplierApply';
@@ -70,10 +72,17 @@
/** æäº¤å®¡æ‰¹ - å…ˆèŽ·å–ååŒåŠžå…¬å®¡æ‰¹æµç¨‹åˆ—è¡¨ */
async function handleSubmit(row: SrmSupplierApplyApi.ApplyVO) {
  const hideLoading = message.loading({
    content: '获取审批流程...',
    content: automaticApproval.value ? '正在提交生效...' : '获取审批流程...',
    duration: 0,
  });
  try {
    if (automaticApproval.value) {
      await submitApply(row.id!, 'supplier_apply_approve');
      hideLoading();
      message.success('已提交生效');
      handleRefresh();
      return;
    }
    const processList = await getApproveProcessList();
    hideLoading();
    if (!processList || processList.length === 0) {
@@ -81,6 +90,7 @@
      return;
    }
    // æ‰“开流程选择弹窗
    processModalApi.setData({ id: row.id, processList }).open();
  } catch {
    hideLoading();