Groupspace.vue 19 KB

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