瀏覽代碼

提交代码

Lijy 11 月之前
父節點
當前提交
f058ceb7d8

+ 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' },
+];

+ 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(() => {
 });

+ 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 }