From 7a8920cd22441a8b14174e4dfad42be591b3725f Mon Sep 17 00:00:00 2001 From: zhangyanpeng <bob.zhang@highdatas.com> Date: 星期二, 17 三月 2020 09:28:04 +0800 Subject: [PATCH] Merge branch 'master' of http://highdatas.com:9000/r/~kimi/srs --- src/components/square.vue | 251 ++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 200 insertions(+), 51 deletions(-) diff --git a/src/components/square.vue b/src/components/square.vue index 13c2f79..b941b7f 100644 --- a/src/components/square.vue +++ b/src/components/square.vue @@ -17,17 +17,21 @@ </el-form-item> </el-form> </el-col> - <el-col :span="4" ><el-button type="primary" @click="createNew">鍒涘缓</el-button></el-col> + <el-col :span="4" > + <el-button type="primary" @click="createNew">鍒涘缓</el-button> + + </el-col> </el-row> - <div class="infinite-list-wrapper" style="overflow:auto; height: 75vh; border-top: 1px solid #c3c5c7;"> + <div class="infinite-list-wrapper" style="overflow:auto; height: 70vh; border-top: 1px solid #c3c5c7;"> <div class="list" v-infinite-scroll="load" infinite-scroll-disabled="disabled"> <div v-for="one in dataList" :key="one.id" class="list-item" @click="showItem(one)"> <el-row > - <el-col :span="20"><div class="grid-content z_grid-content1 grid-content_text">{{one.title}}</div></el-col> - <el-col :span="4"><div class="grid-content z_grid-content1 grid-content_time">{{one.time}}</div></el-col> + <el-col :span="18"><div class="grid-content z_grid-content1 grid-content_text">{{one.title}}</div></el-col> + <el-col :span="3"><div class="grid-content z_grid-content1 grid-content_exam">{{formatter(one.examine)}}</div></el-col> + <el-col :span="3"><div class="grid-content z_grid-content1 grid-content_time">{{one.time}}</div></el-col> </el-row> <el-row> @@ -39,6 +43,7 @@ <p v-if="noMore">娌℃湁鏇村浜�</p> </div> <el-dialog + v-if="dialogVisible" title="璇︽儏" :visible.sync="dialogVisible" width="40%" @@ -51,48 +56,73 @@ </div> <span slot="footer" class="dialog-footer"> - <el-button :v-if="selectOne.attachment == '' ? false: true" type="primary" @click="download">涓� 杞�</el-button> + <el-button v-if="canEdit" type="primary" @click="edit">淇敼</el-button> + <el-button v-if="!selectOne.examine" type="primary" @click="addProject(selectOne)">鐢熸垚椤圭洰</el-button> + <el-button v-if="selectOne.attachment && selectOne.attachment != ''" type="primary" @click="download(selectOne)">涓� 杞�</el-button> </span> </el-dialog> - <el-dialog title="鍒涘缓璇濋" :visible.sync="dialogFormVisible"> + <el-dialog title="鍒涘缓璇濋" :visible.sync="dialogFormVisible" @close="closeCreate" > <el-form :model="form"> <el-form-item label="璇濋鍚嶇О" :label-width="formLabelWidth"> - <el-input v-model="form.name" autocomplete="off"></el-input> + <el-input v-model="form.title" autocomplete="off"></el-input> </el-form-item> <el-form-item label="璇濋鍐呭" :label-width="formLabelWidth"> <el-input type="textarea" v-model="form.desp" autocomplete="off"></el-input> </el-form-item> <el-upload class="upload-demo" + :action="uploadUrl" :on-preview="handlePreview" - :on-remove="handleRemove" - :before-remove="beforeRemove" - :limit="1" + :data="form" + :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> </el-form> <div slot="footer" class="dialog-footer"> <el-button @click="dialogFormVisible = false">鍙� 娑�</el-button> - <el-button type="primary" @click="dialogFormVisible = false">纭� 瀹�</el-button> + <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> + <el-dialog v-if="dialog_1" @close="Cancel" width="70%" top="50px" :visible.sync="dialog_1" append-to-body> + <newProject @closeNewProject="closeNewProject" v-bind:rowData="rowData" ref="newProject_"></newProject> + </el-dialog> + <el-dialog v-if="dialog_2" @close="Cancel1" width="70%" top="50px" :visible.sync="dialog_2" append-to-body> + <newProject ref="newProject1_"></newProject> + </el-dialog> </div> </template> <script> + import newProject from '../components/popup/newProject.vue' export default { + components: { + newProject + }, data() { return { + rowData:undefined, + dialog_1: false, + dialog_2: false, + uploadUrl:"/api/api/file/topicUpload", form:{}, - fileList: [], - dialogVisible: false, - dialogFormVisible: false, + pageno:1, + total:0, + maxPage:0, + fileList: [], + dialogVisible: false, + dialogFormVisible: false, labelPosition: "right", formInline:{}, selectOne:{ @@ -100,47 +130,134 @@ desp:"miaoshu", attachment:"222" }, + formLabelWidth:"40%", 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: { + Cancel() { + this.$refs.newProject_.Cancel(); + this.dialogFormVisible = false; + }, + Cancel1() { + + }, + addProject(selected) { + let url = "/api/topic/exam/" + selected.id; + this.$axios.get(url) + .then(data_ => { + if(data_.data.success) { + this.rowData = { + //id:selected.id, + desp:selected.desp, + name:selected.title, + //objective:this.selected.reseachType, + //items:[this.$moment(this.selected.startTime).format('YYYY-MM-DD'),this.$moment(this.selected.endTime).format('YYYY-MM-DD')] + } + this.dialogFormVisible = false; + this.dialog_1 = true; + }else { + this.$message({message:'鍒涘缓椤圭洰澶辫触', type: 'warning'}); + } + }).catch(error => { + }) + + + }, + closeNewProject() { + this.dialog_1 = false; + getData(); + }, + 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; + }, + canExam() { + return true; + }, + + createTopic() { + let me = this; + var userId = localStorage.getItem('userId'); + if(!userId) { + this.$router.push('/login'); + } + this.form.userId = userId; + let params = this.form; + + if(this.fileList.length == 0) { + //涓嶅甫闄勪欢 + let url = "/api/topic/add"; + this.$axios.get(url, { + params + }) + .then(data_ => { + if(data_.data.success) { + this.$message('鍒涘缓鎴愬姛'); + me.dialogFormVisible = false; + me.getData(); + }else { + this.$message({message:'璇濋鍒涘缓澶辫触', type: 'warning'}); + } + }).catch(error => { + }) + }else { + this.$refs.upload.submit(); + } + }, handleRemove(file, fileList) { - console.log(file, fileList); }, handlePreview(file) { - console.log(file); }, handleExceed(files, fileList) { - this.$message.warning(`褰撳墠闄愬埗閫夋嫨 3 涓枃浠讹紝鏈閫夋嫨浜� ${files.length} 涓枃浠讹紝鍏遍�夋嫨浜� ${files.length + fileList.length} 涓枃浠禶); + this.$message.warning(`褰撳墠闄愬埗閫夋嫨 1 涓枃浠讹紝鏈閫夋嫨浜� ${files.length} 涓枃浠讹紝鍏遍�夋嫨浜� ${files.length + fileList.length} 涓枃浠禶); }, beforeRemove(file, fileList) { 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; @@ -149,36 +266,64 @@ createNew() { this.dialogFormVisible = true; }, + formatter(exam){ + if(exam){ + return "宸插叧鑱旈」鐩�"; + } + }, empty_() { this.formInline = {}; this.query_(); }, query_() { - this.getData(this.formInline); + this.getData(this.formInline, true); }, - getData(query) { + canEdit() { + return this.selectOne.userId == this.userId; + }, + edit(){ + this.form = { + title: this.selectOne.title, + desp: this.selectOne.desp, + id: this.selectOne.id + }; + this.dialogFormVisible = true; + this.dialogVisible = false; + }, + closeCreate() { + this.dialogFormVisible = false; + this.getData(); + }, + 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 }) }, } @@ -198,8 +343,11 @@ } .grid-content_time { font-weight: bold; - font-style: italic; color: #909399; + } + .grid-content_exam { + color: #00aaff; + font-size: 14px; } .z_grid-content1{ display:table-cell; @@ -235,6 +383,7 @@ .handleClose { margin: 10px; text-align: left; + margin-left: 30%; } .handleClose .el-dialog__body { padding: 10px 20px; -- Gitblit v1.8.0