提交
This commit is contained in:
1 parent
c9fb39395c
commit
4f364bc9a0
58 files changed
+1040829
-6729
No files matched your search
@@ -159,7 +159,7 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<ContractDetailDialog ref="contractDetailRef" hide-product-price />
|
||||
<ContractDetailDialog ref="contractDetailRef" :hide-product-price="hideProductPrice" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -170,12 +170,17 @@ import type { ContractProductForm, ContractQuery, ContractVO } from '@/api/crm/c
|
||||
import { planApi } from '@/api/pl'
|
||||
import DictTag from '@/components/DictTag/index.vue'
|
||||
import ListPagination from '@/components/ListPagination/index.vue'
|
||||
import { useContractDetailDialog } from '@/composables/useContractDetailDialog'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { formatPlanProductListText } from '@/utils/pl-display'
|
||||
|
||||
const ContractDetailDialog = defineAsyncComponent(
|
||||
() => import('@/views/crm/contract/components/ContractDetailDialog.vue')
|
||||
)
|
||||
const {
|
||||
ContractDetailDialog,
|
||||
contractDetailRef,
|
||||
openContractDetail,
|
||||
hideProductPrice
|
||||
} = useContractDetailDialog({ gateProductPriceByPerm: true })
|
||||
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -220,7 +225,6 @@ const contractList = ref<ContractVO[]>([])
|
||||
const currentRow = ref<ContractVO | null>(null)
|
||||
const selectedId = ref('')
|
||||
const planCountMap = ref<Record<string, number>>({})
|
||||
const contractDetailRef = ref<InstanceType<typeof ContractDetailDialog>>()
|
||||
|
||||
const queryParams = reactive<ContractQuery>({
|
||||
pageNum: 1,
|
||||
@@ -264,32 +268,8 @@ function formatContractProductLine(product: ContractProductForm) {
|
||||
)
|
||||
}
|
||||
|
||||
async function waitForContractDetailDialog() {
|
||||
if (contractDetailRef.value) return contractDetailRef.value
|
||||
await nextTick()
|
||||
if (contractDetailRef.value) return contractDetailRef.value
|
||||
return new Promise<NonNullable<typeof contractDetailRef.value>>((resolve) => {
|
||||
const stop = watch(
|
||||
contractDetailRef,
|
||||
(val) => {
|
||||
if (val) {
|
||||
stop()
|
||||
resolve(val)
|
||||
}
|
||||
},
|
||||
{ flush: 'post' }
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
async function handleViewContract(row: ContractVO) {
|
||||
const contractId = row?.id
|
||||
if (!contractId) {
|
||||
ElMessage.warning('合同信息无效')
|
||||
return
|
||||
}
|
||||
const dialog = await waitForContractDetailDialog()
|
||||
await dialog.open(contractId)
|
||||
await openContractDetail(row?.id)
|
||||
}
|
||||
|
||||
function isContractSelectable(row: ContractVO): boolean {
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
@confirm="handleConfirmSingle"
|
||||
/>
|
||||
|
||||
<ContractDetailDialog ref="contractDetailRef" hide-product-price />
|
||||
<ContractDetailDialog ref="contractDetailRef" :hide-product-price="hideProductPrice" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -179,13 +179,18 @@ import { fetchProductDetail } from '@/api/crm/product'
|
||||
import ContractSelector from '@/components/business/contract-selector/index.vue'
|
||||
import MpContractSelectSheet from '@/components/mp/MpContractSelectSheet.vue'
|
||||
import DictTag from '@/components/DictTag/index.vue'
|
||||
import { useContractDetailDialog } from '@/composables/useContractDetailDialog'
|
||||
import { applyAliasDisplayMeta, formatBrandConstraintLabel } from '@/utils/crm-product-brand'
|
||||
import { collectContractProductIds } from '@/utils/pl-plan-contract-product'
|
||||
import { PL_PLAN_FORM_MOBILE_PICKERS_KEY } from '@/utils/pl-plan-form-mobile'
|
||||
|
||||
const ContractDetailDialog = defineAsyncComponent(
|
||||
() => import('@/views/crm/contract/components/ContractDetailDialog.vue')
|
||||
)
|
||||
const {
|
||||
ContractDetailDialog,
|
||||
contractDetailRef,
|
||||
openContractDetail,
|
||||
hideProductPrice
|
||||
} = useContractDetailDialog({ gateProductPriceByPerm: true })
|
||||
|
||||
|
||||
export interface PlanContractLinkForm {
|
||||
contractId: string
|
||||
@@ -233,7 +238,6 @@ const useMobileSheet = computed(() => {
|
||||
const selectorVisible = ref(false)
|
||||
const detailRows = ref<ContractVO[]>([])
|
||||
const loadingDetails = ref(false)
|
||||
const contractDetailRef = ref<InstanceType<typeof ContractDetailDialog>>()
|
||||
const expandedContractIds = ref<Set<string>>(new Set())
|
||||
|
||||
function isExpanded(contractId: string) {
|
||||
@@ -379,24 +383,6 @@ function removeContract(id: string) {
|
||||
emitLinksFromDetails(next)
|
||||
}
|
||||
|
||||
async function waitForContractDetailDialog() {
|
||||
if (contractDetailRef.value) return contractDetailRef.value
|
||||
await nextTick()
|
||||
if (contractDetailRef.value) return contractDetailRef.value
|
||||
return new Promise<NonNullable<typeof contractDetailRef.value>>((resolve) => {
|
||||
const stop = watch(
|
||||
contractDetailRef,
|
||||
(val) => {
|
||||
if (val) {
|
||||
stop()
|
||||
resolve(val)
|
||||
}
|
||||
},
|
||||
{ flush: 'post' }
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
async function handleViewContract(contractId: string) {
|
||||
const id = String(contractId || '').trim()
|
||||
if (!id) {
|
||||
@@ -404,8 +390,7 @@ async function handleViewContract(contractId: string) {
|
||||
return
|
||||
}
|
||||
emit('view', id)
|
||||
const dialog = await waitForContractDetailDialog()
|
||||
await dialog.open(id)
|
||||
await openContractDetail(id)
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
|
||||
Reference in new issue
Block a user