Groupspace.vue 19 KB

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