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

@ -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;