rabin пре 2 година
родитељ
комит
cc958c9bfd
5 измењених фајлова са 64 додато и 23 уклоњено
  1. 1 1
      database/admin.php
  2. 12 0
      database/group.php
  3. 14 0
      src/Company.php
  4. 33 21
      src/Database.php
  5. 4 1
      src/Lib/Input.php

+ 1 - 1
database/admin.php

@@ -703,7 +703,7 @@ return array
                     'update_search' => 'scm_product/lib/manage.searchProduct?{id}{role,company}',
                 ),
 			),*/
-			//'list'		=> true,
+			'list'		=> 'Dever::load("manage/company.getGroupName", "{group}")',
 			# 取代option,从接口里读取选项
 			//'update_search' => 'goods/lib/manage.search_sku',
 		),

+ 12 - 0
database/group.php

@@ -167,6 +167,18 @@ $config = array
             'group' => 'company_id',
             'col' => '*|company_id',
         ),
+
+        'getData' => array
+        (
+            'type' => 'all',
+            'option' => array
+            (
+                'ids' => array('yes-id', 'in'),
+                'state' => 1,
+            ),
+            'order' => array('id' => 'desc'),
+            'col' => '*',
+        ),
     ),
 );
 

+ 14 - 0
src/Company.php

@@ -209,4 +209,18 @@ class Company extends Save
         }
         return 'ok';
     }
+
+    public function getGroupName($group)
+    {
+        $html = array();
+        $where['ids'] = $group;
+        $group = Dever::db('manage/group')->getData($where);
+        foreach ($group as $k => $v) {
+            $html[] = $v['name'];
+        }
+
+        $html = implode(',', $html);
+
+        return $html;
+    }
 }

+ 33 - 21
src/Database.php

@@ -3818,8 +3818,9 @@ class Database
                 }
             } elseif (isset($param['sync']) && isset($param['api']) && $param['update'] != 'load') {
                 $param['sync']['dever-read'] = $data;
-                $param['value'] = Dever::load($param['api'], $param['sync']);
+
                 if (is_array($param['update'])) {
+                    $param['value'] = Dever::load($param['api'], $param['sync']);
                     $order = false;
                     if (isset($param['update'][0]) && is_string($param['update'][0]) && strstr($param['update'][0], '.')) {
                         if (isset($param['update'][1]) && $param['update'][1]) {
@@ -3840,6 +3841,8 @@ class Database
                             $param['lang'] = $config['manage']['lang'];
                         }
                     }
+                } elseif (isset($param['method'])) {
+                    $param['value'] = Dever::load($param['api'] . '-' . $param['method'], $param['sync']);
                 }
             }
 
@@ -3948,6 +3951,10 @@ class Database
                     $table .= $table_body . $table_header;
                     $table .= '</table>';
                     $result .= $table;
+
+                    if (isset($param['update_show']) && $param['update_show']) {
+                        //$result .= '<section class="order-sumary border-b">合计数量:111</section>';
+                    }
                 } elseif (isset($param['update_type']) && $param['update_type'] == 3) {
                     $table = '<style>.layui-table .layui-input, .layui-table .xm-select-parent{width:100%}</style>';
                     $table .= '<table class="layui-table">';
@@ -4162,6 +4169,9 @@ class Database
                 if (isset($param['upload_search_value'])) {
                     $param['upload_search_value'] = $this->value($param['upload_search_value'], $data + $param);
                 }
+                if (isset($param['update_search_value'])) {
+                    $param['update_search_value'] = $this->value($param['update_search_value'], $data + $param);
+                }
 
                 $param['where_id'] = $this->id;
 
@@ -4311,6 +4321,7 @@ class Database
 
         $input = Dever::preInput('update_');
 
+        $info = array();
         if ($this->id) {
             # 新增权限
 
@@ -4415,9 +4426,10 @@ class Database
                                 $m_col = $config['struct'][$h]['sync'][1];
                                 if ($s_col == 'id') {
                                     $s_value = $this->id;
+                                } elseif (isset($info[$s_col])) {
+                                    $s_value = $info[$s_col];
                                 } else {
-                                    $s_one = $this->load('one', $this->id);
-                                    $s_value = $s_one[$s_col];
+                                    $s_value = $input['update_' . $s_col];
                                 }
                                 $t = explode('-', $h);
                                 $index = $t[0] . '/' . $t[1];
@@ -4451,16 +4463,15 @@ class Database
                                 if ($this->id && $temp[1] == 'id') {
                                     $update_id[$i][$index][$num]['id'] = $v;
                                 }
-                                
+
                                 foreach ($config['struct'][$h]['sync'] as $ks => $vs) {
                                     if ($vs == 'id') {
                                         $vs = $this->id;
                                         $update_col[$i][$index] = $ks;
+                                    } elseif (isset($info[$vs])) {
+                                        $vs = $info[$vs];
                                     } else {
-                                        $s_one = $this->load('one', $this->id);
-                                        if (isset($s_one[$vs])) {
-                                            $vs = $s_one[$vs];
-                                        }
+                                        $vs = $input['update_' . $vs];
                                     }
                                     $update_add[$i][$index][$num]['add_' . $ks] = $vs;
                                     $update_deletes[$i][$index][$ks] = $vs;
@@ -4499,15 +4510,17 @@ class Database
                             $k = str_replace('_', '', $temp[2]);
                             $update_other[$i][$temp[1]][$k] = $v;
                         } elseif (strpos($k, '-') && isset($config['struct'][$k]['sync'][0])) {
+                            # 兼容处理,之后删除
                             $k = str_replace('update_', '', $k);
                             if (isset($config['struct'][$k]) && isset($config['struct'][$k]['sync'])) {
                                 $s_col = $config['struct'][$k]['sync'][0];
                                 $m_col = $config['struct'][$k]['sync'][1];
                                 if ($s_col == 'id') {
                                     $s_value = $this->id;
+                                } elseif (isset($info[$s_col])) {
+                                    $s_value = $info[$s_col];
                                 } else {
-                                    $s_one = $this->load('one', $this->id);
-                                    $s_value = $s_one[$s_col];
+                                    $s_value = $input['update_' . $s_col];
                                 }
                                 $temp = explode('-', $k);
                                 $index = $temp[0] . '/' . $temp[1];
@@ -4531,9 +4544,10 @@ class Database
                                         $m_col = $config['struct'][$k]['sync'][1];
                                         if ($s_col == 'id') {
                                             $s_value = $this->id;
-                                        } else {
-                                            $s_one = $this->load('one', $this->id);
-                                            $s_value = $s_one[$s_col];
+                                        } elseif (isset($info[$s_col])) {
+                                            $s_value = $info[$s_col];
+                                        }  else {
+                                            $s_value = $input['update_' . $s_col];
                                         }
 
                                         $index = $temp[0] . '/' . $temp[1];
@@ -4567,11 +4581,10 @@ class Database
                                     if ($vs == 'id') {
                                         $vs = $this->id;
                                         $update_col[$i][$index] = $ks;
+                                    } elseif (isset($info[$vs])) {
+                                        $vs = $info[$vs];
                                     } else {
-                                        $s_one = $this->load('one', $this->id);
-                                        if (isset($s_one[$vs])) {
-                                            $vs = $s_one[$vs];
-                                        }
+                                        $vs = $input['update_' . $vs];
                                     }
                                     $update_add[$i][$index][0]['add_' . $ks] = $vs;
                                     $update_id[$i][$index][0][$ks] = $vs;
@@ -4592,11 +4605,10 @@ class Database
                                         if ($vs == 'id') {
                                             $vs = $this->id;
                                             $update_col[$i][$index] = $ks;
+                                        } elseif (isset($info[$vs])) {
+                                            $vs = $info[$vs];
                                         } else {
-                                            $s_one = $this->load('one', $this->id);
-                                            if (isset($s_one[$vs])) {
-                                                $vs = $s_one[$vs];
-                                            }
+                                            $vs = $input['update_' . $vs];
                                         }
                                         $up['add_' . $ks] = $vs;
                                         $update_delete[$i][$index][][$ks] = $vs;

+ 4 - 1
src/Lib/Input.php

@@ -649,6 +649,7 @@ class Input
                 
                 $j = -1;
                 $name = $param['name'];
+                $html .= '<input type="hidden" name="'.$name.'[]" value="-1" />';
                 foreach ($param['option'] as $k => $v) {
                     $check = '';
                     if (isset($param['update_parent'])) {
@@ -996,7 +997,9 @@ class Input
             //https://maplemei.gitee.io/xm-select/?select=#/basic/paging
             if (isset($param['update_search'])) {
                 $search_value = '';
-                if (isset($param['value'])) {
+                if (isset($param['update_search_value'])) {
+                    $search_value = $param['update_search_value'];
+                } elseif (isset($param['value'])) {
                     $search_value = $param['value'];
                 } elseif (isset($param['default'])) {
                     $search_value = $param['default'];