prg-class
Version:
Clases genéricas utilizadas por microservicios Programamos SPA.
109 lines (108 loc) • 4.58 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UploadSave = exports.DeleteSave = exports.Save = exports.QueryOne = exports.QueryAll = void 0;
const _020_generic_delete_save_1 = require("./base-class/020-generic-delete-save");
const _002_query_sp_all_1 = require("./base-class/002-query-sp-all");
const _003_query_sp_one_1 = require("./base-class/003-query-sp-one");
const _006_save_sp_1 = require("./base-class/006-save-sp");
const _004_upload_excel_file_1 = require("./base-class/004-upload-excel-file");
class QueryAll extends _002_query_sp_all_1.QuerySPAll {
constructor(aoReq, abEnsureAuth = true, abAudit = false) {
super();
this.mbEnsureAuth = abEnsureAuth;
this.mbAudit = abAudit;
this.msTitle = 'Informe de...';
this.msSPName = 'database.spNameQueryAll';
this.fnInitClass(aoReq);
}
getSPParams(aoParam) {
return [
aoParam && aoParam.fieldOne ? aoParam.fieldOne : '',
aoParam && aoParam.fieldTwo ? aoParam.fieldTwo : '',
aoParam && aoParam.fieldThree ? aoParam.fieldThree : '',
];
}
xlsDefExtraField() {
const loCol = [
this.fnRowXls('fieldString', 'Caption String', this.miSM, ' ', 'L', 101), // C.jDTT.xText
this.fnRowXls('fieldNumber', 'Caption Number', this.miSL, this.msFN0, 'R', 102), // C.jDTT.xNumb
this.fnRowXls('fieldDate ', 'Caption Date ', this.miSM, ' ', 'C', 103), // C.jDTT.xDate
];
return loCol;
// xText: 101, // Texto hasta 255 caracteres.
// xNumb: 102, // Número Entero.
// xDate: 103, // Fecha.
// xBool: 104, // Boolean (true, false, 1, 0).
// xBoTx: 105, // Boolean texto. (Si, No)
// xTxEn: 106, // Texto (incluye enter).
// xList: 107, // Campo del tipo Select.
// xRut: 108, // Campo del tipo rut.
// xEmail: 109, // Campo del tipo Email.
// xFloat: 110, // Campo del tipo coma flotante. DECIMAL(18,6).
// xImg: 111, // Campo de texto con nombre de imagen.
// xDateTime: 112, // Fecha Hora.
}
}
exports.QueryAll = QueryAll;
class QueryOne extends _003_query_sp_one_1.QuerySPOne {
constructor(aoReq, abEnsureAuth = true, abAudit = false) {
super();
this.mbEnsureAuth = abEnsureAuth;
this.mbAudit = abAudit;
this.msSPName = 'database.spNameQueryOne';
this.fnInitClass(aoReq);
}
}
exports.QueryOne = QueryOne;
class Save extends _006_save_sp_1.SaveSP {
constructor(aoReq, abEnsureAuth = true, abAudit = false) {
super();
this.mbEnsureAuth = abEnsureAuth;
this.mbAudit = abAudit;
this.msSPName = 'database.spNameSave';
}
getSPParams(aoParam) {
const loPrm = [
aoParam && aoParam.fieldOne ? aoParam.fieldOne : '',
aoParam && aoParam.fieldTwo ? aoParam.fieldTwo : '',
aoParam && aoParam.fieldThree ? aoParam.fieldThree : '',
];
return loPrm;
}
}
exports.Save = Save;
class DeleteSave extends _020_generic_delete_save_1.GenericDeleteSave {
constructor(aoReq, abEnsureAuth = true, abAudit = false) {
super();
this.mbEnsureAuth = abEnsureAuth;
this.mbAudit = abAudit;
this.msSPName = 'database.spNameDelete';
this.fnInitClass(aoReq);
}
}
exports.DeleteSave = DeleteSave;
class UploadSave extends _004_upload_excel_file_1.UploadExcelDataSave {
constructor(aoReq, abEnsureAuth = true, abAudit = false) {
super();
this.mbEnsureAuth = abEnsureAuth;
this.mbAudit = abAudit;
this.msSpNameTemp = 'spNameTemporalSave';
this.msSpNameProc = 'spNameProcessSave';
this.msSPName = this.getSpName('database', this.msSpNameTemp);
this.fnInitClass(aoReq);
// this.mbHasCompany = false;
this.mbHasCompanyUpload = true;
this.mlRowStartData = 10; // Fila donde comienza la lista de datos. Generalmente es "10".
this.setFldName();
}
setFldName() {
this.moFields = [];
this.setField('NombreCampoStringOpcionalEnExcel');
this.setField('NombreCampoStringObligatorioEnExcel', '', '', true);
this.setField('NombreCampoFechaOpcionalEnExcel', '', 'DATE');
this.setField('NombreCampoEnteroOpcionalEnExcel', '', 'INT');
this.setField('NombreCampoDecimalOpcionalEnExcel', '', 'DECIMAL');
this.setField('NombreCampoMonedaOpcionalEnExcel', '', 'MONEY');
}
}
exports.UploadSave = UploadSave;