1
This commit is contained in:
@@ -11,18 +11,28 @@
|
||||
<div class="handle-box">
|
||||
<el-button type="primary" icon="el-icon-circle-plus-outline" @click="addEditor">add</el-button>
|
||||
</div>
|
||||
|
||||
<div class="handle-box" :rules="rules">
|
||||
<el-select v-model="query.journal_id" placeholder="请选择期刊" @change="chan_id" style="width: 300px;">
|
||||
<el-option label="All" :key="0" :value="0"></el-option>
|
||||
<el-option v-for="item in df_jour" :label="item.title" :key="item.journal_id" :value="item.journal_id"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<el-table :data="tableData" border stripe class="table" ref="multipleTable" header-cell-class-name="table-header">
|
||||
<el-table-column prop="account" label="username" align="center"></el-table-column>
|
||||
<el-table-column prop="journal.title" label="journal" align="center"></el-table-column>
|
||||
<el-table-column prop="realname" label="realname" align="center"></el-table-column>
|
||||
<el-table-column prop="phone" label="phone" align="center"></el-table-column>
|
||||
<el-table-column prop="phone" label="phone" align="center" width="150px"></el-table-column>
|
||||
<el-table-column prop="email" label="email" align="center"></el-table-column>
|
||||
<el-table-column label="" width="100" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" icon="el-icon-edit" @click="handleEdit(scope.$index, scope.row)">Edit</el-button>
|
||||
<el-button type="text" icon="el-icon-delete" class="red" @click="handleDelete(scope.$index, scope.row)">Delete</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination">
|
||||
<el-pagination background layout="total, prev, pager, next" :current-page="query.pageIndex" :page-size="query.pageSize"
|
||||
:total="Total" @current-change="handlePageChange"></el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 添加弹出框 -->
|
||||
@@ -34,6 +44,12 @@
|
||||
<el-form-item label="email" prop="email">
|
||||
<el-input v-model="addForm.email" @blur='saerEm_U()'></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="journal" prop="journal_id">
|
||||
<el-select v-model="addForm.journal_id" filterable placeholder="Please select a responsible Journal" value-key="groupID"
|
||||
style="width: 300px;">
|
||||
<el-option v-for="item in df_jour" :label="item.title" :key="item.journal_id" :value="item.journal_id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="realname" prop="realname">
|
||||
<el-input v-model="addForm.realname"></el-input>
|
||||
</el-form-item>
|
||||
@@ -53,29 +69,32 @@
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 编辑弹出框 -->
|
||||
<el-dialog title="Edit editor" :visible.sync="editVisible" width="40%">
|
||||
<el-form ref="edit_Form" :model="editForm" :rules="rules" label-width="150px">
|
||||
<el-form-item label="account" prop="account">
|
||||
<template slot-scope="scope">
|
||||
{{editForm.account}}
|
||||
</template>
|
||||
|
||||
<!-- 已有信息弹出框 -->
|
||||
<el-dialog title="Add editorial board" :visible.sync="oldVisible" width="40%">
|
||||
<el-form ref="old_Form" :model="oldForm" :rules="rules" label-width="100px">
|
||||
<el-form-item label="account">
|
||||
{{oldForm.account}}
|
||||
</el-form-item>
|
||||
<el-form-item label="email" prop="email">
|
||||
<template slot-scope="scope">
|
||||
{{editForm.email}}
|
||||
</template>
|
||||
<el-form-item label="email">
|
||||
{{oldForm.email}}
|
||||
</el-form-item>
|
||||
<el-form-item label="realname" prop="realname">
|
||||
<el-input v-model="editForm.realname"></el-input>
|
||||
<el-form-item label="journal" prop="journal_id">
|
||||
<el-select v-model="oldForm.journal_id" filterable placeholder="Please select a responsible Journal" value-key="groupID"
|
||||
style="width: 300px;">
|
||||
<el-option v-for="item in df_jour" :label="item.title" :key="item.journal_id" :value="item.journal_id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="phone" prop="phone">
|
||||
<el-input v-model="editForm.phone"></el-input>
|
||||
<el-form-item label="realname">
|
||||
{{oldForm.realname}}
|
||||
</el-form-item>
|
||||
<el-form-item label="phone">
|
||||
{{oldForm.phone}}
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="editVisible = false">Cancel</el-button>
|
||||
<el-button type="primary" @click="saveEdit(editForm)">OK</el-button>
|
||||
<el-button @click="oldVisible = false">Cancel</el-button>
|
||||
<el-button type="primary" @click="saveOld(oldForm)">OK</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
@@ -87,14 +106,20 @@
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
editVisible: false,
|
||||
df_jour: [],
|
||||
addVisible: false,
|
||||
oldVisible: false,
|
||||
addForm: {},
|
||||
oldForm: {},
|
||||
aid: -1,
|
||||
idx: -1,
|
||||
id: -1,
|
||||
btn_alert: false,
|
||||
addForm: {},
|
||||
editForm: {},
|
||||
Total: 0,
|
||||
query: {
|
||||
journal_id: 0,
|
||||
pageIndex: 1,
|
||||
pageSize: 10
|
||||
},
|
||||
rules: {
|
||||
account: [{
|
||||
required: true,
|
||||
@@ -115,6 +140,11 @@
|
||||
},
|
||||
trigger: "blur"
|
||||
}],
|
||||
journal_id: [{
|
||||
required: true,
|
||||
message: 'Please select a responsible Journal',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
password: [{
|
||||
required: true,
|
||||
message: 'Please input password',
|
||||
@@ -132,16 +162,41 @@
|
||||
this.getdate();
|
||||
},
|
||||
methods: {
|
||||
// 获取编辑列表数据
|
||||
getdate() {
|
||||
// 获取主编列表数据
|
||||
this.$api
|
||||
.post('api/Chief/getChiefList')
|
||||
.post('api/Chief/getChiefList',this.query)
|
||||
.then(res => {
|
||||
this.tableData = res.data.chiefs;
|
||||
this.Total = res.data.count || 0;
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message.error(err);
|
||||
});
|
||||
// 获取全部期刊
|
||||
this.$api
|
||||
.post('api/Chief/getAllJournals')
|
||||
.then(res => {
|
||||
if (res.code == 0) {
|
||||
this.df_jour = res.data.journals;
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message.error(err);
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉分类搜索
|
||||
chan_id(event) {
|
||||
this.getdate();
|
||||
},
|
||||
|
||||
// 分页导航
|
||||
handlePageChange(val) {
|
||||
this.$set(this.query, 'pageIndex', val);
|
||||
this.getdate();
|
||||
},
|
||||
|
||||
// 添加操作
|
||||
@@ -160,21 +215,14 @@
|
||||
.then(res => {
|
||||
if (res.code == 0) {
|
||||
if (res.data.user_info != null) {
|
||||
this.$confirm('该账户已存在,是否将该账户新增主编身份?', '提示', {
|
||||
this.$confirm('This user already exists, do you want to add this user as journal editor?', 'Tips', {
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
this.addVisible = false;
|
||||
this.$refs.add_Form.resetFields();
|
||||
this.$api
|
||||
.post('api/Chief/addChief', res.data.user_info)
|
||||
.then(res => {
|
||||
this.$message.success(`添加成功`);
|
||||
this.getdate();
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message.error(err);
|
||||
});
|
||||
this.oldVisible = true;
|
||||
this.oldForm = res.data.user_info;
|
||||
})
|
||||
.catch(() => {});
|
||||
this.btn_alert = true
|
||||
@@ -200,21 +248,14 @@
|
||||
.then(res => {
|
||||
if (res.code == 0) {
|
||||
if (res.data.user_info != null) {
|
||||
this.$confirm('该账户已存在,是否将该账户新增主编身份?', '提示', {
|
||||
this.$confirm('This user already exists, do you want to add this user as journal editor?', 'Tips', {
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
this.addVisible = false;
|
||||
this.$refs.add_Form.resetFields();
|
||||
this.$api
|
||||
.post('api/Chief/addChief', res.data.user_info)
|
||||
.then(res => {
|
||||
this.$message.success(`添加成功`);
|
||||
this.getdate();
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message.error(err);
|
||||
});
|
||||
this.oldVisible = true;
|
||||
this.oldForm = res.data.user_info;
|
||||
})
|
||||
.catch(() => {});
|
||||
this.btn_alert = true
|
||||
@@ -243,7 +284,7 @@
|
||||
if (res.code == 0) {
|
||||
this.addVisible = false;
|
||||
this.$refs.add_Form.resetFields();
|
||||
this.$message.success(`添加成功`);
|
||||
this.$message.success(`Added successfully!`);
|
||||
this.getdate();
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
@@ -257,26 +298,21 @@
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$message.error("两次新密码输入不一致");
|
||||
this.$message.error("The two passwords are inconsistent!");
|
||||
}
|
||||
|
||||
},
|
||||
// 编辑操作
|
||||
handleEdit(index, row) {
|
||||
this.idx = index;
|
||||
this.editForm = Object.assign({}, row);
|
||||
this.editVisible = true;
|
||||
},
|
||||
// 保存编辑
|
||||
saveEdit(editForm) {
|
||||
this.$refs.edit_Form.validate((valid) => {
|
||||
|
||||
// 保存old添加
|
||||
saveOld(oldForm) {
|
||||
this.$refs.old_Form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.$api
|
||||
.post('api/Chief/editChief', this.editForm)
|
||||
.post('api/Chief/addJournalBoardHas', this.oldForm)
|
||||
.then(res => {
|
||||
if (res.code == 0) {
|
||||
this.editVisible = false;
|
||||
this.$message.success(`更改第 ${this.idx + 1} 行成功`);
|
||||
this.oldVisible = false;
|
||||
this.$refs.old_Form.resetFields();
|
||||
this.$message.success(`Added successfully!`);
|
||||
this.getdate();
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
@@ -286,11 +322,34 @@
|
||||
this.$message.error(err);
|
||||
});
|
||||
} else {
|
||||
this.$message.error('error submit!!');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 删除操作
|
||||
handleDelete(index, row) {
|
||||
// 二次确认删除
|
||||
this.$confirm('Are you sure you want to delete?', 'Tips', {
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
this.$api
|
||||
.post('api/Chief/delChiefToJournal ', row)
|
||||
.then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('Delete succeeded');
|
||||
this.getdate();
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message.error(err);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -304,4 +363,8 @@
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.red {
|
||||
color: #ff0000;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user