Commit f7015004 authored by Qiu Chuntao's avatar Qiu Chuntao

add files

parent ad302cfe
Pipeline #11725 failed with stage
in 1 minute and 19 seconds
#include "topsysplugin.h"
//#include "sysmainwindow/sysmainwindow.h"
#include "custommoduleplugin.h"
#include "sysusermgt/musermgt.h"
//#include "sysusermgt/sysuser.h"
#include "sysmainwindow/msysmainwindow.h"
QStringList TopSysPlugin::getClassList()
{
return QStringList()<< QStringLiteral("Musermgt");
return QStringList()<< QStringLiteral("Musermgt")
<< QStringLiteral("SysMainWindow");
}
TopClassAbs *TopSysPlugin::newClass(const QString &iClassName,
const QString &iModuleName,
const QVariantMap &iUrlPars)
{
if (iClassName == QStringLiteral("Musermgt")) {
if (iClassName == QStringLiteral("SysMainWindow")) {
return new SysMainWindow(iModuleName, iUrlPars, nullptr);
} else if (iClassName == QStringLiteral("Musermgt")) {
return new Musermgt(iModuleName, iUrlPars, nullptr);
}
return nullptr;
......
......@@ -35,10 +35,10 @@ TEMPLATE = lib
CONFIG += plugin
SOURCES += \
topsysplugin.cpp
custommoduleplugin.cpp
HEADERS += \
topsysplugin.h
custommoduleplugin.h
LIB_LIST = tsec tbaseutil tdatabaseutil twidget topcore toputil tchart
win32 {
......
#include "msysmainwindow.h"
#include <QCloseEvent>
#include <QDesktopServices>
#include <QProcess>
#include <QGraphicsDropShadowEffect>
#include <QHBoxLayout>
#include <QMenu>
#include <QDateTime>
#include <QResource>
#include <QTabBar>
#include <QFileDialog>
#include <QFileInfo>
#include <QToolBar>
#include <QApplication>
#include <QVBoxLayout>
#include <QSplitter>
#include <QPainter>
#include <tbaseutil/tdataparse.h>
#include <tbaseutil/tfileio.h>
#include <tbaseutil/tlogger.h>
#include <tbaseutil/tresource.h>
#include <tbaseutil/ttheme.h>
#include <tdatabaseutil/tsqlqueryv2.h>
#include <tdatabaseutil/tsqlconnectionpoolv2.h>
#include <toputil/topaboutusdialog.h>
#include <topcore/topclasssqlthread.h>
#include <topcore/topcore.h>
#include <toputil/toploginpwdrestdialog.h>
#include <topcore/topmessagecontroller.h>
#include <twidget/tmessagebox.h>
#include <twidget/tpushbutton.h>
#include <twidget/tuiloaderdialog.h>
#include <twidget/tpanelmenu.h>
#include <twidget/twebview.h>
#include <twidget/ttoolbutton.h>
#include <twidget/tdialog.h>
#include <twidget/tradiobox.h>
#include <twidget/tcheckbox.h>
#include <twidget/tgroupbox.h>
#include <twidget/tdialogbuttonbox.h>
#include "topquickbutton.h"
#include "topquicktoolbar.h"
struct NaviData {
SysMainWindow::RouteType routeType = SysMainWindow::RouteType::None; // 路由类型
QVariant menuData; // 当类型为Menu时,缓存导航树的状态
};
SysMainWindow::SysMainWindow(const QString &iModuleNameStr,
const QVariantMap &iUrlPars,
QWidget *iParent)
: TopClassAbs(iParent)
{
initModule(iModuleNameStr, iUrlPars);
if (this->isHookExists("afterModuleInit")) {
this->callHooks("afterModuleInit");
}
setHasWindowTitleBar(false);
QStringList rccLst = config("resource.rcc").toStringList();
for (QString rcc : rccLst) {
TRES->loadRcc(rcc);
}
initNaviToolBar();
initMainWidget();
initDefaultRoute();
initIsPinned();
initSysTrayIcon();
mMessageController = new TopMessageController(this);
mMessageController->setParentWidget(this);
connect(APP, SIGNAL(notification(QString,QVariant,QString)), this, SLOT(onNotification(QString,QVariant,QString)));
setMinimumSize(TTHEME_DP(800), TTHEME_DP(600));
QVariantMap defalutSize = config("default_size").toMap();
if (!defalutSize.isEmpty() && defalutSize["width"].toInt() > 0
&& defalutSize["height"].toInt() > 0) {
resize(TTHEME_DP(defalutSize["width"].toInt()),
TTHEME_DP(defalutSize["height"].toInt()));
} else {
showMaximized();
}
refreshActionState();
bool hasOperateTimeOut = config("has_operate_time_out").toBool();
if (hasOperateTimeOut) {
mPreOperateTime = new QDateTime(QDateTime::currentDateTime());
mOperateTimeOutTimer = new QTimer(this);
mOperateTimeOutTimer->setInterval(1000);
connect(mOperateTimeOutTimer, SIGNAL(timeout()), this, SLOT(onOperateTimer()));
mOperateTimeOutTimer->start();
}
}
SysMainWindow::~SysMainWindow()
{
if (this->isHookExists("onDestory")) {
this->callHooks("onDestory");
}
}
void SysMainWindow::setIsPinned(bool iIsPinned, bool iForce)
{
if (!iForce) {
if (mIsPinned == iIsPinned) {
return;
}
}
mIsPinned = iIsPinned;
if (mIsPinned) {
QSize widgetSize = mPopupWidget->size();
qreal totalWidth = mMainWidget->width();
mPinButton->setIcon(TRES->icon("pin"));
// 导航窗体被钉住
// 将mNaviWidget添加到mCenterWidget
mPopupWidget->setWindowFlags(Qt::Widget);
mPopupWidget->setStretchWidgetVisible(false);
mCenterWidget->insertWidget(0, mPopupWidget);
mCenterWidget->setSizes(QList<int>()<<widgetSize.width()<<(totalWidth-widgetSize.width()));
} else {
mPinButton->setIcon(TRES->icon("pin2"));
// 导航窗体取消钉住
// 将mNaviWidget从mCenterWidget中移出
// 并将mNaviWidget设置成Popup, 设定mNaviWidget的位置
mPopupWidget->setParent(nullptr);
mPopupWidget->setWindowFlags(Qt::Popup);
mPopupWidget->setStretchWidgetVisible(true);
movePanelMenuWidget();
mPopupWidget->setVisible(true);
}
}
bool SysMainWindow::hide2SystemTrayState()
{
return mHidetoSysTray;
}
void SysMainWindow::saveHide2SystemTrayState(bool iState)
{
mHidetoSysTray = iState;
if (mHidetoSysTrayFlag) {
APP->saveSetting(mHidetoTrayRegName, QVariant::fromValue(mHidetoSysTray));
}
}
bool SysMainWindow::isSystemTrayIconShow()
{
return mSysTrayIconShow;
}
void SysMainWindow::initNaviToolBar()
{
mNaviToolBar = new TopQuickToolBar(this);
mNaviToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
mNaviToolBar->setOrientation(Qt::Vertical);
mNaviToolBar->setMovable(false);
mNaviToolBar->setStyleSheet(QString("QToolBar{border:solid; border-color:#D5D5D5; border-width:0px; border-right-width:0px; spacing:0px;padding:0px;background-color:%1;}").arg(TTHEME->value("COLOR_PRIMARY_7").toString()));
// 添加间隔
QWidget *spacingWget = new QWidget(this);
spacingWget->setFixedHeight(TTHEME_DP(56));
mNaviToolBar->addWidget(spacingWget);
// 添加配置的导航项
QVariantList naviLst = config("desktop").toMap().value("navi").toList();
for (QVariant var : naviLst) {
if (var.type() == QVariant::String) {
if (var.toString().toUpper() == "STRETCHER") {
QWidget *stretcher = new QWidget;
stretcher->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
mNaviToolBar->addWidget(stretcher);
}
} else {
QVariantMap navi = var.toMap();
TopQuickButton *btn = mNaviToolBar->addQuickButton(navi);
if (btn != nullptr) {
connect(btn, SIGNAL(clicked()), this, SLOT(onQuickBtnClicked()));
}
}
}
}
void SysMainWindow::initMainWidget()
{
QWidget *centerWidget = new QWidget(this);
mMainLayout = new QHBoxLayout(centerWidget);
mMainLayout->setSpacing(0);
mMainLayout->setMargin(0);
// 添加左侧导航工具条
if (mNaviToolBar != nullptr) {
mMainLayout->addWidget(mNaviToolBar);
}
//路由导航菜单
mPopupWidget = new StretchFrame(this);
mPopupWidget->setMinimumWidth(TTHEME_DP(config("navi.min_size.width", 200).toInt()));
mPopupWidget->setMaximumWidth(TTHEME_DP(500));
mPopupWidget->resize(TTHEME_DP(config("navi.min_size.width", 200).toInt()), mPopupWidget->height());
mPopupWidget->setVisible(false);
mPopupWidget->setGraphicsEffect(TTHEME->getShadowEffect(1, "left"));
QWidget *popupWidget = new QWidget(mPopupWidget);
QVBoxLayout *panelMenuMainLayout = new QVBoxLayout(popupWidget);
panelMenuMainLayout->setMargin(0);
panelMenuMainLayout->setSpacing(0);
QWidget *panelMenuHeaderWidget = new QWidget;
panelMenuHeaderWidget->setFixedHeight(TTHEME_DP(40));
panelMenuHeaderWidget->setStyleSheet("background-color:#E1E1E5;");
QHBoxLayout *panelMenuHeaderLayout = new QHBoxLayout(panelMenuHeaderWidget);
mPanelMenuTitleLabel = new QLabel;
panelMenuHeaderLayout->addWidget(mPanelMenuTitleLabel);
panelMenuHeaderLayout->addStretch(1);
mPinButton = new TToolButton(this);
connect(mPinButton, SIGNAL(clicked(bool)), this, SLOT(onPinButtonClicked()));
mPinButton->setIcon(TRES->icon(QString("pin")));
mPinButton->setTuiStyle("size=small");
panelMenuHeaderLayout->addWidget(mPinButton);
panelMenuMainLayout->addWidget(panelMenuHeaderWidget);
mModuleBarStackedWidget = new QStackedWidget(this);
mPanelMenu = new TPanelMenu(this);
connect(mPanelMenu, SIGNAL(clicked(QVariant)), this, SLOT(onPanelMenuClicked(QVariant)));
mModuleBarStackedWidget->addWidget(mPanelMenu);
panelMenuMainLayout->addWidget(mModuleBarStackedWidget);
mPopupWidget->setWidget(popupWidget);
// 添加右侧模块显示区域
mMainWidget = new QWidget(this);
QVBoxLayout *centerLayout = new QVBoxLayout(mMainWidget);
centerLayout->setSpacing(0);
centerLayout->setMargin(0);
mWindowTitleBar = new TFramelessWindowBar(this);
mWindowTitleBar->setHostWindow(this);
mWindowTitleBar->setAutoHideFlags(TFramelessWindowBar::AutoHideHint_SysButton);
mWindowTitleBar->setFixedHeight(TTHEME_DP(40));
QHBoxLayout *winTitleLayout = new QHBoxLayout(mWindowTitleBar);
winTitleLayout->setSpacing(0);
winTitleLayout->setMargin(0);
winTitleLayout->addSpacing(TTHEME_DP(12));
mTabBar = new QTabBar(this);
mTabBar->setProperty("SS_TYPE","PRIMARY");
mTabBar->setDrawBase(false);
winTitleLayout->addWidget(mTabBar, 0, Qt::AlignBottom);
winTitleLayout->addStretch(1);
winTitleLayout->addSpacing(TTHEME_DP(8));
QWidget *msgparent = new QWidget(this);
msgparent->setFixedWidth(TTHEME_DP(200));
winTitleLayout->addWidget(msgparent, 0);
mMessageLabel = new QLabel(msgparent);
mMessageLabel->setFixedWidth(TTHEME_DP(200));
mMessageLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
mMessageLabel->setProperty("SS_FONT", "12");
mMessageAnimation = new QPropertyAnimation(mMessageLabel, "pos", this);
mMessageAnimation->setEasingCurve(QEasingCurve::Linear);
winTitleLayout->addSpacing(TTHEME_DP(8));
winTitleLayout->addWidget(mWindowTitleBar->windowMinButton(), 0, Qt::AlignTop);
winTitleLayout->addWidget(mWindowTitleBar->windowMaxButton(), 0, Qt::AlignTop);
winTitleLayout->addWidget(mWindowTitleBar->windowNormalButton(), 0, Qt::AlignTop);
winTitleLayout->addWidget(mWindowTitleBar->windowCloseButton(), 0, Qt::AlignTop);
connect(mTabBar, SIGNAL(currentChanged(int)), this, SLOT(onTabBarCurrentChanged(int)));
connect(mTabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(onTabBarCloseRequested(int)));
centerLayout->addWidget(mWindowTitleBar);
mStackedWidget = new StackedWidget(this);
if (config("background_image_path").isValid()) {
QString fileName = APP->appPlatformPath()
+ "/" + config("background_image_path").toString();
if (QFile::exists(fileName)) {
mStackedWidget->setBackground(fileName);
} else {
TLOG_ERROR(ttr("Wrong background image path."));
}
}
mStackedWidget->setMouseTracking(true);
centerLayout->addWidget(mStackedWidget, 1);
mCenterWidget = new QSplitter(this);
mCenterWidget->addWidget(mMainWidget);
mCenterWidget->setChildrenCollapsible(false);
mMainLayout->addWidget(mCenterWidget);
setCentralWidget(centerWidget);
//如果直接加到naviBar上,图标的大小是随toolbar的设定,无法改变图标大小;
TToolButton *winIconBtn = new TToolButton(this);
if (!this->iconName().contains('.')){
winIconBtn->setIcon(TRES->icon(this->iconName() + ".white"));
} else {
winIconBtn->setIcon(TRES->icon(this->iconName()));
}
mWindowTitleBar->setEditableWidgets(QList<QWidget*>() << mPinButton << winIconBtn << mTabBar);
winIconBtn->setToolTip(QString("%1\n%2").arg(APP->userLogName()).arg(APP->httpUrl()));
winIconBtn->setFixedSize(TTHEME_DP(40),TTHEME_DP(41));
winIconBtn->setStyleSheet(QString("TToolButton{background-color: %1; border-width:0px; border-style:none; border-radius:0px}")
.arg(TTHEME->value("COLOR_PRIMARY_8").toString()));
winIconBtn->setIconSize(QSize(TTHEME_DP(32), TTHEME_DP(32)));
winIconBtn->move(TTHEME_DP(0), TTHEME_DP(0));
winIconBtn->raise();
}
void SysMainWindow::initDefaultRoute()
{
QVariantList naviLst = config("desktop").toMap().value("navi").toList();
QVariantMap defaultRouteItem = searchDefaultRoute(naviLst);
if (!defaultRouteItem.isEmpty()) {
QString routeTypeStr = defaultRouteItem.value("route_type").toString();
RouteType routeType = str2RouteType(routeTypeStr);
if (routeType == RouteType::Module) {
routeModule(defaultRouteItem.value("url_address").toString(), defaultRouteItem);
} else if (routeType == RouteType::Url) {
routeUrl(defaultRouteItem.value("url_address").toString(), defaultRouteItem);
}
}
}
void SysMainWindow::openModule(const QString &iUrl,
const QVariant &iConfig)
{
bool exists = false;
TopClassAbs *module = APP->openModule(iUrl, &exists);
if (module == nullptr) {
TLOG_ERROR(QString("open module(%1) failed.").arg(iUrl));
return;
}
// 默认将菜单中的标题、图标设置到模块
QVariantMap paramMap = iConfig.toMap();
QString title = paramMap.value("title_" + APP->language()).toString();
if (title.isEmpty()) {
title = paramMap.value("title").toString();
}
module->setTitle(title);
module->setIconName(paramMap.value("icon").toString());
const QString url = module->url().toUpper();
if (!exists) {
connect(module, SIGNAL(windowTitleChanged(QString)),
this, SLOT(onModuleWindowTitleChanged()),
Qt::UniqueConnection);
connect(module, SIGNAL(windowModifyChanged(bool)),
this, SLOT(onModuleWindowTitleChanged()),
Qt::UniqueConnection);
}
if (!mUrlAddressWidgetMap.contains(url)) {
mUrlAddressWidgetMap.insert(url, module);
mUrlAddressConfigMap.insert(url, iConfig.toMap());
}
QVariantMap config;
config.insert("title", module->title());
config.insert("icon", module->iconName());
mStackedWidget->addWidget(module);
mStackedWidget->setCurrentWidget(module);
updateTabBar(url, config);
}
void SysMainWindow::updateTabBar(const QString &iUrl, const QVariant &iConfigVar)
{
disconnect(mTabBar, 0, 0, 0);
bool exists = false;
int count = mTabBar->count();
for (int i = 0; i < count; ++i) {
if (iUrl == mTabBar->tabData(i).toString()) {
mTabBar->setCurrentIndex(i);
exists = true;
break;
}
}
if (!exists) {
QVariantMap configMap = iConfigVar.toMap();
QString iconStr = configMap.value("icon").toString();
int index = mTabBar->addTab(TRES->icon(iconStr, "TAB", "DARK"),
configMap.value("title").toString());
mTabBar->setTabData(index, iUrl);
mTabBar->setCurrentIndex(index);
}
connect(mTabBar, SIGNAL(currentChanged(int)), this, SLOT(onTabBarCurrentChanged(int)));
connect(mTabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(onTabBarCloseRequested(int)));
}
void SysMainWindow::updateTabBarWhenRemoveTab(int index)
{
if (index == mTabBar->currentIndex()) {
int previous = index - 1;
if (previous >= 0) {
QString previousUrl = mTabBar->tabData(previous).toString();
QWidget *widget = mUrlAddressWidgetMap.value(previousUrl);
if (widget != nullptr) {
mStackedWidget->setCurrentWidget(widget);
}
} else {
int next = index + 1;
if (next < mTabBar->count()) {
QString nextUrl = mTabBar->tabData(next).toString();
QWidget *widget = mUrlAddressWidgetMap.value(nextUrl);
if (widget != nullptr) {
mStackedWidget->setCurrentWidget(widget);
}
} else {
}
}
}
mTabBar->removeTab(index);
update();
}
void SysMainWindow::updatePopupWidget(TopQuickButton *iBtn, const QVariantMap &iConfigVar, RouteType type)
{
if (iBtn == nullptr) {
return;
}
const QString lang = APP->language();
QString title = iConfigVar.value("title_"+lang).toString();
if (title.isEmpty()) {
title = iConfigVar.value("title").toString();
}
mPanelMenuTitleLabel->setText(title);
if (type == RouteType::Menu) {
if (mNaviDataMap[iBtn]->menuData.isNull()) {
QVariantList data = iConfigVar.value("items").toList();
QString status = config("navi_status_without_permission").toString();
if (status == "disable" || status == "hide") {
insertStatusInfo(data);
}
buildPanelMenuData(data);
mNaviDataMap[iBtn]->menuData = data;
mPanelMenu->setItemList(data);
} else {
mPanelMenu->setItemList(mNaviDataMap[iBtn]->menuData);
}
mModuleBarStackedWidget->setCurrentWidget(mPanelMenu);
} else if (type == RouteType::ModuleBar) {
QString url = iConfigVar.value("url_address").toString().trimmed().toUpper();
TopClassAbs *module = nullptr;
if (mModuleBarUrlAddressMap.contains(url)) {
module = mModuleBarUrlAddressMap[url];
} else {
module = APP->openModule(url);
}
if (module != nullptr) {
mModuleBarUrlAddressMap[url] = module;
mModuleBarStackedWidget->addWidget(module);
mModuleBarStackedWidget->setCurrentWidget(module);
}
}
}
void SysMainWindow::movePanelMenuWidget()
{
if (mPopupWidget != nullptr && (!mIsPinned)) {
auto geometry = this->geometry();
QRect rect(geometry.x() + mNaviToolBar->width(),
geometry.y(),
mPopupWidget->width(),
geometry.height());
if (!this->isMaximized()) {
auto frameGeometry = this->frameGeometry();
rect.setX(frameGeometry.x() + mNaviToolBar->width());
rect.setY(frameGeometry.y() + 1);
rect.setHeight(frameGeometry.height() - 3);
}
mPopupWidget->setGeometry(rect);
}
}
void SysMainWindow::initSysTrayIcon()
{
mHidetoTrayRegName = APP->productCategory();
if (mHidetoTrayRegName.isEmpty()) {
mHidetoTrayRegName = "TopLinker/SysMainWindow/HidetoSysTray";
} else {
mHidetoTrayRegName = "TopLinker/" + mHidetoTrayRegName + "/HidetoSysTray";
}
mSysTrayTitle = config("sys_tray_product_name").toString();
if (mSysTrayTitle.isEmpty()) {
mSysTrayTitle = config("sys_title").toString();
}
mHidetoSysTrayFlag = true;
if (APP->getSetting(mHidetoTrayRegName).toString().isEmpty()) {
mHidetoSysTrayFlag = false;
}
mHidetoSysTray = APP->getSetting(mHidetoTrayRegName, false).toBool();
mSysTrayIconShow = config("sys_tray_icon_show", false).toBool();
if (mSysTrayIconShow == false) {
mHidetoSysTrayFlag = false;
}
mSysTrayIcon = new QSystemTrayIcon(this);
QString sysIcon = config("sys_icon").toString();
if (sysIcon.isEmpty()) {
sysIcon = "topmes.#0162fe";
} else if (sysIcon.contains(".")) {
sysIcon = sysIcon.split(".").first() + ".#0162fe";
} else {
sysIcon += ".#0162fe";
}
mSysTrayIcon->setIcon(TRES->colorIcon(sysIcon));
mSysTrayIcon->setToolTip(this->title());
QMenu *trayMenu = new QMenu;
trayMenu->setStyleSheet("QMenu::item{padding-top: 0px;}");
trayMenu->addAction(ttr("Open") + mSysTrayTitle, [this]{
this->show();
this->activateWindow();
});
trayMenu->addAction(TRES->colorIcon("power-off.#e54545"),ttr("Quit"), [this]{
mSysTrayIcon->deleteLater();
QApplication::exit();
});
mSysTrayIcon->setContextMenu(trayMenu);
connect(mSysTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
this, SLOT(onSysTrayIconActived(QSystemTrayIcon::ActivationReason)));
if (mSysTrayIconShow) {
mSysTrayIcon->show();
} else {
mSysTrayIcon->hide();
}
}
SysMainWindow::RouteType SysMainWindow::str2RouteType(const QString &iTypeStr)
{
if (iTypeStr == "module") {
return RouteType::Module;
} else if (iTypeStr == "menu") {
return RouteType::Menu;
} else if (iTypeStr == "module_bar") {
return RouteType::ModuleBar;
} else if (iTypeStr == "action") {
return RouteType::Action;
} else if (iTypeStr == "url") {
return RouteType::Url;
} else {
return RouteType::None;
}
}
void SysMainWindow::routeUrl(const QString &iUrlAddressStr, const QVariantMap &iConfigVar)
{
if (!iUrlAddressStr.isEmpty()) {
if (mUrlAddressWidgetMap.contains(iUrlAddressStr)) {
QWidget *widget = mUrlAddressWidgetMap.value(iUrlAddressStr);
TWebView *webview = qobject_cast<TWebView *>(widget);
if (webview != nullptr) {
mStackedWidget->setCurrentWidget(widget);
updateTabBar(iUrlAddressStr);
webview->navigate(iUrlAddressStr);
}
} else {
TWebView *webview = new TWebView(this);
webview->setAttribute(Qt::WA_DeleteOnClose);
mUrlAddressWidgetMap.insert(iUrlAddressStr, webview);
mUrlAddressConfigMap.insert(iUrlAddressStr, iConfigVar);
QString title = iConfigVar.value("title_"+APP->language()).toString();
if (title.isEmpty()) {
title = iConfigVar.value("title").toString();
}
QVariantMap tmp;
tmp.insert("title", title);
tmp.insert("icon", iConfigVar.value("icon"));
mStackedWidget->addWidget(webview);
mStackedWidget->setCurrentWidget(webview);
updateTabBar(iUrlAddressStr, tmp);
webview->navigate(iUrlAddressStr);
}
}
}
void SysMainWindow::routeModule(const QString &iUrlAddressStr, const QVariantMap &iConfigVar)
{
if (mIsRoutingModule) {
return;
}
mIsRoutingModule = true;
if (!iUrlAddressStr.isEmpty()) {
if (mUrlAddressWidgetMap.contains(iUrlAddressStr)) {
QWidget *widget = mUrlAddressWidgetMap.value(iUrlAddressStr);
if (widget != nullptr) {
mStackedWidget->setCurrentWidget(widget);
updateTabBar(iUrlAddressStr);
}
} else {
openModule(iUrlAddressStr, iConfigVar);
}
}
mIsRoutingModule = false;
}
void SysMainWindow::routeAction(const QString &iUrlAddressStr)
{
callAction(iUrlAddressStr);
}
void SysMainWindow::route(TopQuickButton *iBtn, NaviData *iData, const QVariantMap &iConfigVar)
{
RouteType type = iData->routeType;
if (type == RouteType::Module) {
mPopupWidget->setVisible(false);
QString urlAddress = iConfigVar.value("url_address").toString().trimmed().toUpper();
routeModule(urlAddress, iConfigVar);
} else if (type == RouteType::Menu || type == RouteType::ModuleBar) {
movePanelMenuWidget();
if (mCurrentActiveQuickBtn == iBtn) {
mPopupWidget->setVisible(!mPopupWidget->isVisible());
} else {
if (!mPopupWidget->isVisible()) {
mPopupWidget->setVisible(true);
}
}
updatePopupWidget(iBtn, iConfigVar, type);
} else if (type == RouteType::Action) {
QString urlAddress = iConfigVar.value("url_address").toString().trimmed();
routeAction(urlAddress);
} else if (type == RouteType::Url) {
mPopupWidget->setVisible(false);
QString urlAddress = iConfigVar.value("url_address").toString().trimmed();
routeUrl(urlAddress, iConfigVar);
} else {
return;
}
if (mCurrentActiveQuickBtn != nullptr) {
mCurrentActiveQuickBtn->setActived(false);
}
iBtn->setActived(true);
mCurrentActiveQuickBtn = iBtn;
}
void SysMainWindow::insertStatusInfo(QVariantList &oMenuDataLst)
{
QVariantMap urlMap = getUrlAddressInfo(oMenuDataLst);
QStringList moduleList = urlMap["module"].toStringList();
QStringList actionList = urlMap["action"].toStringList();
TSqlQueryV2 localSqlQuery(T_SQLCNT_POOL->getSqlDatabase(LOCALDB_CONNECTION_NAME));
QVariantMap modulePermission;
QVariantMap actionPermission;
if (moduleList.count() > 0) {
TSqlSelectorV2 selector;
selector.setTable("sys_setting_module");
selector.setField("module_name,conf");
selector.addWhere("product_category", APP->productCategory());
selector.addWhere("module_name", moduleList);
selector.setFieldFormat("conf", "json");
QVariantList moduleInfoList = localSqlQuery.selectArrayMap(selector);
for (QVariant val: moduleInfoList) {
QVariantMap dataMap = val.toMap();
modulePermission[dataMap["module_name"].toString().toLower()] = dataMap["conf"].toMap()["sys_open_right"];
}
}
if (actionList.count() > 0) {
TSqlSelectorV2 selector;
selector.setTable("sys_setting_action");
selector.setField("action_name,attr");
selector.addWhere("module_name", moduleName());
selector.addWhere("action_name", actionList);
selector.setFieldFormat("attr", "json");
QVariantList actionInfoList = localSqlQuery.selectArrayMap(selector);
for (QVariant val: actionInfoList) {
QVariantMap dataMap = val.toMap();
actionPermission[dataMap["action_name"].toString().toLower()] = dataMap["attr"].toMap()["PERMISSION"];
}
}
insertStatusInfo(oMenuDataLst, modulePermission, actionPermission);
}
void SysMainWindow::insertStatusInfo(QVariantList &oMenuDataLst, const QVariantMap &iModulePermission, const QVariantMap &iActionPermission)
{
QString status = config("navi_status_without_permission").toString();
if (status.isEmpty() || status == "show") {
return;
}
for (QVariant & i : oMenuDataLst) {
QVariantMap dataMap = i.toMap();
QString routeType = dataMap["route_type"].toString().trimmed().toLower();
QString url = dataMap["url_address"].toString().trimmed().toLower();
QString permission;
if (routeType == "module") {
permission = iModulePermission[url].toString();
} else if (routeType == "action") {
permission = iActionPermission[url].toString();
}
if (!permission.isEmpty()) {
if (!APP->hasRight(permission)) {
dataMap["status"] = status;
}
}
QVariantList items = dataMap["items"].toList();
if (items.count() > 0) {
insertStatusInfo(items, iModulePermission, iActionPermission);
dataMap["items"] = items;
}
i = dataMap;
}
}
QVariantMap SysMainWindow::getUrlAddressInfo(const QVariantList &iMenuDataLst)
{
QStringList moduleList;
QStringList actionList;
for (QVariant i : iMenuDataLst) {
QVariantMap dataMap = i.toMap();
QVariantList items = dataMap["items"].toList();
if (items.count() > 0) {
QVariantMap urlInfo = getUrlAddressInfo(items);
moduleList.append(urlInfo["module"].toStringList());
actionList.append(urlInfo["action"].toStringList());
}
QString routeType = dataMap["route_type"].toString();
if (routeType == "module") {
moduleList.append(dataMap["url_address"].toString().trimmed().toUpper());
} else if (routeType == "action") {
actionList.append(dataMap["url_address"].toString().trimmed());
}
}
return QVariantMap{{"module", moduleList},{"action",actionList}};
}
bool SysMainWindow::nativeEvent(const QByteArray &iEventTypeLst,
void *iMsgPtr,
long *oResultI64Ptr)
{
#ifdef Q_OS_WIN
if (mWindowTitleBar != nullptr) {
MSG* msg = static_cast<MSG *>(iMsgPtr);
if (mWindowTitleBar->winEvent(msg, oResultI64Ptr)) {
return true;
}
}
#endif
return QMainWindow::nativeEvent(iEventTypeLst, iMsgPtr, oResultI64Ptr);
}
void SysMainWindow::closeEvent(QCloseEvent *iEvent)
{
if (!mSysTrayIconShow) {
if (TMessageBox::msgbox(this, ttr("Are you sure to quit?"), "", "Question", ttr("Quit"),
QStringList() << ttr("Quit") + ":Yes:Accept:Warn"
<< ttr("Cancel") + ":Cancel:Reject:Normal",
"Cancel") == "Yes") {
iEvent->accept();
} else {
iEvent->ignore();
}
return;
}
if (mHidetoSysTrayFlag) {
if (mHidetoSysTray) {
this->hide();
iEvent->ignore();
} else {
iEvent->accept();
}
} else {
this->showCloseDialog();
iEvent->ignore();
}
}
void SysMainWindow::onOperateTimer()
{
QDateTime *nowTime = new QDateTime(QDateTime::currentDateTime());
mNowWindowHideState = this->isHidden();
if (mPreWindowHideState != mNowWindowHideState) {
mPreOperateTime = nowTime;
mPreWindowHideState = mNowWindowHideState;
}
mNowWindowActiveState = this->isActiveWindow();
//若窗体为当前窗体,则根据鼠标位置来判断是否操作
if (mNowWindowActiveState) {
mNowMousePos = QCursor::pos();
if (mPreMousePos != mNowMousePos) {
mPreOperateTime = nowTime;
mPreMousePos = mNowMousePos;
}
}
if (mPreWindowActiveState != mNowWindowActiveState) {
mPreOperateTime = nowTime;
mPreWindowActiveState = mNowWindowActiveState;
}
QVariantMap timeOutMap = config("operate_out_time").toMap();
int hour = timeOutMap.value("hour").toInt();
int minute = timeOutMap.value("minute").toInt();
int second = timeOutMap.value("second").toInt();
int allSec = hour*60*60 + minute*60 + second;
if (qAbs(nowTime->secsTo(*mPreOperateTime)) >= allSec) {
mPreOperateTime = nowTime;
if ("Yes" == TMessageBox::warning(this, ttr("Operate TimeOut!"), ttr("Operate TimeOut!Please restart the application to update!")
,"",QStringList() << ttr("Confirm")+":Yes:Yes:Primary" << ttr("Cancel")+":Cancel:Cancel:Normal")) {
this->close();
};
}
}
void SysMainWindow::onQuickBtnClicked()
{
if (TopQuickButton *btn = qobject_cast<TopQuickButton *>(sender())) {
if (mNaviDataMap.contains(mCurrentActiveQuickBtn) && (mNaviDataMap[mCurrentActiveQuickBtn]->routeType == RouteType::Menu)) {
mNaviDataMap[mCurrentActiveQuickBtn]->menuData = mPanelMenu->itemList();
}
QVariantMap config = btn->data().toMap();
if (mNaviDataMap.contains(btn)) {
NaviData *productData = mNaviDataMap.value(btn);
route(btn, productData, config);
} else {
NaviData *productData = new NaviData;
productData->routeType = str2RouteType(config.value("route_type").toString());
mNaviDataMap.insert(btn, productData);
route(btn, productData, config);
}
}
}
void SysMainWindow::onTabBarCurrentChanged(int iIndexInt)
{
QString url = mTabBar->tabData(iIndexInt).toString();
QWidget *widget = mUrlAddressWidgetMap.value(url);
if (widget != nullptr) {
mStackedWidget->setCurrentWidget(widget);
}
}
void SysMainWindow::onTabBarCloseRequested(int iIndexInt)
{
QString url = mTabBar->tabData(iIndexInt).toString();
QWidget *widget = mUrlAddressWidgetMap.value(url);
if (widget != nullptr) {
if (widget->close()) {
mUrlAddressWidgetMap.remove(url);
mUrlAddressConfigMap.remove(url);
updateTabBarWhenRemoveTab(iIndexInt);
}
}
}
void SysMainWindow::onNaviButtonClicked()
{
if (TPushButton *btn = qobject_cast<TPushButton *>(sender())) {
openModule(btn->data().toMap().value("urlAddress").toString(), btn->data());
}
}
void SysMainWindow::onPinButtonClicked()
{
setIsPinned(!mIsPinned);
}
void SysMainWindow::onPanelMenuClicked(const QVariant &iDataVar)
{
QVariantMap dataMap = iDataVar.toMap();
dataMap.insert("title", dataMap.value("text"));
QVariantMap userData = dataMap.value("user_data").toMap();
QString routeTypeStr = userData.value("route_type").toString();
RouteType routeType = str2RouteType(routeTypeStr);
QString urlAddress = userData.value("url_address").toString();
bool routeSuccessBol = false;
if (routeType == RouteType::Module) {
routeSuccessBol = true;
routeModule(urlAddress, dataMap);
} else if (routeType == RouteType::Action) {
routeSuccessBol = true;
routeAction(urlAddress);
} else if(routeType == RouteType::Url) {
routeSuccessBol = true;
routeUrl(urlAddress, dataMap);
}
if (!mIsPinned && routeSuccessBol) {
mPopupWidget->setVisible(false);
}
}
void SysMainWindow::onNotification(const QString &iKeyStr, const QVariant &iDataVar, const QString &iUuid)
{
Q_UNUSED(iUuid);
if (qobject_cast<TopCore *>(sender()) != nullptr) {
if (iKeyStr == A_MESSAGECONTROLLER_SHOWOK
|| iKeyStr == A_MESSAGECONTROLLER_SHOWWARN
|| iKeyStr == A_MESSAGECONTROLLER_SHOWINFO) {
QString msgText = iDataVar.toMap().value("text").toString();
msgText = fontMetrics().elidedText(msgText, Qt::ElideMiddle, mMessageLabel->width());
mMessageLabel->setText(msgText);
QString color;
if (iKeyStr == A_MESSAGECONTROLLER_SHOWOK) {
color = "OK";
} else if (iKeyStr == A_MESSAGECONTROLLER_SHOWWARN) {
color = "WARN";
} else if (iKeyStr == A_MESSAGECONTROLLER_SHOWINFO) {
color = "INFO";
}
mMessageLabel->setProperty("SS_COLOR", color);
mMessageLabel->setStyleSheet(".Q{}");
mMessageAnimation->setDuration(3000);
mMessageAnimation->setStartValue(QPoint(0, TTHEME_DP(40)));
mMessageAnimation->setEndValue(QPoint(0, -mMessageLabel->height()));
mMessageAnimation->start();
} else if (iKeyStr == A_MESSAGECONTROLLER_SHOWERROR
|| iKeyStr == A_MESSAGECONTROLLER_LOADING
|| iKeyStr == A_MESSAGECONTROLLER_UNLOADING) {
if (mMessageController != nullptr) {
mMessageController->onNotifaction(iKeyStr, iDataVar);
}
} else if (iKeyStr == A_CORE_PUSH_MODULE_TO_DESKTOP) {
if (iDataVar.type() == QVariant::Map) {
QVariantMap param = iDataVar.toMap();
TopClassAbs *module = APP->getModule(param.value("moduleName").toString(),
param.value("uid").toString());
if (module != nullptr) {
const QString url = QString("%1/%2").arg(module->moduleName().toUpper()).arg(module->uid());
QVariantMap config;
config.insert("title", module->windowTitle());
config.insert("icon", module->iconName());
config.insert("url_address", url);
if (!mUrlAddressWidgetMap.contains(url)) {
mUrlAddressWidgetMap.insert(url, module);
mUrlAddressConfigMap.insert(url, config);
}
mStackedWidget->addWidget(module);
mStackedWidget->setCurrentWidget(module);
updateTabBar(url, config);
}
}
} else if (iKeyStr == A_CORE_OPEN_MODULE_TO_DESKTOP) {
TopClassAbs *module = nullptr;
if (iDataVar.type() == QVariant::Map) {
QVariantMap param = iDataVar.toMap();
module = APP->openModule(QString("%1/%2")
.arg(param.value("moduleName").toString())
.arg(param.value("uid").toString()));
} else if (iDataVar.type() == QVariant::String) {
module = APP->openModule(iDataVar.toString());
}
if (module != nullptr) {
connect(module, SIGNAL(windowTitleChanged(QString)), this, SLOT(onModuleWindowTitleChanged()), Qt::UniqueConnection);
connect(module, SIGNAL(windowModifyChanged(bool)), this, SLOT(onModuleWindowTitleChanged()), Qt::UniqueConnection);
const QString url = QString("%1%2")
.arg(module->moduleName())
.arg(module->uid().isEmpty() ? "" : ("/"+module->uid()));
QVariantMap config;
if (module->uid().isEmpty()) {
config.insert("title", module->title());
} else {
config.insert("title", module->windowTitle());
}
config.insert("icon", module->iconName());
config.insert("url_address", url);
if (!mUrlAddressWidgetMap.contains(url)) {
mUrlAddressWidgetMap.insert(url, module);
mUrlAddressConfigMap.insert(url, config);
mStackedWidget->addWidget(module);
}
mStackedWidget->setCurrentWidget(module);
updateTabBar(url, config);
}
} else if (iKeyStr == "mainwindow_show_other") {
QString modulePath = iDataVar.toString().trimmed();
QRegularExpression re("^(?<path>[^/]+/?[^,]*).*$");
QRegularExpressionMatch match = re.match(modulePath);
if (match.hasMatch()) {
modulePath = match.captured("path");
}
for (int i = 0; i < mTabBar->count(); ++i) {
if (mTabBar->tabData(i).toString().toUpper() == modulePath.toUpper()) {
mTabBar->setCurrentIndex(i);
break;
}
}
} else if (iKeyStr == "mainwindow_close_tab") {
QString tmpUrl;
QString tmpUid;
if (iDataVar.type() == QVariant::Map) {
QVariantMap param = iDataVar.toMap();
tmpUrl = param.value("moduleName").toString();
tmpUid = param.value("uid").toString();
tmpUrl = QString("%1%2").arg(tmpUrl).arg(tmpUid.isEmpty() ? "" : ("/"+tmpUid));
} else if (iDataVar.type() == QVariant::String) {
tmpUrl = iDataVar.toString();
}
if (!tmpUrl.isEmpty()) {
int tmpIndex = -1;
for (int i = 0; i < mTabBar->count(); ++i) {
if (mTabBar->tabData(i).toString().toUpper() == tmpUrl.toUpper()) {
tmpIndex = i;
break;
}
}
QWidget *widget = mUrlAddressWidgetMap.value(tmpUrl);
if (widget == nullptr) {
tmpUrl = tmpUrl.toUpper();
widget = mUrlAddressWidgetMap.value(tmpUrl);
}
if (widget != nullptr) {
if (widget->close()) {
mUrlAddressWidgetMap.remove(tmpUrl);
mUrlAddressConfigMap.remove(tmpUrl);
updateTabBarWhenRemoveTab(tmpIndex);
}
}
}
}
}
}
void SysMainWindow::onModuleWindowTitleChanged()
{
if (TopClassAbs *module = qobject_cast<TopClassAbs*>(sender())) {
QString url = QString("%1/%2").arg(module->moduleName().toUpper()).arg(module->uid());
int count = mTabBar->count();
for (int i = 0; i < count; ++i) {
if (url == mTabBar->tabData(i).toString()) {
mTabBar->setTabText(i, module->title() + (module->isDataModified() ? "*" : ""));
}
}
}
}
void SysMainWindow::onSysTrayIconActived(QSystemTrayIcon::ActivationReason reason)
{
if (QSystemTrayIcon::Trigger == reason) {
this->show();
this->activateWindow();
}
}
void SysMainWindow::initIsPinned()
{
setIsPinned(false, true);
}
void SysMainWindow::buildPanelMenuData(QVariantList &oMenuDataLst)
{
const QString lang = APP->language();
for (QVariant & i : oMenuDataLst) {
QVariantMap imap = i.toMap();
QVariantMap tmp;
QString title = imap.value("title_"+lang).toString();
if (title.isEmpty()) {
title = imap.value("title").toString();
}
bool isExpanded = false;
if (imap.contains("is_expanded")) {
isExpanded = imap.value("is_expanded").toBool();
}
tmp.insert("text", title);
tmp.insert("icon", imap.value("icon"));
tmp.insert("status", imap.value("status"));
tmp.insert("unfold", isExpanded);
QVariantMap userData;
userData.insert("url_address", imap.value("url_address"));
userData.insert("route_type", imap.value("route_type"));
tmp.insert("user_data", userData);
if (imap.contains("items")) {
QVariantList items = imap.value("items").toList();
buildPanelMenuData(items);
tmp.insert("child_list", items);
}
i = tmp;
}
}
QVariantMap SysMainWindow::searchDefaultRoute(const QVariantList &iNaviLst)
{
for (QVariant i : iNaviLst) {
QVariantMap imap = i.toMap();
if (imap.contains("default_route")) {
QVariant defaultRouteVar = imap.value("default_route");
if ((defaultRouteVar.type() == QVariant::Bool) && (defaultRouteVar.toBool())) {
return imap;
}
}
if (imap.contains("items")) {
QVariantMap ret = searchDefaultRoute(imap.value("items").toList());
if (!ret.isEmpty()) {
return ret;
}
}
}
return QVariantMap();
}
void SysMainWindow::showCloseDialog()
{
TDialog *closeDlg = new TDialog(this);
TFramelessWindowBar *winTitleBar = closeDlg->windowTitleBar();
winTitleBar->setAutoHideFlags(TFramelessWindowBar::AutoHideHint_All);
winTitleBar->setFixedHeight(TTHEME_DP(28));
QHBoxLayout *titleVLayout = new QHBoxLayout(winTitleBar);
titleVLayout->setSpacing(0);
titleVLayout->setMargin(0);
titleVLayout->addSpacing(TTHEME_DP(8));
titleVLayout->addWidget(winTitleBar->windowTitleLabel());
titleVLayout->addStretch(1);
titleVLayout->addWidget(winTitleBar->windowCloseButton());
closeDlg->setWindowTitle(ttr("Quit"));
QVBoxLayout *vlayout = new QVBoxLayout(closeDlg);
vlayout->setContentsMargins(10, 22, 10, 18);
vlayout->setSpacing(12);
QLabel *textLabel = new QLabel;
textLabel->setProperty("SS_FONT", "16");
textLabel->setProperty("SS_COLOR", QVariant("WARN"));
textLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
textLabel->setWordWrap(true);
textLabel->setText(ttr("Are you sure to quit?"));
vlayout->addWidget(textLabel);
vlayout->addStretch();
TRadioBox *radioBox = new TRadioBox;
QVariantList itemList;
QVariantMap itemHide;
itemHide.insert("name", "hide");
itemHide.insert("text", ttr("Hide to system tray"));
QVariantMap itemQuit;
itemQuit.insert("name", "quit");
itemQuit.insert("text", ttr("Quit"));
itemList.append(itemHide);
itemList.append(itemQuit);
radioBox->setItemList(itemList);
if (mHidetoSysTray) {
radioBox->setCurrentName("hide");
} else {
radioBox->setCurrentName("quit");
}
TCheckBox *checkbox = new TCheckBox;
checkbox->setText(ttr("No longer remind"));
QHBoxLayout *hlayout = new QHBoxLayout;
hlayout->addStretch();
hlayout->addWidget(radioBox);
hlayout->addStretch();
hlayout->addWidget(checkbox);
hlayout->addStretch();
vlayout->addLayout(hlayout);
vlayout->addStretch();
QWidget *line = new QWidget;
line->setFixedHeight(1);
line->setStyleSheet(QString("background-color:%1;").arg(TTHEME->value("COLOR_LIGHT_BORDER").toString()));
vlayout->addWidget(line);
TDialogButtonBox *buttonBox = new TDialogButtonBox;
buttonBox->setContentsMargins(1, 1, 1, 1);
buttonBox->findChild<QHBoxLayout*>()->setSpacing(16);
buttonBox->setCenterButtons(true);
buttonBox->setButtons(QStringList() << ttr("Ok")+":Ok:Accept:Warn"<<ttr("Cancel")+":Cancel:Reject:Normal");
vlayout->addWidget(buttonBox);
connect(buttonBox, SIGNAL(rejected()), closeDlg, SLOT(reject()));
connect(buttonBox, SIGNAL(accepted()), closeDlg, SLOT(accept()));
closeDlg->setFixedSize(420, 210);
int ret = closeDlg->exec();
if (radioBox->currentName() == "hide") {
mHidetoSysTray = true;
} else {
mHidetoSysTray = false;
}
if (checkbox->isChecked()) {
mHidetoSysTrayFlag = true;
APP->saveSetting(mHidetoTrayRegName, QVariant::fromValue(mHidetoSysTray));
}
if (ret == 1) {
if (radioBox->currentName() == "hide") {
this->hide();
} else {
mSysTrayIcon->deleteLater();
QApplication::exit();
}
}
}
void SysMainWindow::showPasswordModificationDialog()
{
TopLoginPwdRestDialog dialog;
dialog.exec();
}
void SysMainWindow::showAboutDialog()
{
TopAboutUsDialog dialog;
const QString lang = APP->language();
QVariantMap aboutCfg = config("about_us").toMap();
QString title = aboutCfg.value("title_"+lang).toString();
if (title.isEmpty()) title = aboutCfg.value("title").toString();
if (title.isEmpty()) {
title = this->windowTitle();
if (!config("product_version").toString().isEmpty()) {
title += config("product_version").toString();
}
}
dialog.setWindowTitle(title);
QString copyright = aboutCfg.value("copyright_" + lang).toString();
if (copyright.isEmpty()) {
copyright = aboutCfg.value("copyright").toString();
}
QString lawdesc = aboutCfg.value("lawdesc_" + lang).toString();
if (lawdesc.isEmpty()) {
lawdesc = aboutCfg.value("lawdesc").toString();
}
dialog.exec();
}
void SysMainWindow::openModuleUpgrade()
{
#ifdef Q_OS_WIN
const QString exeFileStr = APP->appBinPath() + "/TopModuleUpgrade.exe";
const QString exeFileStrNew = APP->appBinPath() + "/PackageUploaderPlus.exe";
#else
const QString exeFileStr = APP->appBinPath() + "/TopModuleUpgrade";
const QString exeFileStrNew = APP->appBinPath() + "/PackageUploaderPlus";
#endif
QFileInfo finfo(exeFileStrNew);
if (finfo.exists()) {
QProcess::startDetached(exeFileStrNew, QStringList()<<"-l"<<APP->language(), APP->appBinPath());
} else {
QDesktopServices::openUrl(QUrl::fromLocalFile(exeFileStr));
}
}
StretchFrame::StretchFrame(QWidget *iParent)
:QFrame(iParent)
{
setAttribute(Qt::WA_Hover, true);
setMouseTracking(true);
mStretchWidgetWidth = TTHEME_DP(5);
mLayout = new QHBoxLayout(this);
mLayout->setMargin(0);
mLayout->setSpacing(0);
mStretchWidget = new QFrame(this);
mStretchWidget->setFixedWidth(mStretchWidgetWidth);
mStretchWidget->setStyleSheet("background-color: rgba(0,0,0,0)");
}
void StretchFrame::setWidget(QWidget *iWidget)
{
if (mWidget != nullptr) {
delete mWidget;
}
mWidget = iWidget;
mLayout->insertWidget(0, mWidget);
}
void StretchFrame::setStretchWidgetVisible(bool iVisible)
{
mStretchWidget->setVisible(iVisible);
}
void StretchFrame::mousePressEvent(QMouseEvent *event)
{
if (this->isTopLevel() && event->button() == Qt::LeftButton){
mDragPosition = event->globalPos() - this->frameGeometry().topLeft();
mLeftButtonPressed = true;
}
QFrame::mousePressEvent(event);
}
void StretchFrame::mouseReleaseEvent(QMouseEvent *)
{
mLeftButtonPressed = false;
}
bool StretchFrame::event(QEvent *event)
{
if (event->type() == QEvent::HoverMove) {
QHoverEvent *hoverEvent = static_cast<QHoverEvent *>(event);
QPoint pos = hoverEvent->pos();
QPoint gp = mapToGlobal(pos);
if (hoverEvent && !mLeftButtonPressed && (windowFlags() & Qt::Popup)) {
QPoint br = QPoint(this->width(), this->height());
int x = pos.x();
bool widthReizable = (this->minimumWidth() != this->maximumWidth());
if (x < br.x() && x >= br.x() - mStretchWidgetWidth && widthReizable) {
if (cursor().shape() != Qt::SizeHorCursor) {
QApplication::setOverrideCursor(QCursor(Qt::SizeHorCursor));
setCursor(QCursor(Qt::SizeHorCursor));
}
} else if (cursor().shape() != Qt::ArrowCursor) {
QApplication::restoreOverrideCursor();
setCursor(QCursor(Qt::ArrowCursor));
}
} else if (mLeftButtonPressed && (cursor().shape() == Qt::SizeHorCursor)) {
QRect rect = this->rect();
QPoint tl = mapToGlobal(rect.topLeft()); //top left
QPoint br = mapToGlobal(rect.bottomRight()); //bottom right
QRect rectMove(tl, br);
if (gp.x() - tl.x() > minimumWidth()){
rectMove.setWidth(gp.x() - tl.x());
}
this->setGeometry(rectMove);
}
} else if (event->type() == QEvent::Resize) {
if (mWidget != nullptr) {
qreal width = size().width();
qreal height = size().height();
mWidget->resize(width, height);
}
const QRect rect = geometry();
mStretchWidget->setGeometry((rect.width() - mStretchWidgetWidth),
0, mStretchWidgetWidth, rect.height());
mStretchWidget->raise();
} else if (event->type() == QEvent::Hide) {
mLeftButtonPressed = false;
QApplication::restoreOverrideCursor();
} else if (event->type() == QEvent::Show) {
setFocus();
}
return QFrame::event(event);
}
void StretchFrame::showEvent(QShowEvent *event)
{
QFrame::showEvent(event);
activateWindow();
}
StackedWidget::StackedWidget(QWidget *iParent)
: QStackedWidget(iParent)
{
}
void StackedWidget::setBackground(const QString &iBackground)
{
mBackground = iBackground;
}
void StackedWidget::paintEvent(QPaintEvent *iEvent)
{
Q_UNUSED(iEvent)
if (!mBackground.isEmpty()) {
QPainter p(this);
p.drawPixmap(this->rect(), QPixmap(mBackground));
}
}
#ifndef SYSMAINWINDOW_H
#define SYSMAINWINDOW_H
#include <QStackedWidget>
#include <topcore/topclassabs.h>
#include <QSystemTrayIcon>
class QHBoxLayout;
class QLabel;
class QPropertyAnimation;
class QStackedWidget;
class QTabBar;
class QDateTime;
class QVBoxLayout;
class TFramelessWindowBar;
class TPanelMenu;
class TopMessageController;
class TopQuickToolBar;
class TopQuickButton;
class TToolButton;
class QSplitter;
struct NaviData;
class StretchFrame: public QFrame {
Q_OBJECT
public:
StretchFrame(QWidget* iParent = nullptr);
void setWidget(QWidget *iWidget);
void setStretchWidgetVisible(bool iVisible);
protected:
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *);
bool event(QEvent *event);
void showEvent(QShowEvent *event);
private:
bool mLeftButtonPressed = false;
QPoint mDragPosition;
qreal mStretchWidgetWidth = 1;
bool mMouseAnchor = false;
QWidget *mWidget = nullptr;
QFrame *mStretchWidget = nullptr;
QHBoxLayout *mLayout = nullptr;
};
class StackedWidget : public QStackedWidget {
Q_OBJECT
public:
StackedWidget(QWidget *iParent = nullptr);
void setBackground(const QString &iBackground);
protected:
void paintEvent(QPaintEvent *iEvent);
private:
QString mBackground;
};
class SysMainWindow final : public TopClassAbs
{
Q_OBJECT
public:
enum class RouteType {
None,
Module,
Menu,
Action,
Url,
ModuleBar
};
public:
explicit SysMainWindow(const QString &iModuleNameStr = QString(""),
const QVariantMap &iUrlPars = QVariantMap(),
QWidget *iParent = nullptr);
~SysMainWindow();
public slots:
void openModule(const QString &iUrl, const QVariant &iConfig = QVariant());
void showPasswordModificationDialog();
void showAboutDialog();
void openModuleUpgrade();
void setIsPinned(bool iIsPinned, bool iForce = false);
bool hide2SystemTrayState();
void saveHide2SystemTrayState(bool iState);
bool isSystemTrayIconShow();
protected:
bool nativeEvent(const QByteArray &iEventTypeLst,
void *iMsgPtr,
long *oResultI64Ptr) override;
void closeEvent(QCloseEvent *iEvent) override;
private slots:
void onOperateTimer();
void onQuickBtnClicked();
void onTabBarCurrentChanged(int iIndexInt);
void onTabBarCloseRequested(int iIndexInt);
void onNaviButtonClicked();
void onPinButtonClicked();
void onPanelMenuClicked(const QVariant &iDataVar);
void onNotification(const QString &iKeyStr, const QVariant &iDataVar, const QString &iUuid);
void onModuleWindowTitleChanged();
void onSysTrayIconActived(QSystemTrayIcon::ActivationReason reason);
private:
void initIsPinned();
void initNaviToolBar();
void initMainWidget();
void initDefaultRoute();
void updateTabBar(const QString &iUrl, const QVariant &iConfigVar = QVariant());
void updateTabBarWhenRemoveTab(int iIndexInt);
void updatePopupWidget(TopQuickButton *iBtn, const QVariantMap &iConfigVar, RouteType type);
void movePanelMenuWidget();
void initSysTrayIcon();
RouteType str2RouteType(const QString &iTypeStr);
void routeUrl(const QString &iUrlAddressStr, const QVariantMap &iConfigVar);
void routeModule(const QString &iUrlAddressStr, const QVariantMap &iConfigVar);
void routeAction(const QString &iUrlAddressStr);
void route(TopQuickButton *iBtn, NaviData *iData, const QVariantMap &iConfigVar);
void insertStatusInfo(QVariantList &oMenuDataLst);
void insertStatusInfo(QVariantList &oMenuDataLst, const QVariantMap &iModulePermission, const QVariantMap &iActionPermission);
QVariantMap getUrlAddressInfo(const QVariantList &iMenuDataLst);
void buildPanelMenuData(QVariantList &oMenuDataLst);
QVariantMap searchDefaultRoute(const QVariantList &iNaviLst);
void showCloseDialog();
private:
QDateTime *mPreOperateTime = nullptr;
QPointF mPreMousePos;
QPointF mNowMousePos;
bool mPreWindowHideState = false;
bool mNowWindowHideState = false;
bool mPreWindowActiveState = false;
bool mNowWindowActiveState = false;
QTimer *mOperateTimeOutTimer = nullptr;
TopQuickToolBar *mNaviToolBar = nullptr;
TFramelessWindowBar *mWindowTitleBar = nullptr;
QTabBar *mTabBar = nullptr;
StackedWidget *mStackedWidget = nullptr;
QStackedWidget *mModuleBarStackedWidget = nullptr;
QMap<QString, TopClassAbs *> mModuleBarUrlAddressMap;
QMap<TopQuickButton *, NaviData *> mNaviDataMap;
TopQuickButton *mCurrentActiveQuickBtn = nullptr;
QLabel *mPanelMenuTitleLabel = nullptr;
TToolButton *mPinButton = nullptr;
TPanelMenu *mPanelMenu = nullptr;
StretchFrame *mPopupWidget = nullptr;
QSplitter *mCenterWidget = nullptr;
QWidget *mMainWidget = nullptr;
QHBoxLayout *mMainLayout = nullptr;
QMap<QString, QWidget *> mUrlAddressWidgetMap; // urlAddress:QWidget
QMap<QString, QVariantMap> mUrlAddressConfigMap; // urlAddress:Config
bool mIsPinned = false;
QLabel *mMessageLabel = nullptr;
QPropertyAnimation *mMessageAnimation = nullptr;
TopMessageController *mMessageController = nullptr;
bool mIsRoutingModule = false;
// 托盘图标
QSystemTrayIcon *mSysTrayIcon = nullptr;
bool mSysTrayIconShow = false; // 是否显示托盘图标
bool mHidetoSysTray = false; // 关闭时是否隐藏程序到托盘
bool mHidetoSysTrayFlag = false; // 注册表中是否有mHidetoSysTray标记,是否显示确认弹窗
QString mHidetoTrayRegName;
QString mSysTrayTitle;
};
#endif // SYSMAINWINDOW_H
HEADERS += \
$$PWD/sysmainwindow.h
##$$PWD/sysmainwindow.h \
$$PWD/msysmainwindow.h \
$$PWD/topquickbutton.h \
$$PWD/topquicktoolbar.h
SOURCES += \
$$PWD/sysmainwindow.cpp
##$$PWD/sysmainwindow.cpp \
$$PWD/msysmainwindow.cpp \
$$PWD/topquickbutton.cpp \
$$PWD/topquicktoolbar.cpp
#include "topquickbutton.h"
#include <QLayout>
#include <QMenu>
#include <QPainter>
#include <QPaintEvent>
#include <QVariant>
#include <tbaseutil/tresource.h>
#include <tbaseutil/ttheme.h>
#include <topcore/topclassabs.h>
class TopQuickButtonPrivate
{
Q_DECLARE_PUBLIC(TopQuickButton)
public:
explicit TopQuickButtonPrivate(TopQuickButton *qptr)
: q_ptr(qptr)
{
}
~TopQuickButtonPrivate()
{
}
QString uidStr;
bool modifiedBol = false;
bool closableBol = false;
bool activedBol = false;
bool openedBol = false;
QVariant dataVar;
protected:
TopQuickButton * const q_ptr;
};
TopQuickButton::TopQuickButton(QWidget *parent) :
QToolButton(parent),
d_ptr(new TopQuickButtonPrivate(this))
{
setStyleSheet(QString("TopQuickButton{margin:%1px; border:none; background:#2196F3; border-radius:%2px;color:#FFFFFF;}\n" \
"TopQuickButton:hover{border-radius:%3px}\n" \
"QToolButton::menu-indicator{image:None;}")
.arg(TTHEME_DP(4)).arg(TTHEME_DP(10)).arg(TTHEME_DP(16)));
setFixedSize(QSize(TTHEME_DP(40),TTHEME_DP(40)));
}
TopQuickButton::~TopQuickButton()
{
}
void TopQuickButton::setUid(const QString &iUidStr)
{
Q_D(TopQuickButton);
d->uidStr = iUidStr;
}
QString TopQuickButton::uid() const
{
Q_D(const TopQuickButton);
return d->uidStr;
}
void TopQuickButton::setData(const QVariant &iDataVar)
{
Q_D(TopQuickButton);
d->dataVar = iDataVar;
}
QVariant TopQuickButton::data() const
{
Q_D(const TopQuickButton);
return d->dataVar;
}
void TopQuickButton::setModified(bool iBol)
{
Q_D(TopQuickButton);
if (d->modifiedBol != iBol) {
d->modifiedBol = iBol;
changeStyleSheet();
}
}
bool TopQuickButton::isModified() const
{
Q_D(const TopQuickButton);
return d->modifiedBol;
}
void TopQuickButton::setClosable(bool iBol)
{
Q_D(TopQuickButton);
d->closableBol = iBol;
}
bool TopQuickButton::isClosable() const
{
Q_D(const TopQuickButton);
return d->closableBol;
}
void TopQuickButton::setActived(bool iBol)
{
Q_D(TopQuickButton);
if (d->activedBol != iBol) {
d->activedBol = iBol;
changeStyleSheet();
}
}
bool TopQuickButton::isActived() const
{
Q_D(const TopQuickButton);
return d->activedBol;
}
void TopQuickButton::setOpened(bool iBol)
{
Q_D(TopQuickButton);
if (d->openedBol != iBol) {
d->openedBol = iBol;
changeStyleSheet();
}
}
bool TopQuickButton::isOpened() const
{
Q_D(const TopQuickButton);
return d->openedBol;
}
void TopQuickButton::changeStyleSheet()
{
}
#ifndef TOPQUICKBUTTON_H
#define TOPQUICKBUTTON_H
#include <QToolButton>
#include <QVariant>
#include <QWidget>
class TopClassAbs;
class TopQuickButtonPrivate;
class TopQuickButton : public QToolButton
{
Q_OBJECT
public:
explicit TopQuickButton(QWidget *parent = nullptr);
~TopQuickButton();
public slots:
void setUid(const QString &iUidStr);
QString uid() const;
void setData(const QVariant &iDataVar);
QVariant data() const;
void setModified(bool iBol);
bool isModified() const;
void setClosable(bool iBol);
bool isClosable() const;
void setActived(bool iBol);
bool isActived() const;
void setOpened(bool iBol);
bool isOpened() const;
private slots:
void changeStyleSheet();
protected:
const QScopedPointer<TopQuickButtonPrivate> d_ptr;
private:
Q_DISABLE_COPY(TopQuickButton)
Q_DECLARE_PRIVATE(TopQuickButton)
};
#endif // TOPQUICKBUTTON_H
#include "topquicktoolbar.h"
#include <QActionGroup>
#include <QMenu>
#include <QStackedWidget>
#include <QVariantMap>
#include <tbaseutil/tdataparse.h>
#include <tbaseutil/tresource.h>
#include <tbaseutil/ttheme.h>
#include <topcore/topcore.h>
#include "topquickbutton.h"
class TopQuickToolBarPrivate
{
Q_DECLARE_PUBLIC(TopQuickToolBar)
public:
explicit TopQuickToolBarPrivate(TopQuickToolBar *qptr)
: languageStr(APP->language()),
q_ptr(qptr)
{
}
~TopQuickToolBarPrivate()
{
}
QString languageStr;
QActionGroup *mToolBarActions;
protected:
TopQuickToolBar * const q_ptr;
};
TopQuickToolBar::TopQuickToolBar(QWidget *parent)
: QToolBar(parent),
d_ptr(new TopQuickToolBarPrivate(this))
{
Q_D(TopQuickToolBar);
d->mToolBarActions = new QActionGroup(this);
// this->setIconSize(QSize(16, 16));
}
TopQuickToolBar::~TopQuickToolBar()
{
// 保存来自用户配置的数据
QEventLoop loop;
connect(this, SIGNAL(userDataSaved()), &loop, SLOT(quit()));
QTimer::singleShot(300, &loop, SLOT(quit()));
emit saveUserData();
loop.exec();
}
void TopQuickToolBar::setLanguage(const QString &iLangStr)
{
Q_D(TopQuickToolBar);
d->languageStr = iLangStr;
}
QString TopQuickToolBar::language() const
{
Q_D(const TopQuickToolBar);
return d->languageStr;
}
void TopQuickToolBar::loadQuickButtons(const QVariantList &iVarLst)
{
for (QVariant var: iVarLst) {
addQuickButton(var.toMap());
}
}
TopQuickButton *TopQuickToolBar::addQuickButton(const QVariantMap &iParamMap)
{
Q_D(TopQuickToolBar);
TopQuickButton *btn = createQuickBtn(iParamMap);
btn->setToolButtonStyle(Qt::ToolButtonIconOnly);
d->mToolBarActions->addAction(addWidget(btn));
return btn;
}
void TopQuickToolBar::clearAllButtons()
{
Q_D(TopQuickToolBar);
// 清除当前ACTION,会自动析构对应的QToolButoon
QList<QAction *> listAction = d->mToolBarActions->actions();
for (QAction *act: listAction) {
d->mToolBarActions->removeAction(act);
this->removeAction(act);
act->deleteLater();
}
}
TopQuickButton *TopQuickToolBar::createQuickBtn(const QVariantMap &iParamMap)
{
Q_D(TopQuickToolBar);
TopQuickButton *toolBtn = new TopQuickButton(this);
QString btnTextStr = iParamMap.value("title_" + d->languageStr).toString();
if (btnTextStr.isEmpty()) {
btnTextStr = iParamMap.value("title").toString();
}
QString btnTooltipStr = iParamMap.value("remark_" + d->languageStr).toString();
if (btnTooltipStr.isEmpty()) {
btnTooltipStr = iParamMap.value("remark").toString();
}
if (btnTooltipStr.isEmpty()) {
btnTooltipStr = btnTextStr;
}
QString iconStr = iParamMap.value("icon").toString();
if (!iconStr.isEmpty() && !iconStr.contains('.')) {
iconStr += ".white";
}
toolBtn->setText(btnTextStr);
toolBtn->setToolTip(btnTooltipStr);
if (!iconStr.isEmpty()) {
toolBtn->setIcon(TRES->colorIcon(iconStr));
}
QString bgColor;
if (iParamMap.contains("icon_bgcolor") &&
!iParamMap.value("icon_bgcolor").toString().isEmpty()) {
bgColor = iParamMap.value("icon_bgcolor").toString();
} else {
bgColor = TTHEME->value("COLOR_PRIMARY_5").toString();
}
toolBtn->setStyleSheet(QString("TopQuickButton{border:none; background:%1;margin:%2px; border-radius:%3px;color:#FFFFFF;}\n" \
"TopQuickButton:hover{border-radius:%4px}\n" \
"QToolButton::menu-indicator{image:None;}")
.arg(bgColor).arg(TTHEME_DP(4)).arg(TTHEME_DP(10)).arg(TTHEME_DP(16)));
toolBtn->setData(iParamMap);
return toolBtn;
}
#ifndef TOPQUICKTOOLBAR_H
#define TOPQUICKTOOLBAR_H
#include <QToolBar>
#include <QVariant>
#include <QVariantList>
class QMenu;
class QStackedWidget;
class TopQuickButton;
class TopQuickToolBarPrivate;
class TopQuickToolBar : public QToolBar
{
Q_OBJECT
public:
explicit TopQuickToolBar(QWidget *parent = nullptr);
~TopQuickToolBar();
signals:
void saveUserData();
void userDataSaved();
void sizeChanged(QSize);
public slots:
void setLanguage(const QString &iLangStr);
QString language() const;
void loadQuickButtons(const QVariantList &iVarLst);
TopQuickButton *addQuickButton(const QVariantMap &iParamMap);
void clearAllButtons();
private:
TopQuickButton *createQuickBtn(const QVariantMap &iParamMap);
protected:
const QScopedPointer<TopQuickToolBarPrivate> d_ptr;
private:
Q_DISABLE_COPY(TopQuickToolBar)
Q_DECLARE_PRIVATE(TopQuickToolBar)
};
#endif // TOPQUICKTOOLBAR_H
......@@ -17,12 +17,16 @@
#include <twidget/ttableview.h>
#include <twidget/tsearchentry.h>
#include <twidget/tpagetool.h>
#include <twidget/tadvancedquery.h>
#include <twidget/tmessagebar.h>
#include <twidget/tcategorytreeview.h>
#include <twidget/ttableviewdialog.h>
#include <twidget/tmessagebox.h>
#include <twidget/taccordion.h>
#include <twidget/tsplitter.h>
#include <twidget/tscrollarea.h>
#include <twidget/ttabwidget.h>
#include <tbaseutil/tresource.h>
Musermgt::Musermgt(const QString &iModuleNameStr,
......@@ -346,6 +350,7 @@ void Musermgt::initTableView()
bodyLayout->setMargin(0);
bodyLayout->setSpacing(0);
mBodyWidget->addWidget(mBodyWgt);
initNavi();
mTableView = new TTableView(this);
mTableView->setObjectName("__view__");
......@@ -416,3 +421,299 @@ void Musermgt::initTableView()
}
}
Musermgt::NaviType Musermgt::str2NaviType(const QString &iType)
{
const QString type = iType.toUpper();
if (type == "UILOADER") {
return NaviType::UiLoader;
} else if (type == "ADVANCEDQUERY") {
return NaviType::AdvancedQuery;
} else if (type == "NAVIFILTER") {
return NaviType::NaviFilter;
} else if (type == "CATEGORYTREEVIEWANDADVANCEDQUERY") {
return NaviType::CategoryTreeViewAndAdvancedQuery;
} else if (type == "NONE") {
return NaviType::None;
} else {
return NaviType::CategoryTreeView;
}
}
QVariantList Musermgt::parseCategoryConfig()
{
QVariantList categoryLst;
QVariantList categoryConfig = config("navi.categories").toList();
QString format = config("navi.format", "filter_by_enum").toString();
if (format.compare("filter_by_enum") == 0) {
for(const QVariant &item: categoryConfig) {
QVariantMap itemMap = item.toMap();
QString itemName = itemMap.value("name").toString();
QVariantList childrenLst = itemMap.value("children").toList();
QString enumCfg = itemMap.value("enum_children").toString();
QStringList enumCheckedLst = itemMap.value("enum_checked").toStringList();
QStringList enumInvisibleLst = itemMap.value("enum_invisible").toStringList();
if (itemMap.contains("visible")) {
itemMap.insert("VISIBLE", itemMap.take("visible"));
}
if (itemMap.contains("expand")) {
itemMap.insert("EXPAND", itemMap.take("expand"));
}
TSqlWhereCompsiteV2 childWhere;
childWhere.setLogic(TSqlWhereCompsiteV2::Logic_Or);
QVariantList type = TOPENM->enumList(enumCfg)->toComboList();
for (const QVariant &item: type) {
QVariantMap enumMap = item.toMap();
QString enumName = enumMap.value("name").toString();
QVariantMap childMap;
childMap.insert("name",enumName);
childMap.insert("text",ttr(enumMap.value("text").toString()));
childMap.insert("icon",enumMap.value("icon"));
childMap.insert("data", itemName);
if(enumCheckedLst.contains(enumName)) {
childMap.insert("checked",1);
} else {
childMap.insert("checked",0);
}
if (enumInvisibleLst.contains(enumName)) {
childMap.insert("VISIBLE", 0);
} else {
childMap.insert("VISIBLE",1);
}
childrenLst.append(childMap);
}
int checkedChildLen = 0;
for (QVariant &item : childrenLst) {
QVariantMap itemMap = item.toMap();
QString name = itemMap.value("name").toString();
if(itemMap.value("checked").toInt() == 1) {
childWhere.append(itemName, name);
checkedChildLen++;
}
item = itemMap;
}
if (checkedChildLen == childrenLst.length()) {
itemMap.insert("checked", 1);
} else {
itemMap.insert("checked", 0);
}
//mCategoryWhere.append(childWhere);
itemMap.remove("children");
itemMap.remove("enum_children");
itemMap.remove("enum_checked");
itemMap.remove("enum_invisible");
itemMap.insert("text",ttr(itemMap.value("text").toString()));
itemMap.insert("CHILDREN",childrenLst);
categoryLst.append(itemMap);
}
} else if (format.compare("filter_by_sql_where") == 0) {
return categoryConfig;
}
return categoryLst;
}
QVariantMap Musermgt::getDefaultQueryDataFromCfgMap()
{
QVariantMap conditionMap = config("advance").toMap().value("condition").toMap();
QVariantList valueList = conditionMap.value("value").toList();
for (QVariant &var: valueList) {
QVariantMap m = var.toMap();
m.insert("title", ttr(m.value("title").toString()));
var = m;
}
conditionMap.insert("value", valueList);
return conditionMap;
}
void Musermgt::initAdvanceCfgMap()
{
mAdvancedQueryCfgMap = config("advance").toMap();
QVariantList queryItems = mAdvancedQueryCfgMap.value("advanced_items").toList();
QVariantList newQueryItems;
for (QVariant var : queryItems) {
QVariantMap m = var.toMap();
// 翻译title
m.insert("title", ttr(m.value("title").toString()));
// 转换枚举
QVariantList optionList;
QRegExp regExp("enum(.*)");
if ((m.value("optionList").type() == QVariant::String) && (regExp.indexIn(m.value("optionList").toString()) != -1)) {
if (regExp.capturedTexts().count() > 1) {
optionList = TOPENM->enumList(regExp.capturedTexts().value(1).remove("(").remove(")"))->toComboList();
m.insert("optionList", optionList);
}
}
newQueryItems << m;
}
mAdvancedQueryCfgMap.insert("advanced_items", newQueryItems);
}
void Musermgt::initNavi()
{
mNaviType = str2NaviType(config("navi.__type__", "CategoryTreeView").toString());
if (mNaviType == NaviType::None) {
return;
}
TAccordion *accordion = new TAccordion(this);
accordion->setObjectName("__navi__");
accordion->setProperty("SS_BG","NAVI");
accordion->setMinimumWidth(TTHEME_DP(config("navi.min_width", 150).toInt()));
accordion->setMaximumWidth(TTHEME_DP(config("navi.max_width", 300).toInt()));
accordion->setAccordionLocation(TAccordion::AccordionLocation::Left);
QVBoxLayout *naviLayout = new QVBoxLayout(accordion);
naviLayout->setMargin(0);
naviLayout->setSpacing(0);
QLabel *naviLabel = new QLabel(tr("Navigation"));
naviLabel->setProperty("SS_TYPE", "SUBHEADER");
naviLayout->addWidget(naviLabel,0);
naviLayout->addSpacing(TTHEME_DP(4));
accordion->expandButton()->setFixedHeight(TTHEME_DP(40));
accordion->expandButton()->setToolTip(tr("Show Navigation"));
accordion->collapseButton()->setToolTip(tr("Hide Navigation"));
accordion->setIsExpanded(config("navi.is_expanded", false).toBool());
mBodyWidget->insertWidget(0,accordion);
if (mNaviType == NaviType::UiLoader) {
mNaviView = new TUiLoader(this);
TUiLoader *filterUi = qobject_cast<TUiLoader*>(mNaviView);
filterUi->setSelf(this);
filterUi->setScriptEngine(APP->scriptEngine());
filterUi->setUiStr(ui("navi").toString());
QFrame *naviWgt = new QFrame(this);
QVBoxLayout *leftLayout = new QVBoxLayout(naviWgt);
leftLayout->addWidget(mNaviView);
QHBoxLayout *leftBtnsLayout = new QHBoxLayout();
leftLayout->addLayout(leftBtnsLayout);
QPushButton *resetBtn = new QPushButton(this);
connect(resetBtn, SIGNAL(clicked(bool)), filterUi, SLOT(clearValues()));
leftBtnsLayout->addWidget(resetBtn);
resetBtn->setText(tr("Reset"));
resetBtn->setIcon(TRES->icon("rotate-right"));
QPushButton *filterBtn = new QPushButton(this);
connect(filterBtn, SIGNAL(clicked(bool)), this, SLOT(refresh()));
leftBtnsLayout->addWidget(filterBtn);
filterBtn->setText(tr("Filter"));
filterBtn->setIcon(TRES->icon("filter"));
leftLayout->addStretch(1);
naviLayout->addWidget(naviWgt);
} else if (mNaviType == NaviType::AdvancedQuery) {
Q_ASSERT_X(false, "TopTemplateClass4", "This feature is not yet supported.");
} else if (mNaviType == NaviType::NaviFilter) {
Q_ASSERT_X(false, "TopTemplateClass4", "This feature is not yet supported.");
} else if (mNaviType == NaviType::CategoryTreeViewAndAdvancedQuery) {
// tab1-CategoryTreeView
TCategoryTreeView *categoryTreeView = new TCategoryTreeView(this);
categoryTreeView->setStyleSheet("TCategoryTreeView{border:NONE;background-color:transparent}");
QVariantList rootChildList = parseCategoryConfig();
if (rootChildList.isEmpty()) {
mNaviView->setVisible(false);
return;
}
categoryTreeView->setItemList(rootChildList);
categoryTreeView->setCheckable(config("navi.is_checkable").toBool());
connect(categoryTreeView, SIGNAL(selectionChanged(QVariantList)),
this, SLOT(onCategoryViewDataChanged(QVariantList)));
// tab2-tab1-ToolBar
QToolBar *toolbar = new QToolBar(this);
toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
toolbar->setProperty("SS_SIZE", "SMALL");
toolbar->setMovable(false);
QAction *queryAction = toolbar->addAction(APP->getResIcon("search"), tr("Query"));
connect(queryAction, SIGNAL(triggered()), this, SLOT(refresh()));
toolbar->addSeparator();
QAction* addAction = toolbar->addAction(APP->getResIcon("addto-circle-o"), tr("Add"));
addAction->setToolTip(tr("Add query criteria"));
//connect(addAction, SIGNAL(triggered()), this, SLOT(onAddActionTriggered()));
QAction* clearAction = toolbar->addAction(APP->getResIcon("eraser"), tr("Clear"));
clearAction->setToolTip(tr("Clear all query criteria"));
//connect(clearAction, SIGNAL(triggered()), this, SLOT(onClearActionTriggered()));
QAction* saveAsAction = toolbar->addAction(APP->getResIcon("save"), tr("Save As"));
saveAsAction->setToolTip(tr("Save query criteria as file"));
//connect(saveAsAction, SIGNAL(triggered()), this, SLOT(onSaveAsActionTriggered()));
QAction* openActtion = toolbar->addAction(APP->getResIcon("folder-open-o"), tr("Open"));
openActtion->setToolTip(tr("Open query criteria from file"));
//connect(openActtion, SIGNAL(triggered()), this, SLOT(onOpenActtionTriggered()));
QAction* saveAsCommonQueryAction = toolbar->addAction(APP->getResIcon("save-as"), tr("Save"));
saveAsCommonQueryAction->setToolTip(tr("Save as a common query"));
//connect(saveAsCommonQueryAction, SIGNAL(triggered()), this, SLOT(onSaveAsCommonQueryActionTriggered()));
// tab2-tab1-AdvancedQuery
TAdvancedQuery *advancedQuery = new TAdvancedQuery(this);
advancedQuery->setObjectName("AdvancedQuery");
initAdvanceCfgMap();
advancedQuery->setItemList(mAdvancedQueryCfgMap.value("advanced_items").toList());
advancedQuery->setData(getDefaultQueryDataFromCfgMap());
TScrollArea *scrollArea = new TScrollArea(this);
scrollArea->setWidgetResizable(true);
scrollArea->setWidget(advancedQuery);
// tab2-tab1
QMainWindow *mainWindow = new QMainWindow(this);
mainWindow->addToolBar(toolbar);
mainWindow->setCentralWidget(scrollArea);
// tab2-tab2-TableView
TTableView *commonQueryTable = new TTableView(this);
commonQueryTable->setObjectName("CommonQueryTable");
commonQueryTable->setShowGrid(false);
commonQueryTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
commonQueryTable->verticalHeader()->setVisible(false);
QVariantList headerItem;
headerItem << QVariant() << TDataParse::variantList2Map(
QVariantList() <<"name" << "title" << "display" << tr("Query Name") << "resizeMode" << "Stretch" << "displayRole" << "$title");
commonQueryTable->setHeaderItem(headerItem);
commonQueryTable->setDataKeyList(QStringList() << "title" << "condition");
commonQueryTable->setPrimaryKey("condition");
//connect(commonQueryTable, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(onCommonQueryTableDoubleClicked(const QModelIndex &)));
QAction *deleleCommonQueryActtion = new QAction(APP->getResIcon("remove"), tr("Delete query"), this);
connect(deleleCommonQueryActtion, SIGNAL(triggered()), this, SLOT(onDeleleCommonQueryActtionTriggered()));
QMenu *contextMenu = new QMenu(this);
contextMenu->addAction(deleleCommonQueryActtion);
commonQueryTable->setContextMenu(contextMenu);
// 刷新常用查询表格数据
//initCommonQueryMap();
//commonQueryTable->loadData(mAdvancedQueryTableDataMap.value("advance").toList());
// 高级查询Tab
TTabWidget *advancedQueryTabWidget = new TTabWidget(this);
advancedQueryTabWidget->setObjectName("AdvancedQueryTabWidget");
advancedQueryTabWidget->addTab(mainWindow, tr("Advanced Query"));
advancedQueryTabWidget->addTab(commonQueryTable, tr("Common Query"));
// 导航Tab
mNaviView = new TTabWidget(this);
TTabWidget *tabWidget = qobject_cast<TTabWidget *>(mNaviView);
tabWidget->addTab(categoryTreeView, tr("Category"));
tabWidget->addTab(advancedQueryTabWidget, tr("Advanced Query"));
naviLayout->addWidget(mNaviView);
} else {
mNaviView = new TCategoryTreeView(this);
mNaviView->setStyleSheet("TCategoryTreeView{border:NONE;background-color:transparent}");
QVariantList rootChildList = parseCategoryConfig();
if (rootChildList.isEmpty()) {
mNaviView->setVisible(false);
return;
}
TCategoryTreeView *categoryTreeView = qobject_cast<TCategoryTreeView *>(mNaviView);
categoryTreeView->setItemList(rootChildList);
categoryTreeView->setCheckable(config("navi.is_checkable").toBool());
connect(categoryTreeView, SIGNAL(selectionChanged(QVariantList)),
this, SLOT(onCategoryViewDataChanged(QVariantList)));
naviLayout->addWidget(mNaviView);
}
}
......@@ -21,6 +21,14 @@ public:
explicit Musermgt(const QString &iModuleNameStr = QString(""),
const QVariantMap &iUrlPars = QVariantMap(),
QWidget *iParent = nullptr);
enum class NaviType {
None,
CategoryTreeView,
UiLoader,
AdvancedQuery,
NaviFilter,
CategoryTreeViewAndAdvancedQuery
};
~Musermgt();
......@@ -50,7 +58,10 @@ signals:
void selectionChanged(); //左侧表单选中条目变化时发送该信号
private:
void initTableView(); //初始化界面
void initNavi();
Musermgt::NaviType str2NaviType(const QString &iType);
QVariantList parseCategoryConfig();
private:
TSplitter *mBodySplitter = nullptr;
TSplitter *mBodyWidget = nullptr;
......@@ -62,10 +73,16 @@ private:
QString mLastDetailUid;
QString mDetailUid;
NaviType mNaviType = NaviType::CategoryTreeView;
QWidget *mNaviView = nullptr;
QVariantMap mAdvancedQueryCfgMap;
bool IsDetailchange = false;
TopClassTableConf mTableConf;
QTimer *mRefreshTimer = nullptr;
QVariantList mSelectedItems;
void initAdvanceCfgMap();
QVariantMap getDefaultQueryDataFromCfgMap();
};
#endif //MUSERMGT
# 模块标题
sys_title: "System Config"
sys_title_en: ""
sys_title_zhcn: "系统设置"
sys_title_zhtw: ""
# 模块图标(普通图标在font awesome中找 http://fontawesome.io/icons/)
sys_icon: "toplinker-cd"
# 模块对应的插件DLL名称
sys_plugin: "musermgt-plugin"
# 模块对应的类名
sys_class: "SysMainWindow"
# 打开模块的权限
sys_open_right: ""
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: []
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
# 产品版本号
product_version: "V0.0.1"
# 关于对话框配置
about_us {
title:"", title_en:"", title_zhcn:"", title_zhtw:"",
copyright:"", copyright_en:"", copyright_zhcn:"", copyright_zhtw:"",
lawdesc:"", lawdesc_en:"", lawdesc_zhcn:"", lawdesc_zhtw:"",
}
# 当左侧导航的moudle或action没有权限时的状态
# 状态包括 show, hide, disable
# 默认为show
navi_status_without_permission: "disable"
# 资源
resource: {
rcc: ["topsys.rcc"]
}
# 主桌面配置
desktop: {
"navi": [
{
"route_type": "menu",
"icon": "gear",
"title": "Module menu",
"title_en": "Module menu",
"title_zhcn": "模块菜单",
"title_zhtw": "模块菜单",
"icon_bgcolor": "#7493B8",
"items": [
{
"route_type": "module",
"icon": "user-o",
"title": "Custom module",
"title_en": "Custom module",
"title_zhcn": "自定义模块",
"title_zhtw": "自定义模块",
"url_address": "Custom_module"
},
{
"route_type": "module",
"icon": "users",
"title": "Module configuration module",
"title_en": "Module configuration module",
"title_zhcn": "模板配置模块",
"title_zhtw": "模板配置模块",
"url_address": "Module_configuration_module"
},
]
},
"stretcher",
{
"route_type": "menu",
"icon": "home",
"title": "System",
"title_en": "System",
"title_zhcn": "系统",
"title_zhtw": "系統",
"icon_bgcolor": "#3598DB",
"items": [
{
"route_type": "action",
"icon": "info",
"title": "About",
"title_en": "About",
"title_zhcn": "关于",
"title_zhtw": "關於",
"url_address": "about"
},
{
"route_type": "action",
"icon": "sign-out",
"title": "Logout",
"title_en": "Logout",
"title_zhcn": "退出",
"title_zhtw": "退出",
"url_address": "quit"
}
]
}
]
}
......@@ -22,31 +22,6 @@ sys_enum_list: []
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
# 导航栏
# is_checkable,=true 或1, 表示支持checkbox形式; =false 或0, 表示非checkbox形式
navi: {
__type__: CategoryTreeViewAndAdvancedQuery,
is_checkable: 1,
categories: [
{
name: "status",
text: "status",
icon: "",
visible: 1,
expand: 1,
checked: 0,
data: "",
children: [
{ name: "active", text: "active", data: "status", checked: 1, VISIBLE:1 },
{ name: "inactive", text: "inactive", data: "status", checked: 1, VISIBLE:1 }
],
enum_children: "tpm-machine-maintenance-plan-status",
enum_checked:["active"],
enum_invisible:[]
},
]
}
# 主表格
view {
......
try {
this.newItem();
this.addUser();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "plus.#54698d"
LABEL: "New Attribute"
LABEL_ZHCN: "新建属性"
LABEL_ZHTW: "新建屬性"
ICON: "plus"
LABEL: "Add"
LABEL_ZHCN: "添加客户"
LABEL_ZHTW: "添加客戶"
ACCEL: "Ctrl+N"
TOOLTIP: "New Attribute"
TOOLTIP_ZHCN: "新建属性"
TOOLTIP_ZHTW: "新建屬性"
TOOLTIP: "Add Customer"
TOOLTIP_ZHCN: "添加客户"
TOOLTIP_ZHTW: "添加客戶"
CHECKED: ""
GROUP: ""
LABEL_EN: ""
LABEL_JP: ""
TOOLTIP_EN: ""
TOOLTIP_JP: ""
PERMISSION: "pdm-attr-name-create"
PERMISSION: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
STATEHOOK: "return (this.state() != 'EDIT') ? 'enable' : 'hide';"
---ACTION---*/
\ No newline at end of file
try {
this.copyItem();
this.copy();
} catch(e) {
print(e);
}
......@@ -20,5 +20,5 @@ STYLE: "button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return this.isDetailModified() ? 'hide' : 'enable';"
STATEHOOK: "return this.DetailModified() ? 'hide' : 'enable';"
---ACTION---*/
\ No newline at end of file
try {
var ans = TMessageBox.question(this, this.ttr("Do you want to delete the selected item?"), '', '',
[this.ttr('Delete')+':Yes:Yes:Error', this.ttr('Cancel')+':Cancel:Cancel:Normal']);
if (ans != 'Yes') {
return;
var ans = TMessageBox.question(this, this.ttr("Are you sure to delete selected items?"), '', '',
[this.ttr('Delete')+':Yes:Yes:Primary', this.ttr('Cancel')+':Cancel:Cancel:Normal']);
if (ans != 'Yes') {
return;
}
this.removeUser(this.selectedItems());
} catch (e) {
print(e);
}
this.deleteItems(this.selectedItems());
} catch (e) {
print(e);
}
/*---ACTION---
......@@ -26,5 +26,5 @@ STYLE: "size=small button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "if(this.selectedItems().length > 0 && !this.isDetailModified()){return 'enable'}else{return 'disable'}"
STATEHOOK: "if(this.selectedItems().length > 0 && !this.DetailModified()){return 'enable'}else{return 'disable'}"
---ACTION---*/
\ No newline at end of file
......@@ -20,5 +20,5 @@ STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "if (!this.isDetailModified()){return 'enable'} else {return 'disable'}"
STATEHOOK: "if (!this.DetailModified()){return 'enable'} else {return 'disable'}"
---ACTION---*/
\ No newline at end of file
try {
this.reloadItem();
this.reload();
} catch(e) {
print(e);
}
......@@ -18,5 +18,5 @@ STYLE: "button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return this.isDetailModified() ? 'hide' : 'enable';"
STATEHOOK: "return this.DetailModified() ? 'hide' : 'enable';"
---ACTION---*/
\ No newline at end of file
[
{
name: "basic_info_area",
type: "ScrollArea",
property: {
widget_resizable: true,
frame_shape: 'NoFrame'
},
pack: { label: self.ttr('Basic Info') },
child: [
{
name: 'formlayout',
type: 'FormGridLayout',
property: {
// label_alignment: 'AlignTop | AlignRight',
// horizontal_spacing: 10,
// vertical_spacing: 10,
// margin: 10,
columns: 2
},
child: [
{
name: "id",
type: "LineEdit",
title: self.ttr(""),
pack: {column_span: 2},
initCallback: function(obj,value,self) {
obj.setVisible(false)
}
},
{
name: "username",
type: "LineEdit",
title: self.ttr("UserName"),
validate: function (obj, val, title, moment, self) {
if (val.trim() == '') {
return [title + self.ttr(" can not be null"), 'Error'];
} else if (!val.match(new RegExp('^[A-Za-z0-9_]+$'))) {
return [title + self.ttr(" can only contain [A-Za-z0-9]!"), 'Error'];
}
},
},
{
name: "fullname",
type: "LineEdit",
title: self.ttr("FullName"),
validate: function (obj, val, title, moment, self) {
if (val.trim() == '') {
return [title + self.ttr(" can not be null"), 'Error'];
} else if (!val.match(new RegExp('^[A-Za-z0-9_]+$'))) {
return [title + self.ttr(" can only contain [A-Za-z0-9]!"), 'Error'];
}
},
},
{
name: "status",
type: "ComboBox",
title: self.ttr("Status"),
property: {
item_list: TOPENM.enumList("tpm-machine-maintenance-plan-status").toComboList()
},
validate: 'NOTNULL',
},
{
name: "attr_data.age",
type: "LineEdit",
title: self.ttr("Age"),
validate: function (obj, val, title, moment, self) {
if (!val.match(new RegExp('^[0-9_]+$'))) {
return [title + self.ttr(" can only contain [0-9]!"), 'Error'];
} else if (parseInt(val) >= 100 || parseInt(val) <= 0) {
return [title + self.ttr("Are you sure you are a hundred years old?"), 'Error'];
}
},
},
{
name: "attr_data.gender",
type: "ComboBox",
title: self.ttr("Gender"),
property: {
item_list: TOPENM.enumList("tpm-machine-maintenance-plan-gender").toComboList()
}
},
{
type: 'VBoxLayout'
},
{
type: 'Stretch'
}
]
}
]
}
]
\ No newline at end of file
"Age": {en: "Age", zhcn: "年龄", zhtw: "年龄"}
"Gender": {en: "Gender", zhcn: "性别", zhtw: "性别"}
"Navigation": {en: "Navigation", zhcn: "导航栏", zhtw: "導航欄"}
"Display Navigation": {en: "Display Navigation", zhcn: "显示导航栏", zhtw: "顯示導航欄"}
"Hide Navigation": {en: "Hide Navigation", zhcn: "隐藏导航栏", zhtw: "隱藏導航欄"}
"Password": {en: "Password", zhcn: "密码", zhtw: "密码"}
"UserName": {en: "UserName", zhcn: "用户名", zhtw: "用户名"}
"FullName": {en: "FullName", zhcn: "全名", zhtw: "全名"}
"Status": {en: "Status", zhcn: "状态", zhtw: "状态"}
"Load data successful!": {en: "Load data successful!" ,zhcn: "加载数据完成!" ,zhtw: "加載數據完成!"}
"Choose": {en: "Choose", zhcn: "选择", zhtw: "選擇"}
"Basic Info": {en: "Basic Info", zhcn: "基本信息", zhtw: "基本信息"}
"Ok": {en: "OK", zhcn: "确定", zhtw: "確定"}
"Cancel": {en: "Cancel", zhcn: "取消", zhtw: "取消"}
"Name": {en: "Name", zhcn: "姓名", zhtw: "姓名"}
\ No newline at end of file
# 模块标题
sys_title: "Template Demo - Single Tree Show"
sys_title_en: "Template Demo - Single Tree Show"
sys_title_zhcn: "树形信息展示"
# 模块标题
sys_title: "Module configuration module"
sys_title_en: "Module configuration module"
sys_title_zhcn: "模板配置模块"
sys_title_zhtw: ""
# 模块图标
sys_icon: "wpforms"
# 模块对应的插件DLL名称
sys_plugin: "toptemplateclassplugin"
# 模块对应的类名
sys_class: "TopTemplateClass1A"
sys_class: "TopTemplateClass4"
# 许可证验证键
sys_license_key: ""
# 打开模块的权限
......@@ -22,59 +22,62 @@ sys_enum_list: []
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
# 主表格
view {
# 数据项, 默认包含表头中配置的数据项
data_keys: [ "id", "parent_id" ]
data_keys: ["id","username","fullname","status",
"attr_data"]
# 主键
primary_key: "id"
# 分组键
group_key: ""
# 父结点键
# 当无此值,表示按照group_key进行分组,树形结构只有一级
# 当有此值,表示按照parent_key生成树形结果,可能有多级
child_key: "id"
parent_key: "parent_id"
# 同级结点排序的键
seq_key: "seq"
# 水平表头
horizontal_header: [
{
"name": "code",
"display": "Code",
"displayRole": "$code",
"search": "string"
"name": "id",
"display": "ID",
"displayRole": "$id",
"size": 100
},
{
"name": "name",
"display": "Name",
"displayRole": "$name",
"search": "string"
"name": "username",
"display": "登录名",
"displayRole": "$username",
"size": 100
},
{
"name": "node_type",
"display": "Node Type",
"displayRole": "$node_type"
"name": "fullname",
"display": "全名",
"displayRole": "$fullname",
"size": 100,
"search": "string"
},
{
"name": "status",
"display": "Status",
"displayRole": "$status"
"name": "status",
"display": "状态",
"displayRole": "$status.text",
"size": 100,
"format": "enum(tpm-machine-maintenance-plan-status)"
},
{
"name": "stop_reason",
"display": "Stop Reason",
"displayRole": "$stop_reason"
}
"name": "attr_data.age",
"display": "年龄",
"displayRole": "$attr_data.age",
"size": 100
},
{
"name": "attr_data.gender",
"display": "性别",
"displayRole": "$attr_data.gender.text",
"size": 100
"format": "enum(tpm-machine-maintenance-plan-gender)"
},
]
# 默认排序列
sort_by: ""
sort_by: "id DESC"
# 数据集
data_set {
# 数据库表名
db_table_name: "mes_workcenter"
# 若有sql, 以sql为最优先
# 若无sql, 默认根据表头的配置进行查询
db_sql: ""
db_table_name: "sys_user"
db_filter: ""
}
}
# 枚举类信息
label: "TopMes/Attr Name Mgt/Data Type"
label_en: "TopMes/Attr Name Mgt/Data Type"
label_zhcn: "TopMes/属性名称列表/数据类型"
label_zhtw: "TopMes/屬性名稱列表/數據類型"
remark: ""
# 枚举项信息
items :[
{"name":"attachment","icon":"","text":"Attachment","text_zhcn":"附件","text_zhtw":"Attachment","remark":"","tags":[],"data":
{"fieldType":"VARCHAR","fieldLength":255,"widgetType":"Attachment"}},
{"name":"string","icon":"","text":"String","text_zhcn":"字符串","text_zhtw":"String","remark":"","tags":[],"data":
{"fieldType":"VARCHAR","fieldLength":255,"widgetType":"LineEdit"}},
{"name":"integer","icon":"","text":"Integer","text_zhcn":"整数","text_zhtw":"Integer","remark":"","tags":[],"data":
{"fieldType":"INTEGER","fieldLength":255,"widgetType":"LineEdit"}},
{"name":"number","icon":"","text":"Number","text_zhcn":"数字","text_zhtw":"Number","remark":"","tags":[],"data":
{"fieldType":"DOUBLE","fieldLength":255,"widgetType":"LineEdit"}},
{"name":"enum","icon":"","text":"EnumList","text_zhcn":"选项列表(单选不可编辑)","text_zhtw":"EnumList","remark":"","tags":[],"data":
{"fieldType":"VARCHAR","fieldLength":255,"widgetType":"ComboBox"}},
{"name":"multiple_enum","icon":"","text":"MultipleEnum","text_zhcn":"可多选列表","text_zhtw":"MultipleEnum","remark":"","tags":[],"data":
{"fieldType":"VARCHAR","fieldLength":255,"widgetType":"MultiComboBox"}},
{"name":"editable_enum","icon":"","text":"EditableEnum","text_zhcn":"选项列表(单选可编辑)","text_zhtw":"EditableEnum","remark":"","tags":[],"data":
{"fieldType":"VARCHAR","fieldLength":255,"widgetType":"EditableComboBox"}},
{"name":"radio_box","icon":"","text":"RadioBox","text_zhcn":"单选框","text_zhtw":"RadioBox","remark":"","tags":[],"data":
{"fieldType":"VARCHAR","fieldLength":255,"widgetType":"RadioBox"}},
{"name":"check_box","icon":"","text":"CheckBox","text_zhcn":"复选框","text_zhtw":"CheckBox","remark":"","tags":[],"data":
{"fieldType":"VARCHAR","fieldLength":255,"widgetType":"CheckBox"}},
{"name":"multiple_check","icon":"","text":"MultipleCheck","text_zhcn":"可多选复选框","text_zhtw":"MultipleCheck","remark":"","tags":[],"data":
{"fieldType":"VARCHAR","fieldLength":255,"widgetType":"MultiCheckBox"}},
{"name":"plain_text","icon":"","text":"PlainText","text_zhcn":"文本(不可变字体及颜色)","text_zhtw":"PlainText","remark":"","tags":[],"data":
{"fieldType":"TEXT","fieldLength":255,"widgetType":"PlainTextEdit"}},
{"name":"text","icon":"","text":"Text","text_zhcn":"富文本(字体及颜色可变)","text_zhtw":"Text","remark":"","tags":[],"data":
{"fieldType":"TEXT","fieldLength":255,"widgetType":"TextEdit"}},
{"name":"date_time","icon":"","text":"DateTime","text_zhcn":"日期时间","text_zhtw":"DateTime","remark":"","tags":[],"data":
{"fieldType":"TIMESTAMP","fieldLength":255,"widgetType":"DateTimeEdit"}},
{"name":"date","icon":"","text":"Date","text_zhcn":"日期","text_zhtw":"Date","remark":"","tags":[],"data":
{"fieldType":"DATE","fieldLength":255,"widgetType":"DateEdit"}},
{"name":"time","icon":"","text":"Time","text_zhcn":"时间","text_zhtw":"Time","remark":"","tags":[],"data":
{"fieldType":"TIMESTAMP","fieldLength":255,"widgetType":"TimeEdit"}},
{"name":"table_view","icon":"","text":"TableView","text_zhcn":"表格","text_zhtw":"TableView","remark":"","tags":[],"data":
{"fieldType":"Text","fieldLength":255,"widgetType":"TableView"}},
{"name":"code","icon":"","text":"CodeEdit","text_zhcn":"代码片段","text_zhtw":"CodeEdit","remark":"","tags":[],"data":
{"fieldType":"TEXT","fieldLength":255,"widgetType":"CodeEdit"}},
{"name":"tree_view","icon":"","text":"TreeView","text_zhcn":"树形","text_zhtw":"TreeView","remark":"","tags":[],"data":
{"fieldType":"Text","fieldLength":255,"widgetType":"PcbPdmTreeView"}}
]
\ No newline at end of file
# 枚举类信息
label: "TopPDM/Attr Name Mgt/Attr Category"
label_en: "TopPDM/Attr Name Mgt/Attr Category"
label_zhcn: "东领产品数据管理/属性名称列表/属性分类"
label_zhtw: "東領產品數據管理/屬性名稱列表/屬性分類"
remark: ""
# 枚举项信息
items :[
{"name":"info","icon":"","text":"Info","text_zhcn":"Info","text_zhtw":"Info","remark":"","tags":[],"data":null},
{"name":"drill","icon":"","text":"Drill","text_zhcn":"钻孔","text_zhtw":"鑽孔","remark":"","tags":[],"data":null},
{"name":"inner","icon":"","text":"Inner","text_zhcn":"内层","text_zhtw":"內層","remark":"","tags":[],"data":null},
{"name":"outer","icon":"","text":"Outer","text_zhcn":"外层","text_zhtw":"外層","remark":"","tags":[],"data":null},
{"name":"relam","icon":"","text":"Relam","text_zhcn":"层压","text_zhtw":"層壓","remark":"","tags":[],"data":null},
{"name":"soldermask","icon":"","text":"SM","text_zhcn":"防焊","text_zhtw":"防焊","remark":"","tags":[],"data":null},
{"name":"silkscreen","icon":"","text":"SS","text_zhcn":"字符","text_zhtw":"字符","remark":"","tags":[],"data":null},
{"name":"logo","icon":"","text":"Logo","text_zhcn":"Logo","text_zhtw":"Logo","remark":"","tags":[],"data":null},
{"name":"surface","icon":"","text":"Surface","text_zhcn":"表面处理","text_zhtw":"表面處理","remark":"","tags":[],"data":null},
{"name":"contour","icon":"","text":"Contour","text_zhcn":"外形","text_zhtw":"外形","remark":"","tags":[],"data":null},
{"name":"quote","icon":"","text":"Quote","text_zhcn":"报价","text_zhtw":"報價","remark":"","tags":[],"data":null},
{"name":"other","icon":"","text":"Other","text_zhcn":"其他","text_zhtw":"其他","remark":"","tags":[],"data":null},
{"name":"sys","icon":"","text":"Sys","text_zhcn":"系统","text_zhtw":"系統","remark":"","tags":[],"data":null}
]
\ No newline at end of file
# 枚举类信息
label: "TopPDM/Attr Name Mgt/Attr Type"
label_en: "TopPDM/Attr Name Mgt/Attr Type"
label_zhcn: "东领产品数据管理/属性名称列表/属性类型"
label_zhtw: "東領產品數據管理/屬性名稱列表/屬性類型"
remark: ""
# 枚举项信息
items :[
{"name":"job","icon":"","text":"Job","text_zhcn":"料号属性","text_zhtw":"料號屬性","remark":"","tags":[],"data":null},
{"name":"layer","icon":"","text":"Layer","text_zhcn":"层属性","text_zhtw":"層屬性","remark":"","tags":[],"data":null}
]
\ No newline at end of file
# 枚举类信息
label: "TopPDM/Attr Name Mgt/Data Type"
label_en: "TopPDM/Attr Name Mgt/Data Type"
label_zhcn: "东领产品数据管理/属性名称列表/数据类型"
label_zhtw: "東領產品數據管理/屬性名稱列表/數據類型"
remark: ""
# 枚举项信息
items :[
{"name":"attachment","icon":"","text":"Attachment","text_zhcn":"附件","text_zhtw":"Attachment","remark":"","tags":[],"data":
{"fieldType":"VARCHAR","fieldLength":255,"widgetType":"Attachment"}},
{"name":"string","icon":"","text":"String","text_zhcn":"字符串","text_zhtw":"String","remark":"","tags":[],"data":
{"fieldType":"VARCHAR","fieldLength":255,"widgetType":"LineEdit"}},
{"name":"integer","icon":"","text":"Integer","text_zhcn":"整数","text_zhtw":"Integer","remark":"","tags":[],"data":
{"fieldType":"INTEGER","fieldLength":255,"widgetType":"LineEdit"}},
{"name":"number","icon":"","text":"Number","text_zhcn":"数字","text_zhtw":"Number","remark":"","tags":[],"data":
{"fieldType":"DOUBLE","fieldLength":255,"widgetType":"LineEdit"}},
{"name":"length_entry","icon":"","text":"LengthEntry","text_zhcn":"数字(单位转换)","text_zhtw":"數字(單位轉換)","remark":"","tags":[],"data":
{"fieldType":"DOUBLE","fieldLength":255,"widgetType":"LengthValueEntry"}},
{"name":"enum","icon":"","text":"EnumList","text_zhcn":"选项列表(单选不可编辑)","text_zhtw":"EnumList","remark":"","tags":[],"data":
{"fieldType":"VARCHAR","fieldLength":255,"widgetType":"ComboBox"}},
{"name":"multiple_enum","icon":"","text":"MultipleEnum","text_zhcn":"可多选列表","text_zhtw":"MultipleEnum","remark":"","tags":[],"data":
{"fieldType":"VARCHAR","fieldLength":255,"widgetType":"MultiComboBox"}},
{"name":"editable_enum","icon":"","text":"EditableEnum","text_zhcn":"选项列表(单选可编辑)","text_zhtw":"EditableEnum","remark":"","tags":[],"data":
{"fieldType":"VARCHAR","fieldLength":255,"widgetType":"EditableComboBox"}},
{"name":"radio_box","icon":"","text":"RadioBox","text_zhcn":"单选框","text_zhtw":"RadioBox","remark":"","tags":[],"data":
{"fieldType":"VARCHAR","fieldLength":255,"widgetType":"RadioBox"}},
{"name":"check_box","icon":"","text":"CheckBox","text_zhcn":"复选框","text_zhtw":"CheckBox","remark":"","tags":[],"data":
{"fieldType":"VARCHAR","fieldLength":255,"widgetType":"CheckBox"}},
{"name":"multiple_check","icon":"","text":"MultipleCheck","text_zhcn":"可多选复选框","text_zhtw":"MultipleCheck","remark":"","tags":[],"data":
{"fieldType":"VARCHAR","fieldLength":255,"widgetType":"MultiCheckBox"}},
{"name":"plain_text","icon":"","text":"PlainText","text_zhcn":"文本(不可变字体及颜色)","text_zhtw":"PlainText","remark":"","tags":[],"data":
{"fieldType":"TEXT","fieldLength":255,"widgetType":"PlainTextEdit"}},
{"name":"text","icon":"","text":"Text","text_zhcn":"富文本(字体及颜色可变)","text_zhtw":"Text","remark":"","tags":[],"data":
{"fieldType":"TEXT","fieldLength":255,"widgetType":"TextEdit"}},
{"name":"date_time","icon":"","text":"DateTime","text_zhcn":"日期时间","text_zhtw":"DateTime","remark":"","tags":[],"data":
{"fieldType":"TIMESTAMP","fieldLength":255,"widgetType":"DateTimeEdit"}},
{"name":"date","icon":"","text":"Date","text_zhcn":"日期","text_zhtw":"Date","remark":"","tags":[],"data":
{"fieldType":"DATE","fieldLength":255,"widgetType":"DateEdit"}},
{"name":"time","icon":"","text":"Time","text_zhcn":"时间","text_zhtw":"Time","remark":"","tags":[],"data":
{"fieldType":"TIMESTAMP","fieldLength":255,"widgetType":"TimeEdit"}},
{"name":"table_view","icon":"","text":"TableView","text_zhcn":"表格","text_zhtw":"TableView","remark":"","tags":[],"data":
{"fieldType":"Text","fieldLength":255,"widgetType":"TableView"}},
{"name":"code","icon":"","text":"CodeEdit","text_zhcn":"代码片段","text_zhtw":"CodeEdit","remark":"","tags":[],"data":
{"fieldType":"TEXT","fieldLength":255,"widgetType":"CodeEdit"}},
{"name":"tree_view","icon":"","text":"TreeView","text_zhcn":"树形","text_zhtw":"TreeView","remark":"","tags":[],"data":
{"fieldType":"Text","fieldLength":255,"widgetType":"PcbPdmTreeView"}}
]
\ No newline at end of file
# 枚举类信息
label: "TopPDM/Attr Name Mgt/Department"
label_en: "TopPDM/Attr Name Mgt/Department"
label_zhcn: "东领产品数据管理/属性名称列表/部门"
label_zhtw: "東領產品數據管理/屬性名稱列表/部門"
remark: ""
# 枚举项信息
items :[
{"name":"sales","icon":"","text":"Sales","text_zhcn":"销售","text_zhtw":"銷售","remark":"","tags":[],"data":null},
{"name":"mi","icon":"","text":"MI","text_zhcn":"预审","text_zhtw":"預審","remark":"","tags":[],"data":null},
{"name":"cam","icon":"","text":"CAM","text_zhcn":"CAM","text_zhtw":"CAM","remark":"","tags":[],"data":null}
]
\ No newline at end of file
# 枚举类信息
label: "TopPDM/Job Management/Job Status"
label_en: "TopPDM/Job Management/Job Status"
label_zhcn: "东领产品数据管理/料号管理/料号状态"
label_zhtw: "東領產品數據管理/料號管理/料號狀態"
remark: ""
# 枚举项信息
items :[
{"name":"active","icon":"play-circle-o.#27ad3a","text":"Active","text_zhcn":"激活","text_zhtw":"激活","remark":"","tags":[]},
{"name":"finish","icon":"check-circle-o.#3366ff","text":"Finish","text_zhcn":"结案","text_zhtw":"結案","remark":"","tags":[]},
{"name":"pause","icon":"pause-circle-o.#f49138","text":"Pause","text_zhcn":"暂停","text_zhtw":"暫停","remark":"","tags":[]},
{"name":"cancel","icon":"times-circle-o.#e82525","text":"Cancel","text_zhcn":"取消","text_zhtw":"取消","remark":"","tags":[]}
]
\ No newline at end of file
# 枚举类信息
label: "TopPDM/Job Management/Job Type"
label_en: "TopPDM/Job Management/Job Type"
label_zhcn: "东领产品数据管理/料号管理/料号类型"
label_zhtw: "東領產品數據管理/料號管理/料號類型"
remark: ""
# 枚举项信息
items :[
{"name":"normal","icon":"","text":"Normal","text_zhcn":"厂内料号","text_zhtw":"廠內料號","remark":"","tags":[]},
{"name":"combine","icon":"","text":"Combine","text_zhcn":"合拼料号","text_zhtw":"合拼料號","remark":"","tags":[]},
{"name":"sub_job","icon":"","text":"SubJob","text_zhcn":"子料号","text_zhtw":"子料號","remark":"","tags":[]}
]
\ No newline at end of file
# 枚举类信息
label: "MES/Mes TPM Maintenance Category/Plan Category"
label_en: "MES/Mes TPM Maintenance PlCategoryan/Plan Category"
label_zhcn: "MES/维护计划/计划分类"
label_zhtw: "MES/维护计划/计划分类"
remark: ""
# 枚举项信息
items :[
{"name":"overhaul","icon":"","text":"大修","text_zhcn":"大修","text_zhtw":"大修","remark":"","tags":[]},
{"name":"part_repairing","icon":"","text":"局部维修","text_zhcn":"局部维修","text_zhtw":"局部维修","remark":"","tags":[]},
{"name":"lubrication","icon":"","text":"润滑保养","text_zhcn":"润滑保养","text_zhtw":"润滑保养","remark":"","tags":[]},
{"name":"sealing","icon":"","text":"密封保养","text_zhcn":"密封保养","text_zhtw":"密封保养","remark":"","tags":[]}
]
\ No newline at end of file
# 枚举类信息
label: "MES/Mes TPM Maintenance Class/Maintenance Class"
label_en: "MES/Mes TPM Maintenance Class/Maintenance Class"
label_zhcn: "MES/维护计划/维护分类"
label_zhtw: "MES/维护计划/维护分类"
remark: ""
# 枚举项信息
items :[
{"name":"repair","icon":"","text":"维修","text_zhcn":"维修","text_zhtw":"维修","remark":"","tags":[]},
{"name":"maintenance","icon":"","text":"保养","text_zhcn":"保养","text_zhtw":"保养","remark":"","tags":[]},
{"name":"spot_check","icon":"","text":"点检","text_zhcn":"点检","text_zhtw":"点检","remark":"","tags":[]}
]
\ No newline at end of file
# 枚举类信息
label: "MES/Mes TPM Maintenance Class/Maintenance Cycle"
label_en: "MES/Mes TPM Maintenance Class/Maintenance Cycle"
label_zhcn: "MES/维护计划/维护周期"
label_zhtw: "MES/维护计划/维护周期"
remark: ""
# 枚举项信息
items :[
{"name":"day","icon":"","text":"天","text_zhcn":"天","text_zhtw":"天","remark":"","tags":[]},
{"name":"week","icon":"","text":"周","text_zhcn":"周","text_zhtw":"周","remark":"","tags":[]},
{"name":"month","icon":"","text":"月","text_zhcn":"月","text_zhtw":"月","remark":"","tags":[]}
]
\ No newline at end of file
# 枚举类信息
label: "MES/Mes TPM Maintenance Category/Plan Execution Cycle"
label_en: "MES/Mes TPM Maintenance PlCategoryan/Plan Execution Cycle"
label_zhcn: "MES/维护计划/计划执行周期"
label_zhtw: "MES/维护计划/计划执行周期"
remark: ""
# 枚举项信息
items :[
{"name":"once","icon":"","text":"单次","text_zhcn":"单次","text_zhtw":"单次","remark":"","tags":[]},
{"name":"cycle","icon":"","text":"周期","text_zhcn":"周期","text_zhtw":"周期","remark":"","tags":[]}
]
\ No newline at end of file
# 枚举类信息
label: "MES/Mes TPM Maintenance Plan/Plan Priority"
label_en: "MES/Mes TPM Maintenance Plan/Plan Priority"
label_zhcn: "MES/维护计划/计划优先级"
label_zhtw: "MES/维护计划/计划优先级"
remark: ""
# 枚举项信息
items :[
{"name":"1","icon":"","text":"1","text_zhcn":"1","text_zhtw":"1","remark":"","tags":[]},
{"name":"2","icon":"","text":"2","text_zhcn":"2","text_zhtw":"2","remark":"","tags":[]},
{"name":"3","icon":"","text":"3","text_zhcn":"3","text_zhtw":"3","remark":"","tags":[]}
]
\ No newline at end of file
try {
this.showPasswordModificationDialog();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: ""
LABEL: "Modify Password"
LABEL_ZHCN: "修改密码"
LABEL_ZHCN: "修改密碼"
ACCEL: ""
TOOLTIP: "Modify Password"
TOOLTIP_ZHCN: "修改密码"
TOOLTIP_ZHTW: "修改密碼"
CHECKED: ""
GROUP: ""
STYLE: "size=small button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
# 模块标题
sys_title: "Demo Summary"
sys_title_en: ""
sys_title_zhcn: "模板模块汇总"
sys_title_zhtw: ""
# 模块图标(普通图标在font awesome中找 http://fontawesome.io/icons/)
sys_icon: "toplinker-cd"
# 模块对应的插件DLL名称
sys_plugin: "topikm6-topsys-plugin"
# 模块对应的类名
sys_class: "SysMainWindow"
# 打开模块的权限
sys_open_right: ""
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: []
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
# 产品版本号
product_version: "V0.0.1"
# 关于对话框配置
about_us {
title:"", title_en:"", title_zhcn:"", title_zhtw:"",
copyright:"", copyright_en:"", copyright_zhcn:"", copyright_zhtw:"",
lawdesc:"", lawdesc_en:"", lawdesc_zhcn:"", lawdesc_zhtw:"",
}
# 当左侧导航的moudle或action没有权限时的状态
# 状态包括 show, hide, disable
# 默认为show
navi_status_without_permission: "disable"
# 资源
resource: {
rcc: []
}
# 主桌面配置
desktop: {
"navi": [
{
"route_type": "module",
"icon": "code",
"title": "单表格",
"title_en": "",
"title_zhcn": "",
"title_zhtw": "",
"url_address": "template-demo-single-table"
},
{
"route_type": "module",
"icon": "code",
"title": "单树形表格",
"title_en": "",
"title_zhcn": "",
"title_zhtw": "",
"url_address": "template-demo-single-tree"
},
{
"route_type": "module",
"icon": "code",
"title": "表单",
"title_en": "",
"title_zhcn": "",
"title_zhtw": "",
"url_address": "template-demo-uiloader"
},
{
"route_type": "module",
"icon": "code",
"title": "带详情表单",
"title_en": "",
"title_zhcn": "",
"title_zhtw": "",
"url_address": "template-demo-table-with-detail"
},
{
"route_type": "module",
"icon": "code",
"title": "属性名称列表",
"title_en": "",
"title_zhcn": "",
"title_zhtw": "",
"url_address": "pdm-attr-name-mgt"
},
{
"route_type": "module",
"icon": "code",
"title": "叠构模板库",
"title_en": "",
"title_zhcn": "",
"title_zhtw": "",
"url_address": "pdm-stackup-template"
},
{
"route_type": "module",
"icon": "code",
"title": "主从表",
"title_en": "",
"title_zhcn": "",
"title_zhtw": "",
"url_address": "template-demo-master-slave"
},
{
"route_type": "menu",
"icon": "home",
"title": "System",
"title_en": "System",
"title_zhcn": "系统",
"title_zhtw": "系統",
"icon_bgcolor": "#3598DB",
"items": [
{
"route_type": "module",
"icon": "gears",
"title": "Module Setting",
"title_en": "Module Setting",
"title_zhcn": "模块配置",
"title_zhtw": "模塊配置",
"url_address": "module-conf-mgt"
},
{
"route_type": "module",
"icon": "gear",
"title": "Config Management",
"title_en": "Config Management",
"title_zhcn": "配置管理",
"title_zhtw": "配置管理",
"url_address": "sys-config-mgt"
},
{
"route_type": "action",
"icon": "cloud-upload",
"title": "Module Upgrade",
"title_en": "Module Upgrade",
"title_zhcn": "模块升级",
"title_zhtw": "模塊升级",
"url_address": "open_module_upgrade"
},
{
"route_type": "module",
"icon": "code",
"title": "Macro Console",
"title_en": "Macro Console",
"title_zhcn": "宏控制台",
"title_zhtw": "宏控制臺",
"url_address": "sys-macro-console"
},
{
"route_type": "module",
"icon": "file-text-o",
"title": "Log Console",
"title_en": "Log Console",
"title_zhcn": "后台日志",
"title_zhtw": "後台日誌",
"url_address": "sys-log-console"
},
{
"route_type": "action",
"icon": "lock",
"title": "Change Password",
"title_en": "Change Password",
"title_zhcn": "修改密码",
"title_zhtw": "修改密碼",
"url_address": "modifypwd"
},
{
"route_type": "action",
"icon": "info",
"title": "About",
"title_en": "About",
"title_zhcn": "关于",
"title_zhtw": "關於",
"url_address": "about"
},
{
"route_type": "action",
"icon": "sign-out",
"title": "Logout",
"title_en": "Logout",
"title_zhcn": "退出",
"title_zhtw": "退出",
"url_address": "quit"
}
]
}
]
}
this.afterModuleInit = function () {
var self = this;
var lang_def = APP.languageDefine();
// 根据语言定义确定要查的title_i18n
var cfg = self.config();
var data_keys = self.config('view.data_keys');
_.forEach(lang_def, function (v, k) {
data_keys.push('attr_data.title_i18n.' + k);
self.setUserData('attr_data.title_i18n.' + k + '.visible', 0);
});
_.set(cfg, 'view.data_keys', data_keys);
self.setConfig(cfg);
// 根据语言定义动态修改detail.ui.js
var detail_ui = self.ui('detail');
var title_i18n_actions = [];
var title_i18n_widgets = [];
var action_template_str = "{ \
type: 'Action', \
property: { text: '{0}', user_data: '{1}', checkable: true}, \
callback: function(obj, checked, self) { \
var lang = obj.getData('user_data'); \
self.setUserData('{2}'+lang+'.visible', checked); \
this.refreshState(); \
} \
}";
var widget_template_str = "{ \
name: '{0}', \
type: 'LineEdit', \
title: self.ttr('Title') + ' ({1})', \
pack: { label: self.ttr('Title') + ' ({1})' }, \
state: function(obj, self) { \
var v = self.userData('{0}.visible'); \
if (v) { \
return 'show'; \
} else { \
return 'hide'; \
} \
}, \
getter: function(obj) { \
if (_.isEmpty(obj.text)) { \
return null; \
} \
return obj.text; \
} \
}";
_.forEach(lang_def, function (v, k) {
title_i18n_actions.push(_.format(action_template_str, v, k, 'attr_data.title_i18n.'));
title_i18n_widgets.push(_.format(widget_template_str, 'attr_data.title_i18n.' + k, v));
});
detail_ui = detail_ui.replace('/*{% TITLE_I18N_ACTIONS %}*/', title_i18n_actions.join(','))
.replace('/*{% TITLE_I18N_WIDGETS %},*/', title_i18n_widgets.join(',') + ',');
self.setUi('detail', detail_ui);
// 根据语言定义动态修改option-list.ui.js
var option_ui = self.ui('option-list');
var option_i18n_actions = [];
var option_i18n_widgets = [];
_.forEach(lang_def, function (v, k) {
option_i18n_actions.push(_.format(action_template_str, v, k, 'text_'));
option_i18n_widgets.push(_.format(widget_template_str, 'text_' + k, v));
});
option_ui = option_ui.replace('/*{% TITLE_I18N_ACTIONS %}*/', option_i18n_actions.join(','))
.replace('/*{% TITLE_I18N_WIDGETS %},*/', option_i18n_widgets.join(',') + ',');
self.setUi('option-list', option_ui);
};
try {
var self = this;
var option_list_table = self.uiLoader().getObject("option_list");
if (option_list_table == undefined) return;
var allDataMap = option_list_table.allDataMap();
var ret = GUI.showForm({
title: self.ttr('New Option'),
self: self,
use_core_engine: true,
ui: self.ui('option-list'),
size: '400x400',
buttons: [
self.ttr('Ok') + ':Ok:Ok:Primary',
self.ttr('Cancel') + ':Cancel:Cancel:Normal'
],
include_hidden_items: true,
});
if (_.isEmpty(ret)) return;
var isNameExist = false;
_.forEach(allDataMap, function(item) {
if (ret['name'] == item['name']) {
isNameExist = true;
}
});
if (isNameExist) {
GUI.msgbox({
title: this.ttr("Error"),
text: this.ttr("Option name is exist")
});
return;
}
option_list_table.appendRow(ret);
} catch (e) {
print(e);
}
\ No newline at end of file
try {
this.reloadItem();
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "times.#54698d"
LABEL: "Cancel"
LABEL_ZHCN: "取消"
LABEL_ZHTW: "取消"
ACCEL: ""
TOOLTIP: "Cancel Edit"
TOOLTIP_ZHCN: "取消编辑"
TOOLTIP_ZHTW: "取消編輯"
CHECKED: ""
GROUP: ""
LABEL_EN: ""
LABEL_JP: ""
TOOLTIP_EN: ""
TOOLTIP_JP: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return (this.isDetailModified() ) ? 'enable' : 'hide';"
---ACTION---*/
\ No newline at end of file
try {
this.copyItem();
this.uiLoader().setValue('name', "");
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "copy.#54698d"
LABEL: "Copy"
LABEL_ZHCN: "复制"
LABEL_ZHTW: "複製"
ACCEL: ""
TOOLTIP: "Copy Attribute"
TOOLTIP_ZHCN: "复制属性"
TOOLTIP_ZHTW: "複製屬性"
CHECKED: ""
GROUP: ""
LABEL_EN: ""
LABEL_JP: ""
TOOLTIP_EN: ""
TOOLTIP_JP: ""
PERMISSION: "pdm-attr-name-edit"
STYLE: "button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return (this.isDetailModified() || this.detailUid() == 0) ? 'hide' : 'enable';"
---ACTION---*/
\ No newline at end of file
var del_flag_key = this.config("view_data_set.db_del_flag_key");
try {
if (_.isEmpty(del_flag_key)) {
if ('ok' != TMessageBox.warning(this, this.ttr('Are you sure to delete selected items?'), '', this.ttr('Delete item'), [this.ttr('Sure') + ':ok:ok:warn', this.ttr('Cancel') + ':cancel:cancel:primary'])) {
return;
}
} else {
if ('ok' != TMessageBox.warning(this, this.ttr('Are you sure to move the selected item to the recycling station?'), '', this.ttr('Delete item'), [this.ttr('Sure') + ':ok:ok:warn', this.ttr('Cancel') + ':cancel:cancel:primary'])) {
return;
}
}
this.deleteItems(this.selectedItems());
this.refresh();
this.refreshDetail("");
}
catch (e) {
print(e);
}
/*---ACTION---
ICON: "trash.#54698d"
LABEL: "Delete"
LABEL_ZHCN: "删除"
LABEL_ZHTW: "刪除"
ACCEL: "Delete"
TOOLTIP: "Delete Attribute"
TOOLTIP_ZHCN: "删除属性"
TOOLTIP_ZHTW: "刪除屬性"
CHECKED: ""
GROUP: ""
LABEL_EN: ""
LABEL_JP: ""
TOOLTIP_EN: ""
TOOLTIP_JP: ""
PERMISSION: "pdm-attr-name-delete"
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "if(this.selectedItems().length > 0){return 'enable'}else{return 'disable'}"
---ACTION---*/
\ No newline at end of file
try {
var self = this;
var option_list_table = self.uiLoader().getObject("option_list");
if (option_list_table == undefined) {
return;
}
if (option_list_table.selectedRowDataMaps().length <= 0) {
return;
}
var allDataMap = option_list_table.allDataMap();
var rowMap = option_list_table.selectedRowDataMaps()[0];
var currentIndex = -1;
_.each(allDataMap, function(item, index) {
if (_.isEqual(rowMap, item)) {
currentIndex = index;
}
})
var ret = GUI.showForm({
title: self.ttr('Edit Option') + ": " + rowMap['name'],
self: self,
use_core_engine: true,
ui: self.ui('option-list'),
size: '400x400',
buttons: [
self.ttr('Ok') + ':Ok:Ok:Primary',
self.ttr('Cancel') + ':Cancel:Cancel:Normal'
],
include_hidden_items: true,
values: rowMap
})
if (_.isEmpty(ret)) {
return;
}
var isNameExist = false;
var iindex;
_.forEach(allDataMap, function(item, index) {
if (currentIndex != index && ret['name'] == item['name']) {
isNameExist = true;
}
});
if (isNameExist) {
GUI.msgbox({
title: this.ttr("Error"),
text: this.ttr("Option Name is existed!")
});
return;
}
option_list_table.setRowDataByPrimaryKey(rowMap["name"], ret);
} catch (e) {
print(e);
}
\ No newline at end of file
try {
this.refresh(false);
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "refresh.#54698d"
LABEL: "Refresh"
LABEL_ZHCN: "刷新"
LABEL_ZHTW: "刷新"
ACCEL: "F5"
TOOLTIP: "Refresh"
TOOLTIP_ZHCN: "刷新"
TOOLTIP_ZHTW: "刷新"
CHECKED: ""
GROUP: ""
LABEL_EN: ""
LABEL_JP: ""
TOOLTIP_EN: ""
TOOLTIP_JP: ""
STYLE: "button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
try {
this.reloadItem();
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "refresh.#54698d"
LABEL: "Refresh"
LABEL_ZHCN: "刷新"
LABEL_ZHTW: "刷新"
ACCEL: ""
TOOLTIP: "Reload data from database"
TOOLTIP_ZHCN: "重载数据"
TOOLTIP_ZHTW: "重載數據"
CHECKED: ""
GROUP: ""
LABEL_EN: ""
LABEL_JP: ""
TOOLTIP_EN: ""
TOOLTIP_JP: ""
STYLE: "button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return (this.isDetailModified() || this.detailUid() == 0) ? 'hide' : 'enable';"
---ACTION---*/
\ No newline at end of file
var self = this;
var option_list_table = self.uiLoader().getObject("option_list");
if (option_list_table == undefined) {
return;
}
if (option_list_table.selectedRowDataMaps().length <= 0) {
return;
}
if ('ok' != TMessageBox.warning(self, self.ttr('Are you sure to remove selected items?'), '', self.ttr('Delete item'), [self.ttr('Sure') + ':ok:ok:warn', self.ttr('Cancel') + ':cancel:cancel:primary'])) {
return;
}
option_list_table.removeSelectedRows();
var ans = TMessageBox.question(this, this.ttr("Are you sure to restore selected items?"), '', this.ttr('Ask'));
if (ans != 'Yes')
{
return;
}
var query = new TSqlQueryV2(T_SQLCNT_POOL.getSqlDatabase());
query.begin();
try {
var updater = new TSqlUpdaterV2;
updater.setTable("pdm_attrname");
updater.setWhere('id', this.selectedItems());
updater.setData({del_flag: 0});
query.updateRow(updater);
var error = query.lastError();
if (error.isValid()) {
throw error;
}
query.commit();
this.alertOk(this.ttr("Restore data Success!"));
this.refresh(false);
this.refreshDetail("");
} catch (e) {
query.rollback();
this.alertError(this.ttr("Restore Data Failed"));
print(e);
}
/*---ACTION---
ICON: "mail-reply"
LABEL: "Restore"
LABEL_ZHCN: "还原"
LABEL_ZHTW: "還原"
ACCEL: "Ctrl+R"
TOOLTIP: "Restore Attribute"
TOOLTIP_ZHCN: "还原属性"
TOOLTIP_ZHTW: "還原屬性"
CHECKED: ""
GROUP: ""
LABEL_EN: ""
LABEL_JP: ""
TOOLTIP_EN: ""
TOOLTIP_JP: ""
PERMISSION: "pdm-attr-name-edit"
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "if(_.isEmpty(this.config('view.data_set.db_del_flag_key')) == false){return 'hide'} else if( this.selectedItems().length > 0){return 'enable'}else{return 'disable'}"
---ACTION---*/
\ No newline at end of file
try {
this.saveItem();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "save.#54698d"
LABEL: "Save"
LABEL_ZHCN: "保存"
LABEL_ZHTW: "保存"
ACCEL: "Ctrl+S"
TOOLTIP: "Save Attribute"
TOOLTIP_ZHCN: "保存属性"
TOOLTIP_ZHTW: "保存屬性"
PERMISSION: "pdm-attr-name-edit"
CHECKED: ""
GROUP: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return (this.isDetailModified() ) ? 'enable' : 'disable';"
---ACTION---*/
\ No newline at end of file
var query = new TSqlQueryV2(T_SQLCNT_POOL.getSqlDatabase());
var self = this;
try {
var selector = new TSqlSelectorV2;
selector.setTable("pdm_attrname");
selector.setField(["id", "name", "title", "storage_flag"]);
selector.setWhere("del_flag = 0 OR del_flag IS NULL");
var error = new TError;
var data = this.runSqlQueryOnThreadSync('TOPSQLTHREAD_SELECT_ARRAYMAP', selector, error);
if (error.isValid()) {
throw error.text();
}
var flagTrueList = []; //storage_flag = 1
var flagFalseList = []; //storage_flag = 0 or null
_.forEach(data, function(item){
var storage_flag = item["storage_flag"];
if (storage_flag == 1) {
flagTrueList.push(item);
} else {
flagFalseList.push(item);
}
});
var dialog = new TTableChooserDialog(self);
dialog.setTitle(self.ttr("Set primary attrname"));
dialog.setButtons([self.ttr('Ok') + ':Ok:Ok:Primary', self.ttr('Cancel') + ':Cancel:Cancel:ERROR']);
dialog.setIcon("pdm-setting.546998d");
dialog.setRepetitionEnabled(false);
dialog.setPrimaryKey('id');
dialog.setSearchKeys(['name', 'title']);
dialog.setHeaderItem(
[
{
},
{
name: 'name',
display: self.ttr('Attrname'),
displayRole: '$name',
resizeMode: 'Stretch',
sorting_enabled: 1,
},
{
name: 'title',
display: self.ttr('Title'),
displayRole: '$title',
resizeMode: 'Stretch',
sorting_enabled: 0
}
]
);
dialog.setDataKeyList(['id', 'name', 'title', 'storage_flag']);
dialog.loadAllData(flagFalseList);
dialog.loadSelectedData(flagTrueList);
var ret = dialog.run();
if (_.isEmpty(ret)) {
return;
}
var newFlagFalseList = dialog.tableView().allDataMap();
var newFlagTrueList = dialog.selectedTableView().allDataMap();
var flagTrueIds = [];
var flagFalseIds = [];
_.forEach(newFlagTrueList, function(item) {
flagTrueIds.push(item['id']);
});
_.forEach(newFlagFalseList, function(item) {
flagFalseIds.push(item['id']);
});
var updater = new TSqlUpdaterV2;
updater.setTable('pdm_attrname');
var updateTrueMap = {};
updateTrueMap["storage_flag"] = 1;
updater.setField(["storage_flag"]);
updater.setWhere("id", flagTrueIds);
updater.setData(updateTrueMap);
query.updateRow(updater);
var error = query.lastError();
if (error.isValid()) {
throw error;
}
var updateFalseMap = {};
updateFalseMap["storage_flag"] = 0;
updater.setField(["storage_flag"]);
updater.setWhere("id", flagFalseIds);
updater.setData(updateFalseMap);
query.updateRow(updater);
var error = query.lastError();
if (error.isValid()) {
throw error;
}
query.commit();
} catch (e) {
query.rollback();
this.alertError(this.ttr('Error!'), e);
print(e);
}
/*---ACTION---
ICON: "pdm-setting.#54698d"
LABEL: "Set Primary Attributes"
LABEL_ZHCN: "设置关键属性"
LABEL_ZHTW: "設置關鍵屬性"
ACCEL: ""
TOOLTIP: "Set Primary Attributes"
TOOLTIP_ZHCN: "设置关键属性"
TOOLTIP_ZHTW: "設置關鍵屬性"
CHECKED: ""
GROUP: ""
LABEL_EN: ""
LABEL_JP: ""
TOOLTIP_EN: ""
TOOLTIP_JP: ""
PERMISSION: "pdm-attr-name-edit"
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
try {
var checked = arguments[0];
var cfg = this.config();
if (checked) {
var dbFilter = {};
dbFilter['del_flag'] = '1';
_.set(cfg, 'view.data_set.db_filter', dbFilter);
_.set(cfg, 'view.data_set.db_del_flag_key', "");
} else {
_.set(cfg, 'view.data_set.db_filter', {});
_.set(cfg, 'view.data_set.db_del_flag_key', "del_flag");
}
this.setConfig(cfg);
this.viewConfChanged();
this.refresh(false);
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "trash-o"
LABEL: "Recycle Bin"
LABEL_ZHCN: "回收站"
LABEL_ZHTW: "回收站"
ACCEL: ""
TOOLTIP: "Recycle Bin"
TOOLTIP_ZHCN: "回收站"
TOOLTIP_ZHTW: "回收站"
CHECKED: "false"
GROUP: ""
LABEL_EN: ""
LABEL_JP: ""
TOOLTIP_EN: ""
TOOLTIP_JP: ""
PERMISSION: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
function func(self) {
return [
{
name: 'scrollarea',
type: 'ScrollArea',
property:
{
widget_resizable: true, frame_shape: 'NoFrame'
},
pack: {},
child: [
{
name: 'vlayout',
type: 'VBoxLayout',
property:
{
margin: 0, spacing: 10
},
pack: {},
child: [
{
name: 'fglayout',
type: 'FormGridLayout',
property:
{
label_alignment: 'AlignRight', margin: 20, vertical_spacing: 10, horizontal_spacing: 20
},
pack: {},
child: [
{
name: 'id',
type: 'LineEdit',
title: self.ttr('ID'),
property: { enabled: true },
pack:
{
label: self.ttr('ID'),
},
state: function () {
return 'hide';
}
},
{
name: 'name',
type: 'LineEdit',
title: self.ttr('Name'),
property: {},
pack:
{
label: self.ttr('Name')
},
validate: function (obj, val, title, moment, self) {
if (val.trim() == '') {
return [title + self.ttr(" can not be null!"), 'Error'];
}
else if (!val.match(new RegExp('^[A-Za-z0-9_]+$'))) {
return [title + self.ttr(" can only contain [A-Za-z0-9_]!"), 'Error'];
}
return;
}
},
{
name: 'title_layout',
type: 'HBoxLayout',
title: self.ttr('Title'),
property: {
spacing: 10,
margin: 0
},
pack: { label: self.ttr('Title') },
child: [
{
name: 'title',
type: 'LineEdit',
property: {},
validate: function (obj, val, title, moment, self) {
if (val.trim() == '') {
return [title + self.ttr(" can not be null!"), 'Error'];
}
}
},
{
type: 'PushButton',
property: { text: self.ttr('Add Translation') },
child: [
{
type: 'Menu',
child: [
/*{% TITLE_I18N_ACTIONS %}*/
]
}
]
}
]
},
/*{% TITLE_I18N_WIDGETS %},*/
{
name: 'units',
title: self.ttr('Units'),
type: 'LineEdit',
property:
{
},
pack:
{
label: self.ttr('Units')
},
},
{
name: 'department',
title: self.ttr('Department'),
type: 'MultiComboBox',
property:
{
item_list: TOPENM.enumList("pdm-attrname-department").toComboList(),
name_format: 'A,B'
},
pack:
{
label: self.ttr('Department')
},
getter: function (obj, self) {
return obj.getData("current_names");
},
setter: function (obj, value, self) {
obj.setData('value', value.join(','));
}
},
{
name: 'category',
title: self.ttr('Category'),
type: 'MultiComboBox',
property:
{
item_list: TOPENM.enumList("pdm-attrname-attrcategory").toComboList(),
name_format: 'A,B'
},
pack:
{
label: self.ttr('Category')
},
getter: function (obj, self) {
return obj.getData("current_names");
},
setter: function (obj, value, self) {
obj.setData('value', value.join(','));
}
},
{
name: 'type',
title: self.ttr('Attribute Type'),
type: 'MultiComboBox',
property:
{
item_list: TOPENM.enumList("pdm-attrname-attrtype").toComboList(),
size_policy: 'Expanding,fixed',
name_format: 'A,B'
},
pack:
{
label: self.ttr('Attribute Type')
},
validate: 'NotNull',
getter: function (obj, self) {
return obj.getData("current_names");
},
setter: function (obj, value, self) {
obj.setData('value', value.join(','));
}
},
{
name: 'data_type',
title: self.ttr('Data Type'),
type: 'ComboBox',
property:
{
item_list: TOPENM.enumList("pdm-attrname-datatype").toComboList(),
size_policy: 'Expanding,fixed',
name_format: 'A,B'
},
pack:
{
label: self.ttr('Data Type')
},
validate: function (obj, val, title, moment, self) {
if (val.trim() == '') {
return [title + self.ttr(" can not be null!"), 'Error'];
}
},
},
{
name: 'option_list_box',
type: 'GroupBox',
pack: {
label: self.ttr("Option List")
},
property: {
label: self.ttr("Option List")
},
state: function (obj, self) {
var list = ["enum", "editable_enum", "check_box", "radio_box",
"multiple_enum", "multiple_check", "drill_cu_thick"];
var dataType = this.getValue("data_type");
if (list.indexOf(dataType) == -1) {
return 'hide';
} else {
// 当为单选可编辑时,由于编辑的是选项的namne,所以不显示text
var optionLstView = this.getObject("option_list");
if (optionLstView !== null) {
optionLstView.setColumnVisible("text", (dataType !== "editable_enum"));
}
return "Show";
}
},
child: [ {
name: 'vlayout',
type: 'VBoxLayout',
property: {
spacing: 0,
margin: 0
},
pack: {},
child: [
{
name: 'toolbar',
type: 'ToolBar',
property: {},
pack: {},
child: [
{
name: 'yesno',
type: 'Action',
property:
{
text: self.ttr('Defalt Yes/No'),
icon: 'pdm-default.#54698d',
shortcut: '',
tooltip: '',
style: 'size=small button_style=icon'
},
callback: function (obj, checked, self) {
var datType = this.getObject('data_type').getData('value');
var optionList = [];
if ('check_box' === datType) {
optionList = [
{
"data": "",
"icon": "",
"name": "1",
"rmk": "",
"text": "Yes"
},
{
"data": "",
"icon": "",
"name": "0",
"rmk": "",
"text": "No"
}
];
} else {
optionList = [
{
"data": "",
"icon": "",
"name": "Yes",
"rmk": "",
"text": "Yes"
},
{
"data": "",
"icon": "",
"name": "No",
"rmk": "",
"text": "No"
}
];
}
this.getObject('option_list').loadData(optionList);
},
},
{
name: 'new',
type: 'Action',
property:
{
text: self.ttr('New Option'),
icon: 'addto-circle-o.#54698d',
shortcut: '',
tooltip: '',
style: 'size=small button_style=icon'
},
callback: function (obj, checked, self) {
self.callAction("add_option");
},
},
{
name: 'edit',
type: 'Action',
property:
{
text: self.ttr('Edit Option'),
icon: 'edit.#54698d',
shortcut: '',
tooltip: '',
style: 'size=small button_style=icon'
},
callback: function (obj, checked, self) {
self.callAction("edit_option");
},
},
{
name: 'delete',
type: 'Action',
property:
{
text: self.ttr('Remove Option'),
icon: 'minus-circle-o.#54698d',
shortcut: '',
tooltip: '',
style: 'size=small button_style=icon'
},
callback: function (obj, checked, self) {
self.callAction("remove_option");
},
},
{
name: 'refresh',
type: 'Action',
property:
{
text: self.ttr('Refresh'),
icon: 'refresh.#54698d',
shortcut: '',
tooltip: '',
style: 'size=small button_style=icon'
},
callback: function (obj, checked, self) {
self.callAction("refresh_detail");
},
},
{
name: 'separator',
type: 'Separator',
},
{
name: 'move_top',
type: 'Action',
property:
{
text: self.ttr('Arrow top'),
icon: 'angle-double-up',
shortcut: '',
tool_tip: self.ttr('Arrow top'),
style: 'size = small'
},
callback: function (obj, checked, self) {
this.getObject('option_list').moveSelectedRowsTop();
},
},
{
name: 'move_up',
type: 'Action',
property:
{
text: self.ttr('Arrow up'),
icon: 'angle-up',
shortcut: '',
tool_tip: self.ttr('Arrow up'),
style: 'size = small'
},
callback: function (obj, checked, self) {
this.getObject('option_list').moveSelectedRowsUp();
},
},
{
name: 'move_down',
type: 'Action',
property:
{
text: self.ttr('Arrow down'),
icon: 'angle-down',
shortcut: '',
tool_tip: self.ttr('Arrow down'),
style: 'size = small'
},
callback: function (obj, checked, self) {
this.getObject('option_list').moveSelectedRowsDown();
},
},
{
name: 'move_btm',
type: 'Action',
property:
{
text: self.ttr('Arrow bottom'),
icon: 'angle-double-down',
shortcut: '',
tool_tip: self.ttr('Arrow bottom'),
style: 'size = small'
},
callback: function (obj, checked, self) {
this.getObject('option_list').moveSelectedRowsBottom();
},
},
]
},
{
name: 'option_list',
type: 'TableView',
property: { minimum_height: 200 },
pack: {},
getter: function (obj, self) {
var data = obj.allDataMap();
return TDataParse.variant2JsonStr(data);
},
setter: function (obj, value) {
var data = [];
if (value != null) {
data = TDataParse.jsonStr2Variant(value);
}
obj.loadData(data);
},
initCallback: function (obj) {
obj.setHeaderItem(
[
{
},
{
"name": "name",
"display": self.ttr("Name"),
"resizeMode": "Interactive",
"size": "100",
"displayRole": "$name"
},
{
"name": "text",
"display": self.ttr("Text"),
"resizeMode": "Interactive",
"size": "80",
"displayRole": "$text"
},
{
"name": "icon",
"display": self.ttr("Icon"),
"resizeMode": "Interactive",
"size": "120",
"displayRole": "$icon",
"decorationRole": "$icon"
},
{
"name": "data",
"display": self.ttr("Data"),
"resizeMode": "Interactive",
"size": "100",
"displayRole": "$data"
},
{
"name": "rmk",
"display": self.ttr("Remark"),
"resizeMode": "Interactive",
"size": "100",
"displayRole": "$rmk"
}
]);
obj.setDataKeyList(["name", "text", "icon", "data", "rmk", "text_en", "text_zhcn", "text_zhtw"]);
obj.setPrimaryKey("name");
},
}
]
}
]
},
{
name: 'ui_cfg',
title: self.ttr('UI Cfg'),
type: 'CodeEdit',
property:
{
min: 1, max: 30,
acceptRichText: false
},
pack:
{
label: self.ttr('UI Cfg'),
},
},
{
name: 'tags',
title: self.ttr('Tag'),
type: 'Chips',
property:
{
},
pack:
{
label: self.ttr('Tag'),
},
},
{
name: 'remark',
title: self.ttr('Remark'),
type: 'PlainTextEdit',
property:
{
acceptRichText: false, min_row_count: 1, max_row_count: 30
},
pack:
{
label: self.ttr('Remark'),
},
},
]
},
{
name: 'stretcher',
type: 'Widget',
property: { size_policy: 'Qt::Expanding' }
}
]
}
]
}
];
}
"Delete item": {en: "Delete item", zhcn: "删除条目", zhtw: ""}
"Sure": {en: "Confirmed", zhcn: "确认", zhtw: ""}
" already exists in the recycle bin!": {en: " already exists in the recycle bin!",zhcn: " 已在回收站中存在!",zhtw: " 已在回收站中存在!"}
" already exists!": {en: " already exists!",zhcn: " 已存在!",zhtw: " 已存在!"}
" can only contain [A-Za-z0-9_]!": {en: " can only contain [A-Za-z0-9_]!",zhcn: " 只能包含数字字母下划线!",zhtw: " 只能包含數字字母下劃線!"}
"Are you sure to remove selected items?": {en: "Are you sure to remove selected items?",zhcn: "确定要移除所选项吗?",zhtw: "確定要移除所選項嗎?"}
"Are you sure to move the selected item to the recycling station?": {en:"Are you sure to move the selected item to the recycle bin?", zhcn: "确定要将选中的条目移至回收站吗?", zhtw: "確定要將選中的條目移至回收站嗎?"}
"Arrow bottom": {en: "Move bottom",zhcn: "置底",zhtw: "置底"}
"Arrow down": {en: "Move down",zhcn: "下移",zhtw: "下移"}
"Arrow top": {en: "Move top",zhcn: "置顶",zhtw: "置頂"}
"Arrow up": {en: "Move up",zhcn: "上移",zhtw: "上移"}
"Attribute Type": {en: "Attribute Type",zhcn: "属性类型",zhtw: "屬性類型"}
"Category": {en: "Category",zhcn: "分类",zhtw: "分類"}
"Common Query Attributes": {en: "Common Query Attributes",zhcn: "常用查询",zhtw: "常用查詢"}
"Data": {en: "Data",zhcn: "数据",zhtw: "數據"}
"Data Type": {en: "Data Type",zhcn: "数据类型",zhtw: "數據類型"}
"Department": {en: "Department",zhcn: "部门",zhtw: "部門"}
"Used Department": {en: "Used Department",zhcn: "使用部门",zhtw: "使用部門"}
"Edit Option": {en: "Edit Option",zhcn: "编辑选项",zhtw: "編輯選項"}
"Job Attr-%1": {en: "Job Attr-%1",zhcn: "料号属性-%1",zhtw: "料號屬性-%1"}
"Name": {en: "Name",zhcn: "名称",zhtw: "名稱"}
"Navigation": {en: "Navigation",zhcn: "分类导航",zhtw: "分類導航"}
"New Attr": {en: "New Attr",zhcn: "新建属性",zhtw: "新建屬性"}
"New Option": {en: "New Option",zhcn: "新建选项",zhtw: "新建選項"}
"Option List": {en: "Option List",zhcn: "选项列表",zhtw: "選項列表"}
"Remove Option": {en: "Remove Option",zhcn: "移除选项",zhtw: "移除選項"}
"Saving data failed!": {en: "Saving data failed!",zhcn: "保存数据失败!",zhtw: "保存數據失敗!"}
"Tag": {en: "Tag",zhcn: "标签",zhtw: "標籤"}
"Text": {en: "Text",zhcn: "标题",zhtw: "標題"}
"Title": {en: "Title",zhcn: "标题",zhtw: "標題"}
"Trash": {en: "Trash",zhcn: "回收站",zhtw: "回收站"}
"UI Cfg": {en: "UI Cfg",zhcn: "界面配置",zhtw: "界面配置"}
"Units": {en: "Units",zhcn: "单位",zhtw: "單位"}
"can not be null": {en: "can not be null",zhcn: "不为空",zhtw: "不為空"}
"Attribute-%1": {en: "Attribute-%1",zhcn: "属性-%1",zhtw: "屬性-%1"}
"Set data failed!": {en: "Set data failed!",zhcn: "设置数据失败!",zhtw: "設置數據失敗!"}
"Set data success!": {en: "Set data success!",zhcn: "设置数据成功!",zhtw: "設置數據成功!"}
"Defalt Yes/No": {en: "Default Yes/No",zhcn: "默认 Yes/No",zhtw: "默認 Yes/No"}
"Set flag success!": {en: "Set flag success!",zhcn: "设置关键属性成功!",zhtw: "設置關鍵屬性成功!"}
"Set flag failed!": {en: "Set flag failed!",zhcn: "设置关键属性失败!",zhtw: "設置關鍵屬性失敗!"}
"Set primary attrname": {en: "Set primary attrname",zhcn: "设置关键属性",zhtw: "設置關鍵屬性"}
"Attrname": {en: "Attrname",zhcn: "属性",zhtw: "屬性"}
"Are you sure to restore selected items?": {en: "Are you sure to restore selected items?",zhcn: "确定要还原所选项吗?",zhtw: "確定要還遠所選項嗎?"}
"Restore data success!": {en: "Restore data success!", zhcn: "还原数据成功!", zhtw: "還原數據成功!"}
"Restore data failed!": {en: "Restore data failed!", zhcn: "还原数据失败!", zhtw: "還原數據失敗!"}
"Add Translation": { en: "Add Translation", zhcn: "添加翻译", zhtw: "添加翻譯" }
"Option Name is existed!": { en: "Option Name is existed!", zhcn: "选项名称已存在!", zhtw: "選項名稱已存在!"}
# 模块标题
sys_title: "Attribute Name List"
sys_title_en: "Attribute Name List"
sys_title_zhcn: "属性名称列表"
sys_title_zhtw: "屬性名稱列表"
# 模块图标
sys_icon: "pdm-check_item"
# 模块对应的插件DLL名称
sys_plugin: "toptemplateclassplugin"
# 模块对应的类名
sys_class: "TopTemplateClass4"
# 打开模块的权限
sys_open_right: "pdm-attr-name-read"
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: ["pdm-attrname-attrtype", "pdm-attrname-datatype", "pdm-attrname-department", "pdm-attrname-attrcategory"]
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
#详情页面的初始大小
detail.perfect_size.width: 600
#导航栏初宽度
navi.perfect_size.width:200
navi.min_size.width:150
# 新建时是否全屏
detail.create.fullscreen: false
# 导航栏配置
navi: {
min_width: 150,
is_expanded: true,
is_checkable: true,
categories: [
{
name: "category",
text: "Category",
icon: "",
VISIBLE: 1,
EXPAND: 1,
checked: 0,
data: "category",
children: [],
enum_children: "pdm-attrname-attrcategory",
enum_checked:[]
},
{
name: "type",
text: "Attribute Type",
icon: "",
VISIBLE: 1,
EXPAND: 1,
checked: 0,
data: "type",
children: [],
enum_children: "pdm-attrname-attrtype",
enum_checked:[]
},
{
name: "department",
text: "Used Department",
icon: "",
VISIBLE: 1,
EXPAND: 1,
checked: 0,
data: "department",
children: [],
enum_children: "pdm-attrname-department",
enum_checked:[]
}
]
}
# 显示相关配置
view {
data_keys: ["id", "title", "attr_data.store_table", "ui_cfg", "option_list", "tags", "del_flag"],
primary_key: "id",
horizontal_header: [
{
"name": "name",
"display": "Name",
"displayRole": "$name",
"size": 100,
"search": "string"
},
{
"name": "title",
"display": "Title",
"displayRole": "$title",
"size": 100,
"search": "string"
}
{
"name": "units",
"display": "Units",
"displayRole": "$units",
"size": 100
},
{
"name": "category",
"display": "Category",
"displayRole": "$category.text",
"size": 100,
"format": "enum(pdm-attrname-attrcategory)",
"field_format": "array"
},
{
"name": "type",
"display": "Attribute Type",
"displayRole": "$type.text",
"size": 100,
"format": "enum(pdm-attrname-attrtype)",
"field_format": "array"
},
{
"name": "data_type",
"display": "Data Type",
"displayRole": "$data_type.text",
"size": 100,
"format": "enum(pdm-attrname-datatype)"
},
{
"name": "department",
"display": "Department",
"displayRole": "$department.text",
"size": 100,
"format": "enum(pdm-attrname-department)",
"field_format": "array"
},
{
"name": "remark",
"display": "Remark",
"displayRole": "$remark",
"size": 100,
"search": "string"
}
],
data_set {
db_table_name: "pdm_attrname",
db_sql: "",
# 删除标记,若为空表示做物理删除
db_del_flag_key: "del_flag"
# 过滤项
db_filter {
}
}
}
\ No newline at end of file
function func(self) {
return [
{
name: 'scrollarea',
type: 'ScrollArea',
property:
{
widget_resizable: true,
frame_shape: 'QFrame::NoFrame'
},
pack: {},
child:
{
name: 'vlayout',
type: 'VBoxLayout',
property:
{
margin: 0, spacing: 10
},
pack: {},
child: [
{
name: 'flayout',
type: 'FormGridLayout',
property:
{
label_alignment: 'AlignRight', margin: 20, vertical_spacing: 10, horizontal_spacing: 20
},
pack: {},
child: [
{
name: 'name',
type: 'LineEdit',
property: {},
title: self.ttr("Name"),
pack:
{
label: self.ttr("Name")
},
validate: function (obj, val, title, moment, self) {
if (val.trim() == '') {
return [title + self.ttr('can not be null'), 'Error'];
}
return;
},
initCallback: function (obj, self) {
obj.setFocus();
}
},
{
name: "text_wgt",
type: "Widget",
pack: { label: self.ttr("Text") },
child: {
name: 'text_layout',
type: 'HBoxLayout',
property: {
margin: 0,
spacing: 10
},
child: [
{
name: 'text',
type: 'LineEdit',
title: self.ttr('Text'),
property: {},
validate: function (obj, val, title, moment, self) {
return;
}
},
{
type: 'PushButton',
property: { text: self.ttr('Add Translation') },
child: [
{
type: 'Menu',
child: [
/*{% TITLE_I18N_ACTIONS %}*/
]
}
]
}
]
},
state: function (obj, self) {
var option_list_table = self.uiLoader().getObject("option_list");
if (option_list_table == undefined || option_list_table === null) return;
return option_list_table.isColumnVisible("text") ? "SHOW" : "HIDE";
}
},
/*{% TITLE_I18N_WIDGETS %},*/
{
name: 'icon',
type: 'IconSelector',
title: self.ttr('Icon'),
property: {},
pack:
{
label: self.ttr('Icon')
},
},
{
name: 'data',
title: self.ttr('Data'),
type: 'TextEdit',
property: { min_row_count: 1, max_row_count: 30 },
pack:
{
label: self.ttr('Data')
},
setter: function (obj, value, self) {
obj.setPlainText(value);
},
getter: function (obj, self) {
return obj.plainText
},
},
{
name: 'rmk',
title: self.ttr('Remark'),
type: 'TextEdit',
property: { min_row_count: 1, max_row_count: 30 },
pack:
{
label: self.ttr('Remark')
},
setter: function (obj, value, self) {
obj.setPlainText(value);
},
getter: function (obj, self) {
return obj.plainText
},
},
{
name: 'stretcher',
type: 'Widget',
property: { size_policy: 'Qt::Expanding' }
}
]
}
]
}
}
]
;
}
\ No newline at end of file
# 表格的右键菜单
"TABLEVIEW_POPUP": [
{"type":"menuitem","action":"new"},
{"type":"separator"},
{"type":"menuitem","action":"delete"},
{"type":"menuitem","action":"restore"},
{"type":"separator"},
{"type":"menuitem","action":"refresh"}
]
# 工具栏
"MAIN_TOOLBAR": [
{"type":"spacing", "size":10},
{"type":"toolitem","action":"new"},
{"type":"separator"},
{"type":"toolitem","action":"trash"},
{"type":"toolitem","action":"c1"},
{"type":"toolitem","action":"c2"},
{"type":"toolitem","action":"c3"},
{"type":"toolitem","action":"c4"},
{"type":"toolitem","action":"c5"},
{"type":"stretcher"},
{"type":"searchentry","name":"SEARCH_ENTRY"},
{"type":"toolitem", action:"refresh"},
{type:"menu", text:"", icon:"ellipsis-v",
child: [
{"type":"menuitem","action":"set_key_attr"},
]},
]
# 底部工具栏
"BOTTOM_TOOLBAR" : [
{"type":"stretcher"},
{"type":"pagetool","name":"PAGE_TOOL"}
]
# 详细信息工具栏
"DETAIL_TOOLBAR": [
{"type":"toolitem","action":"save_detail"},
{"type":"stretcher"},
{"type":"toolitem","action":"copy_detail"},
{"type":"toolitem","action":"cancel_detail"},
{"type":"toolitem","action":"refresh_detail"}
]
this.afterViewInit = function () {
var self = this;
var stackup_viewer = self.uiLoader().getObject('stackup');
stackup_viewer.setDrawSetting(self.config("stackup.draw_setting"));
var selector = new TSqlSelectorV2;
selector.setTable("pdm_stkmatlib");
selector.setWhere("class = 'Core'");
selector.setField("DISTINCT family");
selector.setOrder(["family ASC"]);
var cores = self.runSqlQueryOnThreadSync("TOPSQLTHREAD_SELECT_ARRAYMAP", selector);
cores = _.map(cores, function(item) { return { name: item.family, text: item.family } } );
self.naviView().getObject('attr_data.core_family').setData('item_list', cores);
selector.clear();
selector.setTable("pdm_stkmatlib");
selector.setWhere("class = 'Prepreg'");
selector.setField("DISTINCT family");
selector.setOrder(["family ASC"]);
var pps = self.runSqlQueryOnThreadSync("TOPSQLTHREAD_SELECT_ARRAYMAP", selector);
pps = _.map(pps, function(item) { return { name: item.family, text: item.family } } );
self.naviView().getObject('attr_data.pp_family').setData('item_list', pps);
}
\ No newline at end of file
try {
this.reloadItem();
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "cancel"
LABEL: "Cancel"
LABEL_ZHCN: "取消"
LABEL_ZHTW: "取消"
ACCEL: ""
TOOLTIP: "Cancel the action"
TOOLTIP_ZHCN: "取消动作"
TOOLTIP_ZHTW: "取消動作"
CHECKED: ""
GROUP: ""
STYLE: "button_style=text"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return (this.isDetailModified()) ? 'enable' : 'hide';"
---ACTION---*/
\ No newline at end of file
try {
this.refresh();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "refresh"
LABEL: "Refresh"
LABEL_ZHCN: "刷新"
LABEL_ZHTW: "刷新"
ACCEL: "F5"
TOOLTIP: "Refresh"
TOOLTIP_ZHCN: "刷新"
TOOLTIP_ZHTW: "刷新"
CHECKED: ""
GROUP: ""
STYLE: "size=small button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
try {
this.reloadItem();
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "refresh"
LABEL: "Refresh"
LABEL_ZHCN: "刷新"
LABEL_ZHTW: "刷新"
ACCEL: ""
TOOLTIP: "Reload data from database"
TOOLTIP_ZHCN: "重新从数据库加载数据"
TOOLTIP_ZHTW: "重新從數據庫加載數據"
CHECKED: ""
GROUP: ""
STYLE: "button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return this.isDetailModified() ? 'hide' : 'enable';"
---ACTION---*/
\ No newline at end of file
function func(self) {
var ui = {
type: 'TabWidget',
child: [
{
type: 'VBoxLayout',
pack: { label: self.ttr('Basic Info') },
child: [
{
type: 'FormGridLayout',
child: [
{
name: 'attr_data.name',
type: 'LineEdit',
pack: { label: self.ttr('Name') }
},
{
name: 'layer_count',
type: 'LineEdit',
pack: { label: self.ttr('Layer Count') },
property: { readonly: true }
},
{
name: 'min_thk',
type: 'LineEdit',
pack: { label: self.ttr('Min Thk') },
property: { readonly: true }
},
{
name: 'max_thk',
type: 'LineEdit',
pack: { label: self.ttr('Max Thk') },
property: { readonly: true }
},
{
name: 'attr_data.core_family',
type: 'LineEdit',
pack: { label: self.ttr('Core Family') },
property: { readonly: true }
},
{
name: 'attr_data.pp_family',
type: 'LineEdit',
pack: { label: self.ttr('PP Family') },
property: { readonly: true }
},
{
name: 'stackup_code',
type: 'LineEdit',
pack: { label: self.ttr('Structure') },
property: { readonly: true }
},
{
name: 'attr_data.remark',
type: 'PlainTextEdit',
pack: { label: self.ttr('Remark') }
}
]
},
{
type: 'Stretch'
}
]
},
{
type: 'VBoxLayout',
pack: { label: self.ttr('Stackup') },
property: { margin: 0, spacing: 0 },
child: [
{
name: 'stackup',
type: 'topikm6-stackup-viewer-plugin.STACKUPVIEWER',
setter: function(obj, value) {
obj.setStackupData(JSON.parse(value));
}
},
{
type: 'Stretch'
}
]
}
]
};
return ui;
}
\ No newline at end of file
"Layer Count": { zhcn: "层数" }
"Min Thk": { zhcn: "最小板厚" }
"Max Thk": { zhcn: "最大板厚" }
"Core Family": { zhcn: "芯板材料" }
"PP Family": { zhcn: "PP材料" }
"Structure": { zhcn: "结构" }
"Basic Info": { zhcn: "基本信息" }
"Stackup": { zhcn: "叠构图" }
\ No newline at end of file
# 模块标题
sys_title: "Stackup Template Lib"
sys_title_en: "Stackup Template Lib"
sys_title_zhcn: "叠层模板库"
sys_title_zhtw: "疊層模板庫"
# 模块图标(普通图标在font awesome中找 http://fontawesome.io/icons/)
sys_icon: "pdm-job-stackup"
# 模块对应的插件DLL名称
sys_plugin: "toptemplateclassplugin"
# 模块对应的类名
sys_class: "TopTemplateClass4"
# 打开模块的权限
sys_open_right: ""
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: []
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
navi {
__type__: "UiLoader"
is_expanded: true
}
# 主表格
view {
# 数据项, 默认包含表头中配置的数据项
data_keys: [ "id", "stackup", "attr_data.remark" ]
# 主键
primary_key: "id"
# 水平表头
horizontal_header: [
{
"name": "attr_data.name",
"display": "Name",
"displayRole": "$attr_data.name",
"resizeMode": "ResizeToContents",
"search": "json"
},
{
"name": "layer_count",
"display": "Layer Count",
"displayRole": "$layer_count",
"resizeMode": "ResizeToContents"
},
{
"name": "min_thk",
"display": "Min Thk",
"displayRole": "$min_thk",
"resizeMode": "ResizeToContents"
},
{
"name": "max_thk",
"display": "Max Thk",
"displayRole": "$max_thk",
"resizeMode": "ResizeToContents"
},
{
"name": "attr_data.core_family",
"display": "Core Family",
"displayRole": "$attr_data.core_family",
"resizeMode": "ResizeToContents",
"search": "json"
},
{
"name": "attr_data.pp_family",
"display": "PP Family",
"displayRole": "$attr_data.pp_family",
"resizeMode": "ResizeToContents",
"search": "json"
},
{
"name": "stackup_code",
"display": "Structure",
"displayRole": "$stackup_code",
"resizeMode": "ResizeToContents"
}
]
# 默认排序列
sort_by: "id DESC"
# 数据集
data_set {
# 数据库表名
db_table_name: "pdm_stackstructlib"
# 删除标记
# 若为空表示做物理删除
db_del_flag_key: ""
# 过滤项
db_filter {
}
}
}
# 叠构图配置
stackup.draw_setting: {
# 字体设置
"font_family": "Microsoft YaHei"
# 软硬结合板中为了表示辅材的形状, 用以表示不同的层形状
"layer_shape_x" : ["-50","-10","0","50","150","230","330","380","550"],
# 层标题
"layer_title" : [" "," ","Layer","Drill","Layer Type","Material","RC", "Thickness"],
# 层高
"layer_height": "20",
# 最小长度
# 若是HDI板,钻孔增多时,会自动加长
"layer_base_lenth": "550",
# 层上的文字定义
# text: 文字内容
# DISP. 精度调整后的值
# MAT. 显示材料相关的属性
# start_zone: 文字的起始区域,layer_shape_x中的第N个区域开始(从0开始)
# offset: 相对于区域的起始点的偏移值,单位:像素
# color: 文字颜色, 若不配置颜色,会自动根据背景色算出合适的颜色
# size: 文字大小,单位:像素
# exclude_display_type: 哪种图形类型显示, 此参数命名错误,应是include_display_type,
# expand_only: 只有在展开时才显示
"layer_text" : [
{"anchor":"center","text":"layer_name","start_zone":"2","offset":"3","color":"black","exclude_display_type" : ["2","1"]},
{"anchor":"center","text":"layer_type","start_zone":"4","offset":"3","color":"black","exclude_display_type" : ["1"]},
{"anchor":"center","text":"MAT.description","start_zone":"5","offset":"10","color":"black", "size": 12, "exclude_display_type" : ["1"]},
{"anchor":"center","text":"MAT.resin_content","start_zone":"6","offset":"10","color":"black", "size": 12, "exclude_display_type" : ["1"]},
{"anchor":"center","text":"DISP.final_thk","start_zone":"7","offset":"5","color":"black","exclude_display_type" : ["1"]}
],
# 钻孔形状宽度
"drl_shape_width" : "40",
# 钻孔的间距
"drl_shape_spacing" : "0",
# 镭射钻孔形状描述
"laser_shape" : ["2","10","13","5"],
"laser_color" : "#D8934C",
"laser_filler_color" : {
"" : "white",
"None" : "white",
"SM Plugin" : "#0F8E0D",
"Resin Plugin" : "#D8C6AA",
"Via Filling" : "#D8934C",
"Resin Plugin + Capping" : "#D8987E"
},
"depth_laser_shape" : ["2","10","13","5"],
"depth_laser_color" : "#D8934C",
"depth_laser_filler_color" : {
"" : "white",
"None" : "white",
"SM Plugin" : "#0F8E0D",
"Resin Plugin" : "#D8C6AA",
"Via Filling" : "#D8934C",
"Resin Plugin + Capping" : "#D8987E"
},
"uv_laser_shape" : ["2","10","13","5"],
"uv_laser_color" : "#D8934C",
"uv_laser_filler_color" : {
"" : "white",
"None" : "white",
"SM Plugin" : "#0F8E0D",
"Resin Plugin" : "#D8C6AA",
"Via Filling" : "#D8934C",
"Resin Plugin + Capping" : "#D8987E"
},
"ivh_shape" : ["8"],
"ivh_color" : "#D8934C",
"pth_shape" : ["3","10","7"],
"pth_color" : "#D8934C",
"npth_shape" : ["8"],
"npth_color" : "white",
"mech_blind_shape": ["3","10","7"],
"mech_blind_color": "#D8934C",
"depth_milling_shape": ["16"],
"depth_milling_color": "white",
"zone_bgcolor" : "white",
"zone_line_color" : "white",
"zone_line_width" : "0",
"zone_header_margin" : "10",
"zone_header_bgcolor" : "#76AB43",
"zone_header_height" : "40",
"zone_bottom_margin" : "10",
"zone_bottom_bgcolor" : "#C8C8C8",
"zone_bottom_height" : "80",
"zone_main_top_margin" : "10",
"zone_main_about_margin" : "0",
"zone_main_bot_margin" : "10",
"zone_header_text": [
{"anchor":"center","color":"white","offset_y":-30,"text":"zone_name","offset_x":0,"font":"Sans 10 Bold"},
{"anchor":"center","color":"white","offset_y":-15,"text":"zone_title","offset_x":0,"font":"Sans Bold 12"},
{"anchor":"center","color":"white","offset_y":0,"text":"zone_type","offset_x":0,"font":"Sans 10 Bold"},
{"anchor":"center","color":"white","offset_y":15,"text":"remark","dist_y":15,"offset_x":0,"font":"Sans Bold 10"}
]
}
function func(self) {
return {
type: 'FormGridLayout',
child: [
{
name: 'layer_count',
type: 'IntLineEdit',
pack: { label: self.ttr('Layer Count') }
},
{
name: 'attr_data.core_family',
type: 'ComboBox',
pack: { label: self.ttr('Core Family') },
property: {
searchable: true,
user_data: { field_name: "attr_data->>'core_family'", operator: 'LIKE' }
}
},
{
name: 'attr_data.pp_family',
type: 'ComboBox',
pack: { label: self.ttr('PP Family') },
property: {
searchable: true,
user_data: { field_name: "attr_data->>'pp_family'", operator: 'LIKE' }
}
},
{
name: 'stackup_code',
type: 'LineEdit',
pack: { label: self.ttr('Structure') },
property: {
user_data: { operator: 'LIKE' }
}
}
]
};
}
# 工具栏
"MAIN_TOOLBAR": [
{"type":"stretcher"},
{"type":"searchentry","name":"SEARCH_ENTRY"}
{"type":"toolitem","action":"refresh"}
]
# 表格的右键菜单
"TABLEVIEW_POPUP": [
{"type":"menuitem","action":"delete"},
{"type":"separator"},
{"type":"menuitem","action":"refresh"}
]
# 底部工具栏
"BOTTOM_TOOLBAR" : [
{"type":"stretcher"},
{"type":"pagetool","name":"PAGE_TOOL"}
]
# 详细信息工具栏
"DETAIL_TOOLBAR": [
{"type":"toolitem","action":"save_detail"},
{"type":"stretcher"},
{"type":"toolitem","action":"cancel_detail"},
{"type":"toolitem","action":"refresh_detail"}
]
\ No newline at end of file
//获取总表数据
this.getTotalData = function (conditionMap) {
var treeName = "test";
var view = {
"data_keys": ["zone", "kpi_dept", "past_due", "past_due.color"],
"horizontal_header": [
{
"name": "zone",
"display": "Zone",
"displayRole": "$zone"
},
{
"name": "kpi_dept",
"display": "Kpi dept",
"displayRole": "$kpi_dept"
},
{
"name": "past_due",
"display": "Past due",
"displayRole": "$past_due",
"backgroundRole": "$past_due.color"
}
]
}
var treeData = [];
for (var i = 0; i < 5; i++) {
var data = {
"id": 1,
"zone": "Z0",
"kpi_dept": "Unreleased",
"past_due": "14",
"past_due.color": "pink",
"CHILDREN": [
{
"zone": "Z00",
"kpi_dept": "release",
"past_due": "14",
"past_due.color": "#FF99CC"
},
{
"zone": "Z01",
"kpi_dept": "release",
"past_due": "14",
"past_due.color": "#FF99CC"
},
{
"zone": "Z02",
"kpi_dept": "release",
"past_due": "14",
"past_due.color": "#FF99CC"
}
]
};
treeData.push(data)
}
var totalData = {};
totalData['name'] = treeName;
totalData['view'] = view;
totalData['data'] = treeData;
return totalData;
}
//获取分表数据
this.getSubData = function (cellData) {
var detailData = this.getTotalData(cellData);
detailData['name'] = APP.getToday() + '_' +_.random(0, 100);
return detailData;
}
try {
this.collapseAll();
} catch (e) {
print(_.toString(e));
}
/*---ACTION---
ICON: "minus-square-o"
LABEL: "Collapse All"
LABEL_ZHCN: "折叠全部"
LABEL_ZHTW: "折疊全部"
ACCEL: ""
TOOLTIP: "Collapse All"
TOOLTIP_ZHCN: "折叠全部"
TOOLTIP_ZHTW: "折疊全部"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
try {
this.expandAll();
} catch (e) {
print(_.toString(e));
}
/*---ACTION---
ICON: "plus-square-o"
LABEL: "Expand All"
LABEL_ZHCN: "展开全部"
LABEL_ZHTW: "展開全部"
ACCEL: ""
TOOLTIP: "Expand All"
TOOLTIP_ZHCN: "展开全部"
TOOLTIP_ZHTW: "展開全部"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
importPackage("moment");
importPackage('ikm.ole');
function exportToExcel(field_text_list, field_name_list, allData, excel) {
//表头字段
for (var i = 0; i< field_text_list.length; i++) {
var range = String.fromCharCode(65 + i) + "1";
excel.setRangeValue(range, field_text_list[i]);
excel.setRangeHorizontalAlignment(range, -4108);//-4108 x1center 水平居中
var font_map = {
Size: 12,
Bold: true,
Color: -11480942,
ThemeColor: 1
};
excel.setRangeFont(range, font_map);
excel.setRangeBackgroundColor(range, '#64CC33'); //背景色设为绿色
excel.autoFitColumns(String.fromCharCode(65 + i));
}
//数据
var row = 2;
_.forEach(allData, function (v) {
var j = 0;
_.forEach(field_name_list, function (v2) {
var cell = excel.getCell(row, j + 1);
excel.setCellValue(cell, _.toString(v[v2]));
j++;
})
row++;
})
//边框
var row = excel.getUsedRows();
var column = excel.getUsedColumns();
var rangecolunmn = String.fromCharCode(65 + column - 1);
var used_range = _.format("A1:{0}{1}", rangecolunmn, row);
var border = {
Color: -4165632,
LineStyle: 1,
TintAndShader: 0,
Weight: 2
};
excel.setRangeBorder(used_range, border);
}
function treeData2TableData(iDataLst, iChildrenKey) {
var allDataLst = [];
_.forEach(iDataLst, function (item) {
var childrenLst = item[iChildrenKey];
delete item[iChildrenKey];
allDataLst.push(item);
if (!_.isEmpty(childrenLst)) {
allDataLst = allDataLst.concat(treeData2TableData(childrenLst, iChildrenKey));
}
})
return allDataLst;
}
try {
var self = this;
var chooseDlg = new TTableChooserDialog();
chooseDlg.setTitle(this.ttr("Select Export Tab"));
chooseDlg.setHeaderItem([
{},
{
"name": "name",
"display": self.ttr("Name"),
"displayRole": "$name",
"resizeMode": "Stretch"
}
]);
chooseDlg.setPrimaryKey("index");
chooseDlg.setDataKeyList(["index", "name"]);
chooseDlg.loadAllData(this.allTabInfo());
var selectedTabLst = chooseDlg.run();
if (selectedTabLst.length == 0) {
return;
}
var moduleName = String(this.moduleName());
moduleName = moduleName.replace(/\-/g, " ");
var fileName = _.format("{0} {1}.xlsx", moduleName, moment().format("YYYYMMDDHHmmss"));
var fileDlg = new TFileDialog(this.ttr("Please select save file"), fileName);
fileDlg.setNameFilters(["EXCEL(*.xlsx)"]);
fileDlg.setAcceptMode("AcceptSave");
var strLst = fileDlg.run();
if (strLst.length == 0 ) {
return;
}
var absoluteFileName = String(strLst[0]);
var excel = new TExcel();
excel.setExcelVisible(true);
excel.addBook();
var i = 1;
_.forEach(selectedTabLst, function (v) {
var index = _.toNumber(v['index']);
var tabName = v['name'];
var treeView = self.getTreeView(index);
if (treeView) {
if (i > excel.getSheetsCount()) {
excel.appendSheet(tabName);
}
excel.selectSheet(i);
excel.setSheetName(tabName);
var headerItems = treeView.headerItem();
var dataLst = treeView.allDataMap();
var allData = treeData2TableData(dataLst, "CHILDREN");
var field_text_list = [];
var field_name_list = [];
_.forEach(headerItems, function (v) {
field_text_list.push(v['display']);
field_name_list.push(v['displayRole'].replace('$', ''));
});
print("field_text_list" + _.toString(field_text_list));
exportToExcel(field_text_list, field_name_list, allData, excel);
i++;
}
})
excel.saveAsBook(absoluteFileName.replace(/\//g, "\\"));
excel.closeBook();
excel.quitExcel();
this.alertOk(this.ttr("Export success!"));
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "export"
LABEL: "Export Excel"
LABEL_ZHCN: "导出Excel"
LABEL_ZHTW: "導出Excel"
ACCEL: ""
TOOLTIP: "Export Excel"
TOOLTIP_ZHCN: "导出Excel"
TOOLTIP_ZHTW: "導出Excel"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
try {
var errLst = this.uiLoader().validateAll("COMMIT", true, "ERROR");
if (!_.isEmpty(errLst)) {
var errStrLst = [];
for (var i in errLst) {
errStrLst.push(errLst[i]['text']);
}
TMessageBox.error(this, this.ttr("Validate Error"), errStrLst.join("\n"));
return;
}
var uiLoaderData = this.uiLoaderValues();
var totalData = this.getTotalData(uiLoaderData);
this.reopenTotalTab(totalData);
} catch (e) {
TMessageBox.error(this, this.ttr("Search Failed"), _.toString(e))
print(e);
}
/*---ACTION---
ICON: "search"
LABEL: "Search"
LABEL_ZHCN: "查询"
LABEL_ZHTW: "查詢"
ACCEL: ""
TOOLTIP: "Search"
TOOLTIP_ZHCN: "查询"
TOOLTIP_ZHTW: "查詢"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
try {
this.onSetUiClicked();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "cog"
LABEL: "Set Condition Ui"
LABEL_ZHCN: "编辑界面"
LABEL_ZHTW: "編輯界面"
ACCEL: ""
TOOLTIP: "Set Condition Ui"
TOOLTIP_ZHCN: "编辑界面"
TOOLTIP_ZHTW: "編輯界面"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
# 模块标题
sys_title: "SEC TABLE REPORT TEMP1"
sys_title_en: "SEC TABLE REPORT TEMP1"
sys_title_zhcn: "SEC表格类报表模板1"
sys_title_zhtw: "SEC表格类报表模板1"
# 模块图标
sys_icon: ""
# 模块对应的插件DLL名称
sys_plugin: "toptemplateclassplugin"
# 模块对应的类名
sys_class: "TopTemplateClass6"
# 打开模块的权限
sys_open_right: ""
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: []
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
# 左侧占用比例
width_ratio: 0.15
# 左侧UI
condition_ui{
table_name: "pub_conf",
path_name: "path",
path_value: "ConditionUi",
field: "json_data",
field_format: {
"json_data": "json"
}
}
# 左侧ui工具栏
"CONDITION_TOOLBAR": [
{"type":"toolitem","action":"search"},
{"type":"stretcher"},
{type:"menu", text:"", icon:"ellipsis-v",
child: [
{"type":"menuitem","action":"set_condition_ui"}
]}
]
# 工具栏
"MAIN_TOOLBAR": [
{"type":"toolitem","action":"export_excel"},
{"type":"stretcher"}
]
#所有树形控件的菜单
"TREEVIEW_POPUP": [
{"type":"menuitem","action":"collapseAll"},
{"type":"menuitem","action":"expandAll"}
]
\ No newline at end of file
try {
var ans = TMessageBox.question(this, this.ttr("Are you sure to delete selected items?"), '', '',
[this.ttr('Delete')+':Yes:Yes:Primary', this.ttr('Cancel')+':Cancel:Cancel:Normal']);
if (ans != 'Yes') {
return;
}
this.deleteItems(this.selectedItems());
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "times-circle"
LABEL: "Delete"
LABEL_ZHCN: "刪除"
LABEL_ZHTW: "刪除"
ACCEL: "Delete"
TOOLTIP: "Delete"
TOOLTIP_ZHCN: "删除"
TOOLTIP_ZHTW: "刪除"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: "size=small button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "if(this.selectedItems().length > 0 && !this.isDetailModified()){return 'enable'}else{return 'disable'}"
---ACTION---*/
\ No newline at end of file
try {
this.newItem();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "plus"
LABEL: "New"
LABEL_ZHCN: "新建"
LABEL_ZHTW: "新建"
ACCEL: "Ctrl+N"
TOOLTIP: "New"
TOOLTIP_ZHCN: "新建"
TOOLTIP_ZHTW: "新建"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "if (!this.isDetailModified()){return 'enable'} else {return 'disable'}"
---ACTION---*/
\ No newline at end of file
try {
this.reloadItem();
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "refresh"
LABEL: "Refresh"
LABEL_ZHCN: "刷新"
LABEL_ZHTW: "刷新"
ACCEL: ""
TOOLTIP: "Reload data from database"
TOOLTIP_ZHCN: "重新从数据库加载数据"
TOOLTIP_ZHTW: "重新從數據庫加載數據"
CHECKED: ""
GROUP: ""
STYLE: "button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return this.isDetailModified() ? 'hide' : 'enable';"
---ACTION---*/
\ No newline at end of file
try {
this.saveItem();
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "save"
LABEL: "Save"
LABEL_ZHCN: "保存"
LABEL_ZHTW: "保存"
ACCEL: "Ctrl+S"
TOOLTIP: "Save"
TOOLTIP_ZHCN: "保存"
TOOLTIP_ZHTW: "保存"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: " button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return (this.isDetailModified()) ? 'enable' : 'disable';"
---ACTION---*/
\ No newline at end of file
[
{
name: "basic_info_area",
type: "ScrollArea",
property: {
widget_resizable: true,
frame_shape: 'NoFrame'
},
pack: { label: self.ttr('Basic Info') },
child: [
{
name: 'formlayout',
type: 'FormGridLayout',
property: {
// label_alignment: 'AlignTop | AlignRight',
// horizontal_spacing: 10,
// vertical_spacing: 10,
// margin: 10,
columns: 2
},
child: [
{
name: "id",
type: "LineEdit",
title: self.ttr(""),
pack: {column_span: 2},
initCallback: function(obj,value,self) {
obj.setVisible(false)
}
},
{
name: "attr_data.machine_code",
type: "LineEdit",
title: self.ttr("Machine Code"),
property: { readonly: true},
validate: 'NOTNULL',
child: [
{
name: "choose_machine",
type: "ToolButton",
property: {
text: self.ttr("Choose")
},
callback: function(){
var query = new TSqlQueryV2(T_SQLCNT_POOL.getSqlDatabase());
var sql = "SELECT id,code,name FROM tpm_machine ORDER BY id DESC";
try {
var dialog = new TTableViewDialog(self)
dialog.width = 400;
dialog.height = 600;
dialog.setTitle(self.ttr("Choose Machine"));
dialog.setButtons([self.ttr('Ok')+':Ok:Ok:Primary',self.ttr('Cancel')+':Cancel:Cancel:ERROR']);
dialog.setPrimaryKey('id');
dialog.setSearchKeys(['code','name']);
dialog.setHeaderItem(
[
{
},
{
name: 'id',
display: self.ttr('ID'),
displayRole: '$id'
},
{
name: 'code',
display: self.ttr('Machine Code'),
displayRole: '$code',
size: 100
},
{
name: 'name',
display: self.ttr('Machine Name'),
displayRole: '$name',
size: 200
}
]
);
dialog.setDataKeyList(['id','code','name']);
dialog.loadData(query.selectArrayMap(sql,{}));
dialog.refreshData(true);
var ret = dialog.run();
if(_.isEmpty(ret)) return;
this.getObject('attr_data.machine_code').setData('value',ret[0]['code']);
this.getObject('attr_data.machine_name').setData('value',ret[0]['name']);
this.getObject('machine_id').setData('value',ret[0]['id']);
} catch(e) {
GUI.msgbox({detail: e})
print(e)
}
}
}
]
},
{
name: "attr_data.machine_name",
type: "LineEdit",
title: self.ttr("Machine Name"),
state: function(obj,self){
return 'disable';
}
},
{
name: "class",
type: "ComboBox",
title: self.ttr("Maintenance Type"),
property: {
item_list: TOPENM.enumList("tpm-machine-maintenance-plan-class").toComboList()
},
validate: 'NOTNULL'
},
{
name: "title",
type: "LineEdit",
title: self.ttr("Title"),
},
{
name: "priority",
type: "ComboBox",
title: self.ttr("Priority"),
property: {
item_list: TOPENM.enumList("tpm-machine-maintenance-plan-priority").toComboList()
},
},
{
name: "category",
type: "ComboBox",
title: self.ttr("Maintenance Category"),
property: {
item_list: TOPENM.enumList("tpm-machine-maintenance-plan-category").toComboList()
},
},
{
name: "execution_cycle",
type: "ComboBox",
title: self.ttr("Execution Type"),
property: {
item_list: TOPENM.enumList("tpm-machine-maintenance-plan-execution-cycle").toComboList()
},
validate: 'NOTNULL'
},
{
type: 'HBoxLayout',
title: self.ttr("Execution Cycle"),
state: function(obj,self){
if (this.getValue("execution_cycle") == "cycle"){
return 'show';
}
return 'hide';
},
child: [
{
name: "attr_data.cycle_value",
type: "IntLineEdit",
title: self.ttr("Cycle Value"),
state: function(obj,self){
if (this.getValue("execution_cycle") == "cycle"){
return 'show';
}
return 'hide';
},
},
{
name: "attr_data.cycle_unit",
type: "ComboBox",
title: self.ttr("Cycle Unit"),
state: function(obj,self){
if (this.getValue("execution_cycle") == "cycle"){
return 'show';
}
return 'hide';
},
property: {
item_list: TOPENM.enumList("tpm-machine-maintenance-plan-cycle").toComboList()
},
}
]
},
{
name: "last_execution_time",
type: "DateTimeEdit",
title: self.ttr("Last Execution Time"),
state: function(obj,self){
return 'disable';
},
getter: function(obj,self){
if(_.isEmpty(obj.getData())){
return null;
}
return obj.getData();
}
},
{
name: "next_execution_time",
type: "DateTimeEdit",
title: self.ttr("Next Execution Time"),
getter: function(obj,self){
if(_.isEmpty(obj.getData())){
return null;
}
return obj.getData();
},
validate: "NOTNULL"
},
{
name: "status",
type: "ComboBox",
title: self.ttr("Status"),
property: {
item_list: TOPENM.enumList("tpm-machine-maintenance-plan-status").toComboList()
}
},
{
type: 'HBoxLayout'
},
{
name: "maintenance_person_name",
type: "LineEdit",
title: self.ttr("Maintenance Person"),
pack: {column_span: 2},
getter: function(obj,self){
if (_.isEmpty(obj.getData())){
return null;
}
return obj.getData().split(',');
},
setter: function(obj,val,self){
if (_.isEmpty(val))return;
val = val.replace('{','[');
val = val.replace('}',']');
obj.setData('value',eval('(' + val + ')').join(','))
},
child: [
{
name: "choose_person",
type: "ToolButton",
property: {
text: self.ttr("Choose")
},
callback: function(){
var query = new TSqlQueryV2(T_SQLCNT_POOL.getSqlDatabase());
var sql = "SELECT id,fullname FROM sys_user ORDER BY id DESC";
try {
var dialog = new TTableViewDialog(self)
dialog.width = 400;
dialog.height = 600;
dialog.setTitle(self.ttr("Choose Person"));
dialog.setButtons([self.ttr('Ok')+':Ok:Ok:Primary',self.ttr('Cancel')+':Cancel:Cancel:ERROR']);
dialog.setPrimaryKey('id');
dialog.setSearchKeys(['fullname']);
dialog.setSelectionMode(3);
dialog.setHeaderItem(
[
{
},
{
name: 'id',
display: self.ttr('ID'),
displayRole: '$id'
},
{
name: 'fullname',
display: self.ttr('Name'),
displayRole: '$fullname',
size: 200
}
]
);
dialog.setDataKeyList(['id','fullname']);
dialog.loadData(query.selectArrayMap(sql,{}));
dialog.refreshData(true);
var ret = dialog.run();
if(_.isEmpty(ret)) return;
var idList = [];
var nameList = [];
_.each(ret,function(people){
idList.push(people.id);
nameList.push(people.fullname)
});
this.getObject('maintenance_person_name').setData('value',nameList.join(','));
this.getObject('maintenance_person_ids').setData('value',idList.join(','));
} catch(e) {
GUI.msgbox({detail: e})
print(e)
}
}
}
]
},
{
name: "description",
type: "PlainTextEdit",
title: self.ttr("Maintenance Content"),
pack: {column_span: 2},
property: {
min_row_count: 8
}
},
{
name: "maintenance_person_ids",
type: "LineEdit",
pack: {column_span: 2},
initCallback: function(obj,value,self) {
obj.setVisible(false)
},
getter: function(obj,self){
if (_.isEmpty(obj.getData())){
return null;
}
return obj.getData().split(',');
},
setter: function(obj,val,self){
if (_.isEmpty(val))return;
val = val.replace('{','[');
val = val.replace('}',']');
obj.setData('value',eval('(' + val + ')').join(','))
},
},
{
name: "machine_id",
type: "LineEdit",
initCallback: function(obj,value,self) {
obj.setVisible(false)
}
},
{
type: 'Stretch'
}
]
}
]
}
]
\ No newline at end of file
"Title": {en: "Title", zhcn: "标题", zhtw: "標題"}
"Navigation": {en: "Navigation", zhcn: "导航栏", zhtw: "導航欄"}
"Display Navigation": {en: "Display Navigation", zhcn: "显示导航栏", zhtw: "顯示導航欄"}
"Hide Navigation": {en: "Hide Navigation", zhcn: "隐藏导航栏", zhtw: "隱藏導航欄"}
"Catergory": {en: "Catergory", zhcn: "分类", zhtw: "分類"}
"Priority": {en: "Priority", zhcn: "优先级", zhtw: "優先級"}
"Last execution time": {en: "Last execution time", zhcn: "上次维护时间", zhtw: "上次維護時間"}
"Next execution time": {en: "Next execution time", zhcn: "下次维护时间", zhtw: "下次維護時間"}
"Machine Code": {en: "Machine Code", zhcn: "设备编号", zhtw: "設備編號"}
"Machine Name": {en: "Machine Name", zhcn: "设备名称", zhtw: "設備名稱"}
"Maintenance Type": {en: "Maintenance Type", zhcn: "维护类型", zhtw: "維護類型"}
"Maintenance Category": {en: "Maintenance Category", zhcn: "维护分类", zhtw: "維護分類"}
"Execution Type": {en: "Execution Type", zhcn: "计划类型", zhtw: "計劃類型"}
"Execution Cycle": {en: "Execution Cycle", zhcn: "计划周期", zhtw: "計劃週期"}
"Status": {en: "Status", zhcn: "状态", zhtw: "狀態"}
"Last Execution Time": {en: "Last Execution Time", zhcn: "上次执行时间", zhtw: "上次執行時間"}
"Next Execution Time": {en: "Next Execution Time", zhcn: "下次执行时间", zhtw: "下次執行時間"}
"Maintenance Person": {en: "Maintenance Person", zhcn: "维护人员", zhtw: "維護人員"}
"Maintenance Content": {en: "Maintenance Content", zhcn: "维护内容", zhtw: "維護內容"}
"Class": {en: "Maintenance Class", zhcn: "维护类型", zhtw: "維護類型"}
"Load data successful!": {en: "Load data successful!" ,zhcn: "加载数据完成!" ,zhtw: "加載數據完成!"}
"Exec Plan": {en: "Exec Plan", zhcn: "执行计划", zhtw: "執行計劃"}
"Class": {en: "Maintenance Class", zhcn: "维护类型", zhtw: ""}
"Choose": {en: "Choose", zhcn: "选择", zhtw: "選擇"}
"Choose Machine": {en: "Choose Machine", zhcn: "选择设备", zhtw: "選擇設備"}
"Choose Person": {en: "Choose Person", zhcn: "选择人员", zhtw: "選擇人員"}
"Record No": {en: "Record No", zhcn: "记录单号", zhtw: "記錄單號"}
"Apply Time": {en: "Apply Time", zhcn: "申请时间", zhtw: "申請時間"}
"Apply Person": {en: "Apply Person", zhcn: "申请人", zhtw: "申請人"}
"Start Time": {en: "Start Time", zhcn: "开始时间", zhtw: "開始時間"}
"End Time": {en: "End Time", zhcn: "结束时间", zhtw: "結束時間"}
"Basic Info": {en: "Basic Info", zhcn: "基本信息", zhtw: "基本信息"}
"Ok": {en: "OK", zhcn: "确定", zhtw: "確定"}
"Cancel": {en: "Cancel", zhcn: "取消", zhtw: "取消"}
"Cycle Value": {en: "Cycle Value", zhcn: "周期", zhtw: "週期"}
"Cycle Unit": {en: "Cycle Unit", zhcn: "周期单位", zhtw: "週期單位"}
"Name": {en: "Name", zhcn: "姓名", zhtw: "姓名"}
\ No newline at end of file
# 模块标题
sys_title: "Template Demo - Table With Category And Detail"
sys_title_en: "Template Demo - Table With Category And Detail"
sys_title_zhcn: "带导航栏和详细信息的单表展示"
sys_title_zhtw: ""
# 模块图标
sys_icon: "wpforms"
# 模块对应的插件DLL名称
sys_plugin: "toptemplateclassplugin"
# 模块对应的类名
sys_class: "TopTemplateClass4"
# 许可证验证键
sys_license_key: ""
# 打开模块的权限
sys_open_right: ""
# 语言包,默认包含自己模块的语言包
sys_lang_list: []
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: []
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
# 导航栏
# is_checkable,=true 或1, 表示支持checkbox形式; =false 或0, 表示非checkbox形式
navi: {
__type__: CategoryTreeViewAndAdvancedQuery,
is_checkable: 1,
categories: [
{
name: "class",
text: "Maintenance Type",
icon: "",
visible: 1,
expand: 1,
checked: 0,
data: "",
children: [
{ name: "repair", text: "repair", data: "class", checked: 1, VISIBLE:1 },
{ name: "maintenance", text: "maintenance", data: "class", checked: 1, VISIBLE:1 },
{ name: "spot_check", text: "spot_check", data: "class", checked: 1, VISIBLE:1 }
],
enum_children: "tpm-machine-maintenance-plan-class",
enum_checked:["repair"],
enum_invisible:[]
},
{
name: "category",
text: "Catergory",
icon: "",
visible: 1,
expand: 1,
checked: 0,
data: "",
children: [],
enum_children: "tpm-machine-maintenance-plan-category",
enum_checked:["overhaul", "part_repairing", "lubrication", "sealing"],
enum_invisible:[]
}
]
}
# 高级查询
advance: {
"advanced_items" : [
{"name" : "attr_data.machine_code", "title" : "Machine Code" , "widgetType" : "LineEdit" , "wgt_prop" : "" , "optionList" : []},
{"name" : "attr_data.machine_name", "title" : "Machine Name" , "widgetType" : "LineEdit" , "wgt_prop" : "" , "optionList" : []},
{"name" : "title", "title" : "Title" , "widgetType" : "LineEdit" , "wgt_prop" : "" , "optionList" : []},
{"name" : "class", "title" : "Class" , "widgetType" : "ComboBox" , "wgt_prop" : "" , "optionList" : "enum(tpm-machine-maintenance-plan-class)"}
],
"condition" :{
"condition": "1 and 2",
"value": [
{
"ignoreEmpty": false,
"name": "attr_data.machine_code",
"operator": "LIKE",
"title": "Machine Code",
"valid": true,
"value1": "00"
},
{
"ignoreEmpty": false,
"name": "attr_data.machine_name",
"operator": "LIKE",
"title": "Machine Name",
"valid": true,
"value1": "4"
}
]
}
}
# 主表格
view {
# 数据项, 默认包含表头中配置的数据项
data_keys: ["id","class","status","attr_data.machine_code","attr_data.machine_name","machine_id","execution_cycle","attr_data.cycle_value","attr_data.cycle_unit"
"title","category","priority","last_execution_time","next_execution_time","description","maintenance_person_name"]
# 主键
primary_key: "id"
# 水平表头
horizontal_header: [
{
"name": "attr_data.machine_code",
"display": "Machine Code",
"displayRole": "$attr_data.machine_code",
"size": 100
},
{
"name": "attr_data.machine_name",
"display": "Machine Name",
"displayRole": "$attr_data.machine_name",
"size": 100
},
{
"name": "title",
"display": "Title",
"displayRole": "$title",
"size": 100,
"search": "string"
},
{
"name": "class",
"display": "Class",
"displayRole": "$class.text",
"size": 100,
"format": "enum(tpm-machine-maintenance-plan-class)"
},
{
"name": "category",
"display": "Catergory",
"displayRole": "$category.text",
"size": 100
"format": "enum(tpm-machine-maintenance-plan-category)"
},
{
"name": "priority",
"display": "Priority",
"displayRole": "$priority",
"size": 100
},
{
"name": "status",
"display": "Status",
"displayRole": "$status.text",
"size": 100,
"format": "enum(tpm-machine-maintenance-plan-status)"
},
{
"name": "last_execution_time",
"display": "Last execution time",
"displayRole": "$last_execution_time",
"size": 200
},
{
"name": "next_execution_time",
"display": "Next execution time",
"displayRole": "$next_execution_time",
"size": 200
}
]
# 默认排序列
sort_by: "id DESC"
# 数据集
data_set {
# 数据库表名
db_table_name: "tpm_machine_maintenance_plan"
db_filter: ""
}
}
# 模块标题
sys_title: "Template Demo - Homepage"
sys_title_en: "Template Demo - Homepage"
sys_title_zhcn: "主页"
sys_title_zhtw: ""
# 模块图标
sys_icon: "wpforms"
# 模块对应的插件DLL名称
sys_plugin: "toptemplateclassplugin"
# 模块对应的类名
sys_class: "TopTemplateClass0A"
# 许可证验证键
sys_license_key: ""
# 打开模块的权限
sys_open_right: ""
# 语言包,默认包含自己模块的语言包
sys_lang_list: []
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: []
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
# 背景图相对路径,相对于APP.appPlatformPath()
background_image_path: "resource/image/homepage.png"
\ No newline at end of file
try {
this.refreshMaster(false);
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "refresh"
LABEL: "Refresh"
LABEL_ZHCN: "刷新"
LABEL_ZHTW: "刷新"
ACCEL: "F5"
TOOLTIP: "Refresh"
TOOLTIP_ZHCN: "刷新"
TOOLTIP_ZHTW: "刷新"
CHECKED: ""
GROUP: ""
STYLE: "size=small button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
# 模块标题
sys_title: "Template Demo - Master & Slave"
sys_title_en: "Template Demo - Master & Slave"
sys_title_zhcn: "主从表展示"
sys_title_zhtw: ""
# 模块图标
sys_icon: "wpforms"
# 模块对应的插件DLL名称
sys_plugin: "toptemplateclassplugin"
# 模块对应的类名
sys_class: "TopTemplateClass5"
# 许可证验证键
sys_license_key: ""
# 打开模块的权限
sys_open_right: ""
# 语言包,默认包含自己模块的语言包
sys_lang_list: []
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: [
"pdm-job-status"
]
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
# 主表格
master_view {
# 数据项, 默认包含表头中配置的数据项
data_keys: [ "id" ]
# 主键
primary_key: "id"
# 水平表头
horizontal_header: [
{
"name": "id",
"display": "Role ID",
"displayRole": "$id"
},
{
"name": "name",
"display": "Role Name",
"displayRole": "$name",
"width": 150,
"search": "string"
}
]
# 默认排序列
sort_by: "id DESC"
# 数据集
data_set {
# 数据库表名
db_table_name: "sys_role"
# 若有sql, 以sql为最优先
# 若无sql, 默认根据表头的配置进行查询
db_sql: ""
}
# 主从表关系配置
relation {
type: "hasMany"
through: "sys_role_map_user"
master_foreign_key: "role_id"
master_key: "id"
slave_foreign_key: "user_id"
slave_key: "id"
}
}
# 从表格
slave_view {
# 数据项, 默认包含表头中配置的数据项
data_keys: [ "id" ]
# 主键
primary_key: "id"
# 水平表头
horizontal_header: [
{
"name": "id",
"display": "User ID",
"displayRole": "$id",
"width": 150
},
{
"name": "username",
"display": "User Name",
"displayRole": "$username"
},
{
"name": "status",
"display": "Status",
"displayRole": "$status",
"sorting_enabled": 0
}
]
# 默认排序列
sort_by: "id DESC"
# 数据集
data_set {
# 数据库表名
db_table_name: "sys_user"
# 若有sql, 以sql为最优先
# 若无sql, 默认根据表头的配置进行查询
db_sql: ""
}
}
\ No newline at end of file
# 主表工具栏
"MASTER_TOOLBAR": [
{"type":"stretcher"},
{"type":"searchentry","name":"SEARCH_ENTRY"}
{"type":"toolitem","action":"refresh_master"}
]
# 表格的右键菜单
"MASTER_POPUP": [
{"type":"menuitem","action":"refresh_master"}
]
# 主表底部工具栏
"MASTER_BOTTOM_TOOLBAR" : [
{"type":"stretcher"},
{"type":"pagetool","name":"PAGE_TOOL"}
]
\ No newline at end of file
try {
var data = {
"1-6.dat": {
"title": "1-6层钻孔程序",
"data": [
{
"tool_num": "T01",
"tool_type": "P",
"finish_size": "0.3",
"size_tol_lower": "-∞",
"size_tol_upper": "0.05",
"drill_size": "0.3"
},
{
"tool_num": "T02",
"tool_type": "P",
"finish_size": "0.4",
"size_tol_lower": "-∞",
"size_tol_upper": "0.05",
"drill_size": "0.4"
}
]
},
"2-5.dat": {
"title": "2-5层钻孔程序",
"data": [
{
"tool_num": "T03",
"tool_type": "P",
"finish_size": "0.3",
"size_tol_lower": "-∞",
"size_tol_upper": "0.05",
"drill_size": "0.3"
},
{
"tool_num": "T04",
"tool_type": "P",
"finish_size": "0.4",
"size_tol_lower": "-∞",
"size_tol_upper": "0.05",
"drill_size": "0.4"
}
]
}
};
this.loadTreeData(data);
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "refresh"
LABEL: "Refresh"
LABEL_ZHCN: "刷新"
LABEL_ZHTW: "刷新"
ACCEL: "F5"
TOOLTIP: "Refresh"
TOOLTIP_ZHCN: "刷新"
TOOLTIP_ZHTW: "刷新"
CHECKED: ""
GROUP: ""
STYLE: "size=small button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
# 模块标题
sys_title: "Template Demo - Master & Slave"
sys_title_en: "Template Demo - Master & Slave"
sys_title_zhcn: "主从表展示"
sys_title_zhtw: ""
# 模块图标
sys_icon: "wpforms"
# 模块对应的插件DLL名称
sys_plugin: "toptemplateclassplugin"
# 模块对应的类名
sys_class: "TopTemplateClass5"
# 许可证验证键
sys_license_key: ""
# 打开模块的权限
sys_open_right: ""
# 语言包,默认包含自己模块的语言包
sys_lang_list: []
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: []
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
#主从表显示比例
master_slave_ratio: "1:9"
# 主表格
master_view {
# 数据项, 默认包含表头中配置的数据项
data_keys: [ "name" ]
# 主键
primary_key: "name"
# 水平表头
horizontal_header: [
{
"name": "title",
"display": "Drill Title",
"displayRole": "$title",
"width": 150,
"search": "string"
}
]
}
# 从表格
slave_view {
# 数据项, 默认包含表头中配置的数据项
data_keys: [ ]
# 主键
primary_key: ""
# 水平表头
horizontal_header: [
{
"name": "tool_num",
"display": "Tool Num",
"displayRole": "$tool_num"
},
{
"name": "tool_type",
"display": "Tool Type",
"displayRole": "$tool_type"
},
{
"name": "finish_size",
"display": "Finish Size",
"displayRole": "$finish_size"
},
{
"name": "size_tol_lower",
"display": "Size Tol Lower",
"displayRole": "$size_tol_lower"
},
{
"name": "size_tol_upper",
"display": "Size Tol Upper",
"displayRole": "$size_tol_upper"
},
{
"name": "drill_size",
"display": "Drill Size",
"displayRole": "$drill_size"
}
]
}
\ No newline at end of file
# 主表工具栏
"MASTER_TOOLBAR": [
{"type":"stretcher"},
{"type":"searchentry","name":"SEARCH_ENTRY"}
{"type":"toolitem","action":"refresh_master"}
]
# 表格的右键菜单
"MASTER_POPUP": [
{"type":"menuitem","action":"refresh_master"}
]
# 主表底部工具栏
"MASTER_BOTTOM_TOOLBAR" : [
{"type":"stretcher"},
{"type":"pagetool","name":"PAGE_TOOL"}
]
\ No newline at end of file
try {
var data = {
"1-6.dat": {
"title": "1-6层钻孔程序",
"data": [
{
"tool_num": "T01",
"tool_type": "P",
"finish_size": "0.3",
"size_tol_lower": "-∞",
"size_tol_upper": "0.05",
"drill_size": "0.3"
},
{
"tool_num": "T02",
"tool_type": "P",
"finish_size": "0.4",
"size_tol_lower": "-∞",
"size_tol_upper": "0.05",
"drill_size": "0.4"
}
]
},
"2-5.dat": {
"title": "2-5层钻孔程序",
"data": [
{
"tool_num": "T03",
"tool_type": "P",
"finish_size": "0.3",
"size_tol_lower": "-∞",
"size_tol_upper": "0.05",
"drill_size": "0.3"
},
{
"tool_num": "T04",
"tool_type": "P",
"finish_size": "0.4",
"size_tol_lower": "-∞",
"size_tol_upper": "0.05",
"drill_size": "0.4"
}
]
}
};
this.loadTreeData(data);
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "refresh"
LABEL: "Refresh"
LABEL_ZHCN: "刷新"
LABEL_ZHTW: "刷新"
ACCEL: "F5"
TOOLTIP: "Refresh"
TOOLTIP_ZHCN: "刷新"
TOOLTIP_ZHTW: "刷新"
CHECKED: ""
GROUP: ""
STYLE: "size=small button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
# 模块标题
sys_title: "Template Demo - Master & Slave"
sys_title_en: "Template Demo - Master & Slave"
sys_title_zhcn: "主从表展示"
sys_title_zhtw: ""
# 模块图标
sys_icon: "wpforms"
# 模块对应的插件DLL名称
sys_plugin: "toptemplateclassplugin"
# 模块对应的类名
sys_class: "TopTemplateClass5"
# 许可证验证键
sys_license_key: ""
# 打开模块的权限
sys_open_right: ""
# 语言包,默认包含自己模块的语言包
sys_lang_list: []
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: []
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
#模块初次运行时,主从详情显示比例master:slave:uiloader
master_slave_ratio: "1:9:3"
# 主表格
master_view {
# 数据项, 默认包含表头中配置的数据项
data_keys: [ "name" ]
# 主键
primary_key: "name"
# 水平表头
horizontal_header: [
{
"name": "title",
"display": "Drill Title",
"displayRole": "$title",
"width": 150,
"search": "string"
}
]
}
# 从表格
slave_view {
# 数据项, 默认包含表头中配置的数据项
data_keys: [ ]
# 主键
primary_key: ""
# 水平表头
horizontal_header: [
{
"name": "tool_num",
"display": "Tool Num",
"displayRole": "$tool_num"
},
{
"name": "tool_type",
"display": "Tool Type",
"displayRole": "$tool_type"
},
{
"name": "finish_size",
"display": "Finish Size",
"displayRole": "$finish_size"
},
{
"name": "size_tol_lower",
"display": "Size Tol Lower",
"displayRole": "$size_tol_lower"
},
{
"name": "size_tol_upper",
"display": "Size Tol Upper",
"displayRole": "$size_tol_upper"
},
{
"name": "drill_size",
"display": "Drill Size",
"displayRole": "$drill_size"
}
]
}
\ No newline at end of file
# 主表工具栏
"MASTER_TOOLBAR": [
{"type":"stretcher"},
{"type":"searchentry","name":"SEARCH_ENTRY"}
{"type":"toolitem","action":"refresh_master"}
]
# 表格的右键菜单
"MASTER_POPUP": [
{"type":"menuitem","action":"refresh_master"}
]
# 主表底部工具栏
"MASTER_BOTTOM_TOOLBAR" : [
{"type":"stretcher"},
{"type":"pagetool","name":"PAGE_TOOL"}
]
\ No newline at end of file
try {
this.refreshMaster(false);
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "refresh"
LABEL: "Refresh"
LABEL_ZHCN: "刷新"
LABEL_ZHTW: "刷新"
ACCEL: "F5"
TOOLTIP: "Refresh"
TOOLTIP_ZHCN: "刷新"
TOOLTIP_ZHTW: "刷新"
CHECKED: ""
GROUP: ""
STYLE: "size=small button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
[
{
name: "nothing",
type: "VBoxLayout",
child: [
{
name: "table(master).id",
type: "IntLineEdit"
},
{
name: "table(slave).id",
type: "IntLineEdit"
}
]
}
]
# 模块标题
sys_title: "Template Demo - Master & Slave"
sys_title_en: "Template Demo - Master & Slave"
sys_title_zhcn: "主从表展示"
sys_title_zhtw: ""
# 模块图标
sys_icon: "wpforms"
# 模块对应的插件DLL名称
sys_plugin: "toptemplateclassplugin"
# 模块对应的类名
sys_class: "TopTemplateClass5"
# 许可证验证键
sys_license_key: ""
# 打开模块的权限
sys_open_right: ""
# 语言包,默认包含自己模块的语言包
sys_lang_list: []
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: [
"pdm-job-status"
]
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
# 主表格
master_view {
# 数据项, 默认包含表头中配置的数据项
data_keys: [ "id" ]
# 主键
primary_key: "id"
# 水平表头
horizontal_header: [
{
"name": "id",
"display": "Group ID",
"displayRole": "$id"
},
{
"name": "name",
"display": "Group Name",
"displayRole": "$name",
"width": 150,
"search": "string"
},
{
"name": "title",
"display": "Group Title",
"displayRole": "$title",
"sorting_enabled": 0
}
]
# 默认排序列
sort_by: "id DESC"
# 数据集
data_set {
# 数据库表名
db_table_name: "pdm_spec_group"
# 若有sql, 以sql为最优先
# 若无sql, 默认根据表头的配置进行查询
db_sql: ""
}
# 主从表关系配置
relation {
type: "hasMany"
through: "pdm_spec_group_lnk_spec"
master_foreign_key: "group_id"
master_key: "id"
slave_foreign_key: "spec_name"
slave_key: "name"
}
}
# 从表格
slave_view {
# 数据项, 默认包含表头中配置的数据项
data_keys: [ "id" ]
# 主键
primary_key: "id"
# 水平表头
horizontal_header: [
{
"name": "id",
"display": "Spec ID",
"displayRole": "$id",
"width": 150
},
{
"name": "name",
"display": "Spec Name",
"displayRole": "$name"
},
{
"name": "title",
"display": "Spec Title",
"displayRole": "$title",
"sorting_enabled": 0
},
{
"name": "category",
"display": "Spec Category",
"displayRole": "$category",
"sorting_enabled": 0
}
]
# 默认排序列
sort_by: "id DESC"
# 数据集
data_set {
# 数据库表名
db_table_name: "pdm_spec"
# 若有sql, 以sql为最优先
# 若无sql, 默认根据表头的配置进行查询
db_sql: ""
}
}
\ No newline at end of file
# 主表工具栏
"MASTER_TOOLBAR": [
{"type":"stretcher"},
{"type":"searchentry","name":"SEARCH_ENTRY"}
{"type":"toolitem","action":"refresh_master"}
]
# 表格的右键菜单
"MASTER_POPUP": [
{"type":"menuitem","action":"refresh_master"}
]
# 主表底部工具栏
"MASTER_BOTTOM_TOOLBAR" : [
{"type":"stretcher"},
{"type":"pagetool","name":"PAGE_TOOL"}
]
\ No newline at end of file
this.afterModuleInit = function() {
print("afterModuleInit")
}
this.afterViewInit = function() {
try {
print("afterViewInit")
this.tableView().activated.connect(function(){
print("activated");
});
} catch(e) {
print(e);
}
}
this.onDestroy = function() {
print("onDestroy")
}
this.add = function(v, k, arg1, arg2) {
print(v, k, arg1, arg2);
return _.toNumber(v) * 20;
}
\ No newline at end of file
try {
this.refresh(false);
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "refresh"
LABEL: "Refresh"
LABEL_ZHCN: "刷新"
LABEL_ZHTW: "刷新"
ACCEL: "F5"
TOOLTIP: "Refresh"
TOOLTIP_ZHCN: "刷新"
TOOLTIP_ZHTW: "刷新"
CHECKED: ""
GROUP: ""
STYLE: "size=small button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
"Layer Count": {en: "", zhcn: "板层数"}
"Job Name": {en: "", zhcn: "料号名"}
"Job Status": {en: "", zhcn: "状态"}
\ No newline at end of file
# 模块标题
sys_title: "Template Demo - Single Table Show"
sys_title_en: "Template Demo - Single Table Show"
sys_title_zhcn: "单表信息展示"
sys_title_zhtw: ""
# 模块图标
sys_icon: "wpforms"
# 模块对应的插件DLL名称
sys_plugin: "toptemplateclassplugin"
# 模块对应的类名
sys_class: "TopTemplateClass1"
# 许可证验证键
sys_license_key: ""
# 打开模块的权限
sys_open_right: ""
# 语言包,默认包含自己模块的语言包
sys_lang_list: []
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: [
"pdm-job-status"
]
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
# 主表格
view {
# 数据项, 默认包含表头中配置的数据项
data_keys: [ "id" ]
# 主键
primary_key: "id"
# 水平表头
horizontal_header: [
{
"name": "jobname",
"display": "Job Name",
"displayRole": "$jobname",
"width": 150,
"search": "string"
},
{
"name": "job_attrs.layer_count",
"display": "Layer Count",
"displayRole": "$job_attrs.layer_count",
"format": "hook(add(3,4))"
},
{
"name": "job_status",
"display": "Job Status",
"displayRole": "$job_status.text",
"decorationRole": "$job_status.icon",
"format": "enum(pdm-job-status)",
"sorting_enabled": 0
}
]
# 默认排序列
sort_by: "id DESC"
# 数据集
data_set {
# 数据库表名
db_table_name: "pdm_job"
# 若有sql, 以sql为最优先
# 若无sql, 默认根据表头的配置进行查询
db_sql: ""
}
}
# 工具栏
"MAIN_TOOLBAR": [
{"type":"stretcher"},
{"type":"searchentry","name":"SEARCH_ENTRY"}
{"type":"toolitem","action":"refresh"}
]
# 表格的右键菜单
"TABLEVIEW_POPUP": [
{"type":"menuitem","action":"refresh"}
]
# 底部工具栏
"BOTTOM_TOOLBAR" : [
{"type":"stretcher"},
{"type":"pagetool","name":"PAGE_TOOL"}
]
\ No newline at end of file
# 模块标题
sys_title: "Template Demo - Single Tree Show"
sys_title_en: "Template Demo - Single Tree Show"
sys_title_zhcn: "树形信息展示"
sys_title_zhtw: ""
# 模块图标
sys_icon: "wpforms"
# 模块对应的插件DLL名称
sys_plugin: "toptemplateclassplugin"
# 模块对应的类名
sys_class: "TopTemplateClass1A"
# 许可证验证键
sys_license_key: ""
# 打开模块的权限
sys_open_right: ""
# 语言包,默认包含自己模块的语言包
sys_lang_list: []
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: []
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
# 主表格
view {
# 数据项, 默认包含表头中配置的数据项
data_keys: [ "id", "part_code", "parent_part_code" ]
# 主键
primary_key: "id"
# 分组键
group_key: "part_code"
# 父结点键
# 当无此值,表示按照group_key进行分组,树形结构只有一级
# 当有此值,表示按照parent_key生成树形结果,可能有多级
parent_key: "parent_part_code"
# 同级结点排序的键
seq_key: "seq"
# 水平表头
horizontal_header: [
{
"name": "part_title",
"display": "Part Title",
"displayRole": "$part_title",
"width": 150
},
{
"name": "sys_version",
"display": "Sys Version",
"displayRole": "$sys_version",
"width": 150,
},
{
"name": "status",
"display": "Status",
"displayRole": "$status",
"width": 150
}
]
# 默认排序列
sort_by: ""
# 数据集
data_set {
# 数据库表名
db_table_name: ""
# 若有sql, 以sql为最优先
# 若无sql, 默认根据表头的配置进行查询
db_sql: """
SELECT id, part_code, parent_part_code, part_title, sys_version, status
FROM
(
SELECT *, rank() OVER( PARTITION BY part_code ORDER BY sys_version DESC ) AS r
FROM mes_partnumber_prod_parts
WHERE partnumber_id = 28 AND status != 'deleted' AND sys_version <= 99999999
) AS t
WHERE r = 1
"""
}
}
try {
this.refresh();
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "refresh"
LABEL: "Refresh"
LABEL_ZHCN: "刷新"
LABEL_ZHTW: "刷新"
ACCEL: "F5"
TOOLTIP: "Refresh"
TOOLTIP_ZHCN: "刷新"
TOOLTIP_ZHTW: "刷新"
CHECKED: ""
GROUP: ""
STYLE: "size=small button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
# 表格的右键菜单
"TREEVIEW_POPUP": [
{"type":"menuitem","action":"refresh"}
]
# 工具栏
"MAIN_TOOLBAR": [
{"type":"stretcher"},
{"type":"searchentry","name":"SEARCH_ENTRY"}
{"type":"toolitem","action":"refresh"}
]
\ No newline at end of file
this.afterViewInit = function() {
print("afterViewInit");
var self = this;
print("self.uim(): ", self.uim());
var label1 = self.uim().getWidget("MAIN_TOOLBAR/label1");
print("label1: ", label1);
print("text:", label1.text);
}
\ No newline at end of file
"Are you sure to remove selected items?": {en: "Are you sure to remove selected items?",zhcn: "确定要移除所选项吗?"}
"Calc Impedance": {en: "Calc Impedance",zhcn: "计算阻抗"}
"Calc Mode": {en: "Calc Mode",zhcn: "计算方式"}
"Coupon": {en: "Coupon", zhcn: "测试条"}
"Coupon Name": {en: "Coupon Name",zhcn: "测试条"}
"Display Mode": {en: "Display Mode",zhcn: "显示模式"}
"Edit Impedance": {en: "Edit Impedance",zhcn: "编辑阻抗"}
"Imp Tol Value": {en: "Imp Tol Value",zhcn: "阻抗公差值"}
"Impedance Type": {en: "Impedance Type",zhcn: "阻抗类型"}
"Impedance value outof range!": {en: "Impedance value outof range!",zhcn: "阻抗值超出范围!"}
"Line Width Range": {en: "Line Width Range",zhcn: "线宽范围"}
"Line width outof range!": {en: "Line width outof range!",zhcn: "线宽超出范围!"}
"New Impedance": {en: "New Impedance",zhcn: "新建阻抗"}
"Org Gnd Spacing": {en: "Org Gnd Spacing",zhcn: "原稿铜面间距"}
"Org Line Width": {en: "Org Line Width",zhcn: "原稿线宽"}
"Org Spacing": {en: "Org Spacing",zhcn: "原稿线距"}
"Org W/S": {en: "Org W/S",zhcn: "原稿线宽/间距"}
"Polar Type": {en: "Polar Type",zhcn: "Polar 类型"}
"Ref Layer": {en: "Ref Layer",zhcn: "参考层"}
"Signal Layer": {en: "Signal Layer",zhcn: "信号层"}
"Target Impedance": {en: "Target Impedance",zhcn: "目标阻抗值"}
"This job has no coupon data,please check job name!": {en: "This job has no coupon data,please check job name!",zhcn: "当前job没有coupon数据,请确认job名称是否正确"}
"Choose Unit" : {en: "Choose Unit", zhcn: "选择单位"}
"Row": {en: "Row", zhcn: "行号"}
"Type": {en: "Type", zhcn: "类型"}
"Target": {en: "Target", zhcn: "目标阻抗"}
"Calc Tol": {en: "Calc Tol", zhcn: "计算公差"}
"Calc Tol Value": {en: "", zhcn: "计算公差值"}
"Org To Groud": {en: "Org To Groud", zhcn: "原稿距铜"}
"Cal. W/S": {en: "Cal. W/S", zhcn: "计算线宽/间距"}
"To Groud": {en: "To Groud", zhcn: "距铜"}
"Alert Msg": {en: "Alert Msg", zhcn: "警报信息"}
"Test Line Length": {en: "Test Line Length", zhcn: "阻抗条线宽"}
"Line Adjust": {en: "Line Adjust", zhcn: "线宽范围"}
"Unit": { en: "Unit", zhcn: "单位" }
"Group Type": {en: "Group Type", zhcn: "分组类型"}
"Max Coupon Set": {en: "Max Coupon Set", zhcn: "最大阻抗数"}
"Group Config": {en: "Group Config", zhcn: "分组设置"}
"Are you sure you want to overwrite the original packet data?": {en: "Are you sure you want to overwrite the original packet data?", zhcn:"你确定要覆盖原来的分组数据吗?"}
"Are you sure cancel grouping?": {en: "Are you sure cancel grouping?", zhcn: "你确定要取消分组吗?"}
"Manual Grouping": {en: "Manual Grouping", zhcn: "手动分组"}
"Polar Calc Info": {en: "", zhcn: "Polar计算信息"}
"Polar Para": {en: "", zhcn: "Polar参数"}
"Line Width": {en: "", zhcn: "线宽"}
"Spacing": {en: "", zhcn: "线距"}
"Gnd Spacing": {en: "", zhcn: "距铜"}
"Impedance Value": {en: "Impedance", zhcn: "阻抗"}
"Adjust Calc Result": {en: "", zhcn: "调整计算结果"}
"Apply": {en: "", zhcn: "应用"}
"Calculate": {en: "", zhcn: "计算"}
"Calculating impedance.": {en: "", zhcn: "计算阻抗."}
"SM Open Impedance": {en: "", zhcn: "防焊前阻抗"}
"Please calculate the impedance first!": {en: "", zhcn: "请先计算阻抗!"}
"Initialize polar calculator failed, make sure polar software installed succefully!": {en: "", zhcn: "初始化Polar计算器失败,请检查Polar软件是否已正常安装!"}
"The coupon name can only contain letters, numbers, underscores, plus signs, minus signs.": {en: "", zhcn: "名称中只能包含字母,数字,下划线,加号或减号!"}
"Create Symmetric IMP": {en: "", zhcn: "创建对称阻抗"}
"Top Ref Layer": {en: "", zhcn: "上参考层"}
"Bot Ref Layer": {en: "", zhcn: "下参考层"}
"Delete item": {en: "Delete item", zhcn: "删除条目", zhtw: ""}
"Sure": {en: "Sure", zhcn: "确认", zhtw: ""}
"There is not a qualified impedance here. Sure to Save it?" : {en: "", zhcn: "有不合格阻抗,确定要继续保存吗?"}
"Ignore and Save": {en: "", zhcn: "忽略并保存"}
"Data changes has been made on the group and it is recommended to re-group and save. Sure to Save it?": {en: "", zhcn: "分组中的数据被更改了,建议重新分组后再保存。确定要继续保存?"}
"There is an uncalculated impedance here here. Sure to Save it?": {en: "", zhcn: "有未被计算的阻抗,确定要继续保存吗?"}
"Calculate Mode": {en: "", zhcn: "试算模式"}
"Choose Calculate Mode": {en: "", zhcn: "选择试算模式"}
"Detail Info": {en: "", zhcn: "阻抗详情"}
\ No newline at end of file
# 模块标题
sys_title: "Template Demo - Single Tree Show"
sys_title_en: "Template Demo - Single Tree Show"
sys_title_zhcn: "树形信息展示"
sys_title_zhtw: ""
# 模块图标
sys_icon: "wpforms"
# 模块对应的插件DLL名称
sys_plugin: "toptemplateclassplugin"
# 模块对应的类名
sys_class: "TopTemplateClass1A"
# 许可证验证键
sys_license_key: ""
# 打开模块的权限
sys_open_right: ""
# 语言包,默认包含自己模块的语言包
sys_lang_list: []
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: []
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
# 主表格
view {
# 数据项, 默认包含表头中配置的数据项
data_keys: [ "uid" ]
# 主键
primary_key: ""
# 分组键
group_key: "impedance_type"
# 父结点键
# 当无此值,表示按照group_key进行分组,树形结构只有一级
# 当有此值,表示按照parent_key生成树形结果,可能有多级
parent_key: ""
# 水平表头
horizontal_header: [
{
"name": "_category",
"display": "Coupon Name",
"resizeMode": "Interactive",
"size": 120,
"displayRole": "$_category"
},
{
"name": "impedance_polar_type",
"display": "Polar Type",
"resizeMode": "Interactive",
"size": 200,
"displayRole": "$impedance_polar_type"
},
{
"name": "impedance_type",
"display": "Type",
"resizeMode": "Interactive",
"size": 150,
"displayRole": "$impedance_type"
},
{
"name": "target_impedance",
"display": "Target",
"resizeMode": "Interactive",
"size": 100,
"displayRole": "$target_impedance"
},
{
"name": "calculate_impedance",
"display": "Calc Impedance",
"resizeMode": "Interactive",
"size": 100,
"displayRole": "$calculate_impedance",
"foregroundRole": "$calculate_impedance_fgcolor",
"backgroundRole": "$calculate_impedance_bgcolor"
},
{
"name": "sm_open_impedance",
"display": "SM Open Impedance",
"resizeMode": "Interactive",
"size": 100,
"displayRole": "$sm_open_impedance",
},
{
"name": "signal1",
"display": "Signal Layer",
"resizeMode": "Interactive",
"size": 100,
"displayRole": "$signal1"
},
{
"name": "org_coplanar_spacing",
"display": "Org To Groud",
"resizeMode": "Interactive",
"size": 100,
"displayRole": "$org_coplanar_spacing"
},
{
"name": "coplanar_spacing",
"display": "To Groud",
"resizeMode": "Interactive",
"size": 100,
"displayRole": "$coplanar_spacing"
},
{
"name": "org_coplanar_spacing",
"display": "Org To Groud",
"resizeMode": "Interactive",
"size": 100,
"displayRole": "$org_coplanar_spacing"
},
{
"name": "coplanar_spacing",
"display": "To Groud",
"resizeMode": "Interactive",
"size": 100,
"displayRole": "$coplanar_spacing"
},
{
"name": "coupon_name",
"display": "Coupon Name",
"resizeMode": "Interactive",
"size": 100,
"displayRole": "$coupon_name"
},
{
"name": "alert_msg",
"display": "Alert Msg",
"resizeMode": "Interactive",
"size": 100,
"displayRole": "$alert_msg"
},
{
"name": "test_line_length",
"display": "Test Line Length",
"resizeMode": "Interactive",
"size": 100,
"displayRole": "$test_line_length"
}
]
# 默认排序列
sort_by: ""
# 数据集
data_set {
# 数据库表名
db_table_name: ""
# 若有sql, 以sql为最优先
# 若无sql, 默认根据表头的配置进行查询
db_sql: "SELECT * FROM pdm_job_imp WHERE job_id = 16188"
}
}
# 工具栏
"MAIN_TOOLBAR": [
{"type": "label", "name": "label1", "text": "Label 1" }
]
this.afterViewInit = function() {
this.sound = new TSound("BEEP");
this.sound.setLoops(10);
}
this.afterDataRefresh = function() {
print("___________afterDataRefresh____________");
this.sound.play();
};
\ No newline at end of file
try {
this.reloadItem();
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "cancel"
LABEL: "Cancel"
LABEL_ZHCN: "取消"
LABEL_ZHTW: "取消"
ACCEL: ""
TOOLTIP: "Cancel the action"
TOOLTIP_ZHCN: "取消动作"
TOOLTIP_ZHTW: "取消動作"
CHECKED: ""
GROUP: ""
STYLE: "button_style=text"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return (this.isDetailModified()) ? 'enable' : 'hide';"
---ACTION---*/
\ No newline at end of file
try {
this.copyItem();
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "copy"
LABEL: "Copy"
LABEL_ZHCN: "复制"
LABEL_ZHTW: "複製"
ACCEL: ""
TOOLTIP: "Copy"
TOOLTIP_ZHCN: "复制"
TOOLTIP_ZHTW: "複製"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: "button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return this.isDetailModified() ? 'hide' : 'enable';"
---ACTION---*/
\ No newline at end of file
try {
var ans = TMessageBox.question(this, this.ttr("Are you sure to delete selected items?"), '', '',
[this.ttr('Delete')+':Yes:Yes:Primary', this.ttr('Cancel')+':Cancel:Cancel:Normal']);
if (ans != 'Yes') {
return;
}
this.deleteItems(this.selectedItems());
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "times-circle"
LABEL: "Delete"
LABEL_ZHCN: "刪除"
LABEL_ZHTW: "刪除"
ACCEL: "Delete"
TOOLTIP: "Delete"
TOOLTIP_ZHCN: "删除"
TOOLTIP_ZHTW: "刪除"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: "size=small button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "if(this.selectedItems().length > 0 && !this.isDetailModified()){return 'enable'}else{return 'disable'}"
---ACTION---*/
\ No newline at end of file
try {
this.newItem();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "plus"
LABEL: "New"
LABEL_ZHCN: "新建"
LABEL_ZHTW: "新建"
ACCEL: "Ctrl+N"
TOOLTIP: "New"
TOOLTIP_ZHCN: "新建"
TOOLTIP_ZHTW: "新建"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "if (!this.isDetailModified()){return 'enable'} else {return 'disable'}"
---ACTION---*/
\ No newline at end of file
try {
this.refresh();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "refresh"
LABEL: "Refresh"
LABEL_ZHCN: "刷新"
LABEL_ZHTW: "刷新"
ACCEL: "F5"
TOOLTIP: "Refresh"
TOOLTIP_ZHCN: "刷新"
TOOLTIP_ZHTW: "刷新"
CHECKED: ""
GROUP: ""
STYLE: "size=small button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
try {
this.saveItem();
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "save"
LABEL: "Save"
LABEL_ZHCN: "保存"
LABEL_ZHTW: "保存"
ACCEL: "Ctrl+S"
TOOLTIP: "Save"
TOOLTIP_ZHCN: "保存"
TOOLTIP_ZHTW: "保存"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: " button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return (this.isDetailModified()) ? 'enable' : 'disable';"
---ACTION---*/
\ No newline at end of file
function func(self) {
return {
type: 'ScrollArea',
property: { widget_resizable: true, frame_shape: 'NoFrame'},
child: {
type: 'FormLayout',
child: [
{
name: 'name',
type: 'LineEdit',
title: self.ttr('Name'),
pack: { label: self.ttr('Name') }
},
{
name: 'title',
type: 'LineEdit',
title: self.ttr('Title'),
pack: { label: self.ttr('Title') }
},
{
name: 'value_type',
type: 'ComboBox',
title: self.ttr('Value Type'),
pack: { label: self.ttr('Value Type') },
property: { item_list: TOPENM.enumList("mes-attrname-datatype").toComboList() }
},
{
name: 'remark',
type: 'PlainTextEdit',
title: self.ttr('Remark'),
pack: { label: self.ttr('Remark') },
property: { vertical_scroll_bar_policy : 'ScrollBarAlwaysOff' }
}
]
}
};
}
\ No newline at end of file
"Name": { en: "", zhcn: "名称" }
"Title": { en: "", zhcn: "标题" }
"Value Type": { en: "", zhcn: "数据类型" }
"Remark": { en: "", zhcn: "备注" }
\ No newline at end of file
# 模块标题
sys_title: "Template Demo - Table With Detail"
sys_title_en: "Template Demo - Table With Detail"
sys_title_zhcn: "带详细信息的单表展示"
sys_title_zhtw: ""
# 模块图标
sys_icon: "wpforms"
# 模块对应的插件DLL名称
sys_plugin: "toptemplateclassplugin"
# 模块对应的类名
sys_class: "TopTemplateClass3"
# 许可证验证键
sys_license_key: ""
# 打开模块的权限
sys_open_right: ""
# 语言包,默认包含自己模块的语言包
sys_lang_list: []
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: [
"mes-attrname-datatype"
]
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
# 主表格
view {
# 定时刷新间隔(单位:秒)
# 若不配置,或间隔小于0,则不执行定时刷新
timing_refresh_interval: 10
# 数据项, 默认包含表头中配置的数据项
data_keys: [ "id", "process_code", "remark" ]
# 主键
primary_key: "id"
# 水平表头
horizontal_header: [
{
"name": "name",
"display": "Name",
"displayRole": "$name",
"resizeMode": "ResizeToContents",
"search": "string"
},
{
"name": "title",
"display": "Title",
"displayRole": "$title",
"resizeMode": "ResizeToContents",
"search": "string"
},
{
"name": "value_type",
"display": "Value Type",
"displayRole": "$value_type.text",
"resizeMode": "ResizeToContents",
"format": "enum(mes-attrname-datatype)"
}
]
# 默认排序列
sort_by: "id DESC"
# 数据集
data_set {
# 数据库表名
db_table_name: "iqs_cp_variable_lib"
# 删除标记
# 若为空表示做物理删除
db_del_flag_key: "del_flag"
# 过滤项
db_filter {
# "process_code": "L01"
}
}
}
# 工具栏
"MAIN_TOOLBAR": [
{"type":"toolitem","action":"new"},
{"type":"stretcher"},
{"type":"searchentry","name":"SEARCH_ENTRY"}
{"type":"toolitem","action":"refresh"}
]
# 表格的右键菜单
"TABLEVIEW_POPUP": [
{"type":"menuitem","action":"new"},
{"type":"separator"},
{"type":"menuitem","action":"delete"},
{"type":"separator"},
{"type":"menuitem","action":"refresh"}
]
# 底部工具栏
"BOTTOM_TOOLBAR" : [
{"type":"stretcher"},
{"type":"pagetool","name":"PAGE_TOOL"}
]
# 详细信息工具栏
"DETAIL_TOOLBAR": [
{"type":"toolitem","action":"save_detail"},
{"type":"stretcher"},
{"type":"toolitem","action":"copy_detail"},
{"type":"toolitem","action":"cancel_detail"},
{"type":"toolitem","action":"refresh_detail"}
]
\ No newline at end of file
this.afterViewInit = function() {
}
\ No newline at end of file
try {
this.refresh();
} catch (e) {
print(e)
}
/*---ACTION---
ICON: "refresh"
LABEL: "Refresh"
LABEL_ZHCN: "刷新"
LABEL_ZHTW: "刷新"
ACCEL: ""
TOOLTIP: "Refresh"
TOOLTIP_ZHCN: "刷新"
TOOLTIP_ZHTW: "刷新"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
try {
this.resetSearchUiLoader();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: ""
LABEL: "Reset"
LABEL_ZHCN: "重置"
LABEL_ZHTW: "重置"
ACCEL: ""
TOOLTIP: "Reset"
TOOLTIP_ZHCN: "重置"
TOOLTIP_ZHTW: "重置"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
try {
this.refresh();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "search"
LABEL: "Search"
LABEL_ZHCN: "查询"
LABEL_ZHTW: "查詢"
ACCEL: ""
TOOLTIP: "Search"
TOOLTIP_ZHCN: "查询"
TOOLTIP_ZHTW: "查詢"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
function func(self) {
return {
type: 'ScrollArea',
property: { widget_resizable: true, frame_shape: 'NoFrame'},
child: {
type: 'FormLayout',
child: [
{
name: 'name',
type: 'LineEdit',
title: self.ttr('Name'),
pack: { label: self.ttr('Name') }
},
{
name: 'title',
type: 'LineEdit',
title: self.ttr('Title'),
pack: { label: self.ttr('Title') }
},
{
name: 'value_type',
type: 'ComboBox',
title: self.ttr('Value Type'),
pack: { label: self.ttr('Value Type') },
property: { item_list: TOPENM.enumList("mes-attrname-datatype").toComboList() }
},
{
name: 'remark',
type: 'PlainTextEdit',
title: self.ttr('Remark'),
pack: { label: self.ttr('Remark') },
property: { vertical_scroll_bar_policy : 'ScrollBarAlwaysOff' }
}
]
}
};
}
\ No newline at end of file
# 模块标题
sys_title: "Template7-Demo"
sys_title_en: "Template7-Demo"
sys_title_zhcn: "Template7-Demo"
sys_title_zhtw: ""
# 模块图标
sys_icon: ""
# 模块对应的插件DLL名称
sys_plugin: "toptemplateclassplugin"
# 模块对应的类名
sys_class: "TopTemplateClass7"
# 许可证验证键
sys_license_key: ""
# 打开模块的权限
sys_open_right: ""
# 语言包,默认包含自己模块的语言包
sys_lang_list: []
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: []
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
# search.ui设置成导航栏形式,当is_navi=1时,以导航栏显示;否则普通控件展示;navi_is_expand=1, 表示导航栏展开;
search_ui_set {
is_navi: 1,
navi_is_expand: 1
}
# 界面布局
view_ratio: "4:3:3"
#表格
# 主表格
view {
# 数据项, 默认包含表头中配置的数据项
data_keys: [ "id", "process_code", "remark" ]
# 主键
primary_key: "id"
# 水平表头
horizontal_header: [
{
"name": "name",
"display": "Name",
"displayRole": "$name",
"resizeMode": "ResizeToContents",
"search": "string"
},
{
"name": "title",
"display": "Title",
"displayRole": "$title",
"resizeMode": "ResizeToContents",
"search": "string"
},
{
"name": "value_type",
"display": "Value Type",
"displayRole": "$value_type.text",
"resizeMode": "ResizeToContents",
"format": "enum(mes-attrname-datatype)"
}
]
# 默认排序列
sort_by: "id DESC"
# 数据集
data_set {
# 数据库表名
db_table_name: "iqs_cp_variable_lib"
# 删除标记
# 若为空表示做物理删除
db_del_flag_key: "del_flag"
# 过滤项
db_filter {
# "process_code": "L01"
}
}
}
\ No newline at end of file
function func(self) {
return {
type: "FormGridLayout",
child: [
{
name: 'value_type',
type: 'ComboBox',
title: self.ttr('Value Type'),
pack: { label: self.ttr('Value Type') },
property: { item_list: TOPENM.enumList("mes-attrname-datatype").toComboList() }
}
]
}
}
\ No newline at end of file
# 搜索页工具栏
"SEARCH_TOOLBAR": [
{"type": "toolitem", "action": "reset"},
{"type": "toolitem", "action": "search"}
]
# 主界面工具栏
"MAIN_TOOLBAR": [
{"type":"stretcher"},
{"type": "toolitem", "action": "refresh"}
]
# 表格弹出菜单
"TABLEVIEW_POPUP": [
]
# 底部工具栏
"BOTTOM_TOOLBAR": [
{"type":"stretcher"},
{"type": "pagetool","name":"PAGE_TOOL"}
]
#详情页工具栏
"DEATIL_TOOLBAR": [
]
\ No newline at end of file
# 模块标题
sys_title: "Template Demo - UiLoader"
sys_title_en: "Template Demo - UiLoader"
sys_title_zhcn: "Template Demo - UiLoader"
sys_title_zhtw: ""
# 模块图标
sys_icon: "wpforms"
# 模块对应的插件DLL名称
sys_plugin: "toptemplateclassplugin"
# 模块对应的类名
sys_class: "TopTemplateClass2"
# 许可证验证键
sys_license_key: ""
# 打开模块的权限
sys_open_right: ""
# 语言包,默认包含自己模块的语言包
sys_lang_list: []
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: []
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
# UiLoader配置
uiloader {
# 在当前模块的Ui Key,
ui_key: "test0"
# Ui字符串
# 若ui_key与ui_str同时存在,以ui_str为准
ui_str: ""
# 数据集
data_set {
# 数据库表名
"db_table_name": "sys_user",
"db_filter" : {
"id" : 1
}
# 若有sql, 以sql为最优先
"db_sql": ""
}
}
function func(self) {
return {
type: "FormGridLayout",
child: [
{
name: "id",
type: "LineEdit",
pack: { label: "ID" }
},
{
name: "username",
type: "LineEdit",
pack: { label: "Name" },
setter: function (obj, value, self) {
var dd = this.getObject('fullname').getData('value');
print('setter');
print(dd);
},
getter: function(obj){
var dd = this.getObject('fullname').getData('value');
print('getter');
print(typeof(dd));
print(dd);
return obj.getData('value');
}
},
{
name: "fullname",
type: "LineEdit",
pack: { label: "Name" }
},
]
}
}
\ No newline at end of file
try {
this.reloadItem();
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "cancel"
LABEL: "Cancel"
LABEL_ZHCN: "取消"
LABEL_ZHTW: "取消"
ACCEL: ""
TOOLTIP: "Cancel Edit"
TOOLTIP_ZHCN: "取消编辑"
TOOLTIP_ZHTW: "刷新編輯"
CHECKED: ""
GROUP: ""
STYLE: "button_style=text"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return (this.isDetailModified()) ? 'enable' : 'hide';"
---ACTION---*/
\ No newline at end of file
try {
this.copyItem();
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "copy"
LABEL: "Copy"
LABEL_ZHCN: "复制"
LABEL_ZHTW: "複製"
ACCEL: ""
TOOLTIP: "Copy"
TOOLTIP_ZHCN: "复制"
TOOLTIP_ZHTW: "複製"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: "button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return this.isDetailModified() ? 'hide' : 'enable';"
---ACTION---*/
\ No newline at end of file
try {
var ans = TMessageBox.question(this, this.ttr("Are you sure to delete selected items?"), '', '',
[this.ttr('Delete')+':Yes:Yes:Primary', this.ttr('Cancel')+':Cancel:Cancel:Normal']);
if (ans != 'Yes') {
return;
}
this.deleteItems(this.selectedItems());
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "times-circle"
LABEL: "Delete"
LABEL_ZHCN: "刪除"
LABEL_ZHTW: "刪除"
ACCEL: "Delete"
TOOLTIP: "Delete"
TOOLTIP_ZHCN: "删除"
TOOLTIP_ZHTW: "刪除"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: "size=small button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "if(this.selectedItems().length > 0 && !this.isDetailModified()){return 'enable'}else{return 'disable'}"
---ACTION---*/
\ No newline at end of file
try {
this.refresh();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "refresh"
LABEL: "Refresh"
LABEL_ZHCN: "刷新"
LABEL_ZHTW: "刷新"
ACCEL: "F5"
TOOLTIP: "Refresh"
TOOLTIP_ZHCN: "刷新"
TOOLTIP_ZHTW: "刷新"
CHECKED: ""
GROUP: ""
STYLE: "size=small button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: ""
---ACTION---*/
\ No newline at end of file
try {
this.reloadItem();
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "refresh"
LABEL: "Refresh"
LABEL_ZHCN: "刷新"
LABEL_ZHTW: "刷新"
ACCEL: ""
TOOLTIP: "Reload data from database"
TOOLTIP_ZHCN: "重新从数据库加载数据"
TOOLTIP_ZHTW: "重新從數據庫加載數據"
CHECKED: ""
GROUP: ""
STYLE: "button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return this.isDetailModified() ? 'hide' : 'enable';"
---ACTION---*/
\ No newline at end of file
try {
this.saveItem();
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "save"
LABEL: "Save"
LABEL_ZHCN: "保存"
LABEL_ZHTW: "保存"
ACCEL: "Ctrl+S"
TOOLTIP: "Save"
TOOLTIP_ZHCN: "保存"
TOOLTIP_ZHTW: "保存"
PERMISSION: ""
CHECKED: ""
GROUP: ""
STYLE: " button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return (this.isDetailModified()) ? 'enable' : 'disable';"
---ACTION---*/
\ No newline at end of file
[
{
name: "basic_info_area",
type: "ScrollArea",
property: {
widget_resizable: true,
frame_shape: 'NoFrame'
},
pack: { label: self.ttr('Basic Info') },
child: [
{
name: 'formlayout',
type: 'FormGridLayout',
property: {
// label_alignment: 'AlignTop | AlignRight',
// horizontal_spacing: 10,
// vertical_spacing: 10,
// margin: 10,
columns: 2
},
child: [
{
name: "id",
type: "LineEdit",
title: self.ttr(""),
pack: {column_span: 2},
initCallback: function(obj,value,self) {
obj.setVisible(false)
}
},
{
name: "attr_data.machine_code",
type: "LineEdit",
title: self.ttr("Machine Code"),
property: { readonly: true},
validate: 'NOTNULL',
child: [
{
name: "choose_machine",
type: "ToolButton",
property: {
text: self.ttr("Choose")
},
callback: function(){
var query = new TSqlQueryV2(T_SQLCNT_POOL.getSqlDatabase());
var sql = "SELECT id,code,name FROM tpm_machine ORDER BY id DESC";
try {
var dialog = new TTableViewDialog(self)
dialog.width = 400;
dialog.height = 600;
dialog.setTitle(self.ttr("Choose Machine"));
dialog.setButtons([self.ttr('Ok')+':Ok:Ok:Primary',self.ttr('Cancel')+':Cancel:Cancel:ERROR']);
dialog.setPrimaryKey('id');
dialog.setSearchKeys(['code','name']);
dialog.setHeaderItem(
[
{
},
{
name: 'id',
display: self.ttr('ID'),
displayRole: '$id'
},
{
name: 'code',
display: self.ttr('Machine Code'),
displayRole: '$code',
size: 100
},
{
name: 'name',
display: self.ttr('Machine Name'),
displayRole: '$name',
size: 200
}
]
);
dialog.setDataKeyList(['id','code','name']);
dialog.loadData(query.selectArrayMap(sql,{}));
dialog.refreshData(true);
var ret = dialog.run();
if(_.isEmpty(ret)) return;
this.getObject('attr_data.machine_code').setData('value',ret[0]['code']);
this.getObject('attr_data.machine_name').setData('value',ret[0]['name']);
this.getObject('machine_id').setData('value',ret[0]['id']);
} catch(e) {
GUI.msgbox({detail: e})
print(e)
}
}
}
]
},
{
name: "attr_data.machine_name",
type: "LineEdit",
title: self.ttr("Machine Name"),
state: function(obj,self){
return 'disable';
}
},
{
name: "class",
type: "ComboBox",
title: self.ttr("Maintenance Type"),
property: {
item_list: TOPENM.enumList("tpm-machine-maintenance-plan-class").toComboList()
},
validate: 'NOTNULL'
},
{
name: "title",
type: "LineEdit",
title: self.ttr("Title"),
},
{
name: "priority",
type: "ComboBox",
title: self.ttr("Priority"),
property: {
item_list: TOPENM.enumList("tpm-machine-maintenance-plan-priority").toComboList()
},
},
{
name: "category",
type: "ComboBox",
title: self.ttr("Maintenance Category"),
property: {
item_list: TOPENM.enumList("tpm-machine-maintenance-plan-category").toComboList()
},
},
{
name: "execution_cycle",
type: "ComboBox",
title: self.ttr("Execution Type"),
property: {
item_list: TOPENM.enumList("tpm-machine-maintenance-plan-execution-cycle").toComboList()
},
validate: 'NOTNULL'
},
{
type: 'HBoxLayout',
title: self.ttr("Execution Cycle"),
state: function(obj,self){
if (this.getValue("execution_cycle") == "cycle"){
return 'show';
}
return 'hide';
},
child: [
{
name: "attr_data.cycle_value",
type: "IntLineEdit",
title: self.ttr("Cycle Value"),
state: function(obj,self){
if (this.getValue("execution_cycle") == "cycle"){
return 'show';
}
return 'hide';
},
},
{
name: "attr_data.cycle_unit",
type: "ComboBox",
title: self.ttr("Cycle Unit"),
state: function(obj,self){
if (this.getValue("execution_cycle") == "cycle"){
return 'show';
}
return 'hide';
},
property: {
item_list: TOPENM.enumList("tpm-machine-maintenance-plan-cycle").toComboList()
},
}
]
},
{
name: "last_execution_time",
type: "DateTimeEdit",
title: self.ttr("Last Execution Time"),
state: function(obj,self){
return 'disable';
},
getter: function(obj,self){
if(_.isEmpty(obj.getData())){
return null;
}
return obj.getData();
}
},
{
name: "next_execution_time",
type: "DateTimeEdit",
title: self.ttr("Next Execution Time"),
getter: function(obj,self){
if(_.isEmpty(obj.getData())){
return null;
}
return obj.getData();
},
validate: "NOTNULL"
},
{
name: "status",
type: "ComboBox",
title: self.ttr("Status"),
property: {
item_list: TOPENM.enumList("tpm-machine-maintenance-plan-status").toComboList()
}
},
{
type: 'HBoxLayout'
},
{
name: "maintenance_person_name",
type: "LineEdit",
title: self.ttr("Maintenance Person"),
pack: {column_span: 2},
getter: function(obj,self){
if (_.isEmpty(obj.getData())){
return null;
}
return obj.getData().split(',');
},
setter: function(obj,val,self){
if (_.isEmpty(val))return;
val = val.replace('{','[');
val = val.replace('}',']');
obj.setData('value',eval('(' + val + ')').join(','))
},
child: [
{
name: "choose_person",
type: "ToolButton",
property: {
text: self.ttr("Choose")
},
callback: function(){
var query = new TSqlQueryV2(T_SQLCNT_POOL.getSqlDatabase());
var sql = "SELECT id,fullname FROM sys_user ORDER BY id DESC";
try {
var dialog = new TTableViewDialog(self)
dialog.width = 400;
dialog.height = 600;
dialog.setTitle(self.ttr("Choose Person"));
dialog.setButtons([self.ttr('Ok')+':Ok:Ok:Primary',self.ttr('Cancel')+':Cancel:Cancel:ERROR']);
dialog.setPrimaryKey('id');
dialog.setSearchKeys(['fullname']);
dialog.setSelectionMode(3);
dialog.setHeaderItem(
[
{
},
{
name: 'id',
display: self.ttr('ID'),
displayRole: '$id'
},
{
name: 'fullname',
display: self.ttr('Name'),
displayRole: '$fullname',
size: 200
}
]
);
dialog.setDataKeyList(['id','fullname']);
dialog.loadData(query.selectArrayMap(sql,{}));
dialog.refreshData(true);
var ret = dialog.run();
if(_.isEmpty(ret)) return;
var idList = [];
var nameList = [];
_.each(ret,function(people){
idList.push(people.id);
nameList.push(people.fullname)
});
this.getObject('maintenance_person_name').setData('value',nameList.join(','));
this.getObject('maintenance_person_ids').setData('value',idList.join(','));
} catch(e) {
GUI.msgbox({detail: e})
print(e)
}
}
}
]
},
{
name: "description",
type: "PlainTextEdit",
title: self.ttr("Maintenance Content"),
pack: {column_span: 2},
property: {
min_row_count: 8
}
},
{
name: "maintenance_person_ids",
type: "LineEdit",
pack: {column_span: 2},
initCallback: function(obj,value,self) {
obj.setVisible(false)
},
getter: function(obj,self){
if (_.isEmpty(obj.getData())){
return null;
}
return obj.getData().split(',');
},
setter: function(obj,val,self){
if (_.isEmpty(val))return;
val = val.replace('{','[');
val = val.replace('}',']');
obj.setData('value',eval('(' + val + ')').join(','))
},
},
{
name: "machine_id",
type: "LineEdit",
initCallback: function(obj,value,self) {
obj.setVisible(false)
}
},
{
type: 'Stretch'
}
]
}
]
}
]
\ No newline at end of file
"Title": {en: "Title", zhcn: "标题", zhtw: "標題"}
"Navigation": {en: "Navigation", zhcn: "导航栏", zhtw: "導航欄"}
"Display Navigation": {en: "Display Navigation", zhcn: "显示导航栏", zhtw: "顯示導航欄"}
"Catergory": {en: "Catergory", zhcn: "分类", zhtw: "分類"}
"Priority": {en: "Priority", zhcn: "优先级", zhtw: "優先級"}
"Last execution time": {en: "Last execution time", zhcn: "上次维护时间", zhtw: "上次維護時間"}
"Next execution time": {en: "Next execution time", zhcn: "下次维护时间", zhtw: "下次維護時間"}
"Machine Code": {en: "Machine Code", zhcn: "设备编号", zhtw: "設備編號"}
"Machine Name": {en: "Machine Name", zhcn: "设备名称", zhtw: "設備名稱"}
"Maintenance Type": {en: "Maintenance Type", zhcn: "维护类型", zhtw: "維護類型"}
"Maintenance Category": {en: "Maintenance Category", zhcn: "维护分类", zhtw: "維護分類"}
"Execution Type": {en: "Execution Type", zhcn: "计划类型", zhtw: "計劃類型"}
"Execution Cycle": {en: "Execution Cycle", zhcn: "计划周期", zhtw: "計劃週期"}
"Status": {en: "Status", zhcn: "状态", zhtw: "狀態"}
"Last Execution Time": {en: "Last Execution Time", zhcn: "上次执行时间", zhtw: "上次執行時間"}
"Next Execution Time": {en: "Next Execution Time", zhcn: "下次执行时间", zhtw: "下次執行時間"}
"Maintenance Person": {en: "Maintenance Person", zhcn: "维护人员", zhtw: "維護人員"}
"Maintenance Content": {en: "Maintenance Content", zhcn: "维护内容", zhtw: "維護內容"}
"Class": {en: "Maintenance Class", zhcn: "维护类型", zhtw: "維護類型"}
"Load data successful!": {en: "Load data successful!" ,zhcn: "加载数据完成!" ,zhtw: "加載數據完成!"}
"Exec Plan": {en: "Exec Plan", zhcn: "执行计划", zhtw: "執行計劃"}
"Class": {en: "Maintenance Class", zhcn: "维护类型", zhtw: ""}
"Choose": {en: "Choose", zhcn: "选择", zhtw: "選擇"}
"Choose Machine": {en: "Choose Machine", zhcn: "选择设备", zhtw: "選擇設備"}
"Choose Person": {en: "Choose Person", zhcn: "选择人员", zhtw: "選擇人員"}
"Record No": {en: "Record No", zhcn: "记录单号", zhtw: "記錄單號"}
"Apply Time": {en: "Apply Time", zhcn: "申请时间", zhtw: "申請時間"}
"Apply Person": {en: "Apply Person", zhcn: "申请人", zhtw: "申請人"}
"Start Time": {en: "Start Time", zhcn: "开始时间", zhtw: "開始時間"}
"End Time": {en: "End Time", zhcn: "结束时间", zhtw: "結束時間"}
"Basic Info": {en: "Basic Info", zhcn: "基本信息", zhtw: "基本信息"}
"Ok": {en: "OK", zhcn: "确定", zhtw: "確定"}
"Cancel": {en: "Cancel", zhcn: "取消", zhtw: "取消"}
"Cycle Value": {en: "Cycle Value", zhcn: "周期", zhtw: "週期"}
"Cycle Unit": {en: "Cycle Unit", zhcn: "周期单位", zhtw: "週期單位"}
"Name": {en: "Name", zhcn: "姓名", zhtw: "姓名"}
\ No newline at end of file
# 模块标题
sys_title: "Template4 Demo - Filter By Sql Where"
sys_title_en: "Template4 Demo - Filter By Sql Where"
sys_title_zhcn: "模板4-sql where语句过滤"
sys_title_zhtw: ""
# 模块图标
sys_icon: "wpforms"
# 模块对应的插件DLL名称
sys_plugin: "toptemplateclassplugin"
# 模块对应的类名
sys_class: "TopTemplateClass4"
# 许可证验证键
sys_license_key: ""
# 打开模块的权限
sys_open_right: ""
# 语言包,默认包含自己模块的语言包
sys_lang_list: []
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: []
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
# 导航栏
# is_checkable,=true 或1, 表示支持checkbox形式; =false 或0, 表示非checkbox形式
navi: {
format: "filter_by_sql_where",
is_checkable: false,
categories: [
{
name: "class",
text: "Maintenance Type",
icon: "",
VISIBLE: 1,
EXPAND: 1,
checked: 0,
data: ""
CHILDREN: [
{
name: "repair",
text: "维修",
VISIBLE: 1,
checked: 0,
data: "class = 'repair'"
},
{
name: "maintenance",
text: "保养"
VISIBLE: 1,
checked: 0,
data: "class = 'maintenance'"
},
{
name: "spot_check",
text: "点检",
VISIBLE: 1,
checked: 0,
data: "class = 'spot_check'"
}
]
}
]
}
# 主表格
view {
# 数据项, 默认包含表头中配置的数据项
data_keys: ["id","class","status","attr_data.machine_code","attr_data.machine_name","machine_id","execution_cycle","attr_data.cycle_value","attr_data.cycle_unit"
"title","category","priority","last_execution_time","next_execution_time","description","maintenance_person_name"]
# 主键
primary_key: "id"
# 水平表头
horizontal_header: [
{
"name": "attr_data.machine_code",
"display": "Machine Code",
"displayRole": "$attr_data.machine_code",
"size": 100
},
{
"name": "attr_data.machine_name",
"display": "Machine Name",
"displayRole": "$attr_data.machine_name",
"size": 100
},
{
"name": "title",
"display": "Title",
"displayRole": "$title",
"size": 100,
"search": "string"
},
{
"name": "class",
"display": "Class",
"displayRole": "$class.text",
"size": 100,
"format": "enum(tpm-machine-maintenance-plan-class)"
},
{
"name": "category",
"display": "Catergory",
"displayRole": "$category.text",
"size": 100
"format": "enum(tpm-machine-maintenance-plan-category)"
},
{
"name": "priority",
"display": "Priority",
"displayRole": "$priority",
"size": 100
},
{
"name": "status",
"display": "Status",
"displayRole": "$status.text",
"size": 100,
"format": "enum(tpm-machine-maintenance-plan-status)"
},
{
"name": "last_execution_time",
"display": "Last execution time",
"displayRole": "$last_execution_time",
"size": 200
},
{
"name": "next_execution_time",
"display": "Next execution time",
"displayRole": "$next_execution_time",
"size": 200
}
]
# 默认排序列
sort_by: "id DESC"
# 数据集
data_set {
# 数据库表名
db_table_name: "tpm_machine_maintenance_plan"
db_filter: "status = 'waiting' or next_execution_time is not null"
}
}
# 工具栏
"MAIN_TOOLBAR": [
{"type":"toolitem","action":"new"},
{"type":"stretcher"},
{"type":"searchentry","name":"SEARCH_ENTRY"}
{"type":"toolitem","action":"refresh"}
]
# 表格的右键菜单
"TABLEVIEW_POPUP": [
{"type":"menuitem","action":"new"},
{"type":"separator"},
{"type":"menuitem","action":"delete"},
{"type":"separator"},
{"type":"menuitem","action":"refresh"}
]
# 底部工具栏
"BOTTOM_TOOLBAR" : [
{"type":"stretcher"},
{"type":"pagetool","name":"PAGE_TOOL"}
]
# 详细信息工具栏
"DETAIL_TOOLBAR": [
{"type":"toolitem","action":"save_detail"},
{"type":"stretcher"},
{"type":"toolitem","action":"copy_detail"},
{"type":"toolitem","action":"cancel_detail"},
{"type":"toolitem","action":"refresh_detail"}
]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment