This commit is contained in:
2023-06-05 10:10:22 +08:00
parent 9da1c4cf30
commit 634e8b71ab
18 changed files with 367 additions and 143 deletions

View File

@ -166,6 +166,39 @@
opacity: 1;
opacity: initial
}
html::-webkit-scrollbar {
width: 8px;
height: 8px;
}
html::-webkit-scrollbar-thumb {
background-color: rgba(168, 168, 168, 0.9);
border-radius: 4px;
}
#workorderspliter {
height: 6px;
background-color: gray;
cursor: ns-resize;
margin: 6px 0 4px;
}
#workorderdetail {
position: relative;
overflow: auto;
}
#workorderdetail::-webkit-scrollbar {
width: 8px;
height: 8px;
}
#workorderdetail::-webkit-scrollbar-thumb {
background-color: rgba(168, 168, 168, 0.9);
border-radius: 4px;
}
#workorderdetail>.ui-popup-mask {
position: absolute;
}
</style>
<link href="<%=GetFileUrlWithVersion("../css/panel.css")%>" rel="stylesheet" />
@ -1010,6 +1043,10 @@
var dialogWidgets;
var widgetHeight = Number(localStorage.getItem('spliter_height'));
if (isNaN(widgetHeight) || widgetHeight < 100 || widgetHeight > 1000) {
widgetHeight = 300;
}
$(function () {
setPageTitle(GetTextByKey("P_WORKORDER", "Work Order"), true);
$('.iconlayout').on('click', function (ev) {
@ -1062,8 +1099,17 @@
});
$(window).resize(function () {
$("#workorderlist").css("height", $(window).height() - $("#workorderlist").offset().top - 10);
var top = $("#workorderlist").offset().top;
var height = $(window).height() - top - 10;
var widget = wowidgetobj?.workorderwidgets?.length > 0;
if (widget) {
height -= widgetHeight + 10;
}
$("#workorderlist").css("height", height);
grid_dt && grid_dt.resize();
//if (widget) {
// $('#workorderdetail').css('height', top + height + 6);
//}
}).resize();
$('#dialog_alerts').prop('iframe', true).dialog(function () {
@ -1102,6 +1148,46 @@
$('#spExport').hide();
}
var list = document.querySelector('#workorderlist');
var detail = document.querySelector('#workorderdetail');
detail.style.height = widgetHeight + 'px';
document.querySelector('#workorderspliter').addEventListener('mousedown', function (e) {
if (e.buttons !== 1) {
return;
}
var oy = e.clientY;
var oheight = widgetHeight;
var parent = document.body;
var top = document.querySelector('#workorderlist').offsetTop;
var windowHeight = window.innerHeight;
var gridbody = list.querySelector('.data-grid-body');
var headerHeight = list.querySelector('.data-grid-table-header').offsetHeight;
var move = function (e2) {
if (e2.buttons !== 1) {
parent.dispatchEvent(new MouseEvent('mouseup'));
return;
}
var y = e2.clientY - oy;
var height = oheight - y;
if (height > 100) {
widgetHeight = height;
detail.style.height = widgetHeight + 'px';
height = windowHeight - top - 10 - height - 10;
list.style.height = height + 'px';
gridbody.style.height = (height - headerHeight) + 'px';
}
};
parent.addEventListener('mousemove', move, { passive: false });
var up = function () {
grid_dt?.resize();
parent.removeEventListener('mousemove', move, { passive: false });
parent.removeEventListener('mouseup', up);
localStorage.setItem('spliter_height', String(widgetHeight));
};
parent.addEventListener('mouseup', up);
});
openmsgwebsocket();
});
@ -1437,7 +1523,8 @@
</div>
<div class="clear"></div>
<div id="workorderlist"></div>
<div id="workorderdetail"></div>
<div id="workorderspliter" style="display: none"></div>
<div id="workorderdetail" style="display: none"></div>
</div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>

View File

@ -1292,9 +1292,12 @@ function InitGridData() {
grid_dt.selectedrowchanged = function (rowindex) {
var rowdata = grid_dt.source[rowindex];
if (rowdata && rowdata.Values.Id.Value > 0) {
if (!wowidgetobj)
if (!wowidgetobj) {
wowidgetobj = new WorkOrderWidget();
wowidgetobj.changeWorkOrder(rowdata.Values);
wowidgetobj.changeWorkOrder(rowdata.Values);
} else {
wowidgetobj.changeWorkOrder(rowdata.Values);
}
}
}

View File

@ -391,7 +391,7 @@ if (typeof ($woestimate) !== "function") {
tb_att.append(tr_att);
var td_att = $('<td></td>');
tr_att.append(td_att);
div_att = $('<div class="content_main" style="max-height: 80px; overflow: auto;"></div>');
div_att = $('<div style="max-height: 80px; overflow: auto;padding: 0 4px;"></div>');
td_att.append(div_att);
tb_att = $('<table id="tab_est_atts" style="table-layout: fixed;"></table>');
div_att.append(tb_att);
@ -528,7 +528,7 @@ if (typeof ($woestimate) !== "function") {
tb_att.append(tr_att);
var td_att = $('<td></td>');
tr_att.append(td_att);
div_att = $('<div class="content_main" style="max-height: 80px; overflow: auto;"></div>');
div_att = $('<div style="max-height: 80px; overflow: auto;padding: 0 4px;"></div>');
td_att.append(div_att);
tb_att = $('<table id="tab_woest_atts" style="table-layout: fixed;"></table>');
div_att.append(tb_att);
@ -944,7 +944,7 @@ if (typeof ($woestimate) !== "function") {
tb_att.append(tr_att);
var td_att = $('<td></td>');
tr_att.append(td_att);
div_att = $('<div class="content_main" style="max-height: 80px; overflow: auto;"></div>');
div_att = $('<div style="max-height: 80px; overflow: auto;padding: 0 4px;"></div>');
td_att.append(div_att);
tb_att = $('<table id="tab_est_atts' + estimateindex + '" style="table-layout: fixed;"></table>');
div_att.append(tb_att);
@ -1812,7 +1812,7 @@ if (typeof ($woinvoice) !== "function") {
tb_att.append(tr_att);
var td_att = $('<td></td>');
tr_att.append(td_att);
div_att = $('<div class="content_main" style="max-height: 80px; overflow: auto;"></div>');
div_att = $('<div style="max-height: 80px; overflow: auto;padding: 0 4px;"></div>');
td_att.append(div_att);
tb_att = $('<table id="tab_invoice_atts" style="table-layout: fixed;"></table>');
div_att.append(tb_att);
@ -1943,7 +1943,7 @@ if (typeof ($woinvoice) !== "function") {
tb_att.append(tr_att);
var td_att = $('<td></td>');
tr_att.append(td_att);
div_att = $('<div class="content_main" style="max-height: 80px; overflow: auto;"></div>');
div_att = $('<div style="max-height: 80px; overflow: auto;padding: 0 4px;"></div>');
td_att.append(div_att);
tb_att = $('<table id="tab_woinvoice_atts" style="table-layout: fixed;"></table>');
div_att.append(tb_att);
@ -2369,7 +2369,7 @@ if (typeof ($woinvoice) !== "function") {
tb_att.append(tr_att);
var td_att = $('<td></td>');
tr_att.append(td_att);
div_att = $('<div class="content_main" style="max-height: 80px; overflow: auto;"></div>');
div_att = $('<div style="max-height: 80px; overflow: auto;padding: 0 4px;"></div>');
td_att.append(div_att);
tb_att = $('<table id="tab_invoice_atts' + invoice_index + '" style="table-layout: fixed;"></table>');
div_att.append(tb_att);

View File

@ -195,9 +195,15 @@ var WorkOrderWidget = function () {
return;
}
_this.workorderwidgets = data;
var display = data?.length > 0 ? 'block' : 'none';
$('#workorderspliter').css('display', display);
$('#workorderdetail').css('display', display);
_this.showWorkOrderWidgets();
_this.getWorkOrderContacts(_this.workorderid);
setTimeout(function () {
$(window).resize();
document.querySelector('#workorderdetail').scrollTop = 0;
}, 0);
}, function () {
showAlert(GetTextByKey("P_XXXX", 'Failed to get the work order widget list.'), title);
});
@ -259,6 +265,9 @@ var WorkOrderWidget = function () {
this.workorderwidgets = null;
this.popups = [];
this.widgets = [];
$('#workorderspliter').css('display', 'none');
$('#workorderdetail').css('display', 'none');
$(window).resize();
}
}
}
@ -313,25 +322,33 @@ var WorkOrderWidget = function () {
this.createWidgetDialog = function (widget) {
const ui = window['lib-ui'];
let width = $(document.body).width();
let layout = widget.Layout;
if (!layout || layout === '') {
let x = this.defX;
let y = this.defY;
let width = $(document.body).width();
let height = $(document.body).height();
let left = 20 + 320 * x;
let left = 10 + 315 * x;
if (left + 300 > width) {
x = 0;
left = 20;
left = 10;
y++;
this.defY = y;
}
let top = height - (y == 0 ? 420 : 320 * (y + 1));
let top = 10 + 165 * y;
if (top >= widgetHeight) {
top = widgetHeight - 40;
}
x++;
this.defX = x;
layout = { left, top, width: 300, height: 400 };
} else {
layout = JSON.parse(widget.Layout);
if (layout.top >= widgetHeight) {
layout.top = widgetHeight - 40;
}
if (layout.left >= width) {
layout.left = width - 10;
}
}
let zIndex = this.currentZIndex--;
@ -361,7 +378,7 @@ var WorkOrderWidget = function () {
onMoveEnded: function () { _this.saveWorkOrderWidgets(widget, popup.rect) },
onResizeEnded: function () { _this.saveWorkOrderWidgets(widget, popup.rect) }
});
popup.show();
popup.show(document.querySelector('#workorderdetail'));
popup.rect = layout;
this.popups[widget.WidgetId] = popup;