175 changed files with 8646 additions and 17998 deletions
			
			
		@ -0,0 +1,71 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 提交审批、驳回修改 | 
				
			|||
 * body { | 
				
			|||
 * action:1驳回修改 2审批通过 | 
				
			|||
 * userRegionType:提交用户所属区域级别:3乡镇级,2区县级 | 
				
			|||
 * userId:提交用户id | 
				
			|||
 * rejectReasons:驳回意见 | 
				
			|||
 * correctiveAction:采取措施。区县复核时提交内容 | 
				
			|||
 * punishment:实施处罚,强制措施情况。区县复核时提交内容 | 
				
			|||
 * }  | 
				
			|||
 */ | 
				
			|||
const moment = require('moment'); | 
				
			|||
async function submitApproval (ctx) { | 
				
			|||
    try { | 
				
			|||
        const data = ctx.request.body; | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        let oldData = await models.UserPlaceSecurityRecord.findOne({ where: { id: data.id } }) | 
				
			|||
        if (oldData == null) { | 
				
			|||
            ctx.status = 400; | 
				
			|||
            ctx.body = { name: `message`, message: `该条填报数据不存在` }; | 
				
			|||
        } else { | 
				
			|||
            if ((data.action == 1 || data.action == 2) && (data.userRegionType == 3 || data.userRegionType == 2)) { | 
				
			|||
                let dataSave = {} | 
				
			|||
                if (data.action == 1) {//驳回
 | 
				
			|||
                    dataSave = { | 
				
			|||
                        rejectManId: data.userId, | 
				
			|||
                        rejectReasons: data.rejectReasons, | 
				
			|||
                        type: false,//是否重新发起true默认false可以重新发起
 | 
				
			|||
                        rejectTime: moment() | 
				
			|||
                    } | 
				
			|||
                    if (data.userRegionType == 2) {//区县复核,14、15项可修改
 | 
				
			|||
                        dataSave.correctiveAction = data.correctiveAction; | 
				
			|||
                        dataSave.punishment = data.punishment; | 
				
			|||
                    } | 
				
			|||
                } else {//通过
 | 
				
			|||
                    if (data.userRegionType == 3) { | 
				
			|||
                        dataSave = { | 
				
			|||
                            audit1ManId: data.userId, | 
				
			|||
                            audit1ManIdTime: moment().format() | 
				
			|||
                        } | 
				
			|||
                    } else { | 
				
			|||
                        dataSave = {//区县复核,14、15项可修改
 | 
				
			|||
                            correctiveAction: data.correctiveAction, | 
				
			|||
                            punishment: data.punishment, | 
				
			|||
                            audit2ManId: data.userId, | 
				
			|||
                            audit2ManIdTime: moment().format() | 
				
			|||
                        } | 
				
			|||
                    } | 
				
			|||
                } | 
				
			|||
                await models.UserPlaceSecurityRecord.update(dataSave, { where: { id: data.id } }); | 
				
			|||
                ctx.status = 200; | 
				
			|||
                ctx.body = { name: `message`, message: `提交成功` }; | 
				
			|||
            } else { | 
				
			|||
                ctx.status = 400; | 
				
			|||
                ctx.body = { name: `message`, message: `提交数据有误` }; | 
				
			|||
            } | 
				
			|||
        } | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": { name: `message`, message: `提交审批、驳回修改数据失败` } | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
module.exports = { | 
				
			|||
    submitApproval | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,116 @@ | 
				
			|||
 | 
				
			|||
function deepCompare(x, y) { | 
				
			|||
    var i, l, leftChain, rightChain; | 
				
			|||
 | 
				
			|||
    function compare2Objects(x, y) { | 
				
			|||
        var p; | 
				
			|||
 | 
				
			|||
        // remember that NaN === NaN returns false
 | 
				
			|||
        // and isNaN(undefined) returns true
 | 
				
			|||
        if (isNaN(x) && isNaN(y) && typeof x === 'number' && typeof y === 'number') { | 
				
			|||
            return true; | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        // Compare primitives and functions.     
 | 
				
			|||
        // Check if both arguments link to the same object.
 | 
				
			|||
        // Especially useful on the step where we compare prototypes
 | 
				
			|||
        if (x === y) { | 
				
			|||
            return true; | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        // Works in case when functions are created in constructor.
 | 
				
			|||
        // Comparing dates is a common scenario. Another built-ins?
 | 
				
			|||
        // We can even handle functions passed across iframes
 | 
				
			|||
        if ((typeof x === 'function' && typeof y === 'function') || | 
				
			|||
            (x instanceof Date && y instanceof Date) || | 
				
			|||
            (x instanceof RegExp && y instanceof RegExp) || | 
				
			|||
            (x instanceof String && y instanceof String) || | 
				
			|||
            (x instanceof Number && y instanceof Number)) { | 
				
			|||
            return x.toString() === y.toString(); | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        // At last checking prototypes as good as we can
 | 
				
			|||
        if (!(x instanceof Object && y instanceof Object)) { | 
				
			|||
            return false; | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        if (x.isPrototypeOf(y) || y.isPrototypeOf(x)) { | 
				
			|||
            return false; | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        if (x.constructor !== y.constructor) { | 
				
			|||
            return false; | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        if (x.prototype !== y.prototype) { | 
				
			|||
            return false; | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        // Check for infinitive linking loops
 | 
				
			|||
        if (leftChain.indexOf(x) > -1 || rightChain.indexOf(y) > -1) { | 
				
			|||
            return false; | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        // Quick checking of one object being a subset of another.
 | 
				
			|||
        // todo: cache the structure of arguments[0] for performance
 | 
				
			|||
        for (p in y) { | 
				
			|||
            if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) { | 
				
			|||
                return false; | 
				
			|||
            } else if (typeof y[p] !== typeof x[p]) { | 
				
			|||
                return false; | 
				
			|||
            } | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        for (p in x) { | 
				
			|||
            if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) { | 
				
			|||
                return false; | 
				
			|||
            } else if (typeof y[p] !== typeof x[p]) { | 
				
			|||
                return false; | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            switch (typeof (x[p])) { | 
				
			|||
                case 'object': | 
				
			|||
                case 'function': | 
				
			|||
 | 
				
			|||
                    leftChain.push(x); | 
				
			|||
                    rightChain.push(y); | 
				
			|||
 | 
				
			|||
                    if (!compare2Objects(x[p], y[p])) { | 
				
			|||
                        return false; | 
				
			|||
                    } | 
				
			|||
 | 
				
			|||
                    leftChain.pop(); | 
				
			|||
                    rightChain.pop(); | 
				
			|||
                    break; | 
				
			|||
 | 
				
			|||
                default: | 
				
			|||
                    if (x[p] !== y[p]) { | 
				
			|||
                        return false; | 
				
			|||
                    } | 
				
			|||
                    break; | 
				
			|||
            } | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        return true; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    if (arguments.length < 1) { | 
				
			|||
        return true; //Die silently? Don't know how to handle such case, please help...
 | 
				
			|||
        // throw "Need two or more arguments to compare";
 | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    for (i = 1, l = arguments.length; i < l; i++) { | 
				
			|||
 | 
				
			|||
        leftChain = []; //Todo: this can be cached
 | 
				
			|||
        rightChain = []; | 
				
			|||
 | 
				
			|||
        if (!compare2Objects(arguments[0], arguments[i])) { | 
				
			|||
            return false; | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    return true; | 
				
			|||
} | 
				
			|||
module.exports = { | 
				
			|||
    deepCompare | 
				
			|||
} | 
				
			|||
@ -0,0 +1,63 @@ | 
				
			|||
//获取固化数据接口
 | 
				
			|||
async function getDataDictionary(ctx) { | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const { model } = ctx.params; | 
				
			|||
        const { where, attributes, order } = ctx.query; | 
				
			|||
        let findObj = {}; | 
				
			|||
        if (where) { | 
				
			|||
            let whereJson = JSON.parse(where); | 
				
			|||
            findObj.where = whereJson; | 
				
			|||
        } | 
				
			|||
        if (order) { | 
				
			|||
            findObj.order = [JSON.parse(order)]; | 
				
			|||
        } | 
				
			|||
        if (attributes) { | 
				
			|||
            attributes = attributes.split(','); | 
				
			|||
        } | 
				
			|||
        let rslt = await models[model].findAll(findObj); | 
				
			|||
        ctx.status = 200; | 
				
			|||
        ctx.body = rslt; | 
				
			|||
    } catch (error) { | 
				
			|||
        console.log(error) | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "获取数据字典失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
//基础修改接口
 | 
				
			|||
async function putDataDictionary(ctx) { | 
				
			|||
    const transaction = await ctx.fs.dc.orm.transaction(); | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        let errMsg = "修改失败"; | 
				
			|||
 | 
				
			|||
        const { model } = ctx.params; | 
				
			|||
        const { where, dataToSave } = ctx.request.body; | 
				
			|||
 | 
				
			|||
        const oldData = await models[model].findOne({ where: where }); | 
				
			|||
        if (oldData) { | 
				
			|||
            await models[model].update(dataToSave, { where: where, transaction }); | 
				
			|||
        } else { | 
				
			|||
            errMsg = "未找到需要修改的数据"; | 
				
			|||
            ctx.throw(400) | 
				
			|||
        } | 
				
			|||
        ctx.status = 204; | 
				
			|||
        await transaction.commit(); | 
				
			|||
    } catch (error) { | 
				
			|||
        await transaction.rollback(); | 
				
			|||
        console.log(error) | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": errMsg | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
module.exports = { | 
				
			|||
    getDataDictionary, | 
				
			|||
    putDataDictionary | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,25 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
//获取南昌市下所有区县
 | 
				
			|||
async function getCountiesList(ctx) { | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        let rslt = await models.Department.findAll({ | 
				
			|||
            where: { type: 2 }, | 
				
			|||
            order: [['id', 'asc']], | 
				
			|||
        }); | 
				
			|||
        ctx.status = 200; | 
				
			|||
        ctx.body = rslt; | 
				
			|||
    } catch (error) { | 
				
			|||
        console.log(error) | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "获取南昌市下所有区县失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
module.exports = { | 
				
			|||
    getCountiesList, | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,87 @@ | 
				
			|||
async function getResource(ctx, next) { | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
         | 
				
			|||
        const res = await models.Resource.findAll({ | 
				
			|||
            where: { parentResource: null }, | 
				
			|||
            include: [{ | 
				
			|||
                model: models.Resource, | 
				
			|||
            }] | 
				
			|||
        }) | 
				
			|||
 | 
				
			|||
        ctx.body = res; | 
				
			|||
        ctx.status = 200; | 
				
			|||
 | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "查询所有权限数据失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
async function getUserResource(ctx, next) { | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const { userId } = ctx.query; | 
				
			|||
 | 
				
			|||
        const res = await models.UserResource.findAll({ | 
				
			|||
            where: { userId: userId }, | 
				
			|||
            include: [{ | 
				
			|||
                model: models.Resource, | 
				
			|||
            }] | 
				
			|||
        }) | 
				
			|||
 | 
				
			|||
        ctx.body = res; | 
				
			|||
        ctx.status = 200; | 
				
			|||
 | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "查询用户权限数据失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
async function updateUserRes(ctx, next) { | 
				
			|||
    const transaction = await ctx.fs.dc.orm.transaction(); | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const { userId, resCode } = ctx.request.body; | 
				
			|||
 | 
				
			|||
        const res = await models.UserResource.findAll({ | 
				
			|||
            attributes: ["resourceId"], | 
				
			|||
            raw: true, | 
				
			|||
            where: { userId: userId } | 
				
			|||
        }) | 
				
			|||
 | 
				
			|||
        const addRes = resCode.filter(r => !res.some(rr => rr.resourceId == r)).map(r => { return { userId: userId, resourceId: r } }); | 
				
			|||
        const delRes = res.filter(r => !resCode.includes(r.resourceId)).map(r => r.resourceId); | 
				
			|||
        addRes.length && await models.UserResource.bulkCreate(addRes, { transaction: transaction }); | 
				
			|||
        delRes.length && await models.UserResource.destroy({ | 
				
			|||
            where: { | 
				
			|||
                resourceId: { $in: delRes }, | 
				
			|||
                userId: userId | 
				
			|||
            }, | 
				
			|||
            transaction: transaction | 
				
			|||
        }) | 
				
			|||
 | 
				
			|||
        ctx.status = 204; | 
				
			|||
        await transaction.commit(); | 
				
			|||
 | 
				
			|||
    } catch (error) { | 
				
			|||
        await transaction.rollback(); | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "更新用户权限数据失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
module.exports = { | 
				
			|||
    getResource, | 
				
			|||
    getUserResource, | 
				
			|||
    updateUserRes | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,612 @@ | 
				
			|||
'use strict'; | 
				
			|||
const moment = require('moment'); | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 提交填报信息/保存填报草稿 | 
				
			|||
 * @requires.body { | 
				
			|||
 * isDraft-是否草稿 | 
				
			|||
 * userId-用户id,填报人 | 
				
			|||
 * placeName-场所id | 
				
			|||
 * placeType-场所性质 | 
				
			|||
 * regionId-所属县/区 | 
				
			|||
 * address-场所地址 | 
				
			|||
 * placeOwner-场所负责人 | 
				
			|||
 * phone-负责人手机号 | 
				
			|||
 * dimension-面积 | 
				
			|||
 * floors-多少层 | 
				
			|||
 * numberOfPeople-常住人数 | 
				
			|||
 * location-经纬度 | 
				
			|||
 * isEnable-是否为合用场所 | 
				
			|||
 * localtionDescribe-经纬度定位描述 | 
				
			|||
 * hiddenDangerItem12-12项隐患信息,格式:[{ | 
				
			|||
 *      itemIndex-隐患项序号, | 
				
			|||
 *      value-是否存在隐患, | 
				
			|||
 *      description-隐患具体信息描述, | 
				
			|||
 *      photos-隐患图片(多张图片以 , 隔开)" | 
				
			|||
 *  }], | 
				
			|||
 * description-存在具体问题描述 | 
				
			|||
 * correctiveAction-采取整改措施 | 
				
			|||
 * punishment-实施处罚,强制措施情况 | 
				
			|||
 * } ctx  | 
				
			|||
 */ | 
				
			|||
async function addPlaceSecurityRecord (ctx, next) { | 
				
			|||
    const transaction = await ctx.fs.dc.orm.transaction(); | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const body = ctx.request.body; | 
				
			|||
        let ifRightRegion = true; | 
				
			|||
        if (body.regionId) { | 
				
			|||
            //判断填报信息所属乡镇/区县是否存在
 | 
				
			|||
            let region = await models.Department.findOne({ where: { id: body.regionId } }); | 
				
			|||
            if (!region) { | 
				
			|||
                ifRightRegion = false; | 
				
			|||
            } | 
				
			|||
        } | 
				
			|||
        if (ifRightRegion) { | 
				
			|||
            let placeId = null; | 
				
			|||
            if (body.placeName) { | 
				
			|||
                //判断“场所名称”是否存在,不存在则“新建场所”
 | 
				
			|||
                let place = await models.Places.findOne({ where: { name: body.placeName, userId: ctx.fs.api.userId } }); | 
				
			|||
                if (place) { | 
				
			|||
                    placeId = place.id | 
				
			|||
                } else { | 
				
			|||
                    const newPlace = await models.Places.create({ | 
				
			|||
                        name: body.placeName, | 
				
			|||
                        userId: ctx.fs.api.userId | 
				
			|||
                    }, { transaction: transaction }); | 
				
			|||
                    placeId = newPlace.id; | 
				
			|||
                } | 
				
			|||
            } | 
				
			|||
            //创建填报信息/填报草稿
 | 
				
			|||
            const userPlaceSecurityRecord = await models.UserPlaceSecurityRecord.create({ | 
				
			|||
                isDraft: body.isDraft,//是否草稿
 | 
				
			|||
                userId: ctx.fs.api.userId,//用户id,填报人
 | 
				
			|||
                time: moment(),//录入时间
 | 
				
			|||
                placeId: placeId,//场所id
 | 
				
			|||
                placeType: body.placeType,//场所性质
 | 
				
			|||
                regionId: body.regionId,//所属县/区
 | 
				
			|||
                address: body.address,//场所地址
 | 
				
			|||
                placeOwner: body.placeOwner,//场所负责人
 | 
				
			|||
                phone: body.phone,//负责人手机号
 | 
				
			|||
                dimension: body.dimension,//面积
 | 
				
			|||
                floors: body.floors,//多少层
 | 
				
			|||
                numberOfPeople: body.numberOfPeople,//常住人数
 | 
				
			|||
                location: body.location,//经纬度
 | 
				
			|||
                isEnable: body.isEnable,//是否为合用场所
 | 
				
			|||
                localtionDescribe: body.localtionDescribe,//经纬度定位描述
 | 
				
			|||
                hiddenDangerItem12: body.hiddenDangerItem12,//12项隐患信息
 | 
				
			|||
                description: body.description,//存在具体问题描述
 | 
				
			|||
                correctiveAction: body.correctiveAction,//采取措施
 | 
				
			|||
                type: true,//是否重新发起true默认false可以重新发起
 | 
				
			|||
                punishment: body.punishment,//实施处罚,强制措施情况
 | 
				
			|||
                departmentId: body.departmentId | 
				
			|||
            }, { transaction: transaction }); | 
				
			|||
            ctx.body = { | 
				
			|||
                id: userPlaceSecurityRecord.id, | 
				
			|||
                "message": "新增填报信息成功" | 
				
			|||
            }; | 
				
			|||
            ctx.status = 200; | 
				
			|||
        } else { | 
				
			|||
            ctx.status = 400; | 
				
			|||
            ctx.body = { | 
				
			|||
                "message": "所选地址不存在!" | 
				
			|||
            } | 
				
			|||
        } | 
				
			|||
        await transaction.commit(); | 
				
			|||
    } catch (error) { | 
				
			|||
        await transaction.rollback(); | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "新增填报信息失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 编辑填报信息 | 
				
			|||
 * @param {id-填报信息ID} ctx | 
				
			|||
 * @requires.body { | 
				
			|||
 * isDraft-是否草稿 | 
				
			|||
 * userId-用户id,填报人 | 
				
			|||
 * placeName-场所id | 
				
			|||
 * placeType-场所性质 | 
				
			|||
 * regionId-所属县/区 | 
				
			|||
 * address-场所地址 | 
				
			|||
 * placeOwner-场所负责人 | 
				
			|||
 * phone-负责人手机号 | 
				
			|||
 * dimension-面积 | 
				
			|||
 * floors-多少层 | 
				
			|||
 * numberOfPeople-常住人数 | 
				
			|||
 * location-经纬度 | 
				
			|||
 * isEnable-是否为合用场所 | 
				
			|||
 * localtionDescribe-经纬度定位描述 | 
				
			|||
 * hiddenDangerItem12-12项隐患信息,格式:[{ | 
				
			|||
 *      itemIndex-隐患项序号, | 
				
			|||
 *      value-是否存在隐患, | 
				
			|||
 *      description-隐患具体信息描述, | 
				
			|||
 *      photos-隐患图片(多张图片以 , 隔开)" | 
				
			|||
 *  }], | 
				
			|||
 * description-存在具体问题描述 | 
				
			|||
 * correctiveAction-采取整改措施 | 
				
			|||
 * punishment-实施处罚,强制措施情况 | 
				
			|||
 * } ctx  | 
				
			|||
 */ | 
				
			|||
async function editPlaceSecurityRecord (ctx, next) { | 
				
			|||
    const transaction = await ctx.fs.dc.orm.transaction(); | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const { id } = ctx.params; | 
				
			|||
        //判断该填报信息是否存在
 | 
				
			|||
        let userPlaceSecurityRecord = await models.UserPlaceSecurityRecord.findOne({ where: { id: id } }); | 
				
			|||
        if (userPlaceSecurityRecord) { | 
				
			|||
            const body = ctx.request.body; | 
				
			|||
            let ifRightRegion = true; | 
				
			|||
            if (body.regionId) { | 
				
			|||
                //判断填报信息所属乡镇/区县是否存在
 | 
				
			|||
                let region = await models.Department.findOne({ where: { id: body.regionId } }); | 
				
			|||
                if (!region) { | 
				
			|||
                    ifRightRegion = false; | 
				
			|||
                } | 
				
			|||
            } | 
				
			|||
            if (ifRightRegion) { | 
				
			|||
                let placeId = null; | 
				
			|||
                if (body.placeName) { | 
				
			|||
                    //判断“场所名称”是否存在,不存在则“新建场所”
 | 
				
			|||
                    let place = await models.Places.findOne({ where: { name: body.placeName, userId: ctx.fs.api.userId } }); | 
				
			|||
                    if (place) { | 
				
			|||
                        placeId = place.id | 
				
			|||
                    } else { | 
				
			|||
                        const newPlace = await models.Places.create({ | 
				
			|||
                            name: body.placeName, | 
				
			|||
                            userId: ctx.fs.api.userId | 
				
			|||
                        }, { transaction: transaction }); | 
				
			|||
                        placeId = newPlace.id; | 
				
			|||
                    } | 
				
			|||
                } | 
				
			|||
                //修改填报信息
 | 
				
			|||
                await models.UserPlaceSecurityRecord.update({ | 
				
			|||
                    isDraft: body.isDraft,//是否草稿
 | 
				
			|||
                    userId: ctx.fs.api.userId,//用户id,填报人
 | 
				
			|||
                    time: moment(),//录入时间
 | 
				
			|||
                    placeId: placeId,//场所id
 | 
				
			|||
                    placeType: body.placeType,//场所性质
 | 
				
			|||
                    regionId: body.regionId,//所属县/区
 | 
				
			|||
                    address: body.address,//场所地址
 | 
				
			|||
                    placeOwner: body.placeOwner,//场所负责人
 | 
				
			|||
                    phone: body.phone,//负责人手机号
 | 
				
			|||
                    dimension: body.dimension,//面积
 | 
				
			|||
                    floors: body.floors,//多少层
 | 
				
			|||
                    numberOfPeople: body.numberOfPeople,//常住人数
 | 
				
			|||
                    location: body.location,//经纬度
 | 
				
			|||
                    isEnable: body.isEnable,//是否为合用场所
 | 
				
			|||
                    localtionDescribe: body.localtionDescribe,//经纬度定位描述
 | 
				
			|||
                    hiddenDangerItem12: body.hiddenDangerItem12,//12项隐患信息
 | 
				
			|||
                    description: body.description,//存在具体问题描述
 | 
				
			|||
                    correctiveAction: body.correctiveAction,//采取措施
 | 
				
			|||
                    punishment: body.punishment,//实施处罚,强制措施情况
 | 
				
			|||
                    departmentId: body.departmentId | 
				
			|||
                }, { where: { id: id, }, transaction: transaction }); | 
				
			|||
                ctx.body = { "message": "修改填报信息成功" }; | 
				
			|||
                ctx.status = 200; | 
				
			|||
            } else { | 
				
			|||
                ctx.status = 400; | 
				
			|||
                ctx.body = { "message": "所选地址不存在!" } | 
				
			|||
            } | 
				
			|||
        } else { | 
				
			|||
            ctx.status = 400; | 
				
			|||
            ctx.body = { "message": "该填报信息不存在!" } | 
				
			|||
        } | 
				
			|||
        await transaction.commit(); | 
				
			|||
    } catch (error) { | 
				
			|||
        await transaction.rollback(); | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { "message": "修改填报信息失败" } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 修改type字段 | 
				
			|||
 * @param {*} ctx  | 
				
			|||
 * @param {*} next  | 
				
			|||
 */ | 
				
			|||
async function updateType (ctx, next) { | 
				
			|||
    const models = ctx.fs.dc.models; | 
				
			|||
    const { id } = ctx.params; | 
				
			|||
    try { | 
				
			|||
        await models.UserPlaceSecurityRecord.update({ | 
				
			|||
            type: true,//是否重新发起true默认false可以重新发起
 | 
				
			|||
        }, { where: { id: id, } }) | 
				
			|||
        ctx.body = { "message": "修改信息成功" }; | 
				
			|||
        ctx.status = 200; | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { "message": "修改信息失败" } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 删除填报信息 | 
				
			|||
 * @param {id-填报信息ID} ctx | 
				
			|||
 */ | 
				
			|||
async function deletePlaceSecurityRecord (ctx, next) { | 
				
			|||
    const transaction = await ctx.fs.dc.orm.transaction(); | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const { id } = ctx.params; | 
				
			|||
        //判断该填报信息是否存在
 | 
				
			|||
        let userPlaceSecurityRecord = await models.UserPlaceSecurityRecord.findOne({ where: { id: id } }); | 
				
			|||
        if (userPlaceSecurityRecord) { | 
				
			|||
            await models.UserPlaceSecurityRecord.destroy({ where: { id: id }, transaction: transaction }); | 
				
			|||
            ctx.body = { "message": "删除填报信息成功" }; | 
				
			|||
            ctx.status = 200; | 
				
			|||
        } else { | 
				
			|||
            ctx.status = 400; | 
				
			|||
            ctx.body = { "message": "该填报信息不存在!" } | 
				
			|||
        } | 
				
			|||
        await transaction.commit(); | 
				
			|||
    } catch (error) { | 
				
			|||
        await transaction.rollback(); | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { "message": "删除填报信息失败" } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 根据填报信息ID查询填报信息 | 
				
			|||
 * @param {id-填报信息ID} ctx | 
				
			|||
 */ | 
				
			|||
async function getPlaceSecurityRecordById (ctx, next) { | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const { id } = ctx.params; | 
				
			|||
        //判断该填报信息是否存在
 | 
				
			|||
        let userPlaceSecurityRecord = await models.UserPlaceSecurityRecord.findOne({ where: { id: id } }); | 
				
			|||
        if (userPlaceSecurityRecord) { | 
				
			|||
            let userPlaceSecurityRecord = await models.UserPlaceSecurityRecord.findOne({ | 
				
			|||
                where: { id: id }, | 
				
			|||
                include: [{ | 
				
			|||
                    model: models.Places, | 
				
			|||
                }, { | 
				
			|||
                    model: models.User, | 
				
			|||
                    as: 'user', | 
				
			|||
                    attributes: ['id', 'name', 'username', 'phone'] | 
				
			|||
                }, { | 
				
			|||
                    model: models.User, | 
				
			|||
                    as: 'audit1ManUser', | 
				
			|||
                    attributes: ['id', 'name', 'username', 'phone'] | 
				
			|||
                }, { | 
				
			|||
                    model: models.User, | 
				
			|||
                    as: 'audit2ManUser', | 
				
			|||
                    attributes: ['id', 'name', 'username', 'phone'] | 
				
			|||
                }, { | 
				
			|||
                    model: models.User, | 
				
			|||
                    as: 'rejectManUser', | 
				
			|||
                    attributes: ['id', 'name', 'username', 'phone'] | 
				
			|||
                }] | 
				
			|||
            }); | 
				
			|||
            ctx.body = userPlaceSecurityRecord; | 
				
			|||
            ctx.status = 200; | 
				
			|||
        } else { | 
				
			|||
            ctx.status = 400; | 
				
			|||
            ctx.body = { "message": "该填报信息不存在!" } | 
				
			|||
        } | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { "message": "查询填报信息失败" } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 根据场所ID获取该场所最近用户填报信息 | 
				
			|||
 * @param {placeId-场所信息ID} ctx | 
				
			|||
 */ | 
				
			|||
async function getRecentlyPlaceSecurityRecordByPlaceId (ctx, next) { | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const { placeId } = ctx.params; | 
				
			|||
        //判断该场所信息是否存在
 | 
				
			|||
        let place = await models.Places.findOne({ where: { id: placeId } }); | 
				
			|||
        if (place) { | 
				
			|||
            let userPlaceSecurityRecord = await models.UserPlaceSecurityRecord.findAll({ | 
				
			|||
                where: { placeId: placeId, userId: place.userId }, | 
				
			|||
                include: [{ | 
				
			|||
                    model: models.Places, | 
				
			|||
                }], | 
				
			|||
                limit: 1, | 
				
			|||
                order: [["id", "desc"]], | 
				
			|||
            }); | 
				
			|||
            ctx.status = 200; | 
				
			|||
            ctx.body = userPlaceSecurityRecord.length ? userPlaceSecurityRecord[0] : null; | 
				
			|||
        } else { | 
				
			|||
            ctx.status = 400; | 
				
			|||
            ctx.body = { "message": "该场所不存在!" } | 
				
			|||
        } | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { "message": "获取场所最近用户填报信息失败" } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 根据筛选条件获取用户填报信息 | 
				
			|||
 * @query { | 
				
			|||
 *  isDraft-是否草稿 | 
				
			|||
 *  userId-用户ID | 
				
			|||
 *  timeRange-录入时间范围 | 
				
			|||
 *  regionId-区域ID | 
				
			|||
 *  placeId-场所ID | 
				
			|||
 *  state-审批状态 | 
				
			|||
 *  pageIndex-页码 | 
				
			|||
 *  pageSize-页宽 | 
				
			|||
 * } ctx | 
				
			|||
 */ | 
				
			|||
async function getPlaceSecurityRecords (ctx, next) { | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const { isDraft, userId, timeRange, regionId, placeId, state, pageIndex, pageSize } = ctx.query; | 
				
			|||
        let whereCondition = {}; | 
				
			|||
        if (userId) { | 
				
			|||
            let user = await models.User.findOne({ where: { id: userId } }); | 
				
			|||
            if (user) { | 
				
			|||
                whereCondition.userId = userId; | 
				
			|||
            } else { | 
				
			|||
                ctx.status = 400; | 
				
			|||
                ctx.body = { "message": "用户不存在!" } | 
				
			|||
                return; | 
				
			|||
            } | 
				
			|||
        } | 
				
			|||
        if (regionId) { | 
				
			|||
            let region = await models.Department.findOne({ where: { id: regionId } }); | 
				
			|||
            if (region) { | 
				
			|||
                whereCondition.regionId = regionId; | 
				
			|||
            } else { | 
				
			|||
                ctx.status = 400; | 
				
			|||
                ctx.body = { "message": "区域不存在!" } | 
				
			|||
                return; | 
				
			|||
            } | 
				
			|||
        } | 
				
			|||
        if (placeId) { | 
				
			|||
            let place = await models.Places.findOne({ where: { id: placeId } }); | 
				
			|||
            if (place) { | 
				
			|||
                whereCondition.placeId = placeId; | 
				
			|||
            } else { | 
				
			|||
                ctx.status = 400; | 
				
			|||
                ctx.body = { "message": "场所不存在!" }; | 
				
			|||
                return; | 
				
			|||
            } | 
				
			|||
        } | 
				
			|||
        if (isDraft) { whereCondition.isDraft = isDraft; } | 
				
			|||
        let times = timeRange; | 
				
			|||
        if (timeRange && timeRange.indexOf(',')) { times = timeRange.split(',') } | 
				
			|||
        if (times && times.length > 0) { | 
				
			|||
            const len = times.length; | 
				
			|||
            whereCondition.time = { | 
				
			|||
                $between: [ | 
				
			|||
                    moment(times[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'), | 
				
			|||
                    moment(times[len - 1]).endOf('day').format('YYYY-MM-DD HH:mm:ss') | 
				
			|||
                ] | 
				
			|||
            }; | 
				
			|||
        } | 
				
			|||
        switch (Number(state)) { | 
				
			|||
            case 1: //待审批:未审核 或者 已审核+未复核
 | 
				
			|||
                whereCondition.$or = [ | 
				
			|||
                    { '$audit1ManId$': null }, | 
				
			|||
                    { '$audit2ManId$': null } | 
				
			|||
                ]; | 
				
			|||
                whereCondition.rejectManId = null; | 
				
			|||
                break; | 
				
			|||
            case 2://已审批:已审批+已复核
 | 
				
			|||
                whereCondition.audit1ManId = { $not: null }; | 
				
			|||
                whereCondition.audit2ManId = { $not: null }; | 
				
			|||
                break; | 
				
			|||
            case 3: //驳回
 | 
				
			|||
                whereCondition.rejectManId = { $not: null }; | 
				
			|||
                break; | 
				
			|||
            default: break; | 
				
			|||
        } | 
				
			|||
        let findObj = { | 
				
			|||
            where: whereCondition, | 
				
			|||
            order: [["id", "desc"]], | 
				
			|||
            include: [{ | 
				
			|||
                model: models.Places, | 
				
			|||
            }, { | 
				
			|||
                model: models.User, | 
				
			|||
                as: 'user', | 
				
			|||
                attributes: ['id', 'name', 'username', 'phone'] | 
				
			|||
            }, { | 
				
			|||
                model: models.User, | 
				
			|||
                as: 'audit1ManUser', | 
				
			|||
                attributes: ['id', 'name', 'username', 'phone'] | 
				
			|||
            }, { | 
				
			|||
                model: models.User, | 
				
			|||
                as: 'audit2ManUser', | 
				
			|||
                attributes: ['id', 'name', 'username', 'phone'] | 
				
			|||
            }, { | 
				
			|||
                model: models.User, | 
				
			|||
                as: 'rejectManUser', | 
				
			|||
                attributes: ['id', 'name', 'username', 'phone'] | 
				
			|||
            }] | 
				
			|||
        }; | 
				
			|||
        if (Number(pageSize) > 0 && Number(pageIndex) >= 0) { | 
				
			|||
            findObj.limit = Number(pageSize); | 
				
			|||
            findObj.offset = Number(pageIndex) * Number(pageSize); | 
				
			|||
        } | 
				
			|||
        let userPlaceSecurityRecords = await models.UserPlaceSecurityRecord.findAndCountAll(findObj); | 
				
			|||
        ctx.status = 200; | 
				
			|||
        ctx.body = userPlaceSecurityRecords; | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { "message": "获取用户填报信息失败" } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 根据筛选条件获取用户审批填报信息 | 
				
			|||
 * @query { | 
				
			|||
 *  approveUserId-审批人ID | 
				
			|||
 *  timeRange-录入时间范围 | 
				
			|||
 *  regionId-区域ID | 
				
			|||
 *  placeId-场所ID | 
				
			|||
 *  state-审批状态 | 
				
			|||
 *  pageIndex-页码 | 
				
			|||
 *  pageSize-页宽 | 
				
			|||
 * } ctx | 
				
			|||
 */ | 
				
			|||
async function getApprovePlaceSecurityRecords (ctx, next) { | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const { approveUserId, timeRange, regionId, placeId, state, pageIndex, pageSize } = ctx.query; | 
				
			|||
        let whereCondition = { isDraft: false }; | 
				
			|||
        if (approveUserId) { | 
				
			|||
            let approveUser = await models.User.findOne({ where: { id: approveUserId } }); | 
				
			|||
            if (approveUser) { | 
				
			|||
                //获取审批人管辖区域内所有用户ID(注:市级人员查看所有用户数据)
 | 
				
			|||
                const departmentRes = await models.Department.findOne({ where: { id: approveUser.departmentId } }); | 
				
			|||
                if (departmentRes.dependence) { | 
				
			|||
                    let attentionRegionIds = [departmentRes.id]; | 
				
			|||
                    let regionType = departmentRes.type; | 
				
			|||
                    while (attentionRegionIds.length && regionType && regionType < 4) { | 
				
			|||
                        const departmentChilds = await models.Department.findAll({ where: { dependence: { $in: attentionRegionIds } } }); | 
				
			|||
                        regionType = departmentChilds.length ? departmentChilds[0].type : null; | 
				
			|||
                        attentionRegionIds = departmentChilds.map(d => d.id); | 
				
			|||
                    } | 
				
			|||
                    let users = await models.User.findAll({ where: { departmentId: { $in: attentionRegionIds } }, attributes: ['id'] }); | 
				
			|||
                    if (users.length) { | 
				
			|||
                        let userIds = users.map(u => u.id); | 
				
			|||
                        whereCondition.userId = { $in: userIds }; | 
				
			|||
                    } else { | 
				
			|||
                        ctx.status = 200; | 
				
			|||
                        ctx.body = { | 
				
			|||
                            "count": 0, | 
				
			|||
                            "rows": [] | 
				
			|||
                        } | 
				
			|||
                        return; | 
				
			|||
                    } | 
				
			|||
                } | 
				
			|||
                if (regionId) { | 
				
			|||
                    let region = await models.Department.findOne({ where: { id: regionId } }); | 
				
			|||
                    if (region) { | 
				
			|||
                        whereCondition.regionId = regionId; | 
				
			|||
                    } else { | 
				
			|||
                        ctx.status = 400; | 
				
			|||
                        ctx.body = { "message": "区域不存在!" } | 
				
			|||
                        return; | 
				
			|||
                    } | 
				
			|||
                } | 
				
			|||
                if (placeId) { | 
				
			|||
                    let place = await models.Places.findOne({ where: { id: placeId } }); | 
				
			|||
                    if (place) { | 
				
			|||
                        whereCondition.placeId = placeId; | 
				
			|||
                    } else { | 
				
			|||
                        ctx.status = 400; | 
				
			|||
                        ctx.body = { "message": "场所不存在!" }; | 
				
			|||
                        return; | 
				
			|||
                    } | 
				
			|||
                } | 
				
			|||
                let times = timeRange; | 
				
			|||
                if (timeRange && timeRange.indexOf(',')) { times = timeRange.split(',') } | 
				
			|||
                if (times && times.length > 0) { | 
				
			|||
                    const len = times.length; | 
				
			|||
                    whereCondition.time = { | 
				
			|||
                        $between: [ | 
				
			|||
                            moment(times[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'), | 
				
			|||
                            moment(times[len - 1]).endOf('day').format('YYYY-MM-DD HH:mm:ss') | 
				
			|||
                        ] | 
				
			|||
                    }; | 
				
			|||
                } | 
				
			|||
                switch (Number(state)) { | 
				
			|||
                    case 1: //待审批
 | 
				
			|||
                        if (departmentRes.type == 2) { | 
				
			|||
                            //区县待审:已审核+未复核
 | 
				
			|||
                            whereCondition.audit1ManId = { $not: null }; | 
				
			|||
                            whereCondition.audit2ManId = null; | 
				
			|||
                        } else { | 
				
			|||
                            //乡镇待审:未审核+未复核
 | 
				
			|||
                            whereCondition.audit1ManId = null; | 
				
			|||
                            whereCondition.audit2ManId = null; | 
				
			|||
                        } | 
				
			|||
                        whereCondition.rejectManId = null; | 
				
			|||
                        break; | 
				
			|||
                    case 2://已审批:
 | 
				
			|||
                        if (departmentRes.type == 3) { | 
				
			|||
                            //乡镇已审:已审核
 | 
				
			|||
                            whereCondition.audit1ManId = { $not: null }; | 
				
			|||
                        } else { | 
				
			|||
                            //区域已审:已审批+已复核
 | 
				
			|||
                            whereCondition.audit1ManId = { $not: null }; | 
				
			|||
                            whereCondition.audit2ManId = { $not: null }; | 
				
			|||
                        } | 
				
			|||
                        whereCondition.rejectManId = null; | 
				
			|||
                        break; | 
				
			|||
                    case 3: //驳回
 | 
				
			|||
                        whereCondition.rejectManId = { $not: null }; | 
				
			|||
                        break; | 
				
			|||
                    default: | 
				
			|||
                        if (departmentRes.type == 2) { | 
				
			|||
                            //区县查看数据:去除未审核
 | 
				
			|||
                            whereCondition.audit1ManId = { $not: null }; | 
				
			|||
                        } | 
				
			|||
                        break; | 
				
			|||
                } | 
				
			|||
                let findObj = { | 
				
			|||
                    where: whereCondition, | 
				
			|||
                    include: [{ | 
				
			|||
                        model: models.Places, | 
				
			|||
                    }, { | 
				
			|||
                        model: models.User, | 
				
			|||
                        as: 'user', | 
				
			|||
                        attributes: ['id', 'name', 'username', 'phone'] | 
				
			|||
                    }, { | 
				
			|||
                        model: models.User, | 
				
			|||
                        as: 'audit1ManUser', | 
				
			|||
                        attributes: ['id', 'name', 'username', 'phone'] | 
				
			|||
                    }, { | 
				
			|||
                        model: models.User, | 
				
			|||
                        as: 'audit2ManUser', | 
				
			|||
                        attributes: ['id', 'name', 'username', 'phone'] | 
				
			|||
                    }, { | 
				
			|||
                        model: models.User, | 
				
			|||
                        as: 'rejectManUser', | 
				
			|||
                        attributes: ['id', 'name', 'username', 'phone'] | 
				
			|||
                    }], | 
				
			|||
                    order: [["id", "desc"]] | 
				
			|||
                }; | 
				
			|||
                if (Number(pageSize) > 0 && Number(pageIndex) >= 0) { | 
				
			|||
                    findObj.limit = Number(pageSize); | 
				
			|||
                    findObj.offset = Number(pageIndex) * Number(pageSize); | 
				
			|||
                } | 
				
			|||
                let userPlaceSecurityRecords = await models.UserPlaceSecurityRecord.findAndCountAll(findObj); | 
				
			|||
                ctx.status = 200; | 
				
			|||
                ctx.body = userPlaceSecurityRecords; | 
				
			|||
            } else { | 
				
			|||
                ctx.status = 400; | 
				
			|||
                ctx.body = { "message": "用户不存在!" } | 
				
			|||
            } | 
				
			|||
        } else { | 
				
			|||
            ctx.status = 400; | 
				
			|||
            ctx.body = { "message": "请传用户参数!" } | 
				
			|||
        } | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { "message": "获取用户填报信息失败" } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
module.exports = { | 
				
			|||
    addPlaceSecurityRecord, | 
				
			|||
    editPlaceSecurityRecord, | 
				
			|||
    deletePlaceSecurityRecord, | 
				
			|||
    getPlaceSecurityRecordById, | 
				
			|||
    getRecentlyPlaceSecurityRecordByPlaceId, | 
				
			|||
    getPlaceSecurityRecords, | 
				
			|||
    getApprovePlaceSecurityRecords, | 
				
			|||
    updateType | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,91 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 根据用户ID获取该用户创建的所有场所信息 | 
				
			|||
 * @param {userId-用户ID} ctx | 
				
			|||
 */ | 
				
			|||
async function getPlacesByUserId(ctx, next) { | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const { userId } = ctx.params; | 
				
			|||
        let places = await models.Places.findAll({ where: { userId: userId }, attributes: ['id', 'name'] }); | 
				
			|||
        ctx.status = 200; | 
				
			|||
        ctx.body = places; | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { "message": "查询用户场所信息失败" } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 根据审批用户ID获取该审批用户范围内填报人创建的场所信息 | 
				
			|||
 * @param {approveUserId-审批用户ID} ctx | 
				
			|||
 */ | 
				
			|||
async function getPlacesByApproveUserId(ctx, next) { | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const { approveUserId } = ctx.params; | 
				
			|||
        let approveUser = await models.User.findOne({ where: { id: approveUserId } }); | 
				
			|||
        if (approveUser) { | 
				
			|||
            let whereCondition = {}; | 
				
			|||
            //获取审批人管辖区域内所有用户ID
 | 
				
			|||
            const departmentRes = await models.Department.findOne({ where: { id: approveUser.departmentId } }); | 
				
			|||
            if (departmentRes.dependence) { | 
				
			|||
                let regionType = departmentRes.type; | 
				
			|||
                if (regionType == 4) { | 
				
			|||
                    whereCondition.userId = approveUserId; | 
				
			|||
                } else { | 
				
			|||
                    let attentionRegionIds = [departmentRes.id]; | 
				
			|||
                    while (attentionRegionIds.length && regionType && regionType < 4) { | 
				
			|||
                        const departmentChilds = await models.Department.findAll({ where: { dependence: { $in: attentionRegionIds } } }); | 
				
			|||
                        regionType = departmentChilds.length ? departmentChilds[0].type : null; | 
				
			|||
                        attentionRegionIds = departmentChilds.map(d => d.id); | 
				
			|||
                    } | 
				
			|||
                    let users = await models.User.findAll({ where: { departmentId: { $in: attentionRegionIds } }, attributes: ['id'] }); | 
				
			|||
                    if (users.length) { | 
				
			|||
                        let userIds = users.map(u => u.id); | 
				
			|||
                        whereCondition.userId = { $in: userIds }; | 
				
			|||
                    } else { | 
				
			|||
                        ctx.status = 200; | 
				
			|||
                        ctx.body = []; | 
				
			|||
                        return; | 
				
			|||
                    } | 
				
			|||
                } | 
				
			|||
            } | 
				
			|||
            let places = await models.Places.findAll({ where: whereCondition, attributes: ['id', 'name'] }); | 
				
			|||
            ctx.status = 200; | 
				
			|||
            ctx.body = places; | 
				
			|||
        } else { | 
				
			|||
            ctx.status = 400; | 
				
			|||
            ctx.body = { "message": "用户不存在!" } | 
				
			|||
        } | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { "message": "查询用户区域内场所信息失败" } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 获取所有场所信息 | 
				
			|||
 */ | 
				
			|||
async function getAllPlaces(ctx, next) { | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        let places = await models.Places.findAll(); | 
				
			|||
        ctx.status = 200; | 
				
			|||
        ctx.body = places; | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { "message": "获取场所信息失败" } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
 | 
				
			|||
module.exports = { | 
				
			|||
    getPlacesByUserId, | 
				
			|||
    getPlacesByApproveUserId, | 
				
			|||
    getAllPlaces | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,140 @@ | 
				
			|||
const moment = require('moment') | 
				
			|||
 | 
				
			|||
async function getReportRectify(ctx, next) { | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const { fs: { api: { userInfo } } } = ctx | 
				
			|||
        const { startTime, endTime } = ctx.query | 
				
			|||
        // 查找自己所属的区县数据 type == 2
 | 
				
			|||
 | 
				
			|||
        let userDepRes = await models.Department.findOne({ | 
				
			|||
            order: [['id', 'asc']], | 
				
			|||
            where: { | 
				
			|||
                id: userInfo.departmentId | 
				
			|||
            }, | 
				
			|||
        }) | 
				
			|||
        let depRes = [] | 
				
			|||
        if (userDepRes.dataValues.type == 1) { | 
				
			|||
            depRes = await models.Department.findAll({ | 
				
			|||
                where: { | 
				
			|||
                    type: 2, | 
				
			|||
                } | 
				
			|||
            }) | 
				
			|||
        } else if (userDepRes.dataValues.type == 2) { | 
				
			|||
            depRes = [userDepRes] | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        let rectifyReportList = [] | 
				
			|||
 | 
				
			|||
        let calDay = moment(startTime).startOf('day') | 
				
			|||
        let endDay = moment(endTime).endOf('day') | 
				
			|||
        let today = moment().endOf('day') | 
				
			|||
        while (calDay.isBefore(endDay) && calDay.isBefore(today)) { | 
				
			|||
            let curDay_ = calDay.clone(); | 
				
			|||
            for (let d of depRes) { | 
				
			|||
                let reportCount = await models.ReportRectify.count({ | 
				
			|||
                    where: { | 
				
			|||
                        regionId: d.dataValues.id, | 
				
			|||
                        userId:{$not:null}, | 
				
			|||
                        dateTime: { | 
				
			|||
                            $between: [ | 
				
			|||
                                curDay_.startOf('day').format('YYYY-MM-DD HH:mm:ss'), | 
				
			|||
                                curDay_.endOf('day').format('YYYY-MM-DD HH:mm:ss') | 
				
			|||
                            ] | 
				
			|||
                        } | 
				
			|||
                    } | 
				
			|||
                }) | 
				
			|||
                let detailCount = await models.ReportRectify.count({ | 
				
			|||
                    where: { | 
				
			|||
                        regionId: d.dataValues.id, | 
				
			|||
                        dateTime: { | 
				
			|||
                            $between: [ | 
				
			|||
                                curDay_.startOf('day').format('YYYY-MM-DD HH:mm:ss'), | 
				
			|||
                                curDay_.endOf('day').format('YYYY-MM-DD HH:mm:ss') | 
				
			|||
                            ] | 
				
			|||
                        } | 
				
			|||
                    } | 
				
			|||
                }) | 
				
			|||
                if (detailCount > 0) | 
				
			|||
                    rectifyReportList.push({ | 
				
			|||
                        day: calDay.format('YYYY-MM-DD'), | 
				
			|||
                        region: d.dataValues.name, | 
				
			|||
                        name: d.dataValues.name + '合用场所安全隐患排查整治汇总表', | 
				
			|||
                        reportBool: reportCount > 0, | 
				
			|||
                        depId: d.id, | 
				
			|||
                    }) | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            calDay.add(1, 'day') | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        ctx.body = rectifyReportList; | 
				
			|||
        ctx.status = 200; | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "获取合用场所安全隐患排查整治汇总表列表失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
async function getReportRectifyDetail(ctx, next) { | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const { day, depId } = ctx.query | 
				
			|||
 | 
				
			|||
        let searchDay = moment(day) | 
				
			|||
        let reportRes = await models.ReportRectify.findAll({ | 
				
			|||
            where: { | 
				
			|||
                regionId: depId, | 
				
			|||
                dateTime: { | 
				
			|||
                    $between: [ | 
				
			|||
                        searchDay.startOf('day').format('YYYY-MM-DD HH:mm:ss'), | 
				
			|||
                        searchDay.endOf('day').format('YYYY-MM-DD HH:mm:ss') | 
				
			|||
                    ] | 
				
			|||
                } | 
				
			|||
            } | 
				
			|||
        }) | 
				
			|||
 | 
				
			|||
        ctx.body = reportRes; | 
				
			|||
        ctx.status = 200; | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "获取合用场所安全隐患排查整治汇总表详情失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
async function compileReportRectifyDetail(ctx, next) { | 
				
			|||
    const t = await ctx.fs.dc.orm.transaction(); | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const data = ctx.request.body | 
				
			|||
        for (let d of data) { | 
				
			|||
            await models.ReportRectify.update(d, { | 
				
			|||
                transaction: t, | 
				
			|||
                where: { | 
				
			|||
                    id: d.id | 
				
			|||
                } | 
				
			|||
            }) | 
				
			|||
        } | 
				
			|||
        await t.commit(); | 
				
			|||
        ctx.status = 204; | 
				
			|||
    } catch (error) { | 
				
			|||
        await t.rollback(); | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "保存合用场所安全隐患排查整治汇总表详情失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
module.exports = { | 
				
			|||
    getReportRectify, | 
				
			|||
    getReportRectifyDetail, | 
				
			|||
    compileReportRectifyDetail, | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,173 @@ | 
				
			|||
async function getAreas (ctx, next) { | 
				
			|||
    try { | 
				
			|||
        const { fs: { api: { userInfo } } } = ctx | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
 | 
				
			|||
        let userDepRes = await models.Department.findOne({ | 
				
			|||
            order: [['id', 'asc']], | 
				
			|||
            where: { | 
				
			|||
                id: userInfo.departmentId | 
				
			|||
            }, | 
				
			|||
        }) | 
				
			|||
 | 
				
			|||
        let rslt = [] | 
				
			|||
        if (userDepRes) { | 
				
			|||
            if (userDepRes.dataValues.type == 1) { | 
				
			|||
                rslt = await models.Department.findAll({ | 
				
			|||
                    order: [['id', 'asc']], | 
				
			|||
                    where: { | 
				
			|||
                        type: 2 | 
				
			|||
                    } | 
				
			|||
                }) | 
				
			|||
            } else if (userDepRes.dataValues.type == 2) { | 
				
			|||
                rslt = [userDepRes.dataValues] | 
				
			|||
            } | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        ctx.body = rslt; | 
				
			|||
        ctx.status = 200; | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "查询区域数据失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
async function addReportConfig (ctx) { | 
				
			|||
    let errMsg = "添加报表配置失败" | 
				
			|||
    try { | 
				
			|||
        const data = ctx.request.body | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
 | 
				
			|||
        const repeatRes = await models.ReportConfigition.find({ | 
				
			|||
            where: { | 
				
			|||
                regionId: data.regionId, | 
				
			|||
                reportTypeId: data.reportTypeId, | 
				
			|||
                excuteTime: data.excuteTime, | 
				
			|||
            } | 
				
			|||
        }) | 
				
			|||
 | 
				
			|||
        if (repeatRes) { | 
				
			|||
            errMsg = '已有相同配置信息'; | 
				
			|||
            throw errMsg | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        const res = await models.ReportConfigition.create(data) | 
				
			|||
 | 
				
			|||
        ctx.body = res; | 
				
			|||
        ctx.status = 200; | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": errMsg | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
async function getReportConfig (ctx) { | 
				
			|||
    try { | 
				
			|||
        const { fs: { api: { userInfo } } } = ctx | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
 | 
				
			|||
        // 查找自己所属的区县数据 type == 2
 | 
				
			|||
 | 
				
			|||
        let userDepRes = await models.Department.findOne({ | 
				
			|||
            order: [['id', 'asc']], | 
				
			|||
            where: { | 
				
			|||
                id: userInfo.departmentId | 
				
			|||
            }, | 
				
			|||
        }) | 
				
			|||
        let depRes = [] | 
				
			|||
        if (userDepRes.dataValues.type == 1) { | 
				
			|||
            depRes = await models.Department.findAll({ | 
				
			|||
                where: { | 
				
			|||
                    type: 2, | 
				
			|||
                } | 
				
			|||
            }) | 
				
			|||
        } else if (userDepRes.dataValues.type == 2) { | 
				
			|||
            depRes = [userDepRes] | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        const res = await models.ReportConfigition.findAll({ | 
				
			|||
            where: { | 
				
			|||
                regionId: { $in: depRes.map(d => d.dataValues.id) } | 
				
			|||
            } | 
				
			|||
        }) | 
				
			|||
 | 
				
			|||
        ctx.body = res; | 
				
			|||
        ctx.status = 200; | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "获取报表配置失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
async function editReportConfig (ctx) { | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const data = ctx.request.body | 
				
			|||
        const { reportId } = ctx.params | 
				
			|||
 | 
				
			|||
        const repeatRes = await models.ReportConfigition.find({ | 
				
			|||
            where: { | 
				
			|||
                id: { $ne: parseInt(reportId) }, | 
				
			|||
                regionId: data.regionId, | 
				
			|||
                reportTypeId: data.reportTypeId, | 
				
			|||
                excuteTime: data.excuteTime, | 
				
			|||
            } | 
				
			|||
        }) | 
				
			|||
 | 
				
			|||
        if (repeatRes) { | 
				
			|||
            errMsg = '已有相同配置信息'; | 
				
			|||
            throw errMsg | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        await models.ReportConfigition.update(data, { | 
				
			|||
            where: { | 
				
			|||
                id: parseInt(reportId) | 
				
			|||
            } | 
				
			|||
        }) | 
				
			|||
 | 
				
			|||
        ctx.status = 204; | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "编辑报表配置失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
async function delReportConfig (ctx) { | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const { reportId } = ctx.params | 
				
			|||
        await models.ReportConfigition.destroy({ | 
				
			|||
            where: { | 
				
			|||
                id: parseInt(reportId) | 
				
			|||
            } | 
				
			|||
        }) | 
				
			|||
 | 
				
			|||
        ctx.status = 204; | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "删除报表配置失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
module.exports = { | 
				
			|||
    getAreas, | 
				
			|||
    addReportConfig, | 
				
			|||
    getReportConfig, | 
				
			|||
    editReportConfig, | 
				
			|||
    delReportConfig, | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,87 @@ | 
				
			|||
const moment = require('moment'); | 
				
			|||
async function getReportList (ctx, next) { | 
				
			|||
    try { | 
				
			|||
        const { fs: { api: { userInfo } } } = ctx | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const { creatTime, reportName, regionName, limit, offset } = ctx.query; | 
				
			|||
 | 
				
			|||
        let where = { | 
				
			|||
            $and: { | 
				
			|||
                reportName: { $notLike: '%填报信息导出%' } | 
				
			|||
            } | 
				
			|||
        }; | 
				
			|||
        if (creatTime) { | 
				
			|||
            where.creatTime = { | 
				
			|||
                $gte: moment(creatTime[0]).format('YYYY-MM-DD HH:mm:ss'), | 
				
			|||
                $lte: moment(creatTime[1]).format('YYYY-MM-DD HH:mm:ss') | 
				
			|||
            } | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        if (reportName) { | 
				
			|||
            where.reportName = { | 
				
			|||
                $iLike: `%${reportName}%` | 
				
			|||
            } | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        if (regionName && regionName != -1) { | 
				
			|||
            where.regionId = regionName | 
				
			|||
        } else { | 
				
			|||
            let userDepRes = await models.Department.findOne({ | 
				
			|||
                order: [['id', 'asc']], | 
				
			|||
                where: { | 
				
			|||
                    id: userInfo.departmentId | 
				
			|||
                }, | 
				
			|||
            }) | 
				
			|||
 | 
				
			|||
            let userDep = [] | 
				
			|||
            if (userDepRes) { | 
				
			|||
                if (userDepRes.dataValues.type == 1) { | 
				
			|||
                    userDep = await models.Department.findAll({ | 
				
			|||
                        order: [['id', 'asc']], | 
				
			|||
                        where: { | 
				
			|||
                            type: 2 | 
				
			|||
                        } | 
				
			|||
                    }) | 
				
			|||
                } else if (userDepRes.dataValues.type == 2) { | 
				
			|||
                    userDep = [userDepRes] | 
				
			|||
                } | 
				
			|||
            } | 
				
			|||
            where.regionId = { $in: userDep.map(u => u.dataValues.id) } | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        let findObj = { | 
				
			|||
            include: [{ | 
				
			|||
                model: models.ReportType, | 
				
			|||
                attributes: ['name'] | 
				
			|||
            }, { | 
				
			|||
                model: models.Department, | 
				
			|||
                attributes: ['name'] | 
				
			|||
            }], | 
				
			|||
            where: where, | 
				
			|||
            order: [['creatTime', 'desc']], | 
				
			|||
        }; | 
				
			|||
 | 
				
			|||
        if (Number(limit) > 0 && Number(offset) >= 0) { | 
				
			|||
            findObj.limit = Number(limit); | 
				
			|||
            findObj.offset = Number(offset); | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        const res = await models.ReportDownManage.findAndCountAll(findObj) | 
				
			|||
 | 
				
			|||
        ctx.body = res; | 
				
			|||
        ctx.status = 200; | 
				
			|||
 | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "查询报表数据失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
module.exports = { | 
				
			|||
    getReportList, | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,342 @@ | 
				
			|||
const moment = require('moment'); | 
				
			|||
const { QueryTypes } = require('sequelize'); | 
				
			|||
 | 
				
			|||
async function reportDailyStatistic (ctx, next) { | 
				
			|||
    const rslt = { | 
				
			|||
        added: 0, //今日新增
 | 
				
			|||
        checked: 0, //今日已审填报
 | 
				
			|||
        unChecked: 0, //未审填报
 | 
				
			|||
        danger_place: 0, //隐患场所总数
 | 
				
			|||
        history: 0, //历史填报
 | 
				
			|||
        date: {} | 
				
			|||
    }; | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const curDay_ = moment(); | 
				
			|||
        const sequelize = ctx.fs.dc.orm; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
        rslt.added = await models.UserPlaceSecurityRecord.count({ | 
				
			|||
            where: { | 
				
			|||
                time: { | 
				
			|||
                    $between: [ | 
				
			|||
                        curDay_.startOf('day').format('YYYY-MM-DD HH:mm:ss'), | 
				
			|||
                        curDay_.endOf('day').format('YYYY-MM-DD HH:mm:ss') | 
				
			|||
                    ] | 
				
			|||
                } | 
				
			|||
            } | 
				
			|||
        }) | 
				
			|||
        rslt.unChecked = await models.UserPlaceSecurityRecord.count({ | 
				
			|||
            where: { | 
				
			|||
                $or: [ | 
				
			|||
                    { | 
				
			|||
                        audit2ManId: { $eq: null }, | 
				
			|||
                        rejectManId: { $eq: null }, | 
				
			|||
                    }, | 
				
			|||
                    // {
 | 
				
			|||
                    //     audit2ManId: { $ne: null },
 | 
				
			|||
                    //     rejectManId: { $eq: null },
 | 
				
			|||
                    // },
 | 
				
			|||
                    { | 
				
			|||
                        audit1ManId: { $eq: null }, | 
				
			|||
                        rejectManId: { $eq: null }, | 
				
			|||
                    } | 
				
			|||
                ] | 
				
			|||
            } | 
				
			|||
        }); | 
				
			|||
 | 
				
			|||
        rslt.checked = await models.UserPlaceSecurityRecord.count({ | 
				
			|||
            where: { | 
				
			|||
                $or: [ | 
				
			|||
                    { | 
				
			|||
                        audit2ManId: { $ne: null }, | 
				
			|||
                        audit2ManIdTime: { | 
				
			|||
                            $between: [ | 
				
			|||
                                curDay_.startOf('day').format('YYYY-MM-DD HH:mm:ss'), | 
				
			|||
                                curDay_.endOf('day').format('YYYY-MM-DD HH:mm:ss') | 
				
			|||
                            ] | 
				
			|||
                        } | 
				
			|||
                    }, | 
				
			|||
                    { | 
				
			|||
                        rejectManId: { $ne: null }, | 
				
			|||
                        rejectTime: { | 
				
			|||
                            $between: [ | 
				
			|||
                                curDay_.startOf('day').format('YYYY-MM-DD HH:mm:ss'), | 
				
			|||
                                curDay_.endOf('day').format('YYYY-MM-DD HH:mm:ss') | 
				
			|||
                            ] | 
				
			|||
                        } | 
				
			|||
                    } | 
				
			|||
                ] | 
				
			|||
            } | 
				
			|||
        }); | 
				
			|||
 | 
				
			|||
        const list = await sequelize.query(`SELECT count(*) AS "count" FROM "user_placeSecurityRecord" AS "userPlaceSecurityRecord" 
 | 
				
			|||
        WHERE ("userPlaceSecurityRecord"."correctiveAction" IS NOT NULL AND "userPlaceSecurityRecord"."punishment" IS NOT NULL) AND "audit2ManId" IS NOT NULL GROUP BY "placeId";`, { type: QueryTypes.SELECT })
 | 
				
			|||
        rslt.danger_place = list.length; | 
				
			|||
 | 
				
			|||
        rslt.history = await models.UserPlaceSecurityRecord.count(); | 
				
			|||
 | 
				
			|||
        // seven days data
 | 
				
			|||
 | 
				
			|||
        const startDay = moment().startOf('day'); | 
				
			|||
        for (let d = 1; d <= 7; d++) { | 
				
			|||
            const START_DAY = moment(startDay).add(-d, 'day'); | 
				
			|||
            const date = START_DAY.format('YYYY-MM-DD'); | 
				
			|||
            const num = await models.UserPlaceSecurityRecord.count({ | 
				
			|||
                where: { | 
				
			|||
                    time: { | 
				
			|||
                        $between: [ | 
				
			|||
                            START_DAY.startOf('day').format('YYYY-MM-DD HH:mm:ss'), | 
				
			|||
                            START_DAY.endOf('day').format('YYYY-MM-DD HH:mm:ss') | 
				
			|||
                        ] | 
				
			|||
                    } | 
				
			|||
                } | 
				
			|||
            }) | 
				
			|||
 | 
				
			|||
            rslt.date[date] = num; | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        ctx.status = 200; | 
				
			|||
        ctx.body = rslt; | 
				
			|||
 | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "获取数据中台数据失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
} | 
				
			|||
 | 
				
			|||
async function reportAreaStatistic (ctx, next) { | 
				
			|||
    let rslt = [], relationRegion = {}; | 
				
			|||
    try { | 
				
			|||
        const { startDate, endDate } = ctx.query; | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const sequelize = ctx.fs.dc.orm; | 
				
			|||
 | 
				
			|||
        const list = await sequelize.query(`select "regionId", count("regionId")  from "user_placeSecurityRecord" WHERE "time" BETWEEN '${moment(startDate).startOf('day').format('YYYY-MM-DD HH:mm:ss')}' AND '${moment(endDate).endOf('day').format('YYYY-MM-DD HH:mm:ss')}' AND "hiddenDangerItem12" IS NOT NULL GROUP BY "regionId" `, { type: QueryTypes.SELECT }) | 
				
			|||
        // let regionIds = []
 | 
				
			|||
        // list.map(item => {
 | 
				
			|||
        //     if (item.regionId && item.regionId != '') {
 | 
				
			|||
        //         regionIds.push(item.regionId);
 | 
				
			|||
        //     }
 | 
				
			|||
        // });
 | 
				
			|||
 | 
				
			|||
        // const depts = await sequelize.query(`SELECT "id", "name", "type", "dependence" FROM "department" AS "department" WHERE "department"."id" IN (${regionIds.toString()});`, { type: QueryTypes.SELECT });
 | 
				
			|||
        const deptRelation = await sequelize.query(`SELECT "id", "name", "type", "dependence" FROM "department" AS "department";`, { type: QueryTypes.SELECT }); | 
				
			|||
        const quArea = deptRelation.filter(f => f.type == 2); | 
				
			|||
        quArea.map(item => { | 
				
			|||
            relationRegion[item.id] = {}; | 
				
			|||
            const xiang = deptRelation.filter(f => f.type == 3 && f.dependence == item.id).map(item => item.id); | 
				
			|||
 | 
				
			|||
            const cun = deptRelation.filter(f => f.type == 4 && xiang.some(ss => ss == f.dependence)).map(item => item.id); | 
				
			|||
            relationRegion[item.id]['regionIds'] = [item.id, ...xiang, ...cun]; | 
				
			|||
            relationRegion[item.id]['name'] = item.name; | 
				
			|||
        }) | 
				
			|||
        Object.keys(relationRegion).map(key => { | 
				
			|||
            const { regionIds, name } = relationRegion[key]; | 
				
			|||
            let data = list.filter(item => regionIds.some(id => id == item.regionId)) | 
				
			|||
            let obj = {}; | 
				
			|||
            obj['name'] = name; | 
				
			|||
            obj['count'] = 0; | 
				
			|||
            obj['regionId'] = key; | 
				
			|||
            data.map(item => { | 
				
			|||
                obj['count'] += Number(item.count) | 
				
			|||
            }) | 
				
			|||
            rslt.push(obj) | 
				
			|||
        }) | 
				
			|||
 | 
				
			|||
        ctx.status = 200; | 
				
			|||
        ctx.body = rslt; | 
				
			|||
 | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "获取数据中台数据失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
} | 
				
			|||
 | 
				
			|||
async function dangerAreaQuery (ctx, next) { | 
				
			|||
    const { userId } = ctx.fs.api | 
				
			|||
    let rslt = { rows: [], count: 0, ids: [] }, relationRegion = {}; | 
				
			|||
    try { | 
				
			|||
        const { startDate, endDate, placeType, regionId, placeName, offset = 0, limit = 20 } = ctx.query; | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const sequelize = ctx.fs.dc.orm; | 
				
			|||
 | 
				
			|||
        let options = { | 
				
			|||
            audit2ManId: { $ne: null }, | 
				
			|||
        }, places = [], dep4Ids = []; | 
				
			|||
        if (startDate && endDate) { | 
				
			|||
            options.time = { | 
				
			|||
                $between: [ | 
				
			|||
                    moment(startDate).startOf('day').format('YYYY-MM-DD HH:mm:ss'), | 
				
			|||
                    moment(endDate).endOf('day').format('YYYY-MM-DD HH:mm:ss') | 
				
			|||
                ] | 
				
			|||
            } | 
				
			|||
        } | 
				
			|||
        if (placeName) { | 
				
			|||
            places = await models.Places.findAll({ | 
				
			|||
                where: { | 
				
			|||
                    name: { $like: `%${placeName}%` } | 
				
			|||
                } | 
				
			|||
            }) | 
				
			|||
            options.placeId = { | 
				
			|||
                $in: places.map(item => item.id) | 
				
			|||
            } | 
				
			|||
        } else { | 
				
			|||
            places = await models.Places.findAll() | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        if (regionId && regionId != -1) { | 
				
			|||
            let idList = []; | 
				
			|||
            const curDeptRelation = await sequelize.query(`SELECT "id", "name", "type", "dependence" FROM "department" WHERE "id" in (${regionId});`, { type: QueryTypes.SELECT }); | 
				
			|||
 | 
				
			|||
            const type = curDeptRelation[0].type | 
				
			|||
            if (type != 1) { | 
				
			|||
                const deptRelation = await sequelize.query(`SELECT "id", "name", "type", "dependence" FROM "department" AS "department";`, { type: QueryTypes.SELECT }); | 
				
			|||
                const quArea = deptRelation.filter(f => f.type == 2); | 
				
			|||
                quArea.map(item => { | 
				
			|||
                    relationRegion[item.id] = {}; | 
				
			|||
                    deptRelation.filter(f => f.type == 3 && f.dependence == item.id).map(x => { | 
				
			|||
                        relationRegion[item.id][x.id] = deptRelation.filter(f => f.type == 4 && x.id == f.dependence).map(cun => cun.id); | 
				
			|||
                    }); | 
				
			|||
                }) | 
				
			|||
                if (type == 2) { | 
				
			|||
                    const quList = [regionId]; | 
				
			|||
                    const xiangList = Object.keys(relationRegion[regionId]) | 
				
			|||
                    let cunList = xiangList.map(key => { | 
				
			|||
                        return relationRegion[regionId][key] | 
				
			|||
                    }) | 
				
			|||
                    idList = quList.concat(xiangList).concat(cunList.flat(Infinity)) | 
				
			|||
 | 
				
			|||
                    options.regionId = { $in: idList }; | 
				
			|||
                } | 
				
			|||
                if (type == 3) { | 
				
			|||
                    Object.keys(relationRegion).map(quKey => { | 
				
			|||
                        Object.keys(relationRegion[quKey]).map(xiangKey => { | 
				
			|||
                            if (xiangKey == regionId) { | 
				
			|||
                                const xiangList = [xiangKey]; | 
				
			|||
                                const cunList = relationRegion[quKey][xiangKey] | 
				
			|||
                                idList = xiangList.concat(cunList); | 
				
			|||
                            } | 
				
			|||
                        }) | 
				
			|||
                    }) | 
				
			|||
                    dep4Ids = idList | 
				
			|||
                } | 
				
			|||
                if (type == 4) { | 
				
			|||
                    const curUser = await models.User.findOne({ where: { id: userId } }) | 
				
			|||
                    const corUserDepId = curUser.departmentId | 
				
			|||
                    const corUseUserDepRes = await models.Department.findOne({ where: { id: corUserDepId } }) | 
				
			|||
                    if(corUseUserDepRes.type < 4){ | 
				
			|||
                        dep4Ids = [regionId] | 
				
			|||
                    } else { | 
				
			|||
                        options.userId = userId | 
				
			|||
                    } | 
				
			|||
                    // idList = [regionId]
 | 
				
			|||
                    // options.userId = userId
 | 
				
			|||
                } | 
				
			|||
                // options.departmentId = { $in: idList };
 | 
				
			|||
            } | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        if (placeType != null && placeType != -1) { | 
				
			|||
 | 
				
			|||
            if (placeType == 0) { | 
				
			|||
                options = Object.assign({}, options, { | 
				
			|||
                    $or: [ | 
				
			|||
                        { | 
				
			|||
                            correctiveAction: { $ne: null }, | 
				
			|||
                        }, | 
				
			|||
                        { | 
				
			|||
                            punishment: { $ne: null }, | 
				
			|||
                        } | 
				
			|||
                    ] | 
				
			|||
                }) | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            if (placeType == 1) | 
				
			|||
                options = Object.assign({}, options, { | 
				
			|||
                    $or: [ | 
				
			|||
                        { | 
				
			|||
                            correctiveAction: { $eq: null }, | 
				
			|||
                        }, | 
				
			|||
                        { | 
				
			|||
                            punishment: { $eq: null }, | 
				
			|||
                        } | 
				
			|||
                    ], | 
				
			|||
                    hiddenDangerItem12: { | 
				
			|||
                        $ne: null | 
				
			|||
                    } | 
				
			|||
                }) | 
				
			|||
 | 
				
			|||
            if (placeType == 2) | 
				
			|||
                options.hiddenDangerItem12 = { | 
				
			|||
                    $eq: null | 
				
			|||
                } | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        let findOption = { | 
				
			|||
            where: options, | 
				
			|||
            offset: offset, | 
				
			|||
            limit: limit, | 
				
			|||
            order: [['time', 'DESC']], | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        if (dep4Ids.length) { | 
				
			|||
            findOption.include = [{ | 
				
			|||
                required: true, | 
				
			|||
                model: models.User, | 
				
			|||
                as: 'user', | 
				
			|||
                where: { | 
				
			|||
                    departmentId: { $in: dep4Ids } | 
				
			|||
                } | 
				
			|||
            }] | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        const list = await models.UserPlaceSecurityRecord.findAll(findOption) | 
				
			|||
 | 
				
			|||
        for (let item of list) { | 
				
			|||
            const { name } = places.filter(p => p.id == item.placeId)[0] || {}; | 
				
			|||
            const checkAreaName = await sequelize.query(`SELECT "dpt"."name" FROM "department" as "dpt" WHERE "dpt"."id" in (SELECT "department_id" FROM  "user" WHERE "id" = ${item.userId} );`, { type: QueryTypes.SELECT }) | 
				
			|||
            const checkUser = await sequelize.query(`SELECT "name", "phone" FROM  "user" WHERE "id" = ${item.userId}`, { type: QueryTypes.SELECT }) | 
				
			|||
            rslt.rows.push(Object.assign({}, item.dataValues, { placeName: name, checkAreaName: (checkAreaName[0] || {}).name || '', checkUserName: (checkUser[0] || {}).name || '', checkUserPhone: (checkUser[0] || {}).phone })) | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        delete findOption.offset | 
				
			|||
        delete findOption.limit | 
				
			|||
        delete findOption.order | 
				
			|||
        findOption.attributes = ['id'] | 
				
			|||
        const dataAll = await models.UserPlaceSecurityRecord.findAll( | 
				
			|||
            findOption | 
				
			|||
            // {
 | 
				
			|||
            //     attributes: ['id'],
 | 
				
			|||
            //     where: options,
 | 
				
			|||
            // }
 | 
				
			|||
        ); | 
				
			|||
        rslt.count = dataAll.length; | 
				
			|||
        rslt.ids = dataAll.map(item => item.dataValues.id); | 
				
			|||
 | 
				
			|||
        ctx.status = 200; | 
				
			|||
        ctx.body = rslt; | 
				
			|||
 | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "获取数据中台数据失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
} | 
				
			|||
 | 
				
			|||
module.exports = { | 
				
			|||
    reportDailyStatistic, | 
				
			|||
    reportAreaStatistic, | 
				
			|||
    dangerAreaQuery, | 
				
			|||
} | 
				
			|||
@ -0,0 +1,483 @@ | 
				
			|||
'use strict'; | 
				
			|||
const moment = require('moment'); | 
				
			|||
//获取每日汇总
 | 
				
			|||
async function getDayReport(ctx) { | 
				
			|||
    try { | 
				
			|||
        const { date, areaId } = ctx.query; | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        let range = [moment(date).startOf('day').format("YYYY-MM-DD HH:mm:ss"), moment(date).endOf('day').format("YYYY-MM-DD HH:mm:ss")] | 
				
			|||
        let rslt = await models.ReportCollection.findAll({ | 
				
			|||
            where: { | 
				
			|||
                dateTime: { | 
				
			|||
                    $between: range | 
				
			|||
                }, | 
				
			|||
                regionId: areaId | 
				
			|||
            }, | 
				
			|||
            include: [{ | 
				
			|||
                required: true, | 
				
			|||
                model: models.User, | 
				
			|||
                attributes: ['name', 'username', 'phone'] | 
				
			|||
            }, { | 
				
			|||
                required: false, | 
				
			|||
                model: models.Department, | 
				
			|||
                attributes: ['name'] | 
				
			|||
            }] | 
				
			|||
        }); | 
				
			|||
        ctx.status = 200; | 
				
			|||
        ctx.body = rslt; | 
				
			|||
    } catch (error) { | 
				
			|||
        console.log(error) | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "获取全市每日汇总表失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
//获取排查整治汇总表
 | 
				
			|||
async function getGovern(ctx) { | 
				
			|||
    try { | 
				
			|||
        const { date, areaId } = ctx.query; | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        let range = [moment(date).startOf('day').format("YYYY-MM-DD HH:mm:ss"), moment(date).endOf('day').format("YYYY-MM-DD HH:mm:ss")] | 
				
			|||
        let rslt = await models.ReportRectify.findAndCountAll({ | 
				
			|||
            where: { | 
				
			|||
                dateTime: { | 
				
			|||
                    $between: range | 
				
			|||
                }, | 
				
			|||
                regionId: areaId | 
				
			|||
            }, | 
				
			|||
            include: [{ | 
				
			|||
                required: true, | 
				
			|||
                model: models.User, | 
				
			|||
                attributes: ['id', 'name', 'username', 'phone'] | 
				
			|||
            }, { | 
				
			|||
                required: false, | 
				
			|||
                model: models.Department, | 
				
			|||
                attributes: ['id', 'name'] | 
				
			|||
            }], | 
				
			|||
            limit: 1 | 
				
			|||
        }); | 
				
			|||
        ctx.status = 200; | 
				
			|||
        let obj = { count: 0 } | 
				
			|||
        if (rslt.count > 0) { | 
				
			|||
            obj.area = rslt.rows[0].department; | 
				
			|||
            obj.dateTime = rslt.rows[0].dateTime; | 
				
			|||
            obj.count = rslt.count; | 
				
			|||
            obj.user = rslt.rows[0].user; | 
				
			|||
            obj.isAudit = rslt.rows[0].isAudit | 
				
			|||
        } | 
				
			|||
        ctx.body = obj; | 
				
			|||
    } catch (error) { | 
				
			|||
        console.log(error) | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "获取排查整治汇总表失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
//获取排查整治汇总详情
 | 
				
			|||
async function getGovernDetail(ctx) { | 
				
			|||
    try { | 
				
			|||
        const { name, date, areaId, pageSize, pageIndex } = ctx.query; | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        let range = [moment(date).startOf('day').format("YYYY-MM-DD HH:mm:ss"), moment(date).endOf('day').format("YYYY-MM-DD HH:mm:ss")] | 
				
			|||
        let whereObj = { | 
				
			|||
            dateTime: { | 
				
			|||
                $between: range | 
				
			|||
            }, | 
				
			|||
            regionId: areaId | 
				
			|||
        }; | 
				
			|||
        if (name) { | 
				
			|||
            whereObj.name = { $like: `%${name}%` } | 
				
			|||
        } | 
				
			|||
        let findObj = { | 
				
			|||
            where: whereObj, | 
				
			|||
            include: [{ | 
				
			|||
                required: true, | 
				
			|||
                model: models.User, | 
				
			|||
                attributes: ['id', 'name', 'username', 'phone'] | 
				
			|||
            }, { | 
				
			|||
                required: false, | 
				
			|||
                model: models.Department, | 
				
			|||
                attributes: ['id', 'name'] | 
				
			|||
            }], | 
				
			|||
            order: [['dateTime', 'desc']] | 
				
			|||
        }; | 
				
			|||
        if (Number(pageSize) > 0 && Number(pageIndex) >= 0) { | 
				
			|||
            findObj.limit = Number(pageSize); | 
				
			|||
            findObj.offset = Number(pageIndex) * Number(pageSize); | 
				
			|||
        } | 
				
			|||
        let rslt = await models.ReportRectify.findAndCountAll(findObj); | 
				
			|||
        ctx.status = 200; | 
				
			|||
        ctx.body = rslt; | 
				
			|||
    } catch (error) { | 
				
			|||
        console.log(error) | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "获取排查整治汇总详情失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 确认整治汇总场所数据 | 
				
			|||
 * body { | 
				
			|||
 * governDetailIds:'1,2' | 
				
			|||
 * }  | 
				
			|||
 */ | 
				
			|||
async function operateGovern(ctx, next) { | 
				
			|||
    try { | 
				
			|||
        const data = ctx.request.body; | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        if (data.governDetailIds && data.governDetailIds.length > 0) { | 
				
			|||
            await models.ReportRectify.update({ | 
				
			|||
                isAudit: true | 
				
			|||
            }, { where: { id: { $in: data.governDetailIds.split(',') } } }); | 
				
			|||
 | 
				
			|||
            ctx.body = { "message": "确认整治汇总下场所数据成功" }; | 
				
			|||
            ctx.status = 200; | 
				
			|||
        } else { | 
				
			|||
            ctx.body = { "message": "确认参数有误" }; | 
				
			|||
            ctx.status = 400; | 
				
			|||
        } | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { "message": "确认整治汇总下场所数据失败" } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
//获取安全隐患排查详细数据列表
 | 
				
			|||
async function getSecurityRiskList(ctx) { | 
				
			|||
    try { | 
				
			|||
        const { name, date, areaId, pageSize, pageIndex } = ctx.query; | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
 | 
				
			|||
        let whereObj = {}; | 
				
			|||
        let wheres = { | 
				
			|||
            audit1ManId: { $not: null }, | 
				
			|||
            audit2ManId: { $not: null } | 
				
			|||
        } | 
				
			|||
        if (areaId) { | 
				
			|||
            wheres.regionId = areaId; | 
				
			|||
        } | 
				
			|||
        if (name) | 
				
			|||
            whereObj = { name: { $like: `%${name}%` } } | 
				
			|||
        let findObj = { | 
				
			|||
            attributes: ['id', 'time', 'placeId', 'userId'], | 
				
			|||
            where: | 
				
			|||
                // time: {
 | 
				
			|||
                //     $between: range
 | 
				
			|||
                // },
 | 
				
			|||
                // regionId: areaId,
 | 
				
			|||
                // audit1ManId: { $not: null },
 | 
				
			|||
                // audit2ManId: { $not: null }
 | 
				
			|||
                wheres | 
				
			|||
            , | 
				
			|||
            include: [{ | 
				
			|||
                required: true, | 
				
			|||
                model: models.Places, | 
				
			|||
                attributes: ['id', 'name'], | 
				
			|||
                where: whereObj | 
				
			|||
            }, { | 
				
			|||
                required: true, | 
				
			|||
                model: models.User, | 
				
			|||
                as: 'user', | 
				
			|||
                attributes: ['id', 'name', 'username', 'phone'] | 
				
			|||
            }], | 
				
			|||
            order: [['time', 'desc']] | 
				
			|||
        }; | 
				
			|||
        if (date) { | 
				
			|||
            let range = [moment(date).startOf('day').format("YYYY-MM-DD HH:mm:ss"), moment(date).endOf('day').format("YYYY-MM-DD HH:mm:ss")] | 
				
			|||
            findObj.where.time = { | 
				
			|||
                $between: range | 
				
			|||
            } | 
				
			|||
        } | 
				
			|||
        if (areaId) { | 
				
			|||
            findObj.where.regionId = areaId | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        if (Number(pageSize) > 0 && Number(pageIndex) >= 0) { | 
				
			|||
            findObj.limit = Number(pageSize); | 
				
			|||
            findObj.offset = Number(pageIndex) * Number(pageSize); | 
				
			|||
        } | 
				
			|||
        let rslt = await models.UserPlaceSecurityRecord.findAndCountAll(findObj); | 
				
			|||
        ctx.status = 200; | 
				
			|||
        ctx.body = rslt; | 
				
			|||
    } catch (error) { | 
				
			|||
        console.log(error) | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "获取安全隐患排查详细数据列表失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
 | 
				
			|||
//获取待处理数量
 | 
				
			|||
async function getHomeCount(ctx) { | 
				
			|||
    try { | 
				
			|||
        let { userId, departmentId, userRegionType } = ctx.params; | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const departmentRes = await models.Department.findOne({ where: { id: departmentId } }); | 
				
			|||
        if (userRegionType != 2 && userRegionType != 3 && !departmentRes) { | 
				
			|||
            ctx.body = { "message": "请求参数有误" }; | 
				
			|||
            ctx.status = 400; | 
				
			|||
        } else { | 
				
			|||
            //获取当前用户数据范围管辖区域内所有用户ID
 | 
				
			|||
            let attentionRegionIds = [departmentRes.id]; | 
				
			|||
            let regionType = departmentRes.type; | 
				
			|||
            while (attentionRegionIds.length && regionType && regionType < 4) { | 
				
			|||
                const departmentChilds = await models.Department.findAll({ where: { dependence: { $in: attentionRegionIds } } }); | 
				
			|||
                regionType = departmentChilds.length ? departmentChilds[0].type : null; | 
				
			|||
                attentionRegionIds = departmentChilds.map(d => d.id); | 
				
			|||
            } | 
				
			|||
            let users = await models.User.findAll({ where: { departmentId: { $in: attentionRegionIds } }, attributes: ['id'] }); | 
				
			|||
            let userIds = users.map(u => u.id); | 
				
			|||
 | 
				
			|||
            let rslt = { recordCount: 0, reportCount: null } | 
				
			|||
            if (userIds.length) { | 
				
			|||
                let whereObj = { | 
				
			|||
                    userId: { $in: userIds }, | 
				
			|||
                    rejectManId: null, | 
				
			|||
                    isDraft: false | 
				
			|||
                } | 
				
			|||
                if (userRegionType == 3) { | 
				
			|||
                    whereObj.audit1ManId = null; | 
				
			|||
                } else { | 
				
			|||
                    whereObj.audit1ManId = { $not: null }; | 
				
			|||
                    whereObj.audit2ManId = null; | 
				
			|||
                } | 
				
			|||
                let recordCount = await models.UserPlaceSecurityRecord.count({ | 
				
			|||
                    where: whereObj | 
				
			|||
                }); | 
				
			|||
                rslt.recordCount = recordCount; | 
				
			|||
                if (userRegionType == 2) { | 
				
			|||
                    let reportCount = await models.ReportCollection.count({ | 
				
			|||
                        where: { | 
				
			|||
                            userId: null, | 
				
			|||
                            regionId: departmentId | 
				
			|||
                        } | 
				
			|||
                    }); | 
				
			|||
                    let reportRectify = await models.ReportRectify.findAll({ | 
				
			|||
                        where: { | 
				
			|||
                            userId: null, | 
				
			|||
                            regionId: departmentId | 
				
			|||
                        } | 
				
			|||
                    }); | 
				
			|||
                    let dateArr = []; | 
				
			|||
                    reportRectify.map(r => { | 
				
			|||
                        let date = moment(r.dateTime).format("YYYY-MM-DD"); | 
				
			|||
                        if (!dateArr.includes(date)) { | 
				
			|||
                            dateArr.push(date) | 
				
			|||
                        } | 
				
			|||
                    }) | 
				
			|||
                    rslt.reportCount = reportCount + dateArr.length; | 
				
			|||
                } | 
				
			|||
            } | 
				
			|||
            ctx.status = 200; | 
				
			|||
            ctx.body = rslt; | 
				
			|||
        } | 
				
			|||
    } catch (error) { | 
				
			|||
        console.log(error) | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { | 
				
			|||
            "message": "获取待处理数量失败" | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
//每日汇总表上报
 | 
				
			|||
async function operateReport(ctx, next) { | 
				
			|||
    try { | 
				
			|||
        let { id, userId } = ctx.params; | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        await models.ReportCollection.update({ | 
				
			|||
            userId: userId | 
				
			|||
        }, { where: { id: id } }); | 
				
			|||
 | 
				
			|||
        ctx.body = { "message": "每日汇总表上报成功" }; | 
				
			|||
        ctx.status = 200; | 
				
			|||
 | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { "message": "每日汇总表上报失败" } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 根据筛选条件获取用户审核报表信息 | 
				
			|||
 * @query { | 
				
			|||
 *  approveUserId-审批人ID | 
				
			|||
 *  reportType-报表类型(1-整治汇总表,2-每日汇总表,null-整治汇总表+每日汇总表) | 
				
			|||
 *  timeRange-时间范围 | 
				
			|||
 *  regionId-区域ID | 
				
			|||
 *  state-审批状态 | 
				
			|||
 *  pageIndex-页码 | 
				
			|||
 *  pageSize-页宽 | 
				
			|||
 * } ctx | 
				
			|||
 */ | 
				
			|||
async function getApproveReportCollections(ctx, next) { | 
				
			|||
    try { | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        const { approveUserId, reportType, timeRange, regionId, state, pageIndex, pageSize } = ctx.query; | 
				
			|||
        let whereCondition = {}; | 
				
			|||
        if (approveUserId) { | 
				
			|||
            let approveUser = await models.User.findOne({ where: { id: approveUserId } }); | 
				
			|||
            if (approveUser) { | 
				
			|||
                //市级用户可以看到所有报表数据
 | 
				
			|||
                const departmentRes = await models.Department.findOne({ where: { id: approveUser.departmentId } }); | 
				
			|||
                if (departmentRes.dependence) { | 
				
			|||
                    if (departmentRes.type = 2) { | 
				
			|||
                        //区县人员只能看见自己区县下的报表信息
 | 
				
			|||
                        whereCondition.regionId = departmentRes.id; | 
				
			|||
                    } else { | 
				
			|||
                        //其它层级无报表信息
 | 
				
			|||
                        ctx.status = 200; | 
				
			|||
                        ctx.body = { | 
				
			|||
                            "count": 0, | 
				
			|||
                            "rows": [] | 
				
			|||
                        }; | 
				
			|||
                        return; | 
				
			|||
                    } | 
				
			|||
                } | 
				
			|||
                if (regionId) { | 
				
			|||
                    let region = await models.Department.findOne({ where: { id: regionId } }); | 
				
			|||
                    if (region) { | 
				
			|||
                        if (whereCondition.regionId && whereCondition.regionId != regionId) { | 
				
			|||
                            //区县人员只能看见自己区县下的报表信息
 | 
				
			|||
                            ctx.status = 200; | 
				
			|||
                            ctx.body = { | 
				
			|||
                                "count": 0, | 
				
			|||
                                "rows": [] | 
				
			|||
                            }; | 
				
			|||
                            return; | 
				
			|||
                        } else { | 
				
			|||
                            whereCondition.regionId = regionId; | 
				
			|||
                        } | 
				
			|||
                    } else { | 
				
			|||
                        ctx.status = 400; | 
				
			|||
                        ctx.body = { "message": "区域不存在!" } | 
				
			|||
                        return; | 
				
			|||
                    } | 
				
			|||
                } | 
				
			|||
                let times = timeRange; | 
				
			|||
                if (timeRange && timeRange.indexOf(',')) { times = timeRange.split(',') } | 
				
			|||
                if (times && times.length > 0) { | 
				
			|||
                    const len = times.length; | 
				
			|||
                    whereCondition.dateTime = { | 
				
			|||
                        $between: [ | 
				
			|||
                            moment(times[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'), | 
				
			|||
                            moment(times[len - 1]).endOf('day').format('YYYY-MM-DD HH:mm:ss') | 
				
			|||
                        ] | 
				
			|||
                    }; | 
				
			|||
                } | 
				
			|||
                switch (Number(state)) { | 
				
			|||
                    case 1: //待审批:无审核人员
 | 
				
			|||
                        whereCondition.userId = null; | 
				
			|||
                        break; | 
				
			|||
                    case 2://已审批:有审核人员
 | 
				
			|||
                        whereCondition.userId = { $not: null }; | 
				
			|||
                        break; | 
				
			|||
                    default: break; | 
				
			|||
                } | 
				
			|||
                let findObj = { | 
				
			|||
                    where: whereCondition, | 
				
			|||
                    order: [["id", "desc"]], | 
				
			|||
                    include: [{ | 
				
			|||
                        model: models.User, | 
				
			|||
                        attributes: ['name', 'username', 'phone'] | 
				
			|||
                    }, { | 
				
			|||
                        model: models.Department, | 
				
			|||
                        attributes: ['id', 'name'] | 
				
			|||
                    }] | 
				
			|||
                }; | 
				
			|||
                if (Number(pageSize) > 0 && Number(pageIndex) >= 0) { | 
				
			|||
                    findObj.limit = Number(pageSize); | 
				
			|||
                    findObj.offset = Number(pageIndex) * Number(pageSize); | 
				
			|||
                } | 
				
			|||
                switch (Number(reportType)) { | 
				
			|||
                    case 1: //整治汇总表
 | 
				
			|||
                        ctx.body = await models.ReportRectify.findAndCountAll(findObj); | 
				
			|||
                        break; | 
				
			|||
                    case 2://每日汇总表
 | 
				
			|||
                        ctx.body = await models.ReportCollection.findAndCountAll(findObj); | 
				
			|||
                        break; | 
				
			|||
                    default: //整治汇总表+每日汇总表
 | 
				
			|||
                        const rectifies = await models.ReportRectify.findAndCountAll(findObj); | 
				
			|||
                        const collections = await models.ReportCollection.findAndCountAll(findObj); | 
				
			|||
                        ctx.body = { | 
				
			|||
                            "totalCount": rectifies.count + collections.count, | 
				
			|||
                            "totalRows": { | 
				
			|||
                                "rectify": rectifies, | 
				
			|||
                                "collection": collections | 
				
			|||
                            } | 
				
			|||
                        }; | 
				
			|||
                        break; | 
				
			|||
                } | 
				
			|||
                ctx.status = 200; | 
				
			|||
            } else { | 
				
			|||
                ctx.status = 400; | 
				
			|||
                ctx.body = { "message": "用户不存在!" } | 
				
			|||
            } | 
				
			|||
        } else { | 
				
			|||
            ctx.status = 400; | 
				
			|||
            ctx.body = { "message": "请传用户参数!" } | 
				
			|||
        } | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { "message": "获取审批报表信息失败" } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 上报排查整治汇总表 | 
				
			|||
 * query{ | 
				
			|||
 * userId:1,//上报用户
 | 
				
			|||
 * } | 
				
			|||
 * body { | 
				
			|||
 * governDetailIds:'1,2' //排查整治汇总返回数据id字符串
 | 
				
			|||
 * }  | 
				
			|||
 */ | 
				
			|||
async function operateGovernReport(ctx, next) { | 
				
			|||
    try { | 
				
			|||
        let { userId } = ctx.params; | 
				
			|||
        const data = ctx.request.body; | 
				
			|||
        const models = ctx.fs.dc.models; | 
				
			|||
        if (data.governDetailIds && data.governDetailIds.length > 0) { | 
				
			|||
            await models.ReportRectify.update({ | 
				
			|||
                userId: userId | 
				
			|||
            }, { where: { id: { $in: data.governDetailIds.split(',') } } }); | 
				
			|||
 | 
				
			|||
            ctx.body = { "message": "上报排查整治汇总表成功" }; | 
				
			|||
            ctx.status = 200; | 
				
			|||
        } else { | 
				
			|||
            ctx.body = { "message": "上报排查整治汇总表参数有误" }; | 
				
			|||
            ctx.status = 400; | 
				
			|||
        } | 
				
			|||
    } catch (error) { | 
				
			|||
        ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); | 
				
			|||
        ctx.status = 400; | 
				
			|||
        ctx.body = { "message": "上报排查整治汇总表失败" } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
module.exports = { | 
				
			|||
    getDayReport, | 
				
			|||
    getGovern, | 
				
			|||
    getGovernDetail, | 
				
			|||
    operateGovern, | 
				
			|||
    getSecurityRiskList, | 
				
			|||
    getHomeCount, | 
				
			|||
    operateReport, | 
				
			|||
    getApproveReportCollections, | 
				
			|||
    operateGovernReport | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,61 @@ | 
				
			|||
/* eslint-disable*/ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
module.exports = dc => { | 
				
			|||
  const DataTypes = dc.ORM; | 
				
			|||
  const sequelize = dc.orm; | 
				
			|||
  const Places = sequelize.define("places", { | 
				
			|||
    id: { | 
				
			|||
      type: DataTypes.INTEGER, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: true, | 
				
			|||
      field: "id", | 
				
			|||
      autoIncrement: true, | 
				
			|||
      unique: "places_id_uindex" | 
				
			|||
    }, | 
				
			|||
    name: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "场所名称", | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "name", | 
				
			|||
      autoIncrement: false | 
				
			|||
    }, | 
				
			|||
    describe: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: true, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "描述", | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "describe", | 
				
			|||
      autoIncrement: false | 
				
			|||
    }, | 
				
			|||
    userId: { | 
				
			|||
      type: DataTypes.INTEGER, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "userId", | 
				
			|||
      autoIncrement: false, | 
				
			|||
      references: { | 
				
			|||
        key: "id", | 
				
			|||
        model: "user" | 
				
			|||
      } | 
				
			|||
    }, | 
				
			|||
  }, { | 
				
			|||
    tableName: "places", | 
				
			|||
    comment: "", | 
				
			|||
    indexes: [] | 
				
			|||
  }); | 
				
			|||
  dc.models.Places = Places; | 
				
			|||
 | 
				
			|||
  const User = dc.models.User; | 
				
			|||
  Places.belongsTo(User, { foreignKey: 'userId', targetKey: 'id' }); | 
				
			|||
  User.hasMany(Places, { foreignKey: 'userId', sourceKey: 'id' }); | 
				
			|||
 | 
				
			|||
  return Places; | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,47 @@ | 
				
			|||
/* eslint-disable*/ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
module.exports = dc => { | 
				
			|||
  const DataTypes = dc.ORM; | 
				
			|||
  const sequelize = dc.orm; | 
				
			|||
  const Post = sequelize.define("post", { | 
				
			|||
    id: { | 
				
			|||
      type: DataTypes.INTEGER, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: true, | 
				
			|||
      field: "id", | 
				
			|||
      autoIncrement: true, | 
				
			|||
      unique: "post_id_uindex" | 
				
			|||
    }, | 
				
			|||
    name: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "name", | 
				
			|||
      autoIncrement: false | 
				
			|||
    }, | 
				
			|||
    departmentId: { | 
				
			|||
      type: DataTypes.INTEGER, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "department_id", | 
				
			|||
      autoIncrement: false, | 
				
			|||
      references: { | 
				
			|||
        key: "id", | 
				
			|||
        model: "department" | 
				
			|||
      } | 
				
			|||
    } | 
				
			|||
  }, { | 
				
			|||
    tableName: "post", | 
				
			|||
    comment: "", | 
				
			|||
    indexes: [] | 
				
			|||
  }); | 
				
			|||
  dc.models.Post = Post; | 
				
			|||
  return Post; | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,51 @@ | 
				
			|||
/* eslint-disable*/ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
module.exports = dc => { | 
				
			|||
  const DataTypes = dc.ORM; | 
				
			|||
  const sequelize = dc.orm; | 
				
			|||
  const PostResource = sequelize.define("postResource", { | 
				
			|||
    id: { | 
				
			|||
      type: DataTypes.INTEGER, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: true, | 
				
			|||
      field: "id", | 
				
			|||
      autoIncrement: true, | 
				
			|||
      unique: "post_resource_id_uindex" | 
				
			|||
    }, | 
				
			|||
    postId: { | 
				
			|||
      type: DataTypes.INTEGER, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "post_id", | 
				
			|||
      autoIncrement: false, | 
				
			|||
      references: { | 
				
			|||
        key: "id", | 
				
			|||
        model: "post" | 
				
			|||
      } | 
				
			|||
    }, | 
				
			|||
    resource: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "resource", | 
				
			|||
      autoIncrement: false, | 
				
			|||
      references: { | 
				
			|||
        key: "code", | 
				
			|||
        model: "resource" | 
				
			|||
      } | 
				
			|||
    } | 
				
			|||
  }, { | 
				
			|||
    tableName: "post_resource", | 
				
			|||
    comment: "", | 
				
			|||
    indexes: [] | 
				
			|||
  }); | 
				
			|||
  dc.models.PostResource = PostResource; | 
				
			|||
  return PostResource; | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,34 @@ | 
				
			|||
/* eslint-disable*/ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
module.exports = dc => { | 
				
			|||
  const DataTypes = dc.ORM; | 
				
			|||
  const sequelize = dc.orm; | 
				
			|||
  const RegionType = sequelize.define("regionType", { | 
				
			|||
    id: { | 
				
			|||
      type: DataTypes.INTEGER, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: true, | 
				
			|||
      field: "id", | 
				
			|||
      autoIncrement: true, | 
				
			|||
      unique: "region_type_id_uindex" | 
				
			|||
    }, | 
				
			|||
    type: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "type", | 
				
			|||
      autoIncrement: false | 
				
			|||
    } | 
				
			|||
  }, { | 
				
			|||
    tableName: "region_type", | 
				
			|||
    comment: "", | 
				
			|||
    indexes: [] | 
				
			|||
  }); | 
				
			|||
  dc.models.RegionType = RegionType; | 
				
			|||
  return RegionType; | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,88 @@ | 
				
			|||
/* eslint-disable*/ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
module.exports = dc => { | 
				
			|||
    const DataTypes = dc.ORM; | 
				
			|||
    const sequelize = dc.orm; | 
				
			|||
    const ReportCollection = sequelize.define("reportCollection", { | 
				
			|||
        id: { | 
				
			|||
            type: DataTypes.INTEGER, | 
				
			|||
            allowNull: false, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: null, | 
				
			|||
            primaryKey: true, | 
				
			|||
            field: "id", | 
				
			|||
            autoIncrement: true, | 
				
			|||
            unique: "report_collection_id_uindex" | 
				
			|||
        }, | 
				
			|||
        regionId: { | 
				
			|||
            type: DataTypes.INTEGER, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "县区(id)", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "regionId", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        dateTime: { | 
				
			|||
            type: DataTypes.DATE, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: null, | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "dateTime", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        placeCount: { | 
				
			|||
            type: DataTypes.INTEGER, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "场所总数", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "placeCount", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        hiddenDangerCount: { | 
				
			|||
            type: DataTypes.INTEGER, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "排查隐患总数", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "hiddenDangerCount", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        hiddenDangerItem12Count: { | 
				
			|||
            type: DataTypes.JSON, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "排查隐患详细类目  1-12 项  总数", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "hiddenDangerItem12Count", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        userId: { | 
				
			|||
            type: DataTypes.INTEGER, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "填报人(县区联络员)", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "userId", | 
				
			|||
            autoIncrement: false | 
				
			|||
        } | 
				
			|||
    }, { | 
				
			|||
        tableName: "report_collection", | 
				
			|||
        comment: "", | 
				
			|||
        indexes: [] | 
				
			|||
    }); | 
				
			|||
    dc.models.ReportCollection = ReportCollection; | 
				
			|||
 | 
				
			|||
    const User = dc.models.User; | 
				
			|||
    ReportCollection.belongsTo(User, { foreignKey: 'userId', targetKey: 'id' }); | 
				
			|||
    User.hasMany(ReportCollection, { foreignKey: 'userId', sourceKey: 'id' }); | 
				
			|||
 | 
				
			|||
    const Department = dc.models.Department; | 
				
			|||
    ReportCollection.belongsTo(Department, { foreignKey: 'regionId', targetKey: 'id' }); | 
				
			|||
    Department.hasMany(ReportCollection, { foreignKey: 'regionId', sourceKey: 'id' }); | 
				
			|||
 | 
				
			|||
    return ReportCollection; | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,74 @@ | 
				
			|||
/* eslint-disable*/ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
module.exports = dc => { | 
				
			|||
  const DataTypes = dc.ORM; | 
				
			|||
  const sequelize = dc.orm; | 
				
			|||
  const ReportConfigition = sequelize.define("reportConfigition", { | 
				
			|||
    reportName: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: true, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "报表名称", | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "reportName", | 
				
			|||
      autoIncrement: false | 
				
			|||
    }, | 
				
			|||
    regionId: { | 
				
			|||
      type: DataTypes.INTEGER, | 
				
			|||
      allowNull: true, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "区域id", | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "regionId", | 
				
			|||
      autoIncrement: false | 
				
			|||
    }, | 
				
			|||
    reportTypeId: { | 
				
			|||
      type: DataTypes.INTEGER, | 
				
			|||
      allowNull: true, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "报表类型", | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "reportTypeId", | 
				
			|||
      autoIncrement: false, | 
				
			|||
      references: { | 
				
			|||
        key: "id", | 
				
			|||
        model: "reportType" | 
				
			|||
      } | 
				
			|||
    }, | 
				
			|||
    excuteTime: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: true, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "生成时间 cron表达式", | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "excuteTime", | 
				
			|||
      autoIncrement: false | 
				
			|||
    }, | 
				
			|||
    isEnable: { | 
				
			|||
      type: DataTypes.BOOLEAN, | 
				
			|||
      allowNull: true, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "启用状态", | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "isEnable", | 
				
			|||
      autoIncrement: false | 
				
			|||
    }, | 
				
			|||
    id: { | 
				
			|||
      type: DataTypes.INTEGER, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "序号", | 
				
			|||
      primaryKey: true, | 
				
			|||
      field: "id", | 
				
			|||
      autoIncrement: true, | 
				
			|||
      unique: "report_configition_id_uindex" | 
				
			|||
    } | 
				
			|||
  }, { | 
				
			|||
    tableName: "report_configition", | 
				
			|||
    comment: "", | 
				
			|||
    indexes: [] | 
				
			|||
  }); | 
				
			|||
  dc.models.ReportConfigition = ReportConfigition; | 
				
			|||
  return ReportConfigition; | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,69 @@ | 
				
			|||
/* eslint-disable*/ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
module.exports = dc => { | 
				
			|||
  const DataTypes = dc.ORM; | 
				
			|||
  const sequelize = dc.orm; | 
				
			|||
  const ReportCountyCollect = sequelize.define("reportCountyCollect", { | 
				
			|||
    id: { | 
				
			|||
      type: DataTypes.BIGINT, | 
				
			|||
      allowNull: true, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "序号", | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "id", | 
				
			|||
      autoIncrement: false | 
				
			|||
    }, | 
				
			|||
    name: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: true, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "名称", | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "name", | 
				
			|||
      autoIncrement: false | 
				
			|||
    }, | 
				
			|||
    address: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: true, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "地址", | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "address", | 
				
			|||
      autoIncrement: false | 
				
			|||
    }, | 
				
			|||
    hiddenDanger: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: true, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "排查发现隐患", | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "hiddenDanger", | 
				
			|||
      autoIncrement: false | 
				
			|||
    }, | 
				
			|||
    correctiveAction: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: true, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "采取措施", | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "correctiveAction", | 
				
			|||
      autoIncrement: false | 
				
			|||
    }, | 
				
			|||
    punishment: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: true, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "实施处罚,强制措施情况", | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "punishment", | 
				
			|||
      autoIncrement: false | 
				
			|||
    } | 
				
			|||
  }, { | 
				
			|||
    tableName: "report_countyCollect", | 
				
			|||
    comment: "", | 
				
			|||
    indexes: [] | 
				
			|||
  }); | 
				
			|||
  dc.models.ReportCountyCollect = ReportCountyCollect; | 
				
			|||
  return ReportCountyCollect; | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,82 @@ | 
				
			|||
/* eslint-disable*/ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
module.exports = dc => { | 
				
			|||
  const DataTypes = dc.ORM; | 
				
			|||
  const sequelize = dc.orm; | 
				
			|||
  const ReportDownManage = sequelize.define("reportDownManage", { | 
				
			|||
    id: { | 
				
			|||
      type: DataTypes.INTEGER, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: "nextval(\"report_downManage_id_seq\"::regclass)", | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: true, | 
				
			|||
      field: "id", | 
				
			|||
      autoIncrement: false, | 
				
			|||
      unique: "report_downmanage_id_uindex" | 
				
			|||
    }, | 
				
			|||
    reportName: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "报表名称", | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "reportName", | 
				
			|||
      autoIncrement: false | 
				
			|||
    }, | 
				
			|||
    regionId: { | 
				
			|||
      type: DataTypes.INTEGER, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "区域id", | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "regionId", | 
				
			|||
      autoIncrement: false, | 
				
			|||
      references: { | 
				
			|||
        key: "id", | 
				
			|||
        model: "department" | 
				
			|||
      } | 
				
			|||
    }, | 
				
			|||
    reportTypeId: { | 
				
			|||
      type: DataTypes.INTEGER, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "报表类型id\n1.整治表\n2.汇总表", | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "reportTypeId", | 
				
			|||
      autoIncrement: false, | 
				
			|||
      references: { | 
				
			|||
        key: "id", | 
				
			|||
        model: "reportType" | 
				
			|||
      } | 
				
			|||
    }, | 
				
			|||
    filePath: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: "文件路径", | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "filePath", | 
				
			|||
      autoIncrement: false, | 
				
			|||
    }, | 
				
			|||
    creatTime: { | 
				
			|||
      type: DataTypes.DATE, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "creatTime", | 
				
			|||
      autoIncrement: false | 
				
			|||
    } | 
				
			|||
  }, { | 
				
			|||
    tableName: "report_downManage", | 
				
			|||
    comment: "", | 
				
			|||
    indexes: [] | 
				
			|||
  }); | 
				
			|||
  dc.models.ReportDownManage = ReportDownManage; | 
				
			|||
 | 
				
			|||
  const { ReportType, Department } = dc.models; | 
				
			|||
  ReportDownManage.belongsTo(ReportType, { foreignKey: 'reportTypeId', targetKey: 'id' }); | 
				
			|||
  ReportDownManage.belongsTo(Department, { foreignKey: 'regionId', targetKey: 'id' }); | 
				
			|||
  return ReportDownManage; | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,115 @@ | 
				
			|||
/* eslint-disable*/ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
module.exports = dc => { | 
				
			|||
    const DataTypes = dc.ORM; | 
				
			|||
    const sequelize = dc.orm; | 
				
			|||
    const ReportRectify = sequelize.define("reportRectify", { | 
				
			|||
        id: { | 
				
			|||
            type: DataTypes.BIGINT, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: "nextval(\"report_countyCollect_id_seq\"::regclass)", | 
				
			|||
            comment: "序号", | 
				
			|||
            primaryKey: true, | 
				
			|||
            field: "id", | 
				
			|||
            autoIncrement: false, | 
				
			|||
            unique: "report_countycollect_id_uindex" | 
				
			|||
        }, | 
				
			|||
        regionId: { | 
				
			|||
            type: DataTypes.INTEGER, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "县区(id)", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "regionId", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        dateTime: { | 
				
			|||
            type: DataTypes.DATE, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: null, | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "dateTime", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        name: { | 
				
			|||
            type: DataTypes.STRING, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "名称", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "name", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        address: { | 
				
			|||
            type: DataTypes.STRING, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "地址", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "address", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        hiddenDanger: { | 
				
			|||
            type: DataTypes.STRING, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "排查发现隐患", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "hiddenDanger", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        correctiveAction: { | 
				
			|||
            type: DataTypes.STRING, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "采取措施", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "correctiveAction", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        punishment: { | 
				
			|||
            type: DataTypes.STRING, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "实施处罚,强制措施情况", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "punishment", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        userId: { | 
				
			|||
            type: DataTypes.INTEGER, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "web端上报", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "userId", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        isAudit: { | 
				
			|||
            type: DataTypes.BOOLEAN, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "市级 确认审核", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "isAudit", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
    }, { | 
				
			|||
        tableName: "report_rectify", | 
				
			|||
        comment: "", | 
				
			|||
        indexes: [] | 
				
			|||
    }); | 
				
			|||
    dc.models.ReportRectify = ReportRectify; | 
				
			|||
 | 
				
			|||
    const User = dc.models.User; | 
				
			|||
    ReportRectify.belongsTo(User, { foreignKey: 'userId', targetKey: 'id' }); | 
				
			|||
    User.hasMany(ReportRectify, { foreignKey: 'userId', sourceKey: 'id' }); | 
				
			|||
 | 
				
			|||
    const Department = dc.models.Department; | 
				
			|||
    ReportRectify.belongsTo(Department, { foreignKey: 'regionId', targetKey: 'id' }); | 
				
			|||
    Department.hasMany(ReportRectify, { foreignKey: 'regionId', sourceKey: 'id' }); | 
				
			|||
 | 
				
			|||
    return ReportRectify; | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,33 @@ | 
				
			|||
/* eslint-disable*/ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
module.exports = dc => { | 
				
			|||
  const DataTypes = dc.ORM; | 
				
			|||
  const sequelize = dc.orm; | 
				
			|||
  const ReportType = sequelize.define("reportType", { | 
				
			|||
    id: { | 
				
			|||
      type: DataTypes.INTEGER, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: true, | 
				
			|||
      field: "id", | 
				
			|||
      autoIncrement: false | 
				
			|||
    }, | 
				
			|||
    name: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: true, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "name", | 
				
			|||
      autoIncrement: false | 
				
			|||
    } | 
				
			|||
  }, { | 
				
			|||
    tableName: "report_type", | 
				
			|||
    comment: "", | 
				
			|||
    indexes: [] | 
				
			|||
  }); | 
				
			|||
  dc.models.ReportType = ReportType; | 
				
			|||
  return ReportType; | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,44 @@ | 
				
			|||
/* eslint-disable*/ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
module.exports = dc => { | 
				
			|||
  const DataTypes = dc.ORM; | 
				
			|||
  const sequelize = dc.orm; | 
				
			|||
  const Resource = sequelize.define("resource", { | 
				
			|||
    code: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: true, | 
				
			|||
      field: "code", | 
				
			|||
      autoIncrement: false, | 
				
			|||
      unique: "resource_code_uindex" | 
				
			|||
    }, | 
				
			|||
    name: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "name", | 
				
			|||
      autoIncrement: false, | 
				
			|||
      unique: "resource_name_uindex" | 
				
			|||
    }, | 
				
			|||
    parentResource: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: true, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "parent_resource", | 
				
			|||
      autoIncrement: false | 
				
			|||
    } | 
				
			|||
  }, { | 
				
			|||
    tableName: "resource", | 
				
			|||
    comment: "", | 
				
			|||
    indexes: [] | 
				
			|||
  }); | 
				
			|||
  dc.models.Resource = Resource; | 
				
			|||
  return Resource; | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,311 @@ | 
				
			|||
/* eslint-disable*/ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
module.exports = dc => { | 
				
			|||
    const DataTypes = dc.ORM; | 
				
			|||
    const sequelize = dc.orm; | 
				
			|||
    const UserPlaceSecurityRecord = sequelize.define("userPlaceSecurityRecord", { | 
				
			|||
        id: { | 
				
			|||
            type: DataTypes.BIGINT, | 
				
			|||
            allowNull: false, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "id", | 
				
			|||
            primaryKey: true, | 
				
			|||
            field: "id", | 
				
			|||
            autoIncrement: true, | 
				
			|||
            unique: "user_placesecurityrecord_id_uindex" | 
				
			|||
        }, | 
				
			|||
        time: { | 
				
			|||
            type: DataTypes.DATE, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "录入时间", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "time", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        placeId: { | 
				
			|||
            type: DataTypes.INTEGER, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "场所id", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "placeId", | 
				
			|||
            autoIncrement: false, | 
				
			|||
            references: { | 
				
			|||
                key: "id", | 
				
			|||
                model: "places" | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
        hiddenDangerItem12: { | 
				
			|||
            type: DataTypes.JSON, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "12项隐患信息", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "hiddenDangerItem12", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        description: { | 
				
			|||
            type: DataTypes.STRING, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "存在具体问题描述", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "description", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        audit1ManId: { | 
				
			|||
            type: DataTypes.INTEGER, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "乡镇人审核", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "audit1ManId", | 
				
			|||
            autoIncrement: false, | 
				
			|||
            references: { | 
				
			|||
                key: "id", | 
				
			|||
                model: "user" | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
        audit2ManId: { | 
				
			|||
            type: DataTypes.INTEGER, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "区县人复核", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "audit2ManId", | 
				
			|||
            autoIncrement: false, | 
				
			|||
            references: { | 
				
			|||
                key: "id", | 
				
			|||
                model: "user" | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
        regionId: { | 
				
			|||
            type: DataTypes.INTEGER, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "所属县/区", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "regionId", | 
				
			|||
            autoIncrement: false, | 
				
			|||
            references: { | 
				
			|||
                key: "id", | 
				
			|||
                model: "department" | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
        userId: { | 
				
			|||
            type: DataTypes.BIGINT, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "用户id,填报人", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "userId", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        placeType: { | 
				
			|||
            type: DataTypes.STRING, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "场所性质", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "placeType", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        address: { | 
				
			|||
            type: DataTypes.STRING, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "场所地址", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "address", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        phone: { | 
				
			|||
            type: DataTypes.STRING, | 
				
			|||
            allowNull: false, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "负责人手机号", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "phone", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        dimension: { | 
				
			|||
            type: DataTypes.REAL, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "面积", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "dimension", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        floors: { | 
				
			|||
            type: DataTypes.INTEGER, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "多少层", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "floors", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        numberOfPeople: { | 
				
			|||
            type: DataTypes.INTEGER, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "常住人数", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "numberOfPeople", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        location: { | 
				
			|||
            type: DataTypes.STRING, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "经纬度", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "location", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        isEnable: { | 
				
			|||
            type: DataTypes.BOOLEAN, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "是否为合用场所", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "isEnable", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        rejectManId: { | 
				
			|||
            type: DataTypes.INTEGER, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "驳回人", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "rejectManId", | 
				
			|||
            autoIncrement: false, | 
				
			|||
            references: { | 
				
			|||
                key: "id", | 
				
			|||
                model: "user" | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
        rejectReasons: { | 
				
			|||
            type: DataTypes.STRING, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "驳回意见", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "rejectReasons", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        isDraft: { | 
				
			|||
            type: DataTypes.BOOLEAN, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "是否草稿", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "isDraft", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        placeOwner: { | 
				
			|||
            type: DataTypes.STRING, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "场所负责人", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "placeOwner", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        localtionDescribe: { | 
				
			|||
            type: DataTypes.STRING, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "经纬度定位描述", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "localtionDescribe", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        correctiveAction: { | 
				
			|||
            type: DataTypes.STRING, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "采取措施", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "correctiveAction", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        type: { | 
				
			|||
            type: DataTypes.BOOLEAN, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "是否重新发起", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "type", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        punishment: { | 
				
			|||
            type: DataTypes.STRING, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "实施处罚,强制措施情况", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "punishment", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        audit1ManIdTime: { | 
				
			|||
            type: DataTypes.DATE, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "乡镇人审核时间", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "audit1ManIdTime", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        audit2ManIdTime: { | 
				
			|||
            type: DataTypes.DATE, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "区县人复核时间", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "audit2ManIdTime", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        rejectTime: { | 
				
			|||
            type: DataTypes.DATE, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            comment: "驳回日期", | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "rejectTime", | 
				
			|||
            autoIncrement: false | 
				
			|||
        }, | 
				
			|||
        departmentId: { | 
				
			|||
            type: DataTypes.INTEGER, | 
				
			|||
            allowNull: true, | 
				
			|||
            defaultValue: null, | 
				
			|||
            primaryKey: false, | 
				
			|||
            field: "department_id", | 
				
			|||
            autoIncrement: false, | 
				
			|||
        }, | 
				
			|||
    }, { | 
				
			|||
        tableName: "user_placeSecurityRecord", | 
				
			|||
        comment: "", | 
				
			|||
        indexes: [] | 
				
			|||
    }); | 
				
			|||
    dc.models.UserPlaceSecurityRecord = UserPlaceSecurityRecord; | 
				
			|||
 | 
				
			|||
    const Places = dc.models.Places; | 
				
			|||
    UserPlaceSecurityRecord.belongsTo(Places, { foreignKey: 'placeId', targetKey: 'id' }); | 
				
			|||
    Places.hasMany(UserPlaceSecurityRecord, { foreignKey: 'placeId', sourceKey: 'id' }); | 
				
			|||
 | 
				
			|||
    const User = dc.models.User; | 
				
			|||
    UserPlaceSecurityRecord.belongsTo(User, { as: 'user', foreignKey: 'userId', targetKey: 'id' }); | 
				
			|||
    User.hasMany(UserPlaceSecurityRecord, { foreignKey: 'userId', sourceKey: 'id' }); | 
				
			|||
 | 
				
			|||
    UserPlaceSecurityRecord.belongsTo(User, { as: 'audit1ManUser', foreignKey: 'audit1ManId', targetKey: 'id' }); | 
				
			|||
 | 
				
			|||
    UserPlaceSecurityRecord.belongsTo(User, { as: 'audit2ManUser', foreignKey: 'audit2ManId', targetKey: 'id' }); | 
				
			|||
 | 
				
			|||
    UserPlaceSecurityRecord.belongsTo(User, { as: 'rejectManUser', foreignKey: 'rejectManId', targetKey: 'id' }); | 
				
			|||
 | 
				
			|||
    return UserPlaceSecurityRecord; | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,61 @@ | 
				
			|||
/* eslint-disable*/ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
module.exports = dc => { | 
				
			|||
  const DataTypes = dc.ORM; | 
				
			|||
  const sequelize = dc.orm; | 
				
			|||
  const UserResource = sequelize.define("userResource", { | 
				
			|||
    id: { | 
				
			|||
      type: DataTypes.INTEGER, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: true, | 
				
			|||
      field: "id", | 
				
			|||
      autoIncrement: true, | 
				
			|||
      unique: "post_resource_id_uindex" | 
				
			|||
    }, | 
				
			|||
    userId: { | 
				
			|||
      type: DataTypes.INTEGER, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "user_id", | 
				
			|||
      autoIncrement: false, | 
				
			|||
      references: { | 
				
			|||
        key: "id", | 
				
			|||
        model: "post" | 
				
			|||
      } | 
				
			|||
    }, | 
				
			|||
    resourceId: { | 
				
			|||
      type: DataTypes.STRING, | 
				
			|||
      allowNull: false, | 
				
			|||
      defaultValue: null, | 
				
			|||
      comment: null, | 
				
			|||
      primaryKey: false, | 
				
			|||
      field: "resource", | 
				
			|||
      autoIncrement: false, | 
				
			|||
      references: { | 
				
			|||
        key: "code", | 
				
			|||
        model: "resource" | 
				
			|||
      } | 
				
			|||
    } | 
				
			|||
  }, { | 
				
			|||
    tableName: "user_resource", | 
				
			|||
    comment: "", | 
				
			|||
    indexes: [] | 
				
			|||
  }); | 
				
			|||
  dc.models.UserResource = UserResource; | 
				
			|||
 | 
				
			|||
  const User = dc.models.User; | 
				
			|||
  UserResource.belongsTo(User, { foreignKey: 'userId', targetKey: 'id' }); | 
				
			|||
  User.hasMany(UserResource, { foreignKey: 'userId', sourceKey: 'id' }); | 
				
			|||
 | 
				
			|||
  const Resource = dc.models.Resource; | 
				
			|||
  UserResource.belongsTo(Resource, { foreignKey: 'resourceId', targetKey: 'code' }); | 
				
			|||
  Resource.hasMany(UserResource, { foreignKey: 'resourceId', sourceKey: 'code' }); | 
				
			|||
  Resource.hasMany(Resource, { foreignKey: 'parentResource', sourceKey: 'code' }); | 
				
			|||
 | 
				
			|||
  return UserResource; | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,13 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
const Approval = require('../../controllers/approval/index'); | 
				
			|||
 | 
				
			|||
module.exports = function (app, router, opts) { | 
				
			|||
    /** | 
				
			|||
     * @api {POST} approval/submit 提交审批、驳回修改. | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup Approval | 
				
			|||
     */ | 
				
			|||
    app.fs.api.logAttr['GET/approval/submit'] = { content: '提交审批、驳回修改', visible: true }; | 
				
			|||
    router.post('/approval/submit', Approval.submitApproval); | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,9 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
const common = require('../../controllers/common'); | 
				
			|||
 | 
				
			|||
module.exports = function (app, router, opts) { | 
				
			|||
 | 
				
			|||
    router.get('/data-dictionary/:model', common.getDataDictionary); | 
				
			|||
    router.put('/data-dictionary/:model', common.putDataDictionary); | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,13 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
const Department = require('../../controllers/department/index'); | 
				
			|||
 | 
				
			|||
module.exports = function (app, router, opts) { | 
				
			|||
    /** | 
				
			|||
     * @api {GET} counties/list 获取南昌市下所有区县. | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup Department | 
				
			|||
     */ | 
				
			|||
    app.fs.api.logAttr['GET/counties/list'] = { content: '获取南昌市下所有区县', visible: true }; | 
				
			|||
    router.get('/counties/list', Department.getCountiesList); | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,28 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
const Authority = require('../../controllers/organization/authority'); | 
				
			|||
 | 
				
			|||
module.exports = function (app, router, opts) { | 
				
			|||
    /** | 
				
			|||
    * @api {GET} resource 查询所有权限码. | 
				
			|||
    * @apiVersion 1.0.0 | 
				
			|||
    * @apiGroup Org | 
				
			|||
    */ | 
				
			|||
    app.fs.api.logAttr['GET/resource'] = { content: '查询所有权限码', visible: true }; | 
				
			|||
    router.get('resource', Authority.getResource); | 
				
			|||
    /** | 
				
			|||
     * @api {GET} user/resource 查询用户权限. | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup Org | 
				
			|||
     */ | 
				
			|||
    app.fs.api.logAttr['GET/user/resource'] = { content: '查询用户权限', visible: true }; | 
				
			|||
    router.get('user/resource', Authority.getUserResource); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @api {POST} user/resource 更新用户权限. | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup Org | 
				
			|||
     */ | 
				
			|||
    app.fs.api.logAttr['POST/user/resource'] = { content: '更新用户权限', visible: true }; | 
				
			|||
    router.post('user/resource', Authority.updateUserRes); | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,32 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
const user = require('../../controllers/organization/user'); | 
				
			|||
 | 
				
			|||
module.exports = function (app, router, opts) { | 
				
			|||
 | 
				
			|||
    app.fs.api.logAttr['GET/organization/department'] = { content: '获取部门信息', visible: false }; | 
				
			|||
    router.get('/organization/department', user.getDepMessage); | 
				
			|||
 | 
				
			|||
    app.fs.api.logAttr['GET/organization/department/:depId/user'] = { content: '获取部门下用户信息', visible: false }; | 
				
			|||
    router.get('/organization/department/:depId/user', user.getUser); | 
				
			|||
 | 
				
			|||
    app.fs.api.logAttr['POST/organization/department/user'] = { content: '创建部门下用户信息', visible: false }; | 
				
			|||
    router.post('/organization/department/user', user.creatUser); | 
				
			|||
 | 
				
			|||
    app.fs.api.logAttr['PUT/organization/department/user/:id'] = { content: '修改部门下用户信息', visible: false }; | 
				
			|||
    router.put('/organization/department/user/:id', user.updateUser); | 
				
			|||
 | 
				
			|||
    app.fs.api.logAttr['DEL/organization/department/user/:ids'] = { content: '删除部门下用户信息', visible: false }; | 
				
			|||
    router.del('/organization/department/user/:ids', user.deleteUser); | 
				
			|||
 | 
				
			|||
    app.fs.api.logAttr['PUT/organization/department/user/resetPwd/:id'] = { content: '重置用户密码', visible: false }; | 
				
			|||
    router.put('/organization/department/user/resetPwd/:id', user.resetPwd); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @api {PUT} user/password/:id 修改用户密码 | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup Organization | 
				
			|||
     */ | 
				
			|||
    app.fs.api.logAttr['PUT/user/password/:userId'] = { content: '修改用户密码', visible: false }; | 
				
			|||
    router.put('/user/password/:userId', user.updateUserPassword); | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,70 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
const placeSecurityRecord = require('../../controllers/placeSecurityRecord'); | 
				
			|||
 | 
				
			|||
module.exports = function (app, router, opts) { | 
				
			|||
    /** | 
				
			|||
     * @api {POST} /add/placeSecurityRecord 提交填报信息/保存填报草稿. | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup placeSecurityRecord | 
				
			|||
     */ | 
				
			|||
    app.fs.api.logAttr['POST/add/placeSecurityRecord'] = { content: '提交填报信息/保存填报草稿', visible: true }; | 
				
			|||
    router.post('/add/placeSecurityRecord', placeSecurityRecord.addPlaceSecurityRecord); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @api {PUT} /placeSecurityRecord/:id 编辑填报信息. | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup placeSecurityRecord | 
				
			|||
     */ | 
				
			|||
    app.fs.api.logAttr['PUT/placeSecurityRecord/:id'] = { content: '编辑填报信息', visible: true }; | 
				
			|||
    router.put('/placeSecurityRecord/:id', placeSecurityRecord.editPlaceSecurityRecord); | 
				
			|||
 | 
				
			|||
     /** | 
				
			|||
     * @api {PUT} /placeSecurityRecord/:id 修改type字段 | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup placeSecurityRecord | 
				
			|||
     */ | 
				
			|||
      app.fs.api.logAttr['PUT/updateType/:id'] = { content: '修改type字段', visible: true }; | 
				
			|||
      router.put('/updateType/:id', placeSecurityRecord.updateType); | 
				
			|||
     | 
				
			|||
    /** | 
				
			|||
     * @api {DELETE} /placeSecurityRecord/:id 删除填报信息. | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup placeSecurityRecord | 
				
			|||
     */ | 
				
			|||
    app.fs.api.logAttr['DELETE/placeSecurityRecord/:id'] = { content: '删除填报信息', visible: true }; | 
				
			|||
    router.del('/placeSecurityRecord/:id', placeSecurityRecord.deletePlaceSecurityRecord); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @api {GET} /placeSecurityRecord/:id 根据填报信息ID查询填报信息. | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup placeSecurityRecord | 
				
			|||
     */ | 
				
			|||
    app.fs.api.logAttr['GET/placeSecurityRecord/:id'] = { content: '根据填报信息ID查询填报信息', visible: true }; | 
				
			|||
    router.get('/placeSecurityRecord/:id', placeSecurityRecord.getPlaceSecurityRecordById); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @api {GET} /recently/placeSecurityRecord/:placeId 根据场所ID获取该场所最近用户填报信息. | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup placeSecurityRecord | 
				
			|||
    */ | 
				
			|||
    app.fs.api.logAttr['GET/recently/placeSecurityRecord/:placeId'] = { content: '根据场所ID获取该场所最近用户填报信息', visible: true }; | 
				
			|||
    router.get('/recently/placeSecurityRecord/:placeId', placeSecurityRecord.getRecentlyPlaceSecurityRecordByPlaceId); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @api {GET} /placeSecurityRecords 根据筛选条件获取用户填报信息. | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup placeSecurityRecord | 
				
			|||
    */ | 
				
			|||
    app.fs.api.logAttr['GET/placeSecurityRecords'] = { content: '根据筛选条件获取用户填报信息', visible: true }; | 
				
			|||
    router.get('/placeSecurityRecords', placeSecurityRecord.getPlaceSecurityRecords); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @api {GET} /approve/placeSecurityRecords 根据筛选条件获取用户审批填报信息. | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup placeSecurityRecord | 
				
			|||
    */ | 
				
			|||
    app.fs.api.logAttr['GET/approve/placeSecurityRecords'] = { content: '根据筛选条件获取用户审批填报信息', visible: true }; | 
				
			|||
    router.get('/approve/placeSecurityRecords', placeSecurityRecord.getApprovePlaceSecurityRecords); | 
				
			|||
 | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,30 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
const places = require('../../controllers/places'); | 
				
			|||
 | 
				
			|||
module.exports = function (app, router, opts) { | 
				
			|||
    /** | 
				
			|||
     * @api {GET} /user/places/:userId 根据用户ID获取该用户创建的所有场所信息. | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup places | 
				
			|||
     */ | 
				
			|||
    app.fs.api.logAttr['GET/user/places/:userId'] = { content: '根据用户ID获取该用户创建的所有场所信息', visible: true }; | 
				
			|||
    router.get('/user/places/:userId', places.getPlacesByUserId); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @api {GET} /approveUser/places/:approveUserId 根据审批用户ID获取该审批用户范围内填报人创建的场所信息. | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup places | 
				
			|||
     */ | 
				
			|||
    app.fs.api.logAttr['GET/approveUser/places/:approveUserId'] = { content: '根据审批用户ID获取该审批用户范围内填报人创建的场所信息', visible: true }; | 
				
			|||
    router.get('/approveUser/places/:approveUserId', places.getPlacesByApproveUserId); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @api {GET} /all/places 获取所有场所信息. | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup places | 
				
			|||
     */ | 
				
			|||
    app.fs.api.logAttr['GET/all/places'] = { content: '获取所有场所信息', visible: true }; | 
				
			|||
    router.get('/all/places', places.getAllPlaces); | 
				
			|||
 | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,41 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
const report = require('../../controllers/report'); | 
				
			|||
const reportConfig = require('../../controllers/report/config') | 
				
			|||
const reportRectify = require('../../controllers/report/compile') | 
				
			|||
 | 
				
			|||
module.exports = function (app, router, opts) { | 
				
			|||
    /** | 
				
			|||
     * @api {GET} report 报表. | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup report | 
				
			|||
     */ | 
				
			|||
    app.fs.api.logAttr['GET/report/list'] = { content: '报表下载列表', visible: true }; | 
				
			|||
    router.get('/report/list', report.getReportList); | 
				
			|||
 | 
				
			|||
    // 报表配置
 | 
				
			|||
    app.fs.api.logAttr['GET/allAreas'] = { content: '获取全部区域', visible: true }; | 
				
			|||
    router.get('/allAreas', reportConfig.getAreas); | 
				
			|||
 | 
				
			|||
    app.fs.api.logAttr['POST/report/config'] = { content: '添加报表配置', visible: true }; | 
				
			|||
    router.post('/report/config', reportConfig.addReportConfig); | 
				
			|||
 | 
				
			|||
    app.fs.api.logAttr['GET/report/config'] = { content: '获取报表配置', visible: true }; | 
				
			|||
    router.get('/report/config', reportConfig.getReportConfig); | 
				
			|||
 | 
				
			|||
    app.fs.api.logAttr['PUT/report/:reportId/config'] = { content: '编辑报表配置', visible: true }; | 
				
			|||
    router.put('/report/:reportId/config', reportConfig.editReportConfig); | 
				
			|||
 | 
				
			|||
    app.fs.api.logAttr['DEL/report/:reportId/config'] = { content: '删除报表配置', visible: true }; | 
				
			|||
    router.del('/report/:reportId/config', reportConfig.delReportConfig); | 
				
			|||
 | 
				
			|||
    // 报表编辑
 | 
				
			|||
    app.fs.api.logAttr['GET/report/rectify'] = { content: '获取合用场所安全隐患排查整治汇总表', visible: true }; | 
				
			|||
    router.get('/report/rectify', reportRectify.getReportRectify); | 
				
			|||
 | 
				
			|||
    app.fs.api.logAttr['GET/report/rectify/detail'] = { content: '获取合用场所安全隐患排查整治汇总表详情', visible: true }; | 
				
			|||
    router.get('/report/rectify/detail', reportRectify.getReportRectifyDetail); | 
				
			|||
 | 
				
			|||
    app.fs.api.logAttr['POST/report/rectify/detail'] = { content: '保存合用场所安全隐患排查整治汇总表编辑信息', visible: true }; | 
				
			|||
    router.post('/report/rectify/detail', reportRectify.compileReportRectifyDetail); | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,28 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
const statistic = require('../../controllers/statistic') | 
				
			|||
module.exports = function (app, router, opts) { | 
				
			|||
    /** | 
				
			|||
    * @api {GET} getGovern 获取数据中台. | 
				
			|||
    * @apiVersion 1.0.0 | 
				
			|||
    * @apiGroup wxReport | 
				
			|||
    */ | 
				
			|||
    app.fs.api.logAttr['GET/daily/report/data/statistic'] = { content: '获取数据中台', visible: true }; | 
				
			|||
    router.get('/daily/report/data/statistic', statistic.reportDailyStatistic); | 
				
			|||
    /** | 
				
			|||
* @api {GET} getGovern 获取数据中台地区填报数量. | 
				
			|||
* @apiVersion 1.0.0 | 
				
			|||
* @apiGroup wxReport | 
				
			|||
*/ | 
				
			|||
    app.fs.api.logAttr['GET/daily/report/area/statistic'] = { content: '获取数据中台地区填报数量', visible: true }; | 
				
			|||
    router.get('/daily/report/area/statistic', statistic.reportAreaStatistic); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
    * @api {GET} getGovern 获取填报管理数据. | 
				
			|||
    * @apiVersion 1.0.0 | 
				
			|||
    * @apiGroup wxReport | 
				
			|||
    */ | 
				
			|||
    app.fs.api.logAttr['GET/report/management/statistic'] = { content: '获取填报管理数据', visible: true }; | 
				
			|||
    router.get('/report/management/statistic', statistic.dangerAreaQuery); | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,78 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
const wxReport = require('../../controllers/wxReport/index'); | 
				
			|||
module.exports = function (app, router, opts) { | 
				
			|||
    /*******************首页-市级***************************/ | 
				
			|||
    /** | 
				
			|||
     * @api {GET} getDayReport 获取每日汇总. | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup wxReport | 
				
			|||
     */ | 
				
			|||
    app.fs.api.logAttr['GET/getDayReport'] = { content: '获取每日汇总', visible: true }; | 
				
			|||
    router.get('/getDayReport', wxReport.getDayReport); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
    * @api {GET} getGovern 获取排查整治汇总. | 
				
			|||
    * @apiVersion 1.0.0 | 
				
			|||
    * @apiGroup wxReport | 
				
			|||
    */ | 
				
			|||
    app.fs.api.logAttr['GET/getGovern'] = { content: '获取排查整治汇总', visible: true }; | 
				
			|||
    router.get('/getGovern', wxReport.getGovern); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
    * @api {GET} getGovernDetail 获取排查整治汇总详情. | 
				
			|||
    * @apiVersion 1.0.0 | 
				
			|||
    * @apiGroup wxReport | 
				
			|||
    */ | 
				
			|||
    app.fs.api.logAttr['GET/getGovernDetail'] = { content: '获取排查整治汇总详情', visible: true }; | 
				
			|||
    router.get('/getGovernDetail', wxReport.getGovernDetail); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
   * @api {PUT} /operateGovern 确认整治汇总场所数据. | 
				
			|||
   * @apiVersion 1.0.0 | 
				
			|||
   * @apiGroup wxReport | 
				
			|||
   */ | 
				
			|||
    app.fs.api.logAttr['PUT/operateGovern'] = { content: '确认整治汇总场所数据', visible: true }; | 
				
			|||
    router.put('/operateGovern', wxReport.operateGovern); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
    * @api {GET} getSecurityRiskList 获取安全隐患排查详细数据列表. | 
				
			|||
    * @apiVersion 1.0.0 | 
				
			|||
    * @apiGroup wxReport | 
				
			|||
    */ | 
				
			|||
    app.fs.api.logAttr['GET/getSecurityRiskList'] = { content: '获取安全隐患排查详细数据列表', visible: true }; | 
				
			|||
    router.get('/getSecurityRiskList', wxReport.getSecurityRiskList); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
   * @api {GET} /getHomeCount/:userId/:departmentId/:userRegionType 获取待处理数量. | 
				
			|||
   * @apiVersion 1.0.0 | 
				
			|||
   * @apiGroup wxReport | 
				
			|||
   */ | 
				
			|||
    app.fs.api.logAttr['GET/getHomeCount/:userId/:departmentId/:userRegionType'] = { content: '获取待处理数量', visible: true }; | 
				
			|||
    router.get('/getHomeCount/:userId/:departmentId/:userRegionType', wxReport.getHomeCount); | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
   * @api {PUT} /operateReport/:id/:userId 每日汇总表上报. | 
				
			|||
   * @apiVersion 1.0.0 | 
				
			|||
   * @apiGroup wxReport | 
				
			|||
   */ | 
				
			|||
    app.fs.api.logAttr['PUT/operateReport/:id/:userId'] = { content: '每日汇总表上报', visible: true }; | 
				
			|||
    router.put('/operateReport/:id/:userId', wxReport.operateReport); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @api {GET} /approve/reportCollections 根据筛选条件获取用户审核报表信息. | 
				
			|||
     * @apiVersion 1.0.0 | 
				
			|||
     * @apiGroup wxReport | 
				
			|||
    */ | 
				
			|||
    app.fs.api.logAttr['GET/approve/reportCollections'] = { content: '根据筛选条件获取用户审核报表信息', visible: true }; | 
				
			|||
    router.get('/approve/reportCollections', wxReport.getApproveReportCollections); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
   * @api {PUT} /operateGovernReport/:userId 上报排查整治汇总表. | 
				
			|||
   * @apiVersion 1.0.0 | 
				
			|||
   * @apiGroup wxReport | 
				
			|||
   */ | 
				
			|||
    app.fs.api.logAttr['PUT/operateGovernReport/:userId'] = { content: '上报排查整治汇总表', visible: true }; | 
				
			|||
    router.put('/operateGovernReport/:userId', wxReport.operateGovernReport); | 
				
			|||
} | 
				
			|||
								
									Binary file not shown.
								
							
						
					@ -0,0 +1,4 @@ | 
				
			|||
@font-face { | 
				
			|||
    font-family: YouSheBiaoTiHei; | 
				
			|||
    src: url(./YouSheBiaoTiHei-2.ttf); | 
				
			|||
  } | 
				
			|||
| 
		 After Width: | Height: | Size: 78 KiB  | 
| 
		 After Width: | Height: | Size: 3.6 KiB  | 
| 
		 After Width: | Height: | Size: 27 KiB  | 
| 
		 After Width: | Height: | Size: 12 KiB  | 
| 
		 After Width: | Height: | Size: 12 KiB  | 
@ -1,22 +1,31 @@ | 
				
			|||
<!DOCTYPE html> | 
				
			|||
<html> | 
				
			|||
  <head> | 
				
			|||
    <meta charset="UTF-8" /> | 
				
			|||
    <link rel="shortcut icon" href="/assets/images/favicon.ico" /> | 
				
			|||
    <link rel="stylesheet" href="/assets/fontziti/font.css" /> | 
				
			|||
    <link | 
				
			|||
      rel="stylesheet" | 
				
			|||
      type="text/css" | 
				
			|||
      href="/assets/font_sc/iconfont.css" | 
				
			|||
    /> | 
				
			|||
  </head> | 
				
			|||
 | 
				
			|||
<head> | 
				
			|||
    <meta charset="UTF-8"> | 
				
			|||
    <link rel="shortcut icon" href="/assets/images/favicon.ico"> | 
				
			|||
    <link rel="stylesheet" type="text/css" href="/assets/font_sc/iconfont.css"> | 
				
			|||
</head> | 
				
			|||
  <body style="background: transparent"> | 
				
			|||
    <link | 
				
			|||
      rel="stylesheet/less" | 
				
			|||
      type="text/css" | 
				
			|||
      href="/assets/color.less" | 
				
			|||
      rel="external nofollow" | 
				
			|||
    /> | 
				
			|||
 | 
				
			|||
<body style="background: transparent"> | 
				
			|||
    <link rel="stylesheet/less" type="text/css" href="/assets/color.less" rel="external nofollow" /> | 
				
			|||
    <script> | 
				
			|||
        window.less = { | 
				
			|||
            async: false, | 
				
			|||
            env: 'production' | 
				
			|||
        }; | 
				
			|||
      window.less = { | 
				
			|||
        async: false, | 
				
			|||
        env: "production", | 
				
			|||
      }; | 
				
			|||
    </script> | 
				
			|||
    <script type="text/javascript" src="/assets/js/less/less.min.js"></script> | 
				
			|||
    <div id='App'></div> | 
				
			|||
</body> | 
				
			|||
 | 
				
			|||
</html> | 
				
			|||
    <div id="App"></div> | 
				
			|||
  </body> | 
				
			|||
</html> | 
				
			|||
 | 
				
			|||
@ -1,21 +1,37 @@ | 
				
			|||
<!DOCTYPE html> | 
				
			|||
<html> | 
				
			|||
<head> | 
				
			|||
    <meta charset="UTF-8"> | 
				
			|||
  <head> | 
				
			|||
    <meta charset="UTF-8" /> | 
				
			|||
    <title></title> | 
				
			|||
    <link rel="shortcut icon" href="/assets/images/favicon.ico"> | 
				
			|||
    <link rel="stylesheet" type="text/css" href="/assets/font_sc/iconfont.css"> | 
				
			|||
</head> | 
				
			|||
<body > | 
				
			|||
    <link rel="stylesheet/less" type="text/css" href="/assets/color.less" rel="external nofollow"/> | 
				
			|||
    <link rel="shortcut icon" href="/assets/images/favicon.ico" /> | 
				
			|||
    <link | 
				
			|||
      rel="stylesheet" | 
				
			|||
      type="text/css" | 
				
			|||
      href="/assets/font_sc/iconfont.css" | 
				
			|||
    /> | 
				
			|||
    <link rel="stylesheet" href="/assets/fontziti/font.css" /> | 
				
			|||
  </head> | 
				
			|||
  <body> | 
				
			|||
    <link | 
				
			|||
      rel="stylesheet/less" | 
				
			|||
      type="text/css" | 
				
			|||
      href="/assets/color.less" | 
				
			|||
      rel="external nofollow" | 
				
			|||
    /> | 
				
			|||
    <script> | 
				
			|||
      window.less = { | 
				
			|||
        async: false, | 
				
			|||
        env: 'production' | 
				
			|||
        env: "production", | 
				
			|||
      }; | 
				
			|||
    </script> | 
				
			|||
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/less.js/2.7.2/less.min.js"></script> | 
				
			|||
    <div id='App'></div> | 
				
			|||
    <script type="text/javascript" src="http://localhost:5001/client/build/app.js"></script> | 
				
			|||
</body> | 
				
			|||
</html> | 
				
			|||
    <script | 
				
			|||
      type="text/javascript" | 
				
			|||
      src="https://cdnjs.cloudflare.com/ajax/libs/less.js/2.7.2/less.min.js" | 
				
			|||
    ></script> | 
				
			|||
    <div id="App"></div> | 
				
			|||
    <script | 
				
			|||
      type="text/javascript" | 
				
			|||
      src="http://localhost:5001/client/build/app.js" | 
				
			|||
    ></script> | 
				
			|||
  </body> | 
				
			|||
</html> | 
				
			|||
 | 
				
			|||
@ -0,0 +1,69 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
import { ApiTable } from '$utils' | 
				
			|||
import { Request } from '@peace/utils' | 
				
			|||
 | 
				
			|||
export const INIT_AUTH = 'INIT_AUTH'; | 
				
			|||
export function initAuth() { | 
				
			|||
    const user = JSON.parse(sessionStorage.getItem('user')) || {}; | 
				
			|||
    return { | 
				
			|||
        type: INIT_AUTH, | 
				
			|||
        payload: { | 
				
			|||
            user: user | 
				
			|||
        } | 
				
			|||
    }; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
export const REQUEST_LOGIN = 'REQUEST_LOGIN'; | 
				
			|||
export const LOGIN_SUCCESS = 'LOGIN_SUCCESS'; | 
				
			|||
export const LOGIN_ERROR = 'LOGIN_ERROR'; | 
				
			|||
export function login(username, password) { | 
				
			|||
    return dispatch => { | 
				
			|||
        dispatch({ type: REQUEST_LOGIN }); | 
				
			|||
 | 
				
			|||
        if (!username || !password) { | 
				
			|||
            dispatch({ | 
				
			|||
                type: LOGIN_ERROR, | 
				
			|||
                payload: { error: '请输入账号名和密码' } | 
				
			|||
            }); | 
				
			|||
            return Promise.resolve(); | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        const url = ApiTable.login; | 
				
			|||
        return Request.post(url, { username, password, p: '456' }) | 
				
			|||
            .then(user => { | 
				
			|||
                sessionStorage.setItem('user', JSON.stringify(user)); | 
				
			|||
                dispatch({ | 
				
			|||
                    type: LOGIN_SUCCESS, | 
				
			|||
                    payload: { user: user }, | 
				
			|||
                }); | 
				
			|||
            }, error => { | 
				
			|||
                let { body } = error.response; | 
				
			|||
                dispatch({ | 
				
			|||
                    type: LOGIN_ERROR, | 
				
			|||
                    payload: { | 
				
			|||
                        error: body && body.message ? body.message : '登录失败' | 
				
			|||
                    } | 
				
			|||
                }) | 
				
			|||
            }); | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
export const LOGOUT = 'LOGOUT'; | 
				
			|||
export function logout(user) { | 
				
			|||
    const token = user.token; | 
				
			|||
    const url = ApiTable.logout; | 
				
			|||
    sessionStorage.removeItem('user'); | 
				
			|||
    Request.put(url, { | 
				
			|||
        token: token | 
				
			|||
    }); | 
				
			|||
    return { | 
				
			|||
        type: LOGOUT | 
				
			|||
    }; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
export default { | 
				
			|||
    initAuth, | 
				
			|||
    login, | 
				
			|||
    logout | 
				
			|||
} | 
				
			|||
@ -0,0 +1,10 @@ | 
				
			|||
/** | 
				
			|||
 * Created by liu.xinyi | 
				
			|||
 * on 2016/4/1. | 
				
			|||
 */ | 
				
			|||
'use strict'; | 
				
			|||
import auth from './auth'; | 
				
			|||
 | 
				
			|||
export default { | 
				
			|||
    ...auth     | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,4 @@ | 
				
			|||
'use strict'; | 
				
			|||
import Login from './login'; | 
				
			|||
 | 
				
			|||
export { Login }; | 
				
			|||
@ -0,0 +1,108 @@ | 
				
			|||
'use strict'; | 
				
			|||
import React, { useState, useEffect } from 'react'; | 
				
			|||
import { connect } from 'react-redux'; | 
				
			|||
import { push } from 'react-router-redux'; | 
				
			|||
import { Button, Input, Form, Row, Col, message } from 'antd'; | 
				
			|||
import { login } from '../actions/auth'; | 
				
			|||
import './style.less'; | 
				
			|||
 | 
				
			|||
const FormItem = Form.Item; | 
				
			|||
const Login = props => { | 
				
			|||
    const { dispatch, user, error, isRequesting } = props | 
				
			|||
    const [username, setUserName] = useState('') | 
				
			|||
    const [password, setPassword] = useState('') | 
				
			|||
    const [inputChanged, setInputChanged] = useState(false) | 
				
			|||
 | 
				
			|||
    useEffect(() => { | 
				
			|||
 | 
				
			|||
    }, []) | 
				
			|||
 | 
				
			|||
    useEffect(() => { | 
				
			|||
        if (error) { | 
				
			|||
            message.error(error); | 
				
			|||
            setPassword('') | 
				
			|||
        } | 
				
			|||
    }, [error]) | 
				
			|||
 | 
				
			|||
    useEffect(() => { | 
				
			|||
        user && user.authorized ? dispatch(push('/fillion/infor')) : null | 
				
			|||
    }, [user]) | 
				
			|||
 | 
				
			|||
    const enterHandler = e => { | 
				
			|||
        if (e.key === 'Enter') { | 
				
			|||
            setInputChanged(false) | 
				
			|||
            dispatch(login(username, password)); | 
				
			|||
        } | 
				
			|||
    }; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    const handleLogin = () => { | 
				
			|||
        let reg_user = "SuperAdmin"; | 
				
			|||
        let reg_tel = /^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/;    //11位手机号码正则
 | 
				
			|||
        if (username == reg_user || reg_tel.test(username)) { | 
				
			|||
            setInputChanged(false) | 
				
			|||
            dispatch(login(username, password)) | 
				
			|||
            return | 
				
			|||
        } | 
				
			|||
        if (username == "" || password == "") { | 
				
			|||
            setInputChanged(false) | 
				
			|||
            dispatch(login(username, password)) | 
				
			|||
            return | 
				
			|||
        } | 
				
			|||
        setInputChanged(false) | 
				
			|||
        dispatch(login("12345678912564589", "123456789")) | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    return ( | 
				
			|||
        <div className='login'> | 
				
			|||
            <div className='left'></div> | 
				
			|||
            <div className='right'> | 
				
			|||
                <div className='loginBox'> | 
				
			|||
                    <h1>智慧应急</h1> | 
				
			|||
                    <Form onKeyDown={enterHandler}> | 
				
			|||
 | 
				
			|||
                        <FormItem> | 
				
			|||
                            <div className='loginFormTit'>用户名</div> | 
				
			|||
                            <Input | 
				
			|||
                                className='loginInp' | 
				
			|||
                                type="text" | 
				
			|||
                                value={username} | 
				
			|||
                                maxlength={11} | 
				
			|||
                                onChange={e => { | 
				
			|||
                                    setUserName(e.target.value) | 
				
			|||
                                    setInputChanged(true) | 
				
			|||
                                }} | 
				
			|||
                            /> | 
				
			|||
                        </FormItem> | 
				
			|||
                        <div className='loginFormTit'>密码</div> | 
				
			|||
                        <FormItem> | 
				
			|||
                            <Input | 
				
			|||
                                className='loginInp' | 
				
			|||
                                type="password" | 
				
			|||
                                value={password} | 
				
			|||
 | 
				
			|||
                                onChange={e => { | 
				
			|||
                                    setPassword(e.target.value) | 
				
			|||
                                    setInputChanged(true) | 
				
			|||
                                }} | 
				
			|||
                            /> | 
				
			|||
                        </FormItem> | 
				
			|||
                    </Form> | 
				
			|||
                    <Button type="primary" className='loginBtn' loading={isRequesting} onClick={handleLogin}>登录</Button> | 
				
			|||
                </div> | 
				
			|||
            </div> | 
				
			|||
        </div> | 
				
			|||
    ); | 
				
			|||
} | 
				
			|||
 | 
				
			|||
function mapStateToProps(state) { | 
				
			|||
    const { auth } = state; | 
				
			|||
    return { | 
				
			|||
        user: auth.user, | 
				
			|||
        error: auth.error, | 
				
			|||
        isRequesting: auth.isRequesting | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
export default connect(mapStateToProps)(Login); | 
				
			|||
@ -0,0 +1,81 @@ | 
				
			|||
.login { | 
				
			|||
    width: 100%; | 
				
			|||
    height: 100%; | 
				
			|||
    position: absolute; | 
				
			|||
    top: 0; | 
				
			|||
    left: 0; | 
				
			|||
 | 
				
			|||
    .left { | 
				
			|||
        background-image: url('/assets/images/loginBg.jpg'); | 
				
			|||
        background-size: 100% 100%; | 
				
			|||
        background-repeat: no-repeat; | 
				
			|||
        width: 55%; | 
				
			|||
        height: 100%; | 
				
			|||
        float: left; | 
				
			|||
        top: 0px; | 
				
			|||
        left: 0px; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    .right { | 
				
			|||
        width: 45%; | 
				
			|||
        height: 100%; | 
				
			|||
        background-color: #000066; | 
				
			|||
        float: left; | 
				
			|||
        right: 0px; | 
				
			|||
        bottom: 0px; | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
@media screen and (max-height:1440px) { | 
				
			|||
    .loginBox { | 
				
			|||
        top: 25%; | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
@media screen and (max-height: 768px) { | 
				
			|||
    .loginBox { | 
				
			|||
        top: 20%; | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
@media screen and (max-height: 630px) { | 
				
			|||
    .loginBox { | 
				
			|||
        top: 10%; | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.loginBox { | 
				
			|||
    height: 50%; | 
				
			|||
    width: 25%; | 
				
			|||
    position: absolute; | 
				
			|||
    right: 6.5%; | 
				
			|||
    z-index: 20; | 
				
			|||
 | 
				
			|||
    h1 { | 
				
			|||
        color: #fff; | 
				
			|||
        font-size: 58px; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    .loginFormTit { | 
				
			|||
        width: 20%; | 
				
			|||
        font-size: 18px; | 
				
			|||
        color: rgb(255, 255, 255); | 
				
			|||
        margin-bottom: 10px; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    .loginInp { | 
				
			|||
        width: 80%; | 
				
			|||
        height: 50px; | 
				
			|||
        background: #ffffff; | 
				
			|||
        border: 1px solid #C2C2C2; | 
				
			|||
        border-radius: 5px; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    .loginBtn { | 
				
			|||
        width: 80%; | 
				
			|||
        height: 50px; | 
				
			|||
        margin-top: 20px; | 
				
			|||
        border-radius: 5px; | 
				
			|||
        font-size: 16px; | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
@ -0,0 +1,12 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
import routes from './routes'; | 
				
			|||
import reducers from './reducers'; | 
				
			|||
import actions from './actions'; | 
				
			|||
 | 
				
			|||
export default { | 
				
			|||
    key: 'auth', | 
				
			|||
    reducers: reducers, | 
				
			|||
    routes: routes, | 
				
			|||
    actions: actions | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,40 @@ | 
				
			|||
'use strict'; | 
				
			|||
import * as actionTypes from '../actions/auth'; | 
				
			|||
import Immutable from 'immutable'; | 
				
			|||
 | 
				
			|||
const initState = { | 
				
			|||
    user: {}, | 
				
			|||
    isRequesting: false, | 
				
			|||
    error: null | 
				
			|||
}; | 
				
			|||
 | 
				
			|||
function auth(state = initState, action) { | 
				
			|||
    const payload = action.payload; | 
				
			|||
    switch (action.type){ | 
				
			|||
        case actionTypes.INIT_AUTH: | 
				
			|||
            return Immutable.fromJS(state).set('user', payload.user).toJS(); | 
				
			|||
        case actionTypes.REQUEST_LOGIN: | 
				
			|||
            return Immutable.fromJS(state).merge({ | 
				
			|||
                isRequesting: true, | 
				
			|||
                error: null | 
				
			|||
            }).toJS(); | 
				
			|||
        case actionTypes.LOGIN_SUCCESS: | 
				
			|||
            return Immutable.fromJS(state).merge({ | 
				
			|||
                isRequesting: false, | 
				
			|||
                user: payload.user | 
				
			|||
            }).toJS(); | 
				
			|||
        case actionTypes.LOGIN_ERROR: | 
				
			|||
            return Immutable.fromJS(state).merge({ | 
				
			|||
                isRequesting: false, | 
				
			|||
                error: payload.error | 
				
			|||
            }).toJS(); | 
				
			|||
        case actionTypes.LOGOUT: | 
				
			|||
            return Immutable.fromJS(state).merge({ | 
				
			|||
                user: null | 
				
			|||
            }).toJS(); | 
				
			|||
        default: | 
				
			|||
            return state; | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
export default auth; | 
				
			|||
@ -0,0 +1,6 @@ | 
				
			|||
'use strict'; | 
				
			|||
import auth from './auth' | 
				
			|||
 | 
				
			|||
export default { | 
				
			|||
    auth | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,12 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
import { Login } from './containers'; | 
				
			|||
 | 
				
			|||
export default [{ | 
				
			|||
    type: 'dapin', | 
				
			|||
    route: { | 
				
			|||
        key: 'signin', | 
				
			|||
        path: "/signin", | 
				
			|||
        component: Login | 
				
			|||
    } | 
				
			|||
}]; | 
				
			|||
@ -0,0 +1,15 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
import { basicAction } from '@peace/utils' | 
				
			|||
import { ApiTable } from '$utils' | 
				
			|||
 | 
				
			|||
export function getMembers(orgId) { | 
				
			|||
    return dispatch => basicAction({ | 
				
			|||
        type: 'get', | 
				
			|||
        dispatch: dispatch, | 
				
			|||
        actionType: 'GET_MEMBERS', | 
				
			|||
        url: `${ApiTable.getEnterprisesMembers.replace('{enterpriseId}', orgId)}`, | 
				
			|||
        msg: { error: '获取用户列表失败' }, | 
				
			|||
        reducer: { name: 'members' } | 
				
			|||
    }); | 
				
			|||
} | 
				
			|||
@ -0,0 +1,7 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
import * as example from './example' | 
				
			|||
 | 
				
			|||
export default { | 
				
			|||
    ...example | 
				
			|||
} | 
				
			|||
@ -0,0 +1,43 @@ | 
				
			|||
import React, { useEffect } from 'react'; | 
				
			|||
import { connect } from 'react-redux'; | 
				
			|||
import { Spin, Card } from 'antd'; | 
				
			|||
import '../style.less'; | 
				
			|||
import ProTable, { TableDropdown } from '@ant-design/pro-table'; | 
				
			|||
 | 
				
			|||
const Example = (props) => { | 
				
			|||
    const { dispatch, actions, user, loading } = props | 
				
			|||
 | 
				
			|||
    useEffect(() => { | 
				
			|||
        dispatch(actions.example.getMembers(user.orgId)) | 
				
			|||
    }, []) | 
				
			|||
 | 
				
			|||
    return ( | 
				
			|||
        <Spin tip="biubiubiu~" spinning={loading}> | 
				
			|||
            <div id='example'> | 
				
			|||
                <p>STYLE EXAMPLE</p> | 
				
			|||
            </div> | 
				
			|||
            <ProTable | 
				
			|||
                columns={[{ | 
				
			|||
                    dataIndex: 'index', | 
				
			|||
                    valueType: 'indexBorder', | 
				
			|||
                    width: 48, | 
				
			|||
                }]} | 
				
			|||
                defaultData={[{ index: 1, key: 1 }]} | 
				
			|||
            > | 
				
			|||
 | 
				
			|||
            </ProTable> | 
				
			|||
        </Spin> | 
				
			|||
    ) | 
				
			|||
} | 
				
			|||
 | 
				
			|||
function mapStateToProps(state) { | 
				
			|||
    const { auth, global, members } = state; | 
				
			|||
    return { | 
				
			|||
        loading: members.isRequesting, | 
				
			|||
        user: auth.user, | 
				
			|||
        actions: global.actions, | 
				
			|||
        members: members.data | 
				
			|||
    }; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
export default connect(mapStateToProps)(Example); | 
				
			|||
@ -0,0 +1,5 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
import Example from './example'; | 
				
			|||
 | 
				
			|||
export { Example }; | 
				
			|||
@ -0,0 +1,15 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
import reducers from './reducers'; | 
				
			|||
import routes from './routes'; | 
				
			|||
import actions from './actions'; | 
				
			|||
import { getNavItem } from './nav-item'; | 
				
			|||
 | 
				
			|||
export default { | 
				
			|||
    key: 'example', | 
				
			|||
    name: '书写示例', | 
				
			|||
    reducers: reducers, | 
				
			|||
    routes: routes, | 
				
			|||
    actions: actions, | 
				
			|||
    getNavItem: getNavItem | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,16 @@ | 
				
			|||
import React from 'react'; | 
				
			|||
import { Link } from 'react-router-dom'; | 
				
			|||
import { Menu } from 'antd'; | 
				
			|||
import { SettingOutlined } from '@ant-design/icons'; | 
				
			|||
 | 
				
			|||
const SubMenu = Menu.SubMenu; | 
				
			|||
 | 
				
			|||
export function getNavItem(user, dispatch) { | 
				
			|||
    return ( | 
				
			|||
        <SubMenu key="example" icon={<SettingOutlined />} title={'举个栗子'}> | 
				
			|||
            <Menu.Item key="e1"> | 
				
			|||
                <Link to="/example/e1">举个棒子</Link> | 
				
			|||
            </Menu.Item> | 
				
			|||
        </SubMenu> | 
				
			|||
    ); | 
				
			|||
} | 
				
			|||
@ -0,0 +1,5 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
export default { | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,18 @@ | 
				
			|||
'use strict'; | 
				
			|||
import { Example, } from './containers'; | 
				
			|||
 | 
				
			|||
export default [{ | 
				
			|||
    type: 'inner', | 
				
			|||
    route: { | 
				
			|||
        path: '/example', | 
				
			|||
        key: 'example', | 
				
			|||
        breadcrumb: '栗子', | 
				
			|||
        // 不设置 component 则面包屑禁止跳转
 | 
				
			|||
        childRoutes: [{ | 
				
			|||
            path: '/e1', | 
				
			|||
            key: 'e1', | 
				
			|||
            component: Example, | 
				
			|||
            breadcrumb: '棒子', | 
				
			|||
        }] | 
				
			|||
    } | 
				
			|||
}]; | 
				
			|||
@ -0,0 +1,3 @@ | 
				
			|||
#example:hover { | 
				
			|||
    font-size: larger; | 
				
			|||
} | 
				
			|||
@ -0,0 +1,37 @@ | 
				
			|||
// 'use strict';
 | 
				
			|||
 | 
				
			|||
// import { basicAction } from '@peace/utils'
 | 
				
			|||
// import { ApiTable } from '$utils'
 | 
				
			|||
 | 
				
			|||
// export function reportRectify (timeRange) {
 | 
				
			|||
//     return dispatch => basicAction({
 | 
				
			|||
//         type: 'get',
 | 
				
			|||
//         dispatch: dispatch,
 | 
				
			|||
//         actionType: 'GET_REPORT_RECTIFY',
 | 
				
			|||
//         url: `${ApiTable.getReportRectify}?startTime=${timeRange ? timeRange[0] : ''}&endTime=${timeRange ? timeRange[1] : ''}`,
 | 
				
			|||
//         msg: {},
 | 
				
			|||
//         reducer: { name: 'reportRectify' }
 | 
				
			|||
//     });
 | 
				
			|||
// }
 | 
				
			|||
 | 
				
			|||
// export function reportRectifyDetail (day, depId) {
 | 
				
			|||
//     return dispatch => basicAction({
 | 
				
			|||
//         type: 'get',
 | 
				
			|||
//         dispatch: dispatch,
 | 
				
			|||
//         actionType: 'GET_REPORT_RECTIFY_DETAIL',
 | 
				
			|||
//         url: `${ApiTable.getReportRectifyDetail}?day=${day}&depId=${depId}`,
 | 
				
			|||
//         msg: {},
 | 
				
			|||
//         reducer: { name: 'reportRectifyDetail' }
 | 
				
			|||
//     });
 | 
				
			|||
// }
 | 
				
			|||
 | 
				
			|||
// export function compileReportRectifyDetail (data) {
 | 
				
			|||
//     return dispatch => basicAction({
 | 
				
			|||
//         type: 'post',
 | 
				
			|||
//         dispatch: dispatch,
 | 
				
			|||
//         data,
 | 
				
			|||
//         actionType: 'COMPILE_REPORT_RECTIFY_DETAIL',
 | 
				
			|||
//         url: `${ApiTable.compileReportRectifyDetail}`,
 | 
				
			|||
//         msg: { option: '保存信息' },
 | 
				
			|||
//     });
 | 
				
			|||
// }
 | 
				
			|||
@ -0,0 +1,59 @@ | 
				
			|||
// 'use strict';
 | 
				
			|||
 | 
				
			|||
// import { basicAction } from '@peace/utils'
 | 
				
			|||
// import { ApiTable } from '$utils'
 | 
				
			|||
 | 
				
			|||
// export function allAreas (orgId) {
 | 
				
			|||
//     return dispatch => basicAction({
 | 
				
			|||
//         type: 'get',
 | 
				
			|||
//         dispatch: dispatch,
 | 
				
			|||
//         actionType: 'GET_ALL_AREAS',
 | 
				
			|||
//         url: `${ApiTable.allAreas}`,
 | 
				
			|||
//         msg: {},
 | 
				
			|||
//         reducer: { name: 'allAreas' }
 | 
				
			|||
//     });
 | 
				
			|||
// }
 | 
				
			|||
 | 
				
			|||
// export function addReportConfig (data) {
 | 
				
			|||
//     return dispatch => basicAction({
 | 
				
			|||
//         type: 'post',
 | 
				
			|||
//         dispatch: dispatch,
 | 
				
			|||
//         data: data,
 | 
				
			|||
//         actionType: 'POST_REPORT_CONFIGS',
 | 
				
			|||
//         url: `${ApiTable.addReportConfig}`,
 | 
				
			|||
//         msg: { option: '添加报表配置' },
 | 
				
			|||
//     });
 | 
				
			|||
// }
 | 
				
			|||
 | 
				
			|||
// export function getReportConfig () {
 | 
				
			|||
//     return dispatch => basicAction({
 | 
				
			|||
//         type: 'get',
 | 
				
			|||
//         dispatch: dispatch,
 | 
				
			|||
//         actionType: 'GET_REPORT_CONFIGS',
 | 
				
			|||
//         url: `${ApiTable.getReportConfig}`,
 | 
				
			|||
//         msg: { error: '获取报表配置失败' },
 | 
				
			|||
//         reducer: { name: 'reportConfig' }
 | 
				
			|||
//     });
 | 
				
			|||
// }
 | 
				
			|||
 | 
				
			|||
// export function editReportConfig (data, configId) {
 | 
				
			|||
//     return dispatch => basicAction({
 | 
				
			|||
//         type: 'put',
 | 
				
			|||
//         dispatch: dispatch,
 | 
				
			|||
//         data: data,
 | 
				
			|||
//         actionType: 'EDIT_REPORT_CONFIGS',
 | 
				
			|||
//         url: `${ApiTable.editReportConfig.replace('{reportId}', configId)}`,
 | 
				
			|||
//         msg: { option: '编辑报表配置' },
 | 
				
			|||
//     });
 | 
				
			|||
// }
 | 
				
			|||
 | 
				
			|||
// export function delReportConfig (configId) {
 | 
				
			|||
//     return dispatch => basicAction({
 | 
				
			|||
//         type: 'del',
 | 
				
			|||
//         dispatch: dispatch,
 | 
				
			|||
//         actionType: 'DEL_REPORT_CONFIGS',
 | 
				
			|||
//         url: `${ApiTable.delReportConfig.replace('{reportId}', configId)}`,
 | 
				
			|||
//         msg: { option: '删除报表配置' },
 | 
				
			|||
//     });
 | 
				
			|||
// }
 | 
				
			|||
 | 
				
			|||
@ -0,0 +1,6 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
import * as infor from './infor' | 
				
			|||
export default {  | 
				
			|||
    ...infor, | 
				
			|||
} | 
				
			|||
@ -0,0 +1,24 @@ | 
				
			|||
import { basicAction } from '@peace/utils' | 
				
			|||
import { ApiTable } from '$utils' | 
				
			|||
 | 
				
			|||
export function getDepMessage() { | 
				
			|||
    return dispatch => basicAction({ | 
				
			|||
        type: 'get', | 
				
			|||
        dispatch: dispatch, | 
				
			|||
        actionType: 'GET_DEPARTMENT_MESSAGE', | 
				
			|||
        url: ApiTable.getDepMessage, | 
				
			|||
        msg: { error: '获取部门信息失败' }, | 
				
			|||
        reducer: { name: 'depMessage' } | 
				
			|||
    }); | 
				
			|||
} | 
				
			|||
export function getReportStatistic(query) { | 
				
			|||
    return dispatch => basicAction({ | 
				
			|||
        type: 'get', | 
				
			|||
        dispatch: dispatch, | 
				
			|||
        query: query, | 
				
			|||
        actionType: 'GET_DEPARTMENT_STATIS', | 
				
			|||
        url: ApiTable.getReportStatistic, | 
				
			|||
        msg: { error: '获取填报信息失败' }, | 
				
			|||
        reducer: { name: 'reportstatistic' } | 
				
			|||
    }); | 
				
			|||
} | 
				
			|||
@ -0,0 +1,118 @@ | 
				
			|||
// import React, { useEffect, useState } from 'react';
 | 
				
			|||
// import { connect } from 'react-redux';
 | 
				
			|||
// import { Spin, Drawer, Button } from 'antd';
 | 
				
			|||
// import '../style.less';
 | 
				
			|||
// import { EditableProTable } from '@ant-design/pro-table';
 | 
				
			|||
 | 
				
			|||
// const CompileDrawer = (props) => {
 | 
				
			|||
//     const { dispatch, actions, user, loading, visible, checkRow, close, reportRectifyDetail, checkAction } = props
 | 
				
			|||
//     const [requesting, setRequesting] = useState(false)
 | 
				
			|||
//     const [dataSource, setDataSource] = useState([])
 | 
				
			|||
//     const { report } = actions
 | 
				
			|||
//     const isCheck = checkAction == 'check'
 | 
				
			|||
 | 
				
			|||
//     useEffect(() => {
 | 
				
			|||
//         if (checkRow.day) {
 | 
				
			|||
//             dispatch(report.reportRectifyDetail(checkRow.day, checkRow.depId))
 | 
				
			|||
//         }
 | 
				
			|||
//     }, [checkRow])
 | 
				
			|||
 | 
				
			|||
//     useEffect(() => {
 | 
				
			|||
//         let data = reportRectifyDetail
 | 
				
			|||
//         let i = 1
 | 
				
			|||
//         for (let d of data) {
 | 
				
			|||
//             d.index_ = i++
 | 
				
			|||
//         }
 | 
				
			|||
//         setDataSource(data)
 | 
				
			|||
//     }, [reportRectifyDetail])
 | 
				
			|||
 | 
				
			|||
//     return (
 | 
				
			|||
//         <Drawer
 | 
				
			|||
//             title={"合用场所安全隐患排查整治汇总表"}
 | 
				
			|||
//             placement="right"
 | 
				
			|||
//             onClose={() => {
 | 
				
			|||
//                 close()
 | 
				
			|||
//             }}
 | 
				
			|||
//             visible={visible}
 | 
				
			|||
//             width={'82%'}
 | 
				
			|||
//         >
 | 
				
			|||
//             <Spin spinning={loading || requesting}>
 | 
				
			|||
//                 <EditableProTable
 | 
				
			|||
//                     columns={[
 | 
				
			|||
//                         {
 | 
				
			|||
//                             title: '序号',
 | 
				
			|||
//                             dataIndex: 'index_',
 | 
				
			|||
//                             readonly: true,
 | 
				
			|||
//                         },
 | 
				
			|||
//                         {
 | 
				
			|||
//                             title: '名称',
 | 
				
			|||
//                             dataIndex: 'name',
 | 
				
			|||
//                             readonly: true,
 | 
				
			|||
//                         }, {
 | 
				
			|||
//                             title: '地址',
 | 
				
			|||
//                             dataIndex: 'address',
 | 
				
			|||
//                             readonly: true,
 | 
				
			|||
//                         }, {
 | 
				
			|||
//                             title: '排查发现隐患',
 | 
				
			|||
//                             dataIndex: 'hiddenDanger',
 | 
				
			|||
//                             readonly: true,
 | 
				
			|||
//                         }, {
 | 
				
			|||
//                             title: '采取整改措施',
 | 
				
			|||
//                             dataIndex: 'correctiveAction',
 | 
				
			|||
//                         }, {
 | 
				
			|||
//                             title: '实施处罚、强制措施情况',
 | 
				
			|||
//                             dataIndex: 'punishment',
 | 
				
			|||
//                         },
 | 
				
			|||
//                     ]}
 | 
				
			|||
//                     controlled={true}
 | 
				
			|||
//                     value={dataSource}
 | 
				
			|||
//                     onChange={setDataSource}
 | 
				
			|||
//                     rowKey="id"
 | 
				
			|||
//                     headerTitle={`填报单位:${checkRow.region};时间:${checkRow.day}`}
 | 
				
			|||
//                     maxLength={5}
 | 
				
			|||
//                     recordCreatorProps={false}
 | 
				
			|||
//                     editable={{
 | 
				
			|||
//                         type: 'multiple',
 | 
				
			|||
//                         editableKeys: isCheck ? [] : dataSource.map(r => r.id)
 | 
				
			|||
//                     }}
 | 
				
			|||
//                     toolBarRender={() => [
 | 
				
			|||
//                         isCheck ? '' :
 | 
				
			|||
//                             <Button
 | 
				
			|||
//                                 type="primary"
 | 
				
			|||
//                                 key="save"
 | 
				
			|||
//                                 onClick={() => {
 | 
				
			|||
//                                     // dataSource 就是当前数据,可以调用 api 将其保存
 | 
				
			|||
//                                     setRequesting(true)
 | 
				
			|||
//                                     const data = dataSource
 | 
				
			|||
//                                     for (let d of data) {
 | 
				
			|||
//                                         d.userId = user.id
 | 
				
			|||
//                                         delete d.index_
 | 
				
			|||
//                                     }
 | 
				
			|||
//                                     dispatch(report.compileReportRectifyDetail(dataSource)).then(res => {
 | 
				
			|||
//                                         setRequesting(false)
 | 
				
			|||
//                                     })
 | 
				
			|||
//                                 }}
 | 
				
			|||
//                             >
 | 
				
			|||
//                                 保存数据
 | 
				
			|||
//                             </Button>
 | 
				
			|||
//                     ]}
 | 
				
			|||
//                 >
 | 
				
			|||
 | 
				
			|||
//                 </EditableProTable>
 | 
				
			|||
//             </Spin>
 | 
				
			|||
//         </Drawer >
 | 
				
			|||
//     )
 | 
				
			|||
// }
 | 
				
			|||
 | 
				
			|||
// function mapStateToProps (state) {
 | 
				
			|||
//     const { auth, global, members, reportRectifyDetail } = state;
 | 
				
			|||
//     return {
 | 
				
			|||
//         loading: reportRectifyDetail.isRequesting,
 | 
				
			|||
//         user: auth.user,
 | 
				
			|||
//         actions: global.actions,
 | 
				
			|||
//         members: members.data,
 | 
				
			|||
//         reportRectifyDetail: reportRectifyDetail.data || []
 | 
				
			|||
//     };
 | 
				
			|||
// }
 | 
				
			|||
 | 
				
			|||
// export default connect(mapStateToProps)(CompileDrawer);
 | 
				
			|||
@ -0,0 +1,124 @@ | 
				
			|||
// import React, { useEffect, useRef } from 'react';
 | 
				
			|||
// import { connect } from 'react-redux';
 | 
				
			|||
// import { Spin, Button, Modal, Form, Switch } from 'antd';
 | 
				
			|||
// import ProForm, { ProFormText, ProFormSelect } from '@ant-design/pro-form';
 | 
				
			|||
// import { useState } from 'react';
 | 
				
			|||
 | 
				
			|||
// const ConfigModal = (props) => {
 | 
				
			|||
//     const { dispatch, actions, user, loading, visible, close, editData, allAreas, reportType } = props
 | 
				
			|||
//     const [excuteTimeOptions, setExcuteTimeOptions] = useState([])
 | 
				
			|||
//     const formRef = useRef()
 | 
				
			|||
//     const { report } = actions
 | 
				
			|||
 | 
				
			|||
//     useEffect(() => {
 | 
				
			|||
//         let excuteTimeOptions = []
 | 
				
			|||
//         for (let i = 0; i < 24; i++) {
 | 
				
			|||
//             let curT = i
 | 
				
			|||
//             if (curT < 10) {
 | 
				
			|||
//                 curT = '0' + curT
 | 
				
			|||
//             }
 | 
				
			|||
//             excuteTimeOptions.push({
 | 
				
			|||
//                 value: curT + ':00',
 | 
				
			|||
//                 label: curT + ':00',
 | 
				
			|||
//             })
 | 
				
			|||
//             excuteTimeOptions.push({
 | 
				
			|||
//                 value: curT + ':30',
 | 
				
			|||
//                 label: curT + ':30',
 | 
				
			|||
//             })
 | 
				
			|||
//         }
 | 
				
			|||
//         setExcuteTimeOptions(excuteTimeOptions);
 | 
				
			|||
//     }, [])
 | 
				
			|||
 | 
				
			|||
//     return (
 | 
				
			|||
//         <Modal
 | 
				
			|||
//             title={`${editData ? '编辑' : '新增'}报表配置`}
 | 
				
			|||
//             visible={visible}
 | 
				
			|||
//             onOk={() => {
 | 
				
			|||
//                 formRef.current.validateFields().then(v => {
 | 
				
			|||
//                     v.excuteTime = String(v.excuteTime)
 | 
				
			|||
//                     console.log(v);
 | 
				
			|||
//                     dispatch(editData ? report.editReportConfig(v, editData.id) : report.addReportConfig(v)).then(res => {
 | 
				
			|||
//                         if (res.success) {
 | 
				
			|||
//                             dispatch(report.getReportConfig())
 | 
				
			|||
//                             close()
 | 
				
			|||
//                         }
 | 
				
			|||
//                     })
 | 
				
			|||
//                 })
 | 
				
			|||
//             }}
 | 
				
			|||
//             onCancel={() => {
 | 
				
			|||
//                 close()
 | 
				
			|||
//             }}
 | 
				
			|||
//         >
 | 
				
			|||
//             <ProForm
 | 
				
			|||
//                 formRef={formRef}
 | 
				
			|||
//                 autoFocusFirstInput
 | 
				
			|||
//                 layout={'horizontal'}
 | 
				
			|||
//                 labelCol={{ span: 4 }}
 | 
				
			|||
//                 wrapperCol={{ span: 18 }}
 | 
				
			|||
//                 initialValues={
 | 
				
			|||
//                     editData ?
 | 
				
			|||
//                         editData :
 | 
				
			|||
//                         {
 | 
				
			|||
//                             excuteTime: '00:00',
 | 
				
			|||
//                             isEnable: true
 | 
				
			|||
//                         }
 | 
				
			|||
//                 }
 | 
				
			|||
//                 submitter={false}
 | 
				
			|||
//                 formKey='config-form'
 | 
				
			|||
//             >
 | 
				
			|||
//                 <ProFormText
 | 
				
			|||
//                     name={'reportName'}
 | 
				
			|||
//                     label="报表名称"
 | 
				
			|||
//                     placeholder="请输入名称"
 | 
				
			|||
//                     required
 | 
				
			|||
//                     rules={[{ required: true, message: '请输入名称' }]}
 | 
				
			|||
//                 />
 | 
				
			|||
//                 <ProFormSelect
 | 
				
			|||
//                     options={reportType}
 | 
				
			|||
//                     cacheForSwr
 | 
				
			|||
//                     name="reportTypeId"
 | 
				
			|||
//                     label="报表类型"
 | 
				
			|||
//                     required
 | 
				
			|||
//                     rules={[{ required: true, message: '请选择报表类型' }]}
 | 
				
			|||
//                 />
 | 
				
			|||
//                 <ProFormSelect
 | 
				
			|||
//                     options={
 | 
				
			|||
//                         allAreas.map(a => {
 | 
				
			|||
//                             return {
 | 
				
			|||
//                                 value: a.id,
 | 
				
			|||
//                                 label: a.name,
 | 
				
			|||
//                             }
 | 
				
			|||
//                         })}
 | 
				
			|||
//                     cacheForSwr
 | 
				
			|||
//                     name="regionId"
 | 
				
			|||
//                     label="区域"
 | 
				
			|||
//                     required
 | 
				
			|||
//                     rules={[{ required: true, message: '请选择区域' }]}
 | 
				
			|||
//                 />
 | 
				
			|||
//                 <Form.Item name="isEnable" label="状态" valuePropName="checked">
 | 
				
			|||
//                     <Switch checkedChildren="启用" unCheckedChildren="禁用" />
 | 
				
			|||
//                 </Form.Item>
 | 
				
			|||
//                 <ProFormSelect
 | 
				
			|||
//                     options={excuteTimeOptions}
 | 
				
			|||
//                     addonBefore={'每天'}
 | 
				
			|||
//                     addonAfter={'时'}
 | 
				
			|||
//                     cacheForSwr
 | 
				
			|||
//                     name="excuteTime"
 | 
				
			|||
//                     label="生成时间"
 | 
				
			|||
//                 />
 | 
				
			|||
//             </ProForm>
 | 
				
			|||
//         </Modal>
 | 
				
			|||
//     )
 | 
				
			|||
// }
 | 
				
			|||
 | 
				
			|||
// function mapStateToProps (state) {
 | 
				
			|||
//     const { auth, global, allAreas } = state;
 | 
				
			|||
//     console.log(allAreas);
 | 
				
			|||
//     return {
 | 
				
			|||
//         user: auth.user,
 | 
				
			|||
//         actions: global.actions,
 | 
				
			|||
//         allAreas: allAreas.data || []
 | 
				
			|||
//     };
 | 
				
			|||
// }
 | 
				
			|||
 | 
				
			|||
// export default connect(mapStateToProps)(ConfigModal);
 | 
				
			|||
@ -0,0 +1,132 @@ | 
				
			|||
import React from 'react'; | 
				
			|||
import { connect } from 'react-redux'; | 
				
			|||
import { Spin, Table } from 'antd'; | 
				
			|||
import { ModalForm } from '@ant-design/pro-form'; | 
				
			|||
import moment from 'moment'; | 
				
			|||
const UserModal = (props) => { | 
				
			|||
    const { visible, onVisibleChange } = props | 
				
			|||
    const datas = props.modalRecord || {} | 
				
			|||
    const scopeOfExamination = { ...datas }.hiddenDangerItem12 | 
				
			|||
    const arr = [ | 
				
			|||
        ' 1、合用场所的所有权人、使用人是否遵守消防法律、法规、规章;', | 
				
			|||
        ' 2、住宿场所是否违规搭建;', | 
				
			|||
        ' 3、合用场所是否配置灭火器、消防应急照明等消防器材和设施;', | 
				
			|||
        ' 4、合用场所的电器产品的安装、使用及其线路和管路的设计、敷设、维护保养、检测,是否符合消防技术标准和管理规定;', | 
				
			|||
        ' 5、合用场所住宿是否超过2人;(judge_0) 若超过,人员住宿是否设置在首层,并直通室外安全出口。(judge_1)', | 
				
			|||
        ' 6、电动自行车是否违规室内充电、停放;', | 
				
			|||
        ' 7、合用场所是否违规生产、储存、经营易燃易爆危险品;', | 
				
			|||
        ' 8、合用场所除厨房外是否违规使用或者放置瓶装液化石油气、可燃液体;', | 
				
			|||
        ' 9、放置瓶装液化石油气的厨房是否采取防火分隔措施,并设置自然排风窗;', | 
				
			|||
        ' 10、合用场所疏散通道、安全出口是否保持畅通;', | 
				
			|||
        ' 11、合用场所的外窗或阳台是否设置金属栅栏;(judge_0) 若设置,是否能从内部易于开启。(judge_1)', | 
				
			|||
        ' 12、存在其他安全隐患;', | 
				
			|||
    ] | 
				
			|||
    const columns = [ | 
				
			|||
        { | 
				
			|||
            title: '场所名称', | 
				
			|||
            dataIndex: 'reportName', | 
				
			|||
            hideInSearch: true, | 
				
			|||
            render: () => { | 
				
			|||
                return <div>{datas.placeName}</div> | 
				
			|||
            } | 
				
			|||
        }, { | 
				
			|||
            title: '场所基本情况', | 
				
			|||
            dataIndex: 'reportName', | 
				
			|||
            hideInSearch: true, | 
				
			|||
            render: () => { | 
				
			|||
                return <div> | 
				
			|||
                    <li>使用性质:{datas.placeType}</li> | 
				
			|||
                    <li>地址:{datas.address}</li> | 
				
			|||
                    <li>负责人:{datas.placeOwner}</li> | 
				
			|||
                    <li>电话:{datas.phone}</li> | 
				
			|||
                    <li>面积:{datas.dimension}</li> | 
				
			|||
                    <li>层数:{datas.floors}</li> | 
				
			|||
                    <li>常驻人口:{datas.numberOfPeople}</li> | 
				
			|||
                </div> | 
				
			|||
            } | 
				
			|||
        }, { | 
				
			|||
            title: '检查内容', | 
				
			|||
            dataIndex: 'reportName', | 
				
			|||
            hideInSearch: true, | 
				
			|||
            render: () => { | 
				
			|||
                return datas.hiddenDangerItem12 ? | 
				
			|||
                    scopeOfExamination.map((item, index) => { | 
				
			|||
                        let message = arr[index] | 
				
			|||
                        if (arr[index].indexOf('judge_') > -1) { | 
				
			|||
                            if (item.value == true && index === 4) { | 
				
			|||
                                message = message.replace(`judge_1`, item.child.value ? "是" : "否") | 
				
			|||
                            } else { | 
				
			|||
                                message = message.replace(`若超过,人员住宿是否设置在首层,并直通室外安全出口。(judge_1)`, '') | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (item.value == true && index === 10) { | 
				
			|||
                                message = message.replace(`judge_1`, item.child.value ? "是" : "否") | 
				
			|||
                            } else { | 
				
			|||
 | 
				
			|||
                                message = message.replace(`若设置,是否能从内部易于开启。(judge_1)`, '') | 
				
			|||
 | 
				
			|||
                            } | 
				
			|||
                            if (arr[index].indexOf('judge_0') > -1) { | 
				
			|||
                                return <li key={index}>{message.replace(`judge_0`, item.value ? "是" : "否")}</li> | 
				
			|||
                            } | 
				
			|||
                        } | 
				
			|||
                        return <li key={index}>{message}({item.value ? "是" : "否"})</li> | 
				
			|||
                    }) | 
				
			|||
                    : '---' | 
				
			|||
            } | 
				
			|||
        }, { | 
				
			|||
            title: '存在具体问题', | 
				
			|||
            dataIndex: 'reportName', | 
				
			|||
            hideInSearch: true, | 
				
			|||
            render: () => { | 
				
			|||
                return <div>{datas.description ? datas.description : '---'}</div> | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
    ] | 
				
			|||
    const data = [ | 
				
			|||
        { | 
				
			|||
            key: '1', | 
				
			|||
 | 
				
			|||
            address: 'New York No. 1 Lake Park', | 
				
			|||
            tags: ['nice', 'developer'], | 
				
			|||
        }, | 
				
			|||
    ]; | 
				
			|||
    return ( | 
				
			|||
        <Spin spinning={false}> | 
				
			|||
            <ModalForm | 
				
			|||
                width={'90rem'} | 
				
			|||
                visible={visible} | 
				
			|||
                onVisibleChange={onVisibleChange} | 
				
			|||
                submitter={false} | 
				
			|||
            > | 
				
			|||
                <div style={{ width: '71vw' }}><span style={{ fontSize: '16px' }}>排查单位:{(datas || {}).checkAreaName || ''}</span> | 
				
			|||
                    <span style={{ fontSize: '16px', float: 'right', marginBottom: '10px' }}>填报日期:{moment((datas || {}).time).format('YYYY-MM-DD') || ''}</span><span style={{ clear: 'both' }}></span></div> | 
				
			|||
                <Table columns={columns} dataSource={data} width={'50rem'} pagination={false} | 
				
			|||
 | 
				
			|||
                /> | 
				
			|||
                <div style={{ width: '71vw', marginTop: '10px' }}> | 
				
			|||
                    <span style={{ fontSize: '16px' }}>排查人:{(datas || {}).checkUserName || ''}</span> | 
				
			|||
                    <span style={{ fontSize: '16px', float: 'right' }}>手机号:{(datas || {}).checkUserPhone || ''}</span></div> | 
				
			|||
            </ModalForm> | 
				
			|||
        </Spin> | 
				
			|||
    ) | 
				
			|||
} | 
				
			|||
function mapStateToProps(state) { | 
				
			|||
    const { depMessage } = state; | 
				
			|||
    const pakData = (dep) => { | 
				
			|||
        return dep.map((d) => { | 
				
			|||
            return { | 
				
			|||
                title: d.name, | 
				
			|||
                value: d.id, | 
				
			|||
                children: pakData(d.subordinate) | 
				
			|||
            } | 
				
			|||
        }) | 
				
			|||
    } | 
				
			|||
    let depData = pakData(depMessage.data || []) | 
				
			|||
    return { | 
				
			|||
        loading: depMessage.isRequesting, | 
				
			|||
        depData, | 
				
			|||
    }; | 
				
			|||
} | 
				
			|||
export default connect(mapStateToProps)(UserModal); | 
				
			|||
@ -0,0 +1,223 @@ | 
				
			|||
import React, { useEffect, useState } from 'react'; | 
				
			|||
import { connect } from 'react-redux'; | 
				
			|||
import { Spin, Button, Popconfirm, TreeSelect } from 'antd'; | 
				
			|||
import ProTable from '@ant-design/pro-table'; | 
				
			|||
 | 
				
			|||
import moment from 'moment'; | 
				
			|||
import { getReportStatistic } from "../actions/infor" | 
				
			|||
const InForTable = (props) => { | 
				
			|||
    const { dispatch, user, depData, depMessage, depLoading } = props | 
				
			|||
    const [rowSelected, setRowSelected] = useState([]) | 
				
			|||
    const [regionId, setRegionId] = useState()//区域id
 | 
				
			|||
    const [placeType, setPlaceType] = useState()//场所
 | 
				
			|||
    const [day, setDay] = useState([moment('2022-03-01').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')])//日期
 | 
				
			|||
    const [sitename, setSitename] = useState()//场所名称
 | 
				
			|||
    const [counts, setCounts] = useState()//shuju
 | 
				
			|||
    useEffect(() => { | 
				
			|||
        setRegionId(user.departmentId) | 
				
			|||
    }, [user]) | 
				
			|||
    useEffect(() => { | 
				
			|||
        setDay([moment('2022-03-01').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')]) | 
				
			|||
    }, [depData]) | 
				
			|||
    const onChange = (value) => { | 
				
			|||
        // setRegionName(value)
 | 
				
			|||
        setRegionId(value) | 
				
			|||
    } | 
				
			|||
    const columns = [ | 
				
			|||
        { | 
				
			|||
            title: '场所名称', | 
				
			|||
            dataIndex: 'placeName', | 
				
			|||
            formItemProps: { | 
				
			|||
                label: '场所名称', | 
				
			|||
            }, | 
				
			|||
            fieldProps: { | 
				
			|||
                onChange: (value, cs) => { | 
				
			|||
                    setSitename(value.currentTarget.value) | 
				
			|||
                }, | 
				
			|||
                placeholder: '请输入场所名称进行搜索', | 
				
			|||
                getPopupContainer: (triggerNode) => triggerNode.parentNode, | 
				
			|||
            }, | 
				
			|||
        }, | 
				
			|||
        { | 
				
			|||
            title: '场所地址', | 
				
			|||
            search: false, | 
				
			|||
            dataIndex: 'time', | 
				
			|||
            valueType: 'dateRange', | 
				
			|||
            initialValue: day, | 
				
			|||
            order: 4, | 
				
			|||
            render: (dom, record) => { | 
				
			|||
                return record.address | 
				
			|||
            }, | 
				
			|||
            fieldProps: { | 
				
			|||
                getPopupContainer: (triggerNode) => triggerNode.parentNode, | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
        { | 
				
			|||
            title: '隐患场所', | 
				
			|||
            dataIndex: 'regionName', | 
				
			|||
            valueType: 'select', | 
				
			|||
            initialValue: -1, | 
				
			|||
            fieldProps: { | 
				
			|||
                label: null, | 
				
			|||
                onChange: (value, cs) => { | 
				
			|||
                    setPlaceType(value); | 
				
			|||
                }, | 
				
			|||
                options: [{ | 
				
			|||
 | 
				
			|||
                    label: '全部', | 
				
			|||
                    value: -1 | 
				
			|||
                }, | 
				
			|||
                { | 
				
			|||
                    label: '隐患场所', | 
				
			|||
                    value: 0 | 
				
			|||
                }, { | 
				
			|||
                    label: '非隐患场所', | 
				
			|||
                    value: 1 | 
				
			|||
                }, { | 
				
			|||
                    label: '非合用场所', | 
				
			|||
                    value: 2 | 
				
			|||
                },], | 
				
			|||
                getPopupContainer: (triggerNode) => triggerNode.parentNode, | 
				
			|||
            }, | 
				
			|||
            order: 5, | 
				
			|||
            render: (dom, record) => { | 
				
			|||
                let flag = "是" | 
				
			|||
                if (record.hiddenDangerItem12 == null) { | 
				
			|||
                    flag = <span style={{ color: '#8c8987' }}>/</span> | 
				
			|||
                } | 
				
			|||
                if (record.hiddenDangerItem12 && record.correctiveAction == null && record.punishment == null) { | 
				
			|||
                    flag = <span style={{ color: '#8c8987' }}>否</span> | 
				
			|||
                } | 
				
			|||
                return flag | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
        { | 
				
			|||
            title: '排查日期', | 
				
			|||
            dataIndex: 'time', | 
				
			|||
            valueType: 'dateRange', | 
				
			|||
            initialValue: day, | 
				
			|||
            order: 4, | 
				
			|||
            fieldProps: { | 
				
			|||
                onChange: (value, cs) => { | 
				
			|||
                    setDay(cs) | 
				
			|||
                }, | 
				
			|||
                getPopupContainer: (triggerNode) => triggerNode.parentNode, | 
				
			|||
            }, | 
				
			|||
            render: (dom, record) => { | 
				
			|||
                return [moment(record.time).format('YYYY-MM-DD HH:mm:ss'),] | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
        { | 
				
			|||
            title: '操作', | 
				
			|||
            dataIndex: 'creatTime', | 
				
			|||
            valueType: 'dateTimeRange', | 
				
			|||
            hideInSearch: true, | 
				
			|||
            render: (dom, record) => { | 
				
			|||
                return <Button type="link" onClick={() => { props.openModal('edit', record) }}>详情</Button> | 
				
			|||
            } | 
				
			|||
        }, | 
				
			|||
    ] | 
				
			|||
    return ( | 
				
			|||
        <Spin spinning={false}> | 
				
			|||
            <h4 style={{ position: 'relative', top: '34px', left: '62px' }}>区域:</h4> | 
				
			|||
            <TreeSelect | 
				
			|||
                value={regionId} | 
				
			|||
                suffixIcon={true} | 
				
			|||
                dropdownMatchSelectWidth={false} | 
				
			|||
                style={{ width: '18.4%', marginLeft: '104px' }} | 
				
			|||
                treeData={depData} | 
				
			|||
                placeholder="全部" | 
				
			|||
                showSearch={true} | 
				
			|||
                onChange={onChange} | 
				
			|||
                treeDefaultExpandAll={false} | 
				
			|||
                request={async () => { | 
				
			|||
                    return depData | 
				
			|||
                }} | 
				
			|||
                expandedKeys={["title"]} | 
				
			|||
                notFoundContent={ | 
				
			|||
                    depLoading ? | 
				
			|||
                        <p style={{ textAlign: 'center' }}> | 
				
			|||
                            <Spin spinning={depLoading}></Spin> | 
				
			|||
                        </p> : | 
				
			|||
                        <p style={{ textAlign: 'center' }}>暂无数据</p> | 
				
			|||
                } | 
				
			|||
                getPopupContainer={(triggerNode) => triggerNode.parentNode} | 
				
			|||
            /> | 
				
			|||
            <div> | 
				
			|||
                <ProTable | 
				
			|||
                    style={{ width: "100% ", overflow: "auto", height: '760px' }} | 
				
			|||
                    rowKey="id" | 
				
			|||
                    onReset={(v) => { | 
				
			|||
                        const { id } = depMessage[0] | 
				
			|||
                        console.log(id) | 
				
			|||
                        setRegionId(id) | 
				
			|||
                        setPlaceType(-1) | 
				
			|||
                        setDay([moment('2022-03-01').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')]) | 
				
			|||
                        setSitename('') | 
				
			|||
                    }} | 
				
			|||
                    rowSelection={{ | 
				
			|||
                        selectedRowKeys: rowSelected, | 
				
			|||
                        onChange: (selectedRowKeys) => { | 
				
			|||
                            setRowSelected(selectedRowKeys); | 
				
			|||
                        }, | 
				
			|||
                    }} | 
				
			|||
                    columns={columns} | 
				
			|||
                    options={false} | 
				
			|||
                    dataSource={(counts || {}).rows || []} | 
				
			|||
                    request={async (params) => { | 
				
			|||
                        const query = { | 
				
			|||
                            startDate: day[0], | 
				
			|||
                            endDate: day[1], | 
				
			|||
                            placeType: placeType, | 
				
			|||
                            regionId: regionId, | 
				
			|||
                            placeName: sitename, | 
				
			|||
                            limit: params.pageSize, | 
				
			|||
                            offset: ((params.current ? params.current : 1) - 1) * params.pageSize | 
				
			|||
                        } | 
				
			|||
                        setRowSelected([]); | 
				
			|||
                        const res = await dispatch(getReportStatistic(query)); | 
				
			|||
                        setCounts(res.payload.data) | 
				
			|||
                        return { | 
				
			|||
                            ...res, | 
				
			|||
                            total: res.payload.data ? res.payload.data.count : 0 | 
				
			|||
                        } | 
				
			|||
                    }} | 
				
			|||
                    search={{ | 
				
			|||
                        defaultCollapsed: false, | 
				
			|||
                        optionRender: (searchConfig, formProps, dom) => [ | 
				
			|||
                            ...dom.reverse(), | 
				
			|||
                            <Popconfirm title="确认导出?" onConfirm={() => { props.exports(rowSelected, counts) }}> | 
				
			|||
                                <Button | 
				
			|||
                                > | 
				
			|||
                                    导出 | 
				
			|||
                                </Button> | 
				
			|||
                            </Popconfirm> | 
				
			|||
                        ], | 
				
			|||
                    }} | 
				
			|||
                > | 
				
			|||
                </ProTable></div> | 
				
			|||
 | 
				
			|||
        </Spin > | 
				
			|||
    ) | 
				
			|||
} | 
				
			|||
function mapStateToProps(state) { | 
				
			|||
    const { auth, depMessage } = state; | 
				
			|||
    const pakData = (dep) => { | 
				
			|||
        return dep.map((d) => { | 
				
			|||
            return { | 
				
			|||
                title: d.name, | 
				
			|||
                value: d.id, | 
				
			|||
                // children: d.type >= 2 ? [] : pakData(d.subordinate)
 | 
				
			|||
                children: pakData(d.subordinate) | 
				
			|||
            } | 
				
			|||
        }) | 
				
			|||
    } | 
				
			|||
    let depData = pakData(depMessage.data || []) | 
				
			|||
    return { | 
				
			|||
        user: auth.user, | 
				
			|||
        depMessage: depMessage.data || [], | 
				
			|||
        depLoading: depMessage.isRequesting, | 
				
			|||
        depData, | 
				
			|||
    }; | 
				
			|||
} | 
				
			|||
export default connect(mapStateToProps)(InForTable); | 
				
			|||
@ -0,0 +1,6 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
import infor from './infor'; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
export { infor }; | 
				
			|||
@ -0,0 +1,59 @@ | 
				
			|||
import React, { useEffect, useState } from 'react'; | 
				
			|||
import { connect } from 'react-redux'; | 
				
			|||
import '../style.less'; | 
				
			|||
import { getDepMessage, getReportStatistic } from "../actions/infor" | 
				
			|||
import InForTable from '../components/inforTable'; | 
				
			|||
import UserModal from '../components/infor/details'; | 
				
			|||
const superagent = require('superagent'); | 
				
			|||
const infor = (props) => { | 
				
			|||
    const { dispatch, user} = props | 
				
			|||
    const [data, setData] = useState() | 
				
			|||
    const [modalVisible, setModalVisible] = useState(false); | 
				
			|||
    const [modalRecord, setModalRecord] = useState(); | 
				
			|||
    useEffect(() => { | 
				
			|||
        // dispatch(getDepMessage())
 | 
				
			|||
        dispatch(getReportStatistic()) | 
				
			|||
        setData(props) | 
				
			|||
    }, []); | 
				
			|||
    //打开弹窗
 | 
				
			|||
    const openModal = (type, record) => { | 
				
			|||
        setModalVisible(true); | 
				
			|||
        // setModalType(type);
 | 
				
			|||
        if (type == 'edit') { | 
				
			|||
            setModalRecord(record); | 
				
			|||
        } else { | 
				
			|||
            setModalRecord(null); | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
    //批量导出
 | 
				
			|||
    const exports = (ids,counts) => { | 
				
			|||
        // console.log(user);
 | 
				
			|||
        let reportIds = []; | 
				
			|||
        if (ids.length) | 
				
			|||
            reportIds = ids | 
				
			|||
        else | 
				
			|||
            reportIds = (counts || {}).ids || []; | 
				
			|||
        superagent.post('/_report/http') | 
				
			|||
            .send({ id: reportIds.map(i => Number(i)) }).end((err, res) => { | 
				
			|||
                const resTextIs = res.text.split('/').pop() | 
				
			|||
                window.open( | 
				
			|||
                    '/_api/' + | 
				
			|||
                    `attachments?src=files/${resTextIs}&filename=${encodeURIComponent(resTextIs)}&token=${user.token}`) | 
				
			|||
            }) | 
				
			|||
    } | 
				
			|||
    return ( | 
				
			|||
        <> <InForTable data={data} openModal={openModal} exports={exports} /> | 
				
			|||
            <UserModal | 
				
			|||
                visible={modalVisible} | 
				
			|||
                onVisibleChange={setModalVisible} | 
				
			|||
                modalRecord={modalRecord} | 
				
			|||
            /></> | 
				
			|||
    ) | 
				
			|||
} | 
				
			|||
function mapStateToProps(state) { | 
				
			|||
   const {auth}=state | 
				
			|||
   return { | 
				
			|||
    user: auth.user, | 
				
			|||
   } | 
				
			|||
} | 
				
			|||
export default connect(mapStateToProps)(infor); | 
				
			|||
@ -0,0 +1,124 @@ | 
				
			|||
// import React from 'react';
 | 
				
			|||
// import { connect } from 'react-redux';
 | 
				
			|||
// import { Spin, Table } from 'antd';
 | 
				
			|||
// import { ModalForm } from '@ant-design/pro-form';
 | 
				
			|||
// import moment from 'moment';
 | 
				
			|||
// const UserModal = (props) => {
 | 
				
			|||
//     const { visible, onVisibleChange } = props
 | 
				
			|||
//     const datas = props.modalRecord || {}
 | 
				
			|||
//     const scopeOfExamination = { ...datas }.hiddenDangerItem12
 | 
				
			|||
//     const arr = [
 | 
				
			|||
//         ' 1、合用场所的所有权人、使用人是否遵守消防法律、法规、规章;',
 | 
				
			|||
//         ' 2、住宿场所是否违规搭建;',
 | 
				
			|||
//         ' 3、合用场所是否配置灭火器、消防应急照明等消防器材和设施;',
 | 
				
			|||
//         ' 4、合用场所的电器产品的安装、使用及其线路和管路的设计、敷设、维护保养、检测,是否符合消防技术标准和管理规定;',
 | 
				
			|||
//         ' 5、合用场所住宿是否超过2人;(judge_0) 若超过,人员住宿是否设置在首层,并直通室外安全出口;(judge_1)',
 | 
				
			|||
//         ' 6、电动自行车是否违规室内充电、停放;',
 | 
				
			|||
//         ' 7、合用场所是否违规生产、储存、经营易燃易爆危险品;',
 | 
				
			|||
//         ' 8、合用场所除厨房外是否违规使用或者放置瓶装液化石油气、可燃液体;',
 | 
				
			|||
//         ' 9、放置瓶装液化石油气的厨房是否采取防火分隔措施,并设置自然排风窗;',
 | 
				
			|||
//         ' 10、合用场所疏散通道、安全出口是否保持畅通;',
 | 
				
			|||
//         ' 11、合用场所的外窗或阳台是否设置金属栅栏;(judge_0) 若设置,是否能从内部易于开启。(judge_1)',
 | 
				
			|||
//         ' 12、存在其他安全隐患;',
 | 
				
			|||
//     ]
 | 
				
			|||
//     const columns = [
 | 
				
			|||
//         {
 | 
				
			|||
//             title: '场所名称',
 | 
				
			|||
//             dataIndex: 'reportName',
 | 
				
			|||
//             hideInSearch: true,
 | 
				
			|||
//             render: () => {
 | 
				
			|||
//                 return <div>{datas.placeName}</div>
 | 
				
			|||
//             }
 | 
				
			|||
//         }, {
 | 
				
			|||
//             title: '场所基本情况',
 | 
				
			|||
//             dataIndex: 'reportName',
 | 
				
			|||
//             hideInSearch: true,
 | 
				
			|||
//             render: () => {
 | 
				
			|||
//                 return <div>
 | 
				
			|||
//                     <li>使用性质:{datas.placeType}</li>
 | 
				
			|||
//                     <li>地址:{datas.address}</li>
 | 
				
			|||
//                     <li>负责人:{datas.placeOwner}</li>
 | 
				
			|||
//                     <li>电话:{datas.phone}</li>
 | 
				
			|||
//                     <li>面积:{datas.dimension}</li>
 | 
				
			|||
//                     <li>层数:{datas.floors}</li>
 | 
				
			|||
//                     <li>常驻人口:{datas.numberOfPeople}</li>
 | 
				
			|||
//                 </div>
 | 
				
			|||
//             }
 | 
				
			|||
//         }, {
 | 
				
			|||
//             title: '检查内容',
 | 
				
			|||
//             dataIndex: 'reportName',
 | 
				
			|||
//             hideInSearch: true,
 | 
				
			|||
//             render: () => {
 | 
				
			|||
//                 return datas.hiddenDangerItem12 ?
 | 
				
			|||
//                 scopeOfExamination.map((item, index) => {
 | 
				
			|||
//                         let message = arr[index]
 | 
				
			|||
//                         if (arr[index].indexOf('judge_') > -1) {
 | 
				
			|||
//                             if (item.child && item.child.itemIndex) {
 | 
				
			|||
//                                 message = message.replace(`judge_${item.child.itemIndex}`, item.child.value ? "是" : "否")
 | 
				
			|||
//                             } else {
 | 
				
			|||
//                                 message = message.replace(`judge_1`, '---')
 | 
				
			|||
//                             }
 | 
				
			|||
 | 
				
			|||
//                             if (arr[index].indexOf('judge_0') > -1) {
 | 
				
			|||
//                                 return <li key={index}>{message.replace(`judge_0`, item.value ? "是" : "否")}</li>
 | 
				
			|||
//                             }
 | 
				
			|||
//                         }
 | 
				
			|||
//                         return <li key={index}>{message}({item.value ? "是" : "否"})</li>
 | 
				
			|||
//                     })
 | 
				
			|||
//                     : '---'
 | 
				
			|||
//             }
 | 
				
			|||
//         }, {
 | 
				
			|||
//             title: '存在具体问题',
 | 
				
			|||
//             dataIndex: 'reportName',
 | 
				
			|||
//             hideInSearch: true,
 | 
				
			|||
//             render: () => {
 | 
				
			|||
//                 return <div>{datas.description ? datas.description : '---'}</div>
 | 
				
			|||
//             }
 | 
				
			|||
//         },
 | 
				
			|||
//     ]
 | 
				
			|||
//     const data = [
 | 
				
			|||
//         {
 | 
				
			|||
//             key: '1',
 | 
				
			|||
 | 
				
			|||
//             address: 'New York No. 1 Lake Park',
 | 
				
			|||
//             tags: ['nice', 'developer'],
 | 
				
			|||
//         },
 | 
				
			|||
//     ];
 | 
				
			|||
//     return (
 | 
				
			|||
//         <Spin spinning={false}>
 | 
				
			|||
//             <ModalForm
 | 
				
			|||
//                 width={'90rem'}
 | 
				
			|||
//                 visible={visible}
 | 
				
			|||
//                 onVisibleChange={onVisibleChange}
 | 
				
			|||
//                 submitter={false}
 | 
				
			|||
//             > 
 | 
				
			|||
//                     <div style={{ width:'71vw'}}><span style={{ fontSize: '16px' }}>排查单位:{(datas || {}).checkAreaName || ''}</span>
 | 
				
			|||
//                     <span style={{ fontSize: '16px', float:'right',marginBottom:'10px'}}>填报日期:{moment((datas || {}).time).format('YYYY-MM-DD') || ''}</span><span style={{clear:'both'}}></span></div>
 | 
				
			|||
//                     <Table columns={columns} dataSource={data} width={'50rem'} pagination={false}
 | 
				
			|||
 | 
				
			|||
//                     />
 | 
				
			|||
//                     <div style={{ width:'71vw',marginTop:'10px'}}>
 | 
				
			|||
//                     <span style={{ fontSize: '16px' }}>排查人:{(datas || {}).checkUserName || ''}</span>
 | 
				
			|||
//                     <span style={{ fontSize: '16px',float:'right' }}>手机号:{(datas || {}).checkUserPhone || ''}</span></div>
 | 
				
			|||
//             </ModalForm> 
 | 
				
			|||
//         </Spin>
 | 
				
			|||
//     )
 | 
				
			|||
// }
 | 
				
			|||
// function mapStateToProps (state) {
 | 
				
			|||
//     const { depMessage } = state;
 | 
				
			|||
//     const pakData = (dep) => {
 | 
				
			|||
//         return dep.map((d) => {
 | 
				
			|||
//             return {
 | 
				
			|||
//                 title: d.name,
 | 
				
			|||
//                 value: d.id,
 | 
				
			|||
//                 children: pakData(d.subordinate)
 | 
				
			|||
//             }
 | 
				
			|||
//         })
 | 
				
			|||
//     }
 | 
				
			|||
//     let depData = pakData(depMessage.data || [])
 | 
				
			|||
//     return {
 | 
				
			|||
//         loading: depMessage.isRequesting,
 | 
				
			|||
//         depData,
 | 
				
			|||
//     };
 | 
				
			|||
// }
 | 
				
			|||
// export default connect(mapStateToProps)(UserModal);
 | 
				
			|||
@ -0,0 +1,13 @@ | 
				
			|||
'use strict'; | 
				
			|||
import reducers from './reducers'; | 
				
			|||
import routes from './routes'; | 
				
			|||
import actions from './actions'; | 
				
			|||
import { getNavItem } from './nav-item'; | 
				
			|||
export default { | 
				
			|||
    key: 'fillion', | 
				
			|||
    name: '填报管理', | 
				
			|||
    reducers: reducers, | 
				
			|||
    routes: routes, | 
				
			|||
    actions: actions, | 
				
			|||
    getNavItem: getNavItem | 
				
			|||
}; | 
				
			|||
@ -0,0 +1,14 @@ | 
				
			|||
import React from 'react'; | 
				
			|||
import { Link } from 'react-router-dom'; | 
				
			|||
import { Menu } from 'antd'; | 
				
			|||
import { ReadOutlined } from '@ant-design/icons'; | 
				
			|||
const SubMenu = Menu.SubMenu; | 
				
			|||
export function getNavItem(user, dispatch) { | 
				
			|||
    return ( | 
				
			|||
        <SubMenu key="fillion" icon={<ReadOutlined />} title={'填报管理'}> | 
				
			|||
            <Menu.Item key="fillioninfor"> | 
				
			|||
                <Link to="/fillion/infor">填报信息</Link> | 
				
			|||
            </Menu.Item> | 
				
			|||
        </SubMenu> | 
				
			|||
    ); | 
				
			|||
} | 
				
			|||
@ -0,0 +1,5 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
export default { | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,19 @@ | 
				
			|||
'use strict'; | 
				
			|||
import {  infor } from './containers'; | 
				
			|||
export default [{ | 
				
			|||
    type: 'inner', | 
				
			|||
    route: { | 
				
			|||
        path: '/fillion', | 
				
			|||
        key: 'fillion', | 
				
			|||
        breadcrumb: '填报管理', | 
				
			|||
        menuSelectKeys: ['fillion'], | 
				
			|||
        menuOpenKeys: ['fillion'], | 
				
			|||
        childRoutes: [ { | 
				
			|||
            path: '/infor', | 
				
			|||
            key: 'fillioninfor', | 
				
			|||
            menuSelectKeys:['fillioninfor'], | 
				
			|||
            component: infor, | 
				
			|||
            breadcrumb: '填报信息', | 
				
			|||
        }] | 
				
			|||
    } | 
				
			|||
}]; | 
				
			|||
@ -0,0 +1,3 @@ | 
				
			|||
#example:hover { | 
				
			|||
    font-size: larger; | 
				
			|||
} | 
				
			|||
@ -0,0 +1,30 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
import { basicAction } from '@peace/utils' | 
				
			|||
import { ApiTable } from '$utils' | 
				
			|||
export function getFundamental() { | 
				
			|||
    return dispatch => basicAction({ | 
				
			|||
        type: 'get', | 
				
			|||
        dispatch: dispatch, | 
				
			|||
        actionType: 'GET_DATA', | 
				
			|||
        url: ApiTable.getFundamental, | 
				
			|||
        msg: { error: '获取数据失败' }, | 
				
			|||
        reducer: { name: 'datas' } | 
				
			|||
    }); | 
				
			|||
} | 
				
			|||
 | 
				
			|||
 | 
				
			|||
export function getsortord(zuo, day) { | 
				
			|||
    return dispatch => basicAction({ | 
				
			|||
        type: 'get', | 
				
			|||
        dispatch: dispatch, | 
				
			|||
        actionType: 'GET_PATIENTIA', | 
				
			|||
        url: ApiTable.getsortord.replace('{zuo}', zuo).replace('{day}', day), | 
				
			|||
        msg: { error: '日期更新失败' }, | 
				
			|||
        reducer: { name: 'Patientia' } | 
				
			|||
    }); | 
				
			|||
} | 
				
			|||
export default { | 
				
			|||
    getFundamental, | 
				
			|||
    getsortord | 
				
			|||
} | 
				
			|||
@ -0,0 +1,7 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
import * as date from "./data" | 
				
			|||
 | 
				
			|||
export default { | 
				
			|||
    ...date | 
				
			|||
} | 
				
			|||
@ -0,0 +1,118 @@ | 
				
			|||
import React, { useState, useEffect } from 'react' | 
				
			|||
import { connect } from 'react-redux'; | 
				
			|||
import { getFundamental } from '../actions/data'; | 
				
			|||
import * as echarts from "echarts" | 
				
			|||
import "../style.less" | 
				
			|||
 | 
				
			|||
const DateModal = (props) => { | 
				
			|||
    const { dispatch } = props | 
				
			|||
    const [lists, setLists] = useState([]) | 
				
			|||
    const [keys, setKeys] = useState([]) | 
				
			|||
    const [days, setDays] = useState() | 
				
			|||
    const [unkeys, setUnkeys] = useState([]) | 
				
			|||
    const [num, setNum] = useState(1) | 
				
			|||
    useEffect(() => { | 
				
			|||
        // 获取数据
 | 
				
			|||
        dispatch(getFundamental()).then(res => { | 
				
			|||
            setDays(res.payload.data.date) | 
				
			|||
 | 
				
			|||
        }) | 
				
			|||
    }, [true]) | 
				
			|||
 | 
				
			|||
    const op = () => { | 
				
			|||
        // 把获取的数据进行加工
 | 
				
			|||
        if (days && num == 1) { | 
				
			|||
 | 
				
			|||
            var daysValues = Object.values(days) | 
				
			|||
            var daysKeys = Object.keys(days) | 
				
			|||
            var list = [] | 
				
			|||
            var arr = [] | 
				
			|||
            var months = [] | 
				
			|||
            for (let index = 6; index >= 0; index--) { | 
				
			|||
                list.push(daysValues[index]) | 
				
			|||
            } | 
				
			|||
            setLists(list) | 
				
			|||
            for (let index = 6; index >= 0; index--) { | 
				
			|||
                arr.push(daysKeys[index].substring(8)) | 
				
			|||
            } | 
				
			|||
            for (let index = 6; index >= 0; index--) { | 
				
			|||
                months.push(daysKeys[index].charAt(5) + "" + daysKeys[index].charAt(6)) | 
				
			|||
            } | 
				
			|||
            setUnkeys(months) | 
				
			|||
            setKeys(arr) | 
				
			|||
            setNum(2) | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
    op() | 
				
			|||
    useEffect(() => { | 
				
			|||
        let a = ([...keys]) | 
				
			|||
        let list = [] | 
				
			|||
        for (let index = 0; index < 7; index++) { | 
				
			|||
            list.push(a[index]) | 
				
			|||
        } | 
				
			|||
        for (let index = 0; index < 7; index++) { | 
				
			|||
            list[index] = list[index] + "日" | 
				
			|||
        } | 
				
			|||
        var myChart = echarts.init(document.getElementById('echarts')); | 
				
			|||
        // window.onresize在重复使用过程中会被覆盖
 | 
				
			|||
        // window.onresize = myChart.resize;
 | 
				
			|||
        // addEventListener来添加监听resize的事件,将能避免onresize的覆盖问题,并能实现对窗口的监听操作
 | 
				
			|||
        window.addEventListener("resize", function () { | 
				
			|||
            myChart.resize() | 
				
			|||
        }) | 
				
			|||
        var option = { | 
				
			|||
            title: { | 
				
			|||
                text: '近七日填报数量', | 
				
			|||
                left: "7%" | 
				
			|||
            }, | 
				
			|||
            grid: { | 
				
			|||
                left: '3%', | 
				
			|||
                right: '4%', | 
				
			|||
                bottom: '3%', | 
				
			|||
                containLabel: true | 
				
			|||
            }, | 
				
			|||
            tooltip: { | 
				
			|||
                trigger: 'item', | 
				
			|||
                formatter: function (params) { | 
				
			|||
                    var htmlStr = `填报数量:${params.value}条<br/>${unkeys[params.dataIndex] + "月" + params.name}<br/>` | 
				
			|||
                    return htmlStr; | 
				
			|||
                } | 
				
			|||
            }, | 
				
			|||
            xAxis: { | 
				
			|||
                type: 'category', | 
				
			|||
                data: list, | 
				
			|||
                axisTick: { | 
				
			|||
                    alignWithLabel: true | 
				
			|||
                } | 
				
			|||
            }, | 
				
			|||
            yAxis: { | 
				
			|||
                type: "value", | 
				
			|||
            }, | 
				
			|||
            series: [ | 
				
			|||
                { | 
				
			|||
                    name: '填报数量', | 
				
			|||
                    type: 'bar', | 
				
			|||
                    data: lists, | 
				
			|||
                    barWidth: 40 | 
				
			|||
                } | 
				
			|||
            ] | 
				
			|||
        }; | 
				
			|||
 | 
				
			|||
        // 使用刚指定的配置项和数据显示图表。
 | 
				
			|||
        myChart.setOption(option); | 
				
			|||
    }, [lists]) | 
				
			|||
    return ( | 
				
			|||
        <div id='echarts'></div> | 
				
			|||
    ) | 
				
			|||
} | 
				
			|||
function mapStateToProps(state) { | 
				
			|||
    const { auth, depMessage, depUser, global } = state; | 
				
			|||
    return { | 
				
			|||
        user: auth.user, | 
				
			|||
        clientHeight: global.clientHeight, | 
				
			|||
        loading: depMessage.isRequesting, | 
				
			|||
        depMessage: depMessage.data || [], | 
				
			|||
        depUser: depUser.data || [] | 
				
			|||
    }; | 
				
			|||
} | 
				
			|||
export default connect(mapStateToProps)(DateModal) | 
				
			|||
@ -0,0 +1,5 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
import DateModal from './dateModal'; | 
				
			|||
 | 
				
			|||
export { DateModal }; | 
				
			|||
@ -0,0 +1,157 @@ | 
				
			|||
import React, { useEffect, useState } from "react"; | 
				
			|||
import { connect } from "react-redux"; | 
				
			|||
import { Space, Row, Col, DatePicker, Spin } from "antd"; | 
				
			|||
import { getFundamental, getsortord } from "../actions/data"; | 
				
			|||
import { DateModal } from "../components"; | 
				
			|||
import moment from "moment"; | 
				
			|||
import "../style.less"; | 
				
			|||
const { RangePicker } = DatePicker; | 
				
			|||
const UserManage = (props) => { | 
				
			|||
  const { dispatch, loading, datas, Patientias } = props; | 
				
			|||
  const dateFormat = "YYYY/MM/DD"; | 
				
			|||
  const [data, setData] = useState(); | 
				
			|||
  const [Patientia, setPatientia] = useState(); | 
				
			|||
  useEffect(() => { | 
				
			|||
    // 获取数据
 | 
				
			|||
    dispatch(getFundamental()).then((res) => { | 
				
			|||
      setData(res); | 
				
			|||
    }); | 
				
			|||
  }, [true]); | 
				
			|||
  useEffect(() => { | 
				
			|||
    // 根据接口获取规定时间内获取到的数据
 | 
				
			|||
    var customField = [ | 
				
			|||
      moment().add(-6, "day").format("YYYY-MM-DD"), | 
				
			|||
      moment(new Date(), dateFormat).format("YYYY-MM-DD"), | 
				
			|||
    ]; | 
				
			|||
    dispatch(getsortord(customField[0], customField[1])).then((res) => { | 
				
			|||
      setPatientia(res.payload.data); | 
				
			|||
    }); | 
				
			|||
  }, [true]); | 
				
			|||
  // useEffect(() => {
 | 
				
			|||
  /* Patientia ? setPatientia(Patientia */ /* .sort(sortByKey("count")) */ /* ) : null */ | 
				
			|||
  // }, [Patientia])
 | 
				
			|||
  // 根据数组里面对象的key值进行排序
 | 
				
			|||
  // const sortByKey = (key) => {
 | 
				
			|||
  //     return function (a, b) {
 | 
				
			|||
  //         var value1 = a[key];
 | 
				
			|||
  //         var value2 = b[key];
 | 
				
			|||
  //         return value2 - value1;
 | 
				
			|||
  //     }
 | 
				
			|||
  // }
 | 
				
			|||
  const disabledDate = (current) => { | 
				
			|||
    return ( | 
				
			|||
      (current && current < moment("2022/03/01").subtract("day")) || | 
				
			|||
      current > moment(new Date()).subtract("days") | 
				
			|||
    ); | 
				
			|||
  }; | 
				
			|||
  const getTime = (date) => { | 
				
			|||
    // 根据时间框时间获取数据进行展示
 | 
				
			|||
    if (date) { | 
				
			|||
      var ao = []; | 
				
			|||
      ao.push(date[0].format("YYYY/MM/DD")); | 
				
			|||
      ao.push(date[1].format("YYYY/MM/DD")); | 
				
			|||
    } | 
				
			|||
    dispatch(getsortord(ao[0], ao[1])).then((res) => { | 
				
			|||
      setPatientia(res.payload.data /* .sort(sortByKey("count")) */); | 
				
			|||
    }); | 
				
			|||
  }; | 
				
			|||
 | 
				
			|||
  return ( | 
				
			|||
    <div style={{ overflow: "hiddle" }}> | 
				
			|||
      {/* 此处进行了loding的效果 */} | 
				
			|||
      <Spin spinning={loading} tip="稍等片刻~"> | 
				
			|||
        {/* 页面上部分代码 */} | 
				
			|||
        <div className="shuju-top"> | 
				
			|||
          <Row className="wrap" type="flex" justify="center" align="middle"> | 
				
			|||
            <Col span={6} align="center"> | 
				
			|||
              <span>今日新增填报</span> | 
				
			|||
              <p> {datas.data ? datas.data.added : null}</p> | 
				
			|||
            </Col> | 
				
			|||
            <Col span={6} align="center"> | 
				
			|||
              <span>今日已审填报</span> | 
				
			|||
              <p> | 
				
			|||
                {datas.data ? datas.data.checked : null} | 
				
			|||
                <span>/{datas.data ? datas.data.unChecked : null}</span> | 
				
			|||
              </p> | 
				
			|||
            </Col> | 
				
			|||
            <Col span={6} align="center"> | 
				
			|||
              <span>隐患场所总数</span> | 
				
			|||
              <p>{datas.data ? datas.data.danger_place : null}</p> | 
				
			|||
            </Col> | 
				
			|||
            <Col span={6} align="center"> | 
				
			|||
              <span>历史填报</span> | 
				
			|||
              <p>{datas.data ? datas.data.history : null}</p> | 
				
			|||
            </Col> | 
				
			|||
          </Row> | 
				
			|||
        </div> | 
				
			|||
        {/* 页面下部分代码 */} | 
				
			|||
        <div className="shuju-floer"> | 
				
			|||
          {/* echarts柱状图 */} | 
				
			|||
          <div className="shuju-floer-left">{datas ? <DateModal /> : null}</div> | 
				
			|||
          {/* 根据时间进行的排序 */} | 
				
			|||
          <div className="shuju-floer-reght"> | 
				
			|||
            <p>各区县合用场所填报数量</p> | 
				
			|||
            <Space direction="vertical" size={12}> | 
				
			|||
              <RangePicker | 
				
			|||
                disabledDate={disabledDate} | 
				
			|||
                onChange={getTime} | 
				
			|||
                defaultValue={[ | 
				
			|||
                  moment().add(-6, "day"), | 
				
			|||
                  moment(new Date(), dateFormat) | 
				
			|||
                ]} | 
				
			|||
                width={"100%"} | 
				
			|||
                allowClear={false} | 
				
			|||
              /> | 
				
			|||
            </Space> | 
				
			|||
            <div className="dataDisplay"> | 
				
			|||
              {Patientias | 
				
			|||
                ? Patientias.map((item, index) => { | 
				
			|||
                  return ( | 
				
			|||
                    <li | 
				
			|||
                      key={index} | 
				
			|||
                      className="traverse" | 
				
			|||
                      style={{ marginTop: index == 0 ? "30px" : "0" }} | 
				
			|||
                    > | 
				
			|||
                      {index >= 3 ? ( | 
				
			|||
                        <div className="topThree">{index + 1}</div> | 
				
			|||
                      ) : ( | 
				
			|||
                        <div className="untopThree">{index + 1}</div> | 
				
			|||
                      )} | 
				
			|||
                      <span className="siteName">{item.name}</span> | 
				
			|||
                      <span className="sitePeople">{item.count}</span> | 
				
			|||
                    </li> | 
				
			|||
                  ); | 
				
			|||
                }) | 
				
			|||
                : null} | 
				
			|||
            </div> | 
				
			|||
          </div> | 
				
			|||
        </div> | 
				
			|||
      </Spin> | 
				
			|||
    </div> | 
				
			|||
  ); | 
				
			|||
}; | 
				
			|||
function mapStateToProps(state) { | 
				
			|||
  // console.log(state);
 | 
				
			|||
  const { auth, depMessage, depUser, global, datas, Patientia } = state; | 
				
			|||
  // 在reducer中进行数据处理
 | 
				
			|||
  const sortByKey = (key) => { | 
				
			|||
    return function (a, b) { | 
				
			|||
      var value1 = a[key]; | 
				
			|||
      var value2 = b[key]; | 
				
			|||
      return value2 - value1; | 
				
			|||
    }; | 
				
			|||
  }; | 
				
			|||
  return { | 
				
			|||
    user: auth.user, | 
				
			|||
    clientHeight: global.clientHeight, | 
				
			|||
    loading: datas.isRequesting && Patientia.isRequesting, | 
				
			|||
    depMessage: depMessage.data || [], | 
				
			|||
    depUser: depUser.data || [], | 
				
			|||
    datas: datas || [], | 
				
			|||
    Patientias: Patientia.data | 
				
			|||
      ? Patientia.data.sort(sortByKey("count")) | 
				
			|||
      : null || [], | 
				
			|||
  }; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
export default connect(mapStateToProps)(UserManage); | 
				
			|||
@ -0,0 +1,5 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
import UserManage from './data'; | 
				
			|||
 | 
				
			|||
export { UserManage }; | 
				
			|||
@ -0,0 +1,15 @@ | 
				
			|||
'use strict'; | 
				
			|||
 | 
				
			|||
import reducers from './reducers'; | 
				
			|||
import routes from './routes'; | 
				
			|||
import actions from './actions'; | 
				
			|||
import { getNavItem } from './nav-item'; | 
				
			|||
 | 
				
			|||
export default { | 
				
			|||
    key: 'middleground', | 
				
			|||
    name: '', | 
				
			|||
    reducers: reducers, | 
				
			|||
    routes: routes, | 
				
			|||
    actions: actions, | 
				
			|||
    getNavItem: getNavItem | 
				
			|||
}; | 
				
			|||
Some files were not shown because too many files changed in this diff
					Loading…
					
					
				
		Reference in new issue