PartspaceView.vue 17 KB

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