|
@@ -1,13 +1,20 @@
|
|
|
<template>
|
|
<template>
|
|
|
<el-dialog
|
|
<el-dialog
|
|
|
v-model="dialogVisible"
|
|
v-model="dialogVisible"
|
|
|
- :title="formTitle"
|
|
|
|
|
- width="calc(100vw - 48px)"
|
|
|
|
|
|
|
+ :title="isPageVariant ? undefined : formTitle"
|
|
|
|
|
+ :width="isPageVariant ? '100%' : 'calc(100vw - 48px)'"
|
|
|
|
|
+ :fullscreen="isPageVariant"
|
|
|
|
|
+ :show-close="!isPageVariant"
|
|
|
|
|
+ :modal="!isPageVariant"
|
|
|
|
|
+ :append-to-body="!isPageVariant"
|
|
|
align-center
|
|
align-center
|
|
|
- class="dialog-form-layout contract-form-dialog"
|
|
|
|
|
|
|
+ :class="[
|
|
|
|
|
+ 'dialog-form-layout',
|
|
|
|
|
+ 'contract-form-dialog',
|
|
|
|
|
+ { 'contract-form-dialog--page': isPageVariant }
|
|
|
|
|
+ ]"
|
|
|
destroy-on-close
|
|
destroy-on-close
|
|
|
- append-to-body
|
|
|
|
|
- modal-class="order-module-dialog-mask"
|
|
|
|
|
|
|
+ :modal-class="isPageVariant ? undefined : 'order-module-dialog-mask'"
|
|
|
:close-on-click-modal="false"
|
|
:close-on-click-modal="false"
|
|
|
@opened="handleOpened"
|
|
@opened="handleOpened"
|
|
|
>
|
|
>
|
|
@@ -20,9 +27,10 @@
|
|
|
ref="formRef"
|
|
ref="formRef"
|
|
|
:model="form"
|
|
:model="form"
|
|
|
:rules="rules"
|
|
:rules="rules"
|
|
|
- label-position="right"
|
|
|
|
|
- label-width="120px"
|
|
|
|
|
|
|
+ :label-position="isPageVariant ? 'top' : 'right'"
|
|
|
|
|
+ :label-width="isPageVariant ? undefined : '120px'"
|
|
|
class="crm-dialog-form"
|
|
class="crm-dialog-form"
|
|
|
|
|
+ :class="{ 'crm-dialog-form--page': isPageVariant }"
|
|
|
:disabled="formLoading"
|
|
:disabled="formLoading"
|
|
|
>
|
|
>
|
|
|
<!-- 合同基础信息(一行 4 列) -->
|
|
<!-- 合同基础信息(一行 4 列) -->
|
|
@@ -946,18 +954,29 @@ type ExtendedContractProductForm = ContractProductForm & {
|
|
|
priceTiers?: PriceTierRow[]
|
|
priceTiers?: PriceTierRow[]
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const props = defineProps<{
|
|
|
|
|
- visible: boolean
|
|
|
|
|
- editId: string | null
|
|
|
|
|
- /** 复制来源合同(列表选中行,含 products) */
|
|
|
|
|
- copySource?: ContractVO | null
|
|
|
|
|
-}>()
|
|
|
|
|
|
|
+const props = withDefaults(
|
|
|
|
|
+ defineProps<{
|
|
|
|
|
+ visible: boolean
|
|
|
|
|
+ editId: string | null
|
|
|
|
|
+ /** 复制来源合同(列表选中行,含 products) */
|
|
|
|
|
+ copySource?: ContractVO | null
|
|
|
|
|
+ /** dialog=桌面弹窗;page=小程序 WebView 全屏页 */
|
|
|
|
|
+ variant?: 'dialog' | 'page'
|
|
|
|
|
+ }>(),
|
|
|
|
|
+ {
|
|
|
|
|
+ copySource: null,
|
|
|
|
|
+ variant: 'dialog'
|
|
|
|
|
+ }
|
|
|
|
|
+)
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
const emit = defineEmits<{
|
|
|
'update:visible': [value: boolean]
|
|
'update:visible': [value: boolean]
|
|
|
success: []
|
|
success: []
|
|
|
|
|
+ 'loading-change': [loading: boolean]
|
|
|
}>()
|
|
}>()
|
|
|
|
|
|
|
|
|
|
+const isPageVariant = computed(() => props.variant === 'page')
|
|
|
|
|
+
|
|
|
const dialogVisible = computed({
|
|
const dialogVisible = computed({
|
|
|
get: () => props.visible,
|
|
get: () => props.visible,
|
|
|
set: (val) => emit('update:visible', val)
|
|
set: (val) => emit('update:visible', val)
|
|
@@ -1098,12 +1117,18 @@ watch(
|
|
|
(visible) => {
|
|
(visible) => {
|
|
|
if (visible && (props.editId || props.copySource)) {
|
|
if (visible && (props.editId || props.copySource)) {
|
|
|
formLoading.value = true
|
|
formLoading.value = true
|
|
|
|
|
+ emit('loading-change', true)
|
|
|
} else if (!visible) {
|
|
} else if (!visible) {
|
|
|
formLoading.value = false
|
|
formLoading.value = false
|
|
|
|
|
+ emit('loading-change', false)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+watch(formLoading, (loading) => {
|
|
|
|
|
+ if (props.visible) emit('loading-change', loading)
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
// 组件引用
|
|
// 组件引用
|
|
|
const formRef = ref<FormInstance>()
|
|
const formRef = ref<FormInstance>()
|
|
|
const approvalDialogRef = ref()
|
|
const approvalDialogRef = ref()
|
|
@@ -1368,7 +1393,7 @@ const handleOpened = async () => {
|
|
|
resetForm()
|
|
resetForm()
|
|
|
const isEdit = !!props.editId
|
|
const isEdit = !!props.editId
|
|
|
const isCopy = !!props.copySource
|
|
const isCopy = !!props.copySource
|
|
|
- if (isEdit || isCopy) {
|
|
|
|
|
|
|
+ if (isEdit || isCopy || isPageVariant.value) {
|
|
|
formLoading.value = true
|
|
formLoading.value = true
|
|
|
}
|
|
}
|
|
|
try {
|
|
try {
|
|
@@ -3024,6 +3049,32 @@ const loadSupplierList = async () => {
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ &.contract-form-dialog--page {
|
|
|
|
|
+ :deep(.el-dialog__wrapper) {
|
|
|
|
|
+ top: 0 !important;
|
|
|
|
|
+ height: 100% !important;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ :deep(.el-dialog) {
|
|
|
|
|
+ max-height: 100%;
|
|
|
|
|
+ border-radius: 0;
|
|
|
|
|
+ box-shadow: none;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ :deep(.el-dialog__header) {
|
|
|
|
|
+ display: none;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ :deep(.el-dialog__body) {
|
|
|
|
|
+ padding: 8px 12px 16px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ :deep(.el-dialog__footer) {
|
|
|
|
|
+ padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
|
|
|
|
|
+ border-top: 1px solid #e2e8f0;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
:deep(.dialog-footer) {
|
|
:deep(.dialog-footer) {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
justify-content: center;
|
|
justify-content: center;
|
|
@@ -3053,6 +3104,22 @@ const loadSupplierList = async () => {
|
|
|
padding: 0 4px;
|
|
padding: 0 4px;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+.crm-dialog-form--page {
|
|
|
|
|
+ .contract-basic-info {
|
|
|
|
|
+ grid-template-columns: 1fr;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ :deep(.el-row) {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-direction: column;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ :deep(.el-col) {
|
|
|
|
|
+ width: 100% !important;
|
|
|
|
|
+ max-width: 100% !important;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
.contract-basic-info {
|
|
.contract-basic-info {
|
|
|
display: grid;
|
|
display: grid;
|
|
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|