clientConfig.vue 53 KB

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