diff --git a/config/router.config.js b/config/router.config.js index 6f6320d34ea3b8b0b2ddf019e996e7ea5319aee7..4c6a775b59eac8c737337b2f5f31a5b1dd94eae5 100644 --- a/config/router.config.js +++ b/config/router.config.js @@ -179,6 +179,12 @@ export default [ path: '/o/warning', icon: 'user', component: './warning-order/Index', + }, + { + name: '系统通知', + path: '/o/system-inform', + icon: 'user', + component: './system/Index', } ] }, diff --git a/src/layouts/BasicLayout.jsx b/src/layouts/BasicLayout.jsx index 8a0885c4dc0b81e63296b88b6195c1a920289810..9c7b32755c3779cb2f1205d41122209eb08f15ee 100644 --- a/src/layouts/BasicLayout.jsx +++ b/src/layouts/BasicLayout.jsx @@ -13,7 +13,7 @@ import Authorized from '@/utils/Authorized'; import RightContent from '@/components/GlobalHeader/RightContent'; import { isAntDesignPro, getAuthorityFromRouter } from '@/utils/utils'; import logo from '../assets/login-logo.svg'; -import styles from './BasicLayout.less' +import styles from './BasicLayout.less'; import router from 'umi/router'; const noMatch = ( { - menuList = menuList ? menuList : [] + menuList = menuList ? menuList : []; let menuLists = menuList .map(item => { if (!item.path) { @@ -89,8 +89,10 @@ const BasicLayout = props => { }, collapsed, login, - user + user, + news: { allNumberOfOutTakeAbnormalOrders, allNumberOfOutTakeAbnormalStudios }, } = props; + console.log(props); /** * constructor */ @@ -102,25 +104,25 @@ const BasicLayout = props => { } const userId = localStorage.getItem('userId'); const ws = new WebSocket(`wss://api.zsqw.msstar.cn/websocket/ws/${userId}`); - ws.onmessage = (msg) => { + ws.onmessage = msg => { //JSON.parse() console.log('接收服务端发过来的消息', msg); - console.log('data:', JSON.parse(msg.data)) + console.log('data:', JSON.parse(msg.data)); dispatch({ type: 'user/socket', - payload: JSON.parse(msg.data) - }) + payload: JSON.parse(msg.data), + }); }; - ws.onclose = (e) => { + ws.onclose = e => { console.log('ws 连接关闭了'); - ws.onmessage = (msg) => { + ws.onmessage = msg => { //JSON.parse() console.log('接收服务端发过来的消息', msg); - console.log('data:', JSON.parse(msg.data)) + console.log('data:', JSON.parse(msg.data)); dispatch({ type: 'user/socket', - payload: JSON.parse(msg.data) - }) + payload: JSON.parse(msg.data), + }); }; }; }, []); @@ -140,15 +142,15 @@ const BasicLayout = props => { const authorized = getAuthorityFromRouter(props.route.routes, location.pathname || '/') || { authority: undefined, }; - - const pageToPush = (address) => router.push(address); + + const pageToPush = address => router.push(address); return ( { - return
{dom}
+ return
{dom}
; }} menuHeaderRender={(logoDom, titleDom) => ( <> @@ -165,10 +167,8 @@ const BasicLayout = props => { return {defaultDom}; }} breadcrumbRender={(routers = []) => { - const datas = routers.length > 1 ? routers.splice(1, 1) : routers - return [ - ...datas - ] + const datas = routers.length > 1 ? routers.splice(1, 1) : routers; + return [...datas]; }} itemRender={(route, params, routes, paths) => { const first = routes.indexOf(route) === 0; @@ -184,30 +184,59 @@ const BasicLayout = props => { formatMessage={formatMessage} className={collapsed ? '' : 'camera-menu-sider'} pageTitleRender={() => '中视前卫'} - rightContentRender={e => } + rightContentRender={e => ( + + )} {...props} {...settings} > {children} -
- pageToPush('/o/warning')} placement="leftTop" title="未结束预警" trigger="hover"> - - - - - pageToPush('/o/caException-order')} placement="leftTop" title="外拍未处理单异常单" trigger="hover"> +
+ pageToPush('/o/caException-order')} + placement="leftTop" + title="外拍未处理单异常单" + trigger="hover" + > - + + {allNumberOfOutTakeAbnormalOrders} + - pageToPush('/s/stCaException-order')} placement="leftTop" title="演播室未处理异常单" trigger="hover"> + pageToPush('/s/stCaException-order')} + placement="leftTop" + title="演播室未处理异常单" + trigger="hover" + > - + + {allNumberOfOutTakeAbnormalStudios} + - + + + + pageToPush('/o/warning')} + placement="leftTop" + title="未结束预警" + trigger="hover" + > + + {/* */} @@ -216,10 +245,11 @@ const BasicLayout = props => { ); }; -export default connect(({ global, user, settings, login }) => ({ +export default connect(({ global, user, settings, login, news }) => ({ collapsed: global.collapsed, menus: user.menus, settings, login, - user + user, + news, }))(BasicLayout); diff --git a/src/layouts/models/news.js b/src/layouts/models/news.js index 5d8b95003c5cb8b90b0a1a11b7dfd77b619d6bbd..a30c8f25c7cb03639cfb71adeafa7b70781e4074 100644 --- a/src/layouts/models/news.js +++ b/src/layouts/models/news.js @@ -1,19 +1,48 @@ +import { getData } from '../../services/user' const News = { namespace: 'news', state: { collapsed: false, notices: [], + allNumberOfOutTakeAbnormalOrders: 0, //外拍异常单 + allNumberOfOutTakeAbnormalStudios: 0, //演播室异常单 }, effects: { - + *fetch({ payload }, { call, put }) { + //走后端获取数据 + const response = yield call(getData, payload) + console.log(response); + //走getList进行数据渲染、给count赋值 + yield put({ + type: 'getList', + payload: { + data: response.data + } + }) + } }, reducers: { - + getList(state, { payload }) { + const { data } = payload; + return { + ...state, + allNumberOfOutTakeAbnormalOrders: data.allNumberOfOutTakeAbnormalOrders,//外拍异常单 + allNumberOfOutTakeAbnormalStudios: data.allNumberOfOutTakeAbnormalStudios, //演播室异常单 + }; + }, }, subscriptions: { - setup({ history }) { + setup({dispatch, history }) { history.listen(({ pathname, search }) => { console.log('news1') + dispatch({ + type: 'fetch', + payload: { + example: { + + } + } + }) }); }, }, diff --git a/src/models/global.js b/src/models/global.js index 7427e689a0f650f263ee47a695b007aafda0c9b8..d5805bd08d88aaf201d94b80d43dbf170fa1c4fa 100644 --- a/src/models/global.js +++ b/src/models/global.js @@ -3,7 +3,7 @@ const GlobalModel = { namespace: 'global', state: { collapsed: false, - notices: [], + notices: [] }, effects: { *fetchNotices(_, { call, put, select }) { diff --git a/src/pages/abnormal-order/Edit.jsx b/src/pages/abnormal-order/Edit.jsx index a45d0e2d85fe1b323bb3d3e49ee7396adab0751e..df473f6827a1f76b3eb6e52f77d0d4625e54ff80 100644 --- a/src/pages/abnormal-order/Edit.jsx +++ b/src/pages/abnormal-order/Edit.jsx @@ -1,16 +1,335 @@ import React from 'react'; -import { Descriptions, Divider, Row, Button, Modal, Input, Form, DatePicker, Radio } from 'antd'; +import { connect } from 'dva'; +import { + Descriptions, + Divider, + Row, + Button, + Modal, + Input, + Form, + DatePicker, + Radio, + Select, + Col, + Cascader, + Tag, + Transfer, + Table, + message, +} from 'antd'; import moment from 'moment'; -@Form.create() -export default class Edit extends React.Component { +import validator from '../../utils/validator'; +// @Form.create() +const { Search } = Input; + +// 添加摄像师 +const TableCameraTransfer = ({ + leftColumns, + rightColumns, + cameraPageInfo, + handleCameraSearch, + handlePage, + totalElements, + ...restProps +}) => ( + + {({ + direction, + filteredItems, + onItemSelectAll, + onItemSelect, + selectedKeys: listSelectedKeys, + }) => { + const columns = direction === 'left' ? leftColumns : rightColumns; + + const rowSelection = { + getCheckboxProps: item => ({ disabled: item.disabled }), + onSelectAll(selected, selectedRows) { + const treeSelectedKeys = selectedRows + .filter(item => !item.disabled) + .map(({ key }) => key); + const diffKeys = selected + ? difference(treeSelectedKeys, listSelectedKeys) + : difference(listSelectedKeys, treeSelectedKeys); + onItemSelectAll(diffKeys, selected); + }, + onSelect({ key }, selected) { + onItemSelect(key, selected); + }, + selectedRowKeys: listSelectedKeys, + }; + + return ( +
+
+ + handleCameraSearch(value, 'blurry')} + /> +
+ `共 ${totalCount} 条数据`, + } + : false + } + rowKey={record => `${record.cameraId}`} + onChange={handlePage} + /> + + ); + }} + +); + +// 添加摄助 +const TableCameraAidTransfer = ({ + leftColumns, + rightColumns, + cameraPageInfo, + handleCameraSearch, + handlePage, + totalElements, + ...restProps +}) => ( + + {({ + direction, + filteredItems, + onItemSelectAll, + onItemSelect, + selectedKeys: listSelectedKeys, + }) => { + const columns = direction === 'left' ? leftColumns : rightColumns; + + const rowSelection = { + getCheckboxProps: item => ({ disabled: item.disabled }), + onSelectAll(selected, selectedRows) { + const treeSelectedKeys = selectedRows + .filter(item => !item.disabled) + .map(({ key }) => key); + const diffKeys = selected + ? difference(treeSelectedKeys, listSelectedKeys) + : difference(listSelectedKeys, treeSelectedKeys); + onItemSelectAll(diffKeys, selected); + }, + onSelect({ key }, selected) { + onItemSelect(key, selected); + }, + selectedRowKeys: listSelectedKeys, + }; + + return ( +
+
+ handleCameraSearch(value, 'blurry')} + /> +
+
`共 ${totalCount} 条数据`, + } + : false + } + rowKey={record => `${record.cameraId}`} + onChange={handlePage} + /> + + ); + }} + +); + +// 添加设备 +const TableTransfer = ({ leftColumns, rightColumns, ...restProps }) => ( + + {({ + direction, + filteredItems, + onItemSelectAll, + onItemSelect, + selectedKeys: listSelectedKeys, + }) => { + const columns = direction === 'left' ? leftColumns : rightColumns; + + const rowSelection = { + onSelectAll(selected, selectedRows) { + const treeSelectedKeys = selectedRows + .filter(item => !item.disabled) + .map(({ key }) => key); + const diffKeys = selected + ? difference(treeSelectedKeys, listSelectedKeys) + : difference(listSelectedKeys, treeSelectedKeys); + onItemSelectAll(diffKeys, selected); + }, + onSelect({ key }, selected) { + onItemSelect(key, selected); + }, + selectedRowKeys: listSelectedKeys, + }; + + return ( +
`${record.equipmentId}`} + bordered + /> + ); + }} + +); + +class Edit extends React.Component { constructor(props) { super(props); this.state = { + times: [], isShow: false, content: '', + startTime: '', + vals: 1, + selectedAddress: [], + isAddressVisible: false, //添加地址弹框 + isCameraVisible: false, //摄像师弹框 + isCameraAssistanceVisible: false, //摄助弹框 + isEquipmentVisible: false, //设备弹框 + startTime: '', + finishTime: '', + startTimeb: '', + finishTimeb: '', + valuea: [], + cameraViews: [], + cameraKeys: [], + type: 'COLUMN_COMMON_CAMERA', + cameraAssistanceViews: [], + cameraAssistanceKeys: [], + equipmentViews: [], + equipmentKeys: [], + cameras: [], + equipmentIds: [], }; + + this.leftTableColumns = [ + { + dataIndex: 'equipmentName', + title: '设备名称', + }, + ]; + this.rightTableColumns = [ + { + dataIndex: 'equipmentName', + title: '设备名称', + }, + { + dataIndex: 'value', + title: '数量', + render: (text, record, index) => ( + this.updateQuipMenValue(e, record, index)} + parser={value => value.replace('.', '')} + /> + ), + }, + ]; + this.cameraTableColumns = [ + { + dataIndex: 'cameraName', + title: '摄像师名称', + width: '140px', + }, + { + dataIndex: 'professionName', + title: '工种', + render: (text, record, index) => { + const { + abnormal: { cameraProfessionsList }, + } = this.props; + return ( + + ); + }, + }, + ]; + this.cameraAidTableColumns = [ + { + dataIndex: 'cameraName', + title: '摄像师名称', + width: '190px', + }, + { + dataIndex: 'professionName', + title: '摄助', + width: '140px', + }, + { + dataIndex: 'remark', + title: '不可选原因', + width: '240px', + }, + ]; } + // 开始时间 + startTime = (date, dateString) => { + console.log(date); + console.log(dateString); + this.setState({ + startTime: dateString, + startTimeb: date, + }); + }; + + // 结束时间 + endTime = (date, dateString) => { + this.setState({ + finishTime: dateString, + finishTimeb: date, + }); + }; + handleCancle = () => { const { dispatch, @@ -23,21 +342,38 @@ export default class Edit extends React.Component { }; handleSave = () => { - const { dispatch, abnormal: { orderMessage }, form } = this.props + const { + dispatch, + abnormal: { orderMessage }, + form, + } = this.props; form.validateFields((error, row) => { + console.log(row); if (error) { return; } dispatch({ - type: "abnormal/restoreOrder", + type: 'abnormal/restoreOrder', payload: { ...row, caExceptionId: orderMessage.caExceptionId, - punchTheClockTime: row.punchTheClockTime ? moment(row.punchTheClockTime).format('YYYY-MM-DD HH:mm:ss') : '' - } - }) - }) - } + punchTheClockTime: row.punchTheClockTime + ? moment(row.punchTheClockTime).format('YYYY-MM-DD HH:mm:ss') + : '', + cameraAssistance: orderMessage.cameraAssistance, + cameraIds: orderMessage.cameraIds, + cameras: orderMessage.cameras, + detailedAddress: orderMessage.detailedAddress, + equipmentIds: orderMessage.equipmentIds, + times: orderMessage.times, + customerId: orderMessage.customerId, + programId: orderMessage.programId, + operatorId: orderMessage.operatorId, + programProfessionIds: orderMessage.programProfessionIds + }, + }); + }); + }; handleInputText = ({ target: { value } }) => { this.setState({ @@ -45,11 +381,498 @@ export default class Edit extends React.Component { }); }; + // 栏目搜索框搜索 + handleSearch = value => { + const { + dispatch, + abnormal: { pageInfo }, + } = this.props; + dispatch({ + type: 'abnormal/fetchFindAllProgram', + payload: pageInfo, + }); + }; + + handleSelectProgram = value => { + console.log(value); + const { + dispatch, + form: { setFieldsValue }, + } = this.props; + + // 编导 + dispatch({ + type: 'abnormal/fetchFindAllCustomer', + payload: value, + }); + + // 计费 + dispatch({ + type: 'abnormal/fetchFindChargeMode', + payload: value, + }); + + // 工种 + dispatch({ + type: 'abnormal/fetchFindAllProfessions', + payload: value, + }); + + // 根据栏目id查询,工种摄助 + dispatch({ + type: 'abnormal/fetchFindAllAidProfessions', + payload: value, + }); + }; + + handleChargeModeSelect = value => { + const { + dispatch, + form: { getFieldValue }, + abnormal: { orderMessage }, + } = this.props; + dispatch({ + type: 'abnormal/fetchFindProfessions', + payload: { programId: orderMessage.programId, chargeMode: value }, + }); + }; + + handleSelectCustomer = value => { + const { + abnormal: { customerList }, + form: { setFieldsValue }, + } = this.props; + customerList.forEach(item => { + if (value === item.customerId) { + setFieldsValue({ phone: item.phone }); + } + }); + }; + + // 删除已选择 + handleCascaderRemove = (item, index) => { + const { selectedAddress } = this.state; + selectedAddress.splice(index, 1); + this.setState({ selectedAddress }); + }; + + // 关闭弹出框 + handleCloseModal = () => { + this.setState({ + isAddressVisible: false, //添加地址弹框 + isCameraVisible: false, //摄像师弹框 + isCameraAssistanceVisible: false, //摄助弹框 + isEquipmentVisible: false, + }); + }; + + // 选择地址 + handleCascader = (e, selectedOptions) => { + // console.log(selectedOptions); + this.setState({ selectedOptions }); + // console.log(this.state.selectedOptions); + }; + + // 添加地址 + handleAddCascader = () => { + const { selectedOptions, selectedAddress } = this.state; + selectedAddress.push({ + selectedOption: selectedOptions, + }); + this.setState({ + selectedAddress, + }); + }; + + // 单选框发生变化时调用 + onChangeRadio = e => { + this.setState({ + vals: e.target.value, + }); + }; + + // 添加时间 + handleMonthDate = () => { + // let arraya=[this.state.startTime,this.state.finishTime] + let arrayb = [this.state.startTimeb, this.state.finishTimeb]; + const { times, type } = this.state; + const dateListMoment = arrayb.map(item => moment(item).format('YYYY-MM-DD HH:mm')); + const time = dateListMoment.join('—'); + if (times.indexOf(time) > -1) { + message.warning('当前时间已存在'); + return false; + } + times.push(time); + this.setState({ times }); + const { + dispatch, + abnormal: { pageInfo, cameraAssistancePageInfo }, + form: { getFieldValue }, + } = this.props; + if (getFieldValue('programId')) { + pageInfo.example.times = times.join(',').replace('—', ','); + pageInfo.example.programId = getFieldValue('programId'); + pageInfo.example.type = type; + + cameraAssistancePageInfo.example.times = times.join(',').replace('—', ','); + cameraAssistancePageInfo.example.programId = getFieldValue('programId'); + dispatch({ + type: 'abnormal/fetchFindFindCamera', + payload: pageInfo, + }); + dispatch({ + type: 'abnormal/fetchFindAidFindCamera', + payload: cameraAssistancePageInfo, + }); + } + this.setState({ valuea: null }); + }; + + // 删除时间 + handleClose = (item, index) => { + console.log(item, index); + + const { times, type } = this.state; + times.splice(index, 1); + this.setState({ times }); + + const { + dispatch, + abnormal: { pageInfo, cameraAssistancePageInfo }, + form: { getFieldValue }, + } = this.props; + if (getFieldValue('programId')) { + pageInfo.example.times = times.join(',').replace('—', ','); + pageInfo.example.programId = getFieldValue('programId'); + pageInfo.example.type = type; + + cameraAssistancePageInfo.example.times = times.join(',').replace('—', ','); + cameraAssistancePageInfo.example.programId = getFieldValue('programId'); + dispatch({ + type: 'abnormal/fetchFindFindCamera', + payload: pageInfo, + }); + dispatch({ + type: 'abnormal/fetchFindAidFindCamera', + payload: cameraAssistancePageInfo, + }); + } + }; + + // 摄像师 + handleCameraTransfer = keys => { + const { cameras, cameraViews } = this.state; + const data = []; + cameras.forEach(item => { + if (keys.indexOf(item.cameraId) > -1) { + data.push(item); + } + }); + + const views = []; + cameraViews.forEach(item => { + if (keys.indexOf(item.cameraId) > -1) { + views.push(item); + } + }); + console.log(this.state.cameraKeys); + console.log(this.state.cameras); + console.log(this.state.cameraViews); + this.setState({ cameraKeys: keys, cameras: data, cameraViews: views }); + }; + + handleshexClose = (item, index) => { + console.log(index); + const { cameraViews, cameraKeys } = this.state; + cameraViews.splice(index, 1); + cameraKeys.splice(index, 1); + // console.log(cameraViews); + this.setState({ cameraViews, cameraKeys }); + }; + + // 摄像师添加工种 + handleProfessionsSelect = (value, index, record) => { + const { cameras, cameraKeys, cameraViews } = this.state; + const { + abnormal: { cameraProfessionsList }, + } = this.props; + let isExistence = false; + + cameras.forEach(item => { + if (item.cameraId === cameraKeys[index]) { + isExistence = true; + item.professionId = value; + } + }); + if (!isExistence) { + cameras.push({ + cameraId: cameraKeys[index], + professionId: value, + }); + } + + // 用于展示 + let isNotExistence = true; + cameraViews.forEach((view, j) => { + if (view.cameraId === cameraKeys[index]) { + isNotExistence = false; + cameraProfessionsList.forEach(item => { + if (item.professionId === value) { + cameraViews[j].professionName = item.professionName; + } + }); + } + }); + + if (isNotExistence) { + cameraProfessionsList.forEach(item => { + if (item.professionId === value) { + cameraViews.push({ + cameraName: record.cameraName, + cameraId: record.cameraId, + professionName: item.professionName, + }); + } + }); + } + + this.setState({ cameras, cameraViews }); + }; + + // 摄像师分页 + handlePage = page => { + const { + dispatch, + abnormal: { pageInfo }, + } = this.props; + pageInfo.pageNumber = page.current; + pageInfo.example.cameraId = this.state.cameraKeys; + dispatch({ + type: 'abnormal/fetchFindFindCamera', + payload: pageInfo, + }); + }; + + // 摄像师搜索 + handleCameraSearch = (value, key) => { + const { + dispatch, + abnormal: { pageInfo }, + } = this.props; + const { cameraKeys } = this.state; + pageInfo.example.cameraId = cameraKeys; + pageInfo.example[key] = value; + pageInfo.pageNumber = 1; + if (key === 'type') { + this.setState({ + type: value, + }); + } + dispatch({ + type: 'abnormal/fetchFindFindCamera', + payload: pageInfo, + }); + }; + + // 摄助 + handleCameraAidTransfer = keys => { + const { + abnormal: { cameraAssistanceList }, + } = this.props; + const cameraAssistanceViews = []; + cameraAssistanceList.forEach(item => { + if (keys.indexOf(item.cameraId) > -1) { + cameraAssistanceViews.push(item); + } + }); + this.setState({ cameraAssistanceKeys: keys, cameraAssistanceViews }); + }; + + // 删除摄助 + handleshezClose = (item, index) => { + const { cameraAssistanceViews, cameraAssistanceKeys } = this.state; + cameraAssistanceKeys.splice(index, 1); + cameraAssistanceViews.splice(index, 1); + this.setState({ cameraAssistanceViews, cameraAssistanceKeys }); + }; + + // 摄助分页 + handleAidPage = page => { + const { + dispatch, + abnormal: { cameraAssistancePageInfo }, + } = this.props; + cameraAssistancePageInfo.pageNumber = page.current; + cameraAssistancePageInfo.example.cameraId = this.state.cameraAssistanceKeys; + dispatch({ + type: 'abnormal/fetchFindAidFindCamera', + payload: cameraAssistancePageInfo, + }); + }; + + // 摄助搜索 + handleCameraAidSearch = (value, key) => { + const { + dispatch, + abnormal: { cameraAssistancePageInfo }, + } = this.props; + const { cameraAssistanceKeys } = this.state; + cameraAssistancePageInfo.example.cameraId = cameraAssistanceKeys; + cameraAssistancePageInfo.example[key] = value; + cameraAssistancePageInfo.pageNumber = 1; + dispatch({ + type: 'abnormal/fetchFindAidFindCamera', + payload: cameraAssistancePageInfo, + }); + }; + + // 设备 + handleTableTransfer = keys => { + const { equipmentIds, equipmentViews } = this.state; + const data = []; + const views = []; + equipmentIds.forEach(item => { + if (keys.indexOf(item.equipmentId) > -1) { + data.push(item); + } + }); + + equipmentViews.forEach(item => { + if (keys.indexOf(item.equipmentId) > -1) { + views.push(item); + } + }); + + this.setState({ equipmentKeys: keys, equipmentIds: data, equipmentViews: views }); + }; + + updateQuipMenValue = (value, record, index) => { + const { equipmentIds, equipmentKeys, equipmentViews } = this.state; + let isExistence = false; + equipmentIds.forEach(item => { + if (item.equipmentId === equipmentKeys[index]) { + isExistence = true; + item.value = value; + } + }); + if (!isExistence) { + equipmentIds.push({ + equipmentId: equipmentKeys[index], + value, + }); + } + + // 用于展示 + let isNotExistence = true; + equipmentViews.forEach((view, j) => { + if (view.equipmentId === equipmentKeys[index]) { + isNotExistence = false; + equipmentViews[j].value = value; + } + }); + + if (isNotExistence) { + equipmentViews.push({ + equipmentName: record.equipmentName, + equipmentId: record.equipmentId, + value, + }); + } + + this.setState({ + equipmentIds, + }); + }; + + // 删除设备 + handleshebClose = (item, index) => { + const { equipmentViews, equipmentKeys } = this.state; + equipmentViews.splice(index, 1); + equipmentKeys.splice(index, 1); + this.setState({ equipmentViews, equipmentKeys }); + }; + + // 点击下拉框获取计费类型 + handleChose = () => { + console.log(11); + const { + dispatch, + form: { setFieldsValue }, + abnormal: { orderMessage }, + } = this.props; + dispatch({ + type: 'abnormal/fetchFindChargeMode', + payload: orderMessage.programId, + }); + + // 根据栏目id查询,工种摄助 + dispatch({ + type: 'abnormal/fetchFindAllAidProfessions', + payload: orderMessage.programId, + }); + }; + + // 点击下拉框获取编导姓名 + handleCustomer = () => { + const { + dispatch, + form: { setFieldsValue }, + abnormal: { orderMessage }, + } = this.props; + dispatch({ + type: 'abnormal/fetchFindAllCustomer', + payload: orderMessage.programId, + }); + } + + // 点击下拉框查询工种 + handelProfessions = () => { + const { + dispatch, + form: { setFieldsValue }, + abnormal: { orderMessage }, + } = this.props; + dispatch({ + type: 'abnormal/fetchFindAllProfessions', + payload: orderMessage.programId, + }); + } + render() { const { - abnormal: { orderMessage }, form + abnormal: { + orderMessage, + programList, + chargeModeList, + professionsList, + customerList, + provinceAndCity, + cameraList, + totalCameraElements, + cameraPageInfo, + cameraAssistanceList, + totalCameraAidElements, + cameraAssistancePageInfo, + quipmentList, + }, + form, } = this.props; + console.log(this.props); const { getFieldDecorator, getFieldValue } = form; + const { + isAddressVisible, + isCameraVisible, + isCameraAssistanceVisible, + times, + cameraViews, + cameraKeys, + cameraAssistanceViews, + cameraAssistanceKeys, + equipmentViews, + isEquipmentVisible, + equipmentKeys, + selectedAddress, + } = this.state; const status = [ '已预约', '待完成', @@ -99,8 +922,12 @@ export default class Edit extends React.Component { {orderMessage.cameraGroupName} {orderMessage.createTime} {orderMessage.detailedAddress} - {orderMessage.name} - {orderMessage.beginTime} + + {orderMessage.name} + + + {orderMessage.beginTime} + {/* @@ -110,48 +937,593 @@ export default class Edit extends React.Component { {orderMessage.content} */}
- - {getFieldDecorator('state', { - initialValue: true, rules: [ - { - required: true, - message: '请选择异常处理', - }, - ] - })( - - 归为正常 - 归为异常 - - )} - - - {getFieldDecorator('content', { - initialValue: "", rules: [ - { - required: true, - message: '请填写报错原因', - }, - ] - })( - + + + {getFieldDecorator('state', { + initialValue: true, + rules: [ + { + required: true, + message: '请选择异常处理', + }, + ], + })( + + 归为正常 + 归为异常 + , + )} + + + {getFieldDecorator('content', { + initialValue: '', + rules: [ + { + required: true, + message: '请填写报错原因', + }, + ], + })()} + + {getFieldValue('state') ? ( +
+ + {getFieldDecorator('punchTheClockTime', { + initialValue: '', + rules: [ + { + required: false, + message: '请选择打卡时间', + }, + ], + })()} + + +
+ 栏目信息 + + + + {/* {getFieldDecorator('programId', { + initialValue: orderMessage.programName, + rules: [ + { + required: true, + message: '请选择栏目组', + }, + ], + })( + , + )} */} + + {getFieldDecorator('programId', { + initialValue: orderMessage.programName, + rules: [ + { + required: true, + message: '请选择栏目组', + }, + ], + })()} + + + + {getFieldDecorator('chargeMode', { + initialValue: orderMessage.chargeMode, + rules: [{ required: true, message: '请选择计费方式' }], + validatorTrigger: 'onBlur', + })( + , + )} + + + + {getFieldDecorator('programProfessionIds', { + initialValue: orderMessage.programProfessionNames + ? orderMessage.programProfessionNames + : null, + rules: [{ required: true, message: '请选择收发设置' }], + validatorTrigger: 'onBlur', + type: 'array', + })( + , + )} + + + + 拍摄信息 + + + + + {getFieldDecorator('filmingPlace', { + initialValue: orderMessage.filmingPlace, + rules: [{ required: true, message: '请选择拍摄地' }], + validatorTrigger: 'onBlur', + })( + + {orderMessage.filmingPlace == '1' ? ( + + 在京 + + 出差 + + + 值班 + + + 补单 + + + ) : orderMessage.filmingPlace == '2' ? ( + + + 在京 + + 出差 + + 值班 + + + 补单 + + + ) : orderMessage.filmingPlace == '3' ? ( + + + 在京 + + + 出差 + + 值班 + + 补单 + + + ) : ( + + + 在京 + + + 出差 + + + 值班 + + 补单 + + )} + , + )} + + + + {/* */} + {/* {this.state.vals === 2 ? ( + + +
+ {selectedAddress.map((item, index) => ( +
+ this.handleCascaderRemove(item, index)}> + {item.selectedOption[0] ? `${item.selectedOption[0].label}-` : ''} + {item.selectedOption[1] ? `${item.selectedOption[1].label}` : ''} + {item.selectedOption[2] ? `${item.selectedOption[2].label}` : ''} + +
+ ))} + +
+ + +
+ 选择地址: + + {this.state.selectedAddress.length > 0 ? ( + + ) : ( + + )} +
+
+ {selectedAddress.map((item, index) => ( +
+ this.handleCascaderRemove(item, index)}> + {item.selectedOption[0] ? `${item.selectedOption[0].label}-` : ''} + {item.selectedOption[1] ? `${item.selectedOption[1].label}` : ''} + {item.selectedOption[2] ? `${item.selectedOption[2].label}` : ''} + +
+ ))} +
+
+
+ + ) : ( + + )} */} + + + {orderMessage.times.map((item, index) => ( + + {item.beginTime}--{item.overTime} + + ))} + {/* 开始时间: + + 结束时间: + +    + +
+ {times.map((item, index) => ( + this.handleClose(item, index)} + > + {item} + + ))} +
*/} +
+ + + 编导信息 + + + + {getFieldDecorator('customerId', { + initialValue: orderMessage.customerName, + rules: [{ required: true, message: '请选择编导' }], + validatorTrigger: 'onBlur', + })( + , + )} + + + + {getFieldDecorator('phone', { + initialValue: orderMessage.phone, + rules: [ + { + required: true, + message: '请输入正确的手机号', + pattern: validator.pattern.phone, + }, + ], + validatorTrigger: 'onBlur', + })()} + + + + 摄像信息 + + + +
+ {orderMessage.cameraLists + ? orderMessage.cameraLists.map((item, index) => ( + this.handleshexClose(item, index)} + > + {item} + + )) + : null} + {cameraViews.map((item, index) => ( + this.handleshexClose(item, index)} + > + {item.cameraName}-{item.professionName} + + ))} + +
+ + + + +
+ + + {getFieldDecorator('operatorId', { + initialValue: orderMessage.name, + rules: [{ required: false, message: '请选择操作人' }], + validatorTrigger: 'onBlur', + })( + , + )} + + + +
+ {/* {orderMessage.cameraListTwos.map((item, index) => ( + this.handleshexClose(item, index)} + > + {item} + + ))} */} + {orderMessage.cameraListTwos + ? orderMessage.cameraListTwos.map((item, index) => ( + this.handleshexClose(item, index)} + > + {item} + + )) + : null} + {cameraAssistanceViews.map((item, index) => ( + this.handleshezClose(item, index)} + > + {item.cameraName}-{item.professionName} + + ))} + +
+ + + + +
+ + + 设备信息 + + + +
+ {orderMessage.equipmentNames + ? orderMessage.equipmentNames.map((item, index) => ( + this.handleshebClose(item, index)} + > + {item} + + )) + : null} + {equipmentViews.map((item, index) => ( + this.handleshebClose(item, index)} + > + {item.equipmentName}-{item.value} + + ))} + +
+ + + + item.equipmentName.indexOf(inputValue) !== -1 + } + leftColumns={this.leftTableColumns} + rightColumns={this.rightTableColumns} + /> + +
+ + ) : ( + undefined )} - - { - getFieldValue('state') ? - - {getFieldDecorator('punchTheClockTime', { - initialValue: "", rules: [ - { - required: true, - message: '请选择打卡时间', - }, - ] - })( - , - )} - : undefined - } + - - diff --git a/src/pages/camera/Culumn.jsx b/src/pages/camera/Culumn.jsx new file mode 100644 index 0000000000000000000000000000000000000000..bc9eb9718df10d8d819a9f832b1de64c9b80392d --- /dev/null +++ b/src/pages/camera/Culumn.jsx @@ -0,0 +1,167 @@ +import React from 'react'; +import { Modal, Checkbox } from 'antd'; +import { connect } from 'dva'; +const CheckboxGroup = Checkbox.Group; + +// const plainOptions = ['Apple', 'Pear', 'Orange']; +// const defaultCheckedList = ['Apple', 'Orange']; +// const options = [ +// { label: 'Apple', value: 'Apple' }, +// { label: 'Pear', value: 'Pear' }, +// { label: 'Orange', value: 'Orange' }, +// ]; + +class Culumn extends React.Component { + constructor(props) { + super(props); + this.state = { + visibleCulumn: false, + // checkedList: defaultCheckedList, + indeterminate: true, + checkAll: false, + list: [] + }; + } + + // 点击所属栏目打开弹框 + showCulumn = () => { + const { dispatch, cameraId } = this.props; + console.log(this.props); + dispatch({ + type: 'camera/fetchCulunm', + payload: cameraId, + }); + this.setState({ + visibleCulumn: true, + }); + }; + + // 点击弹框确定 + handleOk = () => { + const {dispatch, cameraId} = this.props; + const {list} = this.state; + console.log(this.state); + dispatch({ + type: 'camera/fetchUpdateCulumn', + payload: { + cameraId, + list + } + }); + this.setState({ + visibleCulumn: false, + }); + }; + + // 点击弹框取消 + hideModal = () => { + this.setState({ + visibleCulumn: false, + }); + }; + + + onCheckAllChange=(a,b)=>{ + console.log(a); + console.log(b); + } + + onChangeb = (listg,checkedValues,c) => { + console.log(c); + // console.log(listg); + if(this.state.list==[]){ + this.setState({list:listg}) + } + // console.log(this.state.list); + // console.log(checkedValues); + let linshilist=this.state.list + let flag=true + for(let i=0;i { + // console.log(`checked = ${e.target.checked}`); + // let flag=this.state.checkAll + + // this.setState({ + // checkAll: !flag + // }) + // }; + + render() { + const { + camera: { culumnList ,flaglist}, + } = this.props; + console.log(this.props); + const { visibleCulumn } = this.state; + return ( + + + 所属栏目 + + + +
+ {culumnList + ? culumnList.map((item, index) => ( +
+
+ this.onCheckAllChange(e,item)} + // checked={checkAll} + key={index} + > + {item.toCompanyName} + +
+
+
+ {item.programList + ? item.programList.map((items, indexs) => ( + this.onChangeb(item.programIdList,items.programId,this.state.list)} + // value={this.state.list} + key={indexs} + // onChange={this.onChange} + // checked={true} + /> + )) + : null} +
+
+
+ )) + : null} +
+
+ ); + } +} + +export default connect(props => props)(Culumn); diff --git a/src/pages/camera/Culumns.jsx b/src/pages/camera/Culumns.jsx new file mode 100644 index 0000000000000000000000000000000000000000..bf30a5718fc4d87eef3f1409a3a78f74fda08540 --- /dev/null +++ b/src/pages/camera/Culumns.jsx @@ -0,0 +1,158 @@ +import React from 'react'; +import { Modal, Checkbox } from 'antd'; +import { connect } from 'dva'; +const CheckboxGroup = Checkbox.Group; + +// const plainOptions = ['Apple', 'Pear', 'Orange']; +// const defaultCheckedList = ['Apple', 'Orange']; +// const options = [ +// { label: 'Apple', value: 'Apple' }, +// { label: 'Pear', value: 'Pear' }, +// { label: 'Orange', value: 'Orange' }, +// ]; +const Options = [ + { id: 1, name: 'Apple' }, + { id: 2, name: 'Pear' }, + { id: 3, name: 'Orange' }, +]; + +class Culumns extends React.Component { + constructor(props) { + super(props); + this.state = { + visibleCulumn: false, + Options: [ + { id: 1, name: 'Apple', checked: false }, + { id: 2, name: 'Pear', checked: false }, + { + id: 3, + name: 'Orange', + checked: false, + }, + ], + checked: false, + checkedId: [], + }; + } + + // 点击所属栏目打开弹框 + showCulumn = () => { + const { dispatch, cameraId } = this.props; + console.log(this.props); + dispatch({ + type: 'camera/fetchCulunm', + payload: cameraId, + }); + this.setState({ + visibleCulumn: true, + }); + }; + + // 点击弹框确定 + handleOk = () => { + this.setState({ + visibleCulumn: false, + }); + }; + + // 点击弹框取消 + hideModal = () => { + this.setState({ + visibleCulumn: false, + }); + }; + + onChange = item => { + let i = 0; + let l = 0; + Options.map((option, index) => { + if (option.id == item.id) { + option.checked = !item.checked; + } + if (option.checked == true) { + i += 1; + } + if (option.checked == false) { + l += 1; + } + }); + + if (Options.length == i) { + this.state.checked = true; + } + if (Options.length == l) { + this.state.checked = false; + } + this.setState({ + Options: Options, + checked: this.state.checked, + }); + }; + + handleCheckAll = () => { + this.setState({ checked: !this.state.checked }); + if (!this.state.checked) { + this.state.checkedId = []; + Options.map((option, index) => { + this.state.checkedId.push(option.id); + }); + this.state.checkedId.map((id, index) => { + Options.map((Option, idx) => { + if (Option.id == id) { + Option.checked = true; + } + }); + }); + } else { + this.state.checkedId.map((id, index) => { + Options.map((Option, idx) => { + if (Option.id == id) { + Option.checked = false; + } + }); + }); + this.state.checkedId = []; + } + this.setState({ + Options: Options, + }); + }; + + render() { + const { visibleCulumn } = this.state; + return ( + + + 所属栏目 + + + +
+ + 全选 +
+ {Options.map((option, index) => { + return ( + + {option.name} + + ); + })} +
+
+
+ ); + } +} + +export default connect(props => props)(Culumns); diff --git a/src/pages/camera/Edit.jsx b/src/pages/camera/Edit.jsx index 141ab60f39535126451e714f37e894bcf736f172..3ec0209e7467e296bdcecdc40958b696a8c5a3c4 100644 --- a/src/pages/camera/Edit.jsx +++ b/src/pages/camera/Edit.jsx @@ -39,12 +39,14 @@ class Edit extends React.Component { }; handleSubmit = e => { + console.log(111); const { dispatch, isNew, camera: { groupAll, works }, form, } = this.props; + console.log(this.props); e.preventDefault(); form.validateFieldsAndScroll((errors, values) => { if (errors) { @@ -229,7 +231,7 @@ class Edit extends React.Component {
{getFieldDecorator('sex', { - initialValue: isNew ? undefined : String(cameraDetail.sex), + initialValue: isNew ? null : cameraDetail.sex === '' || cameraDetail.sex === null || cameraDetail.sex === 'null' ? null : String(cameraDetail.sex), rules: [{ required: false, message: '请选择性别' }], validatorTrigger: 'onBlur', })( @@ -261,7 +263,7 @@ class Edit extends React.Component { {getFieldDecorator('cameraLevel', { - initialValue: isNew ? undefined : String(cameraDetail.cameraLevel), + initialValue: isNew ? null : cameraDetail.cameraLevel === '' || cameraDetail.cameraLevel === null || cameraDetail.cameraLevel === 'null' ? null : String(cameraDetail.cameraLevel), rules: [{ required: false, message: '请选择级别' }], validatorTrigger: 'onBlur', })( @@ -337,7 +339,7 @@ class Edit extends React.Component { {getFieldDecorator('cameraSkillsName', { - initialValue: isNew ? [] : cameraDetail.cameraSkillsName, + initialValue: isNew ? [] : cameraDetail.cameraSkillsName ? [] : cameraDetail.cameraSkillsName, rules: [{ required: false, message: '请输入摄像技能' }], validatorTrigger: 'onBlur', type: 'array', diff --git a/src/pages/camera/Index.jsx b/src/pages/camera/Index.jsx index 82e079d68fa81b9809cd39638db222038d7b0a1e..1a443d3be9fedc55bc216efd1ae33757d0e8523e 100644 --- a/src/pages/camera/Index.jsx +++ b/src/pages/camera/Index.jsx @@ -98,6 +98,7 @@ const Camera = props => { }); }; + const handlePage = page => { const { dispatch, diff --git a/src/pages/camera/Table.jsx b/src/pages/camera/Table.jsx index 72a08d4e645d1563026d016be5ce336920a7966e..03d4b5c94415fb43d2099a2344137f4360f6ad54 100644 --- a/src/pages/camera/Table.jsx +++ b/src/pages/camera/Table.jsx @@ -1,6 +1,7 @@ import React from 'react'; import { Table, Divider, Popconfirm, Menu, Dropdown, Avatar } from 'antd'; import Detail from './Detail'; +import Culumn from './Culumn'; const CameraTable = props => { const { @@ -9,6 +10,7 @@ const CameraTable = props => { handleBlockAccount, handleDelete, handleEdit, + handleColumn, handleReducible, handlePage, // handleLeave, @@ -82,7 +84,7 @@ const CameraTable = props => { width: 90, }, { - title: '排期状态', + title: '状态', dataIndex: 'reducible', key: 'reducible', align: 'center', @@ -98,7 +100,7 @@ const CameraTable = props => { render: value => (String(value) === '0' ? '摄像师' : '摄像主管'), }, { - title: '账号状态', + title: '登录', dataIndex: 'online', key: 'online', align: 'center', @@ -164,6 +166,8 @@ const CameraTable = props => { > 更多 + + ), }, diff --git a/src/pages/camera/models/camera.js b/src/pages/camera/models/camera.js index 291b2dc4a94c5a41bff1583cdc861582621bffce..c0a8d2c1184e12ce0b39a697cefd7d03dd227df0 100644 --- a/src/pages/camera/models/camera.js +++ b/src/pages/camera/models/camera.js @@ -11,6 +11,8 @@ import { edit, detail, updateReducible, + findCulumnAll, + updateCulumn } from '../services/camera'; const CameraModel = { @@ -176,9 +178,55 @@ const CameraModel = { message.error(res.errorCode); } }, + + // 获取所属栏目 + *fetchCulunm({ payload }, { call, put }) { + const response = yield call(findCulumnAll, payload); + console.log(response) + let flaglist=[] + for(let i=0;i state.camera.pageInfo); + yield put({ + type: 'fetchList', + payload: pageInfo, + }); + if (res.success) { + message.success('设置成功'); + } else { + message.error(res.errorCode); + } + }, }, reducers: { + // 获取所属栏目 + getCulunmList(state, {payload}) { + const {data,flaglist} = payload; + return { + ...state, + culumnList: data, + flaglist:flaglist + } + }, + + tabSwitch(state, { payload }) { if (payload.key === 'edit') { return { ...state, tabActiveKey: payload.key, cameraId: payload.cameraId }; diff --git a/src/pages/camera/services/camera.js b/src/pages/camera/services/camera.js index 91751e783e0accbf2d8bf43c2c081e9785ea5566..e2b039bac5130bcbf3f466c9605735af5f2c0bdc 100644 --- a/src/pages/camera/services/camera.js +++ b/src/pages/camera/services/camera.js @@ -111,3 +111,22 @@ export async function updateReducible(params) { method: 'PUT', }); } + +/** + * 获取所属栏目 + */ +export async function findCulumnAll() { + return request(`/api/c/camera/find/update/program`, { + method: 'GET', + }); +} + +/** + * 编辑摄像所属栏目 + */ +export async function updateCulumn(params) { + return request(`/api/c/camera/add/update/program`, { + method: 'PUT', + data: params + }); +} diff --git a/src/pages/configurations/Index.jsx b/src/pages/configurations/Index.jsx index 55f569b45b173bff812feed538b236befe8809f2..2afe5ba01c68115d0db46af2e2af566b558e2e60 100644 --- a/src/pages/configurations/Index.jsx +++ b/src/pages/configurations/Index.jsx @@ -36,6 +36,8 @@ export default class Index extends Component { }; } handleChange = (type, value) => { + console.log(type); + console.log(value); const { dispatch } = this.props; dispatch({ type: 'configurations/fetchSave', @@ -89,10 +91,11 @@ export default class Index extends Component { chargeOrderChargeTime, chargeOrderNoChargeTime, }, - exampleApp: { priceFloor, workUploading,inTimeConfine,outTimeConfine }, + exampleApp: { priceFloor, workUploading,inTimeConfine,outTimeConfine,alarmSystem }, selectValue }, } = this.props; + console.log(this.props); const { getFieldDecorator, getFieldValue } = form; const { data = {} } = configurations; const formItemLayout = { @@ -316,6 +319,22 @@ export default class Index extends Component { + +
+
+ 报警开关: + + + this.handleChange('alarmSystem', checked)} + /> + + + +
diff --git a/src/pages/configurations/models/configurations.js b/src/pages/configurations/models/configurations.js index 56cc2d9718be5c4355a918f3123cce589f256501..126118d15f3904476f87d8c37e483896d60db15d 100644 --- a/src/pages/configurations/models/configurations.js +++ b/src/pages/configurations/models/configurations.js @@ -21,7 +21,8 @@ export default { priceFloor: 0, workUploading: 0, inTimeConfine: 0, - outTimeConfine: 0 + outTimeConfine: 0, + alarmSystem: 0 }, selectValue: '1' @@ -40,6 +41,7 @@ export default { *fetchAppBase({ _ }, { call, put }) { const response = yield call(getConfigurationsApp); + console.log(response); yield put({ type: 'updateState', payload: { @@ -52,8 +54,10 @@ export default { *fetchSave({ params }, { call, put, select }) { const response = yield call(save, params); + console.log(response); if (response.success) { const selectValue = yield select(state => state.configurations.selectValue); + console.log(selectValue); message.success('设置成功') if (selectValue === '1') { yield put({ diff --git a/src/pages/customer/CulumnModal.jsx b/src/pages/customer/CulumnModal.jsx new file mode 100644 index 0000000000000000000000000000000000000000..4dea4c8654f7adf72eee2849ee918c9d309d86ee --- /dev/null +++ b/src/pages/customer/CulumnModal.jsx @@ -0,0 +1,151 @@ +import React from 'react'; +import { Modal, Checkbox } from 'antd'; +import { connect } from 'dva'; +import { times } from 'lodash'; +const CheckboxGroup = Checkbox.Group; +const plainOptions = ['Apple', 'Pear', 'Orange']; +const defaultCheckedList = ['Apple', 'Orange']; + +class CulumnModal extends React.Component { + constructor(props) { + super(props); + this.state = { + isVisible: false, + // checkedList: defaultCheckedList, + indeterminate: true, + checkAll: false, + list: [] + }; + } + + onCheckAllChange=(a,b)=>{ + console.log(a); + console.log(b); + } + + onChangeb = (listg,checkedValues,c) => { + console.log(c); + // console.log(listg); + if(this.state.list==[]){ + this.setState({list:listg}) + } + // console.log(this.state.list); + // console.log(checkedValues); + let linshilist=this.state.list + let flag=true + for(let i=0;i { + const { dispatch, customerId } = this.props; + console.log(this.props); + dispatch({ + type: 'customer/fetchCulunm', + payload: customerId, + }); + this.setState({ + isVisible: true, + }); + }; + + // 点击确定 + handleOk = () => { + const {dispatch, customerId} = this.props; + const {list} = this.state; + console.log(this.state); + dispatch({ + type: 'customer/fetchUpdateCulumn', + payload: { + customerId, + list + } + }); + this.setState({ + isVisible: false, + }); + }; + + // 点击取消 + handleCancel = () => { + this.setState({ + isVisible: false, + }); + }; + + render() { + const { + customer: { culumnList }, + } = this.props; + console.log(this.props); + const { isVisible } = this.state; + return ( +
+ + 所属栏目 + + +
+ {culumnList + ? culumnList.map((item, index) => ( +
+
+ this.onCheckAllChange(e,item)} + // checked={checkAll} + key={index} + > + {item.toCompanyName} + +
+
+
+ {item.programList + ? item.programList.map((items, indexs) => ( + this.onChangeb(item.programIdList,items.programId,this.state.list)} + // value={this.state.list} + key={indexs} + // onChange={this.onChange} + // checked={true} + /> + )) + : null} +
+
+
+ )) + : null} +
+
+ ); + } +} + +export default connect(props => props)(CulumnModal); diff --git a/src/pages/customer/Index.jsx b/src/pages/customer/Index.jsx index b0741923a1ec8f3f79f59ebf657a98c4f7a707e7..5f2560f268cec773096b24e80886af1d04869491 100644 --- a/src/pages/customer/Index.jsx +++ b/src/pages/customer/Index.jsx @@ -1,15 +1,20 @@ import React from 'react'; import { connect } from 'dva'; -import { Table, Row, Col, Divider, Popconfirm, Avatar } from 'antd'; +import { Table, Row, Col, Divider, Popconfirm, Avatar, Modal, Button, Form, Input } from 'antd'; import Head from './Head'; import Edit from './Edit'; +import Modals from './Modals'; +import CulumnModals from './CulumnModal'; const Customer = props => { const { dispatch, customer: { pageNumber, total }, } = props; + console.log(props); + const handleOperation = (type, record) => { + console.log(record); switch (type) { case 'editor': dispatch({ @@ -75,18 +80,19 @@ const Customer = props => { title: '账号', dataIndex: 'userName', key: 'userName', + width: 120, }, { title: 'APP身份', dataIndex: 'customerTypeName', key: 'customerTypeName', - width: 120 + width: 180, }, { title: '后台角色', dataIndex: 'roleName', key: 'roleName', - width: 150 + width: 150, }, { title: '所属栏目', @@ -98,21 +104,33 @@ const Customer = props => { title: '操作', dataIndex: 'set', key: 'set', - width: 120, + width: 180, render: (text, record, index) => ( +
- handleOperation('editor', record)}> - 编辑 - - - handleOperation('delete', record)} - overlayStyle={{ width: '200px' }} - > - 删除 - +
+ handleOperation('editor', record)}> + 编辑 + + +
+
+ handleOperation('delete', record)} + overlayStyle={{ width: '200px' }} + > + 删除 + + +
+
+ +
+
+ {record.ifShow == 1? : ''} +
), }, @@ -121,7 +139,7 @@ const Customer = props => { loading, customer: { list, isList }, } = props; - + console.log(props); return ( <> @@ -149,8 +167,15 @@ const Customer = props => { ); }; +// export default connect(({ customer, loading, login }) => ({ +// customer, +// loading: loading.effects['role/fetch'], +// login +// }))(Customer); + +const customerForm = Form.create()(Customer); export default connect(({ customer, loading, login }) => ({ customer, loading: loading.effects['role/fetch'], login, -}))(Customer); +}))(customerForm); diff --git a/src/pages/customer/Modals.jsx b/src/pages/customer/Modals.jsx new file mode 100644 index 0000000000000000000000000000000000000000..a989c7c9dbd5be574aa9eba362b8ceda00f77e8b --- /dev/null +++ b/src/pages/customer/Modals.jsx @@ -0,0 +1,103 @@ +import React, { Component } from 'react'; +import { connect } from 'dva'; +import { Modal, Form,Input } from 'antd'; + +@connect(({ customer }) => ({ customer })) + class Modals extends Component { + constructor (props) { + super(props); + this.state = { + visible: false + } + } + + + + + render () { + const { getFieldDecorator } = this.props.form; + const handleOk = () => { + const { + form, + dispatch, + customerId + } = this.props; + console.log(this.props); + form.validateFields((err, values) => { + console.log(values); + if(!err) { + if (dispatch) { + dispatch({ + type: 'customer/fetchList', + payload: { + password: values.password, + customerId: customerId + } + }) + } + } + }) + this.setState({ + visible: false + }) + }; + + + + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + }; + + const handleSetPwd = () => { + this.setState({ + visible: true + }) + } + + const handleCancel = e => { + console.log(e); + this.setState({ + visible: false, + }); + }; + + + + + + + return ( +
+ 设置密码 + +
+ + {getFieldDecorator('password', { + rules: [ + { + required: true, + message: '密码不能为空', + } + ], + })()} + + +
+
+ ) + } +} + +export default Form.create()(Modals); \ No newline at end of file diff --git a/src/pages/customer/models/customer.js b/src/pages/customer/models/customer.js index 1244f416b173a065823c50dd99ad5728dd61eebe..381860b2ffd86960a2275523808f2933888d3aa3 100644 --- a/src/pages/customer/models/customer.js +++ b/src/pages/customer/models/customer.js @@ -7,8 +7,12 @@ import { getIdentity, findByCustomer, customerTypes, + SetPassword, + findCulumnAll, + updateCulumn } from '../services/customer'; import { message } from 'antd'; +import md5 from 'blueimp-md5'; const CustomerModele = { namespace: 'customer', @@ -23,13 +27,14 @@ const CustomerModele = { name: '', phone: '', programName: '', + ifShow: 0 }, }, editorData: null, roleList: [], identityList: [], pageNumber: 1, - customerTypeData: [], + customerTypeData: [] }, effects: { *fetch({ payload }, { call, put }) { @@ -38,10 +43,25 @@ const CustomerModele = { type: 'saveList', payload: { data: response.data, - pageNumber: payload.pageNumber, + pageNumber: payload.pageNumber }, }); }, + + *fetchList({ payload }, { call, put }) { + console.log(payload); + const formData = new FormData(); + formData.append('password', md5(payload.password)); + formData.append('customerId', payload.customerId) + const res = yield call(SetPassword, formData); + console.log(res); + if (res.success) { + message.success('修改成功') + } else { + message.error('修改失败') + } + }, + *addOrEditCustomer({ payload }, { call, put }) { if (payload.isEdit) { yield call(editCustomer, payload.data); @@ -58,6 +78,7 @@ const CustomerModele = { name: '', phone: '', programName: '', + ifShow: 0 }, }, }); @@ -110,9 +131,55 @@ const CustomerModele = { payload: response, }); }, + + // 查询所属栏目 + *fetchCulunm({ payload }, { call, put }) { + const response = yield call(findCulumnAll, payload); + console.log(response) + let flaglist=[] + for(let i=0;i state.customer.pageInfo); + yield put({ + type: 'fetch', + payload: pageInfo, + }); + if (res.success) { + message.success('设置成功'); + } else { + message.error(res.errorCode); + } + }, + + }, reducers: { + // 获取所属栏目 + getCulunmList(state, {payload}) { + const {data, flaglist} = payload; + return { + ...state, + culumnList: data, + flaglist:flaglist + } + }, + saveList(state, action) { return { ...state, @@ -175,6 +242,7 @@ const CustomerModele = { name: '', phone: '', programName: '', + ifShow: 0 }, }, }); diff --git a/src/pages/customer/services/customer.js b/src/pages/customer/services/customer.js index 6d5901feaeab922c5ca05cb01ab84cee4ddb343f..7cd988fd433237a2cc3c0940fbe5b6c0f35feceb 100644 --- a/src/pages/customer/services/customer.js +++ b/src/pages/customer/services/customer.js @@ -59,3 +59,28 @@ export async function customerTypes(param){ }); } +export async function SetPassword(params) { + return request(`/api/g/customer/update`, { + method: 'POST', + data: params, + }); +} + +/** + * 获取所属栏目 + */ +export async function findCulumnAll() { + return request(`/api/g/customer/find/update/program`, { + method: 'GET', + }); +} + +/** + * 编辑摄像所属栏目 + */ +export async function updateCulumn(params) { + return request(`/api/g/customer/add/update/program`, { + method: 'PUT', + data: params + }); +} \ No newline at end of file diff --git a/src/pages/home/Index.jsx b/src/pages/home/Index.jsx index 4e1ba5607cbb3cb834dad376e198d8976404ed49..e14c27f7cb7435e0aacb03c789d8cc73712879d4 100644 --- a/src/pages/home/Index.jsx +++ b/src/pages/home/Index.jsx @@ -33,15 +33,14 @@ export default class Index extends Component { haveInHandOrderNumber, haveInHandStudiosNumber, numberOfPeopleInBeijing, + notFinishOrderNumber, + notFinishStudiosNumber } } = this.props; - + console.log(this.props); const outOrderPercent = haveInHandOrderNumber / allOrderNumber * 100; //外拍单数量进度条 进行中外拍单数量 / 全部外拍单数量 const studioPercent = haveInHandStudiosNumber / allStudiosNumber * 100; // 演播室单进度条 const OutOrderPercent = allNumberOfOutTakeAbnormalOrders / allOrderNumber * 100; // 外拍异常单进度条 - const OutStudiosPercent = allNumberOfOutTakeAbnormalStudios / allStudiosNumber * 100; //演播室异常单进度条 - const destructionOrderCounts = allOrderNumber - haveInHandOrderNumber; //进行中的外拍单数量 外拍单总数量 - 已完成的外拍单数量 - const destructionStudiosCounts = allStudiosNumber - haveInHandStudiosNumber; //进行中的演播室单数量 演播室单总数量 - 已完成的演播室单数量 const myDate = new Date();//获取当前日期 const y = myDate.getFullYear();//年 const m = myDate.getMonth()+1; //月 @@ -61,7 +60,7 @@ export default class Index extends Component { destruction={'未完成 '} allCounts={allOrderNumber} counts={haveInHandOrderNumber} - destructionCounts={destructionOrderCounts} + destructionCounts={notFinishOrderNumber} unit={' 单'} single={' 单'} bgColor={'#1790eb'} @@ -80,7 +79,7 @@ export default class Index extends Component { destruction={'未完成 '} counts={haveInHandStudiosNumber} allCounts={allStudiosNumber} - destructionCounts={destructionStudiosCounts} + destructionCounts={notFinishStudiosNumber} unit={' 单'} single={' 单'} bgColor={'#3aceaf'} diff --git a/src/pages/home/components/GutterCard.jsx b/src/pages/home/components/GutterCard.jsx index 6cf89c5119772420f97bc6265c40d3daba225ea7..3aea170e293c3ed3ca2ec419b0e89891d849c3b0 100644 --- a/src/pages/home/components/GutterCard.jsx +++ b/src/pages/home/components/GutterCard.jsx @@ -42,6 +42,7 @@ export default class GutterCard extends Component { single, destructionCounts } = this.props; + console.log(this.props); return (
diff --git a/src/pages/home/components/OrderLineChart.jsx b/src/pages/home/components/OrderLineChart.jsx index 96d6176b39821a92cef77bae24ae1673140814c1..2c0c66dd3fbdbce6555782aa12bc35e8bf17ca38 100644 --- a/src/pages/home/components/OrderLineChart.jsx +++ b/src/pages/home/components/OrderLineChart.jsx @@ -20,16 +20,17 @@ class OrderLineChart extends Component { dateArray.push(dateTemp); myDate.setDate(myDate.getDate() + flag); } + const pageToPush = (address) => router.push(address); var series=[] for(var i = 0;i router.push(address); @connect(({ home }) => ({ home })) - export default class ShotArrange extends Component { + class ShotArrange extends Component { render () { const { title, subtitle ,count, outShot, travel, studio,free,home:{numberOfPeopleInBeijing,numberOfPeopleOnBusinessTrip,numberOfStudios,numberFree}} = this.props; console.log(this.props) @@ -31,6 +30,8 @@ const pageToPush = (address) => router.push(address); y: numberFree, }, ]; + const pageToPush = (address) => router.push(address); + return (
{title} @@ -80,4 +81,6 @@ const pageToPush = (address) => router.push(address);
) } -} \ No newline at end of file +} + +export default ShotArrange; \ No newline at end of file diff --git a/src/pages/home/models/home.js b/src/pages/home/models/home.js index 8a379ed10296afb79bcb80291957a8d1c428ba2c..642d04d71d2a524157152d1e58dd88fb8f6cb5f6 100644 --- a/src/pages/home/models/home.js +++ b/src/pages/home/models/home.js @@ -24,7 +24,9 @@ const HomeModele = { workingHours: 0 //工时 }, cameraGroupNameList: [], //近期订单执行详情--摄像组 - orderList: [] //近期订单执行详情--对应详情数据 + orderList: [],//近期订单执行详情--对应详情数据 + notFinishOrderNumber: 0, //未完成外拍单数量 + notFinishStudiosNumber: 0, //未完成演播室单数量 }, @@ -82,6 +84,8 @@ const HomeModele = { numberFree: data.numberFree, //空闲人数 cameraGroupNameList: data.cameraGroupNameList, //近期订单执行详情--摄像组 orderList: data.orderList, //近期订单执行详情--对应详情数据 + notFinishOrderNumber: data.notFinishOrderNumber,//未完成外拍单数量 + notFinishStudiosNumber: data.notFinishStudiosNumber,//未完成演播室单数量 }; }, }, diff --git a/src/pages/order-statistics/components/OrderNew.jsx b/src/pages/order-statistics/components/OrderNew.jsx index 64aaa26310c6a7a1a51a9cd9c3338f075e0c96d2..f5b523de61100392e751756cc54387ad19ae135a 100644 --- a/src/pages/order-statistics/components/OrderNew.jsx +++ b/src/pages/order-statistics/components/OrderNew.jsx @@ -91,7 +91,6 @@ export default class OrderDetail extends Component { series.push({ name: cameraGroupNameList[i], type: 'line', - stack: '总量', data: orderList[i], }); } diff --git a/src/pages/organization/company/Edit.jsx b/src/pages/organization/company/Edit.jsx index 274978cbb8b47a39c7cc735541b67454eed33c43..ed2f840a828c4871a086c562374997b28b88252f 100644 --- a/src/pages/organization/company/Edit.jsx +++ b/src/pages/organization/company/Edit.jsx @@ -4,84 +4,108 @@ import { Descriptions, Divider, Row, Button, Modal, Col, Form, Input } from 'ant @connect(({ company }) => ({ company })) @Form.create({ - mapPropsToFields({ company }) { - console.log('mapPropsToFields:', company) - if (company.type == "add") { } - if (company.type == "edit") { - return { - toCompanyName: Form.createFormField({ - value: company.selectTable.toCompanyName - }), - toCompanyNumber: Form.createFormField({ - value: company.selectTable.toCompanyNumber - }), - } - } - }, -}) -export default class Edit extends React.Component { - constructor(props) { - super(props); - this.state = { - isShow: false, - content: '', - }; - } - handleSave = () => { - const { dispatch, form, company } = this.props; - console.log('selectTable:', company.selectTable) - form.validateFields((error, row) => { - if (error) { - return; - } - if (company.type == "add") { - dispatch({ type: 'company/upAddCompany', params: { ...row, parentId: company.selectedKeys[0] == 'all' ? undefined : company.selectedKeys[0] } }) - } - if (company.type == "edit") { - dispatch({ type: 'company/upEditCompany', params: { ...row, toCompanyId: company.selectTable.toCompanyId} }) - } - }) + mapPropsToFields({ company }) { + console.log('mapPropsToFields:', company); + if (company.type == 'add') { } - render() { - const { form, company, dispatch } = this.props; - const { getFieldDecorator } = form - return ( - dispatch({ type: 'company/setStateValue', params: { visible: false } })} - > -
- - {getFieldDecorator('toCompanyName', { - initialValue: "", - rules: [ - { - required: true, - message: '请输入名称', - }, - ], - })( - - )} - - - {getFieldDecorator('toCompanyNumber', { - initialValue: "", - rules: [ - { - required: true, - message: '请输编号', - }, - ], - })( - - )} - - -
- ); + if (company.type == 'edit') { + return { + toCompanyName: Form.createFormField({ + value: company.selectTable.toCompanyName, + }), + toCompanyNumber: Form.createFormField({ + value: company.selectTable.toCompanyNumber, + }), + toCompanyMoney: Form.createFormField({ + value: company.selectTable.toCompanyMoney, + }), + }; } + }, +}) +export default class Edit extends React.Component { + constructor(props) { + super(props); + this.state = { + isShow: false, + content: '', + }; + } + handleSave = () => { + const { dispatch, form, company } = this.props; + console.log('selectTable:', company.selectTable); + form.validateFields((error, row) => { + if (error) { + return; + } + if (company.type == 'add') { + dispatch({ + type: 'company/upAddCompany', + params: { + ...row, + parentId: company.selectedKeys[0] == 'all' ? undefined : company.selectedKeys[0], + }, + }); + } + if (company.type == 'edit') { + dispatch({ + type: 'company/upEditCompany', + params: { ...row, toCompanyId: company.selectTable.toCompanyId }, + }); + } + }); + }; + render() { + const { form, company, dispatch } = this.props; + const { getFieldDecorator } = form; + return ( + dispatch({ type: 'company/setStateValue', params: { visible: false } })} + > +
+ + {getFieldDecorator('toCompanyName', { + initialValue: '', + rules: [ + { + required: true, + message: '请输入名称', + }, + ], + })()} + + + {getFieldDecorator('toCompanyNumber', { + initialValue: '', + rules: [ + { + required: true, + message: '请输编号', + }, + ], + })()} + + {company.selectTree.level != 0? ( + '' + ) : ( + + {getFieldDecorator('toCompanyMoney', { + initialValue: '', + rules: [ + { + required: true, + message: '请输入金额', + }, + ], + })()} + + )} + +
+ ); + } } diff --git a/src/pages/statistics-order/Index.jsx b/src/pages/statistics-order/Index.jsx index d6b83ef081108fca6ced0a05516734eb3f5a0083..778fa22fb9c0800301e80e9b5c77211084d48b36 100644 --- a/src/pages/statistics-order/Index.jsx +++ b/src/pages/statistics-order/Index.jsx @@ -1,6 +1,6 @@ import React from 'react'; import { connect } from 'dva'; -import { Input, Radio, Select, Button, message, DatePicker } from 'antd'; +import { Input, Radio, Select, Button, message, DatePicker, Row, Col, Icon } from 'antd'; import moment from 'moment'; import Table from './Table'; @@ -15,12 +15,13 @@ class StatisticsOrder extends React.Component { tabActiveKey: 'list', isNew: true, reason: '', + visible: true, }; } - - componentWillMount=()=>{ + + componentWillMount = () => { this.handleReset(); - } + }; handleSearch = () => { const { @@ -28,7 +29,7 @@ class StatisticsOrder extends React.Component { statisticsOrder: { pageInfo }, } = this.props; console.log(this.props); - this.props.statisticsOrder.pageInfo.pageNumber = 1 + this.props.statisticsOrder.pageInfo.pageNumber = 1; dispatch({ type: 'statisticsOrder/fetchList', payload: pageInfo, @@ -42,7 +43,7 @@ class StatisticsOrder extends React.Component { type: 'statisticsOrder/getCameraGroup', payload: { cameraGroupName: '', - value: '' + value: '', }, }); dispatch({ @@ -57,7 +58,7 @@ class StatisticsOrder extends React.Component { example: { startTime: '', overTime: '', - blurry: '', + customer: '', customerName: '', orderNo: '', programName: '', @@ -205,77 +206,209 @@ class StatisticsOrder extends React.Component { const { statisticsOrder: { pageInfo, cameraGroup }, } = this.props; - const { tabActiveKey, isNew, reason } = this.state; + const { tabActiveKey, isNew, reason, visible } = this.state; return (
-
-
- 搜索: - this.handleSearchKey(e.target.value, 'blurry')} - placeholder="请输入订单号|摄像姓名" - style={{ width: 250 }} - value={pageInfo.example.blurry} - /> - 开始时间: - - 结束时间: - - {/* 订单时间: - */} - 分组: - +
+ {visible ? ( +
+ +
+ 订单号: + this.handleSearchKey(e.target.value, 'orderNo')} + placeholder="请输入订单号" + style={{ width: 180 }} + value={pageInfo.example.orderNo} + /> + + + 摄像名称: + this.handleSearchKey(e.target.value, 'cameraName')} + placeholder="请输入摄像名称" + style={{ width: 180 }} + value={pageInfo.example.cameraName} + /> + + + 栏目名称: + this.handleSearchKey(e.target.value, 'program')} + placeholder="请输入栏目名称" + style={{ width: 180 }} + value={pageInfo.example.program} + /> + + + 编导: + this.handleSearchKey(e.target.value, 'customer')} + placeholder="请输入编导" + style={{ width: 180 }} + value={pageInfo.example.customer} + /> + + + 分组: + + + + + + + + { + this.setState({ visible: !visible }); + }} + > + 展开 + + + + + + ) : ( +
+ +
+ 订单号: + this.handleSearchKey(e.target.value, 'blurry')} + placeholder="请输入订单号" + style={{ width: 180 }} + value={pageInfo.example.blurry} + /> + + + 摄像名称: + this.handleSearchKey(e.target.value, 'blurry')} + placeholder="请输入摄像名称" + style={{ width: 180 }} + value={pageInfo.example.blurry} + /> + + + 栏目名称: + this.handleSearchKey(e.target.value, 'blurry')} + placeholder="请输入栏目名称" + style={{ width: 180 }} + value={pageInfo.example.blurry} + /> + + + 编导: + this.handleSearchKey(e.target.value, 'blurry')} + placeholder="请输入编导" + style={{ width: 180 }} + value={pageInfo.example.blurry} + /> + + + 分组: + + + + + + + + + + 开始时间: + + 结束时间: + + {/* 订单时间: + */} - - - + {/* + */} + { + this.setState({ visible: !visible }); + }} + > + 收起 + + + + + + )}
{detail.reason} + + + + + {detail.cameraNameLists} + diff --git a/src/pages/system/Edit.jsx b/src/pages/system/Edit.jsx new file mode 100644 index 0000000000000000000000000000000000000000..688f7b5272a64fb5b8d06dd31583e8846d953e53 --- /dev/null +++ b/src/pages/system/Edit.jsx @@ -0,0 +1,152 @@ +import React from 'react'; +import { connect } from 'dva'; +import { Form, Descriptions, Divider,Radio,Input ,Row ,Button} from 'antd'; + +class Edit extends React.Component { + constructor(props) { + super(props); + this.state = {}; + } + + handleSave = () => { + const { + dispatch, + system: { orderMessage }, + form, + } = this.props; + console.log(this.props); + form.validateFields((error, row) => { + if (error) { + return; + } + dispatch({ + type: 'system/restoreOrder', + payload: { + ...row, + caSystemId: orderMessage.caSystemId, + content: orderMessage.content + } + }) + }) + } + + handleCancle = () => { + const { + dispatch, + system: { pageInfo }, + } = this.props; + dispatch({ + type: 'system/fetchList', + payload: pageInfo, + }); + }; + render() { + const { + form, + system: { orderMessage }, + } = this.props; + console.log(this.props); + const { getFieldDecorator, getFieldValue } = form; + + const status = [ + '已预约', + '待完成', + '已开始', + '已完成', + '已评价', + '已取消', + '已锁定', + '开始执行', + '确认开始', + '执行完毕', + '用户已评', + '摄像已评', + '双方已评', + '摄像师提交素材', + '编导确认提交材料', + '订单结束', + ]; + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 4 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + }; + + + return ( +
+
+ {`《${orderMessage.programName}》`} + {`订单状态:${ + status[Number(orderMessage.status)] + }`} +
+ + {orderMessage.orderNo} + {orderMessage.cameraGroupName} + {orderMessage.createTime} + {orderMessage.detailedAddress} + + {orderMessage.name} + + + {orderMessage.beginTime} + + + + +
+ + {getFieldDecorator('state', { + initialValue: true, + rules: [ + { + required: true, + message: '请选择异常处理', + }, + ], + })( + + 归为正常 + 归为异常 + , + )} + + + {getFieldDecorator('content', { + initialValue: '', + rules: [ + { + required: true, + message: '请填写处理意见', + }, + ], + })()} + + + + + + +
+ ); + } +} + +const EditForm = Form.create()(Edit); +export default connect(props => props)(EditForm); diff --git a/src/pages/system/Index.jsx b/src/pages/system/Index.jsx new file mode 100644 index 0000000000000000000000000000000000000000..c952d7d28d3ef4305fb10eb280d17e3ef4ed21ef --- /dev/null +++ b/src/pages/system/Index.jsx @@ -0,0 +1,268 @@ +import React, { Component } from 'react'; +import { + Input, + Radio, + Select, + Button, + message, + DatePicker, + Row, + Col, + Table, + Divider, + Popconfirm, +} from 'antd'; +import { connect } from 'dva'; +import Edit from './Edit'; + +@connect(({ system }) => ({ system })) +class Index extends Component { + constructor(props) { + super(props); + this.state = { + visibles: false, + reason: '', + }; + } + + render() { + const { + dispatch, + system: { list, pageInfo, totalElements ,tabActiveKey}, + } = this.props; + console.log(this.props); + + // 表格 + const columns = [ + { + title: '订单号', + dataIndex: 'orderNo', + key: 'orderNo', + }, + { + title: '摄像', + dataIndex: 'cameraName', + key: 'cameraName', + }, + { + title: '通知内容', + dataIndex: 'content', + key: 'content', + }, + { + title: '处理意见', + dataIndex: 'opinion', + key: 'opinion', + }, + { + title: '状态', + dataIndex: 'state', + key: 'state', + render: value => {['', '处理中', '已处理'][Number(value)]}, + }, + { + title: '通知时间', + dataIndex: 'createTime', + key: 'createTime', + }, + { + title: '操作', + dataIndex: 'set', + key: 'set', + render: (text, record, index) => ( +
+ handleOperation('dispose',record)}>处理 + + handleOperation('delete', record)} + overlayStyle={{ width: '200px' }} + > + 删除 + +
+ ), + }, + ]; + + const handleOperation = (type, record) => { + switch (type) { + case 'dispose': + dispatch({ + type: 'system/disposeOrder', + payload: record.caSystemId, + }); + break; + case 'delete': + dispatch({ + type: 'system/deleteAbnormalOrder', + payload: record.caSystemId, + }); + break; + } + }; + + // 分页 刷新页面 获取数据 + const handlePage = page => { + pageInfo.pageNumber = page; + dispatch({ + type: 'system/fetchList', + payload: pageInfo, + }); + }; + + // 分页 + const pagination = { + current: pageInfo.pageNumber, + pageSize: pageInfo.pageSize, + total: totalElements, + onChange: handlePage, + size: 'middle', + showTotal: totalCount => `共 ${totalCount} 条数据`, + }; + + // 搜索 + const handleSearchKey = (value, key) => { + const { + dispatch, + system: { pageInfo }, + } = this.props; + dispatch({ + type: 'system/updatePageInfo', + payload: { pageInfo, value, key }, + }); + }; + + const handleInput = e => { + this.setState({ reason: e.target.value }); + }; + + // 开始结束时间 + const onStartChange = (date, dateStr) => handleSearchKey(dateStr, 'startTime'); + const onEndChange = (date, dateStr) => handleSearchKey(dateStr, 'overTime'); + + // 查询 + const handleSearch = () => { + const { + dispatch, + system: { pageInfo }, + } = this.props; + console.log(this.props); + this.props.system.pageInfo.pageNumber = 1; + dispatch({ + type: 'system/fetchList', + payload: pageInfo, + }); + }; + + // 重置 + const handleReset = () => { + const { dispatch } = this.props; + dispatch({ + type: 'system/resetState', + }); + + dispatch({ + type: 'system/fetchList', + payload: { + pageNumber: 1, + pageSize: 10, + example: { + startTime: '', + overTime: '', + cameraName: '', + content: '', + orderNo: '', + state: null, + }, + }, + }); + }; + + return ( +
+ {tabActiveKey == 'list' ? ( + +
+ 订单号: + handleSearchKey(e.target.value, 'orderNo')} + placeholder="请输入订单号" + style={{ width: 180 }} + value={pageInfo.example.orderNo} + /> + + + 摄像名称: + handleSearchKey(e.target.value, 'cameraName')} + placeholder="请输入摄像名称" + style={{ width: 180 }} + value={pageInfo.example.cameraName} + /> + + + 状态: + + + + + 开始时间: + + 结束时间: + + + + + + + + ) : null} + + {tabActiveKey == 'list' ? (
{ + if (idx % 2 === 1) return 'bgRow'; + }} + bordered + />) : ( + + )} + + + ); + } +} + +export default Index; diff --git a/src/pages/system/models/System.js b/src/pages/system/models/System.js new file mode 100644 index 0000000000000000000000000000000000000000..8750a32977fca7b623404c026776a50d711775d2 --- /dev/null +++ b/src/pages/system/models/System.js @@ -0,0 +1,178 @@ +import { message } from 'antd'; +import { list ,disposeOrder,delectException,restoreOrder} from '../services/System'; +import moment from 'moment'; + +const SystemModel = { + namespace: 'system', + state: { + list: [], + orderMessage: {}, + tabActiveKey: 'list', + totalElements: 0, + pageInfo: { + pageNumber: 1, + pageSize: 10, + example: { + startTime: String( + moment() + .locale('zh-cn') + .subtract(20, 'days') + .format('YYYY-MM-DD HH:mm:ss'), + ), + overTime: String( + moment() + .locale('zh-cn') + .format('YYYY-MM-DD HH:mm:ss'), + ), + cameraName: '', + content: '', + orderNo: '', + state: null, + }, + }, + }, + + effects: { + // 获取table + *fetchList({ payload }, { call, put }) { + const response = yield call(list, payload); + console.log(response); + yield put({ + type: 'getList', + payload: { + data: response.data, + pageNumber: payload.pageNumber, + }, + }); + }, + + // 处理 + *disposeOrder({ payload }, { call, put }) { + const response = yield call(disposeOrder, payload); + yield put({ + type: 'getOrderMessage', + payload: response.data, + }); + }, + + // 删除 + *deleteAbnormalOrder({ payload }, { call, put, select }) { + const response = yield call(delectException, payload); + const pageInfo = yield select(state => state.system.pageInfo); + yield put({ + type: 'fetchList', + payload: pageInfo, + }); + if (response.success) { + message.success('删除成功'); + } + }, + + // 恢复预约单 + *restoreOrder({ payload }, { call, put, select }) { + const response = yield call(restoreOrder, payload); + const pageInfo = yield select(state => state.system.pageInfo); + yield put({ + type: 'fetchList', + payload: pageInfo, + }); + if (response.success) { + message.success('恢复预约单成功'); + } + }, + }, + + reducers: { + getList(state, { payload }) { + const { data } = payload; + return { + ...state, + list: data.content, + tabActiveKey: 'list' + }; + }, + + // 处理 + getOrderMessage(state, { payload }) { + return { + ...state, + orderMessage: payload, + tabActiveKey: 'dispose', + }; + }, + + updatePageInfo(state, { payload }) { + const { pageInfo } = payload; + pageInfo.example[payload.key] = payload.value; + return { ...state, pageInfo }; + }, + + resetState(state) { + return { + ...state, + list: [], + orderMessage: {}, + tabActiveKey: 'list', + totalElements: 0, + pageInfo: { + pageNumber: 1, + pageSize: 10, + example: { + startTime: String( + moment() + .locale('zh-cn') + .subtract(20, 'days') + .format('YYYY-MM-DD HH:mm:ss'), + ), + overTime: String( + moment() + .locale('zh-cn') + .format('YYYY-MM-DD HH:mm:ss'), + ), + cameraName: '', + content: '', + orderNo: '', + state: null, + }, + }, + } + } + }, + + subscriptions: { + setup({ dispatch, history }) { + return history.listen(({ pathname }) => { + if (pathname === '/o/system-inform') { + dispatch({ + type: 'fetchList', + payload: { + pageNumber: 1, + pageSize: 10, + example: { + startTime: String( + moment() + .locale('zh-cn') + .subtract(20, 'days') + .format('YYYY-MM-DD HH:mm:ss'), + ), + overTime: String( + moment() + .locale('zh-cn') + .format('YYYY-MM-DD HH:mm:ss'), + ), + cameraName: '', + content: '', + orderNo: '', + state: null, + }, + }, + }); + } + }); + }, + }, + + +}; + +export default SystemModel; \ No newline at end of file diff --git a/src/pages/system/services/System.js b/src/pages/system/services/System.js new file mode 100644 index 0000000000000000000000000000000000000000..d55ec8c50566c473faa8052aa94fc63b956ff4d4 --- /dev/null +++ b/src/pages/system/services/System.js @@ -0,0 +1,46 @@ +import { request } from '@/utils/request'; + +/** + * 获取列表table + * @param {*} params + */ +export async function list(params) { + return request(`/api/o/system-inform/list`, { + method: 'POST', + data: params, + }); +} + +/** + * 处理 + * @param {*} params + */ +export async function disposeOrder(params) { + return request(`/api/o/system-inform/${params}`, { + method: 'GET', + data: params, + }); +} + +/** + * 删除 + * @param {*} params + */ +export async function delectException(params) { + return request(`/api/o/system-inform/${params}`, { + method: 'DELETE', + data: params, + }); +} + +/** + * 恢复预约单 + * @param {*} params + */ +export async function restoreOrder(params) { + return request(`/api/o/system-inform`, { + method: 'PUT', + data: params, + }); +} + diff --git a/src/services/user.js b/src/services/user.js index ce796eb617139d84de54fda37cfde0ce5cfc68ca..8325aecdce602f2ea706226c7a563cb8abcc2725 100644 --- a/src/services/user.js +++ b/src/services/user.js @@ -71,3 +71,15 @@ export async function freezeAccount(params) { method: 'PUT', }); } + + +/** + * 获取首页数据 + * @param {*} params + */ +export async function getData(params) { + return request(`/api/u/users/get-home-page-date`, { + method: 'GET', + data: params + }) +} \ No newline at end of file