提交
This commit is contained in:
1 parent
70bdd820ce
commit
bede140d12
988 files changed
+692310
-775910
No files matched your search
@@ -66,8 +66,8 @@
|
||||
<el-icon><EditPen /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedRows.length === 1 && selectedRows[0]?.level === 1"
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1 || selectedRows[0]?.level !== 1"
|
||||
:loading="loadingMap.rowAddChild"
|
||||
@click="handleToolbarAddChild"
|
||||
>
|
||||
|
||||
@@ -773,18 +773,22 @@
|
||||
</el-dialog>
|
||||
<!-- 生成合同对话框 -->
|
||||
<el-dialog
|
||||
:title="isPreviewMode ? '预览合同' : '编辑合同'"
|
||||
v-model="generateContractDialog.visible"
|
||||
width="1200px"
|
||||
align-center
|
||||
append-to-body
|
||||
class="dialog-form-layout"
|
||||
class="dialog-form-layout generate-print-dialog"
|
||||
modal-class="order-module-dialog-mask"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<p v-if="!isPreviewMode" class="generate-contract-edit-hint">
|
||||
编辑模式:鼠标移入表格后,列/行边界会出现绿色调整条,按住拖动即可调列宽或行高;工具栏可合并拆分、插删行列、对齐与换行。调整后请点「保存模板」。
|
||||
</p>
|
||||
<template #header>
|
||||
<div class="generate-print-dialog-header">
|
||||
<span class="generate-print-dialog-title">{{ isPreviewMode ? '预览合同' : '编辑合同' }}</span>
|
||||
<p v-if="!isPreviewMode" class="generate-print-dialog-edit-hint">
|
||||
编辑模式:鼠标移入表格后,列/行边界会出现绿色调整条,按住拖动即可调列宽或行高;工具栏可合并拆分、插删行列、对齐与换行。调整后请点「保存模板」。
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
<TinyMceEditor
|
||||
v-model="contractContent"
|
||||
:height="600"
|
||||
@@ -803,6 +807,12 @@
|
||||
<el-button class="btn-ghost" @click="handleSaveTemplate">
|
||||
<el-icon><DocumentChecked /></el-icon>保存模板
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="toggleRedSeal">
|
||||
<el-icon>
|
||||
<component :is="showRedSeal ? Hide : Stamp" />
|
||||
</el-icon>
|
||||
{{ showRedSeal ? '隐藏红章' : '显示红章' }}
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handlePrintContract">
|
||||
<el-icon><Printer /></el-icon>打印
|
||||
</el-button>
|
||||
@@ -842,10 +852,12 @@ import {
|
||||
DocumentChecked,
|
||||
Download,
|
||||
Edit,
|
||||
Hide,
|
||||
InfoFilled,
|
||||
Plus,
|
||||
Printer,
|
||||
Promotion,
|
||||
Stamp,
|
||||
Upload,
|
||||
VideoPlay,
|
||||
View,
|
||||
@@ -939,6 +951,8 @@ const generateContractDialog = reactive({
|
||||
});
|
||||
const contractContent = ref('');
|
||||
const isPreviewMode = ref(false);
|
||||
/** 打印弹窗内红章显隐(仅本次弹窗有效,打开时默认显示) */
|
||||
const showRedSeal = ref(true);
|
||||
const pdfGenerating = ref(false);
|
||||
const currentContractId = ref<string | number>();
|
||||
|
||||
@@ -1309,8 +1323,9 @@ const handleDetailPrint = async () => {
|
||||
console.error('替换占位符失败,使用原始内容:', replaceError);
|
||||
}
|
||||
|
||||
// 先设置内容,再打开对话框
|
||||
// 先设置内容,再打开对话框(每次打开默认显示红章)
|
||||
contractContent.value = htmlContent;
|
||||
showRedSeal.value = true;
|
||||
|
||||
// 关闭加载提示
|
||||
$modal.closeLoading();
|
||||
@@ -2551,6 +2566,80 @@ const replaceDynamicFields = (template: string, contractData: ContractVO): strin
|
||||
return result;
|
||||
};
|
||||
|
||||
const SEAL_IMG_RE = /<img[^>]*alt=["']印章["'][^>]*>/gi;
|
||||
|
||||
const getSupplierCodeFromContractNo = (contractNo?: string): string => {
|
||||
if (!contractNo) return 'SX';
|
||||
const match = contractNo.match(/^([A-Z]+)\/X-JT/);
|
||||
return match?.[1] || 'SX';
|
||||
};
|
||||
|
||||
const resolveSealImageByCompanyName = (companyName: string | undefined, supplierCode: string): string => {
|
||||
if (!companyName) return '';
|
||||
if (companyName.includes('云栋') || companyName.includes('安徽云栋化工有限公司')) {
|
||||
return '/src/assets/images/yd.png';
|
||||
}
|
||||
if (companyName.includes('山峡') || companyName.includes('安庆市山峡化工有限公司')) {
|
||||
return supplierCode === 'SX' ? '/src/assets/images/yz.png' : '/src/assets/images/yd.png';
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
const buildSealHtml = (companyName: string | undefined, supplierCode: string): string => {
|
||||
const sealSrc = resolveSealImageByCompanyName(companyName, supplierCode);
|
||||
if (!sealSrc) return '';
|
||||
return `<img src="${sealSrc}" alt="印章" style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 140px; height: 140px; opacity: 0.85; z-index: 10;" />`;
|
||||
};
|
||||
|
||||
const stripSealImages = (html: string): string => html.replace(SEAL_IMG_RE, '');
|
||||
|
||||
const injectSealImages = (html: string, contractData: ContractVO): string => {
|
||||
let result = stripSealImages(html);
|
||||
const supplierCode = getSupplierCodeFromContractNo(contractData.contractNo);
|
||||
const partyASeal = buildSealHtml(contractData.partyA, supplierCode);
|
||||
const partyBSeal = buildSealHtml(contractData.partyB, supplierCode);
|
||||
|
||||
if (/<!--\s*印章图片[^>]*-->/.test(result)) {
|
||||
let sealCommentIndex = 0;
|
||||
return result.replace(/<!--\s*印章图片[^>]*-->/g, (match) => {
|
||||
sealCommentIndex += 1;
|
||||
if (sealCommentIndex === 1) return `${match}\n ${partyASeal}`;
|
||||
if (sealCommentIndex === 2) return `${match}\n ${partyBSeal}`;
|
||||
return match;
|
||||
});
|
||||
}
|
||||
|
||||
const escapeRegExp = (value: string) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
if (partyASeal && contractData.partyA) {
|
||||
const escaped = escapeRegExp(contractData.partyA);
|
||||
result = result.replace(
|
||||
new RegExp(`(<div[^>]*>单位名称(章):\\s*${escaped}</div>)`),
|
||||
`${partyASeal}\n $1`
|
||||
);
|
||||
}
|
||||
if (partyBSeal && contractData.partyB) {
|
||||
const escaped = escapeRegExp(contractData.partyB);
|
||||
result = result.replace(
|
||||
new RegExp(`(<div[^>]*>单位名称(章):\\s*${escaped}</div>)`),
|
||||
`${partyBSeal}\n $1`
|
||||
);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/** 切换红章显示/隐藏(同步影响编辑器、打印、PDF) */
|
||||
const toggleRedSeal = () => {
|
||||
if (showRedSeal.value) {
|
||||
contractContent.value = stripSealImages(contractContent.value);
|
||||
showRedSeal.value = false;
|
||||
return;
|
||||
}
|
||||
if (detailContract.value) {
|
||||
contractContent.value = injectSealImages(contractContent.value, detailContract.value);
|
||||
}
|
||||
showRedSeal.value = true;
|
||||
};
|
||||
|
||||
/** 切换预览/编辑模式 */
|
||||
const togglePreviewMode = () => {
|
||||
isPreviewMode.value = !isPreviewMode.value;
|
||||
@@ -2970,15 +3059,33 @@ onMounted(async () => {
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.generate-contract-edit-hint {
|
||||
margin: 0 0 12px;
|
||||
padding: 8px 12px;
|
||||
.generate-print-dialog-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
width: 100%;
|
||||
min-height: 24px;
|
||||
padding-right: 28px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.generate-print-dialog-title {
|
||||
flex-shrink: 0;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
line-height: 24px;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.generate-print-dialog-edit-hint {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
color: #047857;
|
||||
background: #ecfdf5;
|
||||
border: 1px solid #a7f3d0;
|
||||
border-radius: 8px;
|
||||
font-weight: 400;
|
||||
line-height: 1.4;
|
||||
color: #ef4444;
|
||||
}
|
||||
|
||||
.parties-section {
|
||||
|
||||
@@ -470,7 +470,12 @@
|
||||
</template>
|
||||
|
||||
<!-- 产品选择器 -->
|
||||
<ProductSelector :visible="productSelectorVisible" @update:visible="productSelectorVisible = $event" @confirm="handleProductSelected" />
|
||||
<ProductSelector
|
||||
:visible="productSelectorVisible"
|
||||
:supplier-id="form.supplierId"
|
||||
@update:visible="productSelectorVisible = $event"
|
||||
@confirm="handleProductSelected"
|
||||
/>
|
||||
|
||||
<!-- 客户选择器 -->
|
||||
<CustomerSelector :visible="customerSelectorVisible" @update:visible="customerSelectorVisible = $event" @confirm="handleCustomerConfirm" />
|
||||
@@ -540,6 +545,7 @@ import ProductSelector from './ProductSelector.vue'
|
||||
import CustomerSelector from '@/components/CustomerSelector.vue'
|
||||
import ContactSelector from '@/components/ContactSelector.vue'
|
||||
import QuoteSelector from '@/components/QuoteSelector.vue'
|
||||
import { removeProductsNotAllowedByHazard } from '@/utils/crm-supplier-hazard'
|
||||
import ApprovalDialog from './ApprovalDialog.vue'
|
||||
import { getContactByCustomerId } from '@/api/crm/customer'
|
||||
import type { CustomerVO, ContactVO } from '@/api/crm/customer/types'
|
||||
@@ -882,6 +888,8 @@ const loadContractDetail = async (id: number | string) => {
|
||||
form.value.products = contractData.products.map((product: any) => ({
|
||||
...product,
|
||||
productModel: product.model || '',
|
||||
isToxic: Number(product.isToxic || 0),
|
||||
isExplosive: Number(product.isExplosive || 0),
|
||||
priceTiers: (product.priceTiers || []).map((t: any) => {
|
||||
let ids: string[] = []
|
||||
if (Array.isArray(t.letterOssIds) && t.letterOssIds.length) {
|
||||
@@ -1241,6 +1249,20 @@ const handleSupplierChange = async (supplierId: number | undefined) => {
|
||||
|
||||
updateContractNoBySupplier(supplier.supplierCode)
|
||||
rebuildContractName()
|
||||
|
||||
const allowToxic = Number((supplier as any).allowToxic || 0)
|
||||
const allowExplosive = Number((supplier as any).allowExplosive || 0)
|
||||
const { kept, removedNames } = removeProductsNotAllowedByHazard(
|
||||
form.value.products || [],
|
||||
allowToxic,
|
||||
allowExplosive
|
||||
)
|
||||
form.value.products = kept
|
||||
if (removedNames.length) {
|
||||
$modal.msgWarning(`当前主体不支持以下产品,已自动移除:${removedNames.join('、')}`)
|
||||
form.value.products.forEach((p) => calculateProductAmount(p))
|
||||
calculateTotalAmount()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1457,6 +1479,10 @@ const handleSignDateChange = (val: string | null) => {
|
||||
|
||||
/** 添加产品 */
|
||||
const handleAddProduct = () => {
|
||||
if (!form.value.supplierId) {
|
||||
$modal.msgWarning('请先选择交易主体')
|
||||
return
|
||||
}
|
||||
productSelectorVisible.value = true
|
||||
}
|
||||
|
||||
@@ -1480,6 +1506,8 @@ const handleProductSelected = (products: any[]) => {
|
||||
deliveryMethod: '',
|
||||
description: product.description || '',
|
||||
remark: '',
|
||||
isToxic: Number(product.isToxic || 0),
|
||||
isExplosive: Number(product.isExplosive || 0),
|
||||
priceTiers: isFw ? [] : undefined
|
||||
})
|
||||
})
|
||||
|
||||
@@ -155,7 +155,8 @@ interface ProductCategoryVO {
|
||||
|
||||
// 定义组件属性
|
||||
interface Props {
|
||||
visible: boolean;
|
||||
visible: boolean
|
||||
supplierId?: string | number
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
@@ -216,7 +217,8 @@ const getList = async () => {
|
||||
pageSize: queryParams.value.pageSize,
|
||||
keyword: queryParams.value.productName,
|
||||
categoryId: queryParams.value.categoryId,
|
||||
status: queryParams.value.status
|
||||
status: queryParams.value.status,
|
||||
supplierId: props.supplierId != null && props.supplierId !== '' ? String(props.supplierId) : undefined
|
||||
});
|
||||
const data = (res as any)?.data || res || {};
|
||||
productList.value = data.list || data.rows || [];
|
||||
|
||||
@@ -978,21 +978,32 @@
|
||||
|
||||
<!-- 生成合同对话框 -->
|
||||
<el-dialog
|
||||
:title="isPreviewMode ? '预览合同' : '编辑合同'"
|
||||
v-model="generateContractDialog.visible"
|
||||
width="1200px"
|
||||
append-to-body
|
||||
class="generate-print-dialog"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<p v-if="!isPreviewMode" class="generate-contract-edit-hint">
|
||||
编辑模式:鼠标移入表格后,列/行边界会出现绿色调整条,按住拖动即可调列宽或行高;工具栏可合并拆分、插删行列、对齐与换行。调整后请点「保存模板」。
|
||||
</p>
|
||||
<template #header>
|
||||
<div class="generate-print-dialog-header">
|
||||
<span class="generate-print-dialog-title">{{ isPreviewMode ? '预览合同' : '编辑合同' }}</span>
|
||||
<p v-if="!isPreviewMode" class="generate-print-dialog-edit-hint">
|
||||
编辑模式:鼠标移入表格后,列/行边界会出现绿色调整条,按住拖动即可调列宽或行高;工具栏可合并拆分、插删行列、对齐与换行。调整后请点「保存模板」。
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
<TinyMceEditor v-model="contractContent" :height="600" :disabled="isPreviewMode" :toolbar="!isPreviewMode" :contractNo="contract?.contractNo" />
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="generateContractDialog.visible = false">关 闭</el-button>
|
||||
<el-button v-if="hasContractPerm('edit')" type="info" icon="View" @click="togglePreviewMode">{{ isPreviewMode ? '编辑模式' : '预览模式' }}</el-button>
|
||||
<el-button v-if="hasContractPerm('edit')" type="warning" icon="DocumentChecked" @click="handleSaveTemplate">保存模板</el-button>
|
||||
<el-button v-if="hasContractPerm('print')" @click="toggleRedSeal">
|
||||
<el-icon>
|
||||
<component :is="showRedSeal ? Hide : Stamp" />
|
||||
</el-icon>
|
||||
{{ showRedSeal ? '隐藏红章' : '显示红章' }}
|
||||
</el-button>
|
||||
<el-button v-if="hasContractPerm('print')" type="success" icon="Printer" @click="handlePrintContract">打印</el-button>
|
||||
<el-button v-if="hasContractPerm('print')" type="primary" icon="Download" @click="handleGeneratePdfFile" :loading="pdfGenerating">生成PDF</el-button>
|
||||
</div>
|
||||
@@ -1012,7 +1023,7 @@ import { $modal } from '@/utils/modal';
|
||||
import { useDictStore } from '@/store/modules/dict';
|
||||
import DictTag from '@/components/DictTag/index.vue';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { CircleCheck, CircleClose, View, ChatLineSquare, Clock, InfoFilled, VideoPlay, Document, Paperclip, Download, Back, Edit, Delete, Promotion, Printer } from '@element-plus/icons-vue';
|
||||
import { CircleCheck, CircleClose, View, ChatLineSquare, Clock, InfoFilled, VideoPlay, Document, Paperclip, Download, Back, Edit, Delete, Promotion, Printer, Hide, Stamp } from '@element-plus/icons-vue';
|
||||
import ApprovalDialog from './components/ApprovalDialog.vue';
|
||||
import ExecuteDialog from './components/ExecuteDialog.vue';
|
||||
import InvalidDialog from './components/InvalidDialog.vue';
|
||||
@@ -1085,6 +1096,8 @@ const generateContractDialog = reactive({
|
||||
});
|
||||
const contractContent = ref('');
|
||||
const isPreviewMode = ref(false);
|
||||
/** 打印弹窗内红章显隐(仅本次弹窗有效,打开时默认显示) */
|
||||
const showRedSeal = ref(true);
|
||||
const pdfGenerating = ref(false);
|
||||
|
||||
/** 加载合同详情 */
|
||||
@@ -2071,8 +2084,9 @@ const handlePrint = async () => {
|
||||
htmlContent = generateContractTemplate(contract.value);
|
||||
}
|
||||
|
||||
// 先设置内容,再打开对话框
|
||||
// 先设置内容,再打开对话框(每次打开默认显示红章)
|
||||
contractContent.value = htmlContent;
|
||||
showRedSeal.value = true;
|
||||
|
||||
// 关闭加载提示
|
||||
$modal.closeLoading();
|
||||
@@ -2529,6 +2543,80 @@ const handleDownloadHtml = () => {
|
||||
};
|
||||
|
||||
/** 切换预览/编辑模式 */
|
||||
const SEAL_IMG_RE = /<img[^>]*alt=["']印章["'][^>]*>/gi;
|
||||
|
||||
const getSupplierCodeFromContractNo = (contractNo?: string): string => {
|
||||
if (!contractNo) return 'SX';
|
||||
const match = contractNo.match(/^([A-Z]+)\/X-JT/);
|
||||
return match?.[1] || 'SX';
|
||||
};
|
||||
|
||||
const resolveSealImageByCompanyName = (companyName: string | undefined, supplierCode: string): string => {
|
||||
if (!companyName) return '';
|
||||
if (companyName.includes('云栋') || companyName.includes('安徽云栋化工有限公司')) {
|
||||
return '/src/assets/images/yd.png';
|
||||
}
|
||||
if (companyName.includes('山峡') || companyName.includes('安庆市山峡化工有限公司')) {
|
||||
return supplierCode === 'SX' ? '/src/assets/images/yz.png' : '/src/assets/images/yd.png';
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
const buildSealHtml = (companyName: string | undefined, supplierCode: string): string => {
|
||||
const sealSrc = resolveSealImageByCompanyName(companyName, supplierCode);
|
||||
if (!sealSrc) return '';
|
||||
return `<img src="${sealSrc}" alt="印章" style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 140px; height: 140px; opacity: 0.85; z-index: 10;" />`;
|
||||
};
|
||||
|
||||
const stripSealImages = (html: string): string => html.replace(SEAL_IMG_RE, '');
|
||||
|
||||
const injectSealImages = (html: string, contractData: ContractVO): string => {
|
||||
let result = stripSealImages(html);
|
||||
const supplierCode = getSupplierCodeFromContractNo(contractData.contractNo);
|
||||
const partyASeal = buildSealHtml(contractData.partyA, supplierCode);
|
||||
const partyBSeal = buildSealHtml(contractData.partyB, supplierCode);
|
||||
|
||||
if (/<!--\s*印章图片[^>]*-->/.test(result)) {
|
||||
let sealCommentIndex = 0;
|
||||
return result.replace(/<!--\s*印章图片[^>]*-->/g, (match) => {
|
||||
sealCommentIndex += 1;
|
||||
if (sealCommentIndex === 1) return `${match}\n ${partyASeal}`;
|
||||
if (sealCommentIndex === 2) return `${match}\n ${partyBSeal}`;
|
||||
return match;
|
||||
});
|
||||
}
|
||||
|
||||
const escapeRegExp = (value: string) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
if (partyASeal && contractData.partyA) {
|
||||
const escaped = escapeRegExp(contractData.partyA);
|
||||
result = result.replace(
|
||||
new RegExp(`(<div[^>]*>单位名称(章):\\s*${escaped}</div>)`),
|
||||
`${partyASeal}\n $1`
|
||||
);
|
||||
}
|
||||
if (partyBSeal && contractData.partyB) {
|
||||
const escaped = escapeRegExp(contractData.partyB);
|
||||
result = result.replace(
|
||||
new RegExp(`(<div[^>]*>单位名称(章):\\s*${escaped}</div>)`),
|
||||
`${partyBSeal}\n $1`
|
||||
);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/** 切换红章显示/隐藏(同步影响编辑器、打印、PDF) */
|
||||
const toggleRedSeal = () => {
|
||||
if (showRedSeal.value) {
|
||||
contractContent.value = stripSealImages(contractContent.value);
|
||||
showRedSeal.value = false;
|
||||
return;
|
||||
}
|
||||
if (contract.value) {
|
||||
contractContent.value = injectSealImages(contractContent.value, contract.value);
|
||||
}
|
||||
showRedSeal.value = true;
|
||||
};
|
||||
|
||||
const togglePreviewMode = () => {
|
||||
isPreviewMode.value = !isPreviewMode.value;
|
||||
};
|
||||
@@ -3035,14 +3123,32 @@ const handleGeneratePdfFile = async () => {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.generate-contract-edit-hint {
|
||||
margin: 0 0 12px;
|
||||
padding: 8px 12px;
|
||||
.generate-print-dialog-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
width: 100%;
|
||||
min-height: 24px;
|
||||
padding-right: 28px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.generate-print-dialog-title {
|
||||
flex-shrink: 0;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
line-height: 24px;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.generate-print-dialog-edit-hint {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
color: #047857;
|
||||
background: #ecfdf5;
|
||||
border: 1px solid #a7f3d0;
|
||||
border-radius: 8px;
|
||||
font-weight: 400;
|
||||
line-height: 1.4;
|
||||
color: #ef4444;
|
||||
}
|
||||
</style>
|
||||
@@ -536,7 +536,12 @@
|
||||
</section>
|
||||
|
||||
<!-- 产品选择器 -->
|
||||
<ProductSelector :visible="productSelectorVisible" @update:visible="productSelectorVisible = $event" @confirm="handleProductSelected" />
|
||||
<ProductSelector
|
||||
:visible="productSelectorVisible"
|
||||
:supplier-id="form.supplierId"
|
||||
@update:visible="productSelectorVisible = $event"
|
||||
@confirm="handleProductSelected"
|
||||
/>
|
||||
|
||||
<!-- 客户选择器 -->
|
||||
<CustomerSelector :visible="customerSelectorVisible" @update:visible="customerSelectorVisible = $event" @confirm="handleCustomerConfirm" />
|
||||
@@ -601,6 +606,7 @@ import type { CustomerVO, ContactVO } from '@/api/crm/customer/types';
|
||||
import { getDefaultInvoiceInfoByCustomerId } from '@/api/crm/invoiceInfo';
|
||||
import { listAllSupplierInfo, type SupplierInfoVO } from '@/api/crm/supplierInfo';
|
||||
import { useContractPerm } from '@/hooks/business/useContractPerm';
|
||||
import { removeProductsNotAllowedByHazard } from '@/utils/crm-supplier-hazard';
|
||||
|
||||
interface UserVO {
|
||||
userId: string | number
|
||||
@@ -847,6 +853,8 @@ const loadContractDetail = async (id: number | string) => {
|
||||
form.value.products = contractData.products.map((product: any) => ({
|
||||
...product,
|
||||
productModel: product.model || '',
|
||||
isToxic: Number(product.isToxic || 0),
|
||||
isExplosive: Number(product.isExplosive || 0),
|
||||
priceTiers: (product.priceTiers || []).map((t: any) => {
|
||||
let ids: string[] = [];
|
||||
if (Array.isArray(t.letterOssIds) && t.letterOssIds.length) {
|
||||
@@ -1270,6 +1278,20 @@ const handleSupplierChange = async (supplierId: number | undefined) => {
|
||||
|
||||
// 更新合同名称中的供方简称
|
||||
updateContractNameBySupplier(supplier.shortName);
|
||||
|
||||
const allowToxic = Number((supplier as any).allowToxic || 0);
|
||||
const allowExplosive = Number((supplier as any).allowExplosive || 0);
|
||||
const { kept, removedNames } = removeProductsNotAllowedByHazard(
|
||||
form.value.products || [],
|
||||
allowToxic,
|
||||
allowExplosive
|
||||
);
|
||||
form.value.products = kept;
|
||||
if (removedNames.length) {
|
||||
$modal.msgWarning(`当前主体不支持以下产品,已自动移除:${removedNames.join('、')}`);
|
||||
form.value.products.forEach((p) => calculateProductAmount(p));
|
||||
calculateTotalAmount();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1668,6 +1690,10 @@ const handleSignDateChange = (val: string | null) => {
|
||||
|
||||
/** 添加产品 */
|
||||
const handleAddProduct = () => {
|
||||
if (!form.value.supplierId) {
|
||||
$modal.msgWarning('请先选择交易主体');
|
||||
return;
|
||||
}
|
||||
productSelectorVisible.value = true;
|
||||
};
|
||||
|
||||
@@ -1692,6 +1718,8 @@ const handleProductSelected = (products: any[]) => {
|
||||
deliveryMethod: '',
|
||||
description: product.description || '',
|
||||
remark: '',
|
||||
isToxic: Number(product.isToxic || 0),
|
||||
isExplosive: Number(product.isExplosive || 0),
|
||||
priceTiers: isFw ? [] : undefined
|
||||
});
|
||||
});
|
||||
|
||||
@@ -138,7 +138,8 @@ import { fetchProductList, fetchCategoryTree } from '@/api/crm/product';
|
||||
|
||||
// 定义组件属性
|
||||
interface Props {
|
||||
visible: boolean;
|
||||
visible: boolean
|
||||
supplierId?: string | number
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
@@ -199,7 +200,8 @@ const getList = async () => {
|
||||
pageSize: queryParams.value.pageSize,
|
||||
keyword: queryParams.value.productName,
|
||||
categoryId: queryParams.value.categoryId,
|
||||
status: queryParams.value.status
|
||||
status: queryParams.value.status,
|
||||
supplierId: props.supplierId != null && props.supplierId !== '' ? String(props.supplierId) : undefined
|
||||
});
|
||||
const data = (res as any)?.data || res || {};
|
||||
productList.value = data.list || data.rows || [];
|
||||
|
||||
@@ -367,7 +367,12 @@
|
||||
</el-form>
|
||||
|
||||
<!-- 产品选择器对话框 -->
|
||||
<ProductSelector :visible="productSelectorVisible" @update:visible="productSelectorVisible = $event" @confirm="handleProductConfirm" />
|
||||
<ProductSelector
|
||||
:visible="productSelectorVisible"
|
||||
:supplier-id="form.supplierId"
|
||||
@update:visible="productSelectorVisible = $event"
|
||||
@confirm="handleProductConfirm"
|
||||
/>
|
||||
|
||||
<!-- 客户选择器 -->
|
||||
<CustomerSelector :visible="customerSelectorVisible" @update:visible="customerSelectorVisible = $event" @confirm="handleCustomerConfirm" />
|
||||
@@ -471,6 +476,7 @@ import OpportunitySelector from '@/components/OpportunitySelector.vue';
|
||||
import { fetchUserOptions } from '@/api/admin';
|
||||
import { fetchContactsByCustomerId } from '@/api/crm/contact';
|
||||
import { listAllSupplierInfo, type SupplierInfoVO } from '@/api/crm/supplierInfo';
|
||||
import { removeProductsNotAllowedByHazard } from '@/utils/crm-supplier-hazard'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -789,7 +795,9 @@ const getQuoteInfo = async (id: string | number) => {
|
||||
taxRate: parseFloat(item.taxRate || '13'), // 税率(%)
|
||||
packageSpec: item.packageSpec || '', // 包装规格
|
||||
deliveryMethod: item.deliveryMethod || '', // 送货方式
|
||||
description: item.description
|
||||
description: item.description,
|
||||
isToxic: Number(item.isToxic || 0),
|
||||
isExplosive: Number(item.isExplosive || 0)
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -868,7 +876,9 @@ const getQuoteInfoForCopy = async (copyId: string | number) => {
|
||||
taxRate: parseFloat(item.taxRate || '13'), // 税率(%)
|
||||
packageSpec: item.packageSpec || '', // 包装规格
|
||||
deliveryMethod: item.deliveryMethod || '', // 送货方式
|
||||
description: item.description
|
||||
description: item.description,
|
||||
isToxic: Number(item.isToxic || 0),
|
||||
isExplosive: Number(item.isExplosive || 0)
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -1127,11 +1137,26 @@ const handleSupplierChange = (supplierId: number | undefined) => {
|
||||
form.value.supplierId = supplier.id;
|
||||
form.value.supplierName = supplier.supplierName || '';
|
||||
updateQuoteTitleAndNo();
|
||||
const allowToxic = Number((supplier as any).allowToxic || 0)
|
||||
const allowExplosive = Number((supplier as any).allowExplosive || 0)
|
||||
const { kept, removedNames } = removeProductsNotAllowedByHazard(
|
||||
form.value.products || [],
|
||||
allowToxic,
|
||||
allowExplosive
|
||||
)
|
||||
form.value.products = kept
|
||||
if (removedNames.length) {
|
||||
$modal.msgWarning(`当前主体不支持以下产品,已自动移除:${removedNames.join('、')}`)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** 添加产品 */
|
||||
const handleAddProduct = () => {
|
||||
if (!form.value.supplierId) {
|
||||
$modal.msgWarning('请先选择报价主体')
|
||||
return
|
||||
}
|
||||
productSelectorVisible.value = true;
|
||||
};
|
||||
|
||||
@@ -1152,7 +1177,9 @@ const handleProductConfirm = (products: any[]) => {
|
||||
taxAmount: 0,
|
||||
subtotal: 0,
|
||||
packageSpec: '',
|
||||
deliveryMethod: ''
|
||||
deliveryMethod: '',
|
||||
isToxic: Number(product.isToxic || 0),
|
||||
isExplosive: Number(product.isExplosive || 0)
|
||||
};
|
||||
form.value.products?.push(productForm);
|
||||
});
|
||||
|
||||
@@ -535,14 +535,21 @@
|
||||
<!-- 生成报价单对话框 -->
|
||||
<el-dialog
|
||||
v-model="generateQuoteDialog.visible"
|
||||
:title="isPreviewMode ? '预览报价单' : '编辑报价单'"
|
||||
width="1200px"
|
||||
align-center
|
||||
append-to-body
|
||||
class="dialog-form-layout"
|
||||
class="dialog-form-layout generate-print-dialog"
|
||||
modal-class="order-module-dialog-mask"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<template #header>
|
||||
<div class="generate-print-dialog-header">
|
||||
<span class="generate-print-dialog-title">{{ isPreviewMode ? '预览报价单' : '编辑报价单' }}</span>
|
||||
<p v-if="!isPreviewMode" class="generate-print-dialog-edit-hint">
|
||||
编辑模式:鼠标移入表格后,列/行边界会出现绿色调整条,按住拖动即可调列宽或行高;工具栏可合并拆分、插删行列、对齐与换行。调整后请点「保存模板」。
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
<TinyMceEditor v-model="quoteContent" :height="600" :disabled="isPreviewMode" :toolbar="!isPreviewMode" :supplier-code="currentSupplierCode" />
|
||||
<template #footer>
|
||||
<div class="generate-quote-dialog-actions">
|
||||
@@ -552,6 +559,12 @@
|
||||
<el-button class="btn-ghost" @click="handleSaveTemplate">
|
||||
<el-icon><DocumentChecked /></el-icon>保存模板
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="toggleRedSeal">
|
||||
<el-icon>
|
||||
<component :is="showRedSeal ? Hide : Stamp" />
|
||||
</el-icon>
|
||||
{{ showRedSeal ? '隐藏红章' : '显示红章' }}
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handlePrint">
|
||||
<el-icon><Printer /></el-icon>打印
|
||||
</el-button>
|
||||
@@ -723,11 +736,13 @@ import {
|
||||
DocumentCopy,
|
||||
Download,
|
||||
Edit,
|
||||
Hide,
|
||||
Plus,
|
||||
Printer,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
Select
|
||||
Select,
|
||||
Stamp
|
||||
} from '@element-plus/icons-vue'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
const dictStore = useDictStore()
|
||||
@@ -1084,6 +1099,8 @@ const generateQuoteDialog = reactive({
|
||||
});
|
||||
const quoteContent = ref('');
|
||||
const isPreviewMode = ref(false);
|
||||
/** 打印弹窗内红章显隐(仅本次弹窗有效,打开时默认显示) */
|
||||
const showRedSeal = ref(true);
|
||||
const pdfGenerating = ref(false);
|
||||
const currentQuoteId = ref<string | number>(); // 当前报价单ID,用于保存模板
|
||||
const currentSupplierCode = ref<string>('SX'); // 当前供应商编码,用于控制背景图片和Logo显示
|
||||
@@ -2085,8 +2102,9 @@ const handleGenerateQuote = async (row?: QuoteVO) => {
|
||||
|
||||
console.log('HTML内容预览:', htmlContent.substring(0, 200));
|
||||
|
||||
// 先设置内容,再打开对话框
|
||||
// 先设置内容,再打开对话框(每次打开默认显示红章)
|
||||
quoteContent.value = htmlContent;
|
||||
showRedSeal.value = true;
|
||||
console.log('quoteContent已设置');
|
||||
|
||||
// 关闭加载提示
|
||||
@@ -2102,6 +2120,41 @@ const handleGenerateQuote = async (row?: QuoteVO) => {
|
||||
}
|
||||
};
|
||||
|
||||
const SEAL_IMG_RE = /<img[^>]*alt=["']印章["'][^>]*>/gi;
|
||||
|
||||
const QUOTE_SEAL_IMG_STYLE =
|
||||
'position: absolute; left: 50%; top: calc(50% - 50px); transform: translate(-50%, -50%); width: 120px; max-width: 120px; max-height: 120px; height: auto; object-fit: contain; z-index: 10; pointer-events: none; opacity: 0.9;';
|
||||
|
||||
const buildQuoteSealHtml = (supplierCode: string): string => {
|
||||
const sealImg = supplierCode === 'SX' ? yzImg : supplierCode === 'YD' ? ydImg : null;
|
||||
if (!sealImg) return '';
|
||||
return `<img src="${sealImg}" alt="印章" style="${QUOTE_SEAL_IMG_STYLE}" />`;
|
||||
};
|
||||
|
||||
const stripSealImages = (html: string): string => html.replace(SEAL_IMG_RE, '');
|
||||
|
||||
const injectQuoteSealImages = (html: string, supplierCode: string): string => {
|
||||
let result = stripSealImages(html);
|
||||
const sealHtml = buildQuoteSealHtml(supplierCode);
|
||||
if (!sealHtml) return result;
|
||||
// 印章落在「送货方式」表头内;兼容 TinyMCE 改写后的空白/换行
|
||||
if (/<th[^>]*>[\s\S]*?送货方式[\s\S]*?<\/th>/i.test(result)) {
|
||||
result = result.replace(/(<th[^>]*>[\s\S]*?送货方式)([\s\S]*?)(<\/th>)/i, `$1$2${sealHtml}$3`);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/** 切换红章显示/隐藏(同步影响编辑器、打印、PDF) */
|
||||
const toggleRedSeal = () => {
|
||||
if (showRedSeal.value) {
|
||||
quoteContent.value = stripSealImages(quoteContent.value);
|
||||
showRedSeal.value = false;
|
||||
return;
|
||||
}
|
||||
quoteContent.value = injectQuoteSealImages(quoteContent.value, currentSupplierCode.value);
|
||||
showRedSeal.value = true;
|
||||
};
|
||||
|
||||
/** 打印报价单 */
|
||||
const handlePrint = () => {
|
||||
// 根据供应商编码决定是否显示背景图片
|
||||
@@ -2742,4 +2795,33 @@ onMounted(() => {
|
||||
background-color: var(--mint-table-head, #f8fafc);
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.generate-print-dialog-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
width: 100%;
|
||||
min-height: 24px;
|
||||
padding-right: 28px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.generate-print-dialog-title {
|
||||
flex-shrink: 0;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
line-height: 24px;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.generate-print-dialog-edit-hint {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
line-height: 1.4;
|
||||
color: #ef4444;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,177 @@
|
||||
<!-- 主体危化品能力配置 P01 -->
|
||||
<template>
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2 class="title-bar-heading">主体危化品能力</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
<el-form :model="searchForm" class="filter-form" @submit.prevent>
|
||||
<div class="filter-grid">
|
||||
<el-form-item label="主体名称">
|
||||
<el-input
|
||||
v-model="searchForm.supplierName"
|
||||
placeholder="请输入主体名称"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">配置报价主体/交易主体是否允许易制毒、易制爆产品。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset">
|
||||
<el-icon><RefreshLeft /></el-icon>重置
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch">
|
||||
<el-icon><Search /></el-icon>搜索
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table v-loading="loading" :data="tableData" class="list-table" stripe>
|
||||
<el-table-column prop="supplierName" label="主体名称" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="supplierCode" label="编码" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column label="允许易制毒" min-width="120" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
:model-value="Number(row.allowToxic || 0) === 1"
|
||||
:disabled="!canEdit || savingId === String(row.id)"
|
||||
:loading="savingId === String(row.id)"
|
||||
@change="(val: boolean) => handleToggle(row, 'allowToxic', val)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="允许易制爆" min-width="120" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
:model-value="Number(row.allowExplosive || 0) === 1"
|
||||
:disabled="!canEdit || savingId === String(row.id)"
|
||||
:loading="savingId === String(row.id)"
|
||||
@change="(val: boolean) => handleToggle(row, 'allowExplosive', val)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" min-width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.status === '0' ? 'success' : 'info'" size="small">
|
||||
{{ row.status === '0' ? '正常' : '停用' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="updateTime" label="更新时间" min-width="160" show-overflow-tooltip />
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:total="pagination.total"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
background
|
||||
@size-change="loadData"
|
||||
@current-change="loadData"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import {
|
||||
listSupplierInfo,
|
||||
updateSupplierInfo,
|
||||
type SupplierInfoVO
|
||||
} from '@/api/crm/supplierInfo'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
|
||||
defineOptions({ name: 'CrmSupplierHazard' })
|
||||
|
||||
const userStore = useUserStore()
|
||||
const canEdit = computed(() => {
|
||||
const info = userStore.getUserInfo as any
|
||||
const buttons: string[] = info?.buttons || info?.permissions || []
|
||||
if (!Array.isArray(buttons) || buttons.length === 0) return true
|
||||
return (
|
||||
buttons.includes('*:*:*') ||
|
||||
buttons.includes('crm:supplierHazard:edit') ||
|
||||
buttons.includes('crm:supplierHazard:list')
|
||||
)
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
const savingId = ref('')
|
||||
const tableData = ref<SupplierInfoVO[]>([])
|
||||
const searchForm = reactive({
|
||||
supplierName: ''
|
||||
})
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
|
||||
async function loadData() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await listSupplierInfo({
|
||||
pageNum: pagination.page,
|
||||
pageSize: pagination.pageSize,
|
||||
supplierName: searchForm.supplierName || undefined,
|
||||
status: '0'
|
||||
})
|
||||
tableData.value = res.rows || []
|
||||
pagination.total = res.total || 0
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message || '加载失败')
|
||||
tableData.value = []
|
||||
pagination.total = 0
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
searchForm.supplierName = ''
|
||||
handleSearch()
|
||||
}
|
||||
|
||||
async function handleToggle(row: SupplierInfoVO, field: 'allowToxic' | 'allowExplosive', val: boolean) {
|
||||
const next = val ? 1 : 0
|
||||
const prevToxic = Number(row.allowToxic || 0)
|
||||
const prevExplosive = Number(row.allowExplosive || 0)
|
||||
const payload = {
|
||||
id: String(row.id),
|
||||
supplierName: row.supplierName,
|
||||
allowToxic: field === 'allowToxic' ? next : prevToxic,
|
||||
allowExplosive: field === 'allowExplosive' ? next : prevExplosive
|
||||
}
|
||||
savingId.value = String(row.id)
|
||||
try {
|
||||
await updateSupplierInfo(payload)
|
||||
row[field] = next
|
||||
ElMessage.success('已保存')
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message || '保存失败')
|
||||
} finally {
|
||||
savingId.value = ''
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
})
|
||||
</script>
|
||||
@@ -124,17 +124,24 @@
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedRows.length === 1 && selectedRows[0]?.purchasePlanId"
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows[0]?.hasWeighingSlip"
|
||||
:disabled="
|
||||
selectedRows.length !== 1 ||
|
||||
!selectedRows[0]?.purchasePlanId ||
|
||||
!!selectedRows[0]?.hasWeighingSlip
|
||||
"
|
||||
@click="handleGenerateWeighing(selectedRows[0])"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
{{ selectedRows[0]?.hasWeighingSlip ? '已生成地磅单' : '生成地磅单' }}
|
||||
{{
|
||||
selectedRows.length === 1 && selectedRows[0]?.hasWeighingSlip
|
||||
? '已生成地磅单'
|
||||
: '生成地磅单'
|
||||
}}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedRows.length === 1 && selectedRows[0]?.purchasePlanId"
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1 || !selectedRows[0]?.purchasePlanId"
|
||||
@click="handleCopyFillLink(selectedRows[0])"
|
||||
>
|
||||
<el-icon><Link /></el-icon>
|
||||
|
||||
@@ -97,13 +97,13 @@
|
||||
@clear="handleQuickSearchClear"
|
||||
/>
|
||||
<el-button
|
||||
v-if="selectedPlan && selectedPlan.followStatus !== 'cancelled'"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
:disabled="!selectedPlan || selectedPlan.followStatus === 'cancelled'"
|
||||
@click="handleToolbarArchive"
|
||||
>
|
||||
<el-icon><FolderChecked /></el-icon>{{ archiveButtonLabel(selectedPlan) }}
|
||||
<el-icon><FolderChecked /></el-icon>
|
||||
{{ selectedPlan ? archiveButtonLabel(selectedPlan) : '归档' }}
|
||||
</el-button>
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
|
||||
@@ -84,28 +84,57 @@
|
||||
@clear="handleQuickSearchClear"
|
||||
/>
|
||||
<el-button
|
||||
v-if="selectedPlan && canManageCertReady(selectedPlan) && !isHazardCertReady(selectedPlan)"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
:class="
|
||||
selectedPlan &&
|
||||
canManageCertReady(selectedPlan) &&
|
||||
!isHazardCertReady(selectedPlan)
|
||||
? 'btn-main'
|
||||
: 'btn-ghost'
|
||||
"
|
||||
:type="
|
||||
selectedPlan &&
|
||||
canManageCertReady(selectedPlan) &&
|
||||
!isHazardCertReady(selectedPlan)
|
||||
? 'primary'
|
||||
: undefined
|
||||
"
|
||||
:disabled="
|
||||
!selectedPlan ||
|
||||
!canManageCertReady(selectedPlan) ||
|
||||
isHazardCertReady(selectedPlan)
|
||||
"
|
||||
:loading="certReadyLoading"
|
||||
@click="handleToolbarMarkCertReady"
|
||||
>
|
||||
<el-icon><CircleCheck /></el-icon>证书齐备
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedPlan && canUploadCert(selectedPlan)"
|
||||
:class="selectedPlan && canManageCertReady(selectedPlan) && !isHazardCertReady(selectedPlan) ? 'btn-ghost' : 'btn-main'"
|
||||
:type="selectedPlan && canManageCertReady(selectedPlan) && !isHazardCertReady(selectedPlan) ? undefined : 'primary'"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
:class="
|
||||
selectedPlan &&
|
||||
canManageCertReady(selectedPlan) &&
|
||||
!isHazardCertReady(selectedPlan)
|
||||
? 'btn-ghost'
|
||||
: 'btn-main'
|
||||
"
|
||||
:type="
|
||||
selectedPlan &&
|
||||
canManageCertReady(selectedPlan) &&
|
||||
!isHazardCertReady(selectedPlan)
|
||||
? undefined
|
||||
: 'primary'
|
||||
"
|
||||
:disabled="!selectedPlan || !canUploadCert(selectedPlan)"
|
||||
@click="handleToolbarUploadCert"
|
||||
>
|
||||
<el-icon><Upload /></el-icon>上传证书
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedPlan && canManageCertReady(selectedPlan) && isHazardCertReady(selectedPlan)"
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
:disabled="
|
||||
!selectedPlan ||
|
||||
!canManageCertReady(selectedPlan) ||
|
||||
!isHazardCertReady(selectedPlan)
|
||||
"
|
||||
:loading="certReadyLoading"
|
||||
@click="handleToolbarUnmarkCertReady"
|
||||
>
|
||||
|
||||
@@ -242,7 +242,6 @@ const formData = reactive({
|
||||
|
||||
const formRules = {
|
||||
belongsCompany: [{ required: true, message: '请选择归属公司', trigger: 'change' }],
|
||||
planType: [{ required: true, message: '请选择单据类型', trigger: 'change' }],
|
||||
planDate: [{ required: true, message: '请选择计划日期', trigger: 'change' }]
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user