index.vue 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636
  1. <template>
  2. <div class="body1" v-loading="isLoading">
  3. <!-- 课程数据 -->
  4. <div class="left">
  5. <div class="top">
  6. <div class="titleBox" style="justify-content: space-between">
  7. <div class="title">基础概况</div>
  8. <!-- <el-select v-model="cType7" class="selectBox" style="width: 110px">
  9. <el-option label="全部课程" value="全部课程"></el-option>
  10. </el-select> -->
  11. </div>
  12. <div class="dataBox">
  13. <div class="info_box">
  14. <div class="info blueBG">
  15. <span>课程总数</span>
  16. <!-- <span>{{ count }}</span> -->
  17. <span>{{ allCourse }}</span>
  18. </div>
  19. <div class="info blueBG">
  20. <span>本月新增课程环比</span>
  21. <span v-if="loginCountMonthArray.length">{{ (loginCountMonthArray[loginCountMonthArray.length - 1].course) >
  22. 0 ? (((loginCountMonthArray[loginCountMonthArray.length - 1].course) / allCourse) * 100).toFixed(0) + '%'
  23. : 0 }}</span>
  24. <!-- <span>{{ weekCount }}</span> -->
  25. <!-- <span v-if="loginCountMonthArray.length">{{
  26. loginCountMonthArray[loginCountMonthArray.length - 1].course -
  27. loginCountMonthArray[loginCountMonthArray.length - 2].course < 0 ? 0 : (
  28. ((loginCountMonthArray[loginCountMonthArray.length - 1].course -
  29. loginCountMonthArray[loginCountMonthArray.length - 2].course) / (allCourse -
  30. loginCountMonthArray[loginCountMonthArray.length - 1].course)) * 100).toFixed(0) + "%" }}</span> -->
  31. </div>
  32. <div class="info blueBG">
  33. <span>模板课程总数</span>
  34. <span>{{ 0 }}</span>
  35. <!-- <span>{{ courseTemplate }}</span> -->
  36. </div>
  37. <div class="info blueBG">
  38. <span>本月新增课程总数</span>
  39. <!-- <span>{{ weekCount }}</span> -->
  40. <span v-if="loginCountMonthArray.length">{{
  41. loginCountMonthArray[loginCountMonthArray.length - 1].course
  42. }}</span>
  43. </div>
  44. </div>
  45. <TeaFre style="height: calc(100% - 140px)" :monthArray="loginCountMonthArray"></TeaFre>
  46. </div>
  47. </div>
  48. <div class="bottom">
  49. <div class="titleBox">
  50. <div class="title" :class="{ isClick: skType == 0 }" @click="skType = 0"
  51. style="cursor: pointer; padding: 0 0 5px 0">
  52. 授课时长
  53. </div>
  54. <div class="title" :class="{ isClick: skType == 1 }" @click="skType = 1"
  55. style="cursor: pointer; padding: 0 0 5px 0">
  56. 作业数量
  57. </div>
  58. <el-select v-if="skType == 0" v-model="lType" @change="typeChange1" class="selectBox" style="margin-left: auto">
  59. <!-- <el-option label="全部" value="all"></el-option> -->
  60. <el-option label="年级" value="grade"></el-option>
  61. <el-option label="主题" value="theme"></el-option>
  62. <el-option label="学科" value="subject"></el-option>
  63. </el-select>
  64. <el-select v-if="skType == 1" v-model="lType1" @change="typeChange2" class="selectBox"
  65. style="margin-left: auto">
  66. <!-- <el-option label="全部" value="all"></el-option> -->
  67. <el-option label="年级" value="grade"></el-option>
  68. <el-option label="主题" value="theme"></el-option>
  69. <el-option label="学科" value="subject"></el-option>
  70. </el-select>
  71. <!-- <el-select v-model="cType" class="selectBox" style="width: 110px">
  72. <el-option label="全部年级" value="全部年级"></el-option>
  73. <el-option label="一年级" value="一年级"></el-option>
  74. <el-option label="二年级" value="二年级"></el-option>
  75. <el-option label="三年级" value="三年级"></el-option>
  76. </el-select>
  77. <div class="timeDiv">
  78. <div @click="tType = 0" :class="{ isClick: tType == 0 }">周</div>
  79. <div @click="tType = 1" :class="{ isClick: tType == 1 }">月</div>
  80. <div @click="tType = 2" :class="{ isClick: tType == 2 }">学期</div>
  81. </div> -->
  82. </div>
  83. <div class="dataBox">
  84. <div class="info_box" style="width: 96%" v-if="skType == 0">
  85. <div class="info blueBG" style="width: calc(100% / 3 - 10px)">
  86. <span>累计时长</span>
  87. <!-- <span>{{ count }}</span> -->
  88. <span>{{ allTime }}</span>
  89. </div>
  90. <div class="info blueBG" style="width: calc(100% / 3 - 10px)">
  91. <span>课程实施总数</span>
  92. <!-- <span>{{ weekCount }}</span> -->
  93. <span>{{ courseLength }}</span>
  94. </div>
  95. <div class="info blueBG" style="width: calc(100% / 3 - 10px)">
  96. <span>课均时长</span>
  97. <!-- <span>{{ weekCount }}</span> -->
  98. <span>{{
  99. allTime == 0 ? 0 : (allTime / courseLength).toFixed(0)
  100. }}</span>
  101. </div>
  102. </div>
  103. <div class="info_box" style="width: 96%" v-if="skType == 1">
  104. <div class="info blueBG" style="width: calc(100% / 3 - 10px)">
  105. <span>作业数量</span>
  106. <!-- <span>{{ count }}</span> -->
  107. <span>{{ worksCount }}</span>
  108. </div>
  109. <div class="info blueBG" style="width: calc(100% / 3 - 10px)">
  110. <span>课程开展总数</span>
  111. <!-- <span>{{ weekCount }}</span> -->
  112. <span>{{ haveWorksCourse }}</span>
  113. </div>
  114. <div class="info blueBG" style="width: calc(100% / 3 - 10px)">
  115. <span>课程平均作业数量</span>
  116. <!-- <span>{{ weekCount }}</span> -->
  117. <span>{{
  118. worksCount == 0 ? 0 : (worksCount / haveWorksCourse).toFixed(0)
  119. }}</span>
  120. </div>
  121. </div>
  122. <Bar style="height: calc(100% - 70px)" v-if="skType == 0 && !oType" :workList="tedurArray"></Bar>
  123. <!-- <ToolUse2 style="height: calc(100% - 100px)" v-if="skType == 0 && oType" :yearArray="courseWorksCountYearArray"></ToolUse2> -->
  124. <ToolUse style="height: calc(100% - 100px)" v-if="skType == 1 && !oType2"
  125. :yearArray="courseWorksCountYearArray"></ToolUse>
  126. <Bar2 style="height: calc(100% - 100px)" v-if="skType == 1 && oType2" :workList="tedurArray2"></Bar2>
  127. <!-- <div class="otherCss" v-if="skType == 0">
  128. <div v-if="!oType">切换为柱状图</div>
  129. <div v-if="oType">切换为热力图</div>
  130. <div class="otherImg" @click="otherEchart">
  131. <img src="../../../../assets/icon/other.png" alt="" />
  132. </div>
  133. </div> -->
  134. <div class="otherCss" v-if="skType == 1">
  135. <div v-if="!oType2">切换为热力图</div>
  136. <div v-if="oType2">切换为柱状图</div>
  137. <div class="otherImg" @click="otherEchart2">
  138. <img src="../../../../assets/icon/other.png" alt="" />
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. <div class="center">
  145. <div class="top">
  146. <div class="titleBox">
  147. <div class="title" :class="{ isClick: courseType == 0 }" @click="courseType = 0"
  148. style="cursor: pointer; padding: 0 0 5px 0">
  149. 课程分布
  150. </div>
  151. <div class="title" :class="{ isClick: courseType == 1 }" @click="courseType = 1"
  152. style="cursor: pointer; padding: 0 0 5px 0">
  153. 课程总数变化
  154. </div>
  155. </div>
  156. <div class="dataBox">
  157. <CateRank v-if="courseType == 0" style="height: calc(100%)" :courseArray="courseArray"></CateRank>
  158. <CourseNum v-if="courseType == 1" style="height: calc(100%)" :weekCourse2="weekCourse2"></CourseNum>
  159. </div>
  160. </div>
  161. <div class="bottom">
  162. <div class="titleBox" style="justify-content: space-between">
  163. <div class="title">课程实施程度</div>
  164. </div>
  165. <div class="dataBox">
  166. <div class="allBox" v-if="!shType" style="height: calc(100% - 30px)">
  167. <div class="allBox_left">
  168. <CourseTime v-if="!shType" :pusaDep="pusaDep"></CourseTime>
  169. </div>
  170. <div class="allBox_right">
  171. <div class="depth">
  172. <span>已提交作业</span>
  173. <div>
  174. <el-progress :width="80" type="circle" :percentage="allCourse
  175. ? parseInt(
  176. ((haveWorksCourse / allCourse) * 100).toFixed(0)
  177. )
  178. : 0
  179. " :stroke-width="5" :format="format" color="#106BFF"></el-progress>
  180. </div>
  181. </div>
  182. <div class="depth">
  183. <span>设置评价</span>
  184. <div>
  185. <el-progress :width="80" type="circle" :percentage="allCourse
  186. ? parseInt(((evaCount / allCourse) * 100).toFixed(0))
  187. : 0
  188. " :stroke-width="5" :format="format" color="#106BFF"></el-progress>
  189. </div>
  190. </div>
  191. <div class="depth">
  192. <span>已评价课程</span>
  193. <div>
  194. <el-progress :width="80" type="circle" :percentage="allCourse
  195. ? parseInt(
  196. ((evaWorksCount / allCourse) * 100).toFixed(0)
  197. )
  198. : 0
  199. " :stroke-width="5" :format="format" color="#106BFF"></el-progress>
  200. </div>
  201. </div>
  202. <div class="depth">
  203. <span>教学评一体化</span>
  204. <div>
  205. <el-progress :width="80" type="circle" :percentage="allCourse
  206. ? parseInt(
  207. ((evaWorksCount / allCourse) * 100).toFixed(0)
  208. )
  209. : 0
  210. " :stroke-width="5" :format="format" color="#106BFF"></el-progress>
  211. </div>
  212. </div>
  213. </div>
  214. </div>
  215. <div class="info_box" v-if="shType">
  216. <div class="info blueBG" style="width: calc(100% / 4 - 10px)">
  217. <span>平台实施课程总数</span>
  218. <!-- <span>{{ count }}</span> -->
  219. <span>{{ isCourseCount }}</span>
  220. </div>
  221. <div class="info blueBG" style="width: calc(100% / 4 - 10px)">
  222. <span>平台实施课程占比</span>
  223. <!-- <span>{{ weekCount }}</span> -->
  224. <span>{{
  225. isCourseCount
  226. ? ((isCourseCount / allCourseCount) * 100).toFixed(0) + "%"
  227. : "0%"
  228. }}</span>
  229. </div>
  230. <div class="info blueBG" style="width: calc(100% / 4 - 10px)">
  231. <span>课程平均任务数量</span>
  232. <!-- <span>{{ weekCount }}</span> -->
  233. <span>{{
  234. isCourseCount ? (taskCount / isCourseCount).toFixed(0) : 0
  235. }}</span>
  236. </div>
  237. <div class="info blueBG" style="width: calc(100% / 4 - 10px)">
  238. <span>课程平均作业数量</span>
  239. <!-- <span>{{ weekCount }}</span> -->
  240. <span>{{
  241. isCourseCount ? (workCount / isCourseCount).toFixed(0) : 0
  242. }}</span>
  243. </div>
  244. </div>
  245. <WorkNum style="height: calc(100% - 95px)" :workNumList="workNumList" @openCourse="openCourse" v-if="shType">
  246. </WorkNum>
  247. <div class="otherCss">
  248. <div v-if="!shType">转换为散点图</div>
  249. <div v-if="shType">转换为漏斗图</div>
  250. <div class="otherImg" @click="shEchart">
  251. <img src="../../../../assets/icon/other.png" alt="" />
  252. </div>
  253. </div>
  254. </div>
  255. </div>
  256. </div>
  257. <div class="right">
  258. <div class="top" style="border-radius: 5px">
  259. <div class="titleBox" style="justify-content: space-between">
  260. <div style="
  261. display: flex;
  262. flex-direction: row;
  263. flex-wrap: nowrap;
  264. align-items: center;
  265. ">
  266. <div class="title" :class="{ isClick: toolType == 0 }" @click="toolType = 0"
  267. style="cursor: pointer; padding: 0 0 5px 0">
  268. 课程占比
  269. </div>
  270. <div class="title" :class="{ isClick: toolType == 1 }" @click="toolType = 1"
  271. style="cursor: pointer; padding: 0 0 5px 0">
  272. 工具使用
  273. </div>
  274. </div>
  275. <el-select v-model="cType4" @change="typeChange" class="selectBox" v-if="toolType == 0">
  276. <!-- <el-option label="全部" value=""></el-option> -->
  277. <el-option label="年级" value="grade"></el-option>
  278. <el-option label="主题" value="theme"></el-option>
  279. <el-option label="学科" value="subject"></el-option>
  280. </el-select>
  281. </div>
  282. <div class="dataBox">
  283. <CourseAna style="height: calc(100%)" :courseNumberArray="courseNumberArray" v-if="toolType == 0"></CourseAna>
  284. <ToolChart style="height: calc(100%)" :toolArray="toolList" v-if="toolType == 1"></ToolChart>
  285. </div>
  286. </div>
  287. <div class="bottom">
  288. <div class="titleBox">
  289. <div class="title">课程协同情况</div>
  290. </div>
  291. <div class="dataBox">
  292. <WorkTime style="height: calc(100% - 25px)" :personArray="personList" v-if="xtType"></WorkTime>
  293. <Subjuect style="height: calc(100% - 25px)" v-if="!xtType"></Subjuect>
  294. <div class="otherCss">
  295. <div v-if="!xtType">转换为人员协同</div>
  296. <div v-if="xtType">转换为学科协同</div>
  297. <div class="otherImg" @click="xtEchart">
  298. <img src="../../../../assets/icon/other.png" alt="" />
  299. </div>
  300. </div>
  301. </div>
  302. </div>
  303. </div>
  304. </div>
  305. </template>
  306. <script>
  307. import TeaFre from "./chartList/teaFre.vue";
  308. import ToolUse from "./chartList/toolUse.vue";
  309. import ToolUse2 from "./chartList/toolUse2.vue";
  310. import CateRank from "./chartList/cateRank.vue";
  311. import WorkNum from "./chartList/workNum.vue";
  312. import CourseTime from "./chartList/courseTime.vue";
  313. import CourseAna from "./chartList/courseAna.vue";
  314. import WorkTime from "./chartList/workTime.vue";
  315. import Bar from "./chartList/bar.vue";
  316. import Bar2 from "./chartList/bar2.vue";
  317. import CourseNum from "./chartList/courseNum.vue";
  318. import ToolChart from "./chartList/toolChart.vue";
  319. import Subjuect from "./chartList/subjuect.vue";
  320. export default {
  321. components: {
  322. TeaFre,
  323. ToolUse,
  324. ToolUse2,
  325. CateRank,
  326. WorkNum,
  327. CourseTime,
  328. CourseAna,
  329. WorkTime,
  330. Bar,
  331. Bar2,
  332. CourseNum,
  333. ToolChart,
  334. Subjuect,
  335. },
  336. props: {
  337. oid: {
  338. type: String,
  339. },
  340. org: {
  341. type: String,
  342. },
  343. },
  344. data() {
  345. return {
  346. isLoading: false,
  347. cType: "全部年级",
  348. cType4: "grade",
  349. cType7: "全部课程",
  350. toolType: 0,
  351. tType: 0,
  352. skType: 0,
  353. courseType: 0,
  354. sType: 0,
  355. oType: false,
  356. oType2: false,
  357. shType: true,
  358. xtType: false,
  359. allCourse: 0,
  360. courseTemplate: 0,
  361. loginCountMonthArray: [],
  362. lType: "grade",
  363. lType1: "grade",
  364. allTimeList: [],
  365. tedurArray: [],
  366. tedurArray2: [],
  367. classList: [],
  368. subjectList: [],
  369. themeList: [],
  370. allTime: 0,
  371. allTimeLength: 0,
  372. gradeLength: 0,
  373. subjectLength: 0,
  374. themeLength: 0,
  375. courseTList: [],
  376. courseLength: 0,
  377. courseWorksCountYearArray: [],
  378. allCourseWorks: [],
  379. gradeList: [],
  380. subjectList2: [],
  381. thList: [],
  382. worksCount: 0,
  383. haveWorksCourse: 0,
  384. courseNumberArray: [],
  385. gradeArray: [],
  386. subjectArray: [],
  387. themeArray: [],
  388. allArray: [],
  389. toolList: [],
  390. personList: [],
  391. workNumList: [],
  392. taskCount: 0,
  393. workCount: 0,
  394. isCourseCount: 0,
  395. allCourseCount: 0,
  396. courseArray: [],
  397. evaCount: 0,
  398. evaWorksCount: 0,
  399. pusaDep: [
  400. { value: 0, name: "课程总数" },
  401. { value: 0, name: "设置评价课程" },
  402. { value: 0, name: "已提交作业课程" },
  403. { value: 0, name: "已评价课程" },
  404. { value: 0, name: "教学评一体化课程" },
  405. ],
  406. weekCourse2: [],
  407. };
  408. },
  409. mounted() {
  410. this.getData();
  411. },
  412. methods: {
  413. openCourse(cid) {
  414. window.parent.postMessage({ cid: cid, screenType: "3" }, "*");
  415. },
  416. otherEchart() {
  417. this.oType = !this.oType;
  418. },
  419. otherEchart2() {
  420. this.oType2 = !this.oType2;
  421. },
  422. shEchart() {
  423. this.shType = !this.shType;
  424. },
  425. xtEchart() {
  426. this.xtType = !this.xtType;
  427. },
  428. format(percentage) {
  429. return percentage + "%";
  430. },
  431. getMonth() {
  432. // 获取当前时间
  433. var currentDate = new Date();
  434. // 获取本月的年份和月份
  435. var currentYear = currentDate.getFullYear();
  436. var currentMonth = currentDate.getMonth() + 1; // 月份从0开始,需要加1
  437. // 获取上个月的年份和月份
  438. var lastMonthYear, lastMonth;
  439. if (currentMonth === 1) {
  440. lastMonthYear = currentYear - 1;
  441. lastMonth = 12;
  442. } else {
  443. lastMonthYear = currentYear;
  444. lastMonth = currentMonth - 1;
  445. }
  446. // 获取本月的第一天和最后一天的日期
  447. var firstDayOfMonth = new Date(currentYear, currentMonth - 1, 1);
  448. var lastDayOfMonth = new Date(currentYear, currentMonth, 0);
  449. // 获取上个月的第一天和最后一天的日期
  450. var firstDayOfLastMonth = new Date(lastMonthYear, lastMonth - 1, 1);
  451. var lastDayOfLastMonth = new Date(lastMonthYear, lastMonth, 0);
  452. // 构建本月日期的数组
  453. var currentMonthDates = [];
  454. for (var i = 1; i <= lastDayOfMonth.getDate(); i++) {
  455. let a = new Date(currentYear, currentMonth - 1, i)
  456. currentMonthDates.push(a.getFullYear() + '-' + (a.getMonth() + 1) + '-' + a.getDate());
  457. }
  458. // 构建上个月日期的数组
  459. var lastMonthDates = [];
  460. for (var j = firstDayOfLastMonth.getDate(); j <= lastDayOfLastMonth.getDate(); j++) {
  461. let a = new Date(lastMonthYear, lastMonth - 1, j)
  462. lastMonthDates.push(a.getFullYear() + '-' + (a.getMonth() + 1) + '-' + a.getDate());
  463. }
  464. return {
  465. lastWeek: lastMonthDates,//上月
  466. toWeek: currentMonthDates //本月
  467. }
  468. },
  469. typeChange1() {
  470. var a = [];
  471. if (this.lType == "all") {
  472. // a = this.classList.concat(this.subjectList, this.themeList);
  473. a = this.allTimeList;
  474. this.courseLength = this.allTimeLength;
  475. } else if (this.lType == "grade") {
  476. a = this.classList;
  477. this.courseLength = this.gradeLength;
  478. } else if (this.lType == "subject") {
  479. a = this.subjectList;
  480. this.courseLength = this.subjectLength;
  481. } else {
  482. a = this.themeList;
  483. this.courseLength = this.themeLength;
  484. }
  485. this.tedurArray = a;
  486. var time = 0;
  487. for (var i = 0; i < a.length; i++) {
  488. if (a[i].time) {
  489. time += a[i].time;
  490. }
  491. }
  492. this.allTime = time;
  493. this.$forceUpdate();
  494. },
  495. typeChange2() {
  496. const date = new Date();
  497. var Month = date.getMonth() + 1;
  498. var Year = date.getFullYear();
  499. let courseWorksCountYearArray = [];
  500. for (var i = Month; i > Month - 12; i--) {
  501. if (i <= 0) {
  502. courseWorksCountYearArray.push({
  503. Year: Year - 1,
  504. Month: 12 + i,
  505. mon: 0,
  506. tue: 0,
  507. wed: 0,
  508. thur: 0,
  509. fri: 0,
  510. sat: 0,
  511. sun: 0,
  512. });
  513. } else {
  514. courseWorksCountYearArray.push({
  515. Month: i,
  516. Year: Year,
  517. mon: 0,
  518. tue: 0,
  519. wed: 0,
  520. thur: 0,
  521. fri: 0,
  522. sat: 0,
  523. sun: 0,
  524. });
  525. }
  526. }
  527. courseWorksCountYearArray = courseWorksCountYearArray.reverse();
  528. for (var i = 0; i < this.allCourseWorks.length; i++) {
  529. let _date = new Date(this.allCourseWorks[i].create_at);
  530. let _type = this.allCourseWorks[i].typeid;
  531. var _month = _date.getMonth() + 1;
  532. var _year = _date.getFullYear();
  533. var _day = _date.getDay();
  534. let dayArray = ["sun", "mon", "tue", "wed", "thur", "fri", "sat"];
  535. for (var j = 0; j < courseWorksCountYearArray.length; j++) {
  536. if (this.lType1 == "all") {
  537. if (
  538. _month == courseWorksCountYearArray[j].Month &&
  539. _year == courseWorksCountYearArray[j].Year
  540. ) {
  541. courseWorksCountYearArray[j][dayArray[_day]]++;
  542. break;
  543. }
  544. } else if (this.lType1 == "grade") {
  545. if (
  546. _month == courseWorksCountYearArray[j].Month &&
  547. _year == courseWorksCountYearArray[j].Year &&
  548. this.gradeList.indexOf(_type) != -1
  549. ) {
  550. courseWorksCountYearArray[j][dayArray[_day]]++;
  551. break;
  552. }
  553. } else if (this.lType1 == "subject") {
  554. if (
  555. _month == courseWorksCountYearArray[j].Month &&
  556. _year == courseWorksCountYearArray[j].Year &&
  557. this.subjectList2.indexOf(_type) != -1
  558. ) {
  559. courseWorksCountYearArray[j][dayArray[_day]]++;
  560. break;
  561. }
  562. } else {
  563. if (
  564. _month == courseWorksCountYearArray[j].Month &&
  565. _year == courseWorksCountYearArray[j].Year &&
  566. this.thList.indexOf(_type) != -1
  567. ) {
  568. courseWorksCountYearArray[j][dayArray[_day]]++;
  569. break;
  570. }
  571. }
  572. }
  573. }
  574. var worksCount = 0,
  575. haveWorksCourse = [];
  576. for (var i = 0; i < this.allCourseWorks.length; i++) {
  577. if (this.lType1 == "all") {
  578. if (this.allCourseWorks[i].id) {
  579. worksCount++;
  580. }
  581. if (haveWorksCourse.length == 0) {
  582. haveWorksCourse.push(this.allCourseWorks[i].courseid);
  583. } else {
  584. if (
  585. haveWorksCourse.indexOf(this.allCourseWorks[i].courseid) == -1
  586. ) {
  587. haveWorksCourse.push(this.allCourseWorks[i].courseid);
  588. }
  589. }
  590. } else if (this.lType1 == "grade") {
  591. if (this.gradeList.indexOf(this.allCourseWorks[i].typeid) != -1) {
  592. if (this.allCourseWorks[i].id) {
  593. worksCount++;
  594. }
  595. if (haveWorksCourse.length == 0) {
  596. haveWorksCourse.push(this.allCourseWorks[i].courseid);
  597. } else {
  598. if (
  599. haveWorksCourse.indexOf(this.allCourseWorks[i].courseid) == -1
  600. ) {
  601. haveWorksCourse.push(this.allCourseWorks[i].courseid);
  602. }
  603. }
  604. }
  605. } else if (this.lType1 == "subject") {
  606. if (this.subjectList2.indexOf(this.allCourseWorks[i].typeid) != -1) {
  607. if (this.allCourseWorks[i].id) {
  608. worksCount++;
  609. }
  610. if (haveWorksCourse.length == 0) {
  611. haveWorksCourse.push(this.allCourseWorks[i].courseid);
  612. } else {
  613. if (
  614. haveWorksCourse.indexOf(this.allCourseWorks[i].courseid) == -1
  615. ) {
  616. haveWorksCourse.push(this.allCourseWorks[i].courseid);
  617. }
  618. }
  619. }
  620. } else {
  621. if (this.thList.indexOf(this.allCourseWorks[i].typeid) != -1) {
  622. if (this.allCourseWorks[i].id) {
  623. worksCount++;
  624. }
  625. if (haveWorksCourse.length == 0) {
  626. haveWorksCourse.push(this.allCourseWorks[i].courseid);
  627. } else {
  628. if (
  629. haveWorksCourse.indexOf(this.allCourseWorks[i].courseid) == -1
  630. ) {
  631. haveWorksCourse.push(this.allCourseWorks[i].courseid);
  632. }
  633. }
  634. }
  635. }
  636. }
  637. var courseJson = this.allCourseWorks
  638. let _allTime = JSON.parse(JSON.stringify(this.allTimeList)).filter(el => {
  639. el.time = 0
  640. return el
  641. })
  642. let _grade = JSON.parse(JSON.stringify(this.classList)).filter(el => {
  643. el.time = 0
  644. return el
  645. })
  646. let _subject = JSON.parse(JSON.stringify(this.subjectList)).filter(el => {
  647. el.time = 0
  648. return el
  649. })
  650. let _themeList = JSON.parse(JSON.stringify(this.themeList)).filter(el => {
  651. el.time = 0
  652. return el
  653. })
  654. for (var i = 0; i < courseJson.length; i++) {
  655. for (var j = 0; j < _allTime.length; j++) {
  656. if (courseJson[i].typeid.indexOf(_allTime[j].id) != -1) {
  657. if (_allTime[j].time) {
  658. _allTime[j].time += 1;
  659. } else {
  660. _allTime[j].time = 1;
  661. }
  662. }
  663. }
  664. for (var j = 0; j < _grade.length; j++) {
  665. if (courseJson[i].typeid.indexOf(_grade[j].id) != -1) {
  666. if (_grade[j].time) {
  667. _grade[j].time += 1;
  668. } else {
  669. _grade[j].time = 1;
  670. }
  671. }
  672. }
  673. for (var k = 0; k < _subject.length; k++) {
  674. if (courseJson[i].typeid.indexOf(_subject[k].id) != -1) {
  675. if (_subject[k].time ) {
  676. _subject[k].time += 1;
  677. } else {
  678. _subject[k].time = 1;
  679. }
  680. }
  681. }
  682. for (var l = 0; l < _themeList.length; l++) {
  683. if (courseJson[i].typeid.indexOf(_themeList[l].id) != -1) {
  684. if (_themeList[l].time) {
  685. _themeList[l].time += 1;
  686. } else{
  687. _themeList[l].time = 1;
  688. }
  689. }
  690. }
  691. }
  692. if (this.lType1 == "all") {
  693. this.tedurArray2 = _allTime;
  694. } else if (this.lType1 == "grade") {
  695. this.tedurArray2 = _grade;
  696. } else if (this.lType1 == "subject") {
  697. this.tedurArray2 = _subject;
  698. } else {
  699. this.tedurArray2 = _themeList;
  700. }
  701. this.courseWorksCountYearArray = courseWorksCountYearArray;
  702. this.worksCount = worksCount;
  703. this.haveWorksCourse = haveWorksCourse.length;
  704. this.$forceUpdate();
  705. },
  706. typeChange() {
  707. if (this.cType4 === "") {
  708. this.courseNumberArray = this.allArray;
  709. } else if (this.cType4 === "grade") {
  710. this.courseNumberArray = this.gradeArray;
  711. } else if (this.cType4 === "theme") {
  712. this.courseNumberArray = this.themeArray;
  713. } else if (this.cType4 === "subject") {
  714. this.courseNumberArray = this.subjectArray;
  715. }
  716. this.$forceUpdate();
  717. },
  718. getData() {
  719. this.isLoading = true;
  720. let params = [
  721. {
  722. oid: this.oid,
  723. org: this.org,
  724. },
  725. ];
  726. this.ajax
  727. .post(this.$store.state.api + "selectDataBoardCourseNew", params)
  728. .then((res) => {
  729. this.isLoading = false;
  730. let _grade = res.data[0]; //年级
  731. let _subject = res.data[1]; //学科
  732. let _themeList = res.data[2]; //主题
  733. let _allTime = [..._grade, ..._subject, ..._themeList]; //年级 + 学科 + 主题
  734. this.allCourse = res.data[3][0].count; //课程总数
  735. let _timeCourse = res.data[4]; //查询半年内全部课程
  736. this.courseTemplate = res.data[5][0].count; //查询模板课程总数
  737. let tList = res.data[6]; //授课时长
  738. // let countCourseWorks = res.data[8][0].count; //获取有作业的课程
  739. this.courseTList = tList;
  740. //将数据根据time里面的月份分成多个数组
  741. let loginCountMonthArray = [];
  742. const date = new Date();
  743. var Month = date.getMonth() + 1;
  744. var Year = date.getFullYear();
  745. for (var i = Month; i > Month - 6; i--) {
  746. if (i <= 0) {
  747. loginCountMonthArray.push({
  748. Year: Year - 1,
  749. Month: 12 + i,
  750. course: 0,
  751. });
  752. } else {
  753. loginCountMonthArray.push({
  754. Month: i,
  755. Year: Year,
  756. course: 0,
  757. });
  758. }
  759. }
  760. loginCountMonthArray = loginCountMonthArray.reverse();
  761. for (var i = 0; i < _timeCourse.length; i++) {
  762. let _date = new Date(_timeCourse[i].time);
  763. var _month = _date.getMonth() + 1;
  764. var _year = _date.getFullYear();
  765. for (var j = 0; j < loginCountMonthArray.length; j++) {
  766. if (
  767. _month == loginCountMonthArray[j].Month &&
  768. _year == loginCountMonthArray[j].Year
  769. ) {
  770. loginCountMonthArray[j].course++;
  771. break;
  772. }
  773. }
  774. }
  775. this.loginCountMonthArray = loginCountMonthArray;
  776. var courseJson = Object.values(
  777. tList.reduce(function (acc, obj) {
  778. if (!acc[obj.courseid]) {
  779. acc[obj.courseid] = { ...obj };
  780. acc[obj.courseid].typeid = [acc[obj.courseid].typeid];
  781. } else {
  782. if (!acc[obj.courseid].typeid.includes(obj.typeid)) {
  783. acc[obj.courseid].typeid.push(obj.typeid);
  784. }
  785. acc[obj.courseid].text =
  786. parseInt(acc[obj.courseid].text) + parseInt(obj.text);
  787. }
  788. return acc;
  789. }, {})
  790. ).map(function (obj) {
  791. var totalTime = parseInt(obj.text);
  792. obj.text = (totalTime / (60 * 60)).toFixed(0);
  793. return obj;
  794. });
  795. for (var i = 0; i < courseJson.length; i++) {
  796. for (var j = 0; j < _allTime.length; j++) {
  797. if (courseJson[i].typeid.indexOf(_allTime[j].id) != -1) {
  798. if (_allTime[j].time && courseJson[i].text) {
  799. _allTime[j].time += parseInt(courseJson[i].text);
  800. } else if (courseJson[i].text) {
  801. _allTime[j].time = parseInt(courseJson[i].text);
  802. }
  803. }
  804. }
  805. for (var j = 0; j < _grade.length; j++) {
  806. if (courseJson[i].typeid.indexOf(_grade[j].id) != -1) {
  807. if (_grade[j].time && courseJson[i].text) {
  808. _grade[j].time += parseInt(courseJson[i].text);
  809. } else if (courseJson[i].text) {
  810. _grade[j].time = parseInt(courseJson[i].text);
  811. }
  812. }
  813. }
  814. for (var k = 0; k < _subject.length; k++) {
  815. if (courseJson[i].typeid.indexOf(_subject[k].id) != -1) {
  816. if (_subject[k].time && courseJson[i].text) {
  817. _subject[k].time += parseInt(courseJson[i].text);
  818. } else if (courseJson[i].text) {
  819. _subject[k].time = parseInt(courseJson[i].text);
  820. }
  821. }
  822. }
  823. for (var l = 0; l < _themeList.length; l++) {
  824. if (courseJson[i].typeid.indexOf(_themeList[l].id) != -1) {
  825. if (_themeList[l].time && courseJson[i].text) {
  826. _themeList[l].time += parseInt(courseJson[i].text);
  827. } else if (courseJson[i].text) {
  828. _themeList[l].time = parseInt(courseJson[i].text);
  829. }
  830. }
  831. }
  832. }
  833. this.allTimeList = _allTime;
  834. this.classList = _grade;
  835. this.subjectList = _subject;
  836. this.themeList = _themeList;
  837. var _gradeList = [],
  838. _subjectList = [],
  839. _thList = [];
  840. for (var i = 0; i < _grade.length; i++) {
  841. _gradeList.push(_grade[i].id);
  842. }
  843. for (var i = 0; i < _subject.length; i++) {
  844. _subjectList.push(_subject[i].id);
  845. }
  846. for (var i = 0; i < _themeList.length; i++) {
  847. _thList.push(_themeList[i].id);
  848. }
  849. var _courseTypeList = this.courseTList;
  850. var _gList = [],
  851. _sList = [],
  852. _tList = [],
  853. _timeList = [];
  854. for (var i = 0; i < _courseTypeList.length; i++) {
  855. if (_timeList.length == 0) {
  856. _timeList.push(_courseTypeList[i].courseid);
  857. } else {
  858. if (_timeList.indexOf(_courseTypeList[i].courseid) == -1) {
  859. _timeList.push(_courseTypeList[i].courseid);
  860. }
  861. }
  862. if (_gradeList.indexOf(_courseTypeList[i].typeid) != -1) {
  863. if (_gList.length == 0) {
  864. _gList.push(_courseTypeList[i].courseid);
  865. } else {
  866. if (_gList.indexOf(_courseTypeList[i].courseid) == -1) {
  867. _gList.push(_courseTypeList[i].courseid);
  868. }
  869. }
  870. }
  871. if (_subjectList.indexOf(_courseTypeList[i].typeid) != -1) {
  872. if (_sList.length == 0) {
  873. _sList.push(_courseTypeList[i].courseid);
  874. } else {
  875. if (_sList.indexOf(_courseTypeList[i].courseid) == -1) {
  876. _sList.push(_courseTypeList[i].courseid);
  877. }
  878. }
  879. }
  880. if (_thList.indexOf(_courseTypeList[i].typeid) != -1) {
  881. if (_tList.length == 0) {
  882. _tList.push(_courseTypeList[i].courseid);
  883. } else {
  884. if (_tList.indexOf(_courseTypeList[i].courseid) == -1) {
  885. _tList.push(_courseTypeList[i].courseid);
  886. }
  887. }
  888. }
  889. }
  890. this.allTimeLength = _timeList.length
  891. this.gradeLength = _gList.length;
  892. this.subjectLength = _sList.length;
  893. this.themeLength = _tList.length;
  894. var a = [];
  895. if (this.lType == "all") {
  896. this.tedurArray = _allTime;
  897. this.courseLength = _timeList.length;
  898. } else if (this.lType == "grade") {
  899. this.tedurArray = _grade;
  900. this.courseLength = _gList.length;
  901. } else if (this.lType == "subject") {
  902. this.tedurArray = _subject;
  903. this.courseLength = _sList.length;
  904. } else {
  905. this.tedurArray = _themeList;
  906. this.courseLength = _tList.length;
  907. }
  908. var time = 0;
  909. a = this.tedurArray;
  910. for (var i = 0; i < a.length; i++) {
  911. if (a[i].time) {
  912. time += a[i].time;
  913. }
  914. }
  915. this.allTime = time;
  916. let allCourseWorks = res.data[7]; //作业总数量
  917. this.allCourseWorks = allCourseWorks;
  918. this.gradeList = _gradeList;
  919. this.subjectList2 = _subjectList;
  920. this.thList = _thList;
  921. this.typeChange2();
  922. let _course = res.data[8]; //课程
  923. let _gradeArray = [];
  924. let _subjectArray = [];
  925. let _themeArray = [];
  926. for (var i = 0; i < _grade.length; i++) {
  927. _gradeArray.push({
  928. name: _grade[i].name,
  929. typeid: _grade[i].id,
  930. course: 0,
  931. array: [],
  932. });
  933. for (var z = 0; z < _course.length; z++) {
  934. if (_course[z].typeid == _grade[i].id) {
  935. _gradeArray[i].course++;
  936. _gradeArray[i].array.push(_course[z].courseid);
  937. }
  938. }
  939. }
  940. for (var i = 0; i < _subject.length; i++) {
  941. _subjectArray.push({
  942. name: _subject[i].name,
  943. typeid: _subject[i].id,
  944. course: 0,
  945. array: [],
  946. });
  947. for (var z = 0; z < _course.length; z++) {
  948. if (_course[z].typeid == _subject[i].id) {
  949. _subjectArray[i].course++;
  950. _subjectArray[i].array.push(_course[z].courseid);
  951. }
  952. }
  953. }
  954. for (var i = 0; i < _themeList.length; i++) {
  955. _themeArray.push({
  956. name: _themeList[i].name,
  957. typeid: _themeList[i].id,
  958. course: 0,
  959. array: [],
  960. });
  961. for (var z = 0; z < _course.length; z++) {
  962. if (_course[z].typeid == _themeList[i].id) {
  963. _themeArray[i].course++;
  964. _themeArray[i].array.push(_course[z].courseid);
  965. }
  966. }
  967. }
  968. this.gradeArray = _gradeArray;
  969. this.subjectArray = _subjectArray;
  970. this.themeArray = _themeArray;
  971. this.allArray = [..._gradeArray, ..._subjectArray, ..._themeArray];
  972. this.typeChange();
  973. var courseList = res.data[9];
  974. var cList = [];
  975. for (var i = 0; i < courseList.length; i++) {
  976. cList.push(JSON.parse(courseList[i].chapters));
  977. }
  978. var toolList = [
  979. [10, 65], //互动类
  980. [7, 1, 52, 3, 48], //思维类
  981. [49], //协作类
  982. [4, 45, 15, 16, 50, 41, 47], //测评类
  983. [40], //评价类
  984. [18, 21, 22, 23, 24, 32, 57, 63], //编程类
  985. [28, 31, 39, 66, 67, 68], //学科类
  986. ];
  987. var toolAllArray = [
  988. { name: "互动类", value: 0 },
  989. { name: "思维类", value: 0 },
  990. { name: "协作类", value: 0 },
  991. { name: "测评类", value: 0 },
  992. { name: "评价类", value: 0 },
  993. { name: "编程类", value: 0 },
  994. { name: "学科类", value: 0 },
  995. ];
  996. for (var p = 0; p < toolList.length; p++) {
  997. for (var i = 0; i < cList.length; i++) {
  998. for (var j = 0; j < cList[i].length; j++) {
  999. for (
  1000. var k = 0;
  1001. k < cList[i][j].chapterInfo[0].taskJson.length;
  1002. k++
  1003. ) {
  1004. for (
  1005. var q = 0;
  1006. q <
  1007. cList[i][j].chapterInfo[0].taskJson[k].toolChoose.length;
  1008. q++
  1009. ) {
  1010. if (
  1011. toolList[p].indexOf(
  1012. cList[i][j].chapterInfo[0].taskJson[k].toolChoose[q]
  1013. .tool[0]
  1014. ) != -1
  1015. ) {
  1016. toolAllArray[p].value++;
  1017. }
  1018. }
  1019. }
  1020. }
  1021. }
  1022. }
  1023. this.toolList = toolAllArray;
  1024. var twoPerson = 0,
  1025. threePerson = 0,
  1026. fivePerson = 0,
  1027. sevenPerson = 0;
  1028. var personList = [];
  1029. for (var i = 0; i < courseList.length; i++) {
  1030. if (courseList[i].course_teacher) {
  1031. if (courseList[i].course_teacher.split(",").length <= 2) {
  1032. twoPerson++;
  1033. } else if (
  1034. 4 >= courseList[i].course_teacher.split(",").length &&
  1035. courseList[i].course_teacher.split(",").length > 2
  1036. ) {
  1037. threePerson++;
  1038. } else if (
  1039. 6 >= courseList[i].course_teacher.split(",").length &&
  1040. courseList[i].course_teacher.split(",").length > 4
  1041. ) {
  1042. fivePerson++;
  1043. } else if (courseList[i].course_teacher.split(",").length > 7) {
  1044. sevenPerson++;
  1045. }
  1046. }
  1047. }
  1048. personList.push(
  1049. { name: "2人以下", value: twoPerson },
  1050. { name: "3-4人", value: threePerson },
  1051. { name: "5-6人", value: fivePerson },
  1052. { name: "7人以上", value: sevenPerson }
  1053. );
  1054. this.personList = personList;
  1055. let _workCourse = res.data[10]; //带作业的课程
  1056. let _taskCount = 0; //任务数量
  1057. var wList = [];
  1058. for (var i = 0; i < _workCourse.length; i++) {
  1059. if (!wList[_workCourse[i].courseId]) {
  1060. wList[_workCourse[i].courseId] = {
  1061. cid: _workCourse[i].courseId,
  1062. title: _workCourse[i].title,
  1063. task: 0,
  1064. work: 0,
  1065. };
  1066. let chapters = JSON.parse(_workCourse[i].chapters);
  1067. for (var j = 0; j < chapters.length; j++) {
  1068. if (wList[_workCourse[i].courseId].task == 0) {
  1069. wList[_workCourse[i].courseId].task =
  1070. chapters[j].chapterInfo[0].taskJson.length;
  1071. } else {
  1072. wList[_workCourse[i].courseId].task +=
  1073. chapters[j].chapterInfo[0].taskJson.length;
  1074. }
  1075. _taskCount += chapters[j].chapterInfo[0].taskJson.length;
  1076. }
  1077. }
  1078. }
  1079. for (var i = 0; i < _workCourse.length; i++) {
  1080. let a = Object.keys(wList);
  1081. for (var j = 0; j < Object.keys(wList).length; j++) {
  1082. if (
  1083. _workCourse[i].courseId == wList[a[j]].cid &&
  1084. _workCourse[i].id
  1085. ) {
  1086. wList[a[j]].work++;
  1087. }
  1088. }
  1089. }
  1090. var workNumList = Object.values(wList).map((item) => [
  1091. item.task,
  1092. item.work,
  1093. item.title,
  1094. item.cid,
  1095. ]);
  1096. this.workNumList = workNumList;
  1097. this.taskCount = _taskCount;
  1098. this.workCount = _workCourse.length;
  1099. this.isCourseCount = res.data[11][0].count; //课程开展总数
  1100. this.allCourseCount = res.data[9].length; //课程总数
  1101. let _gradeCourse = 0; //各年级上传课程
  1102. let _subjectCourse = 0; //各学科上传课程
  1103. let _courseArray = [];
  1104. _subject.push({ name: "其他" });
  1105. for (var i = 0; i < _grade.length; i++) {
  1106. _courseArray.push({
  1107. name: _grade[i].name,
  1108. id: _grade[i].id,
  1109. courseid: [],
  1110. subject: [],
  1111. });
  1112. for (var z = 0; z < _course.length; z++) {
  1113. if (_course[z].typeid == _grade[i].id) {
  1114. _gradeCourse++;
  1115. if (
  1116. _courseArray[i].courseid.indexOf(_course[z].courseid) === -1
  1117. ) {
  1118. _courseArray[i].courseid.push(_course[z].courseid);
  1119. }
  1120. }
  1121. }
  1122. for (var j = 0; j < _subject.length; j++) {
  1123. _courseArray[i].subject.push({
  1124. name: _subject[j].name,
  1125. id: _subject[j].id,
  1126. course: 0,
  1127. });
  1128. for (var z = 0; z < _course.length; z++) {
  1129. if (
  1130. _course[z].typeid == _subject[j].id &&
  1131. _courseArray[i].courseid.indexOf(_course[z].courseid) !== -1
  1132. ) {
  1133. _courseArray[i].subject[j].course++;
  1134. }
  1135. }
  1136. }
  1137. let sum = 0;
  1138. for (var j = 0; j < _courseArray[i].subject.length - 1; j++) {
  1139. sum += _courseArray[i].subject[j].course;
  1140. }
  1141. _courseArray[i].subject[_courseArray[i].subject.length - 1].course =
  1142. _courseArray[i].courseid.length - sum < 0
  1143. ? 0
  1144. : _courseArray[i].courseid.length - sum;
  1145. }
  1146. for (var j = 0; j < _subject.length; j++) {
  1147. for (var z = 0; z < _course.length; z++) {
  1148. if (_course[z].typeid == _subject[j].id) {
  1149. _subjectCourse++;
  1150. }
  1151. }
  1152. }
  1153. this.courseArray = _courseArray;
  1154. this.evaCount = res.data[12][0].count; //设置评价
  1155. this.evaWorksCount = res.data[13][0].count; //查询有目标并且有评价的作业
  1156. for (var i = 0; i < this.pusaDep.length; i++) {
  1157. if (this.pusaDep[i].name == "课程总数") {
  1158. this.pusaDep[i].value = (
  1159. (this.allCourse / this.allCourse) *
  1160. 100
  1161. ).toFixed(0);
  1162. } else if (this.pusaDep[i].name == "设置评价课程") {
  1163. this.pusaDep[i].value = (
  1164. (this.evaCount / this.allCourse) *
  1165. 100
  1166. ).toFixed(0);
  1167. } else if (this.pusaDep[i].name == "已提交作业课程") {
  1168. this.pusaDep[i].value = (
  1169. (this.haveWorksCourse / this.allCourse) *
  1170. 100
  1171. ).toFixed(0);
  1172. } else if (this.pusaDep[i].name == "已评价课程") {
  1173. this.pusaDep[i].value = (
  1174. (this.evaWorksCount / this.allCourse) *
  1175. 100
  1176. ).toFixed(0);
  1177. } else if (this.pusaDep[i].name == "教学评一体化课程") {
  1178. this.pusaDep[i].value = (
  1179. (this.evaWorksCount / this.allCourse) *
  1180. 100
  1181. ).toFixed(0);
  1182. }
  1183. }
  1184. var today = new Date();
  1185. var lastDayOfWeek = new Date(
  1186. today.setDate(today.getDate() - today.getDay() + 7)
  1187. ); //本周周日
  1188. let weekArray = {
  1189. lastWeek: [], //上周
  1190. toWeek: [], //本周
  1191. };
  1192. // for (var i = 0; i < 14; i++) {
  1193. // let time = JSON.parse(JSON.stringify(lastDayOfWeek));
  1194. // let time2 = new Date(time);
  1195. // var a = new Date(time2.setDate(time2.getDate() - i));
  1196. // if (i > 6) {
  1197. // weekArray.lastWeek.push(
  1198. // a.getFullYear() + "-" + (a.getMonth() + 1) + "-" + a.getDate()
  1199. // );
  1200. // } else {
  1201. // weekArray.toWeek.push(
  1202. // a.getFullYear() + "-" + (a.getMonth() + 1) + "-" + a.getDate()
  1203. // );
  1204. // }
  1205. // }
  1206. weekArray = this.getMonth()
  1207. let weekCourse = [];
  1208. let weekCourse2 = [];
  1209. let lastWeekCouseCount = 0;
  1210. let toWeekCouseCount = 0;
  1211. for (var z = 0; z < _course.length; z++) {
  1212. let _date = new Date(
  1213. weekArray.lastWeek[0]
  1214. );
  1215. if (
  1216. new Date(_course[z].create_at) > _date &&
  1217. _course[z].pid == "34628934-d02f-11ec-8c78-005056b86db5"
  1218. ) {
  1219. weekCourse.push(_course[z]);
  1220. var a = new Date(_course[z].create_at);
  1221. var string =
  1222. a.getFullYear() + "-" + (a.getMonth() + 1) + "-" + a.getDate();
  1223. if (weekArray.lastWeek.indexOf(string) != -1) {
  1224. lastWeekCouseCount++;
  1225. } else {
  1226. toWeekCouseCount++;
  1227. }
  1228. }
  1229. }
  1230. let lastCourseidWeek = [];
  1231. let toCourseidWeek = [];
  1232. for (var i = 0; i < _grade.length; i++) {
  1233. weekCourse2.push({
  1234. name: _grade[i].name,
  1235. id: _grade[i].id,
  1236. lastCourse: 0,
  1237. toCourse: 0,
  1238. });
  1239. for (var z = 0; z < weekCourse.length; z++) {
  1240. if (weekCourse[z].typeid == _grade[i].id) {
  1241. var a = new Date(weekCourse[z].create_at);
  1242. var string =
  1243. a.getFullYear() +
  1244. "-" +
  1245. (a.getMonth() + 1) +
  1246. "-" +
  1247. a.getDate();
  1248. if (weekArray.lastWeek.indexOf(string) != -1) {
  1249. weekCourse2[i].lastCourse++;
  1250. if (lastCourseidWeek.indexOf(weekCourse[z].courseid) === -1) {
  1251. lastCourseidWeek.push(weekCourse[z].courseid);
  1252. }
  1253. } else {
  1254. weekCourse2[i].toCourse++;
  1255. if (toCourseidWeek.indexOf(weekCourse[z].courseid) === -1) {
  1256. toCourseidWeek.push(weekCourse[z].courseid);
  1257. }
  1258. }
  1259. }
  1260. }
  1261. }
  1262. weekCourse2.push({
  1263. name: "其他",
  1264. id: "",
  1265. lastCourse:
  1266. lastWeekCouseCount - lastCourseidWeek.length > 0
  1267. ? lastWeekCouseCount - lastCourseidWeek.length
  1268. : 0,
  1269. toCourse:
  1270. toWeekCouseCount - toCourseidWeek.length > 0
  1271. ? toWeekCouseCount - toCourseidWeek.length
  1272. : 0,
  1273. });
  1274. this.weekCourse2 = weekCourse2;
  1275. this.$forceUpdate();
  1276. })
  1277. .catch((err) => {
  1278. this.isLoading = false;
  1279. console.error(err);
  1280. });
  1281. },
  1282. },
  1283. };
  1284. </script>
  1285. <style scoped>
  1286. .body1 {
  1287. width: 100%;
  1288. height: 100%;
  1289. display: flex;
  1290. padding: 20px;
  1291. box-sizing: border-box;
  1292. overflow: hidden;
  1293. }
  1294. .left {
  1295. width: calc(100% / 4 * 1);
  1296. height: 100%;
  1297. }
  1298. .left>.top {
  1299. width: 100%;
  1300. height: calc(100% / 2 - 10px);
  1301. background: #fff;
  1302. border-radius: 5px;
  1303. margin: 0 0 20px 0;
  1304. }
  1305. .left>.bottom {
  1306. width: 100%;
  1307. height: calc(100% / 2 - 10px);
  1308. background: #fff;
  1309. border-radius: 5px;
  1310. }
  1311. .center {
  1312. width: calc(100% / 4 * 2 - 40px);
  1313. height: 100%;
  1314. margin: 0 20px;
  1315. }
  1316. .center>.top {
  1317. width: 100%;
  1318. height: calc(100% / 5 * 3 - 10px);
  1319. background: #fff;
  1320. border-radius: 5px;
  1321. margin: 0 0 20px 0;
  1322. }
  1323. .center>.bottom {
  1324. width: 100%;
  1325. height: calc(100% / 5 * 2 - 10px);
  1326. background: #fff;
  1327. border-radius: 5px;
  1328. }
  1329. .right {
  1330. width: calc(100% / 4 * 1);
  1331. height: 100%;
  1332. }
  1333. .right>.top {
  1334. width: 100%;
  1335. height: calc(100% / 2 - 10px);
  1336. background: #fff;
  1337. border-radius: 16px;
  1338. margin: 0 0 20px 0;
  1339. }
  1340. .right>.bottom {
  1341. width: 100%;
  1342. height: calc(100% / 2 - 10px);
  1343. background: #fff;
  1344. border-radius: 5px;
  1345. }
  1346. .titleBox {
  1347. height: 40px;
  1348. display: flex;
  1349. align-items: center;
  1350. padding: 0 15px;
  1351. box-sizing: border-box;
  1352. width: 100%;
  1353. }
  1354. .dataBox {
  1355. height: calc(100% - 40px);
  1356. width: 100%;
  1357. }
  1358. .middleBox {
  1359. display: flex;
  1360. flex-direction: row;
  1361. flex-wrap: nowrap;
  1362. align-items: flex-start;
  1363. }
  1364. .title {
  1365. color: #060e17;
  1366. margin-right: 10px;
  1367. }
  1368. .teaMiddle {
  1369. width: calc(100% / 2 - 10px);
  1370. height: 60px;
  1371. border-radius: 8px;
  1372. /* border: 1px solid #e0eafb; */
  1373. display: flex;
  1374. flex-direction: column;
  1375. align-items: flex-start;
  1376. justify-content: center;
  1377. padding: 0 10px;
  1378. margin: 0 10px;
  1379. }
  1380. .teaMiddle {
  1381. width: calc(100% / 3 - 10px);
  1382. }
  1383. .cNum {
  1384. background: linear-gradient(180deg,
  1385. rgb(125, 227, 174, 0.2) 0%,
  1386. rgb(23, 196, 105, 0.3) 100%) !important;
  1387. }
  1388. .tNum {
  1389. background: linear-gradient(180deg,
  1390. rgb(174, 204, 254, 0.2) 0%,
  1391. rgb(54, 129, 252, 0.3) 100%) !important;
  1392. }
  1393. .tSum {
  1394. background: linear-gradient(180deg,
  1395. rgb(125, 227, 174, 0.2) 0%,
  1396. rgb(23, 196, 105, 0.3) 100%) !important;
  1397. }
  1398. .teaLeft>div:first-child,
  1399. .teaMiddle>div:first-child {
  1400. font-size: 12px;
  1401. font-weight: 400;
  1402. color: #565e6a;
  1403. }
  1404. .teaLeft>div:last-child,
  1405. .teaMiddle>div:last-child {
  1406. font-size: 22px;
  1407. font-weight: bold;
  1408. color: #060e17;
  1409. }
  1410. .halfBox {
  1411. width: 50%;
  1412. height: 100%;
  1413. }
  1414. .selectBox {
  1415. width: 80px;
  1416. margin-left: 10px;
  1417. }
  1418. .selectBox>>>.el-input__inner {
  1419. height: 30px;
  1420. line-height: 30px;
  1421. }
  1422. .selectBox>>>.el-input__icon {
  1423. line-height: 30px;
  1424. }
  1425. .timeDiv {
  1426. display: flex;
  1427. flex-direction: row;
  1428. flex-wrap: nowrap;
  1429. align-items: center;
  1430. margin: 0 0 0 15px;
  1431. }
  1432. .timeDiv>div {
  1433. margin-right: 10px;
  1434. cursor: pointer;
  1435. }
  1436. .isClick {
  1437. color: #1684fc;
  1438. border-bottom: 2px solid #1684fc;
  1439. box-sizing: border-box;
  1440. }
  1441. .otherCss {
  1442. display: flex;
  1443. flex-direction: row;
  1444. flex-wrap: nowrap;
  1445. align-items: center;
  1446. justify-content: flex-end;
  1447. }
  1448. .otherImg {
  1449. width: 20px;
  1450. height: 20px;
  1451. margin: 0 10px;
  1452. cursor: pointer;
  1453. }
  1454. .otherImg>img {
  1455. width: 100%;
  1456. height: 100%;
  1457. }
  1458. .allBox {
  1459. width: 100%;
  1460. height: 100%;
  1461. display: flex;
  1462. flex-direction: row;
  1463. flex-wrap: nowrap;
  1464. align-items: center;
  1465. }
  1466. .allBox_left {
  1467. width: 30%;
  1468. height: 100%;
  1469. }
  1470. .allBox_right {
  1471. display: flex;
  1472. flex-wrap: wrap;
  1473. height: 100%;
  1474. width: 70%;
  1475. margin: 0 auto;
  1476. overflow: hidden;
  1477. justify-content: space-between;
  1478. }
  1479. .depth {
  1480. width: calc(100% / 4 - 10px);
  1481. display: flex;
  1482. flex-direction: column;
  1483. align-items: center;
  1484. justify-content: center;
  1485. }
  1486. .depth>span:nth-child(1) {
  1487. font-size: 14px;
  1488. font-weight: 700;
  1489. margin: 0 0 10px;
  1490. }
  1491. .depth>div:nth-child(1) {}
  1492. .info_box {
  1493. display: flex;
  1494. flex-wrap: wrap;
  1495. align-items: center;
  1496. justify-content: space-between;
  1497. width: 90%;
  1498. margin: 0 auto;
  1499. }
  1500. .info_box>.info2,
  1501. .info_box>.info3,
  1502. .info_box>.info {
  1503. width: calc(50% - 10px);
  1504. display: flex;
  1505. flex-direction: row;
  1506. flex-wrap: nowrap;
  1507. height: 60px;
  1508. justify-content: space-between;
  1509. align-items: center;
  1510. padding: 0 10px;
  1511. box-sizing: border-box;
  1512. margin-bottom: 10px;
  1513. border-radius: 5px;
  1514. }
  1515. .info_box>.info2 {
  1516. width: calc(100% / 4 - 10px);
  1517. /* align-items: flex-end; */
  1518. }
  1519. .info_box>.info3 {
  1520. width: 100%;
  1521. margin-bottom: 5px;
  1522. }
  1523. .info_box>.info2>span:nth-child(1),
  1524. .info_box>.info3>span:nth-child(1),
  1525. .info_box>.info>span:nth-child(1) {
  1526. font-size: 12px;
  1527. /* margin: 0 0 0 20px; */
  1528. color: #565e6a;
  1529. width: 60px;
  1530. white-space: pre-wrap;
  1531. word-break: break-all;
  1532. }
  1533. .info_box>.info2>span:nth-child(2),
  1534. .info_box>.info3>span:nth-child(2),
  1535. .info_box>.info>span:nth-child(2) {
  1536. font-size: 24px;
  1537. /* font-weight: 700; */
  1538. }
  1539. .blueBG {
  1540. background: rgb(243, 248, 253);
  1541. border: 2px solid rgb(234, 246, 255);
  1542. }</style>