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.

149 lines
4.6 KiB

4 years ago
/**
* 复制权限按钮弹框文件
* @description [description]
* @version 1.0
* @author yangjinhua
*/
define(function(require, exports, module) {
let Window = require('system/views/pages/window/window');
let tpl = require('text!apps/rht/sku/sku080206/PreAbandon.tpl');
let service = require('./sku080206service');
let rhtComm = require('../../comm/rhtComm');
/**
* [复制权限弹框]
* @param {[type]} dsData 角色表数据源用于对角色ComBox进行赋值
*/
function PreAbandon(inputTitle) {
this.options = {
title: '设置商品状态'+inputTitle,
content: tpl,
width: 400,
height: 500,
modal: true,
closed: true,
closable: true,
draggable: true,
maximizable: false,
resizable: false,
data: null
}
this.preDisUseStatus = '111111';
Window.call(this, this.options);
}
inherits(PreAbandon, Window);
PreAbandon.prototype.init = function() {
}
PreAbandon.prototype.open = function() {
Window.prototype.open.call(this);
this.preDisUseStatus = rhtComm.getRhtOptionValue("*",'SKU','PreDisUseStatus','111111');
let ret = service.SkuGetDisUseReason();
if(ret.result != 1) {
Store.messager.err('获取淘汰原因失败!' + ret.message);
return false;
}
let $disuseReason = this.getElement('.disuseReason');
$disuseReason.combobox({
valueField:'lxcode',
textField:'lxname',
data:ret.data
});
SetDefault(this);
}
//执行windows窗体上自定义按钮事件
PreAbandon.prototype.customerize = function() {
let self = this;
//确定按钮事件
this.getElement('.btnOK').on('click', function(event) {
let status = GetStatus(self);
let disuseReason = self.getElement('.disuseReason').textbox('getText');
self.callback(status,disuseReason);
self.close();
});
//取消按钮事件
this.getElement('.btnCancel').on('click', function(event) {
self.close();
});
//默认值按钮事件
this.getElement('.btnDefault').on('click', function(event) {
SetDefault(self);
});
}
function SetDefault(fromObj) {
let $isJh = fromObj.getElement('.isJh');
let $isTh = fromObj.getElement('.isTh');
let $isPs = fromObj.getElement('.isPs');
let $isJs = fromObj.getElement('.isJs');
let $isSale = fromObj.getElement('.isSale');
let $isSaleTh = fromObj.getElement('.isSaleTh');
let $disuseReason = fromObj.getElement('.disuseReason');
if(fromObj.preDisUseStatus.substr(0,1) == '1') {
$isJh.checkbox('check');
}else {
$isJh.checkbox('uncheck');
}
if(fromObj.preDisUseStatus.substr(1,1) == '1') {
$isTh.checkbox('check');
}else {
$isTh.checkbox('uncheck');
}
if(fromObj.preDisUseStatus.substr(2,1) == '1') {
$isPs.checkbox('check');
}else {
$isPs.checkbox('uncheck');
}
if(fromObj.preDisUseStatus.substr(3,1) == '1') {
$isJs.checkbox('check');
}else {
$isJs.checkbox('uncheck');
}
if(fromObj.preDisUseStatus.substr(4,1) == '1') {
$isSale.checkbox('check');
}else {
$isSale.checkbox('uncheck');
}
if(fromObj.preDisUseStatus.substr(5,1) == '1') {
$isSaleTh.checkbox('check');
}else {
$isSaleTh.checkbox('uncheck');
}
$disuseReason.combobox('select', 0);
}
function GetStatus(fromObj) {
let $isJh = fromObj.getElement('.isJh');
let $isTh = fromObj.getElement('.isTh');
let $isPs = fromObj.getElement('.isPs');
let $isJs = fromObj.getElement('.isJs');
let $isSale = fromObj.getElement('.isSale');
let $isSaleTh = fromObj.getElement('.isSaleTh');
let status = '';
status += $isJh.checkbox('options').checked ? '1' : '0';
status += $isTh.checkbox('options').checked ? '1' : '0';
status += $isPs.checkbox('options').checked ? '1' : '0';
status += $isJs.checkbox('options').checked ? '1' : '0';
status += $isSale.checkbox('options').checked ? '1' : '0';
status += $isSaleTh.checkbox('options').checked ? '1' : '0';
return status;
}
return PreAbandon;
})