123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- $PatrolPosSearchPopup = function (viewModel, selectPatrolPosData, isMultipleSelect, onSelectedPatrolPoss, datagridId) {
- //isMultipleSelect 추가 hcLee 2016 02 15
- var isMultipleSelect = isMultipleSelect;
- // 멀티선택기능 추가 hcLee2016 02 15
- //var onSelectedUsers = options.onSelectedUsers;
- var onSelectedPatrolPoss = onSelectedPatrolPoss;
- var datagridId = datagridId;
- var dataViewModel = new BemsWebApplication.CmPatrolPosViewModel(),
- gridView,
- popupVisible = ko.observable(false),
- dataSource;
- // _Name 작업을 original로 수정해야 한다.
- dataSource = BWA.DataUtil.createDataSource({
- dataSourceOptions: {
- select: ['SiteId',
- 'BuildingId',
- 'FloorId',
- 'PosId',
- 'Name',
- 'TagId',
- 'PosDesc',
- 'CmBuilding/Name',
- 'CmFloor/Name',
- ],
- expand: ["CmBuilding", "CmFloor"],
- extendOptions: { forceOriginalField: true },
- filter: [
- ['SiteId', '=', BWA.UserInfo.SiteId()]
- ]
- }
- }, 'CmPatrolPos');
- var dataGridOptions = utils.datagrid.defaultOptions({
- dxDataSource: dataSource,
- selectedSourceItem: dataViewModel,
- datagridId: 'gridPatrolPosContainer',
- dbId: 'CmPatrolPos',
- useNumberColumn: true,
- columns: [
- { dataField: 'PosId', caption: $G('number'), width: '10%', alignment: 'center', allowFiltering: false },
- // { dataField: 'UserId', caption: $G('userId'), width: '15%', alignment: 'center' },
- { dataField: 'Name', caption: '순찰지점명', width: '35%', alignment: 'center' },
- { dataField: 'CmBuilding/Name', caption: '빌딩', width: '20%', alignment: 'center' },
- { dataField: 'CmFloor/Name', caption: '층', width: '20%', alignment: 'center' },
- { dataField: 'TagId', caption: 'TagId', width: '30%', alignment: 'center' },
- ],
- searchPanelPlaceHolder: '순찰지점 검색',
- paging: {
- pageSize: 11,
- enabled: true
- },
- pager: { visible: true }
- });
- if (isMultipleSelect) {
- dataGridOptions.selection = { mode: 'multiple', allowSelectAll: true };
- dataGridOptions.handleDataGridRowClick = function (id, dataGrid, clickRow) {
- /*
- var data = clickRow.data;
- if (!_.isUndefined(onSelectedUsers)) {
- onSelectedUsers([BWA.DataUtil.convertViewModelToJS(data)]);
- }*/
- };
- }
- else {
- /*
- dataGridOptions.handleDataGridRowClick = function (id, dataGrid, clickRow) {
-
- var data = clickRow.data;
- selectUserData({
- SiteId: data.SiteId(),
- UserId: data.UserId(),
- CompanyId: data.CompanyId(),
- DepartmentId: data.DepartmentId(),
- CompanyName: data.CmCompany_Name(),
- MobilePhoneNo: data.MobilePhoneNo(),
- Name: data.Name()
- });
-
- if (data.CmDepartment_Name !== undefined)
- selectUserData.DepartmentName = data.CmDepartment_Name();
-
- popupVisible(false);
- }*/
- }
- function handlePopupShowing(e) {
- gridView = $('#gridPatrolPosContainer').dxDataGrid('instance');
- }
- function handlePopupShown() {
- }
- function handlePopupButtonSelect() {
- var array = utils.datagrid.getSelectedRowsData('gridPatrolPosContainer');
- if (!_.isUndefined(onSelectedPatrolPoss)) {
- onSelectedPatrolPoss(array);
- }
- $('#gridPatrolPosContainer').dxDataGrid('instance').clearSelection();
- popupVisible(false);
- }
- function handlePopupButtonClose() {
- $('#gridPatrolPosContainer').dxDataGrid('instance').clearSelection();
- popupVisible(false);
- }
- var toolbarItems = [
- { location: 'before', text: '찾기' },
- { location: 'after', widget: 'button', options: { text: $G('select'), icon: 'save', visible: isMultipleSelect, clickAction: handlePopupButtonSelect } },
- { location: 'after', widget: 'button', options: { text: $G('close'), icon: 'close', clickAction: handlePopupButtonClose } }
- ];
- var popupOptions = {
- width: isMultipleSelect ? '800px' : '600px',
- height: 'auto',
- visible: popupVisible,
- closeOnOutsideClick: true,
- shading: false,
- showingAction: handlePopupShowing,
- shownAction: handlePopupShown,
- animation: {
- show: { type: "pop", duration: 200, from: { opacity: 1, scale: 0.4 }, to: { scale: 1 } },
- hide: { type: "fade", duration: 200, from: 1, to: 0 }
- }
- };
- return {
- dataModel: dataViewModel,
- dataSource: dataSource,
- popupOptions: popupOptions,
- toolbarItems: toolbarItems,
- dataGridOptions: dataGridOptions,
- show: function () {
- popupVisible(true);
- }
- };
- }
|