isobit-ui 0.2.131 → 0.2.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1066 -1031
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* isobit-ui v0.2.
|
|
2
|
+
* isobit-ui v0.2.131
|
|
3
3
|
* (c) Erik Alarcon Pinedo
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -56,6 +56,20 @@ function _typeof(obj) {
|
|
|
56
56
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
57
57
|
}, _typeof(obj);
|
|
58
58
|
}
|
|
59
|
+
function _defineProperty(obj, key, value) {
|
|
60
|
+
key = _toPropertyKey(key);
|
|
61
|
+
if (key in obj) {
|
|
62
|
+
Object.defineProperty(obj, key, {
|
|
63
|
+
value: value,
|
|
64
|
+
enumerable: true,
|
|
65
|
+
configurable: true,
|
|
66
|
+
writable: true
|
|
67
|
+
});
|
|
68
|
+
} else {
|
|
69
|
+
obj[key] = value;
|
|
70
|
+
}
|
|
71
|
+
return obj;
|
|
72
|
+
}
|
|
59
73
|
function _slicedToArray(arr, i) {
|
|
60
74
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
61
75
|
}
|
|
@@ -141,6 +155,20 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
141
155
|
}
|
|
142
156
|
};
|
|
143
157
|
}
|
|
158
|
+
function _toPrimitive(input, hint) {
|
|
159
|
+
if (typeof input !== "object" || input === null) return input;
|
|
160
|
+
var prim = input[Symbol.toPrimitive];
|
|
161
|
+
if (prim !== undefined) {
|
|
162
|
+
var res = prim.call(input, hint || "default");
|
|
163
|
+
if (typeof res !== "object") return res;
|
|
164
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
165
|
+
}
|
|
166
|
+
return (hint === "string" ? String : Number)(input);
|
|
167
|
+
}
|
|
168
|
+
function _toPropertyKey(arg) {
|
|
169
|
+
var key = _toPrimitive(arg, "string");
|
|
170
|
+
return typeof key === "symbol" ? key : String(key);
|
|
171
|
+
}
|
|
144
172
|
|
|
145
173
|
//
|
|
146
174
|
//
|
|
@@ -6261,7 +6289,8 @@ Vue__default["default"].mergeDeep = function () {
|
|
|
6261
6289
|
};
|
|
6262
6290
|
|
|
6263
6291
|
window.ui = _$1.ui = function (cfg) {
|
|
6264
|
-
var
|
|
6292
|
+
var _defs;
|
|
6293
|
+
var defs = (_defs = {
|
|
6265
6294
|
watch: {
|
|
6266
6295
|
$route: function $route(v) {
|
|
6267
6296
|
Vue__default["default"].resize();
|
|
@@ -6277,14 +6306,24 @@ window.ui = _$1.ui = function (cfg) {
|
|
|
6277
6306
|
}
|
|
6278
6307
|
}
|
|
6279
6308
|
},
|
|
6309
|
+
data: function data() {
|
|
6310
|
+
return {
|
|
6311
|
+
_connected: null
|
|
6312
|
+
};
|
|
6313
|
+
},
|
|
6280
6314
|
computed: {
|
|
6281
6315
|
connected: {
|
|
6282
6316
|
get: function get() {
|
|
6283
|
-
|
|
6317
|
+
console.log(this);
|
|
6318
|
+
if (this._connected) {
|
|
6319
|
+
this._connected = this.session.connected;
|
|
6320
|
+
}
|
|
6321
|
+
return this.online && this._connected !== false;
|
|
6284
6322
|
},
|
|
6285
6323
|
set: function set(v) {
|
|
6286
6324
|
var me = this;
|
|
6287
6325
|
var session = me.session;
|
|
6326
|
+
this._connected = v;
|
|
6288
6327
|
//session.connected=v;
|
|
6289
6328
|
this.$set(session, 'connected', v);
|
|
6290
6329
|
me.session = session;
|
|
@@ -6329,1120 +6368,1116 @@ window.ui = _$1.ui = function (cfg) {
|
|
|
6329
6368
|
baseURL: function baseURL() {
|
|
6330
6369
|
return Vue__default["default"].baseURL ? Vue__default["default"].baseURL : axios__default["default"].defaults.baseURL;
|
|
6331
6370
|
}
|
|
6371
|
+
}
|
|
6372
|
+
}, _defineProperty(_defs, "data", function data() {
|
|
6373
|
+
var me = this;
|
|
6374
|
+
return {
|
|
6375
|
+
filters: {},
|
|
6376
|
+
ui: me,
|
|
6377
|
+
_session: null,
|
|
6378
|
+
//rowSelectedCount: 0,
|
|
6379
|
+
row: {}
|
|
6380
|
+
};
|
|
6381
|
+
}), _defineProperty(_defs, "updated", function updated() {
|
|
6382
|
+
// console.log(this);
|
|
6383
|
+
}), _defineProperty(_defs, "mounted", function mounted() {
|
|
6384
|
+
var me = this;
|
|
6385
|
+
var vueid = _$1.id();
|
|
6386
|
+
//error cuando se carga un mapa con v-panel el mapa de turismo es ejemplo
|
|
6387
|
+
if (me.$el && me.$el.setAttribute) {
|
|
6388
|
+
me.$el.setAttribute("vueid", vueid);
|
|
6389
|
+
}
|
|
6390
|
+
_$1.varMap[vueid] = me;
|
|
6391
|
+
me.ddd(me.$root);
|
|
6392
|
+
}), _defineProperty(_defs, "methods", {
|
|
6393
|
+
resize: function resize() {
|
|
6394
|
+
Vue__default["default"].resize();
|
|
6332
6395
|
},
|
|
6333
|
-
|
|
6396
|
+
vv: function vv(v) {
|
|
6334
6397
|
var me = this;
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6398
|
+
var sf = function sf(status) {
|
|
6399
|
+
if (status.connected) {
|
|
6400
|
+
var session = localStorage.getItem('session');
|
|
6401
|
+
if (session) {
|
|
6402
|
+
try {
|
|
6403
|
+
session = JSON.parse(session);
|
|
6404
|
+
} catch (e) {
|
|
6405
|
+
console.log(e);
|
|
6406
|
+
session = {};
|
|
6407
|
+
}
|
|
6408
|
+
session.connected = v;
|
|
6409
|
+
localStorage.setItem('session', JSON.stringify(session));
|
|
6410
|
+
}
|
|
6411
|
+
} else {
|
|
6412
|
+
me.toast('El dispositivo no tiene acceso a internet!');
|
|
6413
|
+
me.connected = status.connected;
|
|
6414
|
+
}
|
|
6341
6415
|
};
|
|
6416
|
+
Network.getStatus().then(sf);
|
|
6342
6417
|
},
|
|
6343
|
-
|
|
6344
|
-
|
|
6418
|
+
bindLinks: function bindLinks(el, callback) {
|
|
6419
|
+
var me = this;
|
|
6420
|
+
el = el ? el : me.$el;
|
|
6421
|
+
//console.log(el);
|
|
6422
|
+
//console.log("ENTLO")
|
|
6423
|
+
if (el.querySelectorAll) {
|
|
6424
|
+
//var a=el.querySelectorAll('a:not(._),ion-item:not(._)');
|
|
6425
|
+
var a = el.querySelectorAll('a:not(._),ion-item:not(._)');
|
|
6426
|
+
//console.log(a)
|
|
6427
|
+
var f0 = function f0(e) {
|
|
6428
|
+
e.preventDefault();
|
|
6429
|
+
};
|
|
6430
|
+
var f = function f(e) {
|
|
6431
|
+
e.preventDefault();
|
|
6432
|
+
if (callback) callback();
|
|
6433
|
+
me.open(e);
|
|
6434
|
+
};
|
|
6435
|
+
for (var i = 0; i < a.length; i++) {
|
|
6436
|
+
if (a[i].attributes.href) {
|
|
6437
|
+
a[i].onclick = f;
|
|
6438
|
+
} else a[i].onclick = f0;
|
|
6439
|
+
a[i].classList ? a[i].classList.add('_') : a[i].className = '_';
|
|
6440
|
+
}
|
|
6441
|
+
}
|
|
6442
|
+
},
|
|
6443
|
+
MsgBox: _$1.MsgBox,
|
|
6444
|
+
changeRoute: function changeRoute() {/*console.log(v)*/},
|
|
6445
|
+
pad: Vue__default["default"].pad,
|
|
6446
|
+
key: function key() {
|
|
6447
|
+
return Math.random();
|
|
6345
6448
|
},
|
|
6346
|
-
|
|
6449
|
+
submitFile: function submitFile(f, name, cb) {
|
|
6450
|
+
var formData = new FormData();
|
|
6451
|
+
name = name ? name : f.name.replace(/[^\w\s.]/gi, '');
|
|
6452
|
+
formData.append('filename', name);
|
|
6453
|
+
formData.append('file', f, name);
|
|
6454
|
+
axios__default["default"].post('/api/file/upload', formData, {
|
|
6455
|
+
headers: {
|
|
6456
|
+
'Content-Type': 'multipart/form-data',
|
|
6457
|
+
filename: name
|
|
6458
|
+
}
|
|
6459
|
+
}).then(function (r) {
|
|
6460
|
+
cb(r.data);
|
|
6461
|
+
})["catch"](function () {
|
|
6462
|
+
console.log('FAILURE!!');
|
|
6463
|
+
});
|
|
6464
|
+
},
|
|
6465
|
+
go: function go(e) {
|
|
6466
|
+
window.o(e);
|
|
6467
|
+
},
|
|
6468
|
+
ddd: function ddd() {
|
|
6469
|
+
// for(var i=0;i<o.$children.length;i++){
|
|
6470
|
+
// var child=o.$children[i];
|
|
6471
|
+
// console.log(child);
|
|
6472
|
+
// if (child.$vnode.tag && child.$vnode.tag.includes("v-table")) {
|
|
6473
|
+
// //child.setColumns(columns);
|
|
6474
|
+
// }else{
|
|
6475
|
+
// this.ddd(child);
|
|
6476
|
+
// }
|
|
6477
|
+
// }
|
|
6478
|
+
} /*o*/,
|
|
6479
|
+
rowCreated: function rowCreated(r) {
|
|
6480
|
+
this.row = r;
|
|
6481
|
+
},
|
|
6482
|
+
getSelected: function getSelected(e) {
|
|
6347
6483
|
var me = this;
|
|
6348
|
-
var
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6484
|
+
var t = e && e.$vnode ? e : me.$children[0].$children[0];
|
|
6485
|
+
var s = [];
|
|
6486
|
+
for (var i = 0; i < t.selected.length; i++) {
|
|
6487
|
+
s.push(t.data[t.selected[i]]);
|
|
6352
6488
|
}
|
|
6353
|
-
|
|
6354
|
-
me.ddd(me.$root);
|
|
6489
|
+
return s;
|
|
6355
6490
|
},
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6491
|
+
getRowSelectedCount: function getRowSelectedCount() {
|
|
6492
|
+
var me = this;
|
|
6493
|
+
var t = me.$children[0].$children[0];
|
|
6494
|
+
return t ? t.selected.length : 0;
|
|
6495
|
+
},
|
|
6496
|
+
rewrite: function rewrite(url) {
|
|
6497
|
+
return url;
|
|
6498
|
+
},
|
|
6499
|
+
create: function create() {
|
|
6500
|
+
var me = this;
|
|
6501
|
+
var action = me.$children[0].action;
|
|
6502
|
+
if (!action) action = window.location.pathname;
|
|
6503
|
+
action = _$1.processURL(action);
|
|
6504
|
+
if (action) action = action.replace("/api", "");
|
|
6505
|
+
if (_$1.app) {
|
|
6506
|
+
me.open(action + '/create');
|
|
6507
|
+
} else {
|
|
6508
|
+
instance.get(_$1.currentPath = (action + '/create').replace(/([^:]\/)\/+/g, "$1") + '?modal').then(_$1.open)["catch"](me.error);
|
|
6509
|
+
}
|
|
6510
|
+
},
|
|
6511
|
+
edit: function edit(e) {
|
|
6512
|
+
var me = this;
|
|
6513
|
+
var f = me.$children[0];
|
|
6514
|
+
var action = f.action;
|
|
6515
|
+
var t = [].filter.call(e.component.$parent.$children, function (e) {
|
|
6516
|
+
return e.$el.classList.contains('v-datatable');
|
|
6517
|
+
})[0];
|
|
6518
|
+
if (!action) {
|
|
6519
|
+
action = window.location.pathname;
|
|
6520
|
+
}
|
|
6521
|
+
if (t && t.src) action = t.src;
|
|
6522
|
+
if (e.action) action = e.action;
|
|
6523
|
+
if (!t) {
|
|
6524
|
+
t = e.$vnode ? e : e.target && e.target.$vnode ? e : me.$children[0].$children[0];
|
|
6525
|
+
if (t.src) action = t.src;
|
|
6526
|
+
}
|
|
6527
|
+
if (action) action = me.rewrite(action.replace("/api", "").replace("/0/0", ""));
|
|
6528
|
+
var selected = me.getSelected(t)[0];
|
|
6529
|
+
var id = selected[t.rowKey];
|
|
6530
|
+
if (selected.tmpId) id = -selected.tmpId;
|
|
6531
|
+
console.log(selected);
|
|
6532
|
+
if (me.getSelectedId) id = me.getSelectedId(selected);
|
|
6533
|
+
if (_$1.app) {
|
|
6534
|
+
me.open(action + '/' + id + '/edit');
|
|
6535
|
+
} else {
|
|
6536
|
+
axios__default["default"].get((_$1.currentPath = (action + '/' + id + '/edit').replace(/([^:]\/)\/+/g, "$1")) + '?modal').then(me.open)["catch"](me.error);
|
|
6537
|
+
}
|
|
6538
|
+
},
|
|
6539
|
+
get: function get(part) {
|
|
6540
|
+
var me = this;
|
|
6541
|
+
var p = me.$el;
|
|
6542
|
+
//Se debe buscar si abajo esta el form
|
|
6543
|
+
var f = p.querySelector("form");
|
|
6544
|
+
var action = f.action;
|
|
6545
|
+
//console.log(me.apiLink(action) + '/' + part);
|
|
6546
|
+
window.location.href = me.apiLink(action) + '/' + part;
|
|
6547
|
+
},
|
|
6548
|
+
error: function error(e) {
|
|
6549
|
+
//console.log(e);
|
|
6550
|
+
alert(e);
|
|
6551
|
+
//this.open({data:''+e});
|
|
6552
|
+
},
|
|
6553
|
+
destroy: function destroy(e) {
|
|
6554
|
+
var me = this;
|
|
6555
|
+
var f = me.$children[0];
|
|
6556
|
+
f.action;
|
|
6557
|
+
var t = [].filter.call(e.component.$parent.$children, function (e) {
|
|
6558
|
+
return e.$el.classList.contains('v-datatable');
|
|
6559
|
+
})[0];
|
|
6560
|
+
if (!t) t = e.$vnode ? e : me.$children[0].$children[0];
|
|
6561
|
+
var cb = e.$vnode ? e.load : null;
|
|
6562
|
+
var key = t.$attrs.rowkey;
|
|
6563
|
+
if (!key) key = t.rowKey;
|
|
6564
|
+
var dat = t.data[t.selected[0]];
|
|
6565
|
+
t.data;
|
|
6566
|
+
if (dat.tmpId) {
|
|
6567
|
+
me.MsgBox('Esta seguro que desea eliminar los registros temporales seleccionados ?', function (r) {
|
|
6568
|
+
if (r == 0) {
|
|
6569
|
+
var c = 0,
|
|
6570
|
+
db = _$1.db;
|
|
6571
|
+
var objectStore = db.transaction([t.store], "readwrite").objectStore(t.store);
|
|
6572
|
+
var ele = [];
|
|
6573
|
+
for (var k = t.selected.length - 1; k >= 0; k--) {
|
|
6574
|
+
dat = t.data[t.selected[k]];
|
|
6575
|
+
ele.push(dat);
|
|
6576
|
+
if (dat.tmpId) objectStore["delete"](dat.tmpId);
|
|
6577
|
+
c++;
|
|
6578
|
+
t.data.splice(t.selected[k], 1);
|
|
6374
6579
|
}
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
bindLinks: function bindLinks(el, callback) {
|
|
6383
|
-
var me = this;
|
|
6384
|
-
el = el ? el : me.$el;
|
|
6385
|
-
//console.log(el);
|
|
6386
|
-
//console.log("ENTLO")
|
|
6387
|
-
if (el.querySelectorAll) {
|
|
6388
|
-
//var a=el.querySelectorAll('a:not(._),ion-item:not(._)');
|
|
6389
|
-
var a = el.querySelectorAll('a:not(._),ion-item:not(._)');
|
|
6390
|
-
//console.log(a)
|
|
6391
|
-
var f0 = function f0(e) {
|
|
6392
|
-
e.preventDefault();
|
|
6393
|
-
};
|
|
6394
|
-
var f = function f(e) {
|
|
6395
|
-
e.preventDefault();
|
|
6396
|
-
if (callback) callback();
|
|
6397
|
-
me.open(e);
|
|
6398
|
-
};
|
|
6399
|
-
for (var i = 0; i < a.length; i++) {
|
|
6400
|
-
if (a[i].attributes.href) {
|
|
6401
|
-
a[i].onclick = f;
|
|
6402
|
-
} else a[i].onclick = f0;
|
|
6403
|
-
a[i].classList ? a[i].classList.add('_') : a[i].className = '_';
|
|
6404
|
-
}
|
|
6405
|
-
}
|
|
6406
|
-
},
|
|
6407
|
-
MsgBox: _$1.MsgBox,
|
|
6408
|
-
changeRoute: function changeRoute() {/*console.log(v)*/},
|
|
6409
|
-
pad: Vue__default["default"].pad,
|
|
6410
|
-
key: function key() {
|
|
6411
|
-
return Math.random();
|
|
6412
|
-
},
|
|
6413
|
-
submitFile: function submitFile(f, name, cb) {
|
|
6414
|
-
var formData = new FormData();
|
|
6415
|
-
name = name ? name : f.name.replace(/[^\w\s.]/gi, '');
|
|
6416
|
-
formData.append('filename', name);
|
|
6417
|
-
formData.append('file', f, name);
|
|
6418
|
-
axios__default["default"].post('/api/file/upload', formData, {
|
|
6419
|
-
headers: {
|
|
6420
|
-
'Content-Type': 'multipart/form-data',
|
|
6421
|
-
filename: name
|
|
6580
|
+
if (c) {
|
|
6581
|
+
if (me.app && me.app.toast) me.app.toast(c + ' registros eliminados');else me.MsgBox(c + ' registros eliminados');
|
|
6582
|
+
}
|
|
6583
|
+
t.rowSelect(null, -1);
|
|
6584
|
+
t.selected = [];
|
|
6585
|
+
me.$emit('destroyed', ele, t.store);
|
|
6586
|
+
if (cb) cb();
|
|
6422
6587
|
}
|
|
6423
|
-
}
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
// }
|
|
6442
|
-
} /*o*/,
|
|
6443
|
-
rowCreated: function rowCreated(r) {
|
|
6444
|
-
this.row = r;
|
|
6445
|
-
},
|
|
6446
|
-
getSelected: function getSelected(e) {
|
|
6447
|
-
var me = this;
|
|
6448
|
-
var t = e && e.$vnode ? e : me.$children[0].$children[0];
|
|
6449
|
-
var s = [];
|
|
6450
|
-
for (var i = 0; i < t.selected.length; i++) {
|
|
6451
|
-
s.push(t.data[t.selected[i]]);
|
|
6452
|
-
}
|
|
6453
|
-
return s;
|
|
6454
|
-
},
|
|
6455
|
-
getRowSelectedCount: function getRowSelectedCount() {
|
|
6456
|
-
var me = this;
|
|
6457
|
-
var t = me.$children[0].$children[0];
|
|
6458
|
-
return t ? t.selected.length : 0;
|
|
6459
|
-
},
|
|
6460
|
-
rewrite: function rewrite(url) {
|
|
6461
|
-
return url;
|
|
6462
|
-
},
|
|
6463
|
-
create: function create() {
|
|
6464
|
-
var me = this;
|
|
6465
|
-
var action = me.$children[0].action;
|
|
6466
|
-
if (!action) action = window.location.pathname;
|
|
6467
|
-
action = _$1.processURL(action);
|
|
6468
|
-
if (action) action = action.replace("/api", "");
|
|
6469
|
-
if (_$1.app) {
|
|
6470
|
-
me.open(action + '/create');
|
|
6471
|
-
} else {
|
|
6472
|
-
instance.get(_$1.currentPath = (action + '/create').replace(/([^:]\/)\/+/g, "$1") + '?modal').then(_$1.open)["catch"](me.error);
|
|
6473
|
-
}
|
|
6474
|
-
},
|
|
6475
|
-
edit: function edit(e) {
|
|
6476
|
-
var me = this;
|
|
6477
|
-
var f = me.$children[0];
|
|
6478
|
-
var action = f.action;
|
|
6479
|
-
var t = [].filter.call(e.component.$parent.$children, function (e) {
|
|
6480
|
-
return e.$el.classList.contains('v-datatable');
|
|
6481
|
-
})[0];
|
|
6482
|
-
if (!action) {
|
|
6483
|
-
action = window.location.pathname;
|
|
6484
|
-
}
|
|
6485
|
-
if (t && t.src) action = t.src;
|
|
6486
|
-
if (e.action) action = e.action;
|
|
6487
|
-
if (!t) {
|
|
6488
|
-
t = e.$vnode ? e : e.target && e.target.$vnode ? e : me.$children[0].$children[0];
|
|
6489
|
-
if (t.src) action = t.src;
|
|
6490
|
-
}
|
|
6491
|
-
if (action) action = me.rewrite(action.replace("/api", "").replace("/0/0", ""));
|
|
6492
|
-
var selected = me.getSelected(t)[0];
|
|
6493
|
-
var id = selected[t.rowKey];
|
|
6494
|
-
if (selected.tmpId) id = -selected.tmpId;
|
|
6495
|
-
console.log(selected);
|
|
6496
|
-
if (me.getSelectedId) id = me.getSelectedId(selected);
|
|
6497
|
-
if (_$1.app) {
|
|
6498
|
-
me.open(action + '/' + id + '/edit');
|
|
6499
|
-
} else {
|
|
6500
|
-
axios__default["default"].get((_$1.currentPath = (action + '/' + id + '/edit').replace(/([^:]\/)\/+/g, "$1")) + '?modal').then(me.open)["catch"](me.error);
|
|
6501
|
-
}
|
|
6502
|
-
},
|
|
6503
|
-
get: function get(part) {
|
|
6504
|
-
var me = this;
|
|
6505
|
-
var p = me.$el;
|
|
6506
|
-
//Se debe buscar si abajo esta el form
|
|
6507
|
-
var f = p.querySelector("form");
|
|
6508
|
-
var action = f.action;
|
|
6509
|
-
//console.log(me.apiLink(action) + '/' + part);
|
|
6510
|
-
window.location.href = me.apiLink(action) + '/' + part;
|
|
6511
|
-
},
|
|
6512
|
-
error: function error(e) {
|
|
6513
|
-
//console.log(e);
|
|
6514
|
-
alert(e);
|
|
6515
|
-
//this.open({data:''+e});
|
|
6516
|
-
},
|
|
6517
|
-
destroy: function destroy(e) {
|
|
6518
|
-
var me = this;
|
|
6519
|
-
var f = me.$children[0];
|
|
6520
|
-
f.action;
|
|
6521
|
-
var t = [].filter.call(e.component.$parent.$children, function (e) {
|
|
6522
|
-
return e.$el.classList.contains('v-datatable');
|
|
6523
|
-
})[0];
|
|
6524
|
-
if (!t) t = e.$vnode ? e : me.$children[0].$children[0];
|
|
6525
|
-
var cb = e.$vnode ? e.load : null;
|
|
6526
|
-
var key = t.$attrs.rowkey;
|
|
6527
|
-
if (!key) key = t.rowKey;
|
|
6528
|
-
var dat = t.data[t.selected[0]];
|
|
6529
|
-
t.data;
|
|
6530
|
-
if (dat.tmpId) {
|
|
6531
|
-
me.MsgBox('Esta seguro que desea eliminar los registros temporales seleccionados ?', function (r) {
|
|
6532
|
-
if (r == 0) {
|
|
6533
|
-
var c = 0,
|
|
6534
|
-
db = _$1.db;
|
|
6535
|
-
var objectStore = db.transaction([t.store], "readwrite").objectStore(t.store);
|
|
6536
|
-
var ele = [];
|
|
6537
|
-
for (var k = t.selected.length - 1; k >= 0; k--) {
|
|
6588
|
+
}, ['SI', 'NO']);
|
|
6589
|
+
} else {
|
|
6590
|
+
if (!key) return alert('Table don`t have defined attribute \'rowkey\'');
|
|
6591
|
+
var id = dat[key];
|
|
6592
|
+
me.MsgBox('Esta seguro que desea eliminar el registro seleccionado?', function (r) {
|
|
6593
|
+
if (r == 0) {
|
|
6594
|
+
var src = t.src.replace('/0/0', '');
|
|
6595
|
+
var ele = [];
|
|
6596
|
+
console.log(t.selected);
|
|
6597
|
+
var k = t.selected.length - 1;
|
|
6598
|
+
axios__default["default"]["delete"](src + '/' + id, {
|
|
6599
|
+
params: t.filters
|
|
6600
|
+
}).then(function () {
|
|
6601
|
+
console.log(t.selected);
|
|
6602
|
+
for (; k >= 0; k--) {
|
|
6603
|
+
console.log('k=' + k);
|
|
6604
|
+
console.log(t.data);
|
|
6605
|
+
console.log('t.selected[k]=' + t.selected[k]);
|
|
6538
6606
|
dat = t.data[t.selected[k]];
|
|
6539
6607
|
ele.push(dat);
|
|
6540
|
-
|
|
6541
|
-
c++;
|
|
6608
|
+
console.log(ele);
|
|
6542
6609
|
t.data.splice(t.selected[k], 1);
|
|
6543
6610
|
}
|
|
6544
|
-
if (
|
|
6545
|
-
if (me.app && me.app.toast) me.app.toast(c + ' registros eliminados');else me.MsgBox(c + ' registros eliminados');
|
|
6546
|
-
}
|
|
6611
|
+
if (me.app && me.app.toast) me.app.toast(ele.length + ' registros eliminados');else me.MsgBox(ele.length + ' registros eliminados');
|
|
6547
6612
|
t.rowSelect(null, -1);
|
|
6548
6613
|
t.selected = [];
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
}
|
|
6614
|
+
//if(cb)cb();
|
|
6615
|
+
})["catch"](me.error);
|
|
6616
|
+
//t.rowSelect(null,-1);
|
|
6617
|
+
}
|
|
6618
|
+
}, ['SI', 'NO']);
|
|
6619
|
+
}
|
|
6620
|
+
},
|
|
6621
|
+
apiLink: function apiLink(str) {
|
|
6622
|
+
return str.replace(_$1.contextPath, _$1.contextPath + '/api');
|
|
6623
|
+
},
|
|
6624
|
+
open: function open(response, path, o) {
|
|
6625
|
+
if (!response.$el && !(response instanceof HTMLElement)) {
|
|
6626
|
+
var e = response;
|
|
6627
|
+
var t = e.target;
|
|
6628
|
+
var me = this;
|
|
6629
|
+
if (typeof e == 'string') {
|
|
6630
|
+
t = e;
|
|
6631
|
+
} else if (t.tagName == "ION-ITEM" && t.href) {
|
|
6632
|
+
e.preventDefault();
|
|
6633
|
+
t = t.href;
|
|
6553
6634
|
} else {
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
var ele = [];
|
|
6560
|
-
console.log(t.selected);
|
|
6561
|
-
var k = t.selected.length - 1;
|
|
6562
|
-
axios__default["default"]["delete"](src + '/' + id, {
|
|
6563
|
-
params: t.filters
|
|
6564
|
-
}).then(function () {
|
|
6565
|
-
console.log(t.selected);
|
|
6566
|
-
for (; k >= 0; k--) {
|
|
6567
|
-
console.log('k=' + k);
|
|
6568
|
-
console.log(t.data);
|
|
6569
|
-
console.log('t.selected[k]=' + t.selected[k]);
|
|
6570
|
-
dat = t.data[t.selected[k]];
|
|
6571
|
-
ele.push(dat);
|
|
6572
|
-
console.log(ele);
|
|
6573
|
-
t.data.splice(t.selected[k], 1);
|
|
6574
|
-
}
|
|
6575
|
-
if (me.app && me.app.toast) me.app.toast(ele.length + ' registros eliminados');else me.MsgBox(ele.length + ' registros eliminados');
|
|
6576
|
-
t.rowSelect(null, -1);
|
|
6577
|
-
t.selected = [];
|
|
6578
|
-
//if(cb)cb();
|
|
6579
|
-
})["catch"](me.error);
|
|
6580
|
-
//t.rowSelect(null,-1);
|
|
6581
|
-
}
|
|
6582
|
-
}, ['SI', 'NO']);
|
|
6635
|
+
e.preventDefault();
|
|
6636
|
+
if (!t.pathname) t = t.parentNode;
|
|
6637
|
+
if (!t.pathname) t = t.parentNode;
|
|
6638
|
+
if (!t.pathname) t = t.parentNode;
|
|
6639
|
+
t = t.pathname;
|
|
6583
6640
|
}
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
},
|
|
6588
|
-
open: function open(response, path, o) {
|
|
6589
|
-
if (!response.$el && !(response instanceof HTMLElement)) {
|
|
6590
|
-
var e = response;
|
|
6591
|
-
var t = e.target;
|
|
6592
|
-
var me = this;
|
|
6593
|
-
if (typeof e == 'string') {
|
|
6594
|
-
t = e;
|
|
6595
|
-
} else if (t.tagName == "ION-ITEM" && t.href) {
|
|
6596
|
-
e.preventDefault();
|
|
6597
|
-
t = t.href;
|
|
6598
|
-
} else {
|
|
6599
|
-
e.preventDefault();
|
|
6600
|
-
if (!t.pathname) t = t.parentNode;
|
|
6601
|
-
if (!t.pathname) t = t.parentNode;
|
|
6602
|
-
if (!t.pathname) t = t.parentNode;
|
|
6603
|
-
t = t.pathname;
|
|
6604
|
-
}
|
|
6605
|
-
if (me.$route.path !== t) {
|
|
6606
|
-
console.log('path=' + t);
|
|
6607
|
-
me.$router.push(t);
|
|
6608
|
-
}
|
|
6609
|
-
return;
|
|
6641
|
+
if (me.$route.path !== t) {
|
|
6642
|
+
console.log('path=' + t);
|
|
6643
|
+
me.$router.push(t);
|
|
6610
6644
|
}
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
}
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
dd.children[i]
|
|
6645
|
+
return;
|
|
6646
|
+
}
|
|
6647
|
+
var me = this,
|
|
6648
|
+
el;
|
|
6649
|
+
if (response.$el) {
|
|
6650
|
+
response = response.$el;
|
|
6651
|
+
path = {};
|
|
6652
|
+
} else if (response instanceof HTMLElement) {
|
|
6653
|
+
path = path && path.closeOnClickOut ? path : {};
|
|
6654
|
+
console.log("PATH====");
|
|
6655
|
+
console.log(path);
|
|
6656
|
+
} else if (response.target) {
|
|
6657
|
+
el = response.target;
|
|
6658
|
+
return me.open(el.pathname ? el.pathname : el.href);
|
|
6659
|
+
} else if (response === 'GET') {
|
|
6660
|
+
if (typeof path == 'string') {
|
|
6661
|
+
var cfg = {
|
|
6662
|
+
path: _$1.currentPath = path + (typeof o == 'string' ? '/' + o : '')
|
|
6663
|
+
};
|
|
6664
|
+
if (typeof o == 'function') {
|
|
6665
|
+
cfg.result = o;
|
|
6666
|
+
} else if (_typeof(o) == 'object') {
|
|
6667
|
+
cfg = Vue__default["default"].mergeDeep(cfg, o);
|
|
6668
|
+
}
|
|
6669
|
+
return me.open(response, cfg);
|
|
6670
|
+
} else if (!path.data) {
|
|
6671
|
+
//Tiene q buscarse el elemt si existe
|
|
6672
|
+
//console.log('path='+path.path);
|
|
6673
|
+
el = document.querySelector('[path=\'' + path.path + '\']');
|
|
6674
|
+
//console.log(el);
|
|
6675
|
+
if (el) {
|
|
6676
|
+
var dd = document.querySelector('#layoutUnit-center > .ui-layout-unit-content,#page-content');
|
|
6677
|
+
//console.log(dd);
|
|
6678
|
+
for (var i = 0; i < dd.children.length; i++) {
|
|
6679
|
+
//Se ocultan todas las demas paginas
|
|
6680
|
+
if (dd.children[i].style) {
|
|
6681
|
+
if (dd.children[i].className == 'ui-panel' && dd.children[i].style.display != 'none') {
|
|
6682
|
+
backPanel = dd.children[i];
|
|
6649
6683
|
}
|
|
6684
|
+
dd.children[i].style.display = 'none';
|
|
6650
6685
|
}
|
|
6651
|
-
el.style.removeProperty('display');
|
|
6652
|
-
return el;
|
|
6653
|
-
} else {
|
|
6654
|
-
return axios__default["default"].get((path.path + '/?modal').replace(/([^:]\/)\/+/g, "$1")).then(function (r) {
|
|
6655
|
-
r["class"] = path["class"] ? path["class"] : '';
|
|
6656
|
-
r.path = path.path;
|
|
6657
|
-
r.result = path.callback;
|
|
6658
|
-
r = Object.assign(r, path);
|
|
6659
|
-
me.open(response, r);
|
|
6660
|
-
})["catch"](me.error);
|
|
6661
6686
|
}
|
|
6687
|
+
el.style.removeProperty('display');
|
|
6688
|
+
return el;
|
|
6689
|
+
} else {
|
|
6690
|
+
return axios__default["default"].get((path.path + '/?modal').replace(/([^:]\/)\/+/g, "$1")).then(function (r) {
|
|
6691
|
+
r["class"] = path["class"] ? path["class"] : '';
|
|
6692
|
+
r.path = path.path;
|
|
6693
|
+
r.result = path.callback;
|
|
6694
|
+
r = Object.assign(r, path);
|
|
6695
|
+
me.open(response, r);
|
|
6696
|
+
})["catch"](me.error);
|
|
6662
6697
|
}
|
|
6663
|
-
} else if (!response.data) {
|
|
6664
|
-
return me.open('GET', response, path);
|
|
6665
|
-
} else if (response.data) {
|
|
6666
|
-
path = response;
|
|
6667
6698
|
}
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
ifor = k;
|
|
6695
|
-
}
|
|
6696
|
-
}
|
|
6699
|
+
} else if (!response.data) {
|
|
6700
|
+
return me.open('GET', response, path);
|
|
6701
|
+
} else if (response.data) {
|
|
6702
|
+
path = response;
|
|
6703
|
+
}
|
|
6704
|
+
console.log("PATH====222");
|
|
6705
|
+
console.log(path);
|
|
6706
|
+
var dialog,
|
|
6707
|
+
nid = Vue__default["default"].id(),
|
|
6708
|
+
scriptDom = [],
|
|
6709
|
+
for_,
|
|
6710
|
+
ifor = 0;
|
|
6711
|
+
if (response instanceof HTMLElement) {
|
|
6712
|
+
dialog = response;
|
|
6713
|
+
dialog.classList.add("v-dialog");
|
|
6714
|
+
} else {
|
|
6715
|
+
dialog = document.createElement("div");
|
|
6716
|
+
dialog.classList.add("v-dialog");
|
|
6717
|
+
dialog.innerHTML = path.data;
|
|
6718
|
+
var s = dialog.getElementsByTagName('script');
|
|
6719
|
+
//console.log('patttt=' + _.currentPath);
|
|
6720
|
+
dialog.setAttribute("path", _$1.currentPath);
|
|
6721
|
+
var ld = dialog.children;
|
|
6722
|
+
//console.log(s);
|
|
6723
|
+
for (var k = 0; k < s.length; k++) {
|
|
6724
|
+
scriptDom.push(s[k]);
|
|
6697
6725
|
}
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
//para los dialog
|
|
6704
|
-
overlay.style.display = "none";
|
|
6705
|
-
dialog.parentNode.removeChild(dialog);
|
|
6706
|
-
overlay.parentNode.removeChild(overlay);
|
|
6707
|
-
}
|
|
6708
|
-
if (backPanel) {
|
|
6709
|
-
dialog.parentNode.removeChild(dialog);
|
|
6710
|
-
backPanel.style.display = 'block';
|
|
6711
|
-
}
|
|
6712
|
-
Vue__default["default"].resize();
|
|
6713
|
-
};
|
|
6714
|
-
if (for_ && for_.classList.contains('panel')) {
|
|
6715
|
-
//Si elemto tiene declarado el id se debe considerar que es
|
|
6716
|
-
if (for_.id) {
|
|
6717
|
-
window.currentEl = '#' + for_.id;
|
|
6718
|
-
} else {
|
|
6719
|
-
var clsId = 'cls-id-' + Vue__default["default"].id();
|
|
6720
|
-
for_.classList.add(clsId);
|
|
6721
|
-
window.currentEl = '.' + clsId;
|
|
6726
|
+
for (k = 0; k < ld.length; k++) {
|
|
6727
|
+
//console.log(ld[k].tagName);
|
|
6728
|
+
if (ld[k].tagName == 'V-FORM' || ld[k].tagName == 'V-PANEL') {
|
|
6729
|
+
for_ = ld[k];
|
|
6730
|
+
ifor = k;
|
|
6722
6731
|
}
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6732
|
+
}
|
|
6733
|
+
}
|
|
6734
|
+
var backPanel;
|
|
6735
|
+
var close = function close() {
|
|
6736
|
+
dialog.style.display = "none";
|
|
6737
|
+
overlay = dialog.parentNode;
|
|
6738
|
+
if (overlay.classList.contains('v-overlay')) {
|
|
6739
|
+
//para los dialog
|
|
6740
|
+
overlay.style.display = "none";
|
|
6741
|
+
dialog.parentNode.removeChild(dialog);
|
|
6742
|
+
overlay.parentNode.removeChild(overlay);
|
|
6743
|
+
}
|
|
6744
|
+
if (backPanel) {
|
|
6745
|
+
dialog.parentNode.removeChild(dialog);
|
|
6746
|
+
backPanel.style.display = 'block';
|
|
6747
|
+
}
|
|
6748
|
+
Vue__default["default"].resize();
|
|
6749
|
+
};
|
|
6750
|
+
if (for_ && for_.classList.contains('panel')) {
|
|
6751
|
+
//Si elemto tiene declarado el id se debe considerar que es
|
|
6752
|
+
if (for_.id) {
|
|
6753
|
+
window.currentEl = '#' + for_.id;
|
|
6754
|
+
} else {
|
|
6755
|
+
var clsId = 'cls-id-' + Vue__default["default"].id();
|
|
6756
|
+
for_.classList.add(clsId);
|
|
6757
|
+
window.currentEl = '.' + clsId;
|
|
6758
|
+
}
|
|
6759
|
+
dd = document.querySelector('#layoutUnit-center > .ui-layout-unit-content,#page-content');
|
|
6760
|
+
for (i = 0; i < dd.children.length; i++) {
|
|
6761
|
+
//Se ocultan todas las demas paginas
|
|
6762
|
+
if (dd.children[i].style) {
|
|
6763
|
+
if (dd.children[i].className == 'ui-panel' && dd.children[i].style.display != 'none') {
|
|
6764
|
+
backPanel = dd.children[i];
|
|
6731
6765
|
}
|
|
6766
|
+
dd.children[i].style.display = 'none';
|
|
6732
6767
|
}
|
|
6733
|
-
|
|
6734
|
-
|
|
6768
|
+
}
|
|
6769
|
+
//se agrega el dialog recuperado y se genera
|
|
6770
|
+
dd.appendChild(dialog);
|
|
6735
6771
|
|
|
6736
|
-
|
|
6737
|
-
|
|
6772
|
+
//console.log(scriptDom);
|
|
6773
|
+
for (var l2 = 0; scriptDom.length > l2; l2++) {
|
|
6774
|
+
//console.log(s[l2]);
|
|
6775
|
+
try {
|
|
6776
|
+
eval(scriptDom[l2].innerHTML);
|
|
6777
|
+
} catch (e) {
|
|
6778
|
+
console.error(e);
|
|
6779
|
+
}
|
|
6780
|
+
}
|
|
6781
|
+
dialog.style.display = 'none';
|
|
6782
|
+
var td;
|
|
6783
|
+
var aux = dialog.children[ifor];
|
|
6784
|
+
//todo los elementos del dialog son agregados al panel
|
|
6785
|
+
while (dialog.children.length > 0) {
|
|
6786
|
+
if (!td) td = dialog.children[0];
|
|
6787
|
+
dd.appendChild(dialog.children[0]);
|
|
6788
|
+
}
|
|
6789
|
+
dialog.parentNode.removeChild(dialog);
|
|
6790
|
+
dialog = aux;
|
|
6791
|
+
//console.log(path);
|
|
6792
|
+
dialog.setAttribute("path", path.path);
|
|
6793
|
+
} else {
|
|
6794
|
+
var overlay = document.createElement("div");
|
|
6795
|
+
//console.log('create overlay');
|
|
6796
|
+
overlay.classList.add("v-overlay");
|
|
6797
|
+
overlay.style.padding = "40px";
|
|
6798
|
+
document.body.appendChild(overlay);
|
|
6799
|
+
overlay.appendChild(dialog);
|
|
6800
|
+
if (!(response instanceof HTMLElement)) {
|
|
6801
|
+
for (l2 = 0; s.length > l2; l2++) {
|
|
6738
6802
|
//console.log(s[l2]);
|
|
6739
6803
|
try {
|
|
6740
|
-
eval(
|
|
6804
|
+
eval(s[l2].innerHTML);
|
|
6741
6805
|
} catch (e) {
|
|
6742
6806
|
console.error(e);
|
|
6743
6807
|
}
|
|
6744
6808
|
}
|
|
6745
|
-
dialog.style.display = 'none';
|
|
6746
|
-
var td;
|
|
6747
|
-
var aux = dialog.children[ifor];
|
|
6748
|
-
//todo los elementos del dialog son agregados al panel
|
|
6749
|
-
while (dialog.children.length > 0) {
|
|
6750
|
-
if (!td) td = dialog.children[0];
|
|
6751
|
-
dd.appendChild(dialog.children[0]);
|
|
6752
|
-
}
|
|
6753
|
-
dialog.parentNode.removeChild(dialog);
|
|
6754
|
-
dialog = aux;
|
|
6755
|
-
//console.log(path);
|
|
6756
|
-
dialog.setAttribute("path", path.path);
|
|
6757
|
-
} else {
|
|
6758
|
-
var overlay = document.createElement("div");
|
|
6759
|
-
//console.log('create overlay');
|
|
6760
|
-
overlay.classList.add("v-overlay");
|
|
6761
|
-
overlay.style.padding = "40px";
|
|
6762
|
-
document.body.appendChild(overlay);
|
|
6763
|
-
overlay.appendChild(dialog);
|
|
6764
|
-
if (!(response instanceof HTMLElement)) {
|
|
6765
|
-
for (l2 = 0; s.length > l2; l2++) {
|
|
6766
|
-
//console.log(s[l2]);
|
|
6767
|
-
try {
|
|
6768
|
-
eval(s[l2].innerHTML);
|
|
6769
|
-
} catch (e) {
|
|
6770
|
-
console.error(e);
|
|
6771
|
-
}
|
|
6772
|
-
}
|
|
6773
|
-
}
|
|
6774
|
-
overlay.style.visibility = "unset";
|
|
6775
|
-
overlay.style.opacity = "unset";
|
|
6776
|
-
overlay.style.overflow = "auto";
|
|
6777
|
-
dialog.style.margin = "0 auto";
|
|
6778
|
-
dialog.style.position = "unset";
|
|
6779
|
-
//console.log(dialog);
|
|
6780
|
-
var resize = function resize(e) {
|
|
6781
|
-
dialog.style.left = (window.innerWidth - dialog.offsetWidth) / 2 + 'px';
|
|
6782
|
-
if (window.innerWidth < 600) {
|
|
6783
|
-
//console.log(333333);
|
|
6784
|
-
console.log(dialog);
|
|
6785
|
-
var dc = dialog.querySelector('.v-dialog-content');
|
|
6786
|
-
//console.log(dc);
|
|
6787
|
-
var h = dialog.querySelector('.v-panel-titlebar');
|
|
6788
|
-
//console.log(h.clientHeight);
|
|
6789
|
-
var ih = window.innerHeight - 94 - (h ? h.clientHeight : 0);
|
|
6790
|
-
(dc ? dc : dialog).style.height = ih + "px";
|
|
6791
|
-
}
|
|
6792
|
-
};
|
|
6793
|
-
window.addEventListener('resize', resize);
|
|
6794
|
-
if (path["class"] === 'v-search') {
|
|
6795
|
-
var d = dialog;
|
|
6796
|
-
d.className = d.className + ' ' + path["class"];
|
|
6797
|
-
d.style.width = "100%";
|
|
6798
|
-
d.style.height = "calc(100% - 2px)";
|
|
6799
|
-
var children = d.querySelector('div');
|
|
6800
|
-
var f = d.querySelector('form');
|
|
6801
|
-
var t = d.querySelector('.v-datatable');
|
|
6802
|
-
var tb = d.querySelector('.v-datatable-scrollable-body');
|
|
6803
|
-
children.style.height = 'calc(100% - 2px)';
|
|
6804
|
-
children.style.overflowY = 'auto';
|
|
6805
|
-
children.children[1].style.padding = '0px';
|
|
6806
|
-
children.children[1].style.height = 'calc(100% - 33px)';
|
|
6807
|
-
f.style.height = '100%';
|
|
6808
|
-
f.style.overflowY = 'auto';
|
|
6809
|
-
t.style.height = 'calc(100% - 52px)';
|
|
6810
|
-
tb.style.height = 'calc(100% - 72px)';
|
|
6811
|
-
tb.style.overflowY = 'auto';
|
|
6812
|
-
var pag = d.querySelector('.v-paginator');
|
|
6813
|
-
pag.style.display = 'inline-block';
|
|
6814
|
-
f.appendChild(pag);
|
|
6815
|
-
tb = document.createElement("button");
|
|
6816
|
-
tb.innerHTML = 'Recuperar';
|
|
6817
|
-
tb.style.padding = '4px 16px';
|
|
6818
|
-
tb.className = "_ ui-widget v-state-default ui-corner-all v-button ui-button-text-only";
|
|
6819
|
-
var vue = _$1.varMap[children.getAttribute("vueid")];
|
|
6820
|
-
tb.onclick = function (e) {
|
|
6821
|
-
e.preventDefault();
|
|
6822
|
-
vue.refresh();
|
|
6823
|
-
};
|
|
6824
|
-
f.appendChild(tb);
|
|
6825
|
-
tb = document.createElement("button");
|
|
6826
|
-
tb.innerHTML = 'Seleccionar';
|
|
6827
|
-
tb.style.padding = '4px 16px';
|
|
6828
|
-
tb.className = "_ ui-widget v-state-default ui-corner-all v-button ui-button-text-only";
|
|
6829
|
-
vue = _$1.varMap[children.getAttribute("vueid")];
|
|
6830
|
-
tb.onclick = function (e) {
|
|
6831
|
-
e.preventDefault();
|
|
6832
|
-
var d = [];
|
|
6833
|
-
var t = vue.$children[0].$children[0];
|
|
6834
|
-
for (i = 0; i < t.selected.length; i++) {
|
|
6835
|
-
d.push(t.filteredData[t.selected[i]]);
|
|
6836
|
-
}
|
|
6837
|
-
path.result(d);
|
|
6838
|
-
delete path.result;
|
|
6839
|
-
vue.close(e);
|
|
6840
|
-
};
|
|
6841
|
-
f.appendChild(tb);
|
|
6842
|
-
}
|
|
6843
|
-
resize();
|
|
6844
6809
|
}
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
|
|
6810
|
+
overlay.style.visibility = "unset";
|
|
6811
|
+
overlay.style.opacity = "unset";
|
|
6812
|
+
overlay.style.overflow = "auto";
|
|
6813
|
+
dialog.style.margin = "0 auto";
|
|
6814
|
+
dialog.style.position = "unset";
|
|
6815
|
+
//console.log(dialog);
|
|
6816
|
+
var resize = function resize(e) {
|
|
6817
|
+
dialog.style.left = (window.innerWidth - dialog.offsetWidth) / 2 + 'px';
|
|
6818
|
+
if (window.innerWidth < 600) {
|
|
6819
|
+
//console.log(333333);
|
|
6820
|
+
console.log(dialog);
|
|
6821
|
+
var dc = dialog.querySelector('.v-dialog-content');
|
|
6822
|
+
//console.log(dc);
|
|
6823
|
+
var h = dialog.querySelector('.v-panel-titlebar');
|
|
6824
|
+
//console.log(h.clientHeight);
|
|
6825
|
+
var ih = window.innerHeight - 94 - (h ? h.clientHeight : 0);
|
|
6826
|
+
(dc ? dc : dialog).style.height = ih + "px";
|
|
6849
6827
|
}
|
|
6850
|
-
if (o === true) me.refresh();
|
|
6851
6828
|
};
|
|
6852
|
-
|
|
6853
|
-
if (
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
var
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6829
|
+
window.addEventListener('resize', resize);
|
|
6830
|
+
if (path["class"] === 'v-search') {
|
|
6831
|
+
var d = dialog;
|
|
6832
|
+
d.className = d.className + ' ' + path["class"];
|
|
6833
|
+
d.style.width = "100%";
|
|
6834
|
+
d.style.height = "calc(100% - 2px)";
|
|
6835
|
+
var children = d.querySelector('div');
|
|
6836
|
+
var f = d.querySelector('form');
|
|
6837
|
+
var t = d.querySelector('.v-datatable');
|
|
6838
|
+
var tb = d.querySelector('.v-datatable-scrollable-body');
|
|
6839
|
+
children.style.height = 'calc(100% - 2px)';
|
|
6840
|
+
children.style.overflowY = 'auto';
|
|
6841
|
+
children.children[1].style.padding = '0px';
|
|
6842
|
+
children.children[1].style.height = 'calc(100% - 33px)';
|
|
6843
|
+
f.style.height = '100%';
|
|
6844
|
+
f.style.overflowY = 'auto';
|
|
6845
|
+
t.style.height = 'calc(100% - 52px)';
|
|
6846
|
+
tb.style.height = 'calc(100% - 72px)';
|
|
6847
|
+
tb.style.overflowY = 'auto';
|
|
6848
|
+
var pag = d.querySelector('.v-paginator');
|
|
6849
|
+
pag.style.display = 'inline-block';
|
|
6850
|
+
f.appendChild(pag);
|
|
6851
|
+
tb = document.createElement("button");
|
|
6852
|
+
tb.innerHTML = 'Recuperar';
|
|
6853
|
+
tb.style.padding = '4px 16px';
|
|
6854
|
+
tb.className = "_ ui-widget v-state-default ui-corner-all v-button ui-button-text-only";
|
|
6855
|
+
var vue = _$1.varMap[children.getAttribute("vueid")];
|
|
6856
|
+
tb.onclick = function (e) {
|
|
6857
|
+
e.preventDefault();
|
|
6858
|
+
vue.refresh();
|
|
6859
|
+
};
|
|
6860
|
+
f.appendChild(tb);
|
|
6861
|
+
tb = document.createElement("button");
|
|
6862
|
+
tb.innerHTML = 'Seleccionar';
|
|
6863
|
+
tb.style.padding = '4px 16px';
|
|
6864
|
+
tb.className = "_ ui-widget v-state-default ui-corner-all v-button ui-button-text-only";
|
|
6865
|
+
vue = _$1.varMap[children.getAttribute("vueid")];
|
|
6866
|
+
tb.onclick = function (e) {
|
|
6867
|
+
e.preventDefault();
|
|
6868
|
+
var d = [];
|
|
6869
|
+
var t = vue.$children[0].$children[0];
|
|
6870
|
+
for (i = 0; i < t.selected.length; i++) {
|
|
6871
|
+
d.push(t.filteredData[t.selected[i]]);
|
|
6864
6872
|
}
|
|
6873
|
+
path.result(d);
|
|
6874
|
+
delete path.result;
|
|
6875
|
+
vue.close(e);
|
|
6865
6876
|
};
|
|
6866
|
-
|
|
6867
|
-
var span = document.createElement("i");
|
|
6868
|
-
span.style.top = "6px";
|
|
6869
|
-
span.style.right = "6px";
|
|
6870
|
-
h.style.position = "relative";
|
|
6871
|
-
span.style.position = "absolute";
|
|
6872
|
-
span.style.color = "white";
|
|
6873
|
-
span.className = "fa fa-window-close v-dialog-close";
|
|
6874
|
-
acl = document.createElement("a");
|
|
6875
|
-
acl.className = "ui-js-close v-dialog-titlebar-icon v-dialog-titlebar-close ui-corner-all";
|
|
6876
|
-
acl.appendChild(span);
|
|
6877
|
-
h.appendChild(acl);
|
|
6878
|
-
acl.addEventListener("click", close);
|
|
6879
|
-
}
|
|
6880
|
-
}
|
|
6881
|
-
if (path.closeOnClickOut) {
|
|
6882
|
-
dialog.parentNode.addEventListener("click", close);
|
|
6877
|
+
f.appendChild(tb);
|
|
6883
6878
|
}
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
if (ok.$el) ok = ok.$el;
|
|
6891
|
-
var dlg = ok instanceof HTMLElement ? ok : null;
|
|
6892
|
-
try {
|
|
6893
|
-
if (!dlg && event.target instanceof HTMLElement) dlg = _$1.closest(event.target, '.v-dialog');
|
|
6894
|
-
} catch (e) {
|
|
6895
|
-
console.log(e);
|
|
6896
|
-
}
|
|
6897
|
-
if (!dlg) dlg = this.$el.parentElement;
|
|
6898
|
-
var mask = dlg.parentElement;
|
|
6899
|
-
if (!mask && _$1.app.$router) {
|
|
6900
|
-
_$1.app.$router.back();
|
|
6901
|
-
return;
|
|
6879
|
+
resize();
|
|
6880
|
+
}
|
|
6881
|
+
_$1.storeFunction['PROPS=' + nid] = path;
|
|
6882
|
+
_$1.storeFunction[nid] = function (o) {
|
|
6883
|
+
if (path.result) {
|
|
6884
|
+
path.result(o);
|
|
6902
6885
|
}
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6886
|
+
if (o === true) me.refresh();
|
|
6887
|
+
};
|
|
6888
|
+
var _vue_ = dialog.querySelector('[vueid]');
|
|
6889
|
+
if (_vue_) {
|
|
6890
|
+
path.__vue__ = _vue_.__vue__;
|
|
6891
|
+
_vue_.__vue__.$emit('opened', path);
|
|
6892
|
+
}
|
|
6893
|
+
dialog.setAttribute("callback", nid);
|
|
6894
|
+
var h = dialog.querySelector('.v-panel-titlebar');
|
|
6895
|
+
if (h) {
|
|
6896
|
+
var acl = h.querySelector('.ui-js-close');
|
|
6897
|
+
window.onkeyup = function (event) {
|
|
6898
|
+
if (event.keyCode == 27) {
|
|
6899
|
+
close();
|
|
6900
|
+
}
|
|
6901
|
+
};
|
|
6902
|
+
if (!acl) {
|
|
6903
|
+
var span = document.createElement("i");
|
|
6904
|
+
span.style.top = "6px";
|
|
6905
|
+
span.style.right = "6px";
|
|
6906
|
+
h.style.position = "relative";
|
|
6907
|
+
span.style.position = "absolute";
|
|
6908
|
+
span.style.color = "white";
|
|
6909
|
+
span.className = "fa fa-window-close v-dialog-close";
|
|
6910
|
+
acl = document.createElement("a");
|
|
6911
|
+
acl.className = "ui-js-close v-dialog-titlebar-icon v-dialog-titlebar-close ui-corner-all";
|
|
6912
|
+
acl.appendChild(span);
|
|
6913
|
+
h.appendChild(acl);
|
|
6914
|
+
acl.addEventListener("click", close);
|
|
6932
6915
|
}
|
|
6933
|
-
}
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6916
|
+
}
|
|
6917
|
+
if (path.closeOnClickOut) {
|
|
6918
|
+
dialog.parentNode.addEventListener("click", close);
|
|
6919
|
+
}
|
|
6920
|
+
dialog.style.display = 'block';
|
|
6921
|
+
Vue__default["default"].resize();
|
|
6922
|
+
document.documentElement.style.overflow = 'hidden'; // firefox, chrome
|
|
6923
|
+
document.body.scroll = "no"; // ie only
|
|
6924
|
+
},
|
|
6925
|
+
close: function close(ok) {
|
|
6926
|
+
if (ok.$el) ok = ok.$el;
|
|
6927
|
+
var dlg = ok instanceof HTMLElement ? ok : null;
|
|
6928
|
+
try {
|
|
6929
|
+
if (!dlg && event.target instanceof HTMLElement) dlg = _$1.closest(event.target, '.v-dialog');
|
|
6930
|
+
} catch (e) {
|
|
6931
|
+
console.log(e);
|
|
6932
|
+
}
|
|
6933
|
+
if (!dlg) dlg = this.$el.parentElement;
|
|
6934
|
+
var mask = dlg.parentElement;
|
|
6935
|
+
if (!mask && _$1.app.$router) {
|
|
6936
|
+
_$1.app.$router.back();
|
|
6937
|
+
return;
|
|
6938
|
+
}
|
|
6939
|
+
dlg.style.display = "none";
|
|
6940
|
+
if ((' ' + mask.className + ' ').indexOf(' v-overlay ') > -1) mask.style.display = "none";else mask = null;
|
|
6941
|
+
Vue__default["default"].resize();
|
|
6942
|
+
var cb = _$1.storeFunction[dlg.getAttribute("callback")];
|
|
6943
|
+
if (cb) cb(ok);
|
|
6944
|
+
dlg.parentNode.removeChild(dlg);
|
|
6945
|
+
if (mask) mask.parentNode.removeChild(mask);
|
|
6946
|
+
document.documentElement.style.overflow = 'auto'; // firefox, chrome
|
|
6947
|
+
document.body.scroll = "yes";
|
|
6948
|
+
//si history esta activo
|
|
6949
|
+
//history.back();
|
|
6950
|
+
},
|
|
6951
|
+
refresh: function refresh() {
|
|
6952
|
+
//Para que funcione se debe tener el listado respetando la estructura
|
|
6953
|
+
var me = this;
|
|
6954
|
+
var t = me.$children[0].$children[0];
|
|
6955
|
+
t.load();
|
|
6956
|
+
},
|
|
6957
|
+
removeStored: function removeStored(storage) {
|
|
6958
|
+
if (window.idb) {
|
|
6959
|
+
var me = this,
|
|
6960
|
+
db = window._.db,
|
|
6961
|
+
objectStore = db.transaction([storage], "readwrite").objectStore(storage);
|
|
6962
|
+
var objectStoreRequest = objectStore.clear();
|
|
6963
|
+
objectStoreRequest.onerror = function () {
|
|
6964
|
+
me.MsgBox('Error al eliminar data temporal');
|
|
6965
|
+
};
|
|
6966
|
+
} else {
|
|
6967
|
+
localStorage.removeItem(storage);
|
|
6968
|
+
}
|
|
6969
|
+
},
|
|
6970
|
+
toast: function toast(msx, callback) {
|
|
6971
|
+
try {
|
|
6972
|
+
var _this2 = this;
|
|
6973
|
+
if (msx.message && !msx.duration) msx.duration = 2000;
|
|
6974
|
+
return _await(_this2.$ionic.toastController.create(msx.message ? msx : {
|
|
6975
|
+
message: msx,
|
|
6976
|
+
duration: 2000
|
|
6977
|
+
}), function (toast) {
|
|
6978
|
+
return _await(toast.present(), function () {
|
|
6979
|
+
if (callback) callback();
|
|
6945
6980
|
});
|
|
6946
|
-
}
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
}
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
}
|
|
6966
|
-
}
|
|
6967
|
-
}
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
} else {
|
|
6972
|
-
localStorage.setItem(store, JSON.stringify(data));
|
|
6981
|
+
});
|
|
6982
|
+
} catch (e) {
|
|
6983
|
+
return Promise.reject(e);
|
|
6984
|
+
}
|
|
6985
|
+
},
|
|
6986
|
+
setStoredList: function setStoredList(store, data) {
|
|
6987
|
+
try {
|
|
6988
|
+
var db, objectStore;
|
|
6989
|
+
if (_$1.db) {
|
|
6990
|
+
try {
|
|
6991
|
+
db = _$1.db;
|
|
6992
|
+
objectStore = db.transaction([store], "readwrite").objectStore(store);
|
|
6993
|
+
var objectStoreRequest = objectStore.clear();
|
|
6994
|
+
objectStoreRequest.onsuccess = function () {
|
|
6995
|
+
for (var i in data) {
|
|
6996
|
+
console.log(data[i]);
|
|
6997
|
+
var request = objectStore.add(data[i]);
|
|
6998
|
+
request.onerror = function (event) {
|
|
6999
|
+
console.log(event);
|
|
7000
|
+
};
|
|
7001
|
+
}
|
|
7002
|
+
};
|
|
7003
|
+
} catch (e) {
|
|
7004
|
+
alert(store);
|
|
7005
|
+
throw e;
|
|
6973
7006
|
}
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
return Promise.reject(e);
|
|
7007
|
+
} else {
|
|
7008
|
+
localStorage.setItem(store, JSON.stringify(data));
|
|
6977
7009
|
}
|
|
6978
|
-
|
|
6979
|
-
|
|
7010
|
+
return _await();
|
|
7011
|
+
} catch (e) {
|
|
7012
|
+
return Promise.reject(e);
|
|
7013
|
+
}
|
|
7014
|
+
},
|
|
7015
|
+
getStoredList: function getStoredList(store, params) {
|
|
7016
|
+
try {
|
|
7017
|
+
var _exit = false;
|
|
7018
|
+
var loadedStores;
|
|
6980
7019
|
try {
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
if (loadedStores
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
return
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
//console.log(data[i]);
|
|
7005
|
-
//console.log(e[0]);
|
|
7006
|
-
throw exception;
|
|
7007
|
-
});
|
|
7008
|
-
}, function () {
|
|
7009
|
-
return _exit2;
|
|
7010
|
-
}), function (_result3) {
|
|
7011
|
-
if (_exit2) ;
|
|
7012
|
-
loadedStores[store] = 1;
|
|
7013
|
-
sessionStorage.setItem('loadedStores', JSON.stringify(loadedStores));
|
|
7020
|
+
loadedStores = JSON.parse(sessionStorage.getItem('loadedStores'));
|
|
7021
|
+
} catch (e) {}
|
|
7022
|
+
if (loadedStores == null) loadedStores = {};
|
|
7023
|
+
//console.log(loadedStores);
|
|
7024
|
+
return _await(_invoke(function () {
|
|
7025
|
+
if (!loadedStores[store] && _$1.networkStatus.connected) {
|
|
7026
|
+
var e = _$1.stores.filter(function (e) {
|
|
7027
|
+
return e[0] == store;
|
|
7028
|
+
})[0];
|
|
7029
|
+
//console.log(e);
|
|
7030
|
+
if (!e[2]) throw "store url is empty";
|
|
7031
|
+
return _await(axios__default["default"].get(e[2]), function (data) {
|
|
7032
|
+
var objectStore = _$1.db.transaction([e[0]], "readwrite").objectStore(e[0]);
|
|
7033
|
+
return _await(objectStore.clear(), function () {
|
|
7034
|
+
var _exit2 = false;
|
|
7035
|
+
data = data.data || data;
|
|
7036
|
+
return _continue(_forIn(data, function (i) {
|
|
7037
|
+
return _catch(function () {
|
|
7038
|
+
return _awaitIgnored(objectStore.add(data[i]));
|
|
7039
|
+
}, function (exception) {
|
|
7040
|
+
//console.log(data[i]);
|
|
7041
|
+
//console.log(e[0]);
|
|
7042
|
+
throw exception;
|
|
7014
7043
|
});
|
|
7044
|
+
}, function () {
|
|
7045
|
+
return _exit2;
|
|
7046
|
+
}), function (_result3) {
|
|
7047
|
+
if (_exit2) ;
|
|
7048
|
+
loadedStores[store] = 1;
|
|
7049
|
+
sessionStorage.setItem('loadedStores', JSON.stringify(loadedStores));
|
|
7015
7050
|
});
|
|
7016
7051
|
});
|
|
7017
|
-
}
|
|
7018
|
-
}, function (_result) {
|
|
7019
|
-
if (_exit) return _result;
|
|
7020
|
-
var p = new Promise(function (resolve, rejected) {
|
|
7021
|
-
if (_$1.db) {
|
|
7022
|
-
var t = _$1.db.transaction(store),
|
|
7023
|
-
objectStore = t.objectStore(store); //,d=[];
|
|
7024
|
-
var r = objectStore.getAll();
|
|
7025
|
-
r.onsuccess = function () {
|
|
7026
|
-
resolve(r.result);
|
|
7027
|
-
};
|
|
7028
|
-
} else rejected('db is null');
|
|
7029
|
-
//t.onerror = event => reject(event.target.error);
|
|
7030
7052
|
});
|
|
7031
|
-
return _await(p); //console.log(result);
|
|
7032
|
-
}));
|
|
7033
|
-
} catch (e) {
|
|
7034
|
-
return Promise.reject(e);
|
|
7035
|
-
}
|
|
7036
|
-
},
|
|
7037
|
-
getStoreObject: function getStoreObject(storage, id) {
|
|
7038
|
-
var db = window._.db,
|
|
7039
|
-
objectStore = db.transaction([storage], "readwrite").objectStore(storage);
|
|
7040
|
-
return objectStore.get(id);
|
|
7041
|
-
},
|
|
7042
|
-
sync: function sync(e) {
|
|
7043
|
-
try {
|
|
7044
|
-
var _this3 = this;
|
|
7045
|
-
var me = _this3;
|
|
7046
|
-
var p = me.$el;
|
|
7047
|
-
var f = p.querySelector("form");
|
|
7048
|
-
var action = f.getAttribute('action');
|
|
7049
|
-
//console.log('Action='+action);
|
|
7050
|
-
if (!action) {
|
|
7051
|
-
action = me.$el.parentNode.getAttribute('path');
|
|
7052
|
-
//debe en ciertos casoss sobreescribirse ponr unas rglas definidas y una tabla extra
|
|
7053
|
-
var tc = action.split('/');
|
|
7054
|
-
if (tc[tc.length - 1] == 'edit') tc = tc.splice(0, tc.length - 2);else tc = tc.splice(0, tc.length - 1);
|
|
7055
|
-
action = me.apiLink(tc.join('/'));
|
|
7056
7053
|
}
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7054
|
+
}, function (_result) {
|
|
7055
|
+
if (_exit) return _result;
|
|
7056
|
+
var p = new Promise(function (resolve, rejected) {
|
|
7057
|
+
if (_$1.db) {
|
|
7058
|
+
var t = _$1.db.transaction(store),
|
|
7059
|
+
objectStore = t.objectStore(store); //,d=[];
|
|
7060
|
+
var r = objectStore.getAll();
|
|
7061
|
+
r.onsuccess = function () {
|
|
7062
|
+
resolve(r.result);
|
|
7063
|
+
};
|
|
7064
|
+
} else rejected('db is null');
|
|
7065
|
+
//t.onerror = event => reject(event.target.error);
|
|
7066
|
+
});
|
|
7067
|
+
return _await(p); //console.log(result);
|
|
7068
|
+
}));
|
|
7069
|
+
} catch (e) {
|
|
7070
|
+
return Promise.reject(e);
|
|
7071
|
+
}
|
|
7072
|
+
},
|
|
7073
|
+
getStoreObject: function getStoreObject(storage, id) {
|
|
7074
|
+
var db = window._.db,
|
|
7075
|
+
objectStore = db.transaction([storage], "readwrite").objectStore(storage);
|
|
7076
|
+
return objectStore.get(id);
|
|
7077
|
+
},
|
|
7078
|
+
sync: function sync(e) {
|
|
7079
|
+
try {
|
|
7080
|
+
var _this3 = this;
|
|
7081
|
+
var me = _this3;
|
|
7082
|
+
var p = me.$el;
|
|
7083
|
+
var f = p.querySelector("form");
|
|
7084
|
+
var action = f.getAttribute('action');
|
|
7085
|
+
//console.log('Action='+action);
|
|
7086
|
+
if (!action) {
|
|
7087
|
+
action = me.$el.parentNode.getAttribute('path');
|
|
7088
|
+
//debe en ciertos casoss sobreescribirse ponr unas rglas definidas y una tabla extra
|
|
7089
|
+
var tc = action.split('/');
|
|
7090
|
+
if (tc[tc.length - 1] == 'edit') tc = tc.splice(0, tc.length - 2);else tc = tc.splice(0, tc.length - 1);
|
|
7091
|
+
action = me.apiLink(tc.join('/'));
|
|
7092
|
+
}
|
|
7093
|
+
var t = me.$children[0].$children[0];
|
|
7094
|
+
action = t.src;
|
|
7095
|
+
//debe recorrerse toda los registros seleccionados
|
|
7096
|
+
//ponerlos gris
|
|
7097
|
+
return _await(me.getStoredList(t.store), function (dats) {
|
|
7098
|
+
var sel = t.selected;
|
|
7099
|
+
var sel2 = [];
|
|
7100
|
+
var sel3 = [];
|
|
7101
|
+
for (var i = 0; i < sel.length; i++) {
|
|
7102
|
+
//se recupra
|
|
7103
|
+
var item = t.data[sel[i]];
|
|
7104
|
+
if (item.tmpId && !item["synchronized"]) {
|
|
7105
|
+
for (var j = 0; j < dats.length; j++) {
|
|
7106
|
+
if (dats[j].tmpId == item.tmpId) {
|
|
7107
|
+
var o = JSON.clone(dats[j]);
|
|
7108
|
+
delete o["synchronized"];
|
|
7109
|
+
sel3.push(o);
|
|
7110
|
+
sel2.push(j);
|
|
7076
7111
|
}
|
|
7077
7112
|
}
|
|
7078
7113
|
}
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
if (d[k].id) dats[j].id = d[k].id;
|
|
7101
|
-
//aqui deberia revisarsee los registro anidados
|
|
7102
|
-
dats[j]["synchronized"] = 1;
|
|
7103
|
-
me.$emit('sync', d[k], dats[j]);
|
|
7114
|
+
}
|
|
7115
|
+
//se envia solo los selccionados
|
|
7116
|
+
if (sel2.length > 0) {
|
|
7117
|
+
axios__default["default"].post(action + '/bulk' + (e.sufix ? e.sufix : ''), sel3).then(function (r) {
|
|
7118
|
+
var d = r.data;
|
|
7119
|
+
//console.log(d);
|
|
7120
|
+
for (var k = 0; k < d.length; k++) {
|
|
7121
|
+
if (d[k].errors) {
|
|
7122
|
+
me.MsgBox(JSON.stringify(d[k].errors));
|
|
7123
|
+
break;
|
|
7124
|
+
}
|
|
7125
|
+
if (d[k].error) {
|
|
7126
|
+
me.MsgBox(d[k].error);
|
|
7127
|
+
break;
|
|
7128
|
+
}
|
|
7129
|
+
for (var j = 0; j < dats.length; j++) {
|
|
7130
|
+
//cada registro recibido de bulk ss compara con los locales
|
|
7131
|
+
if (d[k].ext && d[k].ext.tmpId == dats[j].tmpId || d[k].tmpId == dats[j].tmpId) {
|
|
7132
|
+
console.log('ok');
|
|
7133
|
+
if (d[k].ext && dats.ext) {
|
|
7134
|
+
dats[j].ext.error = d[k].ext.error;
|
|
7104
7135
|
}
|
|
7136
|
+
if (d[k].id) dats[j].id = d[k].id;
|
|
7137
|
+
//aqui deberia revisarsee los registro anidados
|
|
7138
|
+
dats[j]["synchronized"] = 1;
|
|
7139
|
+
me.$emit('sync', d[k], dats[j]);
|
|
7105
7140
|
}
|
|
7106
7141
|
}
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
}
|
|
7142
|
+
}
|
|
7143
|
+
me.setStoredList(t.store, dats);
|
|
7144
|
+
//dat.id=r.data.id;
|
|
7145
|
+
//t.$emit('synchronized',{data:dat,result:r.data,index:kk,count:tr});
|
|
7146
|
+
//dat.synchronized=1;
|
|
7147
|
+
//dats[kk]=dat;
|
|
7148
|
+
//sendf(dats,k0+1,te+1);
|
|
7149
|
+
me.refresh();
|
|
7150
|
+
})["catch"](function (r) {
|
|
7151
|
+
if (r.response) {
|
|
7152
|
+
me.MsgBox(r.response.data);
|
|
7153
|
+
} else {
|
|
7154
|
+
console.log(r);
|
|
7155
|
+
}
|
|
7156
|
+
});
|
|
7157
|
+
}
|
|
7158
|
+
});
|
|
7159
|
+
} catch (e) {
|
|
7160
|
+
return Promise.reject(e);
|
|
7161
|
+
}
|
|
7162
|
+
},
|
|
7163
|
+
save: function save() {
|
|
7164
|
+
try {
|
|
7165
|
+
var _this4 = this;
|
|
7166
|
+
var me = _this4;
|
|
7167
|
+
me.$forceUpdate();
|
|
7168
|
+
var p = me.$el;
|
|
7169
|
+
//Se debe buscar si abajo esta el form
|
|
7170
|
+
var f = p.querySelector("form");
|
|
7171
|
+
var va = _this4.validate(f);
|
|
7172
|
+
return _await(function () {
|
|
7173
|
+
if (va) {
|
|
7174
|
+
var action = f.getAttribute('action');
|
|
7175
|
+
//console.log('Action='+action);
|
|
7176
|
+
if (!action) {
|
|
7177
|
+
action = me.$el.parentNode.getAttribute('path');
|
|
7178
|
+
if (action) {
|
|
7179
|
+
//debe en ciertos casoss sobreescribirse ponr unas rglas definidas y una tabla extra
|
|
7180
|
+
var tc = action.split('/');
|
|
7181
|
+
if (tc[tc.length - 1] == 'edit') tc = tc.splice(0, tc.length - 2);else tc = tc.splice(0, tc.length - 1);
|
|
7182
|
+
action = me.apiLink(tc.join('/'));
|
|
7183
|
+
}
|
|
7121
7184
|
}
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
//Se debe buscar si abajo esta el form
|
|
7134
|
-
var f = p.querySelector("form");
|
|
7135
|
-
var va = _this4.validate(f);
|
|
7136
|
-
return _await(function () {
|
|
7137
|
-
if (va) {
|
|
7138
|
-
var action = f.getAttribute('action');
|
|
7139
|
-
//console.log('Action='+action);
|
|
7140
|
-
if (!action) {
|
|
7141
|
-
action = me.$el.parentNode.getAttribute('path');
|
|
7142
|
-
if (action) {
|
|
7143
|
-
//debe en ciertos casoss sobreescribirse ponr unas rglas definidas y una tabla extra
|
|
7144
|
-
var tc = action.split('/');
|
|
7145
|
-
if (tc[tc.length - 1] == 'edit') tc = tc.splice(0, tc.length - 2);else tc = tc.splice(0, tc.length - 1);
|
|
7146
|
-
action = me.apiLink(tc.join('/'));
|
|
7185
|
+
var o0 = _this4._data.data ? _this4._data.data : _this4._data.o;
|
|
7186
|
+
var o = JSON.parse(JSON.stringify(o0));
|
|
7187
|
+
if (me.process) o = me.process(o);
|
|
7188
|
+
//console.log('o2='+o);
|
|
7189
|
+
if (!(_typeof(o) === 'object' && !Array.isArray(o) && o !== null)) return;
|
|
7190
|
+
return function () {
|
|
7191
|
+
if (!action || !me.app.networkStatus.connected) {
|
|
7192
|
+
var store = me.$children[0].store;
|
|
7193
|
+
if (!store) {
|
|
7194
|
+
me.MsgBox('Store in form is undefined!');
|
|
7195
|
+
return;
|
|
7147
7196
|
}
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
if (!action || !me.app.networkStatus.connected) {
|
|
7156
|
-
var store = me.$children[0].store;
|
|
7157
|
-
if (!store) {
|
|
7158
|
-
me.MsgBox('Store in form is undefined!');
|
|
7159
|
-
return;
|
|
7160
|
-
}
|
|
7161
|
-
return _await(me.getStoredList(store), function (storedList) {
|
|
7162
|
-
if (!storedList) storedList = [];
|
|
7163
|
-
if (o.id) {
|
|
7164
|
-
for (var k = 0; k < storedList.length; k++) {
|
|
7165
|
-
if (storedList[k].tmpId == o.tmpId) {
|
|
7166
|
-
delete o["synchronized"];
|
|
7167
|
-
storedList[k] = o;
|
|
7168
|
-
}
|
|
7197
|
+
return _await(me.getStoredList(store), function (storedList) {
|
|
7198
|
+
if (!storedList) storedList = [];
|
|
7199
|
+
if (o.id) {
|
|
7200
|
+
for (var k = 0; k < storedList.length; k++) {
|
|
7201
|
+
if (storedList[k].tmpId == o.tmpId) {
|
|
7202
|
+
delete o["synchronized"];
|
|
7203
|
+
storedList[k] = o;
|
|
7169
7204
|
}
|
|
7170
7205
|
}
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
};
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
}
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
}
|
|
7210
|
-
}
|
|
7211
|
-
me.$emit('stored', o, storedList, objectStore);
|
|
7212
|
-
if (me.$ionic) me.app.toast('El registro fue grabado exitosamente!');
|
|
7213
|
-
me.close({
|
|
7214
|
-
success: true,
|
|
7215
|
-
data: o
|
|
7206
|
+
}
|
|
7207
|
+
var db = _$1.db;
|
|
7208
|
+
var transaction = db.transaction([store], "readwrite");
|
|
7209
|
+
var objectStore = transaction.objectStore(store);
|
|
7210
|
+
if (!o.id) {
|
|
7211
|
+
o.tmpId = 1 * new Date();
|
|
7212
|
+
o.id = -o.tmpId;
|
|
7213
|
+
//add new item to start to array
|
|
7214
|
+
var objectStoreRequest = objectStore.add(o);
|
|
7215
|
+
objectStoreRequest.onsuccess = function (e) {
|
|
7216
|
+
console.log(e);
|
|
7217
|
+
console.log('saved to ' + store);
|
|
7218
|
+
storedList.unshift(o);
|
|
7219
|
+
me.$emit('stored', o, storedList, objectStore);
|
|
7220
|
+
if (me.app && me.app.toast) me.app.toast('El registro fue grabado exitosamente!');
|
|
7221
|
+
o0.tmpId = o.tmpId;
|
|
7222
|
+
o0.id = o.id;
|
|
7223
|
+
me.close({
|
|
7224
|
+
success: true,
|
|
7225
|
+
data: o
|
|
7226
|
+
});
|
|
7227
|
+
};
|
|
7228
|
+
objectStoreRequest.onerror = function (e) {
|
|
7229
|
+
if (me.app && me.app.toast) me.app.toast('Error!');
|
|
7230
|
+
console.log(e);
|
|
7231
|
+
};
|
|
7232
|
+
} else {
|
|
7233
|
+
delete o["synchronized"];
|
|
7234
|
+
var item = objectStore.get(o.tmpId);
|
|
7235
|
+
item.onsuccess = function () {
|
|
7236
|
+
console.log(item.result);
|
|
7237
|
+
if (item.result) {
|
|
7238
|
+
console.log('objectStore.put(o)');
|
|
7239
|
+
objectStore.put(o);
|
|
7240
|
+
} else {
|
|
7241
|
+
storedList.forEach(function (ee) {
|
|
7242
|
+
if (ee.tmpId == o.tmpId) {
|
|
7243
|
+
objectStore.put(o);
|
|
7244
|
+
}
|
|
7216
7245
|
});
|
|
7217
|
-
}
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7246
|
+
}
|
|
7247
|
+
me.$emit('stored', o, storedList, objectStore);
|
|
7248
|
+
if (me.$ionic) me.app.toast('El registro fue grabado exitosamente!');
|
|
7249
|
+
me.close({
|
|
7250
|
+
success: true,
|
|
7251
|
+
data: o
|
|
7252
|
+
});
|
|
7253
|
+
};
|
|
7254
|
+
item.onerror = function () {
|
|
7255
|
+
me.MsgBox('Error getting temporal record ' + o.tmpId);
|
|
7256
|
+
};
|
|
7257
|
+
}
|
|
7258
|
+
});
|
|
7259
|
+
} else {
|
|
7260
|
+
axios__default["default"].post(action, o).then(function (result) {
|
|
7261
|
+
var data = result.data;
|
|
7262
|
+
if (o.tmpId) {
|
|
7263
|
+
var store = me.$children[0].store;
|
|
7264
|
+
var objectStore = window._.db.transaction([store], "readwrite").objectStore(store);
|
|
7265
|
+
var item = objectStore.get(o.tmpId);
|
|
7266
|
+
if (data.id) {
|
|
7267
|
+
o.id = data.id;
|
|
7268
|
+
o0.id = o.id;
|
|
7221
7269
|
}
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
if (data.id) {
|
|
7231
|
-
o.id = data.id;
|
|
7232
|
-
o0.id = o.id;
|
|
7270
|
+
item.onsuccess = function () {
|
|
7271
|
+
o0["synchronized"] = 1;
|
|
7272
|
+
o["synchronized"] = 1;
|
|
7273
|
+
var re;
|
|
7274
|
+
if (item.result) {
|
|
7275
|
+
re = objectStore.put(o);
|
|
7276
|
+
} else {
|
|
7277
|
+
re = objectStore.add(o);
|
|
7233
7278
|
}
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
o["synchronized"] = 1;
|
|
7237
|
-
var re;
|
|
7238
|
-
if (item.result) {
|
|
7239
|
-
re = objectStore.put(o);
|
|
7240
|
-
} else {
|
|
7241
|
-
re = objectStore.add(o);
|
|
7242
|
-
}
|
|
7243
|
-
re.onerror = function (e) {
|
|
7244
|
-
console.error(e);
|
|
7245
|
-
};
|
|
7246
|
-
//data es l valor recibiddo y o l nviao
|
|
7247
|
-
me.$emit('sync', data, o);
|
|
7279
|
+
re.onerror = function (e) {
|
|
7280
|
+
console.error(e);
|
|
7248
7281
|
};
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7282
|
+
//data es l valor recibiddo y o l nviao
|
|
7283
|
+
me.$emit('sync', data, o);
|
|
7284
|
+
};
|
|
7285
|
+
item.onerror = function () {
|
|
7286
|
+
me.MsgBox('Error getting temporal record ' + o.tmpId);
|
|
7287
|
+
};
|
|
7288
|
+
}
|
|
7289
|
+
if (me.$ionic) me.app.toast('El registro fue grabado exitosamente!', function () {
|
|
7290
|
+
me.close({
|
|
7291
|
+
success: true,
|
|
7292
|
+
data: data
|
|
7293
|
+
});
|
|
7294
|
+
});else {
|
|
7295
|
+
console.log(data);
|
|
7296
|
+
me.MsgBox('El registro fue grabado exitosamente!', function () {
|
|
7254
7297
|
me.close({
|
|
7255
7298
|
success: true,
|
|
7256
7299
|
data: data
|
|
7257
7300
|
});
|
|
7258
|
-
});
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
}
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
l = r.response.data.propertyViolations;
|
|
7275
|
-
//ec += l.length;
|
|
7276
|
-
for (var i = 0; i < l.length; i++) {
|
|
7277
|
-
var t = l[i];
|
|
7278
|
-
e = f.querySelector('[name=' + t.path + ']');
|
|
7279
|
-
if (e) {
|
|
7280
|
-
me.showerror(e, t.message);
|
|
7281
|
-
}
|
|
7301
|
+
});
|
|
7302
|
+
}
|
|
7303
|
+
})["catch"](function (r) {
|
|
7304
|
+
console.log(r);
|
|
7305
|
+
if (r.response) {
|
|
7306
|
+
var l, e;
|
|
7307
|
+
if (typeof r.response.data === 'string') {
|
|
7308
|
+
me.MsgBox(r.response.data);
|
|
7309
|
+
} else {
|
|
7310
|
+
l = r.response.data.propertyViolations;
|
|
7311
|
+
//ec += l.length;
|
|
7312
|
+
for (var i = 0; i < l.length; i++) {
|
|
7313
|
+
var t = l[i];
|
|
7314
|
+
e = f.querySelector('[name=' + t.path + ']');
|
|
7315
|
+
if (e) {
|
|
7316
|
+
me.showerror(e, t.message);
|
|
7282
7317
|
}
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7318
|
+
}
|
|
7319
|
+
l = r.response.data.fieldViolations;
|
|
7320
|
+
//ec += l.length;
|
|
7321
|
+
for (i = 0; i < l.length; i++) {
|
|
7322
|
+
t = l[i];
|
|
7323
|
+
e = f.querySelector('[name=' + t.path + ']');
|
|
7324
|
+
if (e) {
|
|
7325
|
+
me.showerror(e, t.message + ', valor=' + t.value);
|
|
7291
7326
|
}
|
|
7292
|
-
me.MsgBox('Verifique el formulario, aun tiene campos obligatorio completar.');
|
|
7293
|
-
if (me.$el.parentNode.className == 'v-dialog') me.$el.parentNode.parentNode.scroll({
|
|
7294
|
-
top: 0,
|
|
7295
|
-
behavior: 'smooth'
|
|
7296
|
-
});
|
|
7297
7327
|
}
|
|
7328
|
+
me.MsgBox('Verifique el formulario, aun tiene campos obligatorio completar.');
|
|
7329
|
+
if (me.$el.parentNode.className == 'v-dialog') me.$el.parentNode.parentNode.scroll({
|
|
7330
|
+
top: 0,
|
|
7331
|
+
behavior: 'smooth'
|
|
7332
|
+
});
|
|
7298
7333
|
}
|
|
7299
|
-
}
|
|
7300
|
-
}
|
|
7301
|
-
}
|
|
7302
|
-
}
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
}
|
|
7309
|
-
}());
|
|
7310
|
-
} catch (e) {
|
|
7311
|
-
return Promise.reject(e);
|
|
7312
|
-
}
|
|
7313
|
-
},
|
|
7314
|
-
saveAs: function saveAs(url, o, config) {
|
|
7315
|
-
if (typeof o == 'string') o = {
|
|
7316
|
-
body: o
|
|
7317
|
-
};
|
|
7318
|
-
var cfg = typeof config == 'string' ? {
|
|
7319
|
-
fileName: config
|
|
7320
|
-
} : config;
|
|
7321
|
-
if (!cfg) cfg = {};
|
|
7322
|
-
|
|
7323
|
-
/*
|
|
7324
|
-
var requestOptions = {
|
|
7325
|
-
method: 'POST',
|
|
7326
|
-
body: formdata
|
|
7327
|
-
};
|
|
7328
|
-
|
|
7329
|
-
fetch("http://{url}", requestOptions)
|
|
7330
|
-
.then(response => response.text())
|
|
7331
|
-
.then(result => console.log(result))
|
|
7332
|
-
.catch(error => console.log('error', error))
|
|
7333
|
-
*/
|
|
7334
|
-
var a = "" + o ? axios__default["default"].post(url, o, {
|
|
7335
|
-
responseType: 'blob'
|
|
7336
|
-
}) : axios__default["default"]({
|
|
7337
|
-
method: "post",
|
|
7338
|
-
url: url,
|
|
7339
|
-
data: o,
|
|
7340
|
-
headers: {
|
|
7341
|
-
"Content-Type": "multipart/form-data"
|
|
7342
|
-
}
|
|
7343
|
-
});
|
|
7344
|
-
a.then(function (response) {
|
|
7345
|
-
//console.log(response);
|
|
7346
|
-
var url = window.URL.createObjectURL(new Blob([response.data]));
|
|
7347
|
-
var link = document.createElement('a');
|
|
7348
|
-
link.href = url;
|
|
7349
|
-
if (!cfg.fileName) var disposition = response.headers['content-disposition'];
|
|
7350
|
-
if (disposition && disposition.indexOf('attachment') !== -1) {
|
|
7351
|
-
var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
|
|
7352
|
-
var matches = filenameRegex.exec(disposition);
|
|
7353
|
-
if (matches != null && matches[1]) {
|
|
7354
|
-
cfg.fileName = matches[1].replace(/['"]/g, '').trim();
|
|
7355
|
-
}
|
|
7356
|
-
}
|
|
7357
|
-
//console.log('cfg.fileName='+cfg.fileName);
|
|
7358
|
-
link.setAttribute('download', cfg.fileName);
|
|
7359
|
-
document.body.appendChild(link);
|
|
7360
|
-
link.click();
|
|
7361
|
-
});
|
|
7362
|
-
},
|
|
7363
|
-
savePost: function savePost() {},
|
|
7364
|
-
validate: function validate(e2) {
|
|
7365
|
-
var me = this;
|
|
7366
|
-
var ok = true;
|
|
7367
|
-
e2 = e2 ? e2 : me.$el;
|
|
7368
|
-
var input = e2.querySelectorAll("input,select,textarea,div[required=required]");
|
|
7369
|
-
var radio = {},
|
|
7370
|
-
previousElementSibling;
|
|
7371
|
-
for (i = 0; input.length > i; i++) {
|
|
7372
|
-
var e = input[i];
|
|
7373
|
-
if (e.type === 'radio') {
|
|
7374
|
-
var oo = radio[e.name];
|
|
7375
|
-
if (!oo) radio[e.name] = oo = [];
|
|
7376
|
-
oo.push(e);
|
|
7377
|
-
continue;
|
|
7334
|
+
}
|
|
7335
|
+
});
|
|
7336
|
+
}
|
|
7337
|
+
}();
|
|
7338
|
+
} else {
|
|
7339
|
+
me.MsgBox('Verifique el formulario, aun tiene campos obligatorios sin completar.');
|
|
7340
|
+
if (me.$el.parentNode.className == 'v-dialog') me.$el.parentNode.parentNode.scroll({
|
|
7341
|
+
top: 0,
|
|
7342
|
+
behavior: 'smooth'
|
|
7343
|
+
});
|
|
7378
7344
|
}
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7345
|
+
}());
|
|
7346
|
+
} catch (e) {
|
|
7347
|
+
return Promise.reject(e);
|
|
7348
|
+
}
|
|
7349
|
+
},
|
|
7350
|
+
saveAs: function saveAs(url, o, config) {
|
|
7351
|
+
if (typeof o == 'string') o = {
|
|
7352
|
+
body: o
|
|
7353
|
+
};
|
|
7354
|
+
var cfg = typeof config == 'string' ? {
|
|
7355
|
+
fileName: config
|
|
7356
|
+
} : config;
|
|
7357
|
+
if (!cfg) cfg = {};
|
|
7358
|
+
|
|
7359
|
+
/*
|
|
7360
|
+
var requestOptions = {
|
|
7361
|
+
method: 'POST',
|
|
7362
|
+
body: formdata
|
|
7363
|
+
};
|
|
7364
|
+
|
|
7365
|
+
fetch("http://{url}", requestOptions)
|
|
7366
|
+
.then(response => response.text())
|
|
7367
|
+
.then(result => console.log(result))
|
|
7368
|
+
.catch(error => console.log('error', error))
|
|
7369
|
+
*/
|
|
7370
|
+
var a = "" + o ? axios__default["default"].post(url, o, {
|
|
7371
|
+
responseType: 'blob'
|
|
7372
|
+
}) : axios__default["default"]({
|
|
7373
|
+
method: "post",
|
|
7374
|
+
url: url,
|
|
7375
|
+
data: o,
|
|
7376
|
+
headers: {
|
|
7377
|
+
"Content-Type": "multipart/form-data"
|
|
7378
|
+
}
|
|
7379
|
+
});
|
|
7380
|
+
a.then(function (response) {
|
|
7381
|
+
//console.log(response);
|
|
7382
|
+
var url = window.URL.createObjectURL(new Blob([response.data]));
|
|
7383
|
+
var link = document.createElement('a');
|
|
7384
|
+
link.href = url;
|
|
7385
|
+
if (!cfg.fileName) var disposition = response.headers['content-disposition'];
|
|
7386
|
+
if (disposition && disposition.indexOf('attachment') !== -1) {
|
|
7387
|
+
var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
|
|
7388
|
+
var matches = filenameRegex.exec(disposition);
|
|
7389
|
+
if (matches != null && matches[1]) {
|
|
7390
|
+
cfg.fileName = matches[1].replace(/['"]/g, '').trim();
|
|
7382
7391
|
}
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7392
|
+
}
|
|
7393
|
+
//console.log('cfg.fileName='+cfg.fileName);
|
|
7394
|
+
link.setAttribute('download', cfg.fileName);
|
|
7395
|
+
document.body.appendChild(link);
|
|
7396
|
+
link.click();
|
|
7397
|
+
});
|
|
7398
|
+
},
|
|
7399
|
+
savePost: function savePost() {},
|
|
7400
|
+
validate: function validate(e2) {
|
|
7401
|
+
var me = this;
|
|
7402
|
+
var ok = true;
|
|
7403
|
+
e2 = e2 ? e2 : me.$el;
|
|
7404
|
+
var input = e2.querySelectorAll("input,select,textarea,div[required=required]");
|
|
7405
|
+
var radio = {},
|
|
7406
|
+
previousElementSibling;
|
|
7407
|
+
for (i = 0; input.length > i; i++) {
|
|
7408
|
+
var e = input[i];
|
|
7409
|
+
if (e.type === 'radio') {
|
|
7410
|
+
var oo = radio[e.name];
|
|
7411
|
+
if (!oo) radio[e.name] = oo = [];
|
|
7412
|
+
oo.push(e);
|
|
7413
|
+
continue;
|
|
7414
|
+
}
|
|
7415
|
+
previousElementSibling = e.previousElementSibling;
|
|
7416
|
+
if (previousElementSibling && previousElementSibling.classList && previousElementSibling.classList.contains('v-error')) {
|
|
7417
|
+
previousElementSibling.parentNode.removeChild(previousElementSibling);
|
|
7418
|
+
}
|
|
7419
|
+
if (!(e.disabled || e.getAttribute('disabled')) && (e.required || e.tagName === 'DIV')) {
|
|
7420
|
+
//console.log([e]);
|
|
7421
|
+
//console.log(e.value);console.log(e.nodeValue);
|
|
7386
7422
|
|
|
7387
|
-
|
|
7388
|
-
|
|
7423
|
+
if (e.tagName != 'DIV' && !e.value /*||e.value == 0*/ || e.tagName === 'DIV' && !e.attributes.value) {
|
|
7424
|
+
previousElementSibling = e.previousElementSibling;
|
|
7425
|
+
while (previousElementSibling && previousElementSibling.nodeType != 1) {
|
|
7426
|
+
previousElementSibling = previousElementSibling.previousElementSibling;
|
|
7427
|
+
}
|
|
7428
|
+
if (!previousElementSibling) {
|
|
7429
|
+
previousElementSibling = e.parentElement.previousElementSibling;
|
|
7389
7430
|
while (previousElementSibling && previousElementSibling.nodeType != 1) {
|
|
7390
7431
|
previousElementSibling = previousElementSibling.previousElementSibling;
|
|
7391
7432
|
}
|
|
7392
|
-
if (!previousElementSibling) {
|
|
7393
|
-
previousElementSibling = e.parentElement.previousElementSibling;
|
|
7394
|
-
while (previousElementSibling && previousElementSibling.nodeType != 1) {
|
|
7395
|
-
previousElementSibling = previousElementSibling.previousElementSibling;
|
|
7396
|
-
}
|
|
7397
|
-
}
|
|
7398
|
-
var error = document.createElement("div");
|
|
7399
|
-
error.innerHTML = "Este campo es requerido!";
|
|
7400
|
-
ok = false;
|
|
7401
|
-
error.classList.add("v-error");
|
|
7402
|
-
e.parentNode.insertBefore(error, e);
|
|
7403
7433
|
}
|
|
7434
|
+
var error = document.createElement("div");
|
|
7435
|
+
error.innerHTML = "Este campo es requerido!";
|
|
7436
|
+
ok = false;
|
|
7437
|
+
error.classList.add("v-error");
|
|
7438
|
+
e.parentNode.insertBefore(error, e);
|
|
7404
7439
|
}
|
|
7405
7440
|
}
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7441
|
+
}
|
|
7442
|
+
for (var r in radio) {
|
|
7443
|
+
if (Object.prototype.hasOwnProperty.call(radio, r)) {
|
|
7444
|
+
var op = radio[r];
|
|
7445
|
+
var checked = false;
|
|
7446
|
+
var required = false;
|
|
7447
|
+
for (var i = 0; i < op.length; i++) {
|
|
7448
|
+
if (op[i].required && !op[i].disabled) required = true;
|
|
7449
|
+
if (op[i].checked) checked = true;
|
|
7450
|
+
}
|
|
7451
|
+
e = op[0].parentNode.parentNode;
|
|
7452
|
+
previousElementSibling = e.previousElementSibling;
|
|
7453
|
+
if (previousElementSibling && previousElementSibling.classList && previousElementSibling.classList.contains('v-error')) {
|
|
7454
|
+
previousElementSibling.parentNode.removeChild(previousElementSibling);
|
|
7455
|
+
}
|
|
7456
|
+
if (required && !checked) {
|
|
7457
|
+
me.showerror(e);
|
|
7458
|
+
/*previousElementSibling = e.previousElementSibling;
|
|
7459
|
+
while(previousElementSibling&&previousElementSibling.nodeType != 1) {
|
|
7460
|
+
previousElementSibling = previousElementSibling.previousElementSibling;
|
|
7461
|
+
}
|
|
7462
|
+
if(!previousElementSibling){
|
|
7463
|
+
previousElementSibling=e.parentElement.previousElementSibling;
|
|
7464
|
+
while(previousElementSibling&&previousElementSibling.nodeType != 1) {
|
|
7465
|
+
previousElementSibling = previousElementSibling.previousElementSibling;
|
|
7466
|
+
}
|
|
7467
|
+
}
|
|
7468
|
+
var error = document.createElement("div");
|
|
7469
|
+
error.innerHTML = "Este campo es requerido!";*/
|
|
7470
|
+
ok = false;
|
|
7471
|
+
//error.classList.add("v-error");
|
|
7472
|
+
//e.parentNode.insertBefore(error, e);
|
|
7438
7473
|
}
|
|
7439
7474
|
}
|
|
7475
|
+
}
|
|
7440
7476
|
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
};
|
|
7477
|
+
return ok;
|
|
7478
|
+
},
|
|
7479
|
+
showerror: _$1.showerror
|
|
7480
|
+
}), _defs);
|
|
7446
7481
|
if (!cfg) cfg = {
|
|
7447
7482
|
data: {
|
|
7448
7483
|
o: {}
|