courseProgress.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <div v-loading="loading" class="box">
  3. <!-- <el-button type="primary" size="small" class="returnBtn" @click="retrunA()">返回</el-button> -->
  4. <!-- <div v-if="cPan == 2" class="noneClass">项目数据不完善,无法显示数据,请前去完善</div> -->
  5. <div class="proMan" v-if="cPan == 1">
  6. <div class="title"><img src="../../assets/icon/task.png" alt />任务进展甘特图</div>
  7. <ganChart :Json="unitJson"></ganChart>
  8. </div>
  9. <div class="proMan">
  10. <div class="title"><img src="../../assets/icon/tupu.png" alt />图谱</div>
  11. <graph :Json="graphJson"></graph>
  12. </div>
  13. <div class="proMan" v-if="cPan == 1">
  14. <div class="title"><img src="../../assets/icon/proMan.png" alt />负责人看板</div>
  15. <proMan :Json="unitJson" :ManAarray="ManAarray"></proMan>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. import proMan from "../components/proMan.vue"
  21. import ganChart from "../components/ganChart.vue"
  22. import graph from "../components/graph.vue"
  23. export default {
  24. components: { proMan, ganChart, graph },
  25. props:['cid','userid','oid','org'],
  26. data() {
  27. return {
  28. loading: false,
  29. unitJson: {},
  30. cPan: 1,
  31. teacherJuri2: [],
  32. ManAarray: [],
  33. checkboxList3: [],
  34. courseUserid: "",
  35. graphJson: {}
  36. }
  37. },
  38. methods: {
  39. retrunA() {
  40. this.$router.go(-1)
  41. },
  42. getCourse() {
  43. let params = {
  44. cid: this.cid,
  45. };
  46. this.ajax
  47. .get(this.$store.state.api + "select_studio_course_detail", params)
  48. .then((res) => {
  49. this.unitJson = JSON.parse(res.data[0][0].chapters);
  50. this.courseUserid = res.data[0][0].userid;
  51. this.checkboxList3 = res.data[0][0].course_teacher
  52. ? res.data[0][0].course_teacher.split(",")
  53. : [];
  54. this.cPan = 1;
  55. for (var i = 0; i < this.unitJson.length; i++) {
  56. for (
  57. var j = 0;
  58. j < this.unitJson[i].chapterInfo[0].taskJson.length;
  59. j++
  60. ) {
  61. // if (
  62. // !this.unitJson[i].chapterInfo[0].taskJson[j].task
  63. // ) {
  64. // // this.$message.error("请填写任务名称");
  65. // this.cPan = 2
  66. // break;
  67. // }
  68. // if (
  69. // !this.unitJson[i].chapterInfo[0].taskJson[j].people
  70. // ) {
  71. // // this.$message.error("请填写负责人");
  72. // this.cPan = 2
  73. // break;
  74. // }
  75. // if (
  76. // !this.unitJson[i].chapterInfo[0].taskJson[j].time
  77. // ) {
  78. // // this.$message.error("请填写任务完成时间");
  79. // this.cPan = 2
  80. // break;
  81. // }
  82. if (this.unitJson[i].chapterInfo[0].taskJson[j].eList) {
  83. this.unitJson[i].chapterInfo[0].taskJson[j].eList = this.unitJson[
  84. i
  85. ].chapterInfo[0].taskJson[j].eList.filter((ele) => {
  86. return ele.value != "";
  87. });
  88. }
  89. }
  90. }
  91. this.getTeacher(res.data[0][0]);
  92. })
  93. .catch((err) => {
  94. console.error(err);
  95. });
  96. },
  97. setGraphJson(json) {
  98. let chapters = JSON.parse(json.chapters)
  99. let gjson = {
  100. rootId: 'pid',
  101. nodes: [
  102. { id: 'pid', text: '', borderWidth: -1, color: '#128cff' },
  103. ],
  104. lines: [
  105. ]
  106. }
  107. gjson.nodes[0].text = json.title
  108. for (var i = 0; i < chapters.length; i++) {
  109. let _chapter = chapters[i]
  110. gjson.nodes.push({ id: 'chap' + i, text: '阶段' + (i + 1) + '-' + _chapter.dyName, borderWidth: -1, color: '#0672e1' })
  111. gjson.lines.push({ from: 'pid', to: 'chap' + i })
  112. let tasks = _chapter.chapterInfo[0].taskJson
  113. for (var j = 0; j < tasks.length; j++) {
  114. let _task = tasks[j]
  115. gjson.nodes.push({ id: 'task' + i + '-' + j, text: '任务' + (j + 1) + '-' + _task.task, borderWidth: -1, color: '#3c59da' })
  116. gjson.lines.push({ from: 'chap' + i, to: 'task' + i + '-' + j })
  117. if (_task.people) {
  118. let _people = '负责人-' + this.getGMan(_task.people)
  119. gjson.nodes.push({ id: 'people' + i + '-' + j, text: _people, borderWidth: -1, color: '#004d9b' })
  120. gjson.lines.push({ from: 'task' + i + '-' + j, to: 'people' + i + '-' + j })
  121. if (_task.tcMember && _task.tcMember.length) {
  122. for (var tc = 0; tc < _task.tcMember.length; tc++) {
  123. let _tc = this.getGMan(_task.tcMember[tc])
  124. if (_tc) {
  125. gjson.nodes.push({ id: 'tc' + i + '-' + j + '-' + tc, text: _tc, borderWidth: -1, color: '#53c5fb' })
  126. gjson.lines.push({ from: 'people' + i + '-' + j, to: 'tc' + i + '-' + j + '-' + tc })
  127. }
  128. }
  129. }
  130. }
  131. }
  132. }
  133. this.graphJson = gjson
  134. },
  135. getGMan(people) {
  136. let _people = ''
  137. if (this.ManAarray.length) {
  138. for (var i = 0; i < this.ManAarray.length; i++) {
  139. if (this.ManAarray[i].userid == people) {
  140. _people = this.ManAarray[i].name;
  141. break;
  142. }
  143. }
  144. }
  145. return _people ? _people : '无'
  146. },
  147. getTeacher(sss) {
  148. this.ManAarray = []
  149. if (this.checkboxList3.indexOf(this.courseUserid) == -1) {
  150. this.checkboxList3.push(this.courseUserid)
  151. }
  152. let params = {
  153. uid: this.checkboxList3.join(","),
  154. };
  155. this.ajax
  156. .get(
  157. this.$store.state.api + "getAllUserById",
  158. params
  159. )
  160. .then((res) => {
  161. let teacherJuri = res.data[0];
  162. this.ManAarray = teacherJuri;
  163. this.setGraphJson(sss)
  164. this.setMan();
  165. })
  166. .catch((err) => {
  167. console.error(err);
  168. });
  169. },
  170. setMan() {
  171. // let teacherJuri = this.teacherJuri2;
  172. // debugger
  173. // this.ManAarray = []
  174. // for (var i = 0; i < teacherJuri.length; i++) {
  175. // if (teacherJuri[i].userid == this.userid) {
  176. // this.ManAarray.push(teacherJuri[i])
  177. // } else if (this.checkboxList3.indexOf(teacherJuri[i].userid) != -1) {
  178. // this.ManAarray.push(teacherJuri[i])
  179. // }
  180. // }
  181. this.loading = false;
  182. },
  183. },
  184. mounted() {
  185. this.loading = true;
  186. this.getCourse();
  187. },
  188. }
  189. </script>
  190. <style scoped>
  191. .returnBtn {
  192. position: fixed;
  193. right: 20px;
  194. top: 15px;
  195. z-index: 99999;
  196. }
  197. .noneClass {
  198. margin-top: 10px;
  199. display: flex;
  200. justify-content: center;
  201. font-size: 20px;
  202. font-weight: 700;
  203. }
  204. .box {
  205. background: #fff;
  206. height: 100%;
  207. width: 100%;
  208. overflow: auto;
  209. }
  210. .proMan {
  211. width: 95%;
  212. margin: 0 auto;
  213. padding: 20px 0 20px;
  214. /* margin-top: 20px; */
  215. }
  216. .proMan .title {
  217. margin-bottom: 10px;
  218. display: flex;
  219. align-items: center;
  220. }
  221. .proMan .title img {
  222. margin-right: 5px;
  223. height: 17px;
  224. width: 17px;
  225. }
  226. </style>