From 06768ae444b08c442041af4c112567194e444e14 Mon Sep 17 00:00:00 2001 From: Vergil <974548713@qq.com> Date: Wed, 11 Mar 2020 08:46:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/layout/components/Navbar.vue | 270 +++++++++++++++++++++---- 1 file changed, 235 insertions(+), 35 deletions(-) diff --git a/src/views/layout/components/Navbar.vue b/src/views/layout/components/Navbar.vue index b0a0be89..3ae88e99 100644 --- a/src/views/layout/components/Navbar.vue +++ b/src/views/layout/components/Navbar.vue @@ -27,6 +27,13 @@ import { mapGetters } from 'vuex' import Breadcrumb from '@/components/Breadcrumb' import Hamburger from '@/components/Hamburger' +import { searchTable1 } from '@/api/PurchasingCenter/PurchaseContractApproval' +import { getMaterial, getMaterial_NOTES, setChakan } from '@/api/PurchasingCenter/MaterialManagement' +import { initApproval, initApprovalOffline } from '@/api/PurchasingCenter/FundApproval' +import { searchUrgentItem } from '@/api/ManufacturingCenter/InitialProduction' +import { searchTable1 as searchTableInvoice } from '@/api/PurchasingCenter/InvoiceSettlementApprove' +import { searchRequestFund } from '@/api/PurchasingCenter/PurchaseContractRequestFund' +import { getPickingList, setPickingList } from '@/api/Inventory/MaterialOut' export default { components: { Breadcrumb, @@ -57,7 +64,200 @@ export default { 'token' ]) }, + mounted() { + if (this.id.toString() === '3') { + this.checkApproval() + this.timer = setInterval(this.checkApproval, 1000 * 60 * 5) + } else if (this.token.toString() === '11' || this.token.toString() === '12') { + this.comfirmMaterial() + this.timer = setInterval(this.comfirmMaterial, 1000 * 60 * 5) + } else if (this.token.toString() === '2' || this.token.toString() === '3') { + this.comfirmMaterial_CG() + this.timer = setInterval(this.comfirmMaterial_CG, 1000 * 60 * 5) + } else if (this.token.toString() === '15') { + this.comfirmMaterial_KG() + this.timer = setInterval(this.comfirmMaterial_KG, 1000 * 60 * 5) + } else if (this.token.toString() === '5') { + this.comfirmUrgentItem() + this.timer = setInterval(this.comfirmUrgentItem, 1000 * 60) + } + }, + beforeDestroy() { + clearInterval(this.timer) + }, methods: { + comfirmMaterial_KG() { + getPickingList().then(res => { + if (res.data.length) { + this.noticeContractKG = null + this.noticeContractKG = this.$notify.success({ + title: '提示', + message: '您有新的领料单需要备料确认,请及时处理,点击查看', + onClick: () => { + setPickingList().then(res => { + this.$router.push({ path: '/Inventory/MaterialOut' }) + setTimeout(this.noticeContractKG.close(), 1000) + }) + }, + duration: 1000 * 60 + }) + } + }) + }, + comfirmMaterial_CG() { + getMaterial_NOTES().then(res => { + if (res.data.length) { + this.noticeContract1 = null + this.noticeContract1 = this.$notify.success({ + title: '提示', + message: '有新采购物料审批结果,点击查看', + onClick: () => { + setChakan().then(res => { + this.$router.push({ path: '/PurchasingCenter/MaterialMProcure' }) + setTimeout(this.noticeContract1.close(), 1000) + }) + }, + duration: 1000 * 60 + }) + } + }) + if (this.token.toString() === '2') { + searchRequestFund(1, 9999, 0, 0, 0, 0, 0).then(res => { + if (res.data.length) { + this.noticeContract2 = null + this.noticeContract2 = this.$notify.success({ + title: '提示', + message: '有合同请款申请审批结果,点击查看', + onClick: () => { + setChakan().then(res => { + this.$router.push({ path: '/PurchasingCenter/PurchaseContractRequestFund' }) + setTimeout(this.noticeContract2.close(), 1000) + }) + }, + duration: 1000 * 60 + }) + } + }) + initApproval(1, 999, 1).then(res => { + if (res.data.rows.length) { + this.noticeContract3 = null + this.noticeContract3 = this.$notify.success({ + title: '提示', + message: '有合同请款申请待审批,点击查看', + onClick: () => { + setChakan().then(res => { + this.$router.push({ path: '/PurchasingCenter/FundApproval1' }) + setTimeout(this.noticeContract3.close(), 1000) + }) + }, + duration: 1000 * 60 + }) + } + }) + } else if (this.token.toString() === '3') { + searchRequestFund(1, 99999, 0, 0, 0, 0, 0).then(res => { + if (res.data.length) { + this.noticeContract4 = null + this.noticeContract4 = this.$notify.success({ + title: '提示', + message: '有合同请款申请审批结果,点击查看', + onClick: () => { + setChakan().then(res => { + this.$router.push({ path: '/PurchasingCenter/PurchaseContractRequestFund' }) + setTimeout(this.noticeContract4.close(), 1000) + }) + }, + duration: 1000 * 60 + }) + } + }) + } + }, + comfirmMaterial() { + getMaterial().then(res => { + if (res.data.length) { + this.noticeContract5 = null + this.noticeContract5 = this.$notify.success({ + title: '提示', + message: '您有采购物料申请待审批,请及时处理,点击查看', + onClick: () => { + this.$router.push({ path: '/PurchasingCenter/MaterialManagement' }) + setTimeout(this.noticeContract5.close(), 1000) + }, + duration: 1000 * 60 + }) + } + }) + }, + checkApproval() { + searchTable1(1, 999, 0, null, null, 0, 0, 0, 0, 0, 0).then(res => { + if (res.data.total) { + this.noticeContract6 = null + this.noticeContract6 = this.$notify.success({ + title: '提示', + message: '您有采购合同待审批,请及时处理,点击查看', + onClick: () => { + this.$router.push({ path: '/PurchasingCenter/PurchaseContractApproval' }) + setTimeout(this.noticeContract6.close(), 1000) + }, + duration: 1000 * 60 + }) + } + }) + const p1 = new Promise((resolve, reject) => { + initApproval(1, 999, 1).then(res => { + resolve(res) + }) + }) + const p2 = new Promise((resolve, reject) => { + initApprovalOffline(1, 999, 1).then(res => { + resolve(res) + }) + }) + Promise.race([p1, p2]).then(res => { + if (res.data.total) { + this.noticeFund = this.$notify.success({ + title: '提示', + message: '您有合同请款申请待审批,请及时处理,点击查看', + onClick: () => { + this.$router.push({ path: '/PurchasingCenter/FundApproval2' }) + setTimeout(this.noticeFund.close(), 1000) + }, + duration: 1000 * 60 * 5 + }) + } + }) + searchTableInvoice(0, null, null, 1, 999, this.token).then(res => { + if (res.data.total) { + this.noticeInvoice = null + this.noticeInvoice = this.$notify.success({ + title: '提示', + message: '您有发票结算申请待审批,请及时处理,点击查看', + onClick: () => { + this.$router.push({ path: '/PurchasingCenter/InvoiceSettlementApprove' }) + setTimeout(this.noticeInvoice.close(), 1000) + }, + duration: 1000 * 60 * 5 + }) + } + }) + }, + comfirmUrgentItem() { + console.log(1111) + searchUrgentItem().then(res => { + if (res.data.length > 0) { + this.noticeContractJJ = null + this.noticeContractJJ = this.$notify.success({ + title: '提示', + message: '您有加急件未打印,请及时处理', + onClick: () => { + setTimeout(this.noticeContractJJ.close(), 1000) + }, + duration: 1000 * 60 + }) + } + }) + }, toggleSideBar() { this.$store.dispatch('ToggleSideBar') }, @@ -71,43 +271,43 @@ export default {