Skip to content
On this page

资质审查

业务模板

供应商 ELS 账号 toElsAccount

json
{
  "groupCode": "baseForm",
  "fieldType": "remoteSelect",
  "fieldLabel": "供应商ELS账号",
  "fieldName": "toElsAccount",
  "required": "1"
}
js
/**
 * @param {Object} ctx 组件实例
 * @param {String} value 当前所选值
 * @param {Array} data selectModal, remoteSelect 已选行数据 (如有)
 * @param {boolean} _isFill 填充、粘贴操作判断标识
 * @param {Object} row 表行数据 (如有)
 * @param {number} idx 表行索引值 (如有)
 * @param {Object} pageData 页面所有数据
 * @param {Object} layoutConfig 模板配置
 * @param {Object} userInfo 当前登录人信息
 * @param {(groupCode: string, fieldName: string, fn: (item: FormFieldsItem | ColumnItem) => void) => void}
 * customFormatItem 遍历模板分组配置,自定义格式化查询到的字段
 * @param {(groupCode: string, fieldName: string, flag: boolean) => void}
 * setItemRequired 自定义设置字段必填
 * @param {(groupCode: string, fieldName: string, flag: boolean) => void}
 * setItemDisabled 自定义设置字段置灰
 * @param {(groupCode: string, fieldName: string, flag: boolean) => void}
 * setItemRequiredOrDisabled 自定义设置字段必填/置灰
 * @param {() => void} topEmit 用于处理复杂绑定函数需求
 * @param {Constructor} Decimal构造函数, 适用于js小数位数精度计算
 * https://github.com/MikeMcl/decimal.js
 */
function callback(
  ctx,
  {
    value,
    data,
    _isFill,
    row,
    idx,
    pageData,
    layoutConfig,
    userInfo,
    customFormatItem,
    setItemRequired,
    setItemDisabled,
    setItemRequiredOrDisabled,
    topEmit,
    Decimal,
  },
) {
  if (data && data.length) {
    const {
      toElsAccount = "",
      supplierName = "",
      supplierCode = "",
    } = data[0] || {};
    pageData.toElsAccount = toElsAccount;
    pageData.supplierName = supplierName;
    pageData.supplierCode = supplierCode;
  }
}
js
{
  modalColumns: [
    {
      field: "toElsAccount",
      title: "供应商ELS账号",
      fieldLabelI18nKey: "i18n_title_supplierELSAccount",
      with: 150,
    },
    {
      field: "supplierName",
      title: "供应商名称",
      fieldLabelI18nKey: "i18n_field_supplierName",
      with: 150,
    },
    {
      field: "supplierCode",
      title: "供应商ERP编码",
      fieldLabelI18nKey: "i18n_field_supplierCode",
      with: 150,
    },
  ],
  modalUrl: "/supplier/supplierMaster/list",
  selectModel: "single",
  handleAfter: function ({ pageData }) {
    pageData.toElsAccount = "";
    pageData.supplierName = "";
    pageData.supplierCode = "";
  },
}

准入策略标题 policyDesc

json
{
  "groupCode": "baseForm",
  "fieldType": "selectModal",
  "fieldLabel": "准入策略标题",
  "fieldName": "policyDesc",
  "required": "0"
}
js
/**
 * @param {Object} ctx 组件实例
 * @param {String} value 当前所选值
 * @param {Array} data selectModal, remoteSelect 已选行数据 (如有)
 * @param {boolean} _isFill 填充、粘贴操作判断标识
 * @param {Object} row 表行数据 (如有)
 * @param {number} idx 表行索引值 (如有)
 * @param {Object} pageData 页面所有数据
 * @param {Object} layoutConfig 模板配置
 * @param {Object} userInfo 当前登录人信息
 * @param {(groupCode: string, fieldName: string, fn: (item: FormFieldsItem | ColumnItem) => void) => void}
 * customFormatItem 遍历模板分组配置,自定义格式化查询到的字段
 * @param {(groupCode: string, fieldName: string, flag: boolean) => void}
 * setItemRequired 自定义设置字段必填
 * @param {(groupCode: string, fieldName: string, flag: boolean) => void}
 * setItemDisabled 自定义设置字段置灰
 * @param {(groupCode: string, fieldName: string, flag: boolean) => void}
 * setItemRequiredOrDisabled 自定义设置字段必填/置灰
 * @param {() => void} topEmit 用于处理复杂绑定函数需求
 * @param {Constructor} Decimal构造函数, 适用于js小数位数精度计算
 * https://github.com/MikeMcl/decimal.js
 */
function callback(
  ctx,
  {
    value,
    data,
    _isFill,
    row,
    idx,
    pageData,
    layoutConfig,
    userInfo,
    customFormatItem,
    setItemRequired,
    setItemDisabled,
    setItemRequiredOrDisabled,
    topEmit,
    Decimal,
  },
) {
  if (data && data.length) {
    pageData.policyDesc = data[0].policyDesc || "";
    pageData.policyNumber = data[0].policyNumber || "";
    pageData.policyRemark = data[0].remark || "";
    let itemInfo = pageData.supplierAccessMgmtQuareviewItemList;
    let arr = [];
    if (itemInfo.length) {
      itemInfo = itemInfo.filter((item) => !item.policyNumber);
    }
    if (data[0].itemList.length) {
      arr = data[0].itemList
        .map((item) => {
          if (item.accessLink == 0) {
            return {
              ...item,
              policyNumber: data[0].policyNumber,
              policyDesc: data[0].policyDesc,
              attachmentId: "",
              attachmentName: "",
              attachmentPath: "",
              attachmentSaveType: "",
              fileType: item.fileType,
              limited: item.limited,
              attachmentTemplateId: item.attachmentId,
              attachmentTemplateName: item.attachmentName,
              attachmentTemplatePath: item.attachmentPath,
              attachmentTemplateSaveType: item.attachmentSaveType,
              id: "",
            };
          }
        })
        .filter(Boolean);
    }
    // 合并默认值
    const currentGroup = layoutConfig.groups.find(
      (rs) => rs.groupCode === "supplierAccessMgmtQuareviewItemList",
    );
    if (currentGroup?.columns) {
      currentGroup.columns.forEach((item) => {
        arr.forEach((insert) => {
          if (!insert[item.field]) {
            insert[item.field] = item.defaultValue || "";
          }
        });
      });
    }
    pageData.supplierAccessMgmtQuareviewItemList = [...itemInfo, ...arr];
  } else {
    pageData.policyDesc = "";
    pageData.policyNumber = "";
    pageData.policyRemark = "";
    pageData.supplierAccessMgmtQuareviewItemList = [];
  }
}
js
{
  modalColumns: [
    {
      field: "policyNumber",
      title: "准入策略编号",
      fieldLabelI18nKey: "i18n_field_rNiNAy_3f42158f",
      with: 150,
    },
    {
      field: "policyDesc",
      title: "准入策略标题",
      fieldLabelI18nKey: "i18n_field_rNiNBD_3f3f8f5f",
      with: 150,
    },
    {
      field: "policyType_dictText",
      title: "准入策略类型",
      fieldLabelI18nKey: "i18n_field_rNiNAc_3f41c85e",
      with: 150,
    },
    {
      field: "cateCode",
      title: "适用的物料分类",
      fieldLabelI18nKey: "i18n_field_KjjSLzA_9206f663",
      with: 150,
    },
    {
      field: "cateName",
      title: "适用物料分类名称",
      fieldLabelI18nKey: "i18n_field_KjSLzARL_f08a72ae",
      with: 150,
    },
    {
      field: "remark",
      title: "备注",
      fieldLabelI18nKey: "i18n_field_remark",
      with: 150,
    },
  ],
  modalUrl: "/supplier/supplierAccessMgmtStrategyHead/selectCustomPageList",
  selectModal: "single",
  params: { policyStatus: "1" },
  afterClearCallBack: function (form, pageData, column) {
    form.policyDesc = "";
    form.policyNumber = "";
    form.policyRemark = "";
  },
}