projectInside.vue 22 KB

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