index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806
  1. <!--
  2. * @Descripttion: POCT文件培训
  3. * @version: 1.0
  4. * @Author: Liu_jiaYin
  5. * @Date: 2024-03-01 13:47:32
  6. * @LastEditors: Do not edit
  7. * @LastEditTime: 2024-04-26 16:04:02
  8. -->
  9. <template>
  10. <!-- <el-dialog
  11. :visible.sync="dialogVisible"
  12. fullscreen
  13. :title="title"
  14. append-to-body
  15. custom-class="ibps-file-preview-dialog"
  16. >
  17. <div>
  18. <fView v-if="refresh" ref="fvView" :option-file="optionFile" :operation_status="operation_status" @hadLoadedFile="hadLoadedFile" />
  19. </div>
  20. </el-dialog> -->
  21. <!--个人修改 -->
  22. <el-dialog
  23. :visible.sync="dialogVisible"
  24. fullscreen
  25. append-to-body
  26. custom-class="ibps-file-preview-dialog"
  27. :show-close="false"
  28. >
  29. <template #title>
  30. <el-row>
  31. <el-col :span="11" class="titleHander">{{ title }}</el-col>
  32. <el-col v-show="showYueDuLiangRights" :span="3" class="read" style="text-align: right"
  33. >阅读量:{{ lookNum }}</el-col
  34. >
  35. <el-col :span="10" style="text-align: right">
  36. <el-popover v-model="deleteVisible" placement="top" width="160">
  37. <p>文件删除之后将不能查看,确定要删除该文件吗?</p>
  38. <div style="text-align: right; margin: 0">
  39. <el-button size="mini" type="text" @click="deleteVisible = false"
  40. >取消</el-button
  41. >
  42. <el-button type="primary" size="mini" @click="deleteFile"
  43. >确定</el-button
  44. >
  45. </div>
  46. <el-button
  47. v-if="deleteShow"
  48. slot="reference"
  49. type="danger"
  50. icon="el-icon-delete"
  51. class="deleteBtn"
  52. @click="deleteVisible = true"
  53. >删除</el-button
  54. >
  55. </el-popover>
  56. <el-button type="primary" icon="el-icon-view" @click="lookFile"
  57. >查看文件信息</el-button
  58. >
  59. <el-button type="primary" icon="el-icon-s-fold" @click="hideLeft">{{
  60. leftContent
  61. }}</el-button>
  62. <el-button
  63. v-if="updateShow"
  64. type="primary"
  65. icon="el-icon-download"
  66. @click="updateFile"
  67. >下载文件</el-button
  68. >
  69. <el-button type="danger" icon="el-icon-close" @click="closeDialog"
  70. >关闭</el-button
  71. >
  72. </el-col>
  73. </el-row>
  74. </template>
  75. <div>
  76. <el-row>
  77. <el-col v-if="leftShow" :span="4" class="left-content">
  78. <div class="left-title">文件修订历史</div>
  79. <el-timeline :reverse="reverse">
  80. <el-timeline-item
  81. v-for="(activity, index) in leftData"
  82. :key="index"
  83. :timestamp="'发布日期:' + activity.fa_bu_shi_jian_"
  84. :type="index === activeIndex ? type : ''"
  85. @click.stop.native="toggleActive(activity, index)"
  86. >
  87. <div class="timeline-content">
  88. <el-tooltip
  89. class="itemStyle"
  90. effect="dark"
  91. popper-class="tooltip-max-width"
  92. placement="right"
  93. :content="showContent(activity, index)"
  94. >
  95. <div>
  96. <!-- <div>版本号:{{ activity.ban_ben_ }}/修订人:{{ getUserName(activity.bian_zhi_ren_) }}</div> -->
  97. <el-collapse v-model="activeName" accordion>
  98. <el-collapse-item :name="index + 1">
  99. <template slot="title">
  100. <div>
  101. 版本号:{{
  102. activity.xiu_ding_ban_ben_ || activity.ban_ben_
  103. }}&nbsp;&nbsp;&nbsp;&nbsp;修订人:{{
  104. getUserName(activity.bian_zhi_ren_)
  105. }}
  106. </div>
  107. </template>
  108. <!-- 附件 -->
  109. <div v-if="activity.zhen_fu_jian_">
  110. <ibps-attachment
  111. v-model="activity.zhen_fu_jian_"
  112. allow-download
  113. download
  114. multiple
  115. accept="*"
  116. store="id"
  117. readonly
  118. />
  119. </div>
  120. <div v-else>
  121. <i class="el-icon-warning-outline" type="warning">
  122. 暂无附件</i
  123. >
  124. </div>
  125. </el-collapse-item>
  126. </el-collapse>
  127. </div>
  128. </el-tooltip>
  129. </div>
  130. </el-timeline-item>
  131. </el-timeline>
  132. </el-col>
  133. <el-col :span="computedSpan"
  134. ><fView
  135. v-if="refresh"
  136. ref="fvView"
  137. :option-file="optionFile"
  138. :operation_status="operation_status"
  139. :copy="updateShow"
  140. @hadLoadedFile="hadLoadedFile"
  141. /></el-col>
  142. </el-row>
  143. </div>
  144. <!-- 查看文件信息弹窗 @close="closeDialog"-->
  145. <FileDialog
  146. v-if="innerVisible"
  147. :show-list="showList"
  148. :dig-data="digData"
  149. :inner-visible="innerVisible"
  150. :file-index="fileIndex"
  151. @pause="pauseTimer"
  152. @start="startTimer"
  153. @update-inner-visible="updateInnerVisible"
  154. />
  155. </el-dialog>
  156. </template>
  157. <script>
  158. /**
  159. * 文件预览
  160. * 1、'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx' 类型支持
  161. * 2、图片支持缩放
  162. * 3、音频,语音支持
  163. * ==================
  164. * 下一版本支持
  165. * 1、pdf支持缩放
  166. * 2、音频,语音多格式支持
  167. * 3、压缩包支持
  168. */
  169. import fView from '@/business/platform/file/attachment/editFile/fView.vue'
  170. import { SYSTEM_URL, BASE_API } from '@/api/baseUrl'
  171. import ViewFile from '@/views/viewFile/index.vue'
  172. import Template from '@/business/platform/form/form-print/template.vue'
  173. import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
  174. import FileDialog from './fileDialog.vue'
  175. import IbpsAttachment from '@/business/platform/file/attachment/selector'
  176. import { getSetting } from '@/utils/query'
  177. // import * as selectbox from 'bpmn-js-properties-panel/lib/factory/SelectEntryFactory'
  178. // import func from 'vue-editor-bridge'
  179. export default {
  180. name: 'file-training',
  181. components: {
  182. fView,
  183. ViewFile,
  184. Template,
  185. FileDialog,
  186. 'ibps-attachment': IbpsAttachment
  187. },
  188. props: {
  189. visible: {
  190. type: Boolean,
  191. default: false
  192. },
  193. // fileInfos: {
  194. // type: Object,
  195. // default: () => {}
  196. // },
  197. fileInfos: {
  198. type: Array,
  199. default: () => {}
  200. }
  201. // template: {
  202. // type: Object,
  203. // default: () => {}
  204. // }
  205. },
  206. data() {
  207. const { userList, userId, role, isSuper } = this.$store.getters
  208. // const userId = this.$store.getters.userInfo.employee.id// 本人修改
  209. return {
  210. activeName: 1,
  211. updateShow: false,
  212. type: 'success',
  213. curFileName: '',
  214. curZid: '',
  215. timeId: '',
  216. dialogVisible: false,
  217. operation_status: 'fileTraining',
  218. title: '',
  219. browseTime: 0, // 浏览时长初始值为 0
  220. clearTimeSet: null,
  221. optionFile: {},
  222. tmpId: '',
  223. upFunc: () => {},
  224. height: 0,
  225. out: false, // 记录鼠标是否离开过被监听的位置,未离开过则startTimer不启用
  226. hadLoad: false,
  227. refresh: false,
  228. // 本人修改
  229. leftShow: true,
  230. scrollTimeout: null,
  231. reverse: false,
  232. fileInfo: '',
  233. fileJie: '',
  234. leftData: [],
  235. activeIndex: 0,
  236. userList: userList,
  237. userId: userId,
  238. innerVisible: false,
  239. currentPage: 1,
  240. pageSize: 10,
  241. lookNum: null,
  242. showList: [],
  243. digData: null,
  244. paused: false,
  245. role: role,
  246. isSuper: isSuper,
  247. deleteVisible: false,
  248. deleteShow: false,
  249. showYueDuLiangRights: true,
  250. leftContent: '隐藏修订历史'
  251. }
  252. },
  253. // 本人修改
  254. computed: {
  255. computedSpan() {
  256. return this.leftShow ? 20 : 24
  257. },
  258. fileIndex() {
  259. if (this.leftData.length <= 0) {
  260. return 0
  261. }
  262. return this.leftData.findIndex((i) => i === this.digData)
  263. }
  264. },
  265. watch: {
  266. visible: {
  267. immediate: true,
  268. handler(val) {
  269. this.digData = this.leftData[0]
  270. }
  271. },
  272. leftShow: {
  273. immediate: true, // 强制执行一次
  274. handler(val) {
  275. if (val) {
  276. this.leftContent = '隐藏修订历史'
  277. return
  278. }
  279. this.leftContent = '显示修订历史'
  280. }
  281. },
  282. // 本人修改
  283. fileInfos: {
  284. handler(newVal) {
  285. this.leftData = newVal
  286. const temp = JSON.parse(JSON.stringify(newVal))
  287. temp.sort((a, b) => {
  288. return (
  289. new Date(b.fa_fang_shi_jian_).getTime() -
  290. new Date(a.fa_fang_shi_jian_).getTime()
  291. )
  292. })
  293. if (newVal !== temp) {
  294. this.leftData = temp
  295. console.log('this.leftData====>', this.leftData)
  296. }
  297. temp.forEach((val) => {
  298. this.fileShow(temp[0])
  299. })
  300. // newVal.forEach(val => {
  301. // this.fileShow(val)
  302. // })
  303. },
  304. deep: true, // 深度监听,确保对象属性变化也能触发(本人修改)
  305. immediate: true
  306. },
  307. browseTime: {
  308. handler: function (val, oldVal) {
  309. if (this.curFileName) {
  310. this.title = `文件:《 ${this.curFileName} 》,查阅时长:${val}秒`
  311. } else {
  312. this.title = `文件:《 ${this.leftData[0]?.FILE_NAME_} 》,查阅时长:${val}秒`
  313. }
  314. if (!this.lookNum) {
  315. if (this.leftData[0]?.id) {
  316. this.checkNum(this.leftData[0])
  317. }
  318. }
  319. },
  320. immediate: true
  321. },
  322. dialogVisible: {
  323. handler: function (val, oldVal) {
  324. if (!val) {
  325. this.closeDialog()
  326. }
  327. }
  328. }
  329. },
  330. beforeDestroy() {
  331. this.fileType = ''
  332. this.option = {}
  333. // 本人修改
  334. this.removeMouseMoveListener()
  335. },
  336. async mounted() {
  337. this.height = this.getDialogHeightHeight()
  338. const { fileDownRights,fileYueDuLiangRights } = (await getSetting('system')) || {}
  339. // 页面切换时改变计时状态
  340. document.addEventListener('visibilitychange', this.handlePageChange)
  341. this.checkDialogBody()
  342. const roleKey = ['xtgljs']
  343. const curRole = this.role.map((i) => i.alias)
  344. const isPower = curRole.some((item) => roleKey.includes(item))
  345. this.deleteShow = !!(isPower || this.isPower)
  346. if (fileDownRights) {
  347. //绍兴妇幼环境限制只有文件管理员可以显示
  348. if (this.isSuper || curRole.some((item) => item == 'wjgly')) {
  349. this.updateShow = true
  350. }
  351. } else {
  352. // 其他环境
  353. const hasRole = localStorage.getItem('hasHighRole') === '1'
  354. if (this.isSuper || hasRole) {
  355. this.updateShow = true
  356. }
  357. }
  358. if (fileYueDuLiangRights) {
  359. //绍兴妇幼环境限制不显示阅读量
  360. this.showYueDuLiangRights = false
  361. }
  362. },
  363. methods: {
  364. getUserName(data) {
  365. const user = this.userList.find((item) => item.userId === data)
  366. return user ? user.userName : '未知用户'
  367. },
  368. showContent(activity, index) {
  369. if (activity.cao_zuo_lei_xing_ === '新增') {
  370. return '第一版本'
  371. }
  372. return activity.xiu_ding_nei_rong
  373. ? activity.xiu_ding_nei_rong
  374. : '无修订原因'
  375. },
  376. handlePageChange() {
  377. if (document.visibilityState === 'hidden') {
  378. this.pauseTimer()
  379. } else {
  380. this.startTimer()
  381. }
  382. },
  383. closeDialog() {
  384. // 关闭时存入查阅时间
  385. if (this.browseTime && this.browseTime > 0 && this.timeId) {
  386. this.handleUpdate()
  387. }
  388. this.$emit('colseVisible', false)
  389. const fvView = this.$refs.fvView
  390. // 销毁子组件方法
  391. fvView.destoryZiComponent()
  392. if (this.browseTime >= 30) {
  393. this.upFunc(this.tmpId, this.browseTime)
  394. }
  395. // 针对关闭窗口或者浏览器的
  396. if (this.clearTimeSet != null) {
  397. clearInterval(this.clearTimeSet)
  398. this.clearTimeSet = null
  399. }
  400. this.leftShow = true
  401. this.out = false
  402. this.browseTime = 0
  403. // this.curFileName = ''// 本人添加
  404. // this.lookNum = null
  405. // this.showList = []
  406. // this.leftData = []
  407. // this.digData = null
  408. },
  409. hadLoadedFile(v) {
  410. // 计时开始,添加查看记录
  411. if (!this.curZid) {
  412. this.handleAdd(this.leftData[0]?.zId, 0)
  413. }
  414. this.setBrowseTime()
  415. this.hadLoad = true
  416. },
  417. setBrowseTime() {
  418. // 设置定时器
  419. this.clearTimeSet = setInterval(() => {
  420. this.browseTime++
  421. }, 1000)
  422. },
  423. getDialogHeightHeight() {
  424. return (
  425. (document.documentElement.clientHeight || document.body.clientHeight) -
  426. 60 +
  427. 'px'
  428. )
  429. },
  430. startTimer() {
  431. if (
  432. this.dialogVisible &&
  433. this.hadLoad &&
  434. this.out &&
  435. this.clearTimeSet == null
  436. ) {
  437. this.clearTimeSet = setInterval(() => {
  438. this.browseTime++
  439. }, 1000)
  440. }
  441. },
  442. pauseTimer() {
  443. if (this.dialogVisible) {
  444. this.out = true
  445. clearInterval(this.clearTimeSet)
  446. this.clearTimeSet = null
  447. }
  448. },
  449. // 本人修改
  450. // id转换
  451. async idChange(id) {
  452. // const sql = `select id_ FROM t_wjxxb WHERE shu_ju_lai_yuan_ = '${id}'`
  453. return new Promise((resolve, reject) => {
  454. this.$common
  455. .request('query', {
  456. key: 'getFileInfoById',
  457. params: [id]
  458. })
  459. .then((res) => {
  460. const { data = [] } = res.variables || {}
  461. const firstId = data[0]?.id_
  462. resolve(firstId) // 解析 Promise 时返回 firstId
  463. })
  464. .catch((error) => {
  465. reject(error) // 捕获错误并拒绝 Promise
  466. })
  467. })
  468. },
  469. toggleActive(activity, index) {
  470. if (this.activeIndex === index) {
  471. return
  472. }
  473. // 切换文件修订历史时,保存上一个文件查看记录,新增当前文件查看记录
  474. if (this.browseTime && this.browseTime > 0 && this.timeId) {
  475. this.handleUpdate()
  476. this.handleAdd(this.curZid || this.leftData[0]?.zId, 0)
  477. }
  478. this.activeIndex = index
  479. this.digData = activity
  480. this.curZid = activity.zid
  481. this.fileShow(activity)
  482. if (this.browseTime >= 30) {
  483. this.upFunc(this.tmpId, this.browseTime)
  484. }
  485. clearInterval(this.clearTimeSet)
  486. this.browseTime = 0
  487. this.curFileName = activity.FILE_NAME_
  488. this.checkNum(activity) // 阅读量
  489. // this.$forceUpdate()// 触发监听器
  490. },
  491. // 阅读量函数
  492. async checkNum(activity) {
  493. // const sql = `select t_wjcyjl.* from t_wjcyjl INNER JOIN t_wjxxb ON t_wjcyjl.parent_id_ = t_wjxxb.id_ WHERE t_wjxxb.shu_ju_lai_yuan_ = '${activity.id}' order by create_time_ desc`
  494. // const sql1 = `select * from t_wjcyjl where parent_id_= '${activity.id}' order by create_time_ desc`
  495. await this.$common
  496. .request('query', {
  497. key: 'getFileCheckRecord',
  498. params: [activity.id]
  499. })
  500. .then((res) => {
  501. const { data = [] } = res.variables || {}
  502. this.lookNum = data.length
  503. this.showList = data
  504. })
  505. },
  506. handleAdd(fileId, time) {
  507. const addParams = {
  508. tableName: 't_wjcyjl',
  509. paramWhere: [
  510. {
  511. bian_zhi_ren_: this.userId,
  512. bian_zhi_shi_jian: this.$common.getDateNow(19),
  513. parent_id_: fileId,
  514. shi_chang_: time
  515. }
  516. ]
  517. }
  518. curdPost('add', addParams).then((res) => {
  519. // this.refreshData()
  520. const { cont = [] } = res.variables || {}
  521. this.timeId = cont[0]?.id_ || ''
  522. })
  523. },
  524. handleUpdate() {
  525. const updateParams = {
  526. tableName: 't_wjcyjl',
  527. updList: [
  528. {
  529. where: {
  530. id_: this.timeId
  531. },
  532. param: {
  533. shi_chang_: this.browseTime || 20
  534. // shi_chang_: 20
  535. }
  536. }
  537. ]
  538. }
  539. curdPost('update', updateParams).then((res) => {})
  540. },
  541. hideLeft() {
  542. this.leftShow = !this.leftShow
  543. },
  544. async lookFile() {
  545. // console.log(document.querySelector('iframe').contentWindow.document)
  546. // console.log(document.querySelector('iframe').contentWindow.document.body.innerHTML);
  547. if (this.digData) {
  548. await this.checkNum(this.digData)
  549. } else {
  550. this.digData = this.leftData[0]
  551. await this.checkNum(this.digData)
  552. }
  553. this.innerVisible = true
  554. },
  555. a() {
  556. fetch(this.optionFile.url)
  557. .then((response) => {
  558. if (response.ok) {
  559. // 如果响应状态码为 200-299,则创建下载链接
  560. const a = document.createElement('a')
  561. a.href = this.optionFile.url
  562. a.download = this.optionFile.data.fileName
  563. document.body.appendChild(a)
  564. a.click()
  565. a.remove()
  566. } else {
  567. // 如果响应状态码不是 200-299,则显示错误消息
  568. this.$message({
  569. message: '文件未找到,请联系管理员',
  570. type: 'warning'
  571. })
  572. console.error('文件未找到:', response.status, response.statusText)
  573. }
  574. })
  575. .catch((error) => {
  576. // 捕获网络请求错误
  577. this.$message({
  578. message: '网络请求失败,请联系管理员',
  579. type: 'warning'
  580. })
  581. console.error('网络请求失败:', error)
  582. })
  583. },
  584. deleteFile() {
  585. this.deleteVisible = false
  586. // const roleKey = ['xtgljs', 'syszr', 'wjgly', 'wjglzzc']
  587. const roleKey = ['xtgljs']
  588. const curRole = this.role.map((i) => i.alias)
  589. const isPower = curRole.some((item) => roleKey.includes(item))
  590. if (this.isSuper || isPower) {
  591. const deleteParams = {
  592. tableName: 't_wjxxb',
  593. paramWhere: { id_: this.leftData[0].zId }
  594. }
  595. curdPost('delete', deleteParams).then(() => {
  596. this.$message({
  597. message: '删除成功!',
  598. type: 'warning'
  599. })
  600. this.dialogVisible = false
  601. })
  602. return
  603. }
  604. this.$message({
  605. message: '您还没有权限,请联系管理员',
  606. type: 'warning'
  607. })
  608. },
  609. // closeDialog1 (val) {
  610. // this.innerVisible = val
  611. // },
  612. updateFile() {
  613. const hasRole = localStorage.getItem('hasHighRole') === '1'
  614. // const roleKey = ['xtgljs', 'wjglzzc', 'wjgly', 'zhsfzr']
  615. // const curRole = this.role.map(i => i.alias)
  616. // const isPower = curRole.some(i => roleKey.includes(i))
  617. if (this.isSuper || hasRole) {
  618. const a = document.createElement('a')
  619. a.href = this.optionFile.url
  620. console.log('文件下载替换前地址:', a.href)
  621. const url = new URL(a.href)
  622. //替换文件下载路径为浏览器路径
  623. url.host = window.location.host
  624. a.href = url.href
  625. console.log('文件下载替换后地址:', a.href)
  626. a.download = this.optionFile.data.fileName
  627. document.body.appendChild(a)
  628. a.click()
  629. a.remove()
  630. return
  631. }
  632. this.$message({
  633. message: '您还没有权限,请联系管理员',
  634. type: 'warning'
  635. })
  636. },
  637. fileShow(val) {
  638. return new Promise((resolve, reject) => {
  639. try {
  640. this.dialogVisible = true
  641. this.title = `文件:《${val.FILE_NAME_}》`
  642. this.idChange(val.id).then((res) => {
  643. this.tmpId = res
  644. if (val.func) {
  645. this.upFunc = val.func
  646. }
  647. const data = {
  648. ext: val.fileInfos.EXT_,
  649. fileName: val.fileInfos.FILE_NAME_,
  650. id: val.fileInfos.ID_,
  651. index: 0,
  652. totalBytes: val.fileInfos.TOTAL_BYTES_
  653. }
  654. this.optionFile.url = `${this.$onlyofficeApi}/file/download?attachmentId=${data.id}`
  655. this.optionFile.editUrl = `${this.$onlyofficeApi}/file/editCallback?fileName=${data.fileName}&fileType=${data.ext}&type=fileTraining&id=${data.id}`
  656. this.optionFile.title = data.fileName // 文件名称
  657. this.optionFile.fileType = data.ext // 类型
  658. this.optionFile.data = data // 记录编制的位置,需要替换。
  659. this.optionFile.data.index = data.index
  660. // 使用 v-if 实现组件刷新功能
  661. this.refresh = false
  662. this.$nextTick(() => {
  663. this.refresh = true
  664. resolve() // 异步操作完成后 resolve
  665. })
  666. })
  667. } catch (error) {
  668. reject(error)
  669. }
  670. })
  671. },
  672. // 排序函数
  673. sortByFabushijianDesc(data) {
  674. return data.sort((a, b) => {
  675. const dateA = new Date(a.fa_fang_shi_jian_)
  676. const dateB = new Date(b.fa_fang_shi_jian_)
  677. return dateB - dateA // 降序排序
  678. })
  679. },
  680. formattedTimestamp(timestamp) {
  681. const date = new Date(timestamp)
  682. // 获取年月日时分秒
  683. const year = date.getFullYear()
  684. const month = String(date.getMonth() + 1).padStart(2, '0')
  685. const day = String(date.getDate()).padStart(2, '0')
  686. const hours = String(date.getHours()).padStart(2, '0')
  687. const minutes = String(date.getMinutes()).padStart(2, '0')
  688. const seconds = String(date.getSeconds()).padStart(2, '0')
  689. // 格式化日期
  690. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
  691. },
  692. checkDialogBody() {
  693. const intervalId = setInterval(() => {
  694. if (document.querySelector('iframe')) {
  695. this.dialogBody = document.querySelector('iframe')
  696. this.addMouseMoveListener()
  697. clearInterval(intervalId)
  698. }
  699. }, 200)
  700. },
  701. addMouseMoveListener() {
  702. if (this.dialogBody && !this.mouseMoveHandler) {
  703. this.mouseMoveHandler = () => {
  704. console.log('鼠标移动事件!!!!')
  705. }
  706. this.dialogBody.addEventListener(
  707. 'mousemove',
  708. this.mouseMoveHandler,
  709. true
  710. )
  711. }
  712. },
  713. removeMouseMoveListener() {
  714. if (this.dialogBody && this.mouseMoveHandler) {
  715. this.dialogBody.removeEventListener(
  716. 'mousemove',
  717. this.mouseMoveHandler,
  718. true
  719. )
  720. this.mouseMoveHandler = null
  721. }
  722. },
  723. updateInnerVisible(newVal) {
  724. this.innerVisible = newVal
  725. }
  726. }
  727. }
  728. </script>
  729. <style lang="scss">
  730. .tooltip-max-width {
  731. max-width: 1200px !important; /* 固定最大宽度800px */
  732. width: max-content; /* 内容不足时自适应宽度,不占满800px */
  733. white-space: pre-wrap; /* 超长内容自动换行,避免横向溢出 */
  734. word-break: break-all; /* 英文/数字超长时强制换行 */
  735. padding: 8px 12px; /* 可选:调整内边距,优化排版 */
  736. }
  737. .ibps-file-preview-dialog {
  738. width: 80%;
  739. z-index: 99999;
  740. .el-dialog__body {
  741. padding: 0;
  742. }
  743. .file-type-txt {
  744. height: calc(88vh) !important;
  745. }
  746. .itemStyle:hover {
  747. cursor: pointer;
  748. }
  749. .titleHander,
  750. .read {
  751. line-height: 32px;
  752. }
  753. .deleteBtn {
  754. margin: 0 10px 0 0;
  755. }
  756. }
  757. .left-content {
  758. .left-title {
  759. text-align: left;
  760. padding: 15px;
  761. font-size: 18px;
  762. font-weight: 600;
  763. }
  764. .el-timeline {
  765. padding: 0 15px;
  766. }
  767. /* 清除分割线 */
  768. .el-collapse-item__wrap,
  769. .el-collapse-item__header {
  770. border-bottom: none !important;
  771. }
  772. .el-collapse {
  773. border: none !important;
  774. }
  775. .el-collapse-item__header {
  776. height: 30px;
  777. line-height: 30px;
  778. }
  779. .el-collapse-item__content {
  780. padding: 0px;
  781. }
  782. .el-timeline-item {
  783. padding-bottom: 10px;
  784. }
  785. }
  786. // .file-read-num{
  787. // display: inline-block;
  788. // margin-left: 60px;
  789. // }
  790. </style>