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/TruckMng/Viewsjs/MsCustTruckFeeTemplate/MsCustTruckFeeTemplateAudit...

589 lines
21 KiB
JavaScript

3 years ago
Ext.namespace('DsTruck');
DsTruck.MsCustTruckFeeTemplateAuditIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.MsCustTruckFeeTemplateAuditIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruck.MsCustTruckFeeTemplateAuditIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
//需求编号SR2017061200005-3
initUIComponents: function () {
this.AuditEdit = true;
this.formname = "MsCustTruckFeeTemplateAuditIndex"
this.worksql = getUrlParam('worksql');
this.sqlcontext = '';
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsCustTruckFeeTemplate',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsCustTruckFeeTemplate/GetAuditDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.ShuJuJiaZaiZhong },
trackMouseOver: true,
disableSelection: false,
columns: [{
sortable: true,
dataIndex: 'GID',
header: Zi.LAN.GID, //'GID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'TEMPLATENAME',
header: '计费方案名称', //'模板名称',
width: 160
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '客户名称', //'模板名称',
width: 160
}, {
sortable: true,
dataIndex: 'CONTRACTNO',
header: '合同号', //'业务种类',
width: 160
}, {
sortable: true,
dataIndex: 'GOODNAME',
header: '商品名称', //'费用类别',
width: 160
}, {
sortable: true,
dataIndex: 'TRANTYPE',
header: '运输方式', //'费用类别',
width: 160
}, {
sortable: true,
dataIndex: 'BSSTATUS',
header: '模板状态', //'费用类别',
width: 160
}, {
sortable: true,
dataIndex: 'DC',
header: '收付', //'费用类别',
width: 100,
renderer: function (value, p, record) {
if (value == "1")
return "收";
else if (value == "2") return "付";
}
}, {
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('/TruckMng/MsCustTruckFeeTemplate/Edit');
}, this);
//#region formSearch
this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
});
this.storeCustomerNameRef.load();
this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCustomerNameRef,
fieldLabel: '客户名称', //'费用类型',
forceSelection: true,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
lazyRender: false,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeListGoodName = Ext.create('Ext.data.Store', {
fields: [
{ name: 'GID', type: 'string' },
{ name: 'GOODCODE', type: 'string' },
{ name: 'GOODNAME', type: 'string' },
{ name: 'GOODNO', type: 'string' },
{ name: 'DESCRIP', type: 'string' },
{ name: 'CODEANDNAME', type: 'string' },
{ name: 'GOODSTYPEGID', type: 'string' },
{ name: 'GOODSTYPE', type: 'string' },
{ name: 'CORPID', type: 'string' },
{ name: 'ISSTOP', type: 'string' }
],
pageSize: 5000,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeGoods/GetDataList',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListGoodName.load({
params: { start: 0, limit: 5000, sort: '', condition: '' },
waitMsg: "正在查询数据...",
scope: this
});
this.comboxGoodCode = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeListGoodName,
forceSelection: true,
fieldLabel: '商品名称', //'费用类型',
valueField: 'GOODNAME',
displayField: 'CODEANDNAME',
name: 'GOODNAME'
});
this.storeTransType = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeTransType.add({ "DC": "普货", "NAME": "普货" });
this.storeTransType.add({ "DC": "集装箱", "NAME": "集装箱" });
this.comboxTransType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '运输类型', //'费用类型',
store: this.storeTransType,
valueField: 'DC',
displayField: 'NAME',
forceSelection: true,
name: 'TRANTYPE'
});
this.storeTransStatus = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeTransStatus.add({ "DC": "新增", "NAME": "新增" });
this.storeTransStatus.add({ "DC": "提交审核", "NAME": "提交审核" });
this.storeTransStatus.add({ "DC": "审核通过", "NAME": "审核通过" });
this.comboxTransStatus = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '状态', //'费用类型',
store: this.storeTransStatus,
valueField: 'DC',
displayField: 'NAME',
forceSelection: true,
name: 'BSSTATUS'
});
this.storeAddDCType = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeAddDCType.add({ "DC": "", "NAME": "全部" });
this.storeAddDCType.add({ "DC": "1", "NAME": "未审核" });
this.storeAddDCType.add({ "DC": "2", "NAME": "已审核" });
this.storeAddDCType.add({ "DC": "3", "NAME": "仅需自己审核" });
this.comboxaddDCType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '状态',
labelWidth: 60,
store: this.storeAddDCType,
valueField: 'DC',
displayField: 'NAME',
forceSelection: true,
name: 'DC',
value: '3',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxaddDCType,this.comboxTransStatus, {
fieldLabel: '计费方案名称', //'模板名称',
labelWidth: 80,
name: 'TEMPLATENAME'
},this.comboxCustomerNameRef, this.comboxGoodCode,this.comboxTransType,{
fieldLabel:'合同号', //'模板名称',
name: 'CONTRACTNO'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
id: 'btnAudit',
text: '审核通过',
tooltip: '审核通过',
handler: function (button, event) {
this.onAuditClick();
},
scope: this
}, {
text: "驳回提交",
id: 'btnAuditBack',
iconCls: "btndelete",
handler: function (button, event) {
this.winAuditBackShow.show();
},
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) {
this.onClearSql(button, event);
},
scope: this
}, {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}
]
});
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, isaudit: this.isAudit });
}, this);
if (this.worksql != undefined && this.worksql !='') {
this.worksql = this.worksql.replace(/@@/g, '=')
this.sqlcontext = this.worksql;
this.onDsQuery();
} else {
this.onRefreshClick();
}
this.formAuditBack = Ext.widget('form', {
frame: true,
region: 'center',
title: "<a href='#'><font color='#FF0000'>驳回原因</font></a>",
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{
xtype: 'textareafield',
grow: true,
fieldLabel: '',
labelSeparator: '',
labelWidth: 0,
height: 100,
name: 'ORREASON',
anchor: '100%'
}
]//end root items
});
me = this;
this.winAuditBackShow = Ext.create('Ext.window.Window', {
title: "驳回派车申请",
width: 450,
//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.formAuditBack],
buttons: [{
text: "确认驳回",
minWidth: 70,
handler: function () {
var form = me.formAuditBack.getForm();
var ORREASON = form.findField('ORREASON').getRawValue();
if (ORREASON == '' || ORREASON == null || ORREASON == undefined) {
Ext.Msg.show({ title: '提示', msg: '驳回原因为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
me.onAuditBack(ORREASON);
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winAuditBackShow.close();
}
}]
});
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: 500, sort: '', condition: sql, isaudit: this.isAudit },
waitMsg: Zi.LAN.ZhengZaiChaXunShuJu, //"正在查询数据...",
scope: this
});
},
onDsQuery: function (button, event) {
var sql = this.sqlcontext;
this.storeList.load({
params: { start: 0, limit: 500, sort: '', condition: sql, isaudit: this.isAudit },
waitMsg: Zi.LAN.ZhengZaiChaXunShuJu, //"正在查询数据...",
scope: this
});
},
onAuditClick: function () {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodydatas = [];
for (var i = 0; i < selections.length ; i += 1) {
var member = selections[i];
if ((member.data.BSSTATUS == '提交审核'))
bodydatas.push(member);
}
if (bodydatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有需要审核的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.MessageBox.confirm('提示', '确实要审核吗?', function (btn) {
if (btn == 'yes') {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodydatas);
Ext.Msg.wait('正在操作数据...');
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/TruckMng/MsCustTruckFeeTemplate/AuditList',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.reload();
Ext.Msg.hide();
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
onAuditBack: function (reason) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodydatas = [];
for (var i = 0; i < selections.length ; i += 1) {
var member = selections[i];
if ((member.data.BSSTATUS == '提交审核') || (member.data.BSSTATUS == '审核通过'))
bodydatas.push(member);
}
if (bodydatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有需要驳回审核的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.MessageBox.confirm('提示', '确实要驳回审核吗?', function (btn) {
if (btn == 'yes') {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodydatas);
Ext.Msg.wait('正在操作数据...');
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/TruckMng/MsCustTruckFeeTemplate/AuditBackList',
params: {
data: jsonbodyAddDatas,
reason: reason
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.reload();
Ext.Msg.hide();
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert(Zi.LAN.TiShi, Zi.LAN.ChaXunTiaoJianFuZhiCuoWu);
return '';
}
var sql = '';
var CONTRACTNO = form.findField('CONTRACTNO').getValue();
sql = sql + getAndConSql(sql, CONTRACTNO, "CONTRACTNO like '%" + CONTRACTNO + "%'");
var TRANTYPE = form.findField('TRANTYPE').getValue();
sql = sql + getAndConSql(sql, TRANTYPE, "TRANTYPE='" + TRANTYPE + "'");
var BSSTATUS = form.findField('BSSTATUS').getValue();
sql = sql + getAndConSql(sql, BSSTATUS, "BSSTATUS='" + BSSTATUS + "'");
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME='" + CUSTOMERNAME + "'");
var GOODNAME = form.findField('GOODNAME').getValue();
sql = sql + getAndConSql(sql, GOODNAME, "GOODNAME='" + GOODNAME + "'");
this.isAudit = form.findField('DC').getValue();
return sql;
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
}, //onDeleteClick
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.AuditEdit;
return ret;
}
});