From b321fc6111c6483e3b2e501620d2e7ffc6a22f15 Mon Sep 17 00:00:00 2001 From: liuwh <liuwh@hugeinfo.com.cn> Date: Wed, 26 Feb 2020 09:15:52 +0800 Subject: [PATCH] 1 --- SunshineIns/src/fetch/index.js | 12 + SunshineIns/src/page/ActiveManage.jsx | 140 ++++++++++++++++ SunshineIns/src/page/UnderAgeList.jsx | 224 ++++++++++++++++++++++++++++ SunshineIns/src/fetch/_fetch.js | 2 SunshineIns/src/fetch/socialCompanySave.js | 8 + SunshineIns/src/fetch/socialCompanyDetail.js | 9 + SunshineIns/src/index.jsx | 3 SunshineIns/src/fetch/addResult.js | 6 SunshineIns/src/data/menu.js | 9 + SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxss | 9 + SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxml | 16 + SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js | 8 SunshineIns/src/fetch/socialCompanydelete.js | 9 + SunshineIns/src/fetch/socialCompany.js | 9 + 14 files changed, 452 insertions(+), 12 deletions(-) diff --git a/SunshineIns/src/data/menu.js b/SunshineIns/src/data/menu.js index ca9c0e9..d336d7e 100644 --- a/SunshineIns/src/data/menu.js +++ b/SunshineIns/src/data/menu.js @@ -85,7 +85,7 @@ path: '/sweeping' }, { id: 'activeManage', - name: '活动管理', + name: '法制活动', icon: active, iconCheck: activeCheck, path: '/activeManage' @@ -98,6 +98,13 @@ path: '/careList' }, { + id: 'underAgeList', + name: '涉未成年负责部门组织', + icon: active, + iconCheck: activeCheck, + path: '/underAgeList' +}, +{ id: 'questionnaire', name: '问卷管理部分', icon: msgManage, diff --git a/SunshineIns/src/fetch/_fetch.js b/SunshineIns/src/fetch/_fetch.js index 0919acd..dbde3fd 100644 --- a/SunshineIns/src/fetch/_fetch.js +++ b/SunshineIns/src/fetch/_fetch.js @@ -2,6 +2,8 @@ // export const base = 'http://xnwj.gznsjc.gov.cn'; export const base = 'http://nsjc.vaiwan.com'; +// export const base = 'http://nsjcy.hugeinfo.com.cn'; + // export const base = 'http://192.168.0.147:8081'; export const domain = base + '/nsjc-charge/'; diff --git a/SunshineIns/src/fetch/addResult.js b/SunshineIns/src/fetch/addResult.js new file mode 100644 index 0000000..0082000 --- /dev/null +++ b/SunshineIns/src/fetch/addResult.js @@ -0,0 +1,6 @@ +import fetch from './_fetch'; +import { message } from 'antd'; +export default ({ id, result}) => fetch(`api/activity/addResult?id=${id||''}&result=${result || ''}`) + .catch( + error => message.error('列表加载失败,请联系管理员', 2) + ); diff --git a/SunshineIns/src/fetch/index.js b/SunshineIns/src/fetch/index.js index 251a0e1..2c4e035 100644 --- a/SunshineIns/src/fetch/index.js +++ b/SunshineIns/src/fetch/index.js @@ -81,6 +81,11 @@ import attachmentDownload from './attachmentDownload'; import entryAudit from './entryAudit'; import signinfo from './signinfo'; +import addResult from './addResult'; +import socialCompany from './socialCompany'; +import socialCompanySave from './socialCompanySave'; +import socialCompanyDetail from './socialCompanyDetail'; +import socialCompanydelete from './socialCompanydelete'; export default { domain, @@ -165,5 +170,10 @@ entryQuery, attachmentDownload, entryAudit, - signinfo + signinfo, + addResult, + socialCompany, + socialCompanySave, + socialCompanyDetail, + socialCompanydelete }; \ No newline at end of file diff --git a/SunshineIns/src/fetch/socialCompany.js b/SunshineIns/src/fetch/socialCompany.js new file mode 100644 index 0000000..8f17932 --- /dev/null +++ b/SunshineIns/src/fetch/socialCompany.js @@ -0,0 +1,9 @@ +import fetch from './_fetch'; +import { message } from 'antd'; +export default ({ companyName, companyLegal,companyTel,companyAccount, createTime }) => fetch(`api/socialCompany/finds?companyName=${companyName || ''}&companyLegal=${companyLegal || ''}&companyTel=${companyTel || ''}&companyAccount=${companyAccount || ''}&createTime=${createTime || ''}`) + .then( + json => json.rows + ) + .catch( + error => message.error('列表加载失败,请联系管理员', 2) + ); diff --git a/SunshineIns/src/fetch/socialCompanyDetail.js b/SunshineIns/src/fetch/socialCompanyDetail.js new file mode 100644 index 0000000..15f9a1d --- /dev/null +++ b/SunshineIns/src/fetch/socialCompanyDetail.js @@ -0,0 +1,9 @@ +import fetch from './_fetch'; +import { message } from 'antd'; +export default (id) => fetch(`api/socialCompany/find?id=${id||'new'}`) + .then( + json => json + ) + .catch( + error => message.error('详情加载失败,请联系管理员', 2) + ); diff --git a/SunshineIns/src/fetch/socialCompanySave.js b/SunshineIns/src/fetch/socialCompanySave.js new file mode 100644 index 0000000..c636f75 --- /dev/null +++ b/SunshineIns/src/fetch/socialCompanySave.js @@ -0,0 +1,8 @@ + +import fetch from './_fetch'; + +export default (savedate) => { + return fetch(`api/socialCompany/save`, + savedate + ); +} diff --git a/SunshineIns/src/fetch/socialCompanydelete.js b/SunshineIns/src/fetch/socialCompanydelete.js new file mode 100644 index 0000000..9944d06 --- /dev/null +++ b/SunshineIns/src/fetch/socialCompanydelete.js @@ -0,0 +1,9 @@ +import fetch from './_fetch'; +import { message } from 'antd'; +export default (id) => fetch(`api/socialCompany/delete?id=${id}`) + .then( + json => json + ) + .catch( + error => message.error('删除失败,请联系管理员', 2) + ); diff --git a/SunshineIns/src/index.jsx b/SunshineIns/src/index.jsx index 62b5c13..816d599 100644 --- a/SunshineIns/src/index.jsx +++ b/SunshineIns/src/index.jsx @@ -14,6 +14,8 @@ import BusDetail from './page/BusDetail'; import SupPerson from './page/SupPerson'; import Company from './page/Company'; +// 涉未成年负责部门组织 +import UnderAgeList from './page/UnderAgeList'; import ActiveManage from './page/ActiveManage'; import ActiveManageEdit from './page/ActiveManageEdit'; import KnowledgeBase from './page/KnowledgeBase'; @@ -72,6 +74,7 @@ <Route path='/active' component={Active} /> <Route path='/supPerson' component={SupPerson} /> <Route path='/company' component={Company} /> + <Route path='/underAgeList' component={UnderAgeList} /> <Route path='/knowledgeBase' component={KnowledgeBase} /> <Route path='/articlePublish' component={ArticlePublish} /> <Route path='/articleEidt/:id' component={ArticleEidt} /> diff --git a/SunshineIns/src/page/ActiveManage.jsx b/SunshineIns/src/page/ActiveManage.jsx index bc789c1..1eebd18 100644 --- a/SunshineIns/src/page/ActiveManage.jsx +++ b/SunshineIns/src/page/ActiveManage.jsx @@ -4,12 +4,13 @@ import HeadView from '../view/HeadView'; import TableBtnView from '../view/TableBtnView'; import CommonSearchForm from '../view/CommonSearchForm'; -import { Divider, Modal, message, Button, Progress } from 'antd' +import { Divider, Modal, message, Button, Row, Col, Progress, Input, Upload, Icon } from 'antd' import moment from 'moment' import Fetch from '../fetch'; import { domain } from '../fetch/_fetch'; import TableView from '../view/TableView'; const confirm = Modal.confirm; +const { TextArea } = Input; function typeOfName(type) { switch (type) { case 0: @@ -69,14 +70,21 @@ this.state = { data: [], resetKey: Date.now(), - loading:false, + loading: false, + confirmLoading: false, + modal: false, + closeKey: Date.now(), formData: { __key: Date.now(), activityType: '', activityStatus: '', startTime: '', endTime: '', - } + }, + savedate: {}, + fileList: [], + previewVisible: false, + previewImage: '', }; } @@ -92,6 +100,45 @@ }); } + handlePreview = (file) => { + this.setState({ + previewImage: file.url || file.thumbUrl, + previewVisible: true, + }); + } + + handleOk = () => { + console.log('success') + this.setState({ confirmLoading: true }); + const { savedate } = this.state; + console.log(savedate) + + if (!savedate.result) { + return message.warning("培训结果不能为空"); + } + Fetch.addResult({ ...savedate }) + .then(res => { + console.log(res) + if (res.code === 0) { + this.setState({ + confirmLoading: false, + modal: false, + closeKey: Date.now() + }, this.getData); + message.success("提交成功!") + } else { + message.error('保存失败,请联系管理员', 2) + } + }); + } + + handleCancel = () => { + this.setState({ + closeKey: Date.now(), + modal: false + }); + } + searchonClick = data => { console.log('form', data); this.setState({ @@ -100,11 +147,20 @@ this.getData(); } + saveInputChange = ({ target: { value, name } }) => { + this.setState(({ savedate }) => ({ + savedate: { + ...savedate, + [name]: value + } + })) + } + getData = () => { // this.setState({ // data: [] // }); - this.setState({loading:true}) + this.setState({ loading: true }) Fetch.activeManage({ ...this.state.formData }) .then(res => { for (var i = 0; i < res.length; i++) { @@ -112,7 +168,7 @@ } this.setState({ data: res, - loading:false + loading: false }); }); } @@ -122,6 +178,16 @@ signIn = (id) => { window.open('index.html#/signIn/' + id); + } + + addResult = (id) => { + this.setState(({ savedate }) => ({ + savedate: { + ...savedate, + id: id + }, + modal: true + })) } pulish = (id) => { @@ -219,12 +285,44 @@ <label className='theme-color' onClick={() => this.signIn(record.id)} style={{ cursor: 'pointer' }}>签到上墙</label> </span> : - <span><label className='theme-color' onClick={() => this.showModal(record.id)} style={{ cursor: 'pointer' }}>查看</label></span> + record.status == 3 ? + <span> + <label className='theme-color' onClick={() => this.showModal(record.id)} style={{ cursor: 'pointer' }}>查看</label> + {!record.result && + <React.Fragment> + <Divider type="vertical" /> + <label className='theme-color' onClick={() => this.addResult(record.id)} style={{ cursor: 'pointer' }}>添加结果</label> + </React.Fragment> + } + </span> + : + <span><label className='theme-color' onClick={() => this.showModal(record.id)} style={{ cursor: 'pointer' }}>查看</label></span> ) ), }]; - const { data, resetKey, formData, loading } = this.state; + const { data, previewImage, formData, loading, modal, fileList, previewVisible, confirmLoading, closeKey, savedate } = this.state; + const props = { + action: domain + 'api/v1/attachment/materials?associateTypeId=1020&entityId=' + savedate.id, + onChange: ({ file, fileList }) => { + this.setState({ fileList }); + }, + fileList: fileList, + onRemove: (file) => { + Fetch.deleteAttachment(file.uid) + .then(res => { + message.success("移除成功!"); + }); + this.setState(({ fileList }) => { + const index = fileList.indexOf(file); + const newFileList = fileList.slice(); + newFileList.splice(index, 1); + return { + fileList: newFileList, + }; + }); + } + }; return ( <div className="app-page" > <HeadView history={this.props.history} /> @@ -263,6 +361,34 @@ ]} /> <TableView columns={columns} data={data} pageSize='10' size='default' loading={loading} /> </div> + <Modal + key={closeKey} + confirmLoading={confirmLoading} + visible={modal} + width={'50%'} + title="添加结果" + onOk={this.handleOk} + onCancel={this.handleCancel} + > + <Row type="flex" align='middle' style={{ margin: '12px 0' }} justify="space-around"> + <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>培训结果</span></Col> + <Col span={18} push={0} ><TextArea rows={4} placeholder="请输入培训结果" value={savedate.result || ""} onChange={this.saveInputChange} name='result' /></Col> + </Row> + <Row type="flex" align='middle' justify="space-around"> + <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>培训材料</span></Col> + <Col span={18} push={0} > + <Upload listType="picture-card" onPreview={this.handlePreview} {...props}> + <div> + <Icon type="plus" /> + <div className="ant-upload-text">上传图片</div> + </div> + </Upload> + <Modal visible={previewVisible} footer={null} onCancel={this.handleCancel}> + <img alt="example" style={{ width: '100%' }} src={previewImage} /> + </Modal> + </Col> + </Row> + </Modal> </div> ); } diff --git a/SunshineIns/src/page/UnderAgeList.jsx b/SunshineIns/src/page/UnderAgeList.jsx new file mode 100644 index 0000000..272a96d --- /dev/null +++ b/SunshineIns/src/page/UnderAgeList.jsx @@ -0,0 +1,224 @@ +import React from 'react'; + +import HeadView from '../view/HeadView'; +import TableBtnView from '../view/TableBtnView'; +import { Input, Button, DatePicker, Divider, Modal, message } from 'antd' +import moment from 'moment' +import Fetch from '../fetch'; +import TableView from '../view/TableView'; +const confirm = Modal.confirm; +export default class Company extends React.Component { + constructor(props) { + super(props); + this.state = { + data: [], + loading: false, + visible: false, + savedate: {}, + formdata: {}, + resetKey: Date.now(), + closeKey: Date.now() + }; + } + + componentDidMount() { + document.title = '涉未成年负责部门组织'; + this.getData(); + } + getData = () => { + const { formdata } = this.state; + Fetch.socialCompany(formdata) + .then(res => { + for (var i = 0; i < res.length; i++) { + res[i]['index'] = i + 1; + } + this.setState({ + data: res + }); + }); + } + onInputChange = ({ target: { value, name } }) => { + this.setState(({ formdata }) => ({ + formdata: { + ...formdata, + [name]: value + } + })) + } + saveInputChange = ({ target: { value, name } }) => { + this.setState(({ savedate }) => ({ + savedate: { + ...savedate, + [name]: value + } + })) + } + Seaech = () => { + const { formdata } = this.state; + Fetch.socialCompany(formdata) + .then(res => { + for (var i = 0; i < res.length; i++) { + res[i]['index'] = i + 1; + } + this.setState({ + data: res + }); + }); + } + Reset = () => { + this.setState({ + resetKey: Date.now(), + formdata: {} + }, this.getData); + } + + showModal = (id) => { + this.setState({ + visible: true, + }); + Fetch.socialCompanyDetail(id) + .then(res => { + this.setState({ savedate: res }) + }) + } + + handleOk = () => { + this.setState({ loading: true }); + const { savedate } = this.state; + if (savedate.companyTel) { + if (!validator.mobile(savedate.companyTel)) { + this.setState({ + loading: false + }); + return message.warning("电话号码格式不正确"); + } + } + if (!savedate.companyAccount) { + return message.warning("账号不能为空"); + } + if (!savedate.companyPassword) { + return message.warning("密码不能为控"); + } + Fetch.socialCompanySave(savedate) + .then(res => { + if (res.statuscode === 1) { + this.setState({ + loading: false, + visible: false, + closeKey: Date.now() + }, this.getData); + message.success("提交成功!") + } else { + message.error('保存失败,请联系管理员', 2) + } + }); + } + + handleCancel = () => { + this.setState({ + closeKey: Date.now(), + visible: false + }); + } + + deleteItems = (id) => { + confirm({ + title: '确认要删除这条数据吗?', + onOk: () => { + Fetch.socialCompanydelete(id) + .then(data => { + if (data.statuscode == 1) { + message.success("删除成功!") + this.setState({ + resetKey: Date.now(), + formdata: {} + }, this.getData); + } else { + message.error('删除失败,请联系管理员', 2) + } + }) + } + }); + } + render() { + const columns = [{ + title: '序号', + dataIndex: 'index', + key: 'index' + }, { + title: '公司名称', + dataIndex: 'companyName', + key: 'companyName' + }, { + title: '法人姓名', + dataIndex: 'companyLegal', + key: 'companyLegal', + }, { + title: '联系电话', + dataIndex: 'companyTel', + key: 'companyTel', + }, { + title: '公司地址', + dataIndex: 'companyAddress', + key: 'companyAddress', + }, { + title: '管理员账号', + dataIndex: 'companyAccount', + key: 'companyAccount', + }, { + title: '管理员密码', + dataIndex: 'companyPassword', + key: 'companyPassword', + render: text => <span>***********</span> + }, { + title: '创建时间', + dataIndex: 'createTime', + key: 'createTime', + render: text => <span>{moment(text).format("YYYY-MM-DD HH:mm")}</span> + }, { + title: '操作', + key: 'action', + render: (text, record) => ( + <span> + <label onClick={() => this.showModal(record.id)} className='theme-color' style={{ cursor: 'pointer' }}>编辑</label> + <Divider type="vertical" /> + <label onClick={() => this.deleteItems(record.id)} className='theme-color' style={{ cursor: 'pointer' }}>删除</label> + </span> + ), + }]; + const { data, resetKey, visible, loading, savedate, closeKey } = this.state; + return ( + + <div className="app-page"> + <HeadView history={this.props.history} /> + <TableBtnView key={-resetKey} type="infoManage" name='涉未成年负责部门组织' btnName='新建公司' onClick={() => this.showModal('new')}> + <Input placeholder="根据公司名称模糊查询" style={{ width: "200px" }} name='companyName' onChange={this.onInputChange} /> + <Input placeholder="根据法人姓名模糊查询" style={{ width: "200px" }} name='companyLegal' onChange={this.onInputChange} /> + <Input placeholder="根据联系电话模糊查询" style={{ width: "200px" }} name='companyTel' onChange={this.onInputChange} /> + <Input placeholder="根据管理员账号模糊查询" style={{ width: "200px" }} name='companyAccount' onChange={this.onInputChange} /> + <DatePicker onChange={(_, value) => this.onInputChange({ target: { name: 'createTime', value } })} placeholder="根据创建时间查询" /> + <Button type="primary" onClick={this.Seaech}>查询</Button> + <Button onClick={this.Reset}>重置</Button> + </TableBtnView> + <TableView columns={columns} data={data} pageSize='10' size='default' /> + <Modal + key={closeKey} + confirmLoading={loading} + visible={visible} + title="公司信息" + onOk={this.handleOk} + onCancel={this.handleCancel} + bodyStyle={{ lineHeight: 4 }} + > + <Input addonBefore="公司名称" name='companyName' onChange={this.saveInputChange} value={savedate.companyName || ''} /> + <Input addonBefore="法人姓名" name='companyLegal' onChange={this.saveInputChange} value={savedate.companyLegal || ''} /> + <Input addonBefore="联系电话" name='companyTel' onChange={this.saveInputChange} value={savedate.companyTel || ''} /> + <Input addonBefore="公司地址" name='companyAddress' onChange={this.saveInputChange} value={savedate.companyAddress || ''} /> + <Input addonBefore="管理员账号" name='companyAccount' onChange={this.saveInputChange} value={savedate.companyAccount || ''} /> + <Input addonBefore="管理员密码" name='companyPassword' onChange={this.saveInputChange} value={savedate.companyPassword || ''} /> + </Modal> + </div> + ); + } + +} diff --git a/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js b/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js index 5662339..d63220d 100644 --- a/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js +++ b/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js @@ -12,7 +12,9 @@ loading: false, peopleInfo: {}, signStatus: '', - id: "" + id: "", + topattList:[], + bottomattList:[] }, /** @@ -40,7 +42,9 @@ if (res.data.code == 0) { res.data.data.startTime = app.formatDate(res.data.data.startTime) that.setData({ - activity: res.data.data + activity: res.data.data, + bottomattList:res.data.data.attList.filter((item)=>(item.associateType==1020)), + topattList:res.data.data.attList.filter((item)=>(item.associateType==1000)) }) console.log('传过来', options.flag) console.log('传过来', options.signStatus) diff --git a/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxml b/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxml index 04236e8..83b3115 100644 --- a/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxml +++ b/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxml @@ -2,7 +2,7 @@ <view class="fzpxInfo-bg" wx:if="{{!loading}}"> <view class="flex1"> <swiper class="screen-swiper square-dot" indicator-dots="true" circular="true" autoplay="true" interval="5000" duration="500"> - <swiper-item wx:for="{{activity.attList}}" wx:key> + <swiper-item wx:for="{{topattList}}" wx:key> <image src="{{item.imgPath}}" mode="aspectFill"></image> <!-- <video src="{{item.url}}" autoplay loop muted show-play-btn="{{false}}" controls="{{false}}" objectFit="cover" wx:if="{{item.type=='video'}}"></video> --> </swiper-item> @@ -39,6 +39,20 @@ <view class="fzpxInfo-main-group-around">{{activity.activityDesc}}</view> </view> </view> + + <view wx:if="{{activity.result}}" class="fzpxInfo-main-group"> + <view class="fzpxInfo-main-group-title">培训结果</view> + <view class="fzpxInfo-main-group-around">{{activity.result}}</view> + </view> + + <view wx:if="{{activity.result}}" class="fzpxInfo-main-group"> + <view class="fzpxInfo-main-group-title">培训材料</view> + <view class="fzpxInfo-main-group-around" style="display:flex;flex-wrap: wrap"> + <view class="educt_hasupload_pic" wx:for="{{bottomattList}}" wx:key="index"> + <image src="{{item.imgPath}}" class="upload"></image> + </view> + </view> + </view> </view> <block wx:if="{{activity.activityStatus == 1 && flag == 'true'}}"> diff --git a/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxss b/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxss index d2c6db6..014d402 100644 --- a/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxss +++ b/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxss @@ -76,6 +76,15 @@ font-weight: 600; } +.upload { + width: 48px; + height: 48px; +} + +.educt_hasupload_pic { + margin: 4px; +} + .fzpxInfo-foot-txt { margin: 6px 6px 24px; line-height: 22PX; -- Gitblit v1.8.0