Bladeren bron

fix:调整定时任务数据获取接口调用完再渲染首页页面

liujiayin 2 jaren geleden
bovenliggende
commit
682c5275d2
1 gewijzigde bestanden met toevoegingen van 455 en 451 verwijderingen
  1. 455 451
      src/views/system/dashboard/page.vue

+ 455 - 451
src/views/system/dashboard/page.vue

@@ -48,7 +48,7 @@
             </template>
         </newHome> -->
         <workbench
-            v-if="cronTask"
+            v-if="cronTask && scheduledTask"
             :plan="cronTask"
             @handleApprove="handleApprove"
             @handleUnreadMessage="handleUnreadMessage"
@@ -156,488 +156,492 @@
 </template>
 
 <script>
-    import { getMyDesktop } from '@/api/platform/desktop/myLayout'
-    import { initColumn, isInit, getComponents } from './components'
-    // 引用导出地址
-    import { BASE_API, BUSINESS_BASE_URL } from '@/api/baseUrl'
-    //  网格布局组件
-    import { GridLayout, GridItem } from 'vue-grid-layout'
-    import IbpsBackToTop from '@/components/ibps-back-to-top'
-    import Preview from '@/views/platform/desktop/column/preview'
-    import BpmnFormrender from '@/business/platform/bpmn/form/dialog'
+import { getMyDesktop } from '@/api/platform/desktop/myLayout'
+import { initColumn, isInit, getComponents } from './components'
+// 引用导出地址
+import { BASE_API, BUSINESS_BASE_URL } from '@/api/baseUrl'
+//  网格布局组件
+import { GridLayout, GridItem } from 'vue-grid-layout'
+import IbpsBackToTop from '@/components/ibps-back-to-top'
+import Preview from '@/views/platform/desktop/column/preview'
+import BpmnFormrender from '@/business/platform/bpmn/form/dialog'
 
-    import IbpsNewsDialog from '@/views/platform/system/news/cms'
-    import IbpsMessageDialog from '@/views/platform/message/inner/detail/dialog'
-    import { StatisticsData, StatisticsSign } from '@/api/platform/system/jbdHome'
-    import { getToken } from '@/utils/auth'
-    import newHome from './components/new-home'
-    import Workbench from './components/workbench.vue'
-    import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
-    import param from '@/store/modules/ibps/modules/param'
+import IbpsNewsDialog from '@/views/platform/system/news/cms'
+import IbpsMessageDialog from '@/views/platform/message/inner/detail/dialog'
+import { StatisticsData, StatisticsSign } from '@/api/platform/system/jbdHome'
+import { getToken } from '@/utils/auth'
+import newHome from './components/new-home'
+import Workbench from './components/workbench.vue'
+import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
+import param from '@/store/modules/ibps/modules/param'
 
-    const _import = require('@/utils/util.import.' + process.env.NODE_ENV)
-    let cronTask = null
-    export default {
-        components: {
-            'ibps-news-dialog': IbpsNewsDialog,
-            'ibps-message-dialog': IbpsMessageDialog,
-            IbpsBackToTop,
-            Preview,
-            newHome,
-            Workbench,
-            BpmnFormrender,
-            'ibps-grid-layout': GridLayout,
-            'ibps-grid-item': GridItem
-        },
-        data () {
-            return {
-                cronTask,
-                infoMessage: [],
-                uloadPath: BASE_API() + BUSINESS_BASE_URL() + '/ck/task/importExcel',
-                reportPath: BASE_API() + BUSINESS_BASE_URL() + '/sys/SysDataContext/replaceReportFile',
-                layout: null,
-                colNum: 24,
-                rowHeight: 30,
-                isDraggable: false,
-                isResizable: false,
-                isMirrored: false,
-                verticalCompact: true,
-                margin: [15, 15],
-                useCssTransforms: true,
-                taskId: '',
-                ibpsNewsDialogVisible: false,
-                newsEditId: '',
-                showRepost: true,
+const _import = require('@/utils/util.import.' + process.env.NODE_ENV)
+let cronTask = null
+export default {
+    components: {
+        'ibps-news-dialog': IbpsNewsDialog,
+        'ibps-message-dialog': IbpsMessageDialog,
+        IbpsBackToTop,
+        Preview,
+        newHome,
+        Workbench,
+        BpmnFormrender,
+        'ibps-grid-layout': GridLayout,
+        'ibps-grid-item': GridItem
+    },
+    data () {
+        return {
+            cronTask,
+            infoMessage: [],
+            uloadPath: BASE_API() + BUSINESS_BASE_URL() + '/ck/task/importExcel',
+            reportPath: BASE_API() + BUSINESS_BASE_URL() + '/sys/SysDataContext/replaceReportFile',
+            layout: null,
+            colNum: 24,
+            rowHeight: 30,
+            isDraggable: false,
+            isResizable: false,
+            isMirrored: false,
+            verticalCompact: true,
+            margin: [15, 15],
+            useCssTransforms: true,
+            taskId: '',
+            ibpsNewsDialogVisible: false,
+            newsEditId: '',
+            showRepost: true,
 
-                ibpsMessageDialogVisible: false,
-                messageEditId: '',
+            ibpsMessageDialogVisible: false,
+            messageEditId: '',
 
-                scrollDelay: 0,
-                scrollTop: 0,
-                initLoading: false,
-                loading: false,
-                id: '',
-                dialogPreviewVisible: false, // 预览
-                defaultData: [],
+            scrollDelay: 0,
+            scrollTop: 0,
+            initLoading: false,
+            loading: false,
+            id: '',
+            dialogPreviewVisible: false, // 预览
+            defaultData: [],
 
-                bpmnFormrenderDialogVisible: false, // 流程
-                defId: '',
-                instanceId: '',
-                layoutIndex: '',
-                initInterval: null,
+            bpmnFormrenderDialogVisible: false, // 流程
+            defId: '',
+            instanceId: '',
+            layoutIndex: '',
+            initInterval: null,
 
-                systemUrlType: 'iframe',
-                systemUrlName: '',
-                systemUrlParams: {},
-                alias: '',
-                headers: {
-                    'X-Authorization-access_token': getToken()
-                }
-            }
-        },
-        computed: {
-            system () {
-                return this.$store.getters.system ? this.$store.getters.system : null
+            systemUrlType: 'iframe',
+            systemUrlName: '',
+            systemUrlParams: {},
+            alias: '',
+            headers: {
+                'X-Authorization-access_token': getToken()
             },
-            systemAlias () {
-                return this.$store.getters.system ? this.$store.getters.system.alias : ''
-            },
-            localSystem () {
-                return this.system.isLocal
-            }
+            scheduledTask: false
+        }
+    },
+    computed: {
+        system () {
+            return this.$store.getters.system ? this.$store.getters.system : null
         },
-        beforeRouteEnter(to, from, next){
-            const { first = '', second = '' } = param.state.level
-            const sql = `select * from t_jhswpzb where di_dian_ = '${second || first}'`
-            curdPost('sql', sql).then(res => {
-                const { data = [] } = res.variables || {}
-                cronTask = data.map(i => i.liu_cheng_key_)
-                next()
-            }).catch(error => {
-                alert('获取计划事务配置表信息失败,请刷新页面重试!')
-                console.log(error)
-            })
+        systemAlias () {
+            return this.$store.getters.system ? this.$store.getters.system.alias : ''
         },
-        mounted () {
-            if (localStorage.getItem('statistic') === 'isNormal') {
-                this.showRepost = false
+        localSystem () {
+            return this.system.isLocal
+        }
+    },
+    beforeRouteEnter (to, from, next) {
+        const { first = '', second = '' } = param.state.level
+        const sql = `select * from t_jhswpzb where di_dian_ = '${second || first}'`
+        curdPost('sql', sql).then(res => {
+            const { data = [] } = res.variables || {}
+            cronTask = data.map(i => i.liu_cheng_key_)
+            next()
+        }).catch(error => {
+            alert('获取计划事务配置表信息失败,请刷新页面重试!')
+            console.log(error)
+        })
+    },
+    mounted () {
+        if (localStorage.getItem('statistic') === 'isNormal') {
+            this.showRepost = false
+        }
+        this.initLoading = false
+        this.initData()
+    },
+    created () {
+        const today = new Date().toLocaleDateString()
+        const savedDate = localStorage.getItem('doNotShowToday')
+        if (savedDate !== today) {
+            // this.getPeriodTask()
+        }
+        StatisticsData().then(data => {
+            this.scheduledTask = true
+            // 将参数替换成对应参数
+            // if (data.state === 200 && data.variables.data.length > 0) {
+            //     const h = this.$createElement
+            //     const cont = data.variables.data
+            //     for (let i = 0; i < cont.length; i++) {
+            //         window.setTimeout(() => {
+            //             this.infoMessage[i] = this.$notify.info({
+            //                 title: '定时任务:' + cont[i].ren_wu_biao_ti_,
+            //                 message: h('p', null, [
+            //                     h('span', null, '任务时间: ' + cont[i].ren_wu_shi_jian_),
+            //                     h('br'),
+            //                     h('span', null, '任务内容: '),
+            //                     h('span', { style: 'color: #FF8C00;font-size:12px;' }, cont[i].ding_shi_ren_wu_n),
+            //                     h('br'),
+            //                     h('el-button', {
+            //                         attrs: {
+            //                             size: 'mini',
+            //                             plain: true
+            //                         },
+            //                         on: {
+            //                             click: () => {
+            //                                 this.infoMessage[i].close()
+            //                             } // 路由加载之后,调用关闭消息弹窗的方法
+            //                         }
+            //                     }, '忽略关闭')
+            //                 ]),
+            //                 duration: 0
+            //             })
+            //         }, 0)
+            //     }
+            // }
+        }).catch(() => {
+            this.scheduledTask = true
+        })
+    },
+    beforeDestroy () {
+        for (let i = 0; i < this.infoMessage.length; i++) {
+            this.infoMessage[i].close()
+        }
+    },
+    methods: {
+        cancelInfo (cronId, title, num, processData, taskId) {
+            /* 调用流程*/
+            if (taskId) {
+                this.$router.push({
+                    name: 'pendingItems'
+                })
+            } else if (processData) {
+                this.defId = processData
+                this.bpmnFormrenderDialogVisible = true
             }
-            this.initLoading = false
-            this.initData()
+            this.infoMessage[num].close()
         },
-        created () {
-            const today = new Date().toLocaleDateString()
-            const savedDate = localStorage.getItem('doNotShowToday')
-            if (savedDate !== today) {
-                // this.getPeriodTask()
-            }
-            StatisticsData().then(data => {
-                // 将参数替换成对应参数
-                // if (data.state === 200 && data.variables.data.length > 0) {
-                //     const h = this.$createElement
-                //     const cont = data.variables.data
-                //     for (let i = 0; i < cont.length; i++) {
-                //         window.setTimeout(() => {
-                //             this.infoMessage[i] = this.$notify.info({
-                //                 title: '定时任务:' + cont[i].ren_wu_biao_ti_,
-                //                 message: h('p', null, [
-                //                     h('span', null, '任务时间: ' + cont[i].ren_wu_shi_jian_),
-                //                     h('br'),
-                //                     h('span', null, '任务内容: '),
-                //                     h('span', { style: 'color: #FF8C00;font-size:12px;' }, cont[i].ding_shi_ren_wu_n),
-                //                     h('br'),
-                //                     h('el-button', {
-                //                         attrs: {
-                //                             size: 'mini',
-                //                             plain: true
-                //                         },
-                //                         on: {
-                //                             click: () => {
-                //                                 this.infoMessage[i].close()
-                //                             } // 路由加载之后,调用关闭消息弹窗的方法
-                //                         }
-                //                     }, '忽略关闭')
-                //                 ]),
-                //                 duration: 0
-                //             })
-                //         }, 0)
-                //     }
-                // }
-            })
+        downloadData () {
+            window.location.href = BASE_API() + BUSINESS_BASE_URL() + '/sys/SysDataContext/downloadData'
         },
-        beforeDestroy () {
-            for (let i = 0; i < this.infoMessage.length; i++) {
-                this.infoMessage[i].close()
-            }
+        scrollToTop () {
+            this.$refs.dashboardContainer.scrollToTop()
         },
-        methods: {
-            cancelInfo (cronId, title, num, processData, taskId) {
-                /* 调用流程*/
-                if (taskId) {
-                    this.$router.push({
-                        name: 'pendingItems'
-                    })
-                } else if (processData) {
-                    this.defId = processData
-                    this.bpmnFormrenderDialogVisible = true
-                }
-                this.infoMessage[num].close()
-            },
-            downloadData () {
-                window.location.href = BASE_API() + BUSINESS_BASE_URL() + '/sys/SysDataContext/downloadData'
-            },
-            scrollToTop () {
-                this.$refs.dashboardContainer.scrollToTop()
-            },
-            initData () {
-                this.initInterval = setInterval(() => {
-                    if (this.$utils.isNotEmpty(this.systemAlias)) {
-                        this.initLoading = true
-                        if (this.localSystem) {
-                            // this.fetchData()
-                        } else {
-                            this.initSystemUrl(this.system.homePage)
-                        }
-                        clearInterval(this.initInterval)
+        initData () {
+            this.initInterval = setInterval(() => {
+                if (this.$utils.isNotEmpty(this.systemAlias)) {
+                    this.initLoading = true
+                    if (this.localSystem) {
+                        // this.fetchData()
+                    } else {
+                        this.initSystemUrl(this.system.homePage)
                     }
-                }, 100)
-            },
-            // 抓取数据
-            // fetchData() {
-            //   initColumn(this.systemAlias)
-            //   this.loading = true
-            //    const interval = setInterval(() => {
-            //    if (isInit()) {
-            //   //     getMyDesktop({
-            //   //       systemAlias: this.systemAlias
-            //   //     }).then(response => {
-            //   //       try {
-            //   //         this.layout = this.$utils.parseData(response.data)
-            //   //         this.defaultData = this.$utils.parseData(response.data)
-            //   //       } catch (error) {
-            //   //         this.layout = []
-            //   //         this.defaultData = []
-            //   //       }
-            //   //       this.loading = false
-            //   //     }).catch(() => {
-            //   //       this.loading = false
-            //   //     })
-            //       clearInterval(interval)
-            //    }
-            //    }, 100)
-            // },
-            getHeight (h) {
-                return (h - 1) * (this.rowHeight + this.margin[1]) + this.margin[1]
-            },
-            hasComponent (alias) {
-                const name = 'ibps-desktop-' + alias
-                const components = getComponents()
-                if (components) {
-                    return components.includes(name)
-                } else {
-                    return false
+                    clearInterval(this.initInterval)
                 }
-            },
-            resizedHandler (i, newH, newW, newHPx, newWPx) {
-                if (!this.layout) return
-                this.layout.layout.find(n => {
-                    if (i === n.i) {
-                        n.widthPx = this.getWidth(n.w)
-                        n.heightPx = this.getHeight(n.h)
-                    }
-                })
-            },
-            goMyLayout () {
-                this.$router.push({ path: '/officeDesk/grzlsw/desktopMyLayout' })
-            },
-            handleActionEvent (command, params, index) {
-                this.layoutIndex = index
-                this.alias = params.$alias
-                switch (command) {
-                    case 'fullscreen':
-                        this.handleFullscreen(params.id)
-                        break
-                    case 'collapse':
-                    case 'expansion':
-                        this.handleCollapseExpansion(index, command === 'collapse')
-                        break
-                    case 'flow':
-                        this.handleFlow(params)
-                        break
-                    case 'approve':
-                        this.handleApprove(params)
-                        break
-                    case 'unRead':
-                        this.handleUnreadMessage(params)
-                        break
-
-                    default:
-                        break
+            }, 100)
+        },
+        // 抓取数据
+        // fetchData() {
+        //   initColumn(this.systemAlias)
+        //   this.loading = true
+        //    const interval = setInterval(() => {
+        //    if (isInit()) {
+        //   //     getMyDesktop({
+        //   //       systemAlias: this.systemAlias
+        //   //     }).then(response => {
+        //   //       try {
+        //   //         this.layout = this.$utils.parseData(response.data)
+        //   //         this.defaultData = this.$utils.parseData(response.data)
+        //   //       } catch (error) {
+        //   //         this.layout = []
+        //   //         this.defaultData = []
+        //   //       }
+        //   //       this.loading = false
+        //   //     }).catch(() => {
+        //   //       this.loading = false
+        //   //     })
+        //       clearInterval(interval)
+        //    }
+        //    }, 100)
+        // },
+        getHeight (h) {
+            return (h - 1) * (this.rowHeight + this.margin[1]) + this.margin[1]
+        },
+        hasComponent (alias) {
+            const name = 'ibps-desktop-' + alias
+            const components = getComponents()
+            if (components) {
+                return components.includes(name)
+            } else {
+                return false
+            }
+        },
+        resizedHandler (i, newH, newW, newHPx, newWPx) {
+            if (!this.layout) return
+            this.layout.layout.find(n => {
+                if (i === n.i) {
+                    n.widthPx = this.getWidth(n.w)
+                    n.heightPx = this.getHeight(n.h)
                 }
-            },
-            /**
+            })
+        },
+        goMyLayout () {
+            this.$router.push({ path: '/officeDesk/grzlsw/desktopMyLayout' })
+        },
+        handleActionEvent (command, params, index) {
+            this.layoutIndex = index
+            this.alias = params.$alias
+            switch (command) {
+                case 'fullscreen':
+                    this.handleFullscreen(params.id)
+                    break
+                case 'collapse':
+                case 'expansion':
+                    this.handleCollapseExpansion(index, command === 'collapse')
+                    break
+                case 'flow':
+                    this.handleFlow(params)
+                    break
+                case 'approve':
+                    this.handleApprove(params)
+                    break
+                case 'unRead':
+                    this.handleUnreadMessage(params)
+                    break
+
+                default:
+                    break
+            }
+        },
+        /**
              * 全屏展示切换
              */
-            handleFullscreen (id) {
-                this.dialogPreviewVisible = true
-                this.id = id
-            },
-            // 处理收缩/展开
-            handleCollapseExpansion (index, isCollapse) {
-                this.layout[index].h = isCollapse ? 2 : this.defaultData[index].h
-                this.layout.push({ i: '0' })
-                const deleteIndex = this.layout.findIndex(item => item.i === '0')
-                this.layout.splice(deleteIndex, 1)
-            },
+        handleFullscreen (id) {
+            this.dialogPreviewVisible = true
+            this.id = id
+        },
+        // 处理收缩/展开
+        handleCollapseExpansion (index, isCollapse) {
+            this.layout[index].h = isCollapse ? 2 : this.defaultData[index].h
+            this.layout.push({ i: '0' })
+            const deleteIndex = this.layout.findIndex(item => item.i === '0')
+            this.layout.splice(deleteIndex, 1)
+        },
 
-            handleApprove (id) {
-                this.ibpsNewsDialogVisible = true
-                this.newsEditId = id
-            },
+        handleApprove (id) {
+            this.ibpsNewsDialogVisible = true
+            this.newsEditId = id
+        },
 
-            handleUnreadMessage (id) {
-                this.ibpsMessageDialogVisible = true
-                this.messageEditId = id
-            },
-            fileErr (err, file, fileList) {
-                this.$message.error('文件上传失败,请检查格式!')
-            },
-            handleFlow (params) {
-                this.defId = params.defId || null
-                this.taskId = params.taskId || null
-                this.instanceId = params.instanceId || null
+        handleUnreadMessage (id) {
+            this.ibpsMessageDialogVisible = true
+            this.messageEditId = id
+        },
+        fileErr (err, file, fileList) {
+            this.$message.error('文件上传失败,请检查格式!')
+        },
+        handleFlow (params) {
+            this.defId = params.defId || null
+            this.taskId = params.taskId || null
+            this.instanceId = params.instanceId || null
 
-                this.instanceId = params.instanceId || null
-                this.instanceId = params.instanceId || null
+            this.instanceId = params.instanceId || null
+            this.instanceId = params.instanceId || null
 
-                this.bpmnFormrenderDialogVisible = true
-            },
-            handleFlowCallback () {
-                this.$refs[this.alias] ? this.$refs[this.alias][0].refreshData() : null
-            },
-            initSystemUrl (url) {
-                if (url.startsWith('http')) {
-                    this.systemUrlType = 'iframe'
-                    this.$nextTick(() => {
-                        this.$refs.systemrender.src = url
-                        // 传递消息
-                        // this.$refs.systemrender.contentWindow.postMessage({ data: this.attributes }, '*')
-                    })
-                } else {
-                    const component = url.split('?')[0]
-                    this.systemUrlParams.attrs = this.urlParse(url)
-                    this.systemUrlType = 'inner'
-                    const systemUrlName = 'IbpsBpmnSystemUrl'
-                    this.$options.components[systemUrlName] = _import(component)
-                    this.systemUrlName = systemUrlName
-                }
-            },
-            urlParse (str) {
-                const obj = {}
-                if (str.indexOf('?') !== -1) {
-                    const str1 = str.split('?')[1].split('&')
-                    for (let i = 0; i < str1.length; i++) {
-                        const params = str1[i].split('=')
-                        obj[params[0]] = params[1]
-                    }
-                }
-                return obj
-            },
-            /* 文件类型*/
-            beforeUpload (file) {
-                var testmsg = file.name.substring(file.name.lastIndexOf('.') + 1)
-                const extension = testmsg === 'xls'
-                const extension2 = testmsg === 'xlsx'
-                if (!extension && !extension2) {
-                    this.$message({
-                        message: '上传文件只能是excel格式!',
-                        type: 'warning'
-                    })
-                    return false
-                }
-                return extension || extension2
-            },
-            /* 文件类型*/
-            ReportBeforeUpload (file) {
-                var testmsg = file.name.substring(file.name.lastIndexOf('.') + 1)
-                const extension = testmsg === 'rpx'
-                if (!extension) {
-                    this.$message({
-                        message: '上传文件只能是rpx格式!',
-                        type: 'warning'
-                    })
-                    return false
+            this.bpmnFormrenderDialogVisible = true
+        },
+        handleFlowCallback () {
+            this.$refs[this.alias] ? this.$refs[this.alias][0].refreshData() : null
+        },
+        initSystemUrl (url) {
+            if (url.startsWith('http')) {
+                this.systemUrlType = 'iframe'
+                this.$nextTick(() => {
+                    this.$refs.systemrender.src = url
+                    // 传递消息
+                    // this.$refs.systemrender.contentWindow.postMessage({ data: this.attributes }, '*')
+                })
+            } else {
+                const component = url.split('?')[0]
+                this.systemUrlParams.attrs = this.urlParse(url)
+                this.systemUrlType = 'inner'
+                const systemUrlName = 'IbpsBpmnSystemUrl'
+                this.$options.components[systemUrlName] = _import(component)
+                this.systemUrlName = systemUrlName
+            }
+        },
+        urlParse (str) {
+            const obj = {}
+            if (str.indexOf('?') !== -1) {
+                const str1 = str.split('?')[1].split('&')
+                for (let i = 0; i < str1.length; i++) {
+                    const params = str1[i].split('=')
+                    obj[params[0]] = params[1]
                 }
-                return extension
-            },
+            }
+            return obj
+        },
+        /* 文件类型*/
+        beforeUpload (file) {
+            var testmsg = file.name.substring(file.name.lastIndexOf('.') + 1)
+            const extension = testmsg === 'xls'
+            const extension2 = testmsg === 'xlsx'
+            if (!extension && !extension2) {
+                this.$message({
+                    message: '上传文件只能是excel格式!',
+                    type: 'warning'
+                })
+                return false
+            }
+            return extension || extension2
+        },
+        /* 文件类型*/
+        ReportBeforeUpload (file) {
+            var testmsg = file.name.substring(file.name.lastIndexOf('.') + 1)
+            const extension = testmsg === 'rpx'
+            if (!extension) {
+                this.$message({
+                    message: '上传文件只能是rpx格式!',
+                    type: 'warning'
+                })
+                return false
+            }
+            return extension
+        },
 
-            handleSuccess (res, file, fileList) {
-                if (res.state === 200) {
-                    this.$message({
-                        message: '上传数据成功!',
-                        type: 'success'
-                    })
-                } else {
-                    this.$message({
-                        message: res.message,
-                        type: 'error'
-                    })
-                }
-            },
-            getPeriodTask () {
-                const { userId, role = [] } = this.$store.getters
-                const roles = role.map(i => i.id)
-                const sql = `select * from t_zqswtxb where shi_fou_ti_xing_ = '是' and (zhi_xing_ren_yuan like '%${userId}%' or find_in_set(zhi_xing_jiao_se_, '${roles.join(',')}')) order by field(zhi_xing_zhou_qi_, '1次/天', '1次/周', '1次/月', '1次/季度', '1次/半年', '1次/年')`
-                this.$common.request('sql', sql).then(res => {
-                    const { data = [] } = res.variables || {}
-                    if (data.length) {
-                        this.showMsg(data)
-                    }
-                }).catch(error => {
-                    this.$message.error('获取周期事务信息失败!')
-                    console.log(error)
+        handleSuccess (res, file, fileList) {
+            if (res.state === 200) {
+                this.$message({
+                    message: '上传数据成功!',
+                    type: 'success'
                 })
-            },
-            showMsg (data) {
-                const h = this.$createElement
-                const text = {
-                    '1次/天': '本日',
-                    '1次/周': '本周',
-                    '1次/月': '本月',
-                    '1次/季度': '本季度',
-                    '1次/半年': '近半年',
-                    '1次/年': '本年度'
+            } else {
+                this.$message({
+                    message: res.message,
+                    type: 'error'
+                })
+            }
+        },
+        getPeriodTask () {
+            const { userId, role = [] } = this.$store.getters
+            const roles = role.map(i => i.id)
+            const sql = `select * from t_zqswtxb where shi_fou_ti_xing_ = '是' and (zhi_xing_ren_yuan like '%${userId}%' or find_in_set(zhi_xing_jiao_se_, '${roles.join(',')}')) order by field(zhi_xing_zhou_qi_, '1次/天', '1次/周', '1次/月', '1次/季度', '1次/半年', '1次/年')`
+            this.$common.request('sql', sql).then(res => {
+                const { data = [] } = res.variables || {}
+                if (data.length) {
+                    this.showMsg(data)
                 }
-                const result = data.reduce((acc, item) => {
-                    const key = item.zhi_xing_zhou_qi_
-                    if (!acc[key]) {
-                        acc[key] = []
-                    }
-                    acc[key].push({
-                        name: item.shi_wu_ming_cheng,
-                        path: item.ye_mian_lu_jing_
-                    })
-                    return acc
-                }, {})
-                let msg = []
-                const doNotShowBtn = h('el-button', {
-                    attrs: {
-                        size: 'mini',
-                        type: 'primary',
-                        plain: true
-                    },
-                    on: {
-                        click: () => {
-                            this.doNotShowToday()
-                        }
+            }).catch(error => {
+                this.$message.error('获取周期事务信息失败!')
+                console.log(error)
+            })
+        },
+        showMsg (data) {
+            const h = this.$createElement
+            const text = {
+                '1次/天': '本日',
+                '1次/周': '本周',
+                '1次/月': '本月',
+                '1次/季度': '本季度',
+                '1次/半年': '近半年',
+                '1次/年': '本年度'
+            }
+            const result = data.reduce((acc, item) => {
+                const key = item.zhi_xing_zhou_qi_
+                if (!acc[key]) {
+                    acc[key] = []
+                }
+                acc[key].push({
+                    name: item.shi_wu_ming_cheng,
+                    path: item.ye_mian_lu_jing_
+                })
+                return acc
+            }, {})
+            const msg = []
+            const doNotShowBtn = h('el-button', {
+                attrs: {
+                    size: 'mini',
+                    type: 'primary',
+                    plain: true
+                },
+                on: {
+                    click: () => {
+                        this.doNotShowToday()
                     }
-                }, '今日不再提示')
-                const confirmBtn = h('el-button', {
-                    attrs: {
-                        size: 'mini',
-                        type: 'success',
-                        plain: true
-                    },
-                    on: {
-                        click: () => {
-                            this.infoMessage.close()
-                        }
+                }
+            }, '今日不再提示')
+            const confirmBtn = h('el-button', {
+                attrs: {
+                    size: 'mini',
+                    type: 'success',
+                    plain: true
+                },
+                on: {
+                    click: () => {
+                        this.infoMessage.close()
                     }
-                }, '确认')
-                Object.keys(result).forEach(key => {
-                    // msg.push(h('p', {style: {
-                    //     'font-weight': 'bold',
-                    //     'color': '#666',
-                    //     'font-size': '16px'
-                    // }}, key))
-                    // result[key].forEach(i => {
-                    //     msg.push(h('span', null, i))
-                    //     msg.push(h('br'))
-                    // })
-                    let ul = [text[key]]
-                    result[key].forEach(i => {
-                        ul.push(h('li', {
-                            style: {
-                                'font-weight': 'normal',
-                                'color': '#666',
-                                'font-size': '14px',
-                                'cursor': 'pointer'
-                            },
-                            on: {
-                                click: () => {
-                                    this.infoMessage.close()
-                                    this.$router.push(i.path)
-                                }
+                }
+            }, '确认')
+            Object.keys(result).forEach(key => {
+                // msg.push(h('p', {style: {
+                //     'font-weight': 'bold',
+                //     'color': '#666',
+                //     'font-size': '16px'
+                // }}, key))
+                // result[key].forEach(i => {
+                //     msg.push(h('span', null, i))
+                //     msg.push(h('br'))
+                // })
+                const ul = [text[key]]
+                result[key].forEach(i => {
+                    ul.push(h('li', {
+                        style: {
+                            'font-weight': 'normal',
+                            'color': '#666',
+                            'font-size': '14px',
+                            'cursor': 'pointer'
+                        },
+                        on: {
+                            click: () => {
+                                this.infoMessage.close()
+                                this.$router.push(i.path)
                             }
-                        }, i.name))
-                    })
-                    msg.push(h('ul', {style: {
-                        'font-weight': 'bold',
-                        'color': '#000',
-                        'font-size': '16px',
-                        'margin': '0',
-                        'padding': '0',
-                        'margin-bottom': '5px'
-                    }}, ul))
+                        }
+                    }, i.name))
                 })
-                msg.push(doNotShowBtn, confirmBtn)
-                window.setTimeout(() => {
-                    this.infoMessage = this.$notify({
-                        title: '以下是您的周期性事务提示',
-                        message: h('div', null, msg),
-                        duration: 0,
-                        iconClass: 'el-icon-bell',
-                        showClose: false
-                    })
-                }, 0)
-            },
-            doNotShowToday () {
-                const today = new Date().toLocaleDateString()
-                localStorage.setItem('doNotShowToday', today)
-                this.infoMessage.close()
-            }
+                msg.push(h('ul', { style: {
+                    'font-weight': 'bold',
+                    'color': '#000',
+                    'font-size': '16px',
+                    'margin': '0',
+                    'padding': '0',
+                    'margin-bottom': '5px'
+                }}, ul))
+            })
+            msg.push(doNotShowBtn, confirmBtn)
+            window.setTimeout(() => {
+                this.infoMessage = this.$notify({
+                    title: '以下是您的周期性事务提示',
+                    message: h('div', null, msg),
+                    duration: 0,
+                    iconClass: 'el-icon-bell',
+                    showClose: false
+                })
+            }, 0)
+        },
+        doNotShowToday () {
+            const today = new Date().toLocaleDateString()
+            localStorage.setItem('doNotShowToday', today)
+            this.infoMessage.close()
         }
     }
+}
 </script>
 
 <style lang="scss" scoped>