This commit is contained in:
2025-07-24 11:20:50 +08:00
parent 2eb2a41b06
commit 03d2e9f459
4 changed files with 31 additions and 21 deletions

View File

@ -73,17 +73,24 @@ service.interceptors.response.use(
// 通用下载方法
export function download(url, params, filename, config) {
let token = localStorage.getItem('token')
return axios.post(url, params, {"Content-type": "multipart/form-data",headers:{"Authorization": `${token}`}}).then( async (data) => {
const isBlob = blobValidate(data.data);
console.log(isBlob,'====data');
return service.post(url, params, {
transformRequest: [(params) => { return tansParams(params) }],
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
responseType: 'blob',
...config
}).then(async (data) => {
const isBlob = blobValidate(data);
if (isBlob) {
const blob = new Blob([data.data])
const blob = new Blob([data])
saveAs(blob, filename)
} else {
ElMessage.error('网络异常');
const resText = await data.text();
const rspObj = JSON.parse(resText);
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
ElMessage.error(errMsg);
}
// downloadLoadingInstance.close();
}).catch((r) => {
ElMessage.error('下载文件出现错误,请联系管理员!')
})
}

View File

@ -2,7 +2,7 @@
<div>
<div class="titleBox">
<PageTitle title="人力情报信息采集流转">
<el-button type="primary">
<el-button type="primary" @click="exportFile">
<el-icon style="vertical-align: middle"><CirclePlus /></el-icon>
<span style="vertical-align: middle">导出</span>
</el-button>
@ -85,6 +85,7 @@
</template>
<script setup>
import { download } from "@/utils/request";
import * as MOSTY from "@/components/MyComponents/index";
import PageTitle from "@/components/aboutTable/PageTitle.vue";
import MyTable from "@/components/aboutTable/MyTable.vue";
@ -211,6 +212,12 @@ const delDictItem = (id) =>{
}).catch(() => {});
}
// 导出
const exportFile = () =>{
window.open('/mosty-api/mosty-gsxt/qbcj/exportQbsjcjDc?cjLx=1')
// download("/mosty-api/mosty-gsxt/qbcj/exportQbsjcjDc",{},`情报采集流转_${new Date().getTime()}.xlsx`);
}
// 详情
const addEdit = (type, row) => {
isShow.value = true;

View File

@ -88,12 +88,8 @@ import { reactive, ref, getCurrentInstance } from "vue";
const { proxy } = getCurrentInstance();
const { SGXTQTSQLX } = proxy.$dict("SGXTQTSQLX"); //获取字典数据
const emits = defineEmits(['close'])
const listQuery = ref({
dateRange:timeSlotChange('天'),
hskssj:timeSlotChange('天')[0]+' 00:00:00',
hsjssj:timeSlotChange('天')[1]+' 23:59:59',
});
const active = ref(0);
const listQuery = ref({});
const active = ref(-1);
const time = reactive([
{ label: "今天", value: "10" },
{ label: "本周", value: "20" },
@ -154,11 +150,11 @@ const onSearch = (val) =>{
loadDate()
}
const reset = (val) =>{
active.value = 0;
listQuery.value = {};
listQuery.value.dateRange = timeSlotChange('天');
listQuery.value.hskssj = timeSlotChange('天')[0] + ' 00:00:00';
listQuery.value.hsjssj = timeSlotChange('天')[1] + ' 23:59:59';
active.value = -1;
listQuery.value.dateRange = '';
listQuery.value.hskssj = '';
listQuery.value.hsjssj = '';
loadDate()
}

View File

@ -9,11 +9,11 @@ import { ref, watch ,defineProps,nextTick } from "vue";
const props = defineProps({
echartsId:{
type:String,
default:'barId'
default:'lineId'
},
color:{
type:String,
default:'#0072ff'
default:'lineId'
},
data:{
type:Array,
@ -72,7 +72,7 @@ const initChart = (data) => {
},
series: [
{
name: "",
name: "情报反馈统计",
type: "pie",
radius: ["40%", "75%"],
center: ["30%", "50%"],