/** * @desc: 销售品目录管理 - 销售品属性维护页面相关JS * @version: PRD V2.0 * @type: public * @author: 康勇 * @Copyright: tydic * @date: 2009-12-29 * @email: kangyong@tydic.com */ // ~ function OfrFea( ) { } // ~ 变量定义 OfrFea. prototype . FORMID = "form1" ; // form 标识 OfrFea. prototype . CONTEXT_PATH = "/PmdWeb" ; // 上下文路径,默认为 PmdWeb OfrFea. prototype . URL_LOCATION_PAGE = "/product/ofrManage/ofrFeaAdd.jsp" ; OfrFea. prototype . ofrId = "" ; // 销售品ID OfrFea. prototype . feaId = "" ; // 销售品属性ID OfrFea. prototype . isedit = "" ; OfrFea. prototype . ofrTypeId = "" ; //销售品类型 OfrFea. prototype . LANT_ID= '' ; //登录员工编号 OfrFea. prototype . ZONEID= "" ; //当前刷新区域 // ~定义 业务变量 OfrFea. prototype . FEA_NAME= "" ; //属性名称 OfrFea. prototype . selectCIndex= - 1; //选中行 // ~ 定义 Ajax 刷新区域ID OfrFea. prototype . ZONE_G_FEAINFO = "ZONE_G_FEAINFO" ; // 属性和属性值信息 OfrFea. prototype . ZONE_G_FEAINFO_A = "ZONE_G_FEAINFO_A" ; // 属性信息 // ~ 定义按钮操作类型 OfrFea. prototype . BUTTON_SUBMIT_U = "BUTTON_SUBMIT_U" ; // 修改销售品属性信息 OfrFea. prototype . BUTTON_SUBMIT_A = "BUTTON_SUBMIT_A" ; // 添加销售品属性信息 OfrFea. prototype . OPTION_BUTTON = "" ; // 当前操作按钮 /** * @desc: 查询销售品的属性/属性值 * @type: private */ OfrFea. prototype . queryOfrFeaInfo = function ( ) { //设置刷新区域 this . ZONEID = this . ZONE_G_FEAINFO; this . URL_LOCATION_PAGE = "/product/ofrManage/ofrFeaAdd.jsp" var t = "" ; t = "?FW__SERVICE_ID=30294" ; t = t + "&FW__AA_REFRESH_ZONES=" + this . ZONEID; t = t + "&FW__LATN_CD=888" ; t = t + "&FW__PAGE_NAVIGATION_FORWARD=" + this . URL_LOCATION_PAGE; t = this . CONTEXT_PATH + "/servlet/QueryServlet.ajax" + t; t = t + "&OFR_FEA_ID=" + this . feaId; this . submitActions( t) ; } ; /** * @desc: 查询销售品的属性 * @type: private */ OfrFea. prototype . queryOfrFeaInfoA = function ( ) { //设置刷新区域 this . ZONEID = this . ZONE_G_FEAINFO_A; this . URL_LOCATION_PAGE = "/product/ofrManage/ofrFeaAdd.jsp" var t = "" ; t = "?FW__SERVICE_ID=30295" ; t = t + "&FW__AA_REFRESH_ZONES=" + this . ZONEID; t = t + "&FW__LATN_CD=888" ; t = t + "&FW__PAGE_NAVIGATION_FORWARD=" + this . URL_LOCATION_PAGE; t = this . CONTEXT_PATH + "/servlet/QueryServlet.ajax" + t; t = t + "&OFR_FEA_ID=" + this . feaId; this . submitActions( t) ; } ; //~ /** * @desc: 表格中添加行 * @type: public * @param: ID * @param: 名称 */ OfrFea. prototype . processFeaValue = function ( attrId, attrName, attrDesc, val) { // 获得表格对象 var _tab = document . getElementById ( 'FeaDftTable' ) ; // rows 1 : 定义行 var _row = _tab. insertRow ( ) ; _row. id = attrId; _row. onclick = function anonymous( ) { ofrFea. rowsColorC( this . rowIndex ) ; } ; //为新增的行指定动作 var uObjInstId = reuseFramework. createObjectName( this . FORMID, "T038U" ) ; // var str = " " ; str + = ' + uObjInstId + '_C_OFR_FEA_ATTR_ID" value="' + attrId+ '" type="hidden">' ; _cell = _row. insertCell ( ) ; _cell. innerHTML = str+ "值名称" ; _cell. style . width = 70; _cell = _row. insertCell ( ) ; _cell. innerHTML = ' + uObjInstId + '_C_OFR_FEA_ATTR_NAME" value="' + attrName+ '" type="text">' ; _cell. style . width = 150; _cell = _row. insertCell ( ) ; _cell. innerHTML = "值描述" ; _cell. style . width = 70; _cell = _row. insertCell ( ) ; _cell. innerHTML = ' + uObjInstId + '_C_ATTR_DESC" value="' + attrDesc+ '" type="text">' ; _cell. style . width = 150; _cell = _row. insertCell ( ) ; _cell. innerHTML = "默认值" ; _cell. style . width = 70; _cell = _row. insertCell ( ) ; _cell. innerHTML = ' + uObjInstId + '_C_VAL" value="' + val+ '" type="text" maxlength="10">' ; _cell. style . width = 150; } ; //~ /** * @desc: 表格中添加行 * @type: public * @param: ID * @param: 名称 */ OfrFea. prototype . addOfrFeaAttr = function ( ) { var OBJ1_T037_C_OFR_FEA_TYPE_ID = document . getElementById ( 'OBJ1_T037_C_OFR_FEA_TYPE_ID' ) . value ; if ( OBJ1_T037_C_OFR_FEA_TYPE_ID= = '' ) { alert ( "请先选择属性类型!" ) ; return ; } if ( this . FEA_NAME = = "" ) { ofrFea. FEA_NAME = document . getElementById ( 'OBJ1_T037_C_OFR_FEA_NAME' ) . value ; } // 获得表格对象 var _tab = document . getElementById ( 'FeaDftTable' ) ; len = _tab. rows . length ; //表格行数 var fea_value_type = document . getElementById ( 'OBJ1_T037_C_FEA_VAL_TYPE' ) . value ; if ( fea_value_type= = '2' ) { if ( len> = 1) { alert ( "值类型为连续的属性不能添加多个属性值!" ) ; return ; } } // rows 1 : 定义行 var _row = _tab. insertRow ( ) ; _row. onclick = function anonymous( ) { ofrFea. rowsColorC( this . rowIndex ) ; } ; //为新增的行指定动作 var aObjInstId = reuseFramework. createObjectName( this . FORMID, "T038A" ) ; // var str = " " ; _cell = _row. insertCell ( ) ; _cell. innerHTML = str+ "值名称" ; _cell. style . width = 70; _cell = _row. insertCell ( ) ; _cell. innerHTML = ' + aObjInstId + '_C_OFR_FEA_ATTR_NAME" value="' + this . FEA_NAME+ '" type="text">' ; _cell. style . width = 150; _cell = _row. insertCell ( ) ; _cell. innerHTML = "值描述" ; _cell. style . width = 70; _cell = _row. insertCell ( ) ; _cell. innerHTML = ' + aObjInstId + '_C_ATTR_DESC" value="' + this . FEA_NAME+ '" type="text">' ; _cell. style . width = 150; _cell = _row. insertCell ( ) ; _cell. innerHTML = "默认值" ; _cell. style . width = 70; _cell = _row. insertCell ( ) ; _cell. innerHTML = ' + aObjInstId + '_C_VAL" value="" type="text" maxlength="10">' ; _cell. style . width = 150; } ; OfrFea. prototype . rowsColorC = function ( rows_index) { //控制鼠标点击后的表格行颜色 this . selectCIndex = rows_index; _tab = document . getElementById ( 'FeaDftTable' ) ; //表格对象 len = _tab. rows . length ; //表格行数 for ( i= 0; i< len; i+ + ) { _tab. rows [ i] . style . backgroundColor = "" ; } _tab. rows [ rows_index] . style . backgroundColor = "#FCF9BC" ; } ; OfrFea. prototype . deleteRows= function ( ) { var _tab = document . getElementById ( 'FeaDftTable' ) ; //表格对象 len = _tab. rows . length ; //表格行数 if ( len> = 1) { if ( this . selectCIndex!=-1) { if ( _tab. rows [ this . selectCIndex] . id ! = '' ) { var attrId = _tab. rows [ this . selectCIndex] . id ; //alert(attrId); var T031CH = document . getElementById ( "T038D" ) ; var dObjInstId = reuseFramework. createObjectName( this . FORMID, "T038D" ) ; var fw = document . createElement ( "input" ) ; fw. name = "FW__OBJECT_RELATIONS" ; fw. type = "hidden" ; fw. value = "OBJ1_T037|" + dObjInstId; T031CH. appendChild ( fw) ; fw = document . createElement ( "input" ) ; fw. name = dObjInstId + "_C_OFR_FEA_ATTR_ID" ; fw. type = "hidden" ; fw. value = attrId T031CH. appendChild ( fw) ; } _tab. deleteRow ( this . selectCIndex) ; this . selectCIndex= - 1; //初始化B区被选择的行 } else { alert ( "请选择要删除的行!" ) ; } } } ; // ***********************************************************// // ~ ofrFea = new OfrFea( ) ; /** * @desc: 验证后,页面操作 * @type: public * @param: 显示层ID */ OfrFea. prototype . validateSubmit = function ( ) { //debugger; //alert("validate"); var fea_val_type = document . getElementById ( "OBJ1_T037_C_FEA_VAL_TYPE" ) . value ; if ( fea_val_type= = '2' ) { if ( document . getElementById ( 'OBJ1_T037_C_FEA_MIN_VALUE' ) . value = = "" ) { alert ( '值下限不能为空!' ) ; return ; } ; if ( document . getElementById ( 'OBJ1_T037_C_FEA_MAX_VALUE' ) . value = = "" ) { alert ( '值上限上能为空!' ) ; return ; } ; } else { document . getElementById ( 'OBJ1_T037_C_FEA_MIN_VALUE' ) . value = "" ; document . getElementById ( 'OBJ1_T037_C_FEA_MAX_VALUE' ) . value = "" ; } var _tab = document . getElementById ( 'FeaDftTable' ) ; //表格对象 len = _tab. rows . length ; //表格行数 if ( len< = 0) { alert ( '该属性必须要有一个属性值!' ) ; return ; } if ( fea_val_type= = '2' & & len> 1) { alert ( '值类型为连续的属性只能有一个属性值!' ) ; return ; } var feaUnit = document . getElementById ( 'OBJ1_T037_C_FEA_UNIT' ) ; var i = feaUnit. selectedIndex ; document . getElementById ( 'OBJ1_T037_C_FEA_UNIT_NAME' ) . value = feaUnit[ i] . text ; this . pageSubmit( this . OPTION_BUTTON) ; } ; /** * @desc: 查询待处理任务 * @type: private * @param: _type 区分 保存 提交 */ OfrFea. prototype . setButtonValue = function ( _type) { //alert("set value" + _type); this . OPTION_BUTTON = _type; } ; /** * @desc: 提交页面 * @type: private * @param: 点击的按钮 */ OfrFea. prototype . pageSubmit = function ( _type) { //修改属性/属性值信息 if ( _type= = this . BUTTON_SUBMIT_U) { this . setSubmitData( "30299" , "888" , this . URL_LOCATION_PAGE, "____errorZone" ) ; } //添加属性/属性值信息 if ( _type= = this . BUTTON_SUBMIT_A) { this . setSubmitData( "30292" , "888" , this . URL_LOCATION_PAGE, "____errorZone" ) ; } //ajax提交 var url = this . CONTEXT_PATH + "/servlet/ReuseServlet.ajax" ; this . submitActions( url ) ; } ; /** * @desc: 设置提交后台的必填数据 * @type: public * @param: 服务ID * @param: 本地网 * @param: 跳转页面路径 * @param: 刷新区域ID(Ajax 提交时,需设置) */ OfrFea. prototype . setSubmitData = function ( _serviceId, _latnCd, _forward, _refreshZones) { if ( tools. isEmpty( _serviceId) | | tools. isEmpty( _latnCd) | | tools. isEmpty( _forward) ) { alert ( this . MSG_ERROR_001) ; return ; } document . getElementById ( "FW__SERVICE_ID" ) . value = _serviceId; document . getElementById ( "FW__LATN_CD" ) . value = _latnCd; document . getElementById ( "FW__PAGE_NAVIGATION_FORWARD" ) . value = _forward; if ( ! tools. isEmpty( _refreshZones) ) { document . getElementById ( "FW__AA_REFRESH_ZONES" ) . value = _refreshZones; } } ; /** * @desc: 清空变量值 * @type: public */ OfrFea. prototype . clear = function ( ) { document . getElementById ( "FW__SERVICE_ID" ) . value = "" ; document . getElementById ( "FW__LATN_CD" ) . value = "" ; document . getElementById ( "FW__PAGE_NAVIGATION_FORWARD" ) . value = "" ; document . getElementById ( "FW__AA_REFRESH_ZONES" ) . value = "" ; } ; /** * @desc: 设置展示消息 * @type: private */ OfrFea. prototype . setCommonMsg = function ( _message) { document . getElementById ( "common_message" ) . innerHTML = "" + _message + "
" ; } ; // ~ /** * @desc: 清空展示消息 * @type: private */ OfrFea. prototype . clearCommonMsg = function ( ) { document . getElementById ( "common_message" ) . innerHTML = "" ; } ; // ~ Ajax 提交 ajaxAnywhere. formName = this . FORMID; //; OfrFea. prototype . submitActions = function ( url ) { if ( ! tools. isEmpty( url ) ) { document . frames [ this . FORMID] . action = url ; ajaxAnywhere. submitAJAX( ) ; } } ; //~ ajax 提交后处理 ajaxAnywhere. onAfterResponseProcessing = function ( ) { if ( ajaxAnywhere. isSuccess) { //debugger; if ( ofrFea. OPTION_BUTTON= = ofrFea. BUTTON_SUBMIT_U | | ofrFea. OPTION_BUTTON= = ofrFea. BUTTON_SUBMIT_A) { //alert('销售品信息修改成功!'); window . returnValue = 'true' ; window . close ( ) ; } } } ; //~ AjaxAnywhere. prototype . handleException = function ( type , details) { alert ( "\u63d0\u4ea4\u5931\u8d25,\u8bf7\u91cd\u8bd5!" + details) ; } ;