From 3bcf6a65dfb9813dff2986c9cc03b638742ce64e Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期一, 06 三月 2023 18:02:00 +0800
Subject: [PATCH] 司机管理,用户角色分类查询修改

---
 management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice.js |  151 +++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 130 insertions(+), 21 deletions(-)

diff --git a/management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice.js b/management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice.js
index 5914920..b6d9f0a 100644
--- a/management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice.js
+++ b/management/guns-admin/src/main/webapp/static/modular/system/tBranchOffice/tBranchOffice.js
@@ -14,19 +14,52 @@
 TBranchOffice.initColumn = function () {
     return [
         {field: 'selectItem', radio: true},
-            {title: '主键', field: 'id', visible: true, align: 'center', valign: 'middle'},
-            {title: '代理商id', field: 'agentId', visible: true, align: 'center', valign: 'middle'},
-            {title: '负责人姓名', field: 'principal', visible: true, align: 'center', valign: 'middle'},
-            {title: '负责人电话', field: 'principalPhone', visible: true, align: 'center', valign: 'middle'},
-            {title: '邮箱', field: 'email', visible: true, align: 'center', valign: 'middle'},
-            {title: '代理区域省编号', field: 'provinceCode', visible: true, align: 'center', valign: 'middle'},
-            {title: '代理区域省名称', field: 'provinceName', visible: true, align: 'center', valign: 'middle'},
-            {title: '代理区域市编号', field: 'cityCode', visible: true, align: 'center', valign: 'middle'},
-            {title: '代理区域市名称', field: 'cityName', visible: true, align: 'center', valign: 'middle'},
-            {title: '代理区域区编号', field: 'districtCode', visible: true, align: 'center', valign: 'middle'},
-            {title: '代理区域区名称', field: 'districtName', visible: true, align: 'center', valign: 'middle'},
-            {title: '状态(1=正常,2=冻结,3=删除)', field: 'status', visible: true, align: 'center', valign: 'middle'},
-            {title: '添加时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'}
+            {title: '主键', field: 'id', visible: false, align: 'center', valign: 'middle'},
+        {title: '代理商id', field: 'agentId', visible: false, align: 'center', valign: 'middle'},
+        {title: '添加时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'},
+        {title: '分公司名称', field: 'branchOfficeName', visible: true, align: 'center', valign: 'middle'},
+        {title: '负责人姓名', field: 'principal', visible: true, align: 'center', valign: 'middle'},
+        {title: '负责人电话', field: 'principalPhone', visible: true, align: 'center', valign: 'middle'},
+        {title: '邮箱', field: 'email', visible: false, align: 'center', valign: 'middle'},
+        {title: '代理区域省编号', field: 'provinceCode', visible: false, align: 'center', valign: 'middle'},
+        {title: '代理区域省名称', field: 'provinceName', visible: false, align: 'center', valign: 'middle'},
+        {title: '代理区域市编号', field: 'cityCode', visible: false, align: 'center', valign: 'middle'},
+        {title: '代理区域市名称', field: 'cityName', visible: false, align: 'center', valign: 'middle'},
+        {title: '代理区域区编号', field: 'districtCode', visible: false, align: 'center', valign: 'middle'},
+        {title: '代理区域区名称', field: 'districtName', visible: false, align: 'center', valign: 'middle'},
+
+        {title: '订单数量', field: 'principalPhone', visible: true, align: 'center', valign: 'middle'},
+        {title: '有效订单', field: 'principalPhone', visible: true, align: 'center', valign: 'middle'},
+        {title: '已发放优惠券', field: 'principalPhone', visible: true, align: 'center', valign: 'middle'},
+        {title: '已使用优惠券', field: 'principalPhone', visible: true, align: 'center', valign: 'middle'},
+        {title: '累计优惠券金额', field: 'principalPhone', visible: true, align: 'center', valign: 'middle'},
+
+        {title: '经营业务', field: 'operatingBusiness', visible: true, align: 'center', valign: 'middle',
+            formatter: function (value, row) {
+                if (row.operatingBusiness === 1){
+                    return '<span>司机代驾</span>'
+                }
+            }
+        },
+
+        {title: '司机数', field: 'driverCount', visible: true, align: 'center', valign: 'middle'},
+        {title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle',
+            formatter: function (value, row) {
+                if (row.status === 1){
+                    return '<span>正常</span>'
+                }else if(row.status === 2){
+                    return '<span>冻结</span>'
+                }else if (row.status === 3){
+                    return '<span>已删除</span>'
+                }
+            }
+        },
+        {title: '操作', visible: true, align: 'center', valign: 'middle',width:150,
+            formatter: function (value, row) {
+                return '<a href="#" onclick="TBranchOffice.searchTBranchOfficeDetail('+row.id+')" style="color:blue">详情</a>' +'&nbsp;' +
+                    '<a href="#" onclick="TBranchOffice.delete('+row.id+')" style="color:red">删除</a>'
+            }
+        }
     ];
 };
 
@@ -75,19 +108,79 @@
         this.layerIndex = index;
     }
 };
+/**
+ * 打开查看详情(使用中)
+ */
+TBranchOffice.searchTBranchOfficeDetail = function (id) {
+    var index = layer.open({
+        type: 2,
+        title: '详情',
+        area: ['100%', '100%'], //宽高
+        fix: false, //不固定
+        maxmin: true,
+        content: Feng.ctxPath + '/tBranchOffice/tBranchOfficeDetail?tBranchOfficeId=' + id
+    });
+    this.layerIndex = index;
+};
 
 /**
  * 删除
  */
-TBranchOffice.delete = function () {
-    if (this.check()) {
-        var ajax = new $ax(Feng.ctxPath + "/tBranchOffice/delete", function (data) {
-            Feng.success("删除成功!");
-            TBranchOffice.table.refresh();
+TBranchOffice.delete = function (id) {
+    var ajax = new $ax(Feng.ctxPath + "/tBranchOffice/delete", function (data) {
+        Feng.success("删除成功!");
+        TBranchOffice.table.refresh();
+    }, function (data) {
+        Feng.error("删除失败!" + data.responseJSON.message + "!");
+    });
+    ajax.set("tBranchOfficeId",id);
+    ajax.start();
+};
+
+/**
+ * 提交冻结
+ */
+TBranchOffice.stop = function () {
+    if(this.check()){
+        if(2 == this.seItem.status){
+            Feng.error("该条数据已冻结!");
+            return;
+        }
+        var ajax = new $ax(Feng.ctxPath + "/tBranchOffice/stop?id="+this.seItem.id, function (data) {
+            if(500 == data.code){
+                Feng.error(data.message);
+                return;
+            }else {
+                Feng.success("冻结成功!");
+                TBranchOffice.table.refresh();
+            }
         }, function (data) {
-            Feng.error("删除失败!" + data.responseJSON.message + "!");
+            Feng.error("冻结失败!" + data.message + "!");
         });
-        ajax.set("tBranchOfficeId",this.seItem.id);
+        ajax.start();
+    }
+};
+
+/**
+ * 提交启用
+ */
+TBranchOffice.start = function () {
+    if(this.check()){
+        if(1 == this.seItem.status){
+            Feng.error("该条数据已启用!");
+            return;
+        }
+        var ajax = new $ax(Feng.ctxPath + "/tBranchOffice/start?id="+this.seItem.id, function (data) {
+            if(500 == data.code){
+                Feng.error(data.message);
+                return;
+            }else {
+                Feng.success("启用成功!");
+                TBranchOffice.table.refresh();
+            }
+        }, function (data) {
+            Feng.error("启用失败!" + data.message + "!");
+        });
         ajax.start();
     }
 };
@@ -97,10 +190,26 @@
  */
 TBranchOffice.search = function () {
     var queryData = {};
-    queryData['condition'] = $("#condition").val();
+    queryData['branchOfficeName'] = $("#branchOfficeName").val();
+    queryData['principal'] = $("#principal").val();
+    queryData['principalPhone'] = $("#principalPhone").val();
+    queryData['operatingBusiness'] = $("#operatingBusiness").val();
+    queryData['status'] = $("#status").val();
     TBranchOffice.table.refresh({query: queryData});
 };
 
+/**
+ * 重置
+ */
+TBranchOffice.resetSearch = function (){
+    $("#branchOfficeName").val('');
+    $("#principal").val('');
+    $("#principalPhone").val('');
+    $("#operatingBusiness").val('');
+    $("#status").val('');
+    TBranchOffice.search();
+}
+
 $(function () {
     var defaultColunms = TBranchOffice.initColumn();
     var table = new BSTable(TBranchOffice.id, "/tBranchOffice/list", defaultColunms);

--
Gitblit v1.7.1