Browse Source

信件导出功能初步搭建

master
21819 2 years ago
parent
commit
c76e5f4a6d
  1. 1
      package.json
  2. 6
      src/api/work/index.ts
  3. 30
      src/views/work/Query.vue

1
package.json

@ -9,6 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
"amfe-flexible": "^2.2.1",
"baidu-map-vue3": "^0.4.9",
"echarts": "^5.4.3",
"element-plus": "^2.5.1",

6
src/api/work/index.ts

@ -2,15 +2,15 @@ import request from '@/utils/request'
// 我的待办
export function getTodos(query) {
return request.get({ url: '/work/todo', query})
return request.get({ url: '/work/todo', query })
}
// 我的已办
export function getDones(query) {
return request.get({ url: '/work/done', query})
return request.get({ url: '/work/done', query })
}
// 信件查询
export function getMails(query) {
return request.get({ url: '/work/query', query})
return request.get({ url: '/work/query', query })
}

30
src/views/work/Query.vue

@ -79,7 +79,8 @@
<el-row>
<el-col :span="6">
<el-form-item label="信件标签">
<el-select v-model="query.mailLabels" placeholder="请选择标签" multiple clearable style="width: 280px">
<el-select v-model="query.mailLabels" placeholder="请选择标签" multiple clearable
style="width: 280px">
<el-option v-for="item in optionsData.labels" :key="item.id" :label="item.labelName"
:value="item.id" />
</el-select>
@ -186,6 +187,8 @@ import { deptLists } from '@/api/org/department'
import { labelLists } from '@/api/org/label'
import { ref, reactive, watch } from "vue";
import { ElTable } from "element-plus";
import request from '@/utils/request'
import { getToken } from '@/utils/auth'
const rowKey = "mailId";
@ -236,6 +239,26 @@ const refreshCheckAll = () => {
const outputSelectedMail = () => {
console.log("outputSelectedMail", solveCheckBox.value)
request.post({
url: '/work/export',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
"Admin": getToken()
},
body: solveCheckBox.value
}).then((res: any) => {
const url = URL.createObjectURL(res)
const link = document.createElement('a')
link.href = url
link.download = 'data.xlsx' //
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
URL.revokeObjectURL(url)
}).catch((err: any) => {
console.log(err)
})
}
const form = ref([]);
@ -269,9 +292,10 @@ function getList() {
query.value.mailTimeStart = query.value.mailTime[0];
query.value.mailTimeEnd = query.value.mailTime[1];
}
let source = query.value.mailLabels
let source = ""
if (query.value.mailLabels) {
let strLabels = ""
source = query.value.mailLabels
for (let i = 0; i < query.value.mailLabels.length; i++) {
if (i === query.value.mailLabels.length - 1)
strLabels += query.value.mailLabels[i]
@ -280,7 +304,9 @@ function getList() {
}
query.value.mailLabels = strLabels
}
console.log("query.value", query.value)
getMails(query.value).then((data: any) => {
console.log("data", data)
form.value = data.records;
totalSize.total = data.total;
totalSize.pages = data.pages;

Loading…
Cancel
Save