diff --git a/api/app/lib/controllers/salePerformance/index.js b/api/app/lib/controllers/salePerformance/index.js new file mode 100644 index 0000000..0659c4d --- /dev/null +++ b/api/app/lib/controllers/salePerformance/index.js @@ -0,0 +1,27 @@ +'use strict'; + +// 查询业绩汇总表-->关联sale表 +async function getSalePerformance(ctx, next) { + const { type } = ctx.params; + const models = ctx.fs.dc.models; + let rslt = null; + try { + rslt = await models.sale.findAll({ + order: [['id', 'DESC']], + include:[{ + model:models.salePerformance + }] + // where: { type: type } + }) + ctx.status = 200 + ctx.body = rslt + } catch (error) { + ctx.fs.logger.error(`path:${ctx.path},error:${error}`) + ctx.status = 400; + ctx.body = { name: 'FindAllError', message: '获取失败' } + } +} + +module.exports = { + getSalePerformance, +} \ No newline at end of file diff --git a/api/app/lib/models/customerContactsFollup.js b/api/app/lib/models/customerContactsFollup.js index 0c5a119..1184230 100644 --- a/api/app/lib/models/customerContactsFollup.js +++ b/api/app/lib/models/customerContactsFollup.js @@ -7,7 +7,7 @@ module.exports = dc => { const CustomerContactsFollowup = sequelize.define("customerContactsFollowup", { id: { type: DataTypes.INTEGER, - allowNull: false, + allowNull: true, primaryKey: true, field: "id", autoIncrement: true, @@ -19,7 +19,7 @@ module.exports = dc => { }, items: { type: DataTypes.STRING, - allowNull: true, + allowNull: false, field: "items", }, department: { @@ -29,7 +29,7 @@ module.exports = dc => { }, sale: { type: DataTypes.STRING, - allowNull: true, + allowNull: false, field: "sale", }, updatetime: { @@ -39,22 +39,22 @@ module.exports = dc => { }, customerContacts: { type: DataTypes.STRING, - allowNull: true, + allowNull: false, field: "customer_contacts", }, phone: { type: DataTypes.STRING, - allowNull: true, + allowNull: false, field: "phone", }, visitStyle: { type: DataTypes.STRING, - allowNull: true, + allowNull: false, field: "visit_style", }, itemText: { type: DataTypes.STRING, - allowNull: true, + allowNull: false, field: "item_text", } }, { diff --git a/api/app/lib/models/sale.js b/api/app/lib/models/sale.js new file mode 100644 index 0000000..8afd2d5 --- /dev/null +++ b/api/app/lib/models/sale.js @@ -0,0 +1,50 @@ +/* eslint-disable*/ +'use strict'; + +module.exports = dc => { + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const sale = sequelize.define("sale", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + primaryKey: true, + field: "id", + autoIncrement: true, + }, + department: { + type: DataTypes.STRING, + allowNull: true, + field: "department", + }, + business: { + type: DataTypes.STRING, + allowNull: true, + field: "business", + }, + sale: { + type: DataTypes.STRING, + allowNull: true, + field: "sale", + }, + hiredate: { + type: DataTypes.DATE, + allowNull: false, + field: "hiredate", + }, + regularDate: { + type: DataTypes.DATE, + allowNull: false, + field: "regular_date", + }, + pepId: { + type: DataTypes.INTEGER, + allowNull: true, + field: "pep_id", + } + }, { + tableName: "sale", + }); + dc.models.sale = sale; + return sale; +}; \ No newline at end of file diff --git a/api/app/lib/models/salePerformance.js b/api/app/lib/models/salePerformance.js new file mode 100644 index 0000000..c987425 --- /dev/null +++ b/api/app/lib/models/salePerformance.js @@ -0,0 +1,63 @@ +/* eslint-disable*/ +'use strict'; + +module.exports = dc => { + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const salePerformance = sequelize.define("salePerformance", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + primaryKey: true, + field: "id", + autoIncrement: true, + }, + amount: { + type: DataTypes.STRING, + allowNull: false, + field: "amount", + }, + actualPerformance: { + type: DataTypes.STRING, + allowNull: false, + field: "actual_performance", + }, + assessmentPerformance: { + type: DataTypes.STRING, + allowNull: false, + field: "assessment_performance", + }, + saleName : { + type: DataTypes.STRING, + allowNull: false, + field: "sale_name", + }, + month: { + type: DataTypes.INTEGER, + allowNull: false, + field: "month", + }, + year: { + type: DataTypes.INTEGER, + allowNull: false, + field: "year", + }, + saleId: { + type: DataTypes.INTEGER, + allowNull: false, + field: "sale_id", + }, + task: { + type: DataTypes.INTEGER, + allowNull: false, + field: "task", + } + }, { + tableName: "sale_performance", + }); + const { sale } = dc.models; + sale.hasMany(salePerformance, { foreighKey: 'saleName', targetKey: "sale" }) + + dc.models.salePerformance = salePerformance; + return salePerformance; +}; \ No newline at end of file diff --git a/api/app/lib/routes/salePerformance/index.js b/api/app/lib/routes/salePerformance/index.js new file mode 100644 index 0000000..a8889b0 --- /dev/null +++ b/api/app/lib/routes/salePerformance/index.js @@ -0,0 +1,8 @@ +'use strict'; + +const report = require('../../controllers/salePerformance'); + +module.exports = function (app, router, opts) { + app.fs.api.logAttr['GET/salePerformance'] = { content: '业绩汇总表', visible: false }; + router.get('/salePerformance', report.getSalePerformance); +}; \ No newline at end of file diff --git a/api/config.js b/api/config.js index d4891d1..de1647c 100644 --- a/api/config.js +++ b/api/config.js @@ -55,6 +55,9 @@ const CLICKHOUST_PASSWORD = process.env.CLICKHOUST_PASSWORD || flags.clickHouseP const CLICKHOUST_PEP_EMIS = process.env.CLICKHOUST_PEP_EMIS || flags.clickHousePepEmis const CLICKHOUST_HR = process.env.CLICKHOUST_HR || flags.clickHouseHr + + + if ( !RC_DB || !IOTA_REDIS_SERVER_HOST || !IOTA_REDIS_SERVER_PORT diff --git a/web/client/src/layout/components/header/index.jsx b/web/client/src/layout/components/header/index.jsx index 919a679..1941b7d 100644 --- a/web/client/src/layout/components/header/index.jsx +++ b/web/client/src/layout/components/header/index.jsx @@ -7,99 +7,91 @@ import { headerItems } from './contant'; import "./index.less"; const Header = (props) => { - const { dispatch, history, user, actions, socket, tochange } = props; + const { dispatch, history, user, actions, socket, tochange } = props; - return ( - <> -
储备项目明细表 |
+
---|