projectInside.vue 18 KB

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