Files
geg-gas-web/src/views/sales/Customer/components/createForm.vue

716 lines
31 KiB
Vue
Raw Normal View History

2025-11-21 16:38:17 +08:00
<template>
2025-11-28 14:44:37 +08:00
<a-spin :spinning="spinning" tip="加载中...">
2025-12-04 17:03:49 +08:00
<div class="page-bg-wrap formViewStyle">
2025-11-21 16:38:17 +08:00
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
<a-card title="客户基本信息" :bordered="false" >
<div>
<h4>基本信息</h4>
<a-row>
<a-col :span="8">
<a-form-item label="客户编码" name="cuCode">
<a-input v-model:value="formState.cuCode" disabled />
</a-form-item>
</a-col>
<a-col :span="8">
2025-11-28 17:14:19 +08:00
<a-form-item label="集团编码" name="cuMcode">
<a-input v-model:value="formState.cuMcode" :disabled="isDisable" placeholder="请输入集团编码" />
2025-11-21 16:38:17 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
2025-11-28 17:14:19 +08:00
<a-form-item label="企业性质" name="natureCode">
<a-select v-model:value="formState.natureCode" :disabled="isDisable" placeholder="请选择企业性质" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.natureCodeList" :key="item.code" :value="item.code">
2025-11-21 16:38:17 +08:00
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="24">
2025-11-28 17:14:19 +08:00
<a-form-item label="客户名称" name="cuName" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
2025-12-04 17:03:49 +08:00
<a-input v-model:value="formState.cuName" :disabled="isDisable" placeholder="请输入客户名称" />
2025-11-21 16:38:17 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
2025-12-01 13:38:41 +08:00
<a-form-item label="客户简称" name="cuSname">
<a-input v-model:value="formState.cuSname" :disabled="isDisable" placeholder="请输入客户简称" />
2025-11-21 16:38:17 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
2025-12-01 13:38:41 +08:00
<a-form-item label="国内/国际" name="dI">
<a-select v-model:value="formState.dI" :disabled="isDisable" placeholder="请选择国内/国际" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.dIList" :key="item.code" :value="item.code">
2025-11-21 16:38:17 +08:00
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="母公司名称" name="parentNname">
2025-11-27 17:23:14 +08:00
<a-input v-model:value="formState.parentNname" :disabled="isDisable" placeholder="请输入母公司名称" />
2025-11-21 16:38:17 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="统一社会信用代码" name="creditNo">
2025-11-27 17:23:14 +08:00
<a-input v-model:value="formState.creditNo" :disabled="isDisable" placeholder="请输入统一社会信用代码" />
2025-11-21 16:38:17 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="纳税人识别号" name="tiNo">
2025-11-27 17:23:14 +08:00
<a-input v-model:value="formState.tiNo" :disabled="isDisable" placeholder="请输入纳税人识别号" />
2025-11-21 16:38:17 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="法定代表人" name="representative">
2025-11-27 17:23:14 +08:00
<a-input v-model:value="formState.representative" :disabled="isDisable" placeholder="请输入法定代表人" />
2025-11-21 16:38:17 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="成立日期" name="dateEstab">
2025-11-27 17:23:14 +08:00
<a-date-picker v-model:value="formState.dateEstab" :disabled="isDisable" style="width: 100%" placeholder="请选择成立日期" />
2025-11-21 16:38:17 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="准入时间" name="dateEntry">
2025-11-27 17:23:14 +08:00
<a-date-picker v-model:value="formState.dateEntry" :disabled="isDisable" style="width: 100%" placeholder="请选择准入时间" />
2025-11-21 16:38:17 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="注册资本(万元)" name="amtReg">
2025-11-27 17:23:14 +08:00
<a-input-number v-model:value="formState.amtReg" :disabled="isDisable" :min="0" style="width: 100%" placeholder="请输入注册资本"/>
2025-11-21 16:38:17 +08:00
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="注册地址" name="addrReg" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
2025-11-27 17:23:14 +08:00
<a-textarea v-model:value="formState.addrReg" :disabled="isDisable" placeholder="请输入注册地址" :auto-size="{ minRows: 1, maxRows: 5 }"/>
2025-11-21 16:38:17 +08:00
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="通讯地址" name="addrMail" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
2025-11-27 17:23:14 +08:00
<a-textarea v-model:value="formState.addrMail" :disabled="isDisable" placeholder="请输入通讯地址" :auto-size="{ minRows: 1, maxRows: 5 }"/>
2025-11-21 16:38:17 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="是否有效" name="valid">
<a-select v-model:value="formState.valid" disabled style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.validList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="审批状态" name="approCode">
<a-select v-model:value="formState.approCode" disabled style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.approCodeList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
2025-11-27 17:23:14 +08:00
<a-textarea v-model:value="formState.note" :disabled="isDisable" placeholder="请输入备注最多200字" :maxlength="200" :auto-size="{ minRows: 2, maxRows: 5 }"/>
2025-11-21 16:38:17 +08:00
</a-form-item>
</a-col>
</a-row>
</div>
<div>
<h4>资信/业务信息</h4>
<a-row>
<a-col :span="8">
<a-form-item label="客户分类" name="classCode">
2025-11-27 17:23:14 +08:00
<a-select v-model:value="formState.classCode" :disabled="isDisable" placeholder="请选择客户分类" style="width: 100%" allow-clear>
2025-11-21 16:38:17 +08:00
<a-select-option v-for="item in optionSelect.classCodeList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="客户类别" name="typeCode">
2025-11-27 17:23:14 +08:00
<a-select v-model:value="formState.typeCode" :disabled="isDisable" placeholder="请选择客户类别" @change="typeCodeChange" style="width: 100%" allow-clear>
2025-11-21 16:38:17 +08:00
<a-select-option v-for="item in optionSelect.typeCodeList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="统计分类" name="propCode">
2025-11-27 17:23:14 +08:00
<a-select v-model:value="formState.propCode" :disabled="isDisable" placeholder="请选择统计分类" style="width: 100%" allow-clear>
2025-11-21 16:38:17 +08:00
<a-select-option v-for="item in optionSelect.propCodeList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="国有企业持股" name="stateSign" :offset="8">
<div style="display: flex;">
2025-11-27 17:23:14 +08:00
<a-radio-group v-model:value="formState.stateSign" :disabled="isDisable" style="display: flex;" @change="stateSignChange">
2025-11-21 16:38:17 +08:00
<a-radio v-for="item in optionSelect.signList" :value="item.code">{{ item.name }}</a-radio>
</a-radio-group>
<a-form-item label="持股比例" name="rateShare" style="position: relative;">
2025-11-27 17:23:14 +08:00
<a-input-number v-model:value="formState.rateShare" style="width: 80px" :disabled="formState.stateSign!='Y' || isDisable" :min="0" :max="100"></a-input-number>
2025-11-21 16:38:17 +08:00
<span class="rateStyle">%</span>
</a-form-item>
</div>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="第一大股东名称" name="shareName">
2025-11-27 17:23:14 +08:00
<a-input v-model:value="formState.shareName" :disabled="isDisable" placeholder="请输入第一大股东名称" />
2025-11-21 16:38:17 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="集团持股比例" name="rateShareGn">
2025-11-27 17:23:14 +08:00
<a-input-number v-model:value="formState.rateShareGn" :disabled="isDisable" style="width: 100%" :min="0" :max="100"></a-input-number>
2025-11-21 16:38:17 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="预付款校验" name="prepaySign">
2025-11-27 17:23:14 +08:00
<a-radio-group v-model:value="formState.prepaySign" :disabled="isDisable">
2025-11-21 16:38:17 +08:00
<a-radio v-for="item in optionSelect.signList" :value="item.code">{{ item.name }}</a-radio>
</a-radio-group>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="竞拍" name="onlineSign">
2025-11-27 17:23:14 +08:00
<a-radio-group v-model:value="formState.onlineSign" :disabled="isDisable">
2025-11-21 16:38:17 +08:00
<a-radio v-for="item in optionSelect.signList" :value="item.code">{{ item.code == 'Y'?'': '' }}</a-radio>
</a-radio-group>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="自有终端" name="tSign">
2025-11-27 17:23:14 +08:00
<a-radio-group v-model:value="formState.tSign" :disabled="isDisable">
2025-11-21 16:38:17 +08:00
<a-radio v-for="item in optionSelect.signList" :value="item.code">{{ item.name }}</a-radio>
</a-radio-group>
</a-form-item>
</a-col>
</a-row>
<div style="display:flex">
<h4>电厂业务信息</h4>
<div style="font-size: 12px;">客户类别为 电厂 时填写</div>
</div>
<a-row>
<a-col :span="8">
<a-form-item label="装机量(万KW)" name="capacity">
2025-11-27 17:23:14 +08:00
<a-input-number v-model:value="formState.lngCustomerAttrPowerList[0].capacity" :disabled="formState.typeCode!='DC' || isDisable" style="width: 100%" :min="0" placeholder="请输入机量"></a-input-number>
2025-11-21 16:38:17 +08:00
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
2025-11-27 17:23:14 +08:00
<a-textarea v-model:value="formState.lngCustomerAttrPowerList[0].note" :disabled="formState.typeCode!='DC' || isDisable" placeholder="请输入备注" :auto-size="{ minRows: 2, maxRows: 5 }"/>
2025-11-21 16:38:17 +08:00
</a-form-item>
</a-col>
</a-row>
</div>
</a-card>
<a-card :bordered="false" >
<template #title>
<div style="display: flex; align-items: center;">
<span style="color: red;">*</span>
<span style="margin-left: 8px;">资质证书信息</span>
<span style="font-size: 12px;font-weight: normal;">需上传证书营业执照危险化学品许可证/燃气经营许可证/危险化学品道路运输许可证等证书</span>
</div>
</template>
2025-11-27 17:23:14 +08:00
<a-button v-if="!isDisable" type="primary" style="margin-bottom: 10px;" @click="handleAdd('certificate')">新增证书</a-button>
2025-11-21 16:38:17 +08:00
<a-table :columns="columnsCertificate" :data-source="dataCertificate" >
2025-11-25 12:12:15 +08:00
<template #bodyCell="{ column, record, index }">
2025-12-02 17:48:17 +08:00
<template v-if="column.dataIndex === 'dateFrom'">
{{ record.dateFrom ? dayjs(record.dateFrom).format('YYYY-MM-DD') : ''}}
</template>
<template v-if="column.dataIndex === 'dateTo'">
{{ record.dateTo ? dayjs(record.dateTo).format('YYYY-MM-DD') : ''}}
</template>
2025-11-27 17:23:14 +08:00
<template v-if="column.dataIndex === 'docTypeCode'">
{{ (optionSelect.docCpList.find(v=>v.code == record.docTypeCode) || {}).fullName }}
</template>
2025-11-21 16:38:17 +08:00
<template v-if="column.dataIndex === 'operation'">
2025-11-28 17:14:19 +08:00
<a v-if="!isDisable" style="margin-right: 10px" @click="btnCheck('certificate', 'edit', record, index)">编辑</a>
<a v-if="!isDisable" style="margin-right: 10px" @click="btnCheck('certificate', 'delete', record, index)">删除</a>
2025-11-21 16:38:17 +08:00
<a style="margin-right: 10px" @click="btnCheck('certificate', 'view', record)">查看</a>
2025-11-25 12:12:15 +08:00
<ArrowUpOutlined style="margin-right: 10px;" class="btn" @click="btnCheck('certificate', 'up', record, index)" />
<ArrowDownOutlined class="btn" @click="btnCheck('certificate', 'down', record, index)" />
2025-11-21 16:38:17 +08:00
</template>
</template>
</a-table>
</a-card>
<a-card :bordered="false" >
<template #title>
<div style="display: flex; align-items: center;">
<span style="color: red;">*</span>
<span style="margin-left: 8px;">银行账户信息</span>
<span style="font-size: 12px;font-weight: normal;">至少填写一条银行信息</span>
</div>
</template>
2025-11-27 17:23:14 +08:00
<a-button v-if="!isDisable" type="primary" style="margin-bottom: 10px;" @click="handleAdd('bank')">新增银行账户</a-button>
2025-11-21 16:38:17 +08:00
<a-table :columns="columnsBank" :data-source="dataBank" >
2025-11-25 12:12:15 +08:00
<template #bodyCell="{ column, record, index }">
2025-11-27 17:23:14 +08:00
<template v-if="column.dataIndex === 'defaultSign'">
{{ (optionSelect.signList.find(v=>v.code == record.defaultSign) || {}).name }}
</template>
2025-11-25 12:12:15 +08:00
<template v-if="column.dataIndex === 'operation'">
2025-11-27 17:23:14 +08:00
<a style="margin-right: 10px" @click="btnCheck('bank', 'edit', record, index)">编辑</a>
2025-11-25 12:12:15 +08:00
<a style="margin-right: 10px" @click="btnCheck('bank', 'delete', record, index)">删除</a>
</template>
</template>
2025-11-21 16:38:17 +08:00
</a-table>
</a-card>
<a-card :bordered="false" >
<template #title>
<div style="display: flex; align-items: center;">
<span style="color: red;">*</span>
<span style="margin-left: 8px;">联系人信息</span>
<span style="font-size: 12px;font-weight: normal;">至少填写一条联系人信息</span>
</div>
</template>
2025-11-27 17:23:14 +08:00
<a-button v-if="!isDisable" type="primary" style="margin-bottom: 10px;" @click="handleAdd('contact')">新增联系人</a-button>
2025-11-21 16:38:17 +08:00
<a-table :columns="columnsContact" :data-source="dataContact" >
2025-11-25 12:12:15 +08:00
<template #bodyCell="{ column, record, index }">
2025-11-21 16:38:17 +08:00
<template v-if="column.dataIndex === 'operation'">
2025-11-27 17:23:14 +08:00
<a style="margin-right: 10px" @click="btnCheck('contact', 'edit', record, index)">编辑</a>
2025-11-25 12:12:15 +08:00
<a style="margin-right: 10px" @click="btnCheck('contact', 'delete', record, index)">删除</a>
2025-11-21 16:38:17 +08:00
</template>
</template>
</a-table>
</a-card>
<a-card :bordered="false" >
<template #title>
<div style="display: flex; align-items: center;">
<span style="margin-left: 8px;">附件信息</span>
<span style="font-size: 12px;font-weight: normal;">上传公司财报等附件</span>
</div>
</template>
2025-12-18 10:03:25 +08:00
<UploadList :disabled="isDisable" :list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadListChange"/>
2025-11-21 16:38:17 +08:00
</a-card>
</a-form>
</div>
</a-spin>
2025-12-18 11:21:33 +08:00
<certificateModal @register="registerCertificate" @success="handleSuccessCertificate" type="cuSign" />
2025-11-21 16:38:17 +08:00
<contactModal @register="registerContact" @success="handleSuccessContact" />
2025-11-25 12:12:15 +08:00
<bankModal @register="registerBank" @success="handleSuccessBank"/>
2025-11-21 16:38:17 +08:00
</template>
<script lang="ts" setup>
import { useRouter } from 'vue-router';
import { FromPageType } from '/@/enums/workflowEnum';
2025-11-27 17:23:14 +08:00
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent, watch} from 'vue';
2025-11-21 16:38:17 +08:00
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { CheckCircleOutlined, StopOutlined, CloseOutlined, UploadOutlined, SaveOutlined, DownloadOutlined,ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons-vue';
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
import useEventBus from '/@/hooks/event/useEventBus';
import type { Rule } from 'ant-design-vue/es/form';
2025-11-27 17:23:14 +08:00
import { getDocCpList, getDictionary } from '/@/api/sales/Customer';
2025-12-19 09:11:04 +08:00
import certificateModal from '/@/components/common/certificateModal.vue';
import contactModal from '/@/components/common/contactModal.vue';
import bankModal from '/@/components/common/bankModal.vue';
2025-11-21 16:38:17 +08:00
import { useModal } from '/@/components/Modal';
2025-11-25 12:12:15 +08:00
import { addLngCustomer,updateLngCustomer,getLngCustomer } from '/@/api/sales/Customer';
import dayjs from 'dayjs';
import { getAppEnvConfig } from '/@/utils/env';
import { message } from 'ant-design-vue';
2025-12-17 16:06:44 +08:00
import UploadList from '/@/components/Form/src/components/UploadList.vue';
2025-12-09 17:13:57 +08:00
const tableName = '1';
const columnName = '1'
2025-11-27 17:23:14 +08:00
2025-11-21 16:38:17 +08:00
const formType = ref('2'); // 0 新建 1 修改 2 查看
const formRef = ref();
2025-12-17 16:06:44 +08:00
const uploadFile = ref()
2025-11-27 17:23:14 +08:00
const props = defineProps({
disabled: false,
id: ''
});
2025-11-21 16:38:17 +08:00
const { bus, FORM_LIST_MODIFIED } = useEventBus();
const router = useRouter();
const { currentRoute } = router;
2025-11-27 17:23:14 +08:00
const isDisable = ref(false);
2025-11-21 16:38:17 +08:00
const { formPath } = currentRoute.value.query;
2025-11-27 17:23:14 +08:00
const pathArr = [];
2025-11-21 16:38:17 +08:00
const tabStore = useMultipleTabStore();
const formProps = ref(null);
const formId = ref(currentRoute.value?.params?.id);
2025-11-27 17:23:14 +08:00
const pageType = ref(currentRoute.value.query?.type);
const pageId = ref(currentRoute.value.query?.id)
2025-11-21 16:38:17 +08:00
2025-11-27 17:23:14 +08:00
const spinning = ref(false);
const curIdx = ref(null)
2025-11-21 16:38:17 +08:00
const { notification } = useMessage();
const { t } = useI18n();
const formState = reactive({
valid: 'Y',
approCode: 'WTJ',
2025-11-25 12:12:15 +08:00
tSign: 'N',
2025-11-21 16:38:17 +08:00
lngCustomerAttrPowerList:[
{
"capacity": '',
"note": null,
}
]
});
2025-12-02 17:48:17 +08:00
const btnTip = '上传'
2025-11-21 16:38:17 +08:00
const [registerCertificate, { openModal:openModalCertificate }] = useModal();
const [registerContact, { openModal:openModalContact }] = useModal();
2025-11-25 12:12:15 +08:00
const [registerBank, { openModal:openModalBank}] = useModal();
2025-11-21 16:38:17 +08:00
2025-11-27 17:23:14 +08:00
2025-11-21 16:38:17 +08:00
const rules: Record<string, Rule[]> = {
2025-12-01 13:38:41 +08:00
cuSname: [{ required: true, message: "该项为必填项", trigger: 'change' }],
2025-12-22 17:30:39 +08:00
cuMcode: [{ required: false, message: "该项为必填项", trigger: 'change' }],
2025-12-01 13:38:41 +08:00
dI: [{ required: true, message: "该项为必填项", trigger: 'change' }],
2025-11-28 17:14:19 +08:00
cuName: [{ required: true, message: "该项为必填项", trigger: 'change'}],
2025-11-21 16:38:17 +08:00
natureCode: [{ required: true, message: "该项为必填项", trigger: 'change'}],
classCode: [{ required: true, message: "该项为必填项", trigger: 'change'}],
typeCode: [{ required: true, message: "该项为必填项", trigger: 'change'}],
prepaySign: [{ required: true, message: "该项为必填项", trigger: 'change'}],
onlineSign: [{ required: true, message: "该项为必填项", trigger: 'change'}],
rateShare: [{ required: false, message: "该项为必填项", trigger: 'change'}],
2025-11-25 12:12:15 +08:00
tSign: [{ required: false, message: "该项为必填项", trigger: 'change'}],
2025-11-21 16:38:17 +08:00
};
const layout = {
labelCol: { span: 9 },
wrapperCol: { span: 15 },
}
const columnsCertificate = ref([
{ title: t('序号'), dataIndex: 'index', key: 'index', sorter: true, customRender: (column) => `${column.index + 1}` ,width: 100},
2025-11-27 17:23:14 +08:00
{ title: t('资质证书名称'), dataIndex: 'docTypeCode', sorter: true, width:200},
2025-11-21 16:38:17 +08:00
{ title: t('有效期开始'), dataIndex: 'dateFrom', sorter: true, width: 140},
{ title: t('有效期结束'), dataIndex: 'dateTo', sorter: true, width: 140},
{ title: t('备注'), dataIndex: 'note', sorter: true},
{ title: t('操作'), dataIndex: 'operation', width: 220},
]);
const columnsBank = ref([
{ title: t('序号'), dataIndex: 'index', sorter: true, customRender: (column) => `${column.index + 1}`},
2025-12-26 17:37:06 +08:00
{ title: t('银行名称'), dataIndex: 'bankName', sorter: true},
2025-11-21 16:38:17 +08:00
{ title: t('联行号'), dataIndex: 'code', sorter: true},
{ title: t('账号名称'), dataIndex: 'accountName', sorter: true},
{ title: t('银行账号'), dataIndex: 'account', sorter: true},
{ title: t('默认银行'), dataIndex: 'defaultSign', sorter: true},
{ title: t('操作'), dataIndex: 'operation', sorter: true},
]);
const columnsContact = ref([
{ title: t('序号'), dataIndex: 'index', sorter: true, customRender: (column) => `${column.index + 1}`},
{ title: t('姓名'), dataIndex: 'contactName', sorter: true},
{ title: t('联系电话'), dataIndex: 'tel', sorter: true},
{ title: t('电子邮箱'), dataIndex: 'email', sorter: true},
{ title: t('通讯地址'), dataIndex: 'addrMail', sorter: true},
{ title: t('职位'), dataIndex: 'position', sorter: true},
{ title: t('备注'), dataIndex: 'note', sorter: true},
{ title: t('操作'), dataIndex: 'operation', sorter: true},
]);
const dataCertificate= reactive([]);
const dataBank= reactive([]);
2025-12-02 17:48:17 +08:00
const dataFile = ref([]);
2025-11-21 16:38:17 +08:00
const dataContact= reactive([]);
let optionSelect= reactive({
natureCodeList: [],
2025-12-01 13:38:41 +08:00
dIList: [],
2025-11-21 16:38:17 +08:00
validList: [],
approCodeList: [],
classCodeList: [],
typeCodeList: [],
propCodeList: [],
2025-11-27 17:23:14 +08:00
signList: [],
docCpList: []
2025-11-21 16:38:17 +08:00
});
2025-11-27 17:23:14 +08:00
watch(
() => props.id,
(val) => {
if (val) {
2025-12-19 10:26:01 +08:00
getInfo(val)
2025-11-28 14:44:37 +08:00
}
},
{
immediate: true
}
);
watch(
() => props.disabled,
(val) => {
isDisable.value = val
2025-11-28 17:14:19 +08:00
if (val) {
let idx = columnsBank.value.findIndex(v =>v.dataIndex == 'operation')
idx>-1 && columnsBank.value.splice(idx, 1)
let idx1 = columnsContact.value.findIndex(v =>v.dataIndex == 'operation')
idx1>-1 && columnsContact.value.splice(idx1, 1)
}
2025-11-27 17:23:14 +08:00
},
{
immediate: true
}
);
2025-11-21 16:38:17 +08:00
onMounted(() => {
getOption()
2025-11-25 12:12:15 +08:00
if (pageId.value) {
2025-12-19 10:26:01 +08:00
getInfo(pageId.value)
2025-11-25 12:12:15 +08:00
}
2025-11-21 16:38:17 +08:00
});
2025-12-18 10:03:25 +08:00
const uploadListChange = (val) => {
dataFile.value = val
}
2025-12-19 10:26:01 +08:00
async function getInfo(id) {
2025-11-28 14:44:37 +08:00
spinning.value = true
2025-12-02 17:48:17 +08:00
try {
2025-11-25 12:12:15 +08:00
let data = await getLngCustomer(id)
2025-11-28 14:44:37 +08:00
spinning.value = false
2025-11-25 12:12:15 +08:00
Object.assign(formState, {...data})
formState.lngCustomerAttrPowerList = formState.lngCustomerAttrPowerList || [{}]
Object.assign(dataBank, formState.lngCustomerBankList || [])
Object.assign(dataCertificate, formState.lngCustomerDocList || [])
Object.assign(dataContact, formState.lngCustomerContactList || [])
2025-12-02 17:48:17 +08:00
Object.assign(dataFile.value, formState.lngFileUploadList || [])
formState.dateEntry = formState.dateEntry ? dayjs(formState.dateEntry) : null
formState.dateEstab = formState.dateEstab ? dayjs(formState.dateEstab) : null
} catch (error) {
spinning.value = false
}
2025-11-25 12:12:15 +08:00
}
2025-11-21 16:38:17 +08:00
async function getOption() {
2025-11-28 17:14:19 +08:00
optionSelect.natureCodeList = await getDictionary('LNG_ENT_PR')
2025-12-01 13:38:41 +08:00
optionSelect.dIList = await getDictionary('LNG_NATURE')
2025-11-21 16:38:17 +08:00
optionSelect.classCodeList = await getDictionary('LNG_CLASS')
optionSelect.typeCodeList = await getDictionary('LNG_CU_TYP')
optionSelect.propCodeList = await getDictionary('LNG_CU_RPT')
optionSelect.signList = await getDictionary('LNG_YN')
optionSelect.validList = await getDictionary('LNG_VALID')
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
2025-12-19 09:11:04 +08:00
optionSelect.docCpList = await getDocCpList()
2025-11-21 16:38:17 +08:00
}
function stateSignChange(val) {
if (val!='Y'){
formState.rateShare = ''
}
}
function typeCodeChange(val) {
if (val!='DC'){
formState.lngCustomerAttrPowerList[0].note = ''
formState.lngCustomerAttrPowerList[0].capacity = ''
}
}
const handleAdd = (val)=> {
2025-11-27 17:23:14 +08:00
curIdx.value = null
2025-11-21 16:38:17 +08:00
if (val ==='certificate') {
2025-12-02 17:48:17 +08:00
openModalCertificate(true,{isUpdate: false, list: dataCertificate});
2025-11-21 16:38:17 +08:00
}
if (val ==='contact'){
openModalContact(true, {});
}
2025-11-25 12:12:15 +08:00
if (val == 'bank'){
openModalBank(true,{isUpdate: false})
}
2025-11-21 16:38:17 +08:00
}
const btnCheck = (type, btn, record, index) => {
2025-11-25 12:12:15 +08:00
console.log(index, 555, type, )
2025-11-27 17:23:14 +08:00
curIdx.value = null
btn=='edit' && (curIdx.value = index)
2025-11-21 16:38:17 +08:00
// 证书
if (type == 'certificate') {
2025-11-25 12:12:15 +08:00
if (btn == 'edit' || btn == 'view') {
2025-12-02 17:48:17 +08:00
openModalCertificate(true, {record: record,isUpdate: true, btnType: btn, list: dataCertificate});
2025-12-09 17:13:57 +08:00
console.log(record, 'record', dataCertificate)
2025-11-21 16:38:17 +08:00
}
2025-11-25 12:12:15 +08:00
if (btn == 'delete') {
2025-11-21 16:38:17 +08:00
dataCertificate.splice(index, 1)
}
2025-11-25 12:12:15 +08:00
if (btn == 'up') {
if (index === 0) {
return
}
dataCertificate[index] = dataCertificate.splice(index-1, 1, dataCertificate[index])[0];
}
if (btn == 'down') {
if (index === dataCertificate.length - 1) {
return
}
dataCertificate[index] = dataCertificate.splice(index+1, 1, dataCertificate[index])[0];
}
2025-11-21 16:38:17 +08:00
}
2025-11-25 12:12:15 +08:00
2025-11-21 16:38:17 +08:00
// 联系人
if (type == 'contact') {
if (btn == 'edit') {
openModalContact(true, {record: record,isUpdate: true});
}
2025-11-25 12:12:15 +08:00
if (btn == 'delete') {
2025-11-21 16:38:17 +08:00
dataContact.splice(index, 1)
}
}
2025-11-25 12:12:15 +08:00
// 银行
if (type == 'bank') {
if (btn == 'edit') {
openModalBank(true, {record: record,isUpdate: true});
}
if (btn == 'delete') {
dataBank.splice(index, 1)
}
}
2025-11-21 16:38:17 +08:00
}
const handleSuccessCertificate = (val) => {
2025-11-27 17:23:14 +08:00
// 编辑
if (curIdx.value != null) {
dataCertificate[curIdx.value] = {...val}
return
}
2025-11-21 16:38:17 +08:00
let idx =dataCertificate.findIndex(v => v.docTypeCode == val.docTypeCode)
2025-11-25 12:12:15 +08:00
if (idx <0) {
2025-11-21 16:38:17 +08:00
dataCertificate.push(val)
}
2025-12-09 17:13:57 +08:00
console.log(dataCertificate, 'dataCertificate')
2025-11-21 16:38:17 +08:00
}
const handleSuccessContact = (val)=> {
2025-11-27 17:23:14 +08:00
if (curIdx.value != null) {
dataContact[curIdx.value] = {...val}
return
}
2025-11-21 16:38:17 +08:00
dataContact.push(val)
}
2025-11-25 12:12:15 +08:00
const handleSuccessBank = (val) => {
2025-11-27 17:23:14 +08:00
if (curIdx.value != null) {
dataBank[curIdx.value] = {...val}
return
}
2025-11-25 12:12:15 +08:00
dataBank.push(val)
}
2025-11-21 16:38:17 +08:00
function close() {
2025-11-25 12:12:15 +08:00
tabStore.closeTab(currentRoute.value, router);
2025-11-21 16:38:17 +08:00
}
2025-11-28 14:44:37 +08:00
async function getFormValue() {
return formState
}
2025-11-25 12:12:15 +08:00
async function handleSubmit(type) {
try {
await formRef.value.validateFields();
if (!dataBank.length) {
notification.warning({
message: 'Tip',
description: '请添加银行信息'
})
return
}
if (!dataCertificate.length) {
notification.warning({
message: 'Tip',
description: '请添加资质证书'
})
return
}
if (!dataContact.length) {
notification.warning({
message: 'Tip',
description: '请添加联系人'
})
return
}
2025-12-18 17:58:17 +08:00
let arr = []
dataBank.forEach(v => {
if (v.defaultSign == 'Y') {
arr.push(v)
}
})
2025-12-19 09:11:04 +08:00
if (arr.length !== 1) {
2025-12-18 17:58:17 +08:00
notification.warning({
message: 'Tip',
description: '默认银行有且仅有一个'
})
return
}
2025-12-09 17:13:57 +08:00
let arrCertificate = JSON.parse(JSON.stringify(dataCertificate))
arrCertificate.forEach(v => {
v.dateFrom = v.dateFrom ? dayjs(v.dateFrom ).format('YYYY-MM-DD HH:mm:ss') : '';
v.dateTo = v.dateTo ? dayjs(v.dateTo ).format('YYYY-MM-DD HH:mm:ss'): '';
})
2025-11-25 12:12:15 +08:00
let obj = {
...formState,
lngCustomerBankList: dataBank,
2025-12-09 17:13:57 +08:00
lngCustomerDocList: arrCertificate,
2025-11-25 12:12:15 +08:00
lngCustomerContactList: dataContact,
2025-12-18 10:03:25 +08:00
lngFileUploadList: dataFile.value
2025-11-25 12:12:15 +08:00
2025-11-21 16:38:17 +08:00
}
spinning.value = true;
2025-12-01 16:55:28 +08:00
let request = !formState.id ? addLngCustomer :updateLngCustomer
2025-11-27 17:23:14 +08:00
2025-11-21 16:38:17 +08:00
try {
2025-12-01 16:55:28 +08:00
const data = await request(obj);
2025-12-04 17:03:49 +08:00
// 新增保存
// data?.id && (formState.id = data.id)
// data?.cuCode && (Object.assign(formState, {cuCode: data?.cuCode}))
if (data?.id) {
2025-12-19 10:26:01 +08:00
getInfo(data?.id)
2025-12-04 17:03:49 +08:00
}
// 同意保存不提示
if (!type) {
notification.success({
message: 'Tip',
description: data?.id ? t('新增成功!') : t('修改成功!')
}); //提示消息
2025-12-01 16:55:28 +08:00
}
2025-11-27 17:23:14 +08:00
// formRef.value.resetFields();
2025-12-04 17:03:49 +08:00
return data?.id ? data : obj
2025-11-27 17:23:14 +08:00
// setTimeout(() => {
// bus.emit(FORM_LIST_MODIFIED, { path: formPath });
// close();
// }, 1000);
2025-11-25 12:12:15 +08:00
2025-11-21 16:38:17 +08:00
} finally {
2025-11-25 12:12:15 +08:00
spinning.value = false;
2025-11-21 16:38:17 +08:00
}
2025-11-25 12:12:15 +08:00
} catch (errorInfo) {
2025-11-27 17:23:14 +08:00
spinning.value = false;
console.log(errorInfo, 'errorInfo')
2025-12-04 17:03:49 +08:00
errorInfo?.errorFields?.length && notification.warning({
2025-11-25 12:12:15 +08:00
message: 'Tip',
description: '请完善信息'
});
2025-11-27 17:23:14 +08:00
return false
2025-11-25 12:12:15 +08:00
}
2025-11-21 16:38:17 +08:00
}
2025-11-27 17:23:14 +08:00
defineExpose({
handleSubmit,
2025-11-28 14:44:37 +08:00
getFormValue
2025-11-27 17:23:14 +08:00
});
2025-11-21 16:38:17 +08:00
</script>
<style lang="less" scoped>
.page-bg-wrap {
background-color: #fff;
}
.top-toolbar {
min-height: 44px;
margin-bottom: 12px;
border-bottom: 1px solid #eee;
}
.rateStyle {
position: absolute;
right: -25px;
top:4px;
}
.btn {
color: #5e95ff;
font-size: 20px;
font-weight: bold;
}
2025-12-04 17:03:49 +08:00
2025-11-21 16:38:17 +08:00
</style>