This commit is contained in:
xulu
2021-08-22 19:41:25 +08:00
parent 4d8c396790
commit 21e5fc549a
21 changed files with 602 additions and 360 deletions

View File

@@ -29,10 +29,10 @@
<el-dialog title="Add editor" :visible.sync="addVisible" width="40%">
<el-form ref="add_Form" :model="addForm" :rules="rules" label-width="150px">
<el-form-item label="account" prop="account">
<el-input v-model="addForm.account"></el-input>
<el-input v-model="addForm.account" @blur='saerNa_U()'></el-input>
</el-form-item>
<el-form-item label="email" prop="email">
<el-input v-model="addForm.email"></el-input>
<el-input v-model="addForm.email" @blur='saerEm_U()'></el-input>
</el-form-item>
<el-form-item label="realname" prop="realname">
<el-input v-model="addForm.realname"></el-input>
@@ -49,20 +49,22 @@
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="addVisible = false">Cancel</el-button>
<el-button type="primary" @click="saveAdd(addForm)">OK</el-button>
<el-button type="primary" @click="saveAdd(addForm)" :disabled="this.btn_alert">OK</el-button>
</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">
<el-form-item label="account" prop="account">
<template slot-scope="scope">
{{editForm.account}}
</template>
</el-form-item>
<el-form-item label="email" prop="email">
<el-input v-model="editForm.email"></el-input>
<template slot-scope="scope">
{{editForm.email}}
</template>
</el-form-item>
<el-form-item label="realname" prop="realname">
<el-input v-model="editForm.realname"></el-input>
@@ -76,6 +78,7 @@
<el-button type="primary" @click="saveEdit(editForm)">OK</el-button>
</span>
</el-dialog>
</div>
</template>
@@ -87,10 +90,11 @@
editVisible: false,
addVisible: false,
aid: -1,
editForm: {},
idx: -1,
id: -1,
btn_alert: false,
addForm: {},
editForm: {},
rules: {
account: [{
required: true,
@@ -136,7 +140,7 @@
this.tableData = res.data.chiefs;
})
.catch(err => {
console.log(err);
this.$message.error(err);
});
},
@@ -146,6 +150,88 @@
this.addVisible = true;
},
// 查找与他相同的账号
saerNa_U() {
if (this.addForm.account != undefined) {
this.$api
.post('api/Chief/checkEmailForUser', {
'email': this.addForm.account
})
.then(res => {
if (res.code == 0) {
if (res.data.user_info != null) {
this.$confirm('该账户已存在,是否将该账户新增主编身份?', '提示', {
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);
});
})
.catch(() => {});
this.btn_alert = true
} else {
this.btn_alert = false
}
} else {
this.$message.error(res.msg);
}
})
.catch(err => {
this.$message.error(err);
});
}
},
// 查找与他相同的邮箱
saerEm_U() {
if (this.addForm.email != undefined) {
this.$api
.post('api/Chief/checkEmailForUser', {
'email': this.addForm.email
})
.then(res => {
if (res.code == 0) {
if (res.data.user_info != null) {
this.$confirm('该账户已存在,是否将该账户新增主编身份?', '提示', {
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);
});
})
.catch(() => {});
this.btn_alert = true
} else {
this.btn_alert = false
}
} else {
this.$message.error(res.msg);
}
})
.catch(err => {
this.$message.error(err);
});
}
},
// 保存添加
saveAdd(addForm) {
if (addForm.password == addForm.repassword) {