diff --git a/api/init.json b/api/init.json index bc348d8..47d71f8 100644 --- a/api/init.json +++ b/api/init.json @@ -50,6 +50,12 @@ "href": "page/car_basic/driver_list.html", "icon": "fa fa-asterisk", "target": "_self" + }, + { + "title": "驾驶员白名单", + "href": "page/car_basic/driver_white_list.html", + "icon": "fa fa-asterisk", + "target": "_self" } ] }, diff --git a/js/car_basic/driver_white_list.js b/js/car_basic/driver_white_list.js new file mode 100644 index 0000000..da6334d --- /dev/null +++ b/js/car_basic/driver_white_list.js @@ -0,0 +1,228 @@ +let form, table, laydate; +let tableIns; +let pageNum = 1; // 定义分页 +layui.use(["form", "table"], function () { + form = layui.form; + table = layui.table; + initTable(); +}); + +// 查询/重置 +function queryTable(type) { + if (type === 1) { + let name = $('#name').val(); + let flag = checkValue(name); + if (flag) { + $('#name').val(''); + return layer.msg('姓名查询包含特殊字符,请重新输入', { icon: 2 }); + } + let supName = $('#supName').val(); + let flag2 = checkValue(supName); + if (flag2) { + $('#supName').val(''); + return layer.msg('供应商查询包含特殊字符,请重新输入', { icon: 2 }); + } + reloadTable(1); + } else if (type === 2) { + $('#name').val(''); + $('#supName').val(''); + layui.form.render(); + reloadTable(1); + } +} + +// 刷新页面数据 +function reloadData() { + reloadTable(1); +} + +// 重载表格 +function reloadTable(pageNum) { + table.reload("currentTableId", { + page: { + curr: pageNum ? pageNum : 1, + }, + where: { + encryptedData: JSON.stringify({ + 'name': $('#name').val(), + 'supName': $('#supName').val(), + }), + }, + }, + ); +} + +// 初始化表格 +function initTable() { + tableIns = table.render({ + elem: "#currentTableId", + id: 'currentTableId', + headers: { + authorization: sessionStorage.getItem("gz-token"), + }, + height: "full-170", + url: dataUrl + "backstage/carDriver/getDriverPageWhiteList", + where: { + encryptedData: JSON.stringify({ + 'name': $('#name').val(), + 'supName': $('#supName').val(), + }), + }, + request: { + pageName: 'pageNum', + limitName: 'pageSize' + }, + parseData: function (res) { // res 即为原始返回的数据 + if (res.code === 401) { + closeWindowOpen(); + } + return { + "code": 0, // 解析接口状态 + "msg": '获取成功', // 解析提示文本 + "count": res.total, // 解析数据长度 + "data": res.list // 解析数据列表 + }; + }, + cols: [ + [ + { + width: '6.9%', + title: "序号", + align: "center", + templet: function (d) { + return d.LAY_NUM; + }, + }, + { + field: "name", + width: '12%', + title: "姓名", + unresize: true, + align: "center", + sort:true, + }, + { + field: "phone", + width: '12%', + title: "联系方式", + unresize: true, + align: "center", + sort:true, + }, + { + field: "sfzNum", + width: '12%', + title: "身份证", + unresize: true, + align: "center", + sort:true, + templet: function (d) { + return ''+d.sfzNum+''; + }, + }, + { + field: "jszNum", + width: '12%', + title: "驾驶证", + unresize: true, + align: "center", + sort:true, + templet: function (d) { + return ''+d.jszNum+''; + }, + }, + { + field: "otherNum", + width: '12%', + title: "其他操作证", + unresize: true, + align: "center", + sort:true, + templet: function (d) { + return ''+d.otherNum+''; + }, + }, + { + field: "supName", + width: '20%', + title: "所属供应商", + unresize: true, + align: "center", + sort:true, + }, + { + title: "操作", + width: '13%', + align: "center", + unresize: true, + templet: function (d) { + let html = ""; + html += "详情"; + html += "
|
修改"; + html += "
|
删除"; + return html; + }, + }, + ], + ], + limits: [10, 15, 20, 25, 50, 100], + limit: 10, + page: true, + done: function (res, curr, count) { + pageNum = tableIns.config.page.curr; + table.resize("currentTableId"); + }, + }); +} + +// 导出 +function exportExcel() { + let params = { + 'name': $('#name').val(), + 'supName': $('#supName').val(), + 'isWhiteList': 1 + } + let url = dataUrl + "backstage/carDriver/exportWhiteList"; + exportExcelUtil(url, '驾驶员白名单', JSON.stringify(params)); +} + +// 新增/修改/详情 +function addOrUpdateDriver(obj, type) { + let title = '', content = './child/driver_form.html'; + if (type === 1) { + title = '驾驶员信息新增'; + } else if (type === 2) { + title = '驾驶员信息修改'; + content = './child/driver_edit_form.html'; + } else if (type === 3) { + title = '驾驶员信息详情'; + content = './child/driver_detail.html'; + } + obj.type = type; + openIframeByParamObj("addOrUpdateDriver", title, content, "50%", "92%", obj); +} + +// 删除车辆数据 +function delData(data) { + layer.confirm("确定删除此条数据吗?", { 'title': '操作提示', move: false }, function () { + let loadingMsg = layer.msg('数据删除中,请稍候...', { icon: 16, scrollbar: false, time: 0 }); + let url = dataUrl + "backstage/carDriver/deleteDriverData" + let obj = { 'id': data.id } + let params = { + encryptedData: JSON.stringify(obj) + } + ajaxRequest(url, "POST", params, true, function () { + }, function (result) { + layer.close(loadingMsg); // 关闭提示层 + if (result.code === 200) { + layer.msg(result.msg, { icon: 1 }) + queryTable(1); + } else { + layer.msg(result.msg, { icon: 2 }) + } + }, function (xhr) { + layer.close(loadingMsg); // 关闭提示层 + error(xhr) + }); + }) +} \ No newline at end of file diff --git a/js/car_demand_plan/child/choose_car_or_user_list.js b/js/car_demand_plan/child/choose_car_or_user_list.js index 8b72802..eaac0a4 100644 --- a/js/car_demand_plan/child/choose_car_or_user_list.js +++ b/js/car_demand_plan/child/choose_car_or_user_list.js @@ -15,6 +15,7 @@ function setParams(obj) { } else { initTable2(); $('#nameBox').removeAttr('style'); + $('#whiteBox').removeAttr('style'); } }); } @@ -43,6 +44,7 @@ function queryTable(type) { $('#carNum').val(''); } else { $('#name').val(''); + $('#isWhiteList').val(2); } layui.form.render(); reloadTable(1); @@ -56,6 +58,7 @@ function reloadTable(pageNum) { params.carNum = $('#carNum').val(); } else { params.name = $('#name').val(); + params.isWhiteList = $('#isWhiteList').val(); } table.reload("currentTableId", { page: { @@ -169,7 +172,8 @@ function initTable2() { where: { encryptedData: JSON.stringify({ name: $('#name').val(), - supId: objParam.supId + supId: objParam.supId, + isWhiteList: $('#isWhiteList').val() }), }, request: { @@ -200,7 +204,7 @@ function initTable2() { }, { field: "name", - width: '30%', + width: '25%', title: "姓名", unresize: true, align: "center", @@ -208,12 +212,23 @@ function initTable2() { }, { field: "supName", - width: '50%', + width: '30%', title: "所属供应商", unresize: true, align: "center", sort:true, }, + { + field: "isWhiteList", + width: '25%', + title: "是否为白名单", + unresize: true, + align: "center", + sort:true, + templet: function (d) { + return (d.isWhiteList===1 ? "是" : "否"); + }, + }, ], ], limits: [10, 15, 20, 25, 50, 100], diff --git a/page/car_basic/driver_white_list.html b/page/car_basic/driver_white_list.html new file mode 100644 index 0000000..f429560 --- /dev/null +++ b/page/car_basic/driver_white_list.html @@ -0,0 +1,61 @@ + + + + + + 驾驶员白名单 + + + + + + + + + +
+
+
+ 搜索信息 +
+
+
+
+
+ +
+
+
+
+ +
+
+
+ + + + + +
+
+
+
+
+
+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/page/car_demand_plan/child/choose_car_or_user_list.html b/page/car_demand_plan/child/choose_car_or_user_list.html index 4aa67d3..01c933f 100644 --- a/page/car_demand_plan/child/choose_car_or_user_list.html +++ b/page/car_demand_plan/child/choose_car_or_user_list.html @@ -53,6 +53,15 @@ class="layui-input" lay-affix="clear" placeholder="输入姓名" maxlength="30"> +