Browse Source

12.2

master
lichong 3 weeks ago
parent
commit
4fd0151662
  1. 14
      src/renderer/src/components/tablecomponent.vue
  2. 26
      src/renderer/src/views/shujuguanli.vue

14
src/renderer/src/components/tablecomponent.vue

@ -4,11 +4,10 @@
<template #default="{ height, width }">
<vxe-table show-overflow :data="tableData" round :height="height" :scroll-y="{ enabled: true, gt: 20 }"
:checkbox-config="{ labelField: 'seq', highlight: true }" ref="tableRef" border
:column-config="{ resizable: true }">
:column-config="{ resizable: true }" @resizable-change="resizableChange">
<vxe-column type="seq" width="70"></vxe-column>
<vxe-column :field="headerItem.prop" :title="headerItem.label"
:min-width="`${headerItem.label.length * 23 + 24}`" v-for="(headerItem, headerIndex) in tableHeader"
:key="headerIndex" :sortable="headerItem.isSort">
<vxe-column :field="headerItem.prop" :title="headerItem.label" :width="`${headerItem.width}`"
v-for="(headerItem, headerIndex) in tableHeader" :key="headerIndex" :sortable="headerItem.isSort">
<template #default="{ row }">
<template v-if="headerItem.type === 'text'">
<span>{{ row[headerItem.prop] }}</span>
@ -52,7 +51,12 @@ export default {
dayjs: dayjs,
}
},
methods: {},
methods: {
resizableChange({ $rowIndex, column, columnIndex, $columnIndex, $event }) {
let width = this.$refs.tableRef.getColumnWidth(column.field)
console.log(59, width);
}
},
async mounted() { },
watch: {},
computed: {}

26
src/renderer/src/views/shujuguanli.vue

@ -48,7 +48,7 @@
</template>
<script>
import _ from 'lodash'
import _, { min } from 'lodash'
import dayjs from 'dayjs'
import * as XLSX from 'xlsx';
import ExcelJS from "exceljs";
@ -320,11 +320,29 @@ export default {
let that = this
let tableHeader = []
let tableData = []
let widthObj = {
"Order":105,
"Sku":165,
// "Description":126,
"Type of merchandise": 100,
"Quantity to deliver": 100,
"Store": 100,
"Quantity of containers": 100,
"Barcode": 100,
"Quantity per container": 102,
"Total": 60,
"Cluster": 60,
"": 60,
"_1": 60,
"_2": 160,
"_3": 75,
}
for (let key in that.fileData2[0]) {
tableHeader.push({
prop: key,
label: key,
type: "text"
type: "text",
width: widthObj[key] || "",
})
}
for (let index = 0; index < that.fileData2.length; index++) {
@ -364,8 +382,8 @@ export default {
let cell = worksheet.getCell(1, index + 1);
cell.value = element;
cell.font = { name: 'Arial', size: 10, color: { argb: '000000' } };
cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'EEEEEE' } };
cell.alignment = { horizontal: 'center', vertical: 'center' };
cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'EEEEEE' }, };
cell.alignment = { horizontal: 'center', vertical: 'top' };
});
//

Loading…
Cancel
Save