IndividualView.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  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="main">
  12. <div class="app-container">
  13. <el-row :gutter="20">
  14. <!--目录数据-->
  15. <el-col :span="4" :xs="24" class="main-left">
  16. <div class="head-top">个人文档</div>
  17. <div class="head-container">
  18. <el-tree :data="dirList" :props="defaultProps" :expand-on-click-node="false" ref="tree" node-key="id"
  19. default-expand-all highlight-current @node-click="handleNodeClick" />
  20. </div>
  21. </el-col>
  22. <!--文件数据-->
  23. <el-col :span="20" :xs="24" class="main-right">
  24. <p>个人文档</p>
  25. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
  26. label-width="68px" class="main-right-top">
  27. <el-form-item label="文件名称" prop="docName">
  28. <el-input v-model="queryParams.docName" placeholder="请输入文件名称" clearable
  29. @keyup.enter.native="handleQuery" />
  30. </el-form-item>
  31. <el-form-item label="文件级别" prop="docLevel">
  32. <el-select v-model="queryParams.docLevel" placeholder="请选择文件级别" @change="handleQuery">
  33. <el-option v-for="item in levelOptions" :key="item.levelId" :label="item.levelName"
  34. :value="item.levelId"></el-option>
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item label="文件年份" prop="createYear">
  38. <el-input v-model="queryParams.createYear" placeholder="请输入文件创建年份" clearable
  39. @keyup.enter.native="handleQuery" />
  40. </el-form-item>
  41. <el-form-item label="标签" prop="params">
  42. <el-select v-model="queryParams.params.tagId" placeholder="请输入标签名称" @change="handleQuery"
  43. style="width: 180px">
  44. <el-option v-for="item in tags" :key="item.tagId" :label="item.tagName" :value="item.tagId" />
  45. </el-select>
  46. </el-form-item>
  47. <el-form-item>
  48. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  49. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" class="reset1">重置</el-button>
  50. </el-form-item>
  51. </el-form>
  52. <el-row :gutter="10" class="mb8">
  53. <el-col :span="1.5">
  54. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
  55. v-hasPermi="['doc:info:add']">上传</el-button>
  56. </el-col>
  57. <!-- <el-col :span="1.5">
  58. <el-button
  59. type="success"
  60. plain
  61. icon="el-icon-edit"
  62. size="mini"
  63. :disabled="single"
  64. @click="handleUpdate"
  65. v-hasPermi="['doc:info:edit']"
  66. >修改</el-button
  67. >
  68. </el-col>
  69. <el-col :span="1.5">
  70. <el-button
  71. type="danger"
  72. plain
  73. icon="el-icon-delete"
  74. size="mini"
  75. :disabled="multiple"
  76. @click="handleDelete"
  77. v-hasPermi="['doc:info:remove']"
  78. >删除</el-button
  79. >
  80. </el-col>
  81. <el-col :span="1.5">
  82. <el-button
  83. type="warning"
  84. plain
  85. icon="el-icon-download"
  86. size="mini"
  87. @click="handleExport"
  88. v-hasPermi="['doc:info:export']"
  89. >导出</el-button
  90. >
  91. </el-col> -->
  92. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  93. </el-row>
  94. <el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange"
  95. class="main-right-table" height="calc(100vh * (630 / 1080))" align="left"
  96. :header-cell-style="{ 'text-align': 'center' }">
  97. <el-table-column type="selection" width="55" align="center" />
  98. <el-table-column label="文件名称" align="left" prop="docName" />
  99. <el-table-column label="文件大小" align="center" prop="docSize" :formatter="fileSizeData" width="100" />
  100. <el-table-column label="修改时间" align="center" prop="updateTime" />
  101. <el-table-column label="文件级别" align="center" prop="docLevel" :formatter="fileLevelData" width="90" />
  102. <el-table-column label="文件年份" align="center" prop="createYear" width="90" />
  103. <el-table-column label="文件类型" align="center" prop="docType" />
  104. <el-table-column label="标签" align="center" prop="tagName" width="250">
  105. <template slot-scope="scope">
  106. <div v-if="scope.row.tagList != []">
  107. <el-tag v-for="item in scope.row.tagList" :key="item.tagId">
  108. {{ item.tagName }}
  109. </el-tag>
  110. </div>
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  114. <template slot-scope="scope">
  115. <el-button size="mini" type="text" icon="el-icon-view" @click="handlePreview(scope.row)"
  116. v-if="checkLevel(scope.row, 'view')">预览</el-button>
  117. <el-dropdown size="mini">
  118. <el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
  119. <el-dropdown-menu slot="dropdown">
  120. <el-dropdown-item icon="el-icon-view" @click.native="handleShare(scope.row)"
  121. v-if="checkLevel(scope.row, 'share')">分享</el-dropdown-item>
  122. <el-dropdown-item icon="el-icon-view" @click.native="handleDownload(scope.row)"
  123. v-if="checkLevel(scope.row, 'download')">下载</el-dropdown-item>
  124. <el-dropdown-item icon="el-icon-view" @click.native="handleEdit(scope.row)"
  125. v-if="checkLevel(scope.row, 'edit')">在线编辑</el-dropdown-item>
  126. <el-dropdown-item icon="el-icon-edit" @click.native="handleUpdate(scope.row)"
  127. v-hasPermi="['doc:info:edit']" v-if="checkLevel(scope.row, 'modify')">修改</el-dropdown-item>
  128. <el-dropdown-item icon="el-icon-delete" @click.native="handleDelete(scope.row)"
  129. v-hasPermi="['doc:info:remove']" v-if="checkLevel(scope.row, 'del')">删除</el-dropdown-item>
  130. </el-dropdown-menu>
  131. </el-dropdown>
  132. <!-- <el-button
  133. size="mini"
  134. type="text"
  135. icon="el-icon-view"
  136. @click="handleShare(scope.row)"
  137. v-if="checkLevel(scope.row, 'share')"
  138. >分享</el-button
  139. > -->
  140. <!-- <el-button
  141. size="mini"
  142. type="text"
  143. icon="el-icon-view"
  144. @click="handleDownload(scope.row)"
  145. v-if="checkLevel(scope.row, 'download')"
  146. >下载</el-button
  147. > -->
  148. <!-- <el-button
  149. size="mini"
  150. type="text"
  151. icon="el-icon-view"
  152. @click="handleEdit(scope.row)"
  153. v-if="checkLevel(scope.row, 'edit')"
  154. >在线编辑</el-button
  155. > -->
  156. <!-- <el-button
  157. size="mini"
  158. type="text"
  159. icon="el-icon-edit"
  160. @click="handleUpdate(scope.row)"
  161. v-hasPermi="['doc:info:edit']"
  162. v-if="checkLevel(scope.row, 'modify')"
  163. >修改</el-button
  164. > -->
  165. <!-- <el-button
  166. size="mini"
  167. type="text"
  168. icon="el-icon-delete"
  169. @click="handleDelete(scope.row)"
  170. v-hasPermi="['doc:info:remove']"
  171. v-if="checkLevel(scope.row, 'del')"
  172. >删除</el-button
  173. > -->
  174. </template>
  175. </el-table-column>
  176. </el-table>
  177. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
  178. :limit.sync="queryParams.pageSize" @pagination="getList" />
  179. </el-col>
  180. </el-row>
  181. <!-- 添加或修改文件基本信息对话框 -->
  182. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body custom-class="el-dialog5">
  183. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  184. <el-form-item label="" prop="docPath">
  185. <!-- <el-input v-model="form.docPath" placeholder="请输入文件路径" /> -->
  186. <file-upload v-model="form.docPath" />
  187. </el-form-item>
  188. <el-form-item label="文件目录" prop="dirId">
  189. <treeselect v-model="form.dirId" :options="dirList" :normalizer="normalizer" placeholder="请选择文件目录" />
  190. </el-form-item>
  191. <el-form-item label="文件名称" prop="docName">
  192. <el-input v-model="form.docName" placeholder="请输入文件名称" />
  193. </el-form-item>
  194. <el-form-item label="文件级别" prop="docLevel">
  195. <el-select v-model="form.docLevel" placeholder="请选择文件级别">
  196. <el-option v-for="item in levelOptions" :key="item.levelId" :label="item.levelName"
  197. :value="item.levelId"></el-option>
  198. </el-select>
  199. </el-form-item>
  200. <el-form-item label="选择标签(最多5个)" prop="tagName" color="red">
  201. <el-tag :key="tag" v-for="tag in dynamicTags" closable :disable-transitions="false"
  202. @close="handleClose(tag)">
  203. {{ tag }}
  204. </el-tag>
  205. <el-input class="input-new-tag" v-if="inputVisible" v-model="inputValue" ref="saveTagInput" size="small"
  206. @keyup.enter.native="handleInputConfirm" @blur="handleInputConfirm" maxlength="5" placeholder="最多输入五个字">
  207. </el-input>
  208. <el-button v-else class="button-new-tag" size="small" @click="showInput">添加标签</el-button>
  209. </el-form-item>
  210. <el-form-item label="文件标签" color="red">
  211. <el-tag v-for="tag in tags" :key="tag.tagName" :type="tag.type" @click="handleInputConfirm1(tag)">
  212. {{ tag.tagName }}
  213. </el-tag>
  214. </el-form-item>
  215. <el-form-item label="文件描述">
  216. <el-input v-model="form.docDesc" type="textarea" placeholder="请输入内容" />
  217. </el-form-item>
  218. </el-form>
  219. <div slot="footer" class="dialog-footer">
  220. <el-button type="primary" @click="submitForm">确 定</el-button>
  221. <el-button @click="cancel">取 消</el-button>
  222. </div>
  223. </el-dialog>
  224. <!-- 预览对话框 -->
  225. <div class="dhk" v-if="preview">
  226. <video :src="vid" controls v-if="vid1"></video>
  227. <audio :src="aud" controls v-if="aud1"></audio>
  228. <div class="image-container" v-if="img1">
  229. <el-image :src="imgg" ref="imageRef" style="max-width: 100%" />
  230. <el-button-group>
  231. <el-button icon="el-icon-refresh" @click="rotate(-90)"></el-button>
  232. <el-button icon="el-icon-refresh-right" @click="rotate(90)"></el-button>
  233. <el-button icon="el-icon-zoom-in" @click="scale(0.1)"></el-button>
  234. <el-button icon="el-icon-zoom-out" @click="scale(-0.1)"></el-button>
  235. </el-button-group>
  236. </div>
  237. <el-button class="gb" icon="el-icon-close" circle @click="gb" />
  238. </div>
  239. </div>
  240. </div>
  241. </div>
  242. </template>
  243. <script>
  244. import "@/styles1/element-ui1.scss";
  245. import {
  246. listTag
  247. } from "@/api/doc/tag.js";
  248. import {
  249. listInfo,
  250. getInfo,
  251. delInfo,
  252. addInfo,
  253. updateInfo,
  254. } from "@/api/doc/info";
  255. import {
  256. listDir,
  257. getDir,
  258. delDir,
  259. addDir,
  260. updateDir,
  261. personalList,
  262. } from "@/api/doc/dir";
  263. import {
  264. listLevel
  265. } from "@/api/doc/level";
  266. import Treeselect from "@riophae/vue-treeselect";
  267. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  268. export default {
  269. name: "Info",
  270. components: {
  271. Treeselect,
  272. },
  273. data() {
  274. return {
  275. //预览图片的旋转缩放
  276. scalePercentage: 1,
  277. rotationAngle: 0,
  278. // 预览界面
  279. preview: false,
  280. //视频路径和显示
  281. vid: "",
  282. vid1: false,
  283. //音频路径和显示
  284. aud: "",
  285. aud1: false,
  286. //图片路径和显示
  287. imgg: "",
  288. img1: false,
  289. //标签列表
  290. tags: [
  291. // { name: '十四大', id: 0 },
  292. // { name: '领导讲话', id: 1 },
  293. // { name: '会议精神', id: 2 },
  294. // { name: '党章', id: 3 },
  295. // { name: '212专案', id: 4 }
  296. ],
  297. //选择标签
  298. dynamicTags: [],
  299. inputVisible: false,
  300. inputValue: "",
  301. // 遮罩层
  302. loading: true,
  303. // 选中数组
  304. ids: [],
  305. // 非单个禁用
  306. single: true,
  307. // 非多个禁用
  308. multiple: true,
  309. // 显示搜索条件
  310. showSearch: true,
  311. // 总条数
  312. total: 0,
  313. // 文件基本信息表格数据
  314. infoList: [],
  315. //目录ID
  316. dirId: undefined,
  317. //目录数据
  318. dirList: undefined,
  319. //文件等级数据
  320. levelOptions: [],
  321. // 弹出层标题
  322. title: "",
  323. // 是否显示弹出层
  324. open: false,
  325. // 查询参数
  326. queryParams: {
  327. pageNum: 1,
  328. pageSize: 10,
  329. docName: null,
  330. docLevel: null,
  331. createYear: null,
  332. params: {
  333. tagId: null,
  334. },
  335. },
  336. // 表单参数
  337. form: {},
  338. defaultProps: {
  339. children: "children",
  340. label: "dirName",
  341. id: "dirId",
  342. },
  343. // 表单校验
  344. rules: {
  345. docName: [{
  346. required: true,
  347. message: "文件名称不能为空",
  348. trigger: "blur",
  349. }, ],
  350. dirId: [{
  351. required: true,
  352. message: "文件目录不能为空",
  353. trigger: "blur",
  354. }, ],
  355. docLevel: [{
  356. required: true,
  357. message: "文件级别不能为空",
  358. trigger: "blur",
  359. }, ],
  360. },
  361. };
  362. },
  363. created() {
  364. this.dirTree();
  365. },
  366. watch: {
  367. "form.docPath": function(path, old) {
  368. if (path && path.lastIndexOf("/") > -1) {
  369. let name = path.slice(path.lastIndexOf("/") + 1);
  370. this.form.docName = name.split("_")[0];
  371. }
  372. },
  373. },
  374. methods: {
  375. //预览图片的缩放
  376. rotate(angle) {
  377. this.rotationAngle += angle;
  378. const image = this.$refs.imageRef.$el.querySelector("img");
  379. image.style.transform = `rotate(${this.rotationAngle}deg)`;
  380. },
  381. //预览图片的旋转
  382. scale(delta) {
  383. this.scalePercentage += delta;
  384. const image = this.$refs.imageRef.$el.querySelector("img");
  385. image.style.transform = `scale(${this.scalePercentage})`;
  386. },
  387. // 预览关闭
  388. gb() {
  389. this.preview = false;
  390. },
  391. //选择标签关闭
  392. handleClose(tag) {
  393. this.form.tagList.map((i, index) => {
  394. if (tag == i.tagName) {
  395. this.form.tagList.splice(index, 1);
  396. }
  397. });
  398. this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1);
  399. },
  400. showInput() {
  401. if (this.dynamicTags.length >= 5) {
  402. this.inputVisible = false;
  403. alert("标签数不允许超过五个")
  404. } else {
  405. this.inputVisible = true;
  406. this.$nextTick((_) => {
  407. this.$refs.saveTagInput.$refs.input.focus();
  408. });
  409. }
  410. },
  411. //固定的标签
  412. handleInputConfirm1(tag) {
  413. if (this.dynamicTags.indexOf(tag.tagName) == -1) {
  414. this.dynamicTags.push(
  415. tag.tagName
  416. );
  417. this.form.tagList.push({
  418. tagId: tag.tagId,
  419. tagName: tag.tagName,
  420. });
  421. }
  422. if (this.dynamicTags.length > 5) {
  423. alert("标签数不允许超过五个")
  424. this.dynamicTags.pop()
  425. };
  426. },
  427. //自定义标签
  428. handleInputConfirm() {
  429. let inputValue = this.inputValue;
  430. // if (inputValue) {
  431. // this.dynamicTags.push(inputValue);
  432. // }
  433. // this.inputVisible = false;
  434. // this.inputValue = "";
  435. // this.form.tagList.push({
  436. // tagName:inputValue,
  437. // });
  438. //查询输入的标签在固定标签里是否存在
  439. var Newtags = this.tags.find((value) => value.tagName == inputValue);
  440. // console.log(a);
  441. //删除标签
  442. if (this.dynamicTags.indexOf(inputValue) != -1) {
  443. this.dynamicTags.pop()
  444. this.form.tagList.pop()
  445. }
  446. if (inputValue) {
  447. this.dynamicTags.push(inputValue);
  448. }
  449. this.inputVisible = false;
  450. this.inputValue = "";
  451. //判断输入的标签在固定标签里是否存在,存在则换成固定标签
  452. if (Newtags) {
  453. this.form.tagList.push({
  454. tagId: Newtags.tagId,
  455. tagName: Newtags.tagName,
  456. });
  457. } else {
  458. this.form.tagList.push({
  459. tagName: inputValue,
  460. });
  461. }
  462. // console.log(this.form);
  463. if (this.dynamicTags.length > 5) {
  464. alert("标签数不允许超过五个")
  465. this.dynamicTags.pop()
  466. };
  467. },
  468. /** 转换目录信息数据结构 */
  469. normalizer(node) {
  470. if (node.children && !node.children.length) {
  471. delete node.children;
  472. }
  473. return {
  474. id: node.dirId,
  475. label: node.dirName,
  476. children: node.children,
  477. };
  478. },
  479. // 节点单击事件
  480. handleNodeClick(data) {
  481. this.dirId = data.dirId;
  482. this.queryParams.dirId = this.dirId;
  483. this.queryParams.searchValue = this.spaceId;
  484. this.handleQuery();
  485. },
  486. //分享
  487. handleShare(row) {
  488. this.$router.push("/home/file/individual/share/user/" + row.docId);
  489. },
  490. /**下载按钮操作*/
  491. handleDownload(row) {
  492. location.href = row.docPath;
  493. },
  494. //预览
  495. handlePreview(row) {
  496. console.log(row);
  497. // console.log( this.$route.meta.title);
  498. // row.isEdit = false;
  499. // this.$tab.openPage(
  500. // // "文件[" + row.docName + "]预览",
  501. // document.title = row.docName,
  502. // // window.open("/individual/Pre/user/" + row.docId, '_blank'),
  503. // // row
  504. // );
  505. //图片后缀名
  506. var pictures = ['jpeg', 'tiff', 'raw', 'bmp', 'gif', 'png', 'jpg'];
  507. //音频后缀名
  508. var audios = ['mid', 'mp3', 'wav', 'wma', 'ra', 'ogg', 'flac', 'aac', 'ape'];
  509. //视频后缀名
  510. var videos = ['asf', 'avi', 'mp4', 'ogm', 'ifo', 'mpg', 'mov', 'mpeg', 'mpg', 'vob', 'wmv', 'rm', 'rmvb'];
  511. //判断后缀名
  512. if (videos.some(item => item == row.docType)) {
  513. this.preview = true;
  514. this.vid1 = true;
  515. this.aud1 = false;
  516. this.img1 = false;
  517. this.vid = row.docPath;
  518. } else if (audios.some(item => item == row.docType)) {
  519. this.preview = true;
  520. this.aud1 = true;
  521. this.vid1 = false;
  522. this.img1 = false;
  523. this.aud = row.docPath;
  524. } else if (pictures.some(item => item == row.docType)) {
  525. this.preview = true;
  526. this.aud1 = false;
  527. this.vid1 = false;
  528. this.img1 = true;
  529. this.imgg = row.docPath;
  530. } else {
  531. row.isEdit = false;
  532. this.$tab.openPage(
  533. window.open('/individual/Pre/user/' + row.docId + "?row=" + JSON.stringify(row),
  534. '_blank'),
  535. // window.open("/individual/Pre/user/" + row.docId +"/title/"+ row.docName, '_blank'),
  536. );
  537. // console.log(111);
  538. }
  539. // console.log(row.docPath);
  540. // console.log(vid);
  541. },
  542. //在线编辑
  543. handleEdit(row) {
  544. row.isEdit = true;
  545. this.$tab.openPage(
  546. window.open('/individual/Pre/user/' + row.docId + "?row=" + JSON.stringify(row),
  547. '_blank')
  548. );
  549. },
  550. //先获取左边目录树,拿到目录ID和spaceId才能查询
  551. dirTree() {
  552. this.loading = true;
  553. personalList().then((response) => {
  554. this.dirId = response.data[0].dirId;
  555. this.spaceId = response.data[0].spaceId;
  556. this.dirList = this.handleTree(response.data, "dirId");
  557. this.queryParams.dirId = this.dirId;
  558. this.queryParams.searchValue = this.spaceId;
  559. this.getList();
  560. //获取文件级别数据
  561. listLevel().then((response) => {
  562. this.levelOptions = response.rows;
  563. });
  564. this.loading = false;
  565. //标签数据
  566. listTag().then((res) => {
  567. this.tags = res.rows;
  568. });
  569. });
  570. },
  571. /**处理文档级别数据*/
  572. fileLevelData(row, col, value) {
  573. const obj = this.levelOptions.find((item) => item.levelId == value);
  574. return obj.levelName;
  575. },
  576. /**根据文档级别显示数据*/
  577. checkLevel(row, role) {
  578. try {
  579. const obj = this.levelOptions.find(
  580. (item) => item.levelId == row.docLevel
  581. );
  582. if (obj.levelRole.indexOf(role) != -1) {
  583. return true;
  584. } else {
  585. return false;
  586. }
  587. } catch (e) {}
  588. },
  589. /** 查询文件基本信息列表 */
  590. getList() {
  591. this.loading = true;
  592. listInfo(this.queryParams).then((response) => {
  593. this.infoList = response.rows;
  594. this.total = response.total;
  595. this.loading = false;
  596. });
  597. },
  598. // 取消按钮
  599. cancel() {
  600. this.open = false;
  601. this.reset();
  602. },
  603. // 表单重置
  604. reset() {
  605. this.form = {
  606. docId: null,
  607. dirId: this.dirId,
  608. docName: null,
  609. docType: null,
  610. docSize: null,
  611. classifyId: null,
  612. docDesc: null,
  613. docPath: null,
  614. docLevel: null,
  615. allowEdit: null,
  616. docOf: null,
  617. owner: null,
  618. createYear: null,
  619. createBy: null,
  620. createTime: null,
  621. updateBy: null,
  622. updateTime: null,
  623. remark: null,
  624. isDel: null,
  625. searchValue: this.spaceId,
  626. tagList: [],
  627. };
  628. this.resetForm("form");
  629. this.dynamicTags = []
  630. },
  631. /** 搜索按钮操作 */
  632. handleQuery() {
  633. // const para = {
  634. // tagId: queryParams.params.tagId,
  635. // }
  636. // this.queryParams.params = para;
  637. // console.log(this.queryParams);
  638. this.queryParams.pageNum = 1;
  639. this.getList();
  640. },
  641. /** 重置按钮操作 */
  642. resetQuery() {
  643. this.resetForm("queryForm");
  644. this.queryParams.dirId = this.dirId;
  645. this.queryParams.searchValue = this.spaceId;
  646. this.queryParams.params.tagId = null;
  647. this.handleQuery();
  648. },
  649. // 多选框选中数据
  650. handleSelectionChange(selection) {
  651. this.ids = selection.map((item) => item.docId);
  652. this.single = selection.length !== 1;
  653. this.multiple = !selection.length;
  654. },
  655. /** 新增按钮操作 */
  656. handleAdd() {
  657. this.reset();
  658. this.open = true;
  659. this.title = "添加文件基本信息";
  660. // this.dynamicTags=[];
  661. // console.log(this.dynamicTags);
  662. },
  663. /** 修改按钮操作 */
  664. handleUpdate(row) {
  665. this.reset();
  666. const docId = row.docId || this.ids;
  667. getInfo(docId, row.createYear).then((response) => {
  668. this.form = response.data;
  669. this.open = true;
  670. this.title = "修改文件基本信息";
  671. this.dynamicTags = this.form.tagList.map(item => item.tagName);
  672. // console.log(this.dynamicTags);
  673. // console.log(this.form);
  674. });
  675. },
  676. /** 提交按钮 */
  677. submitForm() {
  678. this.$refs["form"].validate((valid) => {
  679. if (valid) {
  680. if (this.form.docId != null) {
  681. updateInfo(this.form).then((response) => {
  682. this.$modal.msgSuccess("修改成功");
  683. this.open = false;
  684. this.getList();
  685. });
  686. } else {
  687. addInfo(this.form).then((response) => {
  688. this.$modal.msgSuccess("新增成功");
  689. this.open = false;
  690. this.getList();
  691. });
  692. }
  693. }
  694. });
  695. // console.log(this.dynamicTags.length);
  696. // console.log(this.form);
  697. // console.log(this.dynamicTags);
  698. },
  699. /** 删除按钮操作 */
  700. handleDelete(row) {
  701. const docIds = row.docId || this.ids;
  702. this.$modal
  703. .confirm('是否确认删除文件基本信息编号为"' + docIds + '"的数据项?')
  704. .then(function() {
  705. return delInfo(docIds);
  706. })
  707. .then(() => {
  708. this.getList();
  709. this.$modal.msgSuccess("删除成功");
  710. })
  711. .catch(() => {});
  712. },
  713. /** 导出按钮操作 */
  714. handleExport() {
  715. this.download(
  716. "doc/info/export", {
  717. ...this.queryParams,
  718. },
  719. `info_${new Date().getTime()}.xlsx`
  720. );
  721. },
  722. /**格式化文件大小数据*/
  723. fileSizeData(row, col, value) {
  724. const KB = 1;
  725. const MB = KB * 1024;
  726. const GB = MB * 1024;
  727. if (value < MB) {
  728. return `${(value / KB).toFixed(2)} KB`;
  729. } else if (value < GB) {
  730. return `${(value / MB).toFixed(2)} MB`;
  731. } else {
  732. return `${(value / GB).toFixed(2)} GB`;
  733. }
  734. },
  735. },
  736. };
  737. </script>
  738. <style scoped lang='scss'>
  739. .containe {
  740. color: #7ea4c8;
  741. font-size: 0.14rem;
  742. font-family: PingFang SC-Medium, PingFang SC;
  743. font-weight: 500;
  744. padding-left: calc(100vw * (20 / 1920));
  745. .header {
  746. width: calc(100vw * (300 / 1920));
  747. height: calc(100vh * (22 / 1080));
  748. margin-top: calc(100vh * (20 / 1080));
  749. margin-bottom: calc(100vh * (20 / 1080));
  750. display: flex;
  751. align-items: center;
  752. img {
  753. width: calc(100vw * (16 / 1920));
  754. height: calc(100vh * (16 / 1080));
  755. border: 1px dashed grey;
  756. margin-left: 3px;
  757. margin-right: 3px;
  758. }
  759. .top1 {
  760. color: #2e8aecff;
  761. }
  762. }
  763. .title {
  764. height: calc(100vh * (22 / 1080));
  765. margin-top: calc(100vh * (20 / 1080));
  766. margin-bottom: calc(100vh * (20 / 1080));
  767. color: #ffffffff;
  768. font-size: 0.16rem;
  769. font-weight: bold;
  770. line-height: calc(100vh * (22 / 1080));
  771. }
  772. .main {
  773. width: calc(100vw * (1876 / 1920));
  774. height: calc(100vh * (930 / 1080));
  775. .app-container {
  776. width: calc(100vw * (1876 / 1920));
  777. height: calc(100vh * (930 / 1080));
  778. padding: 0;
  779. }
  780. .main-left {
  781. width: calc(100vw * (260 / 1920));
  782. height: calc(100vh * (930 / 1080));
  783. margin-right: calc(100vw * (20 / 1920));
  784. margin-left: calc(100vw * (10 / 1920));
  785. background: url(../../../assets/img/Group-609.png);
  786. background-size: calc(100vw * (260 / 1920)) calc(100vh * (930 / 1080));
  787. .head-top {
  788. color: #ffffffff;
  789. font-size: 0.2rem;
  790. padding-left: calc(100vw * (15 / 1920));
  791. padding-top: calc(100vh * (18 / 1080));
  792. }
  793. //左边下拉菜单
  794. .head-container {
  795. margin-top: -5px;
  796. }
  797. }
  798. .main-right {
  799. width: calc(100vw * (1600 / 1920));
  800. height: calc(100vh * (930 / 1080));
  801. background: url(../../../assets/img/Group-610.png);
  802. background-size: calc(100vw * (1600 / 1920)) calc(100vh * (930 / 1080));
  803. p {
  804. color: #ffffffff;
  805. font-size: 0.16rem;
  806. padding-left: calc(100vw * (15 / 1920));
  807. padding-top: calc(100vh * (18 / 1080));
  808. }
  809. .main-right-top {
  810. height: calc(100vh * (60 / 1080));
  811. margin-top: calc(100vw * (25 / 1920));
  812. .reset1 {
  813. color: #2e8aecff;
  814. background: transparent;
  815. border: 1px solid #2e8aecff;
  816. }
  817. }
  818. .mb8 {
  819. margin-top: 20px;
  820. }
  821. .main-right-table {
  822. background: transparent;
  823. color: #7ea4c8ff;
  824. }
  825. //表格底部
  826. .pagination-container {
  827. width: calc(100vw * (1540 / 1920));
  828. height: calc(100vh * (50 / 1080));
  829. background: transparent;
  830. padding: 0 !important;
  831. margin: 0;
  832. margin-left: calc(100vw * (20 / 1920));
  833. margin-top: calc(100vh * (10 / 1080));
  834. }
  835. }
  836. }
  837. //预览弹窗
  838. .dhk {
  839. width: calc(100vw * (1500 / 1920));
  840. height: calc(100vh * (850 / 1080));
  841. // background: salmon;
  842. background: #0F1540FF;
  843. position: absolute;
  844. top: 10%;
  845. left: 10%;
  846. z-index: 99;
  847. display: flex;
  848. justify-content: center;
  849. align-items: center;
  850. .gb {
  851. position: absolute;
  852. top: 0;
  853. right: 0;
  854. }
  855. video {
  856. width: calc(100vw * (1440 / 1920));
  857. height: calc(100vh * (810 / 1080));
  858. }
  859. .el-image {
  860. width: calc(100vw * (960 / 1920));
  861. height: calc(100vh * (720 / 1080));
  862. }
  863. .el-button-group {
  864. position: absolute;
  865. top: 10%;
  866. right: 1%;
  867. }
  868. }
  869. }
  870. //标签按钮
  871. ::v-deep .el-tag {
  872. color: #df9439ff;
  873. border: 1px solid #ff9839ff;
  874. background: #bba99240;
  875. margin-left: 3px;
  876. margin-bottom: 3px;
  877. height: calc(100vh * (35 / 1080));
  878. line-height: calc(100vh * (35 / 1080));
  879. }
  880. //左边下拉菜单样式
  881. ::v-deep .el-tree {
  882. width: calc(100vw * (200 / 1920));
  883. margin-top: calc(100vh * (30 / 1080));
  884. background: transparent;
  885. color: #7ea4c8ff;
  886. }
  887. ::v-deep .el-tree-node {
  888. width: calc(100vw * (232 / 1920));
  889. }
  890. //悬停时的样式
  891. ::v-deep .el-tree-node__content:hover {
  892. background: #293667ff;
  893. }
  894. //右边顶部字体样式
  895. ::v-deep .el-form-item__label {
  896. color: #2e8aecff;
  897. }
  898. //右边顶部搜索框样式
  899. ::v-deep .el-input__inner {
  900. background-color: transparent;
  901. border: 1px solid #01d1ffff;
  902. color: #ffffffcc;
  903. }
  904. ::v-deep .el-form-item--small .el-form-item__content {
  905. width: calc(100vw * (220 / 1920));
  906. }
  907. //右边顶部标签搜索
  908. ::v-deep .el-select>.el-input {
  909. width: calc(100vw * (180 / 1920));
  910. }
  911. //右边表格线条隐藏
  912. ::v-deep .el-table::before {
  913. height: 0;
  914. }
  915. //table样式
  916. ::v-deep .el-table {
  917. overflow: auto;
  918. }
  919. ::v-deep .el-table th {
  920. background: #016c9aa6;
  921. color: #2e8aec;
  922. }
  923. ::v-deep .el-table tr {
  924. background: transparent;
  925. }
  926. ::v-deep .el-table tbody tr:hover>td {
  927. background-color: #016c9a78 !important;
  928. }
  929. ::v-deep .el-table td.el-table__cell {
  930. border-bottom: 1px solid #006c9aff;
  931. }
  932. ::v-deep .el-table th.el-table__cell.is-leaf {
  933. border-bottom: 1px solid #006c9aff;
  934. }
  935. //搜索刷新按钮颜色
  936. ::v-deep .el-button.is-circle {
  937. background: #006c9aff;
  938. color: white;
  939. }
  940. //按钮的样式
  941. ::v-deep .el-button--primary.is-plain,
  942. .el-button--success.is-plain.is-disabled,
  943. .el-button--danger.is-plain.is-disabled,
  944. .el-button--warning.is-plain,
  945. .el-button--success.is-plain,
  946. .el-button--danger.is-plain {
  947. background-color: #002a5cff;
  948. border: none;
  949. color: #2e8aec;
  950. }
  951. //新增/修改弹窗样式
  952. ::v-deep .el-dialog__title {
  953. color: white;
  954. }
  955. ::v-deep .el-dialog .el-form-item {
  956. margin-top: calc(100vw * (30 / 1920));
  957. }
  958. ::v-deep .el-upload-list__item:hover {
  959. background: #002659ff;
  960. }
  961. //建议框样式
  962. ::v-deep .el-textarea__inner {
  963. background: transparent;
  964. resize: none;
  965. }
  966. //传文件的内容颜色
  967. ::v-deep .el-link.el-link--default {
  968. color: #006c9aff;
  969. }
  970. //上传弹窗位置高度
  971. ::v-deep .el-dialog:not(.is-fullscreen) {
  972. margin-top: 1vh !important;
  973. }
  974. ::v-deep .el-form {
  975. height: calc(100vh * (800 / 1080));
  976. }
  977. //弹窗底部按钮的位置
  978. ::v-deep .el-dialog__footer {
  979. padding: 0;
  980. }
  981. //弹窗关闭按钮
  982. ::v-deep .el-dialog__headerbtn {
  983. top: calc(100vh * (45 / 1080));
  984. right: calc(100vw * (20 / 1920));
  985. font-size: 20px;
  986. }
  987. ::v-deep .el-dialog5 {
  988. width: calc(100vw * (800 / 1920)) !important;
  989. height: calc(100vh * (1050 / 1080)) !important;
  990. background: url(../../../assets/img/Group-585.png);
  991. background-size: calc(100vw * (800 / 1920)) calc(100vh * (1050 / 1080));
  992. //弹窗中间内容
  993. .el-dialog__body {
  994. // width: calc(100vw * (620 / 1920)) ;
  995. height: calc(100vh * (780 / 1080));
  996. margin-top: calc(100vh * (50 / 1080));
  997. margin-bottom: calc(100vh * (20 / 1080));
  998. padding-right: 50px;
  999. overflow: auto;
  1000. // background: salmon;
  1001. }
  1002. .el-dialog__header {
  1003. padding-bottom: 0;
  1004. }
  1005. .el-upload__tip {
  1006. font-size: 12px;
  1007. color: #006c9aff;
  1008. margin-top: 0px;
  1009. }
  1010. .el-upload-list__item {
  1011. margin: 0;
  1012. }
  1013. .el-tag+.el-tag {
  1014. margin-left: 10px;
  1015. }
  1016. .button-new-tag {
  1017. margin-left: 10px;
  1018. height: 32px;
  1019. line-height: 30px;
  1020. padding-top: 0;
  1021. padding-bottom: 0;
  1022. }
  1023. .input-new-tag {
  1024. width: 90px;
  1025. margin-left: 10px;
  1026. vertical-align: bottom;
  1027. }
  1028. }
  1029. </style>