Commit 1211f3de authored by wangqinghua's avatar wangqinghua

会议意向

parent 8e30c911
...@@ -27,6 +27,26 @@ export const getSpecialAgendaById = params =>req('get','/specialAgenda/getSpeci ...@@ -27,6 +27,26 @@ export const getSpecialAgendaById = params =>req('get','/specialAgenda/getSpeci
//通过ID删除特殊议程 //通过ID删除特殊议程
export const removeSpecialAgendaById = params =>req('get','/specialAgenda/removeSpecialAgendaById',params); 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> <template>
<div class="code"> <div class="code">
<el-dialog :title="title" :visible.sync="dialogFormVisible"> <el-dialog :title="title" :visible.sync="dialogFormVisible" :before-close="initForm">
<el-form :model="form" label-width="100px"> <el-form :model="form" :rules="rules" ref="form" label-width="100px">
<el-form-item label="代码名称" :label-width="formLabelWidth"> <el-form-item label="代码名称" prop="title" :label-width="formLabelWidth">
<el-input v-model="form.title" autocomplete="off"></el-input> <el-input v-model="form.title" autocomplete="off"></el-input>
</el-form-item> </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-input v-model="form.url" autocomplete="off"></el-input>
</el-form-item> </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-input v-model="form.reportDep" autocomplete="off"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="列席人员" :label-width="formLabelWidth"> <el-form-item label="列席人员" :label-width="formLabelWidth">
...@@ -17,13 +17,13 @@ ...@@ -17,13 +17,13 @@
<el-button @click="selectPerson" slot="append">选择</el-button> <el-button @click="selectPerson" slot="append">选择</el-button>
</el-input> </el-input>
</el-form-item> </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-input v-model="form.ips" autocomplete="off"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogFormVisible = false">取 消</el-button> <el-button size="small" @click="initForm">取 消</el-button>
<el-button size="small" type="primary" @click="submitForm">确 定</el-button> <el-button size="small" type="primary" @click="submitForm('form')">确 定</el-button>
</div> </div>
</el-dialog> </el-dialog>
<attend-list ref="attendList" @select="getPerson"></attend-list> <attend-list ref="attendList" @select="getPerson"></attend-list>
...@@ -49,6 +49,9 @@ ...@@ -49,6 +49,9 @@
linkAttends: null, linkAttends: null,
ips: "", ips: "",
}, },
rules:{
title:[{required:true,message:"请输入议程名称",trigger:'blur'},{min:1,max:20,message:'长度在1到20个字符之间',trigger:'blur'}]
},
dialogFormVisible: false, dialogFormVisible: false,
formLabelWidth: "100px" formLabelWidth: "100px"
} }
...@@ -61,18 +64,20 @@ ...@@ -61,18 +64,20 @@
showEditDialog(title, item) { showEditDialog(title, item) {
this.title = title this.title = title
this.id = item.id this.id = item.id
this.attendPerson = item.attendPerson
this.dialogFormVisible = true this.dialogFormVisible = true
getSpecialAgendaById({id:item.id}).then( getSpecialAgendaById({id:item.id}).then(
(res)=>{ (res)=>{
this.form.title = res.data.title; this.form.title = res.data.title;
this.form.url = res.data.url; this.form.url = res.data.url;
this.form.reportDep = res.data.reportDep; this.form.reportDep = res.data.reportDep;
this.form.attendPerson = res.data.attendPerson; this.form.linkAttends = res.data.linkAttends;
this.form.ips = res.data.ips; this.form.ips = res.data.ips;
} }
) )
}, },
initForm() { initForm() {
this.$refs['form'].resetFields();
this.form = { this.form = {
title: "", title: "",
url: "", url: "",
...@@ -80,12 +85,14 @@ ...@@ -80,12 +85,14 @@
attendPerson: "", attendPerson: "",
ips: "", ips: "",
} }
this.attendPerson = ""
}, },
//选择列席人员 //选择列席人员
selectPerson(){ selectPerson(){
this.$refs.attendList.showDialog() this.$refs.attendList.showDialog()
}, },
getPerson(data){ getPerson(data){
this.attendPerson = ""
this.form.linkAttends = data.map(e=>{ this.form.linkAttends = data.map(e=>{
this.attendPerson += e.name +"," this.attendPerson += e.name +","
const d = { const d = {
...@@ -94,34 +101,39 @@ ...@@ -94,34 +101,39 @@
return d return d
}); });
this.attendPerson = this.attendPerson.substr(0,this.attendPerson.length -1) this.attendPerson = this.attendPerson.substr(0,this.attendPerson.length -1)
console.log(this.form)
console.log(this.attendPerson)
}, },
//提交 //提交
submitForm() { submitForm(formName) {
if (this.title == "添加议程") { this.$refs[formName].validate((valid)=>{
addSpecialAgenda(this.form).then( console.log(valid)
(res) => { console.log(this.form)
this.dialogFormVisible = false; if(valid){
this.$message.success('添加成功') if (this.title == "添加议程") {
this.$emit('update', res.data) addSpecialAgenda(this.form).then(
this.form.name = "" (res) => {
this.initForm() this.dialogFormVisible = false;
} this.$message.success('添加成功')
) this.$emit('update', res.data)
} else { this.form.name = ""
this.form.id = this.id this.initForm()
updateSpecialAgenda(this.form).then( }
(res) => { )
this.dialogFormVisible = false; } else {
this.$emit('update', res.data) this.form.id = this.id
this.$message.success('编辑成功') updateSpecialAgenda(this.form).then(
this.form.name = "" (res) => {
this.initForm() this.dialogFormVisible = false;
this.$emit('update', res.data)
this.$message.success('编辑成功')
this.form.name = ""
this.initForm()
}
)
} }
) }else{
} return false
}
})
} }
} }
} }
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
<template> <template>
<div class="code"> <div class="code">
<el-dialog :title="title" :visible.sync="dialogFormVisible"> <el-dialog :title="title" :visible.sync="dialogFormVisible">
<el-form> <el-form :model="form" :rules="rulesForm" ref="form" :before-close="initForm">
<el-form-item label="名称" :label-width="formLabelWidth"> <el-form-item label="名称" prop="name" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off"></el-input> <el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogFormVisible = false">取 消</el-button> <el-button size="small" @click="initForm">取 消</el-button>
<el-button size="small" type="primary" @click="submitForm">确 定</el-button> <el-button size="small" type="primary" @click="submitForm('form')">确 定</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
form:{ form:{
name:"", name:"",
}, },
rulesForm:{
name:[{required:true,message:"请输入名称",trigger:'blur'},{min:1,max:20,message:'长度在1到20个字符之间',trigger:'blur'}]
},
title: "", title: "",
dialogFormVisible: false, dialogFormVisible: false,
formLabelWidth: "100px" formLabelWidth: "100px"
...@@ -41,31 +44,39 @@ ...@@ -41,31 +44,39 @@
this.id = item.id; this.id = item.id;
this.form.name = item.name this.form.name = item.name
}, },
submitForm(){ initForm(){
if(this.title == "添加列席"){ this.dialogFormVisible = false;
addAttendInfo(this.form).then( this.$refs['form'].resetFields();
(res)=>{ },
this.dialogFormVisible = false; submitForm(formName){
this.$message.success('添加成功') this.$refs[formName].validate((valid)=>{
this.$emit('update',res.data) console.log(valid)
this.form.name = "" if(valid){
if(this.title == "添加列席"){
addAttendInfo(this.form).then(
(res)=>{
this.$message.success('添加成功')
this.$emit('update',res.data)
this.initForm()
}
)
}else{
const data = {
id:this.id,
name:this.form.name,
}
updateAttendInfo(data).then(
(res)=>{
this.$emit('update',res.data)
this.$message.success('编辑成功')
this.initForm()
}
)
} }
) }else{
}else{ return false
const data = {
id:this.id,
name:this.form.name,
} }
updateAttendInfo(data).then( })
(res)=>{
this.dialogFormVisible = false;
this.$emit('update',res.data)
this.$message.success('编辑成功')
this.form.name = ""
}
)
}
} }
} }
......
...@@ -33,26 +33,28 @@ ...@@ -33,26 +33,28 @@
</template> </template>
<script> <script>
import {getByRefId} from '../api/api'
export default { export default {
name: "indexDialog", name: "indexDialog",
data(){ data(){
return{ return{
id:"",
title:"", title:"",
sIndex:null, sIndex:null,
dialogFormVisible:false, dialogFormVisible:false,
list:[ list:[]
{name:"1",index:1},
{name:"2",index:2},
{name:"3",index:3},
{name:"4",index:4},
{name:"5",index:5},
]
} }
}, },
methods:{ methods:{
showDialog(title){ showDialog(title,id){
this.title = title this.title = title
this.dialogFormVisible = true; this.dialogFormVisible = true
this.id = id
getByRefId({id:id}).then(
(res)=>{
}
)
}, },
// //
selectIndex(i){ selectIndex(i){
......
<!--编辑意向--> <!--编辑意向-->
<template> <template>
<div class="intentionDialog"> <div class="intentionDialog">
<el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible"> <el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible"
<el-form :model="form"> :before-close="initForm">
<el-form-item label="意向主题" :label-width="formLabelWidth"> <el-form :model="form" :rules="rulesForm" ref="form">
<el-input v-model="form.name1" autocomplete="off"></el-input> <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>
<el-form-item label="备注" :label-width="formLabelWidth"> <el-form-item label="备注" prop="remark" :label-width="formLabelWidth">
<el-input v-model="form.name2" autocomplete="off"></el-input> <el-input v-model="form.remark" autocomplete="off"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="相关附件" :label-width="formLabelWidth"> <el-form-item label="相关附件" :label-width="formLabelWidth">
<el-upload <el-upload
class="upload-demo" class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/" ref="upload"
action=""
:on-preview="handlePreview" :on-preview="handlePreview"
:on-change="handleUpload"
:on-remove="handleRemove" :on-remove="handleRemove"
:before-remove="beforeRemove" :file-list="fileList"
multiple :auto-upload="false">
:limit="3" <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
: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>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer text-center">
<el-button size="small" @click="dialogFormVisible = false">取 消</el-button> <el-button size="small" @click="indexDialog">附件排序</el-button>
<el-button size="small" type="primary" @click="dialogFormVisible = false">确 定</el-button> <el-button size="small" @click="initForm">取 消</el-button>
<el-button size="small" type="primary" @click="submitForm">确 定</el-button>
</div> </div>
</el-dialog> </el-dialog>
<index-dialog ref="indexDialog"></index-dialog>
</div> </div>
</template> </template>
<script> <script>
import {addIntention,updateIntention,uploadFile,getIntentionById} from '../api/api'
import IndexDialog from "./indexDialog";
export default { export default {
components: {IndexDialog},
name: "intention-dialog", name: "intention-dialog",
data(){ data(){
return{ return{
id:"",
fileList:[], fileList:[],
form:{ form:{
name1:"", title:"",
name2:"", remark:"",
name3:"", accessories:[]
},
rulesForm:{
title:[{required:true,message:"请输入名称",trigger:'blur'},{min:1,max:20,message:'长度在1到20个字符之间',trigger:'blur'}]
}, },
dialogTitle:'', dialogTitle:'',
dialogFormVisible:false, dialogFormVisible:false,
...@@ -50,16 +58,34 @@ ...@@ -50,16 +58,34 @@
} }
}, },
methods:{ 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) { handleRemove(file, fileList) {
const form = new FormData() this.form.accessories.forEach((e,index)=>{
console.log(file, fileList); if(e.name == file.name){
this.form.accessories.splice(index,1)
}
})
}, },
handlePreview(file) { handlePreview(file) {
console.log(file); console.log(file);
}, },
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
},
beforeRemove(file, fileList) { beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${ file.name }?`); return this.$confirm(`确定移除 ${ file.name }?`);
}, },
...@@ -67,10 +93,57 @@ ...@@ -67,10 +93,57 @@
this.dialogTitle = "添加意向" this.dialogTitle = "添加意向"
this.dialogFormVisible = true this.dialogFormVisible = true
}, },
editDialog(){ editDialog(id){
this.id = id
this.dialogTitle = "编辑意向" this.dialogTitle = "编辑意向"
this.dialogFormVisible = true 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> </script>
......
...@@ -2,56 +2,57 @@ import axios from 'axios'; ...@@ -2,56 +2,57 @@ import axios from 'axios';
import store from '../store/store'; import store from '../store/store';
import * as types from '../store/types'; import * as types from '../store/types';
import router from '../router'; import router from '../router';
import { Message } from 'element-ui'; import {Message} from 'element-ui';
//axios配置 //axios配置
let instance = axios.create({ let instance = axios.create({
baseURL:'/api/', baseURL: '/api/',
timeout:20000, timeout: 20000,
}); });
//http request 拦截器 //http request 拦截器
instance.interceptors.request.use( instance.interceptors.request.use(
config => { config => {
if (store.state.token) { if (store.state.token) {
config.headers.Authorization = `token ${store.state.token}` config.headers.Authorization = `token ${store.state.token}`
}
return config;
},
error => {
return Promise.reject(err);
} }
return config;
},
error => {
return Promise.reject(err);
}
); );
//http reponse拦截器 //http reponse拦截器
instance.interceptors.response.use( instance.interceptors.response.use(
response => { response => {
if(response.data.code !== 0){ if (response.data.code !== 0) {
Message.error(response.data.message) Message.error(response.data.message)
} }
return response.data; //只返回服务器返回的data信息 return response.data; //只返回服务器返回的data信息
}, },
error => { error => {
if (error.response) { if (error.response) {
switch (error.response.status) { switch (error.response.status) {
case 401: case 401:
store.commit(types.LOGOUt); Message.error("没有权限")
router.currentRoute.path !== 'login' && store.commit(types.LOGOUt);
router.replace({ router.currentRoute.path !== 'login' &&
path: 'login', router.replace({
query: {redirect: router.currentRoute.path}, path: 'login',
}); query: {redirect: router.currentRoute.path},
break; });
case 404: break;
console.log(error.response.data); case 404:
break; Message.error("请求路径错误")
case 500: break;
console.log(error.response.data); case 500:
break; Message.error('系统错误')
} break;
} }
return Promise.reject(error.response.data); }
}, return Promise.reject(error.response.data);
},
); );
/** /**
...@@ -60,19 +61,18 @@ instance.interceptors.response.use( ...@@ -60,19 +61,18 @@ instance.interceptors.response.use(
* data 请求的参数 * data 请求的参数
* @return {Promise} 返回一个promise的对象,相当于axios请求数据的返回值 * @return {Promise} 返回一个promise的对象,相当于axios请求数据的返回值
*/ */
export default function(method, url, data = null) export default function (method, url, data = null) {
{ method = method.toLowerCase();
method = method.toLowerCase(); if (method === 'post') {
if (method === 'post') { return instance.post(url, data);
return instance.post(url, data); } else if (method === 'get') {
} else if (method === 'get') { return instance.get(url, {params: data})
return instance.get(url, {params: data}) } else if (method === 'delete') {
} else if (method === 'delete') { return instance.delete(url, {params: data})
return instance.delete(url, {params: data}) } else if (method === 'put') {
} else if (method === 'put') { return instance.put(url, data);
return instance.put(url, data); } else {
} else { console.error("未知的method" + method);
console.error("未知的method" + method); return false;
return false; }
}
} }
...@@ -74,6 +74,15 @@ ...@@ -74,6 +74,15 @@
getList(){ getList(){
getSpecialAgendaList().then( getSpecialAgendaList().then(
(res)=>{ (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 this.tableData = res.data
} }
) )
......
...@@ -80,12 +80,7 @@ ...@@ -80,12 +80,7 @@
this.getList() this.getList()
} }
) )
}).catch(() => { })
this.$message({
type: 'info',
message: '已取消删除'
});
});
}, },
//编辑信息 //编辑信息
handleEdit(row){ handleEdit(row){
......
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
</el-col> </el-col>
<el-col class="text-right" :span="8"> <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" plain>添加</el-button> <el-button size="small" @click="handleAdd" plain>添加</el-button>
<el-button size="small" @click="handleEdit" plain>编辑测试</el-button>
</el-col> </el-col>
</el-row> </el-row>
<div class="margin-20-0"> <div class="margin-20-0">
...@@ -59,8 +60,8 @@ ...@@ -59,8 +60,8 @@
<template slot-scope="scope"> <template slot-scope="scope">
<span class="font-size-20 pointer"> <span class="font-size-20 pointer">
<i @click="handleEdit(scope.row)" class="el-icon-edit-outline margin-right-10"></i> <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-view margin-right-10"></i>
<i class="el-icon-delete"></i> <i @click="handleDelete(scope.row)" class="el-icon-delete"></i>
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
...@@ -77,7 +78,7 @@ ...@@ -77,7 +78,7 @@
</el-pagination> </el-pagination>
</div> </div>
</div> </div>
<intention-dialog ref="intentionDialog"></intention-dialog> <intention-dialog ref="intentionDialog" @update="getList"></intention-dialog>
</div> </div>
</template> </template>
...@@ -92,50 +93,27 @@ ...@@ -92,50 +93,27 @@
input1:"", input1:"",
input2:"", input2:"",
currentPage:1, currentPage:1,
tableData: [{ 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: '公司'
}],
} }
}, },
methods: { methods: {
getList(){
console.log('getlist')
},
//更改每页条数 //更改每页条数
handleSizeChange() { handleSizeChange() {
}, },
handleCurrentChange() { handleCurrentChange() {
}, },
handleEdit(row){ handleAdd(){
this.$refs.intentionDialog.showDialog() 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