MyFile.vue 94 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398
  1. <template>
  2. <div>
  3. <div class="bigBox">
  4. <div class="settingBox" @click="mouseClick">
  5. <!-- 设置盒子顶部搜索 -->
  6. <div class="topSearch">
  7. <div class="spaceName">{{spaceName}}</div>
  8. <div>
  9. <el-icon v-hasRole="['system']" @click="createNewMenu(1, true)" color="#505870" size="24">
  10. <Plus />
  11. </el-icon>
  12. <!-- @click="createNewFile" -->
  13. </div>
  14. </div>
  15. <!-- 方块点击盒子 -->
  16. <div
  17. style="height: 75vh;overflow-y: auto;">
  18. <div class="searchBox">
  19. <el-input v-model="searchFire" @keyup.enter="fileBlur" class="searchFire" size="large" placeholder="搜索文件"/>
  20. <el-icon class="SearchIcon" @click="fileBlur">
  21. <Search/>
  22. </el-icon>
  23. </div>
  24. <!-- v-for盒子 -->
  25. <div style="display: flex;justify-content: flex-start;align-items: flex-start;flex-wrap: wrap;align-content: flex-start;overflow-y: auto;">
  26. <template v-for="(item, index) in fileMenu" :key="index">
  27. <div class="setBox" >
  28. <el-dropdown trigger="click" class="selectChe">
  29. <span class="el-dropdown-link">
  30. ...
  31. </span>
  32. <template #dropdown>
  33. <el-dropdown-menu>
  34. <el-dropdown-item @click="restName(item, index)">重命名</el-dropdown-item>
  35. <el-dropdown-item v-if="item.dirType == '2' && isDept" @click="upFirstFoler(item)">编辑</el-dropdown-item>
  36. <el-dropdown-item v-if="item.dirType == '1'" @click="delName(item, index)">删除</el-dropdown-item>
  37. </el-dropdown-menu>
  38. </template>
  39. </el-dropdown>
  40. <div class="left_fileBox" @click="changeFile(item, index)">
  41. <el-tooltip
  42. class="box-item tool-tip"
  43. effect="dark"
  44. placement="top-start"
  45. v-if="item.encryptLevel"
  46. >
  47. <template #content> 安全级别: {{ item.encryptLevel == 'L1'?'敏感':(item.encryptLevel == 'L2'?'涉密':(item.encryptLevel == 'L3'?'机密':'绝密')) }} </template>
  48. <img :src="item.dirType=='1'?fileStyle:ordinaryList" style="width: 72px;height: 72px;" class="shouzhi"></el-tooltip>
  49. <img :src="item.dirType=='1'?fileStyle:ordinaryList" style="width: 72px;height: 72px;" class="shouzhi" v-else>
  50. <el-tooltip
  51. class="box-item tool-tip"
  52. effect="dark"
  53. placement="top-start"
  54. > <template #content> <span>{{ item.dirName }}</span></template>
  55. <p class="ellipsis-text shouzhi">{{ item.dirName }}</p>
  56. </el-tooltip>
  57. <img class="levelImg shouzhi" v-if="item.isEncrypt === 'Y'" :src="getLevelImg(item.encryptLevel)" alt="">
  58. </div>
  59. </div>
  60. </template>
  61. </div>
  62. </div>
  63. <!-- <div class="expansion">
  64. <div class="top_box">
  65. <span style="margin-left: 5px;font-size: 14px;font-weight: 500;">{{ formatStorage(useSpace) }}/{{ allSpace + "G" }}</span>
  66. <span style="margin-left: 5px;font-size: 14px;color: #2E6BC8;cursor: pointer;"
  67. @click="askApply">申请扩容</span>
  68. </div>
  69. <el-progress style="margin-left: 8px;" :stroke-width="12" color='#2E6BC8' :percentage="percent()" />
  70. </div> -->
  71. </div>
  72. <!-- 右侧大盒子 -->
  73. <div class="mesBox">
  74. <!-- 展示文件夹盒子 -->
  75. <!-- 文件夹 -->
  76. <div v-if="editOnline">
  77. <!-- 众多功能 -->
  78. <div class="manyUse">
  79. <div v-if="thisRole.some(item=>item == 'upload') || isDept"
  80. style="display: flex;width: 92px;height: 32px;justify-content: flex-start;align-items: center;line-height: 18px;">
  81. <div style="margin-left: 5px;">
  82. <img src="../../assets/images/upload.png" style="width: 24px;height: 24px;" alt="">
  83. </div>
  84. <div style="margin-left: 5px;">
  85. <span style="color: black;cursor: pointer;" @click="uploadModal = true" class="shouzhi">上传
  86. </span>
  87. </div>
  88. </div>
  89. <div v-else
  90. style="display: flex;width: 92px;opacity:0.5;height: 32px;justify-content: flex-start;align-items: center;line-height: 18px;">
  91. <div style="margin-left: 5px;">
  92. <img src="../../assets/images/upload.png" style="width: 24px;height: 24px;" alt="">
  93. </div>
  94. <div style="margin-left: 5px;">
  95. <span style="color: black;cursor: pointer;" class="shouzhi">上传
  96. </span>
  97. </div>
  98. </div>
  99. <div v-if="thisFolder.dirType && isDept"
  100. style="display: flex;width: 102px;height: 32px;justify-content: flex-start;align-items: center;">
  101. <div style="margin-left: 5px;">
  102. <el-icon
  103. style="background-color: #7084B4;width: 24px;height: 24px;border-radius: 50%;color: white;"
  104. @click="createNewMenu(0)">
  105. <Plus />
  106. </el-icon>
  107. </div>
  108. <div style="margin-left: 5px;" @click="createNewMenu(0)">
  109. <span style="font-size: 14px;" class="shouzhi">新建目录</span>
  110. </div>
  111. </div>
  112. <div v-else
  113. style="display: flex;opacity:0.5;width: 102px;height: 32px;justify-content: flex-start;align-items: center;">
  114. <div style="margin-left: 5px;">
  115. <el-icon
  116. style="background-color: #7084B4;width: 24px;height: 24px;border-radius: 50%;color: white;"
  117. >
  118. <Plus />
  119. </el-icon>
  120. </div>
  121. <div style="margin-left: 5px;">
  122. <span style="font-size: 14px;" class="shouzhi">新建目录</span>
  123. </div>
  124. </div>
  125. <template v-for="(item, index) in useMenu" :key="index">
  126. <div :class="{ 'isCheck': (haveCheck && thisRole.some(item=>item == 'delete')||haveCheck && isDept) }"
  127. style="display: flex;width: 82px;opacity:0.5;height: 32px;justify-content: flex-start;align-items: center;line-height: 18px;cursor: pointer;"
  128. @click="getMenu(item, index)">
  129. <div style="margin-left: 5px;">
  130. <img :src="item.img" style="width: 24px;height: 24px;" alt="">
  131. </div>
  132. <div style="margin-left: 5px;">
  133. <span style="font-size: 14px;" class="shouzhi">{{ item.name }}</span>
  134. </div>
  135. </div>
  136. </template>
  137. </div>
  138. <!-- 面包屑功能栏 -->
  139. <div class="breadBox">
  140. <!-- 左侧 -->
  141. <div style="display: flex;justify-content: space-around;align-items: center;margin-left: 5px;">
  142. <!-- 前进后退 -->
  143. <!-- <div style="display: flex;justify-content: space-around;align-items: center;">
  144. <img style="display:block;width: 11px;height: 11px;" :src="blueLeft" alt=""
  145. @click="arrowLift">
  146. <img style="display:block;width: 16px;height: 16px;" :src="grayRight" alt="">
  147. </div> -->
  148. <!-- 面包屑 -->
  149. <div class="topPath">
  150. <span @click="backTopPath">{{ topPath }}</span>
  151. <PathLabel v-if="!loadingPreview" @folderClick="folderClick" :pathLabelData='pathLabelData'></PathLabel>
  152. <!-- <BreadMenu></BreadMenu> -->
  153. </div>
  154. </div>
  155. <!-- 右侧 -->
  156. <div>
  157. <img :src="sort" alt="">
  158. <!-- //控制宫格展示 -->
  159. <img
  160. v-if="fileGrid"
  161. src="@/assets/images/squre.png"
  162. class="shouzhi palace-grid"
  163. alt=""
  164. @click="changeShow(true)"
  165. />
  166. <img
  167. v-else
  168. src="@/assets/images/Frame_187.png"
  169. class="shouzhi palace-grid"
  170. alt=""
  171. @click="changeShow(false)"
  172. />
  173. <!-- <img :src="squre" alt="" @click="gridChange" class="shouzhi"> -->
  174. </div>
  175. </div>
  176. <!-- </div> -->
  177. <!-- 展示文件夹盒子 -->
  178. <div class="showBox">
  179. <!-- 文件夹 -->
  180. <div class="detailBox file-jia" @click="mouseClick">
  181. <el-collapse v-model="folder">
  182. <el-collapse-item name="1" class="custom-collapse-item">
  183. <template #title>
  184. <span class="file-title">文件夹</span>
  185. </template>
  186. <el-table v-if="fileGrid == 1" height="37vh" :data="folderList" style="width: 100%" :scrollbar-always-on="true"
  187. @selection-change="handleSelectionChange1" :single-select="true" @row-click="folderClick"
  188. @row-contextmenu="folderRClick" ref="taskTableRef">
  189. <el-table-column type="selection" width="55" />
  190. <el-table-column label="名称" :show-overflow-tooltip="true" width="280">
  191. <template #default="scope">
  192. <span class="juzhong">
  193. <el-icon v-if="scope.row.isFavorite == 'N'" @click.stop="collectByStar(scope.row,true)" class="juli">
  194. <Star />
  195. </el-icon>
  196. <img v-else @click.stop="delCollect(scope.row,true)" src="../../assets/images/yellowstar.png" alt="" class="juli">
  197. <img :src="scope.row.dirType=='1'?fileBox:ordinary" style="width: 20px;height: 24px;"
  198. alt="" class="juli">
  199. <span class="shouzhi">{{ scope.row.dirName }}</span>
  200. </span>
  201. </template>
  202. </el-table-column>
  203. <el-table-column prop="createTime" label="时间" width="280" />
  204. <el-table-column prop="dirType" label="类型">
  205. <template #default="scope">
  206. <span v-if="scope.row.dirType == '1'">普通目录</span>
  207. <span v-else>组织目录</span>
  208. </template>
  209. </el-table-column>
  210. <el-table-column label="加密等级">
  211. <template #default="scope">
  212. <span>
  213. {{setTablelevel(scope.row.encryptLevel)}}
  214. </span>
  215. </template>
  216. </el-table-column>
  217. </el-table>
  218. <PlaceGridFolder v-else @folderClick="folderClick" :restName="restName"
  219. :collectFolder="collectFolder" @folderRClick="folderRClick" :getAllTop="getAllTop" @folderBack="folderBack" :thisFolder="thisFolder">
  220. </PlaceGridFolder>
  221. </el-collapse-item>
  222. </el-collapse>
  223. <!-- 右键唤出的菜单 -->
  224. <div class="right_menu" v-if="folderVisible"
  225. :style="{ left: folderleft + 'px', top: foldertop + 'px' }">
  226. <!-- <div class="menu_item" @click="folderClick(null, null)">
  227. <img src="@/assets/images/trash.png" alt="" />
  228. <span>打开</span>
  229. </div> -->
  230. <div class="menu_item" @click="restName(null, null)">
  231. <img src="@/assets/images/textbox.png" alt="" />
  232. <span class="shouzhi">重命名</span>
  233. </div>
  234. <div class="menu_item" @click="collectFolder">
  235. <img src="@/assets/images/collect.png" alt="" />
  236. <span class="shouzhi">收藏</span>
  237. </div>
  238. </div>
  239. </div>
  240. <!-- 文件 -->
  241. <div class="fileTable">
  242. <el-collapse v-model="files" >
  243. <el-collapse-item name="2" class="">
  244. <template #title>
  245. <span class="file-title">文件</span>
  246. </template>
  247. <el-table v-el-table-infinite-scroll="setScroll" :infinite-scroll-distance="10" :infinite-scroll-disabled="tableBeEnd" v-if="fileGrid == 1" :data="fileList" height="38vh" :scrollbar-always-on="true" style="width: 100%"
  248. @row-contextmenu="handleRowClick" @selection-change="handleSelectionChange"
  249. @row-click="mouseClick" :default-sort="{ prop: 'createTime', order: 'descending' }">
  250. <el-table-column type="selection" width="55" />
  251. <el-table-column label="名称" width="280">
  252. <template #default="scope">
  253. <span style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="juzhong">
  254. <el-icon v-if="scope.row.isFavorite == 'N'" @click.stop="collectByStar(scope.row,false)" class="juli">
  255. <Star />
  256. </el-icon>
  257. <img v-else @click.stop="delCollect(scope.row,false)" src="../../assets/images/yellowstar.png" alt="" class="juli">
  258. <img :src="getImage(scope.row.fileType)" alt="" class="juli">
  259. <el-tooltip
  260. class="box-item"
  261. effect="dark"
  262. placement="top"
  263. :show-after="1000"
  264. :content="scope.row.fileName"
  265. >
  266. <!-- <template #content> {{ scope.row.encryptLevel == 'L1'?'敏感':(scope.row.encryptLevel == 'L2'?'涉密':(scope.row.encryptLevel == 'L3'?'机密':'绝密')) }} </template> -->
  267. <span class="shouzhi">{{ scope.row.fileName }}</span>
  268. </el-tooltip>
  269. </span>
  270. </template>
  271. </el-table-column>
  272. <el-table-column prop="createTime" label="时间" sortable width="280" />
  273. <el-table-column prop="fileType" label="类型" />
  274. <el-table-column label="大小">
  275. <template #default="scope">
  276. <span>
  277. {{ formatFileSize(scope.row.fileSize) }}
  278. </span>
  279. </template>
  280. </el-table-column>
  281. </el-table>
  282. <PalaceGridFile v-else @showFile="showFile" :getAllTop="getAllTop" @navBack="navBack"
  283. @lastBB="lastBB" @handleRowClick="handleRowClick" @onlineCase="onlineCase" @shareBack="shareBack" :thisFolder="thisFolder" :fileList="fileList"></PalaceGridFile>
  284. </el-collapse-item>
  285. </el-collapse>
  286. <div :class="{'setCli':!noMenuItem}" v-if="cliCC" :style="{ left: xz + 'px', top: yz -100 + 'px' }">
  287. <template v-for="(item, index) in filterMouseCli()" :key="index">
  288. <p @click="chooseSet(item, index, 1)" v-if="!noMenuItem" class="chooseSet" style="cursor: pointer;">
  289. <img :src="item.img" alt="">
  290. {{ item.name }}
  291. <span v-if="item.name == '协作' ? true : false"
  292. style="color: #7084B4;float: right;position: relative;" class="arrow"></span>
  293. </p>
  294. </template>
  295. </div>
  296. <div class="setCli1" v-if="anyP" :style="{ left: xz + 155 + 'px', top: yz + 'px' }">
  297. <p @click="chooseSet1(0)" class="chooseSet">
  298. <img src="../../assets/images/user.png" alt="">
  299. 选择人员
  300. </p>
  301. <p class="chooseSet" @click="goLock" v-if="clickRow.isActor === 'Y' && clickRow.isFiled != 'Y'">
  302. <img src="../../assets/images/archiveTray.png" alt="">
  303. 归档
  304. </p>
  305. </div>
  306. </div>
  307. </div>
  308. </div>
  309. <div v-else>
  310. <div>
  311. <el-button @click="editOnline = true; historyPrew = false">返回</el-button>
  312. </div>
  313. <FileEdit :docId="clickRowId" :copyRow="copyRow" :historyPrew="historyPrew"
  314. :historycopyRow="historycopyRow" :onlyView="onlyView" @cancleHistoryPrew="cancleHistoryPrew">
  315. </FileEdit>
  316. </div>
  317. </div>
  318. <!-- 扩容弹窗 -->
  319. <div>
  320. <SpaceBig v-if="spaces" :spaces="spaces" :impSpaceId="impSpaceId" @getSpaceC="getSpaceC"></SpaceBig>
  321. </div>
  322. <!-- 新增文件夹弹窗 -->
  323. <div>
  324. <CreateFloder v-if="folderCase" :thisType="thisFolder" :thisRole="thisRole" :folderCase="folderCase" @getChildrenC="getChildrenC" :oneOrTwo="oneOrTwo"
  325. :impDirId="impDirId" :impSpaceId="impSpaceId" :newDirId="newDirId" :newSpaceId="newSpaceId" :upFolderData="upFolderData" :thisFolderRole="thisFolderRole"
  326. :refreshFile="refreshFile">
  327. </CreateFloder>
  328. </div>
  329. <!-- 文件上传 -->
  330. <div>
  331. <el-dialog v-model="uploadModal" :close-on-click-modal="false" title="文件上传" width="30%" @close="closeUpload">
  332. <el-upload class="upload-demo" :before-upload="upBefore" :file-list="fileArr" drag :http-request="onSuccess" multiple
  333. :on-remove="handleRemove"
  334. element-loading-text="上传中..."
  335. element-loading-background="rgba(255, 255, 255, 0.8)"
  336. v-loading="loadingUpload" >
  337. <el-icon class="el-icon--upload"><upload-filled /></el-icon>
  338. <div class="el-upload__text">拖入或<em>点击上传</em></div>
  339. <template #tip>
  340. <div class="el-upload__tip">请选择或拖入文件</div>
  341. </template>
  342. </el-upload>
  343. <template #footer>
  344. <span class="dialog-footer">
  345. <el-button @click="closeUpload">取消</el-button>
  346. <el-button type="primary" @click="sureUpload">确认</el-button>
  347. </span>
  348. </template>
  349. </el-dialog>
  350. </div>
  351. <!-- 文件重命名 -->
  352. <div>
  353. <el-dialog v-model="fileNameChange" title="重命名" width="30%">
  354. <el-form :model="nameForm" label-width="120px">
  355. <el-form-item label="新名字">
  356. <el-input v-model="nameForm.name" maxlength="10"></el-input>
  357. </el-form-item>
  358. </el-form>
  359. <template #footer>
  360. <span class="dialog-footer">
  361. <el-button @click="fileNameChange = false">取消</el-button>
  362. <el-button type="primary" @click="sureChangeName">
  363. 确认
  364. </el-button>
  365. </span>
  366. </template>
  367. </el-dialog>
  368. </div>
  369. <!-- 文件收藏 -->
  370. <div>
  371. <FileCollect v-if="collects" :collects="collects" @getCollects="getCollects" :copyFileName="copyFileName"
  372. :copyFileId="copyFileId" @refreshFile="refreshFile" :isFolder="isFolder" :clickRow="clickRow"></FileCollect>
  373. </div>
  374. <!-- 中栏重命名 -->
  375. <div>
  376. <FolderReName v-if="rename" :rename="rename" :selectedBox="selectedBox" :getAllTop="refreshFile"
  377. :copyFolderName="copyFolderName" @getRename="getRename">
  378. </FolderReName>
  379. </div>
  380. <ImgPreview :previewData="previewData" :copyFileType="copyFileType" :showPreview="showPreview"
  381. @closeImgPreview="closeImgPreview"></ImgPreview>
  382. <div>
  383. <FileTree v-if="fileTrees" :fileTrees="fileTrees" :newSpaceId="newSpaceId" :fileId="clickRowId"
  384. @getChildren="getChildren" :copyOrMove="copyOrMove" :thisFolder="thisFolder.dirId"></FileTree>
  385. </div>
  386. <!-- 穿梭框 -->
  387. <div>
  388. <TransferModal v-if="thanks" :thanks="thanks" :clickRowId="clickRowId" :workOrEdit="workOrEdit"
  389. @getCback="getCback"></TransferModal>
  390. </div>
  391. </div>
  392. </div>
  393. <!-- 图片预览 -->
  394. <!-- 历史版本 -->
  395. <historyList v-if="openForwardFile" :openFile="openForwardFile" :docId="clickRowId" :name="nameForm.name" :copyRow="copyRow"
  396. @close="openForwardFile = false" :fileUserTreeData="fileUserTreeData.data" @changeMsgClose="changeMsgClose"
  397. :historyTotal="historyTotal">
  398. </historyList>
  399. <!-- 历史版本 -->
  400. <!-- 二次密码验证 -->
  401. <inputPassword v-if="showInputPassword" @surePass="surePass" @closeIptPass="closeIptPass" :showInputPassword="showInputPassword"></inputPassword>
  402. <div v-loading.fullscreen="loadingPreview" v-if="loadingPreview" class="lodingBox"></div>
  403. </template>
  404. <script>
  405. import { ref, toRaw, onMounted ,onActivated} from 'vue'
  406. import myfile from '../../api/myfile/myfile'
  407. import {documentation}from "@/api/biz/actor.js"
  408. import { delFavorite } from '@/api/biz/favorite.js'
  409. import documents from '../../api/document/document'
  410. import fileCount from '../../api/fileCount/fileCount'
  411. import FileTree from './components/FileTree.vue'
  412. import BreadMenu from './components/BreadMenu.vue'
  413. import FileEdit from './components/FileEdit.vue'
  414. import TransferModal from './modalComponebts/Transfer.vue'
  415. import CreateFloder from './modalComponebts/CreateFloder.vue'
  416. import FileCollect from './modalComponebts/FileCollect.vue'
  417. import FolderReName from './modalComponebts/FolderReName.vue'
  418. import SpaceBig from './modalComponebts/SpaceBig.vue'
  419. import PlaceGridFolder from './components/PlaceGridFolder.vue'
  420. import PalaceGridFile from './components/PalaceGridFile.vue'
  421. import ImgFile from "./jsComponents/ImgFile"
  422. import { Search } from '@element-plus/icons-vue'
  423. import blueLeft from '../../assets/images/blueLeft.png'
  424. import grayRight from "../../assets/images/grayRight.png"
  425. import sort from '../../assets/images/sort.png'
  426. import squre from '../../assets/images/squre.png'
  427. import level1 from "@/assets/images/level1.png";
  428. import level2 from "@/assets/images/level2.png";
  429. import level3 from "@/assets/images/level3.png";
  430. import level4 from "@/assets/images/level4.png";
  431. import { ElMessage ,ElLoading } from 'element-plus'
  432. import ImgPreview from '@/components/ImgPreview/ImgPreview.vue'
  433. import { preview } from "@/api/common/common.js";
  434. import historyList from "@/components/historyList/index.vue"; //选择文件发送的列表,历史版本
  435. import inputPassword from "./components/inputPassword.vue"; //选择文件发送的列表,历史版本
  436. import { listVersion } from "@/api/biz/version";
  437. import useUserStore from "@/store/modules/user";
  438. import { useRouter, useRoute,onBeforeRouteUpdate } from "vue-router";
  439. import { canPreviewFile,rightMenuRole,publicRightMenuRole } from "@/utils/index.js"
  440. import fileSpace from '../../api/filespace/fileSpace';
  441. import { getLeveldetail } from '../../api/level/level';
  442. import { encrypt, decrypt } from "@/utils/jsencrypt";
  443. import ordinaryList from "@/assets/images/ordinaryList.png";
  444. import ordinary from "@/assets/images/ordinary.png";
  445. import PathLabel from '@/components/PathLabel/index.vue'
  446. import fileStyle from "@/assets/images/fileStyle.png";
  447. import fileBox from "@/assets/images/fileBox.png";
  448. import Cookies from "js-cookie";
  449. import { getLevel } from '@/api/level/level.js';
  450. import elTableInfiniteScroll from 'el-table-infinite-scroll'
  451. import { getConfigKey } from "@/api/system/config.js"
  452. export default {
  453. directives: {
  454. 'el-table-infinite-scroll': elTableInfiniteScroll
  455. },
  456. setup() {
  457. const { proxy } = getCurrentInstance();
  458. const levelList = ref()
  459. let fileTrees = ref(false)//filetree父传子
  460. let thanks = ref(false)//transfer父传子
  461. let collects = ref(false)//文件收藏父传子
  462. let rename = ref(false)//文件夹重命名
  463. let spaces = ref(false)//空间扩容父传子
  464. let folderCase = ref(false)
  465. let fileGrid = ref(sessionStorage.getItem('fileGrid') || 1)
  466. let folderGrid = ref(true)
  467. let editOnline = ref(true)
  468. let searchFire = ref('')
  469. let selectedIndex = ref(0)
  470. let folder = ref(['1'])
  471. let files = ref(['2'])
  472. let folderList = ref([])
  473. let cliCC = ref(false)
  474. let anyP = ref(false)
  475. let uploadModal = ref(false)
  476. let collectImg = ref(true)
  477. let selectedBox = ref(-1)
  478. let clickRowId = ref(0)
  479. let trandata = ref()
  480. let folderId = ref('')
  481. let fileId = ref('')
  482. let tranvalue = ref([])
  483. let useSpace = ref(0)
  484. let allSpace = ref(0)
  485. let fileArr = ref([])
  486. const leftNewFile = ref(false) //解决左侧点击后不能显示的问题
  487. let copyDirId = ref(0)//需要操作的dirid
  488. let copySpaceId = ref(0)//需要操作的spaceid
  489. let copyDocId = ref(0)//需要操作的docid
  490. let copyFileId = ref(0)//需要操作的fileid
  491. let copyFileSize = ref(0)//需要操作的filesize
  492. let copyFileType = ref('')//需要操作的文件类型
  493. let copyFileName = ref("")//需要操作的文件名
  494. let copyFolderName = ref("")
  495. let copySpaceCup = ref(0)
  496. let directoryId = ref('')
  497. let impSpaceId = ref("")
  498. let impDirId = ref("")
  499. let impNum = ref(0)
  500. let copyParentId = ref("")//文件夹
  501. let needBag = ref("")
  502. let copyOrMove = ref(0)//0代表复制,1代表移动
  503. let oneOrTwo = ref(0)//0代表二级,1代表一级
  504. let sortNum = ref(0)
  505. let folderTotal = ref(0)//文件夹total
  506. let fileTotal = ref(0)//文件total
  507. const openForwardFile = ref(false) //历史版本展示
  508. const delMoreFile = ref([]) //删除多个文件夹
  509. const historyTotal = ref(0)
  510. const historyPrew = ref(false)
  511. let xz = ref(0)
  512. let yz = ref(0)
  513. const router = useRouter(); //注册路由
  514. const route = useRoute(); //注册路由
  515. const fileUserTreeData = reactive({ data: {} });
  516. const loadingUpload = ref(false);//文件上传加载
  517. let fileList = ref()
  518. let menuList = ref([
  519. {
  520. name: "我的空间",
  521. choose: "我的空间"
  522. }
  523. ])
  524. let useMenu = ref([
  525. // {
  526. // img: ImgFile.copy,
  527. // name: "复制"
  528. // },
  529. // {
  530. // img: ImgFile.clipboard,
  531. // name: "粘贴"
  532. // },
  533. // {
  534. // img: ImgFile.share,
  535. // name: "分享给"
  536. // },
  537. {
  538. img: ImgFile.trash,
  539. name: "删除"
  540. },
  541. ])
  542. let arrorMenu = ref([
  543. {
  544. img: ImgFile.file,
  545. name: "文件"
  546. },
  547. {
  548. img: ImgFile.folder,
  549. name: '文件夹'
  550. },
  551. {
  552. img: ImgFile.image,
  553. name: "图片"
  554. },
  555. {
  556. img: ImgFile.filmSlate,
  557. name: "视频"
  558. },
  559. {
  560. img: ImgFile.musicNotes,
  561. name: "音频"
  562. }
  563. ])
  564. let mouseCli = ref([
  565. {
  566. img: ImgFile.previewIcon,
  567. name: "预览"
  568. },
  569. {
  570. img: ImgFile.addolder,
  571. name: "移动到...",
  572. },
  573. {
  574. img: ImgFile.copy,
  575. name: "复制到...",
  576. },
  577. // {
  578. // img: ImgFile.clipboard,
  579. // name: "粘贴"
  580. // },
  581. {
  582. img: ImgFile.collect,
  583. name: "收藏"
  584. },
  585. {
  586. img: ImgFile.downLoad,
  587. name: "下载"
  588. },
  589. {
  590. img: ImgFile.textbox,
  591. name: "重命名"
  592. },
  593. // {
  594. // img: ImgFile.goon,
  595. // name: "发送"
  596. // },
  597. {
  598. img: ImgFile.share,
  599. name: "分享"
  600. },
  601. {
  602. img: ImgFile.notePencil,
  603. name: "在线编辑"
  604. },
  605. {
  606. img: ImgFile.icc,
  607. name: "文字识别"
  608. },
  609. {
  610. img: ImgFile.history,
  611. name: "历史版本"
  612. },
  613. {
  614. img: ImgFile.trash,
  615. name: "删除"
  616. }
  617. ])
  618. let nameForm = ref({
  619. name: ""
  620. })
  621. let ordinaryFolder = ref([ {
  622. img: ImgFile.previewIcon,
  623. name: "预览"
  624. },
  625. {
  626. img: ImgFile.collect,
  627. name: "收藏"
  628. },
  629. {
  630. img: ImgFile.downLoad,
  631. name: "下载"
  632. },
  633. ])
  634. let fileNameChange = ref(false)
  635. let fileMenu = ref([])
  636. let copyRow = ref({})
  637. let newDirId = ref('')
  638. let newSpaceId = ref('')
  639. let workOrEdit = ref(0)
  640. const showPreview = ref(false)//控制图片预览组件显示
  641. const previewData = ref()//需要预览的文件的数据
  642. const folderVisible = ref(false); //显示文件夹右键菜单
  643. const foldertop = ref(0);
  644. const folderleft = ref(0);
  645. const thisFolder = ref({}); //当前右键的文件夹
  646. const folderCheckout = ref(false)//是否有勾选
  647. const fileCheckout = ref(false)//是否有勾选
  648. const haveCheck = ref(false)//是否有勾选
  649. const onlyView = ref(false) //预览
  650. const topPath = ref()//顶部路径
  651. const isFolder = ref('N') //是否为文件夹
  652. const clickRow = ref()//当前右键的行数据
  653. const backFolder = ref()//上一级的文件夹
  654. const thisFolderRole = ref({})//文件夹安全等级
  655. const thisRole = ref([])//文件夹权限
  656. const showInputPassword = ref(false)
  657. const chooseRow = ref()
  658. const chooseNum = ref()
  659. const loadingPreview = ref(false)
  660. const noMenuItem = ref(false)
  661. const addTab = inject("addTab");
  662. const addFileTab = inject("addFileTab");
  663. const addFolderAdd = inject("addFolderAdd");
  664. const filePageNum = ref(1) //获取文件分页
  665. const spaceName = ref()
  666. const tableBeEnd = ref(true)//控制下拉是否到底
  667. const tableTotal = ref(0)//表格数据总数
  668. const isDept = ref(false)// 是否管理员
  669. const maxFileSize = ref()//能上传的最大size
  670. const pathLabelData = ref([
  671. ])
  672. //控制宫格展示
  673. const isList = ref(false); //控制显示方式
  674. const changeShow = (fileGrids) => {
  675. // isList.value = !isList.value;
  676. // fileGrid.value = fileGrids
  677. // folderGrid.value = fileGrids;
  678. if(fileGrid.value == 1){
  679. fileGrid.value = 0
  680. }else{
  681. fileGrid.value = 1
  682. }
  683. sessionStorage.setItem('fileGrid',fileGrid.value)
  684. };
  685. const upFolderData = ref()// 修改的文件夹的数据
  686. // 获取文件夹,中栏,文件
  687. function getAllTop() {
  688. documents.getTop(1).then(res => {
  689. console.log('getAllTopres',res);
  690. if(!res){
  691. console.log('nores');
  692. return
  693. }
  694. let userMe = [res]
  695. impDirId.value = userMe[0].dirId//固定
  696. impSpaceId.value = userMe[0].spaceId//固定
  697. newSpaceId.value = userMe[0].spaceId//变化
  698. newDirId.value = userMe[0].dirId//变化
  699. topPath.value = userMe[0].dirPath
  700. spaceName.value = userMe[0].dirPath
  701. let obj = {
  702. pageNum: 1,
  703. pageSize: 10
  704. }
  705. documents.getALLdocumentByType({ parentId: userMe[0].dirId - 0, spaceId: userMe[0].spaceId, pageNum: obj.pageNum, pageSize: obj.pageSize },1).then(res => {
  706. fileMenu.value = res.data
  707. folderList.value = res.data
  708. },1)
  709. myfile.getById(userMe[0].dirId - 0, obj).then(res => {
  710. if (res.code === 200) {
  711. fileList.value = res.rows
  712. fileTotal.value = res.total
  713. if (fileTotal.value / 10 != 1) {
  714. let x = Math.trunc(fileTotal.value / 10) + 1
  715. for (var i = 1; i <= x; i++) {
  716. obj.pageNum = i
  717. myfile.getById(userMe[0].dirId - 0, obj).then(res => {
  718. fileList.value = fileList.value.concat(res.rows)
  719. const uniqueFileList = Array.from(new Set(fileList.value.map(item => item.docId)))
  720. .map(docId => fileList.value.find(item => item.docId === docId));
  721. // 合并数组并更新 fileList.value
  722. fileList.value = uniqueFileList
  723. })
  724. }
  725. }
  726. // console.log('fileList.value',fileList.value);
  727. }
  728. // console.log('not200');
  729. })
  730. })
  731. }
  732. function getSpaceList() {
  733. myfile.fileType(1).then(res => {
  734. useSpace.value = res.data.usedCap
  735. allSpace.value = res.data.spaceCap
  736. })
  737. }
  738. function fileBlur() {
  739. if (searchFire.value == '') {
  740. getAllTop()
  741. } else {
  742. const searchTerm = searchFire.value.trim().toLowerCase(); // 转换为小写字母并去除首尾空格
  743. fileMenu.value = fileMenu.value.filter(item => {
  744. const dirName = item.dirName.trim();
  745. return dirName.includes(searchTerm);
  746. });
  747. }
  748. }
  749. function changeFile(row, num) {
  750. const addData = {
  751. path:'/publicment'+row.dirId,
  752. name:row.dirName,
  753. clickRowId:toRaw(row)
  754. }
  755. addFolderAdd(addData) //加了这句代码界面会渲染两次
  756. thisFolder.value = row
  757. // console.log('row2',row);
  758. // topPath.value = row.dirPath
  759. if(row.isEncrypt === "Y" && row.encryptLevel){
  760. getLeveldetailFn(row.encryptLevel)
  761. }else{
  762. thisFolderRole.value = {}
  763. }
  764. thisRole.value = row.dirRole?row.dirRole.split(','):[]
  765. copyParentId.value = row.parentId
  766. newDirId.value = row.dirId
  767. newSpaceId.value = row.spaceId
  768. documents.getALLdocumentByType({ parentId: row.dirId - 0, spaceId: row.spaceId - 0 },1).then(res => {
  769. folderList.value = res.data
  770. // if (res.code === 200) {
  771. if (res.data.length === 0) {
  772. myfile.getById(newDirId.value)
  773. .then(res => {
  774. if (res.code === 200) {
  775. fileList.value = res.rows;
  776. }
  777. })
  778. .catch(error => {
  779. console.error("myfile.getAllFileMenu 调用失败:", error);
  780. });
  781. } else {
  782. myfile.getById(row.dirId - 0)
  783. .then(res => {
  784. if (res.code === 200) {
  785. fileList.value = res.rows;
  786. }
  787. })
  788. .catch(error => {
  789. console.error("myfile.getAllFileMenu 调用失败:", error);
  790. });
  791. }
  792. // }
  793. })
  794. selectedIndex.value = num
  795. const newItem = {
  796. name: row.dirName,
  797. choose: row.dirName,
  798. dirIds: row.dirId,
  799. spaceIds: row.spaceId
  800. };
  801. // 检查 newItem 是否已存在于 menuList 中
  802. const isItemExist = menuList.value.some(item => item.choose === newItem.choose);
  803. // 如果不存在,则添加它
  804. if (!isItemExist) {
  805. menuList.value.push(newItem);
  806. }
  807. }
  808. // x图标事件
  809. function shotdown(row) {
  810. menuList.value = menuList.value.filter(item => item.name !== row.name)
  811. selectedIndex.value = -1
  812. if (!editOnline.value) {
  813. editOnline.value = true
  814. }
  815. }
  816. // 文件名表格每一行点击事件
  817. function handleRowClick(row, col, e) {
  818. console.log('row',row);
  819. isFolder.value = "N"
  820. clickRow.value = row
  821. e.preventDefault();
  822. e.stopPropagation();
  823. xz.value = e.pageX
  824. yz.value = e.pageY
  825. copyRow.value = row
  826. clickRowId.value = row.docId
  827. copyDirId.value = row.dirId
  828. copySpaceId.value = row.spaceId
  829. copyFileId.value = row.fileId
  830. copyFileSize.value = row.fileSize
  831. copyFileType.value = row.fileType
  832. nameForm.value.name = row.fileName
  833. copyFileName.value = row.fileName
  834. if (cliCC.value === true) {
  835. cliCC.value = false
  836. } else {
  837. cliCC.value = true
  838. }
  839. }
  840. // 申请扩容
  841. async function askApply() {
  842. const res = await fileSpace.querySpace(impSpaceId.value)
  843. console.log('res',res);
  844. if(res.data){
  845. ElMessage({ message: '已存在扩容申请', type: 'error' })
  846. return
  847. }
  848. spaces.value = true
  849. }
  850. //mouse弹框
  851. async function chooseSet(row, index, num) {
  852. // 权限控制
  853. if(thisFolderRole.value && thisFolderRole.value.roles){
  854. if(thisFolderRole.value.roles.l0600){
  855. const passArr = localStorage.getItem('passArr');
  856. const passArrObj = JSON.parse(passArr)
  857. if((!passArrObj) || !passArrObj.some(item=>item === clickRow.value.docId)){
  858. chooseRow.value = row
  859. chooseNum.value = num
  860. showInputPassword.value = true
  861. return
  862. }
  863. // console.log('needc');
  864. }
  865. }
  866. // console.log('chooseSetrow',row);
  867. // console.log('chooseSetnum',num);
  868. if (row.name == '在线编辑' || row.name == '协作') {
  869. cliCC.value = true
  870. }
  871. if (row.name == '分享') {
  872. workOrEdit.value = num
  873. thanks.value = true
  874. } else {
  875. thanks.value = false
  876. }
  877. if (row.name == '协作') {
  878. workOrEdit.value = num
  879. if (anyP.value) {
  880. anyP.value = false
  881. } else {
  882. anyP.value = true
  883. }
  884. } else {
  885. anyP.value = false
  886. }
  887. if (row.name == '删除') {
  888. myfile.delMenu(clickRowId.value).then(res => {
  889. if (res.code === 200) {
  890. ElMessage({
  891. type: "success",
  892. message: "删除成功"
  893. })
  894. refreshFile()
  895. }
  896. })
  897. }
  898. if (row.name === '复制到...') {
  899. copyOrMove.value = 0
  900. fileTrees.value = true
  901. }
  902. if (row.name === '移动到...') {
  903. copyOrMove.value = 1
  904. fileTrees.value = true
  905. }
  906. if (row.name === '重命名') {
  907. fileNameChange.value = true
  908. }
  909. if (row.name === "下载") {
  910. // location.href = `${import.meta.env.VITE_APP_BASE_API}/api/download/${copyFileId.value}`;
  911. downLoadfile()
  912. }
  913. if (row.name === '收藏') {
  914. if(clickRow.value.isFavorite === "Y"){
  915. return ElMessage({
  916. type: "error",
  917. message: "请勿重复收藏"
  918. })
  919. }
  920. collects.value = true
  921. }
  922. if (row.name === '在线编辑') {
  923. loadingPreview.value = true
  924. // const filePreview = canPreviewFile(copyFileType.value)
  925. // if (filePreview) {
  926. loadingPreview.value = false
  927. if(thisFolderRole.value &&thisFolderRole.value.roles&& thisFolderRole.value.roles.l0800){
  928. addFileTab(clickRow.value, 1,1);
  929. }else{
  930. addFileTab(clickRow.value, 1,0);
  931. }
  932. onlyView.value = false
  933. // editOnline.value = false
  934. cliCC.value = false
  935. // } else {
  936. // const res = await preview(copyRow.value.docId)
  937. // showPreview.value = true
  938. // previewData.value = URL.createObjectURL(res)
  939. // }
  940. loadingPreview.value = false
  941. }
  942. if (row.name === '文字识别') {
  943. router.push({
  944. path: '/identifyFont',
  945. query: {
  946. docId: copyRow.value.docId,
  947. fileId: copyFileId.value,
  948. fileType: copyFileType.value
  949. }
  950. })
  951. }
  952. if (row.name === '预览') {
  953. loadingPreview.value = true
  954. const filePreview = canPreviewFile(copyFileType.value)
  955. if (filePreview) {
  956. loadingPreview.value = false
  957. if(thisFolderRole.value &&thisFolderRole.value.roles&& thisFolderRole.value.roles.l0800){
  958. addFileTab(clickRow.value, 0,1);
  959. }else{
  960. addFileTab(clickRow.value, 0,0);
  961. }
  962. onlyView.value = true
  963. cliCC.value = false
  964. } else {
  965. const res = await preview(copyRow.value.docId)
  966. showPreview.value = true
  967. previewData.value = URL.createObjectURL(res)
  968. }
  969. loadingPreview.value = false
  970. console.log('filePreview', filePreview);
  971. // // console.log('res',res);
  972. // const res = await preview(copyFileId.value)
  973. // showPreview.value = true
  974. // previewData.value = URL.createObjectURL(res)
  975. } else if (row.name === "历史版本") {
  976. const resHistory = await listVersion({ docId: clickRowId.value })
  977. // console.log('resHistory',resHistory);
  978. historyTotal.value = resHistory.total
  979. fileUserTreeData.data = resHistory.rows;
  980. openForwardFile.value = true
  981. }
  982. }
  983. function chooseSet1(num) {
  984. workOrEdit.value = num
  985. thanks.value = true
  986. anyP.value = false
  987. }
  988. function createNewMenu(num,leftNewFiles) {
  989. if (leftNewFiles) {
  990. leftNewFile.value = true //解决左侧点击文件后不显示的问题
  991. }
  992. upFolderData.value = null
  993. oneOrTwo.value = num
  994. folderCase.value = true
  995. }
  996. function cancleHistoryPrew(val) {
  997. historyPrew.value = false
  998. }
  999. function createNewFile() {
  1000. addFile.value = true
  1001. }
  1002. function arrowClick(row, num) {
  1003. if (row.name === '文件') {
  1004. uploadModal.value = true
  1005. } else {
  1006. uploadModal.value = false
  1007. }
  1008. }
  1009. // 确认上传
  1010. function sureUpload() {
  1011. loadingUpload.value = true;
  1012. if (fileArr.value.length > 0) {
  1013. for (var i = 1; i <= fileArr.value.length; i++) {
  1014. myfile.uploadFile({
  1015. spaceId: newSpaceId.value - 0,
  1016. dirId: newDirId.value - 0,
  1017. file: fileArr.value[i - 1]
  1018. }).then(res => {
  1019. if (res.code === 200) {
  1020. ElMessage({
  1021. message: "上传文件成功",
  1022. type: "success"
  1023. })
  1024. refreshFile()
  1025. uploadModal.value = false
  1026. loadingUpload.value = false;
  1027. fileArr.value = []
  1028. }
  1029. }).catch(err => {
  1030. loadingUpload.value = false;
  1031. fileArr.value = []
  1032. })
  1033. }
  1034. } else {
  1035. loadingUpload.value = false;
  1036. return ElMessage({ message: "请选择文件", type: "error" })
  1037. }
  1038. }
  1039. function onSuccess(files, val) {
  1040. fileArr.value.push(files.file)
  1041. } //关闭文件上传
  1042. const closeUpload =() =>{
  1043. uploadModal.value = false;
  1044. fileArr.value = [];
  1045. loadingUpload.value = false
  1046. }
  1047. // 移除上传的某些文件
  1048. const handleRemove = (file,rawFile) => {
  1049. fileArr.value = [...rawFile]
  1050. }
  1051. // 筛选后缀图片
  1052. function getImage(file) {
  1053. if (file === '.txt') {
  1054. return ImgFile.txt
  1055. } else if (file === '.xlxs' || file === '.docx') {
  1056. return ImgFile.xlxs
  1057. } else if (file === '.pptx') {
  1058. return ImgFile.pptx
  1059. } else if (file === '.word') {
  1060. return ImgFile.word
  1061. } else if (file === '.pdf') {
  1062. return ImgFile.pdf
  1063. }
  1064. }
  1065. // 表格多选框
  1066. function handleSelectionChange(val) {
  1067. delMoreFile.value = val //删除多项的数据
  1068. // if (val.length > 1) {
  1069. // // 如果选择了多项,只保留最后一项
  1070. // val.shift();
  1071. // }
  1072. if (val.length === 1) {
  1073. fileId.value = val[0].docId
  1074. }
  1075. if (val.length) {
  1076. folderCheckout.value = true
  1077. haveCheck.value = true
  1078. } else {
  1079. folderCheckout.value = false
  1080. if (!fileCheckout.value) {
  1081. haveCheck.value = false
  1082. }
  1083. }
  1084. }
  1085. // 文件夹
  1086. function handleSelectionChange1(val) {
  1087. delMoreFile.value = val //删除多项的数据
  1088. if (val.length > 1) {
  1089. // 如果选择了多项,只保留最后一项
  1090. val.shift();
  1091. proxy.$refs.taskTableRef.toggleRowSelection(val.shift(), false);//单选操作
  1092. }
  1093. if (val.length === 1) {
  1094. folderId.value = val[0]
  1095. }
  1096. if (val.length) {
  1097. fileCheckout.value = true
  1098. haveCheck.value = true
  1099. } else {
  1100. fileCheckout.value = false
  1101. if (!folderCheckout.value) {
  1102. haveCheck.value = false
  1103. }
  1104. }
  1105. }
  1106. // 重命名
  1107. function restName(row, index) {
  1108. // 判断是点击打开还是右键菜单打开
  1109. row = row ? row : clickRow.value
  1110. copyFolderName.value = row.dirName
  1111. selectedBox.value = row.dirId
  1112. rename.value = true
  1113. }
  1114. function getMenu(row, num) {
  1115. if (row.name === '删除') {
  1116. const datas = []
  1117. const isFile = ref(false)
  1118. delMoreFile.value.map(i => {//多选删除
  1119. if (i.parentId) {//文件
  1120. isFile.value = true
  1121. } else {//文件夹
  1122. datas.push(i.docId)
  1123. }
  1124. })
  1125. if(folderId.value.dirType === '2'){
  1126. return ElMessage({
  1127. message: "删除失败,组织目录不可删除",
  1128. type: "error"
  1129. })
  1130. }
  1131. // 文件夹删除
  1132. if (isFile.value) {//文件
  1133. documents.delDocument(folderId.value.dirId).then(res => {
  1134. if (res.code === 200) {
  1135. ElMessage({
  1136. message: "删除成功",
  1137. type: "success"
  1138. })
  1139. refreshFile()
  1140. } else {
  1141. ElMessage({
  1142. message: "删除失败,目录应不为空",
  1143. type: "error"
  1144. })
  1145. }
  1146. isFile.value = false
  1147. })
  1148. } else {
  1149. myfile.delMenu(datas.toString()).then(res => {
  1150. if (res.code === 200) {
  1151. ElMessage({
  1152. message: "删除成功",
  1153. type: "success"
  1154. })
  1155. refreshFile()
  1156. }
  1157. })
  1158. }
  1159. }
  1160. }
  1161. function delName(row, num) {
  1162. documents.delDocument(row.dirId).then(res => {
  1163. if (res.code === 200) {
  1164. getAllTop()
  1165. ElMessage({
  1166. message: "删除成功",
  1167. type: "success"
  1168. })
  1169. }
  1170. })
  1171. }
  1172. // 计算百分比
  1173. function percent() {
  1174. let numP = 0;
  1175. if (useSpace.value && allSpace.value) {
  1176. numP = (useSpace.value / allSpace.value) * 100;
  1177. }
  1178. return numP.toFixed(2) - 0; // 将结果保留两位小数
  1179. }
  1180. // 文件夹每行点击事件
  1181. function folderClick(row, list,e,jump) {
  1182. if(!pathLabelData.value[0]){
  1183. // 创建标签
  1184. const addData = {
  1185. path: '/publicment' + row.dirId,
  1186. name: row.dirName,
  1187. clickRowId: toRaw(row)
  1188. }
  1189. addFolderAdd(addData)
  1190. }
  1191. // 初始化分页数据
  1192. tableBeEnd.value = true
  1193. filePageNum.value = 1
  1194. tableTotal.value = 0
  1195. // 上一级dirId就是下一级的parentId
  1196. // 判断是点击打开还是右键菜单打开
  1197. if(row){
  1198. backFolder.value = thisFolder.value
  1199. thisFolder.value = row;
  1200. if(pathLabelData.value[0]){
  1201. // 有值就说明是二级及以后的数据
  1202. const oldArr = toRaw(pathLabelData.value)
  1203. // console.log('oldArr',oldArr);
  1204. let newArr
  1205. console.log('jump',jump);
  1206. if(jump == undefined){
  1207. newArr = oldArr.push({
  1208. name:toRaw(row).dirName,
  1209. dirId:toRaw(row).dirId
  1210. })
  1211. }else{ // jump有值说明是点击过来的 后面的要截取掉
  1212. newArr = oldArr.splice(jump+1)
  1213. }
  1214. console.log('newArr',newArr);
  1215. pathLabelData.value = JSON.parse(JSON.stringify(oldArr))
  1216. }
  1217. }else{
  1218. row =thisFolder.value
  1219. }
  1220. if(row.isEncrypt === "Y" && row.encryptLevel){
  1221. getLeveldetailFn(row.encryptLevel)
  1222. }else{
  1223. thisFolderRole.value = {}
  1224. }
  1225. thisRole.value = row.dirRole?row.dirRole.split(','):[]
  1226. console.log('row1', toRaw(row));
  1227. // topPath.value = row.dirPath
  1228. // console.log('topPath',toRaw(topPath.value));
  1229. newDirId.value = row.dirId
  1230. newSpaceId.value = row.spaceId
  1231. const query = `${newDirId.value}?pageSize=10&pageNum=${filePageNum.value}`
  1232. documents.getALLdocumentByType({
  1233. parentId: newDirId.value - 0,
  1234. spaceId: newSpaceId.value - 0
  1235. },1).then(res => {
  1236. folderList.value = res.data
  1237. if (res.data.length === 0) {
  1238. myfile.getById(query).then(res => {
  1239. if (res.code === 200) {
  1240. tableTotal.value =res.total
  1241. if(res.rows.length<res.total){
  1242. //第一次拿到的数据少于总数开启下拉事件
  1243. tableBeEnd.value = false
  1244. }
  1245. fileList.value = res.rows
  1246. }
  1247. })
  1248. } else {
  1249. myfile.getById(query).then(res => {
  1250. console.log('folerFile',res);
  1251. if (res.code === 200) {
  1252. tableTotal.value =res.total
  1253. if(res.rows.length<res.total){
  1254. //第一次拿到的数据少于总数开启下拉事件
  1255. tableBeEnd.value = false
  1256. }
  1257. fileList.value = JSON.parse(JSON.stringify(res.rows))
  1258. // console.log('fileList',toRaw(fileList.value));
  1259. }
  1260. })
  1261. }
  1262. })
  1263. }
  1264. // 确认文件重命名
  1265. function sureChangeName() {
  1266. myfile.editNewMenu({
  1267. dirId: copyDirId.value - 0,
  1268. docId: clickRowId.value - 0,
  1269. fileId: copyFileId.value,
  1270. fileName: nameForm.value.name,
  1271. fileSize: copyFileSize.value - 0,
  1272. fileType: copyFileType.value,
  1273. remark: '',
  1274. spaceId: copySpaceId.value - 0,
  1275. }).then(res => {
  1276. if (res.code === 200) {
  1277. ElMessage({
  1278. message: "重命名成功",
  1279. type: "success"
  1280. })
  1281. fileNameChange.value = false
  1282. refreshFile()
  1283. }
  1284. })
  1285. }
  1286. // 判断id
  1287. function isId() {
  1288. if (directoryId.value === '') {
  1289. directoryId.value = 0
  1290. getAllTop()
  1291. }
  1292. if (folderId.value === '') {
  1293. folderId.value = 0
  1294. getAllTop()
  1295. }
  1296. }
  1297. //关闭图片预览事件
  1298. const closeImgPreview = () => {
  1299. // console.log('close');
  1300. showPreview.value = false
  1301. }
  1302. function getChildren(data) {
  1303. fileTrees.value = data
  1304. refreshFile()
  1305. }
  1306. function getCback(data) {
  1307. thanks.value = data
  1308. }
  1309. function getChildrenC(data) {
  1310. folderCase.value = data
  1311. }
  1312. function getCollects(data) {
  1313. collects.value = data
  1314. }
  1315. function getRename(data) {
  1316. rename.value = data
  1317. }
  1318. function getSpaceC(data) {
  1319. spaces.value = data
  1320. }
  1321. function navBack(data, name) {
  1322. nameForm.value.name = name
  1323. fileNameChange.value = data
  1324. }
  1325. function onlineCase(data, uid, row) {
  1326. editOnline.value = data
  1327. clickRowId.value = uid
  1328. copyRow = row
  1329. }
  1330. function shareBack(data, num) {
  1331. thanks.value = data
  1332. workOrEdit.value = num
  1333. }
  1334. function showFile(data, e, a) {
  1335. editOnline.value = data
  1336. clickRowId.value = e
  1337. copyRow = a
  1338. }
  1339. function folderBack(dir, spa, nam) {
  1340. selectedBox.value = dir
  1341. copyFolderName.value = nam
  1342. copyFileName.value = spa
  1343. }
  1344. //历史版本
  1345. const forwardTreeData = reactive({ data: {} });
  1346. const historycopyRow = ref({})
  1347. function changeMsgClose(val, item) {
  1348. if (val) {
  1349. historycopyRow.value = item
  1350. editOnline.value = false
  1351. cliCC.value = false
  1352. historyPrew.value = true
  1353. }
  1354. openForwardFile.value = val
  1355. }
  1356. function lastBB(data, row, num) {
  1357. openForwardFile.value = data
  1358. historyTotal.value = row
  1359. fileUserTreeData.data = num
  1360. }
  1361. //对mouseCli数组进行筛选,实现菜单的区分显示
  1362. const filterMouseCli = () => {
  1363. const canPreviewArray = ['.doc','.dps','.et','.wps', '.docm', '.docx', '.dot', '.dotm', '.dotx', '.epub', '.fodt', '.htm', '.html', '.mht', '.odt', '.ott', '.pdf', '.rtf', '.txt', '.djvu', '.xps', '.csv', '.fods', '.ods', '.ots', '.xls', '.xlsm', '.xlsx', '.xlt', '.xltm', '.xltx', '.fodp', '.odp', '.otp', '.pot', '.potm', '.potx', '.pps', '.ppsm', '.ppsx', '.ppt', '.pptm', '.pptx']
  1364. const typeArr = ['.png', '.jpg', '.jpeg', '.JPG', '.mp3', '.mp4']
  1365. const imgTypeArr = ['.png', '.jpg', '.jpeg', '.JPG']
  1366. const canEditArr = ['.doc', '.dps','.et','.docm', '.docx', '.dot', '.dotm', '.dotx', '.txt', '.djvu', '.xps', '.csv', '.fods', '.ods', '.ots', '.xls', '.xlsm', '.xlsx', '.xlt', '.xltm', '.xltx', '.fodp', '.odp', '.otp','.doc', '.docm', '.docx', '.dot', '.dotm', '.dotx', '.epub', '.fodt', '.htm', '.html', '.mht', '.odt', '.ott', '.rtf', '.txt', '.djvu', '.xps', '.wps','.pptx']
  1367. let arr = []
  1368. if (!(typeArr.includes(copyFileType.value) || canPreviewArray.includes(copyFileType.value))) {
  1369. arr = mouseCli.value.filter(item => item.name !== "预览")
  1370. } else {
  1371. arr = toRaw(mouseCli.value)
  1372. }
  1373. if (!canEditArr.includes(copyFileType.value)) {
  1374. arr = arr.filter(item => item.name !== "在线编辑" && item.name !== "协作" && item.name !== "历史版本")
  1375. }
  1376. if (clickRow.value.isFiled === "Y") {
  1377. arr = arr.filter(item => item.name !== "在线编辑" && item.name !== "协作")
  1378. }
  1379. if (!imgTypeArr.includes(copyFileType.value)) {
  1380. arr = arr.filter(item => item.name !== "文字识别")
  1381. }
  1382. // console.log('arr',arr);
  1383. if(thisFolderRole.value.roles){
  1384. console.log('thisFolderRole',thisFolderRole.value);
  1385. arr = rightMenuRole(toRaw(thisFolderRole.value),arr)
  1386. }
  1387. if(thisRole.value.length){
  1388. arr = publicRightMenuRole(toRaw(thisRole.value),arr)
  1389. }
  1390. // console.log('thisFolder',thisFolder.value);
  1391. if(thisFolder.value.dirType == '1'&& !isDept.value){
  1392. arr = ordinaryFolder.value
  1393. }
  1394. if(arr.length<1){
  1395. noMenuItem.value = true
  1396. }else{
  1397. noMenuItem.value = false
  1398. }
  1399. console.log('filterArr',arr);
  1400. return arr
  1401. }
  1402. function mouseClick() {
  1403. if (cliCC.value) {
  1404. cliCC.value = false
  1405. }
  1406. if (anyP) {
  1407. anyP.value = false
  1408. }
  1409. }
  1410. // 文件夹右键事件
  1411. const folderRClick = (row, col, e) => {
  1412. e.preventDefault();
  1413. e.stopPropagation();
  1414. // thisFolder.value = '' //先清空
  1415. let thisRow = toRaw(row)
  1416. // console.log('thisFolder',thisFolder.value);
  1417. clickRow.value = thisRow
  1418. copyFolderName.value = row.dirName
  1419. // 唤出右键菜单,思路:获取鼠标位置来定位菜单
  1420. folderVisible.value = true;
  1421. foldertop.value = e.pageY;
  1422. folderleft.value = e.pageX;
  1423. };
  1424. // 关闭文件夹右键菜单
  1425. const closeRMenu = () => {
  1426. // console.log("close");
  1427. folderVisible.value = false;
  1428. };
  1429. // 文件夹收藏事件
  1430. const collectFolder = () => {
  1431. if(clickRow.value.isFavorite === "Y"){
  1432. return ElMessage({
  1433. type: "error",
  1434. message: "请勿重复收藏"
  1435. })
  1436. }
  1437. isFolder.value = 'Y'
  1438. // clickRow.value = thisFolder.value
  1439. // thisFolder.value = ''
  1440. copyFileName.value = clickRow.value.dirName
  1441. collects.value = true
  1442. }
  1443. // 左箭头事件
  1444. const arrowLift =async () => {
  1445. // router.go(-1)
  1446. // console.log(1);
  1447. topPath.value = backFolder.value.dirPath
  1448. // console.log('topPath',toRaw(topPath.value));
  1449. newDirId.value = backFolder.value.parentId
  1450. newSpaceId.value = backFolder.value.spaceId
  1451. documents.getALLdocumentByType({
  1452. parentId: newDirId.value - 0,
  1453. spaceId: newSpaceId.value - 0
  1454. },1).then(res => {
  1455. folderList.value = res.data
  1456. if (res.data.length === 0) {
  1457. myfile.getById(newDirId.value).then(res => {
  1458. if (res.code === 200) {
  1459. fileList.value = res.rows
  1460. }
  1461. })
  1462. } else {
  1463. myfile.getById(newDirId.value).then(res => {
  1464. if (res.code === 200) {
  1465. fileList.value = JSON.parse(JSON.stringify(res.rows))
  1466. // console.log('fileList',toRaw(fileList.value));
  1467. }
  1468. })
  1469. }
  1470. })
  1471. }
  1472. // 归档
  1473. async function goLock() {
  1474. console.log('goLockclickRow',clickRow.value);
  1475. const res = await documentation(clickRow.value.docId)
  1476. console.log('res',res);
  1477. if(res.code == 200){
  1478. ElMessage({
  1479. type: "success",
  1480. message: "成功归档"
  1481. })
  1482. }
  1483. cliCC.value = false
  1484. anyP.value = false
  1485. refreshFile()
  1486. }
  1487. function formatFileSize(fileSize) {
  1488. if (fileSize >= 1024 * 1024 * 1024) {
  1489. // 大于等于1GB,显示GB
  1490. return (fileSize / (1024 * 1024 * 1024)).toFixed(2) + 'GB';
  1491. } else if (fileSize >= 1024 * 1024) {
  1492. // 大于等于1MB,显示MB
  1493. return (fileSize / (1024 * 1024)).toFixed(2) + 'MB';
  1494. } else if (fileSize >= 1024) {
  1495. // 大于等于1KB,显示KB
  1496. return (fileSize / 1024).toFixed(2) + 'KB';
  1497. } else {
  1498. // 小于1KB,显示字节
  1499. return fileSize + 'B';
  1500. }
  1501. }
  1502. function formatStorage(sizeInGB) {
  1503. if (sizeInGB >= 1) {
  1504. return sizeInGB.toFixed(2) + 'GB';
  1505. } else {
  1506. const sizeInMB = sizeInGB * 1024;
  1507. if (sizeInMB >= 1) {
  1508. return sizeInMB.toFixed(2) + 'MB';
  1509. } else {
  1510. const sizeInKB = sizeInMB * 1024;
  1511. return sizeInKB.toFixed(2) + 'KB';
  1512. }
  1513. }
  1514. }
  1515. function gridChange() {
  1516. if (fileGrid.value) {
  1517. fileGrid.value = false
  1518. } else {
  1519. fileGrid.value = true
  1520. }
  1521. if (folderGrid.value) {
  1522. folderGrid.value = false
  1523. } else {
  1524. folderGrid.value = true
  1525. }
  1526. }
  1527. //点击收藏后刷新文件
  1528. const refreshFile = ()=>{
  1529. // console.log('ref',toRaw(thisFolder.value));
  1530. if(toRaw(thisFolder.value).dirId && !leftNewFile.value){//如果点开了文件夹
  1531. // console.log(111);
  1532. folderClick()
  1533. }else{
  1534. // console.log(222);
  1535. getAllTop()
  1536. }
  1537. }
  1538. //star收藏事件
  1539. const collectByStar = (row,isfolder)=>{
  1540. console.log('row',row);
  1541. if(isfolder){
  1542. let thisRow = toRaw(row)
  1543. isFolder.value = 'Y'
  1544. clickRow.value = thisRow
  1545. copyFolderName.value = row.dirName
  1546. copyFileName.value = clickRow.value.dirName
  1547. }else{
  1548. isFolder.value = "N"
  1549. clickRow.value = row
  1550. copyRow.value = row
  1551. clickRowId.value = row.docId
  1552. copyDirId.value = row.dirId
  1553. copyFileName.value = row.fileName
  1554. }
  1555. collects.value = true
  1556. }
  1557. // 取消文件收藏
  1558. const delCollect = async (row,isfolder)=>{
  1559. const thisRow = toRaw(row)
  1560. console.log('thisRow',thisRow);
  1561. let query = {}
  1562. if(isfolder){
  1563. query = {
  1564. isFolder:"Y",
  1565. relaId:thisRow.dirId
  1566. }
  1567. }else{
  1568. query = {
  1569. isFolder:"N",
  1570. relaId:thisRow.docId
  1571. }
  1572. }
  1573. const res = await delFavorite(query)
  1574. //TODO 之后需要重新获取数据 并message提示
  1575. console.log('res',res);
  1576. refreshFile()
  1577. }
  1578. //获取安全图标
  1579. const getLevelImg = (level)=>{
  1580. switch (level) {
  1581. case "L1":
  1582. return level1;
  1583. break;
  1584. case "L2":
  1585. return level2;
  1586. break;
  1587. case "L3":
  1588. return level3;
  1589. break;
  1590. case "L4":
  1591. return level4;
  1592. break;
  1593. return level1;
  1594. break;
  1595. }
  1596. }
  1597. const getLevelList = async ()=>{
  1598. const res = await getLevel()
  1599. if(res.rows){
  1600. levelList.value = res.rows.map(item=>{
  1601. return {
  1602. levelCode:item.levelCode,
  1603. levelName:item.levelName
  1604. }
  1605. })
  1606. console.log('levelList',levelList.value);
  1607. }
  1608. }
  1609. const setTablelevel = (level)=>{
  1610. const thisItem = levelList.value.find(item=>item.levelCode == level)
  1611. if(thisItem){
  1612. return thisItem.levelName
  1613. }else{
  1614. return '未加密'
  1615. }
  1616. }
  1617. //获取权限详情
  1618. const getLeveldetailFn =async (data)=>{
  1619. const res = await getLeveldetail(data)
  1620. // console.log('getLeveldetailFn',res);
  1621. if(res.code === 200){
  1622. thisFolderRole.value = res.data
  1623. }
  1624. // console.log('thisFolderRole',thisFolderRole.value);
  1625. }
  1626. const closeIptPass = ()=>{
  1627. showInputPassword.value = false
  1628. }
  1629. //输入验证密码后
  1630. const surePass = (pass)=>{
  1631. const passwordCookies = Cookies.get("pass");
  1632. // const oldPass = decrypt(passwordCookies)
  1633. // console.log('pass',pass);
  1634. // console.log('oldPass',oldPass);
  1635. // console.log('clickRow',clickRow);
  1636. showInputPassword.value = false
  1637. if(pass === passwordCookies){
  1638. const passArr = localStorage.getItem('passArr');
  1639. // console.log('passArr',passArr);
  1640. if(!passArr){
  1641. const newArr = []
  1642. newArr.push(clickRow.value.docId)
  1643. localStorage.setItem('passArr',JSON.stringify(newArr))
  1644. }else{
  1645. const passArrObj = JSON.parse(passArr)
  1646. passArrObj.push(clickRow.value.docId)
  1647. localStorage.setItem('passArr',JSON.stringify(passArrObj))
  1648. }
  1649. // 设置销毁
  1650. setTimeout(()=>{
  1651. const passArr = localStorage.getItem('passArr');
  1652. const passArrObj = JSON.parse(passArr)
  1653. console.log('```passArrObj',passArrObj);
  1654. const newArr = passArrObj.filter(item=>item != clickRow.value.docId)
  1655. console.log('```newArr',newArr);
  1656. localStorage.setItem('passArr',JSON.stringify(newArr))
  1657. },1000*30)
  1658. chooseSet(chooseRow.value,null,chooseNum.value)
  1659. }else{
  1660. ElMessage({ message: "验证失败", type: "error" })
  1661. }
  1662. }
  1663. // 文件下载
  1664. const downLoadfile = ()=>{
  1665. myfile.fileDown(clickRow.value.docId).then(res=>{
  1666. var reader = new FileReader();
  1667. reader.onloadend = function(event){
  1668. //event 就是你要的返回内容
  1669. //因为返回的报错格式是字符串,手动转换成对象,转换成功表示请求失败
  1670. //转换失败就意味着你拿到的result是文件流,那么直接手动下载就好
  1671. try{
  1672. let data = JSON.parse(event.target.result)
  1673. }catch(err){
  1674. const link = document.createElement('a'); // 创建a标签
  1675. let blob = new Blob([res]);
  1676. link.style.display = 'none';
  1677. link.href = URL.createObjectURL(blob); // 创建下载的链接
  1678. link.setAttribute('download',clickRow.value.fileName); // 给下载后的文件命名
  1679. document.body.appendChild(link);
  1680. link.click(); // 点击下载
  1681. document.body.removeChild(link); // 完成移除元素
  1682. window.URL.revokeObjectURL(link.href); // 释放blob对象
  1683. }
  1684. };
  1685. reader.readAsText(res);
  1686. })
  1687. }
  1688. // 触底加载事件
  1689. const setScroll =async ()=>{
  1690. console.log('setScroll','到底喽');
  1691. // console.log('tableBeEnd.value',tableBeEnd.value);
  1692. filePageNum.value = filePageNum.value+1
  1693. const query = `${thisFolder.value.dirId}?pageSize=10&pageNum=${filePageNum.value}`
  1694. // -------------先禁止掉事件 定时器1秒钟后才能再次触发
  1695. tableBeEnd.value = true
  1696. // --------------------
  1697. const res = await myfile.getById(query)
  1698. // console.log('setScrollres',res);
  1699. if (res.code === 200) {
  1700. // const newarr = res.rows.concat(toRaw(fileList.value))
  1701. const newarr = toRaw(fileList.value).concat(res.rows)
  1702. console.log('newarr',newarr);
  1703. fileList.value = JSON.parse(JSON.stringify(newarr))
  1704. if(newarr.length < tableTotal.value){
  1705. //获取后的数量<total就可以再次获取
  1706. setTimeout(()=>{
  1707. tableBeEnd.value = false
  1708. },1000)
  1709. }
  1710. }
  1711. // console.log('query',query);
  1712. // console.log('fileList',fileList.value);
  1713. }
  1714. // 获取用户信息
  1715. const getUserInfo =async ()=>{
  1716. const userStore = useUserStore();
  1717. const userId = toRaw(userStore.roles)
  1718. if(userId.some(item=>item == 'system')){
  1719. isDept.value = true
  1720. }else{
  1721. isDept.value = false
  1722. }
  1723. console.log('isDept',isDept.value);
  1724. }
  1725. //修改文件夹权限
  1726. const upFirstFoler =async (item)=>{
  1727. // console.log('upFirstFoler',item);
  1728. const res = await myfile.getDir(item.dirId)
  1729. console.log('upFirstFolerres = ',res);
  1730. upFolderData.value = toRaw(res.data)
  1731. oneOrTwo.value = 1
  1732. folderCase.value = true
  1733. }
  1734. const backTopPath = ()=>{
  1735. pathLabelData.value = ([])
  1736. getAllTop()
  1737. }
  1738. const upBefore = (file)=>{
  1739. // console.log('file',file.size);
  1740. const maxSize = (maxFileSize.value-0)*1024*1024
  1741. // console.log('maxSize',maxSize);
  1742. if(file.size>maxSize){
  1743. ElMessage({ message: '上传文件大小最大为'+maxFileSize.value+'M', type: 'error' })
  1744. return false
  1745. }
  1746. }
  1747. onMounted(() => {
  1748. getAllTop()
  1749. getSpaceList()
  1750. getUserInfo()
  1751. getLevelList()
  1752. getConfigKey("file.size.limit").then(response => {
  1753. // console.log('response',response);
  1754. maxFileSize.value = response.msg
  1755. });
  1756. // 添加监听,点击其他地方关闭文件夹右键菜单
  1757. window.addEventListener("click", closeRMenu, true);
  1758. window.addEventListener("click", mouseClick, true);
  1759. })
  1760. // 组件显示
  1761. onActivated(()=>{
  1762. console.log('onActivated.query',route.query);
  1763. loadingPreview.value = true
  1764. setTimeout(()=>{
  1765. if(route.query.clickRowId){
  1766. const newRow = JSON.parse(route.query.clickRowId)
  1767. // console.log('newRow',newRow);
  1768. myfile.getDir(newRow).then(res=>{
  1769. // console.log('tores',res);
  1770. thisFolder.value = res.data
  1771. // 这里点的是一级目录 所以重新给pathLabelData赋值
  1772. const labelItem = {
  1773. name:res.data.dirName,
  1774. dirId:res.data.dirId
  1775. }
  1776. pathLabelData.value = [labelItem]
  1777. refreshFile()
  1778. })
  1779. }
  1780. loadingPreview.value = false
  1781. },500)
  1782. })
  1783. // onBeforeRouteUpdate((to,from)=>{
  1784. // console.log('to',to);
  1785. // console.log('from',from);
  1786. // if(to.name == 'publicment'){
  1787. // loadingPreview.value = true
  1788. // const thisdirId = to.params.dirId
  1789. // console.log('thisdirId',thisdirId);
  1790. // setTimeout(()=>{
  1791. // if(thisdirId){
  1792. // myfile.getDir(thisdirId).then(res=>{
  1793. // console.log('tores',res);
  1794. // thisFolder.value = res.data
  1795. // refreshFile()
  1796. // })
  1797. // }
  1798. // loadingPreview.value = false
  1799. // },500)
  1800. // }
  1801. // // docId = to.query.clickRowId
  1802. // // console.log(docId, "doc");
  1803. // // console.log(copyRow, "row");
  1804. // // edit();
  1805. // })
  1806. return {
  1807. getSpaceList,
  1808. folderList,//文件夹的数据
  1809. fileList,//文件夹的数据
  1810. searchFire,//搜索文件的model
  1811. changeFile,//切换右侧视图的file
  1812. menuList,//右侧切换
  1813. selectedIndex,//当前选中下标
  1814. shotdown,//筛选出当前数据
  1815. useMenu,
  1816. arrorMenu,
  1817. blueLeft,//返回
  1818. grayRight,//前进
  1819. squre,//视图切换
  1820. sort,//排序
  1821. folder,
  1822. files,
  1823. handleRowClick,
  1824. askApply,//申请扩容
  1825. cliCC,
  1826. mouseCli,//文件点击弹框
  1827. chooseSet,
  1828. trandata,
  1829. tranvalue,
  1830. anyP,
  1831. chooseSet1,
  1832. fileMenu,
  1833. createNewMenu,
  1834. // delBoser,
  1835. clickRowId,
  1836. createNewFile,
  1837. // fileUpload,
  1838. getImage,//筛选文件类型
  1839. handleSelectionChange,
  1840. handleSelectionChange1,
  1841. selectedBox,//重命名相关
  1842. restName,//重命名相关
  1843. getMenu,
  1844. folderId,
  1845. fileId,
  1846. // getAllMiddle,//拿到所有空间信息
  1847. delName,//删除空间信息
  1848. useSpace,//使用空间
  1849. allSpace,//总空间
  1850. percent,
  1851. arrowClick,
  1852. uploadModal,
  1853. sureUpload,
  1854. onSuccess,
  1855. fileArr,
  1856. directoryId,
  1857. folderClick,
  1858. copyDirId,//复制移动需要的↓
  1859. copyDocId,
  1860. copySpaceId,
  1861. copyFileId,
  1862. copyFileName,
  1863. copyFileSize,
  1864. copyFileType,
  1865. sureChangeName,//文件重命名
  1866. fileNameChange,//文件重命名模态框
  1867. nameForm,
  1868. collectImg,//收藏小星星
  1869. sortNum,
  1870. needBag,
  1871. isId,
  1872. editOnline,//在线编辑
  1873. copyParentId,
  1874. copyRow,
  1875. fileBox,
  1876. getAllTop,
  1877. newDirId,
  1878. newSpaceId,
  1879. showPreview,//控制图片预览
  1880. closeImgPreview,//关闭预览事件
  1881. previewData,//预览文件数据
  1882. router,
  1883. fileTrees,
  1884. getChildren,//子传父
  1885. copyOrMove,
  1886. impDirId,
  1887. impNum,
  1888. impSpaceId,
  1889. //历史版本=========
  1890. openForwardFile,
  1891. forwardTreeData,
  1892. fileUserTreeData,
  1893. filterMouseCli,
  1894. changeMsgClose,
  1895. historyPrew,
  1896. historycopyRow,
  1897. thanks,
  1898. getCback,
  1899. mouseClick,
  1900. folderVisible,
  1901. foldertop,
  1902. folderleft,
  1903. thisFolder,
  1904. folderRClick,
  1905. closeRMenu,
  1906. cancleHistoryPrew,
  1907. historyTotal,
  1908. //历史版本=========
  1909. fileUserTreeData,
  1910. thanks,
  1911. getCback,
  1912. mouseClick,
  1913. workOrEdit,
  1914. folderCase,//新建文件夹传值
  1915. getChildrenC,
  1916. oneOrTwo,//父传子判断
  1917. folderCheckout,
  1918. fileCheckout,
  1919. haveCheck,
  1920. onlyView,
  1921. goLock,
  1922. collects,//收藏父传子
  1923. getCollects,//收藏子传父
  1924. folderTotal,
  1925. fileTotal,
  1926. delMoreFile,//删除多个文件夹
  1927. topPath,
  1928. xz,//文件右键菜单left
  1929. yz,//文件右键菜单top
  1930. formatFileSize,
  1931. isFolder,
  1932. clickRow,
  1933. ordinaryList,
  1934. ordinary,
  1935. fileStyle,
  1936. rename,
  1937. leftNewFile,
  1938. getRename,//文件夹重命名子传父
  1939. copyFolderName,
  1940. spaces,//空间扩容父传子
  1941. getSpaceC,//空间扩容子传父
  1942. copySpaceCup,
  1943. fileGrid,
  1944. folderGrid,
  1945. collectFolder,
  1946. arrowLift,
  1947. formatStorage,
  1948. showFile,
  1949. navBack,
  1950. onlineCase,
  1951. lastBB,
  1952. shareBack,
  1953. folderBack,
  1954. refreshFile,
  1955. delCollect,
  1956. backFolder,
  1957. collectByStar,
  1958. getLevelImg,
  1959. level1,
  1960. level2,
  1961. level3,
  1962. level4,
  1963. getLeveldetailFn,
  1964. thisFolderRole,
  1965. showInputPassword,
  1966. closeIptPass,
  1967. surePass,
  1968. chooseRow,
  1969. chooseNum,
  1970. loadingPreview,
  1971. thisRole,
  1972. noMenuItem,
  1973. downLoadfile,
  1974. addFolderAdd,
  1975. addFileTab,
  1976. addTab,
  1977. ordinaryFolder,
  1978. filePageNum,
  1979. setScroll,
  1980. tableBeEnd,
  1981. tableTotal,
  1982. spaceName,
  1983. getUserInfo,
  1984. isDept,
  1985. upFirstFoler,
  1986. //控制宫格展示
  1987. changeShow,
  1988. isList,
  1989. upFolderData,
  1990. setTablelevel,
  1991. levelList,
  1992. getLevelList,
  1993. closeUpload,
  1994. handleRemove,
  1995. loadingUpload,
  1996. fileBlur,
  1997. pathLabelData,
  1998. fileBlur,
  1999. backTopPath,
  2000. maxFileSize,
  2001. upBefore
  2002. }
  2003. },
  2004. watch: {
  2005. },
  2006. components: {
  2007. BreadMenu,
  2008. FileEdit,
  2009. ImgPreview,
  2010. FileTree,
  2011. historyList,
  2012. TransferModal,
  2013. CreateFloder,
  2014. FileCollect,
  2015. FolderReName,
  2016. SpaceBig,
  2017. PlaceGridFolder,
  2018. PalaceGridFile,
  2019. inputPassword,
  2020. PathLabel
  2021. },
  2022. }
  2023. </script>
  2024. <style lang="scss" scoped>
  2025. @import "@/assets/styles/my-common.scss";
  2026. .lodingBox{
  2027. position:absolute;
  2028. top: 0;
  2029. left: 0;
  2030. width: 100vh;
  2031. height: 100vh;
  2032. z-index: 10000000;
  2033. }
  2034. p {
  2035. margin: 0;
  2036. padding: 0;
  2037. }
  2038. .bigBox {
  2039. width: 100%;
  2040. height: 88vh;
  2041. display: flex;
  2042. justify-content: flex-start;
  2043. overflow: hidden;
  2044. }
  2045. .settingBox {
  2046. width: 25vw;
  2047. height: 92vh;
  2048. // border: 1px solid black;
  2049. border-radius: 4px;
  2050. /* margin: 5px 5px; */
  2051. margin-right: 8px;
  2052. background-color: white;
  2053. }
  2054. .topSearch {
  2055. width: 100%;
  2056. height: 48px;
  2057. background-color: #EBEFF6;
  2058. display: flex;
  2059. justify-content: space-between;
  2060. align-items: center;
  2061. padding-left: 16px;
  2062. padding-right: 16px;
  2063. }
  2064. .searchFire {
  2065. // width: 248px;
  2066. width: 100%;
  2067. height: 32px;
  2068. }
  2069. .searchBox{
  2070. display: flex;
  2071. justify-content: space-between;
  2072. position: relative;
  2073. padding: 8px 16px;
  2074. .SearchIcon{
  2075. color: gray;
  2076. position: absolute;
  2077. right: 5%;
  2078. top: 35%;
  2079. }
  2080. }
  2081. .setBox {
  2082. width: 88px;
  2083. height: 112px;
  2084. text-align: center;
  2085. margin-left: 5px;
  2086. margin-top: 5px;
  2087. position: relative;
  2088. .left_fileBox{
  2089. position: relative;
  2090. margin-top: 10px;
  2091. .levelImg{
  2092. width: 32px;
  2093. height: 32px;
  2094. position: absolute;
  2095. right: 5%;
  2096. bottom: 20%;
  2097. }
  2098. }
  2099. }
  2100. .setBox:hover {
  2101. background-color: #EEF9FF;
  2102. }
  2103. .setBox:hover .selectChe {
  2104. background-color: #EEF9FF;
  2105. display: block;
  2106. z-index: 1000;
  2107. }
  2108. .selectChe {
  2109. display: none;
  2110. width: 20px;
  2111. height: 20px;
  2112. background: rgba(255, 255, 255, 0.7);
  2113. border-radius: 4px 4px 4px 4px;
  2114. position: absolute;
  2115. top: 2px;
  2116. right: 2px;
  2117. line-height: 10px;
  2118. }
  2119. .mesBox {
  2120. width: 75vw;
  2121. height: 88vh;
  2122. border-radius: 4px;
  2123. background-color: white;
  2124. }
  2125. .useBox {
  2126. width: 100%;
  2127. height: 24px;
  2128. }
  2129. .tables {
  2130. display: inline-block;
  2131. width: 112px;
  2132. height: 22px;
  2133. border-radius: 4px;
  2134. line-height: 21px;
  2135. text-align: center;
  2136. font-size: 12px;
  2137. margin-left: 5px;
  2138. position: relative;
  2139. white-space: nowrap;
  2140. overflow: hidden;
  2141. text-overflow: ellipsis;
  2142. }
  2143. .tableLis {
  2144. display: inline-block;
  2145. width: 112px;
  2146. height: 22px;
  2147. border-radius: 4px;
  2148. background-color: #EBEFF6;
  2149. line-height: 21px;
  2150. text-align: center;
  2151. font-size: 12px;
  2152. margin-left: 5px;
  2153. position: relative;
  2154. white-space: nowrap;
  2155. overflow: hidden;
  2156. text-overflow: ellipsis;
  2157. max-width: auto;
  2158. }
  2159. .manyUse {
  2160. width: 100%;
  2161. height: 48px;
  2162. /* background-color: gray; */
  2163. line-height: 48px;
  2164. display: flex;
  2165. justify-content: flex-start;
  2166. align-items: center;
  2167. }
  2168. .el-dropdown-link {
  2169. color: white;
  2170. cursor: pointer;
  2171. }
  2172. .breadBox {
  2173. width: 100%;
  2174. height: 24px;
  2175. display: flex;
  2176. justify-content: space-between;
  2177. align-items: center;
  2178. background-color: #F6F7F9;
  2179. .topPath {
  2180. margin-left: 4px;
  2181. display: flex;
  2182. cursor: pointer;
  2183. color: #6F85B5;
  2184. font-size: 12px;
  2185. }
  2186. }
  2187. :deep(.el-collapse-item__header) {
  2188. height: 24px !important;
  2189. background-color: #EBEFF6 !important;
  2190. }
  2191. .detailBox {
  2192. width: 100%;
  2193. height: 50%;
  2194. // overflow-y: auto;
  2195. }
  2196. .showBox{
  2197. height: calc(100% - 48px - 24px);
  2198. }
  2199. :deep(.el-dialog__header) {
  2200. background-color: #ECEFF7;
  2201. margin-right: 0px;
  2202. }
  2203. .fileTable {
  2204. height: 50%;
  2205. // overflow-y: hidden;
  2206. // margin-top: 48px;
  2207. }
  2208. .setCli {
  2209. width: 156px;
  2210. max-height: auto;
  2211. position: absolute;
  2212. top: -70px;
  2213. left: 300px;
  2214. flex-wrap: 400;
  2215. background-color: white;
  2216. border: 1px solid gray;
  2217. border-radius: 4px;
  2218. z-index: 3;
  2219. overflow-y: auto;
  2220. // font-size: 16px;
  2221. }
  2222. .setCli1 {
  2223. width: 156px;
  2224. height: auto;
  2225. position: absolute;
  2226. background-color: white;
  2227. border: 1px solid gray;
  2228. border-radius: 4px;
  2229. z-index: 100;
  2230. overflow-y: auto;
  2231. }
  2232. .chooseSet {
  2233. width: 140px;
  2234. height: 30px;
  2235. line-height: 30px;
  2236. margin: 5px auto;
  2237. font-size: 13px;
  2238. cursor: pointer;
  2239. // display: flex;
  2240. // align-items: center;
  2241. // position: relative;
  2242. img {
  2243. margin-right: 4px;
  2244. vertical-align: middle;
  2245. }
  2246. }
  2247. .chooseSet:hover {
  2248. width: 140px;
  2249. height: 30px;
  2250. line-height: 30px;
  2251. margin: 5px auto;
  2252. font-size: 13px;
  2253. background-color: #F5F7F9;
  2254. /* color: white; */
  2255. }
  2256. :deep(.el-collapse-item__content) {
  2257. // height: 235px;
  2258. overflow-y: auto;
  2259. padding-bottom: 0;
  2260. }
  2261. :deep(.el-scrollbar__wrap) {
  2262. height: 100% !important;
  2263. // overflow-y: auto;
  2264. }
  2265. .ellipsis-text {
  2266. white-space: nowrap;
  2267. overflow: hidden;
  2268. text-overflow: ellipsis;
  2269. max-width: auto;
  2270. }
  2271. .right_menu {
  2272. width: 156px;
  2273. position: absolute;
  2274. padding: 8px;
  2275. box-shadow: 0px 2px 10px 1px rgba(199, 203, 216);
  2276. border-radius: 4px 4px 4px 4px;
  2277. border: 1px solid gray;
  2278. background-color: #fff;
  2279. z-index: 10000;
  2280. .menu_item {
  2281. width: 100%;
  2282. height: 30px;
  2283. border-radius: 4px 4px 4px 4px;
  2284. line-height: 30px;
  2285. display: flex;
  2286. margin: 5px auto;
  2287. align-items: center;
  2288. font-size: 13px;
  2289. &:hover {
  2290. background-color: #f5f7f9;
  2291. }
  2292. span {
  2293. margin-left: 4px;
  2294. }
  2295. }
  2296. }
  2297. // 扩容盒子
  2298. .expansion{
  2299. margin: 0 16px;
  2300. border-top: 1px solid #C1CCE3 ;
  2301. .top_box{
  2302. margin-top: 16px;
  2303. width: 100%;
  2304. display: flex;
  2305. justify-content: space-between;
  2306. }
  2307. }
  2308. .isCheck {
  2309. opacity: 1 !important;
  2310. }
  2311. :deep(.el-tag__content) {
  2312. display: block;
  2313. }
  2314. :deep(.el-icon el-tag__close) {
  2315. display: block;
  2316. }
  2317. :deep(.el-collapse-item__content) {
  2318. height: 100%;
  2319. border-bottom: none;
  2320. }
  2321. // 隐藏全选按钮
  2322. .file-jia {
  2323. :deep(.el-table th.el-table__cell:nth-child(1) .cell) {
  2324. visibility: hidden;
  2325. }
  2326. }
  2327. .file-title{
  2328. color: #2E6BC8;
  2329. margin-left: 3%;
  2330. }
  2331. ::v-deep .el-collapse-item__arrow {
  2332. position: relative;
  2333. color: #2e6bc8;
  2334. right: 97%;
  2335. }
  2336. :deep(.el-collapse-item__header) {
  2337. padding-left: 10px;
  2338. box-sizing: border-box;
  2339. }
  2340. .palace-grid{
  2341. margin-left: 4px;
  2342. margin-right: 20px;
  2343. }
  2344. </style>