Commit 1211f3de authored by wangqinghua's avatar wangqinghua

会议意向

parent 8e30c911
......@@ -27,6 +27,26 @@ export const getSpecialAgendaById = params =>req('get','/specialAgenda/getSpeci
//通过ID删除特殊议程
export const removeSpecialAgendaById = params =>req('get','/specialAgenda/removeSpecialAgendaById',params);
//新增意向
export const addIntention = params =>req('post','/intention/addIntention',params);
//通过引用ID批量获取附件
export const getByRefId = params =>req('get','/accessory/getByRefId',params);
//更新附件信息,排序,改名
export const updateAccessoryList = params =>req('post','/accessory/updateAccessoryList',params);
//文件上传
export const uploadFile = params =>req('post','/common/file/upload',params);
//更新意向
export const updateIntention = params =>req('post','/intention/updateIntention',params);
//根据ID获取意向
export const getIntentionById = params =>req('get','/intention/getIntentionById',params);
<!--添加代码-->
<template>
<div class="code">
<el-dialog :title="title" :visible.sync="dialogFormVisible">
<el-form :model="form" label-width="100px">
<el-form-item label="代码名称" :label-width="formLabelWidth">
<el-dialog :title="title" :visible.sync="dialogFormVisible" :before-close="initForm">
<el-form :model="form" :rules="rules" ref="form" label-width="100px">
<el-form-item label="代码名称" prop="title" :label-width="formLabelWidth">
<el-input v-model="form.title" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="代码URL" :label-width="formLabelWidth">
<el-form-item label="代码URL" prop="url" :label-width="formLabelWidth">
<el-input v-model="form.url" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="汇报处室" :label-width="formLabelWidth">
<el-form-item label="汇报处室" prop="reportDep" :label-width="formLabelWidth">
<el-input v-model="form.reportDep" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="列席人员" :label-width="formLabelWidth">
......@@ -17,13 +17,13 @@
<el-button @click="selectPerson" slot="append">选择</el-button>
</el-input>
</el-form-item>
<el-form-item label="白名单IP" :label-width="formLabelWidth">
<el-form-item label="白名单IP" prop="ips" :label-width="formLabelWidth">
<el-input v-model="form.ips" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogFormVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="submitForm">确 定</el-button>
<el-button size="small" @click="initForm">取 消</el-button>
<el-button size="small" type="primary" @click="submitForm('form')">确 定</el-button>
</div>
</el-dialog>
<attend-list ref="attendList" @select="getPerson"></attend-list>
......@@ -49,6 +49,9 @@
linkAttends: null,
ips: "",
},
rules:{
title:[{required:true,message:"请输入议程名称",trigger:'blur'},{min:1,max:20,message:'长度在1到20个字符之间',trigger:'blur'}]
},
dialogFormVisible: false,
formLabelWidth: "100px"
}
......@@ -61,18 +64,20 @@
showEditDialog(title, item) {
this.title = title
this.id = item.id
this.attendPerson = item.attendPerson
this.dialogFormVisible = true
getSpecialAgendaById({id:item.id}).then(
(res)=>{
this.form.title = res.data.title;
this.form.url = res.data.url;
this.form.reportDep = res.data.reportDep;
this.form.attendPerson = res.data.attendPerson;
this.form.linkAttends = res.data.linkAttends;
this.form.ips = res.data.ips;
}
)
},
initForm() {
this.$refs['form'].resetFields();
this.form = {
title: "",
url: "",
......@@ -80,12 +85,14 @@
attendPerson: "",
ips: "",
}
this.attendPerson = ""
},
//选择列席人员
selectPerson(){
this.$refs.attendList.showDialog()
},
getPerson(data){
this.attendPerson = ""
this.form.linkAttends = data.map(e=>{
this.attendPerson += e.name +","
const d = {
......@@ -94,11 +101,13 @@
return d
});
this.attendPerson = this.attendPerson.substr(0,this.attendPerson.length -1)
console.log(this.form)
console.log(this.attendPerson)
},
//提交
submitForm() {
submitForm(formName) {
this.$refs[formName].validate((valid)=>{
console.log(valid)
console.log(this.form)
if(valid){
if (this.title == "添加议程") {
addSpecialAgenda(this.form).then(
(res) => {
......@@ -121,7 +130,10 @@
}
)
}
}else{
return false
}
})
}
}
}
......
......@@ -2,14 +2,14 @@
<template>
<div class="code">
<el-dialog :title="title" :visible.sync="dialogFormVisible">
<el-form>
<el-form-item label="名称" :label-width="formLabelWidth">
<el-form :model="form" :rules="rulesForm" ref="form" :before-close="initForm">
<el-form-item label="名称" prop="name" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogFormVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="submitForm">确 定</el-button>
<el-button size="small" @click="initForm">取 消</el-button>
<el-button size="small" type="primary" @click="submitForm('form')">确 定</el-button>
</div>
</el-dialog>
</div>
......@@ -25,6 +25,9 @@
form:{
name:"",
},
rulesForm:{
name:[{required:true,message:"请输入名称",trigger:'blur'},{min:1,max:20,message:'长度在1到20个字符之间',trigger:'blur'}]
},
title: "",
dialogFormVisible: false,
formLabelWidth: "100px"
......@@ -41,14 +44,20 @@
this.id = item.id;
this.form.name = item.name
},
submitForm(){
initForm(){
this.dialogFormVisible = false;
this.$refs['form'].resetFields();
},
submitForm(formName){
this.$refs[formName].validate((valid)=>{
console.log(valid)
if(valid){
if(this.title == "添加列席"){
addAttendInfo(this.form).then(
(res)=>{
this.dialogFormVisible = false;
this.$message.success('添加成功')
this.$emit('update',res.data)
this.form.name = ""
this.initForm()
}
)
}else{
......@@ -58,14 +67,16 @@
}
updateAttendInfo(data).then(
(res)=>{
this.dialogFormVisible = false;
this.$emit('update',res.data)
this.$message.success('编辑成功')
this.form.name = ""
this.initForm()
}
)
}
}else{
return false
}
})
}
}
......
......@@ -33,26 +33,28 @@
</template>
<script>
import {getByRefId} from '../api/api'
export default {
name: "indexDialog",
data(){
return{
id:"",
title:"",
sIndex:null,
dialogFormVisible:false,
list:[
{name:"1",index:1},
{name:"2",index:2},
{name:"3",index:3},
{name:"4",index:4},
{name:"5",index:5},
]
list:[]
}
},
methods:{
showDialog(title){
showDialog(title,id){
this.title = title
this.dialogFormVisible = true;
this.dialogFormVisible = true
this.id = id
getByRefId({id:id}).then(
(res)=>{
}
)
},
//
selectIndex(i){
......
<!--编辑意向-->
<template>
<div class="intentionDialog">
<el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible">
<el-form :model="form">
<el-form-item label="意向主题" :label-width="formLabelWidth">
<el-input v-model="form.name1" autocomplete="off"></el-input>
<el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible"
:before-close="initForm">
<el-form :model="form" :rules="rulesForm" ref="form">
<el-form-item label="意向主题" prop="title" :label-width="formLabelWidth">
<el-input v-model="form.title" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="备注" :label-width="formLabelWidth">
<el-input v-model="form.name2" autocomplete="off"></el-input>
<el-form-item label="备注" prop="remark" :label-width="formLabelWidth">
<el-input v-model="form.remark" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="相关附件" :label-width="formLabelWidth">
<el-upload
class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/"
ref="upload"
action=""
:on-preview="handlePreview"
:on-change="handleUpload"
:on-remove="handleRemove"
:before-remove="beforeRemove"
multiple
:limit="3"
:on-exceed="handleExceed"
:file-list="fileList">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
:file-list="fileList"
:auto-upload="false">
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
</el-upload>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogFormVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="dialogFormVisible = false">确 定</el-button>
<div slot="footer" class="dialog-footer text-center">
<el-button size="small" @click="indexDialog">附件排序</el-button>
<el-button size="small" @click="initForm">取 消</el-button>
<el-button size="small" type="primary" @click="submitForm">确 定</el-button>
</div>
</el-dialog>
<index-dialog ref="indexDialog"></index-dialog>
</div>
</template>
<script>
import {addIntention,updateIntention,uploadFile,getIntentionById} from '../api/api'
import IndexDialog from "./indexDialog";
export default {
components: {IndexDialog},
name: "intention-dialog",
data(){
return{
id:"",
fileList:[],
form:{
name1:"",
name2:"",
name3:"",
title:"",
remark:"",
accessories:[]
},
rulesForm:{
title:[{required:true,message:"请输入名称",trigger:'blur'},{min:1,max:20,message:'长度在1到20个字符之间',trigger:'blur'}]
},
dialogTitle:'',
dialogFormVisible:false,
......@@ -50,16 +58,34 @@
}
},
methods:{
initForm(){
console.log('close')
this.$refs.form.resetFields()
this.dialogFormVisible = false
},
handleUpload(file,fileList){
const formData = new FormData()
formData.append('file',file.raw)
uploadFile(formData).then(
(res)=>{
const d = {
name: res.data.name,
saveName: res.data.saveName,
}
this.form.accessories.push(d)
}
)
},
handleRemove(file, fileList) {
const form = new FormData()
console.log(file, fileList);
this.form.accessories.forEach((e,index)=>{
if(e.name == file.name){
this.form.accessories.splice(index,1)
}
})
},
handlePreview(file) {
console.log(file);
},
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${ file.name }?`);
},
......@@ -67,10 +93,57 @@
this.dialogTitle = "添加意向"
this.dialogFormVisible = true
},
editDialog(){
editDialog(id){
this.id = id
this.dialogTitle = "编辑意向"
this.dialogFormVisible = true
getIntentionById({id:id}).then(
(res)=>{
this.form.title = res.data.title
this.form.remark = res.data.remark
this.form.accessories = res.data.accessories
}
)
},
submitForm(){
this.form.accessories.forEach((e,index)=>{
e.sortNum = index +1
})
this.$refs.form.validate((valid)=>{
if(valid){
if(this.dialogTitle == '添加意向'){
this.create()
}else{
this.update()
}
}else{
return false
}
})
},
create(){
addIntention(this.form).then(
(res)=>{
this.$message.success("添加意向成功")
this.$emit("update")
this.initForm()
this.dialogFormVisible = false
}
)
},
update(){
updateIntention(this.form).then(
(res)=>{
this.$message.success("修改意向成功")
this.$emit("update")
this.initForm()
this.dialogFormVisible = false
}
)
},
indexDialog(){
this.$refs.indexDialog.showDialog('附件排序',this.id)
},
}
}
</script>
......
......@@ -2,12 +2,12 @@ import axios from 'axios';
import store from '../store/store';
import * as types from '../store/types';
import router from '../router';
import { Message } from 'element-ui';
import {Message} from 'element-ui';
//axios配置
let instance = axios.create({
baseURL:'/api/',
timeout:20000,
baseURL: '/api/',
timeout: 20000,
});
//http request 拦截器
......@@ -26,7 +26,7 @@ instance.interceptors.request.use(
//http reponse拦截器
instance.interceptors.response.use(
response => {
if(response.data.code !== 0){
if (response.data.code !== 0) {
Message.error(response.data.message)
}
return response.data; //只返回服务器返回的data信息
......@@ -35,6 +35,7 @@ instance.interceptors.response.use(
if (error.response) {
switch (error.response.status) {
case 401:
Message.error("没有权限")
store.commit(types.LOGOUt);
router.currentRoute.path !== 'login' &&
router.replace({
......@@ -43,10 +44,10 @@ instance.interceptors.response.use(
});
break;
case 404:
console.log(error.response.data);
Message.error("请求路径错误")
break;
case 500:
console.log(error.response.data);
Message.error('系统错误')
break;
}
}
......@@ -60,8 +61,7 @@ instance.interceptors.response.use(
* data 请求的参数
* @return {Promise} 返回一个promise的对象,相当于axios请求数据的返回值
*/
export default function(method, url, data = null)
{
export default function (method, url, data = null) {
method = method.toLowerCase();
if (method === 'post') {
return instance.post(url, data);
......
......@@ -74,6 +74,15 @@
getList(){
getSpecialAgendaList().then(
(res)=>{
res.data.forEach(e=>{
e.attendPerson = ""
e.linkAttends.forEach(d=>{
e.attendPerson += d.name+","
})
e.attendPerson = e.attendPerson.substr(0,e.attendPerson.length -1)
})
console.log(res.data)
this.tableData = res.data
}
)
......
......@@ -80,12 +80,7 @@
this.getList()
}
)
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
})
},
//编辑信息
handleEdit(row){
......
......@@ -19,7 +19,8 @@
</el-col>
<el-col class="text-right" :span="8">
<el-button size="small" plain>查询</el-button>
<el-button size="small" plain>添加</el-button>
<el-button size="small" @click="handleAdd" plain>添加</el-button>
<el-button size="small" @click="handleEdit" plain>编辑测试</el-button>
</el-col>
</el-row>
<div class="margin-20-0">
......@@ -59,8 +60,8 @@
<template slot-scope="scope">
<span class="font-size-20 pointer">
<i @click="handleEdit(scope.row)" class="el-icon-edit-outline margin-right-10"></i>
<i @click="handleDelete(scope.row)" class="el-icon-view margin-right-10"></i>
<i class="el-icon-delete"></i>
<i class="el-icon-view margin-right-10"></i>
<i @click="handleDelete(scope.row)" class="el-icon-delete"></i>
</span>
</template>
</el-table-column>
......@@ -77,7 +78,7 @@
</el-pagination>
</div>
</div>
<intention-dialog ref="intentionDialog"></intention-dialog>
<intention-dialog ref="intentionDialog" @update="getList"></intention-dialog>
</div>
</template>
......@@ -92,50 +93,27 @@
input1:"",
input2:"",
currentPage:1,
tableData: [{
date: '2016-05-02',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333,
tag: '家'
}, {
date: '2016-05-04',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1517 弄',
zip: 200333,
tag: '公司'
}, {
date: '2016-05-01',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1519 弄',
zip: 200333,
tag: '家'
}, {
date: '2016-05-03',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1516 弄',
zip: 200333,
tag: '公司'
}],
tableData: [],
}
},
methods: {
getList(){
console.log('getlist')
},
//更改每页条数
handleSizeChange() {
},
handleCurrentChange() {
},
handleEdit(row){
handleAdd(){
this.$refs.intentionDialog.showDialog()
},
handleEdit(row){
this.$refs.intentionDialog.editDialog('6414075e02444a27a4eec0d6d22bbfd7')
},
handleDelete(){
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment