You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcShipping/Viewsjs/MsCodeFeeTemplate/MsCodeFeeTemplateIndex.js

614 lines
20 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.MsCodeFeeTemplateIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCodeFeeTemplateIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsCodeFeeTemplateIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
//需求编号SR2017061200005-3
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsCodeFeeTemplate',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeFeeTemplate/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.ShuJuJiaZaiZhong },
trackMouseOver: true,
selModel: this.GridCheckBoxModel,
disableSelection: false,
columns: [{
sortable: true,
dataIndex: 'GID',
header: Zi.LAN.GID, //'GID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'NAME',
header: Zi.LAN.NAME, //'模板名称',
width: 160
}, {
sortable: true,
dataIndex: 'OPTYPEREF',
header: Zi.LAN.OPTYPEREF, //'业务种类',
width: 160
}, {
sortable: true,
dataIndex: 'FEETYPEREF',
header: Zi.LAN.FEETYPEREF, //'费用类别',
width: 160
}, {
sortable: true,
dataIndex: 'ISPUBLIC',
header: Zi.LAN.ISPUBLIC, //'是否公共',
width: 100
}, {
sortable: true,
dataIndex: 'CREATEUSERREF',
header: Zi.LAN.CREATEUSERREF, //'录入人',
width: 100
}, {
sortable: true,
dataIndex: 'CREATETIME',
header: Zi.LAN.CREATETIME, //'录入日期',
width: 100
}, {
sortable: true,
dataIndex: 'REMARK',
header: Zi.LAN.REMARK, //'说明',
width: 160
}
]
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/MvcShipping/MsCodeFeeTemplate/Edit');
}, this);
//#region formSearch
this.storeOpType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeOpType.load({ params: { enumTypeId: 96002} });
this.comboxOpType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.OPTYPE, //'业务种类',
store: this.storeOpType,
forceSelection: true,
name: 'OPTYPE',
valueField: 'EnumValueId',
displayField: 'EnumValueName'
});
this.storeAddDCType = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeAddDCType.add({ "DC": 1, "NAME": "应收" });
this.storeAddDCType.add({ "DC": 2, "NAME": "应付" });
this.comboxaddDCType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.FEETYPE, //'费用类型',
store: this.storeAddDCType,
valueField: 'DC',
displayField: 'NAME',
forceSelection: true,
name: 'FEETYPE'
});
2 years ago
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
this.storeOpCode.load();
//录入人
this.comboxINPUTBY = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '录入人', //'录入人',
store: this.storeOpCode,
forceSelection: true,
name: 'INPUTBY',
valueField: 'GID',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
3 years ago
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxOpType,this.comboxaddDCType,{
fieldLabel: Zi.LAN.NAME, //'模板名称',
name: 'NAME'
2 years ago
}, this.comboxINPUTBY
3 years ago
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
_this = this;
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: Zi.LAN.btnAdd, //"新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin('/MvcShipping/MsCodeFeeTemplate/Edit');
},
scope: this
},
{
text: Zi.LAN.btnDelete, //"删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
},
'-',
{
text: Zi.LAN.btnRefresh, //"执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: Zi.LAN.btnReset, //"重置条件",
iconCls: "btnreset",
handler: function (button, event) {
2 years ago
var form = this.formSearch.getForm();
form.reset();
3 years ago
},
scope: this
}, '-',
{
text: "打印", //"打印",
iconCls: 'btnprint',
menu: [
{
text: "全部", //"全部",
handler: function (menu, event) {
_this.Print();
}
}, {
text: "选择打印", //"选择打印",
handler: function (menu, event) {
_this.PrintSelect();
}
}],
scope: this
2 years ago
}, {
text: "费用模板转接",
handler: function (menu, event) {
_this.winModifyShow.show();
}
3 years ago
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 80,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.onRefreshClick();
2 years ago
this.storeOpCode2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
this.storeOpCode2.load();
//录入人
this.comboxINPUTBY2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '接手人', //'录入人',
store: this.storeOpCode2,
forceSelection: true,
name: 'CREATEUSER',
valueField: 'GID',
displayField: 'CodeAndName',
enableKeyEvents: true
});
this.formModify = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxINPUTBY2, { xtype: 'hiddenfield' }
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
me = this;
this.winModifyShow = Ext.create('Ext.window.Window', {
title: "批量接转",
width: 320,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formModify],
buttons: [{
text: "确认",
minWidth: 70,
handler: function () {
me.onModifyClick()
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winModifyShow.close();
}
}]
});
3 years ago
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: 500, sort: '', condition: sql },
waitMsg: Zi.LAN.ZhengZaiChaXunShuJu, //"正在查询数据...",
scope: this
});
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeXinXi, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
2 years ago
var icount = 0;
var bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
bodyAddDatas.push(rec);
icount = icount + 1;
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
3 years ago
var record = selections[0];
2 years ago
Ext.MessageBox.confirm(Zi.LAN.TiShi,"确实要删除选中的【" + icount.toString() + "】票模板吗?", function (btn) {
3 years ago
if (btn == 'yes') {
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, //'正在删除数据...',
2 years ago
url: '/MvcShipping/MsCodeFeeTemplate/DeleteList',
3 years ago
params: {
2 years ago
data: jsonbodyAddDatas
3 years ago
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
2 years ago
this.storeList.reload();
3 years ago
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: Zi.LAN.CuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}, //onDeleteClick
2 years ago
onModifyClick: function (menu, event) {
var GidStr = '';
var records = this.gridList.getSelectionModel().getSelection();
if (records.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要修改的模板!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyAddDatas = [];
for (var i = 0; i < records.length; i++) {
var rec = records[i];
bodyAddDatas.push(rec);
}
var data = this.formModify.getForm().getValues();
_this = this;
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要修改的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: '正在修改...',
url: '/MvcShipping/MsCodeFeeTemplate/modify',
params: {
data: jsonbodyAddDatas,
modifydata: Ext.JSON.encode(data)
},
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;
} else {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.storeList.reload();
_this.winModifyShow.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
3 years ago
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert(Zi.LAN.TiShi, Zi.LAN.ChaXunTiaoJianFuZhiCuoWu);
return '';
}
var sql = '';
var SERVICENAME = form.findField('NAME').getValue();
sql = sql + getAndConSql(sql, SERVICENAME, "NAME like '%" + SERVICENAME + "%'");
var OPTYPE = form.findField('OPTYPE').getValue();
sql = sql + getAndConSql(sql, OPTYPE, "OPTYPE=" + OPTYPE + "");
var FEETYPE = form.findField('FEETYPE').getValue();
sql = sql + getAndConSql(sql, FEETYPE, "FEETYPE=" + FEETYPE + "");
2 years ago
var INPUTBY = form.findField('INPUTBY').getValue();
sql = sql + getAndConSql(sql, INPUTBY, "CREATEUSER='" + INPUTBY + "'");
3 years ago
return sql;
},
//#region 打印
Print: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var sortstr = 'NAME ';
Ext.Msg.wait('正在查询');
Ext.Ajax.request({
waitMsg: '正在操作数据',
url: '/MvcShipping/MsCodeFeeTemplate/GetDataListStr',
scope: this,
params: {
condition: _this.sqlcontext,
sort: sortstr
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnstr = jsonresult.data;
var printType = 'MSCODEFEETEMPLIST';
var sql1 = returnstr;
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} 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 });
}
}
});
},
PrintSelect: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var selectedRecords = [];
var storeadd = null;
selectedRecords = this.GridCheckBoxModel.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title:'提示', msg:'请选择模板', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var sortstr = 'NAME ';
var feeGidSql = '';
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var feeGId = "'" + record.get('GID') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
};
var printType = 'MSCODEFEETEMPLISTSELECT';
var sql1 = "select * from code_fee_template WHERE GID IN (" + feeGidSql + ") order by " + sortstr;
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6,'');
},
//#endregion
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});