|
@@ -83,7 +83,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>
|
|
|
- <el-button link type="primary" size="large">新建任务</el-button>
|
|
|
+ <el-button link type="primary" size="large" @click="newTask(scope.row)">新建任务</el-button>
|
|
|
<el-button link type="danger" size="large">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -116,6 +116,10 @@
|
|
|
<RelatedProducts ref="relatedProductsRef" :productTableList="productTableList" />
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <!-- 新建任务 -->
|
|
|
+ <TaskModal :visible="allVisible.taskModalVisible" :edit-form="taskModalForm" :save-loading="taskLoading"
|
|
|
+ @close="closeVisible('taskModalVisible')" @submit="submitForm" :title="'新建任务'" :disabled-list="['taskType', 'businessOpportunityId']" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -126,10 +130,12 @@ import { useRouter, useRoute } from "vue-router";
|
|
|
import { GETSYSFILED, MOD, GETPERSONNEL, GETGENERATEFOEM, GETBUSINESSLIST, UPDATEINSET } from './api'
|
|
|
import { GETTABLELIST } from '@/pages/product/api'
|
|
|
import { post, get } from "@/utils/request";
|
|
|
-import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, getLastDayOfMonth, formatDate } from '@/utils/tools'
|
|
|
+import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, createTaskFromType, formatDate } from '@/utils/tools'
|
|
|
+import { createTask } from '@/components/TaskModal/taskFunction'
|
|
|
import { formatDateTime } from '@/utils/times'
|
|
|
import { GenerateForm } from '@zmjs/form-design';
|
|
|
import RelatedProducts from './component/relatedProducts.vue'
|
|
|
+import TaskModal from '@/components/TaskModal/index.vue'
|
|
|
|
|
|
const route = useRoute()
|
|
|
const router = useRouter()
|
|
@@ -150,11 +156,15 @@ const allLoading = reactive({
|
|
|
const allVisible = reactive({
|
|
|
newBusinessisible: false,
|
|
|
recycleVisible: false,
|
|
|
+ taskModalVisible: false
|
|
|
})
|
|
|
const allText = reactive({
|
|
|
newBusinessisibleText: '新建商机'
|
|
|
}) // 所有文本
|
|
|
|
|
|
+const taskModalForm = ref({}) // 任务弹窗表单
|
|
|
+const taskLoading = ref<saveLoadingType>("1");
|
|
|
+
|
|
|
const businessOpportunityForm = reactive<businessOpportunityFormType>({
|
|
|
name: '',
|
|
|
stageId: '',
|
|
@@ -201,6 +211,27 @@ function editShowVisible(type: keyof typeof allVisible, item: any) {
|
|
|
showVisible(type)
|
|
|
}
|
|
|
|
|
|
+function newTask(item: any) {
|
|
|
+ const { id } = item
|
|
|
+ taskModalForm.value = { ...createTaskFromType(1), businessOpportunityId: id, }
|
|
|
+ showVisible('taskModalVisible')
|
|
|
+}
|
|
|
+
|
|
|
+function submitForm(submitData: any, isClose: boolean) { // 任务提交
|
|
|
+ taskLoading.value = '2'
|
|
|
+ createTask(submitData, isClose).then((res) => {
|
|
|
+ const { saveLoading, isClose } = res
|
|
|
+ taskLoading.value = saveLoading
|
|
|
+ allVisible.taskModalVisible = isClose
|
|
|
+ globalPopup?.showSuccess('新增成功')
|
|
|
+ }).catch((err) => {
|
|
|
+ const { saveLoading, isClose, message } = err
|
|
|
+ taskLoading.value = saveLoading
|
|
|
+ allVisible.taskModalVisible = isClose
|
|
|
+ globalPopup?.showSuccess(message)
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
function showVisible(type: keyof typeof allVisible) { // 显示弹窗
|
|
|
allVisible[type] = true
|
|
|
}
|