From 801770456ae3750a44e0989b0025a98ccbad24e6 Mon Sep 17 00:00:00 2001 From: bob <bob.zhang@highdatas.com> Date: 星期四, 13 八月 2020 17:13:53 +0800 Subject: [PATCH] 最新 --- src/views/Home.vue | 218 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 209 insertions(+), 9 deletions(-) diff --git a/src/views/Home.vue b/src/views/Home.vue index cf699e9..d566a4f 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -43,12 +43,62 @@ <el-header style="text-align: right; font-size: 15px;padding-right: 40px;"> <i class="el-icon-user-solid"></i> <span>{{userName}}</span> + <el-badge :hidden="badge_drawer == 0" :max="99" :value="badge_drawer" class="item_badge" style="line-height: 32px;"> + <el-button v-if="drawer_" size="small" type="primary" @click="showDrawer_table">閫� 鐭�</el-button> + </el-badge> <el-button size="small" type="primary" @click="upPassword">淇敼瀵嗙爜</el-button> <el-button size="small" type="primary" @click="Cancel">閫� 鍑�</el-button> </el-header> <el-main style="background-color: #f7f8f9;"> - <router-view name="home"></router-view> + <el-drawer + :visible.sync="drawer_table" + direction="rtl" + size="500px"> + <el-table + v-loading="loading_table3" + :data="gridData" + :header-cell-style="{'width': '100%', 'text-align': 'center', 'background-color': 'rgb(247, 248, 249)'}" + > + <el-table-column property="code" label="椤圭洰鍙�" width="150" align="center" show-overflow-tooltip :formatter="code_"></el-table-column> + <el-table-column property="name" label="椤圭洰鍚嶇О" width="200" show-overflow-tooltip :formatter="name_"></el-table-column> + <el-table-column prop="orderNo" label="鏈熸" align="center"></el-table-column> + <el-table-column prop="isOverdue" label="鏄惁閫炬湡" align="center" :formatter="isOverdue_"></el-table-column> + <el-table-column prop="billTime" label="寮�绁ㄦ棩鏈�" width="180" align="center"> + <template v-slot="{row}"> + <div> + <el-date-picker style="width: 160px;" size="mini" v-model="row.billTime" type="date" placeholder="閫夋嫨鏃ユ湡" @change="moneyChange(row)"> + </el-date-picker> + </div> + </template> + </el-table-column> + <el-table-column prop="money" label="寮�绁ㄩ噾棰�" width="160" align="center"> + <template v-slot="{row}"> + <div> + <el-input-number size="mini" v-model="row.money" @change="moneyChange(row)"></el-input-number> + </div> + </template> + </el-table-column> + <el-table-column prop="gatherTime" label="鏀舵鏃ユ湡" width="180" align="center"> + <template v-slot="{row}"> + <div> + <el-date-picker style="width: 160px;" size="mini" v-model="row.gatherTime" type="date" placeholder="閫夋嫨鏃ユ湡" @change="moneyChange(row)"> + </el-date-picker> + </div> + </template> + </el-table-column> + + <el-table-column fixed="right" label="纭鏀舵" width="140" align="center"> + <template v-slot="{row}"> + <el-row> + <el-button type="primary" size="mini" @click="confirmPhase(row)">纭鏀舵</el-button> + </el-row> + </template> + </el-table-column> + </el-table> + </el-drawer> + + <router-view @refreshDrawer="getbadge_drawer" name="home"></router-view> </el-main> </el-container> </el-container> @@ -108,6 +158,12 @@ dialog_2_2: false, ruleForm: {}, + badge_drawer: 0, + drawer_:false, + drawer_table: false, + loading_table3: false, + gridData: [], + timer: null, rules: { pass_obj: [ {required: true, message: '璇疯緭鍏ュ師瀵嗙爜', trigger: ['blur', 'change']} @@ -129,24 +185,38 @@ //this.userName = localStorage.getItem('userName'); //let departId = localStorage.getItem('departId'); if (!userId_ || !departId) { - this.$router.push('/login'); + this.$router.push('/login').catch(err => {err}); } else { this.defaultActive = "mine"; - this.$router.push('/mine'); + this.$router.push('/mine').catch(err => {err}); let type; - if(departId == "100" || departId == "500") { + + if(departId) { type = departId; this.$cookies.set('assign', false); // localStorage.setItem('assign', false); }else { type = "all"; - this.$cookies.set('assign', true); + this.$cookies.set('assign', false); //localStorage.setItem('assign', true); } this.getMenu(type); } + + if (departId == "300") { + this.drawer_ = true; + this.getbadge_drawer(); + + this.timer = setInterval(()=>{ + this.getbadge_drawer() + },1000 * 60 * 5); + } + }, + + beforeDestroy() {//鍦╒ue瀹炰緥鐨勭敓鍛藉懆鏈熺粨鏉熷墠鎵ц + clearInterval(this.timer); }, methods: { @@ -162,6 +232,7 @@ {'id': "111_3", 'title': "椤圭洰鍒嗘瀽", 'path': 'Overview', 'parentId': "111"}, // // {'id': "111_4", 'title': "褰掓。鎶ュ憡", 'path': 'project4', 'parentId': "111"}, // {'id': "112_1", 'title': "浠诲姟鍒楄〃", 'path': 'calendarTask', 'parentId': "112"}, // + {'id': "112_2", 'title': "浠诲姟鎬昏", 'path': 'taskOverview', 'parentId': "112"}, // {'id': "113_1", 'title': "瀹為檯鏀粯璐圭敤", 'path': 'actualPayment', 'parentId': "113"}, // {'id': "113_2", 'title': "鍚堝悓瀹屾垚缁熻", 'path': 'completeStatistics', 'parentId': "113"}, // @@ -171,13 +242,34 @@ ], 100: [ {'id': "110", 'title': "棣栭〉", 'path': "mine"}, //杩斿洖鐨勬暟缁勫瓧娈� + {'id': "111", 'title': "椤圭洰绠$悊", 'path': "0_111"}, //杩斿洖鐨勬暟缁勫瓧娈� {'id': "112", 'title': "浠诲姟绠$悊", 'path': "0_112"}, + {'id': "111_1", 'title': "淇℃伅骞垮満", 'path': 'square', 'parentId': "111"}, // + + //{'id': "111_2", 'title': "椤圭洰鎬昏", 'path': 'list', 'parentId': "111"}, // + //{'id': "111_3", 'title': "椤圭洰鍒嗘瀽", 'path': 'Overview', 'parentId': "111"}, // + {'id': "112_1", 'title': "浠诲姟鍒楄〃", 'path': 'calendarTask', 'parentId': "112"}, // + {'id': "112_2", 'title': "浠诲姟鎬昏", 'path': 'taskOverview', 'parentId': "112"}, // ], + 300:[ + {'id': "113", 'title': "璐㈠姟绠$悊", 'path': "0_113"}, + {'id': "113_1", 'title': "瀹為檯鏀粯璐圭敤", 'path': 'actualPayment', 'parentId': "113"}, // + {'id': "113_2", 'title': "鍚堝悓瀹屾垚缁熻", 'path': 'completeStatistics', 'parentId': "113"}, // + {'id': "113_3", 'title': "鍏艰亴鏀粯纭", 'path': 'partTimeExpenses', 'parentId': "113"}, // + {'id': "113_5", 'title': "宸插洖娆剧粺璁�", 'path': 'collectionStatistics', 'parentId': "113"}, // + ], + 400: [ + {'id': "110", 'title': "棣栭〉", 'path': "mine"}, //杩斿洖鐨勬暟缁勫瓧娈� + {'id': "112", 'title': "浠诲姟绠$悊", 'path': "0_112"}, + {'id': "112_1", 'title': "浠诲姟鍒楄〃", 'path': 'calendarTask', 'parentId': "112"}, // + {'id': "112_2", 'title': "浠诲姟鎬昏", 'path': 'taskOverview', 'parentId': "112"}, // + ], 500: [ {'id': "110", 'title': "棣栭〉", 'path': "mine"}, //杩斿洖鐨勬暟缁勫瓧娈� {'id': "112", 'title': "浠诲姟绠$悊", 'path': "0_112"}, {'id': "112_1", 'title': "浠诲姟鍒楄〃", 'path': 'calendarTask', 'parentId': "112"}, // + {'id': "112_2", 'title': "浠诲姟鎬昏", 'path': 'taskOverview', 'parentId': "112"}, // ], }; @@ -244,7 +336,7 @@ me.$message.error("淇濆瓨澶辫触锛�" + data_.data.message); } else { - me.$router.push('/login'); + me.$router.push('/login').catch(err => {err}); } //me.$cookies.set('userId', null); }).catch(error =>{ @@ -254,15 +346,116 @@ }, Cancel() { - this.$router.push('/login'); - //localStorage.setItem('userId', undefined); + //localStorage.setItem('userId', null); this.$cookies.set('userId', null); + this.$router.push('/login').catch(err => {err}); }, menuSelect(index, a){ let isPage = index.substring(0,2); if (isPage != "0_") { - this.$router.push('/'+ index); + this.$router.push('/'+ index).catch(err => {err}); } + }, + + getbadge_drawer() { + let me = this; + let url = "/api/scheme/bill/notice/count"; + me.badge_drawer = 0; + this.getUrl(url, null, function(data_) { + if (data_.data.data) { + me.badge_drawer = data_.data.data; + } + }) + }, + + showDrawer_table() { + this.drawer_table = true; + this.getGridData(); + }, + + getGridData() { + let me = this; + let url = "/api/scheme/bill/notice"; + me.loading_table3 = true; + me.gridData = []; + this.getUrl(url, null, function(data_) { + me.loading_table3 = false; + if (data_.data.data) { + me.gridData = data_.data.data; + } + else { + me.gridData = []; + } + }) + }, + + confirmPhase(row) { + let me = this; + let url = "/api/scheme/bill/check/" + row.id; + + let params = { + checkUser: this.$cookies.get('userId'), + money: row.money + } + this.getUrl(url, params, function(data_) { + me.getGridData(); + }) + }, + + moneyChange(row) { + let me = this; + let url = "/api/scheme/bill/addOrUpdate"; + + let params = {...row}; + params.parentId = me.tableData2[0].id; + this.postUrl(url, params, function(data_) { + }) + }, + code_(row, colum, val ,index){ + return row.scheme.code; + }, + + name_(row, colum, val ,index){ + return row.scheme.name; + }, + + isOverdue_(row, colum, val ,index){ + let gatherTime_ = row.gatherTime; + + if (new Date() > new Date(gatherTime_)) { + return "鏄�"; + } + else{ + return "鍚�"; + } + }, + + getUrl(url, params, callback){ + let me = this; + this.$axios.get(url,{ + params: params + }).then(data_ => { + //console.log(data_); + if (callback) { + callback(data_); + } + }) + .catch(error =>{ + //console.log(error); + }) + }, + postUrl(url, params, callback){ + let me = this; + this.$axios.post(url,params) + .then(data_ => { + //console.log(data_); + if (callback) { + callback(data_); + } + }) + .catch(error =>{ + //console.log(error); + }) }, /* handleSelect(key, keyPath){ @@ -295,4 +488,11 @@ .el-aside { color: #333; } + + .class_form_z1 .el-form-item{ + margin-bottom: 5px + } + .z_master_dialog .el-dialog__body{ + padding-top: 0px; + } </style> \ No newline at end of file -- Gitblit v1.8.0