yangsen
3 years ago
15 changed files with 21648 additions and 4113 deletions
@ -1,239 +1,236 @@ |
|||||
'use strict'; |
'use strict'; |
||||
|
|
||||
async function get (ctx) { |
async function get (ctx) { |
||||
try { |
try { |
||||
const models = ctx.fs.dc.models; |
const models = ctx.fs.dc.models; |
||||
const { type } = ctx.request.body; |
const { type } = ctx.request.body; |
||||
const { name } = ctx.query; |
const { name } = ctx.query; |
||||
|
|
||||
let findOption = { |
let findOption = { |
||||
where: { |
where: { |
||||
type |
type |
||||
}, |
} |
||||
order: [['id', 'DESC']] |
} |
||||
} |
if (name) { |
||||
if (name) { |
findOption.where.name = { |
||||
findOption.where.name = { |
$like: `%${name}%` |
||||
$like: `%${name}%` |
} |
||||
} |
} |
||||
} |
const vehicleRes = await models.Statistic.findAll(findOption) |
||||
const vehicleRes = await models.Statistic.findAll(findOption) |
|
||||
|
ctx.status = 200; |
||||
ctx.status = 200; |
ctx.body = vehicleRes |
||||
ctx.body = vehicleRes |
} catch (error) { |
||||
} catch (error) { |
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
ctx.status = 400; |
||||
ctx.status = 400; |
ctx.body = { |
||||
ctx.body = { |
message: typeof error == 'string' ? error : undefined |
||||
message: typeof error == 'string' ? error : undefined |
} |
||||
} |
} |
||||
} |
|
||||
} |
} |
||||
|
|
||||
async function edit (ctx) { |
async function edit (ctx) { |
||||
try { |
try { |
||||
const models = ctx.fs.dc.models; |
const models = ctx.fs.dc.models; |
||||
const { id, name, count, type } = ctx.request.body; |
const { id, name, count, type } = ctx.request.body; |
||||
|
|
||||
if (!id) { |
if (!id) { |
||||
await models.Statistic.create({ |
await models.Statistic.create({ |
||||
name, count, type: type |
name, count, type: type |
||||
}) |
}) |
||||
} else { |
} else { |
||||
await models.Statistic.update({ |
await models.Statistic.update({ |
||||
name, count, type: type |
name, count, type: type |
||||
}, { |
}, { |
||||
where: { |
where: { |
||||
id: id |
id: id |
||||
} |
} |
||||
}) |
}) |
||||
} |
} |
||||
|
|
||||
ctx.status = 204 |
ctx.status = 204 |
||||
} catch (error) { |
} catch (error) { |
||||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
ctx.status = 400; |
ctx.status = 400; |
||||
ctx.body = { |
ctx.body = { |
||||
message: typeof error == 'string' ? error : undefined |
message: typeof error == 'string' ? error : undefined |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
async function del (ctx) { |
async function del (ctx) { |
||||
try { |
try { |
||||
const models = ctx.fs.dc.models; |
const models = ctx.fs.dc.models; |
||||
const { id } = ctx.params; |
const { id } = ctx.params; |
||||
|
|
||||
await models.Statistic.destroy({ |
await models.Statistic.destroy({ |
||||
where: { |
where: { |
||||
id: id |
id: id |
||||
} |
} |
||||
}) |
}) |
||||
|
|
||||
ctx.status = 204 |
ctx.status = 204 |
||||
} catch (error) { |
} catch (error) { |
||||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
ctx.status = 400; |
ctx.status = 400; |
||||
ctx.body = { |
ctx.body = { |
||||
message: typeof error == 'string' ? error : undefined |
message: typeof error == 'string' ? error : undefined |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
async function specificGet (ctx) { |
async function specificGet (ctx) { |
||||
try { |
try { |
||||
const models = ctx.fs.dc.models; |
const models = ctx.fs.dc.models; |
||||
const { type } = ctx.query; |
const { type } = ctx.query; |
||||
const { nameOfBusinessOwner } = ctx.query; |
const { nameOfBusinessOwner } = ctx.query; |
||||
|
|
||||
let findOption = { |
let findOption = { |
||||
where: { |
where: { |
||||
type |
type |
||||
}, |
} |
||||
order: [['id', 'DESC']] |
} |
||||
} |
if (nameOfBusinessOwner) { |
||||
if (nameOfBusinessOwner) { |
findOption.where.nameOfBusinessOwner = { |
||||
findOption.where.nameOfBusinessOwner = { |
$like: `%${nameOfBusinessOwner}%` |
||||
$like: `%${nameOfBusinessOwner}%` |
} |
||||
} |
} |
||||
} |
|
||||
|
const vehicleRes = await models.MunicipalVehicle.findAll(findOption) |
||||
const vehicleRes = await models.MunicipalVehicle.findAll(findOption) |
|
||||
|
ctx.status = 200; |
||||
ctx.status = 200; |
ctx.body = vehicleRes |
||||
ctx.body = vehicleRes |
} catch (error) { |
||||
} catch (error) { |
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
ctx.status = 400; |
||||
ctx.status = 400; |
ctx.body = { |
||||
ctx.body = { |
message: typeof error == 'string' ? error : undefined |
||||
message: typeof error == 'string' ? error : undefined |
} |
||||
} |
} |
||||
} |
|
||||
} |
} |
||||
|
|
||||
async function specificEdit (ctx) { |
async function specificEdit (ctx) { |
||||
try { |
try { |
||||
const models = ctx.fs.dc.models; |
const models = ctx.fs.dc.models; |
||||
const data = ctx.request.body; |
const data = ctx.request.body; |
||||
|
|
||||
if (!data.vehicleId) { |
if (!data.vehicleId) { |
||||
const vehicleRes = await models.MunicipalVehicle.create(data) |
const vehicleRes = await models.Vehicle.create(data) |
||||
} else { |
} else { |
||||
const vehicleRes = await models.MunicipalVehicle.update(data, { |
const vehicleRes = await models.Vehicle.update(data, { |
||||
where: { |
where: { |
||||
id: data.vehicleId |
id: data.vehicleId |
||||
} |
} |
||||
}) |
}) |
||||
} |
} |
||||
|
|
||||
ctx.status = 204 |
ctx.status = 204 |
||||
} catch (error) { |
} catch (error) { |
||||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
ctx.status = 400; |
ctx.status = 400; |
||||
ctx.body = { |
ctx.body = { |
||||
message: typeof error == 'string' ? error : undefined |
message: typeof error == 'string' ? error : undefined |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
async function specificDel (ctx) { |
async function specificDel (ctx) { |
||||
try { |
try { |
||||
const models = ctx.fs.dc.models; |
const models = ctx.fs.dc.models; |
||||
const { vehicleId } = ctx.params; |
const { vehicleId } = ctx.params; |
||||
|
|
||||
const vehicleRes = await models.MunicipalVehicle.destroy({ |
const vehicleRes = await models.Vehicle.destroy({ |
||||
where: { |
where: { |
||||
id: vehicleId |
id: vehicleId |
||||
} |
} |
||||
}) |
}) |
||||
|
|
||||
ctx.status = 204 |
ctx.status = 204 |
||||
} catch (error) { |
} catch (error) { |
||||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
ctx.status = 400; |
ctx.status = 400; |
||||
ctx.body = { |
ctx.body = { |
||||
message: typeof error == 'string' ? error : undefined |
message: typeof error == 'string' ? error : undefined |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
async function businessGet (ctx) { |
async function businessGet (ctx) { |
||||
try { |
try { |
||||
const models = ctx.fs.dc.models; |
const models = ctx.fs.dc.models; |
||||
const { nameOfBusinessOwner } = ctx.query; |
const { nameOfBusinessOwner } = ctx.query; |
||||
|
|
||||
let findOption = { |
let findOption = { |
||||
where: { |
where: { |
||||
|
|
||||
}, |
} |
||||
order: [['id', 'DESC']] |
} |
||||
} |
if (nameOfBusinessOwner) { |
||||
if (nameOfBusinessOwner) { |
findOption.where.nameOfBusinessOwner = { |
||||
findOption.where.nameOfBusinessOwner = { |
$like: `%${nameOfBusinessOwner}%` |
||||
$like: `%${nameOfBusinessOwner}%` |
} |
||||
} |
} |
||||
} |
const businessRes = await models.MunicipalBusiness.findAll(findOption) |
||||
const businessRes = await models.MunicipalBusiness.findAll(findOption) |
|
||||
|
ctx.status = 200; |
||||
ctx.status = 200; |
ctx.body = businessRes |
||||
ctx.body = businessRes |
} catch (error) { |
||||
} catch (error) { |
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
ctx.status = 400; |
||||
ctx.status = 400; |
ctx.body = { |
||||
ctx.body = { |
message: typeof error == 'string' ? error : undefined |
||||
message: typeof error == 'string' ? error : undefined |
} |
||||
} |
} |
||||
} |
|
||||
} |
} |
||||
|
|
||||
async function businessEdit (ctx) { |
async function businessEdit (ctx) { |
||||
try { |
try { |
||||
const models = ctx.fs.dc.models; |
const models = ctx.fs.dc.models; |
||||
const data = ctx.request.body; |
const data = ctx.request.body; |
||||
|
|
||||
if (!data.businessId) { |
if (!data.businessId) { |
||||
await models.MunicipalBusiness.create(data) |
await models.MunicipalBusiness.create(data) |
||||
} else { |
} else { |
||||
await models.MunicipalBusiness.update(data, { |
await models.MunicipalBusiness.update(data, { |
||||
where: { |
where: { |
||||
id: data.businessId |
id: data.businessId |
||||
} |
} |
||||
}) |
}) |
||||
} |
} |
||||
|
|
||||
ctx.status = 204 |
ctx.status = 204 |
||||
} catch (error) { |
} catch (error) { |
||||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
ctx.status = 400; |
ctx.status = 400; |
||||
ctx.body = { |
ctx.body = { |
||||
message: typeof error == 'string' ? error : undefined |
message: typeof error == 'string' ? error : undefined |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
async function businessDel (ctx) { |
async function businessDel (ctx) { |
||||
try { |
try { |
||||
const models = ctx.fs.dc.models; |
const models = ctx.fs.dc.models; |
||||
const { businessId } = ctx.params; |
const { businessId } = ctx.params; |
||||
|
|
||||
await models.MunicipalBusiness.destroy({ |
await models.Vehicle.MunicipalBusiness({ |
||||
where: { |
where: { |
||||
id: businessId |
id: businessId |
||||
} |
} |
||||
}) |
}) |
||||
|
|
||||
ctx.status = 204 |
ctx.status = 204 |
||||
} catch (error) { |
} catch (error) { |
||||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
ctx.status = 400; |
ctx.status = 400; |
||||
ctx.body = { |
ctx.body = { |
||||
message: typeof error == 'string' ? error : undefined |
message: typeof error == 'string' ? error : undefined |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
module.exports = { |
module.exports = { |
||||
get, edit, del, |
get, edit, del, |
||||
specificGet, specificEdit, specificDel, |
specificGet, specificEdit, specificDel, |
||||
businessGet, businessEdit, businessDel |
businessGet, businessEdit, businessDel |
||||
}; |
}; |
@ -0,0 +1,215 @@ |
|||||
|
import React, { useState, useEffect } from 'react'; |
||||
|
import { connect } from 'react-redux'; |
||||
|
import { Modal, Form, Button, Input } from 'antd'; |
||||
|
import Uploads from "../../../../components/Upload/index" |
||||
|
import { putAddPropagata } from '../../actions/infor'; |
||||
|
import { putEditPropagata } from '../../actions/infor'; |
||||
|
import { getPropagata } from '../../actions/infor'; |
||||
|
|
||||
|
|
||||
|
const VideoUpload = (props) => { |
||||
|
const [counts, setCounts] = useState()//shuju
|
||||
|
|
||||
|
//获取数据
|
||||
|
// useEffect(() => {
|
||||
|
// const vedio = dispatch(getPropagata()).then((res) => {
|
||||
|
// setCounts(res.payload.data)
|
||||
|
// console.log(res.payload.data)
|
||||
|
// })
|
||||
|
// }, [])
|
||||
|
|
||||
|
const { dispatch, record } = props |
||||
|
// console.log(record);
|
||||
|
const [success, setSuccess] = useState() //状态
|
||||
|
const [form] = Form.useForm(); |
||||
|
|
||||
|
//弹窗
|
||||
|
const [isModalVisible, setIsModalVisible] = useState(false); |
||||
|
// const [video1, videoAddress] = useState()
|
||||
|
const showModal = () => { |
||||
|
setIsModalVisible(true); |
||||
|
}; |
||||
|
|
||||
|
// const idArr = record.map((item) => { item.id })
|
||||
|
// console.log(idArr);
|
||||
|
|
||||
|
//新增
|
||||
|
const handleOkAdd = () => { |
||||
|
form.validateFields().then((values) => { |
||||
|
const videoAddress = values.video.map((item) => { |
||||
|
return item.storageUrl.concat() |
||||
|
}) |
||||
|
const videoname = values.videoname |
||||
|
const data = { name: videoname, video: videoAddress } |
||||
|
dispatch(putAddPropagata(data)).then((res) => { |
||||
|
setSuccess(res.success) |
||||
|
console.log(data); |
||||
|
}) |
||||
|
setIsModalVisible(false); |
||||
|
} |
||||
|
); |
||||
|
}; |
||||
|
//编辑
|
||||
|
const handleOkEdit = (record) => { |
||||
|
console.log(record); |
||||
|
console.log(record.id); |
||||
|
form.validateFields().then((values) => { |
||||
|
console.log(values); |
||||
|
const videoAddress = values.video.map((item) => { |
||||
|
return item.storageUrl.concat() |
||||
|
}) |
||||
|
// const videoname = form.getFieldsValue('videoname')
|
||||
|
const videoname = values.username ? (!values.username) : record.name |
||||
|
const id = record.id |
||||
|
const video = record.video |
||||
|
|
||||
|
const data = { publicityId: id, name: videoname, video: videoAddress } |
||||
|
dispatch(putEditPropagata(data)).then((res) => { |
||||
|
setSuccess(res.success) |
||||
|
console.log(data); |
||||
|
}) |
||||
|
} |
||||
|
); |
||||
|
setIsModalVisible(false); |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
|
||||
|
const handleCancel = () => { |
||||
|
setIsModalVisible(false); |
||||
|
}; |
||||
|
|
||||
|
const onFinish = (values) => { |
||||
|
console.log('Success:', values); |
||||
|
}; |
||||
|
|
||||
|
const onFinishFailed = (errorInfo) => { |
||||
|
console.log('Failed:', errorInfo); |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
return ( |
||||
|
<div > |
||||
|
{ |
||||
|
props.type_ys ? <div><Button type='primary' onClick={showModal}>新增</Button> |
||||
|
<Modal visible={isModalVisible} onOk={handleOkAdd} onCancel={handleCancel}> |
||||
|
<Form |
||||
|
form={form} |
||||
|
name="basic" |
||||
|
labelCol={{ |
||||
|
span: 5, |
||||
|
}} |
||||
|
wrapperCol={{ |
||||
|
span: 16, |
||||
|
}} |
||||
|
initialValues={{ |
||||
|
remember: true, |
||||
|
}} |
||||
|
onFinish={onFinish} |
||||
|
onFinishFailed={onFinishFailed} |
||||
|
autoComplete="off" |
||||
|
> |
||||
|
<Form.Item |
||||
|
label="视频名称" |
||||
|
name="videoname" |
||||
|
rules={[ |
||||
|
{ |
||||
|
required: true, |
||||
|
message: '请输入视频名称!', |
||||
|
max: 50, |
||||
|
}, |
||||
|
]} |
||||
|
> |
||||
|
<Input |
||||
|
placeholder="请输入视频名称" /> |
||||
|
</Form.Item> |
||||
|
|
||||
|
<Form.Item |
||||
|
label="选择视频" |
||||
|
name="video" |
||||
|
> |
||||
|
<Uploads |
||||
|
maxFilesNum={10} |
||||
|
fileTypes={['mp4']} |
||||
|
maxFileSize={200} |
||||
|
/> |
||||
|
</Form.Item> |
||||
|
</Form> |
||||
|
</Modal> |
||||
|
</div> |
||||
|
: |
||||
|
<div><Button type='link' onClick={showModal} style={{ Position: "absolute", left: "-50px", top: "32px" }}>编辑</Button> |
||||
|
<Modal visible={isModalVisible} onOk={() => handleOkEdit(record)} onCancel={handleCancel}> |
||||
|
<Form |
||||
|
form={form} |
||||
|
name="basic" |
||||
|
labelCol={{ |
||||
|
span: 5, |
||||
|
}} |
||||
|
wrapperCol={{ |
||||
|
span: 16, |
||||
|
}} |
||||
|
// initialValues={{
|
||||
|
// remember: true,
|
||||
|
// }}
|
||||
|
initialValues={true} |
||||
|
onFinish={onFinish} |
||||
|
onFinishFailed={onFinishFailed} |
||||
|
autoComplete="off" |
||||
|
|
||||
|
> |
||||
|
<Form.Item |
||||
|
label="视频名称" |
||||
|
name="username" |
||||
|
rules={[ |
||||
|
{ |
||||
|
required: false, |
||||
|
message: '没有做出任何修改!', |
||||
|
max: 50, |
||||
|
}, |
||||
|
]} |
||||
|
> |
||||
|
<Input |
||||
|
placeholder="请输入视频名称" |
||||
|
defaultValue={record.name} |
||||
|
/> |
||||
|
|
||||
|
</Form.Item> |
||||
|
<Form.Item |
||||
|
label="选择视频" |
||||
|
name="video" |
||||
|
> |
||||
|
<Uploads |
||||
|
maxFilesNum={10} |
||||
|
fileTypes={['mp4']} |
||||
|
maxFileSize={200} |
||||
|
/> |
||||
|
</Form.Item> |
||||
|
</Form> |
||||
|
</Modal> |
||||
|
</div> |
||||
|
} |
||||
|
</div > |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
function mapStateToProps (state) { |
||||
|
const { depMessage } = state; |
||||
|
const pakData = (dep) => { |
||||
|
return dep.map((d) => { |
||||
|
return { |
||||
|
title: d.name, |
||||
|
value: d.id, |
||||
|
children: pakData(d.subordinate) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
let depData = pakData(depMessage.data || []) |
||||
|
return { |
||||
|
loading: depMessage.isRequesting, |
||||
|
depData, |
||||
|
}; |
||||
|
} |
||||
|
export default connect(mapStateToProps)(VideoUpload); |
File diff suppressed because it is too large
@ -1,169 +1,201 @@ |
|||||
import React, { useEffect, useState } from 'react'; |
import React, { useEffect, useState, useRef } from 'react'; |
||||
import { connect } from 'react-redux'; |
import { connect } from 'react-redux'; |
||||
import { Spin, Button, Popconfirm, Badge } from 'antd'; |
import { Spin, Button, Popconfirm, Switch } from 'antd'; |
||||
import ProTable from '@ant-design/pro-table'; |
import ProTable from '@ant-design/pro-table'; |
||||
import './protable.less' |
import './protable.less' |
||||
import moment from 'moment'; |
import VideoUpload from './infor/videoUpload'; |
||||
import { getReportStatistic } from "../actions/infor" |
import { getPropagata } from '../actions/infor'; |
||||
|
import { putEditPropagata } from '../actions/infor'; |
||||
|
import { delPropagata } from '../actions/infor'; |
||||
|
|
||||
const promotionalTable = (props) => { |
const promotionalTable = (props) => { |
||||
const { dispatch, user, depData, depMessage, depLoading } = props |
const { dispatch, } = props |
||||
const [rowSelected, setRowSelected] = useState([]) |
const [rowSelected, setRowSelected] = useState([]) |
||||
const [regionId, setRegionId] = useState()//区域id
|
const [counts, setCounts] = useState()//shuju
|
||||
const [placeType, setPlaceType] = useState()//场所
|
const [success, setSuccess] = useState() |
||||
const [day, setDay] = useState([moment('2022-03-01').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')])//日期
|
const [delet, setDelet] = useState() |
||||
const [sitename, setSitename] = useState()//场所名称
|
// console.log(record);
|
||||
const [counts, setCounts] = useState()//shuju
|
|
||||
|
|
||||
|
const ref = useRef() |
||||
const columns = |
useEffect(() => { ref.current.reload() }, [delet]) |
||||
[{ |
|
||||
title: '序号', |
|
||||
search: false, |
const onClickEnable = (record) => { |
||||
dataIndex: 'containers', |
console.log(record); |
||||
|
const id = record.id |
||||
fixed: 'left', |
const name = record.name |
||||
width: 120, |
const video = record.video |
||||
render: (dom, record) => { |
|
||||
return record.address |
const enable = true ? record.enable == false : true |
||||
}, |
const data = ({ publicityId: id, name: name, video: video, enable: enable }) |
||||
fieldProps: { |
console.log(data); |
||||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
dispatch(putEditPropagata(data)).then((res) => { |
||||
|
setSuccess(res.success) |
||||
|
console.log(data); |
||||
|
}) |
||||
|
} |
||||
|
// const ref = useRef()
|
||||
|
// useEffect(() => { ref.current.reload() }, [modalVisible, modalVisibleyilan, whichofits, delet])//刷新数据
|
||||
|
|
||||
|
|
||||
|
|
||||
|
const columns = |
||||
|
[{ |
||||
|
title: '序号', |
||||
|
search: false, |
||||
|
dataIndex: 'containers', |
||||
|
fixed: 'left', |
||||
|
width: 120, |
||||
|
render: (dom, record) => { |
||||
|
for (let i = 0; i < record.lenght; i += 1) { |
||||
|
return i |
||||
} |
} |
||||
}, |
} |
||||
{ |
}, |
||||
title: '视频名称', |
{ |
||||
dataIndex: 'placeName', |
title: '视频名称', |
||||
fixed: 'left', |
dataIndex: 'videoName', |
||||
width: 120, |
fixed: 'left', |
||||
options: 1, |
search: false, |
||||
backgroundColor: "#ffffff", |
width: 120, |
||||
fieldProps: { |
options: 1, |
||||
onChange: (value, cs) => { |
render: (dom, record) => { |
||||
setSitename(value.currentTarget.value) |
// console.log('record',record)
|
||||
}, |
return record.name |
||||
placeholder: '请输入视频名称进行搜索', |
} |
||||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
}, |
||||
}, |
{ |
||||
}, |
title: '是否展示', |
||||
|
dataIndex: 'shuffling', |
||||
{ |
valueType: 'shufflingRange', |
||||
title: '修改时间', |
search: false, |
||||
search: false, |
width: 120, |
||||
dataIndex: 'time2', |
fixed: 'right', |
||||
valueType: 'dateRange', |
render: (dom, record) => { |
||||
// align: 'right',
|
return <div > |
||||
width: 120, |
|
||||
render: (dom, record) => { |
<Switch checkedChildren="展示" unCheckedChildren="关闭" onClick={() => onClickEnable(record)} defaultChecked={true ? record.enable == true : false} /></div> |
||||
return record.address |
} |
||||
}, |
}, |
||||
fieldProps: { |
{ |
||||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
title: '操作', |
||||
} |
dataIndex: 'creatTime', |
||||
}, |
valueType: 'dateTimeRange', |
||||
{ |
hideInSearch: true, |
||||
key: "direction", |
width: 120, |
||||
hideInTable: true, |
fixed: 'right', |
||||
dataIndex: "direction", |
render: (dom, record) => { |
||||
order: 6, |
return <div style={{ position: 'relative', marginTop: '-30px' }}> |
||||
renderFormItem: (item, { type, defaultRender, ...rest }, form) => { |
<VideoUpload record={record} /> |
||||
return ( |
<Popconfirm |
||||
<div> <Button |
title="是否确定删除?" |
||||
type="primary" |
arrowPointAtCenter={true} |
||||
style={{ width: "100px" }} |
showArrow={true} |
||||
onClick={() => { |
position="topRight" |
||||
dispatch(push(`article/update/post`)); |
onConfirm={/* () => handleRemove(record) */ |
||||
}} |
() => { |
||||
> |
|
||||
新增 |
|
||||
</Button> |
|
||||
</div> |
|
||||
|
|
||||
|
|
||||
); |
|
||||
}, |
|
||||
}, |
|
||||
] |
|
||||
return ( |
|
||||
<Spin spinning={false}> |
|
||||
<div className='protable-transpor'> |
|
||||
<ProTable |
|
||||
scroll={{ x: 800 }} |
|
||||
options={false} |
|
||||
ref={c => { finishedProductTable = c; }} |
|
||||
style={{ width: "100% ", overflow: "auto", height: '760px' }} |
|
||||
rowKey='id' |
|
||||
onReset={(v) => { |
|
||||
const { id } = depMessage[0] |
|
||||
console.log(id) |
|
||||
setRegionId(id) |
|
||||
setPlaceType(-1) |
|
||||
setDay([moment('2022-03-01').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')]) |
|
||||
setSitename('') |
|
||||
}} |
|
||||
rowSelection={{ |
|
||||
selectedRowKeys: rowSelected, |
|
||||
onChange: (selectedRowKeys) => { |
|
||||
setRowSelected(selectedRowKeys); |
|
||||
}, |
|
||||
}} |
|
||||
columns={columns} |
|
||||
|
|
||||
dataSource={(counts || {}).rows || []} |
|
||||
request={async (params) => { |
|
||||
const query = { |
const query = { |
||||
// startDate: day[0],
|
publicityId: record.id |
||||
// endDate: day[1],
|
|
||||
// placeType: placeType,
|
|
||||
// regionId: regionId,
|
|
||||
// placeName: sitename,
|
|
||||
// limit: params.pageSize,
|
|
||||
// offset: ((params.current ? params.current : 1) - 1) * params.pageSize
|
|
||||
} |
} |
||||
setRowSelected([]); |
dispatch(delPropagata(query)).then((res) => { |
||||
const res = await dispatch(getReportStatistic(query)); |
setDelet(res) |
||||
setCounts(res.payload.data) |
console.log(res); |
||||
return { |
// if (res.success) {
|
||||
...res, |
// message.success("记录删除成功");
|
||||
total: res.payload.data ? res.payload.data.count : 0 |
// handelRefresh()
|
||||
} |
// } else {
|
||||
}} |
// message.error("记录删除失败")
|
||||
// search={{
|
// }
|
||||
// defaultCollapsed: false,
|
}) |
||||
// optionRender: (searchConfig, formProps, dom) => [
|
} |
||||
// ...dom.reverse(),
|
} |
||||
// <Popconfirm title="确认导出?" onConfirm={() => { props.exports(rowSelected, counts) }}>
|
|
||||
// <Button
|
> |
||||
// >
|
<Button type="link" float="right" |
||||
// 导出
|
>删除</Button> |
||||
// </Button>
|
</Popconfirm> |
||||
// </Popconfirm>
|
</div> |
||||
// ],
|
|
||||
// }}
|
} |
||||
|
}, |
||||
> |
{ |
||||
</ProTable></div> |
key: "direction", |
||||
|
hideInTable: true, |
||||
</Spin > |
dataIndex: "direction", |
||||
) |
order: 6, |
||||
|
renderFormItem: (item, { type, defaultRender, ...rest }, form, record) => { |
||||
|
return ( |
||||
|
<div> |
||||
|
<VideoUpload type_ys={1} record={counts} /> |
||||
|
</div> |
||||
|
); |
||||
|
}, |
||||
|
}, |
||||
|
] |
||||
|
|
||||
|
//获取数据
|
||||
|
useEffect(() => { |
||||
|
const vedio = dispatch(getPropagata()).then((res) => { |
||||
|
setCounts(res.payload.data) |
||||
|
console.log(res.payload.data) |
||||
|
}) |
||||
|
}, []) |
||||
|
|
||||
|
|
||||
|
return ( |
||||
|
|
||||
|
<Spin spinning={false}> |
||||
|
<div className='protable-transpor'> |
||||
|
<ProTable |
||||
|
actionRef={ref} |
||||
|
scroll={{ x: 800 }} |
||||
|
options={false} |
||||
|
style={{ width: "100% ", overflow: "auto", height: '760px' }} |
||||
|
rowKey='id' |
||||
|
rowSelection={{ |
||||
|
selectedRowKeys: rowSelected, |
||||
|
onChange: (selectedRowKeys) => { |
||||
|
setRowSelected(selectedRowKeys); |
||||
|
}, |
||||
|
}} |
||||
|
form={{ |
||||
|
submitter: false, |
||||
|
}} |
||||
|
columns={columns} |
||||
|
dataSource={counts || []} |
||||
|
request={async (params) => { |
||||
|
const query = { |
||||
|
limit: params.pageSize, |
||||
|
offset: ((params.current ? params.current : 1) - 1) * params.pageSize |
||||
|
} |
||||
|
setRowSelected([]); |
||||
|
}} |
||||
|
> |
||||
|
</ProTable></div> |
||||
|
</Spin > |
||||
|
) |
||||
} |
} |
||||
function mapStateToProps(state) { |
|
||||
const { auth, depMessage } = state; |
function mapStateToProps (state) { |
||||
const pakData = (dep) => { |
|
||||
return dep.map((d) => { |
const { auth, depMessage } = state; |
||||
return { |
const pakData = (dep) => { |
||||
title: d.name, |
return dep.map((d) => { |
||||
value: d.id, |
return { |
||||
// children: d.type >= 2 ? [] : pakData(d.subordinate)
|
title: d.name, |
||||
children: pakData(d.subordinate) |
value: d.id, |
||||
} |
// children: d.type >= 2 ? [] : pakData(d.subordinate)
|
||||
}) |
children: pakData(d.subordinate) |
||||
} |
} |
||||
let depData = pakData(depMessage.data || []) |
}) |
||||
return { |
} |
||||
user: auth.user, |
let depData = pakData(depMessage.data || []) |
||||
depMessage: depMessage.data || [], |
return { |
||||
depLoading: depMessage.isRequesting, |
user: auth.user, |
||||
depData, |
depMessage: depMessage.data || [], |
||||
}; |
depLoading: depMessage.isRequesting, |
||||
|
depData, |
||||
|
}; |
||||
} |
} |
||||
export default connect(mapStateToProps)(promotionalTable); |
export default connect(mapStateToProps)(promotionalTable); |
File diff suppressed because it is too large
Loading…
Reference in new issue