wupengfei
2025-04-14 05a07471a6e55cc82210f9ad8b74d4b5aa445cfc
src/views/MaterialReview/MaterialReviewAudit.vue
@@ -1,11 +1,215 @@
<template>
  <div>MaterialReviewAudit</div>
  <LoadingLayout>
    <AppContainer>
      <PageFormLayout title="材料审核">
        <DetailView :form="form" :has-form="true">
          <ChunkCellV2 title="申报企业名单" class="chunk-cell-table">
            <DeclareEnterpriseTableView
              :getList="getList"
              :extra-param-state="extraParamState"
              :pro-table-props="proTableProps"
              :reset="reset"
            ></DeclareEnterpriseTableView>
          </ChunkCellV2>
          <ChunkCell>
            <ProForm :model="form" ref="formRef" label-width="120px">
              <ProFormCol>
                <ProFormColItem :span="12">
                  <ProFormItemV2
                    label="申报审核:"
                    prop="status"
                    :check-rules="[{ message: '请选择审核状态' }]"
                  >
                    <ProFormRadio
                      v-model="form.status"
                      :value-enum="BountyCheckStatusEnumTextForAudit"
                    />
                  </ProFormItemV2>
                </ProFormColItem>
              </ProFormCol>
              <ProFormCol v-if="form.status === BountyCheckStatusEnum.CheckReject">
                <ProFormColItem>
                  <ProFormItemV2
                    label="驳回原因:"
                    prop="remark"
                    :check-rules="[{ message: '请输入驳回原因' }]"
                  >
                    <ProFormTextArea
                      v-model="form.remark"
                      placeholder="请输入"
                      show-word-limit
                      :maxlength="200"
                    ></ProFormTextArea>
                  </ProFormItemV2>
                </ProFormColItem>
              </ProFormCol>
            </ProForm>
          </ChunkCell>
        </DetailView>
        <template #footer>
          <el-button @click="handleBack">关闭</el-button>
          <el-button type="primary" @click="handleConfirm()">提交</el-button>
        </template>
      </PageFormLayout>
    </AppContainer>
  </LoadingLayout>
</template>
<script setup lang="ts">
import {
  AppContainer,
  ProForm,
  ChunkCell,
  ProFormCol,
  ProFormColItem,
  ProFormItemV2,
  ProFormTextArea,
  ProFormRadio,
  LoadingLayout,
  UploadUserFile,
  PageFormLayout,
  useTable,
} from '@bole-core/components';
import {
  EnterpriseTypeText,
  BountyCheckStatusEnum,
  BountyCheckStatusEnumTextForAudit,
} from '@/constants';
import ChunkCellV2 from '@/components/Layout/ChunkCellV2.vue';
import DetailView from '@/components/commonView/DetailView.vue';
import DeclareEnterpriseTableView from '@/components/commonView/DeclareEnterpriseTableView.vue';
import { useQuery, useQueryClient } from '@tanstack/vue-query';
import * as parkBountyApplyServices from '@/services/api/ParkBountyApply';
import { convertApi2FormUrlOnlyOne, setOSSLink } from '@/utils';
import { useGlobalEventContext, useRouteView } from '@/hooks';
import { FormInstance } from 'element-plus';
import { Message, OrderInputType } from '@bole-core/core';
defineOptions({
  name: 'MaterialReviewAudit',
});
const route = useRoute();
const eventContext = useGlobalEventContext();
const { closeViewPush } = useRouteView();
const id = route.params?.id as string;
const form = reactive({
  batchNo: '',
  parkName: '',
  parkTypeName: '',
  applyMonth: '',
  applySumAmount: 0,
  enterpriseTaxSubFileUrl: [] as UploadUserFile[],
  enterpriseOperateFileUrl: [] as UploadUserFile[],
  bountyAssignFileUlr: [] as UploadUserFile[],
  bountyCollectFileUrl: [] as UploadUserFile[],
  status: '' as any as BountyCheckStatusEnum,
  remark: '',
});
const { data: detail, isLoading } = useQuery({
  queryKey: ['parkBountyApplyServices/getOutCheckParkBountyApplyDetailBaseInfo', id],
  queryFn: async () => {
    return await parkBountyApplyServices.getOutCheckParkBountyApplyDetailBaseInfo(
      { parkBountyApplyId: id },
      {
        showLoading: false,
      }
    );
  },
  placeholderData: () => ({} as API.ParkBountyApplyBaseInfo),
  onSuccess(data) {
    form.batchNo = data.batchNo;
    form.parkName = data.parkName;
    form.parkTypeName = data.parkTypeName;
    form.applyMonth = data.applyMonth;
    form.applySumAmount = data.applySumAmount;
    form.enterpriseTaxSubFileUrl = convertApi2FormUrlOnlyOne(data?.enterpriseTaxSubFileUrl);
    form.enterpriseOperateFileUrl = convertApi2FormUrlOnlyOne(data?.enterpriseOperateFileUrl);
    form.bountyAssignFileUlr = convertApi2FormUrlOnlyOne(data?.bountyAssignFileUlr);
    form.bountyCollectFileUrl = convertApi2FormUrlOnlyOne(data?.bountyCollectFileUrl);
    getList();
  },
});
const {
  getDataSource: getList,
  proTableProps,
  paginationState,
  extraParamState,
  reset,
} = useTable(
  async ({ pageIndex, pageSize }, extraParamState) => {
    try {
      let params: API.GetParkBountyApplyInfoInput = {
        pageModel: {
          rows: pageSize,
          page: pageIndex,
          orderInput: extraParamState.orderInput,
        },
        searchKeyWord: extraParamState.searchKeyWord,
        parkBountyApplyId: id,
      };
      let res = await parkBountyApplyServices.getOutCheckParkBountyApplyDetailList(params);
      return res;
    } catch (error) {}
  },
  {
    defaultExtraParams: {
      orderInput: [{ property: 'enterpriseId', order: OrderInputType.Desc }],
      searchKeyWord: '',
    },
    columnsRenderProps: {
      authType: { type: 'enum', valueEnum: EnterpriseTypeText },
      licenseUrl: {
        type: 'url',
        formatter: (row: API.UserCertificationAuditListDto) => setOSSLink(row.licenseUrl),
        modal: true,
        showDownloadBtn: false,
      },
    },
  }
);
function handleBack() {
  closeViewPush(route, {
    name: 'MaterialReviewList',
  });
}
const formRef = ref<FormInstance>();
function handleConfirm() {
  if (!formRef.value) return;
  formRef.value.validate((valid) => {
    if (valid) {
      confirm();
    } else {
      return;
    }
  });
}
const queryClient = useQueryClient();
async function confirm() {
  try {
    let params: API.OutcheckParkBountyApplyInput = {
      parkBountyApplyId: id,
      outCheckStatus: form.status,
      remark: form.remark,
    };
    let res = await parkBountyApplyServices.outcheckParkBountyApply(params);
    if (res) {
      Message.successMessage('操作成功');
      eventContext.emit('materialReviewAudit:audit');
      queryClient.invalidateQueries({
        queryKey: ['parkBountyApplyServices/getGoverDataBoard'],
      });
      handleBack();
    }
  } catch (error) {}
}
</script>
<style lang="scss" scoped>