rabin 2 năm trước cách đây
mục cha
commit
151dd7e213
3 tập tin đã thay đổi với 21 bổ sung5 xóa
  1. 1 1
      assets/layadmin/html/project/database/update.html
  2. 1 1
      src/Database.php
  3. 19 3
      src/Lib/Input.php

+ 1 - 1
assets/layadmin/html/project/database/update.html

@@ -72,7 +72,7 @@
   var skuTable;
   layui.config({
     base: '../script/lib/layui/admin/' //静态资源所在路径
-    ,version:false
+    ,version:true
   }).extend({
     index: 'lib/index', //主入口模块
     formSelects: 'plugin/formselects/formselects',

+ 1 - 1
src/Database.php

@@ -3637,7 +3637,7 @@ class Database
 
                 $delete = true;
                 if (isset($param['update_type']) && $param['update_type'] == 2) {
-                    $table = '<style>.layui-input, .xm-select-parent{width:100%}</style>';
+                    $table = '<style>.layui-table .layui-input, .layui-table .xm-select-parent{width:100%}</style>';
                     $table .= '<table class="layui-table">';
                     $table_header = '<thead><tr>';
                     $table_body = '<tbody>';

+ 19 - 3
src/Lib/Input.php

@@ -995,7 +995,7 @@ class Input
         } elseif (isset($param['load'])) {
             $change = ' onchange="loadChange($(this), \'' . $param['load'] . '\')" ';
             $child_class .= ' change';
-        } elseif (isset($param['bind'])) {
+        } elseif (isset($param['bind']) && !isset($param['update_search'])) {
             $param['bind'][2] = isset($param['bind'][2]) ? str_replace('"', '\'', json_encode($param['bind'][2], true)) : false;
             $change = $param['bind'][0] . '="' . $param['bind'][1] . '($(this), ' . $param['bind'][2] . ')" ';
 
@@ -1028,6 +1028,11 @@ class Input
                     $param['update_search'] = str_replace('{id}', 'where_id=' . $param['where_id'], $param['update_search']);
                 }
                 $xm = str_replace('xm-select-search=""', 'xm-select-search="'.Dever::url($param['update_search'] . '&yes='.$search_value.'&json=1').'"', $xm);
+
+                if (isset($param['bind'])) {
+                    $param['bind'][2] = isset($param['bind'][2]) ? str_replace('"', '\'', json_encode($param['bind'][2], true)) : false;
+                    $xm .= ' xm-select-callback="'.$param['bind'][1].'" xm-select-callback-param="'.$param['bind'][2].'"';
+                }
             }
 
             if (isset($param['update_create'])) {
@@ -1266,8 +1271,8 @@ class Input
 
                 $auto .= ' onload="' . $param['bind'][1] . '($(this), ' . $param['bind'][2] . ')" ';
             }
-            
-            return '<input ' . $auto . ' type="' . (isset($param['update']) ? $param['update'] : 'text') . '" class="autoload_text layui-input update_value ' . (isset($param['class']) ? $param['class'] : 'form-control') . ' ' . (isset($param['valid']) ? $param['valid'] : '') . '" value="' . $value . '" name="' . $param['name'] . '" id="' . $param['name'] . '_value" autocomplete="new'.time().'" placeholder="' . (isset($param['placeholder']) ? $param['placeholder'] : '') . '"/>' . $input;
+            //id _value
+            return '<input ' . $auto . ' type="' . (isset($param['update']) ? $param['update'] : 'text') . '" class="autoload_text layui-input update_value ' . (isset($param['class']) ? $param['class'] : 'form-control') . ' ' . (isset($param['valid']) ? $param['valid'] : '') . '" value="' . $value . '" name="' . $param['name'] . '" id="' . $param['name'] . '" autocomplete="new'.time().'" placeholder="' . (isset($param['placeholder']) ? $param['placeholder'] : '') . '"/>' . $input;
         }
     }
 
@@ -1453,4 +1458,15 @@ class Input
         <div id="sku_table"></div><div id="sku_table_col" style="display:none">'.$col.'</div>';
         return $html;
     }
+
+    /**
+     * show
+     *
+     * @return string
+     */
+    public static function _show($param, $class = '')
+    {
+        $value = (isset($param['value']) ? $param['value'] : (isset($param['default']) ? $param['default'] : ''));
+        return $value;
+    }
 }