permissionSettingDialog.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369
  1. <template>
  2. <div>
  3. <el-dialog
  4. title="权限设置"
  5. class="permissionSettingDialog"
  6. :visible.sync="show"
  7. :close-on-click-modal="false"
  8. width="1000px"
  9. top="8vh"
  10. >
  11. <div v-loading="loading" class="ps_area">
  12. <div class="pa_a_head">
  13. <span
  14. :class="{ pa_a_h_active: tagType == 'basics' }"
  15. @click="changeTagType('basics')"
  16. >基本信息</span
  17. >
  18. <span
  19. :class="{ pa_a_h_active: tagType == 'desktop' }"
  20. @click="changeTagType('desktop')"
  21. >桌面工具</span
  22. >
  23. <span
  24. :class="{ pa_a_h_active: tagType == 'admin-index' }"
  25. @click="changeTagType('admin-index')"
  26. >管理平台侧首页</span
  27. >
  28. <span
  29. :class="{ pa_a_h_active: tagType == 'admin-sidebar' }"
  30. @click="changeTagType('admin-sidebar')"
  31. >管理平台侧边栏</span
  32. >
  33. <div class="ea_add">
  34. <el-button
  35. size="mini"
  36. v-if="['admin-sidebar'].includes(tagType)"
  37. type="primary"
  38. @click="addMenu()"
  39. >添加菜单</el-button
  40. >
  41. <el-button
  42. size="mini"
  43. v-if="
  44. ['desktop', 'admin-index', 'admin-sidebar'].includes(tagType)
  45. "
  46. type="primary"
  47. @click="addTool(tagType)"
  48. >添加工具</el-button
  49. >
  50. </div>
  51. </div>
  52. <div class="pa_a_editBox">
  53. <div class="editArea pa_a_eb_basics" v-show="tagType == 'basics'">
  54. <div class="ea_basics_input">
  55. <span>标题</span>
  56. <el-input
  57. v-model="form.basics.title"
  58. placeholder="请输入标题内容"
  59. ></el-input>
  60. </div>
  61. <div class="ea_basics_input">
  62. <span>简介</span>
  63. <el-input
  64. v-model="form.basics.brief"
  65. placeholder="请输入简介内容"
  66. ></el-input>
  67. </div>
  68. <div class="ea_basics_logo">
  69. <span>logo</span>
  70. <el-tooltip
  71. class="item"
  72. effect="dark"
  73. :content="form.basics.logo ? '更改图标' : '上传图标'"
  74. placement="top"
  75. >
  76. <el-image
  77. style="width: 100%; height: 100%"
  78. :src="form.basics.logo"
  79. fit="cover"
  80. @click="addBasicsIcon()"
  81. >
  82. <div slot="error" class="image-slot" @click="addBasicsIcon()">
  83. <i class="el-icon-picture-outline"></i>
  84. </div>
  85. </el-image>
  86. </el-tooltip>
  87. </div>
  88. </div>
  89. <div class="editArea pa_a_eb_desktop" v-show="tagType == 'desktop'">
  90. <div class="ea_table">
  91. <el-table
  92. :data="form.desktop.list"
  93. stripe
  94. border
  95. style="width: 100%"
  96. :header-cell-style="headerCellStyle"
  97. >
  98. <el-table-column
  99. label="标识"
  100. min-width="100"
  101. show-overflow-tooltip
  102. >
  103. <template slot-scope="scope">{{
  104. scope.row.toolId ? scope.row.toolId : "-"
  105. }}</template>
  106. </el-table-column>
  107. <!-- <el-table-column
  108. label="宽度"
  109. min-width="45"
  110. show-overflow-tooltip
  111. >
  112. <template slot-scope="scope">{{
  113. scope.row.dialogWidth ? scope.row.dialogWidth : "-"
  114. }}</template>
  115. </el-table-column>
  116. <el-table-column
  117. label="高度"
  118. min-width="45"
  119. show-overflow-tooltip
  120. >
  121. <template slot-scope="scope">{{
  122. scope.row.dialogHeight ? scope.row.dialogHeight : "-"
  123. }}</template>
  124. </el-table-column> -->
  125. <el-table-column
  126. label="描述"
  127. min-width="200"
  128. show-overflow-tooltip
  129. >
  130. <template slot-scope="scope">{{
  131. scope.row.description ? scope.row.description : "-"
  132. }}</template>
  133. </el-table-column>
  134. <el-table-column
  135. label="工具设置"
  136. min-width="80"
  137. show-overflow-tooltip
  138. >
  139. <template slot-scope="scope">
  140. <el-popover placement="bottom" width="840" trigger="hover">
  141. <div class="urlItemBox">
  142. <div
  143. class="urlItem"
  144. v-for="(item, index) in scope.row.url"
  145. :key="scope.row.id + '-' + index"
  146. >
  147. <span>{{ item.region }}</span>
  148. <div class="ui_message">
  149. <div>名称:{{ item.name ? item.name : "-" }}</div>
  150. <div>
  151. <span>链接:</span
  152. ><a
  153. :href="item.url"
  154. v-if="item.url"
  155. target="_blank"
  156. >{{ item.url }}</a
  157. ><span v-else>-</span>
  158. </div>
  159. <div>
  160. <span>桌面图标:</span>
  161. <div class="ui_m_image">
  162. <el-image
  163. v-if="item.icon"
  164. style="width: 100%; height: 100%"
  165. :src="item.icon"
  166. fit="cover"
  167. ></el-image>
  168. <span v-else>-</span>
  169. </div>
  170. </div>
  171. <div>
  172. <span>平台图标:</span>
  173. <div class="ui_m_image">
  174. <el-image
  175. v-if="item.platformIcon"
  176. style="width: 100%; height: 100%"
  177. :src="item.platformIcon"
  178. fit="cover"
  179. ></el-image>
  180. <span v-else>-</span>
  181. </div>
  182. </div>
  183. <div>
  184. <span>默认图标:</span>
  185. <div class="ui_m_image">
  186. <el-image
  187. v-if="item.defaultIcon"
  188. style="width: 100%; height: 100%"
  189. :src="item.defaultIcon"
  190. fit="cover"
  191. ></el-image>
  192. <span v-else>-</span>
  193. </div>
  194. </div>
  195. <div>
  196. <span>激活图标:</span>
  197. <div class="ui_m_image">
  198. <el-image
  199. v-if="item.activeIcon"
  200. style="width: 100%; height: 100%"
  201. :src="item.activeIcon"
  202. fit="cover"
  203. ></el-image>
  204. <span v-else>-</span>
  205. </div>
  206. </div>
  207. </div>
  208. </div>
  209. </div>
  210. <el-button slot="reference" size="small"
  211. >查看设置</el-button
  212. >
  213. </el-popover>
  214. </template>
  215. </el-table-column>
  216. <el-table-column
  217. label="仅管理员显示"
  218. min-width="80"
  219. show-overflow-tooltip
  220. >
  221. <template slot-scope="scope">{{
  222. scope.row.isAdmin == "1" ? "是" : "否"
  223. }}</template>
  224. </el-table-column>
  225. <el-table-column
  226. label="操作"
  227. width="200px"
  228. show-overflow-tooltip
  229. >
  230. <template slot-scope="scope">
  231. <button
  232. @click="moveUp(scope.row)"
  233. v-if="scope.$index > 0"
  234. style="
  235. color: #308fff;
  236. background: none;
  237. border: none;
  238. cursor: pointer;
  239. margin-left: 25px;
  240. "
  241. >
  242. 上移
  243. </button>
  244. <button
  245. @click="moveDown(scope.row)"
  246. v-if="form.desktop.list.length - 1 > scope.$index"
  247. style="
  248. color: #308fff;
  249. background: none;
  250. border: none;
  251. cursor: pointer;
  252. margin-left: 25px;
  253. "
  254. >
  255. 下移
  256. </button>
  257. <button
  258. @click="del(scope.row)"
  259. style="
  260. color: #ff2570;
  261. background: none;
  262. border: none;
  263. cursor: pointer;
  264. margin-left: 25px;
  265. "
  266. >
  267. 删除
  268. </button>
  269. </template>
  270. </el-table-column>
  271. </el-table>
  272. </div>
  273. </div>
  274. <div
  275. class="editArea pa_a_eb_admin-index"
  276. v-show="tagType == 'admin-index'"
  277. >
  278. <div class="ea_table">
  279. <el-table
  280. :data="form.admin.index.list"
  281. stripe
  282. border
  283. style="width: 100%"
  284. :header-cell-style="headerCellStyle"
  285. >
  286. <el-table-column
  287. label="标识"
  288. min-width="100"
  289. show-overflow-tooltip
  290. >
  291. <template slot-scope="scope">{{
  292. scope.row.toolId ? scope.row.toolId : "-"
  293. }}</template>
  294. </el-table-column>
  295. <!-- <el-table-column
  296. label="宽度"
  297. min-width="45"
  298. show-overflow-tooltip
  299. >
  300. <template slot-scope="scope">{{
  301. scope.row.dialogWidth ? scope.row.dialogWidth : "-"
  302. }}</template>
  303. </el-table-column>
  304. <el-table-column
  305. label="高度"
  306. min-width="45"
  307. show-overflow-tooltip
  308. >
  309. <template slot-scope="scope">{{
  310. scope.row.dialogHeight ? scope.row.dialogHeight : "-"
  311. }}</template>
  312. </el-table-column> -->
  313. <el-table-column
  314. label="描述"
  315. min-width="200"
  316. show-overflow-tooltip
  317. >
  318. <template slot-scope="scope">{{
  319. scope.row.description ? scope.row.description : "-"
  320. }}</template>
  321. </el-table-column>
  322. <el-table-column
  323. label="工具设置"
  324. min-width="80"
  325. show-overflow-tooltip
  326. >
  327. <template slot-scope="scope">
  328. <el-popover placement="bottom" width="840" trigger="hover">
  329. <div class="urlItemBox">
  330. <div
  331. class="urlItem"
  332. v-for="(item, index) in scope.row.url"
  333. :key="scope.row.id + '-' + index"
  334. >
  335. <span>{{ item.region }}</span>
  336. <div class="ui_message">
  337. <div>名称:{{ item.name ? item.name : "-" }}</div>
  338. <div>
  339. <span>链接:</span
  340. ><a
  341. :href="item.url"
  342. v-if="item.url"
  343. target="_blank"
  344. >{{ item.url }}</a
  345. ><span v-else>-</span>
  346. </div>
  347. <div>
  348. <span>桌面图标:</span>
  349. <div class="ui_m_image">
  350. <el-image
  351. v-if="item.icon"
  352. style="width: 100%; height: 100%"
  353. :src="item.icon"
  354. fit="cover"
  355. ></el-image>
  356. <span v-else>-</span>
  357. </div>
  358. </div>
  359. <div>
  360. <span>平台图标:</span>
  361. <div class="ui_m_image">
  362. <el-image
  363. v-if="item.platformIcon"
  364. style="width: 100%; height: 100%"
  365. :src="item.platformIcon"
  366. fit="cover"
  367. ></el-image>
  368. <span v-else>-</span>
  369. </div>
  370. </div>
  371. <div>
  372. <span>默认图标:</span>
  373. <div class="ui_m_image">
  374. <el-image
  375. v-if="item.defaultIcon"
  376. style="width: 100%; height: 100%"
  377. :src="item.defaultIcon"
  378. fit="cover"
  379. ></el-image>
  380. <span v-else>-</span>
  381. </div>
  382. </div>
  383. <div>
  384. <span>激活图标:</span>
  385. <div class="ui_m_image">
  386. <el-image
  387. v-if="item.activeIcon"
  388. style="width: 100%; height: 100%"
  389. :src="item.activeIcon"
  390. fit="cover"
  391. ></el-image>
  392. <span v-else>-</span>
  393. </div>
  394. </div>
  395. </div>
  396. </div>
  397. </div>
  398. <el-button slot="reference" size="small"
  399. >查看设置</el-button
  400. >
  401. </el-popover>
  402. </template>
  403. </el-table-column>
  404. <el-table-column
  405. label="仅管理员显示"
  406. min-width="80"
  407. show-overflow-tooltip
  408. >
  409. <template slot-scope="scope">{{
  410. scope.row.isAdmin == "1" ? "是" : "否"
  411. }}</template>
  412. </el-table-column>
  413. <el-table-column
  414. label="操作"
  415. width="200px"
  416. show-overflow-tooltip
  417. >
  418. <template slot-scope="scope">
  419. <button
  420. @click="moveUp(scope.row)"
  421. v-if="scope.$index > 0"
  422. style="
  423. color: #308fff;
  424. background: none;
  425. border: none;
  426. cursor: pointer;
  427. margin-left: 25px;
  428. "
  429. >
  430. 上移
  431. </button>
  432. <button
  433. @click="moveDown(scope.row)"
  434. v-if="form.admin.index.list.length - 1 > scope.$index"
  435. style="
  436. color: #308fff;
  437. background: none;
  438. border: none;
  439. cursor: pointer;
  440. margin-left: 25px;
  441. "
  442. >
  443. 下移
  444. </button>
  445. <button
  446. @click="del(scope.row)"
  447. style="
  448. color: #ff2570;
  449. background: none;
  450. border: none;
  451. cursor: pointer;
  452. margin-left: 25px;
  453. "
  454. >
  455. 删除
  456. </button>
  457. </template>
  458. </el-table-column>
  459. </el-table>
  460. </div>
  461. </div>
  462. <div
  463. class="editArea pa_a_eb_admin-sidebar"
  464. v-show="tagType == 'admin-sidebar'"
  465. >
  466. <div class="ea_table">
  467. <el-table
  468. :data="form.admin.sidebar.list"
  469. stripe
  470. border
  471. style="width: 100%"
  472. row-key="typeId"
  473. :header-cell-style="headerCellStyle"
  474. :tree-props="{
  475. children: 'children',
  476. hasChildren: 'hasChildren',
  477. }"
  478. >
  479. <el-table-column
  480. label="标识"
  481. min-width="100"
  482. show-overflow-tooltip
  483. >
  484. <template slot-scope="scope">{{
  485. scope.row.toolId ? scope.row.toolId : "-"
  486. }}</template>
  487. </el-table-column>
  488. <el-table-column
  489. label="描述"
  490. min-width="200"
  491. show-overflow-tooltip
  492. >
  493. <template slot-scope="scope">{{
  494. scope.row.description ? scope.row.description : "-"
  495. }}</template>
  496. </el-table-column>
  497. <el-table-column
  498. label="菜单名称"
  499. min-width="200"
  500. show-overflow-tooltip
  501. >
  502. <template slot-scope="scope">{{
  503. scope.row.menuName ? scope.row.menuName : "-"
  504. }}</template>
  505. </el-table-column>
  506. <el-table-column
  507. label="菜单默认图标"
  508. min-width="200"
  509. show-overflow-tooltip
  510. >
  511. <template slot-scope="scope">
  512. <el-image
  513. v-if="scope.row.menuIcon"
  514. style="width: 50px; height: 50px"
  515. :src="scope.row.menuIcon"
  516. fit="cover"
  517. >
  518. <div slot="error" class="image-slot">
  519. <i class="el-icon-picture-outline"></i>
  520. </div>
  521. </el-image>
  522. <span v-else>-</span>
  523. </template>
  524. </el-table-column>
  525. <el-table-column
  526. label="菜单激活图标"
  527. min-width="200"
  528. show-overflow-tooltip
  529. >
  530. <template slot-scope="scope">
  531. <el-image
  532. v-if="scope.row.menuActiveIcon"
  533. style="width: 50px; height: 50px"
  534. :src="scope.row.menuActiveIcon"
  535. fit="cover"
  536. >
  537. <div slot="error" class="image-slot">
  538. <i class="el-icon-picture-outline"></i>
  539. </div>
  540. </el-image>
  541. <span v-else>-</span>
  542. </template>
  543. </el-table-column>
  544. <el-table-column
  545. label="工具设置"
  546. min-width="110"
  547. show-overflow-tooltip
  548. >
  549. <template slot-scope="scope">
  550. <el-popover
  551. placement="bottom"
  552. width="840"
  553. trigger="hover"
  554. v-if="scope.row.url"
  555. >
  556. <div class="urlItemBox">
  557. <div
  558. class="urlItem"
  559. v-for="(item, index) in scope.row.url"
  560. :key="scope.row.id + '-' + index"
  561. >
  562. <span>{{ item.region }}</span>
  563. <div class="ui_message">
  564. <div>名称:{{ item.name ? item.name : "-" }}</div>
  565. <div>
  566. <span>链接:</span
  567. ><a
  568. :href="item.url"
  569. v-if="item.url"
  570. target="_blank"
  571. >{{ item.url }}</a
  572. ><span v-else>-</span>
  573. </div>
  574. <div>
  575. <span>桌面图标:</span>
  576. <div class="ui_m_image">
  577. <el-image
  578. v-if="item.icon"
  579. style="width: 100%; height: 100%"
  580. :src="item.icon"
  581. fit="cover"
  582. ></el-image>
  583. <span v-else>-</span>
  584. </div>
  585. </div>
  586. <div>
  587. <span>平台图标:</span>
  588. <div class="ui_m_image">
  589. <el-image
  590. v-if="item.platformIcon"
  591. style="width: 100%; height: 100%"
  592. :src="item.platformIcon"
  593. fit="cover"
  594. ></el-image>
  595. <span v-else>-</span>
  596. </div>
  597. </div>
  598. <div>
  599. <span>默认图标:</span>
  600. <div class="ui_m_image">
  601. <el-image
  602. v-if="item.defaultIcon"
  603. style="width: 100%; height: 100%"
  604. :src="item.defaultIcon"
  605. fit="cover"
  606. ></el-image>
  607. <span v-else>-</span>
  608. </div>
  609. </div>
  610. <div>
  611. <span>激活图标:</span>
  612. <div class="ui_m_image">
  613. <el-image
  614. v-if="item.activeIcon"
  615. style="width: 100%; height: 100%"
  616. :src="item.activeIcon"
  617. fit="cover"
  618. ></el-image>
  619. <span v-else>-</span>
  620. </div>
  621. </div>
  622. </div>
  623. </div>
  624. </div>
  625. <el-button slot="reference" size="small"
  626. >查看设置</el-button
  627. >
  628. </el-popover>
  629. <span v-else>-</span>
  630. </template>
  631. </el-table-column>
  632. <el-table-column
  633. label="仅管理员显示"
  634. min-width="80"
  635. show-overflow-tooltip
  636. >
  637. <template slot-scope="scope">
  638. <span v-if="scope.row.isAdmin">{{
  639. scope.row.isAdmin == "1" ? "是" : "否"
  640. }}</span>
  641. <span v-else>-</span>
  642. </template>
  643. </el-table-column>
  644. <el-table-column
  645. label="操作"
  646. width="270px"
  647. fixed="right"
  648. show-overflow-tooltip
  649. >
  650. <template slot-scope="scope">
  651. <button
  652. @click="addToolSidebar(scope.row.id)"
  653. v-if="scope.row.menuName"
  654. style="
  655. color: #308fff;
  656. background: none;
  657. border: none;
  658. cursor: pointer;
  659. margin-left: 25px;
  660. "
  661. >
  662. 添加工具
  663. </button>
  664. <button
  665. @click="moveUp(scope.row, scope.row.typeId)"
  666. style="
  667. color: #308fff;
  668. background: none;
  669. border: none;
  670. cursor: pointer;
  671. margin-left: 25px;
  672. "
  673. >
  674. 上移
  675. </button>
  676. <button
  677. @click="moveDown(scope.row, scope.row.typeId)"
  678. style="
  679. color: #308fff;
  680. background: none;
  681. border: none;
  682. cursor: pointer;
  683. margin-left: 25px;
  684. "
  685. >
  686. 下移
  687. </button>
  688. <button
  689. @click="del(scope.row, scope.row.typeId)"
  690. style="
  691. color: #ff2570;
  692. background: none;
  693. border: none;
  694. cursor: pointer;
  695. margin-left: 25px;
  696. "
  697. >
  698. 删除
  699. </button>
  700. </template>
  701. </el-table-column>
  702. </el-table>
  703. </div>
  704. </div>
  705. </div>
  706. </div>
  707. <!-- 按钮区域 -->
  708. <div slot="footer" class="el-dialog__footer">
  709. <el-button @click="close()">取 消</el-button>
  710. <el-button type="primary" @click="submit()">确认</el-button>
  711. </div>
  712. </el-dialog>
  713. <selectToolDialog ref="selectToolDialogRef" @success="selectToolSuccess" />
  714. <addMenuDialog ref="addMenuDialogRef" @success="addMenuSuccess" />
  715. </div>
  716. </template>
  717. <script>
  718. import "@/common/aws-sdk-2.235.1.min.js";
  719. import selectToolDialog from "./selectToolDialog.vue";
  720. import { API_CONFIG } from "@/common/apiConfig";
  721. import addMenuDialog from "./addMenuDialog.vue";
  722. export default {
  723. components: {
  724. selectToolDialog,
  725. addMenuDialog,
  726. },
  727. data() {
  728. return {
  729. show: false,
  730. loading: false,
  731. data: null,
  732. type: null,
  733. tagType: "basics",
  734. addToolIndex: null,
  735. toolList: [],
  736. form: {
  737. basics: {
  738. title: "",
  739. brief: "",
  740. logo: "",
  741. },
  742. //桌面 管理平台首页 管理平台侧边栏
  743. desktop: {
  744. list: [],
  745. },
  746. admin: {
  747. index: {
  748. list: [],
  749. },
  750. sidebar: {
  751. list: [],
  752. },
  753. },
  754. },
  755. };
  756. },
  757. methods: {
  758. open(data, type) {
  759. this.init();
  760. let _data = JSON.parse(JSON.stringify(data));
  761. if (_data.json) {
  762. this.form = JSON.parse(_data.json);
  763. }
  764. this.getToolData();
  765. this.data = _data;
  766. this.type = type;
  767. this.show = true;
  768. },
  769. close() {
  770. this.show = false;
  771. this.init();
  772. },
  773. init() {
  774. this.form = {
  775. basics: {
  776. title: "",
  777. brief: "",
  778. logo: "",
  779. },
  780. //桌面 管理平台首页 管理平台侧边栏
  781. desktop: {
  782. list: [],
  783. },
  784. admin: {
  785. index: {
  786. list: [],
  787. },
  788. sidebar: {
  789. list: [],
  790. },
  791. },
  792. };
  793. this.type = null;
  794. this.data = null;
  795. this.tagType = "basics";
  796. },
  797. submit() {
  798. // this.close();
  799. console.log(this.form);
  800. this.setJson();
  801. },
  802. async addBasicsIcon() {
  803. let _url = await this.uploadFile("image/*");
  804. if (_url) {
  805. this.form.basics.logo = _url;
  806. } else {
  807. return console.log("无图片");
  808. }
  809. },
  810. uploadFile(accept = "*") {
  811. return new Promise((resolve) => {
  812. const input = document.createElement("input");
  813. input.type = "file";
  814. input.accept = accept;
  815. input.onchange = (event) => {
  816. const file = event.target.files[0];
  817. if (file) {
  818. let credentials = {
  819. accessKeyId: "AKIATLPEDU37QV5CHLMH",
  820. secretAccessKey: "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",
  821. }; //秘钥形式的登录上传
  822. window.AWS.config.update(credentials);
  823. window.AWS.config.region = "cn-northwest-1"; //设置区域
  824. let bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
  825. // let _name = file.name;
  826. // let size = file.size;
  827. let params = {
  828. Key:
  829. file.name.split(".")[0] +
  830. new Date().getTime() +
  831. "." +
  832. file.name.split(".")[file.name.split(".").length - 1],
  833. ContentType: file.type,
  834. Body: file,
  835. "Access-Control-Allow-Credentials": "*",
  836. ACL: "public-read",
  837. }; //key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
  838. let options = {
  839. partSize: 2048 * 1024 * 1024,
  840. queueSize: 2,
  841. leavePartsOnError: true,
  842. };
  843. bucket
  844. .upload(params, options)
  845. .on("httpUploadProgress", (evt) => {
  846. console.log(evt);
  847. })
  848. .send((err, data) => {
  849. if (err) {
  850. this.$message.error("上传失败");
  851. return resolve("");
  852. } else {
  853. return resolve(data.Location);
  854. }
  855. });
  856. } else {
  857. resolve("");
  858. }
  859. };
  860. input.click();
  861. });
  862. },
  863. changeTagType(newType) {
  864. this.tagType = newType;
  865. },
  866. addTool(type) {
  867. let selectList = [];
  868. if (type == "desktop") selectList = this.form.desktop.list;
  869. if (type == "admin-index") selectList = this.form.admin.index.list;
  870. if (type == "admin-sidebar") selectList = this.form.admin.sidebar.list;
  871. this.$refs.selectToolDialogRef.open(
  872. selectList,
  873. type,
  874. ["admin-index", "admin-sidebar"].includes(type)
  875. ? this.form.desktop.list
  876. : []
  877. );
  878. },
  879. selectToolSuccess([_list, type]) {
  880. console.log(type, "===", _list);
  881. let list = _list;
  882. if (type == "desktop") {
  883. this.form.desktop.list = list;
  884. this.$refs.selectToolDialogRef.close();
  885. } else if (type == "admin-index") {
  886. this.form.admin.index.list = list;
  887. this.$refs.selectToolDialogRef.close();
  888. } else if (type == "admin-sidebar" || type == "admin-sidebar2") {
  889. if (this.addToolIndex != null) {
  890. let _index = this.form.admin.sidebar.list.findIndex(
  891. (i) => i.id == this.addToolIndex
  892. );
  893. if (_index == -1) return this.$message.error("未找到对应的菜单");
  894. list.forEach((i) => (i.typeId = this.addToolIndex + "," + i.id));
  895. this.form.admin.sidebar.list[_index].children.push(
  896. ...JSON.parse(JSON.stringify(list))
  897. );
  898. this.addToolIndex = null;
  899. } else {
  900. list.forEach((i) => (i.typeId = i.id));
  901. this.form.admin.sidebar.list.push(
  902. ...JSON.parse(JSON.stringify(list))
  903. );
  904. }
  905. this.$refs.selectToolDialogRef.close();
  906. }
  907. this.$forceUpdate();
  908. },
  909. // 表头的背景色
  910. headerCellStyle() {
  911. return { backgroundColor: "#f1f1f1" };
  912. },
  913. moveUp(row, typeId) {
  914. console.log(typeId);
  915. if (this.tagType == "desktop") {
  916. let _index = this.form.desktop.list.findIndex((i) => i.id == row.id);
  917. if (_index > 0) {
  918. const itemToMove = this.form.desktop.list.splice(_index, 1)[0];
  919. this.form.desktop.list.splice(_index - 1, 0, itemToMove);
  920. }
  921. } else if (this.tagType == "admin-index") {
  922. let _index = this.form.admin.index.list.findIndex(
  923. (i) => i.id == row.id
  924. );
  925. if (_index > 0) {
  926. const itemToMove = this.form.admin.index.list.splice(_index, 1)[0];
  927. this.form.admin.index.list.splice(_index - 1, 0, itemToMove);
  928. }
  929. } else if (this.tagType == "admin-sidebar") {
  930. let typeIdList = typeId.split(",");
  931. console.log(typeIdList);
  932. if (typeIdList.length == 1) {
  933. let _index = this.form.admin.sidebar.list.findIndex(
  934. (i) => i.typeId == typeIdList[0]
  935. );
  936. if (_index > 0) {
  937. const itemToMove = this.form.admin.sidebar.list.splice(
  938. _index,
  939. 1
  940. )[0];
  941. this.form.admin.sidebar.list.splice(_index - 1, 0, itemToMove);
  942. }
  943. } else if (typeIdList.length == 2) {
  944. let _index = this.form.admin.sidebar.list.findIndex(
  945. (i) => i.typeId == typeIdList[0]
  946. );
  947. let _index2 = this.form.admin.sidebar.list[_index].children.findIndex(
  948. (i) => i.id == typeIdList[1]
  949. );
  950. console.log(_index2);
  951. if (_index2 > 0) {
  952. const itemToMove = this.form.admin.sidebar.list[
  953. _index
  954. ].children.splice(_index2, 1)[0];
  955. this.form.admin.sidebar.list[_index].children.splice(
  956. _index2 - 1,
  957. 0,
  958. itemToMove
  959. );
  960. }
  961. }
  962. }
  963. },
  964. moveDown(row, typeId) {
  965. console.log(typeId);
  966. if (this.tagType == "desktop") {
  967. let _index = this.form.desktop.list.findIndex((i) => i.id == row.id);
  968. if (_index < this.form.desktop.list.length - 1) {
  969. const itemToMove = this.form.desktop.list.splice(_index, 1)[0];
  970. this.form.desktop.list.splice(_index + 1, 0, itemToMove);
  971. }
  972. } else if (this.tagType == "admin-index") {
  973. let _index = this.form.admin.index.list.findIndex(
  974. (i) => i.id == row.id
  975. );
  976. if (_index < this.form.admin.index.list.length - 1) {
  977. const itemToMove = this.form.admin.index.list.splice(_index, 1)[0];
  978. this.form.admin.index.list.splice(_index + 1, 0, itemToMove);
  979. }
  980. } else if (this.tagType == "admin-sidebar") {
  981. let typeIdList = typeId.split(",");
  982. if (typeIdList.length == 1) {
  983. let _index = this.form.admin.sidebar.list.findIndex(
  984. (i) => i.typeId == typeIdList[0]
  985. );
  986. if (_index < this.form.admin.sidebar.list.length - 1) {
  987. const itemToMove = this.form.admin.sidebar.list.splice(
  988. _index,
  989. 1
  990. )[0];
  991. this.form.admin.sidebar.list.splice(_index + 1, 0, itemToMove);
  992. }
  993. } else if (typeIdList.length == 2) {
  994. let _index = this.form.admin.sidebar.list.findIndex(
  995. (i) => i.typeId == typeIdList[0]
  996. );
  997. let _index2 = this.form.admin.sidebar.list[_index].children.findIndex(
  998. (i) => i.id == typeIdList[1]
  999. );
  1000. if (
  1001. _index2 <
  1002. this.form.admin.sidebar.list[_index].children.length - 1
  1003. ) {
  1004. const itemToMove = this.form.admin.sidebar.list[
  1005. _index
  1006. ].children.splice(_index2, 1)[0];
  1007. this.form.admin.sidebar.list[_index].children.splice(
  1008. _index2 + 1,
  1009. 0,
  1010. itemToMove
  1011. );
  1012. }
  1013. }
  1014. }
  1015. },
  1016. del(row, typeId) {
  1017. if (this.tagType == "desktop") {
  1018. const index = this.form.desktop.list.findIndex((i) => i.id === row.id);
  1019. if (index > -1) {
  1020. this.form.desktop.list.splice(index, 1);
  1021. }
  1022. } else if (this.tagType == "admin-index") {
  1023. const index = this.form.admin.index.list.findIndex(
  1024. (i) => i.id === row.id
  1025. );
  1026. if (index > -1) {
  1027. this.form.admin.index.list.splice(index, 1);
  1028. }
  1029. } else if (this.tagType == "admin-sidebar") {
  1030. let typeIdList = typeId.split(",");
  1031. if (typeIdList.length == 1) {
  1032. let _index = this.form.admin.sidebar.list.findIndex(
  1033. (i) => i.typeId == typeIdList[0]
  1034. );
  1035. this.form.admin.sidebar.list.splice(_index, 1);
  1036. } else if (typeIdList.length == 2) {
  1037. let _index = this.form.admin.sidebar.list.findIndex(
  1038. (i) => i.typeId == typeIdList[0]
  1039. );
  1040. let _index2 = this.form.admin.sidebar.list[_index].children.findIndex(
  1041. (i) => i.typeId == typeIdList[1]
  1042. );
  1043. this.form.admin.sidebar.list[_index].children.splice(_index2, 1);
  1044. }
  1045. // this.form.admin.sidebar.list.splice(_index, 1);
  1046. }
  1047. },
  1048. getToolData() {
  1049. let params = [
  1050. {
  1051. functionName: "select_desktopToolByPage",
  1052. status: "",
  1053. page: 1,
  1054. lim: 9999999,
  1055. },
  1056. ];
  1057. this.loading = true;
  1058. this.$ajax
  1059. .post(API_CONFIG.baseUrl, params)
  1060. .then((res) => {
  1061. let _data = res.data;
  1062. let _list = _data[0];
  1063. _list.forEach((i) => {
  1064. i.url = JSON.parse(i.url);
  1065. i.json = JSON.parse(i.json);
  1066. i.argumentList = JSON.parse(i.argumentList);
  1067. });
  1068. this.toolList = _list;
  1069. this.setDataListToo(_list);
  1070. this.loading = false;
  1071. })
  1072. .catch((err) => {
  1073. console.log(err);
  1074. this.loading = false;
  1075. this.$message.error("获取工具数据失败");
  1076. this.close();
  1077. });
  1078. },
  1079. setJson() {
  1080. let _form = JSON.parse(JSON.stringify(this.form));
  1081. _form.desktop.list = _form.desktop.list.map((i) => i.id);
  1082. _form.admin.index.list = _form.admin.index.list.map((i) => i.id);
  1083. _form.admin.sidebar.list.forEach((i, index) => {
  1084. if (i.children) {
  1085. _form.admin.sidebar.list[index].children = i.children.map(
  1086. (i) => i.id
  1087. );
  1088. } else {
  1089. _form.admin.sidebar.list[index] = i.id;
  1090. }
  1091. });
  1092. let params = [
  1093. {
  1094. functionName: "update_orgOroid_json_byId",
  1095. id: this.data.id,
  1096. ujson: JSON.stringify(_form),
  1097. type: this.type,
  1098. },
  1099. ];
  1100. this.loading = true;
  1101. this.$ajax
  1102. .post(API_CONFIG.baseUrl, params)
  1103. .then((res) => {
  1104. let _data = res.data;
  1105. if (_data == 1) {
  1106. this.$message.success("修改权限成功");
  1107. this.$emit("getData");
  1108. this.close();
  1109. } else {
  1110. this.$message.error("修改权限失败");
  1111. }
  1112. this.loading = false;
  1113. })
  1114. .catch((err) => {
  1115. console.log(err);
  1116. this.loading = false;
  1117. this.$message.error("修改权限失败");
  1118. });
  1119. },
  1120. setDataListToo(toolList = []) {
  1121. let _form = JSON.parse(JSON.stringify(this.form));
  1122. _form.desktop.list.forEach((i, index) => {
  1123. let _index = toolList.findIndex((i2) => i == i2.id);
  1124. if (_index != -1) {
  1125. _form.desktop.list[index] = toolList[_index];
  1126. } else {
  1127. console.log("无工具", i);
  1128. }
  1129. });
  1130. _form.admin.index.list.forEach((i, index) => {
  1131. let _index = toolList.findIndex((i2) => i == i2.id);
  1132. if (_index != -1) {
  1133. _form.admin.index.list[index] = toolList[_index];
  1134. } else {
  1135. console.log("无工具", i);
  1136. }
  1137. });
  1138. _form.admin.sidebar.list.forEach((i, index) => {
  1139. if (i.children) {
  1140. i.children.forEach((i2, index2) => {
  1141. let _toolList = JSON.parse(JSON.stringify(toolList))
  1142. let _index = _toolList.findIndex((i3) => i2 == i3.id);
  1143. if (_index != -1) {
  1144. _form.admin.sidebar.list[index].children[index2] = _toolList[_index];
  1145. _form.admin.sidebar.list[index].children[index2].typeId = _form.admin.sidebar.list[index].typeId + "," +_toolList[_index].id;
  1146. } else {
  1147. console.log("无工具", i);
  1148. }
  1149. });
  1150. } else {
  1151. let _toolList = JSON.parse(JSON.stringify(toolList))
  1152. let _index = _toolList.findIndex((i2) => i == i2.id);
  1153. if (_index != -1) {
  1154. _form.admin.sidebar.list[index] = _toolList[_index];
  1155. _form.admin.sidebar.list[index].typeId =
  1156. _form.admin.sidebar.list[index].id;
  1157. } else {
  1158. console.log("无工具", i);
  1159. }
  1160. }
  1161. });
  1162. this.form = _form;
  1163. this.$forceUpdate();
  1164. },
  1165. addToolSidebar(id) {
  1166. this.addToolIndex = id;
  1167. let index = this.form.admin.sidebar.list.findIndex((i) => i.id == id);
  1168. if (index == -1) return this.$message.error("未找到对应菜单");
  1169. let selectList = [];
  1170. selectList = this.form.admin.sidebar.list[index].children;
  1171. this.$refs.selectToolDialogRef.open(
  1172. selectList,
  1173. "admin-sidebar",
  1174. this.form.desktop.list
  1175. );
  1176. },
  1177. addMenuSuccess(item) {
  1178. this.form.admin.sidebar.list.push(item);
  1179. item.id = String(new Date().getTime());
  1180. item.typeId = item.id;
  1181. this.$refs.addMenuDialogRef.close();
  1182. },
  1183. addMenu() {
  1184. this.$refs.addMenuDialogRef.open();
  1185. },
  1186. },
  1187. };
  1188. </script>
  1189. <style scoped>
  1190. .permissionSettingDialog >>> .el-dialog__header {
  1191. padding: 15px 20px;
  1192. background: #454545;
  1193. }
  1194. .permissionSettingDialog >>> .el-dialog__title {
  1195. color: #fff;
  1196. }
  1197. .el-dialog__footer {
  1198. padding: 10px 0 0 10px;
  1199. }
  1200. .ps_area {
  1201. width: 100%;
  1202. height: 800px;
  1203. }
  1204. .pa_a_head {
  1205. width: 100%;
  1206. height: 40px;
  1207. display: flex;
  1208. align-items: center;
  1209. box-sizing: border-box;
  1210. overflow: auto;
  1211. border-bottom: 1px solid #e4e7ed;
  1212. }
  1213. .pa_a_head > span {
  1214. font-size: 16px;
  1215. display: block;
  1216. width: auto;
  1217. height: 100%;
  1218. padding: 0 20px;
  1219. display: flex;
  1220. justify-content: center;
  1221. align-items: center;
  1222. margin-right: 10px;
  1223. cursor: pointer;
  1224. transition: 0.2s;
  1225. white-space: nowrap;
  1226. }
  1227. .pa_a_h_active {
  1228. color: #409eff;
  1229. }
  1230. .pa_a_editBox {
  1231. width: 100%;
  1232. height: 100%;
  1233. overflow: auto;
  1234. }
  1235. .editArea {
  1236. width: 100%;
  1237. height: auto;
  1238. box-sizing: border-box;
  1239. }
  1240. .ea_basics_input {
  1241. width: 100%;
  1242. height: auto;
  1243. margin-top: 20px;
  1244. display: flex;
  1245. align-items: center;
  1246. }
  1247. .ea_basics_input > span {
  1248. display: block;
  1249. width: 60px;
  1250. height: auto;
  1251. }
  1252. .ea_basics_logo {
  1253. margin-top: 30px;
  1254. width: 110px;
  1255. height: 50px;
  1256. cursor: pointer;
  1257. display: flex;
  1258. align-items: center;
  1259. }
  1260. .ea_basics_logo > span {
  1261. display: block;
  1262. min-width: 60px;
  1263. }
  1264. .ea_basics_logo >>> .image-slot {
  1265. width: 100%;
  1266. height: 100%;
  1267. font-size: 22px;
  1268. display: flex;
  1269. justify-content: center;
  1270. align-items: center;
  1271. }
  1272. .ea_item {
  1273. width: 83px;
  1274. height: 83px;
  1275. margin: 10px;
  1276. display: flex;
  1277. align-items: center;
  1278. justify-content: center;
  1279. }
  1280. .pa_a_eb_desktop {
  1281. display: flex;
  1282. flex-direction: column;
  1283. padding: 0;
  1284. }
  1285. .ea_add {
  1286. width: 100%;
  1287. display: flex;
  1288. align-items: center;
  1289. justify-content: flex-end;
  1290. }
  1291. .urlItemBox {
  1292. display: flex;
  1293. flex-wrap: wrap;
  1294. }
  1295. .urlItem {
  1296. width: 400px;
  1297. height: 250px;
  1298. overflow: auto;
  1299. position: relative;
  1300. box-sizing: border-box;
  1301. border-bottom: solid 1px #ebeef5;
  1302. }
  1303. .urlItem:nth-child(2n) {
  1304. margin-left: 20px;
  1305. }
  1306. .urlItem > span {
  1307. font-size: 18px;
  1308. font-weight: bold;
  1309. }
  1310. .ui_m_image {
  1311. width: 40px;
  1312. height: 40px;
  1313. float: left;
  1314. display: flex;
  1315. align-items: center;
  1316. }
  1317. .ui_message > div {
  1318. display: flex;
  1319. align-items: center;
  1320. }
  1321. .ui_message > div > span {
  1322. white-space: nowrap;
  1323. }
  1324. </style>