projectInside.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. <template>
  2. <div>
  3. <van-nav-bar :title="projectDetail.projectName ? projectDetail.projectName : '-'" left-text="返回" @click-left="back" fixed left-arrow :right-text="active == 1 && (projectManagement || user.id==projectDetail.inchargerId || user.id==projectDetail.creatorId) ? '编辑项目' : ''" @click-right="openProject()" />
  4. <div class="content">
  5. <!-- <van-cell><div style="width:100%;text-align:center;font-size:120%">{{projectDetail.projectName ? projectDetail.projectName : '-'}}</div></van-cell> -->
  6. <van-tabs v-model="active" @change="activeChange">
  7. <!-- 任务看板 -->
  8. <van-tab title="任务看板">
  9. <van-cell title="任务分组" :value="inside.taskGroup.active?inside.taskGroup.active.name:''" @click="inside.taskGroup.show = true"></van-cell>
  10. <van-popup v-model="inside.taskGroup.show" position="bottom">
  11. <van-picker
  12. show-toolbar
  13. :columns="inside.taskGroup.list"
  14. @confirm="taskGroupChange"
  15. @cancel="inside.taskGroup.show = false;$forceUpdate();">
  16. <template #option="item">
  17. <span>{{item.name}}</span>
  18. </template>
  19. </van-picker>
  20. </van-popup>
  21. <van-cell title="任务列表" :value="inside.stages.active?inside.stages.active.stagesName:''" @click="inside.stages.show = true"></van-cell>
  22. <van-popup v-model="inside.stages.show" position="bottom">
  23. <van-picker
  24. show-toolbar
  25. :columns="inside.stages.list"
  26. @confirm="stagesChange"
  27. @cancel="inside.stages.show = false;$forceUpdate();">
  28. <template #option="item">
  29. <span>{{item.stagesName}}</span>
  30. </template>
  31. </van-picker>
  32. </van-popup>
  33. <!-- <van-cell value-class="addtaskvalue">
  34. <van-button plain type="info" class="addtaskbutton" @click="toEditask(null)">新建任务</van-button>
  35. </van-cell> -->
  36. <van-icon name="add-o" class="addtaskicon" @click="toEditask(null)" />
  37. <div class="taskList">
  38. <van-cell v-for="item in inside.taskList" :key="item.id">
  39. <div style="line-height:0.8rem">任务名称:{{item.name}}</div>
  40. <div style="line-height:0.8rem">起止时间:
  41. <span v-if="item.startDate && item.endDate">{{(item.startDate ? item.startDate : ' - ') + '\u3000至\u3000' + (item.endDate ? item.endDate : ' - ')}}</span>
  42. <span v-else></span>
  43. </div>
  44. <div class="task_button">
  45. <van-button size="small" type="danger" v-if="user.id == item.creatorId || user.id == projectDetail.creatorId ||user.id == projectDetail.inchargerId || projectManagement" @click="taskDelete(item)">删除</van-button>
  46. <van-button size="small" type="info" @click="toEditask(item.id)">编辑</van-button>
  47. <van-button size="small" type="primary" @click="taskStatus(item.id,0,item)" v-if="item.taskStatus == 0">完成</van-button>
  48. <van-button size="small" color="#e6a23c" @click="taskStatus(item.id,1,item)" v-if="item.taskStatus == 1">重启</van-button>
  49. </div>
  50. </van-cell>
  51. </div>
  52. </van-tab>
  53. <!-- 项目概览 -->
  54. <van-tab title="项目概览">
  55. <!-- 基本信息 -->
  56. <van-cell>
  57. <van-row>
  58. <van-col span="7">项目名称:</van-col>
  59. <van-col span="17">{{projectDetail.projectName}}</van-col>
  60. </van-row>
  61. </van-cell>
  62. <van-cell>
  63. <van-row>
  64. <van-col span="7">项目分类:</van-col>
  65. <van-col span="17">{{projectDetail.categoryName}}</van-col>
  66. </van-row>
  67. </van-cell>
  68. <van-cell>
  69. <van-row>
  70. <van-col span="7">项目编号:</van-col>
  71. <van-col span="17">{{projectDetail.projectCode}}</van-col>
  72. </van-row>
  73. </van-cell>
  74. <van-cell>
  75. <van-row>
  76. <van-col span="7">项目描述:</van-col>
  77. <van-col span="17">{{projectDetail.projectDesc}}</van-col>
  78. </van-row>
  79. </van-cell>
  80. <van-cell v-if="user.timeType.projectWithDept == 1">
  81. <van-row>
  82. <van-col span="7">所属部门:</van-col>
  83. <van-col span="17">
  84. <span v-if="user.userNameNeedTranslate != 1">{{projectDetail.departmentName}}</span>
  85. <span v-else><ww-open-data type='departmentName' :openid='projectDetail.departmentName'></ww-open-data></span>
  86. </van-col>
  87. </van-row>
  88. </van-cell>
  89. <van-cell>
  90. <van-row>
  91. <van-col span="7">状态:</van-col>
  92. <van-col span="17">{{projectDetail.status == null ? '-' : info.statusText[projectDetail.status]}}</van-col>
  93. </van-row>
  94. </van-cell>
  95. <van-cell v-if="user.company.packageEngineering == 0">
  96. <van-row>
  97. <van-col span="7">完成度:</van-col>
  98. <van-col span="17">{{projectDetail.progress}}%</van-col>
  99. </van-row>
  100. </van-cell>
  101. <van-cell>
  102. <van-row>
  103. <van-col span="7">合同金额:</van-col>
  104. <van-col span="17">¥{{projectDetail.contractAmount == null ? '-' : projectDetail.contractAmount.toFixed(2)}}</van-col>
  105. </van-row>
  106. </van-cell>
  107. <van-cell>
  108. <van-row>
  109. <van-col span="7">项目级别:</van-col>
  110. <van-col span="17">{{levelToText(projectDetail.level)}}</van-col>
  111. </van-row>
  112. </van-cell>
  113. <van-cell>
  114. <van-row>
  115. <van-col span="7">创建日期:</van-col>
  116. <van-col span="17">{{projectDetail.createDate}}</van-col>
  117. </van-row>
  118. </van-cell>
  119. <van-cell>
  120. <van-row>
  121. <van-col span="7">计划开始日期:</van-col>
  122. <van-col span="17">{{projectDetail.planStartDate == null ? '-' : projectDetail.planStartDate}}</van-col>
  123. </van-row>
  124. </van-cell>
  125. <van-cell>
  126. <van-row>
  127. <van-col span="7">计划结束日期:</van-col>
  128. <van-col span="17">{{projectDetail.planEndDate == null ? '-' : projectDetail.planEndDate}}</van-col>
  129. </van-row>
  130. </van-cell>
  131. <van-cell>
  132. <van-row>
  133. <van-col span="7">实际完成日期:</van-col>
  134. <van-col span="17">{{projectDetail.finishDate == null ? '-' : projectDetail.finishDate}}</van-col>
  135. </van-row>
  136. </van-cell>
  137. <van-cell v-if="user.timeType.outputValueStatus == 1">
  138. <van-row>
  139. <van-col span="7">项目产值:</van-col>
  140. <van-col span="17">¥{{projectDetail.outputValue == null ? '-' : projectDetail.outputValue.toFixed(2)}}</van-col>
  141. </van-row>
  142. </van-cell>
  143. <!-- 威派格 -->
  144. <template v-if="user.companyId == 936">
  145. <van-cell>
  146. <van-row>
  147. <van-col span="7">合同编号:</van-col>
  148. <van-col span="17">{{projectDetail.projectSeparate.contractCode ? projectDetail.projectSeparate.contractCode : '-'}}</van-col>
  149. </van-row>
  150. </van-cell>
  151. <van-cell>
  152. <van-row>
  153. <van-col span="7">质保开始时间:</van-col>
  154. <van-col span="17">{{projectDetail.projectSeparate.warrantyStartDate == null ? '-' : projectDetail.projectSeparate.warrantyStartDate}}</van-col>
  155. </van-row>
  156. </van-cell>
  157. <van-cell>
  158. <van-row>
  159. <van-col span="7">质保截至时间:</van-col>
  160. <van-col span="17">{{projectDetail.projectSeparate.warrantyEndDate == null ? '-' : projectDetail.projectSeparate.warrantyEndDate}}</van-col>
  161. </van-row>
  162. </van-cell>
  163. <van-cell>
  164. <van-row>
  165. <van-col span="7">自主项目类别:</van-col>
  166. <van-col span="17">{{projectDetail.projectSeparate.projectCategorySub}}</van-col>
  167. </van-row>
  168. </van-cell>
  169. <van-cell>
  170. <van-row>
  171. <van-col span="7">所属大区:</van-col>
  172. <van-col span="17">{{projectDetail.projectSeparate.region}}</van-col>
  173. </van-row>
  174. </van-cell>
  175. <van-cell>
  176. <van-row>
  177. <van-col span="7">所属BU:</van-col>
  178. <van-col span="17">{{projectDetail.projectSeparate.bu}}</van-col>
  179. </van-row>
  180. </van-cell>
  181. </template>
  182. <!-- 长沙晶易科技 -->
  183. <template v-if="user.companyId == 428">
  184. <van-cell>
  185. <van-row>
  186. <van-col span="7">项目分组:</van-col>
  187. <van-col span="17">{{projectDetail.projectSeparate.projectCategorySub ? projectDetail.projectSeparate.projectCategorySub : '-'}}</van-col>
  188. </van-row>
  189. </van-cell>
  190. </template>
  191. <!-- 相关人员 -->
  192. <van-cell>
  193. <van-row>
  194. <van-col span="7">项目经理:</van-col>
  195. <van-col span="17">
  196. <span v-if="user.userNameNeedTranslate != 1">{{projectDetail.inchargerName}}</span>
  197. <span v-else><ww-open-data type='userName' :openid='projectDetail.inchargerName'></ww-open-data></span>
  198. </van-col>
  199. </van-row>
  200. </van-cell>
  201. <van-cell>
  202. <van-row>
  203. <van-col span="7">日报审核人:</van-col>
  204. <van-col span="17" v-if="projectDetail.auditorList && projectDetail.auditorList.length != 0">
  205. <span v-for="item,index in projectDetail.auditorList" :key="item.id">
  206. <span v-if="index != 0">,</span>
  207. <span v-if="user.userNameNeedTranslate != 1">{{item.auditorName}}</span>
  208. <span v-else><ww-open-data type='userName' :openid='item.auditorName'></ww-open-data></span>
  209. </span>
  210. </van-col>
  211. <van-col span="17" v-else>-</van-col>
  212. </van-row>
  213. </van-cell>
  214. <van-cell v-if="projectDetail.isPublic == 0">
  215. <van-row>
  216. <van-col span="7">参与人:</van-col>
  217. <van-col span="17">
  218. <span v-for="item,index in projectDetail.participationList" :key="item.id">
  219. <span v-if="index != 0">,</span>
  220. <span v-if="user.userNameNeedTranslate != 1">{{item.name}}</span>
  221. <span v-else><ww-open-data type='userName' :openid='item.name'></ww-open-data></span>
  222. </span>
  223. </van-col>
  224. </van-row>
  225. </van-cell>
  226. </van-tab>
  227. </van-tabs>
  228. </div>
  229. </div>
  230. </template>
  231. <script>
  232. export default {
  233. data() {
  234. return {
  235. user: JSON.parse(localStorage.userInfo),
  236. projectManagement: false,
  237. projectId: JSON.parse(sessionStorage.projectId),
  238. projectDetail: {},
  239. active: 0,
  240. inside:{ // 任务看板
  241. taskGroup:{ // 任务分组
  242. show: false,
  243. active: null,
  244. list: []
  245. },
  246. stages:{ // 任务列表
  247. show: false,
  248. active: null,
  249. list: []
  250. },
  251. taskList: []
  252. },
  253. info:{ // 项目概览
  254. statusText: ['全部','进行中','已完成','撤销'],
  255. levelList: [],
  256. levelText: ['全部','正常','紧急','重要','重要且紧急'],
  257. }
  258. }
  259. },
  260. mounted() {
  261. // console.log('project',this.project);
  262. for(let i in this.user.functionList){
  263. if(this.user.functionList[i].name == '管理全部项目'){
  264. this.projectManagement = true
  265. }
  266. }
  267. this.getProjectDetail()
  268. this.getLevelList()
  269. this.getTaskGroupList()
  270. },
  271. methods: {
  272. back() {
  273. history.back();
  274. },
  275. activeChange(name,title){
  276. // console.log('activeChange',name,title);
  277. },
  278. // 任务看板
  279. taskGroupChange(value,key){ // 任务分组
  280. // console.log('taskGroupChange',value,key);
  281. this.inside.taskGroup.active = value
  282. this.inside.taskGroup.show = false
  283. this.getStagesList()
  284. },
  285. stagesChange(value,key){ // 任务列表
  286. // console.log('stagesChange',value,key);
  287. this.inside.stages.active = value
  288. this.inside.stages.show = false
  289. this.inside.taskList = value.taskList
  290. },
  291. // 新建/编辑任务
  292. toEditask(taskid){
  293. let item
  294. if(taskid == null){
  295. item = {
  296. addNew: true,
  297. id: null,
  298. groupId: this.inside.taskGroup.active.id,
  299. stagesId: this.inside.stages.active.id
  300. }
  301. }else{
  302. item = {
  303. addNew: false,
  304. id: taskid,
  305. groupId: null,
  306. stagesId: null
  307. }
  308. }
  309. sessionStorage.setItem('taskId',JSON.stringify(item))
  310. this.$router.push("/editask");
  311. },
  312. taskStatus(taskid,status,taskitem){ // 改变任务状态
  313. this.$axios.post("/task/finish", {
  314. id: taskid,
  315. taskStatus: status
  316. }).then(res => {
  317. if(res.code == "ok") {
  318. this.$toast.success('操作成功');
  319. taskitem.taskStatus = status ? 0 : 1
  320. } else {
  321. this.$toast.fail('获取失败');
  322. }
  323. }).catch(err=> {this.$toast.clear();console.log(err)});
  324. },
  325. taskDelete(taskitem){
  326. this.$dialog.confirm({
  327. title: '提示',
  328. message: taskitem.subTaskList.length > 0 ? '您确定删除当前任务及其子任务吗?' : '您确定删除当前任务吗?'
  329. }).then(()=>{
  330. this.$axios.post("/task/delete", {id: taskitem.id})
  331. .then(res => {
  332. if(res.code == "ok") {
  333. this.$toast.success('删除成功');
  334. this.inside.taskList = this.inside.taskList.filter(item => item.id != taskitem.id)
  335. } else {
  336. this.$toast.fail('操作失败');
  337. }
  338. }).catch(err=> {this.$toast.clear();console.log(err)});
  339. }).catch(()=>{})
  340. },
  341. openProject(){
  342. if(this.active == 1 && (this.projectManagement || this.user.id==this.projectDetail.inchargerId || this.user.id==this.projectDetail.creatorId)){
  343. this.$router.push("/editProject");
  344. }
  345. },
  346. getTaskGroupList(){ // 任务分组列表
  347. this.$axios.post("/task-group/list", {
  348. projectId:this.projectId
  349. }).then(res => {
  350. if(res.code == "ok") {
  351. this.inside.taskGroup.list = res.data
  352. this.inside.taskGroup.active = res.data[0]
  353. this.getStagesList()
  354. } else {
  355. this.$toast.fail('获取失败');
  356. }
  357. }).catch(err=> {this.$toast.clear();console.log(err)});
  358. },
  359. getStagesList(){ // 任务列表
  360. this.$axios.post("/stages/list", {
  361. groupId: this.inside.taskGroup.active.id,
  362. projectId: this.projectId,
  363. order: 'seq',
  364. isDesc: false
  365. }).then(res => {
  366. if(res.code == "ok") {
  367. this.inside.stages.list = res.data.list
  368. this.inside.stages.active = res.data.list[0]
  369. this.inside.taskList = res.data.list[0].taskList
  370. } else {
  371. this.$toast.fail('获取失败');
  372. }
  373. }).catch(err=> {this.$toast.clear();console.log(err)});
  374. },
  375. // 项目概览
  376. getProjectDetail(){
  377. this.$axios.post("/project/detail", {id: this.projectId})
  378. .then(res => {
  379. if(res.code == "ok") {
  380. this.projectDetail = res.data
  381. } else {
  382. this.$toast.fail('获取失败');
  383. }
  384. }).catch(err=> {this.$toast.clear();console.log(err)});
  385. },
  386. levelToText(lev){
  387. console.log('levelToText',lev,this.info.levelList,this.info.levelList.filter(item => item.id == lev));
  388. if(this.user.timeType.projectLevelState == 1){
  389. if(this.info.levelList.filter(item => item.id == lev).length == 0){
  390. return this.info.levelText[lev]
  391. }
  392. return this.info.levelList.filter(item => item.id == lev)[0].projectLevelName
  393. }else{
  394. return this.info.levelText[lev]
  395. }
  396. },
  397. getLevelList(){ // 自定义项目级别
  398. this.$axios.post("/project-level/list", {})
  399. .then(res => {
  400. if(res.code == "ok") {
  401. this.info.levelList = res.data
  402. } else {
  403. this.$toast.fail('获取失败');
  404. }
  405. }).catch(err=> {this.$toast.clear();console.log(err)});
  406. }
  407. },
  408. }
  409. </script>
  410. <style lang="less" scoped>
  411. .content{
  412. margin-top: 46px;
  413. overflow: auto;
  414. .addtaskvalue{
  415. text-align: center;
  416. .addtaskbutton{
  417. width: 70%;
  418. height: 30px;
  419. }
  420. }
  421. .addtaskicon{
  422. opacity: 0.5;
  423. position: fixed;
  424. z-index: 1000;
  425. font-size: 50px;
  426. color: #1989fa;
  427. background-color: #fff;
  428. border-radius: 50%;
  429. bottom: 33px;
  430. right: 33px;
  431. }
  432. .task_button{
  433. padding-top: .09rem;
  434. text-align: right;
  435. button{
  436. margin-left: .2667rem;
  437. }
  438. }
  439. }
  440. </style>