Browse Source

(*)回款和业绩明细表查询接口暂交

master
wuqun 2 years ago
parent
commit
9962f4fa8b
  1. 52
      api/app/lib/controllers/report/achievement.js
  2. 241
      api/app/lib/models/performance_detail.js
  3. 3
      api/app/lib/routes/report/index.js
  4. 8
      web/client/src/sections/business/containers/performanceReport/achievementDetails.jsx
  5. 4
      web/client/src/sections/business/containers/performanceReport/backMoneyDetails.jsx

52
api/app/lib/controllers/report/achievement.js

@ -3,11 +3,56 @@ const fs = require('fs');
const moment = require('moment');
//业绩报表相关
async function getReceivedDetail(ctx) {
let rslt = null;
try {
const { models } = ctx.fs.dc;
const { keywordTarget, keyword, limit, page } = ctx.query
let where = {}
if (keywordTarget == 'contract' && keyword) {
where.contractNo = { $like: `%${keyword}%` }
}
let res = await models.ReceivableDetail.findAndCountAll({
where: where,
offset: Number(page) * Number(limit),
limit: Number(limit),
order: [['id', 'DESC']]
})
ctx.status = 200
ctx.body = {
count: res.count,
rows: res.rows
};
} catch (error) {
ctx.fs.logger.error(`path:${ctx.path},error:${error}`)
ctx.status = 400;
ctx.body = { name: 'FindAllError', message: '获取失败' }
}
}
async function getAchievementDetail(ctx) {
try {
const { models } = ctx.fs.dc;
const { keywordTarget, keyword, limit, page } = ctx.query
let where = {}
if (keywordTarget == 'saler' && keyword) {
where.sale = { $like: `%${keyword}%` }
}
if (keywordTarget == 'line' && keyword) {
where.serviceLine = { $like: `%${keyword}%` }
}
if (keywordTarget == 'dep' && keyword) {
where.department = { $like: `%${keyword}%` }
}
let res = await models.ReceivableDetail.findAndCountAll({
where: where,
offset: Number(page) * Number(limit),
limit: Number(limit),
order: [['id', 'DESC']]
})
ctx.status = 200
ctx.body = rslt
ctx.body = {
count: res.count,
rows: res.rows
};
} catch (error) {
ctx.fs.logger.error(`path:${ctx.path},error:${error}`)
ctx.status = 400;
@ -16,5 +61,6 @@ async function getReceivedDetail(ctx) {
}
module.exports = {
getReceivedDetail
getReceivedDetail,//回款
getAchievementDetail,//业绩
}

241
api/app/lib/models/performance_detail.js

@ -0,0 +1,241 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const PerformanceDetail = sequelize.define("performanceDetail", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: false
},
recConDate: {
type: DataTypes.DATEONLY,
allowNull: false,
defaultValue: null,
comment: "收到合同日期",
primaryKey: false,
field: "rec_con_date",
autoIncrement: false
},
month: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "月份",
primaryKey: false,
field: "month",
autoIncrement: false
},
department: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "部门:申请部门",
primaryKey: false,
field: "department",
autoIncrement: false
},
sale: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "销售人员",
primaryKey: false,
field: "sale",
autoIncrement: false
},
customer: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "客户名称:【甲方名称】",
primaryKey: false,
field: "customer",
autoIncrement: false
},
item: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "项目名称",
primaryKey: false,
field: "item",
autoIncrement: false
},
amount: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "合同金额:【合同金额\n(元)】",
primaryKey: false,
field: "amount",
autoIncrement: false
},
realPerformance: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "实际业绩;(合同金额-预\n支提成及委外费用)*特批折算比例\n(G-L)*K",
primaryKey: false,
field: "real_performance",
autoIncrement: false
},
assessmentPerformance: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "合同金额*省外业务(1.1)*复购业务\n(1.05)*可复制的业务路径(1.1)",
primaryKey: false,
field: "assessment_performance",
autoIncrement: false
},
isApproval: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: null,
comment: "价格是否特批:根据折算比例-《合同明细表》推\n算(100%——“是”;其他为否)",
primaryKey: false,
field: "isApproval",
autoIncrement: false
},
approvalProp: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "特批折算比例:【业绩折\n算比例】",
primaryKey: false,
field: "approval_prop",
autoIncrement: false
},
cost: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "预支提成及委外费用",
primaryKey: false,
field: "cost",
autoIncrement: false
},
serviceLine: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "业务线",
primaryKey: false,
field: "service_line",
autoIncrement: false
},
cusType: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "客户类型",
primaryKey: false,
field: "cus_type",
autoIncrement: false
},
industry: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "行业",
primaryKey: false,
field: "industry",
autoIncrement: false
},
source: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "信息来源",
primaryKey: false,
field: "source",
autoIncrement: false
},
itemType: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "项目类型",
primaryKey: false,
field: "item_type",
autoIncrement: false
},
cusProvince: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "客户省份",
primaryKey: false,
field: "cus_province",
autoIncrement: false
},
cusAttribute: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "客户属性:G:政府、事业单位\nB:央企、国企、平台商\nC:资源方",
primaryKey: false,
field: "cus_attribute",
autoIncrement: false
},
repurchaseCount: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: "复购次数:同一客户储备成单-成单项目数量\n(PM)",
primaryKey: false,
field: "repurchase_count",
autoIncrement: false
},
reproducible: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: null,
comment: "是否可复制的业务路径:《合同评审》表单获取",
primaryKey: false,
field: "reproducible",
autoIncrement: false
},
outProvince: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "省外业务1.1:当【客户省份】=“江西”时,省外业务=1;当【客户省份】<>“江西”时,省外业务=1.1",
primaryKey: false,
field: "out_province",
autoIncrement: false
},
repurchase: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "复购业务1.05:当【复购次数】\n<2时,复购业务=1;当【复购次数】\n>=2时,复购业务=1.05;",
primaryKey: false,
field: "repurchase",
autoIncrement: false
},
isreproduce: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "可复制的业务路径1.1:当【是否可复\n制的业务路径】=“是”,可复制的业务路径=1.1;当【是否可复制的业务路径】=“否”,可复制的业务路径=1;",
primaryKey: false,
field: "isreproduce",
autoIncrement: false
}
}, {
tableName: "performance_detail",
comment: "",
indexes: []
});
dc.models.PerformanceDetail = PerformanceDetail;
return PerformanceDetail;
};

3
api/app/lib/routes/report/index.js

@ -12,4 +12,7 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/received/detail'] = { content: '查询回款明细表', visible: false };
router.get('/received/detail', achieve.getReceivedDetail);
app.fs.api.logAttr['GET/achievement/detail'] = { content: '查询业绩明细表', visible: false };
router.get('/achievement/detail', achieve.getAchievementDetail);
};

8
web/client/src/sections/business/containers/performanceReport/achievementDetails.jsx

@ -7,7 +7,7 @@ import '../../style.less';
const AchievementDetails = (props) => {
const { dispatch, actions } = props
const [keywordTarget, setKeywordTarget] = useState('contract');
const [keywordTarget, setKeywordTarget] = useState('saler');
const [keyword, setKeyword] = useState('');//
const [limits, setLimits] = useState()//
const [query, setQuery] = useState({ limit: 10, page: 0 }); //
@ -172,9 +172,9 @@ const AchievementDetails = (props) => {
<div style={{ display: 'flex' }}>
<div>
<Select value={keywordTarget} onChange={setKeywordTarget} style={{ width: 150 }} >
<Select.Option value='contract'>合同编号</Select.Option>
<Select.Option value='invoice'>发票号码</Select.Option>
<Select.Option value='certificate'>凭证号</Select.Option>
<Select.Option value='saler'>销售人员</Select.Option>
<Select.Option value='line'>业务线</Select.Option>
<Select.Option value='dep'>部门</Select.Option>
</Select>
</div>
<div style={{ margin: '0px 18px' }}>

4
web/client/src/sections/business/containers/performanceReport/backMoneyDetails.jsx

@ -143,8 +143,8 @@ const BackMoneyDetails = (props) => {
<div>
<Select value={keywordTarget} onChange={setKeywordTarget} style={{ width: 150 }} >
<Select.Option value='contract'>合同编号</Select.Option>
<Select.Option value='invoice'>发票号码</Select.Option>
<Select.Option value='certificate'>凭证号</Select.Option>
{/* <Select.Option value='invoice'></Select.Option>
<Select.Option value='certificate'>凭证号</Select.Option> */}
</Select>
</div>
<div style={{ margin: '0px 18px' }}>

Loading…
Cancel
Save