Преглед на файлове

提交客户管家代码

Lijy преди 11 месеца
родител
ревизия
66abd53c23

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

@@ -39,7 +39,7 @@ export interface Props {
     /**
      * 详情数据中需要关联的任务类型字段
      */
-    filed?: 'customId' | 'businessOpportunityId' | 'orderId' | 'clueId' 
+    filed?: 'customId' | 'businessOpportunityId' | 'orderId' | 'clueId' | 'contactsId'
 }
 
 export interface Emits {

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

@@ -15,6 +15,8 @@ export const URL_BATCHDETELE = `${URL}/confirmDeleteContacts`
 export const URL_RECYCLELIST = `${URL}/getDeletedContacts`
 export const URL_DETELEITEM = `${URL}/confirmDeleteContacts`
 export const URL_RESTORE = `${URL}/returnContacts`
+export const URL_GETALL = `${URL}/getAllContacts`
+export const URL_GETDETAIL = `${URL}/getContactsDetail`
 
 export const actionButtons: any[] = [
     { text: '新建联系人' },

+ 33 - 8
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/contacts/detail/index.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="h-full flex p-3 flex-col businessDetail">
+    <div class="h-full flex p-3 flex-col businessDetail" v-loading="pageLoading">
         <div class="w-full bg-white p-2 mb-2 shadow-md rounded-md flex items-center">
             <div class="icon mr-4">
                 <el-link :underline="false" @click="backPath()">
@@ -7,8 +7,8 @@
                 </el-link>
             </div>
             <div class="mr-8">
-                <el-select v-model="value" placeholder="请选择" style="width: 150px">
-                    <el-option v-for="item in options" :key="item.id" :label="item.productName" :value="item.id" />
+                <el-select v-model="values" placeholder="请选择" style="width: 150px">
+                    <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
                 </el-select>
             </div>
         </div>
@@ -25,7 +25,8 @@
 
             <div class="w-full h-auto flex justify-between mt-2">
                 <div class="bg-white shadow-md rounded-md" style="width: 65%;">
-                    <RelatedTasks :data="relatedTasks" :information="information" />
+                    <!-- <RelatedTasks :data="relatedTasks" :information="information" /> -->
+                    <Detailcompinents :data="relatedTasks" :information="information" :formTaskType="0" :filed="'contactsId'" :disabledList="['contactsId']" @refreshData="getDetail" />
                 </div>
                 <div class="bg-white ml-2 shadow-md rounded-md flex-1">
                     <OperationRecord :data="operationRecord" />
@@ -45,26 +46,50 @@
 import { ref, reactive, onMounted, inject } from "vue";
 import { Edit, ArrowLeft as IconView } from '@element-plus/icons-vue'
 import { backPath } from '../../../utils/tools'
+import { useRoute } from "vue-router";
+import { post } from "@/utils/request";
+import { URL_GETALL, URL_GETDETAIL } from "../api";
 
 import Information from '../component/information.vue'
 import Attachment from '../component/attachment.vue'
 import RelatedTasks from '../component/relatedTasks.vue'
 import OperationRecord from '../component/operationRecord.vue'
+import Detailcompinents from '@/components/detailcompinents/relatedTasks.vue'
 import RelatedBusiness from '../component/relatedBusiness.vue'
 
+const route = useRoute()
+const globalPopup = inject<GlobalPopup>('globalPopup')
 const information = ref({}) // 基本信息
 const attachment = ref([]) // 附件
 const relatedTasks = ref([]) // 相关任务
 const operationRecord = ref([]) // 操作记录
 const relatedBusiness = ref([]) // 相关商机
-
+const rowId = ref(+(route.query.id || ''))
+const values = ref<number | string>('')
+const options = ref<optionType[]>([])
 const pageLoading = ref(false)
 
-const value = ref('')
-const options: any = ref([])
+function getDetail() {
+    pageLoading.value = true
+    post(URL_GETDETAIL, {}).then((res) => {
+        console.log(res)
+    }).finally(() => {
+        pageLoading.value = false
+    })
+}
+
+function getAllContacts() {
+    post(URL_GETALL, {}).then(({ data }) => {
+        options.value = (data || []).map((item: any) => ({ value: item.id, label: item.name }))
+    }).catch((err) => {
+        globalPopup?.showError(err.message)
+    })
+}
 
 onMounted(() => {
-    
+    values.value = rowId.value || ''
+    getAllContacts()
+    getDetail()
 })
 </script>
     

+ 35 - 3
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/contacts/index.vue

@@ -49,9 +49,10 @@
                 </template>
               </template>
             </el-table-column>
-            <el-table-column :label="'操作'" :width="'140px'" fixed="right">
+            <el-table-column :label="'操作'" :width="'200px'" fixed="right">
               <template #default="scope">
                 <el-button link type="primary" size="large" @click="editContacts(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="contactsDeteleItem(scope.row.id, scope.row.customName)">删除</el-button>
               </template>
@@ -113,12 +114,18 @@
         </div>
       </div>
     </el-dialog>
+
+    <!-- 任务 -->
+    <TaskModal :visible="allVisible.taskModalVisible" :edit-form="taskModalForm" :save-loading="taskLoading"
+      @close="closeVisible('taskModalVisible')" @submit="submitForm" :title="'新建任务'"
+      :disabled-list="['contactsId']" />
+
   </div>
 </template>
 
 <script lang="ts" setup>
 import { ref, reactive, onMounted, inject } from "vue";
-import { getAllListByCode, getFromValue, resetFromValue, getTemplateKey, confirmAction, downloadTemplate, downloadFile } from '@/utils/tools'
+import { getAllListByCode, getFromValue, resetFromValue, getTemplateKey, confirmAction, downloadTemplate, downloadFile, createTaskFromType } from '@/utils/tools'
 import { post, get, uploadFile } from "@/utils/request";
 import { actionButtons, tableColumns, GETSYSFILED, GETPERSONNEL, GETGENERATEFOEM, MOD, URL_PAGECONTACTS, getSex, URL_ADD, URL_UPLOAD, URL_BATCHDETELE, URL_DETELERECYCLE, IMPORTMOD } from "./api";
 import { useRouter, useRoute } from "vue-router";
@@ -127,6 +134,8 @@ import { URL_FETALL } from "../customer/api";
 import { ElTable, UploadRequestOptions } from "element-plus";
 
 import DeteleTables from './component/deteleTables.vue'
+import TaskModal from '@/components/TaskModal/index.vue'
+import { createTask } from "@/components/TaskModal/taskFunction";
 
 const router = useRouter()
 const globalPopup = inject<GlobalPopup>('globalPopup')
@@ -166,6 +175,8 @@ const contactsTemplateRef = ref<typeof GenerateForm>()
 const contactsTableRef = ref<InstanceType<typeof ElTable>>()
 const formTable = ref([]) // 表格数据
 const batchTableData = ref([])
+const taskModalForm = ref({})
+const taskLoading = ref<saveLoadingType>('1')
 const allLoading = reactive({ // 按钮加载 Loading
   formTableLading: false,
   editContactsSaveLoading: false,
@@ -186,6 +197,27 @@ const allText = reactive({
 })
 
 // 方法
+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?.showError(message)
+  })
+}
+
+function newTask(item: any) {
+  const { id } = item
+  taskModalForm.value = { ...createTaskFromType(0), contactsId: id, }
+  showVisible('taskModalVisible')
+}
+
 function exportCustomerTableList() {
   allLoading.exoprtLoading = true
   let valueForm = getFromValue(filterForm)
@@ -296,7 +328,7 @@ function setTemplateVal(val: any = {}) {
 function toDetali(row: any) {
   router.push({
     path: `${MOD}/detail`,
-    query: { id: row.name }
+    query: { id: row.id }
   })
 }
 

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

@@ -92,12 +92,10 @@ function getDetail() {
 
 function getAllCustomer() {
   get(URL_FETALL).then(({ data }) => {
-      options.value = data.map((item: any) => {
-        return {
+      options.value = data.map((item: any) => ({
           value: item.id,
           label: item.customName
-        }
-      })
+      }))
   })
 }