|
@@ -17,10 +17,10 @@
|
|
|
<el-input v-model="form.name" autocomplete="off" placeholder="请输入用户名"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="手机号" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.phone" autocomplete="off" maxlength="11" placeholder="请输入手机号"></el-input>
|
|
|
+ <el-input v-model="form.phone" autocomplete="off" maxlength="11" placeholder="请输入手机号" :disabled="disabled"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="密码" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.passwd" autocomplete="off" placeholder="请输入密码" show-password></el-input>
|
|
|
+ <el-input v-model="form.passwd" autocomplete="off" placeholder="请输入密码" show-password :disabled="disabled"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="单位名称" :label-width="formLabelWidth">
|
|
|
<el-input v-model="form.company" autocomplete="off" placeholder="请输入单位名称"></el-input>
|
|
@@ -33,7 +33,7 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer" style="text-align:center;">
|
|
|
- <el-button type="primary" @click="dialogVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="restFormBtn">取 消</el-button>
|
|
|
<el-button type="success" @click="onSubmit">保 存</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
@@ -80,6 +80,7 @@ export default {
|
|
|
dialogVisible: false,
|
|
|
form: {},
|
|
|
formLabelWidth: '100px',
|
|
|
+ disabled: false,
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -87,7 +88,7 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
...apply(['query', 'delete', 'update']),
|
|
|
- ...dock({ dockFetch: 'fetch', dockUpdate: 'update' }),
|
|
|
+ ...dock({ dockFetch: 'fetch', dockUpdate: 'update', dockupdateVip: 'updateVip', createvipuser: 'createvipuser' }),
|
|
|
...authUser({ authUserQuery: 'query', authUserCreate: 'create', authUserUpdate: 'update' }),
|
|
|
async search() {
|
|
|
if (this.dockid) {
|
|
@@ -101,15 +102,28 @@ export default {
|
|
|
// 添加
|
|
|
add() {
|
|
|
this.dialogVisible = true;
|
|
|
+ this.disabled = false;
|
|
|
},
|
|
|
// 保存
|
|
|
async onSubmit() {
|
|
|
- if (this.form._id) {
|
|
|
- console.log(this.form);
|
|
|
- // const res = await this.dockUpdate(this.form);
|
|
|
- // if (this.$checkRes(res)) {
|
|
|
- // let data = {};
|
|
|
- // }
|
|
|
+ if (this.form.id) {
|
|
|
+ const res = await this.authUserUpdate(this.form);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ let data = {
|
|
|
+ vipname: this.form.name,
|
|
|
+ vipphone: this.form.phone,
|
|
|
+ company: this.form.company,
|
|
|
+ email: this.form.email,
|
|
|
+ content: this.form.content,
|
|
|
+ role: this.form.role,
|
|
|
+ uid: this.form.id,
|
|
|
+ id: this.dockid,
|
|
|
+ };
|
|
|
+ const arr = await this.dockupdateVip(data);
|
|
|
+ if (this.$checkRes(arr)) {
|
|
|
+ console.log(arr);
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
const authUserList = await this.authUserQuery();
|
|
|
let r = authUserList.data.some(f => f.phone == this.form.phone);
|
|
@@ -122,35 +136,48 @@ export default {
|
|
|
this.form.role = '9';
|
|
|
const res = await this.authUserCreate(this.form);
|
|
|
if (this.$checkRes(res)) {
|
|
|
- let vipuser = [
|
|
|
- {
|
|
|
- vipname: this.form.name,
|
|
|
- vipphone: this.form.phone,
|
|
|
- company: this.form.company,
|
|
|
- email: this.form.email,
|
|
|
- content: this.form.content,
|
|
|
- role: this.form.role,
|
|
|
- uid: res.data.id,
|
|
|
- },
|
|
|
- ];
|
|
|
- let data = {};
|
|
|
- data.id = this.dockid;
|
|
|
- data.vipuser = vipuser;
|
|
|
- const arr = await this.dockUpdate(data);
|
|
|
- console.log(arr);
|
|
|
+ let data = {
|
|
|
+ vipname: this.form.name,
|
|
|
+ vipphone: this.form.phone,
|
|
|
+ company: this.form.company,
|
|
|
+ email: this.form.email,
|
|
|
+ content: this.form.content,
|
|
|
+ role: this.form.role,
|
|
|
+ uid: res.data.id,
|
|
|
+ id: this.dockid,
|
|
|
+ };
|
|
|
+ const arr = await this.createvipuser(data);
|
|
|
+ if (this.$checkRes(arr)) {
|
|
|
+ this.dialogVisible = false;
|
|
|
+ this.back();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
// 关闭
|
|
|
handleClose(done) {
|
|
|
+ this.form = {};
|
|
|
done();
|
|
|
},
|
|
|
+ // 取消
|
|
|
+ restFormBtn() {
|
|
|
+ this.form = {};
|
|
|
+ this.dialogVisible = false;
|
|
|
+ },
|
|
|
// 修改
|
|
|
toEdit({ data }) {
|
|
|
this.dialogVisible = true;
|
|
|
- this.$set(this, `form`, data);
|
|
|
- console.log(data);
|
|
|
+ let newDate = {};
|
|
|
+ newDate.name = data.vipname;
|
|
|
+ newDate.phone = data.vipphone;
|
|
|
+ newDate.passwd = data.passwd;
|
|
|
+ newDate.company = data.company;
|
|
|
+ newDate.email = data.email;
|
|
|
+ newDate.content = data.content;
|
|
|
+ newDate.id = data.uid;
|
|
|
+ this.disabled = true;
|
|
|
+ this.$set(this, `form`, newDate);
|
|
|
},
|
|
|
// 刪除
|
|
|
// toDelete({ data }) {
|