优化供应商导出功能

This commit is contained in:
季圣华
2021-10-12 00:41:53 +08:00
parent ed58d997b5
commit 96a6f5fb0f
6 changed files with 59 additions and 20 deletions

View File

@@ -43,7 +43,7 @@
<a-button type="primary" icon="import">导入</a-button>
</a-popover>
</a-upload>
<a-button type="primary" icon="download" @click="handleExportXls('客户信息')">导出</a-button>
<a-button type="primary" @click="exportExcel" icon="download">导出</a-button>
<a-dropdown>
<a-menu slot="overlay">
<a-menu-item key="1" v-if="btnEnableList.indexOf(1)>-1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
@@ -93,6 +93,7 @@
<script>
import CustomerModal from './modules/CustomerModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { openDownloadDialog, sheet2blob} from "@/utils/util"
import JDate from '@/components/jeecg/JDate'
export default {
name: "CustomerList",
@@ -117,6 +118,9 @@
telephone:'',
phonenum:''
},
ipagination:{
pageSizeOptions: ['10', '20', '30', '100', '200']
},
// 表头
columns: [
{
@@ -133,6 +137,7 @@
{ title: '联系人', dataIndex: 'contacts',width:70,align:"center"},
{ title: '手机号码', dataIndex: 'telephone',width:100,align:"center"},
{ title: '联系电话', dataIndex: 'phoneNum',width:100,align:"center"},
{ title: '电子邮箱', dataIndex: 'email',width:150,align:"center"},
{ title: '期初应收',dataIndex: 'beginNeedGet',width:80,align:"center"},
{ title: '期末应收',dataIndex: 'allNeedGet',width:80,align:"center"},
{ title: '税率(%)', dataIndex: 'taxRate',width:80,align:"center"},
@@ -152,7 +157,6 @@
delete: "/supplier/delete",
deleteBatch: "/supplier/deleteBatch",
importExcelUrl: "/supplier/importExcel",
exportXlsUrl: "/supplier/exportExcel",
batchSetStatusUrl: "/supplier/batchSetStatus"
}
}
@@ -176,6 +180,15 @@
if(this.btnEnableList.indexOf(1)===-1) {
this.$refs.modalForm.isReadOnly = true
}
},
exportExcel() {
let aoa = [['名称', '联系人', '手机号码', '联系电话', '电子邮箱', '期初应付', '期末应付', '税率(%)']]
for (let i = 0; i < this.dataSource.length; i++) {
let ds = this.dataSource[i]
let item = [ds.supplier, ds.contacts, ds.telephone, ds.phoneNum, ds.email, ds.beginNeedPay, ds.allNeedPay, ds.taxRate]
aoa.push(item)
}
openDownloadDialog(sheet2blob(aoa), '客户信息')
}
}
}