projectInside.vue 20 KB

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