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="../../static/kj/element-ui/theme-chalk/index.css">
- <link rel="stylesheet" href="../../static/sa.css">
- <script src="../../static/kj/vue.min.js"></script>
- <script src="../../static/kj/element-ui/index.js"></script>
- <script src="https://unpkg.com/http-vue-loader@1.4.2/src/httpVueLoader.js"></script>
- <script src="../../static/kj/jquery.min.js"></script>
- <script src="../../static/kj/layer/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">
- <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" placeholder="请输入用户名" br></sa-item>
- <sa-item type="password" name="密码" v-model="m.password" placeholder="请输入密码" br></sa-item>
- <sa-item type="password" name="再输一次" v-model="m.againPassword" placeholder="请再输一次密码" br></sa-item>
- <div class="c-item">
- <label class="c-label"><span style="color: red;">*</span>角色:</label>
- <el-select v-model="m.roleIds" multiple>
- <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>
- </div>
- <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,
- customerId: sa.p('customerId', ''),
- name: '',
- avatar: '',
- password: '',
- againPassword: '',
- roleIds: []
- },
- roleList: []
- },
- methods: {
- // 修改
- ok: function () {
- console.log(this.m)
- // 表单校验
- let m = this.m;
- sa.checkNull(m.name, '请输入用户名');
- sa.checkNull(m.password, '请输入密码');
- if (m.password !== m.againPassword) {
- sa.error('两次输入密码不一致');
- return;
- }
- m.roleId = m.roleIds.join(',')
- // 添加
- sa.ajax('/admin/addPartnerAdmin', m, function (res) {
- sa.alert('增加成功', this.clean);
- }.bind(this));
- },
- clean() {
- parent.app.f5(); // 刷新父页面列表
- sa.closeCurrIframe(); // 关闭本页
- }
- },
- mounted: function () {
- // 加载角色
- sa.ajax('/role/getCustomerRoleList', {
- customerId: this.m.customerId
- }, function (res) {
- this.roleList = res.data; // 数据
- }.bind(this), {
- msg: null
- });
- }
- })
- </script>
- </body>
- </html>
|