箱管 导出待上线数据 调整

feature-JimuReport-1106-yjl
张同海 4 weeks ago
parent 8b67535e32
commit a61abdf978

@ -27,6 +27,10 @@
删除
</a-button>
</a-popconfirm>
<a-button type="link" class="pl0" @click="derivedExcel">
<span class="iconfont icon-Excel"></span>
导出待上线
</a-button>
<!-- <a-button type="link" @click="handleSave(false)" class="pl0">
<span class="iconfont icon-baocun" v-repeat></span>
保存
@ -118,6 +122,7 @@
import { formSchema, InfoColumns } from './columns'
import { ApiEdit, ApiInfo, ApiDelDetail, ApiImport } from './api'
import { ApiDealExcel } from '/@/views/ContainerManagement/RentIn/api'
import { ExportExcelByColumn } from '/@/api/common'
//
import { getDictOption } from '/@/utils/dictUtil'
import { HotTable } from '@handsontable/vue3'
@ -133,7 +138,7 @@
const loading = ref(false)
const rowId = ref()
const activeKey = ref('1')
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
const [registerForm, { resetFields, getFieldsValue, setFieldsValue, validate }] = useForm({
labelWidth: 100,
schemas: formSchema,
showActionButtonGroup: false,
@ -586,4 +591,41 @@
})
}
}
function derivedExcel() {
let ApiData: any = {
columnSets: [],
jsonDataStr: [],
}
columns.forEach((item, index) => {
if (!settings.hiddenColumns.columns.includes(index) && item?.type != 'checkbox') {
ApiData.columnSets.push({
title: item.title,
enTitle: item.data,
dataIndex: item.data,
visible: true,
})
}
})
list.value.forEach((item) => {
ApiData.jsonDataStr.push({
...item,
})
})
ApiData.jsonDataStr = JSON.stringify(ApiData.jsonDataStr)
ExportExcelByColumn(ApiData).then((res) => {
console.log(res)
const xlsUrl = window.URL.createObjectURL(
new Blob([res], {
type: 'application/vnd.ms-excel;charset=utf-8',
}),
)
const fname = `${getFieldsValue().templetName}待上线数据`
const link = document.createElement('a')
link.href = xlsUrl
link.setAttribute('download', fname)
document.body.appendChild(link)
link.click()
})
}
</script>

Loading…
Cancel
Save