From 977a266172c64d1c5fe5d03296c7fd111fc645ad Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 21 Feb 2023 15:47:38 +0800 Subject: [PATCH] save --- package-lock.json | 21 ++ package.json | 1 + public/index.html | 2 +- src/forge/Issues/Component/allMenus.jsx | 50 ++-- src/forge/Issues/Component/copy.jsx | 21 ++ src/forge/Issues/Component/datas.jsx | 8 +- src/forge/Issues/Component/delBox.jsx | 9 +- src/forge/Issues/Component/editMenus.jsx | 83 +++--- src/forge/Issues/Component/menus.jsx | 72 +++-- src/forge/Issues/Component/newPanel.jsx | 109 ++++++++ src/forge/Issues/Pages/details.jsx | 333 +++++++++++++++++++++-- src/forge/Issues/Pages/list.jsx | 10 +- src/forge/Issues/Pages/new.jsx | 140 +++------- src/forge/Issues/index.jsx | 24 +- src/forge/Issues/index.scss | 9 +- src/forge/Main/Detail.js | 12 +- src/forge/SecuritySetting/sub/New.jsx | 4 +- 17 files changed, 674 insertions(+), 234 deletions(-) create mode 100644 src/forge/Issues/Component/copy.jsx create mode 100644 src/forge/Issues/Component/newPanel.jsx diff --git a/package-lock.json b/package-lock.json index b74d7b911..03f68eeb4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15439,6 +15439,27 @@ "object-assign": "^4.1.1" } }, + "react-copy-to-clipboard": { + "version": "5.1.0", + "resolved": "https://registry.npmmirror.com/react-copy-to-clipboard/-/react-copy-to-clipboard-5.1.0.tgz", + "integrity": "sha512-k61RsNgAayIJNoy9yDsYzDe/yAZAzEbEgcz3DZMhF686LEyukcE1hzurxe85JandPUG+yTfGVFzuEw3xt8WP/A==", + "requires": { + "copy-to-clipboard": "^3.3.1", + "prop-types": "^15.8.1" + }, + "dependencies": { + "prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmmirror.com/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "requires": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + } + } + }, "react-countup": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/react-countup/-/react-countup-6.1.0.tgz", diff --git a/package.json b/package.json index 25cb4a668..e94f160af 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,7 @@ "react-color": "^2.18.0", "react-content-loader": "^3.1.1", "react-cookies": "^0.1.1", + "react-copy-to-clipboard": "^5.1.0", "react-countup": "^6.1.0", "react-cropper": "^2.1.8", "react-datepicker": "^2.14.1", diff --git a/public/index.html b/public/index.html index 88863515a..90f33d8f2 100755 --- a/public/index.html +++ b/public/index.html @@ -49,7 +49,7 @@ - + diff --git a/src/forge/Issues/Component/allMenus.jsx b/src/forge/Issues/Component/allMenus.jsx index fc55ad011..1488d5d35 100644 --- a/src/forge/Issues/Component/allMenus.jsx +++ b/src/forge/Issues/Component/allMenus.jsx @@ -111,7 +111,7 @@ function AllMenus({owner,projectsId,chooseFunc,update},ref){ } function choose(id,name){ - let copy = {...ids,author_id:id}; + let copy = {...ids,author_id:id.join(",")}; let copyname = { ...names,author_name:name} setIds(copy);setNames(copyname); chooseFunc(copy); @@ -121,53 +121,61 @@ function AllMenus({owner,projectsId,chooseFunc,update},ref){ diff --git a/src/forge/Issues/Component/copy.jsx b/src/forge/Issues/Component/copy.jsx new file mode 100644 index 000000000..a46cc1edc --- /dev/null +++ b/src/forge/Issues/Component/copy.jsx @@ -0,0 +1,21 @@ +import React ,{ useState } from 'react'; +import { Tooltip } from 'antd'; +import { CopyToClipboard } from 'react-copy-to-clipboard'; + + +function Copy({ children , value }){ + const [ title , setTitle ] = useState("点击复制链接"); + + return( + setTitle("复制成功")}> + + {children} + + + ) +} +export default Copy; \ No newline at end of file diff --git a/src/forge/Issues/Component/datas.jsx b/src/forge/Issues/Component/datas.jsx index 514f08dda..f2ca31853 100644 --- a/src/forge/Issues/Component/datas.jsx +++ b/src/forge/Issues/Component/datas.jsx @@ -1,8 +1,10 @@ import React from 'react'; -import { Checkbox , Tooltip } from 'antd'; +import { Tooltip } from 'antd'; import { getImageUrl } from 'educoder'; import issue from '../Img/issue.png'; import { Link } from "react-router-dom"; +import Copy from '../Component/copy'; + // issue列表显示 function Datas({checkbox ,item , projectsId,owner}){ @@ -27,7 +29,9 @@ function Datas({checkbox ,item , projectsId,owner}){ {checkbox}
{item.priority_name} - {item.project_issues_index && #{item.project_issues_index}} + { item.project_issues_index && + #{item.project_issues_index} + }
diff --git a/src/forge/Issues/Component/delBox.jsx b/src/forge/Issues/Component/delBox.jsx index 3729b57b6..335a15e19 100644 --- a/src/forge/Issues/Component/delBox.jsx +++ b/src/forge/Issues/Component/delBox.jsx @@ -3,12 +3,13 @@ import Modals from '../../Component/PublicModal/Index'; import { AlignTop } from '../../Component/layout'; import { Button } from 'antd'; -function DelBox({visible,onCancel,onSuccess}){ +function DelBox({visible,onCancel,onSuccess,content}){ return( @@ -19,7 +20,11 @@ function DelBox({visible,onCancel,onSuccess}){
-

您确定要删除所有选中的疑修?

此操作将清空所有已选中的疑修,请谨慎操作

+ { content ? + content + : +

您确定要删除所有选中的疑修?

此操作将清空所有已选中的疑修,请谨慎操作

+ }
diff --git a/src/forge/Issues/Component/editMenus.jsx b/src/forge/Issues/Component/editMenus.jsx index 926b98a0b..afd55e41f 100644 --- a/src/forge/Issues/Component/editMenus.jsx +++ b/src/forge/Issues/Component/editMenus.jsx @@ -5,15 +5,34 @@ import { getImageUrl } from 'educoder'; const { Search } = Input; -// name:显示的标题 -// list[]:选项 -// value[]:显示的值 -// onAdd:标记管理、只针对标记 -// searchFlag:是否显示搜索输入框 -// editFlag:是否有编辑按钮 -// double:可多选 -// onChange:选择项后返回id数组 -function EditMenus({ name , emptyName='未设置',list,value , onAdd , searchFlag , editFlag , searchFunc ,double , onChange , imgFlag}){ +/** + * + * @param name:显示的标题 + * @param names:选择下拉项后显示的内容 + * @param list[]:选项 + * @param emptyName:没有选择项时显示的内容 + * @param value[]:显示的值 + * @param onAdd:标记管理、只针对标记 + * @param searchFlag:是否显示搜索输入框 + * @param editFlag:是否有编辑按钮 + * @param double:可多选 + * @param onChange:选择项后返回id数组 + * @returns + */ +function EditMenus({ + name , + names, + emptyName='未设置', + list, + value , + onAdd , + searchFlag , + editFlag , + searchFunc , + double , + onChange , + imgFlag +}){ const [ menus , setMenus ] = useState([]); const [ searchValue , setSearchValue ]= useState(undefined); const [ showValue , setShowValue ] = useState(undefined); @@ -25,15 +44,9 @@ function EditMenus({ name , emptyName='未设置',list,value , onAdd , searchFla useEffect(()=>{ setMenus(list); - if(value && value.length>0 && list && list.length>0){ - let n = value.map(item=>{ - let n = list.filter(j=>j.id.toString() === item); - return n.length>0 && n[0].name; - }); - setValueId(value); - setShowValue(n.join(",")); - } - },[list,value]) + setValueId(value); + setShowValue(names && names.length >0 ? names : undefined); + },[names,value,list]) useEffect(() => { document.addEventListener('click', clickMe , false); @@ -58,46 +71,36 @@ function EditMenus({ name , emptyName='未设置',list,value , onAdd , searchFla let idStr = i && i.id ? i.id.toString() :i.name; // 分支列表没有id,只能根据name判断 if(double){ - if(l.indexOf(idStr)>=0){ + l = valueId || [] ; + let nameArr = names || [] ; + if(l && l.indexOf(idStr)>=0){ l = l.filter(k=>k.toString() !== idStr); + nameArr = nameArr.filter(k=>k.toString() !== i.name); }else{ - if(valueId.length > double){ + if(valueId && valueId.length >= double){ message.info(`最多只能添加${double}个${name}`); return; } l.push(idStr); + console.log(valueId,l,idStr); + nameArr.push(i.name); } setValueId(l); - console.log(l); - let nameList = i && i.id ? getByid(l) : getByName(l); - setShowValue(nameList.length >0 ? nameList.join(",") : undefined); - onChange(l); + setShowValue(nameArr); + onChange(l,nameArr); }else{ - if(l.indexOf(idStr)>=0){ + if(l && l.indexOf(idStr)>=0){ setValueId([]); onChange([]); setShowValue(undefined); }else{ setValueId([`${i.id || i.name}`]); - onChange([`${i.id || i.name}`]); + onChange([`${i.id || i.name}`],[i.name]); setShowValue(i.name); } } } - function getByid(l){ - return l.length>0 ? l.map(item=>{ - let n = list.filter(j=>j.id.toString() === item); - return n.length>0 && n[0].name; - }) :""; - } - function getByName(l){ - return l.length>0 ? l.map(item=>{ - let n = list.filter(j=>j.name === item); - return n.length>0 && n[0].name; - }) :""; - } - // 搜索 function changeSearchvalue(e){ setSearchValue(e.target.value); @@ -151,7 +154,7 @@ function EditMenus({ name , emptyName='未设置',list,value , onAdd , searchFla }
}> -

{showValue || emptyName}

+

{ (names && names.join(",")) || emptyName}

) diff --git a/src/forge/Issues/Component/menus.jsx b/src/forge/Issues/Component/menus.jsx index 9aab7e5ba..396d54f03 100644 --- a/src/forge/Issues/Component/menus.jsx +++ b/src/forge/Issues/Component/menus.jsx @@ -1,52 +1,90 @@ -import React ,{ useState , useRef } from 'react'; +import React ,{ useState , useRef , useEffect } from 'react'; import { Input , Menu , Icon } from 'antd'; import { getImageUrl } from 'educoder'; import Drop from './drop'; const { Search } = Input; -// name:未选择时显示的内容 -// lists:下拉列表,从接口获取,需一一填充 -// imgControl:控制是否显示头像 -// size:下拉框宽度,small:120px,large:260px; -// chooseValue: 默认选择的项的id -// search: 搜索方法 -// chooseFunc: 选择项后需调用列表的查询方法 -// update: 编辑状态 -function Menus({name, id , lists , size , imgControl , searchFunc , chooseFunc , update },ref){ +/** + * @param {name} 未选择时显示的内容 + * @param {lists} 下拉列表,从接口获取,需一一填充 + * @param {imgControl} 控制是否显示头像 + * @param {size} 下拉框宽度,small:120px,large:260px + * @param {ids} 默认选择的项的id数组 + * @param {search} 搜索方法 + * @param {chooseFunc} 选择项后需调用列表的查询方法 + * @param {update} 编辑状态 + * @param {double} 是否可以多选 + */ +function Menus({name, ids , lists , size , imgControl , searchFunc , chooseFunc , update , double ,names },ref){ const dropRef = useRef(null); + const [ chooseValue , setChooseValue ] = useState([]); + const [ showValue , setShowValue ] = useState(undefined); + + + useEffect(()=>{ + setChooseValue(ids); + setShowValue(names); + console.log(names); + },[ids,names]) // 修改menus数组里的字段值 - function changeMenusValue(value,id){ - chooseFunc(id,value); + function changeMenusValue(i){ + let l = ids; + let id = i.id.toString(); + if(double){ + l = ids ? ids.split(",") : [] ; + let nameArr = names ? names.split(",") : [] ; + if(l && l.indexOf(id)>=0){ + l = l.filter(k=>k.toString() !== id); + nameArr = nameArr.filter(k=>k.toString() !== i.name); + }else{ + l.push(id); + nameArr.push(i.name); + } + setChooseValue(l); + setShowValue(nameArr.join(",")); + chooseFunc(l,nameArr.join(",")); + }else{ + if(l && l.indexOf(id)>=0){ + setChooseValue([]); + setShowValue(undefined); + chooseFunc([]); + }else{ + setChooseValue([`${i.id}`]); + setShowValue([i.name]); + chooseFunc([id],i.name); + } + } dropRef.current && dropRef.current.clearVisible(false); } function menu(data){ return
{ size !== "small" && -
searchFunc(e.target.value)}/>
+
searchFunc(e.target.value)}/>
} { data && data.length>0 ? - + { data.map((i,j)=>{ return {imgControl && } - changeMenusValue(i.name,i.id)}>{i.name} + {i.color && } + changeMenusValue(i)}>{i.name} }) } : -
暂无{id ? '{name}': name}
+
暂无{ids ? '{name}': name}
}
} return( - {(update && !id) ? `更换${name}` : name } + {showValue || (update ? `更换${name}` : name) } ) diff --git a/src/forge/Issues/Component/newPanel.jsx b/src/forge/Issues/Component/newPanel.jsx new file mode 100644 index 000000000..9e74d50f9 --- /dev/null +++ b/src/forge/Issues/Component/newPanel.jsx @@ -0,0 +1,109 @@ +import React , { forwardRef , useState } from 'react'; +import {LongWidth } from '../../Component/layout'; +import { Form , Input , Button } from 'antd'; +import MDEditor from "../../../modules/tpm/challengesnew/tpm-md-editor"; +import Upload from "../../Upload/Index"; +import Attachments from "../../Upload/attachment"; +import UploadImg from '../Img/UploadImg.png'; + +function NewPanel(props,ref){ + const [ description , setDescription ] = useState(""); + const [ fileList , setFileList] = useState(undefined); + const [ attachments , setAttachments ] = useState([]); + const [ receivers_login , setReceiversLogin ] = useState(undefined); + + const { createFunc , title , desc , files , onCancel } = props; + + const { form: { getFieldDecorator, validateFields , setFieldsValue } } = props; + + useState(()=>{ + title && setTimeout(()=>{ + setFieldsValue({subject:title}); + },100) + desc && setDescription(desc); + files && setAttachments(files); + },[title , desc , files]) + + function onContentChange(value){ + setDescription(value); + } + function UploadFunc(f){ + let list = []; + if(files && files.length>0 ){ + let arr = files.map(i=>{return i.id}); + list = arr && arr.length>0 ? f.concat(arr) : f ; + } + console.log(list); + setFileList(list); + }; + function changeAtWhoLoginList(loginList){ + let list = new Set(receivers_login); + loginList.map(item => list.add(item)); + setReceiversLogin(Array.from(list)); + }; + + function sureFunc(){ + validateFields((error,values)=>{ + if (!error) { + createFunc(values,fileList,receivers_login,description); + } + }) + } + + function cancelFunc(){ + if(onCancel){ + onCancel(); + } + } + return( + +
+ + {getFieldDecorator("subject",{ + rules:[{required:true,message:"请输入疑修标题"}] + })( + + )} + +
+ +
+ + } + size={100} + showNotification={props.showNotification} + /> + {attachments && attachments.length > 0 && + + } +
+
+ + +
+
+ ) +} +export default forwardRef(NewPanel); diff --git a/src/forge/Issues/Pages/details.jsx b/src/forge/Issues/Pages/details.jsx index 801820617..c33417163 100644 --- a/src/forge/Issues/Pages/details.jsx +++ b/src/forge/Issues/Pages/details.jsx @@ -1,48 +1,323 @@ -import React from 'react'; -import { Tooltip } from 'antd'; +import React , { useEffect , useState , forwardRef } from 'react'; +import { Spin , Form } from 'antd'; +import { getImageUrl } from 'educoder'; import { Box , LongWidth } from '../../Component/layout'; +import RenderHtml from "../../../components/render-html"; import EditMenus from '../Component/editMenus'; import Add from '../Component/comments/add'; +import NewPanel from '../Component/newPanel'; +import Attachments from "../../Upload/attachment"; +import AddTagsBox from '../Component/addTagsBox'; +import DelBox from '../Component/delBox'; +import Date from '../Component/date'; +import moment from 'moment'; +import Copy from '../Component/copy'; +import axios from 'axios'; function Details(props){ + const [ details , setDetails ] = useState(undefined); const owner = props.match.params.owner; const projectsId = props.match.params.projectsId; const index = props.match.params.index; + + const [ statusList , setStatusList ] = useState([]); + const [ prioritiesList , setPrioritiesList ] = useState([]); + const [ chargeList , setChargeList ] = useState([]); + const [ charge , setCharge ] = useState(undefined); + const [ millstoneList , setMillstoneList ] = useState([]); + const [ millstone , setMillstone ] = useState(undefined); + const [ tagList , setTagList ] = useState(undefined); + const [ tag , setTag ] = useState(undefined); + const [ branchList , setBranchList ] = useState(undefined); + const [ branch , setBranch ] = useState(undefined); + + const [ charegeId , setCharegeId ] = useState([]); + const [ statusId , setStatusId ] = useState([`1`]); + const [ prioritiesId , setPrioritiesId ] = useState([`2`]); + const [ tagId , setTagId ] = useState([]); + const [ millstoneId , setMillstoneId ] = useState([]); + const [ branchId , setBranchId ] = useState([]); + + const [ names , setNames ] = useState({author_name:undefined,issue_priorities_name:undefined,issue_tag_name:undefined,milestone_name:undefined,sortby_name:undefined,status_name:undefined,assigner_name:undefined}); + + const [ visible , setVisible ] = useState(false); + const [ delVisible , setDelVisible] = useState(false); + const [ edit , setEdit] = useState(false); + + const [ start_date, setStartDate ] = useState(""); + const [ due_date, setDueDate ] = useState(""); + + useEffect(()=>{ + if(index){ + Init(); + } + },[index]) + + function Init(){ + const url = `/v1/${owner}/${projectsId}/issues/${index}`; + axios.get(url).then(result=>{ + if(result && result.data){ + let data = result.data; + setDetails(data); + let cIds = data.assigners && data.assigners.length>0 ? data.assigners.map((i)=>{return i.id.toString();}):undefined; + let cNames = data.assigners && data.assigners.length>0 ? data.assigners.map((i)=>{return i.name.toString();}):undefined; + setCharegeId(cIds); + setStatusId([`${data.status && data.status.id}`]); + setPrioritiesId([`${data.priority && data.priority.id}`]); + let tags = data.tags && data.tags.length>0 ? data.tags.map((i)=>{return i.id.toString();}):undefined; + let tagNames = data.tags && data.tags.length>0 ? data.tags.map((i)=>{return i.name.toString();}):undefined; + setTagId(tags); + setMillstoneId([`${data.milestone && data.milestone.id}`]) + setBranchId(data.branch_name && [data.branch_name]); + const n = { + issue_priorities_name:data.priority ? [`${data.priority.name}`]:undefined, + issue_tag_name:tagNames && [tagNames], + milestone_name:data.milestone ? [`${data.milestone.name}`]:undefined, + status_name:data.status ? [`${data.status.name}`]:undefined, + assigner_name:cNames && [cNames] + } + setNames(n); + data.start_date && setStartDate(moment(data.start_date).format('YYYY-MM-DD')); + data.start_date && setDueDate(moment(data.due_date).format('YYYY-MM-DD')); + } + }).catch(error=>{}) + } + + + function statusTag(name){ + switch (name) { + case "低": + return "status low"; + case "正常": + return "status normal"; + case "高": + return "status hight"; + default: + return "status urgent"; + } + } + // 获取状态列表 + useEffect(()=>{ + getStatus(); + },[]) + function getStatus(){ + const url = `/v1/${owner}/${projectsId}/issue_statues`; + axios.get(url).then(result=>{ + if(result && result.data){ + setStatusList(result.data.statues); + } + }) + } + // 获取优先级列表 + useEffect(()=>{ + getPriorities(); + },[]) + + function getPriorities(){ + const url = `/v1/${owner}/${projectsId}/issue_priorities`; + axios.get(url).then(result=>{ + if(result && result.data){ + setPrioritiesList(result.data.priorities); + } + }) + } + + // 获取负责人列表 + useEffect(()=>{ + getCharge(); + },[charge]) + + function getCharge(){ + const url = `/v1/${owner}/${projectsId}/collaborators`; + axios.get(url,{params:{keyword:charge,only_name:true}}).then(result=>{ + if(result && result.data){ + setChargeList(result.data.collaborators); + } + }) + } + // 获取里程碑列表 + useEffect(()=>{ + getMillstone(); + },[millstone]) + + function getMillstone(){ + const url = `/v1/${owner}/${projectsId}/milestones`; + axios.get(url,{params:{keyword:millstone,only_name:true}}).then(result=>{ + if(result && result.data){ + setMillstoneList(result.data.milestones); + } + }) + } + // 获取标记列表 + useEffect(()=>{ + getSign(); + },[tag]) + function getSign(){ + const url = `/v1/${owner}/${projectsId}/issue_tags`; + axios.get(url,{params:{keyword:tag,only_name:true}}).then(result=>{ + if(result && result.data){ + setTagList(result.data.issue_tags); + } + }) + } + // 获取标记列表 + useEffect(()=>{ + getBranch(branch); + },[branch]) + function getBranch(branch){ + if(branch){ + let b = [...branchList]; + let l = b.filter(i=>i.name.indexOf(branch)>-1); + setBranchList(l); + return ; + } + const url = `/${owner}/${projectsId}/branches.json`; + axios.get(url,{params:{keyword:tag}}).then(result=>{ + if(result && result.data){ + setBranchList(result.data); + } + }) + } + + function onSuccess(){ + getSign(); + setVisible(false); + } + + function saveForeach(c,s,p,t,m,b,sDate,eDate){ + const url = `/v1/${owner}/${projectsId}/issues/${index}`; + axios.patch(url,{ + branch_name: b ? b.join(",") :undefined, + status_id: s ? s.join(",") : undefined, + priority_id: p ? p.join(",") :undefined, + milestone_id: m ? m.join(",") :undefined, + issue_tag_ids: t?t:undefined, + assigner_ids: c?c:undefined, + start_date:sDate, + due_date:eDate + }).then(result=>{ + + }).catch(error=>{}) + } + + function deleteFunc(){ + const url = `/v1/${owner}/${projectsId}/issues/${index}`; + axios.delete(url).then(result=>{ + if(result){ + props.showNotification("疑修删除成功!"); + props.history.push(`/${owner}/${projectsId}/issues`); + } + }).catch(error=>{}) + } + + // 编辑保存 + function createFunc(values,fileList,receivers_login,description){ + const url = `/v1/${owner}/${projectsId}/issues/${index}`; + axios.patch(url,{ + subject: values.subject, + attachment_ids: fileList, + receivers_login: receivers_login, + description: description + }).then(result=>{ + if(result){ + props.showNotification("疑修更新成功!"); + Init(); + setEdit(false); + } + }).catch(error=>{}) + } + + return( + details ? -
-
-
- 正常 - #1 -
-
-

fork仓库向原仓库发起合并请求,查看文件跳转有误?

-
- 张嘉佳 - 添加于2022-09-27 13:59 -
-
+ setDelVisible(false)} + onSuccess={deleteFunc} + content={

您确定要删除当前疑修?

} + /> + setVisible(false)} onSuccess={onSuccess} + /> + { + edit ? +
+ setEdit(false)} + title={details.subject} + desc={details.description} + files={details.attachments} + createFunc={createFunc} + />
- -
-
+ : + +
+
+
+ {details.priority && { details.priority.name } } + #{details.project_issues_index} +
+
+

{details.subject}

+ { + details.author && +
+ {details.author.name} + 添加于{details.created_at} +
+ } +
+
+ { + details.user_permission && + + } +
+
+ {details.description ? + + : + 暂无描述 + } + {details.attachments && details.attachments.length > 0 ? + + : "" + } +
+
+ } + + {/*
-
+
*/}
- - - - - + {saveForeach(ids);let copyname = { ...names,assigner_name:name};setNames(copyname);setCharegeId(ids);}} list={chargeList} value={charegeId} searchFlag searchFunc={(value)=>{setCharge(value)}} double={5}/> + {setStatusId(ids);saveForeach(undefined,ids);let copyname = { ...names,status_name:name};setNames(copyname);}} list={statusList} value={statusId}/> + {setPrioritiesId(ids);saveForeach(undefined,undefined,ids);let copyname = { ...names,issue_priorities_name:name};setNames(copyname);}} list={prioritiesList} value={prioritiesId}/> + {setTagId(ids);saveForeach(undefined,undefined,undefined,ids);let copyname = { ...names,issue_tag_name:name};setNames(copyname);}} list={tagList} value={tagId} onAdd={()=>setVisible(true)} searchFlag double={3} searchFunc={(value)=>setTag(value)}/> + {setMillstoneId(ids);saveForeach(undefined,undefined,undefined,undefined,ids);let copyname = { ...names,milestone_name:name};setNames(copyname);}} value={millstoneId} list={millstoneList} searchFlag searchFunc={(value)=>setMillstone(value)}/> + {setBranchId(ids);saveForeach(undefined,undefined,undefined,undefined,undefined,ids);}} value={branchId} list={branchList} searchFlag searchFunc={(value)=>setBranch(value)}/> + {setStartDate(date);saveForeach(undefined,undefined,undefined,undefined,undefined,undefined,date)}}/> + {setDueDate(date);saveForeach(undefined,undefined,undefined,undefined,undefined,undefined,undefined,date)}}/>
+ : +
) } -export default Details; \ No newline at end of file +export default Form.create()(forwardRef(Details)); \ No newline at end of file diff --git a/src/forge/Issues/Pages/list.jsx b/src/forge/Issues/Pages/list.jsx index 455c2ae99..eb24c1778 100644 --- a/src/forge/Issues/Pages/list.jsx +++ b/src/forge/Issues/Pages/list.jsx @@ -35,6 +35,9 @@ function List(props){ const menuRef = useRef(null); const owner = props.match.params.owner; const projectsId = props.match.params.projectsId; + console.log(props && props.projectDetail); + const { permission } = props && props.projectDetail; + console.log(permission); useEffect(()=>{ @@ -146,6 +149,7 @@ function List(props){ params:{ids:allValue} }).then(result=>{ if(result){ + setAllValue([]); setVisible(false); props.showNotification("疑修删除成功!"); Init(); @@ -157,6 +161,7 @@ function List(props){ if(allValue && allValue.length>0){ // 将ids保存下来以便修改 setUpdateIds(ids); + console.log(ids); }else{ Init(ids); } @@ -183,7 +188,10 @@ function List(props){ 清除筛选条件
- 标记管理 + { + permission && permission !== "reporter" && + 标记管理 + } 创建疑修
diff --git a/src/forge/Issues/Pages/new.jsx b/src/forge/Issues/Pages/new.jsx index ec017a2b4..404373745 100644 --- a/src/forge/Issues/Pages/new.jsx +++ b/src/forge/Issues/Pages/new.jsx @@ -1,21 +1,15 @@ import React , { useEffect , useState , forwardRef } from 'react'; -import { Button, Input , Form } from 'antd'; +import { Form } from 'antd'; import { Box , LongWidth } from '../../Component/layout'; -import MDEditor from "../../../modules/tpm/challengesnew/tpm-md-editor"; -import Upload from "../../Upload/Index"; -import Attachments from "../../Upload/attachment"; -import UploadImg from '../Img/UploadImg.png'; import EditMenus from '../Component/editMenus'; import AddTagsBox from '../Component/addTagsBox'; import Date from '../Component/date'; +import NewPanel from '../Component/newPanel'; import axios from 'axios'; import moment from 'moment'; function New(props){ - const [ description , setDescription ] = useState(""); const [ visible , setVisible ] = useState(false); - const [ fileList , setFileList] = useState(undefined); - const [ attachments , setAttachments ] = useState([]); const [ statusList , setStatusList ] = useState([]); @@ -31,26 +25,38 @@ function New(props){ const [ charegeId , setCharegeId ] = useState([]); const [ statusId , setStatusId ] = useState([`1`]); + const [ names , setNames ] = useState({author_name:undefined,issue_priorities_name:["正常"],issue_tag_name:undefined,milestone_name:undefined,sortby_name:undefined,status_name:['新增'],assigner_name:undefined}); const [ prioritiesId , setPrioritiesId ] = useState([`2`]); const [ tagId , setTagId ] = useState([]); const [ millstoneId , setMillstoneId ] = useState([]); const [ branchId , setBranchId ] = useState([]); - const [ start_date, setStartDate ] = useState(moment().format('YYYY-MM-DD')); + const [ start_date, setStartDate ] = useState("");//moment().format('YYYY-MM-DD') const [ due_date, setDueDate ] = useState(""); - const [ receivers_login , setReceiversLogin ] = useState(undefined); const owner = props.match.params.owner; const projectsId = props.match.params.projectsId; - const { form: { getFieldDecorator, validateFields , setFieldsValue } } = props; + + + + // 更新网页标题 + function updateDocumentTitle(){ + // if(form_type === 'feedback'){ + // document.title = `意见反馈` + // }else if(form_type === 'new'){ + // document.title = `新建疑修-${author.name}/${name}` + // }else{ + // subject && (document.title = `${subject}-疑修-${author.name}/${name}`); + // } + } + // 获取状态列表 useEffect(()=>{ getStatus(); },[]) - function getStatus(){ const url = `/v1/${owner}/${projectsId}/issue_statues`; axios.get(url).then(result=>{ @@ -130,12 +136,6 @@ function New(props){ }) } - function onContentChange(value){ - setDescription(value); - } - function UploadFunc(fileList){ - setFileList(fileList); - }; // 标记管理弹框 function onSuccess(){ @@ -145,36 +145,27 @@ function New(props){ } // 创建 - function createFunc(){ - validateFields((error,values)=>{ - if (!error) { - const { subject } = values; - const url = `/v1/${owner}/${projectsId}/issues`; - axios.post(url,{ - description,subject, - branch_name:branchId.join(","), - status_id:statusId.join(","), - priority_id:prioritiesId.join(","), - milestone_id:millstoneId.join(","), - issue_tag_ids:tagId, - assigner_ids:charegeId, - attachment_ids:fileList, - start_date,due_date,receivers_login - }).then(result=>{ - if(result && result.data && result.data.project_issues_index){ - props.showNotification("任务创建成功!"); - props.history.push(`/${owner}/${projectsId}/issues/${result.data.project_issues_index}`); - } - }).catch(error=>{}) + function createFunc(values,fileList,receivers_login,description){ + const { subject } = values; + const url = `/v1/${owner}/${projectsId}/issues`; + axios.post(url,{ + description,subject, + branch_name:branchId.join(","), + status_id:statusId.join(","), + priority_id:prioritiesId.join(","), + milestone_id:millstoneId.join(","), + issue_tag_ids:tagId, + assigner_ids:charegeId, + attachment_ids:fileList, + start_date,due_date,receivers_login + }).then(result=>{ + if(result && result.data && result.data.project_issues_index){ + props.showNotification("任务创建成功!"); + props.history.push(`/${owner}/${projectsId}/issues/${result.data.project_issues_index}`); } - }) + }).catch(error=>{}) } - function changeAtWhoLoginList(loginList){ - let list = new Set(receivers_login); - loginList.map(item => list.add(item)); - setReceiversLogin(Array.from(list)); - }; return( @@ -188,60 +179,15 @@ function New(props){

新建疑修

-
- - {getFieldDecorator("subject",{ - rules:[{required:true,message:"请输入疑修标题"}] - })( - - )} - -
- -
- - } - size={100} - showNotification={props.showNotification} - /> - {attachments && attachments.length > 0 && - - } -
-
- - -
+
- setCharegeId(ids)} list={chargeList} searchFlag searchFunc={(value)=>setCharge(value)} double={5}/> - setStatusId(ids)} list={statusList} editFlag value={statusId}/> - setPrioritiesId(ids)} list={prioritiesList} value={prioritiesId}/> - setTagId(ids)} list={tagList} onAdd={()=>setVisible(true)} searchFlag double={3} searchFunc={(value)=>setTag(value)}/> - setMillstoneId(ids)} list={millstoneList} searchFlag searchFunc={(value)=>setMillstone(value)}/> - setBranchId(ids)} list={branchList} searchFlag searchFunc={(value)=>setBranch(value)}/> + {setCharegeId(ids);let copyname = { ...names,assigner_name:name};setNames(copyname);}} list={chargeList} searchFlag searchFunc={(value)=>setCharge(value)} double={5}/> + {setStatusId(ids);let copyname = { ...names,status_name:name};setNames(copyname);}} list={statusList} editFlag/> + {setPrioritiesId(ids);let copyname = { ...names,issue_priorities_name:name};setNames(copyname);}} list={prioritiesList}/> + {setTagId(ids);let copyname = { ...names,issue_tag_name:name};setNames(copyname);}} list={tagList} onAdd={()=>setVisible(true)} searchFlag double={3} searchFunc={(value)=>setTag(value)}/> + {setMillstoneId(ids);let copyname = { ...names,milestone_name:name};setNames(copyname);}} list={millstoneList} searchFlag searchFunc={(value)=>setMillstone(value)}/> + setBranchId(ids)} list={branchList} searchFlag searchFunc={(value)=>setBranch(value)}/> setStartDate(date)}/> setDueDate(date)}/>
diff --git a/src/forge/Issues/index.jsx b/src/forge/Issues/index.jsx index 991557e6c..ef13c7453 100644 --- a/src/forge/Issues/index.jsx +++ b/src/forge/Issues/index.jsx @@ -27,26 +27,26 @@ function Index(props){ ( - - )} - > - ( - + render={(p) => ( + )} > ( - + render={(p) => ( + + )} + > + ( + )} > ( - + render={(p) => ( + )} > diff --git a/src/forge/Issues/index.scss b/src/forge/Issues/index.scss index 1be819fcb..736c7f89a 100644 --- a/src/forge/Issues/index.scss +++ b/src/forge/Issues/index.scss @@ -290,6 +290,7 @@ text-align: center; display: block; margin-top: 14px; + cursor: pointer; } } // colorCard @@ -460,7 +461,7 @@ } .colorpiece{ display: block; - width: 22px; + width: 22px!important; height: 15px; margin-right: 9px; border-radius:2px; @@ -500,11 +501,11 @@ //详情页面 .detailbanner{ margin-top: 25px; - height:82px; + // height:82px; background-color:#fafcff; border:1px solid rgba(42, 97, 255, 0.23); border-radius:4px; - padding:0px 25px 0px 20px; + padding:12px 25px 12px 20px; display: flex; align-items: center; justify-content: space-between; @@ -514,9 +515,9 @@ font-size: 16px; font-weight: 700; color:#333; - height: 22px; line-height: 22px; margin-bottom: 9px!important; + max-width: 580px; } .author{ img{ diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index bfcc0c76b..58cb504ab 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -742,11 +742,11 @@ class Detail extends Component { } > {/* 标签列表 */} - () } - > + > */} {/* 仓库设置 */} */} {/* 修改详情 edit*/} - () } - > + > */} {/* 复制详情 copyetail*/} - () } - > + > */} {/* 任务详情 */} {/*