1.1.2 合同信息添加复制按钮(复制合同信息),添加客户名称检索。

dev
yinq 4 weeks ago
parent a499cb57e2
commit 272f74da13

@ -98,3 +98,14 @@ export const exportContractApprovalWord = (contractId: string | number) => {
responseType: 'blob'
});
};
/**
* ErpContractInfoBo contractId IDcontractCodecontractName
*/
export const copyContractInfo = (data: ContractInfoForm): AxiosPromise<ContractInfoVO> => {
return request({
url: '/oa/erp/contractInfo/copy',
method: 'post',
data
});
};

@ -292,6 +292,11 @@ export interface ContractInfoForm extends BaseEntity {
*/
oneCustomerId?: string | number;
/**
*
*/
oneCustomerName?: string;
/**
*
*/
@ -518,6 +523,11 @@ export interface ContractInfoQuery extends PageQuery {
*/
oneCustomerId?: string | number;
/**
*
*/
oneCustomerName?: string;
/**
*
*/

@ -18,6 +18,14 @@
<el-form-item label="合同名称" prop="contractName">
<el-input v-model="queryParams.contractName" placeholder="请输入合同名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="甲方公司名称" prop="oneCustomerName">
<el-input
v-model="queryParams.oneCustomerName"
placeholder="请输入甲方公司名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="合同大类" prop="contractCategory">-->
<!-- <el-select v-model="queryParams.contractCategory" placeholder="请选择合同大类" clearable>-->
<!-- <el-option v-for="dict in contract_category" :key="dict.value" :label="dict.label" :value="dict.value" />-->
@ -75,6 +83,11 @@
>维护合同信息
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="primary" plain icon="DocumentCopy" :disabled="single" @click="openCopyDialog" v-hasPermi="['oa/erp:contractInfo:add']"
>复制合同
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['oa/erp:contractInfo:remove']"
>删除
@ -188,7 +201,7 @@
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="180" fixed="right" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" width="140" fixed="right" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="查看详情" placement="top" v-if="canViewDetail(scope.row)">
<el-button link type="info" icon="DocumentChecked" @click="handleView(scope.row)"></el-button>
@ -235,6 +248,7 @@
<fileUpload v-model="uploadDialog.form.oss" :limit="1" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" :loading="uploadDialog.loading" @click="confirmUploadFinal"> </el-button>
@ -242,6 +256,33 @@
</div>
</template>
</el-dialog>
<!-- 复制合同 -->
<el-dialog v-model="copyDialog.visible" title="复制合同信息" width="560px" append-to-body>
<el-form ref="copyFormRef" :model="copyDialog.form" :rules="copyFormRules" label-width="100px">
<el-form-item label="源合同">
<el-input :model-value="copyDialog.sourceLabel" disabled />
</el-form-item>
<el-form-item label="合同编号" prop="contractCode">
<el-input v-model="copyDialog.form.contractCode" placeholder="请输入或生成合同编号" clearable>
<template #append>
<el-button type="primary" @click="generateCopyContractCode" :disabled="copyCodeGenerated">生成合同编号</el-button>
</template>
</el-input>
</el-form-item>
<el-form-item label="合同名称" prop="contractName">
<el-input v-model="copyDialog.form.contractName" placeholder="请输入新合同名称" clearable />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="copyDialog.form.remark" type="textarea" :rows="3" placeholder="请输入备注" clearable />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" :loading="copyDialog.loading" @click="submitCopy"> </el-button>
<el-button @click="copyDialog.visible = false"> </el-button>
</div>
</template>
</el-dialog>
<!-- 维护合同信息 -->
<el-dialog v-model="maintainDialog.visible" title="维护合同信息" width="600px" append-to-body>
<el-form ref="maintainFormRef" :model="maintainDialog.form" label-width="150px">
@ -287,11 +328,13 @@
</template>
<script setup name="ContractInfo" lang="ts">
import { delContractInfo, exportContractApprovalWord, listContractInfo, updateContractInfo } from '@/api/oa/erp/contractInfo';
import { ContractInfoQuery, ContractInfoVO } from '@/api/oa/erp/contractInfo/types';
import { copyContractInfo, delContractInfo, exportContractApprovalWord, listContractInfo, updateContractInfo } from '@/api/oa/erp/contractInfo';
import { ContractInfoForm, ContractInfoQuery, ContractInfoVO } from '@/api/oa/erp/contractInfo/types';
import download from '@/plugins/download';
import ApprovalRecord from '@/components/Process/approvalRecord.vue';
import { allListDept } from '@/api/system/dept';
import { getRuleGenerateCode } from '@/api/system/codeRule';
import { CodeRuleEnum } from '@/enums/OAEnum';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute();
@ -381,6 +424,7 @@ const data = reactive<{ queryParams: ContractInfoQuery }>({
contractDate: undefined,
totalPrice: undefined,
oneCustomerId: undefined,
oneCustomerName: undefined,
oneRepresent: undefined,
oneDate: undefined,
twoCustomerId: undefined,
@ -415,6 +459,24 @@ const uploadDialog = reactive({
}
});
const copyDialog = reactive({
visible: false,
loading: false,
sourceContractId: undefined as string | number | undefined,
sourceLabel: '' as string,
form: {
contractCode: '' as string,
contractName: '' as string,
remark: '' as string
}
});
const copyCodeGenerated = ref(false);
const copyFormRef = ref<ElFormInstance>();
const copyFormRules = {
contractCode: [{ required: true, message: '合同编号不能为空', trigger: 'blur' }],
contractName: [{ required: true, message: '合同名称不能为空', trigger: 'blur' }]
};
const maintainDialog = reactive({
visible: false,
loading: false,
@ -582,6 +644,58 @@ const openUploadFinalDialog = (row?: ContractInfoVO) => {
nextTick(() => uploadFormRef.value?.clearValidate());
};
const openCopyDialog = () => {
if (selectedRows.value.length !== 1) {
proxy?.$modal.msgWarning('请选择一条要复制的合同');
return;
}
const row = selectedRows.value[0];
copyDialog.sourceContractId = row.contractId;
copyDialog.sourceLabel = `${row.contractCode || ''} ${row.contractName || ''}`.trim() || String(row.contractId);
copyDialog.form.contractCode = '';
copyDialog.form.contractName = '';
copyDialog.form.remark = '';
copyCodeGenerated.value = false;
copyDialog.visible = true;
nextTick(() => copyFormRef.value?.clearValidate());
};
const generateCopyContractCode = async () => {
if (copyCodeGenerated.value) return;
try {
const res = await getRuleGenerateCode({ codeRuleCode: CodeRuleEnum.CONTRACT } as any);
copyDialog.form.contractCode = res.msg;
copyCodeGenerated.value = true;
proxy?.$modal.msgSuccess('合同编号生成成功');
} catch {
proxy?.$modal.msgError('生成合同编号失败');
}
};
const submitCopy = async () => {
try {
await copyFormRef.value?.validate();
} catch {
return;
}
if (!copyDialog.sourceContractId) return;
copyDialog.loading = true;
try {
const copyBo: ContractInfoForm = {
contractId: copyDialog.sourceContractId,
contractCode: copyDialog.form.contractCode.trim(),
contractName: copyDialog.form.contractName.trim(),
remark: copyDialog.form.remark?.trim()
};
await copyContractInfo(copyBo);
proxy?.$modal.msgSuccess('复制成功,新合同为暂存状态');
copyDialog.visible = false;
await getList();
} finally {
copyDialog.loading = false;
}
};
const openMaintainDialog = () => {
if (selectedRows.value.length !== 1) {
proxy?.$modal.msgWarning('请选择一条数据进行维护');

Loading…
Cancel
Save