feat(crmQuoteInfo): 集成审批功能并优化报价单管理

- 在报价单编辑页集成审批按钮、审批记录和提交验证组件
- 支持提交报价单同时发起审批流程,新增接口quoteSubmitAndFlowStart
- 将付款方式改为下拉选择,使用字典数据payment_method
- 供货方联系人选择改用supplierList,并调整事件处理逻辑
- 报价物料管理增加标准物料标识materialFlag,优化相关字段命名展示
- 报价明细表格隐藏技术ID,展示物料编号与名称字段
- 列表页调整部分列的显示与字段对应,实现更直观显示
- 实现查看详情权限控制,仅非草稿状态允许查看
- 统一处理流程状态字典,支持审批模式禁用表单输入
- 优化导出模板功能,修复文件保存逻辑中的类型兼容问题
- 代码结构及命名优化,重构部分回调函数及表单数据初始化逻辑
dev
zangch@mesnac.com 4 weeks ago
parent ce3d79cd86
commit ceb1b5273b

@ -1,6 +1,6 @@
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios'; import { AxiosPromise } from 'axios';
import { CrmQuoteInfoVO, CrmQuoteInfoForm, CrmQuoteInfoQuery } from '@/api/oa/crm/crmQuoteInfo/types'; import { CrmQuoteInfoForm, CrmQuoteInfoQuery, CrmQuoteInfoVO } from '@/api/oa/crm/crmQuoteInfo/types';
/** /**
* *
@ -73,7 +73,7 @@ export function getCrmQuoteInfoList (query) {
method: 'get', method: 'get',
params: query params: query
}); });
}; }
/** /**
* *
@ -109,14 +109,14 @@ export const exportQuoteTemplate = (quoteId: string | number) => {
}); });
}; };
// /**
// /** *
// * 测试用 * @param data
// */ */
// export const exportQuoteTemplate = (quoteId: string | number) => { export const quoteSubmitAndFlowStart = (data: CrmQuoteInfoForm): AxiosPromise<CrmQuoteInfoVO> => {
// return request({ return request({
// url: '/oa/crm/crmQuoteInfo/testExport' , url: '/oa/crm/crmQuoteInfo/quoteSubmitAndFlowStart',
// method: 'get', method: 'post',
// responseType: 'blob' data: data
// }); });
// }; };

@ -14,6 +14,11 @@ export interface CrmQuoteMaterialVO {
*/ */
itemNo: number; itemNo: number;
/**
* 1 2
*/
materialFlag: string;
/** /**
* / * /
*/ */
@ -34,6 +39,21 @@ export interface CrmQuoteMaterialVO {
*/ */
relationMaterialId: string | number; relationMaterialId: string | number;
/**
* SAP
*/
materialCode: string;
/**
* SAP
*/
materialName: string;
/**
*
*/
saleMaterialName: string;
/** /**
* *
*/ */
@ -97,6 +117,11 @@ export interface CrmQuoteMaterialForm extends BaseEntity {
*/ */
itemNo?: number; itemNo?: number;
/**
* 1 2
*/
materialFlag?: string;
/** /**
* / * /
*/ */
@ -117,6 +142,21 @@ export interface CrmQuoteMaterialForm extends BaseEntity {
*/ */
relationMaterialId?: string | number; relationMaterialId?: string | number;
/**
* SAP
*/
materialCode?: string;
/**
* SAP
*/
materialName?: string;
/**
*
*/
saleMaterialName?: string;
/** /**
* *
*/ */
@ -166,6 +206,11 @@ export interface CrmQuoteMaterialForm extends BaseEntity {
export interface CrmQuoteMaterialQuery extends PageQuery { export interface CrmQuoteMaterialQuery extends PageQuery {
/**
* 1 2
*/
materialFlag?: string;
/** /**
* ID * ID
*/ */

@ -1,5 +1,17 @@
<template> <template>
<div class="p-2"> <div class="p-2">
<el-card shadow="never">
<approvalButton
@submitForm="submitForm"
@approvalVerifyOpen="approvalVerifyOpen"
@handleApprovalRecord="handleApprovalRecord"
:buttonLoading="buttonLoading"
:id="form.quoteId as any"
:status="approvalStatus"
:pageType="pageTypeForButton"
:mode="false"
/>
</el-card>
<el-card shadow="never"> <el-card shadow="never">
<!-- 统一表单包裹所有分区便于整体验证 --> <!-- 统一表单包裹所有分区便于整体验证 -->
<el-form ref="quoteFormRef" :model="form" :rules="rules" label-width="120px" :disabled="isView"> <el-form ref="quoteFormRef" :model="form" :rules="rules" label-width="120px" :disabled="isView">
@ -72,7 +84,9 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="付款方式" prop="paymentMethod"> <el-form-item label="付款方式" prop="paymentMethod">
<el-input v-model="form.paymentMethod" placeholder="请输入付款方式" /> <el-select v-model="form.paymentMethod" placeholder="请选择付款方式">
<el-option v-for="dict in payment_method" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -98,7 +112,12 @@
<el-col :span="12" v-if="false"> <el-col :span="12" v-if="false">
<el-form-item label="客户联系人" prop="customerContactId"> <el-form-item label="客户联系人" prop="customerContactId">
<el-select v-model="form.customerContactId" filterable placeholder="请选择客户联系人" @change="onCustomerContactChanged"> <el-select v-model="form.customerContactId" filterable placeholder="请选择客户联系人" @change="onCustomerContactChanged">
<el-option v-for="c in customerContactList" :key="c.contactId" :label="c.contactName + ' - ' + (c.phoneNumber||'')" :value="c.contactId" /> <el-option
v-for="c in customerContactList"
:key="c.contactId"
:label="c.contactName + ' - ' + (c.phoneNumber || '')"
:value="c.contactId"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 客户方联系电话与邮箱随选择带出可编辑 --> <!-- 客户方联系电话与邮箱随选择带出可编辑 -->
@ -112,8 +131,8 @@
<!-- 原供货方信息块已迁移到供货方信息分区保留以便后续恢复 --> <!-- 原供货方信息块已迁移到供货方信息分区保留以便后续恢复 -->
<el-col :span="12" v-if="false"> <el-col :span="12" v-if="false">
<el-form-item label="供货方联系人" prop="supplierContactId"> <el-form-item label="供货方联系人" prop="supplierContactId">
<el-select v-model="form.supplierContactId" filterable placeholder="请选择供货方联系人" @change="onSupplierContactChanged"> <el-select v-model="form.supplierContactId" filterable placeholder="请选择供货方联系人" @change="onSupplierChanged">
<el-option v-for="c in supplierContactList" :key="c.contactId" :label="c.contactName + ' - ' + (c.phoneNumber||'')" :value="c.contactId" /> <el-option v-for="c in supplierList" :key="c.supplierId" :label="c.supplierName" :value="c.supplierId" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 供货方联系电话与邮箱随选择带出可编辑 --> <!-- 供货方联系电话与邮箱随选择带出可编辑 -->
@ -144,9 +163,9 @@
<el-form ref="materialFormRef" :model="materialForm" :rules="materialRules" label-width="120px"> <el-form ref="materialFormRef" :model="materialForm" :rules="materialRules" label-width="120px">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="计划标识" prop="planFlag"> <el-form-item label="标准物料标识" prop="materialFlag">
<el-radio-group v-model="materialForm.planFlag"> <el-radio-group v-model="materialForm.materialFlag">
<el-radio v-for="dict in plan_flag" :key="dict.value" :value="dict.value">{{ dict.label }}</el-radio> <el-radio v-for="dict in material_flag" :key="dict.value" :value="dict.value">{{ dict.label }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -154,7 +173,7 @@
<el-form-item label="产品名称" prop="productName"> <el-form-item label="产品名称" prop="productName">
<el-input v-model="materialForm.productName" placeholder="请输入产品名称"> <el-input v-model="materialForm.productName" placeholder="请输入产品名称">
<template #suffix> <template #suffix>
<el-icon style="cursor: pointer" v-if="materialForm.planFlag === '1'" @click="openSaleMaterialSelect"> <el-icon style="cursor: pointer" v-if="materialForm.materialFlag === '1'" @click="openSaleMaterialSelect">
<Search /> <Search />
</el-icon> </el-icon>
</template> </template>
@ -168,7 +187,13 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="数量" prop="amount"> <el-form-item label="数量" prop="amount">
<el-input-number v-model="materialForm.amount" placeholder="请输入数量" style="width: 100%" @change="calculateSubtotal" :precision="2" /> <el-input-number
v-model="materialForm.amount"
placeholder="请输入数量"
style="width: 100%"
@change="calculateSubtotal"
:precision="2"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -180,22 +205,51 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="税率(%)" prop="taxRate"> <el-form-item label="税率(%)" prop="taxRate">
<el-input-number v-model="materialForm.taxRate" placeholder="请输入税率" style="width: 100%" @change="calculateBeforePrice" :precision="2" :min="0" :max="100" /> <el-input-number
v-model="materialForm.taxRate"
placeholder="请输入税率"
style="width: 100%"
@change="calculateBeforePrice"
:precision="2"
:min="0"
:max="100"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="未税单价" prop="beforePrice"> <el-form-item label="未税单价" prop="beforePrice">
<el-input-number v-model="materialForm.beforePrice" placeholder="自动计算" style="width: 100%" :precision="2" :controls="false" disabled /> <el-input-number
v-model="materialForm.beforePrice"
placeholder="自动计算"
style="width: 100%"
:precision="2"
:controls="false"
disabled
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="含税单价" prop="includingPrice"> <el-form-item label="含税单价" prop="includingPrice">
<el-input-number v-model="materialForm.includingPrice" placeholder="请输入含税单价" style="width: 100%" :precision="2" @change="calculateBeforePrice" /> <el-input-number
v-model="materialForm.includingPrice"
placeholder="请输入含税单价"
style="width: 100%"
:precision="2"
@change="calculateBeforePrice"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="小计" prop="subtotal"> <el-form-item label="小计" prop="subtotal">
<el-input-number v-model="materialForm.subtotal" placeholder="自动计算" style="width: 100%" readonly :precision="2" :controls="false" disabled /> <el-input-number
v-model="materialForm.subtotal"
placeholder="自动计算"
style="width: 100%"
readonly
:precision="2"
:controls="false"
disabled
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
@ -221,7 +275,12 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="客户联系人" prop="customerContactId"> <el-form-item label="客户联系人" prop="customerContactId">
<el-select v-model="form.customerContactId" filterable placeholder="请选择客户联系人" @change="onCustomerContactChanged"> <el-select v-model="form.customerContactId" filterable placeholder="请选择客户联系人" @change="onCustomerContactChanged">
<el-option v-for="c in customerContactList" :key="c.contactId" :label="c.contactName + ' - ' + (c.phoneNumber||'')" :value="c.contactId" /> <el-option
v-for="c in customerContactList"
:key="c.contactId"
:label="c.contactName + ' - ' + (c.phoneNumber || '')"
:value="c.contactId"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -288,7 +347,7 @@
</el-row> </el-row>
</el-form> </el-form>
<!-- 报价物料管理 --> <!-- 报价物料管理仅展示业务字段不展示技术ID -->
<el-divider content-position="left">报价明细</el-divider> <el-divider content-position="left">报价明细</el-divider>
<el-row :gutter="10" class="mb-3" v-if="!isView"> <el-row :gutter="10" class="mb-3" v-if="!isView">
<el-col :span="1.5"> <el-col :span="1.5">
@ -298,14 +357,15 @@
<el-table :data="materialRows" border show-summary :summary-method="getSummary"> <el-table :data="materialRows" border show-summary :summary-method="getSummary">
<el-table-column label="产品名称" align="center" prop="productName" min-width="160" /> <el-table-column label="产品名称" align="center" prop="productName" min-width="160" />
<el-table-column label="规格描述" align="center" prop="specificationDescription" min-width="160" /> <el-table-column label="规格描述" align="center" prop="specificationDescription" min-width="160" />
<el-table-column label="物料ID" align="center" prop="materialId" width="120" /> <el-table-column label="物料编号" align="center" prop="materialCode" width="140" />
<el-table-column label="销售物料ID" align="center" prop="relationMaterialId" width="140" /> <el-table-column label="物料名称" align="center" prop="materialName" width="160" />
<el-table-column label="销售物料名称" align="center" prop="saleMaterialName" width="160" />
<el-table-column label="数量" align="center" prop="amount" width="120"> <el-table-column label="数量" align="center" prop="amount" width="120">
<template #default="scope"> <template #default="scope">
{{ scope.row.amount ? Number(scope.row.amount).toFixed(2) : '0.00' }} {{ scope.row.amount ? Number(scope.row.amount).toFixed(2) : '0.00' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="单位ID" align="center" prop="unitId" width="120" /> <el-table-column label="单位" align="center" prop="unitName" width="120" />
<el-table-column label="未税单价" align="center" prop="beforePrice" width="140"> <el-table-column label="未税单价" align="center" prop="beforePrice" width="140">
<template #default="scope"> <template #default="scope">
{{ scope.row.beforePrice ? Number(scope.row.beforePrice).toFixed(2) : '0.00' }} {{ scope.row.beforePrice ? Number(scope.row.beforePrice).toFixed(2) : '0.00' }}
@ -336,11 +396,13 @@
</el-table> </el-table>
<div style="margin-top: 16px; padding-top: 12px; border-top: 1px solid #ebeef5; text-align: right"> <div style="margin-top: 16px; padding-top: 12px; border-top: 1px solid #ebeef5; text-align: right">
<span style="margin-right: 20px; font-weight: bold; font-size: 14px">含税总价<span style="color: #f56c6c">{{ totalIncludingTax.toFixed(2) }}</span></span> <span style="margin-right: 20px; font-weight: bold; font-size: 14px">
<el-button v-if="!isView" type="primary" :loading="buttonLoading" @click="submitForm"> </el-button> 含税总价<span style="color: #f56c6c">{{ totalIncludingTax.toFixed(2) }}</span>
<el-button @click="goBack"> </el-button> </span>
</div> </div>
</el-card> </el-card>
<ApprovalRecord ref="approvalRecordRef" />
<SubmitVerify ref="submitVerifyRef" @submit-callback="submitCallback" />
<!-- 附件上传对话框 --> <!-- 附件上传对话框 -->
<el-dialog v-model="dialog.visible" :title="dialog.title" width="500px" append-to-body> <el-dialog v-model="dialog.visible" :title="dialog.title" width="500px" append-to-body>
<el-form label-width="80px"> <el-form label-width="80px">
@ -357,11 +419,12 @@
</template> </template>
</el-dialog> </el-dialog>
</div> </div>

</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { getCrmQuoteInfo, addCrmQuoteInfo, updateCrmQuoteInfo, recalcQuoteTotals } from '@/api/oa/crm/crmQuoteInfo'; import { addCrmQuoteInfo, getCrmQuoteInfo, quoteSubmitAndFlowStart, updateCrmQuoteInfo } from '@/api/oa/crm/crmQuoteInfo';
import { CrmQuoteInfoForm } from '@/api/oa/crm/crmQuoteInfo/types'; import { CrmQuoteInfoForm } from '@/api/oa/crm/crmQuoteInfo/types';
import type { CrmQuoteMaterialForm } from '@/api/oa/crm/crmQuoteMaterial/types'; import type { CrmQuoteMaterialForm } from '@/api/oa/crm/crmQuoteMaterial/types';
import { getBaseMaterialInfoList } from '@/api/oa/base/materialInfo'; import { getBaseMaterialInfoList } from '@/api/oa/base/materialInfo';
@ -370,15 +433,21 @@ import { getCrmSupplierInfoList } from '@/api/oa/crm/crmSupplierInfo';
import { getRuleGenerateCode } from '@/api/system/codeRule'; import { getRuleGenerateCode } from '@/api/system/codeRule';
import { getBaseUnitInfoList } from '@/api/oa/base/unitInfo'; import { getBaseUnitInfoList } from '@/api/oa/base/unitInfo';
import SaleMaterialSelect from '@/components/SaleMaterialSelect/index.vue'; import SaleMaterialSelect from '@/components/SaleMaterialSelect/index.vue';
import ApprovalButton from '@/components/Process/approvalButton.vue';
import ApprovalRecord from '@/components/Process/approvalRecord.vue';
import SubmitVerify from '@/components/Process/submitVerify.vue';
import { FlowCodeEnum } from '@/enums/OAEnum';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { business_direction, currency_type, quote_category, contract_type, plan_flag } = toRefs<any>(proxy?.useDict('business_direction', 'currency_type', 'quote_category', 'contract_type', 'plan_flag')); const { business_direction, currency_type, quote_category, contract_type, material_flag, wf_business_status, payment_method } = toRefs<any>(
proxy?.useDict('business_direction', 'currency_type', 'quote_category', 'contract_type', 'material_flag', 'wf_business_status', 'payment_method')
);
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
// type=view // /type
const isView = computed(() => route.query.type === 'view'); const isView = computed(() => route.query.type === 'view' || route.query.type === 'approval');
const buttonLoading = ref(false); const buttonLoading = ref(false);
const quoteFormRef = ref<ElFormInstance>(); const quoteFormRef = ref<ElFormInstance>();
@ -431,17 +500,44 @@ const getUnitInfoListSelect = async () => {
unitInfoList.value = res.data || []; unitInfoList.value = res.data || [];
}; };
const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>();
const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
const normalizeFlowStatus = (status?: string) => {
if (!status) return 'draft';
const dictList = wf_business_status.value || [];
const match = dictList.find((item: any) => item?.value === status || item?.label === status);
return match?.value || status;
};
const approvalStatus = computed(() => normalizeFlowStatus((form as any).flowStatus as any));
const pageTypeForButton = computed(() => {
const taskId = route.query.taskId as any;
const type = route.query.type as string | undefined;
if (taskId) {
return 'approval';
}
if (type) {
return type;
}
return (form.quoteId ? 'update' : 'add') as string;
});
// //
const materialDialog = reactive({ visible: false, title: '' }); const materialDialog = reactive({ visible: false, title: '' });
const materialFormRef = ref<ElFormInstance>(); const materialFormRef = ref<ElFormInstance>();
const initMaterialFormData: CrmQuoteMaterialForm & { planFlag?: string } = { const initMaterialFormData: CrmQuoteMaterialForm & { materialFlag?: string } = {
quoteMaterialId: undefined, quoteMaterialId: undefined,
planFlag: '2', // 12 materialFlag: '2', // 1 2
quoteId: undefined, quoteId: undefined,
productName: undefined, productName: undefined,
specificationDescription: undefined, specificationDescription: undefined,
materialId: undefined, materialId: undefined,
relationMaterialId: undefined, relationMaterialId: undefined,
materialCode: undefined,
materialName: undefined,
saleMaterialName: undefined,
amount: undefined, amount: undefined,
unitId: undefined, unitId: undefined,
unitName: undefined, unitName: undefined,
@ -452,7 +548,7 @@ const initMaterialFormData: CrmQuoteMaterialForm & { planFlag?: string } = {
remark: undefined, remark: undefined,
activeFlag: '1' activeFlag: '1'
}; };
const materialForm = ref<CrmQuoteMaterialForm & { planFlag?: string }>({ ...initMaterialFormData }); const materialForm = ref<CrmQuoteMaterialForm & { materialFlag?: string }>({ ...initMaterialFormData });
const materialRules = { const materialRules = {
productName: [{ required: true, message: '产品名称不能为空', trigger: 'blur' }], productName: [{ required: true, message: '产品名称不能为空', trigger: 'blur' }],
amount: [{ required: true, message: '数量不能为空', trigger: 'blur' }], amount: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
@ -466,8 +562,13 @@ const saleMaterialSelectCallBack = (data: any) => {
const m = list[0]; const m = list[0];
materialForm.value.materialId = m.materialId; materialForm.value.materialId = m.materialId;
materialForm.value.relationMaterialId = m.relationMaterialId; materialForm.value.relationMaterialId = m.relationMaterialId;
materialForm.value.materialCode = m.materialCode;
materialForm.value.materialName = m.materialName;
materialForm.value.saleMaterialName = m.saleMaterialName;
materialForm.value.productName = m.saleMaterialName || m.materialName; materialForm.value.productName = m.saleMaterialName || m.materialName;
if (m.unitName) materialForm.value.unitName = m.unitName; if (m.unitName) {
materialForm.value.unitName = m.unitName;
}
} }
}; };
const resetMaterialForm = () => { const resetMaterialForm = () => {
@ -502,9 +603,11 @@ const handleAddMaterial = () => {
materialDialog.visible = true; materialDialog.visible = true;
materialDialog.title = '新增报价物料'; materialDialog.title = '新增报价物料';
}; };
const handleEditMaterial = (row: CrmQuoteMaterialForm) => { const handleEditMaterial = (row: CrmQuoteMaterialForm & { materialFlag?: string }) => {
resetMaterialForm(); resetMaterialForm();
materialForm.value = { ...(row as any), planFlag: (row as any).materialId ? '1' : '2' }; // 使 materialFlagID/
const flag = (row as any).materialFlag ?? ((row as any).materialId ? '1' : '2');
materialForm.value = { ...(row as any), materialFlag: flag };
materialDialog.visible = true; materialDialog.visible = true;
materialDialog.title = '编辑报价物料'; materialDialog.title = '编辑报价物料';
}; };
@ -536,7 +639,7 @@ const submitMaterialForm = () => {
// //
const materialRows = ref<CrmQuoteMaterialForm[]>([]); const materialRows = ref<CrmQuoteMaterialForm[]>([]);
const totalIncludingTax = computed(() => { const totalIncludingTax = computed(() => {
return materialRows.value.reduce((sum, r) => sum + (Number(r.subtotal || 0)), 0); return materialRows.value.reduce((sum, r) => sum + Number(r.subtotal || 0), 0);
}); });
// //
const getSummary = (param: any) => { const getSummary = (param: any) => {
@ -561,6 +664,9 @@ const addMaterialRow = () => {
// //
materialRows.value.push({ materialRows.value.push({
materialId: undefined, materialId: undefined,
materialCode: '',
materialName: '',
saleMaterialName: '',
unitId: undefined, unitId: undefined,
unitName: '', unitName: '',
productName: '', productName: '',
@ -575,12 +681,12 @@ const addMaterialRow = () => {
}; };
const removeRow = (idx: number) => materialRows.value.splice(idx, 1); const removeRow = (idx: number) => materialRows.value.splice(idx, 1);
// //
const toNum = (v: any) => (v === '' || v === null || v === undefined) ? undefined : (Number.isFinite(Number(v)) ? Number(v) : undefined); const toNum = (v: any) => (v === '' || v === null || v === undefined ? undefined : Number.isFinite(Number(v)) ? Number(v) : undefined);
const round2 = (n: number) => Math.round(n * 100) / 100; const round2 = (n: number) => Math.round(n * 100) / 100;
// //
const calcIncluding = (before: number, rate: number) => round2(before * (1 + rate / 100)); const calcIncluding = (before: number, rate: number) => round2(before * (1 + rate / 100));
const calcBefore = (including: number, rate: number) => round2(including / (1 + rate / 100)); const calcBefore = (including: number, rate: number) => round2(including / (1 + rate / 100));
const calcRate = (including: number, before: number) => round2(((including / before) - 1) * 100); const calcRate = (including: number, before: number) => round2((including / before - 1) * 100);
// ×+ // ×+
const updateSubtotal = (row: any) => { const updateSubtotal = (row: any) => {
const amount = toNum(row.amount) ?? 0; const amount = toNum(row.amount) ?? 0;
@ -592,7 +698,7 @@ const updateSubtotal = (row: any) => {
inc = calcIncluding(before, rate); inc = calcIncluding(before, rate);
row.includingPrice = inc; // row.includingPrice = inc; //
} }
row.subtotal = (inc !== undefined) ? round2((inc as number) * amount) : 0; row.subtotal = inc !== undefined ? round2((inc as number) * amount) : 0;
}; };
// //
const onAmountChange = (row: any, val: number) => { const onAmountChange = (row: any, val: number) => {
@ -697,13 +803,11 @@ const submitOss = () => {
const cancel = () => { const cancel = () => {
dialog.visible = false; dialog.visible = false;
}; };
const submitForm = (status: string, mode: boolean) => {
const submitForm = () => {
quoteFormRef.value?.validate(async (valid: boolean) => { quoteFormRef.value?.validate(async (valid: boolean) => {
if (!valid) return; if (!valid) return;
buttonLoading.value = true; buttonLoading.value = true;
try { try {
// itemsBo
const payload: any = { const payload: any = {
...form, ...form,
itemsBo: materialRows.value.map((r, idx) => ({ itemsBo: materialRows.value.map((r, idx) => ({
@ -712,20 +816,56 @@ const submitForm = () => {
subtotal: Number(r.subtotal || 0) subtotal: Number(r.subtotal || 0)
})) }))
}; };
if (status === 'draft') {
payload.quoteStatus = '1';
payload.flowStatus = 'draft';
if (!form.quoteId) { if (!form.quoteId) {
await addCrmQuoteInfo(payload); await addCrmQuoteInfo(payload);
} else { } else {
await updateCrmQuoteInfo(payload); await updateCrmQuoteInfo(payload);
} }
proxy?.$modal.msgSuccess('保存成功'); proxy?.$modal.msgSuccess('暂存成功');
router.back(); } else {
payload.flowCode = FlowCodeEnum.QUOTE_CODE; //OACQ
payload.variables = {
quoteId: form.quoteId,
quoteName: form.quoteName,
quoteCode: form.quoteCode,
totalPrice: totalIncludingTax.value
};
payload.bizExt = {
businessTitle: '报价单审批',
businessCode: form.quoteCode
};
payload.quoteStatus = '2';
payload.flowStatus = 'waiting';
const res = await quoteSubmitAndFlowStart(payload);
if (res?.data) {
Object.assign(form, res.data as any);
}
proxy?.$modal.msgSuccess('已提交并发起流程');
}
proxy?.$tab.closePage(route as any);
router.go(-1);
} finally { } finally {
buttonLoading.value = false; buttonLoading.value = false;
} }
}); });
}; };
const approvalVerifyOpen = async () => {
await submitVerifyRef.value?.openDialog(route.query.taskId as any);
};
const goBack = () => router.back(); const handleApprovalRecord = () => {
if (form.quoteId) {
approvalRecordRef.value?.init(form.quoteId as any);
}
};
const submitCallback = async () => {
await proxy?.$tab.closePage(route as any);
router.go(-1);
};
onMounted(async () => { onMounted(async () => {
// //
@ -776,13 +916,16 @@ onMounted(async () => {
itemNo: r.itemNo, itemNo: r.itemNo,
materialId: r.materialId, materialId: r.materialId,
relationMaterialId: r.relationMaterialId, relationMaterialId: r.relationMaterialId,
materialCode: r.materialCode,
materialName: r.materialName,
saleMaterialName: r.saleMaterialName,
unitId: r.unitId, unitId: r.unitId,
unitName: r.unitName, unitName: r.unitName,
productName: r.productName, productName: r.productName,
specificationDescription: r.specificationDescription, specificationDescription: r.specificationDescription,
amount: Number(r.amount ?? 0), amount: Number(r.amount ?? 0),
beforePrice: Number(r.beforePrice ?? 0), beforePrice: Number(r.beforePrice ?? 0),
taxRate: Number(r.taxRate ?? (form.taxRate ?? 0)), taxRate: Number(r.taxRate ?? form.taxRate ?? 0),
includingPrice: Number(r.includingPrice ?? 0), includingPrice: Number(r.includingPrice ?? 0),
subtotal: Number(r.subtotal ?? 0), subtotal: Number(r.subtotal ?? 0),
remark: r.remark remark: r.remark

@ -3,7 +3,7 @@
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave"> <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]"> <div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover"> <el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width='100px'> <el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="100px">
<el-form-item label="报价单号" prop="quoteCode"> <el-form-item label="报价单号" prop="quoteCode">
<el-input v-model="queryParams.quoteCode" placeholder="请输入报价单号" clearable @keyup.enter="handleQuery" /> <el-input v-model="queryParams.quoteCode" placeholder="请输入报价单号" clearable @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
@ -151,16 +151,28 @@
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['oa/crm:crmQuoteInfo:add']"></el-button> <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['oa/crm:crmQuoteInfo:add']"></el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['oa/crm:crmQuoteInfo:edit']"></el-button> <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['oa/crm:crmQuoteInfo:edit']"
>修改</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['oa/crm:crmQuoteInfo:remove']"></el-button> <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['oa/crm:crmQuoteInfo:remove']"
>删除</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['oa/crm:crmQuoteInfo:export']"></el-button> <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['oa/crm:crmQuoteInfo:export']"></el-button>
</el-col> </el-col>
<el-col :span="1.8"> <el-col :span="1.8">
<el-button type="primary" plain icon="Document" :disabled="single" @click="handleExportTemplate()" v-hasPermi="['oa/crm:crmQuoteInfo:exportTemplate']"></el-button> <el-button
type="primary"
plain
icon="Document"
:disabled="single"
@click="handleExportTemplate()"
v-hasPermi="['oa/crm:crmQuoteInfo:export']"
>模板导出</el-button
>
</el-col> </el-col>
<right-toolbar v-model:showSearch="showSearch" :columns="columns" :search="true" @queryTable="getList"></right-toolbar> <right-toolbar v-model:showSearch="showSearch" :columns="columns" :search="true" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@ -187,7 +199,7 @@
<dict-tag :options="business_direction" :value="scope.row.businessDirection" /> <dict-tag :options="business_direction" :value="scope.row.businessDirection" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="部门" align="center" prop="quoteDeptId" v-if="columns[7].visible"/> <el-table-column label="部门" align="center" prop="deptName" v-if="columns[7].visible" />
<el-table-column label="报价日期" align="center" prop="quoteDate" width="180" v-if="columns[8].visible"> <el-table-column label="报价日期" align="center" prop="quoteDate" width="180" v-if="columns[8].visible">
<template #default="scope"> <template #default="scope">
<span>{{ parseTime(scope.row.quoteDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <span>{{ parseTime(scope.row.quoteDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
@ -222,11 +234,11 @@
<el-table-column label="未税总价" align="center" prop="totalBeforeTax" v-if="columns[19].visible" /> <el-table-column label="未税总价" align="center" prop="totalBeforeTax" v-if="columns[19].visible" />
<el-table-column label="税额" align="center" prop="totalTax" v-if="columns[20].visible" /> <el-table-column label="税额" align="center" prop="totalTax" v-if="columns[20].visible" />
<el-table-column label="含税总价" align="center" prop="totalIncludingTax" v-if="columns[21].visible" /> <el-table-column label="含税总价" align="center" prop="totalIncludingTax" v-if="columns[21].visible" />
<el-table-column label="客户方联系人ID" align="center" prop="customerContactId" v-if="columns[22].visible"/> <el-table-column label="客户名称" align="center" prop="customerName" v-if="columns[22].visible" />
<el-table-column label="客户方联系人" align="center" prop="customerContactName" v-if="columns[23].visible" /> <el-table-column label="客户方联系人" align="center" prop="customerContactName" v-if="columns[23].visible" />
<el-table-column label="客户方联系电话" align="center" prop="customerContactPhone" v-if="columns[24].visible" /> <el-table-column label="客户方联系电话" align="center" prop="customerContactPhone" v-if="columns[24].visible" />
<el-table-column label="客户方电子邮箱" align="center" prop="customerContactEmail" v-if="columns[25].visible" /> <el-table-column label="客户方电子邮箱" align="center" prop="customerContactEmail" v-if="columns[25].visible" />
<el-table-column label="供货方ID" align="center" prop="supplierContactId" v-if="columns[26].visible"/> <el-table-column label="供应商名称" align="center" prop="supplierName" v-if="columns[26].visible" />
<el-table-column label="供货方联系人" align="center" prop="supplierContactName" v-if="columns[27].visible" /> <el-table-column label="供货方联系人" align="center" prop="supplierContactName" v-if="columns[27].visible" />
<el-table-column label="供货方联系电话" align="center" prop="supplierContactPhone" v-if="columns[28].visible" /> <el-table-column label="供货方联系电话" align="center" prop="supplierContactPhone" v-if="columns[28].visible" />
<el-table-column label="供货方电子邮箱" align="center" prop="supplierContactEmail" v-if="columns[29].visible" /> <el-table-column label="供货方电子邮箱" align="center" prop="supplierContactEmail" v-if="columns[29].visible" />
@ -240,7 +252,7 @@
</el-table-column> </el-table-column>
<el-table-column label="流程状态" align="center" prop="flowStatus" v-if="columns[34].visible"> <el-table-column label="流程状态" align="center" prop="flowStatus" v-if="columns[34].visible">
<template #default="scope"> <template #default="scope">
<dict-tag :options="flow_status" :value="scope.row.flowStatus"/> <dict-tag :options="wf_business_status" :value="scope.row.flowStatus" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" v-if="columns[35].visible" /> <el-table-column label="备注" align="center" prop="remark" v-if="columns[35].visible" />
@ -252,20 +264,24 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="150" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" fixed="right" width="150" class-name="small-padding fixed-width">
<template #default="scope"> <template #default="scope">
<el-tooltip content="查看" placement="top"> <el-tooltip content="查看详情" placement="top" v-if="canViewDetail(scope.row)">
<el-button link type="info" icon="DocumentChecked" @click="handleView(scope.row)"></el-button> <el-button link type="info" icon="DocumentChecked" @click="handleView(scope.row)"></el-button>
</el-tooltip> </el-tooltip>
<el-tooltip content="修改" placement="top"> <el-tooltip content="修改" placement="top" v-if="scope.row.quoteStatus === '1'">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['oa/crm:crmQuoteInfo:edit']"></el-button> <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['oa/crm:crmQuoteInfo:edit']"></el-button>
</el-tooltip> </el-tooltip>
<el-tooltip content="审批记录(预留)" placement="top"> <!-- 审批记录统一通过编辑页顶部组件查看这里暂不展示 -->
<el-button link type="info" icon="View"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top"> <el-tooltip content="删除" placement="top">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['oa/crm:crmQuoteInfo:remove']"></el-button> <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['oa/crm:crmQuoteInfo:remove']"></el-button>
</el-tooltip> </el-tooltip>
<el-tooltip content="模板导出" placement="top"> <el-tooltip content="模板导出" placement="top">
<el-button link type="warning" icon="Document" @click="handleExportTemplate(scope.row)" v-hasPermi="['oa/crm:crmQuoteInfo:exportTemplate']"></el-button> <el-button
link
type="warning"
icon="Document"
@click="handleExportTemplate(scope.row)"
v-hasPermi="['oa/crm:crmQuoteInfo:exportTemplate']"
></el-button>
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
@ -457,8 +473,8 @@
<script setup name="CrmQuoteInfo" lang="ts"> <script setup name="CrmQuoteInfo" lang="ts">
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { listCrmQuoteInfo, getCrmQuoteInfo, delCrmQuoteInfo, addCrmQuoteInfo, updateCrmQuoteInfo, exportQuoteTemplate } from '@/api/oa/crm/crmQuoteInfo'; import { addCrmQuoteInfo, delCrmQuoteInfo, exportQuoteTemplate, listCrmQuoteInfo, updateCrmQuoteInfo } from '@/api/oa/crm/crmQuoteInfo';
import { CrmQuoteInfoVO, CrmQuoteInfoQuery, CrmQuoteInfoForm } from '@/api/oa/crm/crmQuoteInfo/types'; import { CrmQuoteInfoForm, CrmQuoteInfoQuery, CrmQuoteInfoVO } from '@/api/oa/crm/crmQuoteInfo/types';
import { getCrmCustomerContactList } from '@/api/oa/crm/customerContact'; import { getCrmCustomerContactList } from '@/api/oa/crm/customerContact';
import FileSaver from 'file-saver'; import FileSaver from 'file-saver';
import { blobValidate } from '@/utils/ruoyi'; import { blobValidate } from '@/utils/ruoyi';
@ -466,7 +482,9 @@ import { blobValidate } from '@/utils/ruoyi';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
const { business_direction, currency_type, quote_category, payment_method, quote_status, flow_status, contract_type } = toRefs<any>(proxy?.useDict('business_direction', 'currency_type', 'quote_category', 'payment_method', 'quote_status', 'flow_status', 'contract_type')); const { business_direction, currency_type, quote_category, payment_method, quote_status, wf_business_status, contract_type } = toRefs<any>(
proxy?.useDict('business_direction', 'currency_type', 'quote_category', 'payment_method', 'quote_status', 'wf_business_status', 'contract_type')
);
const crmQuoteInfoList = ref<CrmQuoteInfoVO[]>([]); const crmQuoteInfoList = ref<CrmQuoteInfoVO[]>([]);
const buttonLoading = ref(false); const buttonLoading = ref(false);
@ -491,10 +509,10 @@ const columns = ref<FieldOption[]>([
{ key: 1, label: `报价单号`, visible: true }, { key: 1, label: `报价单号`, visible: true },
{ key: 2, label: `报价单名称`, visible: true }, { key: 2, label: `报价单名称`, visible: true },
{ key: 3, label: `报价轮次`, visible: false }, { key: 3, label: `报价轮次`, visible: false },
{ key: 4, label: `报价大类`, visible: false }, { key: 4, label: `报价大类`, visible: true },
{ key: 5, label: `报价类型`, visible: false }, { key: 5, label: `报价类型`, visible: true },
{ key: 6, label: `业务方向`, visible: false }, { key: 6, label: `业务方向`, visible: true },
{ key: 7, label: `部门`, visible: false }, { key: 7, label: `部门`, visible: true },
{ key: 8, label: `报价日期`, visible: true }, { key: 8, label: `报价日期`, visible: true },
{ key: 9, label: `报价有效期起`, visible: true }, { key: 9, label: `报价有效期起`, visible: true },
{ key: 10, label: `报价有效期`, visible: false }, { key: 10, label: `报价有效期`, visible: false },
@ -505,26 +523,26 @@ const columns = ref<FieldOption[]>([
{ key: 15, label: `币种`, visible: false }, { key: 15, label: `币种`, visible: false },
{ key: 16, label: `含税信息`, visible: false }, { key: 16, label: `含税信息`, visible: false },
{ key: 17, label: `税率(默认按明细可覆盖)`, visible: false }, { key: 17, label: `税率(默认按明细可覆盖)`, visible: false },
{ key: 18, label: `总报价`, visible: false }, { key: 18, label: `总报价`, visible: true },
{ key: 19, label: `未税总价`, visible: false }, { key: 19, label: `未税总价`, visible: false },
{ key: 20, label: `税额`, visible: false }, { key: 20, label: `税额`, visible: false },
{ key: 21, label: `含税总价`, visible: true }, { key: 21, label: `含税总价`, visible: true },
{ key: 22, label: `客户方联系人ID`, visible: false }, { key: 22, label: `客户名称`, visible: true },
{ key: 23, label: `客户方联系人`, visible: false }, { key: 23, label: `客户方联系人`, visible: false },
{ key: 24, label: `客户方联系电话`, visible: false }, { key: 24, label: `客户方联系电话`, visible: false },
{ key: 25, label: `客户方电子邮箱`, visible: false }, { key: 25, label: `客户方电子邮箱`, visible: false },
{ key: 26, label: `货方ID`, visible: false }, { key: 26, label: `应商名称`, visible: false },
{ key: 27, label: `供货方联系人`, visible: false }, { key: 27, label: `供货方联系人`, visible: false },
{ key: 28, label: `供货方联系电话`, visible: false }, { key: 28, label: `供货方联系电话`, visible: false },
{ key: 29, label: `供货方电子邮箱`, visible: false }, { key: 29, label: `供货方电子邮箱`, visible: false },
{ key: 30, label: `项目ID(可选)`, visible: false }, { key: 30, label: `项目ID(可选)`, visible: false },
{ key: 31, label: `打印模板ID(可选)`, visible: false }, { key: 31, label: `打印模板ID(可选)`, visible: false },
{ key: 32, label: `附件ID`, visible: false }, { key: 32, label: `附件ID`, visible: false },
{ key: 33, label: `报价单状态`, visible: false }, { key: 33, label: `报价单状态`, visible: true },
{ key: 34, label: `流程状态`, visible: false }, { key: 34, label: `流程状态`, visible: true },
{ key: 35, label: `备注`, visible: true }, { key: 35, label: `备注`, visible: true },
{ key: 36, label: `创建人`, visible: true }, { key: 36, label: `创建人`, visible: true },
{ key: 37, label: `创建时间`, visible: true }, { key: 37, label: `创建时间`, visible: true }
// //
]); ]);
@ -565,8 +583,8 @@ const initFormData: CrmQuoteInfoForm = {
quoteStatus: undefined, quoteStatus: undefined,
flowStatus: undefined, flowStatus: undefined,
remark: undefined, remark: undefined,
createName: undefined, createName: undefined
} };
const data = reactive<PageData<CrmQuoteInfoForm, CrmQuoteInfoQuery>>({ const data = reactive<PageData<CrmQuoteInfoForm, CrmQuoteInfoQuery>>({
form: { ...initFormData }, form: { ...initFormData },
queryParams: { queryParams: {
@ -607,13 +625,10 @@ const data = reactive<PageData<CrmQuoteInfoForm, CrmQuoteInfoQuery>>({
quoteStatus: undefined, quoteStatus: undefined,
flowStatus: undefined, flowStatus: undefined,
createName: undefined, createName: undefined,
params: { params: {}
}
}, },
rules: { rules: {
quoteId: [ quoteId: [{ required: true, message: '报价ID不能为空', trigger: 'blur' }]
{ required: true, message: "报价ID不能为空", trigger: "blur" }
],
} }
}); });
@ -626,38 +641,38 @@ const getList = async () => {
crmQuoteInfoList.value = res.rows; crmQuoteInfoList.value = res.rows;
total.value = res.total; total.value = res.total;
loading.value = false; loading.value = false;
} };
/** 取消按钮 */ /** 取消按钮 */
const cancel = () => { const cancel = () => {
reset(); reset();
dialog.visible = false; dialog.visible = false;
} };
/** 表单重置 */ /** 表单重置 */
const reset = () => { const reset = () => {
form.value = { ...initFormData }; form.value = { ...initFormData };
crmQuoteInfoFormRef.value?.resetFields(); crmQuoteInfoFormRef.value?.resetFields();
} };
/** 搜索按钮操作 */ /** 搜索按钮操作 */
const handleQuery = () => { const handleQuery = () => {
queryParams.value.pageNum = 1; queryParams.value.pageNum = 1;
getList(); getList();
} };
/** 重置按钮操作 */ /** 重置按钮操作 */
const resetQuery = () => { const resetQuery = () => {
queryFormRef.value?.resetFields(); queryFormRef.value?.resetFields();
handleQuery(); handleQuery();
} };
/** 多选框选中数据 */ /** 多选框选中数据 */
const handleSelectionChange = (selection: CrmQuoteInfoVO[]) => { const handleSelectionChange = (selection: CrmQuoteInfoVO[]) => {
ids.value = selection.map(item => item.quoteId); ids.value = selection.map((item) => item.quoteId);
single.value = selection.length != 1; single.value = selection.length != 1;
multiple.value = !selection.length; multiple.value = !selection.length;
} };
/** 新增按钮操作(改为路由跳转到编辑页) */ /** 新增按钮操作(改为路由跳转到编辑页) */
const handleAdd = () => { const handleAdd = () => {
@ -666,7 +681,7 @@ const handleAdd = () => {
path: '/oa/crm/crmQuoteInfo/edit', path: '/oa/crm/crmQuoteInfo/edit',
query: { type: 'add' } query: { type: 'add' }
}); });
} };
/** 修改按钮操作(改为路由跳转到编辑页) */ /** 修改按钮操作(改为路由跳转到编辑页) */
const handleUpdate = (row?: CrmQuoteInfoVO) => { const handleUpdate = (row?: CrmQuoteInfoVO) => {
@ -676,7 +691,7 @@ const handleUpdate = (row?: CrmQuoteInfoVO) => {
path: '/oa/crm/crmQuoteInfo/edit', path: '/oa/crm/crmQuoteInfo/edit',
query: { id: _quoteId, type: 'update' } query: { id: _quoteId, type: 'update' }
}); });
} };
/** 查看按钮操作(查看模式只读) */ /** 查看按钮操作(查看模式只读) */
const handleView = (row?: CrmQuoteInfoVO) => { const handleView = (row?: CrmQuoteInfoVO) => {
@ -686,7 +701,12 @@ const handleView = (row?: CrmQuoteInfoVO) => {
path: '/oa/crm/crmQuoteInfo/edit', path: '/oa/crm/crmQuoteInfo/edit',
query: { id: _quoteId, type: 'view' } query: { id: _quoteId, type: 'view' }
}); });
} };
/** 判断是否可以查看详情:仅非草稿状态可进入查看页 */
const canViewDetail = (row: CrmQuoteInfoVO) => {
return row.quoteStatus !== '1';
};
/** 提交按钮 */ /** 提交按钮 */
const submitForm = () => { const submitForm = () => {
@ -694,32 +714,36 @@ const submitForm = () => {
if (valid) { if (valid) {
buttonLoading.value = true; buttonLoading.value = true;
if (form.value.quoteId) { if (form.value.quoteId) {
await updateCrmQuoteInfo(form.value).finally(() => buttonLoading.value = false); await updateCrmQuoteInfo(form.value).finally(() => (buttonLoading.value = false));
} else { } else {
await addCrmQuoteInfo(form.value).finally(() => buttonLoading.value = false); await addCrmQuoteInfo(form.value).finally(() => (buttonLoading.value = false));
} }
proxy?.$modal.msgSuccess("操作成功"); proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false; dialog.visible = false;
await getList(); await getList();
} }
}); });
} };
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (row?: CrmQuoteInfoVO) => { const handleDelete = async (row?: CrmQuoteInfoVO) => {
const _quoteIds = row?.quoteId || ids.value; const _quoteIds = row?.quoteId || ids.value;
await proxy?.$modal.confirm('是否确认删除报价单信息编号为"' + _quoteIds + '"的数据项?').finally(() => loading.value = false); await proxy?.$modal.confirm('是否确认删除报价单信息编号为"' + _quoteIds + '"的数据项?').finally(() => (loading.value = false));
await delCrmQuoteInfo(_quoteIds); await delCrmQuoteInfo(_quoteIds);
proxy?.$modal.msgSuccess("删除成功"); proxy?.$modal.msgSuccess('删除成功');
await getList(); await getList();
} };
/** 导出按钮操作 */ /** 导出按钮操作 */
const handleExport = () => { const handleExport = () => {
proxy?.download('oa/crm/crmQuoteInfo/export', { proxy?.download(
'oa/crm/crmQuoteInfo/export',
{
...queryParams.value ...queryParams.value
}, `crmQuoteInfo_${new Date().getTime()}.xlsx`) },
} `crmQuoteInfo_${new Date().getTime()}.xlsx`
);
};
/** 模板导出支持选中或行内按钮GET Blob 下载) */ /** 模板导出支持选中或行内按钮GET Blob 下载) */
const handleExportTemplate = async (row?: CrmQuoteInfoVO) => { const handleExportTemplate = async (row?: CrmQuoteInfoVO) => {
@ -729,12 +753,13 @@ const handleExportTemplate = async (row?: CrmQuoteInfoVO) => {
return; return;
} }
try { try {
const resp: Blob = await exportQuoteTemplate(_quoteId); const resp = await exportQuoteTemplate(_quoteId);
// JSON // JSON
if (blobValidate(resp)) { if (blobValidate(resp as any)) {
FileSaver.saveAs(resp, `报价单_${new Date().getTime()}.xlsx`); const blob = resp as any;
FileSaver.saveAs(blob as Blob, `报价单_${new Date().getTime()}.xlsx`);
} else { } else {
const resText = await resp.text(); const resText = await (resp as any).text();
const rspObj = JSON.parse(resText); const rspObj = JSON.parse(resText);
proxy?.$modal.msgError(rspObj.msg || '导出失败'); proxy?.$modal.msgError(rspObj.msg || '导出失败');
} }
@ -742,13 +767,13 @@ const handleExportTemplate = async (row?: CrmQuoteInfoVO) => {
console.error(e); console.error(e);
proxy?.$modal.msgError('导出失败,请联系管理员'); proxy?.$modal.msgError('导出失败,请联系管理员');
} }
} };
let crmCustomerContactList = ref([]); let crmCustomerContactList = ref([]);
const getCustomerContactList = async () => { const getCustomerContactList = async () => {
const res = await getCrmCustomerContactList(null); const res = await getCrmCustomerContactList(null);
crmCustomerContactList.value = res.data; crmCustomerContactList.value = res.data;
} };
onMounted(() => { onMounted(() => {
getCustomerContactList(); getCustomerContactList();
getList(); getList();

Loading…
Cancel
Save