| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- <?php /*a:3:{s:69:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\setting\system_role\edit.php";i:1595820902;s:56:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\head.php";i:1595820902;s:57:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\style.php";i:1595820902;}*/ ?>
- <!DOCTYPE html>
- <!--suppress JSAnnotator -->
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
- <link rel="stylesheet" href="/system/css/main.css">
- <link rel="stylesheet" href="/static/css/animate.css">
- <!--<script type="text/javascript" src="/static/plug/basket.js"></script>-->
- <script type="text/javascript" src="/static/plug/requirejs/require.js"></script>
- <?php /* <script type="text/javascript" src="/static/plug/requirejs/require-basket-load.js"></script> */ ?>
- <script>
- var hostname = location.hostname;
- if(location.port) hostname += ':' + location.port;
- requirejs.config({
- map: {
- '*': {
- 'css': '/static/plug/requirejs/require-css.js'
- }
- },
- shim:{
- 'iview':{
- deps:['css!iviewcss']
- },
- 'layer':{
- deps:['css!layercss']
- }
- },
- baseUrl:'//'+hostname+'/',
- paths: {
- 'static':'static',
- 'system':'system',
- 'vue':'static/plug/vue/dist/vue.min',
- 'axios':'static/plug/axios.min',
- 'iview':'static/plug/iview/dist/iview.min',
- 'iviewcss':'static/plug/iview/dist/styles/iview',
- 'lodash':'static/plug/lodash',
- 'layer':'static/plug/layer/layer',
- 'layercss':'static/plug/layer/theme/default/layer',
- 'jquery':'static/plug/jquery/jquery.min',
- 'moment':'static/plug/moment',
- 'sweetalert':'static/plug/sweetalert2/sweetalert2.all.min',
- 'formCreate':'/static/plug/form-create/form-create.min',
- },
- basket: {
- excludes:['system/js/index','system/util/mpVueComponent','system/util/mpVuePackage']
- // excludes:['system/util/mpFormBuilder','system/js/index','system/util/mpVueComponent','system/util/mpVuePackage']
- }
- });
- </script>
- <script type="text/javascript" src="/system/util/mpFrame.js"></script>
- <script>
- $eb = parent._mpApi;
- // if(!$eb) top.location.reload();
- </script>
- <title></title>
- </head>
- <body>
- <div id="form-add" class="mp-form" v-cloak="">
- <i-Form :model="formData" :label-width="80" >
- <Form-Item label="身份名称">
- <i-input v-model="formData.role_name" placeholder="请输入身份名称"></i-input>
- </Form-Item>
- <Form-Item label="是否开启">
- <Radio-Group v-model="formData.status">
- <Radio label="1">开启</Radio>
- <Radio label="0">关闭</Radio>
- </Radio-Group>
- </Form-Item>
- <Form-Item label="权限">
- <Tree :data="menus" show-checkbox ref="tree"></Tree>
- </Form-Item>
- <Form-Item :class="'add-submit-item'">
- <i-Button :type="'primary'" :html-type="'submit'" :size="'large'" :long="true" :loading="loading" @click.prevent="submit">提交</i-Button>
- </Form-Item>
- </i-Form>
- </div>
- <script>
- $eb = parent._mpApi;
- var role = <?php echo $role; ?> || {};
- var menus = <?php echo $menus; ?> || [];
- mpFrame.start(function(Vue){
- new Vue({
- el:'#form-add',
- data:{
- formData:{
- role_name:role.role_name || '',
- status:String(role.status) || '1',
- checked_menus:role.rules
- },
- menus:[],
- loading:false
- },
- methods:{
- tidyRes:function(){
- var data = [];
- menus.map((menu)=>{
- data.push(this.initMenu(menu));
- });
- this.$set(this,'menus',data);
- },
- initMenu:function(menu){
- var data = {},checkMenus = ','+this.formData.checked_menus+',';
- data.title = menu.menu_name;
- data.id = menu.id;
- if(menu.child && menu.child.length >0){
- data.children = [];
- menu.child.map((child)=>{
- data.children.push(this.initMenu(child));
- })
- }else{
- data.checked = checkMenus.indexOf(String(','+data.id+',')) !== -1;
- data.expand = !data.checked;
- }
- return data;
- },
- submit:function(){
- this.loading = true;
- this.formData.checked_menus = [];
- this.$refs.tree.getCheckedNodes().map((node)=>{
- this.formData.checked_menus.push(node.id);
- });
- $eb.axios.post("<?php echo htmlentities($updateUrl); ?>",this.formData).then((res)=>{
- if(res.status && res.data.code == 200)
- return Promise.resolve(res.data);
- else
- return Promise.reject(res.data.msg || '添加失败,请稍候再试!');
- }).then((res)=>{
- $eb.message('success',res.msg || '操作成功!');
- $eb.closeModalFrame(window.name);
- parent.$(".J_iframe:visible")[0].contentWindow.location.reload();
- }).catch((err)=>{
- this.loading=false;
- $eb.message('error',err);
- });
- }
- },
- mounted:function(){
- t = this;
- this.tidyRes();
- }
- });
- });
- </script>
- </body>
|