Browse Source

抽查导出90%

dev
wenlele 1 year ago
parent
commit
624e92e0be
  1. 1874
      api/app/lib/controllers/report/index.js
  2. 11
      api/app/lib/models/road_spot_check_preview.js
  3. 42
      api/app/lib/models/town.js
  4. 42
      api/utils/xlsxDownload.js
  5. BIN
      scripts/1.4.1/data/1_insert_report_data/data/sihao.xlsx
  6. BIN
      scripts/1.4.1/data/1_insert_road_data/data/sihao.xlsx
  7. 5
      scripts/1.4.1/schema/3.alter_road_spot_check_preview.sql

1874
api/app/lib/controllers/report/index.js

File diff suppressed because it is too large

11
api/app/lib/models/road_spot_check_preview.js

@ -104,7 +104,16 @@ module.exports = dc => {
primaryKey: false, primaryKey: false,
field: "country_mil", field: "country_mil",
autoIncrement: false autoIncrement: false
} },
gather: {
type: DataTypes.JSONB,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "gather",
autoIncrement: false
},
}, { }, {
tableName: "road_spot_check_preview", tableName: "road_spot_check_preview",
comment: "", comment: "",

42
api/app/lib/models/town.js

@ -0,0 +1,42 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const Town = sequelize.define("town", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true
},
name: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "name",
autoIncrement: false
},
code: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "code",
autoIncrement: false
},
}, {
tableName: "town",
comment: "",
indexes: []
});
dc.models.Town = Town;
return Town;
};

42
api/utils/xlsxDownload.js

@ -52,7 +52,7 @@ async function gatherSheet ({ sheet_2, data = [] }) {
} }
const header = [{ const header = [{
key: '', key: 'name',
title: '', title: '',
},{ },{
key: 'county', key: 'county',
@ -64,7 +64,7 @@ async function gatherSheet ({ sheet_2, data = [] }) {
key: 'countyPresent', key: 'countyPresent',
title: '本次考核里程', title: '本次考核里程',
}, { }, {
key: 'county', key: 'countyDifferenceValue',
title: '实际抽取比原计划多', title: '实际抽取比原计划多',
}, { }, {
key: 'township', key: 'township',
@ -76,7 +76,7 @@ async function gatherSheet ({ sheet_2, data = [] }) {
key: 'townshipPresent', key: 'townshipPresent',
title: '本次考核里程', title: '本次考核里程',
}, { }, {
key: 'township', key: 'townshipDifferenceValue',
title: '实际抽取比原计划多', title: '实际抽取比原计划多',
}, { }, {
key: 'village', key: 'village',
@ -88,7 +88,7 @@ async function gatherSheet ({ sheet_2, data = [] }) {
key: 'villagePresent', key: 'villagePresent',
title: '本次考核里程', title: '本次考核里程',
}, { }, {
key: 'village', key: 'villageDifferenceValue',
title: '实际抽取比原计划多', title: '实际抽取比原计划多',
},] },]
@ -100,24 +100,22 @@ async function gatherSheet ({ sheet_2, data = [] }) {
} }
// data // data
// const style = new xlsx.Style(); const style = new xlsx.Style();
// style.align.h = 'left'; style.align.h = 'left';
// style.align.v = 'center'; style.align.v = 'center';
// style.border.right = 'thin'; style.border.right = 'thin';
// style.border.rightColor = '#000000'; style.border.rightColor = '#000000';
// style.border.bottom = 'thin'; style.border.bottom = 'thin';
// style.border.bottomColor = '#000000'; style.border.bottomColor = '#000000';
// for (let i = 0; i < data.length; i++) {
// const row = sheet_2.addRow(); for (let i = 0; i < data.length; i++) {
// const indexCell = row.addCell(); const row = sheet_2.addRow();
// indexCell.value = i + 1 for (let h of header) {
// indexCell.style = headerStyle const cell = row.addCell();
// for (let h of header) { cell.value = data[i][h.key];
// const cell = row.addCell(); cell.style = style
// cell.value = data[i][h.key]; }
// cell.style = style }
// }
// }
} }
async function simpleExcelDown ({ data = [], header = [], fileName = moment().format('YYYY-MM-DD HH:mm:ss'), exp, gather } = {}) { async function simpleExcelDown ({ data = [], header = [], fileName = moment().format('YYYY-MM-DD HH:mm:ss'), exp, gather } = {}) {

BIN
scripts/1.4.1/data/1_insert_report_data/data/sihao.xlsx

Binary file not shown.

BIN
scripts/1.4.1/data/1_insert_road_data/data/sihao.xlsx

Binary file not shown.

5
scripts/1.4.1/schema/3.alter_road_spot_check_preview.sql

@ -0,0 +1,5 @@
alter table road_spot_check_preview
add gather jsonb;
comment on column road_spot_check_preview.gather is '抽查汇总';
Loading…
Cancel
Save