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.

97 lines
2.9 KiB

4 years ago
/**
* 复制权限按钮弹框文件
* @description [description]
* @version 1.0
* @author yangjinhua
*/
define(function(require, exports, module) {
let Window = require('system/views/pages/window');
let tpl = require('text!apps/rht/etp/etp0606/Tran.tpl');
let service = require('./etp0606service');
let rhtComm = require('../../comm/rhtComm');
let fOrgCode;
/**
* [复制权限弹框]
* @param {[type]} dsData 角色表数据源用于对角色ComBox进行赋值
*/
function Tran(orgCode, etpCode, etpAttribute) {
this.options = {
title: "转化",
content: tpl,
width: 250,
height: 153,
modal: true,
closed: true,
closable: true,
draggable: true,
maximizable: false,
resizable: false,
data: null
}
this.orgCode = orgCode;
this.etpCode = etpCode;
this.etpAttribute = etpAttribute;
Window.call(this, this.options);
}
inherits(Tran, Window);
Tran.prototype.init = function() {
}
//执行windows窗体上自定义按钮事件
Tran.prototype.customerize = function() {
let self = this;
//确定按钮事件
this.getElement('.btnOk').on('click', function(event) {
let newAttribute = $("input[name='switch']:checked").val();
if(!newAttribute) {
return false;
}
if(newAttribute == self.etpAttribute) {
Store.messager.err('已经是' + (self.etpAttribute=='1' ? '内部供应商' : '外部供应商') + ',不需要转化!');
return false;
}
let ret = service.EtpInOrg(self.etpCode);
if (ret.result != 1) {
Store.messager.err(ret.message);
return false;
}
if(!ret.data && newAttribute == '1') {
Store.messager.err('此供应商不是内部组织,不能转化为内部供应商');
return false;
}
if(ret.data && newAttribute == '2') {
Store.messager.err('此供应商是内部组织,不能转化为外部供应商');
return false;
}
if (!Store.confirm("您确定要转化吗?")) {
return false;
}
ret = service.EtpSupplierTurn(self.orgCode, self.etpCode, newAttribute);
if (ret.result != 1) {
Store.messager.err('转化出错:' + ret.message);
return false;
}
Store.messager.tip('转化成功!');
if (self.callback) {
self.callback();
}
self.close();
});
//取消按钮事件
this.getElement('.btnCancel').on('click', function(event) {
self.close();
});
}
return Tran;
})