lyh
8 小时以前 b6247699693bdc200539f20851b3d2105fe8b674
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// 两列拖动改变两列宽度
export function dragTwoColDiv(contentId,leftBoxId,resizeId,rightBoxId){
  let resize = document.getElementById(resizeId);
  let leftBox = document.getElementById(leftBoxId);
  let rightBox = document.getElementById(rightBoxId);
  let box = document.getElementById(contentId);
  resize.onmousedown = function (e) {
    let startX = e.clientX;
    resize.left = resize.offsetLeft;
    document.onmousemove = function (e) {
      let endX = e.clientX;
      let moveLen = resize.left + (endX - startX);
      let maxT = box.clientWidth - resize.offsetWidth;
      if (moveLen < 150) moveLen = 150;
      if (moveLen > maxT - 150) moveLen = maxT - 150;
      resize.style.left = moveLen;
      leftBox.style.width = moveLen + 'px';
      rightBox.style.width = (box.clientWidth - moveLen - 5) + 'px';
    }
    document.onmouseup = function () {
      document.onmousemove = null;
      document.onmouseup = null;
      resize.releaseCapture && resize.releaseCapture();
    }
    resize.setCapture && resize.setCapture();
    return false;
  }
}
// 三列拖动改变div宽度
export function dragThreeColDiv(contentId,leftBoxId,resizeOne,centerBoxId,resizeTwo,rightBoxId) {
  let resizeO = document.getElementById(resizeOne);
  let resizeT = document.getElementById(resizeTwo);
  let leftBox = document.getElementById(leftBoxId);
  let rightBox = document.getElementById(rightBoxId);
  let centerBox = document.getElementById(centerBoxId);
  let box = document.getElementById(contentId);
  resizeO.onmousedown = function (e) {
    let startX = e.clientX;
    resizeO.left = resizeO.offsetLeft;
    document.onmousemove = function (e) {
      let endX = e.clientX;
      let rightW = rightBox.offsetWidth;
      let moveLen = resizeO.left + (endX - startX);
      let maxT = box.clientWidth - resizeO.offsetWidth;
      if (moveLen < 150) moveLen = 150;
      if (moveLen > maxT - rightW - 150) moveLen = maxT - rightW - 150;
      resizeO.style.left = moveLen;
      leftBox.style.width = moveLen + 'px';
      centerBox.style.width = (box.clientWidth - moveLen - rightW - 10) + 'px';
    }
    document.onmouseup = function () {
      document.onmousemove = null;
      document.onmouseup = null;
      resizeO.releaseCapture && resizeO.releaseCapture();
    }
    resizeO.setCapture && resizeO.setCapture();
    return false;
  }
  resizeT.onmousedown = function (e) {
    let startX = e.clientX;
    resizeT.left = resizeT.offsetLeft;
    document.onmousemove = function (e) {
      let endX = e.clientX;
      let leftW = leftBox.offsetWidth;
      let moveLen = resizeT.left + (endX - startX) - leftW;
      let maxT = box.clientWidth - resizeT.offsetWidth - 5;
      if (moveLen < 150) moveLen = 150;
      if (moveLen > maxT - leftW - 150) moveLen = maxT - leftW - 150;
      resizeT.style.left = moveLen;
      centerBox.style.width = moveLen + 'px';
      rightBox.style.width = (box.clientWidth - moveLen - leftW - 10) + 'px';
    }
    document.onmouseup = function () {
      document.onmousemove = null;
      document.onmouseup = null;
      resizeT.releaseCapture && resizeT.releaseCapture();
    }
    resizeT.setCapture && resizeT.setCapture();
    return false;
  }
 
}
// 上下拖动改变上下两个模块的高度
export function dragTwoRowDiv(contentId,topBoxId,resizeId,downBoxId){
  let resize = document.getElementById(resizeId);
  let topBox = document.getElementById(topBoxId);
  let downBox = document.getElementById(downBoxId);
  let box = document.getElementById(contentId);
  resize.onmousedown = function (e) {
    let startY = e.clientY;
    resize.top = resize.offsetTop;
    document.onmousemove = function (e) {
      let processTable = document.getElementById('processTable');
      let ncDocTable= document.getElementById('ncDocTable');
      let otherTableData = document.getElementById('otherTableData');
      let deviceDocTable = document.getElementById('deviceDocTable');
      let nodeInfoTable = document.getElementById('nodeInfoTable');
      let docPreview = document.getElementById('docPreview');
      let docEdition = document.getElementById('docEdition');
      let usedLog = document.getElementById('usedLog');
      let auditingLog = document.getElementById('auditingLog');
      let endY = e.clientY;
      let moveLen = resize.top + (endY - startY);
      let maxT = box.clientHeight - resize.offsetHeight;
      if (moveLen < 100) moveLen = 100;
      if (moveLen > maxT - 100) moveLen = maxT - 100;
      resize.style.top = moveLen;
      topBox.style.height = moveLen + "px";
      if (ncDocTable != null) {
        ncDocTable.style.height = moveLen -90 + "px";
      }
      if (otherTableData != null) {
        otherTableData.style.height = moveLen -95 + "px";
      }
      if (deviceDocTable != null) {
        deviceDocTable.style.height = moveLen -95 + "px";
      }
      if (processTable != null) {
        processTable.style.height = moveLen -60 + "px";
      }
      downBox.style.height = (box.clientHeight - moveLen - 10) + "px";
      if (nodeInfoTable != null) {
        nodeInfoTable.style.height = (box.clientHeight - moveLen - 120) + "px";
      }
      if (docPreview != null) {
        docPreview.style.height = (box.clientHeight - moveLen - 120) + "px";
      }
      if (docEdition != null) {
        docEdition.style.height = (box.clientHeight - moveLen - 120) + "px";
      }
      if (usedLog != null) {
        usedLog.style.height = (box.clientHeight - moveLen - 120) + "px";
      }
      if (auditingLog != null) {
        auditingLog.style.height = (box.clientHeight - moveLen - 120) + "px";
      }
    }
    document.onmouseup = function () {
      document.onmousemove = null;
      document.onmouseup = null;
      resize.releaseCapture && resize.releaseCapture();
    }
    resize.setCapture && resize.setCapture();
    return false;
  }
}