From b8b615a7876092f8e5b231c058a0ab884ff6e904 Mon Sep 17 00:00:00 2001 From: wl <173@qq.com> Date: 星期四, 21 七月 2022 15:37:23 +0800 Subject: [PATCH] 案件录入导入查询和分页 --- src/views/cause/Entry.vue | 74 +++++++++++++++++++++++++++++-------- 1 files changed, 58 insertions(+), 16 deletions(-) diff --git a/src/views/cause/Entry.vue b/src/views/cause/Entry.vue index a98f71b..63f5e49 100644 --- a/src/views/cause/Entry.vue +++ b/src/views/cause/Entry.vue @@ -4,7 +4,7 @@ <template slot="header"> <el-form :inline="true" :model="queryInfo" class="demo-form-inline"> <el-form-item label="妗堜欢锛�"> - <el-input placeholder="璇疯緭鍏ユ浠剁紪鍙锋垨鍚嶇О" v-model="queryInfo.title"></el-input> + <el-input placeholder="璇疯緭鍏ユ浠剁紪鍙锋垨鍚嶇О" v-model="queryInfo.cause"></el-input> </el-form-item> <el-form-item label="妗堜欢鐘舵�侊細"> <el-select v-model="queryInfo.status" placeholder="璇烽�夋嫨"> @@ -19,7 +19,10 @@ <el-button type="primary" @click="addDialogOpen">娣诲姞</el-button> </el-form-item> <el-form-item> - <el-button type="primary" @click="exportExcel">瀵煎叆</el-button> + <el-upload name="multipartFile" class="upload-demo" action="/api/cause/upload " + :before-upload="beforeAvatarUpload" :on-preview="handlePreview" :on-success="respond" :limit="1"> + <el-button type="primary">瀵煎叆</el-button> + </el-upload> </el-form-item> </el-form> </template> @@ -33,7 +36,14 @@ </el-table-column> <el-table-column prop="firstTime" label="鏈�鏃╁彂妗堟棩鏈�" width="150" header-align="center" align="center"> </el-table-column> - <el-table-column prop="status" label="妗堜欢鐘舵��" width="110" header-align="center"> + <el-table-column prop="status" label="妗堜欢鐘舵��" width="110" header-align="center" align="center"> + <template slot-scope="scope"> + <span v-if="scope.row.status == 0">鏈鏍�</span> + <span v-if="scope.row.status == 1">涓嶄簣绔嬫</span> + <span v-if="scope.row.status == 2">鍙楃悊涓�</span> + <span v-if="scope.row.status == 3">宸茬粨妗�</span> + <span v-if="scope.row.status == 4">宸叉挙妗�</span> + </template> </el-table-column> <el-table-column prop="userName" label="璐熻矗浜�" width="130" header-align="center" align="center"> </el-table-column> @@ -43,15 +53,12 @@ <el-button type="text" size="medium" @click="handleAudit(scope.row)">缂栬緫</el-button> <el-button type="text" size="medium" @click="handleAudit(scope.row)">鎶ユ浜哄憳</el-button> <el-button type="text" size="medium" @click="handleAudit(scope.row)">缇ゅ叕鍛�</el-button> - <el-button type="text" size="medium" @click="handleAudit(scope.row)" style="color:#ff0000" >鍒犻櫎</el-button> + <el-button type="text" size="medium" @click="handleAudit(scope.row)" style="color:#ff0000">鍒犻櫎</el-button> </el-table-column> </el-table> </template> - - <el-pagination @current-change="handleCurrentChange" :current-page="queryInfo.current" :page-size="queryInfo.size" layout="prev, pager, next" :total="total"></el-pagination> - </el-pagination> </el-card> </div> </template> @@ -67,14 +74,14 @@ return { casueList: [], queryInfo: { - title: '', - status: '5', + cause: '', + status: null, current: 1, size: 10 }, options: [ { - value: '5', + value: null, label: '鍏ㄩ儴' }, { @@ -104,7 +111,31 @@ created() { this.init() }, - methods: { + methods: + { + respond(res) { + if (res.code == 200) { + this.$message({ + message: '涓婁紶鎴愬姛', + type: 'success' + } + ) + } else { + this.$message({ + message: res.msg, + type: 'error' + }) + } + }, + beforeAvatarUpload(file) { + let Xls = file.name.split('.'); + if (Xls[1] === 'xls' || Xls[1] === 'xlsx') { + return file + } else { + this.$message.error('涓婁紶鏂囦欢鍙兘鏄� xls/xlsx 鏍煎紡!') + return false + } + }, init() { casueList().then( res => { @@ -114,15 +145,26 @@ ) }, getList() { - this.$http.get('/api/entry/list', { + this.$http.get('/api/cause/getCauseList', { params: this.queryInfo }).then(res => { - this.total = res.data.total - this.list = res.data.list + this.total = res.data.data.total + this.casueList = res.data.data.records }) }, search() { - }, + this.$http.get('/api/cause/getCauseList', { + params: this.queryInfo + }).then( + res => { + this.total = res.data.data.total + this.casueList = res.data.data.records + console.log(res.data.data.records); + } + ) + + } + , addDialogOpen() { }, exportExcel() { @@ -130,7 +172,7 @@ handleCurrentChange(val) { this.queryInfo.current = val; this.getList(); - }, + } } } </script> -- Gitblit v1.8.0