增加线索导出

This commit is contained in:
lcc
2025-10-21 10:02:22 +08:00
parent 4b2fa01cfd
commit 1a5ddc39c6
2 changed files with 60 additions and 2 deletions
+14
View File
@@ -77,3 +77,17 @@ export async function callPhone(data) {
}
return Promise.reject(new Error(res.data.message));
}
/**
* 导出用户
* @param params 查询条件
*/
export async function exportClues(params) {
const res = await request.get('/receiver/clues/export', {
params
});
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
+46 -2
View File
@@ -130,6 +130,13 @@
查询
</el-button>
<el-button @click="reset">重置</el-button>
<el-button
class="ele-btn-icon"
icon="el-icon-download"
type="primary"
@click="exportData"
>导出</el-button
>
</div>
</el-col>
</el-row>
@@ -183,10 +190,16 @@
</template>
<script>
import { pageClues, getSearch, callPhone } from '@/api/receiver/clues';
import {
pageClues,
getSearch,
callPhone,
exportClues
} from '@/api/receiver/clues';
import RegionsSelect from '@/components/RegionsSelect/index.vue';
import BrandSelect from '@/components/BrandSelect/index.vue';
import { pageCenterList, pageOrgNameList } from '@/api/auto';
import { utils, writeFile } from 'xlsx';
export default {
name: 'receiverClues',
@@ -331,7 +344,8 @@
belongOptions: [],
statusList: [],
centerList: [],
orgNameList: []
orgNameList: [],
title: '线索列表'
};
},
created() {
@@ -431,6 +445,36 @@
});
})
.catch(() => {});
},
exportData() {
const loading = this.$loading({ lock: true });
this.$refs.table.doRequest(({ where, order }) => {
exportClues({ ...where, ...order })
.then((data) => {
loading.close();
const array = [data.columns];
data.list.forEach((d) => {
let arrayItem = [];
for (let key in d) {
arrayItem.push(d[key]);
}
array.push(arrayItem);
});
writeFile(
{
SheetNames: ['Sheet1'],
Sheets: {
Sheet1: utils.aoa_to_sheet(array)
}
},
this.title + '.xlsx'
);
})
.catch((e) => {
loading.close();
this.$message.error(e.message);
});
});
}
}
};