Browse Source

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Min 11 tháng trước cách đây
mục cha
commit
b72f976f72

+ 133 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/components/detailcompinents/relatedTasks.vue

@@ -0,0 +1,133 @@
+<template>
+    <div class="relatedTasks pl-4 pr-4 pt-3 pb-3 h-full flex flex-col">
+        <div class="flex justify-between">
+            <div class="title">相关任务</div>
+            <div>
+                <el-button type="primary" @click="newTask()">新建任务</el-button>
+            </div>
+        </div>
+        <div class="flex-1 overflow-auto pt-3">
+            <el-table :data="relatedTaskstable" border style="width: 100%;height: 100%;">
+                <el-table-column prop="taskName" label="任务名称">
+                    <template #default="scope">
+                        <el-button link type="primary" size="large" @click="toTask()">{{
+                            scope.row.taskName
+                        }}</el-button>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="priorityStr" label="优先级" width="130" />
+                <el-table-column prop="statusStr" label="状态" width="130" />
+                <el-table-column prop="executorNamesStr" label="执行人" width="130" />
+                <el-table-column prop="startTimes" label="开始时间" width="130" />
+                <el-table-column prop="endTimes" label="截至时间" width="130" />
+            </el-table>
+        </div>
+    </div>
+
+    <!-- 新建任务 -->
+    <TaskModal :visible="allVisible.taskModalVisible" :edit-form="taskModalForm" :save-loading="taskLoading"
+        @close="closeTaskModal" @submit="submitForm" :title="'新建任务'" :disabled-list="props.disabledList" />
+</template>
+<script lang="ts" setup>
+import { PRIORITY } from '../TaskModal/api';
+import { STATUS } from '../../pages/tasks/api';
+import { formatDate } from '../../utils/times';
+import { createTaskFromType } from '../../utils/tools';
+import { ElNotification, NotificationParamsTyped } from 'element-plus'
+import { ref, reactive, onMounted, watchEffect } from 'vue'
+import { useRouter } from "vue-router";
+import TaskModal from '../TaskModal/index.vue'
+import { createTask } from '../TaskModal/taskFunction';
+import { ITEM_RENDER_EVT } from 'element-plus/es/components/virtual-list/src/defaults';
+import { Props, Emits } from './type';
+
+const props = defineProps<Props>()
+const emits = defineEmits<Emits>();
+
+type saveLoadingType = "1" | "2" | "3" | "4"; //1是没有保存, 2是正在保存, 3是保存成功, 4是保存失败
+
+const relatedTaskstable = ref([])
+const information = ref<any>({})
+const router = useRouter()
+const taskLoading = ref<saveLoadingType>('1')
+const taskModalForm = ref({}) // 任务弹窗表单
+const allVisible = reactive({
+    taskModalVisible: false
+})
+
+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('新建成功', 'success')
+        emits('refreshData')
+    }).catch((err) => {
+        const { saveLoading, isClose, message } = err
+        taskLoading.value = saveLoading
+        allVisible.taskModalVisible = isClose
+        globalPopup(message, 'error')
+    })
+}
+
+function globalPopup(str: string, type: string) {
+    notificationTiop({
+      message: str || '成功',
+      type: type,
+      title: "提示",
+      duration: 2000
+    })
+}
+
+const notificationTiop = (options: NotificationParamsTyped) => {
+  ElNotification(options)
+}
+
+function newTask() {
+    const { id } = information.value
+    taskModalForm.value = { ...createTaskFromType(props.formTaskType), [props.filed as any]: id, }
+    allVisible.taskModalVisible = true
+}
+
+function toTask() {
+    router.push({
+        path: `/tasks`
+    })
+}
+
+function closeTaskModal() {
+    allVisible.taskModalVisible = false
+}
+
+// 接收参数赋值
+function receiveAssignment(item: any) {
+    console.log(item, '<==== 过来的值')
+    information.value = item.information
+    const dataVal = item.data
+    for (let i in dataVal) {
+        dataVal[i].executorNamesStr = (dataVal[i].executorNames || []).join(','),
+            dataVal[i].startTimes = dataVal[i].startDate ? formatDate(new Date(dataVal[i].startDate)) : '',
+            dataVal[i].endTimes = dataVal[i].endDate ? formatDate(new Date(dataVal[i].endDate)) : '',
+            dataVal[i].priorityStr = PRIORITY.find(item => item.value == dataVal[i].priority)?.label || '',
+            dataVal[i].statusStr = STATUS.find(item => item.value == dataVal[i].status)?.label || ''
+    }
+    relatedTaskstable.value = dataVal
+}
+
+watchEffect(() => {
+    receiveAssignment(props)
+});
+
+// 生命周期钩子
+onMounted(() => {
+});
+</script>
+<style scoped lang="scss">
+.relatedTasks {
+    .title {
+        font-size: 18px;
+        color: #000
+    }
+}
+</style>

+ 50 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/components/detailcompinents/type.d.ts

@@ -0,0 +1,50 @@
+type TASK_VALUE_TYPE = 0 | 1 | 2 | 3;
+type tableTypeFiled = {
+    id: number,
+    status: number,
+    priority: number,
+    executorNames: Array,
+    startDate: string,
+    endDate: string,
+}
+export interface Props {
+    /**
+     * data: 任务 Table 数据
+     */
+    data: tableTypeFiled[];
+    /**
+     * information: 详情数据
+     */
+    information: any;
+    /**
+     * disabledList:新建任务需要禁用的字段(参考 TaskModal 文件)
+     */
+    disabledList?: (
+        | "taskName"
+        | "priority"
+        | "taskType"
+        | "customId"
+        | "businessOpportunityId"
+        | "orderId"
+        | "clueId"
+        | "contactsId"
+        | "executorId"
+        | "startDate"
+        | "endDate"
+    )[];
+    /** 
+     * formTaskType: 任务类型  0是客户, 1是商机, 2是销售订单 ,3是线索
+     */
+    formTaskType: TASK_VALUE_TYPE,
+    /**
+     * 详情数据中需要关联的任务类型字段
+     */
+    filed?: 'customId' | 'businessOpportunityId' | 'orderId' | 'clueId' 
+}
+
+export interface Emits {
+    /**
+     *  新建任务后触发的更新数据事件
+     */
+    (event: "refreshData"): void;
+}

+ 5 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/api.ts

@@ -2,3 +2,8 @@ export const SENDVCODE = "/user/sendVcode";     //发送验证码
 export const REGISTER = "/user/insertCompany";  //注册
 export const LOGIN = "/user/loginAdmin";        //登录
 export const IMPORTTIMELIST = "/sys-form/getExportTemplate" // 下载模板
+
+export const SEX: sexTYpe[] = [
+    { label: "男", value: '1' },
+    { label: "女", value: '0' },
+];

+ 5 - 3
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/detail/index.vue

@@ -40,7 +40,7 @@
 
       <div class="w-full h-auto flex justify-between mt-2">
         <div class="bg-white shadow-md rounded-md" style="width: 65%;">
-          <RelatedTasks />
+          <DetailCompinents :data="detailCompinentsData" :information="businessInfo" :formTaskType="1" :filed="'businessOpportunityId'" :disabledList="['taskType', 'businessOpportunityId']" @refreshData="getDetail" />
         </div>
         <div class="bg-white ml-2 shadow-md rounded-md flex-1">
           <OperationRecord />
@@ -66,7 +66,8 @@ import { BUSIESS_ALL, BUSIESS_GETSATE, BUSIESS_INFO } from '../api'
 
 import Information from '../component/information.vue'
 import Attachment from '../component/attachment.vue'
-import RelatedTasks from '../component/relatedTasks.vue';
+// import RelatedTasks from '../component/relatedTasks.vue';
+import DetailCompinents from '@/components/detailcompinents/relatedTasks.vue'
 import OperationRecord from '../component/operationRecord.vue';
 import Products from '../component/products.vue';
 import { post } from "@/utils/request";
@@ -78,6 +79,7 @@ type stageListType = {
 }
 
 const route = useRoute()
+const detailCompinentsData = ref([])
 const optionVal = ref<any>('')
 const stageStatusVal = ref('')
 const options = ref<optionType[]>([])
@@ -93,8 +95,8 @@ const stageList = ref<stageListType[]>([])
 function getDetail() {
   allLoading.skeletonLoading
   post(BUSIESS_INFO, { id: optionVal.value }).then(({ data }) => {
-    console.log(data, '<====== 数据')
     businessInfo.value = (data || []);
+    detailCompinentsData.value = data.taskList || []
   }).finally(() => {
     allLoading.skeletonLoading
   })

+ 19 - 10
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/contacts/api.ts

@@ -1,11 +1,15 @@
+import { SEX } from '../api.ts'
 export const MOD = 'contacts'
+export const URL = '/contacts'
 
 export const GETSYSFILED = "/sys-dict/getListByCode";
 export const GETPERSONNEL = "/user/getSimpleActiveUserList";
-export const GETGENERATEFOEM = `sys-form/getListByCode${MOD}`
+export const GETGENERATEFOEM = `sys-form/getListByCode/${MOD}`
+
+export const URL_PAGECONTACTS = `${URL}/pageContacts`
 
 export const actionButtons: any[] = [
-    { text: '批量转移' },
+    { text: '新建' },
     { text: '批量删除' },
     { text: '导入' },
     { text: '导出' },
@@ -13,12 +17,17 @@ export const actionButtons: any[] = [
 
 export const tableColumns: TableColumn[] = [
     { prop: 'name', label: '联系人', event: 'toDetali', width: '150' },
-    { prop: 'mobile', label: '客户名称', width: '150' },
-    { prop: 'email', label: '电话号码', width: '200' },
-    { prop: 'wechat', label: '邮箱', width: '200' },
+    { prop: 'customName', label: '客户名称', width: '150' },
+    { prop: 'phone', label: '电话号码', width: '200' },
+    { prop: 'email', label: '邮箱', width: '200' },
     { prop: 'position', label: '职务', width: '100' },
-    { prop: 'company', label: '性别', width: '100' },
-    { prop: 'companya', label: '负责人', width: '100' },
-    { prop: 'companyb', label: '创建人', width: '100' },
-    { prop: 'companyc', label: '创建时间', width: '200' },
-]
+    { prop: 'sex', label: '性别', width: '100', event: 'getSex' },
+    { prop: 'ownerName', label: '负责人', width: '100' },
+    { prop: 'creatorName', label: '创建人', width: '100' },
+    { prop: 'createTime', label: '创建时间', width: '200' },
+]
+
+export const getSex = (val: number) => {
+    let sexItem = SEX.filter((item: sexTYpe) => item.value == val)
+    return sexItem.length > 0 ? sexItem[0].label : ''
+}

+ 45 - 20
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/contacts/index.vue

@@ -6,13 +6,19 @@
           <!-- 筛选条件 -->
           <el-form :model="filterForm" label-width="70px" style="max-width: 600px">
             <el-form-item v-for="(item, index) in filterItems" :key="index" :label="item.label">
-              <el-input v-if="item.type === 'input'" v-model="filterForm[item.key as keyof FilterForm]" clearable placeholder="请输入"></el-input>
+              <el-input v-if="item.type === 'input'" v-model="filterForm[item.key as keyof FilterForm]" clearable
+                placeholder="请输入"></el-input>
               <el-select v-else v-model="filterForm[item.key as keyof FilterForm]" placeholder="请选择" clearable>
                 <el-option v-for="option in item.options" :key="option.id" :label="option.name" :value="option.id" />
               </el-select>
             </el-form-item>
           </el-form>
         </div>
+        <div class="w-full flex p-3 shadow-[0_-3px_5px_0px_rgba(0,0,0,0.2)]">
+          <El-button class="w-full" @click="resetForm()" :loading="allLoading.formTableLading">重置</El-Button>
+          <El-button type="primary" class="w-full" :loading="allLoading.formTableLading"
+            @click="getContactPerson()">搜索</El-Button>
+        </div>
       </div>
     </div>
     <div class="flex-1 p-5 overflow-auto">
@@ -25,10 +31,15 @@
           <!-- 表格 -->
           <el-table ref="clueTableRef" :data="formTable" border v-loading="allLoading.formTableLading"
             style="width: 100%;height: 100%;">
-            <el-table-column v-for="(column, index) in tableColumns" :key="index" :prop="column.prop" :label="column.label" :width="column.width">
+            <el-table-column v-for="(column, index) in tableColumns" :key="index" :prop="column.prop"
+              :label="column.label" :width="column.width">
               <template #default="scope">
                 <template v-if="column.event === 'toDetali'">
-                  <el-button link type="primary" size="large" @click="toDetali(scope.row)">{{ scope.row.name }}</el-button>
+                  <el-button link type="primary" size="large" @click="toDetali(scope.row)">{{ scope.row.name
+                  }}</el-button>
+                </template>
+                <template v-if="column.event === 'getSex'">
+                  {{ getSex(scope.row.sex) }}
                 </template>
               </template>
             </el-table-column>
@@ -43,8 +54,7 @@
         </div>
         <div class="flex justify-end pt-3">
           <!-- 分页 -->
-          <el-pagination layout="total, prev, pager, next, sizes" :total="formTablePaging.total"
-            :hide-on-single-page="true" />
+          <el-pagination layout="total, prev, pager, next, sizes" :total="tableTotal" :hide-on-single-page="true" />
         </div>
       </div>
     </div>
@@ -55,7 +65,7 @@
 import { ref, reactive, onMounted, inject } from "vue";
 import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, getLastDayOfMonth, formatDate } from '@/utils/tools'
 import { post, get } from "@/utils/request";
-import { actionButtons, tableColumns, GETSYSFILED, GETPERSONNEL, GETGENERATEFOEM, MOD } from "./api";
+import { actionButtons, tableColumns, GETSYSFILED, GETPERSONNEL, GETGENERATEFOEM, MOD, URL_PAGECONTACTS, getSex } from "./api";
 import { useRouter, useRoute } from "vue-router";
 
 const router = useRouter()
@@ -68,28 +78,26 @@ const filterForm = reactive<FilterForm>({ // 筛选条件
   createId: '',
   email: '',
 });
+const formTablePaging = reactive({ // 分页条件
+  pageIndex: 1,
+  pageSize: 10,
+})
+const tableTotal = ref(0)
 const selectData = reactive({ // 下拉数据
   Personnel: [] as personnelInterface[],
   Customer: [] as any[],
 })
 const filterItems = ref<FilterItem[]>([
-    { label: '联系人', key: 'contactPerson', type: 'input' },
-    { label: '客户名称', key: 'customerId', type: 'select', options: selectData.Customer },
-    { label: '电话号码', key: 'phoneNumber', type: 'input' },
-    { label: '邮箱', key: 'email', type: 'input' },
-    { label: '负责人', key: 'responsibleId', type: 'select', options: selectData.Personnel },
-    { label: '创建人', key: 'createId', type: 'select', options: selectData.Personnel },
+  { label: '联系人', key: 'contactPerson', type: 'input' },
+  { label: '客户名称', key: 'customerId', type: 'select', options: selectData.Customer },
+  { label: '电话号码', key: 'phoneNumber', type: 'input' },
+  { label: '邮箱', key: 'email', type: 'input' },
+  { label: '负责人', key: 'responsibleId', type: 'select', options: selectData.Personnel },
+  { label: '创建人', key: 'createId', type: 'select', options: selectData.Personnel },
 ])
-const formTablePaging = reactive({ // 分页条件
-  currentPage: 1,
-  pageSize: 10,
-  total: 0,
-})
 const generateFormData = ref([]) // 自定义表单数据
 
-const formTable = ref([
-  {name: '联系人', mobile: '13311112222', email: '123@qq.com', responsible: '张三', createId: '张三'}
-]) // 表格数据
+const formTable = ref([]) // 表格数据
 const allLoading = reactive({ // 按钮加载 Loading
   formTableLading: false,
 })
@@ -104,6 +112,22 @@ function toDetali(row: any) {
   })
 }
 
+function getContactPerson() {
+  allLoading.formTableLading = true
+  const formVal = getFromValue(filterForm)
+  post(URL_PAGECONTACTS, { ...formVal, ...formTablePaging }).then((res) => {
+    const { records, total } =  res.data
+    formTable.value = records
+    tableTotal.value = total
+  }).finally(() => {
+    allLoading.formTableLading = false
+  })
+}
+
+function resetForm() {
+  console.log('重置联系人');
+}
+
 async function getSystemField() {
   const systemField = getAllListByCode([])
   for (let i in systemField) {
@@ -143,6 +167,7 @@ function setFilterItems() {
 
 onMounted(() => {
   getSystemField()
+  getContactPerson()
 })
 </script>
 

+ 3 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/thread/detail/components/information.vue

@@ -229,6 +229,9 @@ function receiveAssignment(item: any) {
 function showVisible(filed: keyof typeof dialogVisible) {
     if (filed == 'clueDialogVisible') {
         transferValue.value = ''
+        allText.clueText = '转移线索'
+    } else {
+        allText.clueText = '认领线索'
     }
     dialogVisible[filed] = true
 }

+ 85 - 51
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/thread/detail/components/relatedTasks.vue

@@ -3,73 +3,107 @@
         <div class="flex justify-between">
             <div class="title">相关任务</div>
             <div>
-                <el-button type="primary">新建任务</el-button>
+                <el-button type="primary" @click="newTask()">新建任务</el-button>
             </div>
         </div>
         <div class="flex-1 overflow-auto pt-3">
             <el-table :data="relatedTaskstable" border style="width: 100%;height: 100%;">
                 <el-table-column prop="taskName" label="任务名称">
                     <template #default="scope">
-                        <el-button link type="primary" size="large">{{
+                        <el-button link type="primary" size="large" @click="toTask()">{{
                             scope.row.taskName
                         }}</el-button>
                     </template>
                 </el-table-column>
-                <el-table-column prop="priority" label="优先级" width="130" />
-                <el-table-column prop="status" label="状态" width="130" />
-                <el-table-column prop="executor" label="执行人" width="130" />
-                <el-table-column prop="startTime" label="开始时间" width="130" />
-                <el-table-column prop="endTime" label="截至时间" width="130" />
+                <el-table-column prop="priorityStr" label="优先级" width="130" />
+                <el-table-column prop="statusStr" label="状态" width="130" />
+                <el-table-column prop="executorNamesStr" label="执行人" width="130" />
+                <el-table-column prop="startTimes" label="开始时间" width="130" />
+                <el-table-column prop="endTimes" label="截至时间" width="130" />
             </el-table>
         </div>
     </div>
+
+    <!-- 新建任务 -->
+    <TaskModal :visible="allVisible.taskModalVisible" :edit-form="taskModalForm" :save-loading="taskLoading"
+        @close="closeTaskModal" @submit="submitForm" :title="'新建任务'" :disabled-list="['taskType', 'clueId']" />
 </template>
 <script lang="ts" setup>
-import { ref, reactive, onMounted, onUnmounted, defineExpose, inject } from 'vue'
+import { PRIORITY } from '@/components/TaskModal/api';
+import { STATUS } from '@/pages/tasks/api';
+import { formatDate } from '@/utils/times';
+import { createTaskFromType } from '@/utils/tools';
+import { ref, reactive, onMounted, watchEffect, inject } from 'vue'
+import { useRouter } from "vue-router";
+import TaskModal from '@/components/TaskModal/index.vue'
+import { createTask } from '@/components/TaskModal/taskFunction';
+const globalPopup = inject<GlobalPopup>('globalPopup')
+const emits = defineEmits(['refreshData']);
+
+const props = defineProps<{
+    data: any,
+    information: any
+}>()
+
+const relatedTaskstable = ref([])
+const information = ref<any>({})
+const router = useRouter()
+const taskLoading = ref<saveLoadingType>('1')
+const taskModalForm = ref({}) // 任务弹窗表单
+const allVisible = reactive({
+    taskModalVisible: false
+})
+
+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('新增成功')
+        emits('refreshData')
+    }).catch((err) => {
+        const { saveLoading, isClose, message } = err
+        taskLoading.value = saveLoading
+        allVisible.taskModalVisible = isClose
+        globalPopup?.showError(message)
+    })
+}
+
+function newTask() {
+    const { id } = information.value
+    taskModalForm.value = { ...createTaskFromType(3), clueId: id, }
+    allVisible.taskModalVisible = true
+}
+
+function toTask() {
+    router.push({
+        path: `/tasks`
+    })
+}
+
+function closeTaskModal() {
+    allVisible.taskModalVisible = false
+}
+
+// 接收参数赋值
+function receiveAssignment(item: any) {
+    information.value = item.information
+    const dataVal = item.data
+    for (let i in dataVal) {
+        dataVal[i].executorNamesStr = (dataVal[i].executorNames || []).join(','),
+            dataVal[i].startTimes = dataVal[i].startDate ? formatDate(new Date(dataVal[i].startDate)) : '',
+            dataVal[i].endTimes = dataVal[i].endDate ? formatDate(new Date(dataVal[i].endDate)) : '',
+            dataVal[i].priorityStr = PRIORITY.find(item => item.value == dataVal[i].priority)?.label || '',
+            dataVal[i].statusStr = STATUS.find(item => item.value == dataVal[i].status)?.label || ''
+    }
+    relatedTaskstable.value = dataVal
+}
+
+watchEffect(() => {
+    receiveAssignment(props)
+});
 
-const relatedTaskstable = ref([{
-    taskName: '任务名称20240316-tempalsbls',
-    priority: '中',
-    status: '进行中',
-    executor: '张三',
-    startTime: '2024-04-01',
-    endTime: '2024-04-01',
-}, {
-    taskName: '任务名称20240316-tempalsbls',
-    priority: '中',
-    status: '进行中',
-    executor: '张三',
-    startTime: '2024-04-01',
-    endTime: '2024-04-01',
-}, {
-    taskName: '任务名称20240316-tempalsbls',
-    priority: '中',
-    status: '进行中',
-    executor: '张三',
-    startTime: '2024-04-01',
-    endTime: '2024-04-01',
-}, {
-    taskName: '任务名称20240316-tempalsbls',
-    priority: '中',
-    status: '进行中',
-    executor: '张三',
-    startTime: '2024-04-01',
-    endTime: '2024-04-01',
-}, {
-    taskName: '任务名称20240316-tempalsbls',
-    priority: '中',
-    status: '进行中',
-    executor: '张三',
-    startTime: '2024-04-01',
-    endTime: '2024-04-01',
-}, {
-    taskName: '任务名称20240316-tempalsbls',
-    priority: '中',
-    status: '进行中',
-    executor: '张三',
-    startTime: '2024-04-01',
-    endTime: '2024-04-01',
-}])
 // 生命周期钩子
 onMounted(() => {
 });

+ 2 - 2
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/thread/detail/index.vue

@@ -10,7 +10,7 @@
     </div>
     <div class="layout pl-3 pr-3 pb-3">
       <div class="bg-white w-2/3 shadow-md rounded-md">
-        <RelatedTasks :data="relatedTasks" :information="information" @refreshData="refreshData"></RelatedTasks>
+        <DetailCompinents :data="relatedTasks" :information="information" :formTaskType="3" :disabledList="['taskType', 'clueId']" :filed="'clueId'" @refreshData="refreshData"></DetailCompinents>
       </div>
       <div class="bg-white w-1/3 ml-3 shadow-md rounded-md">
         <OperationRecord :data="operationRecord" :information="information" @refreshData="refreshData"></OperationRecord>
@@ -22,7 +22,7 @@
 <script lang="ts" setup>
 import Information from './components/information.vue'
 import Attachment from './components/attachment.vue'
-import RelatedTasks from './components/relatedTasks.vue';
+import DetailCompinents from '@/components/detailcompinents/relatedTasks.vue'
 import OperationRecord from './components/operationRecord.vue';
 import { ref, reactive, onMounted, inject } from "vue";
 import { post, get } from "@/utils/request";

+ 15 - 2
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/thread/index.vue

@@ -140,7 +140,7 @@
 
     <DeteleTables :visibles="dialogVisible.deteleClueDialogVisible" @showDeteleClue="showDeteleClue" />
 
-    <TaskModal :visible="dialogVisible.taskModalVisible" :edit-form="taskModalForm" :save-loading="'1'"
+    <TaskModal :visible="dialogVisible.taskModalVisible" :edit-form="taskModalForm" :save-loading="taskLoading"
       @close="closeTaskModal" @submit="submitForm" :title="'新建任务'" :disabled-list="['taskType', 'clueId']" />
   </div>
 </template>
@@ -155,6 +155,7 @@ import { useRouter, useRoute } from "vue-router";
 import { GenerateForm } from '@zmjs/form-design';
 import TaskModal from '@/components/TaskModal/index.vue'
 import DeteleTables from "./deteleTables.vue";
+import { createTask } from "@/components/TaskModal/taskFunction";
 
 // 定义类型
 interface fixedDataInterface {
@@ -190,6 +191,7 @@ const filterCriteriaForm = reactive<filterCriteriaFormType>({ // 筛选条件for
   pageFrom: 10
 })
 const generateFormKey = ref(1)
+const taskLoading = ref<saveLoadingType>('1')
 const allLoading = reactive({
   clueTableLading: false,
   generateFormLading: false,
@@ -272,7 +274,18 @@ function closeTaskModal() {
 }
 
 function submitForm(submitData: any, isClose: boolean) {
-  console.log(submitData, isClose)
+  taskLoading.value = '2'
+  createTask(submitData, isClose).then((res) => {
+    const { saveLoading, isClose } = res
+    taskLoading.value = saveLoading
+    dialogVisible.taskModalVisible = isClose
+    globalPopup?.showSuccess('新增成功')
+  }).catch((err) => {
+    const { saveLoading, isClose, message } = err
+    taskLoading.value = saveLoading
+    dialogVisible.taskModalVisible = isClose
+    globalPopup?.showError(message)
+  })
 }
 
 function editClue(item: any) {

+ 3 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/type.d.ts

@@ -30,4 +30,6 @@ type componentType = "success" | "info" | "warning" | "error"
 
 type TaskResponse = { saveLoading: saveLoadingType, isClose: boolean, message?: string }
 
-type optionType = { value: number | string, label: string | number }
+type optionType = { value: number | string, label: string | number }
+
+type sexTYpe = { value: number | string, label: string }