From 84c4c0aa6eadde7d31780bf32ee3fab17e30cb90 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期五, 16 九月 2022 16:39:57 +0800
Subject: [PATCH] #
---
src/main/webapp/static/js/cstmr/cstmr.js | 129 ++++++++++++++++++++++++++++++++++++++++---
1 files changed, 120 insertions(+), 9 deletions(-)
diff --git a/src/main/webapp/static/js/cstmr/cstmr.js b/src/main/webapp/static/js/cstmr/cstmr.js
index 3dfb00c..2bcaa69 100644
--- a/src/main/webapp/static/js/cstmr/cstmr.js
+++ b/src/main/webapp/static/js/cstmr/cstmr.js
@@ -1,11 +1,11 @@
var pageCurr;
var pageCount = 0;
+var treeCond;
layui.config({
base: baseUrl + "/static/layui/lay/modules/"
}).extend({
- dropdown: 'dropdown/dropdown',
cascader: 'cascader/cascader',
-}).use(['table','laydate', 'form', 'admin', 'xmSelect', 'dropdown', 'element', 'cascader'], function(){
+}).use(['table','laydate', 'form', 'admin', 'xmSelect', 'element', 'cascader', 'tree', 'dropdown'], function(){
var table = layui.table;
var $ = layui.jquery;
var layer = layui.layer;
@@ -14,6 +14,102 @@
var admin = layui.admin;
var xmSelect = layui.xmSelect;
var cascader = layui.cascader;
+ var tree = layui.tree;
+ var dropdown = layui.dropdown;
+
+ $('#organization').html(localStorage.getItem('nickname') + ' <i class="layui-icon"></i>');
+
+ // 閮ㄩ棬浜哄憳 绛涢��
+ dropdown.render({
+ elem: '#organization'
+ ,content: ['<div id="organizationTree" style="height: calc(100vh - 525px);border: none"></div>'].join('')
+ ,style: 'width: 370px; height: 500px; padding: 0 15px; box-shadow: 1px 1px 30px rgb(0 0 0 / 12%);'
+ ,ready: function(){
+ loadTree();
+ }
+ });
+
+ // 鏁版嵁鍚屾
+ dropdown.render({
+ elem: '#data-btn'
+ ,align: 'right'
+ ,style: 'border-radius: 5px;'
+ ,className: 'site-dropdown-demo'
+ ,data: [
+ {
+ title: '妯℃澘涓嬭浇'
+ ,templet: '<i class="layui-icon layui-icon-template-1"></i>{{d.title}}'
+ ,id: 1
+ },
+ {
+ title: '瀵煎叆 Excel'
+ ,templet: '<i class="layui-icon layui-icon-upload"></i>{{d.title}}'
+ ,id: 2
+ },
+ {type: '-'}, //鍒嗗壊绾�
+ {
+ title: '瀵煎嚭 Excel'
+ ,templet: '<i class="layui-icon layui-icon-export"></i>{{d.title}}'
+ ,id: 3
+ }
+ ]
+ ,click: function(item){
+ switch (item.id) {
+ case 1:
+ break
+ case 2:
+ break
+ case 3:
+ break
+ default:
+ break
+ }
+ }
+ });
+
+ // 鏍戝舰鍥�
+ var organizationTree;
+ window.loadTree = function(condition){
+ var loadIndex = layer.load(2);
+ $.ajax({
+ url: baseUrl+"/dept/user/tree/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data: {
+ 'condition': condition
+ },
+ method: 'POST',
+ success: function (res) {
+ layer.close(loadIndex);
+ if (res.code === 200){
+ organizationTree = tree.render({
+ elem: '#organizationTree',
+ id: 'organizationTree',
+ onlyIconControl: true,
+ data: res.data,
+ click: function (obj) {
+ treeCond = {
+ key: obj.data.key,
+ val: obj.data.id
+ }
+ $('#organization').html(obj.data.title + ' <i class="layui-icon"></i>');
+ $('#organizationTree').find('.ew-tree-click').removeClass('ew-tree-click');
+ $(obj.elem).children('.layui-tree-entry').addClass('ew-tree-click');
+ clearFormVal($('#search-box'));
+ tableIns.reload({
+ where: {[obj.data.key]: obj.data.id},
+ page: {curr: 1}
+ });
+ }
+ });
+ treeData = res.data;
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ } else {
+ layer.msg(res.msg)
+ }
+ }
+ })
+ }
// 鏁版嵁娓叉煋
tableIns = table.render({
@@ -23,22 +119,22 @@
page: true,
limit: 15,
limits: [15, 30, 50, 100, 200, 500],
- cellMinWidth: 100,
- height: 'full-145',
+ // cellMinWidth: 100,
+ height: 'full-148',
// size: 'sm',
skin: 'line',
cols: [[
{type: 'checkbox'}
// ,{field: 'id', align: 'center',title: 'ID'}
// ,{field: 'hostId$', align: 'center',title: '鎵�灞炲晢鎴�'}
- ,{field: 'name', align: 'left',title: '瀹㈡埛鍚嶇О'}
+ ,{field: 'name', align: 'left',title: '瀹㈡埛鍚嶇О', style: 'color: #1890ff;cursor:pointer', event: 'more'}
,{field: 'uuid', align: 'left',title: '瀹㈡埛浠e彿'}
,{field: 'addr', align: 'left',title: '璇︾粏鍦板潃', templet:function(d){return emptyShow(d.addr)}}
,{field: 'tel', align: 'left',title: '鐢佃瘽', templet:function(d){return emptyShow(d.tel)}}
,{field: 'remarks', align: 'left',title: '澶囨敞', templet:function(d){return emptyShow(d.remarks)}}
- ,{field: 'createTime$', align: 'left',title: '娣诲姞鏃堕棿'}
- ,{field: 'userId$', align: 'left',title: '娣诲姞浜哄憳'}
,{field: 'cstmrType$', align: 'left',title: '瀹㈡埛绫诲埆'}
+ ,{field: 'userId$', align: 'left',title: '娣诲姞浜哄憳'}
+ ,{field: 'createTime$', align: 'left',title: '娣诲姞鏃堕棿'}
,{field: 'deptId$', align: 'left',title: '鎵�灞為儴闂�', hide: true}
,{field: 'simple', align: 'left',title: '瀹㈡埛绠�绉�', hide: true}
,{field: 'rela', align: 'left',title: '瀹㈡埛鍏崇郴', hide: true}
@@ -118,6 +214,18 @@
table.on('tool(cstmr)', function(obj){
var data = obj.data;
switch (obj.event) {
+ case 'more':
+ top.cstmrByMore = data.id;
+ admin.popupRight({
+ type: 1,
+ window: "top",
+ area: "1250px",
+ url: "cstmr_more.html",
+ end: function () {
+ $(".layui-laypage-btn")[0].click();
+ }
+ })
+ break;
case 'edit':
showEditModel(data);
break;
@@ -200,6 +308,7 @@
// 鎼滅储
form.on('submit(search)', function (data) {
pageCurr = 1;
+ pageCount = 0;
tableReload();
});
@@ -234,8 +343,7 @@
itemHeight: '250px',
filterable: true,
onChange: function (values, data) {
- // console.log(values);
- // console.log(data);
+ // console.log(values);console.log(data);
}
});
}
@@ -253,6 +361,9 @@
$.each($('#search-box [name]').serializeArray(), function() {
searchData[this.name] = this.value;
});
+ if (treeCond) {
+ searchData[treeCond.key] = treeCond.val;
+ }
tableIns.reload({
where: searchData,
page: {curr: pageCurr}
--
Gitblit v1.9.1