刘光辉
4 小时以前 cf11e63b659afcc9792ab3e395f1b45d844431a8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const TABLE = 'dms_wenjian_bupingheng_dengji_zixiang';
export function reprintMeasureOptions(field: any, options: any[]) {
  if (field?.__vModel__ !== 'cuoshi' || field?.__config__?.relationTable !== TABLE) return options;
  // 登录时的字典缓存可能早于措施3上线;保留已发布表单中的名称用于回显。
  const configured = field.options?.find((option: any) => option?.enCode === 'cuoshi3');
  const displayOptions = configured && !options.some((option) => option?.enCode === 'cuoshi3') ? [...options, configured] : options;
  return displayOptions.map((option) => (option?.enCode === 'cuoshi3' ? { ...option, disabled: true } : option));
}
export function isReprintMeasureLocked(field: any, row: Record<string, any> | undefined) {
  return field?.__vModel__ === 'cuoshi' && field?.__config__?.relationTable === TABLE && row?.cuoshi === 'cuoshi3';
}
 
export const DMS_REPRINT_MODEL_ID = '37a318b30d7c4daf9670d141b33ed1b7';
 
/** 仅原流水重打恢复使用冻结签名;其他表单仍沿用本次提交的审计关联。 */
export function reprintAuditSign(modelId: string, data: Record<string, any>, fallback: string) {
  return modelId === DMS_REPRINT_MODEL_ID &&
    data.chongda_fasong_id &&
    data.biz_sign &&
    data.bupingheng_mingxi?.length === 1 &&
    data.bupingheng_mingxi[0]?.cuoshi === 'cuoshi3'
    ? String(data.biz_sign)
    : fallback;
}
 
/** 修改弹窗配置副本,保持普通登记表的增删按钮和共享设计不变。 */
export function configureReprintModal(modelId: string, form: any, params: Record<string, any>) {
  if (modelId !== DMS_REPRINT_MODEL_ID || !params?.dmsReprint) return;
  // 恢复入口使用后端已验证并冻结的原签名,确认操作不再次索取签名。
  if (params.recovering && form.confirmBtnConfig) form.confirmBtnConfig.biz_sign_enabled = false;
  for (const field of form.fields || []) {
    if (field.__vModel__ !== 'bupingheng_mingxi') continue;
    const config = field.__config__;
    for (const key of ['columnBtnsList', 'footerBtnsList']) {
      for (const button of config?.[key] || []) button.show = false;
      for (const button of field[key] || []) button.show = false;
    }
    for (const child of config?.children || []) {
      if (child.__vModel__ === 'yuanyin') child.maxlength = 255;
      if (child.__vModel__ === 'cuoshi' || (params.recovering && child.__vModel__ === 'yuanyin')) child.disabled = true;
    }
  }
}