From 1cd847e45f698216961a3015964a526681258d27 Mon Sep 17 00:00:00 2001 From: lc18518571399 <18518571399@163.com> Date: Sat, 6 Jul 2024 10:31:41 +0800 Subject: [PATCH] 1221 --- api/app/service/exportData.js | 21 ++++++++++++++++----- front/src/renderer/src/views/dingdan.vue | 5 +++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/api/app/service/exportData.js b/api/app/service/exportData.js index 981912b..fe3cf61 100644 --- a/api/app/service/exportData.js +++ b/api/app/service/exportData.js @@ -7,15 +7,26 @@ class ExportDataService extends Service { let { ctx } = this let modelLocal = ctx.model[params.model] let subType = params.subType - let paramsLocal = _.omit(params, ["subType", "url", "model"]) + let whereOther = params["$where"] + let paramsLocal = _.omit(params, ["subType", "url", "model", "$where"]) + let paramsLocalInfoAgg = { ...paramsLocal, isExit: 1 } let msgObj = { exportS6: "成功导出S6订单", exportxiaoshou: "成功导出销售订单", } - let ParamsLocalNotDel = { ...paramsLocal, isExit: 1 } - let res = await modelLocal.find(ParamsLocalNotDel).sort({ update_at: -1 }) - let count = await modelLocal.find(ParamsLocalNotDel).count() - let returnData = { hasError: false, msg: msgObj[subType], subType, list: res, count } + if (whereOther === "this.zuigaocaigoujia > this.xiaoshoujine") { + paramsLocalInfoAgg["$expr"] = { + "$gt": ["$zuigaocaigoujia", "$xiaoshoujine"] + } + } else if (whereOther === "this.pinmingxuanxiang.length>1") { + paramsLocalInfoAgg["$expr"] = { + "$gt": [{ "$size": "$pinmingxuanxiang" }, 1] + } + } + let res = await modelLocal.aggregate([{ + $match: paramsLocalInfoAgg, + }, { $sort: { update_at: -1 } }]).exec() + let returnData = { hasError: false, msg: msgObj[subType], subType, list: res } return returnData } } diff --git a/front/src/renderer/src/views/dingdan.vue b/front/src/renderer/src/views/dingdan.vue index d143929..5eac55e 100644 --- a/front/src/renderer/src/views/dingdan.vue +++ b/front/src/renderer/src/views/dingdan.vue @@ -126,6 +126,7 @@ export default { exportxiaoshou: [], exportS6: [], allxiaoshoujine: 0, + clickParams: {}, } }, methods: { @@ -272,6 +273,7 @@ export default { //搜索数据 async searchData(refrash = false) { let params = {} + this.clickParams = {} if (refrash) { console.log(744, this.$refs.dingdanTable) this.$refs.dingdanTable.clearSelected() @@ -288,6 +290,7 @@ export default { red: { $where: "this.zuigaocaigoujia > this.xiaoshoujine" }, yellow: { $where: "this.pinmingxuanxiang.length>1" } } + this.clickParams = params[color] await this.updateSeach(params[color]) }, //选中数据 @@ -448,6 +451,7 @@ export default { subType: "exportxiaoshou", url: "/api/exportDingdanInfo", model: "Dingdan", + ...this.clickParams // 客户编号 简称 客户名称 客户产品名称 产品代码 S6产品名称 最小单位条码 销售数量 修改后销售数量 销售金额 最高采购价 箱装量 最大箱装量 规格型号 计量单位 箱条码 最大箱条码 } if (this.searchParams.kehubianhao) { @@ -461,6 +465,7 @@ export default { subType: "exportS6", url: "/api/exportDingdanInfo", model: "Dingdan", + ...this.clickParams // 客户编号 简称 客户名称 客户产品名称 产品代码 S6产品名称 最小单位条码 销售数量 修改后销售数量 销售金额 最高采购价 箱装量 最大箱装量 规格型号 计量单位 箱条码 最大箱条码 } if (this.searchParams.kehubianhao) {