GroupSpace.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. <template>
  2. <div class="containe">
  3. <div class="header">
  4. <span>个人设置</span>
  5. <img src="../../../assets/img/chevron-down.png" alt="" />
  6. <img src="../../../assets/img/slash.png" alt="" />
  7. <span class="top1">个人存储空间</span>
  8. <img src="../../../assets/img/chevron-down.png" alt="" />
  9. <img src="../../../assets/img/slash.png" alt="" />
  10. <span class="top1">分组空间</span>
  11. <img src="../../../assets/img/chevron-up.png" alt="" class="top2" />
  12. <img src="../../../assets/img/slash.png" alt="" />
  13. </div>
  14. <div class="title">分组空间</div>
  15. <div class="main">
  16. <h3>目录列表</h3>
  17. <div class="main-main">
  18. <div class="app-container">
  19. <el-row :gutter="10" class="mb8">
  20. <el-col :span="1.5">
  21. <el-button
  22. type="primary"
  23. plain
  24. icon="el-icon-plus"
  25. size="mini"
  26. @click="handleAdd"
  27. v-hasPermi="['doc:dir:add']"
  28. v-hasRole="['group.manager']"
  29. >新增</el-button
  30. >
  31. </el-col>
  32. <el-col :span="1.5">
  33. <el-button
  34. type="info"
  35. plain
  36. icon="el-icon-sort"
  37. size="mini"
  38. @click="toggleExpandAll"
  39. >展开/折叠</el-button
  40. >
  41. </el-col>
  42. <right-toolbar
  43. :showSearch.sync="showSearch"
  44. @queryTable="getList"
  45. ></right-toolbar>
  46. </el-row>
  47. <el-table
  48. v-if="refreshTable"
  49. v-loading="loading"
  50. :data="dirList"
  51. row-key="dirId"
  52. :default-expand-all="isExpandAll"
  53. :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
  54. >
  55. <el-table-column label="目录名称" align="left" prop="dirName" />
  56. <el-table-column
  57. label="操作"
  58. align="center"
  59. class-name="small-padding fixed-width"
  60. >
  61. <template slot-scope="scope">
  62. <el-button
  63. size="mini"
  64. type="text"
  65. icon="el-icon-plus"
  66. @click="handleAdd(scope.row)"
  67. v-hasPermi="['doc:dir:add']"
  68. v-hasRole="['group.manager']"
  69. >新增</el-button
  70. >
  71. <el-button
  72. v-if="scope.row.parentId != 0"
  73. size="mini"
  74. type="text"
  75. icon="el-icon-edit"
  76. @click="handleUpdate(scope.row)"
  77. v-hasPermi="['doc:dir:edit']"
  78. v-hasRole="['group.manager']"
  79. >修改</el-button
  80. >
  81. <el-button
  82. v-if="scope.row.parentId != 0"
  83. size="mini"
  84. type="text"
  85. icon="el-icon-delete"
  86. @click="handleDelete(scope.row)"
  87. v-hasPermi="['doc:dir:remove']"
  88. v-hasRole="['group.manager']"
  89. >删除</el-button
  90. >
  91. </template>
  92. </el-table-column>
  93. </el-table>
  94. </div>
  95. </div>
  96. </div>
  97. <div class="footer">
  98. <el-row :gutter="10" class="mb8">
  99. <el-col :span="1.5" class="mb8-col">
  100. 分组空间:
  101. <el-progress
  102. :text-inside="true"
  103. :stroke-width="15"
  104. :percentage="percentage"
  105. >
  106. </el-progress>
  107. {{ spaceData.avlCap }} G可用 (共{{ spaceData.spaceCap }}G)
  108. <el-button
  109. type="primary"
  110. plain
  111. size="mini"
  112. @click="handleExpand"
  113. class="capacity"
  114. >扩容</el-button
  115. >
  116. </el-col>
  117. </el-row>
  118. <!-- 添加或修改目录信息对话框 -->
  119. <el-dialog
  120. :title="title"
  121. :visible.sync="open"
  122. width="500px"
  123. append-to-body
  124. >
  125. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  126. <el-form-item label="上级目录" prop="parentId">
  127. <treeselect
  128. v-model="form.parentId"
  129. :options="dirOptions"
  130. :normalizer="normalizer"
  131. placeholder="请选择上级目录"
  132. />
  133. </el-form-item>
  134. <el-form-item label="目录名称" prop="dirName">
  135. <el-input v-model="form.dirName" placeholder="请输入目录名称" />
  136. </el-form-item>
  137. <el-form-item label="备注" prop="remark">
  138. <el-input
  139. v-model="form.remark"
  140. type="textarea"
  141. placeholder="请输入内容"
  142. />
  143. </el-form-item>
  144. </el-form>
  145. <div slot="footer" class="dialog-footer">
  146. <el-button type="primary" @click="submitForm">确 定</el-button>
  147. <el-button @click="cancel">取 消</el-button>
  148. </div>
  149. </el-dialog>
  150. <!-- 扩容申请对话框 -->
  151. <el-dialog
  152. :title="title"
  153. :visible.sync="openSpace"
  154. width="500px"
  155. append-to-body
  156. v-if="flag"
  157. >
  158. <el-form
  159. ref="formSpace"
  160. :model="formSpace"
  161. :rules="rulesSpace"
  162. label-width="80px"
  163. >
  164. <el-form-item label="扩充容量" prop="expandCap">
  165. <el-input-number
  166. v-model="formSpace.expandCap"
  167. placeholder="扩充容量"
  168. ></el-input-number
  169. ><label>GB</label>
  170. </el-form-item>
  171. <el-form-item label="申请理由" prop="remark">
  172. <el-input
  173. v-model="formSpace.remark"
  174. type="textarea"
  175. rows="5"
  176. placeholder="请输入申请理由"
  177. />
  178. </el-form-item>
  179. </el-form>
  180. <div slot="footer" class="dialog-footer">
  181. <el-button type="primary" @click="submitFormSpace">确 定</el-button>
  182. <el-button @click="cancelSpace">取 消</el-button>
  183. </div>
  184. </el-dialog>
  185. </div>
  186. </div>
  187. </template>
  188. <script>
  189. import "@/styles1/element-ui1.scss";
  190. import {
  191. listDir,
  192. getDir,
  193. delDir,
  194. addDir,
  195. updateDir,
  196. groupList,
  197. } from "@/api/doc/dir";
  198. import { getGroupSpace } from "@/api/doc/space";
  199. import {
  200. listExpand,
  201. getExpand,
  202. delExpand,
  203. addExpand,
  204. updateExpand,
  205. } from "@/api/doc/expand";
  206. import Treeselect from "@riophae/vue-treeselect";
  207. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  208. export default {
  209. name: "GroupSpace",
  210. components: {
  211. Treeselect,
  212. },
  213. data() {
  214. return {
  215. //判断是否弹出扩容界面
  216. flag:true,
  217. // 遮罩层
  218. loading: true,
  219. // 显示搜索条件
  220. showSearch: true,
  221. // 目录信息表格数据
  222. dirList: [],
  223. // 目录信息树选项
  224. dirOptions: [],
  225. // 弹出层标题
  226. title: "",
  227. // 是否显示弹出层
  228. open: false,
  229. openSpace: false,
  230. // 是否展开,默认全部展开
  231. isExpandAll: true,
  232. // 重新渲染表格状态
  233. refreshTable: true,
  234. // 查询参数
  235. queryParams: {
  236. parentId: null,
  237. dirName: null,
  238. },
  239. //个人空间数据
  240. spaceData: {},
  241. // 表单参数
  242. form: {},
  243. formSpace: {},
  244. // 表单校验
  245. rules: {
  246. dirName: [
  247. {
  248. required: true,
  249. message: "目录名称不能为空",
  250. trigger: "blur",
  251. },
  252. ],
  253. parentId: [
  254. {
  255. required: true,
  256. message: "上级目录不能为空",
  257. trigger: "blur",
  258. },
  259. ],
  260. },
  261. // 表单校验
  262. rulesSpace: {
  263. expandCap: [
  264. {
  265. required: true,
  266. message: "扩容容量不能为空",
  267. trigger: "blur",
  268. },
  269. ],
  270. remark: [
  271. {
  272. required: true,
  273. message: "申请理由不能为空",
  274. trigger: "blur",
  275. },
  276. ],
  277. },
  278. percentage:1
  279. };
  280. },
  281. created() {
  282. const groupId = this.$route.params && this.$route.params.groupId;
  283. if (groupId) {
  284. this.queryParams.groupId = groupId;
  285. this.getList();
  286. }
  287. this.spaceInfo();
  288. },
  289. methods: {
  290. /** 查询个人空间相关信息 */
  291. spaceInfo() {
  292. this.loading = true;
  293. getGroupSpace(this.queryParams.groupId).then((response) => {
  294. this.spaceData = response.data;
  295. this.loading = false;
  296. });
  297. console.log(this.spaceData.spaceCap);
  298. // return this.percentage =(this.spaceData.usedCap/this.spaceData.spaceCap)*100;
  299. },
  300. /** 查询目录信息列表 */
  301. getList() {
  302. this.loading = true;
  303. groupList(this.queryParams.groupId).then((response) => {
  304. this.dirList = this.handleTree(response.data, "dirId");
  305. this.loading = false;
  306. });
  307. },
  308. /** 转换目录信息数据结构 */
  309. normalizer(node) {
  310. if (node.children && !node.children.length) {
  311. delete node.children;
  312. }
  313. return {
  314. id: node.dirId,
  315. label: node.dirName,
  316. children: node.children,
  317. };
  318. },
  319. // 取消按钮
  320. cancel() {
  321. this.open = false;
  322. this.reset();
  323. },
  324. // 取消按钮
  325. cancelSpace() {
  326. this.openSpace = false;
  327. this.reset();
  328. },
  329. // 表单重置
  330. reset() {
  331. this.form = {
  332. dirId: null,
  333. spaceId: null,
  334. parentId: null,
  335. dirName: null,
  336. dirPath: null,
  337. createBy: null,
  338. createTime: null,
  339. updateBy: null,
  340. updateTime: null,
  341. remark: null,
  342. isDel: null,
  343. };
  344. this.resetForm("form");
  345. },
  346. /** 搜索按钮操作 */
  347. handleQuery() {
  348. this.getList();
  349. },
  350. /** 重置按钮操作 */
  351. resetQuery() {
  352. this.resetForm("queryForm");
  353. this.handleQuery();
  354. },
  355. /** 新增按钮操作 */
  356. handleAdd(row) {
  357. this.reset();
  358. // this.getTreeselect();
  359. if (row != null && row.dirId) {
  360. this.form.parentId = row.dirId;
  361. // } else {
  362. // this.form.parentId = 0;
  363. }
  364. this.open = true;
  365. this.title = "添加目录信息";
  366. groupList(this.queryParams.groupId).then((response) => {
  367. this.form.spaceId = response.data[0].spaceId;
  368. this.dirOptions = this.handleTree(response.data, "dirId");
  369. });
  370. },
  371. /** 扩容申请 */
  372. handleExpand(row) {
  373. // if(this.spaceData.isApply=="1"){
  374. // this.$modal.alertWarning("扩容申请已经存在了")
  375. // this.flag=false
  376. // }
  377. // if(this.spaceData.isApply=="0"){
  378. // this.flag=true
  379. // }
  380. this.formSpace.currentCap = this.spaceData.spaceCap;
  381. this.formSpace.spaceId = this.spaceData.spaceId;
  382. this.formSpace.spaceName = this.spaceData.spaceName;
  383. this.reset();
  384. // this.getTreeselect();
  385. if (row != null && row.dirId) {
  386. this.form.parentId = row.dirId;
  387. // } else {
  388. // this.form.parentId = 0;
  389. }
  390. this.openSpace = true;
  391. this.title = "扩容申请";
  392. groupList(this.queryParams.groupId).then((response) => {
  393. this.form.spaceId = response.data[0].spaceId;
  394. this.dirOptions = this.handleTree(response.data, "dirId");
  395. });
  396. },
  397. /** 展开/折叠操作 */
  398. toggleExpandAll() {
  399. this.refreshTable = false;
  400. this.isExpandAll = !this.isExpandAll;
  401. this.$nextTick(() => {
  402. this.refreshTable = true;
  403. });
  404. },
  405. /** 修改按钮操作 */
  406. handleUpdate(row) {
  407. this.reset();
  408. if (row != null) {
  409. this.form.parentId = row.dirId;
  410. }
  411. getDir(row.dirId).then((response) => {
  412. this.form = response.data;
  413. this.open = true;
  414. this.title = "修改目录信息";
  415. });
  416. personalList().then((response) => {
  417. this.dirOptions = this.handleTree(response.data, "dirId");
  418. });
  419. },
  420. /** 提交按钮 */
  421. submitForm() {
  422. this.$refs["form"].validate((valid) => {
  423. if (valid) {
  424. if (this.form.dirId != null) {
  425. updateDir(this.form).then((response) => {
  426. this.$modal.msgSuccess("修改成功");
  427. this.open = false;
  428. this.getList();
  429. });
  430. } else {
  431. addDir(this.form).then((response) => {
  432. this.$modal.msgSuccess("新增成功");
  433. this.open = false;
  434. this.getList();
  435. });
  436. }
  437. }
  438. });
  439. },
  440. /** 提交按钮 */
  441. submitFormSpace() {
  442. // console.log(this.formSpace);
  443. this.$refs["formSpace"].validate((valid) => {
  444. if (valid) {
  445. addExpand(this.formSpace).then((response) => {
  446. this.$modal.msgSuccess("扩容申请提交成功");
  447. this.openSpace = false;
  448. });
  449. }
  450. });
  451. },
  452. /** 删除按钮操作 */
  453. handleDelete(row) {
  454. this.$modal
  455. .confirm('是否确认删除目录信息编号为"' + row.dirId + '"的数据项?')
  456. .then(function () {
  457. return delDir(row.dirId);
  458. })
  459. .then(() => {
  460. this.getList();
  461. this.$modal.msgSuccess("删除成功");
  462. })
  463. .catch(() => {});
  464. },
  465. },
  466. };
  467. </script>
  468. <style scoped lang='scss'>
  469. .containe {
  470. color: #7ea4c8;
  471. font-size: 0.14rem;
  472. font-family: PingFang SC-Medium, PingFang SC;
  473. font-weight: 500;
  474. padding-left: calc(100vw * (20 / 1920));
  475. //顶部信息
  476. .header {
  477. height: calc(100vh * (22 / 1080));
  478. margin-top: calc(100vh * (20 / 1080));
  479. margin-bottom: calc(100vh * (20 / 1080));
  480. display: flex;
  481. align-items: center;
  482. img {
  483. width: calc(100vw * (16 / 1920));
  484. height: calc(100vh * (16 / 1080));
  485. border: 1px dashed grey;
  486. margin-left: 3px;
  487. margin-right: 3px;
  488. }
  489. .top1 {
  490. color: #2e8aecff;
  491. }
  492. }
  493. //中间目录列表
  494. .title {
  495. height: calc(100vh * (22 / 1080));
  496. margin-top: calc(100vh * (20 / 1080));
  497. margin-bottom: calc(100vh * (20 / 1080));
  498. color: #ffffffff;
  499. font-size: 0.16rem;
  500. font-weight: bold;
  501. line-height: calc(100vh * (22 / 1080));
  502. }
  503. .main {
  504. width: calc(100vw * (1876 / 1920));
  505. height: calc(100vh * (774 / 1080));
  506. background: url(../../../assets/img/Group-610.png);
  507. background-size: calc(100vw * (1876 / 1920)) calc(100vh * (774 / 1080));
  508. h3 {
  509. font-size: 0.2rem;
  510. color: #ffffffff;
  511. padding-top: calc(100vh * (21 / 1080));
  512. padding-left: calc(100vw * (30 / 1920));
  513. }
  514. .main-main {
  515. width: calc(100vw * (1845 / 1920));
  516. height: calc(100vh * (700 / 1080));
  517. margin-left: calc(100vw * (16 / 1920));
  518. margin-top: calc(100vh * (20 / 1080));
  519. // background: seagreen;
  520. .app-container {
  521. width: calc(100vw * (1845 / 1920));
  522. height: calc(100vh * (700 / 1080));
  523. padding: 0;
  524. }
  525. .el-table {
  526. width: calc(100vw * (1830 / 1920));
  527. height: calc(100vh * (646 / 1080));
  528. margin-left: calc(100vw * (8 / 1920));
  529. border: 1px solid #006c9aff;
  530. overflow: auto;
  531. background: transparent;
  532. color: #7ea4c8;
  533. }
  534. }
  535. //滚动条样式
  536. ::-webkit-scrollbar {
  537. width: 3.5px;
  538. }
  539. ::-webkit-scrollbar-track {
  540. background-color: rgba(0, 0, 0, 0);
  541. }
  542. ::-webkit-scrollbar-thumb {
  543. background: #2e8aec;
  544. border-radius: 3px;
  545. }
  546. ::-webkit-scrollbar-thumb:hover {
  547. background: #2e8aec;
  548. }
  549. }
  550. //底部
  551. .footer {
  552. width: calc(100vw * (1876 / 1920));
  553. height: calc(100vh * (92 / 1080));
  554. margin-top: calc(100vh * (20 / 1080));
  555. background: url(../../../assets/img/Group-611.png);
  556. background-size: calc(100vw * (1876 / 1920)) calc(100vh * (92 / 1080));
  557. display: flex;
  558. align-items: center;
  559. padding-left: calc(100vw * (34 / 1920));
  560. color: #ffffffff;
  561. font-size: 0.16rem;
  562. .el-progress {
  563. width: calc(100vw * (270 / 1920));
  564. margin-right: calc(100vw * (10 / 1920));
  565. }
  566. .mb8-col{
  567. width: calc(100vw * (1800 / 1920));
  568. display: flex;
  569. align-items: center;
  570. height: calc(100vh * (60 / 1080));
  571. margin-top: calc(100vh * (15 / 1080));
  572. }
  573. .capacity{
  574. background: #2E8AECFF;
  575. color: white;
  576. margin-left: calc(100vw * (10 / 1920));
  577. text-align: center;
  578. }
  579. }
  580. }
  581. //表格样式
  582. ::v-deep .el-table th {
  583. background: linear-gradient(
  584. 90deg,
  585. rgba(19, 37, 93, 0) 0%,
  586. rgba(1, 108, 154, 0.65) 52%,
  587. rgba(19, 37, 93, 0) 100%,
  588. rgba(19, 37, 93, 0) 100%
  589. );
  590. color: #2e8aec;
  591. }
  592. ::v-deep .el-table tr {
  593. background: transparent;
  594. }
  595. ::v-deep .el-table tbody tr:hover > td {
  596. background-color: #016c9a78 !important;
  597. }
  598. ::v-deep .el-table td.el-table__cell {
  599. border-bottom: 1px solid #006c9aff;
  600. }
  601. ::v-deep .el-table th.el-table__cell.is-leaf {
  602. border-bottom: 1px solid #006c9aff;
  603. }
  604. ::v-deep .el-button--primary.is-plain {
  605. background-color: #002a5cff;
  606. border: none;
  607. }
  608. ::v-deep .el-button--info.is-plain {
  609. background-color: #002a5cff;
  610. border: none;
  611. color: #1890ff;
  612. }
  613. ::v-deep .el-table::before {
  614. width: 0;
  615. }
  616. //搜索刷新按钮颜色
  617. ::v-deep .el-button.is-circle {
  618. background: #006c9aff;
  619. color: white;
  620. }
  621. // //进度条样式
  622. ::v-deep .el-progress-bar__outer{
  623. background: transparent !important;
  624. border: 1px solid #2E8AECFF;
  625. border-radius: 0;
  626. }
  627. ::v-deep .el-progress-bar__inner{
  628. border-radius: 0;
  629. }
  630. ::v-deep .el-progress-bar__innerText{
  631. font-size: 0;
  632. }
  633. ::v-deep .el-dialog__body{
  634. padding-bottom: 0;
  635. }
  636. ::v-deep .el-dialog__title{
  637. color: white;
  638. }
  639. ::v-deep .el-form-item__label{
  640. color: #2E8AECFF;
  641. }
  642. ::v-deep .el-textarea__inner{
  643. background: transparent;
  644. }
  645. ::v-deep .el-input--medium .el-input__inner{
  646. background: transparent;
  647. }
  648. ::v-deep .el-input-number--medium .el-input-number__decrease {
  649. background: transparent;
  650. }
  651. ::v-deep .el-input-number--medium .el-input-number__increase {
  652. background: transparent;
  653. }
  654. ::v-deep label {
  655. color: white;
  656. margin-left: 10px;
  657. }
  658. //弹窗样式
  659. ::v-deep .vue-treeselect__menu {
  660. // background: salmon !important;
  661. // color: red !important;
  662. // display: block;
  663. }
  664. </style>