| | |
| | | <el-space> |
| | | <el-button type="primary" :icon="Plus" @click="openDia(undefined, 'add')">新建</el-button> |
| | | <el-button type="danger" :icon="Delete" @click="handleDelete">删除</el-button> |
| | | <!-- <el-button type="info" plain :icon="Download" @click="handleExport">导出</el-button> --> |
| | | <el-button type="info" plain :icon="Download" @click="handleExport">导出</el-button> |
| | | </el-space> |
| | | <!-- 表格组件 --> |
| | | <div> |
| | |
| | | import {ref, reactive, onMounted} from "vue"; |
| | | const { proxy } = getCurrentInstance() |
| | | import {Delete, Download, Plus} from "@element-plus/icons-vue"; |
| | | import { ElMessage } from "element-plus"; |
| | | import ETable from "@/components/Table/ETable.vue"; |
| | | import Pagination from "@/components/Pagination/index.vue"; |
| | | import FormDia from "@/views/salesOutbound/components/formDia.vue"; |
| | |
| | | { prop: "saleQuantity", label: "销售数量", minWidth: 120 }, |
| | | { prop: "salePrice", label: "销售单价(含税)", minWidth: 150 }, |
| | | { prop: "totalAmount", label: "销售总价(含税)", minWidth: 120 }, |
| | | { prop: "freight", label: "运费", minWidth: 90 }, |
| | | { prop: "salesFreight", label: "销售运费", minWidth: 90 }, |
| | | { prop: "purchasingFreight", label: "采购运费", minWidth: 90 }, |
| | | { prop: "taxCoal", label: "购销煤税率(%)", minWidth: 120 }, |
| | | { prop: "taxTrans", label: "运输税率(%)", minWidth: 120 }, |
| | | { prop: "grossProfit", label: "毛利润", minWidth: 90 }, |
| | |
| | | }; |
| | | // 导出出库 |
| | | const handleExport = () => { |
| | | |
| | | const config = { api: "/salesRecord/export", name: "销售出库" }; |
| | | proxy.$modal |
| | | .confirm( |
| | | "是否要导出" + |
| | | (selectedRows.value.length > 0 |
| | | ? `选中的${selectedRows.value.length}条` |
| | | : "全部") + |
| | | "数据?" |
| | | ) |
| | | .then((res) => { |
| | | if (!res) return; |
| | | exportData(config.api, config.name); |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.error("导出失败,请重试"); |
| | | }); |
| | | }; |
| | | const exportData = (api, name) => { |
| | | proxy.download( |
| | | api, |
| | | { exportIds: selectedRows.value.map((row) => row.id) }, |
| | | `${new Date().getTime()}${name}${new Date().toLocaleDateString("en-CA")}.xlsx` |
| | | ); |
| | | ElMessage.success("导出数据:" + name); |
| | | }; |
| | | // 选择行 |
| | | const handleSelectionChange = (selection) => { |