diff --git a/web/client/assets/images/tiptop.png b/web/client/assets/images/tiptop.png new file mode 100644 index 00000000..4110aef0 Binary files /dev/null and b/web/client/assets/images/tiptop.png differ diff --git a/web/client/src/sections/fillion/components/editGuanlang.js b/web/client/src/sections/fillion/components/editGuanlang.js new file mode 100644 index 00000000..4073f234 --- /dev/null +++ b/web/client/src/sections/fillion/components/editGuanlang.js @@ -0,0 +1,213 @@ +import React, { useEffect, useState } from 'react'; +import { Modal, Form, Input, Select, DatePicker, AutoComplete, Col, Button,Row } from 'antd'; + +import { MinusCircleOutlined, PlusOutlined,PlusCircleOutlined } from '@ant-design/icons'; +const Search = Input.Search +const { TextArea } = Input; +import moment from 'moment'; + +const EditGuanlang = (props) => { + const { visible, onCancel, editData, handleSaveScore, readOnly, companys, searchCompany, applyState } = props; + const [form] = Form.useForm(); + const [replyFiles, setReplyFiles] = useState([]); + const [companyOpts, setCompanyOpts] = useState([]); + const [stationItem, setStationItem] = useState(null); + const [deviceList, setDeviceList] = useState([]); + + useEffect(() => { + if (!visible) { + form.resetFields() + } + }, [visible]) + + useEffect(() => { + if (editData) { + let revertData = Object.assign({}, editData); + Object.keys(editData).forEach(key => { + if (key == 'accidentTime') { + revertData[key] = editData[key] && moment(editData[key]); + } + if (key == 'images') { + // const list = (editData[key] || '').split(',') || [] + if (editData[key]) { + + revertData[key] = JSON.parse(editData[key]); + } + } + }); + form.setFieldsValue({ ...revertData }); + } + }, [editData]) + + useEffect(() => { + if (companys && companys.length) { + let list = []; + companys.forEach(item => { + list.push({ label: item.company, value: item.company }) + }) + setCompanyOpts(list); + } + }, [companys]) + + useEffect(() => { + if (editData && companys && companys.length) { + handleSelectCompany(null, { value: editData.companyName }) + let list = ((editData || {}).accidentStations || []).map(item => item.stationId) + form.setFieldsValue({ stations: list }) + } + }, [companys, editData]) + + + const handleSave = () => { + const data = form.getFieldsValue(true); + console.log(data,'data') + handleSaveScore(); + } + + const onFileUploaded = (fileList) => { + setReplyFiles(fileList); + } + + const handleSelectCompany = (v, opt) => { + const { value } = opt; + const target = companys.filter(c => c.company == value); + setDeviceList(target[0]?.deviceInfos || []); + + } + + return ( + +
+ + + 配置属性 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ ) +} + + +export default EditGuanlang; diff --git a/web/client/src/sections/fillion/containers/videois.js b/web/client/src/sections/fillion/containers/videois.js index 289d19ae..71d92f91 100644 --- a/web/client/src/sections/fillion/containers/videois.js +++ b/web/client/src/sections/fillion/containers/videois.js @@ -1,42 +1,243 @@ import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; +import { Input, Table, Button, Select, message, Popconfirm } from 'antd'; +// import { getAccidentInfo, createAccidentInfo, deleteAccidentInfo, editAccidentInfo, getAllCompany } from '../actions/device'; + +// import EditAccidentModal from '../components/editAccidentModal'; +import EditGuanlang from '../components/editGuanlang'; import '../style.less'; -import { getDepMessage, getReportStatistic } from "../actions/infor" -import VideoTable from '../components/videoTable'; -const superagent = require('superagent'); -const Videois = (props) => { - const { dispatch, user } = props - const [data, setData] = useState() - useEffect(() => { - // dispatch(getDepMessage()) - - setData(props) - }, []); - //批量导出 - const exports = (ids, counts) => { - // console.log(user); - let reportIds = []; - if (ids.length) - reportIds = ids - else - reportIds = (counts || {}).ids || []; - superagent.post('/_report/http') - .send({ id: reportIds.map(i => Number(i)) }).end((err, res) => { - const resTextIs = res.text.split('/').pop() - window.open( - '/_api/' + - `attachments?src=files/${resTextIs}&filename=${encodeURIComponent(resTextIs)}&token=${user.token}`) - }) - } - return ( - <> - - ) +import { Func } from '$utils'; + +import moment from 'moment'; +var recordId = null; +const Guanlang = (props) => { + const { dispatch, user, totalPage, companys, creditScore } = props + const [data, setData] = useState([]) + const [modalVisible, setModalVisible] = useState(false); + const [modalRecord, setModalRecord] = useState(); + const [companyName, setCompanyName] = useState(null) + const [creditCode, setCreditCode] = useState(null) + const [pageSize, setPageSize] = useState(10); + const [currentPage, setCurrentPage] = useState(1); + const [applyStatus, setApplyStatus] = useState(null); + const [applyState, setApplyState] = useState('check'); // check 查看;create 新增; apply 初审; approve 复审 + const [editModal, setEditModal] = useState(false); + const [readOnly, setReadOnly] = useState(false); + + const accidentInfo= [] + // const initial = (params, search = false) => { + // dispatch(getAccidentInfo(params)).then(() => { if (search) setCurrentPage(1) }) + // } + + useEffect(() => { + const params = { limit: pageSize, offset: currentPage } + // initial(params) + }, [true]) + + + const openModal = (record, state) => { + if (state == 'check') { + setReadOnly(true) + } else { + setReadOnly(false) + } + searchCompany(record.companyName) + setApplyState(state); + setModalVisible(true); + setModalRecord(record); + } + const search = () => { + const params = { company: companyName, applyStatus, limit: pageSize, offset: 1 } + // initial(params, true) + } + const clearSearch = () => { + setCompanyName(null) + setCreditCode(null) + const params = { limit: pageSize, offset: currentPage } + // initial(params) + } + const columns = [ + { + title: '序号', + dataIndex: 'companyName', + key: 'companyName', + + }, + { + title: '设备名称', + dataIndex: 'accidentTime', + key: 'accidentTime', + + render: (text) => { + return moment(text).format('YYYY-MM-DD') + } + }, + { + title: '设备状态', + dataIndex: 'stationName', + key: 'stationName', + + render: (v, t) => { + let list = t.accidentStations.map(item => item.stationName); + return list.join(','); + } + }, + { + title: '接入类型', + dataIndex: 'stationName', + key: 'stationName', + + render: (v, t) => { + let list = t.accidentStations.map(item => item.stationName); + return list.join(','); + } + }, + { + title: '设备厂家', + dataIndex: 'stationName', + key: 'stationName', + + render: (v, t) => { + let list = t.accidentStations.map(item => item.stationName); + return list.join(','); + } + }, + { + title: '操作', + render: (record) => { + return ( + + openModal(record, 'check')}>查看   + openModal(record, 'edit')}>编辑   + { + // console.log(record) + // dispatch(deleteAccidentInfo(record.id)).then((res) => { + // if (res.success) { + // message.success('删除记录成功'); + // search(); + // } + // } + // ) + } + } + > + 删除   + + + ) + } + } + ]; + + const handleSaveScore = (data) => { + console.log('执行了') + setModalVisible(false); + // if (applyState == 'create') + // dispatch(createAccidentInfo(data)).then(res => { + // if (res.success) { + // message.success('事故资讯添加成功'); + // setModalVisible(false); + // search(); + // } + // }) + // else if (applyState == 'edit') { + // dispatch(editAccidentInfo(data)).then(res => { + // if (res.success) { + // message.success('事故资讯编辑成功'); + // setModalVisible(false); + // search(); + // } + // }) + // } + } + var timer = null; + const searchCompany = (companyName) => { + if (timer) { + clearTimeout(timer) + } else { + timer = setTimeout(() => { + // dispatch(getAllCompany({ companyName })); + }, 400); + } + } + + const spanStyle = { diplay: 'inline-block', marginLeft: 10 } + const inputStyle = { width: 200 } + return ( +
+
+ + 设备搜索: + setCompanyName(v.target.value)}> + + + 接入类型: + setCompanyName(v.target.value)}> + + + 厂家筛选: + setCompanyName(v.target.value)}> + + + 查询状态: + setCompanyName(v.target.value)}> + + + +
+ +
+ { + return {`共${Math.ceil(total / pageSize)}页,${total}项`} + }, + onShowSizeChange: (currentPage, pageSize) => { + setCurrentPage(currentPage); + setPageSize(pageSize); + const params = { company: companyName, creditCode, limit: pageSize, offset: currentPage } + // initial(params) + }, + onChange: (page, pageSize) => { + setCurrentPage(page); + setPageSize(pageSize); + const params = { company: companyName, creditCode, limit: pageSize, offset: page } + // initial(params) + } + }} + /> + + {modalVisible ? { setModalVisible(false) }} + handleSaveScore={handleSaveScore} + // searchCompany={searchCompany} + companys={companys} + editData={modalRecord} + readOnly={readOnly} + applyState={applyState} + > : ''} + + + ) } function mapStateToProps(state) { - const { auth } = state - return { - user: auth.user, - } + const { auth, accidentInfo, allCompany } = state + return { + // user: auth?.user, + // accidentInfo: accidentInfo?.data && accidentInfo?.data.rows || [], + // totalPage: accidentInfo.data && accidentInfo.data.count, + // companys: allCompany.data && allCompany.data.rows || [] + } } -export default connect(mapStateToProps)(Videois); \ No newline at end of file +export default connect(mapStateToProps)(Guanlang); + diff --git a/web/client/src/sections/fillion/nav-item.js b/web/client/src/sections/fillion/nav-item.js index 89d0770b..391d8be7 100644 --- a/web/client/src/sections/fillion/nav-item.js +++ b/web/client/src/sections/fillion/nav-item.js @@ -35,9 +35,9 @@ export function getNavItem(user, dispatch) { 档案管理 - {/* + 视频管理 - */} + 宣传视频