clientConfig.vue 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606
  1. <template>
  2. <el-container>
  3. <el-main class="el-main-padding">
  4. <el-form
  5. ref="ruleForm"
  6. :model="ruleForm"
  7. :rules="rules"
  8. label-width="136px"
  9. class="demo-ruleForm"
  10. :inline-message="true"
  11. >
  12. <div style="margin-bottom: 10px">
  13. <el-select
  14. v-if="isSuperAdmin"
  15. v-model="ruleForm.orgId"
  16. placeholder="请选择"
  17. style="width: 180px"
  18. filterable
  19. >
  20. <el-option
  21. v-for="item in rootSchoolSelect"
  22. :key="item.id"
  23. :label="item.name"
  24. :value="item.id"
  25. />
  26. </el-select>
  27. <el-button
  28. style="margin-left: 10px"
  29. :disabled="btnSaveDiabled"
  30. type="primary"
  31. @click="submitForm('ruleForm')"
  32. >保 存</el-button
  33. >
  34. </div>
  35. <el-tabs v-model="tabActiveName" type="border-card">
  36. <el-tab-pane label="学生端配置" name="first">
  37. <el-form-item label="系统名称" prop="OE_STUDENT_SYS_NAME">
  38. <el-input
  39. v-model="ruleForm.OE_STUDENT_SYS_NAME"
  40. placeholder="请输入系统名称"
  41. class="input-width"
  42. ></el-input>
  43. </el-form-item>
  44. <el-form-item label="考生端登录页图片">
  45. <el-upload
  46. ref="uploadClientBgPicture"
  47. class="upload-width"
  48. accept=".jpg,.png,.jpeg"
  49. :action="uploadActionClientBgPicture"
  50. :headers="uploadHeaders"
  51. :data="uploadDataClientBgPicture"
  52. :before-upload="beforeUploadClientBgPicture"
  53. :on-success="uploadSuccessClientBgPicture"
  54. :on-error="uploadError"
  55. :on-remove="handleRemoveClientBgPicture"
  56. :file-list="fileListClientBgPicture"
  57. :auto-upload="false"
  58. :multiple="false"
  59. :limit="1"
  60. :on-exceed="handleExceed"
  61. list-type="picture"
  62. >
  63. <el-button slot="trigger" size="small" type="primary"
  64. >选择文件</el-button
  65. >&nbsp;
  66. <el-button
  67. size="small"
  68. type="success"
  69. @click="submitUploadClientBgPicture"
  70. >确认上传</el-button
  71. >
  72. <el-button
  73. size="small"
  74. type="danger"
  75. @click="handleRemoveClientBgPicture"
  76. >清空文件</el-button
  77. >
  78. <div slot="tip" class="el-upload__tip">
  79. 图片宽高比3:2;宽至少为1200px,不超过2000px;小于1MB;.jpg
  80. .jpeg .png 文件
  81. </div>
  82. </el-upload>
  83. <el-input
  84. v-show="false"
  85. v-model="ruleForm.STUDENT_CLIENT_BG_PICTURE_URL"
  86. ></el-input>
  87. </el-form-item>
  88. <el-form-item label="学校logo" prop="LOGO_FILE_URL">
  89. <el-upload
  90. ref="upload"
  91. class="upload-width"
  92. accept=".png"
  93. :action="uploadAction"
  94. :headers="uploadHeaders"
  95. :data="uploadData"
  96. :before-upload="beforeUpload"
  97. :on-progress="uploadProgress"
  98. :on-success="uploadSuccess"
  99. :on-error="uploadError"
  100. :on-remove="handleRemove"
  101. :file-list="fileList"
  102. :auto-upload="false"
  103. :multiple="false"
  104. :limit="1"
  105. :on-exceed="handleExceed"
  106. list-type="picture"
  107. >
  108. <el-button slot="trigger" size="small" type="primary"
  109. >选择文件</el-button
  110. >&nbsp;
  111. <el-button size="small" type="success" @click="submitUpload"
  112. >确认上传</el-button
  113. >
  114. <el-button size="small" type="danger" @click="removeFile"
  115. >清空文件</el-button
  116. >
  117. <div slot="tip" class="el-upload__tip">
  118. 图片大小(长*宽)为400*100的png文件
  119. </div>
  120. </el-upload>
  121. <el-input
  122. v-show="false"
  123. v-model="ruleForm.LOGO_FILE_URL"
  124. ></el-input>
  125. </el-form-item>
  126. <el-form-item label="登录帐号选择" prop="loginType">
  127. <el-checkbox-group v-model="ruleForm.loginType">
  128. <el-checkbox
  129. v-for="lt in loginTypes"
  130. :key="lt.code"
  131. v-model="lt.code"
  132. name="loginType"
  133. :label="lt.code"
  134. >{{ lt.name }}</el-checkbox
  135. >
  136. </el-checkbox-group>
  137. </el-form-item>
  138. <el-form-item label="学号登录别名" prop="STUDENT_CODE_LOGIN_ALIAS">
  139. <el-input
  140. v-model="ruleForm.STUDENT_CODE_LOGIN_ALIAS"
  141. placeholder="请输入学号登录别名"
  142. class="input-width"
  143. ></el-input>
  144. </el-form-item>
  145. <el-form-item
  146. label="身份证号登录别名"
  147. prop="IDENTITY_NUMBER_LOGIN_ALIAS"
  148. >
  149. <el-input
  150. v-model="ruleForm.IDENTITY_NUMBER_LOGIN_ALIAS"
  151. placeholder="请输入身份号登录别名"
  152. class="input-width"
  153. ></el-input>
  154. </el-form-item>
  155. <el-form-item label="考生端登录方式" prop="loginSupport">
  156. <el-checkbox-group v-model="ruleForm.loginSupport">
  157. <el-checkbox
  158. v-for="lt in loginSupports"
  159. :key="lt.code"
  160. v-model="lt.code"
  161. name="loginSupport"
  162. :label="lt.code"
  163. >{{ lt.name }}</el-checkbox
  164. >
  165. </el-checkbox-group>
  166. </el-form-item>
  167. <el-form-item
  168. label="控制台配置"
  169. prop="STUDENT_CLIENT_CONSOLE_CONFIG"
  170. >
  171. <el-input
  172. v-model="ruleForm.STUDENT_CLIENT_CONSOLE_CONFIG"
  173. placeholder="系统预留,无需配置"
  174. class="input-width"
  175. ></el-input>
  176. </el-form-item>
  177. </el-tab-pane>
  178. <el-tab-pane label="防作弊配置" name="second">
  179. <el-form-item label="防作弊配置" prop="preventCheatingConfig">
  180. <el-checkbox-group v-model="ruleForm.preventCheatingConfig">
  181. <el-checkbox
  182. v-for="pcc in preventCheatingConfigs"
  183. :key="pcc.code"
  184. v-model="pcc.code"
  185. name="preventCheatingConfig"
  186. :label="pcc.code"
  187. >{{ pcc.name }}</el-checkbox
  188. >
  189. </el-checkbox-group>
  190. </el-form-item>
  191. <el-form-item
  192. v-show="false"
  193. label="窗口默认大小"
  194. prop="STUDENT_CLIENT_DEFAULT_SIZE"
  195. >
  196. <el-input
  197. v-model="ruleForm.STUDENT_CLIENT_DEFAULT_SIZE"
  198. placeholder="窗口大小格式为:宽度*高度"
  199. class="input-width"
  200. ></el-input>
  201. </el-form-item>
  202. <el-form-item label="学生端版本" prop="studentClientVersion">
  203. <el-checkbox-group v-model="ruleForm.studentClientVersion">
  204. <el-checkbox
  205. v-for="pcc in studentClientVersions"
  206. :key="pcc.code"
  207. v-model="pcc.code"
  208. name="studentClientVersion"
  209. :label="pcc.code"
  210. >{{ pcc.name }}</el-checkbox
  211. >
  212. </el-checkbox-group>
  213. </el-form-item>
  214. </el-tab-pane>
  215. <el-tab-pane label="自定义菜单配置" name="third">
  216. <el-form-item label="自定义菜单logo">
  217. <el-radio-group
  218. v-model="ruleForm.IS_CUSTOM_MENU_LOGO"
  219. class="input"
  220. @change="csutomMenuLogoChange"
  221. >
  222. <el-radio label="true">是</el-radio>
  223. <el-radio label="false">否</el-radio>
  224. </el-radio-group>
  225. </el-form-item>
  226. <el-form-item
  227. v-if="ruleForm.IS_CUSTOM_MENU_LOGO == 'true'"
  228. label="菜单logo"
  229. prop="CUS_MENU_LOGO_FILE_URL"
  230. >
  231. <el-upload
  232. ref="menuLogUpload"
  233. class="upload-width"
  234. accept=".png"
  235. :action="uploadMenuLogoAction"
  236. :headers="uploadMenuLogoHeaders"
  237. :data="uploadMenuLogoData"
  238. :before-upload="beforeUploadMenuLogo"
  239. :on-progress="uploadMenuLogoProgress"
  240. :on-success="uploadMenuLogoSuccess"
  241. :on-error="uploadMenuLogoError"
  242. :on-remove="handleMenuLogoRemove"
  243. :file-list="menuLogoFileList"
  244. :auto-upload="false"
  245. :multiple="false"
  246. :limit="1"
  247. :on-exceed="handleMenuLogoExceed"
  248. list-type="picture"
  249. >
  250. <el-button slot="trigger" size="small" type="primary"
  251. >选择文件</el-button
  252. >&nbsp;
  253. <el-button
  254. size="small"
  255. type="success"
  256. @click="submitUploadMenuLogo"
  257. >确认上传</el-button
  258. >
  259. <el-button
  260. size="small"
  261. type="danger"
  262. @click="removeMenuLogoFile"
  263. >清空文件</el-button
  264. >
  265. <div slot="tip" class="el-upload__tip">
  266. 图片大小(长*宽)为80*68的png文件
  267. </div>
  268. </el-upload>
  269. <el-input
  270. v-show="false"
  271. v-model="ruleForm.CUS_MENU_LOGO_FILE_URL"
  272. ></el-input>
  273. </el-form-item>
  274. <el-form-item label="菜单自定义">
  275. <!-- 权限树 -->
  276. <div style="width: 80%">
  277. <el-tree
  278. ref="tree"
  279. :data="treeData"
  280. :props="defaultProps"
  281. node-key="id"
  282. highlight-current
  283. :default-expanded-keys="[-1]"
  284. :expand-on-click-node="false"
  285. :render-content="renderMenuTreeContent"
  286. :show-checkbox="true"
  287. style="padding: 10px"
  288. @check-change="treeCheckeChange"
  289. />
  290. </div>
  291. </el-form-item>
  292. <el-form-item label="离线答题纸模板" prop="ANSWERS_TEMPLATE">
  293. <el-upload
  294. ref="uploadAnswer"
  295. class="upload-width"
  296. accept=".zip"
  297. :action="uploadAnswer"
  298. :headers="uploadAnswerHeaders"
  299. :data="uploadAnswerData"
  300. :before-upload="beforeUploadAnswer"
  301. :on-progress="uploadProgress"
  302. :on-success="uploadAnswerSuccess"
  303. :on-error="uploadError"
  304. :on-remove="handleAnswerRemove"
  305. :file-list="answerFileList"
  306. :auto-upload="false"
  307. :multiple="false"
  308. :limit="1"
  309. :on-exceed="handleAnswerExceed"
  310. list-type="zip"
  311. >
  312. <el-button slot="trigger" size="small" type="primary"
  313. >选择文件</el-button
  314. >&nbsp;
  315. <el-button
  316. size="small"
  317. type="success"
  318. @click="submitUploadAnswer"
  319. >确认上传</el-button
  320. >
  321. <el-button size="small" type="danger" @click="removeAnswerFile"
  322. >清空文件</el-button
  323. >
  324. <div slot="tip" class="el-upload__tip">上传的格式为ZIP格式</div>
  325. </el-upload>
  326. <el-input
  327. v-show="false"
  328. v-model="ruleForm.ANSWERS_TEMPLATE"
  329. ></el-input>
  330. </el-form-item>
  331. </el-tab-pane>
  332. </el-tabs>
  333. </el-form>
  334. <!-- 修改权限 -->
  335. <el-dialog
  336. title="修改权限"
  337. width="450px"
  338. :visible.sync="cusMenuTreeDialog.show"
  339. :close-on-click-modal="false"
  340. >
  341. <el-form
  342. ref="updateForm"
  343. :model="cusMenuTreeDialog.privilege"
  344. inline
  345. inline-message
  346. label-width="100px"
  347. :rules="menuRules"
  348. >
  349. <el-form-item label="权限名称" prop="name">
  350. <el-input
  351. v-model="cusMenuTreeDialog.privilege.name"
  352. :disabled="cusMenuTreeDialog.optType == 'view'"
  353. class="input_width"
  354. maxlength="8"
  355. show-word-limit
  356. />
  357. </el-form-item>
  358. <el-form-item label="权限编码" prop="code">
  359. <el-input
  360. v-model="cusMenuTreeDialog.privilege.code"
  361. disabled
  362. class="input_width"
  363. />
  364. </el-form-item>
  365. <el-form-item label="描述" prop="description">
  366. <el-input
  367. v-model="cusMenuTreeDialog.privilege.description"
  368. :disabled="cusMenuTreeDialog.optType == 'view'"
  369. class="input_width"
  370. />
  371. </el-form-item>
  372. <el-form-item v-if="false" label="权重" prop="weight">
  373. <el-input
  374. v-model="cusMenuTreeDialog.privilege.weight"
  375. :disabled="cusMenuTreeDialog.optType == 'view'"
  376. class="input_width"
  377. />
  378. </el-form-item>
  379. <el-form-item v-if="false" label="属性1">
  380. <el-input
  381. v-model="cusMenuTreeDialog.privilege.ext1"
  382. :disabled="cusMenuTreeDialog.optType == 'view'"
  383. class="input_width"
  384. />
  385. </el-form-item>
  386. <el-form-item v-if="false" label="属性2">
  387. <el-input
  388. v-model="cusMenuTreeDialog.privilege.ext2"
  389. :disabled="cusMenuTreeDialog.optType == 'view'"
  390. class="input_width"
  391. />
  392. </el-form-item>
  393. <el-form-item v-if="false" label="属性3">
  394. <el-input
  395. v-model="cusMenuTreeDialog.privilege.ext3"
  396. :disabled="cusMenuTreeDialog.optType == 'view'"
  397. class="input_width"
  398. />
  399. </el-form-item>
  400. <el-form-item v-if="false" label="属性4">
  401. <el-input
  402. v-model="cusMenuTreeDialog.privilege.ext4"
  403. :disabled="cusMenuTreeDialog.optType == 'view'"
  404. class="input_width"
  405. />
  406. </el-form-item>
  407. <el-form-item v-if="false" label="属性5">
  408. <el-input
  409. v-model="cusMenuTreeDialog.privilege.ext5"
  410. :disabled="cusMenuTreeDialog.optType == 'view'"
  411. class="input_width"
  412. />
  413. </el-form-item>
  414. <el-form-item class="d-flex justify-content-center">
  415. <el-button
  416. v-show="cusMenuTreeDialog.optType != 'view'"
  417. type="primary"
  418. @click="updatePrivilege"
  419. >确 定</el-button
  420. >
  421. <el-button
  422. v-show="cusMenuTreeDialog.optType != 'view'"
  423. @click="cusMenuTreeDialog.show = false"
  424. >取 消</el-button
  425. >
  426. <el-button
  427. v-show="cusMenuTreeDialog.optType == 'view'"
  428. @click="cusMenuTreeDialog.show = false"
  429. >关 闭</el-button
  430. >
  431. </el-form-item>
  432. </el-form>
  433. </el-dialog>
  434. </el-main>
  435. </el-container>
  436. </template>
  437. <script>
  438. import { mapState } from "vuex";
  439. import {
  440. LOGIN_TYPE,
  441. PREVENT_CHEATING_CONFIG,
  442. STUDENT_CLIENT_VERSION,
  443. CORE_API,
  444. LOGIN_SUPPORT,
  445. } from "@/constants/constants.js";
  446. let checkWeight = (rule, value, callback) => {
  447. if ("0" != value && !value) {
  448. return new Error("请输入权重");
  449. } else if ("0" != value && !value.match(/^[1-9][0-9]*$/)) {
  450. callback(new Error("请输入整数"));
  451. } else if (value < 0) {
  452. callback(new Error("不能小于0"));
  453. } else if (value > 10000) {
  454. callback(new Error("不能大于10000"));
  455. } else {
  456. callback();
  457. }
  458. };
  459. let checkCode = (rule, value, callback) => {
  460. if (0 != value && !value) {
  461. callback(new Error("请输入权限编码"));
  462. } else if (!value.match(/^[0-9a-zA-Z_]*$/)) {
  463. callback(new Error('只能由数字、字母和"_"组成'));
  464. } else {
  465. callback();
  466. }
  467. };
  468. export default {
  469. data() {
  470. return {
  471. rootOrgList: [],
  472. loginTypes: LOGIN_TYPE,
  473. loginSupports: LOGIN_SUPPORT,
  474. propertyGroupId: "",
  475. preventCheatingConfigs: PREVENT_CHEATING_CONFIG,
  476. studentClientVersions: STUDENT_CLIENT_VERSION,
  477. formDataChanged: false,
  478. originalRuleForm: {},
  479. ruleForm: {
  480. relatedPropertyGroupIdList: [],
  481. orgId: null,
  482. OE_STUDENT_SYS_NAME: "",
  483. LOGO_FILE_URL: "",
  484. ANSWERS_TEMPLATE: "",
  485. LOGIN_TYPE: "",
  486. PREVENT_CHEATING_CONFIG: "",
  487. STUDENT_CLIENT_VERSION: "",
  488. STUDENT_CLIENT_DEFAULT_SIZE: "",
  489. STUDENT_CLIENT_CONSOLE_CONFIG: "",
  490. STUDENT_CODE_LOGIN_ALIAS: "学号登录",
  491. IDENTITY_NUMBER_LOGIN_ALIAS: "身份证号登录",
  492. LOGIN_SUPPORT: "",
  493. IS_CUSTOM_MENU_LOGO: "false",
  494. CUS_MENU_LOGO_FILE_URL: "",
  495. STUDENT_CLIENT_BG_PICTURE_URL: "",
  496. properties: {
  497. OE_STUDENT_SYS_NAME: "",
  498. LOGO_FILE_URL: "",
  499. ANSWERS_TEMPLATE: "",
  500. LOGIN_TYPE: "",
  501. PREVENT_CHEATING_CONFIG: "",
  502. STUDENT_CLIENT_VERSION: "",
  503. STUDENT_CLIENT_DEFAULT_SIZE: "",
  504. STUDENT_CLIENT_CONSOLE_CONFIG: "",
  505. STUDENT_CODE_LOGIN_ALIAS: "学号登录",
  506. IDENTITY_NUMBER_LOGIN_ALIAS: "身份证号登录",
  507. LOGIN_SUPPORT: "",
  508. IS_CUSTOM_MENU_LOGO: "false",
  509. CUS_MENU_LOGO_FILE_URL: "",
  510. STUDENT_CLIENT_BG_PICTURE_URL: "",
  511. },
  512. loginType: [],
  513. preventCheatingConfig: [],
  514. studentClientVersion: [],
  515. loginSupport: [],
  516. },
  517. logoDialog: false,
  518. uploadAction: "",
  519. uploadAnswer: "",
  520. uploadAnswerHeaders: {},
  521. uploadAnswerData: {},
  522. uploadHeaders: {},
  523. uploadData: {},
  524. fileList: [],
  525. uploadActionClientBgPicture: "",
  526. uploadDataClientBgPicture: {},
  527. fileListClientBgPicture: [],
  528. menuRules: {
  529. name: [
  530. {
  531. required: true,
  532. message: "请输入权限名称",
  533. trigger: "blur",
  534. },
  535. ],
  536. code: [
  537. {
  538. required: true,
  539. message: "请输入权限编码",
  540. trigger: "blur",
  541. },
  542. {
  543. validator: checkCode,
  544. trigger: "blur",
  545. },
  546. ],
  547. weight: [
  548. {
  549. required: true,
  550. message: "请输入权重",
  551. trigger: "blur",
  552. },
  553. {
  554. validator: checkWeight,
  555. trigger: "blur",
  556. },
  557. ],
  558. },
  559. rules: {
  560. OE_STUDENT_SYS_NAME: [
  561. { required: true, message: "请输入系统名称", trigger: "blur" },
  562. {
  563. min: 1,
  564. max: 50,
  565. message: "长度在 1 到 50 个字符",
  566. trigger: "blur",
  567. },
  568. ],
  569. LOGO_FILE_URL: [
  570. { required: true, message: "请上传学校logo", trigger: "change" },
  571. ],
  572. loginType: [
  573. {
  574. type: "array",
  575. required: true,
  576. message: "请至少选择一个登录账号选择",
  577. trigger: "change",
  578. },
  579. ],
  580. loginSupport: [
  581. {
  582. type: "array",
  583. required: true,
  584. message: "请至少选择一个考生端登录方式",
  585. trigger: "change",
  586. },
  587. ],
  588. STUDENT_CLIENT_DEFAULT_SIZE: [
  589. { required: true, message: "请输入客户端默认大小", trigger: "blur" },
  590. ],
  591. STUDENT_CODE_LOGIN_ALIAS: [
  592. { required: true, message: "请输入学号登录别名", trigger: "blur" },
  593. {
  594. min: 1,
  595. max: 10,
  596. message: "长度在 1 到 10 个字符",
  597. trigger: "blur",
  598. },
  599. ],
  600. IDENTITY_NUMBER_LOGIN_ALIAS: [
  601. {
  602. required: true,
  603. message: "请输入身份证号登录别名",
  604. trigger: "blur",
  605. },
  606. {
  607. min: 1,
  608. max: 10,
  609. message: "长度在 1 到 10 个字符",
  610. trigger: "blur",
  611. },
  612. ],
  613. studentClientVersion: [
  614. {
  615. type: "array",
  616. required: true,
  617. message: "请至少选择一个学生端版本",
  618. trigger: "change",
  619. },
  620. ],
  621. CUS_MENU_LOGO_FILE_URL: [
  622. {
  623. required: true,
  624. message: "请上传自定义菜单logo",
  625. trigger: "change",
  626. },
  627. ],
  628. },
  629. tabActiveName: "first",
  630. uploadMenuLogoAction: "",
  631. uploadMenuLogoHeaders: {},
  632. uploadMenuLogoData: {},
  633. menuLogoFileList: [],
  634. answerFileList: [],
  635. originalCusMenuForm: {},
  636. cusMenuTreeDialog: {
  637. show: false,
  638. parentName: null,
  639. optType: null,
  640. privilege: {
  641. id: null,
  642. groupId: null,
  643. parentId: null,
  644. name: null,
  645. code: null,
  646. description: null,
  647. weight: null,
  648. ext1: null,
  649. ext2: null,
  650. ext3: null,
  651. ext4: null,
  652. ext5: null,
  653. },
  654. },
  655. treeData: [],
  656. data: null,
  657. defaultProps: {
  658. children: "children",
  659. label: "label",
  660. },
  661. privilegeGroupId: null,
  662. checkedKeys: [],
  663. originalCheckedKeys: [],
  664. treeCheckedChanged: false,
  665. };
  666. },
  667. computed: {
  668. ...mapState({ user: (state) => state.user }),
  669. btnSaveDiabled() {
  670. // console.log(this.formDataChanged);
  671. return !this.formDataChanged && !this.treeCheckedChanged;
  672. },
  673. isSuperAdmin() {
  674. return this.user.roleList.some((role) => role.roleCode == "SUPER_ADMIN");
  675. },
  676. rootSchoolSelect() {
  677. let rootSchools = [];
  678. for (let i = 0; i < this.rootOrgList.length; i++) {
  679. let info = {
  680. name: this.rootOrgList[i].name + "(" + this.rootOrgList[i].id + ")",
  681. id: this.rootOrgList[i].id,
  682. };
  683. rootSchools.push(info);
  684. }
  685. return rootSchools;
  686. },
  687. },
  688. watch: {
  689. "ruleForm.orgId": {
  690. handler: function () {
  691. this.initForm();
  692. },
  693. },
  694. checkedKeys: {
  695. handler: function (newVal) {
  696. this.treeCheckedChanged = !this.equalArrayIgnoreSequence(
  697. this.originalCheckedKeys,
  698. newVal
  699. );
  700. },
  701. },
  702. ruleForm: {
  703. deep: true,
  704. handler: function (newForm) {
  705. if (Object.keys(this.originalRuleForm).length > 0) {
  706. this.formDataChanged = !(
  707. newForm.OE_STUDENT_SYS_NAME ==
  708. this.originalRuleForm.OE_STUDENT_SYS_NAME &&
  709. newForm.STUDENT_CLIENT_BG_PICTURE_URL ==
  710. this.originalRuleForm.STUDENT_CLIENT_BG_PICTURE_URL &&
  711. newForm.LOGO_FILE_URL == this.originalRuleForm.LOGO_FILE_URL &&
  712. this.equalArrayIgnoreSequence(
  713. newForm.loginType,
  714. this.originalRuleForm.loginType
  715. ) &&
  716. this.equalArrayIgnoreSequence(
  717. newForm.loginSupport,
  718. this.originalRuleForm.loginSupport
  719. ) &&
  720. this.equalArrayIgnoreSequence(
  721. newForm.preventCheatingConfig,
  722. this.originalRuleForm.preventCheatingConfig
  723. ) &&
  724. this.equalArrayIgnoreSequence(
  725. newForm.studentClientVersion,
  726. this.originalRuleForm.studentClientVersion
  727. ) &&
  728. newForm.STUDENT_CLIENT_CONSOLE_CONFIG ==
  729. this.originalRuleForm.STUDENT_CLIENT_CONSOLE_CONFIG &&
  730. newForm.STUDENT_CODE_LOGIN_ALIAS ==
  731. this.originalRuleForm.STUDENT_CODE_LOGIN_ALIAS &&
  732. newForm.IDENTITY_NUMBER_LOGIN_ALIAS ==
  733. this.originalRuleForm.IDENTITY_NUMBER_LOGIN_ALIAS &&
  734. newForm.IS_CUSTOM_MENU_LOGO ==
  735. this.originalRuleForm.IS_CUSTOM_MENU_LOGO &&
  736. newForm.ANSWERS_TEMPLATE ==
  737. this.originalRuleForm.ANSWERS_TEMPLATE &&
  738. newForm.CUS_MENU_LOGO_FILE_URL ==
  739. this.originalRuleForm.CUS_MENU_LOGO_FILE_URL
  740. );
  741. } else {
  742. this.formDataChanged = false;
  743. }
  744. },
  745. },
  746. },
  747. created() {
  748. this.ruleForm.orgId = this.user.rootOrgId;
  749. this.propertyGroupId = "config4Edit3";
  750. this.uploadHeaders = {
  751. key: this.user.key,
  752. token: this.user.token,
  753. };
  754. this.uploadAnswerHeaders = {
  755. key: this.user.key,
  756. token: this.user.token,
  757. };
  758. this.uploadMenuLogoHeaders = {
  759. key: this.user.key,
  760. token: this.user.token,
  761. };
  762. if (this.isSuperAdmin) {
  763. this.$httpWithMsg
  764. .get(CORE_API + "/org/getRootOrgList")
  765. .then((response) => {
  766. this.rootOrgList = response.data;
  767. });
  768. }
  769. this.initForm();
  770. },
  771. methods: {
  772. beforeUploadClientBgPicture() {
  773. if (!this.checkUploadClientBgPicture()) {
  774. return false;
  775. }
  776. },
  777. checkUploadClientBgPicture() {
  778. let fileList = this.$refs.uploadClientBgPicture.uploadFiles;
  779. if (fileList.length == 0) {
  780. this.$notify({
  781. message: "上传文件不能为空",
  782. type: "error",
  783. });
  784. return false;
  785. }
  786. if (fileList.length > 1) {
  787. this.$notify({
  788. message: "每次只能上传一个文件",
  789. type: "error",
  790. });
  791. return false;
  792. }
  793. for (let file of fileList) {
  794. let fileName = file.name;
  795. if (
  796. !fileName.endsWith(".jpg") &&
  797. !fileName.endsWith(".jpeg") &&
  798. !fileName.endsWith(".png")
  799. ) {
  800. this.$notify({
  801. message: "上传文件格式必须为jpg jpeg png",
  802. type: "error",
  803. });
  804. this.fileListClientBgPicture = [];
  805. return false;
  806. }
  807. }
  808. return true;
  809. },
  810. uploadSuccessClientBgPicture(response) {
  811. if (response && response.length > 0) {
  812. this.$notify({
  813. message: "上传成功",
  814. type: "success",
  815. });
  816. let fileUrl = response;
  817. this.ruleForm.STUDENT_CLIENT_BG_PICTURE_URL =
  818. this.ruleForm.properties.STUDENT_CLIENT_BG_PICTURE_URL = fileUrl;
  819. } else {
  820. this.errDialog = true;
  821. }
  822. this.fileLoading = false;
  823. },
  824. handleRemoveClientBgPicture() {
  825. this.fileListClientBgPicture = [];
  826. this.ruleForm.STUDENT_CLIENT_BG_PICTURE_URL =
  827. this.ruleForm.properties.STUDENT_CLIENT_BG_PICTURE_URL = "";
  828. if (this.$refs.uploadClientBgPicture) {
  829. this.$refs.uploadClientBgPicture.clearFiles();
  830. }
  831. },
  832. submitUploadClientBgPicture() {
  833. if (!this.checkUploadClientBgPicture()) {
  834. return false;
  835. }
  836. this.$refs.uploadClientBgPicture.submit();
  837. this.fileLoading = true;
  838. },
  839. submitForm(formName) {
  840. this.$refs[formName].validate((valid) => {
  841. if (valid) {
  842. if (
  843. this.$refs.tree.getCheckedKeys() == null ||
  844. this.$refs.tree.getCheckedKeys().length == 0
  845. ) {
  846. this.$notify({
  847. message: "请至少选择一个菜单功能",
  848. type: "error",
  849. });
  850. return;
  851. }
  852. this.ruleForm.properties.OE_STUDENT_SYS_NAME =
  853. this.ruleForm.OE_STUDENT_SYS_NAME;
  854. this.ruleForm.properties.STUDENT_CLIENT_BG_PICTURE_URL =
  855. this.ruleForm.STUDENT_CLIENT_BG_PICTURE_URL;
  856. this.ruleForm.properties.LOGO_FILE_URL = this.ruleForm.LOGO_FILE_URL;
  857. this.ruleForm.properties.STUDENT_CLIENT_DEFAULT_SIZE =
  858. this.ruleForm.STUDENT_CLIENT_DEFAULT_SIZE;
  859. this.ruleForm.properties.STUDENT_CLIENT_CONSOLE_CONFIG =
  860. this.ruleForm.STUDENT_CLIENT_CONSOLE_CONFIG;
  861. this.ruleForm.properties.LOGIN_TYPE = this.ruleForm.LOGIN_TYPE =
  862. this.ruleForm.loginType.join(",");
  863. this.ruleForm.properties.LOGIN_SUPPORT = this.ruleForm.LOGIN_SUPPORT =
  864. this.ruleForm.loginSupport.join(",");
  865. this.ruleForm.properties.STUDENT_CODE_LOGIN_ALIAS =
  866. this.ruleForm.STUDENT_CODE_LOGIN_ALIAS;
  867. this.ruleForm.properties.IDENTITY_NUMBER_LOGIN_ALIAS =
  868. this.ruleForm.IDENTITY_NUMBER_LOGIN_ALIAS;
  869. if (
  870. this.ruleForm.preventCheatingConfig == null ||
  871. this.ruleForm.preventCheatingConfig.length == 0
  872. ) {
  873. this.ruleForm.properties.PREVENT_CHEATING_CONFIG =
  874. this.ruleForm.PREVENT_CHEATING_CONFIG = "NONE";
  875. } else {
  876. let defaultArr = [];
  877. for (let lt of PREVENT_CHEATING_CONFIG) {
  878. defaultArr.push(lt.code);
  879. }
  880. let validArr = [];
  881. //保存时清理一下历史数据
  882. for (
  883. let i = 0;
  884. i < this.ruleForm.preventCheatingConfig.length;
  885. i++
  886. ) {
  887. let code = this.ruleForm.preventCheatingConfig[i];
  888. if (defaultArr.indexOf(code) > -1) {
  889. validArr.push(code);
  890. }
  891. }
  892. let res = "";
  893. if (validArr.length == 0) {
  894. res = "NONE";
  895. } else {
  896. res = validArr.join(",");
  897. }
  898. this.ruleForm.properties.PREVENT_CHEATING_CONFIG =
  899. this.ruleForm.PREVENT_CHEATING_CONFIG = res;
  900. }
  901. if (
  902. this.ruleForm.studentClientVersion == null ||
  903. this.ruleForm.studentClientVersion.length == 0
  904. ) {
  905. this.ruleForm.properties.STUDENT_CLIENT_VERSION =
  906. this.ruleForm.STUDENT_CLIENT_VERSION = "NONE";
  907. } else {
  908. let defaultArr = [];
  909. for (let lt of STUDENT_CLIENT_VERSION) {
  910. defaultArr.push(lt.code);
  911. }
  912. let validArr = [];
  913. //保存时清理一下历史数据
  914. for (
  915. let i = 0;
  916. i < this.ruleForm.studentClientVersion.length;
  917. i++
  918. ) {
  919. let code = this.ruleForm.studentClientVersion[i];
  920. if (defaultArr.indexOf(code) > -1) {
  921. validArr.push(code);
  922. }
  923. }
  924. let res = "";
  925. if (validArr.length == 0) {
  926. res = "NONE";
  927. } else {
  928. res = validArr.join(",");
  929. }
  930. this.ruleForm.properties.STUDENT_CLIENT_VERSION =
  931. this.ruleForm.STUDENT_CLIENT_VERSION = res;
  932. }
  933. this.ruleForm.properties.IS_CUSTOM_MENU_LOGO =
  934. this.ruleForm.IS_CUSTOM_MENU_LOGO;
  935. if (this.ruleForm.IS_CUSTOM_MENU_LOGO == "true") {
  936. this.ruleForm.properties.CUS_MENU_LOGO_FILE_URL =
  937. this.ruleForm.CUS_MENU_LOGO_FILE_URL;
  938. }
  939. Promise.all([
  940. this.$httpWithMsg.put(
  941. CORE_API + "/org/saveOrgProperties",
  942. this.ruleForm
  943. ),
  944. this.$httpWithMsg.post(
  945. CORE_API + "/rolePrivilege/updateRootOrgPrivilegeRelations",
  946. {
  947. rootOrgId: this.ruleForm.orgId,
  948. privilegeGroupId: this.privilegeGroupId,
  949. privilegeIdSet: this.checkedKeys,
  950. }
  951. ),
  952. ]).then(([resp1, resp2]) => {
  953. console.log("resp1:" + resp1);
  954. console.log("resp1:" + resp2);
  955. this.$notify({
  956. message: "保存成功",
  957. type: "success",
  958. });
  959. this.originalRuleForm = Object.assign({}, this.ruleForm);
  960. this.formDataChanged = false;
  961. this.treeCheckedChanged = false;
  962. this.originalCheckedKeys = this.$refs.tree.getCheckedKeys();
  963. });
  964. } else {
  965. console.log("error submit!!");
  966. return false;
  967. }
  968. });
  969. },
  970. async initForm() {
  971. this.uploadAction = CORE_API + "/org/importLogo/" + this.ruleForm.orgId;
  972. this.uploadActionClientBgPicture =
  973. CORE_API + "/org/importClientBgPicture/" + this.ruleForm.orgId;
  974. this.uploadAnswer =
  975. CORE_API + "/org/importAnswers/" + this.ruleForm.orgId;
  976. this.ruleForm.STUDENT_CLIENT_DEFAULT_SIZE = "1400*900";
  977. this.ruleForm.relatedPropertyGroupIdList = ["studentClientConfig"];
  978. await this.initConfig();
  979. this.initTree();
  980. },
  981. beforeUpload(file) {
  982. if (!this.checkUpload()) {
  983. return false;
  984. }
  985. console.log(file);
  986. },
  987. beforeUploadAnswer(file) {
  988. if (!this.checkUploadAnswer()) {
  989. return false;
  990. }
  991. console.log(file);
  992. },
  993. uploadProgress() {
  994. console.log("uploadProgress");
  995. },
  996. uploadSuccess(response) {
  997. console.log("uploadSuccess");
  998. console.log(response);
  999. if (response && response.length > 0) {
  1000. this.$notify({
  1001. message: "上传成功",
  1002. type: "success",
  1003. });
  1004. let fileUrl = response;
  1005. this.ruleForm.LOGO_FILE_URL = this.ruleForm.properties.LOGO_FILE_URL =
  1006. fileUrl;
  1007. } else {
  1008. this.errDialog = true;
  1009. }
  1010. this.fileLoading = false;
  1011. this.logoDialog = false;
  1012. // this.removeFile();
  1013. },
  1014. uploadAnswerSuccess(response) {
  1015. console.log("uploadSuccess");
  1016. console.log(response);
  1017. if (response && response.length > 0) {
  1018. this.$notify({
  1019. message: "上传成功",
  1020. type: "success",
  1021. });
  1022. let fileUrl = response;
  1023. this.ruleForm.ANSWERS_TEMPLATE =
  1024. this.ruleForm.properties.ANSWERS_TEMPLATE = fileUrl;
  1025. } else {
  1026. this.errDialog = true;
  1027. }
  1028. this.fileLoading = false;
  1029. this.logoDialog = false;
  1030. // this.removeFile();
  1031. },
  1032. uploadError(response) {
  1033. let json = JSON.parse(response.message);
  1034. if (response.status == 500) {
  1035. this.$notify({
  1036. message: json.desc,
  1037. type: "error",
  1038. });
  1039. }
  1040. this.fileLoading = false;
  1041. },
  1042. //确定上传
  1043. submitUpload() {
  1044. if (!this.checkUpload()) {
  1045. return false;
  1046. }
  1047. this.$refs.upload.submit();
  1048. this.fileLoading = true;
  1049. },
  1050. checkUpload() {
  1051. let fileList = this.$refs.upload.uploadFiles;
  1052. if (fileList.length == 0) {
  1053. this.$notify({
  1054. message: "上传文件不能为空",
  1055. type: "error",
  1056. });
  1057. return false;
  1058. }
  1059. if (fileList.length > 1) {
  1060. this.$notify({
  1061. message: "每次只能上传一个文件",
  1062. type: "error",
  1063. });
  1064. return false;
  1065. }
  1066. for (let file of fileList) {
  1067. let fileName = file.name;
  1068. if (
  1069. // !fileName.endsWith(".jpg") &&
  1070. // !fileName.endsWith(".gif") &&
  1071. !fileName.endsWith(".png")
  1072. ) {
  1073. this.$notify({
  1074. message: "上传文件格式必须为[png]",
  1075. type: "error",
  1076. });
  1077. this.fileList = [];
  1078. return false;
  1079. }
  1080. }
  1081. return true;
  1082. },
  1083. //清空文件
  1084. removeFile() {
  1085. this.fileList = [];
  1086. this.ruleForm.LOGO_FILE_URL = this.ruleForm.properties.LOGO_FILE_URL = "";
  1087. if (this.$refs.upload) {
  1088. this.$refs.upload.clearFiles();
  1089. }
  1090. },
  1091. handleRemove(file, fileList) {
  1092. console.log(file, fileList);
  1093. this.removeFile();
  1094. },
  1095. handleExceed() {
  1096. this.$notify({
  1097. message: "当前限制选择 1 个文件,请先清空文件再试",
  1098. type: "error",
  1099. });
  1100. },
  1101. equalArrayIgnoreSequence(arr1, arr2) {
  1102. // 判断数组的长度
  1103. if (arr1.length !== arr2.length) {
  1104. return false;
  1105. } else {
  1106. let a = Object.assign([], arr1);
  1107. let b = Object.assign([], arr2);
  1108. a.sort();
  1109. b.sort();
  1110. // 循环遍历数组的值进行比较
  1111. for (let i = 0; i < a.length; i++) {
  1112. if (a[i] !== b[i]) {
  1113. return false;
  1114. }
  1115. }
  1116. return true;
  1117. }
  1118. },
  1119. //初始化配置
  1120. async initConfig() {
  1121. let url =
  1122. CORE_API +
  1123. "/org/getOrgPropertiesByGroupWithoutCache/" +
  1124. this.ruleForm.orgId +
  1125. "/" +
  1126. this.propertyGroupId;
  1127. await this.$httpWithMsg.get(url).then((response) => {
  1128. console.log(response);
  1129. if (response) {
  1130. this.ruleForm.properties = response.data;
  1131. // if (this.ruleForm.properties.OE_STUDENT_SYS_NAME) {
  1132. this.ruleForm.OE_STUDENT_SYS_NAME =
  1133. this.ruleForm.properties.OE_STUDENT_SYS_NAME ||
  1134. this.ruleForm.OE_STUDENT_SYS_NAME;
  1135. // }
  1136. this.ruleForm.STUDENT_CLIENT_BG_PICTURE_URL =
  1137. this.ruleForm.properties.STUDENT_CLIENT_BG_PICTURE_URL ||
  1138. this.ruleForm.STUDENT_CLIENT_BG_PICTURE_URL;
  1139. this.ruleForm.LOGO_FILE_URL =
  1140. this.ruleForm.properties.LOGO_FILE_URL ||
  1141. this.ruleForm.LOGO_FILE_URL;
  1142. this.ruleForm.ANSWERS_TEMPLATE =
  1143. this.ruleForm.properties.ANSWERS_TEMPLATE ||
  1144. this.ruleForm.ANSWERS_TEMPLATE;
  1145. this.ruleForm.LOGIN_TYPE =
  1146. this.ruleForm.properties.LOGIN_TYPE || this.ruleForm.LOGIN_TYPE;
  1147. this.ruleForm.LOGIN_SUPPORT =
  1148. this.ruleForm.properties.LOGIN_SUPPORT ||
  1149. this.ruleForm.LOGIN_SUPPORT;
  1150. this.ruleForm.PREVENT_CHEATING_CONFIG =
  1151. this.ruleForm.properties.PREVENT_CHEATING_CONFIG ||
  1152. this.ruleForm.PREVENT_CHEATING_CONFIG;
  1153. this.ruleForm.STUDENT_CLIENT_VERSION =
  1154. this.ruleForm.properties.STUDENT_CLIENT_VERSION ||
  1155. this.ruleForm.STUDENT_CLIENT_VERSION;
  1156. this.ruleForm.STUDENT_CLIENT_DEFAULT_SIZE =
  1157. this.ruleForm.properties.STUDENT_CLIENT_DEFAULT_SIZE ||
  1158. this.ruleForm.STUDENT_CLIENT_DEFAULT_SIZE;
  1159. this.ruleForm.STUDENT_CLIENT_CONSOLE_CONFIG = this.ruleForm.properties
  1160. .STUDENT_CLIENT_CONSOLE_CONFIG
  1161. ? ""
  1162. : this.ruleForm.properties.STUDENT_CLIENT_CONSOLE_CONFIG;
  1163. this.ruleForm.STUDENT_CODE_LOGIN_ALIAS =
  1164. this.ruleForm.properties.STUDENT_CODE_LOGIN_ALIAS ||
  1165. this.ruleForm.STUDENT_CODE_LOGIN_ALIAS;
  1166. this.ruleForm.IDENTITY_NUMBER_LOGIN_ALIAS =
  1167. this.ruleForm.properties.IDENTITY_NUMBER_LOGIN_ALIAS ||
  1168. this.ruleForm.IDENTITY_NUMBER_LOGIN_ALIAS;
  1169. if (this.ruleForm.properties.LOGIN_TYPE) {
  1170. this.ruleForm.loginType =
  1171. this.ruleForm.properties.LOGIN_TYPE.split(",");
  1172. } else {
  1173. let defaultValue = [];
  1174. for (let lt of LOGIN_TYPE) {
  1175. defaultValue.push(lt.code);
  1176. }
  1177. this.ruleForm.loginType = defaultValue;
  1178. console.log(defaultValue);
  1179. }
  1180. if (this.ruleForm.properties.LOGIN_SUPPORT) {
  1181. this.ruleForm.loginSupport =
  1182. this.ruleForm.properties.LOGIN_SUPPORT.split(",");
  1183. }
  1184. if (this.ruleForm.properties.PREVENT_CHEATING_CONFIG) {
  1185. if (this.ruleForm.properties.PREVENT_CHEATING_CONFIG != "NONE") {
  1186. this.ruleForm.preventCheatingConfig =
  1187. this.ruleForm.properties.PREVENT_CHEATING_CONFIG.split(",");
  1188. } else {
  1189. this.ruleForm.preventCheatingConfig = [];
  1190. }
  1191. } else {
  1192. let defaultValue = [];
  1193. for (let lt of PREVENT_CHEATING_CONFIG) {
  1194. defaultValue.push(lt.code);
  1195. }
  1196. this.ruleForm.preventCheatingConfig = defaultValue;
  1197. // console.log(defaultValue);
  1198. }
  1199. if (this.ruleForm.properties.STUDENT_CLIENT_VERSION) {
  1200. if (this.ruleForm.properties.STUDENT_CLIENT_VERSION != "NONE") {
  1201. this.ruleForm.studentClientVersion =
  1202. this.ruleForm.properties.STUDENT_CLIENT_VERSION.split(",");
  1203. } else {
  1204. this.ruleForm.studentClientVersion = [];
  1205. }
  1206. } else {
  1207. let defaultValue = [];
  1208. // for (let lt of STUDENT_CLIENT_VERSION) {
  1209. // defaultValue.push(lt.code);
  1210. // }
  1211. this.ruleForm.studentClientVersion = defaultValue;
  1212. // console.log(defaultValue);
  1213. }
  1214. let fileUrlClientBgPicture =
  1215. response.data.STUDENT_CLIENT_BG_PICTURE_URL;
  1216. if (fileUrlClientBgPicture) {
  1217. let lastIndex = fileUrlClientBgPicture.lastIndexOf("/");
  1218. let len = fileUrlClientBgPicture.length;
  1219. let fname = fileUrlClientBgPicture.substr(
  1220. lastIndex + 1,
  1221. len - lastIndex
  1222. );
  1223. this.fileListClientBgPicture = [
  1224. { name: fname, url: this.ruleForm.STUDENT_CLIENT_BG_PICTURE_URL },
  1225. ];
  1226. } else {
  1227. this.fileListClientBgPicture = [];
  1228. }
  1229. let fileUrl = response.data.LOGO_FILE_URL;
  1230. let fname = "";
  1231. if (fileUrl) {
  1232. let lastIndex = fileUrl.lastIndexOf("/");
  1233. let len = fileUrl.length;
  1234. fname = fileUrl.substr(lastIndex + 1, len - lastIndex);
  1235. this.fileList = [{ name: fname, url: this.ruleForm.LOGO_FILE_URL }];
  1236. } else {
  1237. this.fileList = [];
  1238. }
  1239. let answersUrl = response.data.ANSWERS_TEMPLATE;
  1240. let answersName = "";
  1241. if (answersUrl) {
  1242. let lastIndex = answersUrl.lastIndexOf("/");
  1243. let len = answersUrl.length;
  1244. answersName = answersUrl.substr(lastIndex + 1, len - lastIndex);
  1245. this.answerFileList = [
  1246. { name: answersName, url: this.ruleForm.ANSWERS_TEMPLATE },
  1247. ];
  1248. } else {
  1249. this.answerFileList = [];
  1250. }
  1251. this.uploadMenuLogoAction =
  1252. CORE_API + "/org/importCusMenuLogo/" + this.ruleForm.orgId;
  1253. this.ruleForm.IS_CUSTOM_MENU_LOGO =
  1254. this.ruleForm.properties.IS_CUSTOM_MENU_LOGO ||
  1255. this.ruleForm.IS_CUSTOM_MENU_LOGO;
  1256. if (this.ruleForm.IS_CUSTOM_MENU_LOGO == "true") {
  1257. this.ruleForm.CUS_MENU_LOGO_FILE_URL =
  1258. this.ruleForm.properties.CUS_MENU_LOGO_FILE_URL ||
  1259. this.ruleForm.CUS_MENU_LOGO_FILE_URL;
  1260. let fileUrl2 = response.data.CUS_MENU_LOGO_FILE_URL;
  1261. let fname2 = "";
  1262. if (fileUrl2) {
  1263. let lastIndex = fileUrl2.lastIndexOf("/");
  1264. let len = fileUrl2.length;
  1265. fname2 = fileUrl2.substr(lastIndex + 1, len - lastIndex);
  1266. this.menuLogoFileList = [
  1267. { name: fname2, url: this.ruleForm.CUS_MENU_LOGO_FILE_URL },
  1268. ];
  1269. } else {
  1270. this.menuLogoFileList = [];
  1271. }
  1272. }
  1273. this.originalRuleForm = Object.assign({}, this.ruleForm);
  1274. } else {
  1275. this.$notify({
  1276. message: "学生客户端信息暂未初始化,请立即初始化",
  1277. type: "warning",
  1278. });
  1279. }
  1280. });
  1281. },
  1282. //初始化权限树
  1283. async initTree() {
  1284. var url =
  1285. CORE_API +
  1286. "/rolePrivilege/getStudentClientMenuTree/" +
  1287. this.ruleForm.orgId +
  1288. "?includeDisabledCodes=false";
  1289. this.$httpWithMsg.get(url).then((response) => {
  1290. if (response) {
  1291. this.treeData = [];
  1292. this.treeData.push(response.data.treeData);
  1293. this.privilegeGroupId = response.data.privilegeGroupId;
  1294. this.originalCheckedKeys = response.data.ownedPrivilegeIds;
  1295. this.checkedKeys = response.data.ownedPrivilegeIds;
  1296. this.setCheckedKeys(this.checkedKeys);
  1297. } else {
  1298. this.$notify({
  1299. message: "自定义菜单权限树初始化失败",
  1300. type: "warning",
  1301. });
  1302. }
  1303. });
  1304. },
  1305. setCheckedKeys(keys) {
  1306. this.$refs.tree.setCheckedKeys(keys);
  1307. },
  1308. renderMenuTreeContent(h, { node, data, store }) {
  1309. if (node.key == -1) {
  1310. return (
  1311. <span>
  1312. <span>
  1313. <span>{node.label}</span>
  1314. </span>
  1315. </span>
  1316. );
  1317. }
  1318. return (
  1319. <span>
  1320. <span>
  1321. <span>{node.label}</span>
  1322. </span>
  1323. <span style="float: right; margin-left: 20px; margin-right: 20px">
  1324. <el-button
  1325. size="mini"
  1326. type="text"
  1327. on-click={() => this.openCusMenuTreeDialog(store, data, "view")}
  1328. >
  1329. 查看
  1330. </el-button>
  1331. <el-button
  1332. size="mini"
  1333. type="text"
  1334. on-click={() => this.openCusMenuTreeDialog(store, data, "edit")}
  1335. >
  1336. 修改
  1337. </el-button>
  1338. </span>
  1339. </span>
  1340. );
  1341. },
  1342. treeCheckeChange(data, checked, indeterminate) {
  1343. console.log(data, checked, indeterminate);
  1344. this.checkedKeys = this.$refs.tree.getCheckedKeys();
  1345. },
  1346. openCusMenuTreeDialog(store, data, optType) {
  1347. this.store = store;
  1348. this.data = data;
  1349. this.getPrivilege(data.id, optType);
  1350. },
  1351. getPrivilege(id, type) {
  1352. var url = CORE_API + "/rolePrivilege/getPrivilege/" + id;
  1353. this.$httpWithMsg.get(url).then((response) => {
  1354. var resp = response.data;
  1355. this.cusMenuTreeDialog.show = true;
  1356. this.cusMenuTreeDialog.optType = type;
  1357. this.cusMenuTreeDialog.privilege.id = resp.id;
  1358. this.cusMenuTreeDialog.privilege.groupId = resp.groupId;
  1359. this.cusMenuTreeDialog.privilege.parentId = resp.parentId;
  1360. this.cusMenuTreeDialog.privilege.name = resp.name;
  1361. this.cusMenuTreeDialog.privilege.code = resp.code;
  1362. this.cusMenuTreeDialog.privilege.description = resp.description;
  1363. this.cusMenuTreeDialog.privilege.weight = resp.weight + "";
  1364. this.cusMenuTreeDialog.privilege.ext1 = resp.ext1;
  1365. this.cusMenuTreeDialog.privilege.ext2 = resp.ext2;
  1366. this.cusMenuTreeDialog.privilege.ext3 = resp.ext3;
  1367. this.cusMenuTreeDialog.privilege.ext4 = resp.ext4;
  1368. this.cusMenuTreeDialog.privilege.ext5 = resp.ext5;
  1369. });
  1370. },
  1371. beforeUploadMenuLogo(file) {
  1372. if (!this.checkUploadMenuLogo()) {
  1373. return false;
  1374. }
  1375. console.log(file);
  1376. },
  1377. uploadMenuLogoProgress() {
  1378. console.log("uploadProgress");
  1379. },
  1380. uploadMenuLogoSuccess(response) {
  1381. console.log("uploadSuccess");
  1382. // console.log(response);
  1383. if (response && response.length > 0) {
  1384. this.$notify({
  1385. message: "上传成功",
  1386. type: "success",
  1387. });
  1388. let fileUrl = response;
  1389. this.ruleForm.CUS_MENU_LOGO_FILE_URL =
  1390. this.ruleForm.properties.CUS_MENU_LOGO_FILE_URL = fileUrl;
  1391. } else {
  1392. this.errDialog = true;
  1393. }
  1394. this.fileLoading = false;
  1395. this.logoDialog = false;
  1396. // this.removeFile();
  1397. },
  1398. uploadMenuLogoError(response) {
  1399. let json = JSON.parse(response.message);
  1400. if (response.status == 500) {
  1401. this.$notify({
  1402. message: json.desc,
  1403. type: "error",
  1404. });
  1405. }
  1406. this.fileLoading = false;
  1407. },
  1408. //确定上传
  1409. submitUploadAnswer() {
  1410. if (!this.checkUploadAnswer()) {
  1411. return false;
  1412. }
  1413. this.$refs.uploadAnswer.submit();
  1414. this.fileLoading = true;
  1415. },
  1416. checkUploadAnswer() {
  1417. let fileList = this.$refs.uploadAnswer.uploadFiles;
  1418. if (fileList.length == 0) {
  1419. this.$notify({
  1420. message: "上传文件不能为空",
  1421. type: "error",
  1422. });
  1423. return false;
  1424. }
  1425. if (fileList.length > 1) {
  1426. this.$notify({
  1427. message: "每次只能上传一个文件",
  1428. type: "error",
  1429. });
  1430. return false;
  1431. }
  1432. for (let file of fileList) {
  1433. let fileName = file.name;
  1434. if (!fileName.endsWith(".zip")) {
  1435. this.$notify({
  1436. message: "上传文件格式必须为[zip]",
  1437. type: "error",
  1438. });
  1439. this.menuLogoFileList = [];
  1440. return false;
  1441. }
  1442. }
  1443. return true;
  1444. },
  1445. //清空文件
  1446. removeAnswerFile() {
  1447. this.answerFileList = [];
  1448. this.ruleForm.ANSWERS_TEMPLATE =
  1449. this.ruleForm.properties.ANSWERS_TEMPLATE = "";
  1450. if (this.$refs.uploadAnswer) {
  1451. this.$refs.uploadAnswer.clearFiles();
  1452. }
  1453. },
  1454. handleAnswerRemove(file, fileList) {
  1455. console.log(file, fileList);
  1456. this.removeAnswerFile();
  1457. },
  1458. handleAnswerExceed() {
  1459. this.$notify({
  1460. message: "当前限制选择 1 个文件,请先清空文件再试",
  1461. type: "error",
  1462. });
  1463. },
  1464. //确定上传
  1465. submitUploadMenuLogo() {
  1466. if (!this.checkUploadMenuLogo()) {
  1467. return false;
  1468. }
  1469. this.$refs.menuLogUpload.submit();
  1470. this.fileLoading = true;
  1471. },
  1472. checkUploadMenuLogo() {
  1473. let fileList = this.$refs.menuLogUpload.uploadFiles;
  1474. if (fileList.length == 0) {
  1475. this.$notify({
  1476. message: "上传文件不能为空",
  1477. type: "error",
  1478. });
  1479. return false;
  1480. }
  1481. if (fileList.length > 1) {
  1482. this.$notify({
  1483. message: "每次只能上传一个文件",
  1484. type: "error",
  1485. });
  1486. return false;
  1487. }
  1488. for (let file of fileList) {
  1489. let fileName = file.name;
  1490. if (
  1491. // !fileName.endsWith(".jpg") &&
  1492. // !fileName.endsWith(".gif") &&
  1493. !fileName.endsWith(".png")
  1494. ) {
  1495. this.$notify({
  1496. message: "上传文件格式必须为[png]",
  1497. type: "error",
  1498. });
  1499. this.menuLogoFileList = [];
  1500. return false;
  1501. }
  1502. }
  1503. return true;
  1504. },
  1505. //清空文件
  1506. removeMenuLogoFile() {
  1507. this.menuLogoFileList = [];
  1508. this.ruleForm.CUS_MENU_LOGO_FILE_URL =
  1509. this.ruleForm.properties.CUS_MENU_LOGO_FILE_URL = "";
  1510. if (this.$refs.menuLogUpload) {
  1511. this.$refs.menuLogUpload.clearFiles();
  1512. }
  1513. },
  1514. handleMenuLogoRemove(file, fileList) {
  1515. console.log(file, fileList);
  1516. this.removeMenuLogoFile();
  1517. },
  1518. handleMenuLogoExceed() {
  1519. this.$notify({
  1520. message: "当前限制选择 1 个文件,请先清空文件再试",
  1521. type: "error",
  1522. });
  1523. },
  1524. updatePrivilege() {
  1525. this.$refs.updateForm.validate((valid) => {
  1526. if (!valid) {
  1527. return;
  1528. }
  1529. var url = CORE_API + "/rolePrivilege/updatePrivilege";
  1530. this.$httpWithMsg
  1531. .put(url, this.cusMenuTreeDialog.privilege)
  1532. .then(() => {
  1533. this.$notify({
  1534. message: "修改成功",
  1535. type: "success",
  1536. });
  1537. this.data.label = this.cusMenuTreeDialog.privilege.name;
  1538. });
  1539. this.cusMenuTreeDialog.show = false;
  1540. });
  1541. },
  1542. csutomMenuLogoChange(val) {
  1543. if (val == "false") {
  1544. this.removeMenuLogoFile();
  1545. }
  1546. },
  1547. },
  1548. };
  1549. </script>
  1550. <style scoped>
  1551. .input-width {
  1552. width: 638px;
  1553. }
  1554. .upload-width {
  1555. width: 638px;
  1556. }
  1557. /* .btn-margin-left {
  1558. margin-left: 20px;
  1559. } */
  1560. </style>