You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

121 lines
5.0 KiB

'use strict';
var fnPageInit = function () {
var canDo = new CanDo({
sortField: 'OrderByValue',
sortOrder: 'asc',
/**
* 當前程式所有ID名稱集合
*/
idKeys: ['OrgID', 'ExhibInfoID', 'CategoryID', 'ExhibitionID'],
//idKeys: ['OrgID', 'ExhibInfoID'],
//*
// * Grid欄位設置(可以是 function)
gridFields: [
{ name: "RowIndex", title: 'common.RowNumber', align: 'center', width: 50, sorting: false },
//{ name: "ExhibInfoID", title: 'ExhibInfoMaintain_Qry.ExhibInfoID', width: 100 },
//{ name: "ExhibitionID", title: 'ExhibMaintain_Qry.ExhibitionID', width: 100 },
{ name: "ExhibitionName", title: 'common.ExhibitionName', align: 'left', width: 100 },
{ name: "Year", title: 'common.ParticularYear', align: 'left', width: 50 },
{ name: "CategoryName", title: 'common.ExhibSubCategory', align: 'left', width: 100 },
//{ name: "StartDate", title: 'ExhibInfoMaintain_Qry.StartDate', align: 'left', width: 50 },
{
name: "StartDate", title: 'common.StartDate', width: 50, align: 'left', itemTemplate: function (val) {
var start_date = val.split('T');
return start_date[0];
}
},
//{ name: "EndDate", title: 'ExhibInfoMaintain_Qry.EndDate', align: 'left', width: 50 },
{
name: "EndDate", title: 'common.EndDate', width: 50, align: 'left', itemTemplate: function (val) {
var end_date = val.split('T');
return end_date[0];
}
},
{ name: "ExhibSize", title: 'ExhibInfoMaintain_Qry.ExhibSize', align: 'left', width: 50 },
{ name: "VisitorCount", title: 'ExhibInfoMaintain_Qry.VisitorCount', align: 'left', width: 50 },
{ name: "IntVisitorCount", title: 'ExhibInfoMaintain_Qry.IntVisitorCount', align: 'left', width: 50 },
{ name: "ExhibitorCount", title: 'ExhibInfoMaintain_Qry.ExhibitorCount', align: 'left', width: 50 },
{
name: "Effective", title: 'common.Status', width: 150, align: 'center', itemTemplate: function (val) {
return val === 'Y' ? i18next.t('common.Enable') : i18next.t('common.Disable');
}
},
//{ name: "OrderByValue", title: 'OrderByValue', align: 'left', width: 50 }
{
name: "OrderByValue", title: 'common.OrderByValue', type: "select", width: 150,
itemTemplate: function (val, item) {
return this._createSelect = $("<select>", {
class: 'w70',
html: createOptions(item.OrderCount),
change: function () {
var sOldValue = val,
sNewValue = this.value;
g_api.ConnectLite(canDo.ProgramId, canDo._api.order, {
Id: item.ExhibInfoID,
OldOrderByValue: sOldValue,
NewOrderByValue: sNewValue
}, function (res) {
if (res.RESULT) {
showMsg(i18next.t('message.Update_Success'), 'success');// ╠message.Update_Success⇒更新成功╣
canDo.Grid.openPage(canDo.options.toFirstPage ? 1 : canDo.options.queryPageidx);
}
else {
showMsg(i18next.t('message.Update_Failed') + '<br>' + res.MSG, 'error'); // ╠message.Update_Failed⇒更新失敗╣
}
});
}
}).val(val);
}
}
],
/**
* 頁面初始化
* @param {Object} pargs CanDo 對象
*/
pageInit: function (pargs) {
var postArray = [];
postArray.push(fnCategoryDrop());
$.whenArray(postArray).done(function () {
pargs._reSetQueryPm();
pargs._initGrid();
});
}
}),
/**
* 類別下拉選單
*/
fnCategoryDrop = function () {
return g_api.ConnectLite(canDo.ProgramId, "QueryCategoryList", {
//RegionID: $("#RegionID").val()
},
function (res) {
if (res.RESULT) {
var saCategoryList = res.DATA.rel;
var sOptionHtml = createOptions(saCategoryList, 'CategoryID', 'CategoryName', false);
$('#CategoryID').html(sOptionHtml);
}
});
}
};
require(['base', 'jsgrid', 'cando'], fnPageInit);