projectInside.vue 19 KB

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