From 11317bf89e4d4194f84229c3d89a786b323c6be4 Mon Sep 17 00:00:00 2001 From: kimi <kimi42345@gmail.com> Date: 星期四, 23 一月 2020 15:16:16 +0800 Subject: [PATCH] merge --- src/components/square.vue | 127 ++++++++++++++++++++++++++++-------------- 1 files changed, 85 insertions(+), 42 deletions(-) diff --git a/src/components/square.vue b/src/components/square.vue index 2f0751e..f7c0a4c 100644 --- a/src/components/square.vue +++ b/src/components/square.vue @@ -51,7 +51,7 @@ </div> <span slot="footer" class="dialog-footer"> - <el-button v-if="selectOne.attachment && selectOne.attachment != ''" type="primary" @click="download">涓� 杞�</el-button> + <el-button v-if="selectOne.attachment && selectOne.attachment != ''" type="primary" @click="download(selectOne)">涓� 杞�</el-button> </span> </el-dialog> @@ -68,10 +68,13 @@ :action="uploadUrl" :on-preview="handlePreview" :data="form" - :limit="1" + :limit="3" :auto-upload='false' + ref="upload" + :on-change="onChange" :on-exceed="handleExceed" - :file-list="fileList"> + :on-success="uploadSuccess" + > <el-button size="small" type="primary">鐐瑰嚮涓婁紶</el-button> <div slot="tip" class="el-upload__tip">涓嶈秴杩�50M</div> </el-upload> @@ -81,7 +84,9 @@ <el-button type="primary" @click="createTopic">纭� 瀹�</el-button> </div> </el-dialog> - + <div style="width: 0px; height: 0px;"> + <iframe ref="frame_export" style="width: 0px; height: 0px;"></iframe> + </div> </div> </template> @@ -91,6 +96,9 @@ return { uploadUrl:"/api/api/file/topicUpload", form:{}, + pageno:1, + total:0, + maxPage:0, fileList: [], dialogVisible: false, dialogFormVisible: false, @@ -102,50 +110,74 @@ attachment:"222" }, dataList: [ - {id:1,attachment:"222",title:"鏍囬", desp:"鎻忚堪鏃跺彂鐢熺籂绾峰徃绗﹀悎鍙屾柟閰掑彑鍙戝姩鏈烘椂浠e嘲宄婚厤鐢甸棿 鍒�鐗囨満姘寸數璐规悳璞嗚厫鐨悳鐨勭湅娉曟垜閮藉彨鎵撶牬鏄寰楁壒鍙戝晢闄勫姞璐圭涓夊搴︾牬鍙戞帴鏀跺埌鍙戝湴鏂瑰氨鎼滃埌鍒板洓鐐瑰垎鍙戝伓璇诲洤", time:"12鍒嗛挓鍓�"}, - {id:1,attachment:"222",title:"11", desp:"111", time:"11111"}, - {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, - {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, - {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, - {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, - {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, - {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, - {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, - ], - loading: false + // {id:1,attachment:"222",title:"鏍囬", desp:"鎻忚堪鏃跺彂鐢熺籂绾峰徃绗﹀悎鍙屾柟閰掑彑鍙戝姩鏈烘椂浠e嘲宄婚厤鐢甸棿 鍒�鐗囨満姘寸數璐规悳璞嗚厫鐨悳鐨勭湅娉曟垜閮藉彨鎵撶牬鏄寰楁壒鍙戝晢闄勫姞璐圭涓夊搴︾牬鍙戞帴鏀跺埌鍙戝湴鏂瑰氨鎼滃埌鍒板洓鐐瑰垎鍙戝伓璇诲洤", time:"12鍒嗛挓鍓�"}, + // {id:1,attachment:"222",title:"11", desp:"111", time:"11111"}, + // {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, + // {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, + // {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, + // {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, + // {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, + // {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, + // {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, + ], + loading: false, + } }, computed: { noMore() { - return this.count >= 20 + return this.maxPage == this.pageno }, disabled() { return this.loading || this.noMore } }, + mounted() { + this.getData(); + }, methods: { + download(val) { + if(val) { + this.$refs.frame_export.src = "/api/api/file/download/" + val.id; + }else { + this.$message({message:'鑾峰彇鍦板潃澶辫触', type: 'warning'}); + } + + }, + uploadSuccess() { + this.dialogFormVisible = false; + }, + onChange(file, fileList) { + this.fileList = []; + this.fileList = fileList; + }, createTopic() { + let me = this; var userId = localStorage.getItem('userId'); if(!userId) { this.$router.push('/login'); } - this.from.userId = userId; - if(fileList.length == 0) { + this.form.userId = userId; + let params = this.form; + + if(this.fileList.length == 0) { //涓嶅甫闄勪欢 - url = "/api/topic/add"; + let url = "/api/topic/add"; this.$axios.get(url, { params }) .then(data_ => { - console.log(data_); - this.tableData = data_.data.data.records; //缁檛ableData璧嬪�� - this.total = data_.data.data.total; - this.loading_table = false; + if(data_.data.success) { + this.$message('鍒涘缓鎴愬姛'); + me.dialogFormVisible = false; + }else { + this.$message({message:'璇濋鍒涘缓澶辫触', type: 'warning'}); + } }).catch(error => { console.log(error); }) }else { - + this.$refs.upload.submit(); } }, handleRemove(file, fileList) { @@ -161,11 +193,13 @@ return this.$confirm(`纭畾绉婚櫎 ${ file.name }锛焋); }, load() { - // this.loading = true - // setTimeout(() => { - // this.count += 2 - // this.loading = false - // }, 2000) + + if(me.pageno < me.maxPage) { + me.pageno++; + } + query_(); + + }, showItem(one) { this.dialogVisible = true; @@ -179,31 +213,40 @@ this.query_(); }, query_() { - this.getData(this.formInline); + this.getData(this.formInline, true); }, - getData(query) { + getData(query,empty) { + if(empty) { + this.dataList = []; + } + let me = this; + this.loading = true this.loading_table = true; let pageno = this.pagenum; - let url = "/api/scheme/page/" + pageno; - let params = { - pageSize: this.pagesize - }; + let url = "/api/topic/page/" + this.pageno; + let params = {}; if(query){ - params.name = query.name; - params.delay = query.delay; - params.finish = query.fiish; - params.type = query.type; + params.title = query.title; + params.desp = query.desp; } this.$axios.get(url, { params }) .then(data_ => { console.log(data_); - this.tableData = data_.data.data.records; //缁檛ableData璧嬪�� - this.total = data_.data.data.total; - this.loading_table = false; + if(data_.data.success) { + me.dataList.push.apply(me.dataList, data_.data.data.records) + me.t + otal = data_.data.data.total; + me.pageno = data_.data.data.pageno; + me.maxPage = data_.data.data.maxPage; + + + } + me.loading = false }).catch(error => { console.log(error); + me.loading = false }) }, } -- Gitblit v1.8.0