This commit is contained in:
2021-05-13 23:35:10 +00:00
parent 1cf4f90fd6
commit 881564f1b8
5 changed files with 38 additions and 10 deletions

View File

@@ -339,6 +339,23 @@ export default {
);
},
///////////////////////////////
// Truncate a string
//truncates and adds ellipses
//
// @param {String} source string
// @param {number} length desired
// @return {string} A new string truncated with ellipses at end
truncateString: function(s, len) {
if (this.stringIsNullOrEmpty(s)) {
return s;
}
if (s.length > len) {
return s.substring(0, len) + "...";
} else {
return s;
}
},
///////////////////////////////
// Format tags for display
//
//

View File

@@ -1003,9 +1003,13 @@ function buildRecords(listData, columndefinitions, ridColumnOpenable) {
);
break;
case 4: //text
if (display.length > MAX_TEXT_COLUMN_LENGTH) {
display = display.substring(0, MAX_TEXT_COLUMN_LENGTH) + "...";
}
// if (display.length > MAX_TEXT_COLUMN_LENGTH) {
// display = display.substring(0, MAX_TEXT_COLUMN_LENGTH) + "...";
// }
display = window.$gz.util.truncateString(
display,
MAX_TEXT_COLUMN_LENGTH
);
break;
case 5: //Integer
//display is already set, just some styling to do

View File

@@ -939,7 +939,7 @@ export default {
this.pvm.languageName,
this.pvm.currencyName
),
serviceDetails: x.serviceDetails
serviceDetails: window.$gz.util.truncateString(x.serviceDetails, 100)
};
});
},

View File

@@ -916,8 +916,7 @@ async function saveLabors(vm, woItemIndex) {
for (let i = 0; i < vm.obj.items[woItemIndex].labors.length; i++) {
let o = vm.obj.items[woItemIndex].labors[i];
if (o.isDirty) {
const isPost = o.id == 0;
let res = await window.$gz.api.upsert(`${API_BASE_URL}items/labors`, o);
const res = await window.$gz.api.upsert(`${API_BASE_URL}items/labors`, o);
if (res.error) {
handleSaveError(vm, {
error: res.error,
@@ -927,9 +926,7 @@ async function saveLabors(vm, woItemIndex) {
});
} else {
//Server will update fields on put or post for most workorder graph objecs so need to update entire object here
vm.obj.items[woItemIndex].labors.splice(i, 1, res.data); //vue needs the splice to trigger reactivity or else the UI won't update
//vm.obj.items[woItemIndex].labors[i] = res.data;
vm.obj.items[woItemIndex].labors.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update
}
}
}