Commit acb73afb authored by maple's avatar maple Committed by MrShi

[error]修改小区服务,图片组件有问题

(cherry picked from commit 978b647e)
parent 65e49186
......@@ -253,7 +253,8 @@ export default defineConfig({
{
path: '/AccountManagement',
name: 'accountmanagement',
icon:'UserSwitchOutlined',
icon: 'UserSwitchOutlined',
authority: 'admin',
routes: [
/* {
path: './AccountManagement',
......
......@@ -32,10 +32,15 @@ const PictureOptionsRow = (props: any) => {
const handleCancel = () => setPreviewVisible(false);
useEffect(() => {
console.log("是否刷新")
console.log(value);
if (value!=null) {
var tmp = value
var result = new Array()
var resultToInside=new Array()
var resultToInside = new Array()
console.log("组件");
console.log(tmp);
tmp.map((item:any, index:any) => {
if (item.name == null) {
item.name = getUrlPicName(item.url)
......
......@@ -31,11 +31,16 @@ class SearchOptions extends React.Component {
var rest=new Array()
this.state.list.map((item,index)=>{
if((item.toLowerCase()).indexOf(value.toLowerCase())>-1){
if(item[0]==value[0]){
if(item[0]==value[0]){
tmp.push(item)
}else{
rest.push(item)
}
if(this.props.titleSearch){
if(item.toLowerCase()===value.toLowerCase()){
this.props.onSubmit(value)
}
}
}
this.setState({ data: tmp.concat(rest.sort()) });
})
......@@ -78,6 +83,7 @@ class SearchOptions extends React.Component {
notFoundContent={<div><Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />Please enter the correct Community Name!</div>}
style={{ width: 200 }}
disabled={this.props.disabled}
allowClear
>
{options}
</Select>
......
......@@ -5,7 +5,7 @@ import SearchOptions from './SearchOptions';
const SearchOptionsCommnity = (props: any) => {
const {dispatch, CommunityList,defaultValue,placeholder,disabled,value,onChange} = props;
const {dispatch, CommunityList,defaultValue,titleSearch,placeholder,disabled,value,onChange} = props;
const tosCommunityget = (values:any) => {dispatch({type: 'Init/tosCommunityget',playload:values})};
useEffect(() => {
......@@ -23,7 +23,7 @@ const SearchOptionsCommnity = (props: any) => {
}
return (
<>{CommunityList!=null?
<SearchOptions disabled={disabled} placeholder={placeholder} defaultValue={props.defaultValue!=null?props.defaultValue:value} list={CommunityList} onSubmit={extendName} />
<SearchOptions titleSearch={titleSearch} disabled={disabled} placeholder={placeholder} defaultValue={props.defaultValue!=null?props.defaultValue:value} list={CommunityList} onSubmit={extendName} />
:null
}
</>
......
import React, { useState,useEffect} from 'react';
import React, { useState,useEffect,useRef} from 'react';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import styles from './index.less';
......@@ -23,7 +23,8 @@ const TitleSearch= (props:any) => {
const checklist = props.checklist;
const status = props.status;
const communitySelect=props.communitySelect
const defaultValue = props.defaultValue
const time = props.time;
const community = props.community;
const [selectOptions, setSelectOptions] = useState(true)
......@@ -31,6 +32,8 @@ const TitleSearch= (props:any) => {
const [communitySingle, setCommunitySingle] = useState(null)
const [datePicker, setDate] = useState(null)
const formRef = useRef(null)
const tosCommunityget = (values:any) => {dispatch({type: 'Init/tosCommunityget',playload:values})};
useEffect(() => {
// console.log("标题搜寻组件初始化") OK
......@@ -38,8 +41,17 @@ const TitleSearch= (props:any) => {
// console.log("小区数量初始化") OK
tosCommunityget(null)
}
if (defaultValue != null) {
formRef.current.setFieldsValue(defaultValue)
}
}, []);
useEffect(()=>{
if (defaultValue != null) {
formRef.current.setFieldsValue(defaultValue)
}
},[defaultValue])
useEffect(()=>{
if (CommunityList != null) {
......@@ -53,21 +65,18 @@ const TitleSearch= (props:any) => {
const onFinish = values => {
const onFinish = (values:any) => {
if (datePicker) {
values[time[0]] = datePicker;
}
if (community) {
values[community]=communitys
}
if (communitySingle) {
values["communityName"]=communitySingle
}
console.log('Success:', values);
props.onSubmit(values)
};
const onFinishFailed = errorInfo => {
const onFinishFailed = (errorInfo:any) => {
console.log('Failed:', errorInfo);
};
......@@ -78,17 +87,15 @@ const TitleSearch= (props:any) => {
const printContent = (comment: any)=>{
setCommunitys(comment)
}
const extendName = (values: any) => {
setCommunitySingle(values)
}
return (
<>
<Form name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed}>
<Form ref={formRef} name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed}>
<Row gutter={32}>
{
communitySelect != null ?
<Col key={"communitySelect_"} ><SearchOptionsCommnity alone={true} onSubmit={extendName} /></Col>
<Col key={"communitySelect_"} ><Form.Item name={"communityName"}><SearchOptionsCommnity titleSearch={true} /></Form.Item></Col>
: null
}
{
......
......@@ -5,7 +5,7 @@ import { Link, useIntl, connect, Dispatch, history } from 'umi';
import { routerRedux } from 'dva/router'
import { timestampToTime, timestampToTime4 } from '@/utils/time';
import { picFromate } from '@/utils/method';
import { picFromate, Fromate } from '@/utils/method';
export default {
namespace: 'CommunityService',
......@@ -53,12 +53,12 @@ export default {
//预订设施查询
*RA({ playload }, { call, put }) {
// switch (playload.index) {
// case 21: {
// var CurDataDetail=null
// yield put({ type: 'returnCurDataDetail', CurDataDetail});
// } break;
// }
switch (playload.index) {
case 40: {
var Data = null
yield put({ type: 'returnPage', Data});
} break;
}
const resp = yield call(service.RA, playload);
console.log(resp)
if (resp.code == 500||resp.error_code!="0000") {
......@@ -75,6 +75,9 @@ export default {
{
var tmp = resp.data.rows[0].tosOwerModel;
var tmp2 = resp.data.rows[0];
console.error(resp.data.rows[0].replyImgUrl)
console.error(Fromate(resp.data.rows[0].replyImgUrl,[["url",null]]))
var CurDataDetail = {
community: tmp.communityName,
address: tmp.addressAndpostalCode,
......@@ -83,6 +86,8 @@ export default {
phone: tmp.owerPhone,
email: tmp.owerEmail,
content: resp.data.rows[0].serviceContent,
replyContent: resp.data.rows[0].replyContent,
replyImgUrl: Fromate(resp.data.rows[0].replyImgUrl,[["url",null]]),
status: tmp2.handleStatus,
pictrues: picFromate(tmp2.imgUrl),
time: timestampToTime4(tmp2.createTime.time)
......@@ -113,7 +118,7 @@ export default {
yield put({ type: 'returnDataSaveDetail', DataSaveDetail, });
} break;
case 40: {
let Data = resp.data.rows;
let Data = resp;
yield put({ type: 'returnPage', Data, });
} break;
}
......
......@@ -132,6 +132,8 @@ export default {
categoriesDetailsImageName:Fromate(tmp.facilitiesImageList,reg2)
}
console.log(sourceData)
console.log(tmp.facilitiesImageList)
console.log(Fromate(tmp.facilitiesImageList,reg2))
console.log("##############################")
yield put({ type: 'returnSource', sourceData });
} break;
......
import React, { useState, useEffect } from 'react';
import React, { useState, useEffect, useRef } from 'react';
import styles from './css/Detail.less';
import { Input ,Form,Row,Col,Upload,Spin, Button,Descriptions} from 'antd';
......@@ -21,8 +21,8 @@ const Detail = (props:any) => {
const [editorFlag, setEditorFlag] = useState(true);
const { dispatch, location, CurData,CurDataDetail } = props;
const { dispatch, location,CurDataDetail } = props;
const fromRef=useRef(null)
const RA = (index:any,values: any) => { dispatch({ type: 'CommunityService/RA', playload: { index: index, body: values } }) };
const setCurDataDetail = () => { dispatch({ type: 'CommunityService/setCurDataDetail' }) };
......@@ -41,23 +41,11 @@ const Detail = (props:any) => {
const [fileList, setfileList] = useState([]);
// useEffect(() => {
// // setCurDataDetail()
// // if (CurData != null) {
// // RA(21,{
// // serviceType: CurData.service_type,
// // id: CurData.id
// // })
// // setHeadTitle(headTitles[CurData.service_type - 1])
// // }
// }, []);
useEffect(() => {
if ((location.pathname).indexOf("/Edit")>-1) {
setEditorFlag(true)
} else {
} else {
setEditorFlag(false)
}
console.log("跳转后的URL参数值")
......@@ -73,8 +61,16 @@ const Detail = (props:any) => {
},[location.pathname]);
useEffect(() => {
if (CurDataDetail != null&& curString.readyState==true) {
if (CurDataDetail != null && curString.readyState == true) {
console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
console.log(CurDataDetail)
if (!editorFlag) {
console.log(CurDataDetail.replyImgUrl);
var tmp = { replyContent: CurDataDetail.replyContent, file: CurDataDetail.replyImgUrl }
console.log(tmp)
fromRef.current.setFieldsValue(tmp)
}
setLoading({ data: false })
}
}, [CurDataDetail])
......@@ -87,11 +83,11 @@ const Detail = (props:any) => {
var val = values
val.handleName =getCookie("name")
val.handleContacts=getCookie("phone")
val.type =""+CurData.service_type
val.id =CurData.id
val.userId = CurData.user_id
val.type =""+ location.query.serviceType
val.id = location.query.id
val.userId = location.query.user_id
val.handleStatus = "1"
val.file=fileList
// val.file=fileList
console.log('Success:', val)
RA(22,val);
};
......@@ -134,23 +130,23 @@ const Detail = (props:any) => {
<Row gutter={16} style={{marginTop:20}}>
<Col>Picture:</Col>
<Col>{
CurDataDetail!=null?
<PictureOptionsRow
action="/tos/communtiy/service/reply/img"
disabled={true} putSubmit={PictureOptionsRowRef}
data={{
userToken: "token",
imageType: 'tosCommunityImageReply',
extends: "",
}}
defultValue={CurDataDetail.pictrues}
/>:null
// CurDataDetail!=null?
// <PictureOptionsRow
// action="/tos/communtiy/service/reply/img"
// disabled={true} putSubmit={PictureOptionsRowRef}
// data={{
// userToken: "token",
// imageType: 'tosCommunityImageReply',
// extends: "",
// }}
// // defultValue={CurDataDetail.pictrues}
// />:null
}</Col>
</Row>
<Line />
<Form name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed} validateMessages={validateMessages}>
<Form ref={fromRef} name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed} validateMessages={validateMessages}>
{!editorFlag ?
<Row gutter={16}>
<Col>Response:</Col>
......@@ -161,21 +157,31 @@ const Detail = (props:any) => {
: null}
<Row gutter={16} style={{ marginTop: 20 }}>
<Col span={3.5}>Resolved Complaint:</Col>
<Col ><Form.Item name="replyContent" rules={[{required:true,max:300}]} ><TextArea style={{ width: 394, height: 80 }} autoSize={false} disabled={!editorFlag} /></Form.Item></Col>
<Col ><Form.Item name="replyContent" rules={[{required:true,max:300}]} ><TextArea style={{padding:8, width: 394, height: 80 }} autoSize={false} disabled={!editorFlag} /></Form.Item></Col>
</Row>
<Row gutter={16} style={{ marginTop: 20 }}>
<Col span={3}></Col>
<Col >
<PictureOptionsRow
{/* putSubmit={PictureOptionsRowRef} */}
{
CurDataDetail.replyImgUrl != null ? <>
<Form.Item name="file" label="filename" >
<PictureOptionsRow
action="/tos/communtiy/service/reply/img"
disabled={!editorFlag}
putSubmit={PictureOptionsRowRef} data={{
data={{
userToken: "token",
imageType: 'tosCommunityImageReply',
extends: "",
}}
defultValue={[]}
/>
}} />
</Form.Item>
</>:null
}
</Col>
</Row>
{
......@@ -192,9 +198,8 @@ const Detail = (props:any) => {
};
function mapStateToProps(state:any) {
const { CurData, CurDataDetail } = state.CommunityService;
const { CurDataDetail } = state.CommunityService;
return {
CurData,
CurDataDetail
};
}
......
import React, { useState, useEffect } from 'react';
import styles from './css/index.less';
import { Input ,Menu,Table,Space,Upload,message,Button } from 'antd';
import { Input ,Menu,Table,Space,Upload,message,Pagination, Button } from 'antd';
import { Link, useIntl, connect, Dispatch,history } from 'umi';
import { timestampToTime3 } from '../../utils/time';
import TitleSearch from '../../components/TitleSearch/TitleSearch';
import { RA, urlEncode } from '@/utils/method';
import { RA, urlEncode, filterObj, filterObjbyTg } from '@/utils/method';
import { query } from 'express';
const pathname = ["CommunityMaintenance", "ShelfLifeService", "OwnerComplaints", "ReportOnline", "ProblemFeedback"]
// const handle_status=["未处理","处理","拒绝"]
const handle_Status = ["Untreated", "Processed", "Rejected"]
const handle_Status = [[0,"Untreated"], [1,"Processed"]]//["未处理","处理","拒绝"] , [2,"Rejected"]
const module="CommunityService"
const PropertyServices = (props: any) => {
const { dispatch, location, Data } = props;
const [loading, setLoading] = useState(false)
const [pageNum,setPageNum]=useState(1)
const [curString, setCurString] = useState({ serviceType: null })
const changeValue = (key:any,value: any) => {
var tmp = curString;tmp[key] = value;setCurString(tmp)
}
const pagination = { defaultCurrent: pageNum, total: Data != null ? Data.length : 0 }
const [pageNum, setPageNum] = useState(1)
const [serviceTypeGobal, setServiceType] = useState("")
const [readyData,setReadyData]=useState(null)
const columns = [
{ title: "Community Name",dataIndex: 'community_name',},
{ title: "Ower Name",dataIndex: 'ower_name',},
{ title: "Reply",dataIndex: 'handle_name',render: (text: any) => (<Space size="middle">{text!=null?text:"--"}</Space>)},
{ title: "Create Time",dataIndex: "create_time",render: (text: any, record: any) => (<Space size="middle">{timestampToTime3(text.time)}</Space>)},
{ title: "Handle status", dataIndex: 'handle_status',render: (text: any, record: any) => (<Space size="middle">{handle_Status[text]}</Space>)},
{ title: "Handle status", dataIndex: 'handle_status',render: (text: any, record: any) => (<Space size="middle">{handle_Status[text][1]}</Space>)},
{ title: "Actions",dataIndex: 'handle_status',
render: (text: any, record: any) => (
<Space size="middle"> <a onClick={goToDetail.bind(this,text,record)}>{text==0?"Reply":"Detail"}</a></Space>
......@@ -41,50 +36,80 @@ const PropertyServices = (props: any) => {
},
];
const goToDetail = (value, record, e) => {
history.push(location.pathname+(value==0?"/Edit":"/Detail")+urlEncode({serviceType: curString.serviceType,id: record.id,user_id:record.user_id}))
const goToDetail = (value:any, record:any, e:any) => {
history.push(location.pathname+(value==0?"/Edit":"/Detail")+urlEncode({serviceType: serviceTypeGobal,id: record.id,user_id:record.user_id}))
}
useEffect(() => {
setLoading(false)
if (Data != null) {setLoading(false)}
}, [Data]);
const TitleSearchContent = (comment: any)=>{
comment.serviceType = curString.serviceType
console.log(comment)
history.push(location.pathname+urlEncode(comment))
const ClickTitleSearch = (comment: any)=>{
comment.serviceType = serviceTypeGobal
comment.current = 1
history.push(location.pathname+urlEncode(filterObj(comment)))
}
const PageChange = (values: any) => { //.current
var tmp = filterObjbyTg(location.query, ["handleStatus", "ownerName", "communityName"])
tmp["current"]=values.current
history.push(location.pathname + urlEncode(tmp))
}
useEffect(()=>{
if (location != null) {
var serviceType =""
pathname.map((item, index) => {
if ((location.pathname).indexOf(item) > -1) {
serviceType = "" + (index + 1)
changeValue("serviceType",serviceType)
setServiceType(serviceType)
}
})
if (location.query.current) {
console.log("翻页")
setPageNum(location.query.current)
if (location.query.current!=null) {
setPageNum(parseInt(location.query.current))
} else {
var tm=1
setPageNum(tm)
setPageNum(1)
}
setLoading(true)
console.log("设置大数据");
var tmp = filterObjbyTg(location.query, ["handleStatus", "ownerName", "communityName"])
console.log(tmp)
setReadyData(tmp)
// var tmp=filterObj(location.query)
// console.log(tmp)
RA(40, {
serviceType: serviceType,
handleStatus: location.query.handleStatus != null ? parseInt(location.query.handleStatus) : null,
handleStatus: location.query.handleStatus != undefined ? parseInt(location.query.handleStatus) : null,
ownerName: location.query.ownerName != undefined ? (location.query.ownerName) : null,
communityName: location.query.communityName != undefined ? (location.query.communityName) : null,
}, module, dispatch)
setLoading(true)
}
}, [location.query])
const PageChange = (values: any) => {
history.push(location.pathname+urlEncode(values))
console.log(values)
}
}, [location])
return (
<div className={styles.base}>
<div>{pageNum}</div>
<TitleSearch communitySelect={true} listkey={['ownerName']} list={['Owner Name']} status={[{ name: ["handleStatus","Status"], data: [[0,"Processed"], [1,"Untreated"],[2,"Rejected"]]}]} onSubmit={TitleSearchContent}/>
<Table loading={loading} rowKey={"id"} style={{ marginTop: 16 }} dataSource={Data} columns={columns} pagination={{ defaultCurrent: pageNum, total: Data != null ? Data.length : 0}} onChange={PageChange}/>
<TitleSearch
communitySelect={true}
listkey={['ownerName']}
list={['Owner Name']}
status={[{ name: ["handleStatus", "Status"], data: handle_Status }]}
defaultValue={readyData}
onSubmit={ClickTitleSearch}
/>
<Table
rowKey={"id"}
style={{ marginTop: 16 }}
loading={loading}
columns={columns}
dataSource={ Data != null ?Data.data.rows:[]}
pagination={Data != null ? { current: pageNum, total: Data.data.rows.length } : {}}
onChange={PageChange}
/>
</div>
);
};
......@@ -96,3 +121,11 @@ function mapStateToProps(state:any) {
};
}
export default connect(mapStateToProps)(PropertyServices);
// 26、获取小区服务信息
// http://47.74.233.180:8651/tos/community/service/get
// {
// "serviceType":"1",
// "ownerName":"阿涛暗暗",
// "handleStatus":"1",
// "communityName":"TANGDE2"
// }
\ No newline at end of file
......@@ -15,8 +15,6 @@ import FileUpload from '@/components/FileUpload/FileUpload';
import { validateMessages } from '@/utils/params';
import PictureOptionsRow from '@/components/PictureOptions/PictureOptionsRow';
import TextArea from 'antd/lib/input/TextArea';
import SelectOptions from '@/components/SelectOptions';
import TitleSearch from '@/components/TitleSearch/TitleSearch';
import SelectCommunity from '@/components/SelectCommunity';
import Line from '@/components/Line/Line';
import TimeComfirm from '@/components/TimeComfirm/TimeComfirm';
......
......@@ -67,7 +67,10 @@ const Facility = (props:any) => {
setExtend(sourceData.communityName)
setTimeExtend(sourceData.reservationQuantumTime)
// 中断
// setPictrueExtend({tab:null,pic:null,pics:null})
// setPictrueExtend({tab:null,pic:null,pics:null})
console.log("重点检查");
console.log(sourceData);
formRef.current.setFieldsValue(sourceData)
}
}, [sourceData])
......
......@@ -33,7 +33,7 @@ const Guard = (props:any) => {
return (
<div className={styles.base}>
<TitleGet title={"Version 1.1.7"} />
<TitleGet title={"Version 1.1.9"} />
<p>
token:{page.token}
name:{getCookie("name")}
......
......@@ -2,9 +2,11 @@ import { reloadAuthorized } from './Authorized';
// use localStorage to store the authority info, which might be sent from server in actual project.
export function getAuthority(str?: string): string | string[] {
console.log("获取权限")
const authorityString =
typeof str === 'undefined' && localStorage ? localStorage.getItem('antd-pro-authority') : str;
// authorityString could be admin, "admin", ["admin"]
console.log(authorityString)
let authority;
try {
if (authorityString) {
......@@ -19,6 +21,7 @@ export function getAuthority(str?: string): string | string[] {
}
// preview.pro.ant.design only do not use in your production.
// preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
if (!authority && ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') {
return ['admin'];
}
......
......@@ -81,6 +81,7 @@ export const Fromate = (values:any,reg:any) => {
}
return result
}
// 按键取值
// const reg2 = "name"
// const values2 = [{name:"kat",url:"longtime"},{name:"jack",url:"longtime2"}]
export const Fromate2 = (values:any, reg:string) => {
......@@ -99,9 +100,6 @@ export const getObjectInfo = (test: any) => {
for (let item in test) {
array.push([item, typeof test[item]])
}
console.log(array)
console.log(array.length)
return array
}
//对象转URL
......@@ -116,4 +114,26 @@ export const urlEncode = (obj:any) => {
i += 1
}
return url
}
\ No newline at end of file
}
//对象抽空
export const filterObj = (obj:any) => {
var tmp = {}
for (var item in obj) {
if (obj[item] != null&&obj[item]!=undefined) {
tmp[item] = obj[item]
}
}
return tmp
}
//对象抽空根据关键字
export const filterObjbyTg = (obj:any,tg:any) => {
var tmp = {}
for (var item in obj) {
if (tg.indexOf(item)>-1) {
if (obj[item] != null) {
tmp[item] = obj[item]
}
}
}
return tmp
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment