diff --git a/src/forge/Order/Detail.js b/src/forge/Order/Detail.js index 9736086c..b0c82acd 100644 --- a/src/forge/Order/Detail.js +++ b/src/forge/Order/Detail.js @@ -7,6 +7,7 @@ import { Form, Popconfirm, Tag, Spin } from "antd"; import Attachments from "../Upload/attachment"; import RenderHtml from "../../components/render-html"; import Comments from "../comments/comments"; +import Claims from "../claims/claims" import "./order.css"; class Detail extends Component { @@ -310,6 +311,10 @@ class Detail extends Component { />
+
+ +
+

负责人: diff --git a/src/forge/claims/claim.scss b/src/forge/claims/claim.scss new file mode 100644 index 00000000..092fa19b --- /dev/null +++ b/src/forge/claims/claim.scss @@ -0,0 +1,73 @@ +.infoCount{ + display: inline-block; + width: 24px; + text-align: center; + height: 24px; + line-height: 24px; + background-color:rgba(153, 153, 153, 0.13);; + color:#666; + border-radius: 12px; + margin-left: 6px; + font-size: 12px; + } + + .menuPanels{ + width: 295px; + .leftline{ + position: relative; + color: #666; + height: 16px; + margin-left: 14px; + font-size: 12px; + &::before{ + position: absolute; + left: -7px; + top:3px; + height: 12px; + width: 1px; + background-color: #999; + content: ""; + } + } + } + + .downMenu{ + width: 329px; + background-color: #fff; + box-shadow: 0px 1px 8px 1px rgba(212, 212, 212, 0.5); + padding-bottom: 14px; + .ant-menu-item{ + height: 50px; + line-height: 50px; + } + } + + .claimNote_input{ + // up, right, botton, left + margin: 5px 10px 5px 10px; + padding-top: 10px; + padding-bottom: 10px; + } + + .claimNote{ + // up, right, botton, left + margin: 5px 14px 0px 14px; + padding-bottom: 5px; + } + .attrPerson{ + padding-top: 12px; + display: flex; + flex-wrap: wrap; + padding-bottom: 2px; + a{ + margin: 0px 17px 10px 0px; + img{ + border-radius: 50%; + width: 40px; + height: 40px; + } + &:nth-child(5n){ + margin-right: 0px; + } + } + } \ No newline at end of file diff --git a/src/forge/claims/claims.js b/src/forge/claims/claims.js new file mode 100644 index 00000000..329bddb6 --- /dev/null +++ b/src/forge/claims/claims.js @@ -0,0 +1,277 @@ +import React, { Component } from "react"; +import axios from "axios"; +import { AlignCenter , FlexAJ } from '../Component/layout'; +import { Popover, List, Button, Dropdown, Input} from "antd"; +import { Link } from "react-router-dom"; +import { getImageUrl } from "educoder"; +import "./claim.scss" +const { TextArea } = Input; + +class claims extends React.Component { + constructor(props) { + super(props); + this.state = { + claimerdata: new Array(), + currentUserClaimed:0, + issue_id:this.props.issue_id, + claimNoteBody:'', + claimNoteBodyChanged:false, + claimNotePop:false + }; + + }; + + getClaimers = ()=>{ + const {issue_id} = this.state; + axios.get(`/issues/${issue_id}/claims.json`) + .then((result) => { + if(result){ + console.log(result.data), + this.setState({ + claimerdata: result.data.claimers, + currentUserClaimed: result.data.currentUserclaimed, + }); + } + }).catch(function (error) { + console.log(error); + }); + }; + + delClaim = () => { + if (this.props.checkIfLogin() === false) { + this.props.showLoginDialog(); + return; + } else { + const {issue_id} = this.state; + axios({ + method: 'delete', + url: `/issues/${issue_id}/claims.json` + }).then(result => { + this.setState({ + claimerdata: result.data.claimers, + currentUserClaimed: result.data.currentUserclaimed, + claimNotePop:false, + claimNoteBody:'', + }); + }) + .catch(error => { + console.log(error); + }); + } + }; + + changeClaimNote = (e)=>{ + this.setState({ + claimNoteBody: e.target.value, + claimNoteBodyChanged: true, + }); + }; + + yesClaim = ()=>{ + const {issue_id,claimNoteBody} = this.state; + + axios.post(`/issues/${issue_id}/claims.json`, { + claim_note: claimNoteBody + }) + .then(result => { + this.setState({ + claimerdata: result.data.claimers, + currentUserClaimed: result.data.currentUserclaimed, + claimNotePop:false, + }); + }) + .catch(error => { + console.log(error); + }); + }; + + addClaim = ()=> { + if (this.props.checkIfLogin() === false) { + this.props.showLoginDialog(); + return; + }else{ + this.setState({ + claimNotePop: true, + }); + } + + }; + + updateClaim = (claimId,key)=>{ + const {issue_id,claimNoteBody,claimNoteBodyChanged} = this.state; + if(claimNoteBodyChanged){ + axios.put(`/issues/${issue_id}/claims.json`, { + claim_note: claimNoteBody, + claim_id: claimId + }) + .then(result => { + this.setState({ + claimerdata: result.data.claimers, + currentUserClaimed: result.data.currentUserclaimed, + }); + }) + .catch(error => { + console.log(error); + }); + } + this.setVisibleFunc(false,key) + }; + + + + cancleClaim = ()=>{ + this.setState({ + claimNotePop: false, + }) + }; + + componentDidMount = () => { + this.getClaimers(); + }; + + + setVisibleFunc = (flag,index) => { + const {claimerdata} = this.state + var lx = claimerdata.concat(); + lx.map(i=>i.visible =false); + if(flag){ + lx[index].visible = flag; + } + lx.splice(); + this.setState({ + claimerdata:lx + }) + } + + render() { + const { + claimerdata, + currentUserClaimed, + issue_id + } = this.state; + + const rednerlist = (item)=>{ + return ( +

+ + + + + {item && item.user_name} + + 声明于 {item.created_at} +
+ ); + }; + + const renderClaim = ()=>{ + return( +
+ 声明留言:
+