提交
This commit is contained in:
1 parent
493f8d6756
commit
d84f4b944c
406 files changed
+58954
-10376
No files matched your search
@@ -40,7 +40,8 @@
|
||||
v-if="hasCluePerm('remove')"
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="clueInfo.isConverted === 1"
|
||||
:disabled="clueInfo.isConverted === 1 || !canDeleteByCreator(clueInfo)"
|
||||
:title="canDeleteByCreator(clueInfo) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
@@ -89,7 +90,7 @@
|
||||
}}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="hasCluePerm('follow') && canManageFollow(item)"
|
||||
v-if="hasCluePerm('follow') && canDeleteByCreator(item)"
|
||||
class="follow-actions"
|
||||
>
|
||||
<el-button link type="primary" size="small" @click="handleEditFollow(item)">
|
||||
@@ -148,6 +149,7 @@
|
||||
import type { ClueVO, ClueFollowVO, ClueFollowQuery } from '@/api/crm/clue/types'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { useCluePerm } from '@/hooks/business/useCluePerm'
|
||||
import { canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import ClueForm from './form.vue'
|
||||
import FollowForm from './followForm.vue'
|
||||
@@ -336,11 +338,6 @@
|
||||
clueFormRef.value?.open(clueId.value)
|
||||
}
|
||||
|
||||
const canManageFollow = (item: ClueFollowVO) => {
|
||||
if (!item.createBy) return true
|
||||
return String(item.createBy) === String(currentUserId.value)
|
||||
}
|
||||
|
||||
const handleAddFollow = () => {
|
||||
followFormRef.value?.open(clueId.value)
|
||||
}
|
||||
|
||||
@@ -406,7 +406,8 @@
|
||||
<el-button
|
||||
v-if="hasCluePerm('remove')"
|
||||
class="btn-op-item danger"
|
||||
:disabled="row.isConverted === 1"
|
||||
:disabled="row.isConverted === 1 || !canDeleteByCreator(row)"
|
||||
:title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
@@ -549,6 +550,7 @@
|
||||
import type { UploadFile } from 'element-plus'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { useCluePerm } from '@/hooks/business/useCluePerm'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import {
|
||||
listClue,
|
||||
listMyClue,
|
||||
@@ -823,6 +825,16 @@
|
||||
ElMessage.warning('请至少选择一条数据进行删除')
|
||||
return
|
||||
}
|
||||
const targets = row ? [row] : selectedRows.value
|
||||
const deletable = filterDeletableByCreator(targets)
|
||||
if (!deletable.length) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
if (deletable.length < targets.length) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
await ElMessageBox.confirm('是否确认删除选中的线索?已转化的线索不允许删除。', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<el-button type="primary" icon="Plus" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col v-if="hasContractPerm('changeRemove')" :span="1.5">
|
||||
<el-button type="danger" icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
<el-button type="danger" icon="Delete" :disabled="multiple || !allRowsDeletableByCreator(changeList.filter((item) => ids.includes(item.id)))" :title="allRowsDeletableByCreator(changeList.filter((item) => ids.includes(item.id))) ? '' : CREATOR_DELETE_TIP" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col v-if="hasContractPerm('changeExport')" :span="1.5">
|
||||
<el-button type="success" icon="Download" @click="handleExport">导出</el-button>
|
||||
@@ -135,7 +135,7 @@
|
||||
icon="RefreshLeft"
|
||||
>撤回</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
v-if="hasContractPerm('changeRemove') && scope.row.approvalStatus === 'pending'"
|
||||
v-if="hasContractPerm('changeRemove') && scope.row.approvalStatus === 'pending' && canDeleteByCreator(scope.row)"
|
||||
command="delete"
|
||||
icon="Delete"
|
||||
divided
|
||||
@@ -238,6 +238,7 @@ import { useDictStore } from '@/store/modules/dict'
|
||||
import DictTag from '@/components/DictTag/index.vue'
|
||||
import { $modal } from '@/utils/modal'
|
||||
import { useContractPerm } from '@/hooks/business/useContractPerm'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
|
||||
const router = useRouter()
|
||||
const dictStore = useDictStore()
|
||||
@@ -455,6 +456,16 @@ const submitForm = () => {
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: ChangeVO) => {
|
||||
const targets = row ? [row] : changeList.value.filter((item) => ids.value.includes(item.id))
|
||||
const deletable = filterDeletableByCreator(targets)
|
||||
if (!deletable.length) {
|
||||
$modal.msgWarning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
if (deletable.length < targets.length) {
|
||||
$modal.msgWarning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
const idList = row?.id ? [row.id] : ids.value;
|
||||
await $modal.confirm('是否确认删除选中的变更记录?')
|
||||
await delChange(idList)
|
||||
|
||||
@@ -37,7 +37,11 @@
|
||||
>
|
||||
<el-icon><Edit /></el-icon>修改
|
||||
</el-button>
|
||||
<el-button v-if="hasContractPerm('remove')" class="btn-ghost" @click="handleDetailDelete">
|
||||
<el-button
|
||||
v-if="hasContractPerm('remove') && canDeleteByCreator(detailContract)"
|
||||
class="btn-ghost"
|
||||
@click="handleDetailDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-button
|
||||
@@ -161,19 +165,37 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" prop="quantity" width="110" align="right" />
|
||||
<el-table-column label="含税单价(元)" prop="price" width="130" align="right">
|
||||
<el-table-column
|
||||
v-if="!hideProductPrice"
|
||||
label="含税单价(元)"
|
||||
prop="price"
|
||||
width="130"
|
||||
align="right"
|
||||
>
|
||||
<template #default="scope">
|
||||
<span v-if="detailContract.contractType === 'framework'" class="text-muted">随行就市</span>
|
||||
<span v-else class="money-display">¥{{ parseFloat(scope.row.price || 0).toFixed(2) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="含税总价(元)" prop="subtotal" width="130" align="right">
|
||||
<el-table-column
|
||||
v-if="!hideProductPrice"
|
||||
label="含税总价(元)"
|
||||
prop="subtotal"
|
||||
width="130"
|
||||
align="right"
|
||||
>
|
||||
<template #default="scope">
|
||||
<span v-if="detailContract.contractType === 'framework'" class="text-muted">随行就市</span>
|
||||
<span v-else class="money-display">¥{{ parseFloat(scope.row.subtotal || 0).toFixed(2) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="税费(元)" prop="taxAmount" width="120" align="right">
|
||||
<el-table-column
|
||||
v-if="!hideProductPrice"
|
||||
label="税费(元)"
|
||||
prop="taxAmount"
|
||||
width="120"
|
||||
align="right"
|
||||
>
|
||||
<template #default="scope">
|
||||
<span v-if="detailContract.contractType === 'framework'" class="text-muted">随行就市</span>
|
||||
<span v-else class="money-display">¥{{ parseFloat(scope.row.taxAmount || 0).toFixed(2) }}</span>
|
||||
@@ -198,7 +220,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-if="detailContract.contractType === 'framework'">
|
||||
<template v-if="detailContract.contractType === 'framework' && !hideProductPrice">
|
||||
<el-divider content-position="left">框架合同调价明细</el-divider>
|
||||
<p class="text-muted" style="font-size: 13px; margin-bottom: 12px">按生效区间记录含税单价及调价函;后续结算可据此核对。</p>
|
||||
<div
|
||||
@@ -247,6 +269,7 @@
|
||||
</template>
|
||||
|
||||
<!-- 合计金额 -->
|
||||
<template v-if="!hideProductPrice">
|
||||
<el-divider />
|
||||
<div class="total-section">
|
||||
<el-row :gutter="20">
|
||||
@@ -320,6 +343,7 @@
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</div>
|
||||
<el-empty v-else description="加载中..." />
|
||||
</el-tab-pane>
|
||||
@@ -573,7 +597,7 @@
|
||||
<el-descriptions-item label="完成说明" :span="2">
|
||||
<div class="remark-content">{{ detailContract?.remark || '-' }}</div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="执行情况汇总" :span="2">
|
||||
<el-descriptions-item v-if="!hideProductPrice" label="执行情况汇总" :span="2">
|
||||
<el-row :gutter="20" class="mt-2">
|
||||
<el-col :span="8">
|
||||
<el-statistic title="合同金额(元)" :value="detailContract?.amount || 0" :precision="2" class="money-statistic">
|
||||
@@ -794,6 +818,7 @@ import DictTag from '@/components/DictTag/index.vue';
|
||||
import { $modal } from '@/utils/modal';
|
||||
import { parseTime } from '@/utils/format';
|
||||
import { useContractPerm } from '@/hooks/business/useContractPerm';
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete';
|
||||
import ApprovalDialog from './ApprovalDialog.vue';
|
||||
import ExecuteDialog from './ExecuteDialog.vue';
|
||||
import InvalidDialog from './InvalidDialog.vue';
|
||||
@@ -824,6 +849,15 @@ import {
|
||||
const dictStore = useDictStore();
|
||||
const router = useRouter();
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
hideProductPrice?: boolean
|
||||
}>(),
|
||||
{
|
||||
hideProductPrice: false
|
||||
}
|
||||
)
|
||||
|
||||
const visible = ref(false);
|
||||
const detailLoading = ref(false);
|
||||
const detailActiveTab = ref('contract');
|
||||
@@ -1330,7 +1364,9 @@ const detailBasicViewFields = computed<ViewField[]>(() => {
|
||||
long: false
|
||||
},
|
||||
{ label: '负责人', value: c.ownerUserName },
|
||||
{ label: '合同金额(元)', value: `¥${formatDetailAmount(c.amount)}`, money: true },
|
||||
...(props.hideProductPrice
|
||||
? []
|
||||
: [{ label: '合同金额(元)', value: `¥${formatDetailAmount(c.amount)}`, money: true }]),
|
||||
{ label: '交易主体', value: c.supplierName },
|
||||
detailTagField('结算方式', 'crm_settlement_method', c.settlementMethod)
|
||||
];
|
||||
|
||||
@@ -40,15 +40,6 @@
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="关联商机" prop="opportunityId">
|
||||
<el-input v-model="form.opportunityName" placeholder="请选择商机(可选)" readonly clearable>
|
||||
<template #append>
|
||||
<el-button text @click="handleSelectOpportunity">
|
||||
<el-icon><Search /></el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="关联报价单" prop="quoteId">
|
||||
<el-input v-model="form.quoteNo" placeholder="请选择报价单(可选)" readonly clearable>
|
||||
<template #append>
|
||||
@@ -501,14 +492,6 @@
|
||||
@confirm="handleContactConfirm"
|
||||
/>
|
||||
|
||||
<!-- 商机选择器 -->
|
||||
<OpportunitySelector
|
||||
:visible="opportunitySelectorVisible"
|
||||
@update:visible="opportunitySelectorVisible = $event"
|
||||
:customerId="form.customerId"
|
||||
@confirm="handleOpportunityConfirm"
|
||||
/>
|
||||
|
||||
<!-- 报价单选择器 -->
|
||||
<QuoteSelector
|
||||
:visible="quoteSelectorVisible"
|
||||
@@ -563,7 +546,6 @@ import { getQuote } from '@/api/crm/quote'
|
||||
import ProductSelector from './ProductSelector.vue'
|
||||
import CustomerSelector from '@/components/CustomerSelector.vue'
|
||||
import ContactSelector from '@/components/ContactSelector.vue'
|
||||
import OpportunitySelector from '@/components/OpportunitySelector.vue'
|
||||
import QuoteSelector from '@/components/QuoteSelector.vue'
|
||||
import ApprovalDialog from './ApprovalDialog.vue'
|
||||
import { getContactByCustomerId } from '@/api/crm/customer'
|
||||
|
||||
@@ -28,7 +28,12 @@
|
||||
@click="handleEdit"
|
||||
v-if="hasContractPerm('edit') && contract?.status === 'draft'"
|
||||
>修改</el-button>
|
||||
<el-button type="danger" icon="Delete" @click="handleDelete" v-if="hasContractPerm('remove')">删除</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('remove') && canDeleteByCreator(contract)"
|
||||
type="danger"
|
||||
icon="Delete"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
icon="Promotion"
|
||||
@@ -1021,6 +1026,7 @@ import {
|
||||
downloadCrmAttachment
|
||||
} from '@/utils/crm-attachment';
|
||||
import { useContractPerm } from '@/hooks/business/useContractPerm';
|
||||
import { canDeleteByCreator } from '@/utils/creator-delete';
|
||||
import html2canvas from 'html2canvas';
|
||||
import { jsPDF } from 'jspdf';
|
||||
|
||||
@@ -1225,47 +1231,17 @@ const getOperLogList = async (reload: boolean = false) => {
|
||||
if (!contract.value?.id) return;
|
||||
logLoading.value = true;
|
||||
try {
|
||||
// 如果需要重新加载或者还没有加载过完整数据,则从服务器获取
|
||||
if (reload || operLogListFull.value.length === 0) {
|
||||
// 获取所有操作日志,不限制模块
|
||||
const query = {
|
||||
pageNum: 1,
|
||||
pageSize: 100 // 获取更多记录用于筛选
|
||||
};
|
||||
const res = await listOperLog(query);
|
||||
const payload = res as { rows?: OperLogVO[]; list?: OperLogVO[] } | OperLogVO[];
|
||||
const rows = Array.isArray(payload) ? payload : payload?.rows || payload?.list || [];
|
||||
|
||||
// 过滤出与当前合同相关的日志
|
||||
const contractIdStr = String(contract.value.id);
|
||||
operLogListFull.value = rows.filter((log: OperLogVO) => {
|
||||
// 检查URL是否包含合同ID
|
||||
const urlMatch = log.operUrl && log.operUrl.includes(`/crm/contract`) && log.operUrl.includes(`/${contractIdStr}`);
|
||||
|
||||
// 检查参数中是否包含合同ID(支持多种格式)
|
||||
const paramMatch =
|
||||
log.operParam &&
|
||||
(log.operParam.includes(`"id":${contractIdStr}`) ||
|
||||
log.operParam.includes(`"id":"${contractIdStr}"`) ||
|
||||
log.operParam.includes(`"contractId":${contractIdStr}`) ||
|
||||
log.operParam.includes(`"contractId":"${contractIdStr}"`) ||
|
||||
log.operParam.includes(`[${contractIdStr}]`) ||
|
||||
log.operParam.includes(`["${contractIdStr}"]`));
|
||||
|
||||
return urlMatch || paramMatch;
|
||||
});
|
||||
|
||||
// 按时间倒序排序
|
||||
operLogListFull.value.sort((a, b) => {
|
||||
return new Date(b.operTime).getTime() - new Date(a.operTime).getTime();
|
||||
});
|
||||
}
|
||||
|
||||
// 从完整列表中进行分页
|
||||
const start = (logQuery.value.pageNum - 1) * logQuery.value.pageSize;
|
||||
const end = start + logQuery.value.pageSize;
|
||||
logTotal.value = operLogListFull.value.length;
|
||||
operLogList.value = operLogListFull.value.slice(start, end);
|
||||
const query = {
|
||||
pageNum: logQuery.value.pageNum,
|
||||
pageSize: logQuery.value.pageSize,
|
||||
businessId: String(contract.value.id),
|
||||
businessTitle: 'CRM合同管理'
|
||||
};
|
||||
const res = await listOperLog(query);
|
||||
const payload = res as { rows?: OperLogVO[]; list?: OperLogVO[]; total?: number };
|
||||
operLogListFull.value = payload?.rows || payload?.list || [];
|
||||
logTotal.value = payload?.total ?? operLogListFull.value.length;
|
||||
operLogList.value = operLogListFull.value;
|
||||
} catch (error) {
|
||||
console.error('获取操作日志失败:', error);
|
||||
operLogList.value = [];
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 第一行:客户名称、关联商机、关联报价单、联系人 -->
|
||||
<!-- 第一行:客户名称、关联报价单、联系人 -->
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="客户名称" prop="customerId" required>
|
||||
@@ -51,15 +51,6 @@
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="关联商机" prop="opportunityId">
|
||||
<el-input v-model="form.opportunityName" placeholder="请选择商机(可选)" readonly clearable>
|
||||
<template #append>
|
||||
<el-button text icon="Search" @click="handleSelectOpportunity" />
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="关联报价单" prop="quoteId">
|
||||
<el-input v-model="form.quoteNo" placeholder="请选择报价单(可选)" readonly clearable>
|
||||
@@ -560,14 +551,6 @@
|
||||
@confirm="handleContactConfirm"
|
||||
/>
|
||||
|
||||
<!-- 商机选择器 -->
|
||||
<OpportunitySelector
|
||||
:visible="opportunitySelectorVisible"
|
||||
@update:visible="opportunitySelectorVisible = $event"
|
||||
:customerId="form.customerId"
|
||||
@confirm="handleOpportunityConfirm"
|
||||
/>
|
||||
|
||||
<!-- 报价单选择器 -->
|
||||
<QuoteSelector
|
||||
:visible="quoteSelectorVisible"
|
||||
@@ -612,7 +595,6 @@ import { getQuote } from '@/api/crm/quote';
|
||||
import ProductSelector from './components/ProductSelector.vue';
|
||||
import CustomerSelector from '@/components/CustomerSelector.vue';
|
||||
import ContactSelector from '@/components/ContactSelector.vue';
|
||||
import OpportunitySelector from '@/components/OpportunitySelector.vue';
|
||||
import QuoteSelector from '@/components/QuoteSelector.vue';
|
||||
import UserSelector from '@/components/UserSelector.vue';
|
||||
import ApprovalDialog from './components/ApprovalDialog.vue';
|
||||
|
||||
@@ -571,6 +571,7 @@ import { $modal } from '@/utils/modal'
|
||||
import { parseTime } from '@/utils/format'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { useContractPerm } from '@/hooks/business/useContractPerm'
|
||||
import { filterDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import ApprovalDialog from './components/ApprovalDialog.vue'
|
||||
import ExecuteDialog from './components/ExecuteDialog.vue'
|
||||
import InvalidDialog from './components/InvalidDialog.vue'
|
||||
@@ -1175,6 +1176,15 @@ const handleDelete = async (row?: ContractVO) => {
|
||||
$modal.msgWarning('只能删除草稿状态的合同');
|
||||
return;
|
||||
}
|
||||
const deletable = filterDeletableByCreator(selectedContracts)
|
||||
if (!deletable.length) {
|
||||
$modal.msgWarning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
if (deletable.length < selectedContracts.length) {
|
||||
$modal.msgWarning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
await $modal.confirm('是否确认删除选中的合同?只能删除草稿状态的合同');
|
||||
await delContract(idList);
|
||||
$modal.msgSuccess('删除成功');
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<el-button type="primary" icon="Plus" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col v-if="hasContractPerm('templateRemove')" :span="1.5">
|
||||
<el-button type="danger" icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
<el-button type="danger" icon="Delete" :disabled="multiple || !allRowsDeletableByCreator(templateList.filter((item) => ids.includes(item.id)))" :title="allRowsDeletableByCreator(templateList.filter((item) => ids.includes(item.id))) ? '' : CREATOR_DELETE_TIP" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col v-if="hasContractPerm('templateExport')" :span="1.5">
|
||||
<el-button type="success" icon="Download" @click="handleExport">导出</el-button>
|
||||
@@ -93,7 +93,7 @@
|
||||
<el-tooltip v-if="hasContractPerm('templateEdit')" content="编辑" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" />
|
||||
</el-tooltip>
|
||||
<el-tooltip v-if="hasContractPerm('templateRemove')" content="删除" placement="top">
|
||||
<el-tooltip v-if="hasContractPerm('templateRemove') && canDeleteByCreator(scope.row)" content="删除" placement="top">
|
||||
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
@@ -203,6 +203,7 @@ import { useDictStore } from '@/store/modules/dict'
|
||||
import DictTag from '@/components/DictTag/index.vue'
|
||||
import { $modal } from '@/utils/modal'
|
||||
import { useContractPerm } from '@/hooks/business/useContractPerm'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const { loadPerms, hasContractPerm } = useContractPerm()
|
||||
@@ -365,6 +366,16 @@ const submitForm = () => {
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: TemplateVO) => {
|
||||
const targets = row ? [row] : templateList.value.filter((item) => ids.value.includes(item.id))
|
||||
const deletable = filterDeletableByCreator(targets)
|
||||
if (!deletable.length) {
|
||||
$modal.msgWarning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
if (deletable.length < targets.length) {
|
||||
$modal.msgWarning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
const idList = row?.id ? [row.id] : ids.value;
|
||||
await $modal.confirm('是否确认删除选中的合同模板?')
|
||||
await delTemplate(idList)
|
||||
|
||||
@@ -36,7 +36,13 @@
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" type="danger" @click="handleDelete">
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(customerInfo)"
|
||||
:title="canDeleteByCreator(customerInfo) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -73,14 +79,11 @@
|
||||
}}</span>
|
||||
</div>
|
||||
<el-button
|
||||
v-if="
|
||||
item.ownerUserName === userStore.info.realName ||
|
||||
item.createByName === userStore.info.realName ||
|
||||
userStore.info.roles?.includes('admin')
|
||||
"
|
||||
v-if="canDeleteByCreator(item)"
|
||||
link
|
||||
type="danger"
|
||||
size="small"
|
||||
:title="canDeleteByCreator(item) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDeleteFollow(item)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
@@ -199,7 +202,13 @@
|
||||
<el-button link type="primary" @click="handleEditContact(row)">
|
||||
<el-icon><Edit /></el-icon>修改
|
||||
</el-button>
|
||||
<el-button link type="danger" @click="handleDeleteContact(row)">
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(row)"
|
||||
:title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDeleteContact(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -487,6 +496,7 @@ import { list as listOperLog } from '@/api/monitor/operlog'
|
||||
import type { OperLogVO } from '@/api/monitor/operlog/types'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import CustomerForm from './CustomerFormDialog.vue'
|
||||
import FollowForm from './FollowFormDialog.vue'
|
||||
import ContactForm from './components/ContactFormDialog.vue'
|
||||
@@ -751,39 +761,16 @@ async function getOperLogList(reload = false) {
|
||||
if (!customerId.value) return
|
||||
logLoading.value = true
|
||||
try {
|
||||
if (reload || !operLogListFull.value.length) {
|
||||
const res = await listOperLog({ pageNum: 1, pageSize: 100 })
|
||||
const payload = res as { rows?: OperLogVO[]; list?: OperLogVO[] } | OperLogVO[]
|
||||
const rows = Array.isArray(payload)
|
||||
? payload
|
||||
: payload?.rows || payload?.list || []
|
||||
const customerIdStr = String(customerId.value)
|
||||
const matchCustomerId = (text?: string) => {
|
||||
if (!text) return false
|
||||
return (
|
||||
text.includes(`"id":${customerIdStr}`) ||
|
||||
text.includes(`"id":"${customerIdStr}"`) ||
|
||||
text.includes(`"customerId":${customerIdStr}`) ||
|
||||
text.includes(`"customerId":"${customerIdStr}"`) ||
|
||||
text.includes(`[${customerIdStr}]`) ||
|
||||
text.includes(`["${customerIdStr}"]`) ||
|
||||
text.includes(`/${customerIdStr}`)
|
||||
)
|
||||
}
|
||||
operLogListFull.value = rows.filter((log: OperLogVO) => {
|
||||
const urlMatch =
|
||||
log.operUrl?.includes('/crm/customer') && matchCustomerId(log.operUrl)
|
||||
const paramMatch = matchCustomerId(log.operParam)
|
||||
const resultMatch = matchCustomerId(log.jsonResult)
|
||||
return urlMatch || paramMatch || resultMatch
|
||||
})
|
||||
operLogListFull.value.sort(
|
||||
(a, b) => new Date(b.operTime || 0).getTime() - new Date(a.operTime || 0).getTime()
|
||||
)
|
||||
}
|
||||
const start = (logQuery.value.pageNum - 1) * logQuery.value.pageSize
|
||||
logTotal.value = operLogListFull.value.length
|
||||
operLogList.value = operLogListFull.value.slice(start, start + logQuery.value.pageSize)
|
||||
const res = await listOperLog({
|
||||
pageNum: logQuery.value.pageNum,
|
||||
pageSize: logQuery.value.pageSize,
|
||||
businessId: String(customerId.value),
|
||||
businessTitle: 'CRM客户管理'
|
||||
})
|
||||
const payload = res as { rows?: OperLogVO[]; list?: OperLogVO[]; total?: number }
|
||||
operLogListFull.value = payload?.rows || payload?.list || []
|
||||
logTotal.value = payload?.total ?? operLogListFull.value.length
|
||||
operLogList.value = operLogListFull.value
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
operLogList.value = []
|
||||
|
||||
@@ -75,7 +75,13 @@
|
||||
<el-button v-if="row.isPrimary !== 1" link type="warning" @click="handleSetPrimary(row)">
|
||||
<el-icon><Star /></el-icon>设为主要
|
||||
</el-button>
|
||||
<el-button link type="danger" @click="handleDelete(row)">
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(row)"
|
||||
:title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -90,6 +96,7 @@
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import {
|
||||
fetchContactsByCustomerId,
|
||||
fetchDeleteContact,
|
||||
|
||||
@@ -99,7 +99,13 @@
|
||||
<el-button link type="primary" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button link type="danger" @click="handleDelete(row)">
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(row)"
|
||||
:title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -162,6 +168,7 @@ import { ref, watch } from 'vue'
|
||||
import { Plus, Edit, Delete, Star, Close, Check } from '@element-plus/icons-vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import request from '@/utils/http'
|
||||
import { canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
|
||||
interface InvoiceInfoVO {
|
||||
id: string | number
|
||||
|
||||
@@ -607,7 +607,12 @@
|
||||
<el-button class="btn-op-item" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button class="btn-op-item btn-op-danger" @click="handleDelete(row)">
|
||||
<el-button
|
||||
class="btn-op-item btn-op-danger"
|
||||
:disabled="!canDeleteByCreator(row)"
|
||||
:title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -703,6 +708,7 @@ import {
|
||||
Edit,
|
||||
} from '@element-plus/icons-vue'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import {
|
||||
fetchCustomerList,
|
||||
fetchCustomerDetail,
|
||||
@@ -983,6 +989,16 @@ async function handleDelete(row?: any) {
|
||||
ElMessage.warning('请至少选择一条数据进行删除')
|
||||
return
|
||||
}
|
||||
const targets = row ? [row] : selectedRows.value
|
||||
const deletable = filterDeletableByCreator(targets)
|
||||
if (!deletable.length) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
if (deletable.length < targets.length) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
await ElMessageBox.confirm('是否确认删除选中的客户数据?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
|
||||
@@ -177,6 +177,7 @@
|
||||
<el-button
|
||||
class="btn-op-item danger"
|
||||
v-auth="'delete'"
|
||||
v-if="canDeleteByCreator(row)"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
@@ -224,6 +225,7 @@ import {
|
||||
fetchExecutePoolRules,
|
||||
} from '@/api/crm/pool'
|
||||
import RuleDialog from './components/RuleDialog.vue'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive({
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
v-if="hasOpportunityPerm('remove')"
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="opportunityInfo.status === 'won'"
|
||||
:disabled="opportunityInfo.status === 'won' || !canDeleteByCreator(opportunityInfo)"
|
||||
:title="canDeleteByCreator(opportunityInfo) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
@@ -79,7 +80,7 @@
|
||||
</el-tag>
|
||||
<span class="follow-creator">{{ item.followByName || item.createByName || '—' }}</span>
|
||||
</div>
|
||||
<div v-if="String(item.followBy) === String(currentUserId)" class="follow-actions">
|
||||
<div v-if="canDeleteByCreator(item)" class="follow-actions">
|
||||
<el-button link type="primary" size="small" @click="handleEditFollow(item)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
</el-button>
|
||||
@@ -190,6 +191,7 @@ import AttachmentUploadField from '@/components/business/attachment-upload-field
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { useOpportunityPerm } from '@/hooks/business/useOpportunityPerm'
|
||||
import { canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import {
|
||||
getOpportunity,
|
||||
listFollowByOpportunity,
|
||||
|
||||
@@ -459,6 +459,7 @@ import {
|
||||
} from '@element-plus/icons-vue'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { useOpportunityPerm } from '@/hooks/business/useOpportunityPerm'
|
||||
import { filterDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { fetchUserOptions } from '@/api/admin'
|
||||
import { listOpportunity, listMyOpportunity, delOpportunity, assignOpportunity, exportOpportunity } from '@/api/crm/opportunity'
|
||||
import type { OpportunityQuery, OpportunityVO } from '@/api/crm/opportunity/types'
|
||||
@@ -777,6 +778,16 @@ const handleDelete = async (row?: OpportunityVO) => {
|
||||
ElMessage.warning('已赢单的商机不允许删除');
|
||||
return;
|
||||
}
|
||||
const targets = row ? [row] : opportunityList.value.filter((item) => ids.value.includes(item.id))
|
||||
const deletable = filterDeletableByCreator(targets)
|
||||
if (!deletable.length) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
if (deletable.length < targets.length) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
const idList = row?.id ? [row.id] : ids.value;
|
||||
await ElMessageBox.confirm('是否确认删除选中的商机数据?删除后将无法恢复!', '提示', {
|
||||
type: 'warning'
|
||||
|
||||
@@ -75,7 +75,8 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="!selectedId"
|
||||
:disabled="!selectedId || !canDeleteSelectedCategory"
|
||||
:title="canDeleteSelectedCategory ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete()"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
@@ -219,7 +220,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, nextTick } from 'vue'
|
||||
import { ref, reactive, onMounted, nextTick, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import {
|
||||
@@ -232,6 +233,7 @@ import {
|
||||
RefreshLeft,
|
||||
} from '@element-plus/icons-vue'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import {
|
||||
fetchCategoryTree,
|
||||
fetchCreateCategory,
|
||||
@@ -249,6 +251,12 @@ const refreshTable = ref(true)
|
||||
const selectedId = ref<string>()
|
||||
const selectedRows = ref<any[]>([])
|
||||
|
||||
const canDeleteSelectedCategory = computed(() => {
|
||||
if (!selectedId.value) return false
|
||||
const node = findNodeById(categoryList.value, selectedId.value)
|
||||
return canDeleteByCreator(node)
|
||||
})
|
||||
|
||||
// ── 弹窗数据 ──
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
@@ -377,6 +385,11 @@ async function handleDelete() {
|
||||
ElMessage.warning('请选择一条数据进行删除')
|
||||
return
|
||||
}
|
||||
const node = findNodeById(categoryList.value, selectedId.value)
|
||||
if (!canDeleteByCreator(node)) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
await ElMessageBox.confirm('是否确认删除该产品分类?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
|
||||
@@ -225,7 +225,7 @@
|
||||
<el-dropdown-item command="view">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="delete" divided>
|
||||
<el-dropdown-item command="delete" divided :disabled="!canDeleteByCreator(row)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
@@ -490,6 +490,7 @@ import SystemViewDialog, {
|
||||
import { crmDictField, crmField, crmLongField, crmTagField } from '@/utils/crm/view-fields'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import {
|
||||
fetchCategoryTree,
|
||||
@@ -735,6 +736,16 @@ async function handleDelete(row?: any) {
|
||||
ElMessage.warning('请至少选择一条数据进行删除')
|
||||
return
|
||||
}
|
||||
const targets = row ? [row] : selectedRows.value
|
||||
const deletable = filterDeletableByCreator(targets)
|
||||
if (!deletable.length) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
if (deletable.length < targets.length) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
await ElMessageBox.confirm('是否确认删除选中的产品?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
|
||||
@@ -53,9 +53,10 @@
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="quoteInfo.status !== 'invalid'"
|
||||
v-if="quoteInfo.status !== 'invalid' && canDeleteByCreator(quoteInfo)"
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:title="canDeleteByCreator(quoteInfo) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
@@ -312,6 +313,7 @@ const CustomerDetailDialog = defineAsyncComponent(
|
||||
)
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { useQuotePerm } from '@/hooks/business/useQuotePerm'
|
||||
import { canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { $modal } from '@/utils/modal'
|
||||
import { parseTime } from '@/utils/format'
|
||||
import {
|
||||
|
||||
@@ -16,7 +16,12 @@
|
||||
<el-button v-if="quote?.status === 'draft'" link type="primary" @click="handleSubmit">
|
||||
<el-icon><CircleCheck /></el-icon>提交审批
|
||||
</el-button>
|
||||
<el-button link type="danger" @click="handleDelete">
|
||||
<el-button
|
||||
v-if="quote?.status === 'draft' && canDeleteByCreator(quote)"
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -384,6 +389,7 @@ const dictStore = useDictStore()
|
||||
import DictTag from '@/components/DictTag/index.vue'
|
||||
import ListPagination from '@/components/ListPagination/index.vue'
|
||||
import { $modal } from '@/utils/modal'
|
||||
import { canDeleteByCreator } from '@/utils/creator-delete'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { Back, CircleCheck, Close, Delete, Document, Download, Edit, Printer } from '@element-plus/icons-vue'
|
||||
|
||||
@@ -816,6 +816,7 @@ import html2canvas from 'html2canvas';
|
||||
import jsPDF from 'jspdf';
|
||||
|
||||
import { useQuotePerm } from '@/hooks/business/useQuotePerm'
|
||||
import { filterDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import QuoteFormDialog from './components/QuoteFormDialog.vue'
|
||||
import QuoteDetailDialog from './components/QuoteDetailDialog.vue'
|
||||
|
||||
@@ -1425,6 +1426,16 @@ const handleDelete = async (row?: QuoteVO) => {
|
||||
$modal.msgWarning('只能删除草稿状态的报价单');
|
||||
return;
|
||||
}
|
||||
const targets = row ? [row] : quoteList.value.filter((item) => ids.value.includes(item.id))
|
||||
const deletable = filterDeletableByCreator(targets)
|
||||
if (!deletable.length) {
|
||||
$modal.msgWarning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
if (deletable.length < targets.length) {
|
||||
$modal.msgWarning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
const idList = row?.id ? [row.id] : ids.value;
|
||||
await $modal.confirm('是否确认删除选中的报价单?只能删除草稿状态的报价单');
|
||||
await delQuote(idList);
|
||||
|
||||
Reference in new issue
Block a user