SpaceView.vue 18 KB

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