123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>添加管理员</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta name="viewport"
- content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
- <!-- 所有的 css & js 资源 -->
- <link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
- <link rel="stylesheet" href="../../static/sa.css">
- <script src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
- <script src="https://unpkg.com/element-ui@2.13.0/lib/index.js"></script>
- <script src="https://unpkg.com/http-vue-loader@1.4.2/src/httpVueLoader.js"></script>
- <script src="https://unpkg.com/jquery@3.4.1/dist/jquery.min.js"></script>
- <script src="https://www.layuicdn.com/layer-v3.1.1/layer.js"></script>
- <script src="../../static/sa.js"></script>
- <script src="../../static/kj/upload-util.js"></script>
- </head>
- <body>
- <div class="vue-box" style="display: none;" :style="'display: block;'">
- <!-- 参数栏 -->
- <div class="c-panel">
- <h4 class="c-title">添加用户</h4>
- <el-form>
- <!-- 防止密码框被填充 -->
- <div style="height: 0px; overflow: hidden;">
- <el-input></el-input>
- <el-input type="password"></el-input>
- </div>
- <sa-item type="text" name="账号" v-model="m.name" br need></sa-item>
- <sa-item type="text" name="姓名" v-model="m.nickname" br need></sa-item>
- <sa-item style="display: inline;" type="text" name="手机号" v-model="m.phone" br need></sa-item>
- <sa-item type="password" name="密码" v-model="m.password" br need></sa-item>
- <sa-item name="角色" br>
- <el-select v-model="m.roleId">
- <el-option label="请选择" :value="0" disabled></el-option>
- <el-option v-for="role in roleList" :key="role.id" :label="role.name" :value="role.id">
- </el-option>
- </el-select>
- </sa-item>
- <sa-item name="" br>
- <el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
- </sa-item>
- </el-form>
- </div>
- </div>
- <script>
- var app = new Vue({
- components: {
- "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
- },
- el: '.vue-box',
- data: {
- sa: sa, // 超级对象
- m: {
- id: 0,
- name: '',
- customerId:sa.p('customerId',-2),
- superAdmin:0,
- avatar: '',
- password: '',
- roleId: 0
- },
- roleList: [],
- deptList: [],
- currentUser: sa.$sys.getCurrUser(),
- deptIds: [],
- },
- methods: {
- // 修改
- ok: function() {
- // 表单校验
- let m = this.m;
- sa.checkNull(m.name, '请输入账号');
- sa.checkNull(m.nickname, '请输入姓名');
- let phone = m.phone;
- if (!sa.isPhone(phone)) {
- sa.error('请输入正确的手机号');
- return;
- }
- sa.checkNull(m.password, '请输入密码');
- sa.checkNull(m.roleId, '请选择角色');
- // 添加
- sa.ajax('/admin/addCustomerAdmin', sa.removeNull(m), function(res) {
- sa.alert('增加成功', this.clean);
- parent.app.f5(); // 刷新父页面列表
- sa.closeCurrIframe();
- }.bind(this));
- },
- getRoleList() {
- sa.ajax('/role/getCustomerRoleList',{customerId:this.m.customerId}, function(res) {
- this.roleList = res.data; // 数据
- }.bind(this), {
- msg: null
- });
- }
- },
- mounted: function() {
- // 加载角色
- this.getRoleList();
- }
- })
- </script>
- </body>
- </html>
|