|
|
///<reference path="../../../../Views/../TruckMng/Scripts/ext-all-debug.js" />
|
|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
var BillNoCount = 0;
|
|
|
|
|
|
Shipping.SysUserEdit = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.Shipping.SysUserEdit.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
function getSaved() {
|
|
|
//var cargodirty=BaseProject.GetDirty(panelEdit.storeCargo,panelEdit.CargoDel);
|
|
|
//var appstatedirty=BaseProject.GetDirty(panelEdit.storeappstate,panelEdit.AppstateDel);
|
|
|
|
|
|
if (panelEdit.formEdit.getForm().isDirty() == true) { //判断表单是否有项改变,有改变isDirty()返回true
|
|
|
return true;
|
|
|
}
|
|
|
else return false;
|
|
|
}
|
|
|
|
|
|
Ext.extend(Shipping.SysUserEdit, Ext.Panel, {
|
|
|
parentWin: null,
|
|
|
opStatus: 'add',
|
|
|
// StoreList: null,
|
|
|
editRecord: null,
|
|
|
DEPTNAME: "",
|
|
|
COMPANYID:"",
|
|
|
initUIComponents: function () {
|
|
|
|
|
|
this.bodyUSERID = "";
|
|
|
//----------------------------------------------------------------------------------------------------------
|
|
|
this.formname = "modSysUserEdit"; //视图自定义样式Form名称
|
|
|
//--------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
//#region combox定义
|
|
|
//所属部门
|
|
|
this.storeDept = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.DeptModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetDeptList_All' }
|
|
|
});
|
|
|
//this.storeDept.load();
|
|
|
this.comboxDept = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '所属部门',
|
|
|
allowBlank: false,
|
|
|
store: this.storeDept,
|
|
|
flex: 1,
|
|
|
labelWidth: 80,
|
|
|
forceSelection: true,
|
|
|
name: 'DEPTNAME',
|
|
|
valueField: 'DeptName',
|
|
|
displayField: 'DeptName'
|
|
|
//,hidden: true
|
|
|
});
|
|
|
|
|
|
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'companymb', proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
|
|
|
});
|
|
|
|
|
|
|
|
|
_this = this;
|
|
|
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '所属公司',
|
|
|
allowBlank: false,
|
|
|
forceSelection: true,
|
|
|
store: this.storeCompany,
|
|
|
flex: 1,
|
|
|
labelWidth: 80,
|
|
|
name: 'COMPANYID', id: "COMPANYID",
|
|
|
valueField: 'gid',
|
|
|
displayField: 'name',
|
|
|
listeners: {
|
|
|
blur: function (combo,records,field, eOpts) {
|
|
|
_this.storeDept.load({ params: { condition: " linkid='" + combo.value+"'" } });
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//#region 编辑form:formEdit
|
|
|
checklabelwidth = 130;
|
|
|
this.formEdit = Ext.widget('form', { //便于速记创建一个微件的xtype配置对象。
|
|
|
// layout: "border",
|
|
|
region: 'north',
|
|
|
height: 650,
|
|
|
//collapsed: false, //设置为 true 则将 fieldset 初始化为收缩状态
|
|
|
//collapsible: true, //设置为 true 则允许 fieldset 可以收缩,并自动的渲染 收缩/展开 切换按钮到 组头(legend) 元素中, 设置为 false 则让 fieldset 保持静态的大小,也没有收缩按钮.
|
|
|
frame: true,
|
|
|
bodyPadding: 3,
|
|
|
trackResetOnLoad: true, //如果设为true,reset()重置到最近被加载的或setValues()的数据,而不是最初创建表单时的。
|
|
|
fieldDefaults: { //设定样式,如果指定此配置项, 则该对象内部的属性将会被应用到所有添加到此容器内的 Ext.form.Labelable 实例(e.g. Ext.form.field.Base 或者 Ext.form.FieldContainer),
|
|
|
// 作为其默认值. 而在每个 field 自己的配置项中相应的属性会具有较高的优先级, 当然, 其父容器的 defaults config 也比此配置项优先。
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1, //此配置项将被应用到布局管理的容器的子项中.
|
|
|
//每个含有flex属性的子项将会被根据当前子项的flex值与所有其他含flex值子项的值的和 的相对比例进行伸缩('hbox'中横向, 'vbox'中纵向).
|
|
|
labelWidth: 80,
|
|
|
msgTarget: 'qtip'
|
|
|
//,split:true
|
|
|
},
|
|
|
|
|
|
items: [
|
|
|
{//fieldset 1
|
|
|
title: '基本信息',
|
|
|
xtype: 'fieldset', //此属性提供了一个较短的替代全类型创建对象. 使用 xtype 是最常见的方式来定义组件实例, 特别是在一个容器中.
|
|
|
defaultType: 'textfield', //当一个子项目通过一个原生的配置对象而不是一个组件的实例指定时, 在当前容器中创建子组件时使用的默认 xtype,默认为 'panel'。
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
this.comboxCompany,
|
|
|
this.comboxDept,
|
|
|
{
|
|
|
fieldLabel: '姓名', flex: 1,
|
|
|
name: 'SHOWNAME'
|
|
|
}, {
|
|
|
fieldLabel: '英文名', flex: 1,
|
|
|
name: 'USERNAME'
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: 'GID',
|
|
|
hidden: true,
|
|
|
name: 'GID'
|
|
|
},
|
|
|
|
|
|
|
|
|
// {
|
|
|
// fieldLabel: '所属部门', readOnly: true,
|
|
|
// name: 'DEPTNAME'
|
|
|
// },
|
|
|
//{
|
|
|
// fieldLabel: 'COMPANYID',
|
|
|
// name: 'COMPANYID', flex: 0, hidden: true, margins: '0'
|
|
|
//},
|
|
|
{
|
|
|
fieldLabel: 'DEPTID',
|
|
|
name: 'DEPTID', flex: 0, hidden: true, margins: '0'
|
|
|
}, {
|
|
|
fieldLabel: '代码名', flex: 1,
|
|
|
name: 'CODENAME',
|
|
|
//xtype: 'numberfield',
|
|
|
//selectOnFocus: true, //得到焦点时自动选择文本
|
|
|
//allowDecimals: false, //允许输入小数
|
|
|
//decimalPrecision: 0, //允许保留的小数位数,并四舍五入
|
|
|
//nanText: '请输入有效数值',
|
|
|
//hideTrigger: false //是否隐藏上下调节按钮
|
|
|
}, {
|
|
|
fieldLabel: '密码', flex: 1,
|
|
|
inputType: 'password',
|
|
|
name: 'PASSWORD'
|
|
|
}, {
|
|
|
fieldLabel: '财务用户名', flex: 1,
|
|
|
name: 'CWUSERNAME',
|
|
|
//xtype: 'numberfield',
|
|
|
//selectOnFocus: true, //得到焦点时自动选择文本
|
|
|
//allowDecimals: false, //允许输入小数
|
|
|
//decimalPrecision: 0, //允许保留的小数位数,并四舍五入
|
|
|
//nanText: '请输入有效数值',
|
|
|
//hideTrigger: false //是否隐藏上下调节按钮
|
|
|
}, {
|
|
|
fieldLabel: '财务密码', flex: 1,
|
|
|
inputType: 'password',
|
|
|
name: 'CWPASSWORD'
|
|
|
},{
|
|
|
fieldLabel: 'ENROLLTIME', hidden:true,
|
|
|
name: 'ENROLLTIME'
|
|
|
}, {
|
|
|
fieldLabel: 'ISDELETED', hidden: true,
|
|
|
name: 'ISDELETED'
|
|
|
}, {
|
|
|
fieldLabel: 'ISDISABLE', hidden: true,
|
|
|
name: 'ISDISABLE'
|
|
|
}, {
|
|
|
fieldLabel: 'DELETEUSER', hidden: true,
|
|
|
name: 'DELETEUSER'
|
|
|
}, {
|
|
|
fieldLabel: 'DELETETIME', hidden: true,
|
|
|
name: 'DELETETIME'
|
|
|
}, {
|
|
|
fieldLabel: 'NOCODE', hidden: true,
|
|
|
name: 'NOCODE'
|
|
|
}, {
|
|
|
fieldLabel: 'OPENID', hidden: true,
|
|
|
name: 'OPENID'
|
|
|
}, {
|
|
|
fieldLabel: 'USERCOMPANYGID', hidden: true,
|
|
|
name: 'USERCOMPANYGID'
|
|
|
}, {
|
|
|
fieldLabel: 'USERBASEINFOGID', hidden: true,
|
|
|
name: 'USERBASEINFOGID'
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
,
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
]
|
|
|
}
|
|
|
,{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: 'QQ', flex: 1,
|
|
|
name: 'QQ'
|
|
|
}, {
|
|
|
fieldLabel: '传真', flex: 1,
|
|
|
name: 'FAX'
|
|
|
}, {
|
|
|
fieldLabel: 'MSN', flex: 1,hidden:true,
|
|
|
name: 'MSN'
|
|
|
}, {
|
|
|
fieldLabel: '微信', flex: 1,
|
|
|
name: 'WECHATACCOUNT'
|
|
|
}, {
|
|
|
fieldLabel: '钉钉', flex: 1,
|
|
|
name: 'DINGTALKACCOUNT'
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '办公电话', flex: 1,
|
|
|
name: 'OFFICEPHONE'
|
|
|
}, {
|
|
|
fieldLabel: '家庭电话', flex: 1,
|
|
|
name: 'HOMEPHONE'
|
|
|
}, {
|
|
|
fieldLabel: '移动电话', flex: 1,
|
|
|
name: 'MOBILE'
|
|
|
}, {
|
|
|
fieldLabel: '财务软件代码', flex: 1,
|
|
|
name: 'FINANCESOFTCODE'
|
|
|
}
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '紧急联系人', flex: 1,
|
|
|
name: 'EMERGUSER'
|
|
|
}, {
|
|
|
fieldLabel: '紧急联系电话', flex: 1,
|
|
|
name: 'EMERGPHONE'
|
|
|
},{
|
|
|
fieldLabel: '邮箱1', flex: 1,
|
|
|
name: 'EMAIL1'
|
|
|
}, {
|
|
|
fieldLabel: '邮箱2', flex: 1,
|
|
|
name: 'EMAIL2'
|
|
|
}
|
|
|
]
|
|
|
} , {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [ {
|
|
|
fieldLabel: '家庭住址', flex: 3.02,
|
|
|
name: 'HOMEADDRESS'
|
|
|
}, {
|
|
|
fieldLabel: '邮政编码', flex: 1,
|
|
|
name: 'POSTCODE'
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
xtype: 'textareafield',
|
|
|
grow: true,
|
|
|
labelWidth: 80,
|
|
|
name: 'MAILSIGN',
|
|
|
fieldLabel: '邮箱签名',
|
|
|
flex: 1
|
|
|
},{
|
|
|
xtype: 'textareafield',
|
|
|
grow: true,
|
|
|
labelWidth: 80,
|
|
|
name: 'REMARK',
|
|
|
fieldLabel: '备注',
|
|
|
flex: 1
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
,
|
|
|
{//fieldset 2
|
|
|
xtype: 'fieldset',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
title:'用户属性',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
{
|
|
|
xtype: 'checkbox', flex: 1,
|
|
|
labelWidth: checklabelwidth,
|
|
|
fieldLabel: '是否允许使用本系统',
|
|
|
name: 'isUseSystem'
|
|
|
}, {
|
|
|
xtype: 'checkbox', flex: 1,
|
|
|
fieldLabel: '是否停用',
|
|
|
labelWidth: checklabelwidth,
|
|
|
name: 'isDisable'
|
|
|
}, {
|
|
|
xtype: 'checkbox', flex: 1,
|
|
|
fieldLabel: '是否操作',
|
|
|
labelWidth: checklabelwidth,
|
|
|
name: 'isOperator'
|
|
|
}, {
|
|
|
xtype: 'checkbox', flex: 1,
|
|
|
fieldLabel: '是否销售',
|
|
|
labelWidth: checklabelwidth,
|
|
|
name: 'isSaleMan'
|
|
|
},{
|
|
|
xtype: 'checkbox', flex: 1,
|
|
|
fieldLabel: '是否单证',
|
|
|
labelWidth: checklabelwidth,
|
|
|
name: 'isDocument'
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
xtype: 'checkbox', flex: 1,
|
|
|
fieldLabel: '是否报关员',
|
|
|
labelWidth: checklabelwidth,
|
|
|
name: 'isCustomsDeclarer'
|
|
|
}, {
|
|
|
xtype: 'checkbox', flex: 1,
|
|
|
fieldLabel: '是否财务',
|
|
|
labelWidth: checklabelwidth,
|
|
|
name: 'isFinancialStaff'
|
|
|
}, {
|
|
|
xtype: 'checkbox', flex: 1,
|
|
|
fieldLabel: '是否客服',
|
|
|
labelWidth: checklabelwidth,
|
|
|
name: 'isCustomsService'
|
|
|
}, {
|
|
|
xtype: 'checkbox', flex: 1,
|
|
|
fieldLabel: '是否司机',
|
|
|
labelWidth: checklabelwidth,
|
|
|
name: 'isDriver'
|
|
|
}, {
|
|
|
xtype: 'checkbox', flex: 1,
|
|
|
fieldLabel: '是否派车调度人员',
|
|
|
labelWidth: checklabelwidth,
|
|
|
name: 'isVehiclesDispatcher'
|
|
|
}]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: []
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
|
|
|
, {
|
|
|
title: '图片信息',
|
|
|
xtype: 'fieldset',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'hbox',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'anchor',flex:1,
|
|
|
defaultType: 'textfield',
|
|
|
height:160,
|
|
|
items: [
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox', flex: 1,
|
|
|
defaultType: 'textfield',
|
|
|
|
|
|
items: [
|
|
|
|
|
|
{
|
|
|
fieldLabel: '头像Url', flex: 1, hidden: true,
|
|
|
name: 'IMAGEURL', id: 'IMAGEURL'
|
|
|
}, {
|
|
|
fieldLabel: '签名Url', flex: 1, hidden: true,
|
|
|
name: 'SIGNATUREURL', id: 'SIGNATUREURL'
|
|
|
}, {
|
|
|
xtype: 'label', text: '头像:'
|
|
|
},
|
|
|
{
|
|
|
xtype: 'button',
|
|
|
tooltip: '最好图片尺寸小于120x120',
|
|
|
text: "上传头像",
|
|
|
handler: function (button, event) {
|
|
|
_this.UploadHead(button, event);
|
|
|
}
|
|
|
}]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'box', //或者xtype: 'component',
|
|
|
id: 'IMAGEURLPANEL',
|
|
|
width: 120, //图片宽度
|
|
|
height: 120, //图片高度
|
|
|
autoEl: {
|
|
|
tag: 'img', //指定为img标签
|
|
|
src: '../../images/noImage.gif' //指定url路径
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'anchor',flex:1,
|
|
|
defaultType: 'textfield',
|
|
|
items: [
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox', flex: 1,
|
|
|
defaultType: 'textfield',
|
|
|
|
|
|
items: [
|
|
|
{
|
|
|
xtype: 'label', text: '签名图:'
|
|
|
},
|
|
|
{
|
|
|
xtype: 'button',
|
|
|
tooltip:'最好是75x30的图片',
|
|
|
text: "上传签名图",
|
|
|
handler: function (button, event) {
|
|
|
_this.UploadSign(button, event);
|
|
|
}
|
|
|
}]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'box', //或者xtype: 'component',
|
|
|
id: 'SIGNATUREURLPANEL',
|
|
|
width: 75, //图片宽度
|
|
|
height: 30, //图片高度
|
|
|
autoEl: {
|
|
|
tag: 'img', //指定为img标签
|
|
|
src: '../../images/noImage.gif' //指定url路径
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
//#region 公共按钮Toolbar:panelBtn
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
region: "north",
|
|
|
tbar: [
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
text: "保存",
|
|
|
//disabled: true,
|
|
|
id: "SAVE1",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('0');
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
// id: "saveandclose",
|
|
|
text: "保存并关闭",
|
|
|
//disabled: true,
|
|
|
id: "SAVE2",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('1');
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-',
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
text: "关闭",
|
|
|
handler: function (button, event) {
|
|
|
window.close();
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-',
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
text: "打印",
|
|
|
handler: function (button, event) {
|
|
|
this.Print();
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//#region 布局
|
|
|
/* 3 */
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 32,
|
|
|
items: [this.panelBtn]//, this.formEdit]
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.page_1 = new Ext.Panel({
|
|
|
title: "用户信息",
|
|
|
autoScroll: true,
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
autoScroll: true,
|
|
|
split: true,
|
|
|
items: [this.formEdit]
|
|
|
});
|
|
|
this.page_2 = new Ext.Panel({
|
|
|
title: " ",
|
|
|
items: []
|
|
|
});
|
|
|
this.page_3 = new Ext.Panel({
|
|
|
title: " ",
|
|
|
//autoScroll: true,
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
items: []
|
|
|
});
|
|
|
|
|
|
this.MainTab = new Ext.tab.Panel({
|
|
|
layout: "border",
|
|
|
region: "center",
|
|
|
items: [this.page_1
|
|
|
, this.page_2
|
|
|
, this.page_3
|
|
|
|
|
|
]
|
|
|
})
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelTop,
|
|
|
//this.MainTab
|
|
|
this.page_1
|
|
|
]
|
|
|
});
|
|
|
//#endregion
|
|
|
|
|
|
parentWin = window.parent.opener;
|
|
|
this.InitData();
|
|
|
|
|
|
//集中绑定编辑后事件
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
InitData: function () {
|
|
|
|
|
|
this.opStatus = 'edit';
|
|
|
var condition = '';
|
|
|
|
|
|
if (parentWin) {
|
|
|
var ret = parentWin.OprationSwap();
|
|
|
this.opStatus = ret[0]; //状态(编辑、添加等)
|
|
|
this.StoreList = ret[1]; //列表
|
|
|
this.editRecord = ret[2]; // 一条数据
|
|
|
this.DEPTNAME = ret[3]; // 一条数据
|
|
|
this.COMPANYID = ret[4]; // 一条数据
|
|
|
// this.parentfunction = ret[3];
|
|
|
}
|
|
|
|
|
|
if (this.opStatus == 'edit') condition = " u.GID='" + this.editRecord.get('GID') + "'";
|
|
|
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
|
|
|
}, //end InitData
|
|
|
|
|
|
//载入数据
|
|
|
LoadData: function (opStatus, condition) {
|
|
|
if (opStatus == "edit") {
|
|
|
this.formEdit.getForm().setValues(this.editRecord.data);
|
|
|
}
|
|
|
var _this = this;
|
|
|
this.opStatus = opStatus;
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/SysMng/SysUser/GetData',
|
|
|
params: {
|
|
|
handle: opStatus,
|
|
|
condition: condition
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
Ext.Msg.show({
|
|
|
title: '提示',
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var data = result.data;
|
|
|
if (this.opStatus == "add") {
|
|
|
data.DEPTNAME = this.DEPTNAME;
|
|
|
data.COMPANYID = this.COMPANYID;
|
|
|
}
|
|
|
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
if (this.opStatus != "add") {
|
|
|
if (!data.isedit) {
|
|
|
this.formEdit.getForm().findField('SHOWNAME').setReadOnly(true);
|
|
|
this.formEdit.getForm().findField('CODENAME').setReadOnly(true);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
this.storeCompany.load({
|
|
|
params: { condition: " ISDISABLE=0 and exists(select 1 from sys_dept where linkid=company.gid) " },
|
|
|
callback: function () {
|
|
|
_this.formEdit.getForm().setValues(data);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
if (!isNullorEmpty(data.COMPANYID)) {
|
|
|
this.storeDept.load({
|
|
|
params: { condition: " linkid='" + data.COMPANYID + "'" },
|
|
|
callback: function () {
|
|
|
_this.formEdit.getForm().setValues(data);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
if (!isNullorEmpty( data.IMAGEURL))
|
|
|
this.do_rewrite_head(data.IMAGEURL);
|
|
|
if (!isNullorEmpty(data.SIGNATUREURL))
|
|
|
this.do_rewrite_sign(data.SIGNATUREURL);
|
|
|
|
|
|
|
|
|
function setsave() { saved = true; }
|
|
|
var task = new Ext.util.DelayedTask(setsave);
|
|
|
task.delay(500);
|
|
|
|
|
|
|
|
|
//完成载入后,将状态设为已存储
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});//request over
|
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
|
|
|
this.bodyUSERID = this.editRecord.get('GID');
|
|
|
//alert(s);
|
|
|
this.LoadBody();
|
|
|
|
|
|
}
|
|
|
|
|
|
}, // end LoadDate
|
|
|
|
|
|
LoadBody: function () {
|
|
|
|
|
|
}
|
|
|
,
|
|
|
//getUserRoleDiff: function (button, event) {
|
|
|
// var namelist = [];
|
|
|
// havesame = false;
|
|
|
// this.storeUserRole.each(function (record) {
|
|
|
// name = record.get('ROLE_ref');
|
|
|
// if (namelist.indexOf(name) >= 0) {
|
|
|
// havesame = true;
|
|
|
// } else {
|
|
|
// namelist.push(name);
|
|
|
// }
|
|
|
// });
|
|
|
// return havesame;
|
|
|
//},
|
|
|
Save: function (type) {
|
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//如果角色重复则返回错误
|
|
|
//if (this.getUserRoleDiff() == true) {
|
|
|
// alert("有重复的角色~");
|
|
|
// return;
|
|
|
//}
|
|
|
|
|
|
var data = this.formEdit.getForm().getValues();
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/SysMng/SysUser/Save',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data)
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
Ext.MessageBox.hide();
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText); //*
|
|
|
if (jsonresult.Success) {
|
|
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
//Ext.Msg.show({
|
|
|
// title: '成功',
|
|
|
// msg: '保存成功',
|
|
|
// icon: Ext.Msg.SUCCESS,
|
|
|
// buttons: Ext.Msg.OK
|
|
|
//});
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
var arrNewRecords = this.StoreList.add(returnData);
|
|
|
this.editRecord = arrNewRecords[0];
|
|
|
this.bodyUSERID = this.editRecord.get('GID') ;
|
|
|
this.opStatus = 'edit';
|
|
|
}
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
var editp = Ext.create('SysUsermb', returnData);
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
if (name != 'id')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
|
|
|
if (type == "1") {
|
|
|
window.close();
|
|
|
}
|
|
|
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
this.LoadBody();
|
|
|
|
|
|
} else {
|
|
|
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
} else {
|
|
|
Ext.Msg.show({
|
|
|
title: '请重试',
|
|
|
msg: '服务器响应出错',
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
});
|
|
|
}
|
|
|
//alert('03');
|
|
|
|
|
|
}
|
|
|
});
|
|
|
}, //end save
|
|
|
|
|
|
UploadHead: function () {
|
|
|
|
|
|
if (this.opStatus != 'edit') {
|
|
|
alert("请先保存,然后才能进行图片设置");
|
|
|
}
|
|
|
|
|
|
URLINFO = { KeyValue: this.editRecord.data.GID };
|
|
|
UrlType = "SysUser_Head";
|
|
|
|
|
|
UpLoadFile(URLINFO, UrlType, this.rewrite_head, '');
|
|
|
},
|
|
|
UploadSign: function () {
|
|
|
|
|
|
if (this.opStatus != 'edit') {
|
|
|
alert("请先保存,然后才能进行图片设置");
|
|
|
}
|
|
|
|
|
|
URLINFO = { KeyValue: this.editRecord.data.GID };
|
|
|
UrlType = "SysUser_Sign";
|
|
|
|
|
|
UpLoadFile(URLINFO, UrlType, this.rewrite_sign, '');
|
|
|
},
|
|
|
rewrite_head: function (newurl) {
|
|
|
|
|
|
var result = Ext.JSON.decode(newurl.response.responseText);
|
|
|
//record.set('TAGPICURL', result.data);
|
|
|
|
|
|
_this.LoadData('edit', " u.GID='" + _this.editRecord.get('GID') + "'")
|
|
|
},
|
|
|
do_rewrite_head: function (src) {
|
|
|
Ext.getCmp("IMAGEURL").setValue(src);
|
|
|
|
|
|
if (Ext.isIE) {
|
|
|
var image = Ext.get('IMAGEURLPANEL').dom;
|
|
|
image.src = src + "?t=" + Math.floor(Math.random() * 100000 + 1);
|
|
|
} // 支持FF
|
|
|
else {
|
|
|
Ext.get('IMAGEURLPANEL').dom.src = src + "?t=" + Math.floor(Math.random() * 100000 + 1);
|
|
|
}
|
|
|
},
|
|
|
rewrite_sign: function (newurl) {
|
|
|
|
|
|
var result = Ext.JSON.decode(newurl.response.responseText);
|
|
|
//record.set('TAGPICURL', result.data);
|
|
|
|
|
|
_this.LoadData('edit', " u.GID='" + _this.editRecord.get('GID') + "'")
|
|
|
},
|
|
|
do_rewrite_sign: function (src) {
|
|
|
Ext.getCmp("SIGNATUREURL").setValue(src);
|
|
|
|
|
|
|
|
|
if (Ext.isIE) {
|
|
|
var image = Ext.get('SIGNATUREURLPANEL').dom;
|
|
|
image.src = src + "?t=" + Math.floor(Math.random() * 100000 + 1);
|
|
|
} // 支持FF
|
|
|
else {
|
|
|
Ext.get('SIGNATUREURLPANEL').dom.src = src + "?t=" + Math.floor(Math.random() * 100000 + 1);
|
|
|
}
|
|
|
},
|
|
|
Print: function () {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
var GID = this.editRecord.get('GID')
|
|
|
if (ContractNo == '*' || ContractNo == '') {
|
|
|
Ext.Msg.show({ title: '错误', msg: '还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var printType = 'XXH_CW_YS';
|
|
|
//
|
|
|
var sql1 = " SELECT * FROM [user] WHERE GID = '" + GID + "' ";
|
|
|
var sql2 = "";
|
|
|
var sql3 = "";
|
|
|
var sql4 = "";
|
|
|
var sql5 = "";
|
|
|
var sql6 = "";
|
|
|
|
|
|
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
|
|
|
}
|
|
|
});
|