clientConfig.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. <template>
  2. <el-container>
  3. <el-main class="el-main-padding">
  4. <el-form
  5. :model="ruleForm"
  6. :rules="rules"
  7. ref="ruleForm"
  8. label-width="136px"
  9. class="demo-ruleForm"
  10. :inline-message="true"
  11. >
  12. <el-form-item v-if="isSuperAdmin" label="学校">
  13. <el-select
  14. v-model="ruleForm.orgId"
  15. placeholder="请选择"
  16. style="width: 180px"
  17. >
  18. <el-option
  19. v-for="item in rootOrgList"
  20. :label="item.name"
  21. :value="item.id"
  22. :key="item.id"
  23. />
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item label="系统名称" prop="OE_STUDENT_SYS_NAME">
  27. <el-input
  28. v-model="ruleForm.OE_STUDENT_SYS_NAME"
  29. placeholder="请输入系统名称"
  30. class="input-width"
  31. ></el-input>
  32. </el-form-item>
  33. <el-form-item label="学校logo" prop="LOGO_FILE_URL">
  34. <el-upload
  35. class="upload-width"
  36. ref="upload"
  37. accept=".png"
  38. :action="uploadAction"
  39. :headers="uploadHeaders"
  40. :data="uploadData"
  41. :before-upload="beforeUpload"
  42. :on-progress="uploadProgress"
  43. :on-success="uploadSuccess"
  44. :on-error="uploadError"
  45. :on-remove="handleRemove"
  46. :file-list="fileList"
  47. :auto-upload="false"
  48. :multiple="false"
  49. :limit="1"
  50. :on-exceed="handleExceed"
  51. list-type="picture"
  52. >
  53. <el-button size="small" slot="trigger" type="primary"
  54. >选择文件</el-button
  55. >&nbsp;
  56. <el-button size="small" type="success" @click="submitUpload"
  57. >确认上传</el-button
  58. >
  59. <el-button size="small" type="danger" @click="removeFile"
  60. >清空文件</el-button
  61. >
  62. <div slot="tip" class="el-upload__tip">
  63. 图片大小(长*宽)为400*100的png文件
  64. </div>
  65. </el-upload>
  66. <el-input v-show="false" v-model="ruleForm.LOGO_FILE_URL"></el-input>
  67. </el-form-item>
  68. <el-form-item label="登录帐号选择" prop="loginType">
  69. <el-checkbox-group v-model="ruleForm.loginType">
  70. <el-checkbox
  71. v-for="lt in loginTypes"
  72. name="loginType"
  73. :label="lt.code"
  74. v-model="lt.code"
  75. :key="lt.code"
  76. >{{ lt.name }}</el-checkbox
  77. >
  78. </el-checkbox-group>
  79. </el-form-item>
  80. <el-form-item label="学号登录别名" prop="STUDENT_CODE_LOGIN_ALIAS">
  81. <el-input
  82. v-model="ruleForm.STUDENT_CODE_LOGIN_ALIAS"
  83. placeholder="请输入学号登录别名"
  84. class="input-width"
  85. ></el-input>
  86. </el-form-item>
  87. <el-form-item
  88. label="身份证号登录别名"
  89. prop="IDENTITY_NUMBER_LOGIN_ALIAS"
  90. >
  91. <el-input
  92. v-model="ruleForm.IDENTITY_NUMBER_LOGIN_ALIAS"
  93. placeholder="请输入身份号登录别名"
  94. class="input-width"
  95. ></el-input>
  96. </el-form-item>
  97. <el-form-item label="考生端登录方式" prop="loginSupport">
  98. <el-checkbox-group v-model="ruleForm.loginSupport">
  99. <el-checkbox
  100. v-for="lt in loginSupports"
  101. name="loginSupport"
  102. :label="lt.code"
  103. v-model="lt.code"
  104. :key="lt.code"
  105. >{{ lt.name }}</el-checkbox
  106. >
  107. </el-checkbox-group>
  108. </el-form-item>
  109. <el-form-item label="防作弊配置" prop="preventCheatingConfig">
  110. <el-checkbox-group v-model="ruleForm.preventCheatingConfig">
  111. <el-checkbox
  112. v-for="pcc in preventCheatingConfigs"
  113. name="preventCheatingConfig"
  114. :label="pcc.code"
  115. v-model="pcc.code"
  116. :key="pcc.code"
  117. >{{ pcc.name }}</el-checkbox
  118. >
  119. </el-checkbox-group>
  120. </el-form-item>
  121. <el-form-item
  122. v-show="false"
  123. label="窗口默认大小"
  124. prop="STUDENT_CLIENT_DEFAULT_SIZE"
  125. >
  126. <el-input
  127. v-model="ruleForm.STUDENT_CLIENT_DEFAULT_SIZE"
  128. placeholder="窗口大小格式为:宽度*高度"
  129. class="input-width"
  130. ></el-input>
  131. </el-form-item>
  132. <el-form-item label="学生端版本" prop="studentClientVersion">
  133. <el-checkbox-group v-model="ruleForm.studentClientVersion">
  134. <el-checkbox
  135. v-for="pcc in studentClientVersions"
  136. name="studentClientVersion"
  137. :label="pcc.code"
  138. v-model="pcc.code"
  139. :key="pcc.code"
  140. >{{ pcc.name }}</el-checkbox
  141. >
  142. </el-checkbox-group>
  143. </el-form-item>
  144. <el-form-item label="控制台配置" prop="STUDENT_CLIENT_CONSOLE_CONFIG">
  145. <el-input
  146. v-model="ruleForm.STUDENT_CLIENT_CONSOLE_CONFIG"
  147. placeholder="系统预留,无需配置"
  148. class="input-width"
  149. ></el-input>
  150. </el-form-item>
  151. <el-form-item>
  152. <el-button
  153. :disabled="btnSaveDiabled"
  154. type="primary"
  155. @click="submitForm('ruleForm')"
  156. >保 存</el-button
  157. >
  158. <!-- <el-button class="btn-margin-left" @click="resetForm('ruleForm')">取 消</el-button> -->
  159. </el-form-item>
  160. </el-form>
  161. </el-main>
  162. </el-container>
  163. </template>
  164. <script>
  165. import { mapState } from "vuex";
  166. import {
  167. LOGIN_TYPE,
  168. PREVENT_CHEATING_CONFIG,
  169. STUDENT_CLIENT_VERSION,
  170. CORE_API,
  171. LOGIN_SUPPORT
  172. } from "@/constants/constants.js";
  173. export default {
  174. data() {
  175. return {
  176. rootOrgList: [],
  177. loginTypes: LOGIN_TYPE,
  178. loginSupports: LOGIN_SUPPORT,
  179. propertyGroupId: "",
  180. preventCheatingConfigs: PREVENT_CHEATING_CONFIG,
  181. studentClientVersions: STUDENT_CLIENT_VERSION,
  182. formDataChanged: false,
  183. originalRuleForm: {},
  184. ruleForm: {
  185. relatedPropertyGroupIdList: [],
  186. orgId: null,
  187. OE_STUDENT_SYS_NAME: "",
  188. LOGO_FILE_URL: "",
  189. LOGIN_TYPE: "",
  190. PREVENT_CHEATING_CONFIG: "",
  191. STUDENT_CLIENT_VERSION: "",
  192. STUDENT_CLIENT_DEFAULT_SIZE: "",
  193. STUDENT_CLIENT_CONSOLE_CONFIG: "",
  194. STUDENT_CODE_LOGIN_ALIAS: "学号登录",
  195. IDENTITY_NUMBER_LOGIN_ALIAS: "身份证号登录",
  196. LOGIN_SUPPORT: "",
  197. properties: {
  198. OE_STUDENT_SYS_NAME: "",
  199. LOGO_FILE_URL: "",
  200. LOGIN_TYPE: "",
  201. PREVENT_CHEATING_CONFIG: "",
  202. STUDENT_CLIENT_VERSION: "",
  203. STUDENT_CLIENT_DEFAULT_SIZE: "",
  204. STUDENT_CLIENT_CONSOLE_CONFIG: "",
  205. STUDENT_CODE_LOGIN_ALIAS: "学号登录",
  206. IDENTITY_NUMBER_LOGIN_ALIAS: "身份证号登录",
  207. LOGIN_SUPPORT: ""
  208. },
  209. loginType: [],
  210. preventCheatingConfig: [],
  211. studentClientVersion: [],
  212. loginSupport: []
  213. },
  214. logoDialog: false,
  215. uploadAction: "",
  216. uploadHeaders: {},
  217. uploadData: {},
  218. fileList: [],
  219. rules: {
  220. OE_STUDENT_SYS_NAME: [
  221. { required: true, message: "请输入系统名称", trigger: "blur" },
  222. { min: 1, max: 50, message: "长度在 1 到 50 个字符", trigger: "blur" }
  223. ],
  224. LOGO_FILE_URL: [
  225. { required: true, message: "请上传学校logo", trigger: "change" }
  226. ],
  227. loginType: [
  228. {
  229. type: "array",
  230. required: true,
  231. message: "请至少选择一个登录账号选择",
  232. trigger: "change"
  233. }
  234. ],
  235. loginSupport: [
  236. {
  237. type: "array",
  238. required: true,
  239. message: "请至少选择一个考生端登录方式",
  240. trigger: "change"
  241. }
  242. ],
  243. STUDENT_CLIENT_DEFAULT_SIZE: [
  244. { required: true, message: "请输入客户端默认大小", trigger: "blur" }
  245. ],
  246. STUDENT_CODE_LOGIN_ALIAS: [
  247. { required: true, message: "请输入学号登录别名", trigger: "blur" },
  248. { min: 1, max: 10, message: "长度在 1 到 10 个字符", trigger: "blur" }
  249. ],
  250. IDENTITY_NUMBER_LOGIN_ALIAS: [
  251. {
  252. required: true,
  253. message: "请输入身份证号登录别名",
  254. trigger: "blur"
  255. },
  256. { min: 1, max: 10, message: "长度在 1 到 10 个字符", trigger: "blur" }
  257. ],
  258. studentClientVersion: [
  259. {
  260. type: "array",
  261. required: true,
  262. message: "请至少选择一个学生端版本",
  263. trigger: "change"
  264. }
  265. ]
  266. }
  267. };
  268. },
  269. methods: {
  270. submitForm(formName) {
  271. this.$refs[formName].validate(valid => {
  272. if (valid) {
  273. this.ruleForm.properties.OE_STUDENT_SYS_NAME = this.ruleForm.OE_STUDENT_SYS_NAME;
  274. this.ruleForm.properties.LOGO_FILE_URL = this.ruleForm.LOGO_FILE_URL;
  275. this.ruleForm.properties.STUDENT_CLIENT_DEFAULT_SIZE = this.ruleForm.STUDENT_CLIENT_DEFAULT_SIZE;
  276. this.ruleForm.properties.STUDENT_CLIENT_CONSOLE_CONFIG = this.ruleForm.STUDENT_CLIENT_CONSOLE_CONFIG;
  277. this.ruleForm.properties.LOGIN_TYPE = this.ruleForm.LOGIN_TYPE = this.ruleForm.loginType.join(
  278. ","
  279. );
  280. this.ruleForm.properties.LOGIN_SUPPORT = this.ruleForm.LOGIN_SUPPORT = this.ruleForm.loginSupport.join(
  281. ","
  282. );
  283. this.ruleForm.properties.STUDENT_CODE_LOGIN_ALIAS = this.ruleForm.STUDENT_CODE_LOGIN_ALIAS;
  284. this.ruleForm.properties.IDENTITY_NUMBER_LOGIN_ALIAS = this.ruleForm.IDENTITY_NUMBER_LOGIN_ALIAS;
  285. if (
  286. this.ruleForm.preventCheatingConfig == null ||
  287. this.ruleForm.preventCheatingConfig.length == 0
  288. ) {
  289. this.ruleForm.properties.PREVENT_CHEATING_CONFIG = this.ruleForm.PREVENT_CHEATING_CONFIG =
  290. "NONE";
  291. } else {
  292. let defaultArr = [];
  293. for (let lt of PREVENT_CHEATING_CONFIG) {
  294. defaultArr.push(lt.code);
  295. }
  296. let validArr = [];
  297. //保存时清理一下历史数据
  298. for (
  299. let i = 0;
  300. i < this.ruleForm.preventCheatingConfig.length;
  301. i++
  302. ) {
  303. let code = this.ruleForm.preventCheatingConfig[i];
  304. if (defaultArr.indexOf(code) > -1) {
  305. validArr.push(code);
  306. }
  307. }
  308. let res = "";
  309. if (validArr.length == 0) {
  310. res = "NONE";
  311. } else {
  312. res = validArr.join(",");
  313. }
  314. this.ruleForm.properties.PREVENT_CHEATING_CONFIG = this.ruleForm.PREVENT_CHEATING_CONFIG = res;
  315. }
  316. if (
  317. this.ruleForm.studentClientVersion == null ||
  318. this.ruleForm.studentClientVersion.length == 0
  319. ) {
  320. this.ruleForm.properties.STUDENT_CLIENT_VERSION = this.ruleForm.STUDENT_CLIENT_VERSION =
  321. "NONE";
  322. } else {
  323. let defaultArr = [];
  324. for (let lt of STUDENT_CLIENT_VERSION) {
  325. defaultArr.push(lt.code);
  326. }
  327. let validArr = [];
  328. //保存时清理一下历史数据
  329. for (
  330. let i = 0;
  331. i < this.ruleForm.studentClientVersion.length;
  332. i++
  333. ) {
  334. let code = this.ruleForm.studentClientVersion[i];
  335. if (defaultArr.indexOf(code) > -1) {
  336. validArr.push(code);
  337. }
  338. }
  339. let res = "";
  340. if (validArr.length == 0) {
  341. res = "NONE";
  342. } else {
  343. res = validArr.join(",");
  344. }
  345. this.ruleForm.properties.STUDENT_CLIENT_VERSION = this.ruleForm.STUDENT_CLIENT_VERSION = res;
  346. }
  347. this.$httpWithMsg
  348. .put(CORE_API + "/org/saveOrgProperties", this.ruleForm)
  349. .then(
  350. () => {
  351. this.$notify({
  352. message: "保存成功",
  353. type: "success"
  354. });
  355. this.originalRuleForm = Object.assign({}, this.ruleForm);
  356. this.formDataChanged = false;
  357. },
  358. () => {}
  359. );
  360. } else {
  361. console.log("error submit!!");
  362. return false;
  363. }
  364. });
  365. },
  366. initForm() {
  367. this.uploadAction = CORE_API + "/org/importLogo/" + this.ruleForm.orgId;
  368. this.ruleForm.STUDENT_CLIENT_DEFAULT_SIZE = "1400*900";
  369. this.ruleForm.relatedPropertyGroupIdList = ["studentClientConfig"];
  370. let url =
  371. CORE_API +
  372. "/org/getOrgPropertiesByGroupWithoutCache/" +
  373. this.ruleForm.orgId +
  374. "/" +
  375. this.propertyGroupId;
  376. this.$httpWithMsg.get(url).then(response => {
  377. console.log(response);
  378. if (response) {
  379. this.ruleForm.properties = response.data;
  380. // if (this.ruleForm.properties.OE_STUDENT_SYS_NAME) {
  381. this.ruleForm.OE_STUDENT_SYS_NAME =
  382. this.ruleForm.properties.OE_STUDENT_SYS_NAME ||
  383. this.ruleForm.OE_STUDENT_SYS_NAME;
  384. // }
  385. this.ruleForm.LOGO_FILE_URL =
  386. this.ruleForm.properties.LOGO_FILE_URL ||
  387. this.ruleForm.LOGO_FILE_URL;
  388. this.ruleForm.LOGIN_TYPE =
  389. this.ruleForm.properties.LOGIN_TYPE || this.ruleForm.LOGIN_TYPE;
  390. this.ruleForm.LOGIN_SUPPORT =
  391. this.ruleForm.properties.LOGIN_SUPPORT ||
  392. this.ruleForm.LOGIN_SUPPORT;
  393. this.ruleForm.PREVENT_CHEATING_CONFIG =
  394. this.ruleForm.properties.PREVENT_CHEATING_CONFIG ||
  395. this.ruleForm.PREVENT_CHEATING_CONFIG;
  396. this.ruleForm.STUDENT_CLIENT_VERSION =
  397. this.ruleForm.properties.STUDENT_CLIENT_VERSION ||
  398. this.ruleForm.STUDENT_CLIENT_VERSION;
  399. this.ruleForm.STUDENT_CLIENT_DEFAULT_SIZE =
  400. this.ruleForm.properties.STUDENT_CLIENT_DEFAULT_SIZE ||
  401. this.ruleForm.STUDENT_CLIENT_DEFAULT_SIZE;
  402. this.ruleForm.STUDENT_CLIENT_CONSOLE_CONFIG =
  403. this.ruleForm.properties.STUDENT_CLIENT_CONSOLE_CONFIG ||
  404. this.ruleForm.STUDENT_CLIENT_CONSOLE_CONFIG;
  405. this.ruleForm.STUDENT_CODE_LOGIN_ALIAS =
  406. this.ruleForm.properties.STUDENT_CODE_LOGIN_ALIAS ||
  407. this.ruleForm.STUDENT_CODE_LOGIN_ALIAS;
  408. this.ruleForm.IDENTITY_NUMBER_LOGIN_ALIAS =
  409. this.ruleForm.properties.IDENTITY_NUMBER_LOGIN_ALIAS ||
  410. this.ruleForm.IDENTITY_NUMBER_LOGIN_ALIAS;
  411. if (this.ruleForm.properties.LOGIN_TYPE) {
  412. this.ruleForm.loginType = this.ruleForm.properties.LOGIN_TYPE.split(
  413. ","
  414. );
  415. } else {
  416. let defaultValue = [];
  417. for (let lt of LOGIN_TYPE) {
  418. defaultValue.push(lt.code);
  419. }
  420. this.ruleForm.loginType = defaultValue;
  421. console.log(defaultValue);
  422. }
  423. if (this.ruleForm.properties.LOGIN_SUPPORT) {
  424. this.ruleForm.loginSupport = this.ruleForm.properties.LOGIN_SUPPORT.split(
  425. ","
  426. );
  427. }
  428. if (this.ruleForm.properties.PREVENT_CHEATING_CONFIG) {
  429. if (this.ruleForm.properties.PREVENT_CHEATING_CONFIG != "NONE") {
  430. this.ruleForm.preventCheatingConfig = this.ruleForm.properties.PREVENT_CHEATING_CONFIG.split(
  431. ","
  432. );
  433. } else {
  434. this.ruleForm.preventCheatingConfig = [];
  435. }
  436. } else {
  437. let defaultValue = [];
  438. for (let lt of PREVENT_CHEATING_CONFIG) {
  439. defaultValue.push(lt.code);
  440. }
  441. this.ruleForm.preventCheatingConfig = defaultValue;
  442. console.log(defaultValue);
  443. }
  444. if (this.ruleForm.properties.STUDENT_CLIENT_VERSION) {
  445. if (this.ruleForm.properties.STUDENT_CLIENT_VERSION != "NONE") {
  446. this.ruleForm.studentClientVersion = this.ruleForm.properties.STUDENT_CLIENT_VERSION.split(
  447. ","
  448. );
  449. } else {
  450. this.ruleForm.studentClientVersion = [];
  451. }
  452. } else {
  453. let defaultValue = [];
  454. // for (let lt of STUDENT_CLIENT_VERSION) {
  455. // defaultValue.push(lt.code);
  456. // }
  457. this.ruleForm.studentClientVersion = defaultValue;
  458. console.log(defaultValue);
  459. }
  460. let fileUrl = response.data.LOGO_FILE_URL;
  461. let fname = "";
  462. if (fileUrl) {
  463. let lastIndex = fileUrl.lastIndexOf("/");
  464. let len = fileUrl.length;
  465. fname = fileUrl.substr(lastIndex + 1, len - lastIndex);
  466. this.fileList = [{ name: fname, url: this.ruleForm.LOGO_FILE_URL }];
  467. } else {
  468. this.fileList = [];
  469. }
  470. this.originalRuleForm = Object.assign({}, this.ruleForm);
  471. } else {
  472. this.$notify({
  473. message: "学生客户端信息暂未初始化,请立即初始化",
  474. type: "warning"
  475. });
  476. }
  477. });
  478. },
  479. // resetForm(formName) {
  480. // this.$refs[formName].resetFields();
  481. // },
  482. initUpload() {
  483. this.fileList = [];
  484. },
  485. beforeUpload(file) {
  486. if (!this.checkUpload()) {
  487. return false;
  488. }
  489. console.log(file);
  490. },
  491. uploadProgress() {
  492. console.log("uploadProgress");
  493. },
  494. uploadSuccess(response) {
  495. console.log("uploadSuccess");
  496. console.log(response);
  497. if (response && response.length > 0) {
  498. this.$notify({
  499. message: "上传成功",
  500. type: "success"
  501. });
  502. let fileUrl = response;
  503. this.ruleForm.LOGO_FILE_URL = this.ruleForm.properties.LOGO_FILE_URL = fileUrl;
  504. } else {
  505. this.errDialog = true;
  506. }
  507. this.fileLoading = false;
  508. this.logoDialog = false;
  509. // this.removeFile();
  510. },
  511. uploadError(response) {
  512. let json = JSON.parse(response.message);
  513. if (response.status == 500) {
  514. this.$notify({
  515. message: json.desc,
  516. type: "error"
  517. });
  518. }
  519. this.fileLoading = false;
  520. },
  521. //确定上传
  522. submitUpload() {
  523. if (!this.checkUpload()) {
  524. return false;
  525. }
  526. this.$refs.upload.submit();
  527. this.fileLoading = true;
  528. },
  529. checkUpload() {
  530. let fileList = this.$refs.upload.uploadFiles;
  531. if (fileList.length == 0) {
  532. this.$notify({
  533. message: "上传文件不能为空",
  534. type: "error"
  535. });
  536. return false;
  537. }
  538. if (fileList.length > 1) {
  539. this.$notify({
  540. message: "每次只能上传一个文件",
  541. type: "error"
  542. });
  543. return false;
  544. }
  545. for (let file of fileList) {
  546. let fileName = file.name;
  547. if (
  548. // !fileName.endsWith(".jpg") &&
  549. // !fileName.endsWith(".gif") &&
  550. !fileName.endsWith(".png")
  551. ) {
  552. this.$notify({
  553. message: "上传文件格式必须为[png]",
  554. type: "error"
  555. });
  556. this.initUpload();
  557. return false;
  558. }
  559. }
  560. return true;
  561. },
  562. //清空文件
  563. removeFile() {
  564. this.fileList = [];
  565. this.ruleForm.LOGO_FILE_URL = this.ruleForm.properties.LOGO_FILE_URL = "";
  566. if (this.$refs.upload) {
  567. this.$refs.upload.clearFiles();
  568. }
  569. },
  570. handleRemove(file, fileList) {
  571. console.log(file, fileList);
  572. this.removeFile();
  573. },
  574. handleExceed() {
  575. this.$notify({
  576. message: "当前限制选择 1 个文件,请先清空文件再试",
  577. type: "error"
  578. });
  579. },
  580. equalArrayIgnoreSequence(arr1, arr2) {
  581. // 判断数组的长度
  582. if (arr1.length !== arr2.length) {
  583. return false;
  584. } else {
  585. let a = Object.assign([], arr1);
  586. let b = Object.assign([], arr2);
  587. a.sort();
  588. b.sort();
  589. // 循环遍历数组的值进行比较
  590. for (let i = 0; i < a.length; i++) {
  591. if (a[i] !== b[i]) {
  592. return false;
  593. }
  594. }
  595. return true;
  596. }
  597. }
  598. },
  599. created() {
  600. this.ruleForm.orgId = this.user.rootOrgId;
  601. this.propertyGroupId = "config4Edit3";
  602. this.uploadHeaders = {
  603. key: this.user.key,
  604. token: this.user.token
  605. };
  606. if (this.isSuperAdmin) {
  607. this.$httpWithMsg.get(CORE_API + "/org/getRootOrgList").then(response => {
  608. this.rootOrgList = response.data;
  609. });
  610. }
  611. this.initForm();
  612. },
  613. watch: {
  614. "ruleForm.orgId": {
  615. handler: function() {
  616. this.initForm();
  617. }
  618. },
  619. ruleForm: {
  620. deep: true,
  621. handler: function(newForm) {
  622. if (Object.keys(this.originalRuleForm).length > 0) {
  623. this.formDataChanged = !(
  624. newForm.OE_STUDENT_SYS_NAME ==
  625. this.originalRuleForm.OE_STUDENT_SYS_NAME &&
  626. newForm.LOGO_FILE_URL == this.originalRuleForm.LOGO_FILE_URL &&
  627. this.equalArrayIgnoreSequence(
  628. newForm.loginType,
  629. this.originalRuleForm.loginType
  630. ) &&
  631. this.equalArrayIgnoreSequence(
  632. newForm.loginSupport,
  633. this.originalRuleForm.loginSupport
  634. ) &&
  635. this.equalArrayIgnoreSequence(
  636. newForm.preventCheatingConfig,
  637. this.originalRuleForm.preventCheatingConfig
  638. ) &&
  639. this.equalArrayIgnoreSequence(
  640. newForm.studentClientVersion,
  641. this.originalRuleForm.studentClientVersion
  642. ) &&
  643. newForm.STUDENT_CLIENT_CONSOLE_CONFIG ==
  644. this.originalRuleForm.STUDENT_CLIENT_CONSOLE_CONFIG &&
  645. newForm.STUDENT_CODE_LOGIN_ALIAS ==
  646. this.originalRuleForm.STUDENT_CODE_LOGIN_ALIAS &&
  647. newForm.IDENTITY_NUMBER_LOGIN_ALIAS ==
  648. this.originalRuleForm.IDENTITY_NUMBER_LOGIN_ALIAS
  649. );
  650. } else {
  651. this.formDataChanged = false;
  652. }
  653. }
  654. }
  655. },
  656. computed: {
  657. ...mapState({ user: state => state.user }),
  658. btnSaveDiabled() {
  659. console.log(this.formDataChanged);
  660. return !this.formDataChanged;
  661. },
  662. isSuperAdmin() {
  663. return this.user.roleList.some(role => role.roleCode == "SUPER_ADMIN");
  664. }
  665. }
  666. };
  667. </script>
  668. <style scoped>
  669. .input-width {
  670. width: 638px;
  671. }
  672. .upload-width {
  673. width: 638px;
  674. }
  675. /* .btn-margin-left {
  676. margin-left: 20px;
  677. } */
  678. </style>