|
@@ -29,8 +29,8 @@
|
|
|
<el-button type="primary" @click="editContacts(false)">新建联系人</el-button>
|
|
|
<el-button type="primary" @click="batchDeteleItem" :disabled="batchTableData.length <= 0">批量删除</el-button>
|
|
|
<el-button type="primary" @click="showVisible('deteleContactsVisible')">回收站</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">
|
|
|
<!-- 表格 -->
|
|
@@ -95,7 +95,7 @@
|
|
|
<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>
|
|
|
+ <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">
|
|
@@ -109,7 +109,7 @@
|
|
|
<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 class="mt-4">2、填写excel文件、联系人、客户名称必填</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
@@ -118,7 +118,7 @@
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { ref, reactive, onMounted, inject } from "vue";
|
|
|
-import { getAllListByCode, getFromValue, resetFromValue, getTemplateKey, confirmAction, downloadTemplate } from '@/utils/tools'
|
|
|
+import { getAllListByCode, getFromValue, resetFromValue, getTemplateKey, confirmAction, downloadTemplate, downloadFile } 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";
|
|
@@ -170,7 +170,8 @@ const allLoading = reactive({ // 按钮加载 Loading
|
|
|
formTableLading: false,
|
|
|
editContactsSaveLoading: false,
|
|
|
contactsTemplateRefLoading: false,
|
|
|
- importLoading: false
|
|
|
+ importLoading: false,
|
|
|
+ exoprtLoading: false
|
|
|
})
|
|
|
const allVisible = reactive({
|
|
|
editContactsVisible: false,
|
|
@@ -180,10 +181,21 @@ const allVisible = reactive({
|
|
|
})
|
|
|
const allText = reactive({
|
|
|
editContactsText: '新建联系人',
|
|
|
- importText: '联系人导入模板.xlsx'
|
|
|
+ importText: '联系人导入模板.xlsx',
|
|
|
+ exportText: '联系人导出.xlsx'
|
|
|
})
|
|
|
|
|
|
// 方法
|
|
|
+function exportCustomerTableList() {
|
|
|
+ allLoading.exoprtLoading = true
|
|
|
+ let valueForm = getFromValue(filterForm)
|
|
|
+ post('接口名称', { ...valueForm }).then((res) => {
|
|
|
+ downloadFile(res.data, allText.exportText)
|
|
|
+ }).finally(() => {
|
|
|
+ allLoading.exoprtLoading = false
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
async function importBusiness(param: UploadRequestOptions) {
|
|
|
allLoading.importLoading = true
|
|
|
const formData = new FormData();
|