提交 f7786068 编写于 作者: H hjdhnx

加了个没啥用的功能

上级 03c9be83
...@@ -3,15 +3,17 @@ ...@@ -3,15 +3,17 @@
# File : layui.py # File : layui.py
# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------ # Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
# Date : 2022/9/14 # Date : 2022/9/14
import ujson
from flask import Blueprint,request,render_template,jsonify,make_response,redirect from flask import Blueprint,request,render_template,jsonify,make_response,redirect
from utils.ua import UA
from utils.web import getParmas,get_interval,layuiBack,verfy_token from utils.web import getParmas,get_interval,layuiBack,verfy_token
from utils.cfg import cfg from utils.cfg import cfg
from controllers.service import storage_service,rules_service from controllers.service import storage_service,rules_service
from utils.system import getHost from utils.system import getHost
from utils.files import getCustonDict,custom_merge from utils.files import getCustonDict,custom_merge
from utils.encode import parseText from utils.encode import parseText
from js.rules import getRules,getPys from js.rules import getRules,getPys,getJxs
from operator import itemgetter, attrgetter from operator import itemgetter, attrgetter
import functools import functools
...@@ -28,6 +30,13 @@ def layui_index(): # put application's code here ...@@ -28,6 +30,13 @@ def layui_index(): # put application's code here
return render_template('login.html') return render_template('login.html')
return render_template('layui_list.html') return render_template('layui_list.html')
@layui.route('/jxs')
def layui_jxs(): # put application's code here
# return render_template('layui_index.html')
if not verfy_token():
return render_template('login.html')
return render_template('layui_jxs.html')
@layui.route('/api/list') @layui.route('/api/list')
def layui_rule_list(): def layui_rule_list():
page = int(getParmas('page',1)) page = int(getParmas('page',1))
...@@ -105,3 +114,37 @@ def layui_rule_list(): ...@@ -105,3 +114,37 @@ def layui_rule_list():
new_sites = sites[(page-1)*limit:page*limit] new_sites = sites[(page-1)*limit:page*limit]
# print(new_sites) # print(new_sites)
return layuiBack('获取成功',new_sites,count=len(sites)) return layuiBack('获取成功',new_sites,count=len(sites))
@layui.route('/api/jx_list')
def layui_jx_list():
# 拖拽排序教程 https://blog.csdn.net/qq_41829337/article/details/126610406
host = request.host_url # 获取当前访问链接对应的host
page = int(getParmas('page',1))
limit = int(getParmas('limit',10))
new_conf = cfg
lsg = storage_service()
store_conf_dict = lsg.getStoreConfDict()
new_conf.update(store_conf_dict)
ali_token = new_conf.ALI_TOKEN
xr_mode = new_conf.XR_MODE
js0_password = new_conf.JS0_PASSWORD
js_mode = int(new_conf.JS_MODE or 0)
customConfig = getCustonDict(host, ali_token, js0_password)
jxs = getJxs(host=host)
rules = {'list': [{"key": "dr_MXONE", "name": "MXONE(道长)", "type": 1, "api": "{{host}}/vod?{% if js0_password %}pwd={{js0_password}}&{% endif %}rule=MXONE&ext=txt/js/tg/MXONE.js", "searchable": 2, "quickSearch": 0, "filterable": 0},
], 'count': 1}
html = render_template('config.txt', js0_password=js0_password, UA=UA, xr_mode=xr_mode, ISTVB=False, pys=[],
rules=rules, host=host, mode=2, js_mode=js_mode, jxs=jxs, alists=[],
alists_str='', live_url='', config=new_conf)
merged_config = custom_merge(parseText(html), customConfig)
parses = merged_config['parses']
# print(parses)
for i in range(len(parses)):
if not parses[i].get('header'):
parses[i]['header'] = {'User-Agent': 'Mozilla/5.0'}
if isinstance(parses[i].get('header'),dict):
parses[i]['header'] = ujson.dumps(parses[i]['header'],ensure_ascii=False)
if isinstance(parses[i].get('ext'),dict):
parses[i]['ext'] = ujson.dumps(parses[i]['ext'],ensure_ascii=False)
new_parses = parses[(page - 1) * limit:page * limit]
return layuiBack('获取成功', new_parses, count=len(parses))
\ No newline at end of file
3.9.18beta5 3.9.18beta6
\ No newline at end of file \ No newline at end of file
此差异已折叠。
/** 自定义字体 **/
/** 这里使用在线字体,如果需要离线包,请看 font/README.md **/
@font-face {
font-family: 'soul-icon'; /* project id 677836 */
src: url('//at.alicdn.com/t/font_677836_jwq362m0tt.eot');
src: url('//at.alicdn.com/t/font_677836_jwq362m0tt.eot?#iefix') format('embedded-opentype'),
url('//at.alicdn.com/t/font_677836_jwq362m0tt.woff2') format('woff2'),
url('//at.alicdn.com/t/font_677836_jwq362m0tt.woff') format('woff'),
url('//at.alicdn.com/t/font_677836_jwq362m0tt.ttf') format('truetype'),
url('//at.alicdn.com/t/font_677836_jwq362m0tt.svg#iconfont') format('svg');
}
.soul-icon {
font-family:"soul-icon" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.soul-icon-filter:before { content: "\e60b"; }
.soul-icon-filter-asc:before { content: "\e768"; }
.soul-icon-filter-desc:before { content: "\e767"; }
.soul-icon-asc:before { content: "\e6af"; }
.soul-icon-desc:before { content: "\e6ae"; }
.soul-icon-all-check:before { content: "\e670"; }
.soul-icon-invert-check:before { content: "\e614"; }
.soul-icon-fold:before { content: "\e760"; }
.soul-icon-unfold:before { content: "\e611"; }
.soul-icon-delete:before { content: "\e600"; }
.soul-icon-download:before { content: "\e601"; }
.soul-icon-drop-list:before { content: "\e6a3"; }
.soul-icon-query:before { content: "\e66d"; }
/* 全选*/
.soul-icon-quanxuan:before { content: "\e623"; }
.soul-icon-qingkong:before { content: "\e63e"; }
.soul-icon-autoColumnWidth
:before { content: "\e614"; }
/*最大化*/
.soul-icon-min:before { content: "\e656"; }
.soul-icon-max:before { content: "\e61b"; }
/* 配色方案*/
.layui-red {
color: #FF5722
}
.layui-orange {
color: #FFB800
}
.layui-green {
color: #009688
}
.layui-cyan {
color: #2F4056
}
.layui-blue {
color: #1E9FFF
}
.layui-black {
color: #393D49
}
.layui-gray {
color: #eee
}
.layui-firebrick {
color: firebrick;
}
.layui-deeppink {
color: deeppink;
}
.layui-blueviolet {
color: blueviolet;
}
.soul-condition [class*="layui-col-"] {
margin-top: 10px;
}
/* 表格排序样式*/
.soul-edge {
display: inline-block;
width: 0;
height: 0;
border-width: 6px;
border-style: dashed;
border-color: transparent;
overflow: hidden
}
.soul-table-sort {
width: 10px;
height: 20px;
margin-left: 5px;
cursor: pointer !important;
position: relative;
display: inline-block;
}
.soul-table-sort .soul-edge {
position: absolute;
left: 5px;
border-width: 5px
}
.soul-table-sort .soul-table-sort-asc {
top: 10px;
border-top: none;
border-bottom-style: solid;
border-bottom-color: #b2b2b2
}
.soul-table-sort .soul-table-sort-asc:hover {
border-bottom-color: #666
}
.soul-table-sort .soul-table-sort-desc {
bottom: -2px;
border-bottom: none;
border-top-style: solid;
border-top-color: #b2b2b2
}
.soul-table-sort .soul-table-sort-desc:hover {
border-top-color: #666
}
.soul-table-sort[soul-sort=asc] .soul-table-sort-asc {
border-bottom-color: #000
}
.soul-table-sort[soul-sort=desc] .soul-table-sort-desc {
border-top-color: #000
}
.multiOption {
display: inline-block;
padding: 0 5px;
cursor: pointer;
color: #999;
}
/*表格筛选*/
.soul-table-filter {
line-height: 20px;
color: #b2b2b2;
cursor: pointer;
margin-left: 5px;
}
.soul-table-filter .soul-icon-filter-asc,.soul-table-filter .soul-icon-filter-desc {
display: none;
}
.soul-table-filter[lay-sort="asc"] .soul-icon-filter-asc{
display: block;
color: #000000;
}
.soul-table-filter[lay-sort="asc"] .soul-icon-filter,.soul-table-filter[lay-sort="asc"] .soul-icon-filter-desc{
display: none;
}
.soul-table-filter[lay-sort="desc"] .soul-icon-filter-desc{
display: block;
color: #000000;
}
.soul-table-filter[lay-sort="desc"] .soul-icon-filter,.soul-table-filter[lay-sort="desc"] .soul-icon-filter-asc{
display: none;
}
.soul-table-filter[soul-filter="true"] i {
color: #009688!important;
}
[id^=main-list], [id^=soul-columns], [id^=soul-dropList], [id^=soul-condition], [id^=soul-bf-prefix], [id^=soul-bf-column], [id^=soul-bf-type], [id^=soul-bf-cond2] {
display: inline-block;
position: absolute;
z-index: 2147483647;
background-color: white;
max-height: 200px;
min-width: 160px;
max-width: 300px;
overflow-y: auto;
border: 1px solid #e6e6e6;
border-radius: 5px;
box-shadow: 2px 2px 4px -2px rgba(0,0,0,.2);
}
[id^=main-list] {
max-height: initial;
}
[id^=soul-condition] {
overflow-y: visible;
max-height: initial;
min-width: 285px;
padding: 5px;
}
[id^=soul-condition] .layui-laydate-header {
padding: 4px 70px 5px
}
[id^=soul-condition] hr{
margin: 5px 0;
}
[id^=soul-condition].soul-bf{
min-width: 150px;
}
[id^=soul-filter-list] ul li {
padding: 3px 10px;
cursor: pointer;
}
[id^=soul-filter-list] ul li:hover {
background-color: deepskyblue;
}
[id^=soul-filter-list] i.layui-icon {
display: inline-block;
width: 16px;
}
[id^=soul-dropList] ul {
border: 0;
max-height: 116px;
overflow-y: auto;
}
[id^=soul-dropList] ul li, [id^=soul-filter-list] [id^=soul-columns]>li{
padding: 2px 10px;
}
[id^=soul-dropList] .check {
padding: 5px 10px;
}
.filter-search {
padding: 5px 10px 0 10px;
}
[id^=soul-condition] .layui-inline {
width: 100px;
}
[id^=soul-condition] table.condition-table tr>td {
padding: 0 3px;
}
[id^=soul-condition] table.condition-table tr>td:first-child {
min-width: 60px;
}
[id^=soul-condition] .layui-form-switch {
background-color: #1E9FFF;
border: 1px solid #1E9FFF;
width: 35px;
margin-top: 0px;
}
[id^=soul-condition] .layui-form-switch.layui-form-onswitch {
background-color: #5FB878;
border: 1px solid #5FB878;
}
[id^=soul-condition] .layui-form-switch em {
color: #fff!important;
}
[id^=soul-condition] .layui-form-switch i {
background-color: #fff;
}
[data-type^=date][class$=Condition] {
width: 273px;
}
/*表格筛选*/
[id^=soul-condition]>div{
width: 270px;
}
.soul-condition-title {
text-align: center;
font-weight: bolder;
}
/*底部筛选*/
.soul-bottom-contion {
height: 31px;
/*line-height: 29px;*/
border-top: solid 1px #e6e6e6;
}
.soul-bottom-contion .condition-items {
display: inline-block;
width: calc(100vw - 100px);
height: 30px;
float: left;
overflow: hidden;
white-space: nowrap;
}
.soul-bottom-contion .condition-item>div {
display: inline-block;
height: 28px;
line-height: 28px;
cursor: pointer;
}
.soul-bottom-contion .condition-items .condition-item>div[class^='item-']:hover{
text-decoration: underline;
}
.soul-bottom-contion .condition-items .condition-item{
padding: 0 10px;
margin: 0 2px;
font-weight: bold;
border: solid 1px darkslateblue;
border-radius: 10px;
display: inline-block;
height: 28px;
position: relative;
}
.soul-bottom-contion .editCondtion {
height: 30px;
float: right;
}
.soul-bottom-contion .item-value {
min-width: 20px;
display: inline-block;
}
.soul-bottom-contion .editCondtion a {
border: hidden;
border-left: solid 1px #e6e6e6;
height: 28px;
line-height: 29px;
}
.soul-bottom-contion .condition-items .condition-item .condition-item-close {
position: absolute;
cursor: pointer;
margin-top: -8px;
}
.soul-bottom-contion .condition-items>.condition-item>.condition-item-close {
margin-top: -2px;
}
.soul-bottom-contion .condition-items .condition-item .condition-item-close:hover{
color: red
}
.soul-bottom-contion .condition-items .condition-item .condition-item-close:before {
background: white;
border-radius: 10px;
}
.soul-edit-out {
padding: 10px;
}
[id^=soul-bf] li {
padding: 0px 10px;
height: 22px;
line-height: 22px;
color: #000;
cursor: pointer;
}
[id^=soul-bf] li.soul-bf-selected {
background-color: deepskyblue;
}
[id^=soul-bf] li:hover {
background-color: deepskyblue;
}
.soul-edit-out .tempValue {
height: 25px;
}
.soul-bf-condition-value {
display: inline;
width: 100px;
}
/*子表格*/
.layui-table tbody tr.noHover:hover {
background-color: white;
}
/*编辑筛选*/
.soul-edit-out .layui-form-radio {
margin: 0;
}
.soul-edit-out ul li > div {
display: inline-block;
margin-right: 10px;
height: 25px;
vertical-align: top;
cursor: pointer;
}
.soul-edit-out ul.group {
padding-left: 50px;
}
.soul-edit-out ul.group.line {
border-left: 1px dashed grey;
}
.soul-edit-out ul li {
line-height: 25px;
}
.soul-edit-out table {
display: inline-block;
}
.soul-edit-out table td[data-type='top'] {
width: 12px;
height: 12px;
border-left: dashed 1px grey;
border-bottom: dashed 1px grey;
}
.soul-edit-out table td[data-type='bottom'] {
width: 12px;
height: 12px;
border-left: dashed 1px grey;
}
.soul-edit-out li.last>div>table td[data-type='bottom'] {
border-left: none;
}
.soul-edit-out .layui-form-switch {
background-color: #1E9FFF;
border: 1px solid #1E9FFF;
width: 35px;
margin-top: 0px;
}
.soul-edit-out .layui-form-switch em {
color: #fff!important;
}
.soul-edit-out .layui-form-switch i {
background-color: #fff;
}
.soul-edit-out .layui-form-switch.layui-form-onswitch {
background-color: #5FB878;
border: 1px solid #5FB878;
}
.soul-edit-out .delete-item {
display: none;
}
.soul-edit-out li:hover>.delete-item {
display: inline-block;
}
/* 拖拽相关 */
#column-remove {
position: absolute;
z-index: 2147483647;
}
.layui-table-box.no-left-border td.isDrag, .layui-table-box.no-left-border th.isDrag {
border-left: inherit!important;
}
.soul-drag-bar {
position: absolute;
top: 100px;
z-index: 200;
left: 50%;
font-weight: 900;
color: white;
box-shadow: 0 1px 20px rgba(0,0,0,.15);
text-align: center;
transform: translateX(100vw);
/*transition: transform .3s;*/
}
.soul-drag-bar.active {
transform: translateX(-98px);
}
.soul-drag-bar > div {
display: inline-block;
padding: 10px;
cursor: crosshair;
width: 62px;
background-color: rgba(0, 150, 136, 0.5);
}
.soul-drag-bar > div.active, .soul-drag-bar[data-type='left']>div[data-type='left'], .soul-drag-bar[data-type='right']>div[data-type='right'], .soul-drag-bar[data-type='none']>div[data-type='none'] {
background-color: rgb(0, 150, 136);
}
/* 动画 */
.animated {
-webkit-animation-duration: 1s;
-moz-animation-duration: 1s;
-o-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
-moz-animation-fill-mode: both;
-o-animation-fill-mode: both;
animation-fill-mode: both;
}
@-moz-keyframes fadeInLeft {
0% {
opacity: 0;
-moz-transform: translateX(-20px);
}
100% {
opacity: 1;
-moz-transform: translateX(0);
}
}
@-o-keyframes fadeInLeft {
0% {
opacity: 0;
-o-transform: translateX(-20px);
}
100% {
opacity: 1;
-o-transform: translateX(0);
}
}
@keyframes fadeInLeft {
0% {
opacity: 0;
transform: translateX(-20px);
}
100% {
opacity: 1;
transform: translateX(0);
}
}
.animated.fadeInLeft {
-webkit-animation-name: fadeInLeft;
-moz-animation-name: fadeInLeft;
-o-animation-name: fadeInLeft;
animation-name: fadeInLeft;
}
@-webkit-keyframes fadeOutLeft {
0% {
opacity: 1;
-webkit-transform: translateX(0);
}
100% {
opacity: 0;
-webkit-transform: translateX(-20px);
}
}
@-moz-keyframes fadeOutLeft {
0% {
opacity: 1;
-moz-transform: translateX(0);
}
100% {
opacity: 0;
-moz-transform: translateX(-20px);
}
}
@-o-keyframes fadeOutLeft {
0% {
opacity: 1;
-o-transform: translateX(0);
}
100% {
opacity: 0;
-o-transform: translateX(-20px);
}
}
@keyframes fadeOutLeft {
0% {
opacity: 1;
transform: translateX(0);
}
100% {
opacity: 0;
transform: translateX(-20px);
}
}
.animated.fadeOutLeft {
-webkit-animation-name: fadeOutLeft;
-moz-animation-name: fadeOutLeft;
-o-animation-name: fadeOutLeft;
animation-name: fadeOutLeft;
}
@-webkit-keyframes fadeInRight {
0% {
opacity: 0;
-webkit-transform: translateX(20px);
}
100% {
opacity: 1;
-webkit-transform: translateX(0);
}
}
@-moz-keyframes fadeInRight {
0% {
opacity: 0;
-moz-transform: translateX(20px);
}
100% {
opacity: 1;
-moz-transform: translateX(0);
}
}
@-o-keyframes fadeInRight {
0% {
opacity: 0;
-o-transform: translateX(20px);
}
100% {
opacity: 1;
-o-transform: translateX(0);
}
}
@keyframes fadeInRight {
0% {
opacity: 0;
transform: translateX(20px);
}
100% {
opacity: 1;
transform: translateX(0);
}
}
.animated.fadeInRight {
-webkit-animation-name: fadeInRight;
-moz-animation-name: fadeInRight;
-o-animation-name: fadeInRight;
animation-name: fadeInRight;
}
@-webkit-keyframes fadeInUp {
0% {
opacity: 0;
-webkit-transform: translateY(20px);
}
100% {
opacity: 1;
-webkit-transform: translateY(0);
}
}
@-moz-keyframes fadeInUp {
0% {
opacity: 0;
-moz-transform: translateY(20px);
}
100% {
opacity: 1;
-moz-transform: translateY(0);
}
}
@-o-keyframes fadeInUp {
0% {
opacity: 0;
-o-transform: translateY(20px);
}
100% {
opacity: 1;
-o-transform: translateY(0);
}
}
@keyframes fadeInUp {
0% {
opacity: 0;
transform: translateY(20px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
.animated.fadeInUp {
-webkit-animation-name: fadeInUp;
-moz-animation-name: fadeInUp;
-o-animation-name: fadeInUp;
animation-name: fadeInUp;
}
@-webkit-keyframes fadeOutDown {
0% {
opacity: 1;
-webkit-transform: translateY(0);
}
100% {
opacity: 0;
-webkit-transform: translateY(20px);
}
}
@-moz-keyframes fadeOutDown {
0% {
opacity: 1;
-moz-transform: translateY(0);
}
100% {
opacity: 0;
-moz-transform: translateY(20px);
}
}
@-o-keyframes fadeOutDown {
0% {
opacity: 1;
-o-transform: translateY(0);
}
100% {
opacity: 0;
-o-transform: translateY(20px);
}
}
@keyframes fadeOutDown {
0% {
opacity: 1;
transform: translateY(0);
}
100% {
opacity: 0;
transform: translateY(20px);
}
}
.animated.fadeOutDown {
-webkit-animation-name: fadeOutDown;
-moz-animation-name: fadeOutDown;
-o-animation-name: fadeOutDown;
animation-name: fadeOutDown;
}
#soul-table-contextmenu-wrapper {
width: 0;
}
.soul-table-contextmenu {
position: absolute;
z-index: 2147483647;
list-style: none;
margin: 0;
padding: 0;
border: 1px solid #ebeef5;
box-shadow: 2px 2px 4px -2px rgba(0,0,0,.2);
background: white;
}
.soul-table-contextmenu li {
line-height: 26px;
padding: 0 30px;
cursor: pointer;
word-break: keep-all;
}
.soul-table-contextmenu li:hover {
background: #c5c5c5;
}
.soul-table-contextmenu li i.prefixIcon{
position: absolute;
left: 8px;
}
.soul-table-contextmenu li i.endIcon{
position: absolute;
right: 8px;
}
/*拖拽相关*/
.layui-table-sort-invalid {
width: 10px;
height: 20px;
margin-left: 5px;
cursor: pointer!important;
}
.layui-table-sort-invalid .layui-table-sort-asc {
top: 3px;
border-top: none;
border-bottom-style: solid;
border-bottom-color: #b2b2b2;
}
.layui-table-sort-invalid .layui-edge {
position: absolute;
left: 5px;
border-width: 5px;
}
.layui-table-sort-invalid .layui-table-sort-desc {
bottom: 5px;
border-bottom: none;
border-top-style: solid;
border-top-color: #b2b2b2;
}
.layui-table-sort-invalid .layui-edge {
position: absolute;
left: 5px;
border-width: 5px;
}
.noselect {
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Chrome/Safari/Opera */
-khtml-user-select: none; /* Konqueror */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently */
}
/* 固定列滚动 */
.soul-fixed-scroll::-webkit-scrollbar{
display: none
}
.soul-fixed-scroll{
overflow-y: auto!important;
-ms-overflow-style:none;
overflow:-moz-scrollbars-none;
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
/**
*
* @name: 子表格扩展
* @author: yelog
* @link: https://github.com/yelog/layui-soul-table
* @license: MIT
* @version: v1.6.4
*/
layui.define(['table'], function (exports) {
var $ = layui.jquery;
// 封装方法
var mod = {
/**
* 渲染入口
* @param myTable
*/
render: function (myTable) {
var tableBox = $(myTable.elem).next().children('.layui-table-box'),
$main = $(tableBox.children('.layui-table-body').children('table').children('tbody').children('tr').toArray().reverse()),
$fixLeft = $(tableBox.children('.layui-table-fixed-l').children('.layui-table-body').children('table').children('tbody').children('tr').toArray().reverse()),
$fixRight = $(tableBox.children('.layui-table-fixed-r').children('.layui-table-body').children('table').children('tbody').children('tr').toArray().reverse()),
mergeRecord = {};
layui.each(myTable.cols, function (i1, item1) {
layui.each(item1, function (i2, item2) {
if (item2.merge && item2.field) {
var mergeField = [item2.field];
if (item2.merge !== true) {
if (typeof item2.merge === 'string') {
mergeField = [item2.merge]
} else {
mergeField = item2.merge
}
}
mergeRecord[myTable.index + '-' + i1 + '-' + i2] = {mergeField: mergeField, rowspan: 1}
}
})
})
$main.each(function (i) {
for (var item in mergeRecord) {
if (i === $main.length - 1 || isMaster(i, item)) {
var tdHeight = $(this).children('[data-key="' + item + '"]').outerHeight(), patchHeight = 0; // 获取td高度
if ($main.eq(i).data('index') === 0) {
patchHeight = 1
}
$(this).children('[data-key="' + item + '"]').attr('rowspan', mergeRecord[item].rowspan).css({
'position': 'static',
'height': tdHeight * mergeRecord[item].rowspan + patchHeight
}).children().css({
height: 'auto',
'white-space': 'normal',
'max-height': tdHeight * mergeRecord[item].rowspan + patchHeight - 10
});
$fixLeft.eq(i).children('[data-key="' + item + '"]').attr('rowspan', mergeRecord[item].rowspan).css({
'position': 'static',
'height': tdHeight * mergeRecord[item].rowspan + patchHeight
}).children().css({
height: 'auto',
'white-space': 'normal',
'max-height': tdHeight * mergeRecord[item].rowspan + patchHeight - 10
});
$fixRight.eq(i).children('[data-key="' + item + '"]').attr('rowspan', mergeRecord[item].rowspan).css({
'position': 'static',
'height': tdHeight * mergeRecord[item].rowspan + patchHeight
}).children().css({
height: 'auto',
'white-space': 'normal',
'max-height': tdHeight * mergeRecord[item].rowspan + patchHeight - 10
});
mergeRecord[item].rowspan = 1;
} else {
$(this).children('[data-key="' + item + '"]').remove();
$fixLeft.eq(i).children('[data-key="' + item + '"]').remove();
$fixRight.eq(i).children('[data-key="' + item + '"]').remove();
mergeRecord[item].rowspan += 1;
}
}
})
function isMaster(index, item) {
var mergeField = mergeRecord[item].mergeField;
var dataLength = layui.table.cache[myTable.id].length;
for (var i = 0; i < mergeField.length; i++) {
if (layui.table.cache[myTable.id][dataLength - 2 - index][mergeField[i]]
!== layui.table.cache[myTable.id][dataLength - 1 - index][mergeField[i]]) {
return true;
}
}
return false;
}
}
};
// 输出
exports('tableMerge', mod);
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>解析管理</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="/static/plugin/layui/css/layui.css">
<link rel="stylesheet" href="/static/plugin/layui/ext/soulTable/soulTable.css" media="all"/>
</head>
<body>
<table id="myTable" ></table>
<script type="text/html" id="toolbar">
<div>
<!-- <button class="layui-btn layui-btn-sm" lay-event="clearFilter">清除所有筛选条件</button>-->
<button class="layui-btn layui-btn-sm" lay-event="getData">获取当前页数据</button>
</div>
</script>
<script type="text/html" id="bar">
<a class="layui-btn layui-btn-xs" lay-event="set_top"></a>
<a class="layui-btn layui-btn-xs" lay-event="set_bottom"></a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"></a>
</script>
<script src="/static/plugin/layui/layui.js"></script>
<script>
// 自定义模块
layui.config({
base: '/static/plugin/layui/ext/', // 模块目录
version: 'v1.6.4'
}).extend({
soulTable: 'soulTable/soulTable',
tableChild: 'soulTable/tableChild',
tableMerge: 'soulTable/tableMerge',
tableFilter: 'soulTable/tableFilter',
excel: 'soulTable/excel',
});
layui.use(['form', 'table','soulTable'], function () {
var table = layui.table, soulTable = layui.soulTable;
soulTable.config({
rowDrag: true
});
// 后台分页
table.render({
elem: '#myTable'
,id: 'myTable'
,url: '/layui/api/jx_list'
,height: 1000
,toolbar: '#toolbar'
,page: true
,limit:100
,limits:[20,40,60,80,100,150,200,300,500]
,cols: [[
{type: 'checkbox', fixed: 'left'},
{field: 'name', title: '名称', width: 200, sort: true, filter: true},
{field: 'url', title: '接口', minWidth: 200, sort: true, filter: true},
{field: 'type', title: '类型', width: 100 , filter: true},
// {field: 'header', title: '请求头', width: 112, filter: {split:','}, sort:true},
{field: 'header', title: '请求头', width: 200, sort:true},
{field: 'ext', title: '扩展信息', minWidth: 200, sort:true},
{title: '操作', width: 156, fixed: 'right', templet: '#bar'}
]]
,done: function () {
soulTable.render(this)
}
});
// 工具栏事件
table.on('toolbar(myTable)', function(obj){
var id = obj.config.id;
console.log(id);
if (obj.event === 'clearFilter') {
// 清除所有筛选条件并重载表格
// 参数: tableId
soulTable.clearFilter('myTable')
}else if(obj.event === 'getData'){
var getData = table.getData(id);
console.log(getData);
layer.alert(layui.util.escape(JSON.stringify(getData)));
}
});
//触发单元格工具事件
table.on('tool(bar)', function(obj) { // 双击 toolDouble
console.log(obj);
if(obj.event === 'del'){
alert('删除...')
}
});
// }, null, 'define');
});
</script>
</body>
</html>
\ No newline at end of file
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
<button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="default-row"> <button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="default-row">
单行 单行
</button> </button>
<button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="jxs">
解析管理
</button>
</div> </div>
</script> </script>
...@@ -383,6 +386,9 @@ layui.use(['table', 'dropdown'], function(){ ...@@ -383,6 +386,9 @@ layui.use(['table', 'dropdown'], function(){
}); });
layer.msg('已设为单行'); layer.msg('已设为单行');
break; break;
case 'jxs':
location.href = 'jxs';
break;
case 'LAYTABLE_TIPS': case 'LAYTABLE_TIPS':
layer.alert('Table for layui-v'+ layui.v); layer.alert('Table for layui-v'+ layui.v);
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册