巴林闲侠 1 year ago
parent
commit
543c11b25f
  1. 31
      api/app/lib/controllers/data/anspectionNotificationPhone.js
  2. 35
      api/app/lib/models/inspection_notification_phone.js
  3. 5
      api/app/lib/routes/data/index.js
  4. 29
      weapp/src/packages/patrol/index.jsx
  5. 13
      web/client/src/sections/fillion/actions/patrol.js
  6. 121
      web/client/src/sections/fillion/components/patrolTable.js
  7. 4
      web/client/src/utils/webapi.js

31
api/app/lib/controllers/data/anspectionNotificationPhone.js

@ -0,0 +1,31 @@
'use strict';
const moment = require('moment')
async function getAnspectionNotificationPhone (ctx) {
try {
const models = ctx.fs.dc.models;
let findOption = {
where: {
},
order: [['id', 'DESC']]
}
const roadRes = await models.AnspectionNotificationPhone.findAll(findOption)
ctx.status = 200;
ctx.body = roadRes
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
message: typeof error == 'string' ? error : undefined
}
}
}
module.exports = {
getAnspectionNotificationPhone,
};

35
api/app/lib/models/inspection_notification_phone.js

@ -0,0 +1,35 @@
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const AnspectionNotificationPhone = sequelize.define("inspection_notification_phone", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "assess_id_uindex"
},
phone: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "联系电话",
primaryKey: false,
field: "phone",
autoIncrement: false
},
}, {
tableName: "inspection_notification_phone",
comment: "",
indexes: []
});
dc.models.AnspectionNotificationPhone = AnspectionNotificationPhone;
return AnspectionNotificationPhone;
};

5
api/app/lib/routes/data/index.js

@ -12,6 +12,7 @@ const task = require('../../controllers/data/task')
const assess = require('../../controllers/data/assess')
const videoCenter = require('../../controllers/data/videoCenter')
const appointTask = require('../../controllers/data/appointed')
const anspectionNotificationPhone = require('../../controllers/data/anspectionNotificationPhone')
module.exports = function (app, router, opts) {
// 数据导出
@ -206,4 +207,8 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['PUT/appointTask'] = { content: '指派任务', visible: true };
router.put('/appointTask', appointTask.appoint);
// 指派任务 END
//短信电话anspectionNotificationPhone
app.fs.api.logAttr['GET/anspection/notification/phone'] = { content: '获取短信提醒电话', visible: true };
router.get('/anspection/notification/phone', anspectionNotificationPhone.getAnspectionNotificationPhone);
};

29
weapp/src/packages/patrol/index.jsx

@ -1329,26 +1329,25 @@ const Index = () => {
/>
}
<View className='horizontal-line hl-two'>
<View className='circle c-two'></View>
<View className='text t-two'>养护中</View>
</View>
{
isView && isBeforeReport ? <>
<View className='horizontal-line hl-two'>
<View className='circle c-two'></View>
<View className='text t-two'>养护中</View>
</View>
isView ?
<View className='img-box'>
{conserveUnderwayPic.map(item => (
<Image className='img' src={item.url} onClick={() => handleImgClick(undefined, item)} />
))}
</View>
</> : null
// <AtImagePicker
// className='img-picker'
// count={3 - conserveUnderwayPic.length}
// showAddBtn={conserveUnderwayPic.length >= 3 ? false : true}
// files={conserveUnderwayPic}
// onChange={(files, operationType, index) => handleImgChange(files, operationType, index, 'conserveUnderwayPic')}
// onImageClick={handleImgClick}
// />
</View> :
<AtImagePicker
className='img-picker'
count={3 - conserveUnderwayPic.length}
showAddBtn={conserveUnderwayPic.length >= 3 ? false : true}
files={conserveUnderwayPic}
onChange={(files, operationType, index) => handleImgChange(files, operationType, index, 'conserveUnderwayPic')}
onImageClick={handleImgClick}
/>
}
<View className='horizontal-line hl-three'>

13
web/client/src/sections/fillion/actions/patrol.js

@ -46,4 +46,17 @@ export function handleReport (reportId, data) {
data: data,
msg: { option: '处理数据' },
});
}
export function getAnspectionNotificationPhone (query) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_REPORT_LIST',
url: ApiTable.getAnspectionNotificationPhone,
query,
msg: { error: '获取巡查数据失败' },
reducer: { name: 'reportList' }
});
}

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

@ -1,8 +1,8 @@
import { connect } from 'react-redux';
import './protable.less'
import { Card, Button, Popconfirm, Badge, Col, Row, DatePicker, Input, Modal, Spin, Image, message, Popover, Select, Tree } from 'antd';
import { Card, Button, Popconfirm, Badge, Col, Row, DatePicker, Input, Modal, Spin, Image, message, Popover, Select, Tree, Form } from 'antd';
import ProTable from '@ant-design/pro-table';
import { DownOutlined, RightOutlined, CaretDownOutlined, CaretRightOutlined } from '@ant-design/icons';
import { DownOutlined, RightOutlined, CaretDownOutlined, CaretRightOutlined, MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
import { getReportList, getReportDetail, handleReport } from '../actions/patrol';
import React, { useEffect, useState, useMemo } from 'react';
import { getAllDepUsers } from '../actions/allDepUsers'
@ -15,6 +15,9 @@ import styles from './protable.less';
import moment from 'moment';
import NominateModalcopy from './feedback/nominateModalcopy';//指派的模块
export const reportTypeText = (text) => {
switch (text) {
case 'road': return '道路';
@ -709,8 +712,11 @@ const PatrolTable = (props) => {
const isAnomaly = pathname.includes('anomaly')
const isPatrol = !isRoad && !isAnomaly
const reportType = isRoad ? 'road' : isAnomaly ? 'anomaly' : 'patrol';
const [isModalOpen, setIsModalOpen] = useState(false);
const [form] = Form.useForm();
useEffect(() => {
queryData();
console.log(123456789);
}, [])
useEffect(() => {
if (userList && userList instanceof Array && reportDetail && reportDetail instanceof Object) {
@ -807,6 +813,39 @@ const PatrolTable = (props) => {
exports(ids, reportType);
}
}
const showModal = () => {
setIsModalOpen(true);
};
const handleOk = () => {
// setIsModalOpen(false);
console.log(form, '=====');
form.validateFields().then(values => {
console.log(values, '----------');
}).catch(err => {
console.log(err, 'err');
})
};
const handleCancel = () => {
setIsModalOpen(false);
};
const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 4 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 20 },
},
};
const formItemLayoutWithOutLabel = {
wrapperCol: {
xs: { span: 24, offset: 0 },
sm: { span: 20, offset: 4 },
},
};
return (
<div className='card-protable'>
@ -853,6 +892,8 @@ const PatrolTable = (props) => {
: ''
}
<Button style={{ marginLeft: 20 }}>查询</Button>
<Button onClick={() => { showModal() }} style={{ float: 'right', marginRight: 30 }}> 短信提醒</Button>
{/* <Button style={{ marginLeft: 20 }} onClick={handleExport} >导出</Button> */}
</div> : ''
}
@ -865,12 +906,86 @@ const PatrolTable = (props) => {
isPatrol={isPatrol} isRoad={isRoad} isAnomaly={isAnomaly}
/>
</Card>
<Modal title="短信提醒" maskClosable={false} destroyOnClose={true} visible={isModalOpen} onOk={handleOk} onCancel={handleCancel}>
<Form form={form} name="dynamic_form_item" {...formItemLayoutWithOutLabel} >
<Form.List
name="phone"
// rules={[
// {
// validator: async (_, names) => {
// if (!names || names.length < 1) {
// return Promise.reject(new Error('At least 2 passengers'));
// }
// },
// },
// ]}
>
{(fields, { add, remove }, { errors }) => (
<>
{fields.map((field, index) => (
<Form.Item
{...(index === 0 ? formItemLayout : formItemLayoutWithOutLabel)}
label={index === 0 ? '联系电话' : ''}
required={false}
key={field.key}
>
<Form.Item
{...field}
validateTrigger={['onChange', 'onBlur']}
rules={[
// {
// required: true,
// whitespace: true,
// message: "请填入手机号!",
// },
{
validator: async (_, phone) => {
console.log(phone,'phone');
let re = /^1((3[\d])|(4[5,6,9])|(5[0-3,5-9])|(6[5-7])|(7[0-8])|(8[1-3,5-8])|(9[1,8,9]))\d{8}$/
if(!re.test(phone)){
return Promise.reject(new Error('请输入正确的手机号!'));
}
},
},
]}
noStyle
>
<Input placeholder="请输入联系电话" style={{ width: '90%' }} />
</Form.Item>
<MinusCircleOutlined
style={{ marginLeft: 5 }}
onClick={() => remove(field.name)}
/>
</Form.Item>
))}
<Form.Item>
<Button
type="dashed"
onClick={() => add()}
style={{ width: '90%' }}
icon={<PlusOutlined />}
>
添加联系电话
</Button>
<Form.ErrorList errors={errors} />
</Form.Item>
</>
)}
</Form.List>
{/* <Form.Item>
<Button type="primary" htmlType="submit">
Submit
</Button>
</Form.Item> */}
</Form>
</Modal>
</div>
);
};
function mapStateToProps (state) {
function mapStateToProps(state) {
const { auth, depMessage, userList, reportList, reportDetail, global, allDepUsers } = state;
const pakData = (dep) => {
return dep.map((d) => {

4
web/client/src/utils/webapi.js

@ -304,7 +304,9 @@ export const ApiTable = {
//部门下所有员工
getAllDepUsers: 'allDepUsers',
//指派任务
appointTask: 'appointTask'
appointTask: 'appointTask',
//获取短信提醒电话
getAnspectionNotificationPhone:'/anspection/notification/phone'
};

Loading…
Cancel
Save