index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800
  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 :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="aactivity.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. leftContent: '隐藏修订历史'
  250. }
  251. },
  252. // 本人修改
  253. computed: {
  254. computedSpan() {
  255. return this.leftShow ? 20 : 24
  256. },
  257. fileIndex() {
  258. if (this.leftData.length <= 0) {
  259. return 0
  260. }
  261. return this.leftData.findIndex((i) => i === this.digData)
  262. }
  263. },
  264. watch: {
  265. visible: {
  266. immediate: true,
  267. handler(val) {
  268. this.digData = this.leftData[0]
  269. }
  270. },
  271. leftShow: {
  272. immediate: true, // 强制执行一次
  273. handler(val) {
  274. if (val) {
  275. this.leftContent = '隐藏修订历史'
  276. return
  277. }
  278. this.leftContent = '显示修订历史'
  279. }
  280. },
  281. // 本人修改
  282. fileInfos: {
  283. handler(newVal) {
  284. this.leftData = newVal
  285. const temp = JSON.parse(JSON.stringify(newVal))
  286. temp.sort((a, b) => {
  287. return (
  288. new Date(b.fa_fang_shi_jian_).getTime() -
  289. new Date(a.fa_fang_shi_jian_).getTime()
  290. )
  291. })
  292. if (newVal !== temp) {
  293. this.leftData = temp
  294. console.log('this.leftData====>', this.leftData)
  295. }
  296. temp.forEach((val) => {
  297. this.fileShow(temp[0])
  298. })
  299. // newVal.forEach(val => {
  300. // this.fileShow(val)
  301. // })
  302. },
  303. deep: true, // 深度监听,确保对象属性变化也能触发(本人修改)
  304. immediate: true
  305. },
  306. browseTime: {
  307. handler: function (val, oldVal) {
  308. if (this.curFileName) {
  309. this.title = `文件:《 ${this.curFileName} 》,查阅时长:${val}秒`
  310. } else {
  311. this.title = `文件:《 ${this.leftData[0]?.FILE_NAME_} 》,查阅时长:${val}秒`
  312. }
  313. if (!this.lookNum) {
  314. if (this.leftData[0]?.id) {
  315. this.checkNum(this.leftData[0])
  316. }
  317. }
  318. },
  319. immediate: true
  320. },
  321. dialogVisible: {
  322. handler: function (val, oldVal) {
  323. if (!val) {
  324. this.closeDialog()
  325. }
  326. }
  327. }
  328. },
  329. beforeDestroy() {
  330. this.fileType = ''
  331. this.option = {}
  332. // 本人修改
  333. this.removeMouseMoveListener()
  334. },
  335. async mounted() {
  336. this.height = this.getDialogHeightHeight()
  337. const { fileDownRights } = (await getSetting('system')) || {}
  338. // 页面切换时改变计时状态
  339. document.addEventListener('visibilitychange', this.handlePageChange)
  340. this.checkDialogBody()
  341. const roleKey = ['xtgljs']
  342. const curRole = this.role.map((i) => i.alias)
  343. const isPower = curRole.some((item) => roleKey.includes(item))
  344. this.deleteShow = !!(isPower || this.isPower)
  345. if (fileDownRights) {
  346. //绍兴妇幼环境限制只有文件管理员可以显示
  347. if (this.isSuper || curRole.some((item) => item == 'wjgly')) {
  348. this.updateShow = true
  349. }
  350. } else {
  351. // 其他环境
  352. const hasRole = localStorage.getItem('hasHighRole') === '1'
  353. if (this.isSuper || hasRole) {
  354. this.updateShow = true
  355. }
  356. }
  357. },
  358. methods: {
  359. getUserName(data) {
  360. const user = this.userList.find((item) => item.userId === data)
  361. return user ? user.userName : '未知用户'
  362. },
  363. showContent(activity, index) {
  364. if (activity.cao_zuo_lei_xing_ === '新增') {
  365. return '第一版本'
  366. }
  367. return activity.xiu_ding_nei_rong
  368. ? activity.xiu_ding_nei_rong
  369. : '无修订原因'
  370. },
  371. handlePageChange() {
  372. if (document.visibilityState === 'hidden') {
  373. this.pauseTimer()
  374. } else {
  375. this.startTimer()
  376. }
  377. },
  378. closeDialog() {
  379. // 关闭时存入查阅时间
  380. if (this.browseTime && this.browseTime > 0 && this.timeId) {
  381. this.handleUpdate()
  382. }
  383. this.$emit('colseVisible', false)
  384. const fvView = this.$refs.fvView
  385. // 销毁子组件方法
  386. fvView.destoryZiComponent()
  387. if (this.browseTime >= 30) {
  388. this.upFunc(this.tmpId, this.browseTime)
  389. }
  390. // 针对关闭窗口或者浏览器的
  391. if (this.clearTimeSet != null) {
  392. clearInterval(this.clearTimeSet)
  393. this.clearTimeSet = null
  394. }
  395. this.leftShow = true
  396. this.out = false
  397. this.browseTime = 0
  398. // this.curFileName = ''// 本人添加
  399. // this.lookNum = null
  400. // this.showList = []
  401. // this.leftData = []
  402. // this.digData = null
  403. },
  404. hadLoadedFile(v) {
  405. // 计时开始,添加查看记录
  406. if (!this.curZid) {
  407. this.handleAdd(this.leftData[0]?.zId, 0)
  408. }
  409. this.setBrowseTime()
  410. this.hadLoad = true
  411. },
  412. setBrowseTime() {
  413. // 设置定时器
  414. this.clearTimeSet = setInterval(() => {
  415. this.browseTime++
  416. }, 1000)
  417. },
  418. getDialogHeightHeight() {
  419. return (
  420. (document.documentElement.clientHeight || document.body.clientHeight) -
  421. 60 +
  422. 'px'
  423. )
  424. },
  425. startTimer() {
  426. if (
  427. this.dialogVisible &&
  428. this.hadLoad &&
  429. this.out &&
  430. this.clearTimeSet == null
  431. ) {
  432. this.clearTimeSet = setInterval(() => {
  433. this.browseTime++
  434. }, 1000)
  435. }
  436. },
  437. pauseTimer() {
  438. if (this.dialogVisible) {
  439. this.out = true
  440. clearInterval(this.clearTimeSet)
  441. this.clearTimeSet = null
  442. }
  443. },
  444. // 本人修改
  445. // id转换
  446. async idChange(id) {
  447. // const sql = `select id_ FROM t_wjxxb WHERE shu_ju_lai_yuan_ = '${id}'`
  448. return new Promise((resolve, reject) => {
  449. this.$common
  450. .request('query', {
  451. key: 'getFileInfoById',
  452. params: [id]
  453. })
  454. .then((res) => {
  455. const { data = [] } = res.variables || {}
  456. const firstId = data[0]?.id_
  457. resolve(firstId) // 解析 Promise 时返回 firstId
  458. })
  459. .catch((error) => {
  460. reject(error) // 捕获错误并拒绝 Promise
  461. })
  462. })
  463. },
  464. toggleActive(activity, index) {
  465. if (this.activeIndex === index) {
  466. return
  467. }
  468. // 切换文件修订历史时,保存上一个文件查看记录,新增当前文件查看记录
  469. if (this.browseTime && this.browseTime > 0 && this.timeId) {
  470. this.handleUpdate()
  471. this.handleAdd(this.curZid || this.leftData[0]?.zId, 0)
  472. }
  473. this.activeIndex = index
  474. this.digData = activity
  475. this.curZid = activity.zid
  476. this.fileShow(activity)
  477. if (this.browseTime >= 30) {
  478. this.upFunc(this.tmpId, this.browseTime)
  479. }
  480. clearInterval(this.clearTimeSet)
  481. this.browseTime = 0
  482. this.curFileName = activity.FILE_NAME_
  483. this.checkNum(activity) // 阅读量
  484. // this.$forceUpdate()// 触发监听器
  485. },
  486. // 阅读量函数
  487. async checkNum(activity) {
  488. // 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`
  489. // const sql1 = `select * from t_wjcyjl where parent_id_= '${activity.id}' order by create_time_ desc`
  490. await this.$common
  491. .request('query', {
  492. key: 'getFileCheckRecord',
  493. params: [activity.id]
  494. })
  495. .then((res) => {
  496. const { data = [] } = res.variables || {}
  497. this.lookNum = data.length
  498. this.showList = data
  499. })
  500. },
  501. handleAdd(fileId, time) {
  502. const addParams = {
  503. tableName: 't_wjcyjl',
  504. paramWhere: [
  505. {
  506. bian_zhi_ren_: this.userId,
  507. bian_zhi_shi_jian: this.$common.getDateNow(19),
  508. parent_id_: fileId,
  509. shi_chang_: time
  510. }
  511. ]
  512. }
  513. curdPost('add', addParams).then((res) => {
  514. // this.refreshData()
  515. const { cont = [] } = res.variables || {}
  516. this.timeId = cont[0]?.id_ || ''
  517. })
  518. },
  519. handleUpdate() {
  520. const updateParams = {
  521. tableName: 't_wjcyjl',
  522. updList: [
  523. {
  524. where: {
  525. id_: this.timeId
  526. },
  527. param: {
  528. // shi_chang_: this.browseTime
  529. shi_chang_: 20
  530. }
  531. }
  532. ]
  533. }
  534. curdPost('update', updateParams).then((res) => {})
  535. },
  536. hideLeft() {
  537. this.leftShow = !this.leftShow
  538. },
  539. async lookFile() {
  540. // console.log(document.querySelector('iframe').contentWindow.document)
  541. // console.log(document.querySelector('iframe').contentWindow.document.body.innerHTML);
  542. if (this.digData) {
  543. await this.checkNum(this.digData)
  544. } else {
  545. this.digData = this.leftData[0]
  546. await this.checkNum(this.digData)
  547. }
  548. this.innerVisible = true
  549. },
  550. a() {
  551. fetch(this.optionFile.url)
  552. .then((response) => {
  553. if (response.ok) {
  554. // 如果响应状态码为 200-299,则创建下载链接
  555. const a = document.createElement('a')
  556. a.href = this.optionFile.url
  557. a.download = this.optionFile.data.fileName
  558. document.body.appendChild(a)
  559. a.click()
  560. a.remove()
  561. } else {
  562. // 如果响应状态码不是 200-299,则显示错误消息
  563. this.$message({
  564. message: '文件未找到,请联系管理员',
  565. type: 'warning'
  566. })
  567. console.error('文件未找到:', response.status, response.statusText)
  568. }
  569. })
  570. .catch((error) => {
  571. // 捕获网络请求错误
  572. this.$message({
  573. message: '网络请求失败,请联系管理员',
  574. type: 'warning'
  575. })
  576. console.error('网络请求失败:', error)
  577. })
  578. },
  579. deleteFile() {
  580. this.deleteVisible = false
  581. // const roleKey = ['xtgljs', 'syszr', 'wjgly', 'wjglzzc']
  582. const roleKey = ['xtgljs']
  583. const curRole = this.role.map((i) => i.alias)
  584. const isPower = curRole.some((item) => roleKey.includes(item))
  585. if (this.isSuper || isPower) {
  586. const deleteParams = {
  587. tableName: 't_wjxxb',
  588. paramWhere: { id_: this.leftData[0].zId }
  589. }
  590. curdPost('delete', deleteParams).then(() => {
  591. this.$message({
  592. message: '删除成功!',
  593. type: 'warning'
  594. })
  595. this.dialogVisible = false
  596. })
  597. return
  598. }
  599. this.$message({
  600. message: '您还没有权限,请联系管理员',
  601. type: 'warning'
  602. })
  603. },
  604. // closeDialog1 (val) {
  605. // this.innerVisible = val
  606. // },
  607. updateFile() {
  608. const hasRole = localStorage.getItem('hasHighRole') === '1'
  609. // const roleKey = ['xtgljs', 'wjglzzc', 'wjgly', 'zhsfzr']
  610. // const curRole = this.role.map(i => i.alias)
  611. // const isPower = curRole.some(i => roleKey.includes(i))
  612. if (this.isSuper || hasRole) {
  613. const a = document.createElement('a')
  614. a.href = this.optionFile.url
  615. console.log('文件下载替换前地址:', a.href)
  616. const url = new URL(a.href)
  617. //替换文件下载路径为浏览器路径
  618. url.host = window.location.host
  619. a.href = url.href
  620. console.log('文件下载替换后地址:', a.href)
  621. a.download = this.optionFile.data.fileName
  622. document.body.appendChild(a)
  623. a.click()
  624. a.remove()
  625. return
  626. }
  627. this.$message({
  628. message: '您还没有权限,请联系管理员',
  629. type: 'warning'
  630. })
  631. },
  632. fileShow(val) {
  633. return new Promise((resolve, reject) => {
  634. try {
  635. this.dialogVisible = true
  636. this.title = `文件:《${val.FILE_NAME_}》`
  637. this.idChange(val.id).then((res) => {
  638. this.tmpId = res
  639. if (val.func) {
  640. this.upFunc = val.func
  641. }
  642. const data = {
  643. ext: val.fileInfos.EXT_,
  644. fileName: val.fileInfos.FILE_NAME_,
  645. id: val.fileInfos.ID_,
  646. index: 0,
  647. totalBytes: val.fileInfos.TOTAL_BYTES_
  648. }
  649. this.optionFile.url = `${this.$onlyofficeApi}/file/download?attachmentId=${data.id}`
  650. this.optionFile.editUrl = `${this.$onlyofficeApi}/file/editCallback?fileName=${data.fileName}&fileType=${data.ext}&type=fileTraining&id=${data.id}`
  651. this.optionFile.title = data.fileName // 文件名称
  652. this.optionFile.fileType = data.ext // 类型
  653. this.optionFile.data = data // 记录编制的位置,需要替换。
  654. this.optionFile.data.index = data.index
  655. // 使用 v-if 实现组件刷新功能
  656. this.refresh = false
  657. this.$nextTick(() => {
  658. this.refresh = true
  659. resolve() // 异步操作完成后 resolve
  660. })
  661. })
  662. } catch (error) {
  663. reject(error)
  664. }
  665. })
  666. },
  667. // 排序函数
  668. sortByFabushijianDesc(data) {
  669. return data.sort((a, b) => {
  670. const dateA = new Date(a.fa_fang_shi_jian_)
  671. const dateB = new Date(b.fa_fang_shi_jian_)
  672. return dateB - dateA // 降序排序
  673. })
  674. },
  675. formattedTimestamp(timestamp) {
  676. const date = new Date(timestamp)
  677. // 获取年月日时分秒
  678. const year = date.getFullYear()
  679. const month = String(date.getMonth() + 1).padStart(2, '0')
  680. const day = String(date.getDate()).padStart(2, '0')
  681. const hours = String(date.getHours()).padStart(2, '0')
  682. const minutes = String(date.getMinutes()).padStart(2, '0')
  683. const seconds = String(date.getSeconds()).padStart(2, '0')
  684. // 格式化日期
  685. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
  686. },
  687. checkDialogBody() {
  688. const intervalId = setInterval(() => {
  689. if (document.querySelector('iframe')) {
  690. this.dialogBody = document.querySelector('iframe')
  691. this.addMouseMoveListener()
  692. clearInterval(intervalId)
  693. }
  694. }, 200)
  695. },
  696. addMouseMoveListener() {
  697. if (this.dialogBody && !this.mouseMoveHandler) {
  698. this.mouseMoveHandler = () => {
  699. console.log('鼠标移动事件!!!!')
  700. }
  701. this.dialogBody.addEventListener(
  702. 'mousemove',
  703. this.mouseMoveHandler,
  704. true
  705. )
  706. }
  707. },
  708. removeMouseMoveListener() {
  709. if (this.dialogBody && this.mouseMoveHandler) {
  710. this.dialogBody.removeEventListener(
  711. 'mousemove',
  712. this.mouseMoveHandler,
  713. true
  714. )
  715. this.mouseMoveHandler = null
  716. }
  717. },
  718. updateInnerVisible(newVal) {
  719. this.innerVisible = newVal
  720. }
  721. }
  722. }
  723. </script>
  724. <style lang="scss">
  725. .tooltip-max-width {
  726. max-width: 1200px !important; /* 固定最大宽度800px */
  727. width: max-content; /* 内容不足时自适应宽度,不占满800px */
  728. white-space: pre-wrap; /* 超长内容自动换行,避免横向溢出 */
  729. word-break: break-all; /* 英文/数字超长时强制换行 */
  730. padding: 8px 12px; /* 可选:调整内边距,优化排版 */
  731. }
  732. .ibps-file-preview-dialog {
  733. width: 80%;
  734. z-index: 99999;
  735. .el-dialog__body {
  736. padding: 0;
  737. }
  738. .file-type-txt {
  739. height: calc(88vh) !important;
  740. }
  741. .itemStyle:hover {
  742. cursor: pointer;
  743. }
  744. .titleHander,
  745. .read {
  746. line-height: 32px;
  747. }
  748. .deleteBtn {
  749. margin: 0 10px 0 0;
  750. }
  751. }
  752. .left-content {
  753. .left-title {
  754. text-align: left;
  755. padding: 15px;
  756. font-size: 18px;
  757. font-weight: 600;
  758. }
  759. .el-timeline {
  760. padding: 0 15px;
  761. }
  762. /* 清除分割线 */
  763. .el-collapse-item__wrap,
  764. .el-collapse-item__header {
  765. border-bottom: none !important;
  766. }
  767. .el-collapse {
  768. border: none !important;
  769. }
  770. .el-collapse-item__header {
  771. height: 30px;
  772. line-height: 30px;
  773. }
  774. .el-collapse-item__content {
  775. padding: 0px;
  776. }
  777. .el-timeline-item {
  778. padding-bottom: 10px;
  779. }
  780. }
  781. // .file-read-num{
  782. // display: inline-block;
  783. // margin-left: 60px;
  784. // }
  785. </style>