列表组件优化、下拉选框支持分组单选

feat/task1-c-wallet
gongfuxiang 2022-09-23 19:06:01 +08:00
parent ba42f1e8bb
commit b5bd929f21
26 changed files with 1757 additions and 183 deletions

View File

@ -381,6 +381,12 @@ class Common extends BaseController
$assign['page_size'] = $this->page_size;
$assign['page_html'] = $this->page_html;
$assign['page_url'] = $this->page_url;
// 是否开启打印和pdf导出、则引入组件
if((isset($this->form_table['base']['is_data_print']) && $this->form_table['base']['is_data_print'] == 1) || (isset($this->form_table['base']['is_data_export_pdf']) && $this->form_table['base']['is_data_export_pdf'] == 1))
{
$assign['is_load_hiprint'] = 1;
}
} else {
$this->form_error = $ret['msg'];
$assign['form_error'] = $this->form_error;

View File

@ -269,7 +269,7 @@ class Order
'form_type' => 'select',
'form_name' => 'payment_id',
'where_type' => 'in',
'data' => PaymentService::PaymentList(),
'data' => PaymentService::PaymentList(['field'=>'id,name']),
'data_key' => 'id',
'data_name' => 'name',
'is_multiple' => 1,

View File

@ -90,7 +90,7 @@
<!-- amazeui插件 -->
<script type='text/javascript' src="{{$public_host}}static/common/lib/amazeui-switch/amazeui.switch.min.js?v={{:MyC('home_static_cache_version')}}"></script>
<script type='text/javascript' src="{{$public_host}}static/common/lib/amazeui-chosen/amazeui.chosen.min.js?v={{:MyC('home_static_cache_version')}}"></script>
<script type='text/javascript' src="{{$public_host}}static/common/lib/amazeui-chosen/amazeui.chosen.js?v={{:MyC('home_static_cache_version')}}"></script>
<script type='text/javascript' src="{{$public_host}}static/common/lib/amazeui-dialog/amazeui.dialog.js?v={{:MyC('home_static_cache_version')}}"></script>
<script type='text/javascript' src="{{$public_host}}static/common/lib/amazeui-tagsinput/amazeui.tagsinput.min.js?v={{:MyC('home_static_cache_version')}}"></script>

View File

@ -56,10 +56,8 @@
{{foreach $form_table.form as $t}}
{{if isset($t['label']) and isset($t['view_type']) and in_array($t['view_type'], ['images', 'field', 'module', 'status']) and (!isset($t['is_detail']) or $t['is_detail'] eq 1)}}
<li>
<div class="data-avg-text-list-title">
<strong>{{$t.label}}</strong>
</div>
<div class="data-avg-text-list-content am-margin-top-xs">
<div class="data-avg-text-list-title">{{$t.label}}</div>
<div class="data-avg-text-list-content">
{{include file="public/module/detail_content" /}}
</div>
</li>

View File

@ -460,6 +460,12 @@ class Common extends BaseController
$assign['page_size'] = $this->page_size;
$assign['page_html'] = $this->page_html;
$assign['page_url'] = $this->page_url;
// 是否开启打印和pdf导出、则引入组件
if((isset($this->form_table['base']['is_data_print']) && $this->form_table['base']['is_data_print'] == 1) || (isset($this->form_table['base']['is_data_export_pdf']) && $this->form_table['base']['is_data_export_pdf'] == 1))
{
$assign['is_load_hiprint'] = 1;
}
} else {
$this->form_error = $ret['msg'];
$assign['form_error'] = $this->form_error;

View File

@ -54,7 +54,7 @@
{{/if}}
<!-- 文章内容 -->
<div class="am-article am-scrollable-horizontal">{{$article.content|raw}}</div>
<div class="am-article am-scrollable-horizontal richtext">{{$article.content|raw}}</div>
<!-- 上一篇、下一篇 -->
<div class="last-next-data am-margin-top-lg am-padding-bottom-sm">

View File

@ -711,7 +711,7 @@
</div>
{{/if}}
<!-- web详情 -->
<div class="content-web am-scrollable-horizontal">{{$goods.content_web|raw}}</div>
<div class="content-web am-scrollable-horizontal richtext">{{$goods.content_web|raw}}</div>
<!-- 详情内容底部钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}

View File

@ -457,7 +457,7 @@
<div class="am-u-sm-2 am-u-md-1 am-list-thumb">
<img src="{{$goods.images}}" alt="{{$goods.title}}" class="am-img-thumbnail am-radius" />
</div>
<div class="am-u-sm-10 am-u-md-11 am-list-item-text">
<div class="am-u-sm-10 am-u-md-11 am-list-item-text richtext">
{{if empty($goods['fictitious_goods_value'])}}
<span>未配置数据</span>
{{else /}}

View File

@ -59,7 +59,7 @@
<!-- amazeui插件 -->
<script type='text/javascript' src="{{$public_host}}static/common/lib/amazeui-switch/amazeui.switch.min.js?v={{:MyC('home_static_cache_version')}}"></script>
<script type='text/javascript' src="{{$public_host}}static/common/lib/amazeui-chosen/amazeui.chosen.min.js?v={{:MyC('home_static_cache_version')}}"></script>
<script type='text/javascript' src="{{$public_host}}static/common/lib/amazeui-chosen/amazeui.chosen.js?v={{:MyC('home_static_cache_version')}}"></script>
<script type='text/javascript' src="{{$public_host}}static/common/lib/amazeui-dialog/amazeui.dialog.js?v={{:MyC('home_static_cache_version')}}"></script>
<script type='text/javascript' src="{{$public_host}}static/common/lib/amazeui-tagsinput/amazeui.tagsinput.min.js?v={{:MyC('home_static_cache_version')}}"></script>

View File

@ -56,10 +56,8 @@
{{foreach $form_table.form as $t}}
{{if isset($t['label']) and isset($t['view_type']) and in_array($t['view_type'], ['images', 'field', 'module', 'status']) and (!isset($t['is_detail']) or $t['is_detail'] eq 1)}}
<li>
<div class="data-avg-text-list-title">
<strong>{{$t.label}}</strong>
</div>
<div class="data-avg-text-list-content am-margin-top-xs">
<div class="data-avg-text-list-title">{{$t.label}}</div>
<div class="data-avg-text-list-content">
{{include file="public/module/detail_content" /}}
</div>
</li>

View File

@ -78,6 +78,7 @@ return [
'not_specified_container_tips' => '未指定容器',
'not_specified_assembly_tips' => '未指定加载组建',
'not_specified_form_name_tips' => '未指定表单name名称',
'not_load_lib_hiprint_error' => '请先引入hiprint组件库',
],
// 公共基础

View File

@ -73,10 +73,10 @@ class FormHandleModule
* @date 2020-06-02
* @desc description
* @param [string] $module [模块位置]
* @param [string] $action [模块方法(默认 Run 方法,可自动匹配控制器方法名)]
* @param [string] $action [模块方法(默认 Index/Run 方法,可自动匹配控制器方法名)]
* @param [mixed] $params [参数数据]
*/
public function Run($module, $action = 'Run', $params = [])
public function Run($module, $action = 'Index', $params = [])
{
// 参数校验
$ret = $this->ParamsCheckHandle($module, $action, $params);

View File

@ -211,8 +211,9 @@ class PaymentService
{
$where['is_open_user'] = intval($params['is_open_user']);
}
$field = empty($params['field']) ? 'id,logo,name,sort,payment,config,apply_terminal,apply_terminal_old,element,is_enable,is_open_user' : $params['field'];
return self::DataListHandle(Db::name('Payment')->where($where)->field('id,logo,name,sort,payment,config,apply_terminal,apply_terminal_old,element,is_enable,is_open_user')->order('sort asc')->select()->toArray());
return self::DataListHandle(Db::name('Payment')->where($where)->field($field)->order('sort asc')->select()->toArray());
}
/**
@ -257,12 +258,27 @@ class PaymentService
{
foreach($data as &$v)
{
$v['logo_old'] = $v['logo'];
$v['logo'] = ResourcesService::AttachmentPathViewHandle($v['logo']);
$v['element'] = empty($v['element']) ? '' : json_decode($v['element'], true);
$v['config'] = empty($v['config']) ? '' : json_decode($v['config'], true);
$v['apply_terminal'] = empty($v['apply_terminal']) ? '' : json_decode($v['apply_terminal'], true);
$v['apply_terminal_old'] = empty($v['apply_terminal_old']) ? '' : json_decode($v['apply_terminal_old'], true);
if(array_key_exists('logo', $v))
{
$v['logo_old'] = $v['logo'];
$v['logo'] = ResourcesService::AttachmentPathViewHandle($v['logo']);
}
if(array_key_exists('element', $v))
{
$v['element'] = empty($v['element']) ? '' : json_decode($v['element'], true);
}
if(array_key_exists('config', $v))
{
$v['config'] = empty($v['config']) ? '' : json_decode($v['config'], true);
}
if(array_key_exists('apply_terminal', $v))
{
$v['apply_terminal'] = empty($v['apply_terminal']) ? '' : json_decode($v['apply_terminal'], true);
}
if(array_key_exists('apply_terminal_old', $v))
{
$v['apply_terminal_old'] = empty($v['apply_terminal_old']) ? '' : json_decode($v['apply_terminal_old'], true);
}
}
}
return $data;

View File

@ -21,7 +21,20 @@ time, mark, audio, video {
font-family: "Microsoft YaHei",SimSun;
font-style: normal;
}
* { font-size: 12px; }
body {font-size: 12px;margin:0;color:#666;}
html,body {position:relative;height:100%;width:100%;}
h1 {line-height:42px;}
h2 {line-height:32px;}
h3 small {color:#444444;}
h4 {line-height:22px;}
h4 small {color:#444444;}
h5 {font-size:15px;}
h5 small {color:#444444;}
b {font-weight:600;}
i{ font-style: normal; }
a:hover {outline:0;text-decoration:none;}
a:active {outline:0;text-decoration:none;}
a:focus {outline:0;text-decoration:none;}
.w100 {width:100%;}
.fw-100 {font-weight:100;}
.fw-700 {font-weight:700;}
@ -72,22 +85,6 @@ input:hover, select:hover, textarea:hover, .chosen-choices:hover, .chosen-single
.am-alert-tips, .am-alert-tips * { font-size: 12px; }
.am-btn-sm { font-size: 12px; }
.am-input-group-sm > .am-input-group-label { line-height: 26px; }
body {margin:0;color:#666;}
html,body {position:relative;height:100%;width:100%;}
h1,h2,h3,h4,h5,h6 {font-family:'Karla',sans-serif;margin:10px 0;}
h1 {line-height:42px;}
h2 {line-height:32px;}
h3 small {color:#444444;}
h4 {line-height:22px;}
h4 small {color:#444444;}
h5 {font-size:15px;}
h5 small {color:#444444;}
b {font-weight:600;}
i{ font-style: normal; }
a:hover {outline:0;text-decoration:none;}
a:active {outline:0;text-decoration:none;}
a:focus {outline:0;text-decoration:none;}
.container {width:auto;}
.container-alt {margin-left:auto;margin-right:auto;padding-left:15px;padding-right:15px;}
/* Footer */
@ -387,10 +384,11 @@ header { background-color:#4386fb !important; border-color:#4386fb; color:#fff;
header, header.am-topbar { min-height:32px; }
header .am-topbar-brand { height:32px; }
header .am-dropdown-content {border-radius:2px;}
header .am-topbar-brand h2 { margin: 0; }
header .header-nav-submit { margin: 4px 10px 0 0; padding: 4px 10px;}
header .am-topbar-brand h2 { font-size: 18px; line-height: 32px; }
header .admin-site-vice-name { font-size: 12px; color: #eaeaea; }
ul {margin-top:0;}
.admin-header {position:fixed;top:0;right:0;z-index:1000;font-size:1.4rem;margin-bottom:0;}
.admin-header {position:fixed;top:0;right:0;z-index:1000;margin-bottom:0;}
.admin-sidebar {width:260px;min-height:100%;float:left;border-right:1px solid #cecece;}
.admin-sidebar.am-active {z-index:1600;}
.admin-sidebar-list {margin-bottom:0;}

View File

@ -74,6 +74,15 @@ html input[disabled] { cursor: default !important; color: #b1b1b1 !important; ba
padding: 10px;
min-height: 80px;
}
.data-avg-text-list li .data-avg-text-list-title {
color: #b9b9b9;
}
.data-avg-text-list li .data-avg-text-list-content {
margin-top: 5px;
}
.data-avg-text-list li:hover .data-avg-text-list-content {
color: #000;
}
/**
*
@ -490,6 +499,12 @@ ul.plug-file-upload-view-file li {
}
.am-btn {
padding: 0.6em 1em;
font-size: 1.2rem;
}
.am-dropdown-content {
-webkit-box-shadow: 0px 2px 10px rgb(136 136 136 / 40%);
-moz-box-shadow: 0px 2px 10px rgb(136 136 136 / 0.4);
box-shadow: 0px 2px 10px rgb(136 136 136 / 40%);
}
/**
@ -789,9 +804,6 @@ button.colorpicker-submit img {
width: 75px;
text-align: center;
min-width: auto;
-webkit-box-shadow: 0px -2px 10px rgb(136 136 136 / 40%);
-moz-box-shadow: 0px -2px 10px rgb(136 136 136 / 0.4);
box-shadow: 0px -2px 10px rgb(136 136 136 / 40%);
}
.am-table-scrollable-horizontal .am-table tr .am-operate-grid-more-list .am-dropdown-content .am-badge:not(:last-child) {
margin-right: 5px;
@ -1150,4 +1162,15 @@ form .am-tab-panel .am-form-group:last-child {
*/
.table-nav {
border-bottom: 1px solid #eee;
}
/**
*
*/
.richtext {
font-family: sans-serif;
font-size: 12px;
}
.richtext p {
margin:5px 0;
}

View File

@ -2777,6 +2777,13 @@ $(function()
result = print_data;
}
// 是否已引入hiprint库
if((window['hiprint'] || null) == null)
{
Prompt(window['lang_not_load_lib_hiprint_error'] || '请先引入hiprint组件库');
return false;
}
// 初始化模板
var ht = new hiprint.PrintTemplate({template: JsonStringToJsonObject(print_template)});
@ -2842,7 +2849,8 @@ $(function()
inherit_select_classes: true,
enable_split_word_search: true,
search_contains: true,
no_results_text: window['lang_chosen_select_no_results_text']
no_results_text: window['lang_chosen_select_no_results_text'],
disable_search_threshold: 10
});
}
// 多选插件 空内容失去焦点验证bug兼容处理
@ -2853,6 +2861,69 @@ $(function()
$(this).parent().parent().prev().trigger('blur');
}
});
// 多选插件分组支持组单选
$(document).on('click', '.chosen-container-multi .chosen-results li', function()
{
var $chosen = $(this).parents('.chosen-container');
var is_group_single = parseInt($chosen.prev().data('group-single') || 0);
if(is_group_single == 1 && !$(this).hasClass('group-result'))
{
var index = $(this).index();
var $parent = $(this).parent();
var count = $parent.find('li').length;
var arr = [];
// 获取前面选中的数据
var temp_index = index-1;
while(temp_index != 0)
{
var $li = $parent.find('li').eq(temp_index);
if($li.hasClass('group-result'))
{
break;
}
if($li.hasClass('result-selected'))
{
var value = $li.attr('data-option-array-index') || null;
if(value != null)
{
arr.push(value);
}
}
temp_index--;
}
// 获取后面选中的数据
temp_index = index+1;
while(temp_index < count)
{
var $li = $parent.find('li').eq(temp_index);
if($li.hasClass('group-result'))
{
break;
}
if($li.hasClass('result-selected'))
{
var value = $li.attr('data-option-array-index') || null;
if(value != null)
{
arr.push(value);
}
}
temp_index++;
}
if(arr.length > 0)
{
$chosen.find('.chosen-choices li').each(function(k, v)
{
var $a = $(this).find('a.search-choice-close');
var value = $a.attr('data-option-array-index');
if(arr.indexOf(value) != -1)
{
$a.trigger('click');
}
});
}
}
});
/**
* 删除数据列表

View File

@ -1,11 +0,0 @@
# editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

View File

@ -1,103 +0,0 @@
{
"env": {
"browser": true,
"node": true
},
"rules": {
// Strict Mode
// @see http://eslint.org/docs/rules/strict
"strict": [
2,
"safe"
],
// Variables
// @see http://eslint.org/docs/rules/#variables
"no-undef": 2,
"no-unused-vars": 2,
// Possible Errors
// @see http://eslint.org/docs/rules/#possible-errors
"comma-dangle": [2, "never"],
"no-empty": [2, {"allowEmptyCatch": true}],
// Best Practices
// @see http://eslint.org/docs/rules/#best-practices
"curly": 2,
"dot-notation": 2,
"no-caller": 2,
"no-multi-str": 2,
"no-unused-expressions": [2, {
"allowShortCircuit": true,
"allowTernary": true
}],
"no-with": 2,
"wrap-iife": [
2,
"any"
],
// Stylistic Issues
// @see http://eslint.org/docs/rules/#stylistic-issues
"array-bracket-spacing": [2, "never"],
"camelcase": [2, {
"properties": "always"
}],
"comma-style": [2, "last"],
"eol-last": 2,
"keyword-spacing": [
2,
{
"before": true,
"after": true,
"overrides": {}}
],
"indent": [
2,
2,
{
"SwitchCase": 1
}
],
"linebreak-style": [2, "unix"],
"max-len": [
2,
80,
2,
{
"ignoreUrls": true
}
],
"new-cap": [2, {
"capIsNewExceptions": [
"$.Event"
]
}],
"no-bitwise": 2,
"no-mixed-spaces-and-tabs": 2,
"no-trailing-spaces": [2, {"skipBlankLines": true }],
"one-var": [2, "never"],
"quotes": [
2,
"single",
{"avoidEscape": true, "allowTemplateLiterals": true}
],
"quote-props": [2, "as-needed"],
"semi": ["error", "always"],
"spaced-comment": ["error", "always"],
"space-before-function-paren": [2, {
"anonymous": "never",
"named": "never"
}],
"space-in-parens": [2, "never"],
"space-infix-ops": [2, {"int32Hint": true}],
"space-unary-ops": [
2, {
// `words` applies to unary word operators,
// such as: new, delete, typeof, void, yield
"words": true,
// nonwords - applies to unary operators such as: -, +, --, ++, !, !!
"nonwords": false
}]
}
}

View File

@ -1,2 +0,0 @@
node_modules
dist

View File

@ -1,12 +0,0 @@
.DS_Store
.idea
dist
docs
gulpfile.js
.editorconfig
.gitignore
.npmignore
.jshintrc
node_modules
bower.json
.*

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -395,7 +395,7 @@ body {
font-weight: normal;
line-height: 1.6;
color: #333333;
font-size: 1.6rem;
font-size: 1.2rem;
}
/**
* 1. http://usabilitypost.com/2012/11/15/w-optimizelegibility-on-mobile-devices/
@ -9527,7 +9527,7 @@ TODO:
margin-top: -4px;
}
.am-popover-sm {
font-size: 1.4rem;
font-size: 1.2rem;
}
.am-popover-sm .am-popover-inner {
padding: 5px;
@ -10623,7 +10623,7 @@ label.am-radio {
margin: 0;
padding: 0;
list-style: none;
font-size: 1.5rem;
font-size: 1.2rem;
}
.am-selected-list li {
position: relative;

View File

@ -6920,7 +6920,7 @@ var fillCharReg = new RegExp(domUtils.fillChar, 'g');
'.view{padding:0;word-wrap:break-word;cursor:text;height:90%;}\n' +
//设置默认字体和字号
//font-family不能呢随便改在safari下fillchar会有解析问题
'body{margin:8px;font-family:sans-serif;font-size:16px;}' +
'body{font-family:sans-serif;font-size:12px;color:#333;}' +
//设置段落间距
'p{margin:5px 0;}</style>' +
( options.iframeCssUrl ? '<link rel=\'stylesheet\' type=\'text/css\' href=\'' + utils.unhtml(options.iframeCssUrl) + '\'/>' : '' ) +

View File

@ -19,8 +19,7 @@ time, mark, audio, video {
}
li { list-style-type: none; }
button { outline: none; }
*, body, .am-btn { font-size: 12px; }
body{ font-size: 12px; }
.am-form select,.am-form textarea,.am-form input[type="text"],.am-form input[type="password"],.am-form input[type="datetime"],.am-form input[type="datetime-local"],.am-form input[type="date"],.am-form input[type="month"],.am-form input[type="time"],.am-form input[type="week"],.am-form input[type="number"],.am-form input[type="email"],.am-form input[type="url"],.am-form input[type="search"],.am-form input[type="tel"],.am-form input[type="color"],.am-form-field {
font-size: 12px !important;
@ -722,6 +721,14 @@ table.am-table .am-btn-danger:hover {
color: #fff !important;
}
/**
*
*/
.am-selected-btn.am-btn-default {
border: 1px solid #ccc !important;
border-radius: 2px;
}
/**
* tabs
*/