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