jinlin
2024-01-31 9025b9cf7ec8610003d445a31d93e35e7bd73c2e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
<template>
  <div class="aui-navbar" :class="`aui-navbar--${$store.state.navbarLayoutType}`">
    <div class="aui-navbar__header">
      <h1 class="aui-navbar__brand" @click="gotoHome" style="font-size: 16px">
        <img :src="srcUrl" width="30" height="30" alt="">
        <a class="aui-navbar__brand-lg" href="javascript:;">
          {{ $store.state.word.systemName }}<span style="color:red">{{ $store.state.word.mj }}</span></a>
        <a class="aui-navbar__brand-mini" href="javascript:;">{{ $store.state.word.systemName }}&ensp;<span
          style="color:red">{{ $store.state.word.mj }}</span></a>
      </h1>
    </div>
    <div class="aui-navbar__body">
      <el-menu class="aui-navbar__menu mr-auto" mode="horizontal">
        <!--        <el-menu-item index="1" @click="$store.state.sidebarFold = !$store.state.sidebarFold">-->
        <!--          <svg class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu&#45;&#45;switch" aria-hidden="true">-->
        <!--            <use xlink:href="#icon-outdent"></use>-->
        <!--          </svg>-->
        <!--        </el-menu-item>-->
        <el-menu-item index="2" @click="getRecordNumber(3);Collapse()">
          <i class="el-icon-s-fold"></i>
        </el-menu-item>
        <el-menu-item index="3" @click="refresh()">
          <i class="el-icon-refresh"></i>
        </el-menu-item>
      </el-menu>
      <!--      <el-form :inline="true" @submit.native.prevent @keyup.enter.native="search()" style="margin-right: 5px;">-->
      <!--        <el-form-item>-->
      <!--          <el-input v-model="dataForm.keyword" placeholder="综合查询" id="materialSearch"-->
      <!--                    style="width: 300px;margin-top:5px;"/>-->
      <!--        </el-form-item>-->
      <!--        &lt;!&ndash;<el-form-item class="message-btn">&ndash;&gt;-->
      <!--        &lt;!&ndash;<zt-button type="query" @click="search()" style="margin-top:9px;"></zt-button>&ndash;&gt;-->
      <!--        &lt;!&ndash;</el-form-item>&ndash;&gt;-->
      <!--      </el-form>-->
      <el-menu class="aui-navbar__menu" mode="horizontal" style=":hover{background:none} !important;">
        <!--        <el-menu-item>-->
        <!--          <local-ship-selector v-model="localShip" placeholder="舷号"/>-->
        <!--        </el-menu-item>-->
<!--        <el-menu-item>-->
<!--          <el-badge :value="feedCount" class="item" :hidden="!isAdmin">-->
<!--          <el-button @click="toFeedBack()" type="text">意见反馈</el-button>-->
<!--          </el-badge>-->
<!--        </el-menu-item>-->
        <el-tooltip class="item" effect="dark" content="帮助" placement="bottom">
          <el-menu-item v-if="help_show" index="4">
            <router-link tag="a" target="_blank" :to="{name:'userHelp',params:{id:0}}">
              <i class="bz-iconfont icon-bangzhu"></i>
            </router-link>
          </el-menu-item>
        </el-tooltip>
        <!--<el-menu-item class="menu">
          <el-badge :value="taskCount" class="item">
            <el-popover
              placement="bottom"
              width="800"
              trigger="hover">
              <i @click="task()" slot="reference" class="wt-iconfont icon-lingdang"></i>
              <zt-button type="primary" style="margin-bottom: 6px; float: right; margin-right: 40px"
                         @click="addOneClassFile1">一键已阅
              </zt-button>
              <el-table :data="gridData" lazy load="true" style="margin-top:10px;" height="300"
                        :default-sort="{prop: 'createDate', order: 'descending'}">
                <el-table-column width="80" type="index" :index="indexMethod" label="序号" align="center">
                </el-table-column>
                <el-table-column property="deptName,model,taskType" label="摘要" align="center">
                  <template slot-scope="scope">
                    <span @click="getJsfa(scope.row)" v-if="scope.row.code === 1" style="cursor: pointer">
                      {{ scope.row.deptName }}已上传{{ scope.row.model }}工程{{ scope.row.busiFieldName }}
                    </span>
                    <span style="cursor: pointer" v-else>{{ scope.row.model }}工程工程单{{ scope.row.taskType }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="操作" width="130" align="center">
                  <template v-slot="{ row }">
                    <zt-table-button v-if="row.code === 1" @click="addOneClassFile(row,1)">已阅</zt-table-button>
                    &lt;!&ndash;                      <zt-table-button v-if="row.code === 1" @click="addOneClassFile(row,2)">一键已阅</zt-table-button>&ndash;&gt;
                    <zt-table-button v-else @click="task(row)" style="color: coral">办理</zt-table-button>
                  </template>
                </el-table-column>
                <template slot="append">
                  <InfiniteLoading
                    @infinite="load"
                    spinner="circles"
                    force-use-infinite-wrapper=".el-table__body-wrapper">
                    <div slot="spinner">加载中...</div>
                    <div slot="no-more">所有数据加载完毕</div>
                    <div slot="no-results">加载完毕</div>
                  </InfiniteLoading>
                </template>
              </el-table>
            </el-popover>
          </el-badge>
        </el-menu-item>-->
        <el-menu-item v-if="$store.state.isGoToHome"  @click="goToIndex()">回到首页</el-menu-item>
        <!--<a href="#" @click="myNoticeRouter()"><i class="el-icon-bell"></i></a>-->
        <!--</el-badge>-->
        <!--</el-menu-item>-->
        <el-tooltip class="item" effect="dark" content="全屏" placement="bottom">
          <el-menu-item index="4" @click="fullscreenHandle('formal')">
            <svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true">
              <use xlink:href="#icon-fullscreen"></use>
            </svg>
          </el-menu-item>
        </el-tooltip>
        <el-tooltip class="item" effect="dark" content="投屏" placement="bottom">
          <el-menu-item index="4" @click="fullscreenHandle('large')" style="padding-top:2px;">
            <i class="el-icon-full-screen" aria-hidden="true">
              <use xlink:href="#icon-fullscreen"></use>
            </i>
          </el-menu-item>
        </el-tooltip>
        <el-menu-item index="1" class="aui-navbar__avatar" v-if="loginType === 'syLogin'">
          <el-dropdown trigger="click" @command="changeSystem">
            <span class="el-dropdown-link" style="font-weight: 700;font-size: 20px">
              {{ systemName }}
            </span>
            <el-dropdown-menu slot="dropdown" class="el-dropdown-link-xt">
              <el-dropdown-item :command="item" v-for="item in systemList" :key="item.name" :value="item.id" v-show="!item.disabled">
                {{ item.text }}
              </el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-menu-item>
        <el-menu-item index="5" class="aui-navbar__avatar" @click="getRecordNumber(4)">
          <el-dropdown placement="bottom" :show-timeout="0">
            <span class="el-dropdown-link">
              <!--<img src="~@/assets/img/avatar.png">-->
              <span>{{ $store.state.user.name }}({{ userRoleInfo.roleName }})</span>
              <i class="el-icon-arrow-down"></i>
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item @click.native="changeTheme()">{{ $t('changeTheme') }}</el-dropdown-item>
              <!--              <el-dropdown-item @click.native="updatePasswordHandle()">{{ $t('updatePassword.title') }}-->
              <!--              </el-dropdown-item>-->
              <el-dropdown-item @click.native="logoutHandle()">{{ $t('logout') }}</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-menu-item>
        <div class="aui-theme-tools" :class="{ 'aui-theme-tools--open': isOpen }">
          <!-- <div class="aui-theme-tools__toggle" @click="isOpen = !isOpen">
            <svg class="icon-svg" aria-hidden="true"><use xlink:href="#icon-setting"></use></svg>
          </div> -->
          <div id="div_panel" class="aui-theme-tools__content">
            <div class="aui-theme-tools__item">
              <h3>主题</h3>
              <div style="margin: 20px 0">
                <el-radio-group v-model="$store.state.theme" size="mini" @change="themehangeHandle">
                  <el-radio-button label="light">浅色</el-radio-button>
                  <el-radio-button label="high">深色</el-radio-button>
                </el-radio-group>
              </div>
            </div>
          </div>
        </div>
      </el-menu>
    </div>
    <!-- 弹窗, 修改密码 -->
    <update-password v-if="updatePasswordVisible" ref="updatePassword"></update-password>
<!--    <el-dialog title="系统功能" top="10vh" append-to-body width='85%' v-if="dialogVisible" v-dialogDrag :visible.sync="dialogVisible">-->
<!--      <el-tabs id="scheduleTabs" v-model="activeName" @tab-click="getDiagramProject">-->
<!--        <el-tab-pane label="问题解决方案" name="1">-->
<!--          <QuestionSolution></QuestionSolution>-->
<!--        </el-tab-pane>-->
<!--        <el-tab-pane label="表关联管理" name="2">-->
<!--          <TableRelation></TableRelation>-->
<!--        </el-tab-pane>-->
<!--        <el-tab-pane label="数据字典" name="3">-->
<!--          <DatabaseTableInfo></DatabaseTableInfo>-->
<!--        </el-tab-pane>-->
<!--        <el-tab-pane label="表结构维护" name="4">-->
<!--          <TableStructMaintain></TableStructMaintain>-->
<!--        </el-tab-pane>-->
<!--      </el-tabs>-->
<!--    </el-dialog>-->
  </div>
 
</template>
<script>
  import Cookies from 'js-cookie'
  import screenfull from 'screenfull'
  // import UpdatePassword from './main-navbar-update-password'
  import {clearLoginInfo} from '../../../packages/utils'
  import debounce from 'lodash/debounce'
  import router from '../../router'
  import InfiniteLoading from 'vue-infinite-loading'
  import srcUrl from '../../../public/logo.png'
 
  function addEventHandler(target, type, func) {
    if (target.addEventListener) {
      target.addEventListener(type, func, false)
    } else if (target.attachEvent) {
      target.attachEvent('on' + type, func)
    } else {
      target['on' + type] = func
    }
  }
 
  function removeEventHandler(target, type, func) {
    if (target.removeEventListener) {
      target.removeEventListener(type, func, false)
    } else if (target.detachEvent) {
      target.detachEvent('on' + type, func)
    } else {
      delete target['on' + type]
    }
  }
 
  function documentMouseDown(e) {
    var element = typeof event !== 'undefined' ? event.srcElement : e.target
    var downPanel = false
    while (element) {
      downPanel = element === document.getElementById('div_panel')
      if (downPanel) break
      element = element.parentNode
    }
    if (!downPanel) {
      removeEventHandler(document, 'mousedown', documentMouseDown)
      document.getElementById('div_panel').style.display = 'none'
    }
  }
 
  // var socket = null
  export default {
    inject: ['Collapse', 'refresh'],
    props: {
      letter: String,
      falg: {
        type: Boolean,
        default: false
      }
    },
    data() {
      return {
        help_show:true,
        loginType:'',
        activeName: '1',
        dialogVisible: false,
        recordNumber: 0,
        srcUrl: srcUrl,
        pageIndex: 1,
        pageSize: 60,
        technologyurl: '',
        userRoleInfo: {},
        msg: '',
        gridData: [],
        isOpen: false,
        localShip: 0,
        themeColor: '',
        dataForm: {
          keyword: ''
        },
        updatePasswordVisible: false,
        messageTip: false,
        taskCount: '',
        taskList: [],
        feedCount:'',
        system:'',
        isAdmin:false
      }
    },
    created() {
      let that = this
      this.getUserRoleInfo()
      this.$EventBus.$on('changeTheme', function () {
        that.isOpen = true
      })
      //this.systemList = window.SITE_CONFIG['menuList']
      this.loginType=Cookies.get('loginType')
      // Cookies.get('loginType')
    },
    watch: {
      themeColor(val) {
        this.$router.go(0)
      },
      '$route.params.keyword'() {
        this.dataForm.keyword = this.$route.params.keyword
        this.query()
      },
      localShip(val) {
        this.$store.commit('setLocalShip', val)
      },
    },
    mounted() {
      // alert(`${window.SITE_CONFIG['apiURL']}/sys/oss/commFile?fileFlag=logo`)
      // this.srcUrl = `${window.SITE_CONFIG['apiURL']}/sys/oss/commFile?fileFlag=logo&token=${Cookies.get('token')}`
      // this.srcUrl = require('../../../public/logo.png')
 
      // this.$http.get('http://127.0.0.1:8086/life-protection/sys/oss/commFile?fileFlag=logo').then(res => {
      //   console.log(res,'res')
      // })
      // this.getUserRoleInfo()
      this.system = this.$store.state.user.system
/*      alert(this.system)
      if(this.system){
        if(this.system==='djxl'|| this.system==='smj'){
          this.help_show = true
        }
      }*/
      // if (Cookies.get('system') === "djxl" || Cookies.get('system') === "smj" ){
      //   this.help_show = true
      // }
 
      this.$EventBus.$on('formSubmit', (msg) => {
        this.msg = msg
        // console.log(msg)
      })
      this.$EventBus.$on('reLogin', () => {
        this.gotoLogin()
      })
      this.$EventBus.$on('singleSignVerify', () => {
        let token = Cookies.get('singleSignToken')
        let verifyUrl = Cookies.get('singleSignVerifyUrl')
        // console.log('singleSignVerifyUrl', verifyUrl)
        // console.log('singleSignToken',token)
        if (verifyUrl && token) {
          console.log('do singleSignVerify')
/*          this.$http2.get(verifyUrl, {params: {token: token}}).then(res => {
            console.log(res,'singleSignVerify return')
          })*/
        }
      })
 
      if (Cookies.get('loginMethod') === 'single'){
        this.technologyurl = 'http://'+location.hostname+':8080/select'
        this.loginUrl = 'http://'+location.hostname+':8080/login'
      }else{
        this.technologyurl = 'http://'+location.hostname+':8020/#/home'
        this.loginUrl = 'http://'+location.hostname+':8020/#/login'
      }
/*      this.$http.get('/sys/data/export/inte/technologyurl').then(res => {
        this.technologyurl = res.data.url
      })
      this.$http.get('/sys/data/export/inte/loginurl').then(res => {
        this.loginUrl = res.data.url
      })*/
 
      this.getTaskCount()
      // console.log(this.$store.state.user,'this.$store.state.user.debug navbar6666666666')
 
      this.isAdmin = this.$store.state.user.isAdmin
    },
    methods: {
      getHelp(){
        console.log(this.system)
        if(this.system&&this.system==='smj'){
          window.open('./help/smjVideo/index.html','_blank');
        }else if(this.system==='djxl') {
          window.open('./help/djxlVideo/index.html','_blank');
        }
      },
      getDiffDay(date_1, date_2) {
        // 计算两个日期之间的差值
        let totalDays, diffDate
        let myDate_1 = Date.parse(date_1)
        let myDate_2 = Date.parse(date_2)
        // 将两个日期都转换为毫秒格式,然后做差
        diffDate = Math.abs(myDate_1 - myDate_2) // 取相差毫秒数的绝对值
        totalDays = Math.floor(diffDate / (1000 * 3600 * 24)) // 向下取整
        // console.log(totalDays)
        return totalDays    // 相差的天数
      },
      // 获取当前用户登录信息
      getUserRoleInfo() {
        return this.$http.get('/user/userRoleInfo').then(res => {
          this.loading = false
          if (res.code !== 0) {
            return this.$message.error(res.msg)
          }
          this.userRoleInfo = res.data
          console.log(this.userRoleInfo, 'userRoleInfo')
        }).catch(() => {
        })
      },
      async gotoHome() {
/*        let res = await this.$http.post('/logout')
        if (!res.success) {
          console.log(res.msg)
        }
        clearLoginInfo()
*/
        window.location.href = this.technologyurl
      },
      // 退出
      async logoutHandle() {
        if (await this.$tip.confirm(this.$t('prompt.info', {'handle': this.$t('logout')}))) {
          let res = await this.$http.post('/logout')
          if (!res.success) {
            return this.$message.error(res.msg)
          }
          this.gotoLogin()
        }
      },
      async gotoLogin() {
        clearLoginInfo()
        console.log(Cookies.get('loginMethod'), 'gotoLogin loginMethod')
        if (Cookies.get('loginMethod') === 'single') {
          window.location.href = this.loginUrl
        } else {
          this.$router.push({name: 'login'})
        }
      },
      indexMethod(index) {
        return index += 1
      },
      task(row) {
        this.getRecordNumber(1)
        let menuId = '1439894944222408706'
        let route = window.SITE_CONFIG['dynamicMenuRoutes'].filter(item => item.meta.menuId === menuId)[0]
        if (route === undefined) {
          this.$tip.alert('没有配置菜单权限')
          return
        }
        let params = {
          projectId: row.id, approveStepId: row.approveStepId
        }
        if (Object.keys(params).length > 0) {
          params = Object.assign(params, route.meta.params)
        }
        this.$router.push({
          name: menuId,
          params: params
        })
      },
      async getTaskCount() {
        let res = await this.$http.get(`/task/taskCenter/page`)
        if (res.success) {
          // this.taskCount = res.data.length
          this.taskList = res.data
          // console.log(this.taskList, "12311")
        }
      },
      goToIndex() {
        console.log(this.$store.state.user.roleName,'this.$store.state.user.roleName')
        this.$router.push({name: 'TestDjxlHome',params: {roleName: this.$store.state.user.roleName}})
        // window.console.log(this.$route.name)
      },
      themehangeHandle(val) {
        this.themeColor = val
        Cookies.set('systemTheme', val)
        let body = document.querySelector('body')
        let clazz = body.className
        if (val === 'light') {
          clazz = clazz.replace(' high', '').replace(' light', '')
        } else {
          clazz = clazz.replace(' light', '').replace(' high', '')
        }
        body.className = clazz + ' ' + val
        this.isOpen = false
      },
      search() {
        let keyword = document.getElementById('materialSearch').value
        this.$EventBus.$emit('search', keyword)
        if (keyword) {
          this.$router.push({
            name: 'search',
            params: {
              keyword: keyword
            }
          })
        } else {
        }
      },
      // 更换主题
      changeTheme() {
        document.getElementById('div_panel').style.display = ''
        addEventHandler(document, 'mousedown', documentMouseDown)
        this.$EventBus.$emit('changeTheme')
      },
      myNoticeRouter() {
        this.$router.replace('notice-notice-user')
      },
      getUnReadCount() {
        this.$http.get(`/sys/notice/my/unread`).then(res => {
          if (res.code !== 0) {
            return this.$message.error(res.msg)
          }
          if (res.data > 0) {
            this.messageTip = true
          }
        }).catch(() => {
        })
      },
      // 全屏
      fullscreenHandle(param) {
        this.getRecordNumber(2)
        if (!screenfull.enabled) {
          return this.$message({
            message: this.$t('fullscreen.prompt'),
            type: 'warning',
            duration: 500
          })
        }
        // this.is_sidebar = false
        // this.$emit('getSide',this.is_sidebar)
        this.$emit('windowResize', param, this.recordNumber)
        this.$EventBus.$emit('netWorkDiagramHeight', '网络图高度')
        if (!screenfull.isFullscreen) {
          screenfull.toggle()
        }
      },
      getRecordNumber(param) {
        if (param == this.recordNumber + 1) {
          this.recordNumber = param
          if (param == 4) {
            this.recordNumber = 0
            this.dialogVisible = true
 
            this.$store.state.debugging = true
          }
        } else {
          this.recordNumber = 0
        }
      },
      // fullscreenHandleResize(){
      //   if (!screenfull.enabled) {
      //     return this.$message({
      //       message: this.$t('fullscreen.prompt'),
      //       type: 'warning',
      //       duration: 500
      //     })
      //   }
      //   console.log('111111111')
      //   this.$emit('windowResizeHandle','open');
      //   screenfull.toggle()
      // },
      // 修改密码
      // updatePasswordHandle() {
      //   this.updatePasswordVisible = true
      //   this.$nextTick(() => {
      //     this.$refs.updatePassword.init()
      //   })
      // },
      changeSystem(system) {
        console.log(Cookies.get('token'),'Cookies token')
        console.log(system.path,'system.path')
        this.$nextTick(() => {
          window.location.href = system.path
          if (system.path.indexOf('8020')>-1) {
            window.location.reload()
          }
        })
 
        /*      this.$store.state.contentTabs = []
              this.systemName = system.name
              Cookies.set('systemId', system.id)
              this.$store.commit('setMenuList', system.children)
              if (system.children.length > 0) {
                let firstMenu = system.children[0]
                if ((firstMenu.children || []).length > 0) {
                  firstMenu = firstMenu.children[0]
                }
                //if ((firstMenu.url || '').length > 0 && (firstMenu.remark || firstMenu.name).indexOf('首页') >= 0) {
                if ((firstMenu.url || '').length > 0) {
                  this.gotoRouteHandle(firstMenu.id)
                }
              }*/
      },
      gotoRouteHandle(menuId) {
        let route = window.SITE_CONFIG['dynamicMenuRoutes'].filter(item => item.meta.menuId === menuId)[0]
        if (route) {
          this.$router.push({name: route.name})
        }
      },
    }
  }
</script>
<style>
.v-modal {
  opacity: 1;
  background: rgb(48 33 33 / 50%)
}
 
.el-dropdown-link-xt {
  background: #586587;
}
 
.el-dropdown-link-xt .el-dropdown-menu__item {
  color: #fff;
  padding-left: 10px;
  font-size: 16px;
}
 
.el-dropdown-link-xt .el-dropdown-menu__item:hover {
  color: #fff;
  background: #17507c !important
}
</style>