Parcourir la source

提交客户管家代码

Lijy il y a 11 mois
Parent
commit
f795f7102f

+ 1 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/index.vue

@@ -143,7 +143,7 @@
       <div class="p-8">
         <div class="ml-4 mr-4">
           <div class="flex items-center">1、点击下载 <el-link type="primary" @click="downloadTemplate(MODURL, '商机导入模板.xlsx')">商机导入模板.xlsx</el-link></div>
-          <div class="mt-4">2、填写excel文件、商机名称、商机金额、商机阶段</div>
+          <div class="mt-4">2、填写excel文件、商机名称、商机金额、商机阶段必填</div>
         </div>
       </div>
     </el-dialog>

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

@@ -3,6 +3,7 @@ export const IMPORTMOD = 'Customer'
 export const PREFIX = '/custom'
 export const GETSYSFILED = '/sys-dict/getListByCode'
 export const GETPERSONNEL = '/user/getSimpleActiveUserList'
+export const GETALLCLUE = '/clue/getAll'
 export const URL_TEMPLALE = `/sys-form/getListByCode${MOD}`
 export const URL_TABLELIST = `${PREFIX}/list`
 export const URL_EDITSAVE = `${PREFIX}/insertAndUpdate`

+ 69 - 9
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/customer/index.vue

@@ -53,11 +53,12 @@
       <div class="bg-white w-full h-full p-3 shadow-md rounded-md flex flex-col">
         <div class="flex justify-end pb-3">
           <el-button type="primary" @click="editCustomer(false)">新建客户</el-button>
-          <el-button type="primary" @click="showVisible('batchTransferVisible')" :disabled="batchTableData.length <= 0">批量转移</el-button>
+          <el-button type="primary" @click="showVisible('batchTransferVisible')"
+            :disabled="batchTableData.length <= 0">批量转移</el-button>
           <el-button type="primary" @click="batchDeteleItem()" :disabled="batchTableData.length <= 0">批量删除</el-button>
           <el-button type="primary" @click="showVisible('deteleCustomerVisible')">回收站</el-button>
-          <el-button type="primary">导入</el-button>
-          <el-button type="primary">导出</el-button>
+          <el-button type="primary" @click="showVisible('importVisible')">导入</el-button>
+          <el-button type="primary" @click="exportCustomerTableList()" :loading="allLoading.exoprtLoading">导出</el-button>
         </div>
         <div class="flex-1 w-full overflow-hidden">
           <el-table ref="customerTableRef" :data="customerTable" border v-loading="allLoading.customerTableLading"
@@ -135,10 +136,31 @@
             <el-option v-for="item in fixedData.Personnel" :key="item.id" :label="item.name" :value="item.id" />
           </el-select>
         </div>
-        <div class="pl-3 text-[#e94a4a]">转移后,将看不到此商机</div>
+        <div class="pl-3 text-[#e94a4a]">转移后,将看不到此客户</div>
       </div>
     </el-dialog>
 
+    <el-dialog v-model="allVisible.importVisible" width="680" :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">导入产品</h4>
+          <div class="flex">
+            <el-upload class="upload-demo mr-3" :limit="1" :show-file-list="false" accept=".xlsx"
+              :http-request="importBusiness">
+              <el-button type="primary" :loading="allLoading.importLoading">导入</el-button>
+            </el-upload>
+            <el-button @click="allVisible.importVisible = false">取消</el-button>
+          </div>
+        </div>
+      </template>
+      <div class="p-8">
+        <div class="ml-4 mr-4">
+          <div class="flex items-center">1、点击下载 <el-link type="primary"
+              @click="downloadTemplate(IMPORTMOD, allText.importText)">{{ allText.importText }}</el-link></div>
+          <div class="mt-4">2、填写excel文件、客户名称必填</div>
+        </div>
+      </div>
+    </el-dialog>
 
     <!-- 任务 -->
     <TaskModal :visible="allVisible.taskModalVisible" :edit-form="taskModalForm" :save-loading="taskLoading"
@@ -152,13 +174,13 @@
 
 <script lang="ts" setup>
 import { ref, reactive, onMounted, inject } from "vue";
-import { MOD, GETSYSFILED, GETPERSONNEL, URL_TABLELIST, URL_TEMPLALE, URL_EDITSAVE, URL_DETELER, URL_CLAIM } from './api.ts'
-import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, getLastDayOfMonth, formatDate, getTemplateKey, createTaskFromType, confirmAction } from '@/utils/tools'
-import { post, get } from "@/utils/request";
+import { MOD, GETSYSFILED, GETPERSONNEL, URL_TABLELIST, URL_TEMPLALE, URL_EDITSAVE, URL_DETELER, URL_CLAIM, IMPORTMOD, GETALLCLUE } from './api.ts'
+import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, getLastDayOfMonth, formatDate, getTemplateKey, createTaskFromType, confirmAction, downloadFile, downloadTemplate } from '@/utils/tools'
+import { post, get, uploadFile } from "@/utils/request";
 import { useRouter, useRoute } from "vue-router";
 import { GenerateForm } from '@zmjs/form-design';
 import { createTask } from "@/components/TaskModal/taskFunction";
-import { ElTable } from "element-plus";
+import { ElTable, UploadRequestOptions } from "element-plus";
 
 import TaskModal from '@/components/TaskModal/index.vue'
 import DeteleBusiness from './component/deteleTables.vue'
@@ -216,16 +238,21 @@ const allLoading = reactive({
   editCustomerSaveLoading: false,
   customerTemplateRefLoading: false,
   transferLoading: false,
+  exoprtLoading: false,
+  importLoading: false
 })
 const allVisible = reactive({
   editCustomerVisible: false,
   taskModalVisible: false,
   deteleCustomerVisible: false,
   batchTransferVisible: false,
+  importVisible: false
 })
 const allText = reactive({
   editCustomerText: '新建客户',
   transferText: '批量转移',
+  importText: '客户导入模板.xlsx',
+  exportText: '客户表导出.xlsx'
 })
 const fixedData = reactive({
   ClueSources: [] as fixedDataInterface[],
@@ -249,6 +276,30 @@ const transferPersonnel = ref('')
 
 
 // 定义方法
+async function importBusiness(param: UploadRequestOptions) {
+  allLoading.importLoading = true
+  const formData = new FormData();
+  formData.append('multipartFile', param.file)
+  const res = await uploadFile('接口名称', formData).finally(() => {
+    allLoading.importLoading = false
+  })
+  if (res.code == 'ok') {
+    globalPopup?.showSuccess('导入成功' || '')
+    getCustomerTable()
+    return
+  }
+  globalPopup?.showError(res.msg || '')
+}
+
+function exportCustomerTableList() {
+  allLoading.exoprtLoading = true
+  let valueForm = getFromValue(customerCriteriaForm)
+  post('接口名称', { ...valueForm }).then((res) => {
+    downloadFile(res.data, allText.exportText)
+  }).finally(() => {
+    allLoading.exoprtLoading = false
+  })
+}
 
 function transferBusiness() {
   const ids = batchTableData.value.map((item: any) => item.id).join(',')
@@ -388,7 +439,7 @@ function getCustomerTable() {
 }
 
 async function getSystemField() {
-  const systemField = getAllListByCode(['线索来源', '客户行业', '客户级别'])
+  const systemField = getAllListByCode(['客户行业', '客户级别'])
   for (let i in systemField) {
     const { data } = await get(`${GETSYSFILED}?code=${systemField[i]}`)
     for (let key of Object.keys(fixedData)) {
@@ -408,6 +459,15 @@ async function getSystemField() {
 
   const res = await get(URL_TEMPLALE)
   customerTemplate.value = JSON.parse(res.data[0].config)
+
+  const datas = await get(GETALLCLUE)
+  fixedData.ClueSources = datas.data.map((item: any) => {
+    const { id, clueName } = item
+    return {
+      id,
+      name: clueName
+    }
+  })
 }
 
 function showVisible(type: keyof typeof allVisible) {