index.vue 8.3 KB

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