Ext.Loader.setConfig({
enabled: true
});
Ext.Loader.setPath('Ext.ux', '../../res/extjs/examples/ux');
Ext.require([
'Ext.grid.*',
'Ext.data.*',
'Ext.ux.RowExpander',
'Ext.selection.CheckboxModel'
]);
var StatusStore;
var baseUrl;
var centerLng;
var centerLat;
var company_code;
var theme;
var ConfirmStore
var pieWidth;
var showAlarm = null;
var pieMask;
var V_LOGINNAME = '', V_PASSWORD = '';
var maxHeight = 10000;
var maxWidth = 10000;
var companyName = null;
var sm = Ext.create('Ext.selection.CheckboxModel');
Ext.define('contractManageOption', {
extend: 'Ext.data.Model',
fields: [
{name: 'id', type: 'int'},
{name: 'company', type: 'string'},
{name: 'maintenanceCompany', type: 'string'},
{name: 'startTime', type: 'string'},
{name: 'salesman', type: 'string'},
{name: 'endTime', type: 'string'},
{name: 'salesmanPhone', type: 'string'},
{name: 'customer', type: 'string'},
{name: 'customerPhone', type: 'string'},
{name: 'status', type: 'string'},
{name: 'url', type: 'string'},
{name: 'companyCode', type: 'string'}
]
});
var getCurrentData = function () {
var query = new Object();
query.V_LOGINNAME = V_LOGINNAME;
query.V_PASSWORD = V_PASSWORD;
query.dwtype = '7';
query.COMMSTATUS = 'NO';
if ((company_code != null) && (company_code != 'null') && (company_code.length > 0))
query.company_code = company_code;
// pieMask.show();
$.ajax({
type: 'POST',
url: baseUrl + "iot/alarm/view/getConfirmStatusByDays",
data: {
queryJson: Ext.JSON.encode(query)
},
success: function (result) {
var json = eval('(' + result + ')');
if (json.action == 'getConfirmStatusByDays') {
if (json.check == 'true') {
ConfirmStore = json.RESULT;
if (json.company_name != null)
companyName = json.company_name;
else
companyName = null;
} else {
Ext.Msg.alert('错误信息', '访问权限错误,请重新登录', function () {
window.parent.frames.return_login();
});
}
}
// pieMask.hide();
}
});
}
var body_resize = function () {
maxHeight = document.documentElement.clientHeight;
maxWidth = document.documentElement.clientWidth;
Ext.getCmp('ManageOptionPanel').setHeight(maxHeight);
Ext.getCmp('ManageOptionPanel').setWidth(maxWidth);
}
Ext.define('CompanyComboStore', {
extend: 'Ext.data.Model',
fields: [
// {name:'company', type:'string'},
// {name:'companyCode',type:'string'}
{name: 'owner_name', type: 'string'},
{name: 'owner_id', type: 'string'}
]
});
var addradiogroup = new Ext.create('Ext.form.RadioGroup', {
fieldLabel: '合同状态',
id: 'addstatus',
width: 300,
items: [{
name: 'stationType',
inputValue: '1',
boxLabel: '启用',
}, {
name: 'stationType',
inputValue: '0',
boxLabel: '未启用',
//checked:
}]
});
var upradiogroup = new Ext.create('Ext.form.RadioGroup', {
fieldLabel: '合同状态',
id: 'upstatus',
width: 300,
items: [{
name: 'stationType',
inputValue: '1',
boxLabel: '启用',
}, {
name: 'stationType',
inputValue: '0',
boxLabel: '未启用',
//checked:
}]
});
Ext.onReady(function () {
baseUrl = document.getElementById('basePath').value;
theme = document.getElementById('theme').value;
company_code = document.getElementById('company_code').value;
$("#V_LOGINNAME").val(sessionStorage.getItem('V_LOGINNAME'));
$("#V_PASSWORD").val(sessionStorage.getItem('V_PASSWORD'));
V_LOGINNAME = $("#V_LOGINNAME").val();
V_PASSWORD = $("#V_PASSWORD").val();
var currentWidth = document.documentElement.clientWidth;
pieWidth = currentWidth / 7;
var chkIcon = '
'
var unchkIcon = '
'
var countPerPage = 30;
var queryJson = new Object();
queryJson.V_LOGINNAME = V_LOGINNAME;
queryJson.V_PASSWORD = V_PASSWORD;
queryJson.COMMSTATUS = 'NO';
if ((company_code != null) && (company_code != 'null') && (company_code.length > 0))
queryJson.company_code = company_code;
var myStore = Ext.create('Ext.data.Store', {
model: 'contractManageOption',
pageSize: countPerPage,
proxy: {
type: 'ajax',
actionMethods: {
create: 'POST',
read: 'POST', // by default GET
update: 'POST',
destroy: 'POST'
},
url: baseUrl + 'contract/queryContract',
reader: {
type: 'json',
root: 'RESULT',
totalProperty: 'totalCount'
},
extraParams: {
queryJson: Ext.JSON.encode(queryJson)
}
},
sorters: [{
property: 'time',
direction: 'DESC'
}],
remoteSort: true
});
myStore.on("load", function (myStore) {
getCurrentData();
//do something
});
var CompanyStory = Ext.create('Ext.data.Store', {
model: 'CompanyComboStore',
proxy: {
type: 'ajax',
actionMethods: {
create: 'POST',
read: 'POST', // by default GET
update: 'POST',
destroy: 'POST'
},
url: baseUrl + 'iot/company/view/getNameList',
//url: baseUrl+'iot/company/view/getNameList',
reader: {
type: 'json',
root: 'RESULT',
totalProperty: 'totalCount'
},
extraParams: {
queryJson: Ext.JSON.encode(queryJson)
}
},
sorters: [{
property: 'time',
direction: 'DESC'
}],
remoteSort: true
});
myStore.on("load", function (myStore) {
getCurrentData();
//do something
});
var patroladaddForm = Ext.create('Ext.form.Panel', {
id: 'patroladaddForm',
layout: 'form',
// title:'设备图片:',
items:[{
layout: 'hbox',
items: [{
xtype: 'box',//或者xtype: 'component',
title:'点位图片',
id: 'patrol_add_picture',
width: 110,//图片宽度
height: 110,//图片高度
margin:'0 0 30 150',
autoEl: {
tag: 'img',//指定为img标签
src: '../../res/img/common/shangchaun.png',
style : 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);width:110px;height:110px;text-align:center;'
},
listeners : {
render : function() {
Ext.fly(this.el).on("click",function() {
// add_pic();
checkfilename();
});}}
}
]}]
});
//新增弹框
var addContractwin = function () {
Ext.create('Ext.window.Window', {
title: '新增维保合同',
height: 500,
width: 430,
layout: 'fit',
items: addContracInfoForm,
closable: false,
modal: true,
closeAction: 'hide'
}).show();
}
//*************************************修改弹框详情*************************
var Contract_InfoForm = Ext.create('Ext.form.Panel', {
// id: 'addContracInfoForm',
labelWidth: 55,
layout: "column",
url: baseUrl + 'contract/updataContract',
defaultType: 'textfield',
fileUpload: true,
bodyPadding: 15,
items: [
{
fieldLabel: 'id',
id: 'up_id',
name: 'id',
displayField: 'id',
valueField: 'id',
allowBlank: true,
blankText: "不能为空",
editable: false,
width: 250,
hidden: true
},{
fieldLabel: 'up_company',
id: 'up_company',
name: 'up_company',
displayField: 'up_company',
valueField: 'up_company',
allowBlank: true,
blankText: "不能为空",
editable: false,
width: 250,
hidden: true
},{
fieldLabel: 'time',
id: 'up_time',
name: 'up_time',
displayField: 'up_time',
valueField: 'up_time',
allowBlank: true,
blankText: "不能为空",
editable: false,
width: 250,
hidden: true
},
{
xtype: 'combo',
fieldLabel: '单位名称',
id: 'up_companyCode',
name: 'company',
displayField: 'owner_name',
valueField: 'owner_id',
allowBlank: true,
blankText: "不能为空",
editable: false,
width: 250,
store: CompanyStory
}, {
fieldLabel: '维保单位',
allowBlank: true,
blankText: "不能为空",
id: 'up_maintenance_company',
name: 'maintenance_company',
hidden: false
},
{
xtype:'datefield',
fieldLabel:"开始日期",
format:"Y-m-d",
id: 'up_start_time',
name:"start_data",
//editable:true,//只读约束
// width: 330,
anchor:'80%'
}
,{
xtype:'datefield',
fieldLabel:"结束日期",
minValue:data,
// '07/07/2017',
minText:"当前日期选择应大于当天日期",
format:"Y-m-d",
// columnWidth:0.5,
id: 'up_end_time',
name:"end_data",
// editable:true,//只读约束
anchor:'80%'
}, {
fieldLabel: '销售人员',
allowBlank: true,
blankText: "不能为空",
id: 'up_salesman',
name: 'salesman',
maxLength: 120,
anchor: '65%'
}, {
fieldLabel: '销售人员电话',
id: 'up_salesman_phone',
name: 'salesman_phone',
maxLength: 120,
anchor: '65%'
}, {
fieldLabel: '客户联系人',
id: 'up_customer',
allowBlank: true,
blankText: "不能为空",
name: 'customer',
maxLength: 50,
anchor: '15%'
}, {
fieldLabel: '客户电话',
id: 'up_customer_phone',
allowBlank: true,
blankText: "不能为空",
name: 'customer_phone',
maxLength: 50,
anchor: '15%'
},upradiogroup,
{
fieldLabel: '文件查看',
id: 'up_url',
allowBlank: true,
blankText: "不能为空",
name: 'customer_phone',
maxLength: 50,
anchor: '15%',
hidden: true
},
{
id: 'up_c_queryJson',
name: 'queryJson',
hidden: true
}],
buttons: [ {
text: '点击查看文件',
iconCls: 'cancel_btn',
handler: function () {
// alert(fileUrl);
var l= Ext.getCmp('up_url').getValue();
window.open(l)
}
},{
text: '提交',
// id: 'addconfirmBtn',
iconCls: 'ok_btn',
handler: function () {
var form = this.up('form').getForm();
if (form.isValid()) {
var queryJson = new Object();
queryJson.V_LOGINNAME = V_LOGINNAME;
queryJson.V_PASSWORD = V_PASSWORD;
queryJson.companyCode = Ext.getCmp('up_companyCode').getValue();
queryJson.id = Ext.getCmp('up_id').getValue();
queryJson.salesman = Ext.getCmp('up_salesman').getValue();
queryJson.maintenanceCompany = Ext.getCmp('up_maintenance_company').getValue();
queryJson.customerPhone = Ext.getCmp('up_customer_phone').getValue();
queryJson.customer = Ext.getCmp('up_customer').getValue();
queryJson.salesmanPhone = Ext.getCmp('up_salesman_phone').getValue();
queryJson.startTime = Ext.getCmp('up_start_time').getValue();
queryJson.status = Ext.getCmp('upstatus').getChecked()[0].boxLabel == '启用' ? 1 : 0;
queryJson.endTime = Ext.getCmp('up_end_time').getValue();
queryJson.time = Ext.getCmp('up_time').getValue();
queryJson.url = Ext.getCmp('up_url').getValue();
queryJson.company = Ext.getCmp('up_company').getValue();
// queryJson.url = fileUrl;
// alert(fileUrl);
var jsonstr = Ext.JSON.encode(queryJson);
Ext.getCmp('up_c_queryJson').setValue(jsonstr);
form.submit({
method: 'post',
success: function (form, action) {
Ext.Msg.alert('操作成功', '已确认1条记录', function (btn, txt) {
clear_contract_add_form();
myStore.reload();
// getCurrentData();
});
},
failure: function (form, action) {
Ext.Msg.alert('操作失败', action.Msg, function (btn, txt) {
clear_contract_add_form();
myStore.reload();
//
});
}
});
this.up('window').close();
}
}
},
{
text: '关闭',
iconCls: 'cancel_btn',
handler: function () {
this.up('window').close();
}
}]
});
var clear_contract_add_form = function () {
Ext.getCmp('addsalesman').setValue('');
// Ext.getCmp('addcompany').setValue('');
Ext.getCmp('addc_companyCode').setValue('');
Ext.getCmp('addmaintenance_company').setValue('');
Ext.getCmp('addcustomer_phone').setValue('');
Ext.getCmp('addcustomer').setValue('');
Ext.getCmp('addsalesman_phone').setValue('');
Ext.getCmp('addstart_time').setValue('');
Ext.getCmp('addstatus').setValue('');
Ext.getCmp('addend_time').setValue('');
}
//********************end**************************
var ContractInfoWin = Ext.create('Ext.window.Window', {
id: 'VFileInfoWin',
title: '维保合同详情: ',
width: 468,
height: 500,
layout: 'fit',
closable: true,
modal: true,
closeAction: 'hide',
items: Contract_InfoForm
});
var ClztStory = Ext.create('Ext.data.Store', {
fields: ['status', 'name'],
data: [
{'status': '0', 'name': '未启用'},
{'status': '1', 'name': '启用'}
]
});
var showContractInfoWin = function (record) {
ContractInfoWin.show();
$("#VInfoWin_Title").html(record.get('data'));
var data= record.raw;
console.log(data);
Ext.getCmp('up_companyCode').setValue(data.company);
Ext.getCmp('up_id').setValue(data.id);
Ext.getCmp('up_customer').setValue(data.customer);
// Ext.getCmp('customer').setValue(data.get('customer'));
Ext.getCmp('up_customer_phone').setValue(data.customerPhone);
Ext.getCmp('up_end_time').setValue(data.endTime);
Ext.getCmp('up_maintenance_company').setValue(data.maintenanceCompany);
Ext.getCmp('up_salesman').setValue(data.salesman);
Ext.getCmp('up_salesman_phone').setValue(data.salesmanPhone);
Ext.getCmp('up_start_time').setValue(data.startTime);
Ext.getCmp('up_url').setValue(data.url);
Ext.getCmp('up_company').setValue(data.company);
Ext.getCmp('up_time').setValue(data.time);
if (data.status == 1) {
// checked:true
Ext.getCmp('upstatus').items.get(0).setValue(true);
} else {
Ext.getCmp('upstatus').items.get(1).setValue(true);
}
}
var FilterForm = Ext.create('Ext.form.Panel', {
id: 'VFireOptionFilterForm',
labelWidth: 55,
defaultType: 'textfield',
bodyPadding: 15,
items: [{
xtype: 'combo',
fieldLabel: '单位名称',
id: 'ff_company_code',
name: 'ff_company_code',
displayField: 'owner_name',
valueField: 'owner_id',
editable: false,
width: 330,
store: CompanyStory
},
{
xtype: 'combo',
fieldLabel: '启用状态',
id: 'ff_qyzt',
name: 'ff_qyzt',
displayField: 'name',
valueField: 'status',
editable: false,
width: 330,
store: ClztStory
},{
xtype:'datefield',
fieldLabel:"开始日期",
format:"Y-m-d",
id: 'filter_start_time',
name:"start_data",
//editable:true,//只读约束
// width: 330,
anchor:'80%'
}
,{
xtype:'datefield',
fieldLabel:"结束日期",
minValue:data,
// '07/07/2017',
minText:"当前日期选择应大于当天日期",
format:"Y-m-d",
// columnWidth:0.5,
id: 'filter_end_time',
name:"end_data",
// editable:true,//只读约束
anchor:'80%'
}
],
buttons: [{
text: '筛选',
iconCls: 'ok_btn',
handler: function () {
var form = this.up('form').getForm();
if (form.isValid()) {
var query = new Object();
// var tmp = Ext.getCmp('ff_company_code');
if (Ext.getCmp('ff_company_code').getValue()) {
query.company_code = Ext.getCmp('ff_company_code').getValue();
$("#company_code").val(query.company_code);
company_code = query.company_code;
$("#FirePiePanel_title_string").html(Ext.getCmp('ff_company_code').getRawValue() + '.维保合同列表');
} else {
$("#company_code").val('');
$("#FirePiePanel_title_string").html('维保合同列表');
company_code = null;
}
if (Ext.getCmp('ff_qyzt').getValue()) {
query.status = Ext.getCmp('ff_qyzt').getValue();
$("#status").val(query.status);
} else {
$("#status").val('');
}
query.status = Ext.getCmp('ff_qyzt').getValue() == null ? "" : Ext.getCmp('ff_qyzt').getValue();
query.time_start = Ext.getCmp('filter_start_time').getValue() == null ? "" : Ext.getCmp('filter_start_time').getValue();
query.time_end = Ext.getCmp('filter_end_time').getValue() == null ? "" : Ext.getCmp('filter_end_time').getValue();
query.V_LOGINNAME = V_LOGINNAME;
query.V_PASSWORD = V_PASSWORD;
query.COMMSTATUS = 'NO';
var jsonstr = Ext.JSON.encode(query);
myStore.getProxy().extraParams = {
queryJson: jsonstr
};
Ext.getCmp('FireStationListPageToolbar').moveFirst();
Ext.getCmp('ff_company_code').setValue('');
Ext.getCmp('ff_qyzt').setValue('');
Ext.getCmp('contractManageFilterWin').hide();
// getCurrentData();
}
}
}, {
text: '关闭',
iconCls: 'cancel_btn',
handler: function () {
Ext.getCmp('contractManageFilterWin').hide();
}
}]
});
var filterwin = function () {
Ext.create('Ext.window.Window', {
id: 'contractManageFilterWin',
title: '合同筛选',
height: 210,
width: 400,
layout: 'fit',
items: FilterForm,
closable: false,
modal: true,
closeAction: 'hide'
}).show();
CompanyStory.reload();
}
Ext.grid.PageRowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 50,
text: '序号',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (store.lastOptions.params != null) {
var pageindex = store.lastOptions.params.start;
return pageindex + rowIndex + 1;
} else {
return rowIndex + 1;
}
}
});
var contractOptionPanel = Ext.create('Ext.grid.Panel', {
header: {
height: 0,
border: '0px solid #000000'
},
titleCollapse: true,
id: 'contractManageOptionPanel',
region: 'center',
store: myStore,
enableColumnResize: true,
columns: [
new Ext.grid.PageRowNumberer(),
{header: 'id', dataIndex: 'id', hidden: true, menuDisabled: true},
{header: '单位名称', dataIndex: 'company', width: '18%', menuDisabled: true, align: 'center'},
{header: '维保单位', dataIndex: 'maintenanceCompany', width: '10%', menuDisabled: true, align: 'center'},
{header: '维保开始时间', dataIndex: 'startTime', width: '10%', menuDisabled: true, align: 'center'},
{header: '维保结束时间', dataIndex: 'endTime', width: '10%', menuDisabled: true, align: 'center'},
{header: '销售', dataIndex: 'salesman', width: '10%', menuDisabled: true, align: 'center'},
{header: '销售电话', dataIndex: 'salesmanPhone', width: '10%', menuDisabled: true, align: 'center'},
{header: '客户单位', dataIndex: 'customer', width: '15%', menuDisabled: true, align: 'center'},
{header: '客户电话', dataIndex: 'customerPhone', width: '15%', menuDisabled: true, align: 'center'},
{header: '合同状态', dataIndex: 'status', width: '10%', menuDisabled: true, align: 'center',hidden: true},
{header: 'url', dataIndex: 'url', width: '10%', menuDisabled: true, align: 'center', hidden: true,hidden: true},
{header: '单位编号', dataIndex: 'companyCode', width: '10%', menuDisabled: true, align: 'center', hidden: true},
],
columnLines: true,
height: maxHeight,
width: '100%',
tbar: new Ext.create('Ext.toolbar.Toolbar', {
items: [{
html: '维保合同数据列表'
}, '->', {
xtype: 'button',
iconCls: 'back_btn',
text: '返回',
listeners: {
click: function () {
location.href = baseUrl + 'view/frontpage/map.jsp?&theme=' + theme + '&company_code=' + company_code;
}
}
}, '-',{
xtype: 'button',
iconCls: 'filter_btn',
text: '筛选',
listeners: {
click: filterwin
}
}, '-',
{
xtype: 'button',
iconCls: 'append_btn',
text: '新增',
listeners: {
click: addContractwin
}
}]
}),
bbar: new Ext.PagingToolbar({
store: myStore,
id: 'FireStationListPageToolbar',
displayInfo: true,
pageSize: countPerPage,
prependButtons: true,
displayMsg: '显示第 {0}条到 {1}条记录,总共 {2}条',
emptyMsg: "没有记录",
firstText: '第一页',
prevText: '前一页',
nextText: '后一页',
lastText: '最后一页',
refreshText: '刷新'
}),
frame: true,
border: false,
iconCls: 'icon-grid',
listeners: {
'celldblclick': function (grid, td, cellIndex, record, tr, rowIndex, e, eOpts) {
// console.log(record.raw.time);
showContractInfoWin(record);
}
}
});
function checkfilename(){
var subwin = window.frames['file_uploader'].contentWindow;
subwin.setpic();
}
var data =Ext.Date.format(new Date(), 'm/d/Y');
var addContracInfoForm = Ext.create('Ext.form.Panel', {
// id: 'addContracInfoForm',
labelWidth: 55,
layout: "column",
url: baseUrl + 'contract/saveContract',
defaultType: 'textfield',
fileUpload: true,
bodyPadding: 15,
items: [ {
xtype: 'combo',
fieldLabel: '单位名称',
id: 'addc_companyCode',
name: 'company',
displayField: 'owner_name',
valueField: 'owner_id',
allowBlank: true,
blankText: "不能为空",
editable: false,
width: 250,
store: CompanyStory
}, {
fieldLabel: '维保单位',
allowBlank: true,
blankText: "不能为空",
id: 'addmaintenance_company',
name: 'maintenance_company',
maxLength: 120,
anchor: '65%'
},
{
xtype:'datefield',
fieldLabel:"开始日期",
format:"Y-m-d",
id: 'addstart_time',
name:"start_data",
editable:false,//只读约束
// width: 330,
anchor:'80%'
}
,{
xtype:'datefield',
fieldLabel:"结束日期",
minValue:data,
// '07/07/2017',
minText:"当前日期选择应大于当天日期",
format:"Y-m-d",
// columnWidth:0.5,
id: 'addend_time',
name:"end_data",
editable:false,//只读约束
anchor:'80%'
}, {
fieldLabel: '销售人员',
allowBlank: true,
blankText: "不能为空",
id: 'addsalesman',
name: 'salesman',
maxLength: 120,
anchor: '65%'
}, addradiogroup, {
fieldLabel: '销售人员电话',
id: 'addsalesman_phone',
name: 'salesman_phone',
maxLength: 120,
anchor: '65%'
}, {
fieldLabel: '客户联系人',
id: 'addcustomer',
allowBlank: true,
blankText: "不能为空",
name: 'customer',
maxLength: 50,
anchor: '15%'
}, {
fieldLabel: '客户电话',
id: 'addcustomer_phone',
allowBlank: true,
blankText: "不能为空",
name: 'customer_phone',
maxLength: 50,
anchor: '15%'
},/*uploadfield,*/
{
id: 'addc_queryJson',
name: 'queryJson',
hidden: true
}],
buttons: [{
text: '提交',
// id: 'addconfirmBtn',
iconCls: 'ok_btn',
handler: function () {
var form = this.up('form').getForm();
if (form.isValid()) {
var queryJson = new Object();
queryJson.V_LOGINNAME = V_LOGINNAME;
queryJson.V_PASSWORD = V_PASSWORD;
queryJson.companyCode = Ext.getCmp('addc_companyCode').getValue();
queryJson.salesman = Ext.getCmp('addsalesman').getValue();
queryJson.maintenanceCompany = Ext.getCmp('addmaintenance_company').getValue();
queryJson.customerPhone = Ext.getCmp('addcustomer_phone').getValue();
queryJson.customer = Ext.getCmp('addcustomer').getValue();
queryJson.salesmanPhone = Ext.getCmp('addsalesman_phone').getValue();
// queryJson.maintenanceCompany = Ext.getCmp('addsalesman_phone').getValue();
queryJson.startTime = Ext.getCmp('addstart_time').getValue();
queryJson.status = Ext.getCmp('addstatus').getChecked()[0].boxLabel == '启用' ? 1 : 0;
queryJson.endTime = Ext.getCmp('addend_time').getValue();
queryJson.url = fileUrl;
var jsonstr = Ext.JSON.encode(queryJson);
Ext.getCmp('addc_queryJson').setValue(jsonstr);
form.submit({
method: 'post',
success: function (form, action) {
Ext.Msg.alert('操作成功', '已确认1条记录', function (btn, txt) {
clear_contract_add_form();
myStore.reload();
// getCurrentData();
});
},
failure: function (form, action) {
Ext.Msg.alert('操作失败', action.Msg, function (btn, txt) {
clear_contract_add_form();
myStore.reload();
//
});
}
});
this.up('window').close();
}
}
},
{
text: '点击上传文件',
iconCls: 'cancel_btn',
handler: function () {
var dxjgdm_sel = 100;
var dxjglx_sel = 100;
var form = new Ext.form.FormPanel({
baseCls : 'x-plain',
labelWidth : 150,
fileUpload : true,
defaultType : 'textfield',
items : [{
xtype : 'textfield',
fieldLabel : '请选择要导入的文件',
name : 'file',
id : 'userfile',
inputType : 'file',
blankText : 'File can\'t not empty.',
anchor : '100%' // anchor width by percentage
}]
});
var win = new Ext.Window({
title : '文件导入',
width : 400,
height : 150,
minWidth : 300,
minHeight : 100,
layout : 'fit',
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : form,
buttons : [{
text : '导入',
handler : function() {
if (form.form.isValid()) {
if(Ext.getCmp('userfile').getValue() == ''){
Ext.Msg.alert('错误','请选择你的文件');
return;
}
Ext.MessageBox.show({
title : '请等待',
msg : '文件正在导入...',
progressText : '',
width : 300,
progress : true,
closable : true,
animEl : 'loding'
});
form.getForm().submit({
url : baseUrl +'contract/contractFileUpload',
method : 'POST',
success : function(form, action) {
Ext.Msg.alert("系统提示", "文件上传成功!");
fileUrl = action.result.url
// console.log(form);
win.close();
},
failure : function() {
Ext.Msg.alert("系统提示", "文件上传失败!(上传文件类型不对或文件过大)");
}
})
}else{
Ext.Msg.alert("系统提示","请选择文件后再上传!");
}
}
}, {
text : '关闭',
handler : function() {
win.close();
}
}]
});
win.show();
}
},
{
text: '关闭',
iconCls: 'cancel_btn',
handler: function () {
this.up('window').close();
}
}]
});
new Ext.create('Ext.panel.Panel', {
width: '100%',
id: 'ManageOptionPanel',
layout: 'border',
items:
contractOptionPanel,
renderTo: Ext.getBody()
});
myStore.reload();
// getCurrentData();
$(window).resize(function () {
body_resize();
});
body_resize();
});