You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
240 lines
7.9 KiB
240 lines
7.9 KiB
|
|
define(function (require, exports, module) {
|
|
//let BaseBiz = require('apps/sos/common/base/sosbiz');
|
|
let BaseBiz = require('apps/rht/base/rhtBiz');
|
|
//let UApp = require('../../comm/UApp');
|
|
//let BaseBiz = require('./ordBiz');
|
|
let Service = require('./etp0603service');
|
|
let rhtComm = require('../../comm/rhtComm');
|
|
// let multiWindow = require("system/views/pages/multiwindow/multiwindow.js");
|
|
|
|
//let PluService = require('apps/rht/comm/pluservice');
|
|
//let multiselectwindow = require("apps/sos/common/window/multiselectwindow.js");
|
|
//let CommonService = require('apps/sos/commonservice/commservice');
|
|
//let MultiSelectWindow = require('apps/sos/common/window/multwindow.js');
|
|
//let FeedBackWindow = require('./feedbackwin');
|
|
//let ExTend = require('system/base/extend');
|
|
//let addfjWindow = require('apps/rht/etp/etp0603/addfjwindow/addjfwindow');
|
|
//let ImageWindow = require('system/views/pages/uploadpicture/uploadpicture');
|
|
let addpicture = require('apps/rht/etp/etp0603/addpicture/addpicture');
|
|
//let test = require('apps/rht/etp/etp0603/test/ddd');
|
|
//let sysuploadwindow = require('system/views/pages/uploadwindow/uploadwindow');
|
|
//let UploadPicture = require('system/views/pages/uploadpicture/uploadpicture');
|
|
//let UApp = require('../../comm/UApp');
|
|
//let uploadWindow = require("apps/rht/etp/uploadwindow/uploadwindow");
|
|
|
|
/**
|
|
* 控制按钮的可用
|
|
* @param opCode 按钮编码
|
|
* @return [description]
|
|
*/
|
|
|
|
//设置全局变量
|
|
let EtpCode;
|
|
let ZjCode;
|
|
let ZjNo;
|
|
|
|
|
|
function Biz(vm) {
|
|
//继承第一步,构造继承
|
|
BaseBiz.call(this, vm);
|
|
}
|
|
|
|
//继承第二步,方法继承
|
|
inherits(Biz, BaseBiz);
|
|
|
|
Biz.prototype.initCompleted = function () {
|
|
this.super('initCompleted');
|
|
this.imageServer = rhtComm.getRhtOptionValue('*','SYS','SYS_IMAGE_SERVER','');
|
|
}
|
|
|
|
//控制按钮状态
|
|
Biz.prototype.getOpEnabled = function (opCode) {
|
|
|
|
let isOk = this.super('getOpEnabled', opCode);
|
|
if (!isOk) {
|
|
return false;
|
|
}
|
|
let curRow = this.dsMaster.currentRow;
|
|
|
|
|
|
if (opCode == 'addfj') {
|
|
if (!curRow)
|
|
return false;
|
|
|
|
//编辑状态才可用
|
|
if (!this.isEdit())
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
};
|
|
|
|
//新增“附件”按钮,写按钮逻辑
|
|
Biz.prototype.doOp = function (opCode) {
|
|
let self = this;
|
|
if (opCode == 'addfj') {
|
|
let ds = self.dsMaster;
|
|
this.addfjButton(self, ds);
|
|
}
|
|
}
|
|
|
|
function getfildid (str){
|
|
return eval("(" + str + ")");
|
|
}
|
|
|
|
Biz.prototype.addfjButton = function (biz, ds) {
|
|
let self = this;
|
|
let detailRow = this.dsDetail.currentRow;
|
|
let length = this.dsDetail.rows.length;
|
|
if (length === 0 ){
|
|
Store.messager.warn('请先选中明细表中的附件信息。'+'<br>'+'若无附件信息请添加附件信息,保存后再设置附件图片!');
|
|
return false;
|
|
}
|
|
let EtpCode = TypeUtil.toString(detailRow['EtpCode']);
|
|
let ZjCode = TypeUtil.toString(detailRow['ZjCode']);
|
|
let ZjNo = TypeUtil.toString(detailRow['ZjNo']);
|
|
let AffixName = TypeUtil.toString(detailRow['AffixName']);
|
|
let imgSrc = TypeUtil.toString(detailRow['ImgSrc']);
|
|
|
|
let upwindow = new addpicture({
|
|
imgSrc: imgSrc,
|
|
confirm:function(val){
|
|
if(val.length === 0) {
|
|
return true;
|
|
}
|
|
|
|
let obj = getfildid(val);
|
|
let rows = obj["data"];
|
|
let fileid = self.imageServer + 'api/storage/file/' + rows[0];
|
|
//addPictureDeal(this.biz,EtpCode,ZjCode,ZjNo,AffixName,fileid);
|
|
detailRow.setColumnValue('ImgSrc', fileid);
|
|
},
|
|
cancel:function(val){
|
|
if(val.length === 0) {
|
|
return true;
|
|
}
|
|
let obj = getfildid(val);
|
|
let rows = obj["data"];
|
|
let fileid = rows[0];
|
|
deletePictureDeal(this.biz,fileid);
|
|
},
|
|
rootPath:'upload_picture',
|
|
//cusUrl:'image/upload.action'
|
|
});
|
|
upwindow.open();
|
|
|
|
|
|
return true;
|
|
}
|
|
//将通过平台上传到后台的图片转为数据库blob数据
|
|
function addPictureDeal (biz,EtpCode,ZjCode,ZjNo,AffixName,fileId) {
|
|
|
|
//let detailRow = this.dsDetail.currentRow;
|
|
let ret= Service.uploadPicture(EtpCode,ZjCode,ZjNo,AffixName,fileId);
|
|
if (ret.result !== 1) {
|
|
Store.messager.err('上传失败!' );
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
//点击取消按钮,将已经上传到后台的图片删除
|
|
function deletePictureDeal (biz,fileId) {
|
|
|
|
//let detailRow = this.dsDetail.currentRow;
|
|
let ret= Service.deletePicture(fileId);
|
|
if (ret.result !== 1) {
|
|
Store.messager.err('操作失败!' );
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
//获取变量值,一会删除数据用
|
|
Biz.prototype.beforeDelete = function () {
|
|
let masterRow = this.dsMaster.currentRow;
|
|
EtpCode = TypeUtil.toString(masterRow['EtpCode']);
|
|
ZjCode = TypeUtil.toString(masterRow['ZjCode']);
|
|
ZjNo = TypeUtil.toString(masterRow['ZjNo']);
|
|
return "确定要删除吗?";
|
|
}
|
|
|
|
//删除企业证件要把企业证件对应的附件删除
|
|
Biz.prototype.afterDelete = function () {
|
|
|
|
let ret= Service.afterDelete(EtpCode,ZjCode,ZjNo);
|
|
if (ret.result !== 1) {
|
|
Store.messager.err('删除企业证件附件表失败!')
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
//保存前数据判断
|
|
Biz.prototype.beforeSave = function () {
|
|
let curRow = this.dsMaster.currentRow;
|
|
if(curRow){
|
|
|
|
let BgnDate = TypeUtil.toString(curRow['BgnDate']);
|
|
let EndDate = TypeUtil.toString(curRow['EndDate']);
|
|
let TgDate = TypeUtil.toString(curRow['TgDate']);
|
|
let ffDate = TypeUtil.toString(curRow['ffDate']);
|
|
|
|
if ((BgnDate !== "") && (EndDate !== ""))
|
|
{
|
|
if (BgnDate > EndDate )
|
|
{
|
|
curRow.setColumnError("BgnDate","有效起始日期不能大于有效终止日期!");
|
|
return false;
|
|
}
|
|
}
|
|
if ((EndDate !== "") && (TgDate !== ""))
|
|
{
|
|
if (TgDate > EndDate )
|
|
{
|
|
curRow.setColumnError("TgDate","提供日期不能大于有效终止日期!");
|
|
return false;
|
|
}
|
|
}
|
|
if ((ffDate !== "") && (TgDate !== ""))
|
|
{
|
|
if (ffDate > TgDate )
|
|
{
|
|
curRow.setColumnError("ffDate","提供日期不能大于发放日期!");
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return this.super('beforeSave');
|
|
}
|
|
|
|
Biz.prototype.beforeDataSrcAddFirstRow = function(dataSrc) {
|
|
if (dataSrc.uiObjCode === this.dsDetail.uiObjCode) {
|
|
if(!this.dsMaster.currentRow.EtpCode) {
|
|
Store.messager.err('请先选择企业!')
|
|
return false;
|
|
}
|
|
if(!this.dsMaster.currentRow.ZjCode) {
|
|
Store.messager.err('请先选择证件!')
|
|
return false;
|
|
}
|
|
if(!this.dsMaster.currentRow.ZjNo) {
|
|
Store.messager.err('请先输入证件编号!')
|
|
return false;
|
|
}
|
|
if(!this.dsMaster.currentRow.YjDates) {
|
|
Store.messager.err('请先输入失效预警天数!')
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
return Biz;
|
|
}); |