Files
geg-gas-web/src/views/contract/ContractFact/components/createForm.vue

666 lines
29 KiB
Vue
Raw Normal View History

2025-12-24 17:38:00 +08:00
<template>
<a-spin :spinning="spinning" tip="加载中...">
<div class="page-bg-wrap formViewStyle">
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
<a-card title="合同要素" :bordered="false" >
<a-row>
<a-col :span="8">
<a-form-item label="合同号" name="kNo">
2025-12-26 17:37:06 +08:00
<a-input v-model:value="formState.kNo" :disabled="isDisable" style="width: 65%" /><a-button v-if="!isDisable" type="primary" @click="onAppro">关联签报</a-button>
2025-12-24 17:38:00 +08:00
</a-form-item>
</a-col>
<a-col :span="16">
<a-form-item label="合同名称" name="kName" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }">
2025-12-25 17:51:53 +08:00
<a-input v-model:value="formState.kName" placeholder="请输入合同名称" :disabled="isDisable"/>
2025-12-24 17:38:00 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
2025-12-25 17:51:53 +08:00
<a-form-item label="关联类别" name="relTypeCode">
<a-select v-model:value="formState.relTypeCode" :disabled="isDisable" placeholder="请选择关联类别" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.relTypeCodeList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
2025-12-24 17:38:00 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
2025-12-25 17:51:53 +08:00
<a-form-item label="合同类别" name="kTypeCode1">
<a-select v-model:value="formState.kTypeCode1" :disabled="isDisable" placeholder="请选择合同类别" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.kTypeCode1List" :key="item.code" :value="item.code">
2025-12-24 17:38:00 +08:00
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
2025-12-25 17:51:53 +08:00
<a-form-item label="二级类别" name="kTypeCode2">
<a-select v-model:value="formState.kTypeCode2" :disabled="isDisable" placeholder="请选择二级类别" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.kTypeCode2List" :key="item.code" :value="item.code">
2025-12-24 17:38:00 +08:00
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同期限" name="periodTypeCode">
2025-12-26 17:37:06 +08:00
<a-select v-model:value="formState.periodTypeCode" :disabled="isDisable" placeholder="请选择合同期限" @change="periodTypeCodeChange" style="width: 100%" allow-clear>
2025-12-25 17:51:53 +08:00
<a-select-option v-for="item in optionSelect.periodTypeCodeList" :key="item.code" :value="item.code">
2025-12-24 17:38:00 +08:00
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
2025-12-25 17:51:53 +08:00
</a-col>
2025-12-24 17:38:00 +08:00
<a-col :span="8">
<a-form-item label="有效期开始" name="dateFrom">
2025-12-26 17:37:06 +08:00
<a-date-picker v-model:value="formState.dateFrom" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateStart" placeholder="请选择开始日期" />
2025-12-24 17:38:00 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="有效期结束" name="dateTo">
2025-12-26 17:37:06 +08:00
<a-date-picker v-model:value="formState.dateTo" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateEnd" placeholder="请选择结束日期" />
2025-12-24 17:38:00 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="起草日期" name="dateDraft">
2025-12-26 17:37:06 +08:00
<a-date-picker v-model:value="formState.dateDraft" style="width: 100%" :disabled="isDisable" placeholder="请选择起草日期" />
2025-12-24 17:38:00 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="币种" name="curCode">
2025-12-25 17:51:53 +08:00
<a-select v-model:value="formState.curCode" :disabled="isDisable" placeholder="请选择币种" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.curCodeList" :key="item.code" :value="item.code">
{{ item.fullName }}
2025-12-24 17:38:00 +08:00
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
2025-12-25 17:51:53 +08:00
<a-form-item label="相对方数量" name="cpCount">
2025-12-26 17:37:06 +08:00
<a-input-number v-model:value="formState.cpCount" style="width: 100%" :disabled="isDisable" :precision="0" :min="0" :step="1" :max="20"/>
2025-12-24 17:38:00 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
2025-12-25 17:51:53 +08:00
<a-form-item label="合同金额类型" name="amountTypeCode">
2025-12-26 17:37:06 +08:00
<a-select v-model:value="formState.amountTypeCode" :disabled="isDisable" placeholder="请选择合同金额类型" @change="amountTypeCodeChange" style="width: 100%" allow-clear>
2025-12-25 17:51:53 +08:00
<a-select-option v-for="item in optionSelect.amountTypeCodeList" :key="item.code" :value="item.code">
2025-12-26 17:37:06 +08:00
{{ item.name }}
2025-12-25 17:51:53 +08:00
</a-select-option>
</a-select>
2025-12-24 17:38:00 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
2025-12-25 17:51:53 +08:00
<a-form-item label="合同金额(万元)" name="amount">
2025-12-26 17:37:06 +08:00
<a-input-number v-model:value="formState.amount" style="width: 100%" @blur="amountBlur(formState.amount)" :min="0" :disabled="isDisable" />
2025-12-24 17:38:00 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
2025-12-25 17:51:53 +08:00
<a-form-item label="合同金额大写" name="amountCn">
<a-input v-model:value="formState.amountCn" disabled />
</a-form-item>
</a-col>
<a-col :span="22">
<a-form-item label="合同金额说明" name="amountDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.amountDesc" :disabled="isDisable" placeholder="请输入合同金额说明" :auto-size="{ minRows: 2, maxRows: 5 }"/>
2025-12-24 17:38:00 +08:00
</a-form-item>
</a-col>
2025-12-25 17:51:53 +08:00
<a-col :span="8">
<a-form-item label="结算类型" name="settleTypeCode">
<a-select v-model:value="formState.settleTypeCode" :disabled="isDisable" placeholder="请选择结算类型" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.settleTypeCodeList" :key="item.code" :value="item.code">
2025-12-26 17:37:06 +08:00
{{ item.name }}
2025-12-25 17:51:53 +08:00
</a-select-option>
</a-select>
</a-form-item>
</a-col>
2025-12-24 17:38:00 +08:00
<a-col :span="8">
<a-form-item label="是否招投标" name="bidSign">
<a-select v-model:value="formState.bidSign" :disabled="isDisable" placeholder="请选择是否招投标" style="width: 100%" allow-clear>
2025-12-25 17:51:53 +08:00
<a-select-option v-for="item in optionSelect.signList" :key="item.code" :value="item.code">
2025-12-24 17:38:00 +08:00
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
2025-12-25 17:51:53 +08:00
<a-form-item label="是否已获前置审批" name="preApproSign">
2025-12-24 17:38:00 +08:00
<a-select v-model:value="formState.preApproSign" :disabled="isDisable" placeholder="请选择已获前置审批" style="width: 100%" allow-clear>
2025-12-25 17:51:53 +08:00
<a-select-option v-for="item in optionSelect.signList" :key="item.code" :value="item.code">
2025-12-24 17:38:00 +08:00
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="先行履行" name="aheadSign">
<a-select v-model:value="formState.aheadSign" :disabled="isDisable" placeholder="请选择先行履行" style="width: 100%" allow-clear>
2025-12-25 17:51:53 +08:00
<a-select-option v-for="item in optionSelect.signList" :key="item.code" :value="item.code">
2025-12-24 17:38:00 +08:00
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="采用范本" name="tempSign">
<a-select v-model:value="formState.tempSign" :disabled="isDisable" placeholder="请选择采用范本" style="width: 100%" allow-clear>
2025-12-25 17:51:53 +08:00
<a-select-option v-for="item in optionSelect.tempSignList" :key="item.code" :value="item.code">
2025-12-24 17:38:00 +08:00
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="重大事项所涉合同" name="impSign">
<a-select v-model:value="formState.impSign" :disabled="isDisable" placeholder="请选择重大事项所涉合同" style="width: 100%" allow-clear>
2025-12-25 17:51:53 +08:00
<a-select-option v-for="item in optionSelect.impSignList" :key="item.code" :value="item.code">
2025-12-24 17:38:00 +08:00
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
2025-12-25 17:51:53 +08:00
<a-col :span="8">
<a-form-item label="业务联系人" name="empName">
<a-input-search v-model:value="formState.empName" :disabled="isDisable" placeholder="请选择业务联系人" readonly @search="onSearchUser"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="联系电话" name="tel">
2025-12-26 17:37:06 +08:00
<a-input-search v-model:value="formState.tel" :disabled="isDisable" placeholder="请输入电话" />
2025-12-25 17:51:53 +08:00
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="业务部门" name="bDeptName">
<a-input-search v-model:value="formState.bDeptName" :disabled="isDisable" placeholder="请选择业务部门" readonly @search="onSearch"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同主体" name="comName">
<a-input v-model:value="formState.comName" disabled />
</a-form-item>
</a-col>
2025-12-24 17:38:00 +08:00
<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="22">
<a-form-item label="合同说明" name="kDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.kDesc" :disabled="isDisable" placeholder="请输入备注最多1000字" :maxlength="1000" :auto-size="{ minRows: 4, }"/>
</a-form-item>
</a-col>
<a-col :span="22">
<a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.note" :disabled="isDisable" placeholder="请输入备注最多200字" :maxlength="200" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
</a-row>
</a-card>
<a-card title="相对方信息" :bordered="false" >
2025-12-25 17:51:53 +08:00
<div style="width: 100%">
2025-12-26 17:37:06 +08:00
<a-button type="primary" style="margin-bottom: 10px" @click="addUser" v-if="!isDisable">新增行</a-button>
<a-table style="width: 100%" :columns="columns" :data-source="dataList" :pagination="false" :scroll="{x: 1000}">
2025-12-25 17:51:53 +08:00
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'operation'">
2025-12-26 17:37:06 +08:00
<a v-if="!isDisable" style="margin-right: 10px" @click="btnCheck('cp', 'edit', record, index)">编辑</a>
<a v-if="!isDisable" style="margin-right: 10px" @click="btnCheck('cp', 'delete', record, index)">删除</a>
2025-12-25 17:51:53 +08:00
</template>
2025-12-24 17:38:00 +08:00
</template>
2025-12-25 17:51:53 +08:00
</a-table>
</div>
2025-12-24 17:38:00 +08:00
</a-card>
<a-card title="附件信息" :bordered="false" >
<UploadList :disabled="isDisable" :list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadListChange"/>
</a-card>
<a-card title="签报列表" :bordered="false" >
2025-12-26 17:37:06 +08:00
<a-button type="primary" style="margin-bottom: 10px" v-if="!isDisable" @click="onAppro">关联签报</a-button>
2025-12-24 17:38:00 +08:00
<a-table :columns="columnsAppro" :data-source="dataListAppro" :pagination="false">
<template #bodyCell="{ column, record, index }">
2025-12-26 17:37:06 +08:00
<template v-if="column.dataIndex === 'file'">
2025-12-29 11:03:31 +08:00
<div v-for="item in (record.lngFileUploadList )">
<a @click="handleDownload(item)">{{item.fileOrg}}</a>
</div>
2025-12-26 17:37:06 +08:00
</template>
2025-12-24 17:38:00 +08:00
<template v-if="column.dataIndex === 'operation'">
2025-12-26 17:37:06 +08:00
<a style="margin-right: 10px" @click="btnCheck('appro', 'view', record, index)">查看</a>
<a v-if="!isDisable" style="margin-right: 10px" @click="btnCheck('appro', 'delete', record, index)">删除</a>
2025-12-24 17:38:00 +08:00
</template>
</template>
</a-table>
</a-card>
</a-form>
</div>
<deptUserModal @register="register" @success="handleSuccess"/>
<deptListModal @register="registerDept" @success="handleSuccessDept" />
2025-12-25 17:51:53 +08:00
<approListModal @register="registerAppro" @success="handleSuccessAppro" />
2025-12-26 17:37:06 +08:00
<contractFactUserModal @register="registerUser" @success="handleSuccessUser" />
2025-12-24 17:38:00 +08:00
</a-spin>
</template>
<script lang="ts" setup>
import { useRouter } from 'vue-router';
import { FromPageType, RecordType } from '/@/enums/workflowEnum';
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent, watch} from 'vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
import useEventBus from '/@/hooks/event/useEventBus';
import type { Rule } from 'ant-design-vue/es/form';
import { getDictionary } from '/@/api/sales/Customer';
import { useModal } from '/@/components/Modal';
2025-12-26 17:37:06 +08:00
import { addLngContractFact,updateLngContractFact,getAllCurrency,getAllUser, getLngContractFact } from '/@/api/contract/ContractFact';
2025-12-25 17:51:53 +08:00
import { getLngAppro,getCompDept } from '/@/api/approve/Appro';
2025-12-24 17:38:00 +08:00
import dayjs from 'dayjs';
import { getAppEnvConfig } from '/@/utils/env';
import { message } from 'ant-design-vue';
import UploadList from '/@/components/Form/src/components/UploadList.vue';
import deptUserModal from '/@/components/common/deptUserModal.vue';
import deptListModal from '/@/components/common/deptListModal.vue';
2025-12-25 17:51:53 +08:00
import approListModal from '/@/components/common/approListModal.vue';
2025-12-26 17:37:06 +08:00
import contractFactUserModal from '/@/components/common/contractFactUserModal.vue';
import { amountToChinese } from '/@/utils/amountToChinese';
import { parseDownloadUrl} from '/@/api/system/file';
import { downloadByUrl } from '/@/utils/file/download';
2025-12-24 17:38:00 +08:00
import { Modal } from 'ant-design-vue';
import { useUserStore } from '/@/store/modules/user';
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const tableName = 'ContractFact';
const columnName = 'ContractFact'
const formType = ref('2'); // 0 新建 1 修改 2 查看
const formRef = ref();
const props = defineProps({
disabled: false,
id: ''
});
const { bus, FORM_LIST_MODIFIED } = useEventBus();
const router = useRouter();
const { currentRoute } = router;
const isDisable = ref(false);
const { formPath } = currentRoute.value.query;
const pathArr = [];
const tabStore = useMultipleTabStore();
const formProps = ref(null);
const formId = ref(currentRoute.value?.params?.id);
const pageType = ref(currentRoute.value.query?.type);
const pageId = ref(currentRoute.value.query?.id)
const spinning = ref(false);
const curIdx = ref(null)
const { notification } = useMessage();
const { t } = useI18n();
const formState = reactive({
2025-12-25 17:51:53 +08:00
approCode: 'WTJ',
dateDraft: dayjs(new Date()),
2025-12-24 17:38:00 +08:00
});
const [register, { openModal:openModal}] = useModal();
const [registerDept, { openModal:openModalDept}] = useModal();
2025-12-25 17:51:53 +08:00
const [registerAppro, { openModal:openModalAppro}] = useModal();
2025-12-26 17:37:06 +08:00
const [registerUser, { openModal:openModalUser}] = useModal();
const rules= reactive({
2025-12-25 17:51:53 +08:00
kNo: [{ required: true, message: "该项为必填项", trigger: 'change' }],
kName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
relTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
kTypeCode1: [{ required: true, message: "该项为必填项", trigger: 'change' }],
periodTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
cpCount: [{ required: true, message: "该项为必填项", trigger: 'change' }],
amountTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
settleTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
bidSign: [{ required: true, message: "该项为必填项", trigger: 'change' }],
preApproSign: [{ required: true, message: "该项为必填项", trigger: 'change' }],
aheadSign: [{ required: true, message: "该项为必填项", trigger: 'change' }],
tempSign: [{ required: true, message: "该项为必填项", trigger: 'change' }],
impSign: [{ required: true, message: "该项为必填项", trigger: 'change' }],
2025-12-24 17:38:00 +08:00
empName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
2025-12-25 17:51:53 +08:00
tel: [{ required: true, message: "该项为必填项", trigger: 'change' }],
bDeptName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
2025-12-24 17:38:00 +08:00
2025-12-26 17:37:06 +08:00
});
2025-12-24 17:38:00 +08:00
const layout = {
labelCol: { span: 8 },
wrapperCol: { span: 16 },
}
const columns= ref([
{ title: t('序号'), dataIndex: 'index', key: 'index', sorter: true, customRender: (column) => `${column.index + 1}` ,width: 100},
2025-12-25 17:51:53 +08:00
{ title: t('相对方名称'), dataIndex: 'cpName', sorter: true, width:200},
2025-12-26 17:37:06 +08:00
{ title: t('相对方顺序'), dataIndex: 'sort', sorter: true, width: 130},
2025-12-25 17:51:53 +08:00
{ title: t('相对方银行名称'), dataIndex: 'cpBankName', sorter: true, width: 200},
{ title: t('对方银行开户名'), dataIndex: 'cpBankAccountName', sorter: true, width: 300},
2025-12-26 17:37:06 +08:00
{ title: t('对方银行账号'), dataIndex: 'cpBankAccount', sorter: true, width: 200},
{ title: t('对方联系人姓名'), dataIndex: 'contactName', sorter: true, width: 200},
2025-12-25 17:51:53 +08:00
{ title: t('对方联系人电话'), dataIndex: 'contactTel', sorter: true, width: 200},
2025-12-26 17:37:06 +08:00
{ title: t('对方联系人邮箱'), dataIndex: 'contactEmail', sorter: true, width: 200},
2025-12-25 17:51:53 +08:00
{ title: t('对方通讯地址'), dataIndex: 'contactAddress', sorter: true, width: 200},
{ title: t('备注'), dataIndex: 'note', sorter: true, width: 200},
{ title: t('操作'), dataIndex: 'operation', width: 120, fixed: 'right',align: 'center'},
2025-12-24 17:38:00 +08:00
]);
const columnsAppro= ref([
{ title: t('序号'), dataIndex: 'index', key: 'index', sorter: true, customRender: (column) => `${column.index + 1}` ,width: 100},
{ title: t('标题'), dataIndex: 'title', sorter: true, width:100},
{ title: t('编号'), dataIndex: 'code', sorter: true},
{ title: t('签报类型'), dataIndex: 'typeName', sorter: true, width: 140},
{ title: t('拟稿人'), dataIndex: 'empName', sorter: true, width: 140},
2025-12-25 17:51:53 +08:00
{ title: t('拟稿人所属部门'), dataIndex: 'bDeptName', sorter: true, width: 140},
2025-12-24 17:38:00 +08:00
{ title: t('拟稿时间'), dataIndex: 'dateAppro', sorter: true, width: 140},
2025-12-26 17:37:06 +08:00
{ title: t('附件'), dataIndex: 'file', sorter: true, width: 140},
2025-12-25 17:51:53 +08:00
{ title: t('操作'), dataIndex: 'operation', width: 120, fixed: 'right',align: 'center'},
2025-12-24 17:38:00 +08:00
]);
2025-12-26 17:37:06 +08:00
const dataList = ref([])
2025-12-24 17:38:00 +08:00
const dataFile = ref([]);
const dataListAppro = ref([])
let optionSelect= reactive({
approCodeList: [],
typeCodeList: [],
2025-12-25 17:51:53 +08:00
relTypeCodeList: [],
signList: [],
periodTypeCodeList: []
2025-12-24 17:38:00 +08:00
});
watch(
() => props.id,
(val) => {
if (val) {
getInfo(val)
}
},
{
immediate: true
}
);
watch(
() => props.disabled,
(val) => {
isDisable.value = val
2025-12-26 17:37:06 +08:00
if (val) {
let idx = columns.value.findIndex(v =>v.dataIndex == 'operation')
idx>-1 && columns.value.splice(idx, 1)
}
2025-12-24 17:38:00 +08:00
},
{
immediate: true
}
);
onMounted(() => {
getOption()
if (pageId.value) {
getInfo(pageId.value)
} else {
formState.empName = userInfo.name
formState.empId = userInfo.id
2025-12-25 17:51:53 +08:00
formState.tel = userInfo.mobile
2025-12-24 17:38:00 +08:00
}
});
const uploadListChange = (val) => {
dataFile.value = val
}
async function getInfo(id) {
spinning.value = true
try {
2025-12-26 17:37:06 +08:00
let data = await getLngContractFact(id)
2025-12-24 17:38:00 +08:00
spinning.value = false
Object.assign(formState, {...data})
Object.assign(dataFile.value, formState.lngFileUploadList || [])
2025-12-26 17:37:06 +08:00
Object.assign(dataList.value, formState.lngContractFactCpList || [])
Object.assign(dataListAppro.value, formState.lngApproVoList || [])
2025-12-25 17:51:53 +08:00
formState.dateDraft = formState.dateDraft ? dayjs(formState.dateDraft) : null
formState.dateFrom = formState.dateFrom ? dayjs(formState.dateFrom) : null
formState.dateTo = formState.dateTo ? dayjs(formState.dateTo) : null
2025-12-26 17:37:06 +08:00
periodTypeCodeChange(formState.periodTypeCode)
amountTypeCodeChange(formState.amountTypeCode)
2025-12-24 17:38:00 +08:00
} catch (error) {
spinning.value = false
}
}
async function getOption() {
2025-12-25 17:51:53 +08:00
optionSelect.relTypeCodeList = await getDictionary('LNG_K_REL')
optionSelect.kTypeCode1List = await getDictionary('LNG_K_TYP1')
optionSelect.kTypeCode2List = await getDictionary('LNG_K_TYP2')
optionSelect.amountTypeCodeList = await getDictionary('LNG_K_AMT')
optionSelect.settleTypeCodeList = await getDictionary('LNG_K_ST')
optionSelect.periodTypeCodeList = await getDictionary('LNG_K_PER')
optionSelect.signList = await getDictionary('LNG_YNU')
optionSelect.tempSignList = await getDictionary('LNG_YNR')
optionSelect.impSignList = await getDictionary('LNG_YN')
2025-12-24 17:38:00 +08:00
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
2025-12-25 17:51:53 +08:00
optionSelect.curCodeList = await getAllCurrency()
2025-12-26 17:37:06 +08:00
// optionSelect.telList = await getAllUser()
2025-12-25 17:51:53 +08:00
2025-12-24 17:38:00 +08:00
if (!pageId.value) {
const res = await getCompDept(userInfo.id)
2025-12-25 17:51:53 +08:00
formState.bDeptName = res?.dept?.name
2025-12-24 17:38:00 +08:00
formState.bDeptId = res?.dept?.id
formState.comName = res?.comp?.name
formState.comId = res?.comp?.id
}
}
2025-12-26 17:37:06 +08:00
const handleDownload = (info) => {
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : info.fileUrl);
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
downloadByUrl({ url, fileName: fileName});
};
const periodTypeCodeChange = (val) => {
if (val === 'Y') {
rules.dateTo = [{ required: true, message: "该项为必填项", trigger: 'change' }]
rules.dateFrom = [{ required: true, message: "该项为必填项", trigger: 'change' }]
} else {
rules.dateTo = [{ required: false, message: "该项为必填项", trigger: 'change' }]
rules.dateFrom = [{ required: false, message: "该项为必填项", trigger: 'change' }]
}
}
const amountTypeCodeChange = (val) => {
if (val === 'Y') {
rules.curCode = [{ required: true, message: "该项为必填项", trigger: 'change' }]
rules.amount = [{ required: true, message: "该项为必填项", trigger: 'change' }]
} else {
rules.curCode = [{ required: false, message: "该项为必填项", trigger: 'change' }]
rules.amount = [{ required: false, message: "该项为必填项", trigger: 'change' }]
}
}
const amountBlur = (val) => {
if (!val) return
formState.amountCn = amountToChinese(Number(val)*10000)
}
2025-12-25 17:51:53 +08:00
const disabledDateStart = (startValue) => {
const endValue = formState?.dateTo;
if (!startValue || !endValue) {
return false
}
return startValue.valueOf() >= endValue.valueOf();
}
const disabledDateEnd = (endValue) => {
const startValue = formState?.dateFrom;
if (!endValue || !startValue) {
return false
}
return endValue.valueOf() <= startValue.valueOf();
}
2025-12-24 17:38:00 +08:00
const onSearch = (val)=> {
openModalDept(true,{isUpdate: false})
}
const onSearchUser = (val)=> {
openModal(true,{isUpdate: false})
}
2025-12-25 17:51:53 +08:00
const onAppro = (val)=> {
openModalAppro(true,{isUpdate: false})
}
2025-12-26 17:37:06 +08:00
const addUser = (val)=> {
openModalUser(true,{isUpdate: false})
}
2025-12-24 17:38:00 +08:00
const handleSuccess = (val) => {
formState.empName = val[0].name
formState.empId = val[0].id
2025-12-25 17:51:53 +08:00
formState.tel = val[0].mobile
2025-12-24 17:38:00 +08:00
}
const handleSuccessDept = (val, info) => {
2025-12-25 17:51:53 +08:00
formState.bDeptName = val[0].name
2025-12-24 17:38:00 +08:00
formState.bDeptId = val[0].id
formState.comName = info.name
formState.comId = info.id
}
2025-12-25 17:51:53 +08:00
const handleSuccessAppro = (val) =>{
2025-12-26 17:37:06 +08:00
val.forEach(v => {
v.approId = v.id
v.id = null
})
2025-12-25 17:51:53 +08:00
if (!dataListAppro.value.length) {
dataListAppro.value = val
return
}
let arr = []
val.forEach(v => {
dataListAppro.value.forEach(i => {
if (v.code == i.code){
2025-12-26 17:37:06 +08:00
message.warning(v.code + '已重复, 签报不需要重复选择')
2025-12-25 17:51:53 +08:00
} else {
arr.push(v)
}
})
})
dataListAppro.value = unique([...dataListAppro.value, ...arr], 'code')
}
2025-12-26 17:37:06 +08:00
const handleSuccessUser = (val) => {
if (curIdx.value != null) {
dataList.value[curIdx.value] = {...val}
return
}
dataList.value.push({...val})
}
const btnCheck = (type, btn, record, index) => {
curIdx.value = null
if (type == 'cp') {
if (btn == 'delete') {
dataList.value.splice(index, 1)
}
if (btn == 'edit') {
openModalUser(true, {record: record,isUpdate: true});
}
}
// 签报
if (type == 'appro') {
if (btn == 'delete') {
Modal.confirm({
title: '提示信息',
content: '是否取消关联?',
okText: '确认',
cancelText: '取消',
onOk() {
dataListAppro.value.splice(index, 1);
},
onCancel() {}
});
}
if (btn == 'view') {
2025-12-30 17:12:37 +08:00
router.push({
path: '/approve/Appro/form',
query: {
id: record.id || record.approId,
disabled: true
}
})
2025-12-26 17:37:06 +08:00
}
}
}
2025-12-25 17:51:53 +08:00
function unique(arr, u_key) {
const map = new Map()
arr.forEach((item, index) => {
if (!map.has(item[u_key])) {
map.set(item[u_key], item)
}
})
return [...map.values()]
}
2025-12-24 17:38:00 +08:00
function close() {
tabStore.closeTab(currentRoute.value, router);
}
async function getFormValue() {
return formState
}
async function handleSubmit(type) {
try {
await formRef.value.validateFields();
2025-12-26 17:37:06 +08:00
if (Number(formState.cpCount) !== dataList.value.length) {
notification.warning({
message: 'Tip',
description: '相对数量需与相对方信息个数一致'
});
return
}
2025-12-24 17:38:00 +08:00
let obj = {
...formState,
2025-12-26 17:37:06 +08:00
lngFileUploadList: dataFile.value,
lngContractFactCpList: dataList.value,
lngContractApproRelList: dataListAppro.value
2025-12-24 17:38:00 +08:00
}
spinning.value = true;
2025-12-25 17:51:53 +08:00
let request = !formState.id ? addLngContractFact :updateLngContractFact
2025-12-24 17:38:00 +08:00
try {
const data = await request(obj);
// 新增保存
if (data?.id) {
getInfo(data?.id)
}
// 同意保存不提示
if (!type) {
notification.success({
message: 'Tip',
description: data?.id ? t('新增成功!') : t('修改成功!')
}); //提示消息
}
return data?.id ? data : obj
} finally {
spinning.value = false;
}
} catch (errorInfo) {
spinning.value = false;
errorInfo?.errorFields?.length && notification.warning({
message: 'Tip',
description: '请完善信息'
});
return false
}
}
defineExpose({
handleSubmit,
getFormValue
});
</script>
<style lang="less" scoped>
2025-12-25 17:51:53 +08:00
:deep(.ant-form-item .ant-form-item-label) {
width: 135px !important;
max-width: 135px !important;
}
2025-12-24 17:38:00 +08:00
.page-bg-wrap {
background-color: #fff;
}
.top-toolbar {
min-height: 44px;
margin-bottom: 12px;
border-bottom: 1px solid #eee;
}
</style>