| | |
| | | <el-dialog title="创建话题" :visible.sync="dialogFormVisible"> |
| | | <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-exceed="handleExceed" |
| | | :file-list="fileList"> |
| | | <el-button size="small" type="primary">点击上传</el-button> |
| | |
| | | </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> |
| | | |
| | |
| | | export default { |
| | | data() { |
| | | return { |
| | | 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:{ |
| | |
| | | attachment:"222" |
| | | }, |
| | | dataList: [ |
| | | {id:1,attachment:"222",title:"标题", desp:"描述时发生纠纷司符合双方酒叟发动机时代峰峻配电间 刀片机水电费搜豆腐皮搜的看法我都叫打破是觉得批发商附加费第三季度破发接收到发地方就搜到到四点分发偶读囧", 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:"描述时发生纠纷司符合双方酒叟发动机时代峰峻配电间 刀片机水电费搜豆腐皮搜的看法我都叫打破是觉得批发商附加费第三季度破发接收到发地方就搜到到四点分发偶读囧", 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: { |
| | | 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; |
| | | }else { |
| | | this.$message({message:'话题创建失败', type: 'warning'}); |
| | | } |
| | | }).catch(error => { |
| | | console.log(error); |
| | | }) |
| | | }else { |
| | | this.$refs.upload.submit(); |
| | | } |
| | | }, |
| | | handleRemove(file, fileList) { |
| | | console.log(file, fileList); |
| | | }, |
| | |
| | | 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; |
| | |
| | | this.getData(this.formInline); |
| | | }, |
| | | getData(query) { |
| | | 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; //给tableData赋值 |
| | | 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.total = 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 |
| | | }) |
| | | }, |
| | | } |