index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. <template>
  2. <div class="testPersonExamine">
  3. <div class="testTit">
  4. <div class="teaLis">
  5. <div
  6. class="teal"
  7. @click="cutPage(2)"
  8. :class="[pType == 2 ? 'Tbor' : '']"
  9. >
  10. 专任教师
  11. </div>
  12. <div
  13. class="teal"
  14. @click="cutPage(1)"
  15. :class="[pType == 1 ? 'Tbor' : '']"
  16. >
  17. 班主任考核
  18. </div>
  19. </div>
  20. <div style="margin-right: 30px;display: flex;">
  21. <el-button
  22. type="primary"
  23. size="mini"
  24. style="margin-right: 15px;"
  25. @click="saveTab"
  26. v-if="allData.type == 1"
  27. >保存</el-button
  28. >
  29. <el-button
  30. v-if="!allData.rjson"
  31. type="primary"
  32. size="mini"
  33. @click="Submit"
  34. >提交</el-button
  35. >
  36. </div>
  37. </div>
  38. <div v-if="pType == 2" v-loading="tabLoad">
  39. <div class="sBox_table">
  40. <div class="table_title">
  41. <div>一级指标</div>
  42. <div>二级指标</div>
  43. <div>评价方法</div>
  44. <div>分值</div>
  45. <div>自评</div>
  46. <div>自评概述</div>
  47. <div>数据来源</div>
  48. <div>认定</div>
  49. <div>认定概述</div>
  50. </div>
  51. <div class="table_Content" v-for="item in PageBaseData" :key="item.id">
  52. <div class="twoCol">
  53. <div class="ColTit">{{ item.name }}</div>
  54. <div class="ColCon">
  55. <div class="twoCon" v-for="k in item.children" :key="k.id">
  56. <div>{{ k.name }}</div>
  57. <div style="padding: 10px;box-sizing: border-box;">
  58. {{ k.evaMethod }}
  59. </div>
  60. <div>{{ k.score }}</div>
  61. <div>
  62. <el-input-number
  63. v-model="k.sco1"
  64. :controls="false"
  65. :min="0"
  66. :max="k.score"
  67. ></el-input-number>
  68. </div>
  69. <div class="tArea">
  70. <textarea v-model.trim="k.selfSummary" />
  71. </div>
  72. <div>
  73. <div v-if="!k.testid.test.length">/</div>
  74. <div v-else style="padding-top: 10px;">
  75. <!-- {{ reverseString(k.testid.test) }} -->
  76. <div
  77. v-for="(item2, index) in k.testid.test"
  78. :key="item2.courseId"
  79. @click="lookPrize(item2.courseId)"
  80. class="orgData"
  81. >
  82. {{ item2.title }}:{{ item2.num }}份
  83. </div>
  84. </div>
  85. </div>
  86. <div style="display: flex;justify-content: center;">
  87. {{ k.sco2 }}
  88. </div>
  89. <div style="display: flex;justify-content: center;">
  90. {{ k.cogSum }}
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. <div v-if="pType == 1" v-loading="tabLoad">
  99. <div class="sBox_table">
  100. <div class="table_title2">
  101. <div>一级指标</div>
  102. <div>二级指标</div>
  103. <div>评价方法</div>
  104. <div>分值</div>
  105. <div>自评</div>
  106. <div>自评概述</div>
  107. <div>数据来源</div>
  108. <div>认定</div>
  109. <div>认定概述</div>
  110. </div>
  111. <div class="table_Content2" v-for="item in PageBaseData" :key="item.id">
  112. <div class="twoCol">
  113. <div class="ColTit">{{ item.name }}</div>
  114. <div class="ColCon">
  115. <div class="twoCon" v-for="k in item.children" :key="k.id">
  116. <div>{{ k.name }}</div>
  117. <div>{{ k.evaMethod }}</div>
  118. <div>{{ k.score }}</div>
  119. <div>
  120. <el-input-number
  121. v-model="k.sco1"
  122. :controls="false"
  123. :min="0"
  124. :max="k.score"
  125. ></el-input-number>
  126. </div>
  127. <div class="tArea">
  128. <textarea v-model.trim="k.selfSummary" />
  129. </div>
  130. <div>
  131. <div v-if="!k.testid.test.length">/</div>
  132. <div v-else style="padding-top: 10px;">
  133. <div
  134. v-for="(item2, index) in k.testid.test"
  135. :key="item2.courseId"
  136. @click="lookPrize(item2.courseId)"
  137. class="orgData"
  138. >
  139. {{ item2.title }}:{{ item2.num }}份
  140. </div>
  141. </div>
  142. </div>
  143. <div>{{ k.sco2 }}</div>
  144. <div>{{ k.cogSum }}</div>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. <!-- 点击数据来源 -->
  152. <el-dialog
  153. title=""
  154. :visible.sync="diaIframe"
  155. :append-to-body="true"
  156. width="95%"
  157. :before-close="handleClose"
  158. class="dialog_diy"
  159. >
  160. <div style="height: 100%;">
  161. <iframe
  162. ref="viframe"
  163. style="width: 100%; height: 99%; border: none"
  164. :src="ifmUrl"
  165. ></iframe>
  166. </div>
  167. <span slot="footer" class="dialog-footer">
  168. <el-button @click="diaIframe = false">关 闭</el-button>
  169. </span>
  170. </el-dialog>
  171. </div>
  172. </template>
  173. <script>
  174. export default {
  175. data() {
  176. return {
  177. pType: 2,
  178. allData: {
  179. type: 1,
  180. rjson: ""
  181. },
  182. // 页面填写数据
  183. tableJsonCon: [],
  184. // 页面基础ui
  185. PageBaseData: [],
  186. tabLoad: false, //表格加载状态
  187. userid: this.$route.query.userid, //用户id
  188. oid: this.$route.query.oid, //学校id
  189. org: this.$route.query.org, //组织id
  190. ifmUrl: "", //数据来源地址
  191. diaIframe: false //数据来源弹框
  192. };
  193. },
  194. watch: {
  195. pType(newVal, oldVal) {
  196. this.getPageBase();
  197. }
  198. },
  199. computed: {},
  200. mounted() {
  201. this.getPageBase();
  202. // console.log(JSON.stringify(this.TeaTabJson));
  203. },
  204. methods: {
  205. // 提交
  206. Submit() {
  207. if (this.allData.type == 2) {
  208. this.$message({
  209. type: "info",
  210. message: "您已提交过,请勿重复提交"
  211. });
  212. return;
  213. }
  214. for (const e of this.PageBaseData) {
  215. for (const k of e.children) {
  216. if (k.testid.test.length > 0) {
  217. k.testid.test = k.testid.test.map(item => item.courseId);
  218. }
  219. }
  220. }
  221. this.$confirm("确认提交?", "提示", {
  222. confirmButtonText: "确定",
  223. cancelButtonText: "取消",
  224. type: " info"
  225. })
  226. .then(() => {
  227. let params = [
  228. {
  229. uid: this.userid,
  230. oid: this.oid,
  231. org: this.org,
  232. type: this.pType,
  233. json: JSON.stringify(this.PageBaseData),
  234. ttype: 2
  235. }
  236. ];
  237. this.ajax
  238. .post(this.$store.state.api + "addTestExamineWorks", params)
  239. .then(res => {
  240. this.getData();
  241. })
  242. .catch(error => {
  243. console.log(error);
  244. });
  245. })
  246. .catch(() => {
  247. this.handleData();
  248. this.$message({
  249. type: "info",
  250. message: "已取消提交"
  251. });
  252. });
  253. },
  254. // 保存
  255. saveTab() {
  256. for (const e of this.PageBaseData) {
  257. for (const k of e.children) {
  258. if (k.testid.test.length > 0) {
  259. k.testid.test = k.testid.test.map(item => item.courseId);
  260. }
  261. }
  262. }
  263. this.$confirm("确认保存?", "提示", {
  264. confirmButtonText: "确定",
  265. cancelButtonText: "取消",
  266. type: " info"
  267. })
  268. .then(() => {
  269. let params = [
  270. {
  271. uid: this.userid,
  272. oid: this.oid,
  273. org: this.org,
  274. type: this.pType,
  275. json: JSON.stringify(this.PageBaseData),
  276. ttype: 1
  277. }
  278. ];
  279. this.ajax
  280. .post(this.$store.state.api + "addTestExamineWorks", params)
  281. .then(res => {
  282. console.log('addTestExamineWorks',res);
  283. this.getData();
  284. // console.log();
  285. // console.log("resresresres", res.data[0]);
  286. })
  287. .catch(error => {
  288. console.log(error);
  289. });
  290. })
  291. .catch(() => {
  292. this.handleData();
  293. this.$message({
  294. type: "info",
  295. message: "已取消保存"
  296. });
  297. });
  298. },
  299. // 切换专任,班主任
  300. cutPage(e) {
  301. this.pType = e;
  302. },
  303. // 获取页面ui
  304. getData() {
  305. this.tabLoad = true;
  306. let params = {
  307. uid: this.userid,
  308. type: this.pType
  309. };
  310. this.ajax
  311. .get(this.$store.state.api + "getTestExamineByUserId", params)
  312. .then(res => {
  313. console.log("getTestExamineByUserId", res);
  314. if (res.data[0].length > 0) {
  315. this.allData = res.data[0][0];
  316. let val = JSON.parse(res.data[0][0].json);
  317. this.PageBaseData.forEach(e => {
  318. val.forEach(i=>{
  319. if (e.id==i.id) {
  320. e.name=i.name
  321. e.children.forEach(a=>{
  322. i.children.forEach(b=>{
  323. if (a.id==b.id) {
  324. a.name=b.name
  325. a.score=b.score
  326. a.sco1=b.sco1
  327. a.sco2=b.sco2
  328. a.evaStandard=b.evaStandard
  329. a.evaMethod=b.evaMethod
  330. a.cogSum=b.cogSum
  331. a.selfSummary=b.selfSummary
  332. a.dep=b.dep
  333. a.type=b.type
  334. a.testid=b.testid
  335. }
  336. })
  337. })
  338. }
  339. })
  340. });
  341. this.handleData();
  342. return (this.tabLoad = false);
  343. } else {
  344. this.handleData();
  345. this.tabLoad = false
  346. }
  347. // else {
  348. // this.allData.type = 1;
  349. // this.allData.rjson = "";
  350. // this.getPageBase();
  351. // this.tabLoad = false;
  352. // }
  353. })
  354. .catch(error => {
  355. console.log(error);
  356. });
  357. },
  358. // 获取页面基础ui信息
  359. getPageBase() {
  360. let params = {
  361. typ: this.pType,
  362. org: this.org,
  363. oid: this.oid
  364. };
  365. this.ajax
  366. .get(this.$store.state.api + "selectTestExamineBase", params)
  367. .then(res => {
  368. // console.log("resresresres", res.data[0]);
  369. console.log("selectTestExamineBase", res.data[0][0]);
  370. this.PageBaseData = JSON.parse(res.data[0][0].json);
  371. // 先获取基础模板,然后再获取用户又没有填写过,填写过就开始循环赋值给基础模板,最后提交基础模板
  372. this.getData();
  373. // this.handleData();
  374. })
  375. .catch(error => {
  376. console.log(error);
  377. });
  378. },
  379. async handleData() {
  380. for (const e of this.PageBaseData) {
  381. for (const k of e.children) {
  382. if (k.testid.test.length > 0) {
  383. k.testid.test = await this.computedTest(k.testid.test);
  384. }
  385. }
  386. }
  387. },
  388. computedTest(val) {
  389. let params = [
  390. {
  391. uid: this.uid,
  392. testId: val.join(",")
  393. }
  394. ];
  395. return new Promise(resolve => {
  396. this.ajax
  397. .post(this.$store.state.api + "selectExamineTestName", params)
  398. .then(res => {
  399. resolve(res.data[0]);
  400. })
  401. .catch(error => {
  402. console.log(error);
  403. });
  404. });
  405. },
  406. // 查看数据来源
  407. lookPrize(val) {
  408. // return;
  409. 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=${this.userid}`;
  410. // this.ifmUrl = `https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/#/test?userid=${this.userid}&oid=45facc0a-1211-11ec-80ad-005056b86db5&org=&role=0`;
  411. this.diaIframe = true;
  412. },
  413. // 关闭弹框
  414. handleClose(done) {
  415. done();
  416. }
  417. }
  418. };
  419. </script>
  420. <style scoped>
  421. .testPersonExamine {
  422. width: 100%;
  423. min-width: calc(100px * 10);
  424. min-height: 100%;
  425. padding: 10px;
  426. box-sizing: border-box;
  427. background-color: #fff;
  428. }
  429. .tArea {
  430. box-sizing: border-box;
  431. padding: 5px;
  432. }
  433. .testPersonExamine > .testTit {
  434. height: 100px;
  435. display: flex;
  436. justify-content: space-between;
  437. align-items: center;
  438. }
  439. .teaLis {
  440. display: flex;
  441. }
  442. .teal {
  443. padding: 10px 20px;
  444. cursor: pointer;
  445. }
  446. .Tbor {
  447. border-bottom: 2px rgba(54, 129, 252, 1) solid;
  448. font-weight: 600;
  449. }
  450. .testCon {
  451. box-sizing: border-box;
  452. padding: 20px;
  453. }
  454. .orgData {
  455. cursor: pointer;
  456. color: #528df6;
  457. margin-bottom: 10px;
  458. }
  459. .diaScoreTop {
  460. display: flex;
  461. justify-content: space-between;
  462. height: 60px;
  463. }
  464. .diaScoreLeft {
  465. display: flex;
  466. justify-content: space-between;
  467. align-items: center;
  468. }
  469. .diaScoreLeft > div {
  470. margin-right: 30px;
  471. }
  472. .diaScoreRight {
  473. display: flex;
  474. justify-content: space-between;
  475. align-items: center;
  476. }
  477. .TabBtn {
  478. cursor: pointer;
  479. color: #528df6;
  480. }
  481. .sBox_table {
  482. width: 100%;
  483. min-width: calc(110px * 9);
  484. margin: 0 auto;
  485. /* min-width: 1520px; */
  486. font-size: 14px;
  487. }
  488. .table_title {
  489. width: 100%;
  490. min-width: calc(110px * 9);
  491. height: 50px;
  492. background: #e0eafb;
  493. border: 1px solid #d5d8df;
  494. display: flex;
  495. flex-direction: row;
  496. flex-wrap: nowrap;
  497. align-items: center;
  498. }
  499. .table_title > div {
  500. width: calc(100% / 9);
  501. min-width: 110px;
  502. text-align: center;
  503. height: 100%;
  504. line-height: 50px;
  505. border-right: 1px solid #d5d8df;
  506. }
  507. .table_title2 {
  508. width: 100%;
  509. min-width: calc(110px * 8);
  510. height: 50px;
  511. background: #e0eafb;
  512. border: 1px solid #d5d8df;
  513. display: flex;
  514. flex-direction: row;
  515. flex-wrap: nowrap;
  516. align-items: center;
  517. }
  518. .table_title2 > div {
  519. width: calc(100% / 8);
  520. min-width: 110px;
  521. text-align: center;
  522. height: 100%;
  523. line-height: 50px;
  524. border-right: 1px solid #d5d8df;
  525. }
  526. .table_title > div:last-child {
  527. border: none;
  528. }
  529. .table_Content {
  530. width: 100%;
  531. min-width: calc(110px * 9);
  532. border: 1px solid #d5d8df;
  533. display: flex;
  534. flex-direction: row;
  535. flex-wrap: nowrap;
  536. text-align: center;
  537. align-items: center;
  538. }
  539. .table_Content2 {
  540. width: 100%;
  541. min-width: calc(110px * 8);
  542. border: 1px solid #d5d8df;
  543. display: flex;
  544. flex-direction: row;
  545. flex-wrap: nowrap;
  546. text-align: center;
  547. align-items: center;
  548. }
  549. .twoCol {
  550. width: 100%;
  551. display: flex;
  552. }
  553. .ColTit {
  554. width: calc(100% / 9);
  555. min-width: 110px;
  556. display: flex;
  557. justify-content: center;
  558. align-items: center;
  559. }
  560. .ColTit2 {
  561. width: calc(100% / 8);
  562. min-width: 110px;
  563. display: flex;
  564. justify-content: center;
  565. align-items: center;
  566. }
  567. .twoCon {
  568. display: flex;
  569. }
  570. .twoCon > div >>> .el-input-number {
  571. height: 100% !important;
  572. }
  573. .twoCon > div >>> .el-input {
  574. height: 100% !important;
  575. }
  576. .twoCon > div > input {
  577. border: none;
  578. width: 100%;
  579. height: 100%;
  580. outline-style: none;
  581. text-align: center;
  582. }
  583. .twoCon {
  584. display: flex;
  585. }
  586. .twoCon > div > textarea {
  587. border: none;
  588. width: 100%;
  589. height: 100%;
  590. resize: none;
  591. outline-style: none;
  592. }
  593. /* 取消[type='number']的input的上下箭头 */
  594. input::-webkit-inner-spin-button {
  595. -webkit-appearance: none !important;
  596. }
  597. input::-webkit-outer-spin-button {
  598. -webkit-appearance: none !important;
  599. }
  600. input[type="number"] {
  601. -moz-appearance: textfield;
  602. }
  603. .twoCon > div {
  604. width: calc(100% / 8);
  605. /* min-width: 110px; */
  606. min-height: 50px;
  607. /* line-height: 50px; */
  608. display: flex;
  609. justify-content: center;
  610. align-items: center;
  611. border-left: 1px #ccc solid;
  612. border-bottom: 1px #ccc solid;
  613. }
  614. .twoCon > div >>> .el-input__inner {
  615. height: 100%;
  616. border: none;
  617. padding-left: 15px;
  618. padding-right: 15px;
  619. }
  620. .twoCon2 {
  621. display: flex;
  622. }
  623. .twoCon2 > div {
  624. width: calc(100% / 7);
  625. min-width: 110px;
  626. min-height: 50px;
  627. /* line-height: 50px; */
  628. display: flex;
  629. justify-content: center;
  630. align-items: center;
  631. border-left: 1px #ccc solid;
  632. border-bottom: 1px #ccc solid;
  633. }
  634. .ColCon {
  635. flex: 1;
  636. }
  637. .dialog_diy >>> .el-dialog {
  638. height: 95%;
  639. margin: 0 auto !important;
  640. margin-top: 20px !important;
  641. overflow: hidden;
  642. }
  643. .dialog_diy >>> .el-dialog__header {
  644. background: #454545 !important;
  645. padding: 25px 20px;
  646. }
  647. .dialog_diy >>> .el-dialog__body {
  648. height: calc(100% - 50px);
  649. box-sizing: border-box;
  650. padding: 0px;
  651. }
  652. .dialog_diy >>> .el-dialog__title {
  653. color: #fff;
  654. }
  655. .dialog_diy >>> .el-dialog__headerbtn {
  656. top: 19px;
  657. }
  658. .dialog_diy >>> .el-dialog__headerbtn .el-dialog__close {
  659. color: #fff;
  660. }
  661. .dialog_diy >>> .el-dialog__headerbtn .el-dialog__close:hover {
  662. color: #fff;
  663. }
  664. .dialog_diy >>> .el-dialog__body,
  665. .dialog_diy >>> .el-dialog__footer {
  666. background: #fafafa;
  667. }
  668. </style>