明树Git Lab

Commit 211b9a24 authored by zfp1's avatar zfp1

update

parent 64602711
......@@ -111,7 +111,34 @@ async function importExcel(req, res, next) {
async function exportExcel(req, res, next) {
try {
let search = {del: 0};
if (req.body.agrProName) {
search.agrProName = {$regex: req.body.agrProName};
}
if (req.body.name) {
search.agrProName = {$regex: req.body.name};
}
if(req.body.startTime) {
search.time = search.time || {};
search.time.$gte = req.body.startTime;
}
if(req.body.endTime) {
search.time = search.time || {};
search.time.$lte = req.body.endTime
}
let ret = await DB.ExcelRecord.create({
creator: req.user._id,
type: 2,
modleName: 'AgrInputDetail',
search,
})
res.sendData(ret);
} catch (error) {
next(error);
}
}
......@@ -126,5 +153,6 @@ module.exports = {
create,
importExcel,
deleteOne,
updateOne
updateOne,
exportExcel,
}
\ No newline at end of file
......@@ -106,7 +106,34 @@ async function importExcel(req, res, next) {
}
async function exportExcel(req, res, next) {
try {
let search = {del: 0};
if (req.body.agrProName) {
search.agrProName = {$regex: req.body.agrProName};
}
if (req.body.name) {
search.agrProName = {$regex: req.body.name};
}
if(req.body.startTime) {
search.time = search.time || {};
search.time.$gte = req.body.startTime;
}
if(req.body.endTime) {
search.time = search.time || {};
search.time.$lte = req.body.endTime
}
let ret = await DB.ExcelRecord.create({
creator: req.user._id,
type: 2,
modleName: 'AgrInputEmploy',
search,
})
res.sendData(ret);
} catch (error) {
next(error);
}
}
......@@ -122,5 +149,6 @@ module.exports = {
create,
importExcel,
deleteOne,
updateOne
updateOne,
exportExcel,
}
\ No newline at end of file
......@@ -106,7 +106,34 @@ async function importExcel(req, res, next) {
}
async function exportExcel(req, res, next) {
try {
let search = {del: 0};
if (req.body.agrProName) {
search.agrProName = {$regex: req.body.agrProName};
}
if (req.body.name) {
search.agrProName = {$regex: req.body.name};
}
if(req.body.startTime) {
search.time = search.time || {};
search.time.$gte = req.body.startTime;
}
if(req.body.endTime) {
search.time = search.time || {};
search.time.$lte = req.body.endTime
}
let ret = await DB.ExcelRecord.create({
creator: req.user._id,
type: 2,
modleName: 'AgrInputOther',
search,
})
res.sendData(ret);
} catch (error) {
next(error);
}
}
......@@ -122,5 +149,6 @@ module.exports = {
create,
importExcel,
deleteOne,
updateOne
updateOne,
exportExcel,
}
\ No newline at end of file
......@@ -16,7 +16,18 @@ async function listFroDP(req, res, next) {
let pageSize = req.body.pageSize || 10;
let skip = (page - 1) * pageSize;
if (req.body.agrProName) {
search.agrProName = req.body.agrProName;
search.agrProName = {$regex: req.body.agrProName};
}
if (req.body.name) {
search.agrProName = {$regex: req.body.name};
}
if(req.body.startTime) {
search.time = search.time || {};
search.time.$gte = req.body.startTime;
}
if(req.body.endTime) {
search.time = search.time || {};
search.time.$lte = req.body.endTime
}
let count = await DB.AgrInputRecord.countDocuments(search)
let list = await DB.AgrInputRecord.find(search).sort({_id: -1}).skip(skip).limit(1000); //甲方要求整体循环,暂时调整
......@@ -129,6 +140,36 @@ async function importExcel(req, res, next) {
}
async function exportExcel(req, res, next) {
try {
let search = {del: 0};
if (req.body.agrProName) {
search.agrProName = {$regex: req.body.agrProName};
}
if (req.body.name) {
search.agrProName = {$regex: req.body.name};
}
if(req.body.startTime) {
search.time = search.time || {};
search.time.$gte = req.body.startTime;
}
if(req.body.endTime) {
search.time = search.time || {};
search.time.$lte = req.body.endTime
}
let ret = await DB.ExcelRecord.create({
creator: req.user._id,
type: 2,
modleName: 'AgrInputRecord',
search,
})
res.sendData(ret);
} catch (error) {
next(error);
}
}
......@@ -146,5 +187,6 @@ module.exports = {
importExcel,
deleteOne,
updateOne,
listFroDP
listFroDP,
exportExcel,
}
\ No newline at end of file
......@@ -92,5 +92,5 @@ const letianAgrInputDetailSchema = new Schema({
});
const AgrInputDetail = mongoose.model('letianAgrInputDetail', letianAgrInputDetailSchema, 'letianAgrInputDetail');
const AgrInputDetail = mongoose.model('AgrInputDetail', letianAgrInputDetailSchema, 'letianAgrInputDetail');
module.exports = AgrInputDetail;
\ No newline at end of file
......@@ -64,5 +64,5 @@ const letianAgrInputEmploySchema = new Schema({
});
const AgrInputEmploy = mongoose.model('letianAgrInputEmploy', letianAgrInputEmploySchema, 'letianAgrInputEmploy');
const AgrInputEmploy = mongoose.model('AgrInputEmploy', letianAgrInputEmploySchema, 'letianAgrInputEmploy');
module.exports = AgrInputEmploy;
\ No newline at end of file
......@@ -80,5 +80,5 @@ const letianAgrInputOtherSchema = new Schema({
});
const AgrInputOther = mongoose.model('letianAgrInputOther', letianAgrInputOtherSchema, 'letianAgrInputOther');
const AgrInputOther = mongoose.model('AgrInputOther', letianAgrInputOtherSchema, 'letianAgrInputOther');
module.exports = AgrInputOther;
\ No newline at end of file
......@@ -94,5 +94,5 @@ const letianAgrInputRecordSchema = new Schema({
});
const AgrInputRecord = mongoose.model('letianAgrInputRecord', letianAgrInputRecordSchema, 'letianAgrInputRecord');
const AgrInputRecord = mongoose.model('AgrInputRecord', letianAgrInputRecordSchema, 'letianAgrInputRecord');
module.exports = AgrInputRecord;
\ No newline at end of file
......@@ -24,6 +24,7 @@ const letianHeavyMetalSchema = new Schema({
},
time: {
type: Date,
get: v => moment(v).format("YYYY-MM-DD HH:mm:ss"),
},
data: {
//因对接过程 不清楚对方的数据 此处弄一个json对象让对方所传数据都放置在这里面
......
......@@ -73,6 +73,10 @@ router.post('/:modelName/exportExcel', async (req, res, next) => {
'IPS': "collectIPSController",
'SMC': "collectSMCController",
'WS': "collectWSController",
'agrInputRecord': "agrInputRecordController",
'agrInputOther': "agrInputOtherController",
'agrInputDetail': "agrInputDetailController",
'agrInputEmploy': "agrInputEmployController",
}
console.log(modelMap[modelName]);
let controller = require(`../controller/${modelMap[modelName]}`);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment