wangyue 2 years ago
parent
commit
2d649d8e42
  1. 2
      api/.vscode/launch.json
  2. 2
      api/app/lib/controllers/data/index.js
  3. 4
      api/app/lib/models/report.js
  4. 29
      api/log/development.log
  5. 29
      api/utils/xlsxDownload.js
  6. 4
      scripts/0.0.1/data/3_init_report_pic_data/Dockerfile
  7. 27
      scripts/0.0.1/data/3_init_report_pic_data/index.js
  8. 4
      weapp/src/pages/home/index.jsx
  9. 11
      web/client/src/sections/fillion/components/inforTable.js
  10. 28
      web/client/src/sections/fillion/components/maintenanceTable.js
  11. 36
      web/client/src/sections/fillion/components/patrolTable.js

2
api/.vscode/launch.json

@ -13,7 +13,7 @@
"NODE_ENV": "development"
},
"args": [
"-p 4000",
"-p 14000",
"-f http://localhost:4000",
"-g postgres://postgres:123@10.8.30.32:5432/highways4good",
"--qnak XuDgkao6cL0HidoMAPnA5OB10Mc_Ew08mpIfRJK5",

2
api/app/lib/controllers/data/index.js

@ -104,7 +104,7 @@ async function dataExport (ctx) {
header.sort((a, b) => { return a.index - b.index })
const fileName = `${modalOption.n}_${moment().format('YYYYMMDDHHmmss')}` + '.csv'
const filePath = await xlsxDownload.simpleExcelDown({ data: exportData, header, fileName: fileName })
const filePath = await xlsxDownload.simpleExcelDown({ data: exportData, header, fileName: fileName, exp })
const fileData = fs.readFileSync(filePath);
ctx.status = 200;

4
api/app/lib/models/report.js

@ -21,7 +21,7 @@ module.exports = dc => {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "上报类型 巡查:patrol / 养护:conserve",
comment: "上报类型",
primaryKey: false,
field: "report_type",
autoIncrement: false
@ -31,7 +31,7 @@ module.exports = dc => {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "工程类型 道路:road / 桥梁:birdge / 涵洞:culvert",
comment: "工程类型",
primaryKey: false,
field: "project_type",
autoIncrement: false

29
api/log/development.log

@ -10668,3 +10668,32 @@ headers: {}
2022-07-30 12:38:46.294 - debug: [FS-LOGGER] Init.
2022-07-30 12:38:46.394 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2022-07-30 12:38:46.394 - info: [FS-AUTH] Inject auth and api mv into router.
2022-07-30 14:19:21.439 - debug: [FS-LOGGER] Init.
2022-07-30 14:19:21.547 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2022-07-30 14:19:21.547 - info: [FS-AUTH] Inject auth and api mv into router.
2022-07-30 14:30:16.777 - error: path: /publicity, error: Error: Invalid value {
uid: -1659162615,
name: 'video.mp4',
status: 'done',
storageUrl: 'project/45017725-be73-4ec7-99a5-f57c2fde5682/video.mp4',
url: 'http://rfkimpwbb.hn-bkt.clouddn.com/project/45017725-be73-4ec7-99a5-f57c2fde5682/video.mp4',
size: 2172089
}
2022-07-30 14:30:47.375 - error: path: /publicity, error: Error: Invalid value {
uid: -1659162647,
name: 'video.mp4',
status: 'done',
storageUrl: 'project/ec692a52-13e2-4bd1-80fb-5cae1386c782/video.mp4',
url: 'http://rfkimpwbb.hn-bkt.clouddn.com/project/ec692a52-13e2-4bd1-80fb-5cae1386c782/video.mp4',
size: 2172089
}
2022-07-30 16:53:41.602 - error: path: /data/export, error: 参数错误
2022-07-30 16:59:14.475 - debug: [FS-LOGGER] Init.
2022-07-30 16:59:14.573 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2022-07-30 16:59:14.573 - info: [FS-AUTH] Inject auth and api mv into router.
2022-07-30 17:19:58.438 - debug: [FS-LOGGER] Init.
2022-07-30 17:19:58.538 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2022-07-30 17:19:58.539 - info: [FS-AUTH] Inject auth and api mv into router.
2022-07-30 17:48:40.061 - debug: [FS-LOGGER] Init.
2022-07-30 17:48:40.152 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2022-07-30 17:48:40.152 - info: [FS-AUTH] Inject auth and api mv into router.

29
api/utils/xlsxDownload.js

@ -16,7 +16,7 @@ async function makeDir (dir) {
}
}
async function simpleExcelDown ({ data = [], header = [], fileName = moment().format('YYYY-MM-DD HH:mm:ss') } = {}) {
async function simpleExcelDown ({ data = [], header = [], fileName = moment().format('YYYY-MM-DD HH:mm:ss'), exp } = {}) {
const fileDirPath = path.join(__dirname, `../../downloadFiles`)
makeDir(fileDirPath)
const file = new xlsx.File();
@ -57,6 +57,33 @@ async function simpleExcelDown ({ data = [], header = [], fileName = moment().fo
for (let h of header) {
const cell = row.addCell();
cell.value = data[i][h.key];
if (exp == 'patrol' || exp == 'maintenance') {
if (h.key == 'projectType') {
let type = data[i][h.key]
if (type == 'road') {
cell.value = '道路'
} else if (type == 'birdge') {
cell.value = '桥梁'
} else if (type == 'culvert') {
cell.value = '涵洞'
} else if (type == 'other') {
cell.value = '其他'
}
continue
}
if (h.key == 'reportType') {
let type = data[i][h.key]
if (type == 'patrol') {
cell.value = '巡查'
} else if (type == 'conserve') {
cell.value = '养护'
}
continue
}
}
cell.style = style
}
}

4
scripts/0.0.1/data/3_init_report_pic_data/Dockerfile

@ -4,4 +4,8 @@ COPY . /var/app
WORKDIR /var/app
RUN npm cache clean -f
RUN rm -rf package-lock.json
RUN npm install --registry http://10.8.30.22:7000
CMD ["node", "index.js"]

27
scripts/0.0.1/data/3_init_report_pic_data/index.js

@ -10,17 +10,30 @@ try {
const uuidv4 = require('uuid/v4');
// 连接数据库
// const pool = new Pool({
// user: 'FashionAdmin',
// host: '10.8.30.156',
// database: 'highway4goodn0728',
// password: '123456',
// port: 5432,
// })
// // 7niu 验证
// const accessKey = '5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu'
// const secretKey = 'w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5'
// const bucket = 'anxinyun-test'
// 商用环境
const pool = new Pool({
user: 'postgres',
host: '10.8.30.32',
database: 'highways4good',
password: '123',
user: 'highwayadmin',
host: '10.8.40.223',
database: 'highway4good',
password: 'highway123',
port: 5432,
})
// 7niu 验证
const accessKey = 'XuDgkao6cL0HidoMAPnA5OB10Mc_Ew08mpIfRJK5'
const secretKey = 'yewcieZLzKZuDfig0wLZ9if9jKp2P_1jd3CMJPSa'
const bucket = 'dev-highways4good'
const accessKey = '5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu'
const secretKey = 'w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5'
const bucket = 'anxinyun'

4
weapp/src/pages/home/index.jsx

@ -51,13 +51,13 @@ const Index = () => {
{isSuperAdmin ? '查看' : '填报'}
</View>
</View>
{
{/* {
isSuperAdmin &&
<View className='card video'>
<View className='title'> </View>
<View className='btn' onClick={toVideo}>查看</View>
</View>
}
} */}
</View>
);
}

11
web/client/src/sections/fillion/components/inforTable.js

@ -197,7 +197,7 @@ const InForTable = (props) => {
dataIndex: 'createdAt',
valueType: 'date',
render: (dom, record) => {
return record.testTime?.slice(0,10)
return record.testTime?.slice(0, 10)
},
fieldProps: {
onChange: (value, cs) => {
@ -447,10 +447,13 @@ const InForTable = (props) => {
defaultCollapsed: false,
optionRender: (searchConfig, formProps, dom) => [
...dom.reverse(),
<Popconfirm title="确认导出?" onConfirm={() => {
<Popconfirm title={rowSelected.length === 0 ? '请勾选内容' : "确认导出?"}
showCancel={rowSelected.length === 0 ? false : true}
onConfirm={() => {
// console.log(rowSelected)
props.exports(rowSelected, counts) }}>
rowSelected.length === 0 ? null : props.exports(rowSelected, counts)
}}
>
<Button
>
导出

28
web/client/src/sections/fillion/components/maintenanceTable.js

@ -12,6 +12,7 @@ import moment from 'moment';
const DetailForm = (props) => {
const { visible, data, handleClose, loading } = props;
const [qndmn] = useState(localStorage.getItem('qndmn'));
const keyList = [
{ key: '编号', name: 'id' },
{ key: '工程类型', name: 'projectType' },
@ -37,7 +38,7 @@ const DetailForm = (props) => {
{
data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => {
return <div style={{ width: '44%', margin: 6 }}>
<Image src={imgSrc} width={'100%'} style={{ marginBottom: 4 }} />
<Image src={qndmn + '/' + imgSrc} width={'100%'} style={{ marginBottom: 4 }} />
</div>
}) : '暂无图片'
}
@ -90,6 +91,8 @@ const DetailList = (props) => {
}
}
let daySet = {};
const columns = [
{
title: '编号',
@ -97,6 +100,14 @@ const DetailList = (props) => {
dataIndex: 'id',
align: 'center',
render: (text, record) => {
let day = moment(record.time).format("YYYYMMDD")
if (daySet[day]) {
daySet[day].add(Symbol())
} else {
daySet[day] = new Set()
daySet[day].add(Symbol())
}
return day * 10000 + daySet[day].size
return moment(record.time).format("YYYYMMDD") * 10000 + record.id;
}
}, {
@ -104,6 +115,15 @@ const DetailList = (props) => {
key: 'projectType',
dataIndex: 'projectType',
align: 'center',
render: (text, record) => {
switch (text) {
case 'road': return '道路';
case 'bridge': return '桥梁';
case 'culvert': return '涵洞';
case 'other': return '其他';
default: return text;
}
}
}, {
title: '所属道路',
key: 'road',
@ -131,7 +151,7 @@ const DetailList = (props) => {
dataIndex: 'userName',
align: 'center',
render: (text, record) => {
return record.user.name
return record?.user?.name
}
}, {
title: '上报时间',
@ -263,7 +283,7 @@ const PatrolNameList = (props) => {
const MaintenanceTable = (props) => {
const { userList, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading } = props;
const { userList, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports } = props;
const [record, setRecord] = useState();
const [dateRange, setDateRange] = useState();
const [detailVisible, setDetailVisible] = useState(false)
@ -333,7 +353,7 @@ const MaintenanceTable = (props) => {
);
};
function mapStateToProps(state) {
function mapStateToProps (state) {
const { auth, depMessage, userList, reportList, reportDetail } = state;
const pakData = (dep) => {
return dep.map((d) => {

36
web/client/src/sections/fillion/components/patrolTable.js

@ -13,13 +13,14 @@ import moment from 'moment';
const DetailForm = (props) => {
const { visible, data, handleClose, loading } = props;
const [qndmn] = useState(localStorage.getItem('qndmn'));
const keyList = [
{ key: '编号', name: 'id' },
{ key: '工程类型', name: 'projectType' },
{ key: '所在路段', name: 'road' },
{ key: '具体位置', name: 'address' },
{ key: '巡查内容', name: 'content' },
{ key: '病害照片', name: 'scenePic' },
{ key: '现场照片', name: 'scenePic' },
];
const renderContent = (data) => {
@ -38,7 +39,7 @@ const DetailForm = (props) => {
{
data.scenePic && data.scenePic instanceof Array ? data.scenePic.map(imgSrc => {
return <div style={{ width: '44%', margin: 6 }}>
<Image src={imgSrc} width={'100%'} style={{ marginBottom: 4 }} />
<Image src={qndmn + '/' + imgSrc} width={'100%'} style={{ marginBottom: 4 }} />
</div>
}) : '暂无图片'
}
@ -57,7 +58,7 @@ const DetailForm = (props) => {
visible={visible}
footer={null}
onCancel={handleClose}
title={'巡管理详情'}
title={'巡管理详情'}
>
<Spin spinning={loading}>
{renderContent(data)}
@ -90,7 +91,7 @@ const DetailList = (props) => {
})
}
}
let daySet = {};
const columns = [
{
title: '编号',
@ -98,6 +99,14 @@ const DetailList = (props) => {
dataIndex: 'id',
align: 'center',
render: (text, record) => {
let day = moment(record.time).format("YYYYMMDD")
if (daySet[day]) {
daySet[day].add(Symbol())
} else {
daySet[day] = new Set()
daySet[day].add(Symbol())
}
return day * 10000 + daySet[day].size
return moment(record.time).format("YYYYMMDD") * 10000 + record.id;
}
},
@ -106,6 +115,15 @@ const DetailList = (props) => {
key: 'projectType',
dataIndex: 'projectType',
align: 'center',
render: (text, record) => {
switch (text) {
case 'road': return '道路';
case 'bridge': return '桥梁';
case 'culvert ': return '涵洞';
case 'other': return '其他';
default: return text;
}
}
},
{
title: '所属道路',
@ -205,7 +223,7 @@ const PatrolNameList = (props) => {
const columns = [
{
title: '巡人员',
title: '巡人员',
key: 'name',
dataIndex: 'name',
align: 'center'
@ -243,7 +261,7 @@ const PatrolNameList = (props) => {
return record.id == selectRoad ? 'list-row-actived' : '';
}}
toolBarRender={() => [
<Input placeholder='输入巡人员名称' onChange={doUserNameSearch} ></Input>
<Input placeholder='输入巡人员名称' onChange={doUserNameSearch} ></Input>
]}
options={false}
pagination={false}
@ -319,10 +337,10 @@ const PatrolTable = (props) => {
const tabList = [
{
key: 'tab1',
tab: '巡',
tab: '巡',
}, {
key: 'tab2',
tab: '巡轨迹查询',
tab: '巡轨迹查询',
},
];
const contentList = {
@ -388,7 +406,7 @@ const PatrolTable = (props) => {
);
};
function mapStateToProps(state) {
function mapStateToProps (state) {
const { auth, depMessage, userList, reportList, reportDetail } = state;
const pakData = (dep) => {
return dep.map((d) => {

Loading…
Cancel
Save