diff --git a/api/app/lib/controllers/patrolPlan/patrolPlan.js b/api/app/lib/controllers/patrolPlan/patrolPlan.js deleted file mode 100644 index f0e7584..0000000 --- a/api/app/lib/controllers/patrolPlan/patrolPlan.js +++ /dev/null @@ -1,122 +0,0 @@ -'use strict'; - -async function getPatrolPlan(ctx, next) { - try { - const models = ctx.fs.dc.models; - const { limit, page } = ctx.query; - let options = { - include: [{ - required: true, - model: models.User, - attributes: ['id', 'name'], - include: [{ - required: true, - model: models.Department, - attributes: ['id', 'name'], - }] - }, { - required: true, - model: models.Project, - attributes: ['id', 'name'], - }] - }; - if (limit) { - options.limit = Number(limit); - } - if (page && limit) { - options.offset = Number(page) * Number(limit); - } - let res = await models.PatrolPlan.findAndCountAll(options); - ctx.status = 200; - ctx.body = res; - } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); - ctx.status = 400; - ctx.body = { - "message": "获取巡检计划失败" - } - } -} - -async function createPatrolPlan(ctx, next) { - try { - const models = ctx.fs.dc.models; - const data = ctx.request.body; - const { name, way, structureId, startTime, endTime, frequency, points, userId } = data; - - let plan = { name, way, structureId, startTime, endTime, frequency, points, userId }; - - await models.PatrolPlan.create(plan); - - ctx.status = 204; - } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); - ctx.status = 400; - ctx.body = { - "message": '新增巡检计划失败' - } - } -} - -async function updatePatrolPlan(ctx, next) { - try { - let errMsg = '修改巡检计划失败'; - const models = ctx.fs.dc.models; - const data = ctx.request.body; - const { name, way, structureId, startTime, endTime, frequency, points, userId } = data; - - let plan = { name, way, structureId, startTime, endTime, frequency, points, userId }; - - if (data && data.id) { - await models.PatrolPlan.update(plan, { - where: { id: data.id } - }) - } else { - errMsg = '请传入巡检计划id'; - throw errMsg; - } - - ctx.status = 204; - } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); - ctx.status = 400; - ctx.body = { - "message": errMsg - } - } -} - -async function delPatrolPlan(ctx, next) { - try { - let errMsg = '删除巡检计划失败'; - - const models = ctx.fs.dc.models; - const { id } = ctx.params; - - const record = await models.PatrolRecord.findOne({ - where: { patrolPlanId: id } - }); - - if (record) { - errMsg = '不能删除有巡检记录的计划'; - throw errMsg; - } - - await models.PatrolPlan.destroy({ - where: { id } - }) - - ctx.status = 204; - } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); - ctx.status = 400; - ctx.body = { message: error } - } -} - -module.exports = { - getPatrolPlan, - createPatrolPlan, - updatePatrolPlan, - delPatrolPlan, -} \ No newline at end of file diff --git a/api/app/lib/controllers/patrolRecord/patrolRecord.js b/api/app/lib/controllers/patrolRecord/patrolRecord.js deleted file mode 100644 index baefeb2..0000000 --- a/api/app/lib/controllers/patrolRecord/patrolRecord.js +++ /dev/null @@ -1,113 +0,0 @@ -'use strict'; - -async function findPatrolRecord(ctx, next) { - let rslt = []; - let error = { name: 'FindError', message: '获取巡检记录失败' }; - try { - const models = ctx.fs.dc.models; - const { startTime, endTime, alarm, patrolPlanId, pointId } = ctx.params; - // patrolPlanId传all查所有 - if (patrolPlanId == 'all') { - /* 如果有startTime && endTime,查询所有符合条件的数据 */ - if (startTime !== 'null' && endTime !== 'null') { - if (pointId !== 'null') { - if (alarm == 'null') { - rslt = await models.PatrolRecord.findAll({ - where: { inspectionTime: { $between: [startTime, endTime] }, pointId: { $in: pointId.split(',') } }, - }); - } else { - rslt = await models.PatrolRecord.findAll({ - where: { alarm, inspectionTime: { $between: [startTime, endTime] }, pointId: { $in: pointId.split(',') } }, - }); - } - } else { - if (alarm == 'null') { - rslt = await models.PatrolRecord.findAll({ - where: { inspectionTime: { $between: [startTime, endTime] } }, - }); - } else { - rslt = await models.PatrolRecord.findAll({ - where: { alarm, inspectionTime: { $between: [startTime, endTime] } }, - }); - } - } - } else { - /* 如果没有startTime && endTime,查询每个点位最新一条符合条件的数据 */ - let a = [] - if (pointId !== 'null') { - a = await models.PatrolRecord.findAll({ - where: { pointId: { $in: pointId.split(',') } }, - }); - } - rslt = pointId.split(',').map(i => { - return a.filter(t => t.pointId == i).sort((a, b) => b.id - a.id)[0] || null - }) - } - } else { - if (startTime !== 'null' && endTime !== 'null') { - if (pointId !== 'null') { - rslt = await models.PatrolRecord.findAll({ - where: { patrolPlanId: { $in: patrolPlanId.split(',') }, alarm, inspectionTime: { $between: [startTime, endTime] }, pointId: { $in: pointId.split(',') } }, - }); - } else { - rslt = await models.PatrolRecord.findAll({ - where: { patrolPlanId: { $in: patrolPlanId.split(',') }, alarm, inspectionTime: { $between: [startTime, endTime] } }, - }); - } - - } else { - let a = [] - /* 如果没有startTime && endTime,查询每个点位最新一条符合条件的数据 */ - if (pointId !== 'null') { - a = await models.PatrolRecord.findAll({ - where: { patrolPlanId: { $in: patrolPlanId.split(',') }, pointId: { $in: pointId.split(',') } }, - }); - } else { - a = await models.PatrolRecord.findAll({ - where: { patrolPlanId: { $in: patrolPlanId.split(',') } }, - }); - } - - rslt = pointId.split(',').map(i => { - return a.filter(t => t.pointId == i).sort((a, b) => b.id - a.id)[0] || null - }) - } - } - - ctx.status = 200; - ctx.body = rslt; - error = null - } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); - ctx.status = 400; - ctx.body = { - "message": "获取巡检记录失败" - } - } -} - -async function addPatrolRecord(ctx, next) { - let error = { name: 'addError', message: '新增巡检记录失败' }; - try { - const models = ctx.fs.dc.models; - const data = ctx.request.body; - let { patrolPlanId, lastInspectionTime, inspectionTime, points, alarm, pointId } = data - let record = { patrolPlanId, lastInspectionTime, inspectionTime, points, alarm, pointId } - - await models.PatrolRecord.create(record); - - ctx.status = 204; - error = null - } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); - ctx.status = 400; - ctx.body = { - "message": '新增巡检计划失败' - } - } -} - -module.exports = { - findPatrolRecord, - addPatrolRecord, -} \ No newline at end of file diff --git a/api/app/lib/controllers/projectRegime/projectSituation.js b/api/app/lib/controllers/projectRegime/projectSituation.js deleted file mode 100644 index 6b3fe83..0000000 --- a/api/app/lib/controllers/projectRegime/projectSituation.js +++ /dev/null @@ -1,431 +0,0 @@ -'use strict'; - - -async function projectList (ctx, next) { - try { - const models = ctx.fs.dc.models; - let userInfo = ctx.fs.api.userInfo; - const { limit, page, name, justStructure } = ctx.query; - - let options = { - where: { - - }, - // include: [{ - // as: 'company', - // model: models.Company, - // attributes: ['id', 'name'], - // },], - } - if (limit) { - options.limit = Number(limit) - } - if (page && limit) { - options.offset = Number(page) * Number(limit) - } - if (name) { - options.where.name = { $like: `%${name}%` } - } - - let res = [] - if (justStructure) { - res = await models.Project.findAndCountAll({ - attributes: ['id', 'name'], - }) - } else { - res = await models.Project.findAndCountAll(options) - } - - ctx.status = 200; - ctx.body = res - } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); - ctx.status = 400; - ctx.body = { - "message": "获取结构列表失败" - } - } -} - - -async function postAddProject (ctx, next) { - try { - const models = ctx.fs.dc.models; - let userInfo = ctx.fs.api.userInfo; - const data = ctx.request.body; - const { img, longitude, latitude, name, type, describe } = data - - let errMsg = data.id ? '结构物编辑失败' : '结构物新增失败' - let project = { img, longitude, latitude, name, type, describe, userId: userInfo.id } - - const alikeProject = await models.Project.findOne({ - where: { - name: name, - } - }) - - if ((!data.id && alikeProject) || (alikeProject && alikeProject.id !== data.id)) { - errMsg = '已有相同结构物名称' - throw errMsg - } - if (data && data.id) { - await models.Project.update(project, { - where: { - id: data.id - } - }) - } else { - await models.Project.create(project) - } - - - ctx.status = 204; - } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`) - ctx.status = 400; - ctx.body = { - "message": errMsg - } - } -} - -async function delProject (ctx, next) { - try { - const models = ctx.fs.dc.models; - let userInfo = ctx.fs.api.userInfo; - const { id } = ctx.params - - //删除结构物 - await models.Project.destroy({ - where: { - id, - } - }) - const pointId = [] - const pointLIst = await models.Point.findAll({ - where: { - projectId: id, - }, - attributes: ['id'], - }) - pointLIst.map(v => pointId.push(v.id)) - - //点位 - await models.Point.destroy({ - where: { - projectId: id - } - }) - - - //巡检计划 - const planId = [] - const planLIst = await models.PatrolPlan.findAll({ - where: { - structureId: id, - }, - attributes: ['id'], - }) - planLIst.map(v => planId.push(v.id)) - await models.PatrolPlan.destroy({ - where: { - structureId: id - } - }) - - //巡检记录 - await models.PatrolRecord.destroy({ - where: { - pointId: { $in: pointId }, - patrolPlanId: { $in: planId } - } - }) - - - ctx.status = 204; - } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`) - ctx.status = 400; - ctx.body = { - "message": '删除结构物失败' - } - } -} - -async function addPosition (ctx, next) { - try { - const models = ctx.fs.dc.models; - let userInfo = ctx.fs.api.userInfo; - const data = ctx.request.body; - const { longitude, latitude, name, describe, qrCode, projectId, } = data - - let errMsg = data.id ? '点位编辑失败' : '点位新增失败' - let pointData = { longitude, latitude, name, describe, qrCode, projectId } - - const alikeProject = await models.Point.findOne({ - where: { - id: data.id, - } - }) - - if (data && data.id) { - if (qrCode) { - await models.Point.update({ ...alikeProject, qrCode }, { - where: { - id: data.id, - } - }) - } else { - await models.Point.update({ pointData }, { - where: { - id: data.id, - } - }) - } - - } else { - await models.Point.create(pointData) - } - - - ctx.status = 204; - } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`) - ctx.status = 400; - ctx.body = { - "message": errMsg - } - } -} - -async function position (ctx, next) { - try { - const models = ctx.fs.dc.models; - let userInfo = ctx.fs.api.userInfo; - const { limit, page, projectId } = ctx.query; - - let options = { - where: { - id: projectId - }, - include: [{ - model: models.Point, - },], - } - if (limit) { - options.limit = Number(limit) - } - if (page && limit) { - options.offset = Number(page) * Number(limit) - } - - let res = await models.Project.findAndCountAll(options) - ctx.status = 200; - ctx.body = res - } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); - ctx.status = 400; - ctx.body = { - "message": "获取结构列表失败" - } - } -} - -async function delPosition (ctx, next) { - try { - const models = ctx.fs.dc.models; - let userInfo = ctx.fs.api.userInfo; - const { id } = ctx.params - - const pointOne = await models.Point.findOne({ - where: { - id - }, - attributes: ['projectId'], - }) - if (pointOne) { - const patrolPlanLIst = await models.PatrolPlan.findAll({ - where: { - structureId: pointOne.projectId, - }, - }) - - for (var u of patrolPlanLIst) { - const points = [] - u.points.map(r => { - if (r.id == id) { - } else { - points.push(r) - } - }) - u.points = points - - await models.PatrolRecord.destroy({ - where: { - pointId: id, - patrolPlanId: u.id - } - }) - - if (points.length > 0) { - let data = { - name: u.dataValues.name, - way: u.dataValues.way, - structureId: u.dataValues.structureId, - startTime: u.dataValues.startTime, - endTime: u.dataValues.endTime, - frequency: u.dataValues.frequency, - points: u.dataValues.points, - userId: u.dataValues.userId, - patrolCount: u.dataValues.patrolCount - } - await models.PatrolPlan.update(data,{ - where: { - id: u.dataValues.id - } - }) - } else { - await models.PatrolPlan.destroy({ - where: { - id: u.id - } - }) - } - } - - } - - await models.Point.destroy({ - where: { - id, - } - }) - - - ctx.status = 204; - } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`) - ctx.status = 400; - ctx.body = { - "message": '删除点位失败' - } - } -} - - -async function qrCodeShow (ctx, next) { - try { - const models = ctx.fs.dc.models; - let userInfo = ctx.fs.api.userInfo; - const { projectId, name } = ctx.query; - - let options = { - where: { - qrCode: { $ne: null } - }, - } - if (projectId) { - options.where.projectId = projectId - } - if (name) { - options.where.name = { $like: `%${name}%` } - } - - let res = await models.Point.findAndCountAll(options) - ctx.status = 200; - ctx.body = res - } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); - ctx.status = 400; - ctx.body = { - "message": "获取二维码列表失败" - } - } -} - - -async function q (ctx) { - // let error = { - // name: 'FindError', - // message: "获取失败!" - // }; - // const models = ctx.fs.dc.models; - // const { devices } = ctx.request.body - // const attachment = ctx.app.fs.qn_attachment - - // try { - - // if (!Array.isArray(devices)) { - // error = { name: 'paramsError', message: '参数不能为空' }; - // ctx.throw(400); - // } - // const devicesArr = await models.Device.findAll({ - // attributes: ['deviceNo', 'periodCode', 'qrSrc'], - // where: { deviceNo: { $in: devices } } - // }) - - // let ids = [], idsMap = {}, qnImages = [] - // devicesArr.forEach(d => { - // const qrSrc = d.qrSrc - // const deviceNo = d.deviceNo - // const periodCode = d.periodCode - // if (qrSrc) { - // if (/^\d+$/.test(qrSrc)) { - // ids.push(qrSrc) - // idsMap[qrSrc] = { deviceNo, periodCode } - // } else { - // let domain = globalCache.getQnDomain() - // let imgUrl = `${domain}/${qrSrc}` - // qnImages.push({ src: imgUrl, deviceNo, periodCode }) - // } - // } - // }) - - // const docs = await models.QrcodePng.findAll({ - // where: { - // id: { $in: ids } - // }, - // attributes: ["id", "base64"] - // }) - - // let pics = [] - - // if (docs.length > 0) { - // pics = docs.map((d) => { - // let { deviceNo, periodCode } = idsMap[d.id] || {} - // let base64 = d.base64.replace(/^data:image\/\w+;base64,/, '') - // return { - // url: Buffer.from(base64, 'base64'), - // name: deviceNo, - // periodCode - // } - // }) - // } - - // if (qnImages.length > 0) { - // let qns = await downloadImgsAsBase64(qnImages) - // pics = pics.concat(qns) - // } - - // let fileUrl = await downLoadImageBiz(pics, { zipName: "二维码_" + moment().format("YYYY-MM-DD-HH-mm-ss"), attachment }) - // add2CleanCache(fileUrl, attachment) - // ctx.status = 200 - // ctx.body = { fileUrl } - - // } catch (err) { - // ctx.fs.logger.error(err); - // ctx.status = 400; - // ctx.body = error; - // } -} - -module.exports = { - projectList, - postAddProject, - delProject, - addPosition, - position, - delPosition, - qrCodeShow, - q -} \ No newline at end of file diff --git a/api/app/lib/routes/patrolPlan/patrolPlan.js b/api/app/lib/routes/patrolPlan/patrolPlan.js deleted file mode 100644 index 5f0e455..0000000 --- a/api/app/lib/routes/patrolPlan/patrolPlan.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -const patrolPlan = require('../../controllers/patrolPlan/patrolPlan'); - -module.exports = function (app, router, opts) { - app.fs.api.logAttr['GET/patrolPlan'] = { content: '获取巡检计划', visible: false }; - router.get('/patrolPlan', patrolPlan.getPatrolPlan); - - app.fs.api.logAttr['POST/patrolPlan'] = { content: '新增巡检计划', visible: true }; - router.post('/patrolPlan', patrolPlan.createPatrolPlan); - - app.fs.api.logAttr['PUT/patrolPlan'] = { content: '修改巡检计划', visible: true }; - router.put('/patrolPlan', patrolPlan.updatePatrolPlan); - - app.fs.api.logAttr['DELETE/patrolPlan/:id'] = { content: '删除巡检计划', visible: true }; - router.del('/patrolPlan/:id', patrolPlan.delPatrolPlan); -}; \ No newline at end of file diff --git a/api/app/lib/routes/patrolRecord/patrolRecord.js b/api/app/lib/routes/patrolRecord/patrolRecord.js deleted file mode 100644 index 48f3d4b..0000000 --- a/api/app/lib/routes/patrolRecord/patrolRecord.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; -const patrolRecord = require('../../controllers/patrolRecord/patrolRecord'); - -module.exports = function (app, router, opts) { - app.fs.api.logAttr['GET/patrolRecord/:patrolPlanId/:startTime/:endTime/:alarm/:pointId'] = { content: '获取巡检记录', visible: true }; - // web端、小程序端查数据:patrolPlanId为all,不需要传pointId - // 小程序端查点位最新一条数据:startTime、endTime、alarm不传 - router.get('/patrolRecord/:patrolPlanId/:startTime/:endTime/:alarm/:pointId', patrolRecord.findPatrolRecord); - - app.fs.api.logAttr['POST/patrolRecord/add'] = { content: '新增巡检记录', visible: true } - router.post('/patrolRecord/add', patrolRecord.addPatrolRecord); -}; \ No newline at end of file diff --git a/api/app/lib/routes/projectRegime/index.js b/api/app/lib/routes/projectRegime/index.js deleted file mode 100644 index a81a805..0000000 --- a/api/app/lib/routes/projectRegime/index.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; - -const projectSituation = require('../../controllers/projectRegime/projectSituation'); - -module.exports = function (app, router, opts) { - - app.fs.api.logAttr['GET/projectList'] = { content: '获取结构物列表', visible: false }; - router.get('/projectList', projectSituation.projectList); - - app.fs.api.logAttr['POST/addProject'] = { content: '新增修改结构物', visible: false }; - router.post('/addProject', projectSituation.postAddProject); - - app.fs.api.logAttr['DEL/delProject/:id'] = { content: '删除结构物', visible: false }; - router.del('/delProject/:id', projectSituation.delProject); - - app.fs.api.logAttr['POST/position'] = { content: '新增修改点位', visible: false }; - router.post('/position', projectSituation.addPosition); - - app.fs.api.logAttr['GET/position'] = { content: '获取点位列表', visible: false }; - router.get('/position', projectSituation.position); - - app.fs.api.logAttr['DEL/delPosition/:id'] = { content: '删除点位', visible: false }; - router.del('/delPosition/:id', projectSituation.delPosition); - - app.fs.api.logAttr['GET/qrCodeShow'] = { content: '获取二维码列表', visible: false }; - router.get('/qrCodeShow', projectSituation.qrCodeShow); - - app.fs.api.logAttr['GET/q'] = { content: '获取二维码列表', visible: false }; - router.get('/q', projectSituation.q); - -} \ No newline at end of file diff --git a/web/client/assets/images/avatar/1.png b/web/client/assets/images/avatar/1.png deleted file mode 100644 index 52dbdb8..0000000 Binary files a/web/client/assets/images/avatar/1.png and /dev/null differ diff --git a/web/client/assets/images/avatar/10.png b/web/client/assets/images/avatar/10.png deleted file mode 100644 index a543c2a..0000000 Binary files a/web/client/assets/images/avatar/10.png and /dev/null differ diff --git a/web/client/assets/images/avatar/11.png b/web/client/assets/images/avatar/11.png deleted file mode 100644 index f569e09..0000000 Binary files a/web/client/assets/images/avatar/11.png and /dev/null differ diff --git a/web/client/assets/images/avatar/12.png b/web/client/assets/images/avatar/12.png deleted file mode 100644 index 7265983..0000000 Binary files a/web/client/assets/images/avatar/12.png and /dev/null differ diff --git a/web/client/assets/images/avatar/2.png b/web/client/assets/images/avatar/2.png deleted file mode 100644 index 708e41d..0000000 Binary files a/web/client/assets/images/avatar/2.png and /dev/null differ diff --git a/web/client/assets/images/avatar/3.png b/web/client/assets/images/avatar/3.png deleted file mode 100644 index 933b3f1..0000000 Binary files a/web/client/assets/images/avatar/3.png and /dev/null differ diff --git a/web/client/assets/images/avatar/4.png b/web/client/assets/images/avatar/4.png deleted file mode 100644 index 793baca..0000000 Binary files a/web/client/assets/images/avatar/4.png and /dev/null differ diff --git a/web/client/assets/images/avatar/5.png b/web/client/assets/images/avatar/5.png deleted file mode 100644 index c66ec46..0000000 Binary files a/web/client/assets/images/avatar/5.png and /dev/null differ diff --git a/web/client/assets/images/avatar/6.png b/web/client/assets/images/avatar/6.png deleted file mode 100644 index 157f56a..0000000 Binary files a/web/client/assets/images/avatar/6.png and /dev/null differ diff --git a/web/client/assets/images/avatar/7.png b/web/client/assets/images/avatar/7.png deleted file mode 100644 index ddd4f3d..0000000 Binary files a/web/client/assets/images/avatar/7.png and /dev/null differ diff --git a/web/client/assets/images/avatar/8.png b/web/client/assets/images/avatar/8.png deleted file mode 100644 index 3a01c87..0000000 Binary files a/web/client/assets/images/avatar/8.png and /dev/null differ diff --git a/web/client/assets/images/avatar/9.png b/web/client/assets/images/avatar/9.png deleted file mode 100644 index 0a952d4..0000000 Binary files a/web/client/assets/images/avatar/9.png and /dev/null differ diff --git a/web/client/assets/images/avatar/avatar.jpg b/web/client/assets/images/avatar/avatar.jpg deleted file mode 100644 index dd6739f..0000000 Binary files a/web/client/assets/images/avatar/avatar.jpg and /dev/null differ diff --git a/web/client/assets/images/homePage/close.png b/web/client/assets/images/homePage/close.png deleted file mode 100644 index 4bff91d..0000000 Binary files a/web/client/assets/images/homePage/close.png and /dev/null differ diff --git a/web/client/assets/images/homePage/gis-infowindow-bg.png b/web/client/assets/images/homePage/gis-infowindow-bg.png deleted file mode 100644 index 3099ec5..0000000 Binary files a/web/client/assets/images/homePage/gis-infowindow-bg.png and /dev/null differ diff --git a/web/client/assets/images/homePage/gis/marker.gif b/web/client/assets/images/homePage/gis/marker.gif deleted file mode 100644 index f6d4830..0000000 Binary files a/web/client/assets/images/homePage/gis/marker.gif and /dev/null differ diff --git a/web/client/assets/images/homePage/gis/mingchu_anquan.png b/web/client/assets/images/homePage/gis/mingchu_anquan.png deleted file mode 100644 index 1d7c906..0000000 Binary files a/web/client/assets/images/homePage/gis/mingchu_anquan.png and /dev/null differ diff --git a/web/client/assets/images/homePage/gis/mingchu_weisheng.png b/web/client/assets/images/homePage/gis/mingchu_weisheng.png deleted file mode 100644 index 154a89d..0000000 Binary files a/web/client/assets/images/homePage/gis/mingchu_weisheng.png and /dev/null differ diff --git a/web/client/assets/images/homePage/gis/企业-中低风险.png b/web/client/assets/images/homePage/gis/企业-中低风险.png deleted file mode 100644 index 89d709f..0000000 Binary files a/web/client/assets/images/homePage/gis/企业-中低风险.png and /dev/null differ diff --git a/web/client/assets/images/homePage/gis/企业-中风险.png b/web/client/assets/images/homePage/gis/企业-中风险.png deleted file mode 100644 index 02ee964..0000000 Binary files a/web/client/assets/images/homePage/gis/企业-中风险.png and /dev/null differ diff --git a/web/client/assets/images/homePage/gis/企业-低风险.png b/web/client/assets/images/homePage/gis/企业-低风险.png deleted file mode 100644 index 00e1f24..0000000 Binary files a/web/client/assets/images/homePage/gis/企业-低风险.png and /dev/null differ diff --git a/web/client/assets/images/homePage/gis/企业-高风险.png b/web/client/assets/images/homePage/gis/企业-高风险.png deleted file mode 100644 index d069ad6..0000000 Binary files a/web/client/assets/images/homePage/gis/企业-高风险.png and /dev/null differ diff --git a/web/client/assets/images/homePage/gis/特种设备企业.png b/web/client/assets/images/homePage/gis/特种设备企业.png deleted file mode 100644 index b3fa2cd..0000000 Binary files a/web/client/assets/images/homePage/gis/特种设备企业.png and /dev/null differ diff --git a/web/client/assets/images/homePage/gis/食堂.png b/web/client/assets/images/homePage/gis/食堂.png deleted file mode 100644 index 6c111e3..0000000 Binary files a/web/client/assets/images/homePage/gis/食堂.png and /dev/null differ diff --git a/web/client/assets/images/homePage/u1025.png b/web/client/assets/images/homePage/u1025.png deleted file mode 100644 index e0d61f1..0000000 Binary files a/web/client/assets/images/homePage/u1025.png and /dev/null differ diff --git a/web/client/assets/images/homePage/u1026.png b/web/client/assets/images/homePage/u1026.png deleted file mode 100644 index 5831a13..0000000 Binary files a/web/client/assets/images/homePage/u1026.png and /dev/null differ diff --git a/web/client/assets/images/homePage/u1031.png b/web/client/assets/images/homePage/u1031.png deleted file mode 100644 index 7b7b51c..0000000 Binary files a/web/client/assets/images/homePage/u1031.png and /dev/null differ diff --git a/web/client/assets/images/homePage/u1036.png b/web/client/assets/images/homePage/u1036.png deleted file mode 100644 index 0bfb677..0000000 Binary files a/web/client/assets/images/homePage/u1036.png and /dev/null differ diff --git a/web/client/assets/images/homePage/u133.png b/web/client/assets/images/homePage/u133.png deleted file mode 100644 index c17573c..0000000 Binary files a/web/client/assets/images/homePage/u133.png and /dev/null differ diff --git a/web/client/assets/images/homePage/u145.png b/web/client/assets/images/homePage/u145.png deleted file mode 100644 index 67b270a..0000000 Binary files a/web/client/assets/images/homePage/u145.png and /dev/null differ diff --git a/web/client/assets/images/homePage/u150.png b/web/client/assets/images/homePage/u150.png deleted file mode 100644 index e1181a0..0000000 Binary files a/web/client/assets/images/homePage/u150.png and /dev/null differ diff --git a/web/client/assets/images/homePage/u151.png b/web/client/assets/images/homePage/u151.png deleted file mode 100644 index 0bfb677..0000000 Binary files a/web/client/assets/images/homePage/u151.png and /dev/null differ diff --git a/web/client/assets/images/homePage/u162.png b/web/client/assets/images/homePage/u162.png deleted file mode 100644 index c734fac..0000000 Binary files a/web/client/assets/images/homePage/u162.png and /dev/null differ diff --git a/web/client/assets/images/homePage/u165.png b/web/client/assets/images/homePage/u165.png deleted file mode 100644 index b3f574b..0000000 Binary files a/web/client/assets/images/homePage/u165.png and /dev/null differ diff --git a/web/client/assets/images/homePage/u182.png b/web/client/assets/images/homePage/u182.png deleted file mode 100644 index 5bbeec3..0000000 Binary files a/web/client/assets/images/homePage/u182.png and /dev/null differ diff --git a/web/client/assets/images/homePage/u183.png b/web/client/assets/images/homePage/u183.png deleted file mode 100644 index 894305b..0000000 Binary files a/web/client/assets/images/homePage/u183.png and /dev/null differ diff --git a/web/client/assets/images/homePage/u184.png b/web/client/assets/images/homePage/u184.png deleted file mode 100644 index 2e51b5d..0000000 Binary files a/web/client/assets/images/homePage/u184.png and /dev/null differ diff --git a/web/client/assets/images/homePage/u189.png b/web/client/assets/images/homePage/u189.png deleted file mode 100644 index 34a2025..0000000 Binary files a/web/client/assets/images/homePage/u189.png and /dev/null differ diff --git a/web/client/assets/images/login.png b/web/client/assets/images/login.png deleted file mode 100644 index af4a5b6..0000000 Binary files a/web/client/assets/images/login.png and /dev/null differ diff --git a/web/client/assets/images/login_bg.png b/web/client/assets/images/login_bg.png deleted file mode 100644 index 08658af..0000000 Binary files a/web/client/assets/images/login_bg.png and /dev/null differ diff --git a/web/client/assets/images/logo.png b/web/client/assets/images/logo.png deleted file mode 100644 index 87a6aa3..0000000 Binary files a/web/client/assets/images/logo.png and /dev/null differ diff --git a/web/client/assets/images/monitor/chose-none.png b/web/client/assets/images/monitor/chose-none.png new file mode 100644 index 0000000..6da1f93 Binary files /dev/null and b/web/client/assets/images/monitor/chose-none.png differ diff --git a/web/client/assets/images/monitor/header-bg.png b/web/client/assets/images/monitor/header-bg.png new file mode 100644 index 0000000..3126b4a Binary files /dev/null and b/web/client/assets/images/monitor/header-bg.png differ diff --git a/web/client/assets/images/monitor/pitch-on.png b/web/client/assets/images/monitor/pitch-on.png new file mode 100644 index 0000000..f0c384d Binary files /dev/null and b/web/client/assets/images/monitor/pitch-on.png differ diff --git a/web/client/assets/images/monitor/screen-bg.png b/web/client/assets/images/monitor/screen-bg.png new file mode 100644 index 0000000..31e24df Binary files /dev/null and b/web/client/assets/images/monitor/screen-bg.png differ diff --git a/web/client/assets/images/monitor/strip.png b/web/client/assets/images/monitor/strip.png new file mode 100644 index 0000000..5843b36 Binary files /dev/null and b/web/client/assets/images/monitor/strip.png differ diff --git a/web/client/assets/images/monitor/user.png b/web/client/assets/images/monitor/user.png new file mode 100644 index 0000000..63de0c6 Binary files /dev/null and b/web/client/assets/images/monitor/user.png differ diff --git a/web/client/src/app.js b/web/client/src/app.js index 98d351d..c90edf7 100644 --- a/web/client/src/app.js +++ b/web/client/src/app.js @@ -3,10 +3,7 @@ import React, { useEffect } from 'react'; import Layout from './layout'; import Auth from './sections/auth'; -import Safetymanage from './sections/safetymanage'; -import ProjectRegime from './sections/projectRegime'; -import Organization from './sections/organization'; -import PatrolManage from './sections/patrolManage'; +import bigScreen from './sections/bigScreen'; const App = props => { const { projectName } = props @@ -18,7 +15,7 @@ const App = props => { return ( ) diff --git a/web/client/src/components/README.txt b/web/client/src/components/README.txt deleted file mode 100644 index e69de29..0000000 diff --git a/web/client/src/components/Upload/index.js b/web/client/src/components/Upload/index.js deleted file mode 100644 index eac0a27..0000000 --- a/web/client/src/components/Upload/index.js +++ /dev/null @@ -1,316 +0,0 @@ -'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 ( -
- - - { - disabled ? ( - '' - ) : - listType == 'picture-card' ? - ( - fileList.length >= maxFilesNum_ ? null : ( -
- -
上传图片
-
- ) - ) : ( - - ) - } -
- { - curPreviewPic ? ( - -
- 文件预览 - { this.setState({ curPreviewPic: '' }); }} - > - - -
- -
- ) : '' - } -
-
- ); - } -} - -function mapStateToProps(state) { - const { auth } = state - return { - user: auth.user - }; -} - -export default connect(mapStateToProps)(Uploads); diff --git a/web/client/src/components/Uploads/index.js b/web/client/src/components/Uploads/index.js deleted file mode 100644 index 8725880..0000000 --- a/web/client/src/components/Uploads/index.js +++ /dev/null @@ -1,389 +0,0 @@ -'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.qnDomain = localStorage.getItem('qnDomain'); - this.aliAdmin = localStorage.getItem('aliAdmin'); - this.state = { - fileUploading: false, - fileList: [], - curPreviewPic: '', - curPreviewVideo: '', - delPicIng: false, - removeFilesList: [] - }; - } - - dealName = (uploaded) => { - let realName = uploaded.split('/')[2] - // let x1 = realName.split('.') - // let postfix = x1.pop() - // let allName = x1.join('.') - // let x2 = allName.split('_') - // let showName = `${x2[0]}.${postfix}` - return realName - } - - // 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 - // }); - // }; - - setFileList = (nextEditData, isQiniu, isAli) => { - let defaultFileList = []; - defaultFileList = nextEditData.map((u, index) => { - let fileUrl = - isQiniu ? `/_file-server/${u.storageUrl}` - : isAli ? `/_file-ali-server/${u.storageUrl}` - : `${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 - }); - }; - - componentDidMount() { - const { value, defaultValue, isQiniu, isAli } = this.props; - if (defaultValue) { - this.setFileList(defaultValue, isQiniu, isAli) - } - } - - UNSAFE_componentWillReceiveProps(np) { - const { dispatch, value: thisEditData, onChange } = this.props; - const { value: nextEditData, isQiniu, isAli } = np; - // this.setFileList(nextEditData, isQiniu) - // const setFileList = () => { - // let defaultFileList = []; - // defaultFileList = nextEditData.map((u, index) => { - // let fileUrl = isQiniu ? `/_file-server/${u.storageUrl}` : `${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) { - this.setFileList(nextEditData, isQiniu, isAli); - } else if (nextEditData.length != thisEditData.length) { - this.setFileList(nextEditData, isQiniu, isAli); - } else { - let repeat = true; - for (let i = 0; i < thisEditData.length; i++) { - if (thisEditData[i] != nextEditData[i]) { - repeat = false; - break; - } - } - if (!repeat) { - this.setFileList(nextEditData, isQiniu, isAli); - } - } - } - // else{ - // this.setState({ - // fileList:[], - // }) - // } - } - - render() { - const UploadPath = { - project: ['txt', 'dwg', 'doc', 'docx', 'xls', 'xlsx', 'csv', 'pdf', 'pptx', 'png', 'jpg', 'svg', 'jpeg', 'rar', 'zip', 'jpeg', 'mp4'], - report: ['doc', 'docx', 'xls', 'xlsx', 'csv', 'pdf'], - data: ['txt', 'xls', 'xlsx', 'csv'], - 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, - isQiniu, - isAli, - } = this.props; - const { fileList, curPreviewPic, curPreviewVideo, delPicIng, removeFilesList } = this.state; - const that = this; - let uploadType_ = uploadType || 'project'; - let maxFilesNum_ = maxFilesNum || 1; - let defaultFileTypes = fileTypes || UploadPath[uploadType_]; - // debugger - const uploadProps = { - name: 'checkFile_', - multiple: false, - showUploadList: showUploadList || true, - action: - isQiniu ? `/_upload/attachments/${uploadType_}` - : isAli ? `/_upload/attachments/ali/${uploadType_}` - : `${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: - isQiniu ? '/_file-server/' + uploaded : - isAli ? `/_file-ali-server/${uploaded}` : - 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: '' - }); - } - if (curPreviewVideo == file.url) { - that.setState({ - curPreviewVideo: '' - }); - } - 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 if (UploadPath.video.some((img) => img == filePostfix)) { - that.setState({ - curPreviewVideo: file.url - }); - } else { - //message.warn('仅支持图片预览'); - preview(file.storageUrl) - } - } - }; - - const preview = (url) => { - let link = isQiniu ? encodeURI(`${this.qnDomain}/${url}`) : - isAli ? encodeURI(`${this.aliAdmin}/${url}`) : '' - if (link) - if (url.indexOf("pdf") !== -1 || url.indexOf("csv") !== -1) { - window.open(link) - } else { - window.open(`https://view.officeapps.live.com/op/view.aspx?src=${link}`) - } - } - - let fileList_ = fileList - // .map(f => { - // if (f.storageUrl) { - // let realName = f.storageUrl.split('/').pop() - // if (f.name != realName) { - // f.name = realName - // } - // } - // return f - // }) - //下载文件 - const handleDownload = (file) => { - saveAs(file) - }; - const saveAs = (file) => { - const link = document.createElement('a'); - link.href = file.url; - link.download = file.name; - link.style.display = 'none'; - link.click(); - } - //自定义下载 - return ( -
- - - { - disabled ? ( - '' - ) : - listType == 'picture-card' ? - ( - fileList.length >= maxFilesNum_ ? null : ( -
- -
添加附件
-
- ) - ) : ( - - ) - } -
- { - curPreviewPic ? ( - -
- 图片预览 - { this.setState({ curPreviewPic: '' }) }}> - - -
- -
- ) : '' - } - { - curPreviewVideo ? ( -
- 视频预览 - { this.setState({ curPreviewVideo: '' }) }}> - - -
- -
) : '' - } -
-
- ); - } -} - -function mapStateToProps(state) { - const { auth } = state - return { - user: auth.user - }; -} - -export default connect(mapStateToProps)(Uploads); \ No newline at end of file diff --git a/web/client/src/components/export/index.js b/web/client/src/components/export/index.js deleted file mode 100644 index 3fd980f..0000000 --- a/web/client/src/components/export/index.js +++ /dev/null @@ -1,683 +0,0 @@ -/** - * Created by Xumeng 2020/04/22. - */ - -import React, { useState, useEffect } from 'react'; -import PropTypes from 'prop-types'; -import { - Row, Col, Space, Button, message, notification, Form, Input, Tooltip, Menu, Dropdown, -} from 'antd'; -import moment from 'moment'; -import XLSX from 'xlsx'; -import { fromJS } from 'immutable'; -import { Request } from '@peace/utils'; -import FileSaver from 'file-saver'; -import './index.less'; - -// 通用前端导入导出组件 使用方法查看底部propTypes -function ExportAndImport(props) { - const [form] = Form.useForm(); - const [exportLoading, setExportLoading] = useState(false); - const [importLoading, setImportLoading] = useState(false); - const { - importDataCallback, onImportSucess, handelData, importMethod = 'post', - } = props; - - useEffect(() => () => { - // 只有unmount 时调用 - notification.close('import-notification'); - }); - const importExcel = (file, type) => { - setImportLoading(true); - // 获取上传的文件对象 - const { files } = file.target; - // 判断xls、xlsx格式 - if (files[0].type.indexOf('sheet') > -1 || files[0].type.indexOf('ms-excel') > -1) { - // 通过FileReader对象读取文件 - const fileReader = new FileReader(); - fileReader.onload = (event) => { - try { - const { importRequest = true, importUrl, importQuery } = props; - if (importRequest && !importUrl) { - message.error('获取导入接口失败!'); - form.resetFields(); - return; - } - const { result } = event.target; - // 以二进制流方式读取得到整份excel表格对象 - const workbook = XLSX.read(result, { type: 'binary', cellDates: true }); - let data = []; // 存储获取到的数据 - // 遍历每张工作表进行读取(这里默认只读取第一张表) - for (const sheet in workbook.Sheets) { - if (workbook.Sheets.hasOwnProperty(sheet)) { - // 利用 sheet_to_json 方法将 excel 转成 json 数据 - data = data.concat(XLSX.utils.sheet_to_json(workbook.Sheets[sheet])); - break; // 如果只取第一张表,就取消注释这行 - } - } - if (data.length > 10000) { - message.error('一次最多导入10000条数据,请分批导入!'); - form.resetFields(); - setImportLoading(false); - return; - } - if (importRequest) { - message.success('获取文件数据成功,开始处理导入...'); - const importData = handelData ? handelData(data) : data; - Request[importMethod](importUrl, { data: importData }, importQuery || {}).then((res) => { - message.success('导入数据成功'); - form.resetFields(); - notification.close('import-notification'); - setImportLoading(false); - onImportSucess && onImportSucess(); - }, (err) => { - if (err.status === 500) { - message.error('数据导入出错,导入失败'); - } else if (err.status === 400) { - message.error(err.body.message || '数据验证出错,请检查数据格式是否正确'); - } else { - message.error('导入失败'); - } - form.resetFields(); - setImportLoading(false); - }); - } else { - form.resetFields(); - setImportLoading(false); - importDataCallback && importDataCallback(data, type); - notification.close('import-notification'); - } - } catch (e) { - console.log(e); - // 这里可以抛出文件类型错误不正确的相关提示 - message.error('文件格式不正确!'); - setImportLoading(false); - form.resetFields(); - } - }; - // fileReader.onloadend = (event) => { - // console.log(event) - // } - // 以二进制方式打开文件 - fileReader.readAsBinaryString(files[0]); - } else { - message.error('文件格式不正确!'); - form.resetFields(); - setImportLoading(false); - } - }; - - const loop = (data, keypath, values) => { // deal with array - const dkey = keypath.slice(0, 1)[0]; - console.log(dkey); - if (dkey) { - const dvalue = data[dkey]; - const otherKeypath = keypath.slice(1); - if (Array.isArray(dvalue)) { - if (otherKeypath.length) { - const immutableData = fromJS(data); - for (let index = 0; index < dvalue.length; index++) { - const tmp = immutableData.getIn([dkey, index]).toJS(); - loop(tmp, otherKeypath, values); - } - } - } else { - values.push(dvalue); - } - } - return values; - }; - const getColumnData = (opts) => { - const { - data, keypath, render, spliter, rawdata, - } = opts; - let v = null; - const outer = data[keypath[0]]; - - if (Array.isArray(outer)) { - const values = loop(data, keypath, []); - v = rawdata ? values : values.join(spliter || ','); - } else { - v = fromJS(data).getIn(keypath); - } - // 处理render - if (render && typeof render === 'function') { - v = render(outer, data); - } - return v; - }; - const getDataSource = (attrs, filterData) => { - // let token = JSON.parse(sessionStorage.getItem('user')).token; - const dataSource = filterData.map((item) => { - const record = {}; - attrs.forEach((attr) => { - const { - key, dataIndex, render, child, - } = attr; - if (child) { - record[key] = getDataSource(child, item[key]); - } else { - const v = getColumnData({ - data: item, - keypath: dataIndex || [key], - render: render || null, - }); - record[key] = v; - } - }); - - return record; - }); - return dataSource; - }; - // 暂时只处理两层 - const getFlatData = (attrs, filterData, dataToAoa, deep = 0) => { - filterData.map((item) => { - let cur = dataToAoa[deep]; - if (!cur) { - cur = dataToAoa[deep] = []; - } - attrs.map((attr, index) => { - const { key, child } = attr; - if (child) { - if (Array.isArray(item[key])) { - // getFlatData(child,item[key],dataToAoa,deep) - - item[key].map((s, i) => { - if (i == 0) { - child.map((c) => { - cur.push(s[c.key]); - }); - } else { - deep++; - const childCur = dataToAoa[deep] = []; - pushNull(childCur, index); - child.map((c) => { - childCur.push(s[c.key]); - }); - } - }); - } - } else { - cur.push(item[key]); - } - }); - deep++; - }); - }; - - const getHeader = (headers, excelHeader, deep, perOffset) => { - let offset = 0; - let cur = excelHeader[deep]; - if (!cur) { - cur = excelHeader[deep] = []; - } - pushNull(cur, perOffset - cur.length); - for (let i = 0; i < headers.length; i++) { - const head = headers[i]; - cur.push(head.name); - if (head.hasOwnProperty('child') && Array.isArray(head.child) && head.child.length > 0) { - const childOffset = getHeader(head.child, excelHeader, deep + 1, cur.length - 1); - pushNull(cur, childOffset - 1); - offset += childOffset; - } else { - offset++; - } - } - return offset; - }; - - const pushNull = (arr, count) => { - for (let i = 0; i < count; i++) { - arr.push(null); - } - }; - const fillNull = (arr) => { - const max = Math.max(...(arr.map((a) => a.length))); - arr.filter((e) => e.length < max).forEach((e) => pushNull(e, max - e.length)); - }; - const doMerges = (arr) => { - // 要么横向合并 要么纵向合并 - const deep = arr.length; - const merges = []; - for (let y = 0; y < deep; y++) { - // 先处理横向合并 - const row = arr[y]; - let colSpan = 0; - for (let x = 0; x < row.length; x++) { - if (row[x] === null) { - colSpan++; - if (((x + 1) === row.length) && (colSpan > 0 && x > colSpan)) { - merges.push({ s: { r: y, c: x - colSpan }, e: { r: y, c: x } }); - } - } else if (colSpan > 0 && x > colSpan) { - merges.push({ s: { r: y, c: x - colSpan - 1 }, e: { r: y, c: x - 1 } }); - colSpan = 0; - } else { - colSpan = 0; - } - } - } - // 再处理纵向合并 - const colLength = arr[0].length; - for (let x = 0; x < colLength; x++) { - let rowSpan = 0; - for (let y = 0; y < deep; y++) { - if (arr[y][x] != null) { - rowSpan = 0; - } else { - rowSpan++; - } - } - if (rowSpan > 0) { - merges.push({ s: { r: deep - rowSpan - 1, c: x }, e: { r: deep - 1, c: x } }); - } - } - return merges; - }; - // 内容暂只出了纵向合并 - const doContetMerges = (arr, headerLength) => { - const deep = arr.length; - const merges = []; - // 处理纵向合并 - const colLength = arr[0].length; - for (let x = 0; x < colLength; x++) { - let rowSpan = 0; - const mergY = 0; - for (let y = 0; y < deep; y++) { - if (rowSpan > 0) { - // 如果还有null 继续加 - if (arr[y][x] === null) { - rowSpan += 1; - } else { - // 不为null 增加merge - merges.push({ s: { r: headerLength + (y - rowSpan - 1), c: x }, e: { r: headerLength + y - 1, c: x } }); - rowSpan = 0; - } - } else if (arr[y][x] === null) { - rowSpan += 1; - } - } - if (rowSpan > 0) { - merges.push({ s: { r: headerLength + (deep - rowSpan - 1), c: x }, e: { r: headerLength + deep - 1, c: x } }); - rowSpan = 0; - } - } - return merges; - }; - const exportMergeExcel = async () => { - setExportLoading(true); - const { - column, data, fileName, exportUrl, exportQuery, exportBody, requestType, header, showYearMouth, - } = props || {}; - - let resultData = []; - if (exportUrl) { - resultData = requestType == 'post' ? await Request.post(exportUrl, exportBody || {}, exportQuery || {}).then((data) => { - // 数据接口返回的结果 如果是对象 必须把返回数组放入rows - if (typeof data === 'object' && data.rows) { - return data.rows; - } - return data; - }, (err) => { - message.error('获取数据失败,导出失败!'); - }) : await Request.get(exportUrl, exportQuery || {}).then((data) => { - if (typeof data === 'object' && data.rows) { - return data.rows; - } - return data; - }, (err) => { - message.error('获取数据失败,导出失败!'); - }); - if (!resultData) { - return; - } - } else { - resultData = data; - } - const excelHeader = []; - getHeader(column, excelHeader, 0, 0); - fillNull(excelHeader); - - // console.log(excelHeader); - - const loopData = getDataSource(column, resultData); - // console.log(loopData) - - const dataToAoa = []; - getFlatData(column, loopData, dataToAoa, 0); - fillNull(dataToAoa); - // console.log(dataToAoa); - - const aoa = [].concat(excelHeader, dataToAoa); - // console.log(aoa) - - const headerMerges = doMerges(excelHeader); - const contentMerages = doContetMerges(dataToAoa, excelHeader.length); - const merges = [].concat(headerMerges, contentMerages); - // console.log(contentMerages) - - // let opts = { - // defaultCellStyle: { - // font: { name: "宋体", sz: 11, color: { auto: 1 } }, - // border: { - // color: { auto: 1 } - // }, - // alignment: { - // /// 自动换行 - // wrapText: 1, - // // 居中 - // horizontal: "center", - // vertical: "center", - // indent: 0 - // } - // } - // } - const sheet = XLSX.utils.aoa_to_sheet(aoa); - // let newSheet = {}; - // for (let [key, value] of Object.entries(sheet)) { - // if(key == '!ref'){ - // newSheet[key] = value - // }else if(typeof value === 'object'){ - // newSheet[key] = { - // ...value, - // s: opts.defaultCellStyle - // } - // } - // } - const wpx = column.map((c) => ({ - wpx: Number.parseInt(c.wpx) ? Number.parseInt(c.wpx) : 100, - })); - sheet['!cols'] = wpx; - sheet['!merges'] = merges; - - // 构建 workbook 对象 - const workbook = XLSX.utils.book_new(); - - const time = moment().format('YYYY-MM-DD'); - - XLSX.utils.book_append_sheet(workbook, sheet, 'mySheet'); - // 导出 Excel - XLSX.writeFile(workbook, fileName ? `${fileName}-${time}.xlsx` : '导出数据.xlsx'); - setExportLoading(false); - // message.success(`成功导出了 ${loopData.length || 0} 条数据`); - }; - - const exportProExcel = async () => { - setExportLoading(true); - const { - column, data, fileName, exportUrl, exportQuery, exportBody, requestType, showYearMouth, - } = props || {}; - let resultData = []; - if (exportUrl) { - resultData = requestType == 'post' ? await Request.post(exportUrl, exportBody || {}, exportQuery || {}).then((data) => { - // 数据接口返回的结果 如果是对象 必须把返回数组放入rows - if (typeof data === 'object') { - return data.data ? data.data : data.rows; - } - return data; - }, (err) => { - message.error('获取数据失败,导出失败!'); - }) : await Request.get(exportUrl, exportQuery || {}).then((data) => { - if (showYearMouth) { - - } - if (typeof data === 'object' && data.rows) { - return data.rows; - } - return data; - }, (err) => { - message.error('获取数据失败,导出失败!'); - }); - if (!resultData) { - return; - } - } else { - resultData = data; - } - - const loopData = getDataSource(column, resultData); - - let content = ''; - let header = ''; - // header += `
序号
`; - column.map((colum) => { - header += `
${colum.name}
`; - }); - header += ''; - loopData.map((data) => { - content += ''; - column.map((c) => { - if (c.style) { - content += `
${data[c.dataIndex || c.key]}
`; - } else { - content += `
${data[c.dataIndex || c.key]}
`; - } - }); - content += ''; - }); - - const exportTable = `\uFEFF - - ${header} - ${content} -
- `; - const time = moment().format('YYYY-MM-DD'); - const tempStrs = new Blob([exportTable], { type: 'text/xls' }); - FileSaver.saveAs(tempStrs, fileName ? `${fileName}-${time}.xls` : '导出数据.xls'); - setExportLoading(false); - // message.success(`成功导出了 ${loopData.length || 0} 条数据`); - }; - - const exportExcel = async () => { - setExportLoading(true); - const { - column, data, fileName, exportUrl, exportQuery, exportBody, requestType, - } = props || {}; - const _headers = column - .map((item, i) => ({ key: item.key, title: item.name, position: String.fromCharCode(65 + i) + 1 })) - .reduce((prev, next) => ({ ...prev, [next.position]: { key: next.key, v: next.title } }), {}); - let resultData = []; - if (exportUrl) { - resultData = requestType == 'post' ? await Request.post(exportUrl, exportBody || {}, exportQuery || {}).then((data) => { - // 数据接口返回的结果 如果是对象 必须把返回数组放入rows - - if (typeof data === 'object' && (data.rows || data.data)) { - return data.data ? data.data : data.rows; - } - return data; - }, (err) => { - message.error('获取数据失败,导出失败!'); - }) : await Request.get(exportUrl, exportQuery || {}).then((data) => { - if (typeof data === 'object' && data.rows) { - return data.rows; - } - return data; - }, (err) => { - message.error('获取数据失败,导出失败!'); - }); - if (!resultData) { - return; - } - } else { - resultData = data; - } - - const loopDate = getDataSource(column, resultData); - - const wpx = column.map((c) => ({ - wpx: Number.parseInt(c.wpx) ? Number.parseInt(c.wpx) : 100, - })); - if (!(loopDate.length > 0)) { - setExportLoading(false); - return; - } - const _data = loopDate - .map((item, i) => column.map((key, j) => ({ content: item[key.key], position: String.fromCharCode(65 + j) + (i + 2) }))) - // 对刚才的结果进行降维处理(二维数组变成一维数组) - .reduce((prev, next) => prev.concat(next)) - // 转换成 worksheet 需要的结构 - .reduce((prev, next) => ({ ...prev, [next.position]: { v: next.content } }), {}); - - // 合并 column 和 data - const output = { ..._headers, ..._data }; - // 获取所有单元格的位置 - const outputPos = Object.keys(output); - // 计算出范围 ,["A1",..., "H2"] - const ref = `${outputPos[0]}:${outputPos[outputPos.length - 1]}`; - - // 构建 workbook 对象 - const workbook = { - SheetNames: ['mySheet'], - Sheets: { - mySheet: { - - ...output, - '!ref': ref, - '!cols': wpx, - }, - }, - }; - const time = moment().format('YYYY-MM-DD'); - // 导出 Excel - XLSX.writeFile(workbook, fileName ? `${fileName}-${time}.xlsx` : '导出数据.xlsx'); - setExportLoading(false); - // message.success(`成功导出了 ${loopDate.length || 0} 条数据`); - }; - - const exportTemplete = async () => { - const { importTemColumn, importTemData, fileName } = props || {}; - const _headers = importTemColumn - .map((item, i) => { - let group = 0; // 用于处理Z1的时候,重计算AA1 - if (parseInt(i / 26) > group) { - group = parseInt(i / 26); - } - if (group > 0) { // AA1 BA1 CA1 - const position = String.fromCharCode(65 + (group - 1)); - return { key: item.key, title: item.name, position: position + String.fromCharCode(65 + (i % 26)) + 1 }; - } return { key: item.key, title: item.name, position: String.fromCharCode(65 + i) + 1 }; - }) - .reduce((prev, next) => ({ ...prev, [next.position]: { key: next.key, v: next.title } }), {}); - - const loopDate = getDataSource(importTemColumn, importTemData); - - const wpx = importTemColumn.map((c) => ({ - wpx: Number.parseInt(c.wpx) ? Number.parseInt(c.wpx) : 100, - })); - const _data = loopDate.length ? loopDate - .map((item, i) => importTemColumn.map((key, j) => ({ content: item[key.key], position: String.fromCharCode(65 + j) + (i + 2) }))) - // 对刚才的结果进行降维处理(二维数组变成一维数组) - .reduce((prev, next) => prev.concat(next)) - // 转换成 worksheet 需要的结构 - .reduce((prev, next) => ({ ...prev, [next.position]: { v: next.content } }), {}) : []; - // 合并 column 和 data - const output = { ..._headers, ..._data }; - // 获取所有单元格的位置 - const outputPos = Object.keys(output); - // 计算出范围 ,["A1",..., "H2"] - const ref = `${outputPos[0]}:${outputPos[outputPos.length - 1]}`; - - // 构建 workbook 对象 - const workbook = { - SheetNames: ['mySheet'], - Sheets: { - mySheet: { - - ...output, - '!ref': ref, - '!cols': wpx, - }, - }, - }; - // 导出 Excel - XLSX.writeFile(workbook, fileName ? `${fileName}-导入模板.xlsx` : '导入模板.xlsx'); - }; - const tips = (type) => { - const { tips, templeteBth = true } = props; - const description = ( -
- {tips && tips} - - -
- - importExcel(e, type)} /> - - -
- - {templeteBth && ( - - - - )} -
-
- ); - - notification.info({ - message: '支持 .xlsx、.xls 格式的文件', - description, - key: 'import-notification', - duration: null, - }); - }; - - return ( - - { - props.import && ( - - ) - } - { - props.export && ( - - - - ) - } - - ); -} - -ExportAndImport.propTypes = { - export: PropTypes.bool, // 是否显示导出按钮 - exportBtnName: PropTypes.string, // 导出按钮文字 - importBtnName: PropTypes.string, // 导入按钮文字 - import: PropTypes.bool, // 是否显示导入按钮 - variedImport: PropTypes.bool, // 是否显示多样导入 - variedImportDisable: PropTypes.bool, // 多样导入禁用 - variedImportBtnName: PropTypes.string, // 多样导入文字 - column: PropTypes.array, // 导出显示的header数组 兼容antd column 可直接拿table的column使用 注:column每列的属性wpx设置导出的execl每列的宽度值 默认 100 - data: PropTypes.array, // 导出的数据 兼容antd table 数组嵌套处理 - exportUrl: PropTypes.string, // 导出数据从接口获取的url地址 返回的数据1、数组必须支持column的设置 ,2、如果是对象,数组需放在rows属性上 - exportBody: PropTypes.object, // 导出数据接口body参数 - exportQuery: PropTypes.object, // 导出数据从接口获取的url地址上的参数 - exportBtnTips: PropTypes.string, // 导出按钮tips文字提示 - importUrl: PropTypes.string, // 导入接口url - importQuery: PropTypes.object, // 导入接口url地址上的参数 - btnClass: PropTypes.string, // 按钮className - btnStyle: PropTypes.object, // 按钮style - tips: PropTypes.oneOfType([PropTypes.string, PropTypes.element]), // 上传文件提示的信息 - onImportSucess: PropTypes.func, // 上传成功后 返回处理函数 - importTemColumn: PropTypes.array, // 导入模板设置 头部字段数组 - importTemData: PropTypes.array, // 导入模板默认数据 - requestType: PropTypes.string, // 请求类型 - importDataCallback: PropTypes.func, // 上传后数据返回 - templeteBth: PropTypes.bool, // 模板按钮 - importRequest: PropTypes.bool, // 请求导入接口,false时搭配importDataCallback, - exportType: PropTypes.string, // 导出执行的函数名 -}; - -export default ExportAndImport; diff --git a/web/client/src/components/export/index.less b/web/client/src/components/export/index.less deleted file mode 100644 index a362e30..0000000 --- a/web/client/src/components/export/index.less +++ /dev/null @@ -1,13 +0,0 @@ -.export-import { - .file-uploader { - position: absolute; - width: 100%; - height: 100%; - top: 0; - left: 0; - outline: none; - opacity: 0; - background-color: transparent; - z-index: 10; - } - } \ No newline at end of file diff --git a/web/client/src/components/flowRecordTable/index.js b/web/client/src/components/flowRecordTable/index.js deleted file mode 100644 index 4d4465c..0000000 --- a/web/client/src/components/flowRecordTable/index.js +++ /dev/null @@ -1,74 +0,0 @@ -'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 ( - - ); - } -} - -export default FlowRecordTable; \ No newline at end of file diff --git a/web/client/src/components/flowRecordTable/index.less b/web/client/src/components/flowRecordTable/index.less deleted file mode 100644 index e69de29..0000000 diff --git a/web/client/src/components/index.js b/web/client/src/components/index.js index 976457f..d2d7ebc 100644 --- a/web/client/src/components/index.js +++ b/web/client/src/components/index.js @@ -1,27 +1,10 @@ 'use strict'; -import Upload from './Upload'; -import Uploads from './Uploads'; -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' -import ExportAndImport from './export' +// import Upload from './Upload'; + export { - Upload, - Uploads, - NoResource, - LimitTextArea, - // ProcessForm, - FlowRecordTable, - Table, - Search, - SketchColor, - ExportAndImport, + }; diff --git a/web/client/src/components/limit-textarea/index.js b/web/client/src/components/limit-textarea/index.js deleted file mode 100644 index e62863a..0000000 --- a/web/client/src/components/limit-textarea/index.js +++ /dev/null @@ -1,70 +0,0 @@ -import React, { PureComponent } from 'react'; -import { Input } from 'antd'; -const { TextArea } = Input; -import './index.less'; - -/*** - * 显示最大输入字符数 - * maxLength:300(默认) - */ -class LimitTextArea extends PureComponent { - - constructor(props) { - super(props) - this.state = { - len: 0, - maxLength: 300, - isvalid: true, // 是否显示最大字符数 - } - // 若需要覆盖onChange时,value必填 - if (props.onChange && !props.hasOwnProperty('value')) { - this.state.isvalid = false - console.warn('LimitTextArea:绑定onChange时,value属性必填,否则显示最大输入字符数将失效!') - } - } - - // 若外部定义了onChange事件,handleChange将会被覆盖 - handleChange = (e) => { - const { sep } = this.props - const val = e.target.value - const arr = (val || '').split(sep) - this.setState({ - len: arr.length - }) - } - - render () { - const { maxLength: defaultMax, isvalid } = this.state - const { sep, maxLength, value, ...restProps } = this.props - const max = maxLength > 0 ? maxLength : defaultMax - /** form组件中,value有值 */ - const arr = (value || '').split(sep) - let len = value ? arr.length : this.state.len - len = len > max ? max : len - /**截取最大字符串 */ - const val = arr.slice(0, len).join(sep) - const n = val ? len : 0 - const suffix = `${n}/${max}` - - return isvalid ? ( -
-