InstitutionInfo.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877
  1. <!--**lxh--学校的增删改查-->
  2. <template>
  3. <div>
  4. <!--搜索start-->
  5. <el-form :inline="true" class="demo-form-inline search-center">
  6. <el-form-item label="请输入学校名称">
  7. <el-input
  8. v-model="searchKey"
  9. placeholder="请输入学校名称搜索"
  10. @keyup.enter.native="onSubmit"
  11. />
  12. </el-form-item>
  13. <el-form-item>
  14. <el-button type="primary" icon="el-icon-search" @click="onSubmit">搜索</el-button>
  15. </el-form-item>
  16. <el-form-item>
  17. <el-button
  18. type="primary"
  19. icon="el-icon-plus"
  20. @click="addInstitution"
  21. >
  22. 新增
  23. </el-button>
  24. </el-form-item>
  25. </el-form>
  26. <!--搜索end-->
  27. <!--记录展示start-->
  28. <el-table
  29. :data="tableData"
  30. border
  31. style="width: 100%"
  32. class="table-padding"
  33. >
  34. <el-table-column
  35. prop="institutionNo"
  36. label="学校编号"
  37. min-width="2"
  38. align="center"
  39. >
  40. </el-table-column>
  41. <el-table-column
  42. prop="institutionName"
  43. label="学校名称"
  44. min-width="2"
  45. align="center"
  46. >
  47. </el-table-column>
  48. <el-table-column
  49. label="最大测试次数"
  50. min-width="2"
  51. align="center"
  52. class="inputPa"
  53. >
  54. <template slot-scope="scope">
  55. <span>{{ scope.row.testNum == null ? 0 : scope.row.testNum }}</span>&nbsp;&nbsp;&nbsp;&nbsp;
  56. <i
  57. @click="editFu(scope.row, 1)"
  58. class="el-icon-edit"
  59. />
  60. <!-- <div class="inputTable" v-show="scope.row.testNumLinFlag">
  61. <el-input-number
  62. v-model="scope.row.testNumLin"
  63. :min="0"
  64. label="最大测试次数"
  65. ></el-input-number>
  66. <el-button
  67. @click="testNumCancle(scope.row)"
  68. size="small"
  69. style="margin-top: 10px; margin-right: 40px"
  70. >取消</el-button
  71. >
  72. <el-button
  73. @click="testNumCom(scope.row)"
  74. type="primary"
  75. size="small"
  76. style="margin-top: 10px"
  77. >保存</el-button
  78. >
  79. </div> -->
  80. <!-- <el-button size="mini">保存</el-button> -->
  81. <!-- <el-input type="text" v-model="scope.row.testNum"></el-input> -->
  82. <!-- <span>{{scope.row.isRegistrantsNum}}</span> -->
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="是否生效" min-width="2" align="center">
  86. <template slot-scope="scope">
  87. <el-switch
  88. v-model="scope.row.isTestNum"
  89. active-color="#13ce66"
  90. inactive-color="#ff4949"
  91. @change="isTestNumFun(scope.row)"
  92. >
  93. </el-switch>
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="最大注册人数" min-width="2" align="center">
  97. <template slot-scope="scope">
  98. <span>{{ scope.row.registrantsNum == null ? 0 : scope.row.registrantsNum }}</span>&nbsp;&nbsp;&nbsp;&nbsp;
  99. <i
  100. @click="editFu(scope.row, 2)"
  101. class="el-icon-edit"
  102. />
  103. <!-- <el-input type="text" v-model="scope.row.registrantsNum"></el-input> -->
  104. </template>
  105. </el-table-column>
  106. <el-table-column label="是否生效" min-width="2" align="center">
  107. <template slot-scope="scope">
  108. <el-switch
  109. v-model="scope.row.isRegistrantsNum"
  110. active-color="#13ce66"
  111. inactive-color="#ff4949"
  112. @change="isRegistrantsNumFun(scope.row)"
  113. >
  114. </el-switch>
  115. </template>
  116. </el-table-column>
  117. <el-table-column
  118. prop="allRegisterNum"
  119. label="注册人数"
  120. min-width="2"
  121. align="center"
  122. >
  123. <!-- <template slot-scope="scope">-->
  124. <!-- {{0}}-->
  125. <!-- </template>-->
  126. </el-table-column>
  127. <el-table-column
  128. prop="allTestNum"
  129. label="总测试次数"
  130. min-width="2"
  131. align="center"
  132. >
  133. <!-- <template slot-scope="scope">-->
  134. <!-- {{0}}-->
  135. <!-- </template>-->
  136. </el-table-column>
  137. <el-table-column label="操作" min-width="3" align="center">
  138. <template slot-scope="scope">
  139. <el-button type="primary" size="small" @click="viewDetail(scope.row)">
  140. 查看记录
  141. </el-button>
  142. <el-button type="primary" size="small" @click="goAuthList(scope.row)">
  143. 查看权限
  144. </el-button>
  145. <el-button
  146. type="danger"
  147. size="small"
  148. @click="delInstitutionInfo(scope.row.id)"
  149. >
  150. 删除
  151. </el-button>
  152. </template>
  153. </el-table-column>
  154. </el-table>
  155. <!--记录展示end-->
  156. <!--分页插件start-->
  157. <div class="txt-center mt20 pagClass">
  158. <el-pagination
  159. @size-change="handleSizeChange"
  160. @current-change="handleCurrentChange"
  161. :current-page="currentPage"
  162. :page-sizes="[10, 20, 50, 100]"
  163. :page-size="pageSize"
  164. layout="total, sizes, prev, pager, next, jumper"
  165. :total="total"
  166. >
  167. </el-pagination>
  168. </div>
  169. <!--分页插件end-->
  170. <!--添加部门-->
  171. <el-dialog
  172. title="添加学校"
  173. :visible.sync="dialogVisible"
  174. width="60%"
  175. top="4vh"
  176. :close-on-click-modal="false"
  177. >
  178. <el-form
  179. :model="dep"
  180. :rules="rules"
  181. ref="ruleForm"
  182. status-icon
  183. label-width="30%"
  184. class="demo-ruleForm"
  185. >
  186. <el-form-item label="请输入学校编号" prop="institutionNo">
  187. <el-input
  188. type="type"
  189. v-model.trim="dep.institutionNo"
  190. autocomplete="off"
  191. style="width: 70%"
  192. maxlength="50"
  193. />
  194. </el-form-item>
  195. <el-form-item label="请输入学校名称" prop="institutionName">
  196. <el-input
  197. type="type"
  198. v-model.trim="dep.institutionName"
  199. autocomplete="off"
  200. style="width: 70%"
  201. clearable
  202. />
  203. </el-form-item>
  204. <el-form-item label="超级管理员用户名" prop="loginName">
  205. <el-input
  206. type="type"
  207. v-model.trim="dep.loginName"
  208. autocomplete="off"
  209. style="width: 70%"
  210. />
  211. </el-form-item>
  212. <el-form-item label="超级管理员密码" prop="superAdminPassword">
  213. <el-input
  214. type="type"
  215. v-model.trim="dep.superAdminPassword"
  216. autocomplete="off"
  217. style="width: 70%"
  218. clearable
  219. />
  220. </el-form-item>
  221. <el-form-item label="是否添加管理员">
  222. <el-radio v-model="addAdminFlag" label="1">是</el-radio>
  223. <el-radio v-model="addAdminFlag" label="2">否</el-radio>
  224. </el-form-item>
  225. <el-form-item
  226. v-if="addAdminFlag == '1'"
  227. label="管理员名称"
  228. prop="adminPhone"
  229. >
  230. <el-input
  231. type="type"
  232. v-model.trim="dep.adminPhone"
  233. autocomplete="off"
  234. style="width: 70%"
  235. clearable
  236. />
  237. </el-form-item>
  238. <el-form-item
  239. v-if="addAdminFlag == '1'"
  240. label="管理员密码"
  241. prop="adminPassword"
  242. >
  243. <el-input
  244. type="type"
  245. v-model.trim="dep.adminPassword"
  246. autocomplete="off"
  247. style="width: 70%"
  248. clearable
  249. />
  250. </el-form-item>
  251. <el-form-item label="是否添加体验账号">
  252. <el-radio v-model="addUserFlag" label="1">是</el-radio>
  253. <el-radio v-model="addUserFlag" label="2">否</el-radio>
  254. </el-form-item>
  255. <el-form-item v-if="addUserFlag == '1'" label="体验账号">
  256. <el-input
  257. type="type"
  258. v-model.trim="dep.userPhone"
  259. autocomplete="off"
  260. style="width: 70%"
  261. clearable
  262. />
  263. </el-form-item>
  264. <el-form-item
  265. v-show="addUserFlag == '1'"
  266. label="体验账号密码"
  267. prop="userPassword"
  268. >
  269. <el-input
  270. type="type"
  271. v-model.trim="dep.userPassword"
  272. autocomplete="off"
  273. style="width: 70%"
  274. clearable
  275. />
  276. </el-form-item>
  277. <el-form-item label="有效测试次数是否生效" >
  278. <el-radio v-model="isTestNum" label="1" @input='testNumChange'>是</el-radio>
  279. <el-radio v-model="isTestNum" label="0" @input='testNumChange'>否</el-radio>
  280. </el-form-item>
  281. <el-form-item
  282. v-show="isTestNum == '1'"
  283. label="有效测试次数为"
  284. prop="testNum"
  285. >
  286. <el-input-number
  287. :min="0"
  288. v-model="dep.testNum"
  289. style="width: 70%"
  290. ></el-input-number>
  291. </el-form-item>
  292. <el-form-item label="最大注册人数是否生效" >
  293. <el-radio v-model="isRegistrantsNum" label="1" @input='registrantsNumChange'>是</el-radio>
  294. <el-radio v-model="isRegistrantsNum" label="0" @input='registrantsNumChange'>否</el-radio>
  295. </el-form-item>
  296. <el-form-item
  297. v-show="isRegistrantsNum == '1'"
  298. label="最大注册人数为"
  299. prop="registrantsNum"
  300. >
  301. <el-input-number
  302. :min="0"
  303. v-model="dep.registrantsNum"
  304. style="width: 70%"
  305. ></el-input-number>
  306. </el-form-item>
  307. <el-form-item>
  308. <el-button @click="cancelAdd">取消</el-button>
  309. <el-button type="primary" @click="savaInstitutionInfo()">确定</el-button>
  310. <el-button @click="copyText">一键复制</el-button>
  311. </el-form-item>
  312. </el-form>
  313. </el-dialog>
  314. <div class="dialogClass">
  315. <el-dialog
  316. :title="dialogDes"
  317. :visible.sync="dialogShow"
  318. width="30%"
  319. top="40vh"
  320. >
  321. <span>
  322. <el-input-number
  323. v-model="testNum"
  324. :min="0"
  325. label="最大测试次数"
  326. ></el-input-number>
  327. </span>
  328. <span slot="footer" class="dialog-footer">
  329. <el-button size="small" @click="dialogShow = false">取 消</el-button>
  330. <el-button size="small" type="primary" @click="dialogConfirm">确 定</el-button>
  331. </span>
  332. </el-dialog>
  333. </div>
  334. </div>
  335. </template>
  336. <script>
  337. export default {
  338. name: "InstitutionInfo",
  339. data() {
  340. return {
  341. //弹出框提示语
  342. dialogDes: "",
  343. //判断是最大测试人数点开了还是最大注册人数点开了
  344. testNumOrReg: 1,
  345. dialogShow: false,
  346. //修改的超级管理员id
  347. dialogShowId: "",
  348. //最大测试次数弹出框中的数
  349. testNum: 0,
  350. //学校编号
  351. orgNum: "",
  352. searchKey: "", //查询条件
  353. currentPage: 1,
  354. total: 200, //记录总数
  355. pageSize: 10,
  356. tableData: [],
  357. institutionNo: "",
  358. type: "1",
  359. // 添加部门
  360. dialogVisible: false,
  361. addAdminFlag: "1",
  362. addUserFlag: "1",
  363. isTestNum: "0", //有效次数标志位
  364. isRegistrantsNum: "0", //最大注册人数标志位
  365. dep: {
  366. institutionName: "",
  367. institutionNo: "",
  368. loginName: "",
  369. superAdminPassword: "",
  370. addAdminFlag: "2",
  371. adminPhone: "",
  372. adminPassword: "",
  373. addUserFlag: "2",
  374. isTestNum: 0, //有效次数标志位
  375. isRegistrantsNum: 0, //最大注册人数标志位
  376. testNum: 0, //有效次数
  377. registrantsNum: 0, //最大注册人数
  378. userPhone: "",
  379. userPassword: "",
  380. },
  381. rules: {
  382. institutionName: [
  383. { required: true, message: "请输入学校名称", trigger: "blur" },
  384. ],
  385. institutionNo: [
  386. { required: true, message: "请输入学校编号", trigger: "blur" },
  387. ],
  388. loginName: [
  389. {
  390. required: true,
  391. message: "请输入超级管理员用户名",
  392. trigger: "blur",
  393. },
  394. ],
  395. },
  396. };
  397. },
  398. // 页面初始化
  399. created() {
  400. this.getData()
  401. console.log('topUserInfo: ', localStorage.getItem('topUserInfo'))
  402. },
  403. methods: {
  404. testNumChange(){
  405. this.dep.testNum=0
  406. },
  407. registrantsNumChange(){
  408. this.dep.registrantsNum=0
  409. },
  410. dialogConfirm() {
  411. let list = JSON.stringify(this.tableData);
  412. let listData = JSON.parse(list);
  413. for (let i = 0; i < listData.length; i++) {
  414. if (listData[i].id == this.dialogShowId) {
  415. if (this.testNumOrReg == 1) {
  416. this.updataInterFaceTestNum();
  417. } else {
  418. this.updataInterFaceRegistrantsNum();
  419. }
  420. } else {
  421. // listData[i].testNumLinFlag = false;
  422. }
  423. }
  424. },
  425. editFu(row, val) {
  426. this.dialogShow = true;
  427. this.dialogShowId = row.id;
  428. this.orgNum = row.institutionNo;
  429. if (val == 1) {
  430. // this.dialogDes = "最大测试次数";
  431. this.dialogDes = "提示";
  432. this.testNumOrReg = 1;
  433. this.testNum = row.testNum;
  434. } else {
  435. // this.dialogDes = "最大注册人数";
  436. this.dialogDes = "提示";
  437. this.testNumOrReg = 2;
  438. this.testNum = row.registrantsNum;
  439. }
  440. },
  441. //更改状态
  442. updataFun(val) {
  443. let list = JSON.stringify(this.tableData);
  444. let listData = JSON.parse(list);
  445. for (let i = 0; i < listData.length; i++) {
  446. if (listData[i].id == val.id) {
  447. listData[i].testNumLinFlag = true;
  448. listData[i].testNumLin = val.testNum;
  449. } else {
  450. listData[i].testNumLinFlag = false;
  451. }
  452. }
  453. this.tableData = listData;
  454. },
  455. testNumCancle(val) {
  456. let list = JSON.stringify(this.tableData);
  457. let listData = JSON.parse(list);
  458. for (let i = 0; i < listData.length; i++) {
  459. if (listData[i].id == val.id) {
  460. listData[i].testNumLinFlag = false;
  461. listData[i].testNumLin = val.testNum;
  462. }
  463. }
  464. this.tableData = listData;
  465. },
  466. testNumCom(val) {
  467. let list = JSON.stringify(this.tableData);
  468. let listData = JSON.parse(list);
  469. for (let i = 0; i < listData.length; i++) {
  470. if (listData[i].id == val.id) {
  471. listData[i].testNumLinFlag = false;
  472. listData[i].testNum = val.testNumLin;
  473. this.updataInterFaceTestNum(val.institutionNo, val.testNumLin);
  474. } else {
  475. listData[i].testNumLinFlag = false;
  476. }
  477. }
  478. this.tableData = listData;
  479. },
  480. updataInterFaceTestNum() {
  481. this.$http.get(
  482. `/institution/updateTestNum?institutionNo=${this.orgNum}&testNum=${this.testNum}`,
  483. {},
  484. (response) => {
  485. if (response.code == "200") {
  486. this.getData();
  487. this.$message.success("修改成功");
  488. this.dialogShow = false;
  489. }
  490. }
  491. );
  492. },
  493. updataInterFaceIsTestNum(institutionNo, isTestNum) {
  494. this.$http.get(
  495. `/institution/updateIsTestNum?institutionNo=${institutionNo}&isTestNum=${isTestNum}`,
  496. {},
  497. (response) => {
  498. if (response.code == "200") {
  499. this.$message.success("修改成功");
  500. }
  501. }
  502. );
  503. },
  504. updataInterFaceIsRegistrantsNum(institutionNo, isRegistrantsNum) {
  505. this.$http.get(
  506. `/institution/updateIsRegistrantsNum?institutionNo=${institutionNo}&isRegistrantsNum=${isRegistrantsNum}`,
  507. {},
  508. (response) => {
  509. if (response.code == "200") {
  510. this.getData();
  511. this.$message.success("修改成功");
  512. this.dialogShow = false;
  513. }
  514. }
  515. );
  516. },
  517. updataInterFaceRegistrantsNum() {
  518. this.$http.get(
  519. `/institution/updateRegistrantsNum?institutionNo=${this.orgNum}&registrantsNum=${this.testNum}`,
  520. {},
  521. (response) => {
  522. if (response.code == "200") {
  523. this.getData();
  524. this.$message.success("修改成功");
  525. this.dialogShow = false;
  526. }
  527. }
  528. );
  529. },
  530. //修改状态
  531. isTestNumFun(val) {
  532. let list = JSON.stringify(this.tableData);
  533. let listData = JSON.parse(list);
  534. for (let i = 0; i < listData.length; i++) {
  535. if (listData[i].id == val.id) {
  536. listData[i].isTestNum = val.isTestNum;
  537. this.updataInterFaceIsTestNum(
  538. val.institutionNo,
  539. val.isTestNum ? 1 : 0
  540. );
  541. } else {
  542. }
  543. }
  544. this.tableData = listData;
  545. },
  546. isRegistrantsNumFun(val) {
  547. let list = JSON.stringify(this.tableData);
  548. let listData = JSON.parse(list);
  549. for (let i = 0; i < listData.length; i++) {
  550. if (listData[i].id == val.id) {
  551. listData[i].isRegistrantsNum = val.isRegistrantsNum;
  552. this.updataInterFaceIsRegistrantsNum(
  553. val.institutionNo,
  554. val.isRegistrantsNum ? 1 : 0
  555. );
  556. } else {
  557. }
  558. }
  559. this.tableData = listData;
  560. },
  561. // 后台get请求获得数据
  562. getNum() {
  563. let that = this;
  564. this.$http.get("/institution/newNumber", {}, (response) => {
  565. that.dep.institutionNo = response.data;
  566. that.dep.loginName = response.data;
  567. that.dep.superAdminPassword = "Admin@123";
  568. //管理员名称
  569. that.dep.adminPhone = response.data + "Admin";
  570. //管理员密码
  571. that.dep.adminPassword = "Admin@123";
  572. //体验账号
  573. that.dep.userPhone = response.data + "Test";
  574. //体验账号密码
  575. that.dep.userPassword = "111111";
  576. that.dep.testNum = 0;
  577. that.dep.registrantsNum = 0;
  578. });
  579. },
  580. //一键复制关键信息
  581. copyText() {
  582. let text = `
  583. 网址:https://school.jue-ming.com
  584. 学校编号:${this.dep.institutionNo}
  585. 超级管理员账号/密码:${this.dep.institutionNo}/${this.dep.superAdminPassword}
  586. 测试账号/密码:${this.dep.userPhone}/${this.dep.userPassword}`;
  587. navigator.clipboard.writeText(text);
  588. this.$message.success("已复制到粘贴板");
  589. },
  590. agreeChangeAddUserFlag(val) {
  591. if (val == true) {
  592. this.dep.addUserFlag = true;
  593. } else {
  594. this.dep.addUserFlag = false;
  595. }
  596. if (val === false) {
  597. this.dep = {
  598. userPhone: "",
  599. userPassword: "",
  600. };
  601. }
  602. if (this.addAdminFlag == "2") {
  603. this.dep.addAdminFlag = false;
  604. } else {
  605. this.dep.addAdminFlag = true;
  606. }
  607. if (this.addUserFlag == "2") {
  608. this.dep.addUserFlag = false;
  609. } else {
  610. this.dep.addUserFlag = true;
  611. }
  612. },
  613. agreeChangeAddAdminFlag(val) {
  614. if (val == true) {
  615. this.dep.addAdminFlag = "true";
  616. } else {
  617. this.dep.addAdminFlag = "false";
  618. }
  619. if (val === false) {
  620. this.dep = {
  621. adminPhone: "",
  622. adminPassword: "",
  623. };
  624. }
  625. },
  626. // 后台get请求获得数据
  627. getData() {
  628. this.$http.get(
  629. "/institution/getAllInstitutionList?searchKey=" +
  630. this.searchKey +
  631. "&pageNum=" +
  632. this.currentPage +
  633. "&type=" +
  634. this.type +
  635. "&pageSize=" +
  636. this.pageSize +
  637. "",
  638. {},
  639. (response) => {
  640. this.total = response.data.allNum;
  641. this.tableData = response.data.data;
  642. for (let i = 0; i < this.tableData.length; i++) {
  643. if (this.tableData[i].isRegistrantsNum == 0) {
  644. this.tableData[i].isRegistrantsNum = false;
  645. } else {
  646. this.tableData[i].isRegistrantsNum = true;
  647. }
  648. if (this.tableData[i].isTestNum == 0) {
  649. this.tableData[i].isTestNum = false;
  650. } else {
  651. this.tableData[i].isTestNum = true;
  652. }
  653. //最大测试次数需要加的标志
  654. // testNum
  655. this.tableData[i].testNumLin = 0;
  656. this.tableData[i].testNumLinFlag = false;
  657. }
  658. console.log('this.tableData: ', this.tableData)
  659. }
  660. );
  661. },
  662. // 添加部门
  663. addInstitution() {
  664. this.dep = {
  665. institutionName: "",
  666. institutionNo: "",
  667. loginName: "",
  668. superAdminPassword: "",
  669. addAdminFlag: true,
  670. adminPhone: "",
  671. adminPassword: "",
  672. addUserFlag: true,
  673. userPhone: "",
  674. userPassword: "",
  675. testNum: 0, //有效次数
  676. registrantsNum: 0, //最大注册人数
  677. isTestNum: 0, //有效次数标志位
  678. isRegistrantsNum: 0,
  679. };
  680. this.isRegistrantsNum='0';
  681. this.isTestNum='0';
  682. this.dialogVisible = true;
  683. this.getNum();
  684. },
  685. // 取消添加
  686. cancelAdd() {
  687. this.dialogVisible = false;
  688. },
  689. // 关闭事件
  690. closeHandle() {
  691. this.$refs["ruleForm"].resetFields();
  692. },
  693. // 保存新增学校信息
  694. savaInstitutionInfo() {
  695. if (this.addAdminFlag == "2") {
  696. this.dep.addAdminFlag = false;
  697. this.dep.adminPhone = "";
  698. this.dep.adminPassword = "";
  699. } else {
  700. this.dep.addAdminFlag = true;
  701. }
  702. if (this.addUserFlag == "2") {
  703. this.dep.addUserFlag = false;
  704. this.dep.userPhone = "";
  705. this.dep.userPassword = "";
  706. } else {
  707. this.dep.addUserFlag = true;
  708. }
  709. if (this.isTestNum == "0") {
  710. this.dep.isTestNum = 0;
  711. } else {
  712. this.dep.isTestNum = 1;
  713. }
  714. if (this.isRegistrantsNum == "0") {
  715. this.dep.isRegistrantsNum = 0;
  716. } else {
  717. this.dep.isRegistrantsNum = 1;
  718. }
  719. console.log('this.dep: ', this.dep)
  720. this.$refs["ruleForm"].validate((valid) => {
  721. if (valid) {
  722. this.$http.post(
  723. "institution/save",
  724. {
  725. ...this.dep,
  726. },
  727. () => {
  728. this.getData();
  729. this.dialogVisible = false;
  730. this.$message.success("添加成功");
  731. }
  732. )
  733. } else {
  734. return false;
  735. }
  736. })
  737. },
  738. // 删除学校信息
  739. delInstitutionInfo(id) {
  740. this.$confirm("此操作将删除该学校, 是否继续?", "提示", {
  741. confirmButtonText: "确定",
  742. cancelButtonText: "取消",
  743. type: "warning",
  744. })
  745. .then(() => {
  746. this.$http.get(`institution/del/${id}`, {}, (msg) => {
  747. this.$message.success("删除成功");
  748. this.getData();
  749. });
  750. })
  751. .catch(() => {});
  752. },
  753. viewDetail(row) {
  754. this.$confirm(`您即将切换${row.institutionName}的管理员账号使用本系统, 是否继续?`, '页面切换提醒', {
  755. confirmButtonText: '确定',
  756. cancelButtonText: '取消',
  757. type: 'warning'
  758. }).then(() => {
  759. localStorage.setItem('topUserInfo', JSON.stringify({
  760. userType: sessionStorage.getItem("f7a42fe7211f98ac7a60a285ac3a9528"),
  761. institutionNo: sessionStorage.getItem("f7a42fe7211f98ac7a60a285ac3a9527"),
  762. institutionName: sessionStorage.getItem("f7a42fe7211f98ac7a60a285ac3a9529")
  763. }))
  764. sessionStorage.setItem("f7a42fe7211f98ac7a60a285ac3a9528", '3')
  765. sessionStorage.setItem("f7a42fe7211f98ac7a60a285ac3a9527", row.institutionNo)
  766. sessionStorage.setItem("f7a42fe7211f98ac7a60a285ac3a9529", row.institutionName)
  767. this.$router.push({
  768. path: '/ContainerSys/AdminHomeS'
  769. })
  770. location.reload()
  771. }).catch(() => {
  772. })
  773. },
  774. // 查看做该量表的所有测试者
  775. getSacleUserList(row) {
  776. this.$router.push({
  777. path: "CognitiveTaskUserList",
  778. query: {
  779. name: row.name,
  780. },
  781. });
  782. },
  783. // 搜索
  784. onSubmit() {
  785. this.currentPage = 1;
  786. this.getData();
  787. },
  788. // 分页start
  789. handleCurrentChange(val) {
  790. this.currentPage = val;
  791. this.getData();
  792. },
  793. handleSizeChange(val) {
  794. this.pageSize = val;
  795. this.getData();
  796. },
  797. // 查看学校权限
  798. goAuthList(row) {
  799. this.$router.push(
  800. "/ContainerSys/AuthList?institutionNo=" + row.institutionNo
  801. );
  802. },
  803. },
  804. };
  805. </script>
  806. <style scoped>
  807. .dialogClass >>> .el-dialog__header {
  808. padding: 10px 20px 10px !important;
  809. }
  810. .dialogClass >>> .el-dialog__headerbtn {
  811. top: 10px !important;
  812. }
  813. .dialogClass >>> .el-dialog__body {
  814. padding: 3px 20px !important;
  815. }
  816. .dialogClass >>> .el-dialog {
  817. border-radius: 4px;
  818. }
  819. </style>
  820. <style scoped>
  821. .inputTable {
  822. opacity: 0.9;
  823. padding-top: 10px;
  824. padding-left: 10px;
  825. padding-right: 10px;
  826. padding-bottom: 20px;
  827. background-color: rgb(255, 255, 255);
  828. position: absolute;
  829. z-index: 999;
  830. margin-left: 0px;
  831. margin-top: -30px;
  832. }
  833. .inputPa {
  834. position: relative;
  835. z-index: 2;
  836. }
  837. .pagClass {
  838. z-index: 998;
  839. position: relative;
  840. }
  841. </style>