|
@@ -7,7 +7,7 @@
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="main">
|
|
|
<el-col :span="24" class="add">
|
|
|
- <el-button type="primary" size="mini" @click="$router.push({ path: '/dockCenter/vipInfo/addUser' })">添加用户</el-button>
|
|
|
+ <el-button type="primary" size="mini" @click="add()">添加用户</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="info">
|
|
|
<el-col :span="24" class="list" v-for="(item, index) in list" :key="index">
|
|
@@ -24,19 +24,50 @@
|
|
|
email:<span>{{ item.email }}</span>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="btn">
|
|
|
- <el-button type="primary" size="mini" @click="$router.push({ path: '/dockCenter/vipInfo/addUser', query: { id: item.id } })">编辑</el-button>
|
|
|
+ <el-button type="primary" size="mini" @click="editViP(item)">编辑</el-button>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+ <el-dialog title="添加用户" :visible.sync="dialogVisible" width="90%" :before-close="handleClose">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form :model="form">
|
|
|
+ <el-form-item label="用户名" :label-width="formLabelWidth">
|
|
|
+ <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="请输入手机号" :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 :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>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="email" :label-width="formLabelWidth">
|
|
|
+ <el-input v-model="form.email" autocomplete="off" placeholder="请输入email"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="简介" :label-width="formLabelWidth">
|
|
|
+ <el-input v-model="form.content" type="textarea" autocomplete="off" placeholder="请输入简介"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-col :span="24" style="text-align:center">
|
|
|
+ <el-button @click="closeBtn">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="onSubmit">确 定</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-form>
|
|
|
+ </el-col>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
import NavBar from '@/layout/common/topInfo.vue';
|
|
|
+const { mapActions: dock } = createNamespacedHelpers('dock');
|
|
|
+const { mapActions: apply } = createNamespacedHelpers('apply');
|
|
|
+const { mapActions: authUser } = createNamespacedHelpers('authUser');
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
@@ -49,18 +80,118 @@ export default {
|
|
|
isleftarrow: '',
|
|
|
// 返回
|
|
|
navShow: true,
|
|
|
- list: [
|
|
|
- {
|
|
|
- vipname: '测试联系人',
|
|
|
- vipphone: '11111111111',
|
|
|
- company: '长春市福瑞科技有限公司',
|
|
|
- email: '12345678901@163.com',
|
|
|
- },
|
|
|
- ],
|
|
|
+ list: [],
|
|
|
+ dock_id:'',
|
|
|
+ dialogVisible:false,
|
|
|
+ disabled: false,
|
|
|
+ form:{},
|
|
|
+ formLabelWidth:'80px'
|
|
|
};
|
|
|
},
|
|
|
- created() {},
|
|
|
- methods: {},
|
|
|
+ created() {
|
|
|
+ this.searchInfo();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...dock({ dockQuery: 'query', dockfetch: 'fetch',dockupdate:'update',dockupdateVip: 'updateVip', createvipuser: 'createvipuser' }),
|
|
|
+ ...apply({ applyUpdate: 'update' }),
|
|
|
+ ...authUser({ authUserQuery: 'query', authUserCreate: 'create', authUserUpdate: 'update' }),
|
|
|
+ async searchInfo() {
|
|
|
+ let res = await this.dockfetch(this.user.uid);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `list`, res.data.vipuser);
|
|
|
+ this.$set(this, `dock_id`, res.data.id);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 添加用户
|
|
|
+ add() {
|
|
|
+ this.dialogVisible = true;
|
|
|
+ this.disabled = false;
|
|
|
+ },
|
|
|
+ // 保存
|
|
|
+ async onSubmit(){
|
|
|
+ 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: '8',
|
|
|
+ status: '1',
|
|
|
+ id: this.dock_id,
|
|
|
+ vipid: this.form.vipid,
|
|
|
+ };
|
|
|
+ const arr = await this.dockupdateVip(data);
|
|
|
+ if (this.$checkRes(arr)) {
|
|
|
+ this.$notify({
|
|
|
+ message: '信息修改成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.dialogVisible = false;
|
|
|
+ this.searchInfo();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const authUserList = await this.authUserQuery();
|
|
|
+ let r = authUserList.data.some(f => f.phone == this.form.phone);
|
|
|
+ if (r) {
|
|
|
+ this.$notify({
|
|
|
+ message: '手机号已经被注册,请重新输入',
|
|
|
+ type: 'warning',
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.form.role = '8';
|
|
|
+ const res = await this.authUserCreate(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: res.data.id,
|
|
|
+ id: this.dock_id,
|
|
|
+ };
|
|
|
+ const arr = await this.createvipuser(data);
|
|
|
+ if (this.$checkRes(arr)) {
|
|
|
+ this.dialogVisible = false;
|
|
|
+ this.searchInfo();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 修改
|
|
|
+ // 修改
|
|
|
+ editViP(data) {
|
|
|
+ this.dialogVisible = true;
|
|
|
+ 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;
|
|
|
+ newDate.vipid = data._id;
|
|
|
+ console.log(newDate);
|
|
|
+
|
|
|
+ this.disabled = true;
|
|
|
+ this.$set(this, `form`, newDate);
|
|
|
+ },
|
|
|
+ // 取消
|
|
|
+ closeBtn() {
|
|
|
+ this.form = {};
|
|
|
+ this.dialogVisible = false;
|
|
|
+ },
|
|
|
+ // 取消
|
|
|
+ handleClose(done) {
|
|
|
+ done();
|
|
|
+ },
|
|
|
+ },
|
|
|
computed: { ...mapState(['user']) },
|
|
|
mounted() {
|
|
|
this.title = this.$route.meta.title;
|
|
@@ -119,4 +250,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+/deep/.el-dialog__body{
|
|
|
+height: 420px;
|
|
|
+}
|
|
|
</style>
|