Commit 88cd8ea8 by 王勇飞

Merge branch 'tx-fi-tax' of gitlab.gongsibao.com:jiangyong/zhichan into tx-fi-tax

parents d7690ded 19871fb6
......@@ -59,8 +59,10 @@ class CtlBase {
//添加组织结构路径,如果是上级,取上级
if (req.xctx.ptags && req.xctx.ptags != "") {
pobj.opath = req.xctx.ptags
pob.isPrincipal = true
} else {
pobj.opath = req.xctx.opath
pob.isPrincipal = false
}
if (!req.xctx.appkey) {
return [-200, "请求头缺少应用x-app-key"]
......
......@@ -5,33 +5,65 @@ class DeliverybillDao extends Dao {
super(Dao.getModelName(DeliverybillDao));
}
extraWhere(qobj, qw, qc) {//根据业务员id获取交付单信息的组装条件
qc.raw = true;
let filters = []
// 公司数据过滤
filters.push({
facilitator_id: Number(qobj.company_id || -1)
});
/**
* 权限 过滤
* 数据权限过滤
* 1. 管理员 (opath 为空)、 销售主管(isPrincipal = true) 、 销售 (isPrincipal = false && opath不为空)
*/
//需要添加公司查询条件
qc.where["facilitator_id"] = Number(qobj.company_id || -1);
// 组织结构
if (qobj.opath && qobj.opath != "") {
qc.where['$or'] = [
{
delivery_man_opcode: { [this.db.Op.like]: `%${qobj.opath}%` },
},
if (!qobj.opath) { // 管理员 不做处理
} else if (qobj.isPrincipal) { // 销售主管 查询为空和自己组织结构下的
filters.push({
$or: [
{
salesman_opcode: { [this.db.Op.like]: `%${qobj.opath}%` },
salesman_opcode: {
$eq: null
}
}, {
salesman_opcode: { $like: `%${qobj.opath}%` }
}
]
});
} else { // 销售 查询自己的
filters.push({
salesman_opcode: { $like: `%${qobj.opath}%` }
});
}
qc.raw = true;
/**
* 筛选 条件 TODO: 筛选功能字段(filter)、确定产品码是多少
*/
let filters = []
// 产品类型过滤
filters.push({
product_code: system.SERVICECODE.FT
})
// 根据 页面 过滤 交付状态
switch (qobj.bizpath) {
case "/configManageMent/deliveryRecord": // 交付单记录
filters.push({
delivery_status: {
$in: [
system.SERVERSESTATUS.INSERVICE, system.SERVERSESTATUS.CLOSED
]
}
});
break
case "/configManageMent/deliveryManage": //交付单处理
filters.push({
delivery_status: {
$in: [
system.SERVERSESTATUS.RECEIVED, system.SERVERSESTATUS.WAITUSERCONFIRM
]
}
});
break
}
/**
* 筛选 条件 TODO: 筛选功能字段(filter)
*/
qc.where["$and"] = filters;
return qw;
}
......
......@@ -21,6 +21,10 @@ module.exports = (db, DataTypes) => {
operation_details: { // 操作详细记录
allowNull: true,
type: DataTypes.JSON
},
order_type: { // 操作的 那个 表的 ( BIZ | DELIVERY )
allowNull: true,
type: DataTypes.STRING
}
}, {
paranoid: false,//假的删除
......
......@@ -363,7 +363,7 @@ System.FLOWCODE = {
}
// 服务名称
System.SERVICECODE = {
FT: 'ft' // 财税项目
FT: 'bookkeeping' // 财税项目
}
// 资质服务单状态
......
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