123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362 |
- <!DOCTYPE html>
- <html class="x-admin-sm">
- <head>
- <meta charset="UTF-8">
- <meta name="renderer" content="webkit">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport"
- content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
- <link rel="shortcut icon" href="https://osscold.baozhida.cn/favicon.ico">
- <link rel="bookmark" href="https://osscold.baozhida.cn/favicon.ico">
- <link rel="stylesheet" href="https://osscold.baozhida.cn/css/font.css">
- <link rel="stylesheet" href="https://osscold.baozhida.cn/css/xadmin.css">
- <link rel="stylesheet" href="https://osscold.baozhida.cn/layui/css/layui.css">
- <script type="text/javascript" src="https://osscold.baozhida.cn/layui/layui.js" charset="utf-8"></script>
- <script type="text/javascript" src="https://osscold.baozhida.cn/js/xadmin.js"></script>
- <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
- <!--[if lt IE 9]>
- <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
- <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
- <![endif]--></head>
- <body>
- <div class="layui-fluid">
- <div class="layui-row">
- <form class="layui-form layui-form-pane">
- <div class="layui-form-item" style="margin-top: 20px">
- <label for="Power_name" class="layui-form-label">
- <span class="x-red">*</span>权限名称</label>
- <div class="layui-input-inline">
- <input {{if gt .id 0 }}
- value="{{.Date.Power_name}}"
- {{end}} type="text" id="Power_name" name="Power_name" required="" lay-verify="required"
- autocomplete="off" class="layui-input"></div>
- </div>
- <div class="layui-form-item layui-form-text">
- <label class="layui-form-label">
- 拥有权限
- </label>
- <table class="layui-table layui-input-block">
- <tbody>
- <tr>
- <td width="50px">
- <span>内部人员</span>
- </td>
- <td>
- <div class="layui-input-block">
- <input type="checkbox" id="Power_Administration" name="Power_Administration" value='1'
- {{if gt $.id 0 }}
- {{if eq $.Date.Power_Administration 1 }}
- checked="checked"
- {{end}}
- {{end}}
- class='checkone' lay-skin="primary" TITLE="内部人员">
- </div>
- </td>
- </tr>
- <tr>
- <td>
- <span>管理员</span>
- </td>
- <td>
- <div class="layui-input-block">
- <input type="checkbox" id="Power_User_r" name="Power_User_r" value='1'
- {{if gt $.id 0 }}
- {{if eq $.Date.Power_User_r 1 }}
- checked="checked"
- {{end}}
- {{end}}
- class='checkone' lay-skin="primary" title="用户管理">
- <input type="checkbox" id="Power_User_e" name="Power_User_e" value='1'
- {{if gt $.id 0 }}
- {{if eq $.Date.Power_User_e 1 }}
- checked="checked"
- {{end}}
- {{end}}
- class='checkone' lay-skin="primary" title="创建、编辑、删除 -用户管理">
- <input type="checkbox" id="Power_User_entry" name="Power_User_entry" value='1'
- {{if gt $.id 0 }}
- {{if eq $.Date.Power_User_entry 1 }}
- checked="checked"
- {{end}}
- {{end}}
- class='checkone' lay-skin="primary" title="无钥匙进入 -用户管理">
- </div>
- </td>
- </tr>
- <tr>
- <td>
- <span>设备管理</span>
- </td>
- <td>
- <div class="layui-input-block">
- <input type="checkbox" id="Power_Device_r" name="Power_Device_r" value='1'
- {{if gt $.id 0 }}
- {{if eq $.Date.Power_Device_r 1 }}
- checked="checked"
- {{end}}
- {{end}}
- class='checkone' lay-skin="primary" title="设备管理">
- <input type="checkbox" id="Power_Device_Parameter_e" name="Power_Device_Parameter_e" value='1'
- {{if gt $.id 0 }}
- {{if eq $.Date.Power_Device_Parameter_e 1 }}
- checked="checked"
- {{end}}
- {{end}}
- class='checkone' lay-skin="primary" title="设备参数设置">
- <input type="checkbox" id="Power_DeviceSensor_Parameter_e" name="Power_DeviceSensor_Parameter_e" value='1'
- {{if gt $.id 0 }}
- {{if eq $.Date.Power_DeviceSensor_Parameter_e 1 }}
- checked="checked"
- {{end}}
- {{end}}
- class='checkone' lay-skin="primary" title="传感器参数设置">
- <input type="checkbox" id="Power_DeviceSensor_Compensate_e" name="Power_DeviceSensor_Compensate_e" value='1'
- {{if gt $.id 0 }}
- {{if eq $.Date.Power_DeviceSensor_Compensate_e 1 }}
- checked="checked"
- {{end}}
- {{end}}
- class='checkone' lay-skin="primary" title="二级报警">
- <input type="checkbox" id="Power_Device_a" name="Power_Device_a" value='1'
- {{if gt $.id 0 }}
- {{if eq $.Date.Power_Device_a 1 }}
- checked="checked"
- {{end}}
- {{end}}
- class='checkone' lay-skin="primary" title="设备添加 [内部]">
- </div>
- <div class="layui-input-block">
- <input type="checkbox" disabled="disabled" value='1' checked="checked" class='checkone' lay-skin="primary" title="设备报警">
- <input type="checkbox" id="Power_Device_Bind_e" name="Power_Device_Bind_e" value='1'
- {{if gt $.id 0 }}
- {{if eq $.Date.Power_Device_Bind_e 1 }}
- checked="checked"
- {{end}}
- {{end}}
- class='checkone' lay-skin="primary" title="设备绑定">
- <input type="checkbox" id="Power_DeviceSensor_Class" name="Power_DeviceSensor_Class" value='1'
- {{if gt $.id 0 }}
- {{if eq $.Date.Power_DeviceSensor_Class 1 }}
- checked="checked"
- {{end}}
- {{end}}
- class='checkone' lay-skin="primary" title="传感器分类">
- </div>
- </td>
- </tr>
- <tr>
- <td>
- <span>数据展示</span>
- </td>
- <td>
- <input type="checkbox" disabled="disabled" value='1' checked="checked" class='checkone' lay-skin="primary" title="数据展示">
- <input type="checkbox" id="Power_DataScreen_r" name="Power_DataScreen_r" value='1'
- {{if gt $.id 0 }}
- {{if eq $.Date.Power_DataScreen_r 1 }}
- checked="checked"
- {{end}}
- {{end}}
- class='checkone' lay-skin="primary" title="大数据平台">
- </td>
- </tr>
- <tr>
- <td>
- <span>系统管理</span>
- </td>
- <td>
- <div class="layui-input-block">
- <input type="checkbox" id="Logs_Sys_r" name="Logs_Sys_r" value='1'
- {{if gt $.id 0 }}
- {{if eq $.Date.Logs_Sys_r 1 }}
- checked="checked"
- {{end}}
- {{end}}
- class='checkone' lay-skin="primary" title="系统日志 [内部]">
- <input type="checkbox" id="Logs_User_r" name="Logs_User_r" value='1'
- {{if gt $.id 0 }}
- {{if eq $.Date.Logs_User_r 1 }}
- checked="checked"
- {{end}}
- {{end}}
- class='checkone' lay-skin="primary" title="用户日志">
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="layui-form-item" style="text-align: center;margin-top: 20px">
- <!-- <label for="L_repass" class="layui-form-label"></label>-->
- <button class="layui-btn layui-btn-normal" lay-filter="add" lay-submit="">提交</button>
- </div>
- </form>
- </div>
- </div>
- <script>
- layui.use(['form', 'layer', "layedit"],
- function () {
- $ = layui.jquery;
- var form = layui.form,
- layer = layui.layer;
- var layedit = layui.layedit
- layedit.set({
- uploadImage: {
- url: '/UpFile' //接口url
- }
- });
- //构建一个默认的编辑器
- var index = layedit.build('T_text', {
- height: 580 //设置编辑器高度,
- });
- function checkone_get(tt) {
- if (tt == undefined) {
- return 0
- }
- return 1
- }
- //监听提交
- form.on('submit(add)',
- function (data) {
- console.log("=== submit(add) ==");
- console.log(data);
- // console.log(data.field.Power_Admin);
- // console.log($("#Power_Admin").attr("checked", "checked"););
- $.ajax({
- type: 'POST',
- url: 'Power_Post',//发送请求
- data: {
- id: "{{.id}}",
- Power_name: data.field.Power_name,
- Power_Administration: checkone_get(data.field.Power_Administration),
- Power_Admin_r: checkone_get(data.field.Power_Admin_r),
- Power_Admin_e: checkone_get(data.field.Power_Admin_e),
- Power_User_r: checkone_get(data.field.Power_User_r),
- Power_User_entry: checkone_get(data.field.Power_User_entry),
- Power_Power_r: checkone_get(data.field.Power_Power_r),
- Power_Power_e: checkone_get(data.field.Power_Power_e),
- Power_Device_r: checkone_get(data.field.Power_Device_r),
- Power_Device_a: checkone_get(data.field.Power_Device_a),
- Power_Device_Parameter_e: checkone_get(data.field.Power_Device_Parameter_e),
- Power_DeviceSensor_Parameter_e: checkone_get(data.field.Power_DeviceSensor_Parameter_e),
- Power_Device_Bind_e: checkone_get(data.field.Power_Device_Bind_e),
- Power_DeviceSensor_Compensate_e: checkone_get(data.field.Power_DeviceSensor_Compensate_e),
- Power_DeviceSensor_Class: checkone_get(data.field.Power_DeviceSensor_Class),
- Power_DataScreen_r: checkone_get(data.field.Power_DataScreen_r),
- Logs_Sys_r: checkone_get(data.field.Logs_Sys_r),
- Logs_User_r: checkone_get(data.field.Logs_User_r),
- },
- success: function (result) {
- console.log(result)
- if (result.Code == 200) {
- layer.msg("操作成功", {
- icon: 1,
- time: 2000
- });
- } else {
- layer.msg("错误:" + result.Msg, {
- icon: 2,
- time: 2000
- });
- }
- //
- //关闭当前frame
- parent.layer.close(parent.layer.getFrameIndex(window.name));
- parent.location.reload();
- form.render('select');
- // return false;
- }
- });
- return false;
- });
- });
- </script>
- <script>
- layui.use('upload', function () {
- var $ = layui.jquery
- , upload = layui.upload;
- //普通图片上传
- var uploadInst = upload.render({
- elem: '#test1'
- , url: '/UpFile' //改成您自己的上传接口
- , before: function (obj) {
- //预读本地文件示例,不支持ie8
- obj.preview(function (index, file, result) {
- $('#demo1').attr('src', result); //图片链接(base64)
- });
- }
- , done: function (res) {
- console.log(res)
- //如果上传失败
- if (res.code != 0) {
- return layer.msg('上传失败');
- }
- T_img = res.data.src
- console.log(T_img)
- //上传成功
- }
- , error: function () {
- console.log("error")
- //演示失败状态,并实现重传
- var demoText = $('#demoText');
- demoText.html('<span style="color: #ff5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
- demoText.find('.demo-reload').on('click', function () {
- uploadInst.upload();
- });
- }
- });
- //绑定原始文件域
- upload.render({
- elem: '#test20'
- , url: 'https://httpbin.org/post' //改成您自己的上传接口
- , done: function (res) {
- layer.msg('上传成功');
- console.log(res)
- }
- });
- });
- </script>
- </body>
- </html>
|