wuqun 2 years ago
parent
commit
3b4b76932b
  1. 31
      api/app/lib/controllers/report/achievement.js
  2. 6
      api/app/lib/models/contract_detail.js
  3. 6
      api/app/lib/models/customerContactsFollup.js
  4. 28
      api/app/lib/models/invoice_detail.js
  5. 8
      api/app/lib/routes/report/index.js
  6. 6
      web/client/src/layout/components/sider/index.jsx
  7. 1
      web/client/src/layout/containers/layout/index.jsx

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

@ -256,11 +256,17 @@ async function exportAchievementDetail(ctx, dataList) {
}
}
}
/**
* 查询明细表已存在编号数据回款合同开票通用
* @param {*} ctx ctx ctx.query:{tableModel表模型名}
*/
async function getReceivedNumbers(ctx) {
let errorMsg = { name: 'FindError', message: '查询失败' };
try {
const { tableModel } = ctx.query;
const models = ctx.fs.dc.models;
let list = await models.ReceivableDetail.findAll({//查编号
let modelName = tableModel || 'ReceivableDetail'
let list = await models[modelName].findAll({//查编号
attributes: ['number']
});
ctx.status = 200
@ -268,20 +274,23 @@ async function getReceivedNumbers(ctx) {
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
message: typeof error == 'string' ? error : undefined
}
ctx.body = errorMsg;
}
}
/**
* 导入明细表数据回款合同开票通用
* @param {*} ctx ctx ctx.query:{tableModel表模型名}
*/
async function importBackDetails(ctx) {
let errorMsg = { message: '导入回款明细失败' };
let errorMsg = { message: '导入失败' };
const transaction = await ctx.fs.dc.orm.transaction();
try {
const models = ctx.fs.dc.models;
const data = ctx.request.body;
const { tableModel } = ctx.query;
let modelName = tableModel || 'ReceivableDetail'
let addArr = [];
let dataList = await models.ReceivableDetail.findAll({//查编号
let dataList = await models[modelName].findAll({//查编号
attributes: ['number']
});
data.map(d => {
@ -292,7 +301,7 @@ async function importBackDetails(ctx) {
})
//只处理新增的
if (addArr.length) {
await models.ReceivableDetail.bulkCreate(addArr);
await models[modelName].bulkCreate(addArr, { transaction });
}
await transaction.commit();
ctx.status = 204;
@ -438,8 +447,8 @@ module.exports = {
getReceivedDetail,//回款
getAchievementDetail,//业绩
getReceivedNumbers,//查询回款明细表 已有的所有编号
importBackDetails,//导入回款明细
getReceivedNumbers,//查询回款、合同、开票明细表 已有的所有编号
importBackDetails,//导入回款、合同、开票明细
importAchieveDetails,//导入业绩明细
getContractDetail,
getInvoicingDetail,

6
api/app/lib/models/contract_detail.js

@ -17,7 +17,7 @@ module.exports = dc => {
},
year: {
type: DataTypes.STRING,
allowNull: true,
allowNull: false,
defaultValue: null,
comment: "年度",
primaryKey: false,
@ -26,7 +26,7 @@ module.exports = dc => {
},
serialNo: {
type: DataTypes.INTEGER,
allowNull: true,
allowNull: false,
defaultValue: null,
comment: "序号",
primaryKey: false,
@ -35,7 +35,7 @@ module.exports = dc => {
},
number: {
type: DataTypes.STRING,
allowNull: true,
allowNull: false,
defaultValue: null,
comment: "编号",
primaryKey: false,

6
api/app/lib/models/customerContactsFollup.js

@ -4,7 +4,7 @@
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const ReserveItemReport = sequelize.define("reserveItemReport", {
const CustomerContactsFollowup = sequelize.define("customerContactsFollowup", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
@ -60,6 +60,6 @@ module.exports = dc => {
}, {
tableName: "customer_contacts_followup",
});
dc.models.ReserveItemReport = ReserveItemReport;
return ReserveItemReport;
dc.models.CustomerContactsFollowup = CustomerContactsFollowup;
return CustomerContactsFollowup;
};

28
api/app/lib/models/invoice_detail.js

@ -13,7 +13,7 @@ module.exports = dc => {
comment: null,
primaryKey: true,
field: "id",
autoIncrement: false
autoIncrement: true
},
year: {
type: DataTypes.STRING,
@ -44,7 +44,7 @@ module.exports = dc => {
},
department: {
type: DataTypes.STRING,
allowNull: false,
allowNull: true,
defaultValue: null,
comment: "部门:申请部门",
primaryKey: false,
@ -53,7 +53,7 @@ module.exports = dc => {
},
sale: {
type: DataTypes.STRING,
allowNull: false,
allowNull: true,
defaultValue: null,
comment: "销售人员:申请人",
primaryKey: false,
@ -62,7 +62,7 @@ module.exports = dc => {
},
contractNo: {
type: DataTypes.STRING,
allowNull: false,
allowNull: true,
defaultValue: null,
comment: "合同编号",
primaryKey: false,
@ -71,7 +71,7 @@ module.exports = dc => {
},
customer: {
type: DataTypes.STRING,
allowNull: false,
allowNull: true,
defaultValue: null,
comment: "客户名称:【甲方名称】",
primaryKey: false,
@ -80,7 +80,7 @@ module.exports = dc => {
},
item: {
type: DataTypes.STRING,
allowNull: false,
allowNull: true,
defaultValue: null,
comment: "项目名称",
primaryKey: false,
@ -89,7 +89,7 @@ module.exports = dc => {
},
amount: {
type: DataTypes.STRING,
allowNull: false,
allowNull: true,
defaultValue: null,
comment: "合同金额:【合同金额\n(元)】",
primaryKey: false,
@ -98,7 +98,7 @@ module.exports = dc => {
},
changeAmount: {
type: DataTypes.STRING,
allowNull: false,
allowNull: true,
defaultValue: null,
comment: "变更后合同金额",
primaryKey: false,
@ -107,7 +107,7 @@ module.exports = dc => {
},
invoiceNo: {
type: DataTypes.STRING,
allowNull: false,
allowNull: true,
defaultValue: null,
comment: "发票号码:《发票申请单》【发票号】一个发票号码一个行数据",
primaryKey: false,
@ -116,7 +116,7 @@ module.exports = dc => {
},
invoiceType: {
type: DataTypes.STRING,
allowNull: false,
allowNull: true,
defaultValue: null,
comment: "开票类型:《发票申请单》\n【发票类型】",
primaryKey: false,
@ -125,7 +125,7 @@ module.exports = dc => {
},
invoiceDate: {
type: DataTypes.DATEONLY,
allowNull: false,
allowNull: true,
defaultValue: null,
comment: "开票日期:《发票申请单》\n【开票日期】",
primaryKey: false,
@ -134,7 +134,7 @@ module.exports = dc => {
},
invoiceAmount: {
type: DataTypes.STRING,
allowNull: false,
allowNull: true,
defaultValue: null,
comment: "开票金额:《发票申请单》【发票金额】取财务填写数据",
primaryKey: false,
@ -143,7 +143,7 @@ module.exports = dc => {
},
outputTax: {
type: DataTypes.STRING,
allowNull: false,
allowNull: true,
defaultValue: null,
comment: "销项税额:《发票申请单》-销项税额",
primaryKey: false,
@ -152,7 +152,7 @@ module.exports = dc => {
},
total: {
type: DataTypes.STRING,
allowNull: false,
allowNull: true,
defaultValue: null,
comment: "合计:自动算出\n(开票金额+销项税额)",
primaryKey: false,

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

@ -16,17 +16,15 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/detail/achievement'] = { content: '查询业绩明细表', visible: false };
router.get('/detail/achievement', achieve.getAchievementDetail);
app.fs.api.logAttr['GET/detail/received/numbers'] = { content: '查询业绩明细已有的编号集合', visible: false };
app.fs.api.logAttr['GET/detail/received/numbers'] = { content: '查询明细表已有的编号集合', visible: false };
router.get('/detail/received/numbers', achieve.getReceivedNumbers);
app.fs.api.logAttr['POST/add/received/back/bulk'] = { content: '导入回款明细', visible: true };
app.fs.api.logAttr['POST/add/received/back/bulk'] = { content: '导入明细表', visible: true };
router.post('/add/received/back/bulk', achieve.importBackDetails);
app.fs.api.logAttr['POST/add/achievement/bulk'] = { content: '导入业绩明细', visible: true };
router.post('/add/achievement/bulk', achieve.importAchieveDetails);
app.fs.api.logAttr['GET/contract/detail'] = { content: '查询合同明细表', visible: false };
router.get('/contract/detail', achieve.getContractDetail);

6
web/client/src/layout/components/sider/index.jsx

@ -18,9 +18,9 @@ const Sider = (props) => {
let nextItems = leftItems
setItems(nextItems)
scrollbar = new PerfectScrollbar('#page-slider', { suppressScrollX: true });
if (pathname == '/') {
dispatch(push(homePath))
}
// if (pathname == '/') {
// dispatch(push(homePath))
// }
}, [leftItems])
let routeSelectedKey = useLocation().pathname.split('/');
// let routeSelectedKey = [useLocation().pathname.split('/')[1]]//

1
web/client/src/layout/containers/layout/index.jsx

@ -209,7 +209,6 @@ const LayoutContainer = props => {
RouteRequest.get(RouteTable.apiRoot).then(res => {
let token = Cookie.get('pepToken', { domain: res.domain });
dispatch(login({ token })).then(res => {
console.log(res);
if (res.type == 'LOGIN_SUCCESS') {
const data = res.payload?.user || {}
history.push('/businessManagement/pmReport/reserveItemsReporting')

Loading…
Cancel
Save