@ -0,0 +1,38 @@ |
|||||
|
{ |
||||
|
// 使用 IntelliSense 了解相关属性。 |
||||
|
// 悬停以查看现有属性的描述。 |
||||
|
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 |
||||
|
"version": "0.2.0", |
||||
|
"configurations": [ |
||||
|
{ |
||||
|
"type": "node", |
||||
|
"request": "launch", |
||||
|
"name": "启动API", |
||||
|
"program": "${workspaceRoot}/server.js", |
||||
|
"env": { |
||||
|
"NODE_ENV": "development" |
||||
|
}, |
||||
|
"args": [ |
||||
|
"-p 14000", |
||||
|
"-f http://localhost:14000", |
||||
|
"-g postgres://postgres:123@10.8.30.32:5432/yinjiguanli", |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"type": "node", |
||||
|
"request": "launch", |
||||
|
"name": "run mocha", |
||||
|
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", |
||||
|
"stopOnEntry": false, |
||||
|
"args": [ |
||||
|
"app/test/*.test.js", |
||||
|
"--no-timeouts" |
||||
|
], |
||||
|
"cwd": "${workspaceRoot}", |
||||
|
"runtimeExecutable": null, |
||||
|
"env": { |
||||
|
"NODE_ENV": "development" |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
|
||||
|
FROM repository.anxinyun.cn/base-images/nodejs12:20.10.12.2 |
||||
|
|
||||
|
MAINTAINER liuxinyi "liu.xinyi@free-sun.com.cn" |
||||
|
|
||||
|
COPY . /var/app |
||||
|
|
||||
|
WORKDIR /var/app |
||||
|
|
||||
|
EXPOSE 8080 |
||||
|
|
||||
|
CMD ["-g", "postgres://FashionAdmin:123456@iota-m1:5433/SmartRiver", "--qnak", "5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu", "--qnsk", "w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5", "--qnbkt", "anxinyun-test", "--qndmn", "http://test.resources.anxinyun.cn"] |
||||
|
|
||||
|
ENTRYPOINT [ "node", "server.js" ] |
@ -0,0 +1,3 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
module.exports = require('./lib'); |
@ -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,195 @@ |
|||||
|
'use strict'; |
||||
|
const Hex = require('crypto-js/enc-hex'); |
||||
|
const MD5 = require('crypto-js/md5'); |
||||
|
const moment = require('moment'); |
||||
|
const uuid = require('uuid'); |
||||
|
|
||||
|
async function login(ctx, next) { |
||||
|
const transaction = await ctx.fs.dc.orm.transaction(); |
||||
|
try { |
||||
|
const models = ctx.fs.dc.models; |
||||
|
const params = ctx.request.body; |
||||
|
let password = Hex.stringify(MD5(params.password)); |
||||
|
|
||||
|
const userRes = await models.User.findOne({ |
||||
|
where: { |
||||
|
username: params.username, |
||||
|
password: password, |
||||
|
delete: false, |
||||
|
}, |
||||
|
attributes: { exclude: ['password'] }, |
||||
|
include: [{ |
||||
|
attributes: ["resourceId"], |
||||
|
model: models.UserResource |
||||
|
}] |
||||
|
}); |
||||
|
|
||||
|
if (!userRes) { |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
"message": "账号或密码错误" |
||||
|
} |
||||
|
} else if (!userRes.enable) { |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { message: "该用户已被禁用" } |
||||
|
} else { |
||||
|
const token = uuid.v4(); |
||||
|
const { departmentId } = userRes.dataValues; |
||||
|
const deptInfo = await models.Department.findOne({ |
||||
|
where: { |
||||
|
id: departmentId |
||||
|
} |
||||
|
}) |
||||
|
let userRslt = Object.assign(userRes.dataValues, { |
||||
|
authorized: true, |
||||
|
token: token, |
||||
|
userResources: userRes.userResources.map(r => r.resourceId), |
||||
|
type: deptInfo.type |
||||
|
}); |
||||
|
|
||||
|
await models.UserToken.create({ |
||||
|
token: token, |
||||
|
userInfo: userRslt, |
||||
|
expired: moment().add(30, 'days').format() |
||||
|
}); |
||||
|
|
||||
|
ctx.status = 200; |
||||
|
ctx.body = userRslt; |
||||
|
} |
||||
|
await transaction.commit(); |
||||
|
} catch (error) { |
||||
|
await transaction.rollback(); |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
"message": "登录失败" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 微信小程序登录 |
||||
|
* @@requires.body {phone-手机号, password-密码} ctx |
||||
|
*/ |
||||
|
async function wxLogin(ctx, next) { |
||||
|
const transaction = await ctx.fs.dc.orm.transaction(); |
||||
|
try { |
||||
|
const models = ctx.fs.dc.models; |
||||
|
const params = ctx.request.body; |
||||
|
let password = Hex.stringify(MD5(params.password)); |
||||
|
const userRes = await models.User.findOne({ |
||||
|
where: { |
||||
|
phone: params.phone, |
||||
|
password: password, |
||||
|
delete: false, |
||||
|
}, |
||||
|
attributes: { exclude: ['password'] } |
||||
|
}); |
||||
|
if (!userRes) { |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { message: "手机号或密码错误" } |
||||
|
} else if (!userRes.enable) { |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { message: "该用户已被禁用" } |
||||
|
} else { |
||||
|
const token = uuid.v4(); |
||||
|
//获取用户关注区域信息
|
||||
|
const departmentRes = await models.Department.findOne({ where: { id: userRes.departmentId } }); |
||||
|
let attentionRegion = departmentRes; |
||||
|
while (attentionRegion.dependence && attentionRegion.type != 1) { |
||||
|
const departmentParent = await models.Department.findOne({ where: { id: attentionRegion.dependence } }); |
||||
|
attentionRegion = { |
||||
|
...departmentParent.dataValues, |
||||
|
nextRegin: attentionRegion |
||||
|
} |
||||
|
} |
||||
|
//获取用户权限信息
|
||||
|
const resourceRes = await models.UserResource.findAll({ |
||||
|
where: { |
||||
|
userId: userRes.id |
||||
|
}, |
||||
|
include: [{ |
||||
|
model: models.Resource, |
||||
|
attributes: ['code', 'name'], |
||||
|
}], |
||||
|
attributes: [] |
||||
|
}); |
||||
|
let userRslt = Object.assign({ |
||||
|
authorized: true, |
||||
|
token: token, |
||||
|
...userRes.dataValues |
||||
|
}); |
||||
|
await models.UserToken.create({ |
||||
|
token: token, |
||||
|
userInfo: userRslt, |
||||
|
expired: moment().add(30, 'day').format('YYYY-MM-DD HH:mm:ss') |
||||
|
}, { transaction: transaction }); |
||||
|
ctx.status = 200; |
||||
|
ctx.body = Object.assign({ |
||||
|
...userRslt, |
||||
|
userRegionType: departmentRes.type,//1-市级,2-区县级,3-乡镇级,4-村级
|
||||
|
attentionRegion: attentionRegion, |
||||
|
resources: resourceRes.map(r => r.resource) |
||||
|
}); |
||||
|
} |
||||
|
await transaction.commit(); |
||||
|
} catch (error) { |
||||
|
await transaction.rollback(); |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
"message": "登录失败" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
async function logout(ctx) { |
||||
|
try { |
||||
|
const { token, code } = ctx.request.body; |
||||
|
const models = ctx.fs.dc.models; |
||||
|
|
||||
|
await models.UserToken.destroy({ |
||||
|
where: { |
||||
|
token: token, |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
ctx.status = 204; |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
"message": "登出失败" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 微信小程序登出 |
||||
|
* @request.body {token-用户登录Token} ctx |
||||
|
*/ |
||||
|
async function wxLogout(ctx) { |
||||
|
try { |
||||
|
const { token } = ctx.request.body; |
||||
|
const models = ctx.fs.dc.models; |
||||
|
await models.UserToken.destroy({ |
||||
|
where: { |
||||
|
token: token, |
||||
|
}, |
||||
|
}); |
||||
|
ctx.status = 204; |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
"message": "登出失败" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
module.exports = { |
||||
|
login, |
||||
|
wxLogin, |
||||
|
logout, |
||||
|
wxLogout |
||||
|
}; |
@ -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,264 @@ |
|||||
|
'use strict'; |
||||
|
const Hex = require('crypto-js/enc-hex'); |
||||
|
const MD5 = require('crypto-js/md5'); |
||||
|
|
||||
|
async function getDepMessage (ctx, next) { |
||||
|
try { |
||||
|
const { fs: { api: { userInfo } } } = ctx |
||||
|
const models = ctx.fs.dc.models; |
||||
|
|
||||
|
let depType1 = await models.Department.findAll({ |
||||
|
order: [['id', 'asc']], |
||||
|
// include: [{
|
||||
|
// model: models.User,
|
||||
|
// required: false,
|
||||
|
// where: { delete: false },
|
||||
|
// attributes: { exclude: ['password'] },
|
||||
|
// }],
|
||||
|
where: { |
||||
|
// type: 1,
|
||||
|
id: userInfo.departmentId |
||||
|
}, |
||||
|
}) |
||||
|
|
||||
|
let depRslt = [] |
||||
|
const getDep = async (d) => { |
||||
|
let subordinate = [] |
||||
|
let depRes = await models.Department.findAll({ |
||||
|
order: [['id', 'asc']], |
||||
|
// include: [{
|
||||
|
// model: models.User,
|
||||
|
// required: false,
|
||||
|
// where: { delete: false },
|
||||
|
// attributes: { exclude: ['password'] },
|
||||
|
// }],
|
||||
|
where: { |
||||
|
dependence: d.id |
||||
|
}, |
||||
|
}) |
||||
|
if (depRes.length) |
||||
|
for (let d of depRes) { |
||||
|
let dep = d.dataValues |
||||
|
dep.subordinate = await getDep(d.dataValues) |
||||
|
subordinate.push(dep) |
||||
|
} |
||||
|
return subordinate |
||||
|
} |
||||
|
for (let d of depType1) { |
||||
|
let dep_1 = d.dataValues |
||||
|
dep_1.subordinate = await getDep(d.dataValues) |
||||
|
depRslt.push(dep_1) |
||||
|
} |
||||
|
|
||||
|
ctx.status = 200; |
||||
|
ctx.body = depRslt |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
"message": "获取部门信息失败" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
async function getUser (ctx, next) { |
||||
|
try { |
||||
|
const models = ctx.fs.dc.models; |
||||
|
const { depId } = ctx.params |
||||
|
const userRes = await models.User.findAll({ |
||||
|
where: { |
||||
|
departmentId: parseInt(depId), |
||||
|
delete: false |
||||
|
}, |
||||
|
attributes: { exclude: ['password'] }, |
||||
|
order: [['id', 'asc']], |
||||
|
}) |
||||
|
|
||||
|
ctx.status = 200; |
||||
|
ctx.body = userRes |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
"message": "获取用户信息失败" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
async function creatUser (ctx, next) { |
||||
|
let errMsg = "新建用户失败" |
||||
|
try { |
||||
|
const models = ctx.fs.dc.models; |
||||
|
const data = ctx.request.body; |
||||
|
|
||||
|
let repeatUserNameCount = await models.User.count({ |
||||
|
where: { |
||||
|
username: data.phone, |
||||
|
delete: false |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
if (repeatUserNameCount) { |
||||
|
errMsg = '已有当前用户名' |
||||
|
throw errMsg |
||||
|
} |
||||
|
|
||||
|
await models.User.create({ |
||||
|
name: data.name, |
||||
|
username: data.phone, |
||||
|
password: Hex.stringify(MD5(data.password)), |
||||
|
departmentId: data.departmentId, |
||||
|
email: data.email, |
||||
|
enable: data.enable, |
||||
|
delete: false, |
||||
|
phone: data.phone, |
||||
|
post: data.post, |
||||
|
}) |
||||
|
|
||||
|
ctx.status = 204; |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
"message": errMsg |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
async function updateUser (ctx, next) { |
||||
|
let errMsg = "修改用户失败" |
||||
|
try { |
||||
|
const models = ctx.fs.dc.models; |
||||
|
const data = ctx.request.body; |
||||
|
const { id } = ctx.params; |
||||
|
|
||||
|
let repeatUserNameCount = await models.User.count({ |
||||
|
where: { |
||||
|
username: data.username |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
if (repeatUserNameCount) { |
||||
|
errMsg = '已有当前用户名' |
||||
|
throw errMsg |
||||
|
} |
||||
|
|
||||
|
await models.User.update({ |
||||
|
name: data.name, |
||||
|
username: data.phone, |
||||
|
departmentId: data.departmentId, |
||||
|
email: data.email, |
||||
|
enable: data.enable, |
||||
|
delete: false, |
||||
|
phone: data.phone, |
||||
|
post: data.post, |
||||
|
}, { |
||||
|
where: { |
||||
|
id: id |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
ctx.status = 204; |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
"message": errMsg |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
async function deleteUser (ctx, next) { |
||||
|
try { |
||||
|
const models = ctx.fs.dc.models; |
||||
|
const { ids } = ctx.params; |
||||
|
const userIds = ids.split(','); |
||||
|
await models.User.update({ |
||||
|
delete: true, |
||||
|
}, { |
||||
|
where: { |
||||
|
id: { $in: userIds }, |
||||
|
} |
||||
|
}); |
||||
|
ctx.status = 204; |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
"message": "删除用户失败" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
async function resetPwd (ctx, next) { |
||||
|
try { |
||||
|
const models = ctx.fs.dc.models; |
||||
|
const { id } = ctx.params; |
||||
|
const data = ctx.request.body; |
||||
|
await models.User.update({ |
||||
|
password: Hex.stringify(MD5(data.password)), |
||||
|
}, { |
||||
|
where: { |
||||
|
id: id, |
||||
|
} |
||||
|
}); |
||||
|
ctx.status = 204; |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
"message": "重置用户密码失败" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改用户密码 |
||||
|
* @params {userId-用户Id} ctx |
||||
|
* @request.body {password-用户新密码} ctx |
||||
|
*/ |
||||
|
async function updateUserPassword (ctx, next) { |
||||
|
try { |
||||
|
const models = ctx.fs.dc.models; |
||||
|
const { userId } = ctx.params; |
||||
|
const { password } = ctx.request.body; |
||||
|
if (!password) { |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { "message": "请输入修改密码" }; |
||||
|
return; |
||||
|
} |
||||
|
const userRes = await models.User.findOne({ |
||||
|
where: { |
||||
|
id: userId |
||||
|
}, |
||||
|
attributes: ['id'] |
||||
|
}); |
||||
|
if (userRes) { |
||||
|
await models.User.update({ password: Hex.stringify(MD5(password)) }, { where: { id: userId, } }); |
||||
|
ctx.status = 204; |
||||
|
} 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 = { |
||||
|
getDepMessage, |
||||
|
getUser, |
||||
|
creatUser, |
||||
|
updateUser, |
||||
|
deleteUser, |
||||
|
resetPwd, |
||||
|
updateUserPassword |
||||
|
} |
@ -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,36 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
const routes = require('./routes'); |
||||
|
const authenticator = require('./middlewares/authenticator'); |
||||
|
// const apiLog = require('./middlewares/api-log');
|
||||
|
const businessRest = require('./middlewares/business-rest'); |
||||
|
|
||||
|
module.exports.entry = function (app, router, opts) { |
||||
|
app.fs.logger.log('info', '[FS-AUTH]', 'Inject auth and api mv into router.'); |
||||
|
|
||||
|
app.fs.api = app.fs.api || {}; |
||||
|
app.fs.api.authAttr = app.fs.api.authAttr || {}; |
||||
|
app.fs.api.logAttr = app.fs.api.logAttr || {}; |
||||
|
|
||||
|
router.use(authenticator(app, opts)); |
||||
|
router.use(businessRest(app, router, opts)); |
||||
|
// router.use(apiLog(app, opts));
|
||||
|
|
||||
|
router = routes(app, router, opts); |
||||
|
}; |
||||
|
|
||||
|
module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Sequelize, models: {} }
|
||||
|
require('./models/user')(dc); |
||||
|
require('./models/user_token')(dc); |
||||
|
require('./models/department')(dc); |
||||
|
require('./models/resource')(dc); |
||||
|
require('./models/user_resource')(dc); |
||||
|
require('./models/places')(dc); |
||||
|
require('./models/user_placeSecurityRecord')(dc); |
||||
|
require('./models/report_type')(dc); |
||||
|
require('./models/report_downManage')(dc); |
||||
|
require('./models/department')(dc); |
||||
|
require('./models/report_configition')(dc); |
||||
|
require('./models/report_collection')(dc); |
||||
|
require('./models/report_rectify')(dc); |
||||
|
}; |
@ -0,0 +1,83 @@ |
|||||
|
/** |
||||
|
* Created by PengPeng on 2017/4/26. |
||||
|
*/ |
||||
|
'use strict'; |
||||
|
|
||||
|
const moment = require('moment'); |
||||
|
const pathToRegexp = require('path-to-regexp'); |
||||
|
|
||||
|
function factory(app, opts) { |
||||
|
async function sendToEsAsync(producer, payloads) { |
||||
|
return new Promise((resolve, reject) => { |
||||
|
producer.send(payloads, function (err) { |
||||
|
if (err) { |
||||
|
reject(err); |
||||
|
} else { |
||||
|
resolve(); |
||||
|
} |
||||
|
}); |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
async function logger(ctx, next) { |
||||
|
const { path, method } = ctx; |
||||
|
const start = Date.now(); |
||||
|
|
||||
|
// 等待路由处理
|
||||
|
await next(); |
||||
|
|
||||
|
try { |
||||
|
let logAttr = null; |
||||
|
for (let prop in app.fs.api.logAttr) { |
||||
|
let keys = []; |
||||
|
let re = pathToRegexp(prop.replace(/\:[A-Za-z_\-]+\b/g, '(\\d+)'), keys); |
||||
|
if (re.test(`${method}${path}`)) { |
||||
|
logAttr = app.fs.api.logAttr[prop]; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
let parameter = null, parameterShow = null, user_id, _token, app_key; |
||||
|
if (ctx.fs.api) { |
||||
|
const { actionParameter, actionParameterShow, userId, token, appKey } = ctx.fs.api; |
||||
|
parameter = actionParameter; |
||||
|
parameterShow = actionParameterShow; |
||||
|
user_id = userId; |
||||
|
_token = token; |
||||
|
app_key = appKey; |
||||
|
} |
||||
|
const producer = ctx.fs.kafka.producer; |
||||
|
|
||||
|
const message = { |
||||
|
log_time: moment().toISOString(), |
||||
|
method: method, |
||||
|
content: logAttr ? logAttr.content : '', |
||||
|
parameter: JSON.stringify(parameter) || JSON.stringify(ctx.request.body), |
||||
|
parameter_show: parameterShow, |
||||
|
visible: logAttr ? logAttr.visible : true, |
||||
|
cost: Date.now() - start, |
||||
|
status_code: ctx.status, |
||||
|
url: ctx.request.url, |
||||
|
user_agent: ctx.request.headers["user-agent"], |
||||
|
user_id: user_id, |
||||
|
session: _token, |
||||
|
app_key: app_key, |
||||
|
header: JSON.stringify(ctx.request.headers), |
||||
|
ip: ctx.request.headers["x-real-ip"] || ctx.ip |
||||
|
}; |
||||
|
|
||||
|
const payloads = [{ |
||||
|
topic: `${opts.kafka.topicPrefix}`, |
||||
|
messages: [JSON.stringify(message)], |
||||
|
partition: 0 |
||||
|
}]; |
||||
|
|
||||
|
await sendToEsAsync(producer, payloads); |
||||
|
|
||||
|
} catch (e) { |
||||
|
ctx.fs.logger.error(`日志记录失败: ${e}`); |
||||
|
} |
||||
|
} |
||||
|
return logger; |
||||
|
} |
||||
|
|
||||
|
module.exports = factory; |
@ -0,0 +1,150 @@ |
|||||
|
/** |
||||
|
* Created by PengLing on 2017/3/27. |
||||
|
*/ |
||||
|
'use strict'; |
||||
|
|
||||
|
const pathToRegexp = require('path-to-regexp'); |
||||
|
const util = require('util'); |
||||
|
const moment = require('moment'); |
||||
|
|
||||
|
class ExcludesUrls { |
||||
|
constructor(opts) { |
||||
|
this.allUrls = undefined; |
||||
|
this.reload(opts); |
||||
|
} |
||||
|
|
||||
|
sanitizePath(path) { |
||||
|
if (!path) return '/'; |
||||
|
const p = '/' + path.replace(/^\/+/i, '').replace(/\/+$/, '').replace(/\/{2,}/, '/'); |
||||
|
return p; |
||||
|
} |
||||
|
|
||||
|
reload(opts) { |
||||
|
// load all url
|
||||
|
if (!this.allUrls) { |
||||
|
this.allUrls = opts; |
||||
|
let that = this; |
||||
|
this.allUrls.forEach(function (url, i, arr) { |
||||
|
if (typeof url === "string") { |
||||
|
url = { p: url, o: '*' }; |
||||
|
arr[i] = url; |
||||
|
} |
||||
|
const keys = []; |
||||
|
let eachPath = url.p; |
||||
|
url.p = (!eachPath || eachPath === '(.*)' || util.isRegExp(eachPath)) ? eachPath : that.sanitizePath(eachPath); |
||||
|
url.pregexp = pathToRegexp(eachPath, keys); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
isExcluded(path, method) { |
||||
|
return this.allUrls.some(function (url) { |
||||
|
return !url.auth |
||||
|
&& url.pregexp.test(path) |
||||
|
&& (url.o === '*' || url.o.indexOf(method) !== -1); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 判断Url是否不鉴权 |
||||
|
* @param {*} opts {exclude: [*] or []},'*'或['*']:跳过所有路由; []:所有路由都要验证 |
||||
|
* @param {*} path 当前request的path |
||||
|
* @param {*} method 当前request的method |
||||
|
*/ |
||||
|
let isPathExcluded = function (opts, path, method) { |
||||
|
let excludeAll = Boolean(opts.exclude && opts.exclude.length && opts.exclude[0] == '*'); |
||||
|
let excludes = null; |
||||
|
if (!excludeAll) { |
||||
|
let excludeOpts = opts.exclude || []; |
||||
|
excludeOpts.push({ p: '/login', o: 'POST' }); |
||||
|
excludeOpts.push({ p: '/wxLogin', o: 'POST' }); |
||||
|
excludeOpts.push({ p: '/logout', o: 'PUT' }); |
||||
|
excludeOpts.push({ p: '/wxLogout', o: 'PUT' }); |
||||
|
excludes = new ExcludesUrls(excludeOpts); |
||||
|
} |
||||
|
let excluded = excludeAll || excludes.isExcluded(path, method); |
||||
|
return excluded; |
||||
|
}; |
||||
|
|
||||
|
let authorizeToken = async function (ctx, token) { |
||||
|
let rslt = null; |
||||
|
const tokenFormatRegexp = /^(\{{0,1}([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}\}{0,1})$/g; |
||||
|
if (token && tokenFormatRegexp.test(token)) { |
||||
|
try { |
||||
|
const axyRes = await ctx.fs.dc.models.UserToken.findOne({ |
||||
|
where: { |
||||
|
token: token, |
||||
|
expired: { $gte: moment().format('YYYY-MM-DD HH:mm:ss') } |
||||
|
} |
||||
|
}); |
||||
|
const { userInfo, expired } = axyRes; |
||||
|
if (!expired || moment().valueOf() <= moment(expired).valueOf()) { |
||||
|
rslt = { |
||||
|
'authorized': userInfo.authorized, |
||||
|
'resources': (userInfo || {}).resources || [], |
||||
|
}; |
||||
|
ctx.fs.api.userId = userInfo.id; |
||||
|
ctx.fs.api.userInfo = userInfo; |
||||
|
ctx.fs.api.token = token; |
||||
|
} |
||||
|
} catch (err) { |
||||
|
const { error } = err.response || {}; |
||||
|
ctx.fs.logger.log('[anxinyun]', '[AUTH] failed', (error || {}).message || `cannot GET /users/${token}`); |
||||
|
} |
||||
|
} |
||||
|
return rslt; |
||||
|
}; |
||||
|
|
||||
|
let isResourceAvailable = function (resources, options) { |
||||
|
let authCode = null; |
||||
|
// authorize user by authorization attribute
|
||||
|
const { authAttr, method, path } = options; |
||||
|
console.log(resources, options) |
||||
|
for (let prop in authAttr) { |
||||
|
let keys = []; |
||||
|
let re = pathToRegexp(prop.replace(/\:[A-Za-z_\-]+\b/g, '(\\d+)'), keys); |
||||
|
if (re.test(`${method}${path}`)) { |
||||
|
authCode = authAttr[prop]; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
return !authCode || (resources || []).some(code => code === authCode); |
||||
|
}; |
||||
|
|
||||
|
function factory(app, opts) { |
||||
|
return async function auth(ctx, next) { |
||||
|
const { path, method, header, query } = ctx; |
||||
|
ctx.fs.logger.log('[AUTH] start', path, method); |
||||
|
ctx.fs.api = ctx.fs.api || {}; |
||||
|
ctx.fs.port = opts.port; |
||||
|
ctx.redis = app.redis; |
||||
|
let error = null; |
||||
|
if (path) { |
||||
|
if (!isPathExcluded(opts, path, method)) { |
||||
|
const user = await authorizeToken(ctx, header.token || query.token); |
||||
|
if (user && user.authorized) { |
||||
|
// if (!isResourceAvailable(user.resources, { authAttr: app.fs.auth.authAttr, path, method })) {
|
||||
|
// error = { status: 403, name: 'Forbidden' }
|
||||
|
// } else {
|
||||
|
// error = { status: 401, name: 'Unauthorized' }
|
||||
|
// }
|
||||
|
} else { |
||||
|
error = { status: 401, name: 'Unauthorized' } |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
error = { status: 401, name: 'Unauthorized' }; |
||||
|
} |
||||
|
if (error) { |
||||
|
ctx.fs.logger.log('[AUTH] failed', path, method); |
||||
|
ctx.status = error.status; |
||||
|
ctx.body = error.name; |
||||
|
} else { |
||||
|
ctx.fs.logger.log('[AUTH] passed', path, method); |
||||
|
await next(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
module.exports = factory; |
@ -0,0 +1,50 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
const request = require('superagent'); |
||||
|
const buildUrl = (url,token) => { |
||||
|
let connector = url.indexOf('?') === -1 ? '?' : '&'; |
||||
|
return `${url}${connector}token=${token}`; |
||||
|
}; |
||||
|
|
||||
|
function factory(app, router, opts) { |
||||
|
return async function (ctx, next) { |
||||
|
|
||||
|
const token = ctx.fs.api.token; |
||||
|
|
||||
|
//console.log(username,password)
|
||||
|
const req = { |
||||
|
get: (url, query) => { |
||||
|
return request |
||||
|
.get(buildUrl(url,token)) |
||||
|
.query(query) |
||||
|
}, |
||||
|
post: (url, data, query) => { |
||||
|
return request |
||||
|
.post(buildUrl(url,token)) |
||||
|
.query(query) |
||||
|
//.set('Content-Type', 'application/json')
|
||||
|
.send(data); |
||||
|
}, |
||||
|
|
||||
|
put: (url, data) => { |
||||
|
return request |
||||
|
.put(buildUrl(url,token)) |
||||
|
//.set('Content-Type', 'application/json')
|
||||
|
.send(data); |
||||
|
}, |
||||
|
|
||||
|
delete: (url) => { |
||||
|
return request |
||||
|
.del(buildUrl(url,token)) |
||||
|
}, |
||||
|
}; |
||||
|
|
||||
|
app.business = app.business || {}; |
||||
|
app.business.request = req; |
||||
|
|
||||
|
await next(); |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
module.exports = factory; |
||||
|
|
@ -0,0 +1,57 @@ |
|||||
|
/* eslint-disable*/ |
||||
|
'use strict'; |
||||
|
|
||||
|
module.exports = dc => { |
||||
|
const DataTypes = dc.ORM; |
||||
|
const sequelize = dc.orm; |
||||
|
const Department = sequelize.define("department", { |
||||
|
id: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: true, |
||||
|
field: "id", |
||||
|
autoIncrement: true, |
||||
|
unique: "department_id_uindex" |
||||
|
}, |
||||
|
name: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "name", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
dependence: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: "上级部门/从属", |
||||
|
primaryKey: false, |
||||
|
field: "dependence", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
type: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: "市1,区县2,乡镇3,村4", |
||||
|
primaryKey: false, |
||||
|
field: "type", |
||||
|
autoIncrement: false |
||||
|
} |
||||
|
}, { |
||||
|
tableName: "department", |
||||
|
comment: "", |
||||
|
indexes: [] |
||||
|
}); |
||||
|
dc.models.Department = Department; |
||||
|
|
||||
|
const User = dc.models.User; |
||||
|
User.belongsTo(Department, { foreignKey: 'departmentId', targetKey: 'id' }); |
||||
|
Department.hasMany(User, { foreignKey: 'departmentId', sourceKey: 'id' }); |
||||
|
|
||||
|
return Department; |
||||
|
}; |
@ -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,108 @@ |
|||||
|
/* eslint-disable*/ |
||||
|
'use strict'; |
||||
|
|
||||
|
module.exports = dc => { |
||||
|
const DataTypes = dc.ORM; |
||||
|
const sequelize = dc.orm; |
||||
|
const User = sequelize.define("user", { |
||||
|
id: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: true, |
||||
|
field: "id", |
||||
|
autoIncrement: true, |
||||
|
unique: "user_id_uindex" |
||||
|
}, |
||||
|
name: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "name", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
username: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: "用户名 账号", |
||||
|
primaryKey: false, |
||||
|
field: "username", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
password: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "password", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
departmentId: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: "部门id", |
||||
|
primaryKey: false, |
||||
|
field: "department_id", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
email: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "email", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
enable: { |
||||
|
type: DataTypes.BOOLEAN, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: "启用状态", |
||||
|
primaryKey: false, |
||||
|
field: "enable", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
delete: { |
||||
|
type: DataTypes.BOOLEAN, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "delete", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
phone: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: "手机号(小程序使用手机号登录)", |
||||
|
primaryKey: false, |
||||
|
field: "phone", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
post: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: "职位", |
||||
|
primaryKey: false, |
||||
|
field: "post", |
||||
|
autoIncrement: false |
||||
|
} |
||||
|
}, { |
||||
|
tableName: "user", |
||||
|
comment: "", |
||||
|
indexes: [] |
||||
|
}); |
||||
|
dc.models.User = User; |
||||
|
|
||||
|
|
||||
|
return User; |
||||
|
}; |
@ -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,43 @@ |
|||||
|
/* eslint-disable*/ |
||||
|
'use strict'; |
||||
|
|
||||
|
module.exports = dc => { |
||||
|
const DataTypes = dc.ORM; |
||||
|
const sequelize = dc.orm; |
||||
|
const UserToken = sequelize.define("userToken", { |
||||
|
token: { |
||||
|
type: DataTypes.UUIDV4, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: true, |
||||
|
field: "token", |
||||
|
autoIncrement: false, |
||||
|
unique: "user_token_token_uindex" |
||||
|
}, |
||||
|
userInfo: { |
||||
|
type: DataTypes.JSONB, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "user_info", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
expired: { |
||||
|
type: DataTypes.DATE, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "expired", |
||||
|
autoIncrement: false |
||||
|
} |
||||
|
}, { |
||||
|
tableName: "user_token", |
||||
|
comment: "", |
||||
|
indexes: [] |
||||
|
}); |
||||
|
dc.models.UserToken = UserToken; |
||||
|
return UserToken; |
||||
|
}; |
@ -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,32 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
const auth = require('../../controllers/auth'); |
||||
|
|
||||
|
module.exports = function (app, router, opts) { |
||||
|
/** |
||||
|
* @api {Post} login 登录. |
||||
|
* @apiVersion 1.0.0 |
||||
|
* @apiGroup Auth |
||||
|
*/ |
||||
|
app.fs.api.logAttr['POST/login'] = { content: '登录', visible: true }; |
||||
|
router.post('/login', auth.login); |
||||
|
|
||||
|
/** |
||||
|
* @api {POST} wxLogin 微信小程序登录.(使用手机号、密码登录) |
||||
|
* @apiVersion 1.0.0 |
||||
|
* @apiGroup Auth |
||||
|
*/ |
||||
|
app.fs.api.logAttr['POST/wxLogin'] = { content: '微信小程序登录', visible: true }; |
||||
|
router.post('/wxLogin', auth.wxLogin); |
||||
|
|
||||
|
app.fs.api.logAttr['PUT/logout'] = { content: '登出', visible: false }; |
||||
|
router.put('/logout', auth.logout); |
||||
|
|
||||
|
/** |
||||
|
* @api {PUT} wxLogout 微信小程序登出 |
||||
|
* @apiVersion 1.0.0 |
||||
|
* @apiGroup Auth |
||||
|
*/ |
||||
|
app.fs.api.logAttr['PUT/wxLogout'] = { content: '登出', visible: false }; |
||||
|
router.put('/wxLogout', auth.wxLogout); |
||||
|
}; |
@ -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,17 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
const path = require('path'); |
||||
|
const fs = require('fs'); |
||||
|
|
||||
|
module.exports = function (app, router, opts) { |
||||
|
fs.readdirSync(__dirname).forEach((filename) => { |
||||
|
if (filename.indexOf('.') !== 0 &&fs.lstatSync(path.join(__dirname, filename)).isDirectory()) { |
||||
|
fs.readdirSync(path.join(__dirname, filename)).forEach((api) => { |
||||
|
if (api.indexOf('.') == 0 || api.indexOf('.js') == -1) return; |
||||
|
require(`./${filename}/${api}`)(app, router, opts); |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
return router; |
||||
|
}; |
@ -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); |
||||
|
} |
@ -0,0 +1,103 @@ |
|||||
|
'use strict'; |
||||
|
/*jslint node:true*/ |
||||
|
const path = require('path'); |
||||
|
const os = require('os'); |
||||
|
const moment = require('moment'); |
||||
|
const args = require('args'); |
||||
|
|
||||
|
const dev = process.env.NODE_ENV == 'development'; |
||||
|
|
||||
|
// 启动参数
|
||||
|
args.option(['p', 'port'], '启动端口'); |
||||
|
args.option(['g', 'pg'], 'postgre服务URL'); |
||||
|
args.option(['f', 'fileHost'], '文件中心本地化存储: WebApi 服务器地址(必填), 该服务器提供文件上传Web服务'); |
||||
|
|
||||
|
const flags = args.parse(process.argv); |
||||
|
|
||||
|
const FS_UNIAPP_DB = process.env.FS_UNIAPP_DB || flags.pg; |
||||
|
const FS_UNIAPP_FC_LOCAL_SVR_ORIGIN = process.env.FS_UNIAPP_FC_LOCAL_SVR_ORIGIN || flags.fileHost; |
||||
|
|
||||
|
if (!FS_UNIAPP_DB) { |
||||
|
console.log('缺少启动参数,异常退出'); |
||||
|
args.showHelp(); |
||||
|
process.exit(-1); |
||||
|
} |
||||
|
|
||||
|
const product = { |
||||
|
port: flags.port || 8080, |
||||
|
staticDirs: ['static'], |
||||
|
mws: [ |
||||
|
{ |
||||
|
entry: require('@fs/attachment').entry, |
||||
|
opts: { |
||||
|
local: { |
||||
|
origin: FS_UNIAPP_FC_LOCAL_SVR_ORIGIN || `http://localhost:${flags.port || 8080}`, |
||||
|
rootPath: 'static', |
||||
|
childPath: 'upload', |
||||
|
}, |
||||
|
maxSize: 104857600, // 100M
|
||||
|
} |
||||
|
}, { |
||||
|
entry: require('./app').entry, |
||||
|
opts: { |
||||
|
exclude: [], // 不做认证的路由,也可以使用 exclude: ["*"] 跳过所有路由
|
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
dc: { |
||||
|
url: FS_UNIAPP_DB, |
||||
|
opts: { |
||||
|
pool: { |
||||
|
max: 80, |
||||
|
min: 10, |
||||
|
idle: 10000 |
||||
|
}, |
||||
|
define: { |
||||
|
freezeTableName: true, // 固定表名
|
||||
|
timestamps: false // 不含列 "createAt"/"updateAt"/"DeleteAt"
|
||||
|
}, |
||||
|
timezone: '+08:00', |
||||
|
logging: false |
||||
|
}, |
||||
|
models: [require('./app').models] |
||||
|
}, |
||||
|
logger: { |
||||
|
level: 'info', |
||||
|
json: false, |
||||
|
filename: path.join(__dirname, 'log', 'runtime.log'), |
||||
|
colorize: false, |
||||
|
maxsize: 1024 * 1024 * 5, |
||||
|
rotationFormat: false, |
||||
|
zippedArchive: true, |
||||
|
maxFiles: 10, |
||||
|
prettyPrint: true, |
||||
|
label: '', |
||||
|
timestamp: () => moment().format('YYYY-MM-DD HH:mm:ss.SSS'), |
||||
|
eol: os.EOL, |
||||
|
tailable: true, |
||||
|
depth: null, |
||||
|
showLevel: true, |
||||
|
maxRetries: 1 |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const development = { |
||||
|
port: product.port, |
||||
|
staticDirs: product.staticDirs, |
||||
|
mws: product.mws, |
||||
|
dc: product.dc, |
||||
|
logger: product.logger |
||||
|
}; |
||||
|
|
||||
|
if (dev) { |
||||
|
// mws
|
||||
|
for (let mw of development.mws) { |
||||
|
// if (mw.opts.exclude) mw.opts.exclude = ['*']; // 使用 ['*'] 跳过所有路由
|
||||
|
} |
||||
|
// logger
|
||||
|
development.logger.filename = path.join(__dirname, 'log', 'development.log'); |
||||
|
development.logger.level = 'debug'; |
||||
|
development.dc.opts.logging = console.log; |
||||
|
} |
||||
|
|
||||
|
module.exports = dev ? development : product; |
@ -0,0 +1,44 @@ |
|||||
|
{ |
||||
|
"name": "smart-emergency", |
||||
|
"version": "1.0.0", |
||||
|
"description": "fs smart emergency api", |
||||
|
"main": "server.js", |
||||
|
"scripts": { |
||||
|
"test": "set DEBUG=true&&\"node_modules/.bin/mocha\" --harmony --reporter spec app/test/*.test.js", |
||||
|
"start": "set NODE_ENV=development&&node server -p 14000 -g postgres://postgres:123@10.8.30.32:5432/yinjiguanli -f http://localhost:14000", |
||||
|
"start:linux": "export NODE_ENV=development&&node server -p 4000 -g postgres://FashionAdmin:123456@10.8.30.39:5432/pm1", |
||||
|
"automate": "sequelize-automate -c sequelize-automate.config.js" |
||||
|
}, |
||||
|
"author": "", |
||||
|
"license": "MIT", |
||||
|
"repository": {}, |
||||
|
"dependencies": { |
||||
|
"@fs/attachment": "^1.0.0", |
||||
|
"archiver": "3.0.0", |
||||
|
"args": "^3.0.7", |
||||
|
"async-busboy": "^0.7.0", |
||||
|
"crypto-js": "^4.0.0", |
||||
|
"file-saver": "^2.0.2", |
||||
|
"fs-web-server-scaffold": "^2.0.2", |
||||
|
"ioredis": "^4.19.4", |
||||
|
"kafka-node": "^2.2.3", |
||||
|
"koa-convert": "^1.2.0", |
||||
|
"koa-proxy": "^0.9.0", |
||||
|
"md5-node": "^1.0.1", |
||||
|
"moment": "^2.24.0", |
||||
|
"path": "^0.12.7", |
||||
|
"path-to-regexp": "^3.0.0", |
||||
|
"pg": "^7.9.0", |
||||
|
"redis": "^3.1.2", |
||||
|
"request": "^2.88.2", |
||||
|
"rimraf": "^3.0.2", |
||||
|
"superagent": "^3.5.2", |
||||
|
"uuid": "^3.3.2", |
||||
|
"xlsx": "^0.16.9", |
||||
|
"koa2-swagger-ui": "^5.3.0", |
||||
|
"swagger-jsdoc": "^6.1.0" |
||||
|
}, |
||||
|
"devDependencies": { |
||||
|
"mocha": "^6.0.2" |
||||
|
} |
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
module.exports = { |
||||
|
// 数据库配置 与 sequelize 相同
|
||||
|
dbOptions: { |
||||
|
database: 'yinjiguanli', |
||||
|
username: 'postgres', |
||||
|
password: '123', |
||||
|
dialect: 'postgres', |
||||
|
host: '10.8.30.32', |
||||
|
port: 5432, |
||||
|
define: { |
||||
|
underscored: false, |
||||
|
freezeTableName: false, |
||||
|
charset: 'utf8mb4', |
||||
|
timezone: '+00: 00', |
||||
|
dialectOptions: { |
||||
|
collate: 'utf8_general_ci', |
||||
|
}, |
||||
|
timestamps: false, |
||||
|
}, |
||||
|
}, |
||||
|
options: { |
||||
|
type: 'freesun', // 指定 models 代码风格
|
||||
|
camelCase: true, // Models 文件中代码是否使用驼峰命名
|
||||
|
modalNameSuffix: false, // 模型名称是否带 ‘Model’ 后缀
|
||||
|
fileNameCamelCase: false, // Model 文件名是否使用驼峰法命名,默认文件名会使用表名,如 `user_post.js`;如果为 true,则文件名为 `userPost.js`
|
||||
|
dir: './app/lib/models', // 指定输出 models 文件的目录
|
||||
|
typesDir: 'models', // 指定输出 TypeScript 类型定义的文件目录,只有 TypeScript / Midway 等会有类型定义
|
||||
|
emptyDir: false, // !!! 谨慎操作 生成 models 之前是否清空 `dir` 以及 `typesDir`
|
||||
|
tables: ['user_placeSecurityRecord', 'places'], // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性
|
||||
|
skipTables: ['user'], // 指定跳过哪些表的 models,如 ['user'];如果为 null,则忽略改属性
|
||||
|
tsNoCheck: false, // 是否添加 `@ts-nocheck` 注释到 models 文件中
|
||||
|
ignorePrefix: [], // 生成的模型名称忽略的前缀,因为 项目中有以下表名是以 t_ 开头的,在实际模型中不需要, 可以添加多个 [ 't_data_', 't_',] ,长度较长的 前缀放前面
|
||||
|
attrLength: false, // 在生成模型的字段中 是否生成 如 var(128)这种格式,公司一般使用 String ,则配置为 false
|
||||
|
}, |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
/** |
||||
|
* Created by rain on 2016/1/25. |
||||
|
*/ |
||||
|
|
||||
|
'use strict'; |
||||
|
/*jslint node:true*/ |
||||
|
//from koa
|
||||
|
|
||||
|
const scaffold = require('fs-web-server-scaffold'); |
||||
|
const config = require('./config'); |
||||
|
|
||||
|
module.exports = scaffold(config); |
@ -0,0 +1,15 @@ |
|||||
|
'use strict'; |
||||
|
const proxy = require('koa-proxy'); |
||||
|
const convert = require('koa-convert'); |
||||
|
|
||||
|
module.exports = { |
||||
|
entry: function (app, router, opts) { |
||||
|
app.use(convert(proxy({ |
||||
|
host: opts.host, |
||||
|
match: opts.match, |
||||
|
map: function (path) { |
||||
|
return path.replace(opts.match, ''); |
||||
|
} |
||||
|
}))); |
||||
|
} |
||||
|
}; |
@ -0,0 +1,19 @@ |
|||||
|
{ |
||||
|
"presets": [ |
||||
|
"@babel/preset-react", |
||||
|
"@babel/preset-env" |
||||
|
|
||||
|
], |
||||
|
"plugins": [ |
||||
|
"@babel/plugin-proposal-class-properties", |
||||
|
"@babel/plugin-proposal-object-rest-spread", |
||||
|
["import", { |
||||
|
"libraryName": "antd", |
||||
|
"libraryDirectory": "es" |
||||
|
|
||||
|
}] |
||||
|
], |
||||
|
"env": { |
||||
|
"development": {} |
||||
|
} |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
|
||||
|
FROM repository.anxinyun.cn/base-images/nodejs12:20.10.12.2 |
||||
|
|
||||
|
COPY . /var/app |
||||
|
|
||||
|
WORKDIR /var/app |
||||
|
|
||||
|
EXPOSE 8080 |
||||
|
|
||||
|
CMD ["-u", "http://localhost:8088"] |
||||
|
|
||||
|
ENTRYPOINT [ "node", "server.js" ] |
@ -0,0 +1,370 @@ |
|||||
|
*{margin: 0;padding: 0;list-style: none;} |
||||
|
/* |
||||
|
KISSY CSS Reset |
||||
|
理念:1. reset 的目的不是清除浏览器的默认样式,这仅是部分工作。清除和重置是紧密不可分的。 |
||||
|
2. reset 的目的不是让默认样式在所有浏览器下一致,而是减少默认样式有可能带来的问题。 |
||||
|
3. reset 期望提供一套普适通用的基础样式。但没有银弹,推荐根据具体需求,裁剪和修改后再使用。 |
||||
|
特色:1. 适应中文;2. 基于最新主流浏览器。 |
||||
|
维护:玉伯<lifesinger@gmail.com>, 正淳<ragecarrier@gmail.com> |
||||
|
*/ |
||||
|
|
||||
|
/** 清除内外边距 **/ |
||||
|
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, /* structural elements 结构元素 */ |
||||
|
dl, dt, dd, ul, ol, li, /* list elements 列表元素 */ |
||||
|
pre, /* text formatting elements 文本格式元素 */ |
||||
|
form, fieldset, legend, button, input, textarea, /* form elements 表单元素 */ |
||||
|
th, td /* table elements 表格元素 */ { |
||||
|
margin: 0; |
||||
|
padding: 0; |
||||
|
} |
||||
|
|
||||
|
/** 设置默认字体 **/ |
||||
|
body, |
||||
|
button, input, select, textarea /* for ie */ { |
||||
|
font: 12px/1.5 tahoma, arial, \5b8b\4f53, sans-serif; |
||||
|
} |
||||
|
h1, h2, h3, h4, h5, h6 { font-size: 100%; } |
||||
|
address, cite, dfn, em, var { font-style: normal; } /* 将斜体扶正 */ |
||||
|
code, kbd, pre, samp { font-family: courier new, courier, monospace; } /* 统一等宽字体 */ |
||||
|
small { font-size: 12px; } /* 小于 12px 的中文很难阅读,让 small 正常化 */ |
||||
|
|
||||
|
/** 重置列表元素 **/ |
||||
|
ul, ol { list-style: none; } |
||||
|
|
||||
|
/** 重置文本格式元素 **/ |
||||
|
a { text-decoration: none; } |
||||
|
a:hover { text-decoration: underline; } |
||||
|
|
||||
|
|
||||
|
/** 重置表单元素 **/ |
||||
|
legend { color: #000; } /* for ie6 */ |
||||
|
fieldset, img { border: 0; } /* img 搭车:让链接里的 img 无边框 */ |
||||
|
button, input, select, textarea { font-size: 100%; } /* 使得表单元素在 ie 下能继承字体大小 */ |
||||
|
/* 注:optgroup 无法扶正 */ |
||||
|
|
||||
|
/** 重置表格元素 **/ |
||||
|
table { border-collapse: collapse; border-spacing: 0; } |
||||
|
|
||||
|
/* 清除浮动 */ |
||||
|
.ks-clear:after, .clear:after { |
||||
|
content: '\20'; |
||||
|
display: block; |
||||
|
height: 0; |
||||
|
clear: both; |
||||
|
} |
||||
|
.ks-clear, .clear { |
||||
|
*zoom: 1; |
||||
|
} |
||||
|
|
||||
|
.main { |
||||
|
padding: 30px 100px; |
||||
|
width: 960px; |
||||
|
margin: 0 auto; |
||||
|
} |
||||
|
.main h1{font-size:36px; color:#333; text-align:left;margin-bottom:30px; border-bottom: 1px solid #eee;} |
||||
|
|
||||
|
.helps{margin-top:40px;} |
||||
|
.helps pre{ |
||||
|
padding:20px; |
||||
|
margin:10px 0; |
||||
|
border:solid 1px #e7e1cd; |
||||
|
background-color: #fffdef; |
||||
|
overflow: auto; |
||||
|
} |
||||
|
|
||||
|
.icon_lists{ |
||||
|
width: 100% !important; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.icon_lists li{ |
||||
|
float:left; |
||||
|
width: 100px; |
||||
|
height:180px; |
||||
|
text-align: center; |
||||
|
list-style: none !important; |
||||
|
} |
||||
|
.icon_lists .icon{ |
||||
|
font-size: 42px; |
||||
|
line-height: 100px; |
||||
|
margin: 10px 0; |
||||
|
color:#333; |
||||
|
-webkit-transition: font-size 0.25s ease-out 0s; |
||||
|
-moz-transition: font-size 0.25s ease-out 0s; |
||||
|
transition: font-size 0.25s ease-out 0s; |
||||
|
|
||||
|
} |
||||
|
.icon_lists .icon:hover{ |
||||
|
font-size: 100px; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
.markdown { |
||||
|
color: #666; |
||||
|
font-size: 14px; |
||||
|
line-height: 1.8; |
||||
|
} |
||||
|
|
||||
|
.highlight { |
||||
|
line-height: 1.5; |
||||
|
} |
||||
|
|
||||
|
.markdown img { |
||||
|
vertical-align: middle; |
||||
|
max-width: 100%; |
||||
|
} |
||||
|
|
||||
|
.markdown h1 { |
||||
|
color: #404040; |
||||
|
font-weight: 500; |
||||
|
line-height: 40px; |
||||
|
margin-bottom: 24px; |
||||
|
} |
||||
|
|
||||
|
.markdown h2, |
||||
|
.markdown h3, |
||||
|
.markdown h4, |
||||
|
.markdown h5, |
||||
|
.markdown h6 { |
||||
|
color: #404040; |
||||
|
margin: 1.6em 0 0.6em 0; |
||||
|
font-weight: 500; |
||||
|
clear: both; |
||||
|
} |
||||
|
|
||||
|
.markdown h1 { |
||||
|
font-size: 28px; |
||||
|
} |
||||
|
|
||||
|
.markdown h2 { |
||||
|
font-size: 22px; |
||||
|
} |
||||
|
|
||||
|
.markdown h3 { |
||||
|
font-size: 16px; |
||||
|
} |
||||
|
|
||||
|
.markdown h4 { |
||||
|
font-size: 14px; |
||||
|
} |
||||
|
|
||||
|
.markdown h5 { |
||||
|
font-size: 12px; |
||||
|
} |
||||
|
|
||||
|
.markdown h6 { |
||||
|
font-size: 12px; |
||||
|
} |
||||
|
|
||||
|
.markdown hr { |
||||
|
height: 1px; |
||||
|
border: 0; |
||||
|
background: #e9e9e9; |
||||
|
margin: 16px 0; |
||||
|
clear: both; |
||||
|
} |
||||
|
|
||||
|
.markdown p, |
||||
|
.markdown pre { |
||||
|
margin: 1em 0; |
||||
|
} |
||||
|
|
||||
|
.markdown > p, |
||||
|
.markdown > blockquote, |
||||
|
.markdown > .highlight, |
||||
|
.markdown > ol, |
||||
|
.markdown > ul { |
||||
|
width: 80%; |
||||
|
} |
||||
|
|
||||
|
.markdown ul > li { |
||||
|
list-style: circle; |
||||
|
} |
||||
|
|
||||
|
.markdown > ul li, |
||||
|
.markdown blockquote ul > li { |
||||
|
margin-left: 20px; |
||||
|
padding-left: 4px; |
||||
|
} |
||||
|
|
||||
|
.markdown > ul li p, |
||||
|
.markdown > ol li p { |
||||
|
margin: 0.6em 0; |
||||
|
} |
||||
|
|
||||
|
.markdown ol > li { |
||||
|
list-style: decimal; |
||||
|
} |
||||
|
|
||||
|
.markdown > ol li, |
||||
|
.markdown blockquote ol > li { |
||||
|
margin-left: 20px; |
||||
|
padding-left: 4px; |
||||
|
} |
||||
|
|
||||
|
.markdown code { |
||||
|
margin: 0 3px; |
||||
|
padding: 0 5px; |
||||
|
background: #eee; |
||||
|
border-radius: 3px; |
||||
|
} |
||||
|
|
||||
|
.markdown pre { |
||||
|
border-radius: 6px; |
||||
|
background: #f7f7f7; |
||||
|
padding: 20px; |
||||
|
} |
||||
|
|
||||
|
.markdown pre code { |
||||
|
border: none; |
||||
|
background: #f7f7f7; |
||||
|
margin: 0; |
||||
|
} |
||||
|
|
||||
|
.markdown strong, |
||||
|
.markdown b { |
||||
|
font-weight: 600; |
||||
|
} |
||||
|
|
||||
|
.markdown > table { |
||||
|
border-collapse: collapse; |
||||
|
border-spacing: 0px; |
||||
|
empty-cells: show; |
||||
|
border: 1px solid #e9e9e9; |
||||
|
width: 95%; |
||||
|
margin-bottom: 24px; |
||||
|
} |
||||
|
|
||||
|
.markdown > table th { |
||||
|
white-space: nowrap; |
||||
|
color: #333; |
||||
|
font-weight: 600; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.markdown > table th, |
||||
|
.markdown > table td { |
||||
|
border: 1px solid #e9e9e9; |
||||
|
padding: 8px 16px; |
||||
|
text-align: left; |
||||
|
} |
||||
|
|
||||
|
.markdown > table th { |
||||
|
background: #F7F7F7; |
||||
|
} |
||||
|
|
||||
|
.markdown blockquote { |
||||
|
font-size: 90%; |
||||
|
color: #999; |
||||
|
border-left: 4px solid #e9e9e9; |
||||
|
padding-left: 0.8em; |
||||
|
margin: 1em 0; |
||||
|
font-style: italic; |
||||
|
} |
||||
|
|
||||
|
.markdown blockquote p { |
||||
|
margin: 0; |
||||
|
} |
||||
|
|
||||
|
.markdown .anchor { |
||||
|
opacity: 0; |
||||
|
transition: opacity 0.3s ease; |
||||
|
margin-left: 8px; |
||||
|
} |
||||
|
|
||||
|
.markdown .waiting { |
||||
|
color: #ccc; |
||||
|
} |
||||
|
|
||||
|
.markdown h1:hover .anchor, |
||||
|
.markdown h2:hover .anchor, |
||||
|
.markdown h3:hover .anchor, |
||||
|
.markdown h4:hover .anchor, |
||||
|
.markdown h5:hover .anchor, |
||||
|
.markdown h6:hover .anchor { |
||||
|
opacity: 1; |
||||
|
display: inline-block; |
||||
|
} |
||||
|
|
||||
|
.markdown > br, |
||||
|
.markdown > p > br { |
||||
|
clear: both; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
.hljs { |
||||
|
display: block; |
||||
|
background: white; |
||||
|
padding: 0.5em; |
||||
|
color: #333333; |
||||
|
overflow-x: auto; |
||||
|
} |
||||
|
|
||||
|
.hljs-comment, |
||||
|
.hljs-meta { |
||||
|
color: #969896; |
||||
|
} |
||||
|
|
||||
|
.hljs-string, |
||||
|
.hljs-variable, |
||||
|
.hljs-template-variable, |
||||
|
.hljs-strong, |
||||
|
.hljs-emphasis, |
||||
|
.hljs-quote { |
||||
|
color: #df5000; |
||||
|
} |
||||
|
|
||||
|
.hljs-keyword, |
||||
|
.hljs-selector-tag, |
||||
|
.hljs-type { |
||||
|
color: #a71d5d; |
||||
|
} |
||||
|
|
||||
|
.hljs-literal, |
||||
|
.hljs-symbol, |
||||
|
.hljs-bullet, |
||||
|
.hljs-attribute { |
||||
|
color: #0086b3; |
||||
|
} |
||||
|
|
||||
|
.hljs-section, |
||||
|
.hljs-name { |
||||
|
color: #63a35c; |
||||
|
} |
||||
|
|
||||
|
.hljs-tag { |
||||
|
color: #333333; |
||||
|
} |
||||
|
|
||||
|
.hljs-title, |
||||
|
.hljs-attr, |
||||
|
.hljs-selector-id, |
||||
|
.hljs-selector-class, |
||||
|
.hljs-selector-attr, |
||||
|
.hljs-selector-pseudo { |
||||
|
color: #795da3; |
||||
|
} |
||||
|
|
||||
|
.hljs-addition { |
||||
|
color: #55a532; |
||||
|
background-color: #eaffea; |
||||
|
} |
||||
|
|
||||
|
.hljs-deletion { |
||||
|
color: #bd2c00; |
||||
|
background-color: #ffecec; |
||||
|
} |
||||
|
|
||||
|
.hljs-link { |
||||
|
text-decoration: underline; |
||||
|
} |
||||
|
|
||||
|
pre{ |
||||
|
background: #fff; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
@ -0,0 +1,514 @@ |
|||||
|
|
||||
|
<!DOCTYPE html> |
||||
|
<html> |
||||
|
<head> |
||||
|
<meta charset="utf-8"/> |
||||
|
<title>IconFont</title> |
||||
|
<link rel="stylesheet" href="demo.css"> |
||||
|
<link rel="stylesheet" href="iconfont.css"> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div class="main markdown"> |
||||
|
<h1>IconFont 图标</h1> |
||||
|
<ul class="icon_lists clear"> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-liuliang"></i> |
||||
|
<div class="name">流量</div> |
||||
|
<div class="fontclass">.icon-liuliang</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-iconfontditie"></i> |
||||
|
<div class="name">轻轨</div> |
||||
|
<div class="fontclass">.icon-iconfontditie</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-fengsu3"></i> |
||||
|
<div class="name">风速3</div> |
||||
|
<div class="fontclass">.icon-fengsu3</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-calendar"></i> |
||||
|
<div class="name">calendar</div> |
||||
|
<div class="fontclass">.icon-calendar</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-box"></i> |
||||
|
<div class="name">box</div> |
||||
|
<div class="fontclass">.icon-box</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-shenheshibai"></i> |
||||
|
<div class="name">审核失败</div> |
||||
|
<div class="fontclass">.icon-shenheshibai</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-slope"></i> |
||||
|
<div class="name">边坡</div> |
||||
|
<div class="fontclass">.icon-slope</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-icon2"></i> |
||||
|
<div class="name">公路</div> |
||||
|
<div class="fontclass">.icon-icon2</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-gnsscaidian"></i> |
||||
|
<div class="name">GNSS采点</div> |
||||
|
<div class="fontclass">.icon-gnsscaidian</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-chuanganqishebei"></i> |
||||
|
<div class="name">传感器设备</div> |
||||
|
<div class="fontclass">.icon-chuanganqishebei</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-dianliuchuanganqi"></i> |
||||
|
<div class="name">电流传感器</div> |
||||
|
<div class="fontclass">.icon-dianliuchuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-dianyachuanganqi"></i> |
||||
|
<div class="name">电压传感器</div> |
||||
|
<div class="fontclass">.icon-dianyachuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-wenduchuanganqi"></i> |
||||
|
<div class="name">温度传感器</div> |
||||
|
<div class="fontclass">.icon-wenduchuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-xinjian"></i> |
||||
|
<div class="name">新建</div> |
||||
|
<div class="fontclass">.icon-xinjian</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-handong"></i> |
||||
|
<div class="name">涵洞</div> |
||||
|
<div class="fontclass">.icon-handong</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-guanwanggongcheng"></i> |
||||
|
<div class="name">管网工程</div> |
||||
|
<div class="fontclass">.icon-guanwanggongcheng</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-shenhe"></i> |
||||
|
<div class="name">审核</div> |
||||
|
<div class="fontclass">.icon-shenhe</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-zhihuishequ"></i> |
||||
|
<div class="name">智慧城市</div> |
||||
|
<div class="fontclass">.icon-zhihuishequ</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-bianpoweiyi"></i> |
||||
|
<div class="name">边坡位移</div> |
||||
|
<div class="fontclass">.icon-bianpoweiyi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-jianzhu"></i> |
||||
|
<div class="name">建筑</div> |
||||
|
<div class="fontclass">.icon-jianzhu</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-chuguan"></i> |
||||
|
<div class="name">储罐</div> |
||||
|
<div class="fontclass">.icon-chuguan</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-suidao"></i> |
||||
|
<div class="name">隧道</div> |
||||
|
<div class="fontclass">.icon-suidao</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-data"></i> |
||||
|
<div class="name">data</div> |
||||
|
<div class="fontclass">.icon-data</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-kuangshankaicai"></i> |
||||
|
<div class="name">矿山开采</div> |
||||
|
<div class="fontclass">.icon-kuangshankaicai</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-wangluo"></i> |
||||
|
<div class="name">网络</div> |
||||
|
<div class="fontclass">.icon-wangluo</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-jiankong"></i> |
||||
|
<div class="name">监控</div> |
||||
|
<div class="fontclass">.icon-jiankong</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-dashuju"></i> |
||||
|
<div class="name">大数据</div> |
||||
|
<div class="fontclass">.icon-dashuju</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-shuju"></i> |
||||
|
<div class="name">数据库</div> |
||||
|
<div class="fontclass">.icon-shuju</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-shenhechenggong"></i> |
||||
|
<div class="name">审核成功</div> |
||||
|
<div class="fontclass">.icon-shenhechenggong</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-jiankong1"></i> |
||||
|
<div class="name">监控</div> |
||||
|
<div class="fontclass">.icon-jiankong1</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-wangluoxitong"></i> |
||||
|
<div class="name">网络系统</div> |
||||
|
<div class="fontclass">.icon-wangluoxitong</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-dingwei"></i> |
||||
|
<div class="name">定位</div> |
||||
|
<div class="fontclass">.icon-dingwei</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-xitongyunzhuanqingkuang"></i> |
||||
|
<div class="name">系统运转情况</div> |
||||
|
<div class="fontclass">.icon-xitongyunzhuanqingkuang</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-chakan"></i> |
||||
|
<div class="name">查看</div> |
||||
|
<div class="fontclass">.icon-chakan</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-lianjie"></i> |
||||
|
<div class="name">链接</div> |
||||
|
<div class="fontclass">.icon-lianjie</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-shujudaochu-01"></i> |
||||
|
<div class="name">数据导出-01</div> |
||||
|
<div class="fontclass">.icon-shujudaochu-01</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-xitongzhuangtai"></i> |
||||
|
<div class="name">系统状态</div> |
||||
|
<div class="fontclass">.icon-xitongzhuangtai</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-xiaofeimingxidan"></i> |
||||
|
<div class="name">消费明细单</div> |
||||
|
<div class="fontclass">.icon-xiaofeimingxidan</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-SQLshenhe"></i> |
||||
|
<div class="name">SQL审核</div> |
||||
|
<div class="fontclass">.icon-SQLshenhe</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-aislogo"></i> |
||||
|
<div class="name">aislogo</div> |
||||
|
<div class="fontclass">.icon-aislogo</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-qiao"></i> |
||||
|
<div class="name">桥</div> |
||||
|
<div class="fontclass">.icon-qiao</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-tashiqizhongji"></i> |
||||
|
<div class="name">塔式起重机</div> |
||||
|
<div class="fontclass">.icon-tashiqizhongji</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-dwggeshi"></i> |
||||
|
<div class="name">dwg格式</div> |
||||
|
<div class="fontclass">.icon-dwggeshi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-luyouqi"></i> |
||||
|
<div class="name">路由器</div> |
||||
|
<div class="fontclass">.icon-luyouqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-anzhuangshigong-xianxing"></i> |
||||
|
<div class="name">244安装、施工-线性</div> |
||||
|
<div class="fontclass">.icon-anzhuangshigong-xianxing</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-shaixuanguolv"></i> |
||||
|
<div class="name">245筛选过滤</div> |
||||
|
<div class="fontclass">.icon-shaixuanguolv</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-anzhuangshigong"></i> |
||||
|
<div class="name">244安装、施工</div> |
||||
|
<div class="fontclass">.icon-anzhuangshigong</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-tiaoxingtu-xianxing"></i> |
||||
|
<div class="name">408条形图-线性</div> |
||||
|
<div class="fontclass">.icon-tiaoxingtu-xianxing</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-zhexiantu-xianxing"></i> |
||||
|
<div class="name">409折线图-线性</div> |
||||
|
<div class="fontclass">.icon-zhexiantu-xianxing</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-tieta"></i> |
||||
|
<div class="name">铁塔</div> |
||||
|
<div class="fontclass">.icon-tieta</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-geshi_wendangtxt"></i> |
||||
|
<div class="name">800格式_文档txt</div> |
||||
|
<div class="fontclass">.icon-geshi_wendangtxt</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-geshi_wendangdoc"></i> |
||||
|
<div class="name">801格式_文档doc</div> |
||||
|
<div class="fontclass">.icon-geshi_wendangdoc</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-geshi_wendangpdf"></i> |
||||
|
<div class="name">807格式_文档pdf</div> |
||||
|
<div class="fontclass">.icon-geshi_wendangpdf</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-geshi_wendangxls"></i> |
||||
|
<div class="name">803格式_文档xls</div> |
||||
|
<div class="fontclass">.icon-geshi_wendangxls</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-geshi_tongyongwendang"></i> |
||||
|
<div class="name">819格式_通用文档</div> |
||||
|
<div class="fontclass">.icon-geshi_tongyongwendang</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-geshi_shipinmp"></i> |
||||
|
<div class="name">840格式_视频mp4</div> |
||||
|
<div class="fontclass">.icon-geshi_shipinmp</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-geshi_tupianjpg"></i> |
||||
|
<div class="name">860格式_图片jpg</div> |
||||
|
<div class="fontclass">.icon-geshi_tupianjpg</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-geshi_tupianpng"></i> |
||||
|
<div class="name">865格式_图片png</div> |
||||
|
<div class="fontclass">.icon-geshi_tupianpng</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-guangzhaochuanganqi"></i> |
||||
|
<div class="name">光照传感器</div> |
||||
|
<div class="fontclass">.icon-guangzhaochuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-building"></i> |
||||
|
<div class="name">建筑</div> |
||||
|
<div class="fontclass">.icon-building</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-yanwuchuanganqi"></i> |
||||
|
<div class="name">烟雾传感器</div> |
||||
|
<div class="fontclass">.icon-yanwuchuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-shizheng"></i> |
||||
|
<div class="name">市政</div> |
||||
|
<div class="fontclass">.icon-shizheng</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-chuanganqi"></i> |
||||
|
<div class="name">传感器</div> |
||||
|
<div class="fontclass">.icon-chuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-WSD"></i> |
||||
|
<div class="name">温湿度传感器</div> |
||||
|
<div class="fontclass">.icon-WSD</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-yalichuanganqi"></i> |
||||
|
<div class="name">压力传感器</div> |
||||
|
<div class="fontclass">.icon-yalichuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-yinglichuanganqi"></i> |
||||
|
<div class="name">应力传感器</div> |
||||
|
<div class="fontclass">.icon-yinglichuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-chenjiangchuanganqi"></i> |
||||
|
<div class="name">沉降传感器</div> |
||||
|
<div class="fontclass">.icon-chenjiangchuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-yalichuanganqi1"></i> |
||||
|
<div class="name">压力传感器</div> |
||||
|
<div class="fontclass">.icon-yalichuanganqi1</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-YWC"></i> |
||||
|
<div class="name">液位传感器</div> |
||||
|
<div class="fontclass">.icon-YWC</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-computer"></i> |
||||
|
<div class="name">computer</div> |
||||
|
<div class="fontclass">.icon-computer</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-empty"></i> |
||||
|
<div class="name">empty</div> |
||||
|
<div class="fontclass">.icon-empty</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-offline"></i> |
||||
|
<div class="name">offline</div> |
||||
|
<div class="fontclass">.icon-offline</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-daba"></i> |
||||
|
<div class="name">大坝</div> |
||||
|
<div class="fontclass">.icon-daba</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-shenbuweiyi"></i> |
||||
|
<div class="name">深部位移</div> |
||||
|
<div class="fontclass">.icon-shenbuweiyi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-maosuochuanganqi"></i> |
||||
|
<div class="name">锚索传感器</div> |
||||
|
<div class="fontclass">.icon-maosuochuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-yuliangchuanganqi"></i> |
||||
|
<div class="name">雨量传感器</div> |
||||
|
<div class="fontclass">.icon-yuliangchuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-weiyiji"></i> |
||||
|
<div class="name">位移计</div> |
||||
|
<div class="fontclass">.icon-weiyiji</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-qixiangzhan_"></i> |
||||
|
<div class="name">气象站_1</div> |
||||
|
<div class="fontclass">.icon-qixiangzhan_</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc icon-shenjikeng"></i> |
||||
|
<div class="name">深基坑</div> |
||||
|
<div class="fontclass">.icon-shenjikeng</div> |
||||
|
</li> |
||||
|
|
||||
|
</ul> |
||||
|
|
||||
|
<h2 id="font-class-">font-class引用</h2> |
||||
|
<hr> |
||||
|
|
||||
|
<p>font-class是unicode使用方式的一种变种,主要是解决unicode书写不直观,语意不明确的问题。</p> |
||||
|
<p>与unicode使用方式相比,具有如下特点:</p> |
||||
|
<ul> |
||||
|
<li>兼容性良好,支持ie8+,及所有现代浏览器。</li> |
||||
|
<li>相比于unicode语意明确,书写更直观。可以很容易分辨这个icon是什么。</li> |
||||
|
<li>因为使用class来定义图标,所以当要替换图标时,只需要修改class里面的unicode引用。</li> |
||||
|
<li>不过因为本质上还是使用的字体,所以多色图标还是不支持的。</li> |
||||
|
</ul> |
||||
|
<p>使用步骤如下:</p> |
||||
|
<h3 id="-fontclass-">第一步:引入项目下面生成的fontclass代码:</h3> |
||||
|
|
||||
|
|
||||
|
<pre><code class="lang-js hljs javascript"><span class="hljs-comment"><link rel="stylesheet" type="text/css" href="./iconfont.css"></span></code></pre> |
||||
|
<h3 id="-">第二步:挑选相应图标并获取类名,应用于页面:</h3> |
||||
|
<pre><code class="lang-css hljs"><<span class="hljs-selector-tag">i</span> <span class="hljs-selector-tag">class</span>="<span class="hljs-selector-tag">sc</span> <span class="hljs-selector-tag">icon-xxx</span>"></<span class="hljs-selector-tag">i</span>></code></pre> |
||||
|
<blockquote> |
||||
|
<p>"sc"是你项目下的font-family。可以通过编辑项目查看,默认是"iconfont"。</p> |
||||
|
</blockquote> |
||||
|
</div> |
||||
|
</body> |
||||
|
</html> |
@ -0,0 +1,695 @@ |
|||||
|
|
||||
|
<!DOCTYPE html> |
||||
|
<html> |
||||
|
<head> |
||||
|
<meta charset="utf-8"/> |
||||
|
<title>IconFont</title> |
||||
|
<link rel="stylesheet" href="demo.css"> |
||||
|
<script src="iconfont.js"></script> |
||||
|
|
||||
|
<style type="text/css"> |
||||
|
.icon { |
||||
|
/* 通过设置 font-size 来改变图标大小 */ |
||||
|
width: 1em; height: 1em; |
||||
|
/* 图标和文字相邻时,垂直对齐 */ |
||||
|
vertical-align: -0.15em; |
||||
|
/* 通过设置 color 来改变 SVG 的颜色/fill */ |
||||
|
fill: currentColor; |
||||
|
/* path 和 stroke 溢出 viewBox 部分在 IE 下会显示 |
||||
|
normalize.css 中也包含这行 */ |
||||
|
overflow: hidden; |
||||
|
} |
||||
|
|
||||
|
</style> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div class="main markdown"> |
||||
|
<h1>IconFont 图标</h1> |
||||
|
<ul class="icon_lists clear"> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-liuliang"></use> |
||||
|
</svg> |
||||
|
<div class="name">流量</div> |
||||
|
<div class="fontclass">#icon-liuliang</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-iconfontditie"></use> |
||||
|
</svg> |
||||
|
<div class="name">轻轨</div> |
||||
|
<div class="fontclass">#icon-iconfontditie</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-fengsu3"></use> |
||||
|
</svg> |
||||
|
<div class="name">风速3</div> |
||||
|
<div class="fontclass">#icon-fengsu3</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-calendar"></use> |
||||
|
</svg> |
||||
|
<div class="name">calendar</div> |
||||
|
<div class="fontclass">#icon-calendar</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-box"></use> |
||||
|
</svg> |
||||
|
<div class="name">box</div> |
||||
|
<div class="fontclass">#icon-box</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-shenheshibai"></use> |
||||
|
</svg> |
||||
|
<div class="name">审核失败</div> |
||||
|
<div class="fontclass">#icon-shenheshibai</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-slope"></use> |
||||
|
</svg> |
||||
|
<div class="name">边坡</div> |
||||
|
<div class="fontclass">#icon-slope</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-icon2"></use> |
||||
|
</svg> |
||||
|
<div class="name">公路</div> |
||||
|
<div class="fontclass">#icon-icon2</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-gnsscaidian"></use> |
||||
|
</svg> |
||||
|
<div class="name">GNSS采点</div> |
||||
|
<div class="fontclass">#icon-gnsscaidian</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-chuanganqishebei"></use> |
||||
|
</svg> |
||||
|
<div class="name">传感器设备</div> |
||||
|
<div class="fontclass">#icon-chuanganqishebei</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-dianliuchuanganqi"></use> |
||||
|
</svg> |
||||
|
<div class="name">电流传感器</div> |
||||
|
<div class="fontclass">#icon-dianliuchuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-dianyachuanganqi"></use> |
||||
|
</svg> |
||||
|
<div class="name">电压传感器</div> |
||||
|
<div class="fontclass">#icon-dianyachuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-wenduchuanganqi"></use> |
||||
|
</svg> |
||||
|
<div class="name">温度传感器</div> |
||||
|
<div class="fontclass">#icon-wenduchuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-xinjian"></use> |
||||
|
</svg> |
||||
|
<div class="name">新建</div> |
||||
|
<div class="fontclass">#icon-xinjian</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-handong"></use> |
||||
|
</svg> |
||||
|
<div class="name">涵洞</div> |
||||
|
<div class="fontclass">#icon-handong</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-guanwanggongcheng"></use> |
||||
|
</svg> |
||||
|
<div class="name">管网工程</div> |
||||
|
<div class="fontclass">#icon-guanwanggongcheng</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-shenhe"></use> |
||||
|
</svg> |
||||
|
<div class="name">审核</div> |
||||
|
<div class="fontclass">#icon-shenhe</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-zhihuishequ"></use> |
||||
|
</svg> |
||||
|
<div class="name">智慧城市</div> |
||||
|
<div class="fontclass">#icon-zhihuishequ</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-bianpoweiyi"></use> |
||||
|
</svg> |
||||
|
<div class="name">边坡位移</div> |
||||
|
<div class="fontclass">#icon-bianpoweiyi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-jianzhu"></use> |
||||
|
</svg> |
||||
|
<div class="name">建筑</div> |
||||
|
<div class="fontclass">#icon-jianzhu</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-chuguan"></use> |
||||
|
</svg> |
||||
|
<div class="name">储罐</div> |
||||
|
<div class="fontclass">#icon-chuguan</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-suidao"></use> |
||||
|
</svg> |
||||
|
<div class="name">隧道</div> |
||||
|
<div class="fontclass">#icon-suidao</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-data"></use> |
||||
|
</svg> |
||||
|
<div class="name">data</div> |
||||
|
<div class="fontclass">#icon-data</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-kuangshankaicai"></use> |
||||
|
</svg> |
||||
|
<div class="name">矿山开采</div> |
||||
|
<div class="fontclass">#icon-kuangshankaicai</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-wangluo"></use> |
||||
|
</svg> |
||||
|
<div class="name">网络</div> |
||||
|
<div class="fontclass">#icon-wangluo</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-jiankong"></use> |
||||
|
</svg> |
||||
|
<div class="name">监控</div> |
||||
|
<div class="fontclass">#icon-jiankong</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-dashuju"></use> |
||||
|
</svg> |
||||
|
<div class="name">大数据</div> |
||||
|
<div class="fontclass">#icon-dashuju</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-shuju"></use> |
||||
|
</svg> |
||||
|
<div class="name">数据库</div> |
||||
|
<div class="fontclass">#icon-shuju</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-shenhechenggong"></use> |
||||
|
</svg> |
||||
|
<div class="name">审核成功</div> |
||||
|
<div class="fontclass">#icon-shenhechenggong</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-jiankong1"></use> |
||||
|
</svg> |
||||
|
<div class="name">监控</div> |
||||
|
<div class="fontclass">#icon-jiankong1</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-wangluoxitong"></use> |
||||
|
</svg> |
||||
|
<div class="name">网络系统</div> |
||||
|
<div class="fontclass">#icon-wangluoxitong</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-dingwei"></use> |
||||
|
</svg> |
||||
|
<div class="name">定位</div> |
||||
|
<div class="fontclass">#icon-dingwei</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-xitongyunzhuanqingkuang"></use> |
||||
|
</svg> |
||||
|
<div class="name">系统运转情况</div> |
||||
|
<div class="fontclass">#icon-xitongyunzhuanqingkuang</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-chakan"></use> |
||||
|
</svg> |
||||
|
<div class="name">查看</div> |
||||
|
<div class="fontclass">#icon-chakan</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-lianjie"></use> |
||||
|
</svg> |
||||
|
<div class="name">链接</div> |
||||
|
<div class="fontclass">#icon-lianjie</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-shujudaochu-01"></use> |
||||
|
</svg> |
||||
|
<div class="name">数据导出-01</div> |
||||
|
<div class="fontclass">#icon-shujudaochu-01</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-xitongzhuangtai"></use> |
||||
|
</svg> |
||||
|
<div class="name">系统状态</div> |
||||
|
<div class="fontclass">#icon-xitongzhuangtai</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-xiaofeimingxidan"></use> |
||||
|
</svg> |
||||
|
<div class="name">消费明细单</div> |
||||
|
<div class="fontclass">#icon-xiaofeimingxidan</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-SQLshenhe"></use> |
||||
|
</svg> |
||||
|
<div class="name">SQL审核</div> |
||||
|
<div class="fontclass">#icon-SQLshenhe</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-aislogo"></use> |
||||
|
</svg> |
||||
|
<div class="name">aislogo</div> |
||||
|
<div class="fontclass">#icon-aislogo</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-qiao"></use> |
||||
|
</svg> |
||||
|
<div class="name">桥</div> |
||||
|
<div class="fontclass">#icon-qiao</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-tashiqizhongji"></use> |
||||
|
</svg> |
||||
|
<div class="name">塔式起重机</div> |
||||
|
<div class="fontclass">#icon-tashiqizhongji</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-dwggeshi"></use> |
||||
|
</svg> |
||||
|
<div class="name">dwg格式</div> |
||||
|
<div class="fontclass">#icon-dwggeshi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-luyouqi"></use> |
||||
|
</svg> |
||||
|
<div class="name">路由器</div> |
||||
|
<div class="fontclass">#icon-luyouqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-anzhuangshigong-xianxing"></use> |
||||
|
</svg> |
||||
|
<div class="name">244安装、施工-线性</div> |
||||
|
<div class="fontclass">#icon-anzhuangshigong-xianxing</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-shaixuanguolv"></use> |
||||
|
</svg> |
||||
|
<div class="name">245筛选过滤</div> |
||||
|
<div class="fontclass">#icon-shaixuanguolv</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-anzhuangshigong"></use> |
||||
|
</svg> |
||||
|
<div class="name">244安装、施工</div> |
||||
|
<div class="fontclass">#icon-anzhuangshigong</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-tiaoxingtu-xianxing"></use> |
||||
|
</svg> |
||||
|
<div class="name">408条形图-线性</div> |
||||
|
<div class="fontclass">#icon-tiaoxingtu-xianxing</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-zhexiantu-xianxing"></use> |
||||
|
</svg> |
||||
|
<div class="name">409折线图-线性</div> |
||||
|
<div class="fontclass">#icon-zhexiantu-xianxing</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-tieta"></use> |
||||
|
</svg> |
||||
|
<div class="name">铁塔</div> |
||||
|
<div class="fontclass">#icon-tieta</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-geshi_wendangtxt"></use> |
||||
|
</svg> |
||||
|
<div class="name">800格式_文档txt</div> |
||||
|
<div class="fontclass">#icon-geshi_wendangtxt</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-geshi_wendangdoc"></use> |
||||
|
</svg> |
||||
|
<div class="name">801格式_文档doc</div> |
||||
|
<div class="fontclass">#icon-geshi_wendangdoc</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-geshi_wendangpdf"></use> |
||||
|
</svg> |
||||
|
<div class="name">807格式_文档pdf</div> |
||||
|
<div class="fontclass">#icon-geshi_wendangpdf</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-geshi_wendangxls"></use> |
||||
|
</svg> |
||||
|
<div class="name">803格式_文档xls</div> |
||||
|
<div class="fontclass">#icon-geshi_wendangxls</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-geshi_tongyongwendang"></use> |
||||
|
</svg> |
||||
|
<div class="name">819格式_通用文档</div> |
||||
|
<div class="fontclass">#icon-geshi_tongyongwendang</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-geshi_shipinmp"></use> |
||||
|
</svg> |
||||
|
<div class="name">840格式_视频mp4</div> |
||||
|
<div class="fontclass">#icon-geshi_shipinmp</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-geshi_tupianjpg"></use> |
||||
|
</svg> |
||||
|
<div class="name">860格式_图片jpg</div> |
||||
|
<div class="fontclass">#icon-geshi_tupianjpg</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-geshi_tupianpng"></use> |
||||
|
</svg> |
||||
|
<div class="name">865格式_图片png</div> |
||||
|
<div class="fontclass">#icon-geshi_tupianpng</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-guangzhaochuanganqi"></use> |
||||
|
</svg> |
||||
|
<div class="name">光照传感器</div> |
||||
|
<div class="fontclass">#icon-guangzhaochuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-building"></use> |
||||
|
</svg> |
||||
|
<div class="name">建筑</div> |
||||
|
<div class="fontclass">#icon-building</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-yanwuchuanganqi"></use> |
||||
|
</svg> |
||||
|
<div class="name">烟雾传感器</div> |
||||
|
<div class="fontclass">#icon-yanwuchuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-shizheng"></use> |
||||
|
</svg> |
||||
|
<div class="name">市政</div> |
||||
|
<div class="fontclass">#icon-shizheng</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-chuanganqi"></use> |
||||
|
</svg> |
||||
|
<div class="name">传感器</div> |
||||
|
<div class="fontclass">#icon-chuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-WSD"></use> |
||||
|
</svg> |
||||
|
<div class="name">温湿度传感器</div> |
||||
|
<div class="fontclass">#icon-WSD</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-yalichuanganqi"></use> |
||||
|
</svg> |
||||
|
<div class="name">压力传感器</div> |
||||
|
<div class="fontclass">#icon-yalichuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-yinglichuanganqi"></use> |
||||
|
</svg> |
||||
|
<div class="name">应力传感器</div> |
||||
|
<div class="fontclass">#icon-yinglichuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-chenjiangchuanganqi"></use> |
||||
|
</svg> |
||||
|
<div class="name">沉降传感器</div> |
||||
|
<div class="fontclass">#icon-chenjiangchuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-yalichuanganqi1"></use> |
||||
|
</svg> |
||||
|
<div class="name">压力传感器</div> |
||||
|
<div class="fontclass">#icon-yalichuanganqi1</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-YWC"></use> |
||||
|
</svg> |
||||
|
<div class="name">液位传感器</div> |
||||
|
<div class="fontclass">#icon-YWC</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-computer"></use> |
||||
|
</svg> |
||||
|
<div class="name">computer</div> |
||||
|
<div class="fontclass">#icon-computer</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-empty"></use> |
||||
|
</svg> |
||||
|
<div class="name">empty</div> |
||||
|
<div class="fontclass">#icon-empty</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-offline"></use> |
||||
|
</svg> |
||||
|
<div class="name">offline</div> |
||||
|
<div class="fontclass">#icon-offline</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-daba"></use> |
||||
|
</svg> |
||||
|
<div class="name">大坝</div> |
||||
|
<div class="fontclass">#icon-daba</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-shenbuweiyi"></use> |
||||
|
</svg> |
||||
|
<div class="name">深部位移</div> |
||||
|
<div class="fontclass">#icon-shenbuweiyi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-maosuochuanganqi"></use> |
||||
|
</svg> |
||||
|
<div class="name">锚索传感器</div> |
||||
|
<div class="fontclass">#icon-maosuochuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-yuliangchuanganqi"></use> |
||||
|
</svg> |
||||
|
<div class="name">雨量传感器</div> |
||||
|
<div class="fontclass">#icon-yuliangchuanganqi</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-weiyiji"></use> |
||||
|
</svg> |
||||
|
<div class="name">位移计</div> |
||||
|
<div class="fontclass">#icon-weiyiji</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-qixiangzhan_"></use> |
||||
|
</svg> |
||||
|
<div class="name">气象站_1</div> |
||||
|
<div class="fontclass">#icon-qixiangzhan_</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<svg class="icon" aria-hidden="true"> |
||||
|
<use xlink:href="#icon-shenjikeng"></use> |
||||
|
</svg> |
||||
|
<div class="name">深基坑</div> |
||||
|
<div class="fontclass">#icon-shenjikeng</div> |
||||
|
</li> |
||||
|
|
||||
|
</ul> |
||||
|
|
||||
|
|
||||
|
<h2 id="symbol-">symbol引用</h2> |
||||
|
<hr> |
||||
|
|
||||
|
<p>这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇<a href="">文章</a> |
||||
|
这种用法其实是做了一个svg的集合,与另外两种相比具有如下特点:</p> |
||||
|
<ul> |
||||
|
<li>支持多色图标了,不再受单色限制。</li> |
||||
|
<li>通过一些技巧,支持像字体那样,通过<code>font-size</code>,<code>color</code>来调整样式。</li> |
||||
|
<li>兼容性较差,支持 ie9+,及现代浏览器。</li> |
||||
|
<li>浏览器渲染svg的性能一般,还不如png。</li> |
||||
|
</ul> |
||||
|
<p>使用步骤如下:</p> |
||||
|
<h3 id="-symbol-">第一步:引入项目下面生成的symbol代码:</h3> |
||||
|
<pre><code class="lang-js hljs javascript"><span class="hljs-comment"><script src="./iconfont.js"></script></span></code></pre> |
||||
|
<h3 id="-css-">第二步:加入通用css代码(引入一次就行):</h3> |
||||
|
<pre><code class="lang-js hljs javascript"><style type=<span class="hljs-string">"text/css"</span>> |
||||
|
.icon { |
||||
|
width: <span class="hljs-number">1</span>em; height: <span class="hljs-number">1</span>em; |
||||
|
vertical-align: <span class="hljs-number">-0.15</span>em; |
||||
|
fill: currentColor; |
||||
|
overflow: hidden; |
||||
|
} |
||||
|
<<span class="hljs-regexp">/style></span></code></pre> |
||||
|
<h3 id="-">第三步:挑选相应图标并获取类名,应用于页面:</h3> |
||||
|
<pre><code class="lang-js hljs javascript"><svg <span class="hljs-class"><span class="hljs-keyword">class</span></span>=<span class="hljs-string">"icon"</span> aria-hidden=<span class="hljs-string">"true"</span>><span class="xml"><span class="hljs-tag"> |
||||
|
<<span class="hljs-name">use</span> <span class="hljs-attr">xlink:href</span>=<span class="hljs-string">"#icon-xxx"</span>></span><span class="hljs-tag"></<span class="hljs-name">use</span>></span> |
||||
|
</span><<span class="hljs-regexp">/svg> |
||||
|
</span></code></pre> |
||||
|
</div> |
||||
|
</body> |
||||
|
</html> |
@ -0,0 +1,552 @@ |
|||||
|
|
||||
|
<!DOCTYPE html> |
||||
|
<html> |
||||
|
<head> |
||||
|
<meta charset="utf-8"/> |
||||
|
<title>IconFont</title> |
||||
|
<link rel="stylesheet" href="demo.css"> |
||||
|
|
||||
|
<style type="text/css"> |
||||
|
|
||||
|
@font-face {font-family: "sc"; |
||||
|
src: url('iconfont.eot'); /* IE9*/ |
||||
|
src: url('iconfont.eot#iefix') format('embedded-opentype'), /* IE6-IE8 */ |
||||
|
url('iconfont.woff') format('woff'), /* chrome, firefox */ |
||||
|
url('iconfont.ttf') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ |
||||
|
url('iconfont.svg#sc') format('svg'); /* iOS 4.1- */ |
||||
|
} |
||||
|
|
||||
|
.sc { |
||||
|
font-family:"sc" !important; |
||||
|
font-size:16px; |
||||
|
font-style:normal; |
||||
|
-webkit-font-smoothing: antialiased; |
||||
|
-webkit-text-stroke-width: 0.2px; |
||||
|
-moz-osx-font-smoothing: grayscale; |
||||
|
} |
||||
|
|
||||
|
</style> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div class="main markdown"> |
||||
|
<h1>IconFont 图标</h1> |
||||
|
<ul class="icon_lists clear"> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">流量</div> |
||||
|
<div class="code">&#xe602;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">轻轨</div> |
||||
|
<div class="code">&#xe66f;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">风速3</div> |
||||
|
<div class="code">&#xe635;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">calendar</div> |
||||
|
<div class="code">&#xe74a;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">box</div> |
||||
|
<div class="code">&#xe6cb;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">审核失败</div> |
||||
|
<div class="code">&#xe61d;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">边坡</div> |
||||
|
<div class="code">&#xe676;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">公路</div> |
||||
|
<div class="code">&#xe607;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">GNSS采点</div> |
||||
|
<div class="code">&#xe825;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">传感器设备</div> |
||||
|
<div class="code">&#xe612;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">电流传感器</div> |
||||
|
<div class="code">&#xe62c;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">电压传感器</div> |
||||
|
<div class="code">&#xe62f;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">温度传感器</div> |
||||
|
<div class="code">&#xe637;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">新建</div> |
||||
|
<div class="code">&#xe61f;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">涵洞</div> |
||||
|
<div class="code">&#xe89b;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">管网工程</div> |
||||
|
<div class="code">&#xe646;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">审核</div> |
||||
|
<div class="code">&#xe639;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">智慧城市</div> |
||||
|
<div class="code">&#xe600;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">边坡位移</div> |
||||
|
<div class="code">&#xe60a;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">建筑</div> |
||||
|
<div class="code">&#xe65f;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">储罐</div> |
||||
|
<div class="code">&#xe636;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">隧道</div> |
||||
|
<div class="code">&#xe61e;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">data</div> |
||||
|
<div class="code">&#xe757;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">矿山开采</div> |
||||
|
<div class="code">&#xe608;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">网络</div> |
||||
|
<div class="code">&#xe617;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">监控</div> |
||||
|
<div class="code">&#xe619;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">大数据</div> |
||||
|
<div class="code">&#xe61a;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">数据库</div> |
||||
|
<div class="code">&#xe61b;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">审核成功</div> |
||||
|
<div class="code">&#xe627;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">监控</div> |
||||
|
<div class="code">&#xe620;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">网络系统</div> |
||||
|
<div class="code">&#xe62e;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">定位</div> |
||||
|
<div class="code">&#xe630;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">系统运转情况</div> |
||||
|
<div class="code">&#xe631;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">查看</div> |
||||
|
<div class="code">&#xe63e;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">链接</div> |
||||
|
<div class="code">&#xe63f;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">数据导出-01</div> |
||||
|
<div class="code">&#xe640;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">系统状态</div> |
||||
|
<div class="code">&#xe642;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">消费明细单</div> |
||||
|
<div class="code">&#xe643;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">SQL审核</div> |
||||
|
<div class="code">&#xe645;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">aislogo</div> |
||||
|
<div class="code">&#xe648;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">桥</div> |
||||
|
<div class="code">&#xe715;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">塔式起重机</div> |
||||
|
<div class="code">&#xe615;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">dwg格式</div> |
||||
|
<div class="code">&#xe82b;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">路由器</div> |
||||
|
<div class="code">&#xe603;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">244安装、施工-线性</div> |
||||
|
<div class="code">&#xe8d6;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">245筛选过滤</div> |
||||
|
<div class="code">&#xe8d7;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">244安装、施工</div> |
||||
|
<div class="code">&#xe8d8;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">408条形图-线性</div> |
||||
|
<div class="code">&#xe904;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">409折线图-线性</div> |
||||
|
<div class="code">&#xe906;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">铁塔</div> |
||||
|
<div class="code">&#xe605;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">800格式_文档txt</div> |
||||
|
<div class="code">&#xe6b8;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">801格式_文档doc</div> |
||||
|
<div class="code">&#xe6b9;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">807格式_文档pdf</div> |
||||
|
<div class="code">&#xe6bc;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">803格式_文档xls</div> |
||||
|
<div class="code">&#xe6be;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">819格式_通用文档</div> |
||||
|
<div class="code">&#xe6c0;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">840格式_视频mp4</div> |
||||
|
<div class="code">&#xe6c8;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">860格式_图片jpg</div> |
||||
|
<div class="code">&#xe6cc;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">865格式_图片png</div> |
||||
|
<div class="code">&#xe6ce;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">光照传感器</div> |
||||
|
<div class="code">&#xe638;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">建筑</div> |
||||
|
<div class="code">&#xe61c;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">烟雾传感器</div> |
||||
|
<div class="code">&#xe610;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">市政</div> |
||||
|
<div class="code">&#xe6ca;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">传感器</div> |
||||
|
<div class="code">&#xe60f;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">温湿度传感器</div> |
||||
|
<div class="code">&#xe697;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">压力传感器</div> |
||||
|
<div class="code">&#xe60e;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">应力传感器</div> |
||||
|
<div class="code">&#xe611;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">沉降传感器</div> |
||||
|
<div class="code">&#xe601;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">压力传感器</div> |
||||
|
<div class="code">&#xe606;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">液位传感器</div> |
||||
|
<div class="code">&#xe699;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">computer</div> |
||||
|
<div class="code">&#xe6eb;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">empty</div> |
||||
|
<div class="code">&#xe6f7;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">offline</div> |
||||
|
<div class="code">&#xe712;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">大坝</div> |
||||
|
<div class="code">&#xe632;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">深部位移</div> |
||||
|
<div class="code">&#xe613;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">锚索传感器</div> |
||||
|
<div class="code">&#xe614;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">雨量传感器</div> |
||||
|
<div class="code">&#xe616;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">位移计</div> |
||||
|
<div class="code">&#xe618;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">气象站_1</div> |
||||
|
<div class="code">&#xe60d;</div> |
||||
|
</li> |
||||
|
|
||||
|
<li> |
||||
|
<i class="icon sc"></i> |
||||
|
<div class="name">深基坑</div> |
||||
|
<div class="code">&#xe62a;</div> |
||||
|
</li> |
||||
|
|
||||
|
</ul> |
||||
|
<h2 id="unicode-">unicode引用</h2> |
||||
|
<hr> |
||||
|
|
||||
|
<p>unicode是字体在网页端最原始的应用方式,特点是:</p> |
||||
|
<ul> |
||||
|
<li>兼容性最好,支持ie6+,及所有现代浏览器。</li> |
||||
|
<li>支持按字体的方式去动态调整图标大小,颜色等等。</li> |
||||
|
<li>但是因为是字体,所以不支持多色。只能使用平台里单色的图标,就算项目里有多色图标也会自动去色。</li> |
||||
|
</ul> |
||||
|
<blockquote> |
||||
|
<p>注意:新版iconfont支持多色图标,这些多色图标在unicode模式下将不能使用,如果有需求建议使用symbol的引用方式</p> |
||||
|
</blockquote> |
||||
|
<p>unicode使用步骤如下:</p> |
||||
|
<h3 id="-font-face">第一步:拷贝项目下面生成的font-face</h3> |
||||
|
<pre><code class="lang-js hljs javascript">@font-face { |
||||
|
font-family: <span class="hljs-string">'sc'</span>; |
||||
|
src: url(<span class="hljs-string">'iconfont.eot'</span>); |
||||
|
src: url(<span class="hljs-string">'iconfont.eot?#iefix'</span>) format(<span class="hljs-string">'embedded-opentype'</span>), |
||||
|
url(<span class="hljs-string">'iconfont.woff'</span>) format(<span class="hljs-string">'woff'</span>), |
||||
|
url(<span class="hljs-string">'iconfont.ttf'</span>) format(<span class="hljs-string">'truetype'</span>), |
||||
|
url(<span class="hljs-string">'iconfont.svg#sc'</span>) format(<span class="hljs-string">'svg'</span>); |
||||
|
} |
||||
|
</code></pre> |
||||
|
<h3 id="-iconfont-">第二步:定义使用iconfont的样式</h3> |
||||
|
<pre><code class="lang-js hljs javascript">.sc{ |
||||
|
font-family:<span class="hljs-string">"sc"</span> !important; |
||||
|
font-size:<span class="hljs-number">16</span>px;font-style:normal; |
||||
|
-webkit-font-smoothing: antialiased; |
||||
|
-webkit-text-stroke-width: <span class="hljs-number">0.2</span>px; |
||||
|
-moz-osx-font-smoothing: grayscale; |
||||
|
} |
||||
|
</code></pre> |
||||
|
<h3 id="-">第三步:挑选相应图标并获取字体编码,应用于页面</h3> |
||||
|
<pre><code class="lang-js hljs javascript"><i <span class="hljs-class"><span class="hljs-keyword">class</span></span>=<span class="hljs-string">"sc"</span>>&#x33;<span class="xml"><span class="hljs-tag"></<span class="hljs-name">i</span>></span></span></code></pre> |
||||
|
|
||||
|
<blockquote> |
||||
|
<p>"sc"是你项目下的font-family。可以通过编辑项目查看,默认是"iconfont"。</p> |
||||
|
</blockquote> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
</body> |
||||
|
</html> |
After Width: | Height: | Size: 148 KiB |
@ -0,0 +1,521 @@ |
|||||
|
|
||||
|
@font-face {font-family: "anticon"; |
||||
|
src: url('iconfont.eot?t=1494480257283'); /* IE9*/ |
||||
|
src: url('iconfont.eot?t=1494480257283#iefix') format('embedded-opentype'), /* IE6-IE8 */ |
||||
|
url('iconfont.woff?t=1494480257283') format('woff'), /* chrome, firefox */ |
||||
|
url('iconfont.ttf?t=1494480257283') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ |
||||
|
url('iconfont.svg?t=1494480257283#anticon') format('svg'); /* iOS 4.1- */ |
||||
|
} |
||||
|
|
||||
|
.anticon { |
||||
|
font-family:"anticon" !important; |
||||
|
font-size:16px; |
||||
|
font-style:normal; |
||||
|
-webkit-font-smoothing: antialiased; |
||||
|
-moz-osx-font-smoothing: grayscale; |
||||
|
} |
||||
|
|
||||
|
.icon-stepforward:before { content: "\e600"; } |
||||
|
|
||||
|
.icon-stepbackward:before { content: "\e601"; } |
||||
|
|
||||
|
.icon-forward:before { content: "\e602"; } |
||||
|
|
||||
|
.icon-banckward:before { content: "\e603"; } |
||||
|
|
||||
|
.icon-caretright:before { content: "\e604"; } |
||||
|
|
||||
|
.icon-caretleft:before { content: "\e605"; } |
||||
|
|
||||
|
.icon-caretdown:before { content: "\e606"; } |
||||
|
|
||||
|
.icon-caretup:before { content: "\e607"; } |
||||
|
|
||||
|
.icon-rightcircle:before { content: "\e608"; } |
||||
|
|
||||
|
.icon-leftcircle:before { content: "\e609"; } |
||||
|
|
||||
|
.icon-upcircle:before { content: "\e60a"; } |
||||
|
|
||||
|
.icon-downcircle:before { content: "\e60b"; } |
||||
|
|
||||
|
.icon-rightcircleo:before { content: "\e60c"; } |
||||
|
|
||||
|
.icon-leftcircleo:before { content: "\e60d"; } |
||||
|
|
||||
|
.icon-upcircleo:before { content: "\e60e"; } |
||||
|
|
||||
|
.icon-downcircleo:before { content: "\e60f"; } |
||||
|
|
||||
|
.icon-verticleleft:before { content: "\e610"; } |
||||
|
|
||||
|
.icon-verticleright:before { content: "\e611"; } |
||||
|
|
||||
|
.icon-rollback:before { content: "\e612"; } |
||||
|
|
||||
|
.icon-retweet:before { content: "\e613"; } |
||||
|
|
||||
|
.icon-shrink:before { content: "\e614"; } |
||||
|
|
||||
|
.icon-arrowsalt:before { content: "\e615"; } |
||||
|
|
||||
|
.icon-doubleright:before { content: "\e617"; } |
||||
|
|
||||
|
.icon-doubleleft:before { content: "\e618"; } |
||||
|
|
||||
|
.icon-arrowdown:before { content: "\e619"; } |
||||
|
|
||||
|
.icon-arrowup:before { content: "\e61a"; } |
||||
|
|
||||
|
.icon-arrowright:before { content: "\e61b"; } |
||||
|
|
||||
|
.icon-arrowleft:before { content: "\e61c"; } |
||||
|
|
||||
|
.icon-down:before { content: "\e61d"; } |
||||
|
|
||||
|
.icon-up:before { content: "\e61e"; } |
||||
|
|
||||
|
.icon-right:before { content: "\e61f"; } |
||||
|
|
||||
|
.icon-left:before { content: "\e620"; } |
||||
|
|
||||
|
.icon-minussquareo:before { content: "\e621"; } |
||||
|
|
||||
|
.icon-minuscircle:before { content: "\e622"; } |
||||
|
|
||||
|
.icon-minuscircleo:before { content: "\e623"; } |
||||
|
|
||||
|
.icon-minus:before { content: "\e624"; } |
||||
|
|
||||
|
.icon-pluscircleo:before { content: "\e625"; } |
||||
|
|
||||
|
.icon-pluscircle:before { content: "\e626"; } |
||||
|
|
||||
|
.icon-plus:before { content: "\e627"; } |
||||
|
|
||||
|
.icon-infocirlce:before { content: "\e628"; } |
||||
|
|
||||
|
.icon-infocirlceo:before { content: "\e629"; } |
||||
|
|
||||
|
.icon-info:before { content: "\e62a"; } |
||||
|
|
||||
|
.icon-exclamation:before { content: "\e62b"; } |
||||
|
|
||||
|
.icon-exclamationcircle:before { content: "\e62c"; } |
||||
|
|
||||
|
.icon-exclamationcircleo:before { content: "\e62d"; } |
||||
|
|
||||
|
.icon-closecircle:before { content: "\e62e"; } |
||||
|
|
||||
|
.icon-closecircleo:before { content: "\e62f"; } |
||||
|
|
||||
|
.icon-checkcircle:before { content: "\e630"; } |
||||
|
|
||||
|
.icon-checkcircleo:before { content: "\e631"; } |
||||
|
|
||||
|
.icon-check:before { content: "\e632"; } |
||||
|
|
||||
|
.icon-close:before { content: "\e633"; } |
||||
|
|
||||
|
.icon-customerservice:before { content: "\e634"; } |
||||
|
|
||||
|
.icon-creditcard:before { content: "\e635"; } |
||||
|
|
||||
|
.icon-codesquareo:before { content: "\e636"; } |
||||
|
|
||||
|
.icon-book:before { content: "\e637"; } |
||||
|
|
||||
|
.icon-barschart:before { content: "\e638"; } |
||||
|
|
||||
|
.icon-bars:before { content: "\e639"; } |
||||
|
|
||||
|
.icon-question:before { content: "\e63a"; } |
||||
|
|
||||
|
.icon-questioncircle:before { content: "\e63b"; } |
||||
|
|
||||
|
.icon-questioncircleo:before { content: "\e63c"; } |
||||
|
|
||||
|
.icon-pause:before { content: "\e63d"; } |
||||
|
|
||||
|
.icon-pausecircle:before { content: "\e63e"; } |
||||
|
|
||||
|
.icon-pausecircleo:before { content: "\e63f"; } |
||||
|
|
||||
|
.icon-clockcircle:before { content: "\e640"; } |
||||
|
|
||||
|
.icon-clockcircleo:before { content: "\e641"; } |
||||
|
|
||||
|
.icon-swap:before { content: "\e642"; } |
||||
|
|
||||
|
.icon-swapleft:before { content: "\e643"; } |
||||
|
|
||||
|
.icon-swapright:before { content: "\e644"; } |
||||
|
|
||||
|
.icon-plussquareo:before { content: "\e645"; } |
||||
|
|
||||
|
.icon-frown:before { content: "\e646"; } |
||||
|
|
||||
|
.icon-menufold:before { content: "\e658"; } |
||||
|
|
||||
|
.icon-mail:before { content: "\e659"; } |
||||
|
|
||||
|
.icon-link:before { content: "\e65b"; } |
||||
|
|
||||
|
.icon-areachart:before { content: "\e65c"; } |
||||
|
|
||||
|
.icon-linechart:before { content: "\e65d"; } |
||||
|
|
||||
|
.icon-home:before { content: "\e65e"; } |
||||
|
|
||||
|
.icon-laptop:before { content: "\e65f"; } |
||||
|
|
||||
|
.icon-star:before { content: "\e660"; } |
||||
|
|
||||
|
.icon-staro:before { content: "\e661"; } |
||||
|
|
||||
|
.icon-filter:before { content: "\e663"; } |
||||
|
|
||||
|
.icon-meho:before { content: "\e666"; } |
||||
|
|
||||
|
.icon-meh:before { content: "\e667"; } |
||||
|
|
||||
|
.icon-shoppingcart:before { content: "\e668"; } |
||||
|
|
||||
|
.icon-save:before { content: "\e669"; } |
||||
|
|
||||
|
.icon-user:before { content: "\e66a"; } |
||||
|
|
||||
|
.icon-videocamera:before { content: "\e66b"; } |
||||
|
|
||||
|
.icon-totop:before { content: "\e66c"; } |
||||
|
|
||||
|
.icon-team:before { content: "\e66d"; } |
||||
|
|
||||
|
.icon-sharealt:before { content: "\e671"; } |
||||
|
|
||||
|
.icon-setting:before { content: "\e672"; } |
||||
|
|
||||
|
.icon-picture:before { content: "\e674"; } |
||||
|
|
||||
|
.icon-phone:before { content: "\e675"; } |
||||
|
|
||||
|
.icon-paperclip:before { content: "\e676"; } |
||||
|
|
||||
|
.icon-notification:before { content: "\e677"; } |
||||
|
|
||||
|
.icon-menuunfold:before { content: "\e679"; } |
||||
|
|
||||
|
.icon-inbox:before { content: "\e67a"; } |
||||
|
|
||||
|
.icon-lock:before { content: "\e67b"; } |
||||
|
|
||||
|
.icon-qrcode:before { content: "\e67c"; } |
||||
|
|
||||
|
.icon-tags:before { content: "\e67d"; } |
||||
|
|
||||
|
.icon-tagso:before { content: "\e67e"; } |
||||
|
|
||||
|
.icon-cloudo:before { content: "\e67f"; } |
||||
|
|
||||
|
.icon-cloud:before { content: "\e680"; } |
||||
|
|
||||
|
.icon-cloudupload:before { content: "\e681"; } |
||||
|
|
||||
|
.icon-clouddownload:before { content: "\e682"; } |
||||
|
|
||||
|
.icon-clouddownloado:before { content: "\e683"; } |
||||
|
|
||||
|
.icon-clouduploado:before { content: "\e684"; } |
||||
|
|
||||
|
.icon-enviroment:before { content: "\e685"; } |
||||
|
|
||||
|
.icon-enviromento:before { content: "\e686"; } |
||||
|
|
||||
|
.icon-eye:before { content: "\e687"; } |
||||
|
|
||||
|
.icon-eyeo:before { content: "\e688"; } |
||||
|
|
||||
|
.icon-camera:before { content: "\e689"; } |
||||
|
|
||||
|
.icon-camerao:before { content: "\e68a"; } |
||||
|
|
||||
|
.icon-windows:before { content: "\e68b"; } |
||||
|
|
||||
|
.icon-export2:before { content: "\e690"; } |
||||
|
|
||||
|
.icon-export:before { content: "\e691"; } |
||||
|
|
||||
|
.icon-circledowno:before { content: "\e693"; } |
||||
|
|
||||
|
.icon-circledown:before { content: "\e694"; } |
||||
|
|
||||
|
.icon-hdd:before { content: "\e69a"; } |
||||
|
|
||||
|
.icon-ie:before { content: "\e69b"; } |
||||
|
|
||||
|
.icon-delete:before { content: "\e69f"; } |
||||
|
|
||||
|
.icon-enter:before { content: "\e6a0"; } |
||||
|
|
||||
|
.icon-pushpino:before { content: "\e6a1"; } |
||||
|
|
||||
|
.icon-pushpin:before { content: "\e6a2"; } |
||||
|
|
||||
|
.icon-heart:before { content: "\e6a3"; } |
||||
|
|
||||
|
.icon-hearto:before { content: "\e6a4"; } |
||||
|
|
||||
|
.icon-smile-circle:before { content: "\e6a7"; } |
||||
|
|
||||
|
.icon-smileo:before { content: "\e6a8"; } |
||||
|
|
||||
|
.icon-frowno:before { content: "\e6a9"; } |
||||
|
|
||||
|
.icon-calculator:before { content: "\e6aa"; } |
||||
|
|
||||
|
.icon-chrome:before { content: "\e6ac"; } |
||||
|
|
||||
|
.icon-github:before { content: "\e6ad"; } |
||||
|
|
||||
|
.icon-iconfontdesktop:before { content: "\e6b4"; } |
||||
|
|
||||
|
.icon-caretcircleoup:before { content: "\e6b5"; } |
||||
|
|
||||
|
.icon-upload:before { content: "\e6b6"; } |
||||
|
|
||||
|
.icon-download:before { content: "\e6b7"; } |
||||
|
|
||||
|
.icon-piechart:before { content: "\e6b8"; } |
||||
|
|
||||
|
.icon-lock1:before { content: "\e6b9"; } |
||||
|
|
||||
|
.icon-unlock:before { content: "\e6ba"; } |
||||
|
|
||||
|
.icon-windowso:before { content: "\e6bc"; } |
||||
|
|
||||
|
.icon-dotchart:before { content: "\e6bd"; } |
||||
|
|
||||
|
.icon-barchart:before { content: "\e6be"; } |
||||
|
|
||||
|
.icon-codesquare:before { content: "\e6bf"; } |
||||
|
|
||||
|
.icon-plussquare:before { content: "\e6c0"; } |
||||
|
|
||||
|
.icon-minussquare:before { content: "\e6c1"; } |
||||
|
|
||||
|
.icon-closesquare:before { content: "\e6c2"; } |
||||
|
|
||||
|
.icon-closesquareo:before { content: "\e6c3"; } |
||||
|
|
||||
|
.icon-checksquare:before { content: "\e6c4"; } |
||||
|
|
||||
|
.icon-checksquareo:before { content: "\e6c5"; } |
||||
|
|
||||
|
.icon-fastbackward:before { content: "\e6c6"; } |
||||
|
|
||||
|
.icon-fastforward:before { content: "\e6c7"; } |
||||
|
|
||||
|
.icon-upsquare:before { content: "\e6c8"; } |
||||
|
|
||||
|
.icon-downsquare:before { content: "\e6c9"; } |
||||
|
|
||||
|
.icon-leftsquare:before { content: "\e6ca"; } |
||||
|
|
||||
|
.icon-rightsquare:before { content: "\e6cb"; } |
||||
|
|
||||
|
.icon-rightsquareo:before { content: "\e6cc"; } |
||||
|
|
||||
|
.icon-leftsquareo:before { content: "\e6cd"; } |
||||
|
|
||||
|
.icon-down-square-o:before { content: "\e6ce"; } |
||||
|
|
||||
|
.icon-up-square-o:before { content: "\e6cf"; } |
||||
|
|
||||
|
.icon-play:before { content: "\e6d0"; } |
||||
|
|
||||
|
.icon-playcircleo:before { content: "\e6d1"; } |
||||
|
|
||||
|
.icon-tag:before { content: "\e6d2"; } |
||||
|
|
||||
|
.icon-tago:before { content: "\e6d3"; } |
||||
|
|
||||
|
.icon-addfile:before { content: "\e910"; } |
||||
|
|
||||
|
.icon-folder1:before { content: "\e662"; } |
||||
|
|
||||
|
.icon-file1:before { content: "\e664"; } |
||||
|
|
||||
|
.icon-switcher:before { content: "\e913"; } |
||||
|
|
||||
|
.icon-addfolder:before { content: "\e914"; } |
||||
|
|
||||
|
.icon-folderopen:before { content: "\e699"; } |
||||
|
|
||||
|
.icon-search1:before { content: "\e670"; } |
||||
|
|
||||
|
.icon-ellipsis1:before { content: "\e647"; } |
||||
|
|
||||
|
.icon-calendar:before { content: "\e6bb"; } |
||||
|
|
||||
|
.icon-filetext1:before { content: "\e698"; } |
||||
|
|
||||
|
.icon-copy1:before { content: "\e648"; } |
||||
|
|
||||
|
.icon-jpgfile1:before { content: "\e69c"; } |
||||
|
|
||||
|
.icon-pdffile1:before { content: "\e6b3"; } |
||||
|
|
||||
|
.icon-exclefile1:before { content: "\e6b0"; } |
||||
|
|
||||
|
.icon-pptfile1:before { content: "\e6b1"; } |
||||
|
|
||||
|
.icon-unknowfile1:before { content: "\e6af"; } |
||||
|
|
||||
|
.icon-wordfile1:before { content: "\e6b2"; } |
||||
|
|
||||
|
.icon-dingding:before { content: "\e923"; } |
||||
|
|
||||
|
.icon-dingding-o:before { content: "\e925"; } |
||||
|
|
||||
|
.icon-mobile1:before { content: "\e678"; } |
||||
|
|
||||
|
.icon-tablet1:before { content: "\e66e"; } |
||||
|
|
||||
|
.icon-bells:before { content: "\e64e"; } |
||||
|
|
||||
|
.icon-disconnect:before { content: "\e64f"; } |
||||
|
|
||||
|
.icon-database:before { content: "\e650"; } |
||||
|
|
||||
|
.icon-barcode:before { content: "\e652"; } |
||||
|
|
||||
|
.icon-hourglass:before { content: "\e653"; } |
||||
|
|
||||
|
.icon-key:before { content: "\e654"; } |
||||
|
|
||||
|
.icon-flag:before { content: "\e655"; } |
||||
|
|
||||
|
.icon-layout:before { content: "\e656"; } |
||||
|
|
||||
|
.icon-printer:before { content: "\e673"; } |
||||
|
|
||||
|
.icon-USB:before { content: "\e6d7"; } |
||||
|
|
||||
|
.icon-skin:before { content: "\e6d8"; } |
||||
|
|
||||
|
.icon-tool:before { content: "\e6d9"; } |
||||
|
|
||||
|
.icon-car:before { content: "\e6dc"; } |
||||
|
|
||||
|
.icon-addusergroup:before { content: "\e6dd"; } |
||||
|
|
||||
|
.icon-carryout:before { content: "\e6df"; } |
||||
|
|
||||
|
.icon-deleteuser:before { content: "\e6e0"; } |
||||
|
|
||||
|
.icon-deleteusergroup:before { content: "\e6e1"; } |
||||
|
|
||||
|
.icon-man:before { content: "\e6e2"; } |
||||
|
|
||||
|
.icon-isv:before { content: "\e6e3"; } |
||||
|
|
||||
|
.icon-gift:before { content: "\e6e4"; } |
||||
|
|
||||
|
.icon-idcard:before { content: "\e6e5"; } |
||||
|
|
||||
|
.icon-medicinebox:before { content: "\e6e6"; } |
||||
|
|
||||
|
.icon-redenvelopes:before { content: "\e6e7"; } |
||||
|
|
||||
|
.icon-rest:before { content: "\e6e8"; } |
||||
|
|
||||
|
.icon-Safety:before { content: "\e6ea"; } |
||||
|
|
||||
|
.icon-wallet:before { content: "\e6eb"; } |
||||
|
|
||||
|
.icon-woman:before { content: "\e6ec"; } |
||||
|
|
||||
|
.icon-adduser:before { content: "\e6ed"; } |
||||
|
|
||||
|
.icon-bank:before { content: "\e6ee"; } |
||||
|
|
||||
|
.icon-Trophy:before { content: "\e6ef"; } |
||||
|
|
||||
|
.icon-loading1:before { content: "\e6ae"; } |
||||
|
|
||||
|
.icon-loading2:before { content: "\e64d"; } |
||||
|
|
||||
|
.icon-like2:before { content: "\e69d"; } |
||||
|
|
||||
|
.icon-dislike2:before { content: "\e69e"; } |
||||
|
|
||||
|
.icon-like1:before { content: "\e64c"; } |
||||
|
|
||||
|
.icon-dislike1:before { content: "\e64b"; } |
||||
|
|
||||
|
.icon-bulb1:before { content: "\e649"; } |
||||
|
|
||||
|
.icon-rocket1:before { content: "\e90f"; } |
||||
|
|
||||
|
.icon-select1:before { content: "\e64a"; } |
||||
|
|
||||
|
.icon-apple1:before { content: "\e68c"; } |
||||
|
|
||||
|
.icon-apple-o:before { content: "\e6d4"; } |
||||
|
|
||||
|
.icon-android1:before { content: "\e938"; } |
||||
|
|
||||
|
.icon-android:before { content: "\e68d"; } |
||||
|
|
||||
|
.icon-aliwangwang-o1:before { content: "\e68f"; } |
||||
|
|
||||
|
.icon-aliwangwang:before { content: "\e68e"; } |
||||
|
|
||||
|
.icon-pay-circle1:before { content: "\e6a5"; } |
||||
|
|
||||
|
.icon-pay-circle-o1:before { content: "\e6a6"; } |
||||
|
|
||||
|
.icon-poweroff:before { content: "\e6d5"; } |
||||
|
|
||||
|
.icon-trademark:before { content: "\e651"; } |
||||
|
|
||||
|
.icon-find:before { content: "\e6db"; } |
||||
|
|
||||
|
.icon-copyright:before { content: "\e6de"; } |
||||
|
|
||||
|
.icon-sound:before { content: "\e6e9"; } |
||||
|
|
||||
|
.icon-earth:before { content: "\e6f1"; } |
||||
|
|
||||
|
.icon-wifi:before { content: "\e6d6"; } |
||||
|
|
||||
|
.icon-sync:before { content: "\e6da"; } |
||||
|
|
||||
|
.icon-login:before { content: "\e657"; } |
||||
|
|
||||
|
.icon-logout:before { content: "\e65a"; } |
||||
|
|
||||
|
.icon-reload1:before { content: "\e616"; } |
||||
|
|
||||
|
.icon-message1:before { content: "\e6ab"; } |
||||
|
|
||||
|
.icon-shake:before { content: "\e94f"; } |
||||
|
|
||||
|
.icon-API:before { content: "\e951"; } |
||||
|
|
||||
|
.icon-appstore-o:before { content: "\e695"; } |
||||
|
|
||||
|
.icon-appstore1:before { content: "\e696"; } |
||||
|
|
||||
|
.icon-scan1:before { content: "\e697"; } |
||||
|
|
||||
|
.icon-exception1:before { content: "\e665"; } |
||||
|
|
||||
|
.icon-contacts:before { content: "\e6f0"; } |
||||
|
|
||||
|
.icon-solution1:before { content: "\e66f"; } |
||||
|
|
||||
|
.icon-fork:before { content: "\e6f2"; } |
||||
|
|
||||
|
.icon-edit1:before { content: "\e692"; } |
||||
|
|
After Width: | Height: | Size: 140 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 202 KiB |
After Width: | Height: | Size: 120 KiB |
@ -0,0 +1,22 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html> |
||||
|
|
||||
|
<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" /> |
||||
|
<script> |
||||
|
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> |
@ -0,0 +1,21 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html> |
||||
|
<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"/> |
||||
|
<script> |
||||
|
window.less = { |
||||
|
async: false, |
||||
|
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> |
@ -0,0 +1,19 @@ |
|||||
|
/** |
||||
|
* User: liuxinyi/liu.xinyi@free-sun.com.cn |
||||
|
* Date: 2016/2/22 |
||||
|
* Time: 15:29 |
||||
|
* |
||||
|
*/ |
||||
|
'use strict'; |
||||
|
|
||||
|
const views = require('koa-view'); |
||||
|
const path = require('path'); |
||||
|
module.exports = { |
||||
|
entry: function (app, router, opt) { |
||||
|
app.use(views(__dirname)); |
||||
|
|
||||
|
router.get('(.*)', async function (ctx){ |
||||
|
await ctx.render(path.join(__dirname, './index')); |
||||
|
}); |
||||
|
} |
||||
|
}; |
@ -0,0 +1,28 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
import React, { useEffect } from 'react'; |
||||
|
import Layout from './layout'; |
||||
|
import Auth from './sections/auth'; |
||||
|
import Report from './sections/report'; |
||||
|
// import Example from './sections/example';
|
||||
|
import Organization from './sections/organization' |
||||
|
import Middleground from './sections/middleground'; |
||||
|
import Fillion from './sections/fillion' |
||||
|
|
||||
|
|
||||
|
const App = props => { |
||||
|
const { projectName } = props |
||||
|
|
||||
|
useEffect(() => { |
||||
|
document.title = projectName; |
||||
|
}, []) |
||||
|
|
||||
|
return ( |
||||
|
<Layout |
||||
|
title={projectName} |
||||
|
sections={[Middleground, Auth, Organization, Report, Fillion]} |
||||
|
/> |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
export default App; |
@ -0,0 +1 @@ |
|||||
|
��Ŀ¼���ڴ����Ŀͨ����� |
@ -0,0 +1,316 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
import React, { Component } from 'react'; |
||||
|
import { connect } from 'react-redux'; |
||||
|
import { Spin, Upload, message, Modal, Card, Button } from 'antd'; |
||||
|
import moment from 'moment'; |
||||
|
import { PlusOutlined, UploadOutlined, CloseOutlined } from '@ant-design/icons'; |
||||
|
|
||||
|
class Uploads extends Component { |
||||
|
constructor(props) { |
||||
|
super(props); |
||||
|
this.ApiRoot = localStorage.getItem('tyApiRoot') |
||||
|
this.state = { |
||||
|
fileUploading: false, |
||||
|
fileList: [], |
||||
|
curPreviewPic: '', |
||||
|
delPicIng: false, |
||||
|
removeFilesList: [] |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
dealName = (uploaded) => { |
||||
|
let realName = uploaded.split('/')[2] |
||||
|
let x1 = realName.split('.') |
||||
|
let x2 = x1[0].split('_') |
||||
|
let showName = `${x2[0]}.${x1[1]}` |
||||
|
return showName |
||||
|
} |
||||
|
|
||||
|
// setFileList = (value) => {
|
||||
|
// let defaultFileList = [];
|
||||
|
// defaultFileList = value.map((u, index) => {
|
||||
|
// let fileUrl = `${this.ApiRoot}/${u.url}`;
|
||||
|
// return {
|
||||
|
// uid: -index - 1,
|
||||
|
// name: this.dealName(u.url),
|
||||
|
// status: 'done',
|
||||
|
// storageUrl: u.url,
|
||||
|
// url: fileUrl
|
||||
|
// };
|
||||
|
// });
|
||||
|
// onChange(defaultFileList)
|
||||
|
// this.setState({
|
||||
|
// fileList: defaultFileList
|
||||
|
// });
|
||||
|
// };
|
||||
|
|
||||
|
componentDidMount() { |
||||
|
const { value } = this.props; |
||||
|
if (value) { |
||||
|
this.setState(value); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
componentWillReceiveProps(np) { |
||||
|
const { dispatch, value: thisEditData, onChange } = this.props; |
||||
|
const { value: nextEditData } = np; |
||||
|
|
||||
|
const setFileList = () => { |
||||
|
let defaultFileList = []; |
||||
|
defaultFileList = nextEditData.map((u, index) => { |
||||
|
let fileUrl = `${this.ApiRoot}/${u.storageUrl}`; |
||||
|
return { |
||||
|
uid: -index - 1, |
||||
|
name: this.dealName(u.storageUrl), |
||||
|
status: 'done', |
||||
|
storageUrl: u.storageUrl, |
||||
|
url: fileUrl, |
||||
|
size: u.size || -1 |
||||
|
}; |
||||
|
}); |
||||
|
this.setState({ |
||||
|
fileList: defaultFileList |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
if (nextEditData && nextEditData.length) { |
||||
|
if (!thisEditData || !this.state.fileList.length) { |
||||
|
setFileList(); |
||||
|
} else if (nextEditData.length != thisEditData.length) { |
||||
|
setFileList(); |
||||
|
} else { |
||||
|
let repeat = true; |
||||
|
for (let i = 0; i < thisEditData.length; i++) { |
||||
|
if (thisEditData[i] != nextEditData[i]) { |
||||
|
repeat = false; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
if (!repeat) { |
||||
|
setFileList(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
// else{
|
||||
|
// this.setState({
|
||||
|
// fileList:[],
|
||||
|
// })
|
||||
|
// }
|
||||
|
} |
||||
|
|
||||
|
render() { |
||||
|
const UploadPath = { |
||||
|
project: ['txt', 'dwg', 'doc', 'docx', 'xls', 'xlsx', 'pdf', 'png', 'jpg', 'rar', 'zip'], |
||||
|
report: ['doc', 'docx', 'xls', 'xlsx', 'pdf'], |
||||
|
data: ['txt', 'xls', 'xlsx'], |
||||
|
image: ['png', 'jpg', 'svg', 'jpeg'], |
||||
|
three: ['js'], |
||||
|
video: ['mp4'] |
||||
|
}; |
||||
|
/** |
||||
|
* uploadType 【string】 主要区别文件上传路径 以及类型 以 web/routes/attachment/index.js 中 UploadPath 的 key 值为准;默认 project; |
||||
|
* disabled 【boolean】 上传是否可用 |
||||
|
* maxFilesNum 【number】 最大上传数量 |
||||
|
* fileTypes 【array[string]】 可允许上传的文件类型; |
||||
|
* maxFileSize 【number】 单个文件最大大小 M |
||||
|
* listType 【antd】 upload 组件的属性 |
||||
|
* onChange 【function】 文件数量变化时候回调 返回文件 |
||||
|
* value 【array[obj]】 编辑数据 [{url:'xxx', [size:999]}] |
||||
|
* onStateChange 【function】 文件状态改变回调函数 上传中 return { uploading:true/false } |
||||
|
*/ |
||||
|
const { |
||||
|
uploadType, |
||||
|
disabled, |
||||
|
maxFilesNum, |
||||
|
fileTypes, |
||||
|
maxFileSize, |
||||
|
listType, |
||||
|
onChange, |
||||
|
value, |
||||
|
showUploadList, |
||||
|
onStateChange |
||||
|
} = this.props; |
||||
|
const { fileList, curPreviewPic, delPicIng, removeFilesList } = this.state; |
||||
|
const that = this; |
||||
|
let uploadType_ = uploadType || 'project'; |
||||
|
let maxFilesNum_ = maxFilesNum || 1; |
||||
|
let defaultFileTypes = fileTypes || UploadPath[uploadType_]; |
||||
|
const uploadProps = { |
||||
|
name: 'checkFile_', |
||||
|
multiple: false, |
||||
|
showUploadList: showUploadList || true, |
||||
|
action: `${this.ApiRoot}/attachments/${uploadType_}`, |
||||
|
listType: listType || 'text', |
||||
|
disabled: disabled, |
||||
|
beforeUpload: (file) => { |
||||
|
if (fileList.length >= maxFilesNum_) { |
||||
|
message.warning(`最多选择${maxFilesNum_}个文件上传`); |
||||
|
return false; |
||||
|
} |
||||
|
if (file.name.length > 60) { |
||||
|
message.warning(`文件名过长(大于60字符),请修改后上传`); |
||||
|
return false; |
||||
|
} |
||||
|
const extNames = file.name.split('.'); |
||||
|
var reg = /^[\.\s\u4e00-\u9fa5a-zA-Z0-9_-]{0,}$/; |
||||
|
if (!reg.exec(file.name)) { |
||||
|
message.warning(`文件名包含除字母、汉字、数字、中划线、下划线之外的字符,请修改后上传`); |
||||
|
return false; |
||||
|
} |
||||
|
let isDAE = false; |
||||
|
if (extNames.length > 0) { |
||||
|
let fileType = extNames[extNames.length - 1].toLowerCase(); |
||||
|
isDAE = defaultFileTypes.some((f) => f == fileType); |
||||
|
} |
||||
|
if (!isDAE) { |
||||
|
message.error(`只能上传 ${defaultFileTypes.join()} 格式的文件!`); |
||||
|
return false; |
||||
|
} |
||||
|
const isLt = file.size / 1024 / 1024 < (maxFileSize || 3); |
||||
|
if (!isLt) { |
||||
|
message.error(`文件必须小于${maxFileSize || 3}MB!`); |
||||
|
return false; |
||||
|
} |
||||
|
this.setState({ |
||||
|
fileUploading: true |
||||
|
}); |
||||
|
if (onStateChange) { |
||||
|
onStateChange({ uploading: true }); |
||||
|
} |
||||
|
}, |
||||
|
onChange(info) { |
||||
|
const status = info.file.status; |
||||
|
if (status === 'uploading') { |
||||
|
that.setState({ |
||||
|
fileList: info.fileList |
||||
|
}); |
||||
|
} |
||||
|
if (status === 'done') { |
||||
|
let { uploaded, url } = info.file.response; |
||||
|
let size = info.file.size; |
||||
|
let nextFileList = fileList; |
||||
|
nextFileList[nextFileList.length - 1] = { |
||||
|
uid: -moment().unix(), |
||||
|
name: that.dealName(uploaded), |
||||
|
status: 'done', |
||||
|
storageUrl: uploaded, |
||||
|
url: url, |
||||
|
size: size |
||||
|
}; |
||||
|
onChange(nextFileList); |
||||
|
that.setState({ |
||||
|
fileUploading: false, |
||||
|
fileList: nextFileList |
||||
|
}); |
||||
|
if (onStateChange) { |
||||
|
onStateChange({ uploading: false }); |
||||
|
} |
||||
|
} else if (status === 'error') { |
||||
|
that.setState({ |
||||
|
fileUploading: false |
||||
|
}); |
||||
|
message.error(`${info.file.name} 上传失败,请重试`); |
||||
|
if (onStateChange) { |
||||
|
onStateChange({ uploading: false }); |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
onRemove(file) { |
||||
|
let nextFileList = []; |
||||
|
fileList.map((f, i) => { |
||||
|
if (f.uid != file.uid) { |
||||
|
nextFileList.push(f); |
||||
|
} |
||||
|
}); |
||||
|
let nextRemoveFiles = removeFilesList.concat([file.storageUrl]); |
||||
|
if (curPreviewPic == file.url) { |
||||
|
that.setState({ |
||||
|
curPreviewPic: '' |
||||
|
}); |
||||
|
} |
||||
|
onChange(nextFileList); |
||||
|
that.setState({ |
||||
|
fileList: nextFileList, |
||||
|
removeFilesList: nextRemoveFiles |
||||
|
}); |
||||
|
}, |
||||
|
onPreview(file) { |
||||
|
let filePostfix = file.url.split('.').pop(); |
||||
|
filePostfix = filePostfix.toLowerCase(); |
||||
|
if (UploadPath.image.some((img) => img == filePostfix)) { |
||||
|
that.setState({ |
||||
|
curPreviewPic: file.url |
||||
|
}); |
||||
|
} else { |
||||
|
message.warn('仅支持图片预览'); |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
let fileList_ = fileList |
||||
|
// .map(f => {
|
||||
|
// if (f.storageUrl) {
|
||||
|
// let realName = f.storageUrl.split('/').pop()
|
||||
|
// if (f.name != realName) {
|
||||
|
// f.name = realName
|
||||
|
// }
|
||||
|
// }
|
||||
|
// return f
|
||||
|
// })
|
||||
|
|
||||
|
return ( |
||||
|
<div> |
||||
|
<Spin spinning={delPicIng}> |
||||
|
<Upload {...uploadProps} fileList={fileList_}> |
||||
|
{ |
||||
|
disabled ? ( |
||||
|
'' |
||||
|
) : |
||||
|
listType == 'picture-card' ? |
||||
|
( |
||||
|
fileList.length >= maxFilesNum_ ? null : ( |
||||
|
<div style={{}}> |
||||
|
<PlusOutlined /> |
||||
|
<div>上传图片</div> |
||||
|
</div> |
||||
|
) |
||||
|
) : ( |
||||
|
<Button disabled={fileList.length >= maxFilesNum_} icon={<UploadOutlined />}> 文件上传 </Button> |
||||
|
) |
||||
|
} |
||||
|
</Upload> |
||||
|
{ |
||||
|
curPreviewPic ? ( |
||||
|
<Card |
||||
|
bodyStyle={{ |
||||
|
padding: 8 |
||||
|
}} |
||||
|
> |
||||
|
<div style={{ marginBottom: 8 }} > |
||||
|
<span>文件预览</span> |
||||
|
<span |
||||
|
style={{ float: 'right' }} |
||||
|
onClick={() => { this.setState({ curPreviewPic: '' }); }} |
||||
|
> |
||||
|
<CloseOutlined style={{ fontSize: 20 }} /> |
||||
|
</span> |
||||
|
</div> |
||||
|
<img style={{ width: '100%' }} src={curPreviewPic}></img> |
||||
|
</Card> |
||||
|
) : '' |
||||
|
} |
||||
|
</Spin> |
||||
|
</div> |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
function mapStateToProps(state) { |
||||
|
const { auth } = state |
||||
|
return { |
||||
|
user: auth.user |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
export default connect(mapStateToProps)(Uploads); |
@ -0,0 +1,74 @@ |
|||||
|
'use strict'; |
||||
|
import React, { Component } from 'react'; |
||||
|
import { Table } from 'antd'; |
||||
|
import './index.less'; |
||||
|
import moment from 'moment'; |
||||
|
|
||||
|
class FlowRecordTable extends Component { |
||||
|
constructor(props) { |
||||
|
super(props); |
||||
|
this.state = { |
||||
|
isRequesting: false, |
||||
|
pagination: { |
||||
|
showTotal: total => `共${total}条`, |
||||
|
responsive: true, |
||||
|
defaultPageSize: 10, |
||||
|
}, |
||||
|
data: [] |
||||
|
} |
||||
|
this.token = JSON.parse(sessionStorage.getItem('user')).token; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
getPagination = () => { |
||||
|
const { pagination, data } = this.state; |
||||
|
const { actiPage } = this.props; |
||||
|
pagination.total = data.length > 0 ? data.length : 0; |
||||
|
pagination.current = actiPage; |
||||
|
return pagination; |
||||
|
}; |
||||
|
|
||||
|
onTableChange = (pagination, filters, sorter) => { |
||||
|
this.props.onPageChange(pagination.current) |
||||
|
} |
||||
|
componentDidMount() { |
||||
|
} |
||||
|
render() { |
||||
|
const { flowRecord } = this.props; |
||||
|
const tableColumnAttrs = [ |
||||
|
{ |
||||
|
title: '序号', |
||||
|
dataIndex: 'id', |
||||
|
width: '12%', |
||||
|
render: (text, record, index) => { return index + 1 } |
||||
|
}, |
||||
|
{ |
||||
|
title: '操作人', |
||||
|
dataIndex: 'processBy', |
||||
|
width: '25%', |
||||
|
}, |
||||
|
{ |
||||
|
title: '操作时间', |
||||
|
dataIndex: 'processAt', |
||||
|
width: '25%', |
||||
|
render: (text, record, index) => { return moment(text).format('YYYY-MM-DD HH:mm') } |
||||
|
}, { |
||||
|
title: '操作内容', |
||||
|
dataIndex: 'processContent', |
||||
|
width: '38%', |
||||
|
}, |
||||
|
]; |
||||
|
return ( |
||||
|
<Table |
||||
|
rowKey="id" |
||||
|
className={'fs-table'} |
||||
|
dataSource={flowRecord} |
||||
|
columns={tableColumnAttrs} |
||||
|
onChange={this.onTableChange} |
||||
|
pagination={this.getPagination()} |
||||
|
/> |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export default FlowRecordTable; |
@ -0,0 +1,22 @@ |
|||||
|
|
||||
|
'use strict'; |
||||
|
|
||||
|
import Upload from './Upload'; |
||||
|
import NoResource from './no-resource'; |
||||
|
import LimitTextArea from './limit-textarea'; |
||||
|
import ProcessForm from './process_form' |
||||
|
import FlowRecordTable from './flowRecordTable' |
||||
|
import Table from './table' |
||||
|
import Search from './search' |
||||
|
import SketchColor from './sketchColor' |
||||
|
|
||||
|
export { |
||||
|
Upload, |
||||
|
NoResource, |
||||
|
LimitTextArea, |
||||
|
ProcessForm, |
||||
|
FlowRecordTable, |
||||
|
Table, |
||||
|
Search, |
||||
|
SketchColor |
||||
|
}; |