SpaceView.vue 17 KB

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