diff --git a/public/excel/wuliu.xlsx b/public/excel/wuliu.xlsx index 833b755..61517f1 100644 Binary files a/public/excel/wuliu.xlsx and b/public/excel/wuliu.xlsx differ diff --git a/src/views/dashboard/home.vue b/src/views/dashboard/home.vue index f86ea39..1a7b240 100644 --- a/src/views/dashboard/home.vue +++ b/src/views/dashboard/home.vue @@ -394,14 +394,34 @@ export default { this.content = this.transformSheets(sheets); }) .catch((err) => { + console.log(err) this.$message.error(err); }); }, + //读取日期格式 + formatDate(numb, format) { + const old = numb - 1; + const t = Math.round((old - Math.floor(old)) * 24 * 60 * 60); + const time = new Date(1900, 0, old, 0, 0, t); + const year = time.getFullYear(); + const month = time.getMonth() + 1; + const date = time.getDate(); + console.log(time.getHours()); + console.log(time.getMinutes()); + return ( + year + + format + + (month < 10 ? "0" + month : month) + + format + + (date < 10 ? "0" + date : date) + ); + }, transformSheets(sheets) { const content1 = []; for (const key in sheets) { content1.push(XLSX.utils.sheet_to_json(sheets[key])); } + console.log(content1) this.dayData.push( { name: "收件量", data: content1[0][0].日总收件量, huanbi: content1[0][0].收件量日总环比 }, { name: "发件量", data: content1[0][0].日总发件量, huanbi: content1[0][0].发件量日总环比 }, @@ -418,14 +438,15 @@ export default { { name: "签件量", data: content1[0][0].月总签件量, huanbi: content1[0][0].签件量月总环比 } ); this.totalData = this.dayData; + this.updateTime = this.formatDate(content1[0][0].日期,'/'); + console.log(this.updateTime) content1[1].map((item) => { - this.xData.unshift(item.日期.substring(item.日期.length - 5).replace(".", "-")); + // item.日期.substring(item.日期.length - 5).replace(".", "-") + this.xData.unshift(this.formatDate(item.日期,'-').substring(this.formatDate(item.日期,'-').length - 5).replace(".", "-")); this.yData1.push(item.到件量); this.yData2.push(item.派件量); }); - // this.dateTime = content1[0][0].日期.replaceAll(".", "/"); - this.updateTime = content1[0][0].日期.replace(/\D/g, "/"); - // this.$message.success(content1[0][0].日期); + console.log(this.xData) content1[3].map((item) => { this.villageData.push({ name: item.村点名称, upData: item.上行, downData: item.下行 }); });