wupengfei
2025-03-27 12cce14bc30a85bbf96b5b30bb1aff1fc354091a
src/views/Home/BatchChange.vue
@@ -3,8 +3,10 @@
    <AppScrollContainer>
      <ChunkCell title="1">
        <template #title>
          <el-text>{{ `保单号:${'958585860689'}` }}</el-text>
          <el-text>{{ `投保人:${'人力无忧'}` }}</el-text>
          <div class="batch-change-title">
            <el-text style="margin-right: 20px">{{ `保单号:${'958585860689'}` }}</el-text>
            <el-text>{{ `投保人:${'人力无忧'}` }}</el-text>
          </div>
        </template>
        <ProForm :model="state.form" ref="formRef" label-width="120px">
          <ProFormCol>
@@ -32,6 +34,7 @@
                  :limitFileSize="10"
                  accept="xlsx,xls"
                  :showTip="false"
                  :on-success="handleUploadAddOrReduce"
                >
                  <template #default>
                    <el-button type="primary">加减人</el-button>
@@ -52,6 +55,7 @@
                  :limitFileSize="10"
                  accept="xlsx,xls"
                  :showTip="false"
                  :on-success="handleUploadReplace"
                >
                  <template #default>
                    <el-button type="primary">替换人</el-button>
@@ -106,8 +110,11 @@
  UploadUserFile,
} from '@bole-core/components';
import * as insuranceOrderServices from '@/services/api/InsuranceOrder';
import { downloadFileByUrl, OrderInputType } from '@bole-core/core';
import * as insureBatchBillServices from '@/services/api/InsureBatchBill';
import { downloadFileByUrl, Message, OrderInputType } from '@bole-core/core';
import { InsuranceAddOrReduceTempPath, InsuranceChangeTempPath } from '@/constants';
import { useRouteView } from '@/hooks';
import { FormInstance } from 'element-plus';
defineOptions({
  name: 'BatchChange',
@@ -157,6 +164,7 @@
];
const route = useRoute();
const { closeViewPush } = useRouteView();
const id = route.params.id as string;
const BaseState = {
  loading: true,
@@ -201,8 +209,50 @@
  }
);
async function handleUploadAddOrReduce(response: UploadUserFile) {
  try {
    let params: API.ImportBatchAddOrSubOrderInput = {
      url: response.path,
      insurePolicyId: id,
    };
    let res = await insureBatchBillServices.importBatchAddOrSubOrderData(params);
  } catch (error) {}
}
async function handleUploadReplace(response: UploadUserFile) {
  try {
    let params: API.ImportBatchAddOrSubOrderInput = {
      url: response.path,
      insurePolicyId: id,
    };
    let res = await insureBatchBillServices.importBatchUpdateOrderData(params);
  } catch (error) {}
}
function handleClear() {}
function handleSubmit() {}
const formRef = ref<FormInstance>();
function handleSubmit() {
  if (!formRef.value) return;
  formRef.value.validate((valid) => {
    if (valid) {
      addOrUpdateInsureBatchBill();
    } else {
      return;
    }
  });
}
async function addOrUpdateInsureBatchBill() {
  try {
    let params = {};
    let res = await insureBatchBillServices.addOrUpdateInsureBatchBill(params);
    if (res) {
      Message.successMessage('提交成功');
      handleBack();
    }
  } catch (error) {}
}
function DownloadAddOrReducePersonTemplate() {
  downloadFileByUrl(InsuranceAddOrReduceTempPath, '加减人模板');
}
@@ -210,6 +260,12 @@
  downloadFileByUrl(InsuranceChangeTempPath, '替换人模板');
}
function handleBack() {
  closeViewPush(route, {
    name: 'Home',
  });
}
onMounted(async () => {
  await getBatchRefundInfoDetail();
  state.loading = false;