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('groupManageOption', {
extend: 'Ext.data.Model',
fields: [
{name: 'id', type: 'int'},
{name: 'groupName', type: 'string'},
{name: 'groupAddr', type: 'string'},
{name: 'mainNumber', type: 'int'},
{name: 'detectorNumbers', type: 'int'},
{name: 'peopleNumber', type: 'int'},
{name: 'companyCode', type: 'string'},
{name: 'time', type: 'string'},
{name: 'status', type: 'int'},
]
});
var getCurrentData = function () {
var query = {};
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();
});
}
}
}
});
}
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: 'owner_name', type: 'string'},
{name: 'owner_id', type: 'string'}
]
});
Ext.define('DeviceTypeStore', {
extend: 'Ext.data.Model',
fields: [
{name: 'deviceTypeName', type: 'string'},
{name: 'deviceType', type: 'int'}
]
});
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 up_group_radiogroup = 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 = {};
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: 'groupManageOption',
pageSize: countPerPage,
proxy: {
type: 'ajax',
actionMethods: {
create: 'POST',
read: 'POST', // by default GET
update: 'POST',
destroy: 'POST'
},
url: baseUrl + 'group/queryGroup',
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
});
var Group_deviceType = Ext.create('Ext.data.Store', {
model: 'DeviceTypeStore',
proxy: {
type: 'ajax',
actionMethods: {
create: 'POST',
read: 'POST', // by default GET
update: 'POST',
destroy: 'POST'
},
url: baseUrl + 'group/queryDevice',
//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
});
var childStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
//这里是参数可以顺便写,这个数据源是在第一个下拉框select的时候load的
url: baseUrl + 'group/queryDevicePoint'
}),
reader: new Ext.data.JsonReader({
root: 'RESULT'
}, [
{name: 'id', mapping: 'id'},
{name: 'mc', mapping: 'name'}
])
});
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 addGroupWin = function () {
Ext.create('Ext.window.Window', {
title: '新增群组',
height: 500,
width: 430,
layout: 'fit',
items: addGroupInfoForm,
closable: false,
modal: true,
closeAction: 'hide'
}).show();
}
//*************************************修改弹框详情*************************
var Group_InfoForm = Ext.create('Ext.form.Panel', {
labelWidth: 55,
layout: "column",
url: baseUrl + 'group/updataGroup',
defaultType: 'textfield',
fileUpload: true,
bodyPadding: 15,
items: [
{
fieldLabel: 'id',
id: 'up_g_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
},
{
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%'
}, up_group_radiogroup,
{
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 = {};
queryJson.V_LOGINNAME = V_LOGINNAME;
queryJson.V_PASSWORD = V_PASSWORD;
queryJson.companyCode = Ext.getCmp('up_companyCode').getValue();
queryJson.id = Ext.getCmp('up_g_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_add_form();
myStore.reload();
// getCurrentData();
});
},
failure: function (form, action) {
Ext.Msg.alert('操作失败', action.Msg, function (btn, txt) {
// clear_add_form();
myStore.reload();
//
});
}
});
this.up('window').close();
}
}
},
{
text: '关闭',
iconCls: 'cancel_btn',
handler: function () {
this.up('window').close();
}
}]
});
//********************end**************************
var GroupInfoWin = Ext.create('Ext.window.Window', {
id: 'GFileInfoWin',
title: '群组详情: ',
width: 468,
height: 500,
layout: 'fit',
closable: true,
modal: true,
closeAction: 'hide',
items: Group_InfoForm
});
var ClztStory = Ext.create('Ext.data.Store', {
fields: ['status', 'name'],
data: [
{'status': '0', 'name': '未启用'},
{'status': '1', 'name': '启用'}
]
});
var showGroupInfoWin = function (record) {
GroupInfoWin.show();
$("#VInfoWin_Title").html(record.get('data'));
var data = record.raw;
console.log(data);
Ext.getCmp('up_companyCode').setValue(data.companyCode);
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 = {};
// 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('groupListPageToolbar').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: 'groupName', width: '20%', menuDisabled: true, align: 'center'},
{header: '群组地址', dataIndex: 'groupAddr', width: '20%', menuDisabled: true, align: 'center'},
{header: '主机数量', dataIndex: 'mainNumber', width: '20%', menuDisabled: true, align: 'center'},
{header: '探测器数量', dataIndex: 'detectorNumbers', width: '20%', menuDisabled: true, align: 'center'},
{header: '人员数量', dataIndex: 'peopleNumber', width: '20%', menuDisabled: true, align: 'center'},
{header: '单位名称', dataIndex: 'companyCode', width: '20%', 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: addGroupWin
}
}]
}),
bbar: new Ext.PagingToolbar({
store: myStore,
id: 'groupListPageToolbar',
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);
showGroupInfoWin(record);
}
}
});
//******************************************************************
/**
* 省选择
*/
/*
{name: 'owner_name', type: 'string'},
{name: 'owner_id', type: 'string'}
*/
Ext.define('App.util.ProviceCombox', {
alias : 'widget.proviceCombox',
extend : 'Ext.form.field.ComboBox',
width: 320,
bodyPadding: 1,
fieldLabel : "所属省",
queryMode : 'local',
lazyInit : true,
editable : false,
triggerAction : 'all',
layout: 'anchor',
store : Ext.create('Ext.data.Store', {
fields : [ "owner_name", "owner_id" ],
autoLoad : true,
proxy : {
type : 'ajax',
url :baseUrl + 'iot/company/view/getNameList',
reader : {
type : 'json',
root : 'RESULT'
}
},
}),
allowBlank : false,
emptyText : '------请选择单位------',
displayField : 'owner_name',
valueField : 'owner_id',
name:"ownerName"
});
/**
* 根据父ID加载市
* @param com 容器
* @param fatherId 加载的父ID
*/
App.util.ProviceCombox.loadCity=function(com,fatherId){
var cityCombox = com.queryById("cityCombox");
var countyCombox = com.queryById("countyCombox");
countyCombox.clearValue();
cityCombox.clearValue();
if (fatherId) {
cityCombox.getStore().load({
params: {
"proviceId": fatherId
}
});
}
}
/******调用方式*******/
// {xtype:"proviceCombox",
// listeners : {
// "select" : function(fatherType, record, index) {
// var provinceId = fatherType.getValue();
// var win = Ext.ComponentQuery.query("personalAdd")[0];
// var cityCombox = win.down("cityCombox");
// var countyCombox = win.down("countyCombox");
// countyCombox.clearValue();
// cityCombox.clearValue();
// if (provinceId) {
// cityCombox.getStore().load({
// params : {
// "provinceId" : provinceId
// }
// });
// }
//
// }
// }
// },{
// xtype:"cityCombox",
// listeners : {
// "select" : function(fatherType, record, index) {
// var cityId = fatherType.getValue();
// var win = Ext.ComponentQuery.query("personalAdd")[0];
// var cityCombox = win.down("countyCombox");
// var countyCombox = win.down("countyCombox");
// countyCombox.clearValue();
// if (cityId) {
// countyCombox.getStore().load({
// params : {
// "cityId" : cityId
// }
// });
// }
//
// }
// }
// },{
// xtype:"countyCombox"
//
// },
/**
* 市选择
*/
Ext.define('App.util.CityCombox', {
alias : 'widget.cityCombox',
extend : 'Ext.form.field.ComboBox',
width: 320,
bodyPadding: 1,
fieldLabel : "设备类型",
layout: 'anchor',
queryMode : 'local',
lazyInit : true,
editable : false,
triggerAction : 'all',
store : Ext.create('Ext.data.Store', {
fields : [ "deviceTypeName", "deviceType" ],
//autoLoad : true,
proxy : {
type : 'ajax',
url : baseUrl + 'group/queryDevice',
reader : {
type : 'json',
root : 'RESULT'
}
},
}),
allowBlank : false,
emptyText : '----请选类型-----',
displayField : 'deviceTypeName',
valueField : 'deviceType',
name:"deviceType"
});
Ext.define('App.util.CountyCombox', {
alias : 'widget.countyCombox',
extend : 'Ext.form.field.ComboBox',
width: 320,
bodyPadding: 1,
fieldLabel : "区/县",
layout: 'anchor',
queryMode : 'local',
lazyInit : true,
editable : false,
triggerAction : 'all',
store : Ext.create('Ext.data.Store', {
fields : [ "countyId", "countyName" ],
//autoLoad : true,
proxy : {
type : 'ajax',
url : baseUrl + 'iot/company/view/getNameList',
reader : {
type : 'json',
root : 'data'
}
},
}),
allowBlank : false,
emptyText : '-----请选择区/县-----',
displayField : 'countyName',
valueField : 'countyId',
name:"countyId"
});
/**
* 根据父ID加载县
* @param com 容器
* @param fatherId 加载的父ID
*/
App.util.CountyCombox.loadCounty=function (com,fatherId) {
var countyCombox = com.queryById("countyCombox");
countyCombox.clearValue();
if (fatherId) {
countyCombox.getStore().load({
params: {
"cityId": fatherId
}
});
}
}
//******************************************************************
function checkfilename() {
var subwin = window.frames['file_uploader'].contentWindow;
subwin.setpic();
}
var data = Ext.Date.format(new Date(), 'm/d/Y');
//TODO 新增弹窗
var addGroupInfoForm = Ext.create('Ext.form.Panel', {
labelWidth: 55,
layout: "column",
url: baseUrl + 'group/addGroup',
defaultType: 'textfield',
fileUpload: true,
bodyPadding: 15,
items: [
/******调用方式*******/
{xtype:"proviceCombox",itemId:"proviceCombox",
listeners : {
"select" : function(fatherType, record, index) {
var provinceId = fatherType.getValue();
// var fatherId = form.queryById("proviceCombox").getValue();
var win = Ext.ComponentQuery.query("proviceCombox")[0];
var cityCombox = win.down("cityCombox");
var countyCombox = win.down("countyCombox");
countyCombox.clearValue();
cityCombox.clearValue();
if (provinceId) {
cityCombox.getStore().load({
params : {
"provinceId" : provinceId
}
});
}
}
}
},{
xtype:"cityCombox",itemId:"cityCombox",
listeners : {
"select" : function(fatherType, record, index) {
var cityId = fatherType.getValue();
var win = Ext.ComponentQuery.query("personalAdd")[0];
var cityCombox = win.down("countyCombox");
var countyCombox = win.down("countyCombox");
countyCombox.clearValue();
if (cityId) {
countyCombox.getStore().load({
params : {
"cityId" : cityId
}
});
}
}
}
},{
xtype:"countyCombox",itemId:"countyCombox",
},
/*{
xtype: 'combo',
fieldLabel: '单位名称',
id: 'addc_companyCode',
name: 'company',
displayField: 'owner_name',
valueField: 'owner_id',
emptyText: '请选择单位',
forceSelection:true,
allowBlank: true,
triggerAction:'all',
blankText: "不能为空",
editable: false,
width: 350,
store: CompanyStory,
listeners: {
select: function (combo, record, index) {
Group_deviceType.proxy = new Ext.data.HttpProxy({url: baseUrl + 'group/queryDevice?queryJson=' + combo.value});
Group_deviceType.load();
}
}
}, {
forceSelection: true,//必须选择一项
mode: 'local',
xtype: 'combo',
fieldLabel: '设备类型',
id: 'add_G_deviceType',
name: 'devicetype',
displayField: 'deviceTypeName',
valueField: 'deviceType',
allowBlank: true,
emptyText: '请选择类型设备类型',
blankText: "不能为空",
editable: false,
triggerAction: 'all',
width: 350,
store: Group_deviceType,
/!*listeners: {
select: function (combo, record, index) {
// childStore.proxy = new Ext.data.HttpProxy({url: 'group/queryDevicePoint?queryJson=' + combo.value});
childStore.load();
}
}*!/
}, /!*{
xtype: 'combo',
store: childStore,
valueField: "id",
displayField: "mc",
//数据是在本地
mode: 'local',
forceSelection: true,//必须选择一项
emptyText: '请选择子分类...',//默认值
hiddenName: 'interviewsDetail.child_category',//hiddenName才是提交到后台的input的name
editable: false,//不允许输入
triggerAction: 'all',//因为这个下拉是只能选择的,所以一定要设置属性triggerAction为all,不然当你选择了某个选项后,你的下拉将只会出现匹配选项值文本的选择项,其它选择项是不会再显示了,这样你就不能更改其它选项了。
//allowBlank:false,//该选项值不能为空
fieldLabel: '选择',
id: 'child_id',
name: 'child',
width: 350
},*!/ {
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 = {};
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_add_form();
myStore.reload();
// getCurrentData();
});
},
failure: function (form, action) {
Ext.Msg.alert('操作失败', action.Msg, function (btn, txt) {
// clear_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();
});