|
@@ -47,7 +47,7 @@
|
|
|
<div class="flex-1 p-5 overflow-auto">
|
|
|
<div class="bg-white w-full h-full p-3 shadow-md rounded-md flex flex-col">
|
|
|
<div class="flex justify-end pb-3">
|
|
|
- <el-button type="primary" @click="showVisible('newBusinessisible')">新建商机</el-button>
|
|
|
+ <el-button type="primary" @click="editNewBusiness(false)">新建商机</el-button>
|
|
|
<el-button type="primary" @click="showVisible('batchTransferVisible')"
|
|
|
:disabled="batchTableData.length <= 0">批量转移</el-button>
|
|
|
<el-button type="primary" @click="batchDeteleItem()" :disabled="batchTableData.length <= 0">批量删除</el-button>
|
|
@@ -69,7 +69,7 @@
|
|
|
<el-table-column label="操作" fixed="right" width="200">
|
|
|
<template #default="scope">
|
|
|
<el-button link type="primary" size="large"
|
|
|
- @click="editShowVisible('newBusinessisible', scope.row)">编辑</el-button>
|
|
|
+ @click="editNewBusiness(scope.row)">编辑</el-button>
|
|
|
<el-button link type="primary" size="large" @click="newTask(scope.row)">新建任务</el-button>
|
|
|
<el-button link type="danger" size="large"
|
|
|
@click="businessDeteleItem(scope.row.id, scope.row.name)">删除</el-button>
|
|
@@ -98,8 +98,8 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <div class="h-[60vh] overflow-y-auto scroll-bar pt-3">
|
|
|
- <GenerateForm ref="generateForm" :data="generateFormData" />
|
|
|
+ <div class="h-[60vh] overflow-y-auto scroll-bar pt-3" v-loading="allLoading.generateFormLading">
|
|
|
+ <GenerateForm ref="businessTemplateRef" :data="businessTemplate" :value="businessTemplateValue" :key="businessTemplateKey" />
|
|
|
<div>相关产品</div>
|
|
|
<RelatedProducts ref="relatedProductsRef" :productTableList="productTableList" />
|
|
|
</div>
|
|
@@ -182,9 +182,11 @@ const router = useRouter()
|
|
|
const globalPopup = inject<GlobalPopup>('globalPopup')
|
|
|
const businessTableRef = ref<InstanceType<typeof ElTable>>() // 商机table dom
|
|
|
const businessTotalTable = ref(0)
|
|
|
-const generateForm = ref<typeof GenerateForm>() // 自定义表单dom
|
|
|
+const businessTemplateRef = ref<typeof GenerateForm>() // 自定义表单dom
|
|
|
const relatedProductsRef = ref<typeof RelatedProducts>()
|
|
|
-const generateFormData = ref({
|
|
|
+const businessTemplateValue = ref({})
|
|
|
+const businessTemplateKey = ref(1)
|
|
|
+const businessTemplate = ref({
|
|
|
config: {},
|
|
|
list: []
|
|
|
}) // 自定义表单数据
|
|
@@ -196,6 +198,7 @@ const allLoading = reactive({
|
|
|
transferLoading: false,
|
|
|
importLoading: false,
|
|
|
exoprtLoading: false,
|
|
|
+ generateFormLading: false
|
|
|
})
|
|
|
const allVisible = reactive({
|
|
|
newBusinessisible: false,
|
|
@@ -236,7 +239,7 @@ const productTableList = ref([])
|
|
|
|
|
|
|
|
|
function editBusiness(visibles: boolean) {
|
|
|
- generateForm.value?.getData().then((res: any) => {
|
|
|
+ businessTemplateRef.value?.getData().then((res: any) => {
|
|
|
let productTableListData = relatedProductsRef?.value?.returnData()
|
|
|
let newForm = {
|
|
|
...res,
|
|
@@ -257,9 +260,23 @@ function editBusiness(visibles: boolean) {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-function editShowVisible(type: keyof typeof allVisible, item: any) {
|
|
|
+function editNewBusiness(item: any) {
|
|
|
console.log(item, '选择数据')
|
|
|
- showVisible(type)
|
|
|
+ showVisible('newBusinessisible')
|
|
|
+ allLoading.generateFormLading = true
|
|
|
+ if (item) {
|
|
|
+ businessTemplateValue.value = item
|
|
|
+ allText.newBusinessisibleText = '编辑商机'
|
|
|
+ }
|
|
|
+ if (!item) {
|
|
|
+ businessTemplateValue.value = {}
|
|
|
+ allText.newBusinessisibleText = '新建产品'
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ businessTemplateRef.value && businessTemplateRef.value.reset()
|
|
|
+ businessTemplateKey.value++
|
|
|
+ allLoading.generateFormLading = false
|
|
|
+ }, 500)
|
|
|
}
|
|
|
|
|
|
function newTask(item: any) {
|
|
@@ -419,7 +436,7 @@ async function getSystemField() {
|
|
|
})
|
|
|
|
|
|
const res = await get(GETGENERATEFOEM)
|
|
|
- generateFormData.value = JSON.parse(res.data[0].config)
|
|
|
+ businessTemplate.value = JSON.parse(res.data[0].config)
|
|
|
}
|
|
|
|
|
|
function toBusinessTableDetail(row: any) {
|