chenhao 4 lat temu
rodzic
commit
545590d5e0

+ 3 - 1
application/admin/controller/Users.php

@@ -71,7 +71,9 @@ class Users extends Backend
 
             return json($result);
         }
-        return $this->view->fetch();
+        // 设置下载模板文件的地址
+        $path = config('site.url').'\template\template.xls';
+        return $this->view->fetch('index', ['path'=>$path]);
     }
 
     /**

+ 6 - 6
application/admin/view/login_admin/index.html

@@ -10,14 +10,14 @@
                         <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('login_admin/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
                         <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('login_admin/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
                         <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('login_admin/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
-<!--                        <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('login_admin/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->
+                        <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('login_admin/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>
 
                         <div class="dropdown btn-group {:$auth->check('login_admin/multi')?'':'hide'}">
-                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
-                            <ul class="dropdown-menu text-left" role="menu">
-                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
-                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
-                            </ul>
+<!--                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
+<!--                            <ul class="dropdown-menu text-left" role="menu">-->
+<!--                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>-->
+<!--                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>-->
+<!--                            </ul>-->
                         </div>
 
                         

+ 6 - 0
application/admin/view/type/add.html

@@ -6,6 +6,12 @@
             <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text">
         </div>
     </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">排序(数字越大越靠前):</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-f_sort" data-rule="required" class="form-control" name="row[f_sort]" type="text">
+        </div>
+    </div>
             <input id="c-f_id" data-rule="required" data-source="f/index" class="form-control selectpage" name="row[f_id]" type="hidden" value="0">
     <div class="form-group layer-footer">
         <label class="control-label col-xs-12 col-sm-2"></label>

+ 6 - 0
application/admin/view/type/edit.html

@@ -6,6 +6,12 @@
             <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
         </div>
     </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">排序(数字越大越靠前):</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-f_sort" data-rule="required" class="form-control" name="row[f_sort]" type="text" value="{$row.f_sort|htmlentities}">
+        </div>
+    </div>
 
             <input id="c-f_id" data-rule="required" data-source="f/index" class="form-control selectpage" name="row[f_id]" type="hidden" value="0">
 

+ 4 - 4
application/admin/view/type/index.html

@@ -6,14 +6,14 @@
             <div class="tab-pane fade active in" id="one">
                 <div class="widget-body no-padding">
                     <div id="toolbar" class="toolbar">
-<!--                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>-->
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
                         <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('type/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
 <!--                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('type/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
 <!--                        <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('type/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
 <!--                        <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('type/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->
 
                         <div class="dropdown btn-group {:$auth->check('type/multi')?'':'hide'}">
-                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
+<!--                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
 <!--                            <ul class="dropdown-menu text-left" role="menu">-->
 <!--                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>-->
 <!--                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>-->
@@ -23,8 +23,8 @@
                         
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
-                           data-operate-edit="{:$auth->check('type/edit')}" 
-                           data-operate-del="{:$auth->check('type/del')}" 
+                           data-operate-edit="{:$auth->check('type/edit')}"
+                           data-operate-del="{:$auth->check('type/del')}"
                            width="100%">
                     </table>
                 </div>

+ 1 - 1
application/admin/view/users/index.html

@@ -10,7 +10,7 @@
                         <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('users/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
                         <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('users/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
                         <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('users/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
-<!--                        <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('users/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="xls" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->
+                        <a href="{$path}" class="btn btn-primary" title="下载模板文件"   data-multiple="false"><i class="fa fa-upload"></i> 下载文件模板</a>
                         <a href="javascript:;" class="btn btn-danger btn-stock-file " title="导入文件" id="btn-stock-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i>&nbsp;导入文件</a>
 <!--                        <div class="dropdown btn-group {:$auth->check('users/multi')?'':'hide'}">-->
 <!--                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->

+ 6 - 0
application/admin/view/ztype/add.html

@@ -6,6 +6,12 @@
             <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text">
         </div>
     </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">排序(数字越大越靠前):</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-z_sort" data-rule="required" class="form-control" name="row[z_sort]" type="text">
+        </div>
+    </div>
             <input id="c-f_id" name="row[f_id]" type="hidden" value="{$t_id}">
     <div class="form-group layer-footer">
         <label class="control-label col-xs-12 col-sm-2"></label>

+ 6 - 0
application/admin/view/ztype/edit.html

@@ -6,6 +6,12 @@
             <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
         </div>
     </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">排序:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-z_sort" data-rule="required" class="form-control" name="row[z_sort]" type="text" value="{$row.z_sort|htmlentities}">
+        </div>
+    </div>
 
             <input id="c-f_id"  name="row[f_id]" type="hidden" value="{$row.f_id|htmlentities}">
 

+ 3 - 3
application/admin/view/ztype/index.html

@@ -6,7 +6,7 @@
             <div class="tab-pane fade active in" id="one">
                 <div class="widget-body no-padding">
                     <div id="toolbar" class="toolbar">
-<!--                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>-->
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
                         <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('ztype/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
 <!--                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('ztype/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
 <!--                        <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('ztype/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
@@ -23,8 +23,8 @@
                         
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
-                           data-operate-edit="{:$auth->check('ztype/edit')}" 
-                           data-operate-del="{:$auth->check('ztype/del')}" 
+                           data-operate-edit="{:$auth->check('ztype/edit')}"
+                           data-operate-del="{:$auth->check('ztype/del')}"
                            width="100%">
                     </table>
                 </div>

+ 5 - 1
application/api/controller/Users.php

@@ -78,11 +78,15 @@ class Users extends Api
     {
         $data = Db::name('type')
             ->where('f_id',0)
+            ->order('f_sort',"desc")
             ->select();
         if ($data) {
             foreach ($data as &$v) {
                 // 循环查出子单位
-                $v['ztype'] = Db::name('type')->where('f_id',$v['t_id'])->select();
+                $v['ztype'] = Db::name('type')
+                    ->where('f_id',$v['t_id'])
+                    ->order('z_sort',"desc")
+                    ->select();
             }
             return $this->result('',$data,200);
         } else {

+ 2 - 1
public/assets/js/backend/type.js

@@ -20,7 +20,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             table.bootstrapTable({
                 url: $.fn.bootstrapTable.defaults.extend.index_url,
                 pk: 't_id',
-                sortName: 't_id',
+                sortName: 'f_sort',
+                sortOrder:'desc',
                 search:false,
                 commonSearch:false,
                 searchFormVisible:false,

+ 2 - 1
public/assets/js/backend/ztype.js

@@ -20,7 +20,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             table.bootstrapTable({
                 url: $.fn.bootstrapTable.defaults.extend.index_url,
                 pk: 't_id',
-                sortName: 't_id',
+                sortName: 'z_sort',
+                sortOrder:'desc',
                 columns: [
                     [
                         {checkbox: true},

BIN
public/template/template.xls