index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <div class="aggregate">
  3. <el-table
  4. :data="tableData"
  5. border
  6. max-height="750px"
  7. v-loading="tabLoading"
  8. @header-click="handleHeaderClick"
  9. >
  10. <el-table-column
  11. fixed
  12. align="center"
  13. label="序号"
  14. type="index"
  15. width="50"
  16. >
  17. </el-table-column>
  18. <el-table-column
  19. align="center"
  20. prop="username"
  21. label="教师姓名"
  22. fixed
  23. width="150"
  24. >
  25. </el-table-column>
  26. <el-table-column
  27. :filters="TeachingOptions"
  28. :filter-method="filterTea"
  29. align="center"
  30. prop="tea"
  31. fixed
  32. label="教研室"
  33. width="130"
  34. >
  35. <template slot-scope="scope">
  36. <div class="TabBtn" v-if="!scope.row.tea">/</div>
  37. <div class="TabBtn" v-else>{{ scope.row.tea }}</div>
  38. </template>
  39. </el-table-column>
  40. <div v-for="item in titList" :key="item.id">
  41. <el-table-column align="center" :label="item.name">
  42. <div v-for="e in allFrom" :key="e.courseId">
  43. <el-table-column
  44. v-if="e.typeid == item.id"
  45. align="center"
  46. :prop="e.courseId"
  47. :label="e.title"
  48. show-overflow-tooltip
  49. width="130"
  50. :resizable="false"
  51. >
  52. <template slot-scope="scope">
  53. <div
  54. v-if="
  55. e.juri2 &&
  56. arrayToArray(
  57. scope.row.teaId ? scope.row.teaId.split(',') : [],
  58. e.juri2 ? e.juri2.split(',') : []
  59. ).length &&
  60. scope.row.works.indexOf(e.courseId) !== -1
  61. "
  62. class="yuan blacky"
  63. @click="gotoFrom(e.courseId, scope.row.userid)"
  64. ></div>
  65. <div
  66. v-else-if="scope.row.works.indexOf(e.courseId) !== -1"
  67. class="yuan blacky"
  68. @click="gotoFrom(e.courseId, scope.row.userid)"
  69. ></div>
  70. <div
  71. v-else-if="
  72. e.juri2 &&
  73. arrayToArray(
  74. scope.row.teaId ? scope.row.teaId.split(',') : [],
  75. e.juri2 ? e.juri2.split(',') : []
  76. ).length == 0
  77. "
  78. class="yuan greyy"
  79. ></div>
  80. <div v-else class="yuan"></div>
  81. </template>
  82. </el-table-column>
  83. </div>
  84. </el-table-column>
  85. </div>
  86. </el-table>
  87. <!-- 查看数据来源 -->
  88. <el-dialog
  89. title=""
  90. :visible.sync="diaIframe"
  91. :append-to-body="true"
  92. width="95%"
  93. :before-close="handleClose2"
  94. class="dialog_diy"
  95. >
  96. <div style="height: 100%;">
  97. <iframe
  98. ref="viframe"
  99. style="width: 100%; height: 99%; border: none"
  100. :src="ifmUrl"
  101. ></iframe>
  102. </div>
  103. </el-dialog>
  104. </div>
  105. </template>
  106. <script>
  107. export default {
  108. data() {
  109. return {
  110. userid: this.$route.query.userid,
  111. oid: this.$route.query.oid,
  112. org: this.$route.query.org,
  113. tableData: [],
  114. titList: [],
  115. allFrom: [],
  116. tabLoading: false,
  117. TeachingOptions: [],
  118. diaIframe: false,
  119. ifmUrl: ""
  120. };
  121. },
  122. mounted() {
  123. this.getData();
  124. this.getTeaList();
  125. },
  126. methods: {
  127. // 处理数据
  128. arrayToArray(arrayo, arrayt) {
  129. let array1 = arrayo;
  130. let array2 = arrayt;
  131. let commonElements = [];
  132. for (let i = 0; i < array1.length; i++) {
  133. for (let j = 0; j < array2.length; j++) {
  134. if (array1[i] === array2[j]) {
  135. commonElements.push(array1[i]);
  136. }
  137. }
  138. }
  139. return commonElements;
  140. },
  141. gotoFrom(val, uid) {
  142. // return console.log(val, uid);
  143. this.ifmUrl = `https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/#/checkToTest?cid=${val}&oid=${this.oid}&org=${this.org}&type=2&role=0&peopleId=${uid}`;
  144. // this.ifmUrl = `https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/#/test?userid=${this.userid}&oid=45facc0a-1211-11ec-80ad-005056b86db5&org=&role=0`;
  145. this.diaIframe = true;
  146. },
  147. // 教研室筛选
  148. filterTea(value, row, column) {
  149. // console.log(value, row, column);
  150. const property = column["property"];
  151. return row[property].includes(value);
  152. },
  153. // 获取教研室
  154. getTeaList() {
  155. let params = {
  156. oid: this.oid
  157. };
  158. this.ajax
  159. .get(this.$store.state.api + "selectTeacherOfficeBySchool", params)
  160. .then(res => {
  161. // return console.log("this.TeachingOptions", res.data[0]);
  162. let data = res.data[0];
  163. let dataCopy = [];
  164. data.forEach(e => {
  165. let a = {};
  166. a.value = e.name;
  167. a.text = e.name;
  168. dataCopy.push(a);
  169. });
  170. this.TeachingOptions = dataCopy;
  171. // console.log("this.TeachingOptions", this.TeachingOptions);
  172. })
  173. .catch(err => {
  174. console.error(err);
  175. });
  176. },
  177. getData() {
  178. this.tabLoading = true;
  179. let params = {
  180. oid: this.oid,
  181. org: this.org
  182. };
  183. this.ajax
  184. .get(this.$store.state.api + "selectTestWorksAggregate", params)
  185. .then(res => {
  186. let data = res.data[0]; //所有老师
  187. this.titList = res.data[1]; // 所有分类
  188. this.allFrom = res.data[2]; //所有表单
  189. let data3 = res.data[3]; //所有老师填写表单
  190. data.forEach(e => {
  191. e.works = [];
  192. data3.forEach(k => {
  193. if (e.userid == k.userid) {
  194. e.works.push(k.courseid);
  195. }
  196. });
  197. });
  198. data.forEach(e => {
  199. if (!e.tea) {
  200. e.tea = "";
  201. }
  202. });
  203. this.tableData = data;
  204. this.tabLoading = false;
  205. })
  206. .catch(error => {
  207. console.log(error);
  208. });
  209. },
  210. // 数据来源关闭弹框
  211. handleClose2(done) {
  212. done();
  213. },
  214. // 点击表头跳转
  215. handleHeaderClick(column, event) {
  216. console.log("表头被点击", column, event);
  217. let titData = this.titList.map(e => {
  218. return e.name;
  219. });
  220. if (
  221. column.label == "教研室" ||
  222. column.label == "教师姓名" ||
  223. column.label == "序号" ||
  224. titData.includes(column.label)
  225. ) {
  226. } else {
  227. this.$router.push(
  228. "/checkToTest?cid=" +
  229. column.property +
  230. "&oid=" +
  231. this.oid +
  232. "&org=" +
  233. this.org +
  234. "&type=" +
  235. 2 +
  236. "&role=" +
  237. this.role
  238. );
  239. }
  240. // 在这里处理点击事件
  241. }
  242. }
  243. };
  244. </script>
  245. <style scoped>
  246. .yuan {
  247. width: 13px;
  248. height: 13px;
  249. border: 1px solid #000;
  250. border-radius: 100%;
  251. box-sizing: border-box;
  252. margin: 0 auto;
  253. }
  254. .blacky {
  255. background-color: #000;
  256. cursor: pointer;
  257. }
  258. .greyy {
  259. background-color: #eee;
  260. border: 1px solid #eee;
  261. }
  262. .dialog_diy >>> .el-dialog {
  263. height: 95%;
  264. margin: 0 auto !important;
  265. margin-top: 20px !important;
  266. overflow: hidden;
  267. min-width: 800px !important;
  268. }
  269. .dialog_diy >>> .el-dialog__header {
  270. background: #454545 !important;
  271. padding: 25px 20px;
  272. }
  273. .dialog_diy >>> .el-dialog__body {
  274. height: calc(100% - 50px);
  275. box-sizing: border-box;
  276. padding: 0px;
  277. }
  278. .dialog_diy >>> .el-dialog__title {
  279. color: #fff;
  280. }
  281. .dialog_diy >>> .el-dialog__headerbtn {
  282. top: 19px;
  283. }
  284. .dialog_diy >>> .el-dialog__headerbtn .el-dialog__close {
  285. color: #fff;
  286. }
  287. .dialog_diy >>> .el-dialog__headerbtn .el-dialog__close:hover {
  288. color: #fff;
  289. }
  290. .dialog_diy >>> .el-dialog__body,
  291. .dialog_diy >>> .el-dialog__footer {
  292. background: #fafafa;
  293. }
  294. .aggregate >>> .el-table th > .cell {
  295. /* -webkit-line-clamp: 2;
  296. display: -webkit-box;
  297. -webkit-box-orient: vertical;
  298. overflow: hidden;
  299. text-overflow: ellipsis;
  300. height: 50px !important; */
  301. }
  302. </style>