zhengyiming
5 天以前 d650e26862fc3288b32bc05813976260df7a5801
src/views/ProtocolManage/EditTemplate.vue
@@ -92,10 +92,6 @@
const operationBtnMap: Record<string, OperationBtnType> = {
  editBtn: {
    emits: { onClick: (role) => openDialog(role) },
    extraProps: {
      hide: (row: API.GetEnterpriseContractTemplatesQueryResultItem) =>
        row.status !== EnumContractTemplateStatus.Completed,
    },
  },
  editTemplateBtn: {
    emits: { onClick: (role) => goEditTemplate(role) },
@@ -189,7 +185,7 @@
  }
);
const { dialogProps, handleEdit, handleAdd, editForm } = useFormDialog({
const { dialogProps, handleEdit, handleAdd, editForm, dialogState } = useFormDialog({
  onConfirm: handleAddOrEdit,
  defaultFormParams: {
    id: '',
@@ -199,22 +195,36 @@
    file: [] as UploadUserFile[],
    access: '' as any as EnumElectronSignAccess,
    title: '新增模板',
    isEnterpriseUserCreated: false,
    templateEditData: '',
    enterpriseId: '',
    isAutoSign: false,
    autoSignPowerAttorneyUrl: [] as UploadUserFile[],
  },
  closeAfterConfirm: false,
});
function openDialog(row?: API.GetEnterpriseContractTemplatesQueryResultItem) {
  if (row) {
    handleEdit({
      id: row.id,
      templateId: row.templateId,
      name: row.name,
      code: row.code,
      file: convertApi2FormUrlOnlyOne(row.file),
      access: row.access,
    });
  } else {
    handleAdd();
  }
async function openDialog(row?: API.GetEnterpriseContractTemplatesQueryResultItem) {
  try {
    if (row) {
      let detail = await electronSignServices.getContractTemplate({ id: row.id });
      handleEdit({
        id: row.id,
        templateId: row.templateId,
        name: row.name,
        code: row.code,
        file: convertApi2FormUrlOnlyOne(row.file),
        access: row.access,
        isEnterpriseUserCreated: detail.isEnterpriseUserCreated,
        templateEditData: detail.templateEditData,
        isAutoSign: detail.isAutoSign ?? false,
        autoSignPowerAttorneyUrl: convertApi2FormUrlOnlyOne(detail.autoSignPowerAttorneyUrl),
        enterpriseId: enterpriseId,
      });
    } else {
      handleAdd();
    }
  } catch (error) {}
}
async function handleAddOrEdit() {
@@ -228,6 +238,8 @@
      code: editForm.code,
      access: editForm.access,
      templateId: editForm.templateId,
      isAutoSign: editForm.isAutoSign,
      autoSignPowerAttorneyUrl: editForm.autoSignPowerAttorneyUrl?.[0]?.path ?? '',
      templateEditData: JSON.stringify(
        pdfToImage.map(
          (x) =>
@@ -246,8 +258,11 @@
    if (res) {
      Message.successMessage('操作成功');
      getList();
      dialogState.dialogVisible = false;
    }
  } catch (error) {}
  } catch (error) {
    dialogState.dialogVisible = true;
  }
}
function handleDownload(row: API.GetEnterpriseContractTemplatesQueryResultItem) {