|
@@ -3,7 +3,7 @@
|
|
<div class="flex justify-between">
|
|
<div class="flex justify-between">
|
|
<div class="title">基本信息</div>
|
|
<div class="title">基本信息</div>
|
|
<div>
|
|
<div>
|
|
- <el-button type="primary">转为商机</el-button>
|
|
|
|
|
|
+ <el-button type="primary" @click="showVisible('newBusinessisible')">转为商机</el-button>
|
|
<el-button type="primary" @click="claimClues()" v-if="!information.inchargerName">认领</el-button>
|
|
<el-button type="primary" @click="claimClues()" v-if="!information.inchargerName">认领</el-button>
|
|
<el-button type="primary" @click="showVisible('clueDialogVisible')" v-else>转移</el-button>
|
|
<el-button type="primary" @click="showVisible('clueDialogVisible')" v-else>转移</el-button>
|
|
<el-button type="primary" @click="editClue(information)">编辑</el-button>
|
|
<el-button type="primary" @click="editClue(information)">编辑</el-button>
|
|
@@ -104,16 +104,39 @@
|
|
<div class="pl-3 text-[#e94a4a]">转移后,将看不到此线索</div>
|
|
<div class="pl-3 text-[#e94a4a]">转移后,将看不到此线索</div>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
+
|
|
|
|
+ <!-- 转成商机 -->
|
|
|
|
+ <el-dialog v-model="dialogVisible.newBusinessisible" width="1000" :show-close="false" top="10vh">
|
|
|
|
+ <template #header="{ close, titleId, titleClass }">
|
|
|
|
+ <div class="flex justify-between items-center border-b pb-3 dialog-header">
|
|
|
|
+ <h4 :id="titleId">{{ allText.businessisText }}</h4>
|
|
|
|
+ <div>
|
|
|
|
+ <el-button type="primary" @click="transferBusiness()"
|
|
|
|
+ :loading="allLoading.businessSaveLading">转为商机</el-button>
|
|
|
|
+ <el-button @click="closeVisible('newBusinessisible')">取消</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ <div class="h-[60vh] overflow-y-auto scroll-bar pt-3">
|
|
|
|
+ <GenerateForm ref="generateFormDataRef" :data="generateFormData" :value="generateFormVal" />
|
|
|
|
+ <div>相关产品</div>
|
|
|
|
+ <RelatedProducts ref="relatedProductsRef" :productTableList="productTableList" />
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
import { ref, reactive, onMounted, onUnmounted, defineExpose, inject, watchEffect } from 'vue'
|
|
import { ref, reactive, onMounted, onUnmounted, defineExpose, inject, watchEffect } from 'vue'
|
|
import { GenerateForm } from '@zmjs/form-design';
|
|
import { GenerateForm } from '@zmjs/form-design';
|
|
-import { formatDate, confirmAction } from '@/utils/tools'
|
|
|
|
-import { GETTEMPLATE, UNDATEFORM, GETPERSONNEL, UNDATECLAIM } from '../../constant'
|
|
|
|
|
|
+import { formatDate, confirmAction, backPath } from '@/utils/tools'
|
|
|
|
+import { GETTEMPLATE, UNDATEFORM, GETPERSONNEL, UNDATECLAIM, GETTEMPLATETWO } from '../../constant'
|
|
import { get, post } from '@/utils/request'
|
|
import { get, post } from '@/utils/request'
|
|
import { useStore } from '@/store/index'
|
|
import { useStore } from '@/store/index'
|
|
import { ElMessageBox } from 'element-plus';
|
|
import { ElMessageBox } from 'element-plus';
|
|
|
|
+import RelatedProducts from '@/pages/business/component/relatedProducts.vue'
|
|
|
|
+import { all } from 'axios';
|
|
|
|
+import { formatDateTime } from '@/utils/times';
|
|
|
|
+import { UPDATEINSET } from '@/pages/business/api';
|
|
|
|
|
|
interface personnelInterface {
|
|
interface personnelInterface {
|
|
id: string | number,
|
|
id: string | number,
|
|
@@ -134,25 +157,59 @@ const generateFormKey = ref(1)
|
|
const allLoading = reactive({
|
|
const allLoading = reactive({
|
|
generateFormLading: false,
|
|
generateFormLading: false,
|
|
saveBtnLoading: false,
|
|
saveBtnLoading: false,
|
|
- clueLoading: false
|
|
|
|
|
|
+ clueLoading: false,
|
|
|
|
+ businessSaveLading: false,
|
|
})
|
|
})
|
|
const dialogVisible = reactive({
|
|
const dialogVisible = reactive({
|
|
editClueDialogVisible: false,
|
|
editClueDialogVisible: false,
|
|
- clueDialogVisible: false
|
|
|
|
|
|
+ clueDialogVisible: false,
|
|
|
|
+ newBusinessisible: false
|
|
})
|
|
})
|
|
const allText = reactive({
|
|
const allText = reactive({
|
|
editClueText: '新建线索',
|
|
editClueText: '新建线索',
|
|
- clueText: '认领线索'
|
|
|
|
|
|
+ clueText: '认领线索',
|
|
|
|
+ businessisText: '转为商机'
|
|
})
|
|
})
|
|
const generateForm: any = ref(null) // 模板
|
|
const generateForm: any = ref(null) // 模板
|
|
const clueTemplate = ref({
|
|
const clueTemplate = ref({
|
|
list: [],
|
|
list: [],
|
|
config: {}
|
|
config: {}
|
|
}) // 线索模板
|
|
}) // 线索模板
|
|
|
|
+const generateFormData = ref({ // 商机模板
|
|
|
|
+ config: {},
|
|
|
|
+ list: []
|
|
|
|
+})
|
|
|
|
+const generateFormDataRef = ref<typeof GenerateForm>() // 商机模板dom
|
|
|
|
+const relatedProductsRef = ref<typeof RelatedProducts>()
|
|
|
|
+const productTableList = ref([])
|
|
|
|
+const generateFormVal = ref<any>({})
|
|
const editForm = ref({}) // 编辑表单
|
|
const editForm = ref({}) // 编辑表单
|
|
const transferValue = ref('') // 转移/认领 id
|
|
const transferValue = ref('') // 转移/认领 id
|
|
const transferOptions = ref<personnelInterface[]>([]) // 转移人员列表
|
|
const transferOptions = ref<personnelInterface[]>([]) // 转移人员列表
|
|
|
|
|
|
|
|
+// 转为商机
|
|
|
|
+function transferBusiness() {
|
|
|
|
+ generateFormDataRef.value?.getData().then((res: any) => {
|
|
|
|
+ let productTableListData = relatedProductsRef?.value?.returnData()
|
|
|
|
+ let newForm = {
|
|
|
|
+ ...res,
|
|
|
|
+ expectedTransactionDate: res.expectedTransactionDate ? formatDateTime(new Date(res.expectedTransactionDate)) : '',
|
|
|
|
+ businessItemProductList: productTableListData ? JSON.stringify(productTableListData) : []
|
|
|
|
+ }
|
|
|
|
+ allLoading.businessSaveLading = true
|
|
|
|
+ post(UPDATEINSET, { ...newForm }).then((_res) => {
|
|
|
|
+ dialogVisible.newBusinessisible = false
|
|
|
|
+ globalPopup?.showSuccess('操作成功')
|
|
|
|
+ backPath()
|
|
|
|
+ }).finally(() => {
|
|
|
|
+ allLoading.businessSaveLading = false
|
|
|
|
+ })
|
|
|
|
+ }).catch((_err: any) => {
|
|
|
|
+ console.log(_err)
|
|
|
|
+ globalPopup?.showError('请填写完整')
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
// 转移/认领 线索
|
|
// 转移/认领 线索
|
|
function transferClues() {
|
|
function transferClues() {
|
|
const ids = information.value?.id
|
|
const ids = information.value?.id
|
|
@@ -233,7 +290,17 @@ function showVisible(filed: keyof typeof dialogVisible) {
|
|
} else {
|
|
} else {
|
|
allText.clueText = '认领线索'
|
|
allText.clueText = '认领线索'
|
|
}
|
|
}
|
|
- dialogVisible[filed] = true
|
|
|
|
|
|
+
|
|
|
|
+ if (filed == 'newBusinessisible') {
|
|
|
|
+ generateFormVal.value.name = information.value.clueName
|
|
|
|
+ }
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ dialogVisible[filed] = true
|
|
|
|
+ }, 100)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function closeVisible(filed: keyof typeof dialogVisible) {
|
|
|
|
+ dialogVisible[filed] = false
|
|
}
|
|
}
|
|
|
|
|
|
async function getSystemField() {
|
|
async function getSystemField() {
|
|
@@ -255,6 +322,9 @@ onMounted(async () => {
|
|
receiveAssignment(props)
|
|
receiveAssignment(props)
|
|
const res = await get(GETTEMPLATE)
|
|
const res = await get(GETTEMPLATE)
|
|
clueTemplate.value = JSON.parse(res.data[0].config)
|
|
clueTemplate.value = JSON.parse(res.data[0].config)
|
|
|
|
+ const data = await get(GETTEMPLATETWO)
|
|
|
|
+ let newData = JSON.parse(data.data[0].config)
|
|
|
|
+ generateFormData.value = newData
|
|
getSystemField()
|
|
getSystemField()
|
|
});
|
|
});
|
|
</script>
|
|
</script>
|