feat: 从自己的gitee转移项目

main
ppst 1 year ago
commit 52f44abd11

@ -0,0 +1,14 @@
# https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

8
.gitignore vendored

@ -0,0 +1,8 @@
.DS_Store
node_modules
.vscode
dist
package-lock.json
mock/node_modules
mock/package-lock.json

@ -0,0 +1,39 @@
# layui-admin
## 目录说明
admin (开发目录)
dist (生成的静态页面)
## 安装
```shell
npm init
```
## 运行
```shell
npm run start
```
## 特点
1. rem 自适应布局
2. mock 数据模拟
3. 界面使用 根据 scss 适配颜色
4. 常用界面示例
5. excel处理
6. gulp 打包 压缩 添加 css 浏览器前缀,js(es6=>es5),热重载,跨域代理等
7. 生产,测试,开发灵活配置
8. 公用模板
9. 合并jscsshtml 减少资源请求

@ -0,0 +1,37 @@
@@include('./../../template/common/header.html', {
"title": "心电图",
csslinks:[]
})
<script src="./../../static/js/echarts.min.js"></script>
<div class="layui-iframe">
@@include('./../../template/common/breadcrumb.html', {
"title": "心电图",
subtitle:''
})
<div class="layui-fluid">
<div class="layui-card form-card">
<form class="layui-form form-box">
<label class="form-label">名称 :</label>
<input type="tel" name="text" autocomplete="off" class="form-input">
<div class="form-button-fixed">
<button type="submit" class="form-btn ml-10" lay-submit lay-filter="lay-form-submit">查询</button>
<button type="reset" class="form-btn ml-10 reset-btn">重置</button>
</div>
</form>
</div>
<div class="layui-card chart-box">
<div class="chart">
<div id="ecgChart" style="width: 100%; height: 257px;"></div>
</div>
</div>
<div class="layui-card table-box">
<div class="layui-card-body">
<table id="listTable" lay-filter="listTable" lay-size="lg"></table>
<div id="pages"></div>
</div>
</div>
</div>
</div>
@@include('./../../template/common/footer.html', {
"jslinks": ['./../../static/js/chart/ecg.js']
})

@ -0,0 +1,37 @@
@@include('./../../template/common/header.html', {
"title": "柱状图",
csslinks:[]
})
<script src="./../../static/js/echarts.min.js"></script>
<div class="layui-iframe">
@@include('./../../template/common/breadcrumb.html', {
"title": "折线图",
subtitle:''
})
<div class="layui-fluid">
<div class="layui-card form-card">
<form class="layui-form form-box">
<label class="form-label">名称 :</label>
<input type="tel" name="text" autocomplete="off" class="form-input">
<div class="form-button-fixed">
<button type="submit" class="form-btn ml-10" lay-submit lay-filter="lay-form-submit">查询</button>
<button type="reset" class="form-btn ml-10 reset-btn">重置</button>
</div>
</form>
</div>
<div class="layui-card chart-box">
<div class="chart">
<div id="histogramChart" style="width: 100%; height: 288px;"></div>
</div>
</div>
<div class="layui-card table-box">
<div class="layui-card-body">
<table id="listTable" lay-filter="listTable" lay-size="lg"></table>
<div id="pages"></div>
</div>
</div>
</div>
</div>
@@include('./../../template/common/footer.html', {
"jslinks": ['./../../static/js/chart/histogram.js']
})

@ -0,0 +1,37 @@
@@include('./../../template/common/header.html', {
"title": "折线图",
csslinks:[]
})
<script src="./../../static/js/echarts.min.js"></script>
<div class="layui-iframe">
@@include('./../../template/common/breadcrumb.html', {
"title": "折线图",
subtitle:''
})
<div class="layui-fluid">
<div class="layui-card form-card">
<form class="layui-form form-box">
<label class="form-label">名称 :</label>
<input type="tel" name="text" autocomplete="off" class="form-input">
<div class="form-button-fixed">
<button type="submit" class="form-btn ml-10" lay-submit lay-filter="lay-form-submit">查询</button>
<button type="reset" class="form-btn ml-10 reset-btn">重置</button>
</div>
</form>
</div>
<div class="layui-card chart-box">
<div class="chart">
<div id="lineChart" style="width: 100%; height: 257px;"></div>
</div>
</div>
<div class="layui-card table-box">
<div class="layui-card-body">
<table id="listTable" lay-filter="listTable" lay-size="lg"></table>
<div id="pages"></div>
</div>
</div>
</div>
</div>
@@include('./../../template/common/footer.html', {
"jslinks": ['./../../static/js/chart/line.js']
})

@ -0,0 +1,37 @@
@@include('./../../template/common/header.html', {
"title": "波浪折线图",
csslinks:[]
})
<script src="./../../static/js/echarts.min.js"></script>
<div class="layui-iframe">
@@include('./../../template/common/breadcrumb.html', {
"title": "波浪折线图",
subtitle:''
})
<div class="layui-fluid">
<div class="layui-card form-card">
<form class="layui-form form-box">
<label class="form-label">名称 :</label>
<input type="tel" name="text" autocomplete="off" class="form-input">
<div class="form-button-fixed">
<button type="submit" class="form-btn ml-10" lay-submit lay-filter="lay-form-submit">查询</button>
<button type="reset" class="form-btn ml-10 reset-btn">重置</button>
</div>
</form>
</div>
<div class="layui-card chart-box">
<div class="chart">
<div id="wavypolylineChart" style="width: 100%; height: 257px;"></div>
</div>
</div>
<div class="layui-card table-box">
<div class="layui-card-body">
<table id="listTable" lay-filter="listTable" lay-size="lg"></table>
<div id="pages"></div>
</div>
</div>
</div>
</div>
@@include('./../../template/common/footer.html', {
"jslinks": ['./../../static/js/chart/wavypolyline.js']
})

@ -0,0 +1,87 @@
@@include('./../../template/common/header.html', {
"title": "clipboard",
csslinks:['./../../static/css/detail.css']
})
<script src="./../../static/js/clipboard/clipboard.min.js"></script>
<div class="layui-iframe">
@@include('./../../template/common/breadcrumb.html', {
"title": "clipboard",
subtitle:''
})
<div class="layui-fluid">
<!-- clipboard1 -->
<div class="layui-card detail-card">
<div class="header"><span class="icon"></span><span class="title">constructor-id-node</span></div>
<div class="layui-opr-block">
<div id="btn" data-clipboard-text="1">
<span class="normal-btn mr-10">复制</span>
</div>
</div>
</div>
<!-- clipboard2 -->
<div class="layui-card detail-card">
<div class="header"><span class="icon"></span><span class="title">constructor-button-nodelist</span></div>
<div class="layui-opr-block">
<button class="normal-btn mr-10" data-clipboard-text="1">复制</button>
<button class="normal-btn mr-10" data-clipboard-text="2">复制</button>
<button class="normal-btn mr-10" data-clipboard-text="3">复制</button>
</div>
</div>
<!-- clipboard3 -->
<div class="layui-card detail-card">
<div class="header"><span class="icon"></span><span class="title">constructor-selector</span></div>
<div class="layui-opr-block">
<span class="normal-btn selector-constructor mr-10">复制</span>
</div>
</div>
<!-- clipboard4 -->
<div class="layui-card detail-card">
<div class="header"><span class="icon"></span><span class="title">function-target</span></div>
<div class="layui-opr-block">
<button class="normal-btn target-btn">复制</button>
<div class="target-text">this is copy text!</div>
</div>
</div>
<!-- clipboard5 -->
<div class="layui-card detail-card">
<div class="header"><span class="icon"></span><span class="title">function-text</span></div>
<div class="layui-opr-block">
<button class="normal-btn text-btn">复制</button>
</div>
</div>
<!-- clipboard6 -->
<div class="layui-card detail-card">
<div class="header"><span class="icon"></span><span class="title">function-target</span></div>
<div class="layui-opr-block">
<p>这就是你要复制的内容</p>
<button class="normal-btn div-btn" data-clipboard-action="copy" data-clipboard-target="p">复制</button>
</div>
</div>
<!-- clipboard7 -->
<div class="layui-card detail-card">
<div class="header"><span class="icon"></span><span class="title">function-target-input</span></div>
<div class="layui-opr-block">
<input id="foo" type="text" value="hello">
<button class="normal-btn target-input-btn" data-clipboard-action="copy"
data-clipboard-target="#foo">复制</button>
</div>
</div>
<!-- clipboard8 -->
<div class="layui-card detail-card">
<div class="header"><span class="icon"></span><span class="title">function-textarea</span></div>
<div class="layui-opr-block">
<textarea id="bar">hello textarea</textarea>
<button class="normal-btn target-textarea-btn" data-clipboard-action="copy"
data-clipboard-target="#bar">复制</button>
</div>
</div>
</div>
</div>
@@include('./../../template/common/footer.html', {
"jslinks": ['./../../static/js/clipboard/index.js']
})

@ -0,0 +1,45 @@
@@include('./../../template/common/header.html', {
"title": "详情",
csslinks:['./../../static/css/detail.css']
})
<div class="layui-iframe">
@@include('./../../template/common/breadcrumb.html', {
"title": "详情",
subtitle:''
})
<div class="layui-fluid">
<div class="layui-card detail-card">
<div class="header"><span class="icon"></span><span class="title">基本信息</span></div>
<ul class="content detail-content">
<li><span>任务ID :5cb92069c3492</span><span>任务名称 :CRM->SCRM[FUL</span></li>
<li><span>读节点 :5cb92069c3492</span><span>写节点 :CRM->SCRM[FUL</span></li>
<li><span>创建者 :5cb92069c3492</span><span>创建时间 :CRM->SCRM[FUL</span></li>
<li><span>更新者 :5cb92069c3492</span><span>更新时间 :CRM->SCRM[FUL</span></li>
<li><span>状态 :5cb92069c3492</span><span>同步架构 :CRM->SCRM[FUL</span></li>
<li><span>源库类型 :5cb92069c3492</span><span>目标库类型 :CRM->SCRM[FUL</span></li>
<li><span>源库端口 :5cb92069c3492</span><span>目标库端口 :CRM->SCRM[FUL</span></li>
<li><span>源库账号 :5cb92069c3492</span><span>目标库账号 :CRM->SCRM[FUL</span></li>
<li><span>已发送数据位点 :5cb92069c3492</span><span>已删除数据位点 :CRM->SCRM[FUL</span></li>
</ul>
</div>
<div class="layui-card detail-card">
<div class="header"><span class="icon"></span><span class="title">初始化设置</span></div>
<p class="desc" id="settingId">同步方式设置 :结构初始化 + 全量数据初始化+增量数据</p>
</div>
<div class="layui-card table-box detail-card">
<div class="header"><span class="icon"></span><span class="title">映射关系</span></div>
<div class="layui-card-body">
<table id="listTable" lay-filter="listTable" lay-size="lg"></table>
</div>
</div>
</div>
</div>
<script type="text/html" id="cellOperating">
<span class="blue-title" lay-event="detail" data-tips="查看列" onmouseover="showToolTips(this)">查看列</span>
</script>
<script type="text/html" id="tableDialogTemplate">
<table id="detailTable" lay-filter="detailTable" lay-size="lg"></table>
</script>
@@include('./../../template/common/footer.html', {
"jslinks": ['./../../static/js/detail/index.js']
})

@ -0,0 +1,79 @@
@@include('./../../template/common/header.html', {
"title": "dialog",
csslinks:['./../../static/css/detail.css']
})
<div class="layui-iframe">
@@include('./../../template/common/breadcrumb.html', {
"title": "dialog",
subtitle:''
})
<div class="layui-fluid">
<div class="layui-card detail-card">
<div class="header"><span class="icon"></span><span class="title">iframe dialog</span></div>
<div class="layui-opr-block">
<span class="normal-btn mr-10" id="demo1">打开</span>
</div>
</div>
<div class="layui-card detail-card">
<div class="header"><span class="icon"></span><span class="title">show OK dialog</span></div>
<div class="layui-opr-block">
<span class="normal-btn mr-10" id="demo2">打开</span>
</div>
</div>
<div class="layui-card detail-card">
<div class="header"><span class="icon"></span><span class="title">生成二维码 dialog</span></div>
<div class="layui-opr-block">
<span class="normal-btn mr-10" id="demo3">打开</span>
</div>
</div>
<div class="layui-card detail-card">
<div class="header"><span class="icon"></span><span class="title">form add dialog</span></div>
<div class="layui-opr-block">
<span class="normal-btn mr-10" id="demo4">打开</span>
</div>
</div>
<div class="layui-card detail-card">
<div class="header"><span class="icon"></span><span class="title">form edit dialog</span></div>
<div class="layui-opr-block">
<span class="normal-btn mr-10" id="demo5">打开</span>
</div>
</div>
<script type="text/html" id="formDialogTemplate">
<div class="layui-form dialog-form add-edit-form" lay-filter="dialogForm">
<div class="layui-form-item">
<label class="layui-form-label">名称:</label>
<div class="layui-input-inline">
<input type="text" name="name" required lay-verify="required" lay-verType="tips" lay-reqText="请填入名称" placeholder="请填入名称" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">数据源类型:</label>
<div class="layui-input-inline">
<select name="type" required lay-verify="required" lay-verType="tips" lay-reqText="请填入类型">
<option value="">请选择</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
</div>
</div>
<div class="layui-layer-btn layui-hide">
<button class="layui-btn layui-form-btn layui-btn-sm submit-btn" id="LAY-dialog-submit" lay-submit lay-filter="lay-dialog-submit">
确认
</button>
</div>
</div>
</script>
</div>
</div>
@@include('./../../template/common/footer.html', {
"jslinks": ['./../../static/js/dialog/index.js']
})

@ -0,0 +1,28 @@
@@include('./../../template/common/header.html', {
"title": "edittable",
csslinks:['./../../static/css/edittable.css']
})
<div class="layui-iframe">
@@include('./../../template/common/breadcrumb.html', {
"title": "edittable",
subtitle:''
})
<div class="layui-fluid">
<div class="layui-card table-box">
<div class="layui-opr-block">
<span class="normal-btn add-dialog mr-10">新增</span>
</div>
<div class="layui-card-body">
<table id="listTable" lay-filter="listTable" lay-size="lg" class="layui-form"></table>
<div id="pages"></div>
</div>
</div>
</div>
</div>
<script type="text/html" id="cellOperating">
<span class="cell-opr edit-cell" lay-event="edit" data-tips="编辑" onmouseover="showToolTips(this)"></span>
<span class="cell-opr delete-cell" lay-event="delete" data-tips="删除" onmouseover="showToolTips(this)"></span>
</script>
@@include('./../../template/common/footer.html', {
"jslinks": ['./../../static/js/edittable/index.js']
})

@ -0,0 +1,23 @@
@@include('./../../template/common/header.html', {
"title": "excel 导出",
csslinks:[]
})
<div class="layui-iframe">
@@include('./../../template/common/breadcrumb.html', {
"title": "excel 导出",
subtitle:''
})
<div class="layui-card table-box">
<div class="layui-opr-block">
<span class="normal-btn export-button mr-10">导出</span>
</div>
<div class="layui-card-body">
<table id="listTable" lay-filter="listTable" lay-size="lg"></table>
<div id="pages"></div>
</div>
</div>
</div>
</div>
@@include('./../../template/common/footer.html', {
"jslinks": ['./../../static/js/excel/export.js']
})

@ -0,0 +1,26 @@
@@include('./../../template/common/header.html', {
"title": "excel 导入",
csslinks:['./../../static/css/excel.css']
})
<div class="layui-iframe">
@@include('./../../template/common/breadcrumb.html', {
"title": "excel 导入",
subtitle:''
})
<div class="layui-card table-box">
<div class="layui-opr-block">
<div class="layui-form-item">
<label class="layui-form-label">门店编号:</label>
<div class="layui-input-inline">
<a href="javascript:;" class="file">选择文件
<input type="file" name="" id="LAY-excel-import-excel" accept="*.xls,*.xlsx">
</a>
</div>
</div>
</div>
</div>
</div>
</div>
@@include('./../../template/common/footer.html', {
"jslinks": ['./../../static/js/excel/upload.js']
})

@ -0,0 +1,48 @@
@@include('./../../template/common/header.html', {
"title": "date 导入",
csslinks:[]
})
<div class="layui-iframe">
@@include('./../../template/common/breadcrumb.html', {
"title": "date页面",
subtitle:''
})
<div class="layui-fluid">
<div class="layui-card form-card">
<div class="layui-form">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">中文版</label>
<div class="layui-input-inline">
<input type="text" class="layui-input" id="test1" placeholder="yyyy-MM-dd">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">国际版</label>
<div class="layui-input-inline">
<input type="text" class="layui-input" id="test1-1" placeholder="yyyy-MM-dd">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
layui.use('laydate', function () {
var laydate = layui.laydate;
//常规用法
laydate.render({
elem: '#test1'
});
//国际版
laydate.render({
elem: '#test1-1'
, lang: 'en'
});
})
</script>
@@include('./../../template/common/footer.html', {
"jslinks": []
})

@ -0,0 +1,264 @@
@@include('./../../template/common/header.html', {
"title": "demo",
csslinks:['./../../static/layui/layui/css/modules/laydate/default/laydate.css']
})
<div class="layui-iframe">
@@include('./../../template/common/breadcrumb.html', {
"title": "table页面",
subtitle:''
})
<div class="layui-fluid">
<div class="layui-card form-card">
<form class="layui-form form-box">
<label class="form-label">名称 :</label>
<input type="tel" name="text" autocomplete="off" class="form-input">
<label class="form-label">动态select数据 :</label>
<select name="fz" id="testIdSelect">
<option value="">请选择分组</option>
</select>
<div class="form-button-fixed">
<button type="submit" class="form-btn ml-10" lay-submit lay-filter="lay-form-submit">查询</button>
<button type="reset" class="form-btn ml-10 reset-btn">重置</button>
</div>
</form>
</div>
<div class="layui-card form-card">
<form class="layui-form" action="">
<div class="layui-form-item">
<label class="layui-form-label">单行输入框</label>
<div class="layui-input-block">
<input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入标题"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">验证必填项</label>
<div class="layui-input-block">
<input type="text" name="username" lay-verify="required" lay-reqtext="用户名是必填项,岂能为空?" placeholder="请输入"
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">验证手机</label>
<div class="layui-input-inline">
<input type="tel" name="phone" lay-verify="required|phone" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">验证邮箱</label>
<div class="layui-input-inline">
<input type="text" name="email" lay-verify="email" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">多规则验证</label>
<div class="layui-input-inline">
<input type="text" name="number" lay-verify="required|number" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">验证日期</label>
<div class="layui-input-inline">
<input type="text" name="date" id="date" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">验证链接</label>
<div class="layui-input-inline">
<input type="tel" name="url" lay-verify="url" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">验证身份证</label>
<div class="layui-input-block">
<input type="text" name="identity" lay-verify="identity" placeholder="" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">自定义验证</label>
<div class="layui-input-inline">
<input type="password" name="password" lay-verify="pass" placeholder="请输入密码" autocomplete="off"
class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">请填写6到12位密码</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">范围</label>
<div class="layui-input-inline" style="width: 100px;">
<input type="text" name="price_min" placeholder="¥" autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 100px;">
<input type="text" name="price_max" placeholder="¥" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">单行选择框</label>
<div class="layui-input-block">
<select name="interest" lay-filter="aihao">
<option value=""></option>
<option value="0">写作</option>
<option value="1" selected="">阅读</option>
<option value="2">游戏</option>
<option value="3">音乐</option>
<option value="4">旅行</option>
</select>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">分组选择框</label>
<div class="layui-input-inline">
<select name="quiz">
<option value="">请选择问题</option>
<optgroup label="城市记忆">
<option value="你工作的第一个城市">你工作的第一个城市</option>
</optgroup>
<optgroup label="学生时代">
<option value="你的工号">你的工号</option>
<option value="你最喜欢的老师">你最喜欢的老师</option>
</optgroup>
</select>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">搜索选择框</label>
<div class="layui-input-inline">
<select name="modules" lay-verify="required" lay-search="">
<option value="">直接选择或搜索选择</option>
<option value="1">layer</option>
<option value="2">form</option>
<option value="3">layim</option>
<option value="4">element</option>
<option value="5">laytpl</option>
<option value="6">upload</option>
<option value="7">laydate</option>
<option value="8">laypage</option>
<option value="9">flow</option>
<option value="10">util</option>
<option value="11">code</option>
<option value="12">tree</option>
<option value="13">layedit</option>
<option value="14">nav</option>
<option value="15">tab</option>
<option value="16">table</option>
<option value="17">select</option>
<option value="18">checkbox</option>
<option value="19">switch</option>
<option value="20">radio</option>
</select>
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">联动选择框</label>
<div class="layui-input-inline">
<select name="quiz1">
<option value="">请选择省</option>
<option value="浙江" selected="">浙江省</option>
<option value="你的工号">江西省</option>
<option value="你最喜欢的老师">福建省</option>
</select>
</div>
<div class="layui-input-inline">
<select name="quiz2">
<option value="">请选择市</option>
<option value="杭州">杭州</option>
<option value="宁波" disabled="">宁波</option>
<option value="温州">温州</option>
<option value="温州">台州</option>
<option value="温州">绍兴</option>
</select>
</div>
<div class="layui-input-inline">
<select name="quiz3">
<option value="">请选择县/区</option>
<option value="西湖区">西湖区</option>
<option value="余杭区">余杭区</option>
<option value="拱墅区">临安市</option>
</select>
</div>
<div class="layui-form-mid layui-word-aux">此处只是演示联动排版,并未做联动交互</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">复选框</label>
<div class="layui-input-block">
<input type="checkbox" name="like[write]" title="写作">
<input type="checkbox" name="like[read]" title="阅读" checked="">
<input type="checkbox" name="like[game]" title="游戏">
</div>
</div>
<div class="layui-form-item" pane="">
<label class="layui-form-label">原始复选框</label>
<div class="layui-input-block">
<input type="checkbox" name="like1[write]" lay-skin="primary" title="写作" checked="">
<input type="checkbox" name="like1[read]" lay-skin="primary" title="阅读">
<input type="checkbox" name="like1[game]" lay-skin="primary" title="游戏" disabled="">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">开关-默认关</label>
<div class="layui-input-block">
<input type="checkbox" name="close" lay-skin="switch" lay-text="ON|OFF">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">开关-默认开</label>
<div class="layui-input-block">
<input type="checkbox" checked="" name="open" lay-skin="switch" lay-filter="switchTest" lay-text="ON|OFF">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">单选框</label>
<div class="layui-input-block">
<input type="radio" name="sex" value="男" title="男" checked="">
<input type="radio" name="sex" value="女" title="女">
<input type="radio" name="sex" value="禁" title="禁用" disabled="">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">普通文本域</label>
<div class="layui-input-block">
<textarea placeholder="请输入内容" class="layui-textarea"></textarea>
</div>
</div>
<!--<div class="layui-form-item layui-form-text">
<label class="layui-form-label">编辑器</label>
<div class="layui-input-block">
<textarea class="layui-textarea layui-hide" name="content" lay-verify="content" id="LAY_demo_editor"></textarea>
</div>
</div>-->
<div class="layui-form-item">
<div class="layui-input-block">
<button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</form>
</div>
</div>
</div>
@@include('./../../template/common/footer.html', {
"jslinks": ['./../../static/js/form/index.js']
})

@ -0,0 +1,124 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>admin</title>
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<link rel="stylesheet" href="./../../static/layui/layui/css/layui.css" media="all" />
<link rel="stylesheet" href="../static/css/admin.css" media="all" />
<link rel="stylesheet" href="../static/css/common.css" media="all" />
<script src="../static/layui/layui/layui.js"></script>
</head>
<body>
<div class="layui-layout layui-layout-admin">
<div class="left-side left-bg">
<div class="side-menu">
<div class="side-scroll">
<div class="left-fold-box">
<div class="logo" lay-href="table/index.html">
admin
</div>
<div class="fold-box fold"></div>
</div>
<ul class="nav-tree main-tree" lay-shrink="all" lay-filter="layadmin-system-side-menu">
<li class="left-menu layui-this" lay-title="table表格" lay-href="table/index.html">
<i class="icon sjy"></i>
<span class="title">table表格</span>
</li>
<li class="left-menu" lay-title="dialog" lay-href="dialog/index.html">
<i class="icon fz"></i>
<span class="title">dialog</span>
</li>
<li class="left-menu" lay-title="edittable" lay-href="edittable/index.html">
<i class="icon fz"></i>
<span class="title">edittable</span>
</li>
<li class="left-menu" lay-title="步骤页面" lay-href="step/index.html">
<i class="icon fz"></i>
<span class="title">步骤页面</span>
</li>
<li class="left-menu" lay-title="详情页面" lay-href="detail/index.html">
<i class="icon light rw"></i>
<span class="title">详情页面</span>
</li>
<li class="left-menu" lay-title="tab页面" lay-href="tab/index.html">
<i class="icon light rw"></i>
<span class="title">tab页面</span>
</li>
<li class="left-menu" lay-title="clipboard页面" lay-href="clipboard/index.html">
<i class="icon light rw"></i>
<span class="title">clipboard页面</span>
</li>
<li class="menu-box" style="height: 100%;">
<ul class="menu-list">
<li class="top-menu">
<i class="menu-icon open-icon"></i>
<i class="icon rw"></i>
<span class="title">EXCEl</span>
</li>
<li class="left-menu" lay-title="导出" lay-href="excel/export.html">
<span class="sub-title">导出</span>
</li>
<li class="left-menu" lay-title="导入" lay-href="excel/upload.html">
<span class="sub-title">导入</span>
</li>
</ul>
</li>
<li class="menu-box" style="height: 100%;">
<ul class="menu-list">
<li class="top-menu">
<i class="menu-icon open-icon"></i>
<i class="icon rw"></i>
<span class="title">form</span>
</li>
<li class="left-menu" lay-title="form" lay-href="form/index.html">
<span class="sub-title">form</span>
</li>
<li class="left-menu" lay-title="date" lay-href="form/date.html">
<span class="sub-title">date</span>
</li>
</ul>
</li>
<li class="menu-box" style="height: 100%;">
<ul class="menu-list">
<li class="top-menu">
<i class="menu-icon close-icon"></i>
<i class="icon rw"></i>
<span class="title">chart图表</span>
</li>
<li class="left-menu display-none" lay-title="折线图" lay-href="chart/line.html">
<span class="sub-title">折线图</span>
</li>
<li class="left-menu display-none" lay-title="柱状图" lay-href="chart/histogram.html">
<span class="sub-title">柱状图</span>
</li>
<li class="left-menu display-none" lay-title="波浪折线图"
lay-href="chart/wavypolyline.html">
<span class="sub-title">波浪折线图</span>
</li>
<li class="left-menu display-none" lay-title="心电图" lay-href="chart/ecg.html">
<span class="sub-title">心电图</span>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div class="layui-body" id="LAY_app_body">
<div>
<iframe class="iframe-box" src="table/index.html" frameborder="0" id="iframe"></iframe>
</div>
</div>
</div>
<script src="./../static/js/index.js"></script>
</body>
</html>

@ -0,0 +1,189 @@
@@include('./../../template/common/header.html', {
"title": "demo",
csslinks:['./../../static/css/step.css']
})
<div class="layui-iframe">
@@include('./../../template/common/breadcrumb.html', {
"title": "demo",
subtitle:''
})
<div class="layui-fluid">
<div class="layui-card table-box">
<div class="layui-progress layui-progress-big" lay-filter="progress">
<div class="step-box">
<ul class="step-ul">
<li class="active">1. 源及目标</li>
<li>2. 选择对象</li>
<li>3. 方式设置</li>
<li>4. 完成</li>
</ul>
</div>
<div class="layui-progress-bar" lay-percent="25%"><i class="active-after"></i></div>
</div>
<div class="step-content">
<div class="step-1">
<div class="layui-form dialog-form">
<div class="layui-form-item">
<label class="layui-form-label">名称:</label>
<div class="layui-input-inline">
<input type="text" name="taskName" required lay-verify="required" placeholder="请填入名称" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">备注:</label>
<div class="layui-input-inline">
<input type="text" name="remark" required lay-verify="required" placeholder="请填入备注" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">描述:</label>
<div class="layui-input-inline">
<input type="text" name="sourceDescription" required lay-verify="required" placeholder="描述"
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item source-test">
<label class="layui-form-label"></label>
<div class="layui-input-inline">
<div class="test-link-fail"><span class="icon"></span>连接失败</div>
<div class="test-link-success"><span class="icon"></span>连接失败</div>
<span class="test-link" onclick="testLink(this)">测试链接</span>
</div>
</div>
<div class="layui-layer-btn">
<button class="step-btn ml-10 reset-btn">取消</button>
<button class="step-btn ml-10 submit-btn" lay-submit lay-filter="lay-step1-submit">
下一步
</button>
</div>
</div>
</div>
<div class="step-2 display-none">
<div class="layui-form dialog-form">
<div class="layui-transfer layui-form layui-border-box" lay-filter="LAY-transfer-1">
<div class="layui-transfer-box" data-index="0">
<div class="layui-transfer-header">
<div class="layui-unselect" lay-skin="primary"><span>源库对象</span></div>
</div>
<ul class="layui-transfer-data">
<li class="tree-node"><i class="rw1"></i><i class="rw2"></i><span class="source-title"></span></li>
<li class="tree-node tree-node2"><i class="rw1"></i><i class="rw2"></i><span>tables</span></li>
<li>
<dl class="tree-node tree-list source-tree-list">
</dl>
</li>
</ul>
</div>
<div class="layui-transfer-active">
<div class="opr-box"> <i class="icon-next"></i>
<i class="icon-pre"></i></div>
</div>
<div class="layui-transfer-box" data-index="1">
<div class="layui-transfer-header">
<div class="layui-unselect" lay-skin="primary"><span>已选择对象</span></div>
</div>
<ul class="layui-transfer-data">
<li class="tree-node tree-node2"><i class="rw2"></i><span>sales_order<em
class="total-nodes"></em></span></li>
<li>
<dl class="tree-node tree-list target-tree-list">
</dl>
</li>
</ul>
</div>
</div>
<div class="layui-layer-btn">
<!-- <button class="step-btn ml-10 reset-btn">取消</button> -->
<button class="step-btn ml-10 pre-btn" lay-submit lay-filter="lay-step2-pre-submit">
上一步
</button>
<button class="step-btn ml-10 next-btn" lay-submit lay-filter="lay-step2-next-submit">
下一步
</button>
</div>
</div>
</div>
<div class="step-3 display-none">
<div class="layui-form dialog-form">
<div class="step3-form-item">
<span class="step3-label">同步设置方式 </span>
<div class="step3-chekbox-box layui-form-item">
<input type="checkbox" name="ways[quanliang]" lay-skin="primary" title="全量数据初始化">
<input type="checkbox" name="ways[zengliang]" lay-skin="primary" title="增量数据初始化" disabled="">
</div>
</div>
<div class="layui-layer-btn">
<button class="step-btn ml-10 pre-btn" lay-submit lay-filter="lay-step3-pre-submit">
上一步
</button>
<button class="step-btn ml-10 next-btn" lay-submit lay-filter="lay-step3-next-submit">
下一步
</button>
</div>
</div>
</div>
<div class="step-4 display-none">
<div class="dialog-form">
<div class="progress-box">
<div class="layui-progress">
<div class="layui-progress-bar" lay-percent="80%"></div>
</div>
<div><span>预检查通过80%</span></div>
</div>
<table id="listTable" lay-filter="listTable" lay-size="lg"></table>
<div class="step4-layer-btn">
<button class="step-btn ml-10 next-btn" lay-submit lay-filter="lay-step4-next-submit">
完成
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 创建数据源 编辑数据源 -->
<script type="text/html" id="formDialogTemplate">
<div class="layui-form dialog-form" lay-filter="dialogForm">
<div class="layui-form-item">
<div class="msg-box"><span class="msg-icon">!</span><span>注意:编辑表名或列名后,目标数据库的库的表名列名将为修改后的名称。</span></div>
</div>
<div class="layui-form-item header-box">
<label class="layui-form-label">数据库表名:</label>
<div class="layui-input-inline">
<input type="text" name="name" required lay-verify="required" placeholder="请填入数据源名称" autocomplete="off" class="layui-input">
<span class="mark-icon">?</span>
</div>
</div>
<div class="layui-form">
<table id="editTable" lay-filter="editTable" lay-size="lg"></table>
</div>
</div>
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-layer-btn layui-layer-btn-r">
<button class="layui-btn reset-btn" onclick="cancelDialog(this)">取消</button>
<button class="layui-btn layui-form-btn layui-btn-sm submit-btn" lay-event="getCheckData">确认</button>
</div>
</script>
@@include('./../../template/common/footer.html', {
"jslinks": ['./../../static/js/step/index.js']
})

@ -0,0 +1,28 @@
@@include('./../../template/common/header.html', {
"title": "tab页面",
csslinks:[]
})
<div class="layui-iframe">
@@include('./../../template/common/breadcrumb.html', {
"title": "tab页面",
subtitle:''
})
<div class="layui-fluid">
<div class="layui-card">
<div class=" layui-card layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
<ul class="layui-tab-title">
<li class="layui-this">TAB1</li>
<li>TAB2</li>
</ul>
<div class="layui-tab-content" style="height: 600px;">
<div class="layui-tab-item layui-show">内容不一样是要有因为你可以监听tab事件阅读下文档就是了</div>
<div class="layui-tab-item">内容2</div>
</div>
</div>
</div>
</div>
</div>
@@include('./../../template/common/footer.html', {
"jslinks": ['./../../static/js/tab/index.js']
})

@ -0,0 +1,99 @@
@@include('./../../template/common/header.html', {
"title": "table",
csslinks:[]
})
<div class="layui-iframe">
@@include('./../../template/common/breadcrumb.html', {
"title": "table页面",
subtitle:''
})
<div class="layui-fluid">
<div class="layui-card form-card">
<form class="layui-form form-box">
<label class="form-label">名称 :</label>
<input type="tel" name="text" autocomplete="off" class="form-input">
<label class="form-label">动态select数据 :</label>
<select name="fz" id="testIdSelect">
<option value="">请选择分组</option>
</select>
<div class="form-button-fixed">
<button type="submit" class="form-btn ml-10" lay-submit lay-filter="lay-form-submit">查询</button>
<button type="reset" class="form-btn ml-10 reset-btn">重置</button>
</div>
</form>
</div>
<div class="layui-card table-box" id="fulldiv">
<div class="layui-opr-block">
<span class="normal-btn add-dialog mr-10">创建</span>
<span class="normal-btn part-full-screen mr-10" data-screen="0">全屏</span>
<span class="normal-btn full-screen mr-10" data-screen="0">整页全屏</span>
</div>
<div class="layui-card-body">
<table id="listTable" lay-filter="listTable" lay-size="lg"></table>
<div id="pages"></div>
</div>
</div>
</div>
</div>
@@include('./../../template/common/celloperating.html')
<script type="text/html" id="formDialogTemplate">
<div class="layui-form dialog-form" lay-filter="dialogForm" >
<div class="layui-form-item">
<label class="layui-form-label">名称:</label>
<div class="layui-input-inline">
<input type="text" name="name" required lay-verify="required" placeholder="请填入名称" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">类型:</label>
<div class="layui-input-inline">
<select name="type" required lay-verify="required">
<option value="">请选择</option>
<option value="1">类型1</option>
<option value="2">类型2</option>
<option value="3">类型3</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">IP地址</label>
<div class="layui-input-inline">
<input type="text" name="ip" required lay-verify="required" placeholder="请填入IP地址" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">端口号:</label>
<div class="layui-input-inline">
<input type="text" name="port" required lay-verify="required" placeholder="请填入端口号" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">库名/Sid</label>
<div class="layui-input-inline">
<input type="text" name="sid" required lay-verify="required" placeholder="请填入库名/Sid" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">用户名:</label>
<div class="layui-input-inline">
<input type="text" name="username" required lay-verify="required" placeholder="请填入用户名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">密码:</label>
<div class="layui-input-inline">
<input type="password" name="password" required lay-verify="required" placeholder="请填入密码" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-layer-btn layui-hide">
<button class="layui-btn layui-form-btn layui-btn-sm submit-btn" id="LAY-dialog-submit" lay-submit lay-filter="lay-dialog-submit">
确认
</button>
</div>
</div>
</script>
@@include('./../../template/common/footer.html', {
"jslinks": ['./../../static/js/table/index.js']
})

@ -0,0 +1,24 @@
layui.define(function (exports) {
// 根据环境获取请求地址
var host = window.location.host;
var mockUrl = "/api/";
var bossUrl = '';
if (host.indexOf('127.0.0.1') > -1 || host.indexOf('localhost') > -1 || host.indexOf('192.168.') > -1) {// 本地环境
bossUrl = 'https://127.0.0.1/';
} else if (host.indexOf('-dev') > -1) {// 开发环境
bossUrl = 'https://admin-de.ppst.top/';
} else if (host.indexOf('-te') > -1) {// 测试环境
bossUrl = 'https://admin-te.ppst.top/';
} else {// 生产环境
bossUrl = 'https://admin.ppst.top/';
}
exports('api', {
getApiUrl: function (mapping, funcName) {
return bossUrl + mapping + '/' + funcName;
},
getMockApiUrl: function (mapping, funcName) {
return mockUrl + mapping + '/' + funcName;
}
});
});

@ -0,0 +1,59 @@
/**
定义layui模块 - 模板引擎 - 自定义模板
*/
layui.define(['index', 'laytpl', 'form'], function (exports) {
exports("chart", {
getUserInfo: "boss/pages/userInfo/index.html",
xAxis: {
axisLine: {
lineStyle: {
color: "#454b5026",
},
},
splitLine: {
show: true,
lineStyle: {
color: ["#454b5026"],
width: 1,
type: "solid",
},
},
},
yAxis: {
axisLine: {
lineStyle: {
color: "#454b5026",
},
},
splitLine: {
show: true,
lineStyle: {
color: ["#454b5026"],
width: 1,
type: "solid",
},
},
},
textStyle: {
color: "#a5aaaf",
},
series: {
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "#1289ff",
},
{
offset: 1,
color: "#1289ff4d",
},
]),
},
},
},
});
});

@ -0,0 +1,55 @@
layui.define(['laytpl', 'layer', 'element', 'util'], function (exports) {
exports('setter', {
container: 'LAY_app', //容器ID
base: layui.cache.base,//记录静态资源所在路径
views: layui.cache.base + 'tpl/',//动态模板所在目录
entry: 'index',//默认视图文件名
engine: '.html',//视图文件后缀名
pageTabs: true, //是否开启页面选项卡功能。iframe版推荐开启
name: 'layuiAdmin',
tableName: 'layuiAdmin',//本地存储表名
MOD_NAME: 'admin',//模块事件名
debug: true, //是否开启调试模式。如开启,接口异常时会抛出异常 URL 等信息
//自定义请求字段
request: {
// tokenName: '_openx_head' //自动携带 token 的字段名access_token。可设置 false 不携带。
},
//自定义响应字段
response: {
statusName: 'code', //数据状态的字段名称
statusCode: {
code: 1,//数据状态一切正常的状态码
logout: 1001 //登录状态失效的状态码
},
msgName: 'msg', //状态信息的字段名称
dataName: 'data' //数据详情的字段名称
},
//扩展的第三方模块
extend: [
'echarts', //echarts 核心包
'echartsTheme' //echarts 主题
], theme: {
color: [{
main: '#20222A',
selected: '#009688',
alias: 'default'
}]
}
});
});

@ -0,0 +1,96 @@
/**
定义弹窗模块 - 自定义弹窗
*/
layui.define(['index', 'tpl', 'qrcode'], function (exports) {
exports("dialog", {
setIframeDialog: function (
title = "",
data = { src: "", otherconfigStyle: "" },
iframeArea = { width: "820px", height: "500px" },
dialogArea = ["600px", "500px"]
) {
var laytpl = layui.laytpl;
var templet =
" <iframe " +
data.otherconfigStyle +
' width="' +
iframeArea.width +
'" height="' +
iframeArea.height +
'" src="' +
data.src +
'"></iframe>';
laytpl(templet).render({}, function (html) {
layer.open({
type: 1,
title: title,
content: templet,
area: dialogArea,
success: function () { },
error: function (e) {
console.warn("setIframeDialog error:", e);
},
});
});
},
setTextDialog: function (
title = "",
data = { text: "" },
dialogArea = ["600px", "500px"]
) {
var laytpl = layui.laytpl;
var templet = data.text;
laytpl(templet).render({}, function (html) {
layer.open({
type: 1,
title: title,
content: templet,
area: dialogArea,
success: function () { },
});
});
},
showOkMsgDialog({ msg, title = "提示", btnTitle = "好的", dialogArea = ["520px", "270px"] }) {
layer.confirm("",
{
title: title,
area: dialogArea,
content: `<div style="margin: 50px auto;">${msg}</div>`,
btnAlign: 'r',
skin: "msg-skin",
btn: [btnTitle]
}, function (index, layero) {
layer.close(index);
}
);
},
setQrCodeDialog({ id = "qrcode", title = "", data = { value: "" }, showQrcodeUrl = false, qrcodeArea = {
width: 400,
height: 400
}, dialogArea = ["700px", "500px"] }) {
var laytpl = layui.laytpl;
var qrcode = layui.qrcode;
var templet = ' <div id="' + id + '" class="qrcode"></div>';
if (showQrcodeUrl) {
templet += '<div class="show-qrcode-value"></div>';
}
laytpl(templet).render({}, function (html) {
layer.open({
type: 1,
title: title,
content: templet,
area: dialogArea,
success: function success() {
qrcode.qrcode(document.getElementById(id), qrcodeArea);
qrcode.makeCode(data.value);
if (showQrcodeUrl) {
layui.$('.show-qrcode-value').html(layui.$('.qrcode').attr('title'));
}
}
});
});
}
});
});

@ -0,0 +1,105 @@
layui.define(['index', 'api'], function (exports) {
var $ = layui.$, admin = layui.admin;
var obj = {
addTr: function (listTableCols) {
var html = ``;
for (var key in listTableCols) {
if (listTableCols.hasOwnProperty(key)) {
var element = listTableCols[key];
if (element.toolbar) {
html += `<td data-field="${element.field}" align="${element.align ? element.align : 'left'}" data-off="true" class="layui-table-col-special">
<div class="layui-table-cell">
<span class="cell-opr save-cell" lay-event="add" data-tips="新增" onmouseover="showToolTips(this)"></span>
<span class="cell-opr delete-cell" lay-event="cancel" data-tips="取消" onmouseover="showToolTips(this)"></span>
</div></td>`;
} else {
if (element.hide) {
html += ``;
} else {
html += `<td data-field="${element.field}" data-key="333-0-${key}" align="${element.align ? element.align : 'left'}" class="add-${element.field}">
<div class="layui-table-cell">
<input type="text" name="${element.field}" required lay-verify="required" data-tips="请填写${element.title}" value="" autocomplete="off" class="layui-input ${element.field}">
</div>
</td>`;
}
}
}
}
return html;
},
addFormFiled: function (listTableCols) {
var addField = {};
for (const key in listTableCols) {
if (listTableCols.hasOwnProperty(key)) {
const element = listTableCols[key];
if (!element.toolbar) {
if (element.hide) {
} else {
var id = $(`.layui-table .add-${element.field} .${element.field}`);
if (!$(id).val()) {
showToolTips($(id));
return false
}
addField[element.field] = $(id).val();
}
}
}
}
return addField;
},
editTr: function (listTableCols, data) {
var html = ``;
for (var key in listTableCols) {
if (listTableCols.hasOwnProperty(key)) {
var element = listTableCols[key];
if (element.toolbar) {
html += `<td data-field="${element.field}" align="${element.align ? element.align : 'left'}" data-off="true" class="layui-table-col-special">
<div class="layui-table-cell">
<span class="cell-opr save-cell" lay-event="save" data-tips="编辑" onmouseover="showToolTips(this)"></span>
<span class="cell-opr delete-cell" lay-event="cancel" data-tips="取消" onmouseover="showToolTips(this)"></span>
</div></td>`;
} else {
if (element.hide) {
html += `
<input type="text" name="${element.field}" data-key="222-0-${key}" class="display-none" required lay-verify="required" value="${data[element.field]}" class="edit-${element.field}">
`;
} else {
html += `<td data-field="${element.field}" data-key="222-0-${key}" align="${element.align ? element.align : 'left'}" class="edit-${element.field}">
<div class="layui-table-cell">
<input type="text" name="${element.field}" required lay-verify="required" data-tips="请填写${element.title}" value="${data[element.field]}" autocomplete="off" class="layui-input ${element.field}">
</div>
</td>`;
}
}
}
}
return html;
},
editFormFiled: function (listTableCols, data) {
var editField = {};
var id = data.id;
for (var key in listTableCols) {
if (listTableCols.hasOwnProperty(key)) {
var element = listTableCols[key];
if (!element.toolbar) {
if (element.hide) {
editField[element.field] = data[element.field];
} else {
var id = $(`.layui-table .edit-${element.field} .${element.field}`);
if (!$(id).val()) {
showToolTips($(id));
return false
}
editField[element.field] = $(id).val();
}
}
}
}
return editField;
}
}
exports('dynamicTr', obj);
});

@ -0,0 +1,836 @@
/**
@NamelayuiAdmin iframe版核心模块
@Author贤心
@Sitehttp://www.layui.com/admin/
@LicenseLPPL
*/
layui.define('view', function(exports){
var $ = layui.jquery
,laytpl = layui.laytpl
,element = layui.element
,setter = layui.setter
,view = layui.view
,device = layui.device()
,$win = $(window), $body = $('body')
,container = $('#'+ setter.container)
,SHOW = 'layui-show', HIDE = 'layui-hide', THIS = 'layui-this', DISABLED = 'layui-disabled', TEMP = 'template'
,APP_BODY = '#LAY_app_body', APP_FLEXIBLE = 'LAY_app_flexible'
,FILTER_TAB_TBAS = 'layadmin-layout-tabs'
,APP_SPREAD_SM = 'layadmin-side-spread-sm', TABS_BODY = 'layadmin-tabsbody-item'
,ICON_SHRINK = 'layui-icon-shrink-right', ICON_SPREAD = 'layui-icon-spread-left'
,SIDE_SHRINK = 'layadmin-side-shrink', SIDE_MENU = 'LAY-system-side-menu'
//通用方法
,admin = {
v: '1.2.1 std'
//数据的异步请求
,req: view.req
//清除本地 token并跳转到登入页
,exit: view.exit
//xss 转义
,escape: function(html){
return String(html || '').replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&amp;')
.replace(/</g, '&lt;').replace(/>/g, '&gt;')
.replace(/'/g, '&#39;').replace(/"/g, '&quot;');
}
//事件监听
,on: function(events, callback){
return layui.onevent.call(this, setter.MOD_NAME, events, callback);
}
//发送验证码
,sendAuthCode: function(options){
options = $.extend({
seconds: 60
,elemPhone: '#LAY_phone'
,elemVercode: '#LAY_vercode'
}, options);
var seconds = options.seconds
,btn = $(options.elem)
,token = null
,timer, countDown = function(loop){
seconds--;
if(seconds < 0){
btn.removeClass(DISABLED).html('获取验证码');
seconds = options.seconds;
clearInterval(timer);
} else {
btn.addClass(DISABLED).html(seconds + '秒后重获');
}
if(!loop){
timer = setInterval(function(){
countDown(true);
}, 1000);
}
};
options.elemPhone = $(options.elemPhone);
options.elemVercode = $(options.elemVercode);
btn.on('click', function(){
var elemPhone = options.elemPhone
,value = elemPhone.val();
if(seconds !== options.seconds || $(this).hasClass(DISABLED)) return;
if(!/^1\d{10}$/.test(value)){
elemPhone.focus();
return layer.msg('请输入正确的手机号')
};
if(typeof options.ajax === 'object'){
var success = options.ajax.success;
delete options.ajax.success;
}
admin.req($.extend(true, {
url: '/auth/code'
,type: 'get'
,data: {
phone: value
}
,success: function(res){
layer.msg('验证码已发送至你的手机,请注意查收', {
icon: 1
,shade: 0
});
options.elemVercode.focus();
countDown();
success && success(res);
}
}, options.ajax));
});
}
//屏幕类型
,screen: function(){
var width = $win.width()
if(width > 1200){
return 3; //大屏幕
} else if(width > 992){
return 2; //中屏幕
} else if(width > 768){
return 1; //小屏幕
} else {
return 0; //超小屏幕
}
}
//侧边伸缩
,sideFlexible: function(status){
var app = container
,iconElem = $('#'+ APP_FLEXIBLE)
,screen = admin.screen();
//设置状态PC默认展开、移动默认收缩
if(status === 'spread'){
//切换到展开状态的 icon箭头
iconElem.removeClass(ICON_SPREAD).addClass(ICON_SHRINK);
//移动从左到右位移PC清除多余选择器恢复默认
if(screen < 2){
app.addClass(APP_SPREAD_SM);
} else {
app.removeClass(APP_SPREAD_SM);
}
app.removeClass(SIDE_SHRINK)
} else {
//切换到搜索状态的 icon箭头
iconElem.removeClass(ICON_SHRINK).addClass(ICON_SPREAD);
//移动清除多余选择器恢复默认PC从右往左收缩
if(screen < 2){
app.removeClass(SIDE_SHRINK);
} else {
app.addClass(SIDE_SHRINK);
}
app.removeClass(APP_SPREAD_SM)
}
layui.event.call(this, setter.MOD_NAME, 'side({*})', {
status: status
});
}
//弹出面板
,popup: view.popup
//右侧面板
,popupRight: function(options){
//layer.close(admin.popup.index);
return admin.popup.index = layer.open($.extend({
type: 1
,id: 'LAY_adminPopupR'
,anim: -1
,title: false
,closeBtn: false
,offset: 'r'
,shade: 0.1
,shadeClose: true
,skin: 'layui-anim layui-anim-rl layui-layer-adminRight'
,area: '300px'
}, options));
}
//主题设置
,theme: function(options){
var theme = setter.theme
,local = layui.data(setter.tableName)
,id = 'LAY_layadmin_theme'
,style = document.createElement('style')
,styleText = laytpl([
//主题色
'.layui-side-menu,'
,'.layadmin-pagetabs .layui-tab-title li:after,'
,'.layadmin-pagetabs .layui-tab-title li.layui-this:after,'
,'.layui-layer-admin .layui-layer-title,'
,'.layadmin-side-shrink .layui-side-menu .layui-nav>.layui-nav-item>.layui-nav-child'
,'{background-color:{{d.color.main}} !important;}'
//选中色
,'.layui-nav-tree .layui-this,'
,'.layui-nav-tree .layui-this>a,'
,'.layui-nav-tree .layui-nav-child dd.layui-this,'
,'.layui-nav-tree .layui-nav-child dd.layui-this a'
,'{background-color:{{d.color.selected}} !important;}'
//logo
,'.layui-layout-admin .layui-logo{background-color:{{d.color.logo || d.color.main}} !important;}'
//头部色
,'{{# if(d.color.header){ }}'
,'.layui-layout-admin .layui-header{background-color:{{ d.color.header }};}'
,'.layui-layout-admin .layui-header a,'
,'.layui-layout-admin .layui-header a cite{color: #f8f8f8;}'
,'.layui-layout-admin .layui-header a:hover{color: #fff;}'
,'.layui-layout-admin .layui-header .layui-nav .layui-nav-more{border-top-color: #fbfbfb;}'
,'.layui-layout-admin .layui-header .layui-nav .layui-nav-mored{border-color: transparent; border-bottom-color: #fbfbfb;}'
,'.layui-layout-admin .layui-header .layui-nav .layui-this:after, .layui-layout-admin .layui-header .layui-nav-bar{background-color: #fff; background-color: rgba(255,255,255,.5);}'
,'.layadmin-pagetabs .layui-tab-title li:after{display: none;}'
,'{{# } }}'
].join('')).render(options = $.extend({}, local.theme, options))
,styleElem = document.getElementById(id);
//添加主题样式
if('styleSheet' in style){
style.setAttribute('type', 'text/css');
style.styleSheet.cssText = styleText;
} else {
style.innerHTML = styleText;
}
style.id = id;
styleElem && $body[0].removeChild(styleElem);
$body[0].appendChild(style);
$body.attr('layadmin-themealias', options.color.alias);
//本地存储记录
local.theme = local.theme || {};
layui.each(options, function(key, value){
local.theme[key] = value;
});
layui.data(setter.tableName, {
key: 'theme'
,value: local.theme
});
}
//初始化主题
,initTheme: function(index){
var theme = setter.theme;
index = index || 0;
if(theme.color[index]){
theme.color[index].index = index;
admin.theme({
color: theme.color[index]
});
}
}
//记录最近一次点击的页面标签数据
,tabsPage: {}
//获取页面标签主体元素
,tabsBody: function(index){
return $(APP_BODY).find('.'+ TABS_BODY).eq(index || 0);
}
//切换页面标签主体
,tabsBodyChange: function(index, options){
options = options || {};
admin.tabsBody(index).addClass(SHOW).siblings().removeClass(SHOW);
events.rollPage('auto', index);
//执行 {setter.MOD_NAME}.tabsPage 下的事件
layui.event.call(this, setter.MOD_NAME, 'tabsPage({*})', {
url: options.url
,text: options.text
});
}
//resize事件管理
,resize: function(fn){
var router = layui.router()
,key = router.path.join('-');
if(admin.resizeFn[key]){
$win.off('resize', admin.resizeFn[key]);
delete admin.resizeFn[key];
}
if(fn === 'off') return; //如果是清除 resize 事件,则终止往下执行
fn(), admin.resizeFn[key] = fn;
$win.on('resize', admin.resizeFn[key]);
}
,resizeFn: {}
,runResize: function(){
var router = layui.router()
,key = router.path.join('-');
admin.resizeFn[key] && admin.resizeFn[key]();
}
,delResize: function(){
this.resize('off');
}
//关闭当前 pageTabs
,closeThisTabs: function(){
if(!admin.tabsPage.index) return;
$(TABS_HEADER).eq(admin.tabsPage.index).find('.layui-tab-close').trigger('click');
}
//全屏
,fullScreen: function(){
var ele = document.documentElement
,reqFullScreen = ele.requestFullScreen || ele.webkitRequestFullScreen
|| ele.mozRequestFullScreen || ele.msRequestFullscreen;
if(typeof reqFullScreen !== 'undefined' && reqFullScreen) {
reqFullScreen.call(ele);
};
}
//退出全屏
,exitScreen: function(){
var ele = document.documentElement
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
}
//……
};
//事件
var events = admin.events = {
//伸缩
flexible: function(othis){
var iconElem = othis.find('#'+ APP_FLEXIBLE)
,isSpread = iconElem.hasClass(ICON_SPREAD);
admin.sideFlexible(isSpread ? 'spread' : null);
}
//刷新
,refresh: function(){
var ELEM_IFRAME = '.layadmin-iframe'
,length = $('.'+ TABS_BODY).length;
if(admin.tabsPage.index >= length){
admin.tabsPage.index = length - 1;
}
var iframe = admin.tabsBody(admin.tabsPage.index).find(ELEM_IFRAME);
iframe[0].contentWindow.location.reload(true);
}
//输入框搜索
,serach: function(othis){
othis.off('keypress').on('keypress',function(e){
if(!this.value.replace(/\s/g, '')) return;
//回车跳转
if(e.keyCode === 13){
var href = othis.attr('lay-action')
,text = othis.attr('lay-text') || '搜索';
href = href + this.value;
text = text + ' <span style="color: #FF5722;">'+ admin.escape(this.value) +'</span>';
//打开标签页
layui.index.openTabsPage(href, text);
//如果搜索关键词已经打开,则刷新页面即可
events.serach.keys || (events.serach.keys = {});
events.serach.keys[admin.tabsPage.index] = this.value;
if(this.value === events.serach.keys[admin.tabsPage.index]){
events.refresh(othis);
}
//清空输入框
this.value = '';
}
});
}
//点击消息
,message: function(othis){
othis.find('.layui-badge-dot').remove();
}
//弹出主题面板
,theme: function(){
admin.popupRight({
id: 'LAY_adminPopupTheme'
,success: function(){
view(this.id).render('system/theme')
}
});
}
//便签
,note: function(othis){
var mobile = admin.screen() < 2
,note = layui.data(setter.tableName).note;
events.note.index = admin.popup({
title: '便签'
,shade: 0
,offset: [
'41px'
,(mobile ? null : (othis.offset().left - 250) + 'px')
]
,anim: -1
,id: 'LAY_adminNote'
,skin: 'layadmin-note layui-anim layui-anim-upbit'
,content: '<textarea placeholder="内容"></textarea>'
,resize: false
,success: function(layero, index){
var textarea = layero.find('textarea')
,value = note === undefined ? '便签中的内容会存储在本地,这样即便你关掉了浏览器,在下次打开时,依然会读取到上一次的记录。是个非常小巧实用的本地备忘录' : note;
textarea.val(value).focus().on('keyup', function(){
layui.data(setter.tableName, {
key: 'note'
,value: this.value
});
});
}
})
}
//全屏
,fullscreen: function(othis){
var SCREEN_FULL = 'layui-icon-screen-full'
,SCREEN_REST = 'layui-icon-screen-restore'
,iconElem = othis.children("i");
if(iconElem.hasClass(SCREEN_FULL)){
admin.fullScreen();
iconElem.addClass(SCREEN_REST).removeClass(SCREEN_FULL);
} else {
admin.exitScreen();
iconElem.addClass(SCREEN_FULL).removeClass(SCREEN_REST);
}
}
//弹出关于面板
,about: function(){
admin.popupRight({
id: 'LAY_adminPopupAbout'
,success: function(){
view(this.id).render('system/about');
}
});
}
//弹出更多面板
,more: function(){
admin.popupRight({
id: 'LAY_adminPopupMore'
,success: function(){
view(this.id).render('system/more');
}
});
}
//返回上一页
,back: function(){
history.back();
}
//主题设置
,setTheme: function(othis){
var index = othis.data('index')
,nextIndex = othis.siblings('.layui-this').data('index');
if(othis.hasClass(THIS)) return;
othis.addClass(THIS).siblings('.layui-this').removeClass(THIS);
admin.initTheme(index);
}
//左右滚动页面标签
,rollPage: function(type, index){
var tabsHeader = $('#LAY_app_tabsheader')
,liItem = tabsHeader.children('li')
,scrollWidth = tabsHeader.prop('scrollWidth')
,outerWidth = tabsHeader.outerWidth()
,tabsLeft = parseFloat(tabsHeader.css('left'));
//右左往右
if(type === 'left'){
if(!tabsLeft && tabsLeft <=0) return;
//当前的left减去可视宽度用于与上一轮的页标比较
var prefLeft = -tabsLeft - outerWidth;
liItem.each(function(index, item){
var li = $(item)
,left = li.position().left;
if(left >= prefLeft){
tabsHeader.css('left', -left);
return false;
}
});
} else if(type === 'auto'){ //自动滚动
(function(){
var thisLi = liItem.eq(index), thisLeft;
if(!thisLi[0]) return;
thisLeft = thisLi.position().left;
//当目标标签在可视区域左侧时
if(thisLeft < -tabsLeft){
return tabsHeader.css('left', -thisLeft);
}
//当目标标签在可视区域右侧时
if(thisLeft + thisLi.outerWidth() >= outerWidth - tabsLeft){
var subLeft = thisLeft + thisLi.outerWidth() - (outerWidth - tabsLeft);
liItem.each(function(i, item){
var li = $(item)
,left = li.position().left;
//从当前可视区域的最左第二个节点遍历,如果减去最左节点的差 > 目标在右侧不可见的宽度,则将该节点放置可视区域最左
if(left + tabsLeft > 0){
if(left - tabsLeft > subLeft){
tabsHeader.css('left', -left);
return false;
}
}
});
}
}());
} else {
//默认向左滚动
liItem.each(function(i, item){
var li = $(item)
,left = li.position().left;
if(left + li.outerWidth() >= outerWidth - tabsLeft){
tabsHeader.css('left', -left);
return false;
}
});
}
}
//向右滚动页面标签
,leftPage: function(){
events.rollPage('left');
}
//向左滚动页面标签
,rightPage: function(){
events.rollPage();
}
//关闭当前标签页
,closeThisTabs: function(){
var topAdmin = parent === self ? admin : parent.layui.admin;
topAdmin.closeThisTabs();
}
//关闭其它标签页
,closeOtherTabs: function(type){
var TABS_REMOVE = 'LAY-system-pagetabs-remove';
if(type === 'all'){
$(TABS_HEADER+ ':gt(0)').remove();
$(APP_BODY).find('.'+ TABS_BODY+ ':gt(0)').remove();
$(TABS_HEADER).eq(0).trigger('click');
} else {
$(TABS_HEADER).each(function(index, item){
if(index && index != admin.tabsPage.index){
$(item).addClass(TABS_REMOVE);
admin.tabsBody(index).addClass(TABS_REMOVE);
}
});
$('.'+ TABS_REMOVE).remove();
}
}
//关闭全部标签页
,closeAllTabs: function(){
events.closeOtherTabs('all');
//location.hash = '';
}
//遮罩
,shade: function(){
admin.sideFlexible();
}
//呼出IM 示例
,im: function(){
admin.popup({
id: 'LAY-popup-layim-demo' //定义唯一ID防止重复弹出
,shade: 0
,area: ['800px', '300px']
,title: '面板外的操作示例'
,offset: 'lb'
,success: function(){
//将 views 目录下的某视图文件内容渲染给该面板
layui.view(this.id).render('layim/demo').then(function(){
layui.use('im');
});
}
})
}
};
//初始
!function(){
//主题初始化,本地主题记录优先,其次为 initColorIndex
var local = layui.data(setter.tableName);
if(local.theme){
admin.theme(local.theme);
} else if(setter.theme){
admin.initTheme(setter.theme.initColorIndex);
}
//常规版默认开启多标签页
if(!('pageTabs' in layui.setter)) layui.setter.pageTabs = true;
//不开启页面标签时
if(!setter.pageTabs){
$('#LAY_app_tabs').addClass(HIDE);
container.addClass('layadmin-tabspage-none');
}
//低版本IE提示
if(device.ie && device.ie < 10){
view.error('IE'+ device.ie + '下访问可能不佳推荐使用Chrome / Firefox / Edge 等高级浏览器', {
offset: 'auto'
,id: 'LAY_errorIE'
});
}
}();
//admin.prevRouter = {}; //上一个路由
//监听 tab 组件切换,同步 index
element.on('tab('+ FILTER_TAB_TBAS +')', function(data){
admin.tabsPage.index = data.index;
});
//监听选项卡切换,改变菜单状态
admin.on('tabsPage(setMenustatus)', function(router){
var pathURL = router.url, getData = function(item){
return {
list: item.children('.layui-nav-child')
,a: item.children('*[lay-href]')
}
}
,sideMenu = $('#'+ SIDE_MENU)
,SIDE_NAV_ITEMD = 'layui-nav-itemed'
//捕获对应菜单
,matchMenu = function(list){
list.each(function(index1, item1){
var othis1 = $(item1)
,data1 = getData(othis1)
,listChildren1 = data1.list.children('dd')
,matched1 = pathURL === data1.a.attr('lay-href');
listChildren1.each(function(index2, item2){
var othis2 = $(item2)
,data2 = getData(othis2)
,listChildren2 = data2.list.children('dd')
,matched2 = pathURL === data2.a.attr('lay-href');
listChildren2.each(function(index3, item3){
var othis3 = $(item3)
,data3 = getData(othis3)
,matched3 = pathURL === data3.a.attr('lay-href');
if(matched3){
var selected = data3.list[0] ? SIDE_NAV_ITEMD : THIS;
othis3.addClass(selected).siblings().removeClass(selected); //标记选择器
return false;
}
});
if(matched2){
var selected = data2.list[0] ? SIDE_NAV_ITEMD : THIS;
othis2.addClass(selected).siblings().removeClass(selected); //标记选择器
return false
}
});
if(matched1){
var selected = data1.list[0] ? SIDE_NAV_ITEMD : THIS;
othis1.addClass(selected).siblings().removeClass(selected); //标记选择器
return false;
}
});
}
//重置状态
sideMenu.find('.'+ THIS).removeClass(THIS);
//移动端点击菜单时自动收缩
if(admin.screen() < 2) admin.sideFlexible();
//开始捕获
matchMenu(sideMenu.children('li'));
});
//监听侧边导航点击事件
element.on('nav(layadmin-system-side-menu)', function(elem){
if(elem.siblings('.layui-nav-child')[0] && container.hasClass(SIDE_SHRINK)){
admin.sideFlexible('spread');
layer.close(elem.data('index'));
};
admin.tabsPage.type = 'nav';
});
//监听选项卡的更多操作
element.on('nav(layadmin-pagetabs-nav)', function(elem){
var dd = elem.parent();
dd.removeClass(THIS);
dd.parent().removeClass(SHOW);
});
//同步路由
var setThisRouter = function(othis){
var layid = othis.attr('lay-id')
,attr = othis.attr('lay-attr')
,index = othis.index();
admin.tabsBodyChange(index, {
url: attr
});
//location.hash = layid === setter.entry ? '/' : attr;
}
,TABS_HEADER = '#LAY_app_tabsheader>li';
//标签页标题点击
$body.on('click', TABS_HEADER, function(){
var othis = $(this)
,index = othis.index();
admin.tabsPage.type = 'tab';
admin.tabsPage.index = index;
setThisRouter(othis);
});
//监听 tabspage 删除
element.on('tabDelete('+ FILTER_TAB_TBAS +')', function(obj){
var othis = $(TABS_HEADER+ '.layui-this');
obj.index && admin.tabsBody(obj.index).remove();
setThisRouter(othis);
//移除resize事件
admin.delResize();
});
//页面跳转
$body.on('click', '*[lay-href]', function(){
var othis = $(this)
,href = othis.attr('lay-href')
,text = othis.attr('lay-text')
,router = layui.router();
admin.tabsPage.elem = othis;
//admin.prevRouter[router.path[0]] = router.href; //记录上一次各菜单的路由信息
//执行跳转
var topLayui = parent === self ? layui : top.layui;
topLayui.index.openTabsPage(href, text || othis.text());
});
//点击事件
$body.on('click', '*[layadmin-event]', function(){
var othis = $(this)
,attrEvent = othis.attr('layadmin-event');
events[attrEvent] && events[attrEvent].call(this, othis);
});
//tips
$body.on('mouseenter', '*[lay-tips]', function(){
var othis = $(this);
if(othis.parent().hasClass('layui-nav-item') && !container.hasClass(SIDE_SHRINK)) return;
var tips = othis.attr('lay-tips')
,offset = othis.attr('lay-offset')
,direction = othis.attr('lay-direction')
,index = layer.tips(tips, this, {
tips: direction || 1
,time: -1
,success: function(layero, index){
if(offset){
layero.css('margin-left', offset + 'px');
}
}
});
othis.data('index', index);
}).on('mouseleave', '*[lay-tips]', function(){
layer.close($(this).data('index'));
});
//窗口resize事件
var resizeSystem = layui.data.resizeSystem = function(){
//layer.close(events.note.index);
layer.closeAll('tips');
if(!resizeSystem.lock){
setTimeout(function(){
admin.sideFlexible(admin.screen() < 2 ? '' : 'spread');
delete resizeSystem.lock;
}, 100);
}
resizeSystem.lock = true;
}
$win.on('resize', layui.data.resizeSystem);
//接口输出
exports('admin', admin);
});

@ -0,0 +1,52 @@
/**
@NamelayuiAdmin iframe版主入口
@Author贤心
@Sitehttp://www.layui.com/admin/
@LicenseLPPL
*/
layui.extend({
setter: 'config' //配置模块
,
admin: 'lib/admin' //核心模块
,
view: 'lib/view' //视图渲染模块
}).define(['setter', 'admin', 'table'], function (exports) {
var setter = layui.setter,
element = layui.element,
admin = layui.admin,
tabsPage = admin.tabsPage,
view = layui.view
//打开标签页
, APP_BODY = '#LAY_app_body', FILTER_TAB_TBAS = 'layadmin-layout-tabs', $ = layui.$, $win = $(window);
//初始
if (admin.screen() < 2) admin.sideFlexible();
//将模块根路径设置为 controller 目录
layui.config({
base: '../../res/js/'
});
//扩展 lib 目录下的其它模块
/* layui.each(setter.extend, function(index, item){
alert(item)
var mods = {};
mods[item] = '{/}' + 'lib/extend/' + item;
layui.extend(mods);
});*/
view().autoRender();
layui.table.set({ contentType: 'application/json', page: {}, loading: true })
// page: {theme: '#1E9FFF'},
//加载公共模块
// layui.use('common');
//对外输出
exports('index', {
});
});

@ -0,0 +1,389 @@
/**
@NamelayuiAdmin 视图模块
@Author贤心
@Sitehttp://www.layui.com/admin/
@LicenseLPPL
*/
layui.define(['laytpl', 'layer'], function (exports) {
var $ = layui.jquery
, laytpl = layui.laytpl
, layer = layui.layer
, setter = layui.setter
, device = layui.device()
, hint = layui.hint()
//对外接口
, view = function (id) {
return new Class(id);
}
, SHOW = 'layui-show', LAY_BODY = 'LAY_app_body'
//构造器
, Class = function (id) {
this.id = id;
this.container = $('#' + (id || LAY_BODY));
};
//加载中
view.loading = function (elem) {
elem.append(
this.elemLoad = $('<i class="layui-anim layui-anim-rotate layui-anim-loop layui-icon layui-icon-loading layadmin-loading"></i>')
);
};
//移除加载
view.removeLoad = function () {
this.elemLoad && this.elemLoad.remove();
};
//清除 token并跳转到登入页
view.exit = function (callback) {
//清空本地记录的 token
layui.data(setter.tableName, {
key: setter.request.tokenName
, remove: true
});
//跳转到登入页
//location.hash = '/user/login';
callback && callback();
};
//Ajax请求
view.req = function (options) {
var that = this
, success = options.success
, error = options.error
, request = setter.request
, response = setter.response
, debug = function () {
return setter.debug
? '<br><cite>URL</cite>' + options.url
: '';
};
options.data = options.data || {};
options.headers = options.headers || {};
if (request.tokenName) {
var sendData = typeof options.data === 'string'? JSON.parse(options.data): options.data;
var ssoToken = JSON.parse(localStorage.getItem(request.tokenName))
if (ssoToken) {
options.data[request.tokenName] = ssoToken
} else {
options.data[request.tokenName] = {}
}
//自动给参数传入默认 _openx_head
// options.data[request.tokenName] = request.tokenName in sendData ? options.data[request.tokenName] : (ssoToken || {});
//自动给 Request Headers 传入 token
// options.headers[request.tokenName] = request.tokenName in options.headers ? options.headers[request.tokenName] : (ssoToken || '');
}
options.contentType = options.contentType || 'application/json; charset=UTF-8';
options.data = options.contentType.indexOf("application/json") == 0 ? JSON.stringify(options.data) : options.data;
delete options.success;
delete options.error;
return $.ajax($.extend({
type: 'post',
dataType: 'json',
beforeSend: function () {
layer.load(1);
},
success: function (res) {
var statusCode = response.statusCode;
//只有 response 的 code 一切正常才执行 done
if (res&&res[response.statusName] == statusCode.ok) {
typeof options.done === 'function' && options.done(res);
}
//登录状态失效,清除本地 access_token并强制跳转到登入页
else if (res&&res[response.statusName] == statusCode.logout) {
view.exit();
}
//其它异常
/* else {
var error = [
'<cite>Error</cite> ' + (res[response.msgName] || '返回状态码异常')
,debug()
].join('');
view.error(error);
}*/
try {
layer.closeAll('loading')
parent.layer.closeAll('loading')
} catch (e) {
console.log(e)
}
//只要 http 状态码正常,无论 response 的 code 是否正常都执行 success
typeof success === 'function' && success(res);
}
, error: function (e, code) {
/* var tips = [
'请求异常,请重试<br><cite>错误信息:</cite>'+ code
,debug()
].join('');
view.error(tips);*/
try {
layer.closeAll('loading')
parent.layer.closeAll('loading')
} catch (e) {
console.log(e)
}
var errorJSON = e.responseJSON || null;
var tips = errorJSON.message ? errorJSON.message : "系统错误,请联系管理员"
if (!errorJSON.code && tips.indexOf('Exception') != -1) {
tips = "系统错误,请联系管理员";
}
layer.msg(tips)
typeof error === 'function' && error(e);
},
}, options));
};
//弹窗
view.popup = function (options) {
var success = options.success
, skin = options.skin;
delete options.success;
delete options.skin;
return layer.open($.extend({
type: 1
, title: '提示'
, content: ''
, id: 'LAY-system-view-popup'
, skin: 'layui-layer-admin' + (skin ? ' ' + skin : '')
, shadeClose: true
, closeBtn: false
, success: function (layero, index) {
var elemClose = $('<i class="layui-icon" close>&#x1006;</i>');
layero.append(elemClose);
elemClose.on('click', function () {
layer.close(index);
});
typeof success === 'function' && success.apply(this, arguments);
}
}, options))
};
//异常提示
view.error = function (content, options) {
return view.popup($.extend({
content: content
, maxWidth: 300
//,shade: 0.01
, offset: 't'
, anim: 6
, id: 'LAY_adminError'
}, options))
};
//请求模板文件渲染
Class.prototype.render = function (views, params) {
var that = this, router = layui.router();
views = setter.views + views + setter.engine;
$('#' + LAY_BODY).children('.layadmin-loading').remove();
view.loading(that.container); //loading
//请求模板
$.ajax({
url: views
, type: 'get'
, dataType: 'html'
, data: {
v: layui.cache.version
}
, success: function (html) {
html = '<div>' + html + '</div>';
var elemTitle = $(html).find('title')
, title = elemTitle.text() || (html.match(/\<title\>([\s\S]*)\<\/title>/) || [])[1];
var res = {
title: title
, body: html
};
elemTitle.remove();
that.params = params || {}; //获取参数
if (that.then) {
that.then(res);
delete that.then;
}
that.parse(html);
view.removeLoad();
if (that.done) {
that.done(res);
delete that.done;
}
}
, error: function (e) {
view.removeLoad();
if (that.render.isError) {
return view.error('请求视图文件异常,状态:' + e.status);
}
;
if (e.status === 404) {
that.render('template/tips/404');
} else {
that.render('template/tips/error');
}
that.render.isError = true;
}
});
return that;
};
//解析模板
Class.prototype.parse = function (html, refresh, callback) {
var that = this
, isScriptTpl = typeof html === 'object' //是否模板元素
, elem = isScriptTpl ? html : $(html)
, elemTemp = isScriptTpl ? html : elem.find('*[template]')
, fn = function (options) {
var tpl = laytpl(options.dataElem.html())
, res = $.extend({
params: router.params
}, options.res);
options.dataElem.after(tpl.render(res));
typeof callback === 'function' && callback();
try {
options.done && new Function('d', options.done)(res);
} catch (e) {
console.error(options.dataElem[0], '\n存在错误回调脚本\n\n', e)
}
}
, router = layui.router();
elem.find('title').remove();
that.container[refresh ? 'after' : 'html'](elem.children());
router.params = that.params || {};
//遍历模板区块
for (var i = elemTemp.length; i > 0; i--) {
(function () {
var dataElem = elemTemp.eq(i - 1)
, layDone = dataElem.attr('lay-done') || dataElem.attr('lay-then') //获取回调
, url = laytpl(dataElem.attr('lay-url') || '').render(router) //接口 url
, data = laytpl(dataElem.attr('lay-data') || '').render(router) //接口参数
, headers = laytpl(dataElem.attr('lay-headers') || '').render(router); //接口请求的头信息
try {
data = new Function('return ' + data + ';')();
} catch (e) {
hint.error('lay-data: ' + e.message);
data = {};
}
;
try {
headers = new Function('return ' + headers + ';')();
} catch (e) {
hint.error('lay-headers: ' + e.message);
headers = headers || {}
}
;
if (url) {
view.req({
type: dataElem.attr('lay-type') || 'get'
, url: url
, data: data
, dataType: 'json'
, headers: headers
, success: function (res) {
fn({
dataElem: dataElem
, res: res
, done: layDone
});
}
});
} else {
fn({
dataElem: dataElem
, done: layDone
});
}
}());
}
return that;
};
//自动渲染数据模板
Class.prototype.autoRender = function (id, callback) {
var that = this;
$(id || 'body').find('*[template]').each(function (index, item) {
var othis = $(this);
that.container = othis;
that.parse(othis, 'refresh');
});
};
//直接渲染字符
Class.prototype.send = function (views, data) {
var tpl = laytpl(views || this.container.html()).render(data || {});
this.container.html(tpl);
return this;
};
//局部刷新模板
Class.prototype.refresh = function (callback) {
var that = this
, next = that.container.next()
, templateid = next.attr('lay-templateid');
if (that.id != templateid) return that;
that.parse(that.container, 'refresh', function () {
that.container.siblings('[lay-templateid="' + that.id + '"]:last').remove();
typeof callback === 'function' && callback();
});
return that;
};
//视图请求成功后的回调1
Class.prototype.then = function (callback) {
this.then = callback;
return this;
};
//视图渲染完毕后的回调
Class.prototype.done = function (callback) {
this.done = callback;
return this;
};
//对外接口
exports('view', view);
});

@ -0,0 +1,698 @@
layui.define(function (exports) {
var QRCode = function () {
this.v = '0.1.beta';
};
(function () {
//---------------------------------------------------------------------
// QRCode for JavaScript
//
// Copyright (c) 2009 Kazuhiko Arase
//
// URL: http://www.d-project.com/
//
// Licensed under the MIT license:
// http://www.opensource.org/licenses/mit-license.php
//
// The word "QR Code" is registered trademark of
// DENSO WAVE INCORPORATED
// http://www.denso-wave.com/qrcode/faqpatent-e.html
//
//---------------------------------------------------------------------
function QR8bitByte(data) {
this.mode = QRMode.MODE_8BIT_BYTE;
this.data = data;
this.parsedData = [];
// Added to support UTF-8 Characters
for (var i = 0, l = this.data.length; i < l; i++) {
var byteArray = [];
var code = this.data.charCodeAt(i);
if (code > 0x10000) {
byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18);
byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12);
byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6);
byteArray[3] = 0x80 | (code & 0x3F);
} else if (code > 0x800) {
byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12);
byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6);
byteArray[2] = 0x80 | (code & 0x3F);
} else if (code > 0x80) {
byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6);
byteArray[1] = 0x80 | (code & 0x3F);
} else {
byteArray[0] = code;
}
this.parsedData.push(byteArray);
}
this.parsedData = Array.prototype.concat.apply([], this.parsedData);
if (this.parsedData.length != this.data.length) {
this.parsedData.unshift(191);
this.parsedData.unshift(187);
this.parsedData.unshift(239);
}
}
QR8bitByte.prototype = {
getLength: function (buffer) {
return this.parsedData.length;
},
write: function (buffer) {
for (var i = 0, l = this.parsedData.length; i < l; i++) {
buffer.put(this.parsedData[i], 8);
}
}
};
function QRCodeModel(typeNumber, errorCorrectLevel) {
this.typeNumber = typeNumber;
this.errorCorrectLevel = errorCorrectLevel;
this.modules = null;
this.moduleCount = 0;
this.dataCache = null;
this.dataList = [];
}
QRCodeModel.prototype = {
addData: function (data) { var newData = new QR8bitByte(data); this.dataList.push(newData); this.dataCache = null; }, isDark: function (row, col) {
if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) { throw new Error(row + "," + col); }
return this.modules[row][col];
}, getModuleCount: function () { return this.moduleCount; }, make: function () { this.makeImpl(false, this.getBestMaskPattern()); }, makeImpl: function (test, maskPattern) {
this.moduleCount = this.typeNumber * 4 + 17; this.modules = new Array(this.moduleCount); for (var row = 0; row < this.moduleCount; row++) { this.modules[row] = new Array(this.moduleCount); for (var col = 0; col < this.moduleCount; col++) { this.modules[row][col] = null; } }
this.setupPositionProbePattern(0, 0); this.setupPositionProbePattern(this.moduleCount - 7, 0); this.setupPositionProbePattern(0, this.moduleCount - 7); this.setupPositionAdjustPattern(); this.setupTimingPattern(); this.setupTypeInfo(test, maskPattern); if (this.typeNumber >= 7) { this.setupTypeNumber(test); }
if (this.dataCache == null) { this.dataCache = QRCodeModel.createData(this.typeNumber, this.errorCorrectLevel, this.dataList); }
this.mapData(this.dataCache, maskPattern);
}, setupPositionProbePattern: function (row, col) { for (var r = -1; r <= 7; r++) { if (row + r <= -1 || this.moduleCount <= row + r) continue; for (var c = -1; c <= 7; c++) { if (col + c <= -1 || this.moduleCount <= col + c) continue; if ((0 <= r && r <= 6 && (c == 0 || c == 6)) || (0 <= c && c <= 6 && (r == 0 || r == 6)) || (2 <= r && r <= 4 && 2 <= c && c <= 4)) { this.modules[row + r][col + c] = true; } else { this.modules[row + r][col + c] = false; } } } }, getBestMaskPattern: function () {
var minLostPoint = 0; var pattern = 0; for (var i = 0; i < 8; i++) { this.makeImpl(true, i); var lostPoint = QRUtil.getLostPoint(this); if (i == 0 || minLostPoint > lostPoint) { minLostPoint = lostPoint; pattern = i; } }
return pattern;
}, createMovieClip: function (target_mc, instance_name, depth) {
var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth); var cs = 1; this.make(); for (var row = 0; row < this.modules.length; row++) { var y = row * cs; for (var col = 0; col < this.modules[row].length; col++) { var x = col * cs; var dark = this.modules[row][col]; if (dark) { qr_mc.beginFill(0, 100); qr_mc.moveTo(x, y); qr_mc.lineTo(x + cs, y); qr_mc.lineTo(x + cs, y + cs); qr_mc.lineTo(x, y + cs); qr_mc.endFill(); } } }
return qr_mc;
}, setupTimingPattern: function () {
for (var r = 8; r < this.moduleCount - 8; r++) {
if (this.modules[r][6] != null) { continue; }
this.modules[r][6] = (r % 2 == 0);
}
for (var c = 8; c < this.moduleCount - 8; c++) {
if (this.modules[6][c] != null) { continue; }
this.modules[6][c] = (c % 2 == 0);
}
}, setupPositionAdjustPattern: function () {
var pos = QRUtil.getPatternPosition(this.typeNumber); for (var i = 0; i < pos.length; i++) {
for (var j = 0; j < pos.length; j++) {
var row = pos[i]; var col = pos[j]; if (this.modules[row][col] != null) { continue; }
for (var r = -2; r <= 2; r++) { for (var c = -2; c <= 2; c++) { if (r == -2 || r == 2 || c == -2 || c == 2 || (r == 0 && c == 0)) { this.modules[row + r][col + c] = true; } else { this.modules[row + r][col + c] = false; } } }
}
}
}, setupTypeNumber: function (test) {
var bits = QRUtil.getBCHTypeNumber(this.typeNumber); for (var i = 0; i < 18; i++) { var mod = (!test && ((bits >> i) & 1) == 1); this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod; }
for (var i = 0; i < 18; i++) { var mod = (!test && ((bits >> i) & 1) == 1); this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod; }
}, setupTypeInfo: function (test, maskPattern) {
var data = (this.errorCorrectLevel << 3) | maskPattern; var bits = QRUtil.getBCHTypeInfo(data); for (var i = 0; i < 15; i++) { var mod = (!test && ((bits >> i) & 1) == 1); if (i < 6) { this.modules[i][8] = mod; } else if (i < 8) { this.modules[i + 1][8] = mod; } else { this.modules[this.moduleCount - 15 + i][8] = mod; } }
for (var i = 0; i < 15; i++) { var mod = (!test && ((bits >> i) & 1) == 1); if (i < 8) { this.modules[8][this.moduleCount - i - 1] = mod; } else if (i < 9) { this.modules[8][15 - i - 1 + 1] = mod; } else { this.modules[8][15 - i - 1] = mod; } }
this.modules[this.moduleCount - 8][8] = (!test);
}, mapData: function (data, maskPattern) {
var inc = -1; var row = this.moduleCount - 1; var bitIndex = 7; var byteIndex = 0; for (var col = this.moduleCount - 1; col > 0; col -= 2) {
if (col == 6) col--; while (true) {
for (var c = 0; c < 2; c++) {
if (this.modules[row][col - c] == null) {
var dark = false; if (byteIndex < data.length) { dark = (((data[byteIndex] >>> bitIndex) & 1) == 1); }
var mask = QRUtil.getMask(maskPattern, row, col - c); if (mask) { dark = !dark; }
this.modules[row][col - c] = dark; bitIndex--; if (bitIndex == -1) { byteIndex++; bitIndex = 7; }
}
}
row += inc; if (row < 0 || this.moduleCount <= row) { row -= inc; inc = -inc; break; }
}
}
}
}; QRCodeModel.PAD0 = 0xEC; QRCodeModel.PAD1 = 0x11; QRCodeModel.createData = function (typeNumber, errorCorrectLevel, dataList) {
var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel); var buffer = new QRBitBuffer(); for (var i = 0; i < dataList.length; i++) { var data = dataList[i]; buffer.put(data.mode, 4); buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber)); data.write(buffer); }
var totalDataCount = 0; for (var i = 0; i < rsBlocks.length; i++) { totalDataCount += rsBlocks[i].dataCount; }
if (buffer.getLengthInBits() > totalDataCount * 8) {
throw new Error("code length overflow. ("
+ buffer.getLengthInBits()
+ ">"
+ totalDataCount * 8
+ ")");
}
if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) { buffer.put(0, 4); }
while (buffer.getLengthInBits() % 8 != 0) { buffer.putBit(false); }
while (true) {
if (buffer.getLengthInBits() >= totalDataCount * 8) { break; }
buffer.put(QRCodeModel.PAD0, 8); if (buffer.getLengthInBits() >= totalDataCount * 8) { break; }
buffer.put(QRCodeModel.PAD1, 8);
}
return QRCodeModel.createBytes(buffer, rsBlocks);
}; QRCodeModel.createBytes = function (buffer, rsBlocks) {
var offset = 0; var maxDcCount = 0; var maxEcCount = 0; var dcdata = new Array(rsBlocks.length); var ecdata = new Array(rsBlocks.length); for (var r = 0; r < rsBlocks.length; r++) {
var dcCount = rsBlocks[r].dataCount; var ecCount = rsBlocks[r].totalCount - dcCount; maxDcCount = Math.max(maxDcCount, dcCount); maxEcCount = Math.max(maxEcCount, ecCount); dcdata[r] = new Array(dcCount); for (var i = 0; i < dcdata[r].length; i++) { dcdata[r][i] = 0xff & buffer.buffer[i + offset]; }
offset += dcCount; var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount); var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1); var modPoly = rawPoly.mod(rsPoly); ecdata[r] = new Array(rsPoly.getLength() - 1); for (var i = 0; i < ecdata[r].length; i++) { var modIndex = i + modPoly.getLength() - ecdata[r].length; ecdata[r][i] = (modIndex >= 0) ? modPoly.get(modIndex) : 0; }
}
var totalCodeCount = 0; for (var i = 0; i < rsBlocks.length; i++) { totalCodeCount += rsBlocks[i].totalCount; }
var data = new Array(totalCodeCount); var index = 0; for (var i = 0; i < maxDcCount; i++) { for (var r = 0; r < rsBlocks.length; r++) { if (i < dcdata[r].length) { data[index++] = dcdata[r][i]; } } }
for (var i = 0; i < maxEcCount; i++) { for (var r = 0; r < rsBlocks.length; r++) { if (i < ecdata[r].length) { data[index++] = ecdata[r][i]; } } }
return data;
}; var QRMode = { MODE_NUMBER: 1 << 0, MODE_ALPHA_NUM: 1 << 1, MODE_8BIT_BYTE: 1 << 2, MODE_KANJI: 1 << 3 }; var QRErrorCorrectLevel = { L: 1, M: 0, Q: 3, H: 2 }; var QRMaskPattern = { PATTERN000: 0, PATTERN001: 1, PATTERN010: 2, PATTERN011: 3, PATTERN100: 4, PATTERN101: 5, PATTERN110: 6, PATTERN111: 7 }; var QRUtil = {
PATTERN_POSITION_TABLE: [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], G15: (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0), G18: (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0), G15_MASK: (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1), getBCHTypeInfo: function (data) {
var d = data << 10; while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) { d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15))); }
return ((data << 10) | d) ^ QRUtil.G15_MASK;
}, getBCHTypeNumber: function (data) {
var d = data << 12; while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) { d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18))); }
return (data << 12) | d;
}, getBCHDigit: function (data) {
var digit = 0; while (data != 0) { digit++; data >>>= 1; }
return digit;
}, getPatternPosition: function (typeNumber) { return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1]; }, getMask: function (maskPattern, i, j) { switch (maskPattern) { case QRMaskPattern.PATTERN000: return (i + j) % 2 == 0; case QRMaskPattern.PATTERN001: return i % 2 == 0; case QRMaskPattern.PATTERN010: return j % 3 == 0; case QRMaskPattern.PATTERN011: return (i + j) % 3 == 0; case QRMaskPattern.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0; case QRMaskPattern.PATTERN101: return (i * j) % 2 + (i * j) % 3 == 0; case QRMaskPattern.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 == 0; case QRMaskPattern.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 == 0; default: throw new Error("bad maskPattern:" + maskPattern); } }, getErrorCorrectPolynomial: function (errorCorrectLength) {
var a = new QRPolynomial([1], 0); for (var i = 0; i < errorCorrectLength; i++) { a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0)); }
return a;
}, getLengthInBits: function (mode, type) { if (1 <= type && type < 10) { switch (mode) { case QRMode.MODE_NUMBER: return 10; case QRMode.MODE_ALPHA_NUM: return 9; case QRMode.MODE_8BIT_BYTE: return 8; case QRMode.MODE_KANJI: return 8; default: throw new Error("mode:" + mode); } } else if (type < 27) { switch (mode) { case QRMode.MODE_NUMBER: return 12; case QRMode.MODE_ALPHA_NUM: return 11; case QRMode.MODE_8BIT_BYTE: return 16; case QRMode.MODE_KANJI: return 10; default: throw new Error("mode:" + mode); } } else if (type < 41) { switch (mode) { case QRMode.MODE_NUMBER: return 14; case QRMode.MODE_ALPHA_NUM: return 13; case QRMode.MODE_8BIT_BYTE: return 16; case QRMode.MODE_KANJI: return 12; default: throw new Error("mode:" + mode); } } else { throw new Error("type:" + type); } }, getLostPoint: function (qrCode) {
var moduleCount = qrCode.getModuleCount(); var lostPoint = 0; for (var row = 0; row < moduleCount; row++) {
for (var col = 0; col < moduleCount; col++) {
var sameCount = 0; var dark = qrCode.isDark(row, col); for (var r = -1; r <= 1; r++) {
if (row + r < 0 || moduleCount <= row + r) { continue; }
for (var c = -1; c <= 1; c++) {
if (col + c < 0 || moduleCount <= col + c) { continue; }
if (r == 0 && c == 0) { continue; }
if (dark == qrCode.isDark(row + r, col + c)) { sameCount++; }
}
}
if (sameCount > 5) { lostPoint += (3 + sameCount - 5); }
}
}
for (var row = 0; row < moduleCount - 1; row++) { for (var col = 0; col < moduleCount - 1; col++) { var count = 0; if (qrCode.isDark(row, col)) count++; if (qrCode.isDark(row + 1, col)) count++; if (qrCode.isDark(row, col + 1)) count++; if (qrCode.isDark(row + 1, col + 1)) count++; if (count == 0 || count == 4) { lostPoint += 3; } } }
for (var row = 0; row < moduleCount; row++) { for (var col = 0; col < moduleCount - 6; col++) { if (qrCode.isDark(row, col) && !qrCode.isDark(row, col + 1) && qrCode.isDark(row, col + 2) && qrCode.isDark(row, col + 3) && qrCode.isDark(row, col + 4) && !qrCode.isDark(row, col + 5) && qrCode.isDark(row, col + 6)) { lostPoint += 40; } } }
for (var col = 0; col < moduleCount; col++) { for (var row = 0; row < moduleCount - 6; row++) { if (qrCode.isDark(row, col) && !qrCode.isDark(row + 1, col) && qrCode.isDark(row + 2, col) && qrCode.isDark(row + 3, col) && qrCode.isDark(row + 4, col) && !qrCode.isDark(row + 5, col) && qrCode.isDark(row + 6, col)) { lostPoint += 40; } } }
var darkCount = 0; for (var col = 0; col < moduleCount; col++) { for (var row = 0; row < moduleCount; row++) { if (qrCode.isDark(row, col)) { darkCount++; } } }
var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5; lostPoint += ratio * 10; return lostPoint;
}
}; var QRMath = {
glog: function (n) {
if (n < 1) { throw new Error("glog(" + n + ")"); }
return QRMath.LOG_TABLE[n];
}, gexp: function (n) {
while (n < 0) { n += 255; }
while (n >= 256) { n -= 255; }
return QRMath.EXP_TABLE[n];
}, EXP_TABLE: new Array(256), LOG_TABLE: new Array(256)
}; for (var i = 0; i < 8; i++) { QRMath.EXP_TABLE[i] = 1 << i; }
for (var i = 8; i < 256; i++) { QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] ^ QRMath.EXP_TABLE[i - 5] ^ QRMath.EXP_TABLE[i - 6] ^ QRMath.EXP_TABLE[i - 8]; }
for (var i = 0; i < 255; i++) { QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i; }
function QRPolynomial(num, shift) {
if (num.length == undefined) { throw new Error(num.length + "/" + shift); }
var offset = 0; while (offset < num.length && num[offset] == 0) { offset++; }
this.num = new Array(num.length - offset + shift); for (var i = 0; i < num.length - offset; i++) { this.num[i] = num[i + offset]; }
}
QRPolynomial.prototype = {
get: function (index) { return this.num[index]; }, getLength: function () { return this.num.length; }, multiply: function (e) {
var num = new Array(this.getLength() + e.getLength() - 1); for (var i = 0; i < this.getLength(); i++) { for (var j = 0; j < e.getLength(); j++) { num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i)) + QRMath.glog(e.get(j))); } }
return new QRPolynomial(num, 0);
}, mod: function (e) {
if (this.getLength() - e.getLength() < 0) { return this; }
var ratio = QRMath.glog(this.get(0)) - QRMath.glog(e.get(0)); var num = new Array(this.getLength()); for (var i = 0; i < this.getLength(); i++) { num[i] = this.get(i); }
for (var i = 0; i < e.getLength(); i++) { num[i] ^= QRMath.gexp(QRMath.glog(e.get(i)) + ratio); }
return new QRPolynomial(num, 0).mod(e);
}
}; function QRRSBlock(totalCount, dataCount) { this.totalCount = totalCount; this.dataCount = dataCount; }
QRRSBlock.RS_BLOCK_TABLE = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]]; QRRSBlock.getRSBlocks = function (typeNumber, errorCorrectLevel) {
var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel); if (rsBlock == undefined) { throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel); }
var length = rsBlock.length / 3; var list = []; for (var i = 0; i < length; i++) { var count = rsBlock[i * 3 + 0]; var totalCount = rsBlock[i * 3 + 1]; var dataCount = rsBlock[i * 3 + 2]; for (var j = 0; j < count; j++) { list.push(new QRRSBlock(totalCount, dataCount)); } }
return list;
}; QRRSBlock.getRsBlockTable = function (typeNumber, errorCorrectLevel) { switch (errorCorrectLevel) { case QRErrorCorrectLevel.L: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0]; case QRErrorCorrectLevel.M: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1]; case QRErrorCorrectLevel.Q: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2]; case QRErrorCorrectLevel.H: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3]; default: return undefined; } }; function QRBitBuffer() { this.buffer = []; this.length = 0; }
QRBitBuffer.prototype = {
get: function (index) { var bufIndex = Math.floor(index / 8); return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) == 1; }, put: function (num, length) { for (var i = 0; i < length; i++) { this.putBit(((num >>> (length - i - 1)) & 1) == 1); } }, getLengthInBits: function () { return this.length; }, putBit: function (bit) {
var bufIndex = Math.floor(this.length / 8); if (this.buffer.length <= bufIndex) { this.buffer.push(0); }
if (bit) { this.buffer[bufIndex] |= (0x80 >>> (this.length % 8)); }
this.length++;
}
}; var QRCodeLimitLength = [[17, 14, 11, 7], [32, 26, 20, 14], [53, 42, 32, 24], [78, 62, 46, 34], [106, 84, 60, 44], [134, 106, 74, 58], [154, 122, 86, 64], [192, 152, 108, 84], [230, 180, 130, 98], [271, 213, 151, 119], [321, 251, 177, 137], [367, 287, 203, 155], [425, 331, 241, 177], [458, 362, 258, 194], [520, 412, 292, 220], [586, 450, 322, 250], [644, 504, 364, 280], [718, 560, 394, 310], [792, 624, 442, 338], [858, 666, 482, 382], [929, 711, 509, 403], [1003, 779, 565, 439], [1091, 857, 611, 461], [1171, 911, 661, 511], [1273, 997, 715, 535], [1367, 1059, 751, 593], [1465, 1125, 805, 625], [1528, 1190, 868, 658], [1628, 1264, 908, 698], [1732, 1370, 982, 742], [1840, 1452, 1030, 790], [1952, 1538, 1112, 842], [2068, 1628, 1168, 898], [2188, 1722, 1228, 958], [2303, 1809, 1283, 983], [2431, 1911, 1351, 1051], [2563, 1989, 1423, 1093], [2699, 2099, 1499, 1139], [2809, 2213, 1579, 1219], [2953, 2331, 1663, 1273]];
function _isSupportCanvas() {
return typeof CanvasRenderingContext2D != "undefined";
}
// android 2.x doesn't support Data-URI spec
function _getAndroid() {
var android = false;
var sAgent = navigator.userAgent;
if (/android/i.test(sAgent)) { // android
android = true;
var aMat = sAgent.toString().match(/android ([0-9]\.[0-9])/i);
if (aMat && aMat[1]) {
android = parseFloat(aMat[1]);
}
}
return android;
}
var svgDrawer = (function () {
var Drawing = function (el, htOption) {
this._el = el;
this._htOption = htOption;
};
Drawing.prototype.draw = function (oQRCode) {
var _htOption = this._htOption;
var _el = this._el;
var nCount = oQRCode.getModuleCount();
var nWidth = Math.floor(_htOption.width / nCount);
var nHeight = Math.floor(_htOption.height / nCount);
this.clear();
function makeSVG(tag, attrs) {
var el = document.createElementNS('http://www.w3.org/2000/svg', tag);
for (var k in attrs)
if (attrs.hasOwnProperty(k)) el.setAttribute(k, attrs[k]);
return el;
}
var svg = makeSVG("svg", { 'viewBox': '0 0 ' + String(nCount) + " " + String(nCount), 'width': '100%', 'height': '100%', 'fill': _htOption.colorLight });
svg.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink");
_el.appendChild(svg);
svg.appendChild(makeSVG("rect", { "fill": _htOption.colorLight, "width": "100%", "height": "100%" }));
svg.appendChild(makeSVG("rect", { "fill": _htOption.colorDark, "width": "1", "height": "1", "id": "template" }));
for (var row = 0; row < nCount; row++) {
for (var col = 0; col < nCount; col++) {
if (oQRCode.isDark(row, col)) {
var child = makeSVG("use", { "x": String(col), "y": String(row) });
child.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#template")
svg.appendChild(child);
}
}
}
};
Drawing.prototype.clear = function () {
while (this._el.hasChildNodes())
this._el.removeChild(this._el.lastChild);
};
return Drawing;
})();
var useSVG = document.documentElement.tagName.toLowerCase() === "svg";
// Drawing in DOM by using Table tag
var Drawing = useSVG ? svgDrawer : !_isSupportCanvas() ? (function () {
var Drawing = function (el, htOption) {
this._el = el;
this._htOption = htOption;
};
/**
* Draw the QRCode
*
* @param {QRCode} oQRCode
*/
Drawing.prototype.draw = function (oQRCode) {
var _htOption = this._htOption;
var _el = this._el;
var nCount = oQRCode.getModuleCount();
var nWidth = Math.floor(_htOption.width / nCount);
var nHeight = Math.floor(_htOption.height / nCount);
var aHTML = ['<table style="border:0;border-collapse:collapse;">'];
for (var row = 0; row < nCount; row++) {
aHTML.push('<tr>');
for (var col = 0; col < nCount; col++) {
aHTML.push('<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:' + nWidth + 'px;height:' + nHeight + 'px;background-color:' + (oQRCode.isDark(row, col) ? _htOption.colorDark : _htOption.colorLight) + ';"></td>');
}
aHTML.push('</tr>');
}
aHTML.push('</table>');
_el.innerHTML = aHTML.join('');
// Fix the margin values as real size.
var elTable = _el.childNodes[0];
var nLeftMarginTable = (_htOption.width - elTable.offsetWidth) / 2;
var nTopMarginTable = (_htOption.height - elTable.offsetHeight) / 2;
if (nLeftMarginTable > 0 && nTopMarginTable > 0) {
elTable.style.margin = nTopMarginTable + "px " + nLeftMarginTable + "px";
}
};
/**
* Clear the QRCode
*/
Drawing.prototype.clear = function () {
this._el.innerHTML = '';
};
return Drawing;
})() : (function () { // Drawing in Canvas
function _onMakeImage() {
this._elImage.src = this._elCanvas.toDataURL("image/png");
this._elImage.style.display = "block";
this._elCanvas.style.display = "none";
}
// Android 2.1 bug workaround
// http://code.google.com/p/android/issues/detail?id=5141
if (this._android && this._android <= 2.1) {
var factor = 1 / window.devicePixelRatio;
var drawImage = CanvasRenderingContext2D.prototype.drawImage;
CanvasRenderingContext2D.prototype.drawImage = function (image, sx, sy, sw, sh, dx, dy, dw, dh) {
if (("nodeName" in image) && /img/i.test(image.nodeName)) {
for (var i = arguments.length - 1; i >= 1; i--) {
arguments[i] = arguments[i] * factor;
}
} else if (typeof dw == "undefined") {
arguments[1] *= factor;
arguments[2] *= factor;
arguments[3] *= factor;
arguments[4] *= factor;
}
drawImage.apply(this, arguments);
};
}
/**
* Check whether the user's browser supports Data URI or not
*
* @private
* @param {Function} fSuccess Occurs if it supports Data URI
* @param {Function} fFail Occurs if it doesn't support Data URI
*/
function _safeSetDataURI(fSuccess, fFail) {
var self = this;
self._fFail = fFail;
self._fSuccess = fSuccess;
// Check it just once
if (self._bSupportDataURI === null) {
var el = document.createElement("img");
var fOnError = function () {
self._bSupportDataURI = false;
if (self._fFail) {
self._fFail.call(self);
}
};
var fOnSuccess = function () {
self._bSupportDataURI = true;
if (self._fSuccess) {
self._fSuccess.call(self);
}
};
el.onabort = fOnError;
el.onerror = fOnError;
el.onload = fOnSuccess;
el.src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; // the Image contains 1px data.
return;
} else if (self._bSupportDataURI === true && self._fSuccess) {
self._fSuccess.call(self);
} else if (self._bSupportDataURI === false && self._fFail) {
self._fFail.call(self);
}
};
/**
* Drawing QRCode by using canvas
*
* @constructor
* @param {HTMLElement} el
* @param {Object} htOption QRCode Options
*/
var Drawing = function (el, htOption) {
this._bIsPainted = false;
this._android = _getAndroid();
this._htOption = htOption;
this._elCanvas = document.createElement("canvas");
this._elCanvas.width = htOption.width;
this._elCanvas.height = htOption.height;
el.appendChild(this._elCanvas);
this._el = el;
this._oContext = this._elCanvas.getContext("2d");
this._bIsPainted = false;
this._elImage = document.createElement("img");
this._elImage.alt = "Scan me!";
this._elImage.style.display = "none";
this._el.appendChild(this._elImage);
this._bSupportDataURI = null;
};
/**
* Draw the QRCode
*
* @param {QRCode} oQRCode
*/
Drawing.prototype.draw = function (oQRCode) {
var _elImage = this._elImage;
var _oContext = this._oContext;
var _htOption = this._htOption;
var nCount = oQRCode.getModuleCount();
var nWidth = _htOption.width / nCount;
var nHeight = _htOption.height / nCount;
var nRoundedWidth = Math.round(nWidth);
var nRoundedHeight = Math.round(nHeight);
_elImage.style.display = "none";
this.clear();
for (var row = 0; row < nCount; row++) {
for (var col = 0; col < nCount; col++) {
var bIsDark = oQRCode.isDark(row, col);
var nLeft = col * nWidth;
var nTop = row * nHeight;
_oContext.strokeStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
_oContext.lineWidth = 1;
_oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
_oContext.fillRect(nLeft, nTop, nWidth, nHeight);
// 안티 앨리어싱 방지 처리
_oContext.strokeRect(
Math.floor(nLeft) + 0.5,
Math.floor(nTop) + 0.5,
nRoundedWidth,
nRoundedHeight
);
_oContext.strokeRect(
Math.ceil(nLeft) - 0.5,
Math.ceil(nTop) - 0.5,
nRoundedWidth,
nRoundedHeight
);
}
}
this._bIsPainted = true;
};
/**
* Make the image from Canvas if the browser supports Data URI.
*/
Drawing.prototype.makeImage = function () {
if (this._bIsPainted) {
_safeSetDataURI.call(this, _onMakeImage);
}
};
/**
* Return whether the QRCode is painted or not
*
* @return {Boolean}
*/
Drawing.prototype.isPainted = function () {
return this._bIsPainted;
};
/**
* Clear the QRCode
*/
Drawing.prototype.clear = function () {
this._oContext.clearRect(0, 0, this._elCanvas.width, this._elCanvas.height);
this._bIsPainted = false;
};
/**
* @private
* @param {Number} nNumber
*/
Drawing.prototype.round = function (nNumber) {
if (!nNumber) {
return nNumber;
}
return Math.floor(nNumber * 1000) / 1000;
};
return Drawing;
})();
/**
* Get the type by string length
*
* @private
* @param {String} sText
* @param {Number} nCorrectLevel
* @return {Number} type
*/
function _getTypeNumber(sText, nCorrectLevel) {
var nType = 1;
var length = _getUTF8Length(sText);
for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) {
var nLimit = 0;
switch (nCorrectLevel) {
case QRErrorCorrectLevel.L:
nLimit = QRCodeLimitLength[i][0];
break;
case QRErrorCorrectLevel.M:
nLimit = QRCodeLimitLength[i][1];
break;
case QRErrorCorrectLevel.Q:
nLimit = QRCodeLimitLength[i][2];
break;
case QRErrorCorrectLevel.H:
nLimit = QRCodeLimitLength[i][3];
break;
}
if (length <= nLimit) {
break;
} else {
nType++;
}
}
if (nType > QRCodeLimitLength.length) {
throw new Error("Too long data");
}
return nType;
}
function _getUTF8Length(sText) {
var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a');
return replacedText.length + (replacedText.length != sText ? 3 : 0);
}
/**
* @class QRCode
* @constructor
* @example
* new QRCode(document.getElementById("test"), "http://jindo.dev.naver.com/collie");
*
* @example
* var oQRCode = new QRCode("test", {
* text : "http://naver.com",
* width : 128,
* height : 128
* });
*
* oQRCode.clear(); // Clear the QRCode.
* oQRCode.makeCode("http://map.naver.com"); // Re-create the QRCode.
*
* @param {HTMLElement|String} el target element or 'id' attribute of element.
* @param {Object|String} vOption
* @param {String} vOption.text QRCode link data
* @param {Number} [vOption.width=256]
* @param {Number} [vOption.height=256]
* @param {String} [vOption.colorDark="#000000"]
* @param {String} [vOption.colorLight="#ffffff"]
* @param {QRCode.CorrectLevel} [vOption.correctLevel=QRCode.CorrectLevel.H] [L|M|Q|H]
*/
QRCode.prototype.qrcode = function (el, vOption) {
this._htOption = {
width: 256,
height: 256,
typeNumber: 4,
colorDark: "#000000",
colorLight: "#ffffff",
correctLevel: QRErrorCorrectLevel.H
};
if (typeof vOption === 'string') {
vOption = {
text: vOption
};
}
// Overwrites options
if (vOption) {
for (var i in vOption) {
this._htOption[i] = vOption[i];
}
}
if (typeof el == "string") {
el = document.getElementById(el);
}
if (this._htOption.useSVG) {
Drawing = svgDrawer;
}
this._android = _getAndroid();
this._el = el;
this._oQRCode = null;
this._oDrawing = new Drawing(this._el, this._htOption);
if (this._htOption.text) {
this.makeCode(this._htOption.text);
}
return QRCode;
};
/**
* Make the QRCode
*
* @param {String} sText link data
*/
QRCode.prototype.makeCode = function (sText) {
this._oQRCode = new QRCodeModel(_getTypeNumber(sText, this._htOption.correctLevel), this._htOption.correctLevel);
this._oQRCode.addData(sText);
this._oQRCode.make();
this._el.title = sText;
this._oDrawing.draw(this._oQRCode);
this.makeImage();
};
/**
* Make the Image from Canvas element
* - It occurs automatically
* - Android below 3 doesn't support Data-URI spec.
*
* @private
*/
QRCode.prototype.makeImage = function () {
if (typeof this._oDrawing.makeImage == "function" && (!this._android || this._android >= 3)) {
this._oDrawing.makeImage();
}
};
/**
* Clear the QRCode
*/
QRCode.prototype.clear = function () {
this._oDrawing.clear();
};
/**
* @name QRCode.CorrectLevel
*/
QRCode.CorrectLevel = QRErrorCorrectLevel;
})();
exports('qrcode', new QRCode)
});

@ -0,0 +1,89 @@
/**
定义layui模块 - 模板引擎 - 自定义模板
*/
layui.define(['index', 'laytpl', 'form'], function (exports) {
exports("tpl", {
setPlainTextTpl: function (eleId, data) {
var laytpl = layui.laytpl;
var form = layui.form;
var getTpl = '{{d.title}}';
var view = document.getElementById(eleId);
if (!view) { console.warn("请填写有效的ElementId"); return false; }
laytpl(getTpl).render(data, function (html) {
view.innerHTML = html;
});
form.render("select");
},
setInputTpl: function (eleId, data) {
var laytpl = layui.laytpl;
var form = layui.form;
var getTpl = '';
var display = data.display ? data.display : 'block';
var requiredhtml = data.required ? ' required lay-verify="required" ' : '';
var placeholder = data.placeholder ? data.placeholder : '请输入内容';
if (data.label) {
getTpl += '<label class="layui-form-label">{{d.label}}</label>';
}
getTpl += '<div class="layui-input-' + display + '">';
getTpl += '<input type="text" name="' + data.name + '" placeholder="' + placeholder + '" value="' + value + '" ' + requiredhtml + ' autocomplete="off" class="layui-input">';
getTpl += '</div>';
var view = document.getElementById(eleId);
if (!view) { console.warn("请填写有效的ElementId"); return false; }
laytpl(getTpl).render(data, function (html) {
view.innerHTML = html;
});
form.render();
},
setTextareaTpl: function (eleId, data) {
var laytpl = layui.laytpl;
var form = layui.form;
var idHtml = data.id ? 'id="' + data.id + '"' : '';
var classHtml = ' class="layui-textarea ' + (data.class ? data.class : '') + '" ';
var display = data.display ? data.display : 'block';
var value = data.value ? data.value : '';
var placeholder = data.placeholder ? data.placeholder : '请输入内容';
var requiredhtml = data.required ? ' required lay-verify="required" ' : '';
var getTpl = '';
if (data.label) {
getTpl += '<label class="layui-form-label">{{d.label}}</label>';
}
getTpl += '<div class="layui-input-' + display + '">';
getTpl += ' <textarea name="' + data.name + '" ' + idHtml + classHtml + requiredhtml + ' placeholder="' + placeholder + '" value="' + value + '"></textarea>';
getTpl += '</div>';
var view = document.getElementById(eleId);
if (!view) { console.warn("请填写有效的ElementId"); return false; }
laytpl(getTpl).render(data, function (html) {
view.innerHTML = html;
});
form.render();
},
setSelectTpl: function (eleId, data) {
var laytpl = layui.laytpl;
var form = layui.form;
var display = data.display ? data.display : 'block';
var layFilterHtml = data.layFilter ? ' lay-filter="' + data.layFilter + '" ' : ' ';
var classHtml = data.class ? ' class="' + eleId + '-select" ' : ' ';
var requiredhtml = data.required ? ' required lay-verify="required" ' : '';
var getTpl = "";
if (data.label) {
getTpl += '<label class="layui-form-label">{{d.label}}</label>';
}
getTpl += '<div class="layui-input-' + display + '">';
if (data.list.length > 0) {
getTpl += '<select name="{{d.name}}" ' + layFilterHtml + classHtml + requiredhtml + '>{{# layui.each(d.list, function(index, item){ }}<option value="{{ item.value }}" {{# if(item.selected){ }} selected="selected" {{# } }} >{{ item.name }}</option>{{# }); }}</select></div>';
} else {
getTpl += '<select name="{{d.name}}" ' + layFilterHtml + classHtml + requiredhtml + '><option value="" >请选择</option></select></div>';
}
var view = document.getElementById(eleId);
if (!view) { console.warn("请填写有效的ElementId"); return false; }
laytpl(getTpl).render(data, function (html) {
view.innerHTML = html;
});
form.render('select');
},
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 828 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 922 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 853 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

@ -0,0 +1,314 @@
layui.use(["index", "api", "tpl", "dialog", "laypage", "laydate"], function () {
var $ = layui.$,
table = layui.table,
element = layui.element,
form = layui.form,
admin = layui.admin,
laydate = layui.laydate,
laypage = layui.laypage;
var refreshNextTime = 0;
var intervalsTime = 0;//刷新时间频率
var myRefreshTimeOut = "";
var where = {};
var ecgChart = echarts.init(document.getElementById("ecgChart"));
var LIST_TABLE_ID = "listTable";
var LIST_TABLE_DATA = [
{
id: 1,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 2,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 3,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 4,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 5,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 6,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 7,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 8,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 9,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 10,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
];
var LIST_TABLE_COLS = [
{
field: "id",
title: "id",
align: "center",
},
{
field: "name",
title: "名称",
align: "center",
},
{
field: "createTime",
title: "创建时间",
align: "center",
templet: function (d) {
return layui.util.toDateString(d.createTime, "yyyy-MM-dd");
},
}
];
init();
function init() {
getChartData();
getTableData();
refreshTime();
}
function stopRefreshTime() {
clearTimeout(myRefreshTimeOut);
}
function refreshTime() {
if (intervalsTime == 0) {
stopRefreshTime();
}
var nowTime = new Date().getTime();
if (nowTime > refreshNextTime) {
refreshNextTime = nowTime + parseInt(intervalsTime);
getChartData();
getTableData();
if (intervalsTime > 0) {
refreshTime();
}
} else {
if (intervalsTime > 0) {
myRefreshTimeOut = window.setTimeout(function () {
refreshTime();
}, intervalsTime);
}
}
}
function getChartData() {
var responseTimeOptions = {
xAxisData: ["4000", "3000", "5000", "6500", "4800"],
seriesData: [110, 250, 239, 124, 47],
}; //api 请求数据
rendErecgChart(responseTimeOptions);
}
function rendErecgChart({ xAxisData, seriesData }) {
var xAxisData = [];
var yAxisData = [];
for (var i = 500; i > 0; i--) {
xAxisData.push(i + "秒前");
}
for (i = 1; i < 501; i++) {
yAxisData.push(null);
}
var totalFlowRateOption = {
animation: false,
title: {
text: '总流量kbps'/*,
left:"110px"*/ },
tooltip: {
trigger: 'axis',
axisPointer: { type: 'cross' }
},
grid: {
left: 50/*"50px"*/,
right: 15/*"15px"*/
},
legend: {
data: ['当前流量']
},
xAxis: {
boundaryGap: false,
data: xAxisData,
nameLocation: "end",
axisLine: {
lineStyle: {
color: "#454b5026",
},
},
splitLine: {
show: true,
lineStyle: {
color: ["#454b5026"],
width: 1,
type: "solid",
},
},
},
textStyle: {
color: "#a5aaaf",
},
yAxis: {
boundaryGap: false, nameLocation: "end",
axisLine: {
lineStyle: {
color: "#454b5026",
},
},
splitLine: {
show: true,
lineStyle: {
color: ["#454b5026"],
width: 1,
type: "solid",
},
},
},
series: {
symbol: "none",/*去掉小圆点*/
name: '当前流量',
type: 'line',
data: yAxisData,
showBackground: false,
itemStyle: {
normal: {
color: "#1289ff",
},
},
}
};
ecgChart.setOption(totalFlowRateOption);
setInterval(function () {
yAxisData.push(Math.round(Math.random() * 1000));
if (yAxisData.length > 500) {
yAxisData.shift();
}
ecgChart.setOption(totalFlowRateOption);
}, 1000);
}
function getTableData() {
var tableRenderOptions = {
elem: "#" + LIST_TABLE_ID,
data: LIST_TABLE_DATA,
even: "false",
defaultToolbar: [],
page: false,
cols: [LIST_TABLE_COLS],
where: where,
};
table.render(tableRenderOptions);
laypage.render({
elem: "pages",
count: 100,
layout: ["count", "prev", "page", "next", "limit", "refresh", "skip"],
jump: function (obj) {
console.log(obj);
},
});
}
});

@ -0,0 +1,310 @@
layui.use(["index", "api", "tpl", "dialog", "laypage", "laydate"], function () {
var $ = layui.$,
table = layui.table,
element = layui.element,
form = layui.form,
admin = layui.admin,
laydate = layui.laydate,
laypage = layui.laypage;
var refreshNextTime = 0;
var intervalsTime = 0;//刷新时间频率
var myRefreshTimeOut = "";
var where = {};
var histogramChart = echarts.init(document.getElementById("histogramChart"));
var LIST_TABLE_ID = "listTable";
var LIST_TABLE_DATA = [
{
id: 1,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 2,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 3,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 4,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 5,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 6,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 7,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 8,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 9,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 10,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
];
var LIST_TABLE_COLS = [
{
field: "id",
title: "id",
align: "center",
},
{
field: "name",
title: "名称",
align: "center",
},
{
field: "createTime",
title: "创建时间",
align: "center",
templet: function (d) {
return layui.util.toDateString(d.createTime, "yyyy-MM-dd");
},
}
];
init();
function init() {
getChartData();
getTableData();
refreshTime();
}
function stopRefreshTime() {
clearTimeout(myRefreshTimeOut);
}
function refreshTime() {
if (intervalsTime == 0) {
stopRefreshTime();
}
var nowTime = new Date().getTime();
if (nowTime > refreshNextTime) {
refreshNextTime = nowTime + parseInt(intervalsTime);
getChartData();
getTableData();
if (intervalsTime > 0) {
refreshTime();
}
} else {
if (intervalsTime > 0) {
myRefreshTimeOut = window.setTimeout(function () {
refreshTime();
}, intervalsTime);
}
}
}
function getChartData() {
var responseTimeOptions = {
xAxisData: ["100", "200", "50", "250", "100"],
seriesData: [100, 700, 50, 250, 100],
}; //api 请求数据
renderHistogramChart(responseTimeOptions);
}
function renderHistogramChart({ xAxisData, seriesData }) {
var option = {
xAxis: {
type: 'category',
data: xAxisData,
name: "响应时长/ms",
nameLocation: "end",
splitNumber: 10,
axisLine: {
lineStyle: {
color: "#454b5026",
},
},
splitLine: {
show: true,
lineStyle: {
color: ["#454b5026"],
width: 1,
type: "solid",
},
}
},
yAxis: {
type: 'value',
name: "请求个数",
nameLocation: "end",
splitNumber: 4,
axisLine: {
lineStyle: {
color: "#454b5026",
},
},
splitLine: {
show: true,
lineStyle: {
color: ["#454b5026"],
width: 1,
type: "solid",
},
}
},
textStyle: {
color: "#a5aaaf",
},
series: [{
data: seriesData,
type: 'bar',
barMinWidth: '180',
barCategoryGap: "0",
showBackground: false,
backgroundStyle: {
color: 'rgba(18, 137, 255, 1)',
},
itemStyle: {
normal: {
label: {
formatter: "{c}",
show: true,
position: "top",
textStyle: {
fontWeight: "bolder",
fontSize: "16",
color: "#1289ff"
}
},
opacity: 1,
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "#1289ff",
},
{
offset: 1,
color: "#1289ff4d",
},
]),
},
}
}]
};
histogramChart.setOption(option);
}
function getTableData() {
var tableRenderOptions = {
elem: "#" + LIST_TABLE_ID,
data: LIST_TABLE_DATA,
even: "false",
defaultToolbar: [],
page: false,
cols: [LIST_TABLE_COLS],
where: where,
};
table.render(tableRenderOptions);
laypage.render({
elem: "pages",
count: 100,
layout: ["count", "prev", "page", "next", "limit", "refresh", "skip"],
jump: function (obj) {
console.log(obj);
},
});
}
});

@ -0,0 +1,285 @@
layui.use(["index", "api", "tpl", "dialog", "laypage", "laydate"], function () {
var $ = layui.$,
table = layui.table,
element = layui.element,
form = layui.form,
admin = layui.admin,
laydate = layui.laydate,
laypage = layui.laypage;
var refreshNextTime = 0;
var intervalsTime = 0;//刷新时间频率
var myRefreshTimeOut = "";
var where = {};
var lineChart = echarts.init(document.getElementById("lineChart"));
var LIST_TABLE_ID = "listTable";
var LIST_TABLE_DATA = [
{
id: 1,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 2,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 3,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 4,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 5,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 6,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 7,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 8,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 9,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 10,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
];
var LIST_TABLE_COLS = [
{
field: "id",
title: "id",
align: "center",
},
{
field: "name",
title: "名称",
align: "center",
},
{
field: "createTime",
title: "创建时间",
align: "center",
templet: function (d) {
return layui.util.toDateString(d.createTime, "yyyy-MM-dd");
},
}
];
init();
function init() {
getChartData();
getTableData();
refreshTime();
}
function stopRefreshTime() {
clearTimeout(myRefreshTimeOut);
}
function refreshTime() {
if (intervalsTime == 0) {
stopRefreshTime();
}
var nowTime = new Date().getTime();
if (nowTime > refreshNextTime) {
refreshNextTime = nowTime + parseInt(intervalsTime);
getChartData();
getTableData();
if (intervalsTime > 0) {
refreshTime();
}
} else {
if (intervalsTime > 0) {
myRefreshTimeOut = window.setTimeout(function () {
refreshTime();
}, intervalsTime);
}
}
}
function getChartData() {
var responseTimeOptions = {
xAxisData: ["4000", "3000", "5000", "6500", "4800"],
seriesData: [110, 250, 239, 124, 47],
}; //api 请求数据
renderLineChart(responseTimeOptions);
}
function renderLineChart({ xAxisData, seriesData }) {
var option = {
xAxis: {
type: "category",
name: "响应时长/ms",
nameLocation: "end",
data: xAxisData,
axisLine: {
lineStyle: {
color: "#454b5026",
},
},
splitLine: {
show: true,
lineStyle: {
color: ["#454b5026"],
width: 1,
type: "solid",
},
},
},
yAxis: {
type: "value",
name: "请求个数",
nameLocation: "end",
axisLine: {
lineStyle: {
color: "#454b5026",
},
},
splitLine: {
show: true,
lineStyle: {
color: ["#454b5026"],
width: 1,
type: "solid",
},
},
},
textStyle: {
color: "#a5aaaf",
},
series: [
{
data: seriesData,
type: "line",
showBackground: false,
itemStyle: {
normal: {
color: "#1289ff",
},
},
},
],
};
lineChart.setOption(option);
}
function getTableData() {
var tableRenderOptions = {
elem: "#" + LIST_TABLE_ID,
data: LIST_TABLE_DATA,
even: "false",
defaultToolbar: [],
page: false,
cols: [LIST_TABLE_COLS],
where: where,
};
table.render(tableRenderOptions);
laypage.render({
elem: "pages",
count: 100,
layout: ["count", "prev", "page", "next", "limit", "refresh", "skip"],
jump: function (obj) {
console.log(obj);
},
});
}
});

@ -0,0 +1,233 @@
layui.use(["index", "api", "tpl", "dialog", "laypage", "laydate"], function () {
var $ = layui.$,
table = layui.table,
element = layui.element,
form = layui.form,
admin = layui.admin,
laydate = layui.laydate,
laypage = layui.laypage;
var wavypolylineChart = echarts.init(
document.getElementById("wavypolylineChart")
);
var refreshNextTime = 0;
var intervalsTime = 0; //刷新时间频率
var myRefreshTimeOut = "";
var where = {};
var LIST_TABLE_ID = "listTable";
var LIST_TABLE_DATA = [
{
id: 1,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 2,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 3,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
{
id: 4,
name: "我的名字",
ip: "192.168.10.123",
port: "3306",
sid: "student_info",
username: "student",
password: "12345678",
createTime: 1590560278000,
fz: 1,
type: 1,
remark: "我是一个备注",
},
];
var LIST_TABLE_COLS = [
{
field: "id",
title: "id",
align: "center",
},
{
field: "name",
title: "名称",
align: "center",
},
{
field: "createTime",
title: "创建时间",
align: "center",
templet: function (d) {
return layui.util.toDateString(d.createTime, "yyyy-MM-dd");
},
},
];
init();
function init() {
getChartData();
getTableData();
refreshTime();
}
function stopRefreshTime() {
clearTimeout(myRefreshTimeOut);
}
function refreshTime() {
if (intervalsTime == 0) {
stopRefreshTime();
}
var nowTime = new Date().getTime();
if (nowTime > refreshNextTime) {
refreshNextTime = nowTime + parseInt(intervalsTime);
getChartData();
getTableData();
if (intervalsTime > 0) {
refreshTime();
}
} else {
if (intervalsTime > 0) {
myRefreshTimeOut = window.setTimeout(function () {
refreshTime();
}, intervalsTime);
}
}
}
function getChartData() {
var responseTimeOptions = {
xAxisData: ["100", "200", "50", "300", "100", "100", "200", "50", "300", "100"],
seriesData: [100, 200, 50, 300, 100, 100, 200, 50, 300, 100],
}; //api 请求数据
renderWavypolylineChart(responseTimeOptions);
}
function renderWavypolylineChart({ xAxisData, seriesData }) {
var option = {
xAxis: {
type: "category",
boundaryGap: false,
name: "响应时长/ms",
nameLocation: "end",
data: xAxisData,
axisLine: {
lineStyle: {
color: "#454b5026",
},
},
splitLine: {
show: true,
lineStyle: {
color: ["#454b5026"],
width: 1,
type: "solid",
},
},
},
yAxis: {
type: "value",
name: "请求个数",
nameLocation: "end",
axisLine: {
lineStyle: {
color: "#454b5026",
},
},
splitLine: {
show: true,
lineStyle: {
color: ["#454b5026"],
width: 1,
type: "solid",
},
},
},
textStyle: {
color: "#a5aaaf",
},
series: [
{
data: seriesData,
type: "line",
showBackground: false,
symbol: "none", //去掉折线图中的节点
smooth: true,
areaStyle: {
normal: {
color: {
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "#1289ff4d"
},
{
offset: 0.7,
color: "rgba(255, 255, 255, 1)", // 100% 处的颜色
},
],
globalCoord: false, // 缺省为 false
},
},
},
itemStyle: {
normal: {
color: "#1289ff",
},
},
},
],
};
wavypolylineChart.setOption(option);
}
function getTableData() {
var tableRenderOptions = {
elem: "#" + LIST_TABLE_ID,
data: LIST_TABLE_DATA,
even: "false",
defaultToolbar: [],
page: false,
cols: [LIST_TABLE_COLS],
where: where,
};
table.render(tableRenderOptions);
laypage.render({
elem: "pages",
count: 100,
layout: ["count", "prev", "page", "next", "limit", "refresh", "skip"],
jump: function (obj) {
console.log(obj);
},
});
}
});

File diff suppressed because one or more lines are too long

@ -0,0 +1,92 @@
var where = {};
var FORM_QUERY_ID = "lay-form-submit"; // form seach ElementId
layui.use(["index", "api"], function () {
var $ = layui.$,
table = layui.table,
element = layui.element;
// clipboard1
var btn = document.getElementById('btn');
var clipboard1 = new ClipboardJS(btn)
clipboard1.on('success', function (e) {
console.log('clipboard2 success:', e);
});
clipboard1.on('error', function (e) {
console.log('clipboard2 error:', e);
});
// clipboard2
var btns = document.querySelectorAll('button');
var clipboard2 = new ClipboardJS(btns);
clipboard2.on('success', function (e) {
console.log('clipboard2 success:', e);
});
clipboard2.on('error', function (e) {
console.log('clipboard2 error:', e);
});
// clipboard3
var clipboard3 = new ClipboardJS('.selector-constructor');
clipboard3.on('success', function (e) {
console.log('clipboard3 success:', e);
});
clipboard3.on('error', function (e) {
console.log('clipboard3 success:', e);
});
// clipboard4
var clipboard4 = new ClipboardJS('.target-btn', {
target: function () {
return document.querySelector('.target-text');
}
});
clipboard4.on('success', function (e) {
console.log('clipboard4 success:', e);
});
clipboard4.on('error', function (e) {
console.log('clipboard4 success:', e);
});
// clipboard5
var clipboard5 = new ClipboardJS('.text-btn', {
text: function () {
return 'to be or not to be';
}
});
clipboard5.on('success', function (e) {
console.log('clipboard5 success:', e);
});
clipboard5.on('error', function (e) {
console.log('clipboard5 success:', e);
});
// clipboard6
var clipboard6 = new ClipboardJS('.div-btn');
clipboard6.on('success', function (e) {
console.log('clipboard6 success:', e);
});
clipboard6.on('error', function (e) {
console.log('clipboard6 success:', e);
});
// clipboard7
var clipboard7 = new ClipboardJS('.target-input-btn');
clipboard7.on('success', function (e) {
console.log('clipboard7 success:', e);
});
clipboard7.on('error', function (e) {
console.log('clipboard7 success:', e);
});
// clipboard8
var clipboard8 = new ClipboardJS('.target-textarea-btn');
clipboard8.on('success', function (e) {
console.log('clipboard8 success:', e);
});
clipboard8.on('error', function (e) {
console.log('clipboard8 success:', e);
});
});

@ -0,0 +1,62 @@
layui.use(["layer", "element"], function () {
var $ = layui.$,
layer = layui.layer,
element = layui.element;
$(".right-fold-box .unfold").on("click", function () {
window.parent.leftMenuChange();
});
});
//显示 tips <span data-tips="编辑" onmouseover="showToolTips(this)"></span>
function showToolTips(t) {
var row = layui.$(t).attr("data-tips");
layer.tips(row, t, { tips: 1, time: 2000 });
}
//假如 500px px2rem(500) 3.125rem
function px2rem(pxVal) {
return (pxVal * 0.8375) / 134 + 'rem';
}
//暴力关闭所有弹窗
function cancelDialog() {
layer.closeAll();
}
//rem resize 改变的是iframe 中页面的html font-size
!function (win, doc) {
var d = doc.documentElement;
//300为左侧宽度
function change() {
d.style.fontSize = (d.clientWidth + 300) / 10 + 'px';
}
win.addEventListener('resize', change, false);
change();
}(window, document);
//部分区域全屏
function partFullScreen(buttonClass, fuuareaId) {
var fullarea = document.getElementById(fuuareaId);
var buttonEle = layui.$('.' + buttonClass);
var fullscreen = parseInt(buttonEle.attr('data-screen'));
if (fullscreen) { // 退出全屏
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
buttonEle.attr('data-screen', '0').html('全屏');
} else { // 进入全屏
if (fullarea.requestFullscreen) {
fullarea.requestFullscreen();
} else if (fullarea.webkitRequestFullScreen) {
fullarea.webkitRequestFullScreen();
} else if (fullarea.mozRequestFullScreen) {
fullarea.mozRequestFullScreen();
} else if (fullarea.msRequestFullscreen) {
fullarea.msRequestFullscreen();
} else {
console.log('不支持全屏');
}
buttonEle.attr('data-screen', '1').html('退出');
}
}

@ -0,0 +1,156 @@
layui.use(["index", "api", "tpl", "dialog", "laypage"], function () {
var $ = layui.$,
table = layui.table,
element = layui.element,
form = layui.form,
admin = layui.admin,
laypage = layui.laypage;
var LIST_TABLE_URL = layui.api.getMockApiUrl("detail", "list");
var DELETE_TABLE_URL = layui.api.getMockApiUrl("detail", "detail");
var where = {};
var FORM_QUERY_ID = "lay-form-submit"; // form seach ElementId
var LIST_TABLE_ID = "listTable"; // table ElementId
var DETAIL_TABLE_ID = "detailTable";
var LIST_TABLE_COLS = [{
field: "id",
title: "id",
align: "left",
hide: true
}, {
field: "name",
title: "源库",
align: "left"
}, {
field: "ip",
title: "源库对象名",
align: "left"
}, {
field: "port",
title: "目标库",
align: "left"
}, {
field: "sid",
title: "目标库对象名",
align: "left"
}, {
fixed: "right",
title: "操作",
width: 150,
align: "left",
toolbar: "#cellOperating"
}];
var DETAIL_TABLE_COLS = [{
field: "id",
title: "id",
align: "left",
hide: true
}, {
field: "name",
title: "源库列名",
align: "left"
}, {
field: "ip",
title: "类型",
align: "left"
}, {
field: "port",
title: "目标库列",
align: "left"
}, {
field: "sid",
title: "类型",
align: "left"
}];
init();
form.on("submit(" + FORM_QUERY_ID + ")", function (data) {
console.log("查询:", data.field);
getTableData();
}); //单元格 操作列中 操作事件
table.on("tool(" + LIST_TABLE_ID + ")", function (obj) {
var data = obj.data;
var layEvent = obj.event;
if (layEvent === "detail") {
detailDialog(data);
}
});
function init() {
getDetail();
getSetting();
getTableData();
}
function getDetail() {
//api 请求得到结果
var data = { id: '5cb92069c3492', name: 'CRM->SCRM[FUL' };
var html = `
<li><span>任务ID : ${data.id}</span><span> : ${data.name}</span></li>
<li><span>读节点 : ${data.id}</span><span> : ${data.name}</span></li>
<li><span>创建者 : ${data.id}</span><span> : ${data.name}</span></li>
<li><span>更新者 : ${data.id}</span><span> : ${data.name}</span></li>
<li><span>状态 : ${data.id}</span><span> : ${data.name}</span></li>
<li><span>源库类型 : ${data.id}</span><span> : ${data.name}</span></li>
<li><span>源库端口 : ${data.id}</span><span> : ${data.name}</span></li>
<li><span>源库账号 : ${data.id}</span><span> : ${data.name}</span></li>
<li><span>已发送数据位点 : ${data.id}</span><span> : ${data.name}</span></li>
`
$('.detail-content').html(html);
}
function getSetting() {
//api 请求得到结果
layui.tpl.setPlainTextTpl("settingId", { title: '同步方式设置2 :结构初始化 + 全量数据初始化+增量数据' })
}
function getTableData() {
var tableRenderOptions = {
height: 300,
id: LIST_TABLE_ID,
elem: "#" + LIST_TABLE_ID,
url: LIST_TABLE_URL,
even: "false",
defaultToolbar: [],
page: false,
cols: [LIST_TABLE_COLS],
where: where
};
table.render(tableRenderOptions);
}
function detailDialog(data) {
console.log('查看列:', data);
var templet = $("#tableDialogTemplate").html();
layui.laytpl(templet).render({}, function (html) {
layer.open({
type: 1,
title: "节点任务详情",
content: templet,
area: ["520px", "640px"],
success: function success() {
//请求api
var tableRenderOptions = {
height: 300,
id: DETAIL_TABLE_ID,
elem: "#" + DETAIL_TABLE_ID,
url: DELETE_TABLE_URL,
even: "false",
defaultToolbar: [],
page: false,
cols: [DETAIL_TABLE_COLS],
where: {}
};
table.render(tableRenderOptions);
}
});
});
}
});

@ -0,0 +1,125 @@
layui.use(["index", "api", "tpl", "dialog"], function () {
var $ = layui.$,
table = layui.table,
element = layui.element,
form = layui.form,
laypage = layui.laypage,
admin = layui.admin;
$('#demo1').on('click', function (e) {
e.stopPropagation();
layui.dialog.setIframeDialog("iframe", {
src: "https://www.layui.com/",
otherconfigStyle:
'scrolling="no" frameborder=0',
});
});
$('#demo2').on('click', function (e) {
e.stopPropagation();
layui.dialog.showOkMsgDialog({ msg: "this is ok!" });
});
$('#demo3').on('click', function (e) {
e.stopPropagation();
layui.dialog.setQrCodeDialog("qrcode", "生成二维码", {
value: 'https://www.layui.com/',
});
});
$('#demo4').on('click', function (e) {
e.stopPropagation();
addDialog();
});
$('#demo5').on('click', function (e) {
e.stopPropagation();
var data = { name: '我是编辑好的名称', type: 1 };
editDialog(data);
});
function addDialog() {
var templet = $('#formDialogTemplate').html()
layui.laytpl(templet).render({}, function (html) {
layer.open({
type: 1,
title: '创建',
content: templet,
area: [px2rem(520), px2rem(600)],
btn: ['取消', '确认'],
btnAlign: 'r',
yes: function (index, layero) {
layer.close(index)
return false
},
btn2: function (index, layero) {
var submit = $('#LAY-dialog-submit')
var submitID = 'lay-dialog-submit'
form.on('submit(' + submitID + ')', function (data) {
var field = data.field //获取提交的字段
console.log('表单 field:', field);
var ADD_URL = '';
admin.req({
url: ADD_URL,
data: field,
success: function (res) {
layer.close(index);
layer.msg('成功');
},
error: function (res) {
layer.msg('失败');
return false;
}
})
layer.close(index); //关闭弹层
})
submit.trigger('click')
return false
},
success: function success() {
layui.form.render('')
}
})
})
}
function editDialog(data) {
var templet = $('#formDialogTemplate').html()
layui.laytpl(templet).render({}, function (html) {
layer.open({
type: 1,
title: '编辑',
content: templet,
area: [px2rem(520), px2rem(600)],
btn: ['取消', '确认'],
btnAlign: 'r',
yes: function (index, layero) {
layer.close(index)
return false
},
btn2: function (index, layero) {
var submit = $('#LAY-dialog-submit')
var submitID = 'lay-dialog-submit'
form.on('submit(' + submitID + ')', function (data) {
var field = data.field //获取提交的字段
console.log('表单 field:', field);
var UPDATE_URL = "";
admin.req({
url: UPDATE_URL,
data: field,
success: function (res) {
layer.close(index);
layer.msg('成功');
},
error: function (res) {
layer.msg('失败');
return false;
}
})
layer.close(index) //关闭弹层
})
submit.trigger('click')
return false
},
success: function success() {
form.val('dialogForm', data)
layui.form.render('')
}
})
})
}
});

File diff suppressed because one or more lines are too long

@ -0,0 +1,192 @@
layui.use(["index", "api", "tpl", "dialog", "laypage", 'dynamicTr'], function () {
var $ = layui.$,
table = layui.table,
element = layui.element,
form = layui.form,
admin = layui.admin,
laypage = layui.laypage;
var LIST_TABLE_URL = layui.api.getMockApiUrl("edittable", "list");
var List_TABLE_ADD_URL = layui.api.getMockApiUrl(
"edittable",
"insert"
);
var LIST_TABLE_UPDATE_URL = layui.api.getMockApiUrl(
"edittable",
"update"
);
var LIST_TABLE_DELETE_URL = layui.api.getMockApiUrl(
"edittable",
"delete"
);
var where = {
data: "",
};
var FORM_QUERY_ID = "lay-form-submit"; // form seach ElementId
var LIST_TABLE_ID = "listTable"; // table ElementId
// table field 配置
var LIST_TABLE_COLS = [{
field: "id",
title: "id",
align: "left",
hide: true,
},
{
field: "groupName",
title: "分组名称",
align: "left",
// edit:"text"
},
{
field: "remark",
title: "备注",
align: "left",
// edit:"text"
},
{
fixed: "right",
title: "操作",
width: 88,
align: "left",
toolbar: "#cellOperating",
},
];
var isEdit = false;
init(); // 创建
$(".add-dialog").click(function (e) {
e.stopPropagation();
if (isEdit) {
layer.msg("有一个在编辑");
return false;
}
isEdit = true;
$("tbody").before(layui.dynamicTr.addTr(LIST_TABLE_COLS));
form.render();
});
//单元格 操作列中 操作事件
table.on("tool(" + LIST_TABLE_ID + ")", function (obj) {
var data = obj.data;
var layEvent = obj.event;
debugger;
if (layEvent === "add") {
var addField = layui.dynamicTr.addFormFiled(LIST_TABLE_COLS);
if (!addField) {
return false;
}
admin.req({
url: List_TABLE_ADD_URL,
data: addField,
success: function (res) {
layer.msg("新增成功");
isEdit = false;
layui.table.reload(LIST_TABLE_ID, { where: where });
},
});
} else if (layEvent === "save") {
var editField = layui.dynamicTr.editFormFiled(LIST_TABLE_COLS, data);
if (!editField) {
return false;
}
admin.req({
url: LIST_TABLE_UPDATE_URL,
data: editField,
success: function (res) {
layer.msg("编辑成功");
layui.table.reload(LIST_TABLE_ID, { where: where });
// obj.update(editField);
isEdit = false;
},
});
} else if (layEvent === "cancel") {
layui.table.reload(LIST_TABLE_ID, { where: where });
isEdit = false;
} else if (layEvent === "edit") {
if (isEdit) {
layer.msg("有一个在编辑");
return false;
}
var target = $(obj.tr);
$(target).html(layui.dynamicTr.editTr(LIST_TABLE_COLS, data));
isEdit = false;
} else if (layEvent === "delete") {
layer.confirm(
"", {
title: "提示",
area: ["520px", "270px"],
content: '<div style="margin: 50px auto;">确定删除分组吗?</div>',
btnAlign: "r",
btn: ["取消", "确认"],
},
function (index, layero) {
layer.close(index);
},
function (index) {
admin.req({
url: LIST_TABLE_DELETE_URL,
data: { data: obj.data },
success: function (res) {
if (res) {
obj.del();
layer.close(index);
} else {
layui.dialog.showOkMsgDialog({
msg: "无法删除,请先清空组内数据源和节点信息。",
});
return false;
}
},
});
}
);
}
});
function init() {
getTableData();
}
function getTableData() {
var tableRenderOptions = {
height: 600,
id: LIST_TABLE_ID,
elem: "#" + LIST_TABLE_ID,
url: LIST_TABLE_URL,
even: "false",
defaultToolbar: [],
page: false,
cols: [LIST_TABLE_COLS],
where: where,
parseData: function (res) {
return {
code: 0,
msg: "",
//count: res.totalSize,
data: res.data,
};
},
};
table.render(tableRenderOptions);
// laypage.render({
// elem: "pages",
// count: 100,
// layout: ["count", "prev", "page", "next", "limit", "refresh", "skip"],
// jump: function jump(obj) {
// }
// });
// admin.req({
// url: LIST_TABLE_URL,
// data: where,
// success: function (res) {
// tableRenderOptions.data = res;
// table.render(tableRenderOptions);
// },
// error:function(err){
// table.render(tableRenderOptions);
// }
// });
}
});

@ -0,0 +1,125 @@
layui.config({
base: './../../static/layui/layui_exts/'
}).use(['table', 'excel'], function () {
var table = layui.table //表格
,
$ = layui.$,
excel = layui.excel;
var LIST_TABLE_ID = "listTable"; // table ElementId
$(".export-button").click(function (e) {
exportFile('listTable');
});
//执行一个 table 实例
table.render({
elem: '#listTable',
height: 420,
data: [{ id: 1, username: '小毛', city: '长沙', birth: '1990-06-16', createTime: '2020-01-01', remark: '备注' }],
// url: './data.json', //数据接口
title: '用户表',
page: true, //开启分页
toolbar: '#toolbarDemo', //操作1:启用自定义模板表格头部工具栏
defaultToolbar: [], //操作2:隐藏头部工具栏右侧的图标
cols: [
[ //表头
{
type: 'checkbox',
fixed: 'left'
}, {
field: 'id',
title: 'ID',
width: 200,
sort: true
}, {
field: 'username',
title: '用户名',
width: 100
}, {
field: 'city',
title: '城市',
width: 100
}, {
field: 'birth',
title: '生日',
width: 120,
sort: true,
totalRow: true
}, {
field: 'createTime',
title: '创建日期',
width: 180
}, {
field: 'remark',
title: '备注',
width: 300
}
]
]
});
//监听头工具栏事件
table.on('toolbar(test)', function (obj) {
var checkStatus = table.checkStatus(obj.config.id),
data = checkStatus.data; //获取选中的数据
switch (obj.event) {
case 'table_export':
exportFile('demo')
break;
};
});
/**
* by yutons
* Array.from() 非常方便的将一个类数组的集合 == 数组直接使用数组身上的方法例如常用的mapforeach
* 但是问题来了IE不识别Array.from这个方法所以写了它兼容IE的写法
*/
if (!Array.from) {
Array.from = function (el) {
return Array.apply(this, el);
}
}
//表格导出
function exportFile(id) {
//根据传入tableID获取表头
var headers = $("div[lay-id=" + id + "] .layui-table-box table").get(0);
var htrs = Array.from(headers.querySelectorAll('tr'));
var titles = {};
for (var j = 0; j < htrs.length; j++) {
var hths = Array.from(htrs[j].querySelectorAll("th"));
for (var i = 0; i < hths.length; i++) {
var clazz = hths[i].getAttributeNode('class').value;
if (clazz != ' layui-table-col-special' && clazz != 'layui-hide') {
//排除居左、具有、隐藏字段
//修改:默认字段data-field+i,兼容部分数据表格中不存在data-field值的问题
titles['data-field' + i] = hths[i].innerText;
}
}
}
//根据传入tableID获取table内容
var bodys = $("div[lay-id=" + id + "] .layui-table-box table").get(1);
var btrs = Array.from(bodys.querySelectorAll("tr"))
var bodysArr = new Array();
for (var j = 0; j < btrs.length; j++) {
var contents = {};
var btds = Array.from(btrs[j].querySelectorAll("td"));
for (var i = 0; i < btds.length; i++) {
for (var key in titles) {
//修改:默认字段data-field+i,兼容部分数据表格中不存在data-field值的问题
var field = 'data-field' + i;
if (field === key) {
//根据表头字段获取table内容字段
contents[field] = btds[i].innerText;
}
}
}
bodysArr.push(contents)
}
//将标题行置顶添加到数组
bodysArr.unshift(titles);
//导出excel
excel.exportExcel({
sheet1: bodysArr
}, '表' + new Date().toLocaleString() + '.xlsx', 'xlsx');
}
});

@ -0,0 +1,80 @@
layui.config({
base: './../../static/layui/layui_exts/'
}).use(['table', 'excel'], function () {
var table = layui.table //表格
,
$ = layui.$,
excel = layui.excel;
$('#LAY-excel-import-excel').change(function (e) {
// 注意:这里直接引用 e.target.files 会导致 FileList 对象在读取之前变化,导致无法弹出文件
var files = Object.values(e.target.files)
uploadExcel(files)
// 变更完清空,否则选择同一个文件不触发此事件
e.target.value = ''
})
// 文件拖拽
document.body.ondragover = function (e) {
e.preventDefault()
}
document.body.ondrop = function (e) {
e.preventDefault()
var files = e.dataTransfer.files
uploadExcel(files)
}
if (!Array.from) {
Array.from = function (el) {
return Array.apply(this, el);
}
}
/**
* 上传excel的处理函数传入文件对象数组
* @param {FileList} files [description]
* @return {[type]} [description]
*/
function uploadExcel(files) {
try {
excel.importExcel(files, {
// 可以在读取数据的同时梳理数据
/*fields: {
'id': 'A'
, 'username': 'B'
, 'experience': 'C'
, 'sex': 'D'
, 'score': 'E'
, 'city': 'F'
, 'classify': 'G'
, 'wealth': 'H'
, 'sign': 'I'
}*/
}, function (data, book) {
// data: {1: {sheet1: [{id: 1, name: 2}, {...}]}}// 工作表的数据对象
// book: {1: {Sheets: {}, Props: {}, ....}} // 工作表的整个原生对象https://github.com/SheetJS/js-xlsx#workbook-object
// 也可以全部读取出来再进行数据梳理
/* data = excel.filterImportData(data, {
'id': 'A'
, 'username': 'B'
, 'experience': 'C'
, 'sex': 'D'
, 'score': 'E'
, 'city': 'F'
, 'classify': 'G'
, 'wealth': 'H'
, 'sign': 'I'
})*/
// 如果不需要展示直接上传,可以再次 $.ajax() 将JSON数据通过 JSON.stringify() 处理后传递到后端即可
/**
* 2019-06-21 JeffreyWang 应群友需求加一个单元格合并还原转换
* 思路
* 1. 渲染时为每个cell加上唯一的IDdemo里边采用 table-export-文件索引-sheet名称-行索引-列索引
* 2. 根据 book[文件索引].Sheets[sheet名称]['!merge'] 参数取左上角元素设置 colspan 以及 rowspan并删除其他元素
*/
console.log(data, book);
})
} catch (e) {
layer.alert(e.message)
}
}
});

@ -0,0 +1,97 @@
layui.use(['form', 'layedit', 'tpl', 'laydate'], function () {
var form = layui.form
, layer = layui.layer
, layedit = layui.layedit
, laydate = layui.laydate;
var where = {};
var FORM_QUERY_ID = "lay-form-submit"; // form seach ElementId
init();
form.on(`submit(${FORM_QUERY_ID})`, function (data) {
console.log("查询:", data.field);
table.reload(LIST_TABLE_ID, { where });
});
function init() {
getSelectData();
}
function getSelectData() {
var data = { list: [] };
var res = [
{ name: "1111", value: "1111" },
{ name: "2222", value: "2222" },
];
var list = [{ name: "请选择", value: "" }];
for (var item in res) {
var selected = false;
list.push({
name: res[item].name,
value: res[item].value,
selected: selected,
});
}
data.list = list;
layui.tpl.setSelectTpl("testIdSelect", data);
}
//日期
laydate.render({
elem: '#date'
});
laydate.render({
elem: '#date1'
});
//创建一个编辑器
var editIndex = layedit.build('LAY_demo_editor');
//自定义验证规则
form.verify({
title: function (value) {
if (value.length < 5) {
return '标题至少得5个字符啊';
}
}
, pass: [
/^[\S]{6,12}$/
, '密码必须6到12位且不能出现空格'
]
, content: function (value) {
layedit.sync(editIndex);
}
});
//监听指定开关
form.on('switch(switchTest)', function (data) {
layer.msg('开关checked' + (this.checked ? 'true' : 'false'), {
offset: '6px'
});
layer.tips('温馨提示请注意开关状态的文字可以随意定义而不仅仅是ON|OFF', data.othis)
});
//监听提交
form.on('submit(demo1)', function (data) {
layer.alert(JSON.stringify(data.field), {
title: '最终的提交信息'
})
return false;
});
//表单赋值
layui.$('#LAY-component-form-setval').on('click', function () {
form.val('example', {
"username": "贤心" // "name": "value"
, "password": "123456"
, "interest": 1
, "like[write]": true //复选框选中状态
, "close": true //开关状态
, "sex": "女"
, "desc": "我爱 layui"
});
});
//表单取值
layui.$('#LAY-component-form-getval').on('click', function () {
var data = form.val('example');
alert(JSON.stringify(data));
});
});

@ -0,0 +1,81 @@
!function (win, doc) {
var d = doc.documentElement;
function change() {
d.style.fontSize = d.clientWidth / 10 + 'px';
}
win.addEventListener('resize', change, false);
change();
}(window, document);
layui.use(["layer", "element"], function () {
var $ = layui.$,
layer = layui.layer,
element = layui.element; $(".main-tree .left-menu").on("click", function (e) {
e.stopPropagation();
var src = $(this).attr("lay-href");
var title = $(this).attr("lay-title");
$('.left-menu').removeClass("layui-this");
$(this).addClass("layui-this");
iframeToHref(src);
});
$(".left-fold-box").on("click", function (e) {
e.stopPropagation();
$(".left-side").hide();
$(".layui-body").addClass("left-0").removeClass("left-230");
var iframe = document.getElementById('iframe');
var innerDoc = (iframe.contentDocument)
? iframe.contentDocument
: iframe.contentWindow.document;
innerDoc.querySelector("#rightFold > .logo").classList.remove('display-none');
innerDoc.querySelector("#rightFold > .unfold").classList.remove('display-none');
});
$(".right-fold-box .back-url").on("click", function () {
if ($(this).attr("lay-href")) {
iframeToHref($(this).attr("lay-href"));
}
});
// 子菜单展开收缩
$(".menu-box").on('click', ".open-icon", function (e) {
e.stopPropagation();
$(this).removeClass('open-icon');
$(this).addClass('close-icon');
$(this).parent().siblings().addClass("display-none");
});
$(".menu-box").on('click', ".close-icon", function (e) {
e.stopPropagation();
$(this).removeClass('close-icon');
$(this).addClass('open-icon');
$(this).parent().siblings().removeClass("display-none");
});
var leftMenuChange = function () {
var iframe = document.getElementById('iframe');
var innerDoc = (iframe.contentDocument)
? iframe.contentDocument
: iframe.contentWindow.document;
innerDoc.querySelector("#rightFold > .logo").classList.add('display-none');
innerDoc.querySelector("#rightFold > .unfold").classList.add('display-none');
$(".layui-body").addClass("left-230").removeClass("left-0");
$(".left-side").show();
}
var rightMenuChange = function () {
var iframe = document.getElementById('iframe');
var innerDoc = (iframe.contentDocument)
? iframe.contentDocument
: iframe.contentWindow.document;
innerDoc.querySelector("#rightFold > .logo").classList.remove('display-none');
innerDoc.querySelector("#rightFold > .unfold").classList.remove('display-none');
$(".layui-body").removeClass("left-230").addClass("left-0");
$(".left-side").hide();
}
var iframeToHref = function (url) {
var iframe = document.getElementById("iframe");
iframe.src = url;
};
var routerPush = function ({ url, breadcrumb }) {
iframeToHref(url);
};
window.routerPush = routerPush;
window.leftMenuChange = leftMenuChange;
window.rightMenuChange = rightMenuChange;
});

@ -0,0 +1,294 @@
layui.use(["index", "api", "tpl"], function () {
var $ = layui.$,
table = layui.table,
element = layui.element,
form = layui.form,
laypage = layui.laypage,
admin = layui.admin;
var sourceTitle = "";
var selectSourceNode = { id: "", name: "" };
var targetNodeId = [];
var selectTargetNode = [];
var unSelectTargetNodeId = "";
var LIST_TABLE_ID = "listTable"; // table ElementId
var LIST_TABLE_DATA = [
{
name: "层MySQL密码格式检查",
content: "检查数据传输服务器是否能连通源数据库",
tips: "查数据传输服务器失败",
status: "1",
},
{
name: "层MySQL密码格式检查",
content: "检查数据传输服务器是否能连通源数据库",
tips: "查数据传输服务器失败",
status: "2",
},
{
name: "层MySQL密码格式检查",
content: "检查数据传输服务器是否能连通源数据库",
tips: "查数据传输服务器失败",
status: "1",
},
{
name: "层MySQL密码格式检查",
content: "检查数据传输服务器是否能连通源数据库",
tips: "查数据传输服务器失败",
status: "2",
},
{
name: "层MySQL密码格式检查",
content: "检查数据传输服务器是否能连通源数据库",
tips: "查数据传输服务器失败",
status: "1",
},
];
// table field 配置
var LIST_TABLE_COLS = [
{
field: "name",
title: "检查项",
align: "left",
},
{
field: "content",
title: "检查内容",
align: "left",
},
{
field: "tips",
title: "消息提醒",
align: "left",
},
{
field: "status",
title: "检查结果",
align: "left",
templet: function templet(d) {
if (d.status == "1") {
return "<span class='status-success'>成功</span>";
} else if (d.status == "2") {
return `<div class="status-fail-box"><span class="status-fail">失败</span><i class="fail-icon" onmouseover="showToolTips(this)" data-tips="${d.tips}"></i></div>`;
}
return "";
},
},
];
//step1
form.on("submit(lay-step1-submit)", function (data) {
console.log("step1", data.field);
element.progress("progress", "50%");
$($(".step-ul").children()[1]).addClass("active");
sourceTitle = "sales_order"; //获取了源码名称
$(".source-title").html(sourceTitle);
getSourceNodeLIst();
$(".step-2")
.removeClass("display-none")
.siblings()
.addClass("display-none");
});
//step2
form.on("submit(lay-step2-pre-submit)", function (data) {
console.log("step1", data.field);
element.progress("progress", "25%");
$($(".step-ul").children()[0]).addClass("active");
$($(".step-ul").children()[1]).removeClass("active");
$(".step-1")
.removeClass("display-none")
.siblings()
.addClass("display-none");
});
form.on("submit(lay-step2-next-submit)", function () {
element.progress("progress", "75%");
$($(".step-ul").children()[2]).addClass("active");
$(".step-3")
.removeClass("display-none")
.siblings()
.addClass("display-none");
});
$(".source-tree-list").on("click", ".tree-node", function (e) {
e.stopPropagation();
selectSourceNode.id = $(this).attr("data-id");
selectSourceNode.name = $(this).attr("data-name");
console.log("tree-node selectSourceNode:", selectSourceNode);
$(this).addClass("active").siblings().removeClass("active");
});
$(".opr-box .icon-next").on("click", function () {
if (selectSourceNode.name == "") {
layer.msg("请选择源对象");
return false;
}
if (targetNodeId.includes(selectSourceNode.id)) {
layer.msg("已选择");
return false;
}
changeTargetNode();
});
$(".opr-box .icon-pre").on("click", function () {
console.log("icon-pre");
if (unSelectTargetNodeId == "") {
layer.msg("请选择目标对象");
return false;
}
resetTargetNodes(unSelectTargetNodeId);
});
$(".target-tree-list").on("click", ".tree-node", function () {
console.log(".target-tree-list .tree-node", $(this).attr("data-id"));
$(this).addClass("active").siblings().removeClass("active");
unSelectTargetNodeId = $(this).attr("data-id");
});
function changeTargetNode() {
targetNodeId.push(selectSourceNode.id);
totalNodes();
selectTargetNode.push({
id: selectSourceNode.id,
name: selectSourceNode.name,
});
var ddHtml = `<dd class="tree-node" data-id="${selectSourceNode.id}" data-name="${selectSourceNode.name}"><i class="rw3"></i><span>${selectSourceNode.name}</span><span
class="edit">编辑</span></dd>`;
$(".target-tree-list").append(ddHtml);
}
function totalNodes() {
$(".total-nodes").html(`${targetNodeId.length}个对象)`);
}
function getSourceNodeLIst() {
targetNodeId = [];
var data = [
{ id: "1", name: "sales_orderpromotion1" },
{ id: "2", name: "sales_orderpromotion2" },
{ id: "3", name: "sales_orderpromotion3" },
];
var html = "";
data.forEach((element) => {
html += `<dd class="tree-node" data-id="${element.id}" data-name="${element.name}"><i class="rw3"></i><span>${element.name}</span></dd>
`;
});
$(".source-tree-list").html(html);
}
function resetTargetNodes(selectId) {
var html = "";
var newSelectNode = [];
targetNodeId = [];
selectTargetNode.forEach((element) => {
if (element.id != selectId) {
html += `<dd class="tree-node" data-id="${element.id}" data-name="${element.name}"><i class="rw3"></i><span>${element.name}</span><span
class="edit">编辑</span></dd>`;
targetNodeId.push(element.id);
newSelectNode.push({ id: element.id, name: element.name });
}
});
$(".target-tree-list").html(html);
selectTargetNode = newSelectNode;
totalNodes();
unSelectTargetNodeId = "";
}
$(".target-tree-list").on("click", ".edit", function (e) {
e.stopPropagation();
editDialog({ id: $(this).parent().attr('data-id'), name: $(this).parent().attr('data-name') });
});
function editDialog({ id, name }) {
console.log('editDialog:id,name:', id, name);
var templet = $("#formDialogTemplate").html();
layui.laytpl(templet).render({}, function (html) {
layer.open({
type: 1,
title: "编辑表",
content: templet,
area: ["620px", "640px"],
success: function success() {
table.render({
elem: "#editTable",
data: [
{ id: 1, col: "acount_money", type: "decimal(11,2)" },
{ id: 1, col: "acount_money", type: "decimal(11,2)" },
],
defaultToolbar: [],
toolbar: "#toolbarDemo",
title: "用户数据表",
cols: [
[
{ type: "checkbox", width: 20 },
{ field: "id", title: "ID", hide: true },
{ field: "col", title: "列名", width: 250, edit: "text" },
{ field: "type", title: "类型", width: 250, edit: "text" },
],
],
page: false,
});
},
});
});
}
table.on("toolbar(editTable)", function (obj) {
var checkStatus = table.checkStatus(obj.config.id);
if (obj.event == "getCheckData") {
var data = checkStatus.data;
if (data.length == 0) {
layer.msg('请选择列');
return false;
}
// admin.req({
// url: url,
// data: params,
// success: function (res) {
// layer.msg('成功');
// },
// });
layer.close(layer.index);
}
});
//step3
form.on("submit(lay-step3-pre-submit)", function () {
element.progress("progress", "50%");
$($(".step-ul").children()[1]).addClass("active");
$($(".step-ul").children()[2]).removeClass("active");
$(".step-2")
.removeClass("display-none")
.siblings()
.addClass("display-none");
});
form.on("submit(lay-step3-next-submit)", function () {
element.progress("progress", "100%");
$($(".step-ul").children()[3]).addClass("active");
$(".active-after").addClass("display-none");
$(".step-4")
.removeClass("display-none")
.siblings()
.addClass("display-none");
getTableData();
});
//step4
function getTableData() {
var where = {};
var tableRenderOptions = {
height: 600,
id: LIST_TABLE_ID,
elem: "#" + LIST_TABLE_ID,
data: LIST_TABLE_DATA,
// url: LIST_TABLE_URL,
even: "false",
defaultToolbar: [],
page: false,
cols: [LIST_TABLE_COLS],
where: where,
parseData: function (res) {
return {
code: 0,
msg: "",
//count: res.totalSize,
data: res,
};
},
/* done: function (res, curr, count) {
loadPage(curr, count);
},*/
};
table.render(tableRenderOptions);
}
});

@ -0,0 +1,125 @@
layui.use(["index", "api", "tpl", "dialog", "laypage"], function () {
var $ = layui.$,
table = layui.table,
element = layui.element,
form = layui.form,
admin = layui.admin,
laypage = layui.laypage;
var LIST_TABLE_URL = layui.api.getApiUrl("app", "list");
var DELETE_TABLE_URL = layui.api.getApiUrl("app", "remove");
var where = {};
var FORM_QUERY_ID = "lay-form-submit"; // form seach ElementId
var LIST_TABLE_ID = "listTable"; // table ElementId
var LIST_TABLE_DATA = [
{ id: 1, name: "我的名字", remark: "我是一个备注" },
{ id: 2, name: "我的名字", remark: "我是一个备注" },
{ id: 3, name: "我的名字", remark: "我是一个备注" },
{ id: 4, name: "我的名字", remark: "我是一个备注" },
{ id: 5, name: "我的名字", remark: "我是一个备注" },
{ id: 6, name: "我的名字", remark: "我是一个备注" },
{ id: 7, name: "我的名字", remark: "我是一个备注" },
{ id: 8, name: "我的名字", remark: "我是一个备注" },
{ id: 9, name: "我的名字", remark: "我是一个备注" },
{ id: 10, name: "我的名字", remark: "我是一个备注" },
];
// table field 配置
var LIST_TABLE_COLS = [
{
field: "id",
title: "id",
align: "center",
hide: true,
},
{
field: "name",
title: "分组名称",
align: "center",
},
{
field: "remark",
title: "备注",
align: "center",
},
{
fixed: "right",
title: "操作",
width: 150,
align: "center",
toolbar: "#cellOperating",
},
];
init();
// 创建
$(".add-dialog").click(function (e) {
e.stopPropagation();
addDialog();
});
//单元格 操作列中 操作事件
table.on(`tool(${LIST_TABLE_ID})`, function (obj) {
var data = obj.data;
var layEvent = obj.event;
if (layEvent === "edit") {
editDialog(data);
} else if (layEvent === "delete") {
layer.confirm("",
{
title: "提示",
area: ["520px", "270px"],
content: '<div style="margin: 50px auto;">确定删除该数据源吗?</div>',
btnAlign: 'r',
btn: ['取消', '确认']
}, function (index, layero) {
layer.close(index);
}, function (index) {
console.log("按钮【按钮二】的回调");
layui.dialog.showOkMsgDialog({ msg: "该数据源存在同步任务,不能删除!" });
return false;
}
);
}
});
function init() {
getTableData();
}
function getTableData() {
var tableRenderOptions = {
height: 600,
id: LIST_TABLE_ID,
elem: "#" + LIST_TABLE_ID,
data: LIST_TABLE_DATA,
even: "false",
defaultToolbar: [],
page: false,
cols: [LIST_TABLE_COLS],
where: where,
};
table.render(tableRenderOptions);
laypage.render({
elem: "pages",
count: 100,
layout: ["count", "prev", "page", "next", "limit", "refresh", "skip"],
jump: function (obj) {
console.log(obj);
},
});
// admin.req({
// url: LIST_TABLE_URL,
// data: where,
// success: function (res) {
// tableRenderOptions.data = res;
// table.render(tableRenderOptions);
// console.log('success:',res);
// },
// error:function(err){
// console.log('error:',err);
// table.render(tableRenderOptions);
// }
// });
}
});

@ -0,0 +1,268 @@
layui.use(["api", "tpl", "dialog", "laypage"], function () {
var $ = layui.$,
table = layui.table,
element = layui.element,
form = layui.form,
admin = layui.admin,
laypage = layui.laypage;
var LIST_TABLE_URL = layui.api.getMockApiUrl("index", "list"); //查询url
var where = {};
var FORM_QUERY_ID = "lay-form-submit"; // form seach ElementId
var LIST_TABLE_ID = "listTable"; // table ElementId
// table field 配置
var LIST_TABLE_COLS = [{
field: "id",
title: "id",
align: "center",
},
{
field: "name",
title: "名称",
align: "center",
},
{
field: "createTime",
title: "创建时间",
align: "center",
templet: function (d) {
return layui.util.toDateString(d.createTime, "yyyy-MM-dd");
},
},
{
field: "fz",
title: "所属分组",
align: "center",
sort: true,
templet: function (d) {
if (d.fz == "1") {
return "类型1";
} else if (d.fz == "2") {
return "类型2";
} else if (d.fz == "3") {
return "类型3";
}
return "";
},
},
{
field: "type",
title: "类型",
align: "center",
sort: true,
templet: function (d) {
if (d.type == "1") {
return "类型1";
} else if (d.type == "2") {
return "类型2";
} else if (d.type == "3") {
return "类型3";
}
return "";
},
},
{
fixed: "right",
title: "操作",
width: 120,
align: "center",
toolbar: "#cellOperating",
},
];
init();
$(".add-dialog").click(function (e) {
e.stopPropagation();
addDialog();
});
$(".part-full-screen").click(function (e) {
e.stopPropagation();
partFullScreen('part-full-screen', 'fulldiv');
});
$(".full-screen").click(function (e) {
e.stopPropagation();
var fullScreen = parseInt($(this).attr('data-screen'));
if (fullScreen) {
admin.exitScreen();
$(this).attr('data-screen', '0').html('整页全屏');
} else {
admin.fullScreen();
$(this).attr('data-screen', '1').html("退出整页全屏");
}
});
// 重置
$(".reset-btn").click(function (e) {
e.stopPropagation();
//重置where
return false;
});
form.on(`submit(${FORM_QUERY_ID})`, function (data) {
console.log("查询:", data.field);
table.reload(LIST_TABLE_ID, { where });
});
//单元格 操作列中 操作事件
table.on(`tool(${LIST_TABLE_ID})`, function (obj) {
//阻止冒泡
var evt = window.event || arguments.callee.caller.arguments[0]; // 获取event对象
layui.stope(evt);
var data = obj.data;
var layEvent = obj.event;
if (layEvent === "delete") {
layer.confirm(
"", {
title: "提示",
area: ["520px", "270px"],
content: '<div style="margin: 50px auto;">确定删除该数据吗?</div>',
btnAlign: "r",
btn: ["取消", "确认"],
},
function (index, layero) {
layer.close(index);
},
function (index) {
layui.dialog.showOkMsgDialog({ msg: "该数据存在,不能删除!" });
return false;
}
);
} else if (layEvent === "edit") {
$(".tips-box").remove();
editDialog(data);
}
});
function init() {
getSelectData();
getTableData();
}
function getTableData() {
var tableRenderOptions = {
height: 800,
elem: "#" + LIST_TABLE_ID,
url: LIST_TABLE_URL,
even: "false",
defaultToolbar: [],
page: false,
cols: [LIST_TABLE_COLS],
where: {},
};
console.log("tableRenderOptions:", tableRenderOptions);
table.render(tableRenderOptions);
laypage.render({
elem: "pages",
count: 100,
layout: ["count", "prev", "page", "next", "limit", "refresh", "skip"],
jump: function (obj) {
// console.log(obj);
},
});
}
function addDialog() {
var templet = $("#formDialogTemplate").html();
layui.laytpl(templet).render({}, function (html) {
layer.open({
type: 1,
title: "新增",
content: templet,
area: [px2rem(520), px2rem(600)],
btn: ["取消", "确认"],
btnAlign: "r",
yes: function (index, layero) {
layer.close(index);
return false;
},
btn2: function (index, layero) {
var submit = $("#LAY-dialog-submit");
var submitID = "lay-dialog-submit";
form.on("submit(" + submitID + ")", function (data) {
var params = data.field; //获取提交的字段
// admin.req({
// url: ADD_URL,
// data: params,
// success: function (res) {
table.reload(LIST_TABLE_ID, { where: where });
layer.msg("新增成功");
layer.close(index);
// },
// });
});
submit.trigger("click");
return false;
},
success: function success() {
layui.form.render("");
}
});
});
}
function editDialog(data) {
var templet = $("#formDialogTemplate").html();
layui.laytpl(templet).render({}, function (html) {
layer.open({
type: 1,
title: "编辑",
content: templet,
area: [px2rem(520), px2rem(600)],
btn: ["取消", "确认"],
btnAlign: "r",
yes: function (index, layero) {
layer.close(index);
return false;
},
btn2: function (index, layero) {
var submit = $("#LAY-dialog-submit");
var submitID = "lay-dialog-submit";
form.on("submit(" + submitID + ")", function (data) {
var params = data.field;
// admin.req({
// url: UPDATE_URL,
// data: params,
// success: function (res) {
layui.table.reload(LIST_TABLE_ID, { where: where });
layer.close(index); //关闭弹层
layer.msg("成功");
// },
// });
});
submit.trigger("click");
return false;
},
success: function success() {
data.name = "这个名字我就是要固定不改";
form.val("dialogForm", data);
layui.form.render("");
},
});
});
}
function getSelectData() {
var data = { list: [] };
var res = [
{ name: "1111", value: "1111" },
{ name: "2222", value: "2222" },
];
var list = [{ name: "请选择", value: "" }];
for (var item in res) {
var selected = false;
list.push({
name: res[item].name,
value: res[item].value,
selected: selected,
});
}
data.list = list;
layui.tpl.setSelectTpl("testIdSelect", data);
}
});

@ -0,0 +1,17 @@
function formatDuring(mss) {
var days = parseInt(mss / (1000 * 60 * 60 * 24));
var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = parseInt((mss % (1000 * 60 * 60)) / (1000 * 60));
var seconds = (mss % (1000 * 60)) / 1000;
var returnStr = "";
if (days > 0) {
returnStr += days + "天";
}
if (hours > 0) {
returnStr += hours + "小时";
}
if (minutes > 0) {
returnStr += minutes + "分钟";
}
return returnStr + seconds + "秒";
}

@ -0,0 +1,9 @@
/**
* 全部配置静态资源所在路径
*/
const GLOBAL_CONFIG_BASE_URL = './../../res/js/';
layui.config({
base: `${GLOBAL_CONFIG_BASE_URL}` //静态资源所在路径
}).extend({
index: 'lib/index', //主入口模块
})

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,2 @@
/** layui-v2.5.6 MIT License By https://www.layui.com */
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}

@ -0,0 +1,496 @@
/** layui-v2.5.6 MIT License By https://www.layui.com */
.laydate-set-ym,
.layui-laydate,
.layui-laydate *,
.layui-laydate-list {
box-sizing: border-box
}
html #layuicss-laydate {
display: none;
position: absolute;
width: 1989px
}
.layui-laydate * {
margin: 0;
padding: 0
}
.layui-laydate {
position: absolute;
z-index: 66666666;
margin: 5px 0;
border-radius: 2px;
font-size: 14px;
-webkit-animation-duration: .3s;
animation-duration: .3s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation-name: laydate-upbit;
animation-name: laydate-upbit
}
.layui-laydate-main {
width: 272px
}
.layui-laydate-content td,
.layui-laydate-header *,
.layui-laydate-list li {
transition-duration: .3s;
-webkit-transition-duration: .3s
}
@-webkit-keyframes laydate-upbit {
from {
-webkit-transform: translate3d(0, 20px, 0);
opacity: .3
}
to {
-webkit-transform: translate3d(0, 0, 0);
opacity: 1
}
}
@keyframes laydate-upbit {
from {
transform: translate3d(0, 20px, 0);
opacity: .3
}
to {
transform: translate3d(0, 0, 0);
opacity: 1
}
}
.layui-laydate-static {
position: relative;
z-index: 0;
display: inline-block;
margin: 0;
-webkit-animation: none;
animation: none
}
.laydate-ym-show .laydate-next-m,
.laydate-ym-show .laydate-prev-m {
display: none!important
}
.laydate-ym-show .laydate-next-y,
.laydate-ym-show .laydate-prev-y {
display: inline-block!important
}
.laydate-time-show .laydate-set-ym span[lay-type=month],
.laydate-time-show .laydate-set-ym span[lay-type=year],
.laydate-time-show .layui-laydate-header .layui-icon,
.laydate-ym-show .laydate-set-ym span[lay-type=month] {
display: none!important
}
.layui-laydate-header {
position: relative;
line-height: 30px;
padding: 10px 70px 5px
}
.laydate-set-ym span,
.layui-laydate-header i {
padding: 0 5px;
cursor: pointer
}
.layui-laydate-header * {
display: inline-block;
vertical-align: bottom
}
.layui-laydate-header i {
position: absolute;
top: 10px;
color: #999;
font-size: 18px
}
.layui-laydate-header i.laydate-prev-y {
left: 15px
}
.layui-laydate-header i.laydate-prev-m {
left: 45px
}
.layui-laydate-header i.laydate-next-y {
right: 15px
}
.layui-laydate-header i.laydate-next-m {
right: 45px
}
.laydate-set-ym {
width: 100%;
text-align: center;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap
}
.laydate-time-text {
cursor: default!important
}
.layui-laydate-content {
position: relative;
padding: 10px;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none
}
.layui-laydate-content table {
border-collapse: collapse;
border-spacing: 0
}
.layui-laydate-content td,
.layui-laydate-content th {
width: 36px;
height: 30px;
padding: 5px;
text-align: center
}
.layui-laydate-content td {
position: relative;
cursor: pointer
}
.laydate-day-mark {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
line-height: 30px;
font-size: 12px;
overflow: hidden
}
.laydate-day-mark::after {
position: absolute;
content: '';
right: 2px;
top: 2px;
width: 5px;
height: 5px;
border-radius: 50%
}
.layui-laydate-footer {
position: relative;
height: 46px;
line-height: 26px;
padding: 10px 20px
}
.layui-laydate-footer span {
margin-right: 15px;
display: inline-block;
cursor: pointer;
font-size: 12px
}
.layui-laydate-footer span:hover {
color: #5FB878
}
.laydate-footer-btns {
position: absolute;
right: 10px;
top: 10px
}
.laydate-footer-btns span {
height: 26px;
line-height: 26px;
margin: 0 0 0 -1px;
padding: 0 10px;
border: 1px solid #C9C9C9;
background-color: #fff;
white-space: nowrap;
vertical-align: top;
border-radius: 2px
}
.layui-laydate-list>li,
.layui-laydate-range .layui-laydate-main {
display: inline-block;
vertical-align: middle
}
.layui-laydate-list {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
padding: 10px;
background-color: #fff
}
.layui-laydate-list>li {
position: relative;
width: 33.3%;
height: 36px;
line-height: 36px;
margin: 3px 0;
text-align: center;
cursor: pointer
}
.laydate-month-list>li {
width: 25%;
margin: 17px 0
}
.laydate-time-list>li {
height: 100%;
margin: 0;
line-height: normal;
cursor: default
}
.laydate-time-list p {
position: relative;
top: -4px;
line-height: 29px
}
.laydate-time-list ol {
height: 181px;
overflow: hidden
}
.laydate-time-list>li:hover ol {
overflow-y: auto
}
.laydate-time-list ol li {
width: 130%;
padding-left: 33px;
line-height: 30px;
text-align: left;
cursor: pointer
}
.layui-laydate-hint {
position: absolute;
top: 115px;
left: 50%;
width: 250px;
margin-left: -125px;
line-height: 20px;
padding: 15px;
text-align: center;
font-size: 12px
}
.layui-laydate-range {
width: 546px
}
.layui-laydate-range .laydate-main-list-0 .laydate-next-m,
.layui-laydate-range .laydate-main-list-0 .laydate-next-y,
.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,
.layui-laydate-range .laydate-main-list-1 .laydate-prev-y {
display: none
}
.layui-laydate-range .laydate-main-list-1 .layui-laydate-content {
border-left: 1px solid #e2e2e2
}
.layui-laydate,
.layui-laydate-hint {
border: 1px solid #d2d2d2;
box-shadow: 0 2px 4px rgba(0, 0, 0, .12);
background-color: #fff;
color: #666
}
.layui-laydate-header {
border-bottom: 1px solid #e2e2e2
}
.layui-laydate-header i:hover,
.layui-laydate-header span:hover {
color: #5FB878
}
.layui-laydate-content {
border-top: none 0;
border-bottom: none 0
}
.layui-laydate-content th {
font-weight: 400;
color: #333
}
.layui-laydate-content td {
color: #666
}
.layui-laydate-content td.laydate-selected {
background-color: #00F7DE
}
.laydate-selected:hover {
background-color: #00F7DE!important
}
.layui-laydate-content td:hover,
.layui-laydate-list li:hover {
background-color: #eaeaea;
color: #333
}
.laydate-time-list li ol {
margin: 0;
padding: 0;
border: 1px solid #e2e2e2;
border-left-width: 0
}
.laydate-time-list li:first-child ol {
border-left-width: 1px
}
.laydate-time-list>li:hover {
background: 0 0
}
.layui-laydate-content .laydate-day-next,
.layui-laydate-content .laydate-day-prev {
color: #d2d2d2
}
.laydate-selected.laydate-day-next,
.laydate-selected.laydate-day-prev {
background-color: #f8f8f8!important
}
.layui-laydate-footer {
border-top: 1px solid #e2e2e2
}
.layui-laydate-hint {
color: #FF5722
}
.laydate-day-mark::after {
background-color: #5FB878
}
.layui-laydate-content td.layui-this .laydate-day-mark::after {
display: none
}
.layui-laydate-footer span[lay-type=date] {
color: #5FB878
}
.layui-laydate .layui-this {
background-color: #009688;
color: #fff!
}
.layui-laydate .laydate-disabled,
.layui-laydate .laydate-disabled:hover {
background: 0 0!important;
color: #d2d2d2!important;
cursor: not-allowed!important;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none
}
.laydate-theme-molv {
border: none
}
.laydate-theme-molv.layui-laydate-range {
width: 548px
}
.laydate-theme-molv .layui-laydate-main {
width: 274px
}
.laydate-theme-molv .layui-laydate-header {
border: none;
background-color: #009688
}
.laydate-theme-molv .layui-laydate-header i,
.laydate-theme-molv .layui-laydate-header span {
color: #f6f6f6
}
.laydate-theme-molv .layui-laydate-header i:hover,
.laydate-theme-molv .layui-laydate-header span:hover {
color: #fff
}
.laydate-theme-molv .layui-laydate-content {
border: 1px solid #e2e2e2;
border-top: none;
border-bottom: none
}
.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content {
border-left: none
}
.laydate-theme-grid .laydate-month-list>li,
.laydate-theme-grid .laydate-year-list>li,
.laydate-theme-grid .layui-laydate-content td,
.laydate-theme-grid .layui-laydate-content thead,
.laydate-theme-molv .layui-laydate-footer {
border: 1px solid #e2e2e2
}
.laydate-theme-grid .laydate-selected,
.laydate-theme-grid .laydate-selected:hover {
background-color: #f2f2f2!important;
color: #009688!important
}
.laydate-theme-grid .laydate-selected.laydate-day-next,
.laydate-theme-grid .laydate-selected.laydate-day-prev {
color: #d2d2d2!important
}
.laydate-theme-grid .laydate-month-list,
.laydate-theme-grid .laydate-year-list {
margin: 1px 0 0 1px
}
.laydate-theme-grid .laydate-month-list>li,
.laydate-theme-grid .laydate-year-list>li {
margin: 0 -1px -1px 0
}
.laydate-theme-grid .laydate-year-list>li {
height: 43px;
line-height: 43px
}
.laydate-theme-grid .laydate-month-list>li {
height: 71px;
line-height: 71px
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 299 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save