Commit 7e12663a authored by Qiu Chuntao's avatar Qiu Chuntao

Optimize the code

parent f7015004
Pipeline #11766 failed with stage
in 1 minute and 5 seconds
[ [
{ {
"name": "topikm6-topsys", "name": "usermgt",
"version": "6.1.63", "version": "6.1.63",
"os": "windows", "os": "windows",
"arch": "x86", "arch": "x86",
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
"noqt": false, "noqt": false,
"devDependencies": { "devDependencies": {
"topikm6-frame": "^6.0.0", "topikm6-frame": "^6.0.0",
"topikm6-topsys": "^6.1.0",
"topikm6-templateclass": "^1.0.0" "topikm6-templateclass": "^1.0.0"
}, },
"prefix": "dist/topikm/qt5.6.3-win32-msvc2015/", "prefix": "dist/topikm/qt5.6.3-win32-msvc2015/",
...@@ -29,7 +30,7 @@ ...@@ -29,7 +30,7 @@
] ]
}, },
{ {
"name": "topikm6-topsys", "name": "usermgt",
"version": "6.1.63", "version": "6.1.63",
"os": "linux", "os": "linux",
"arch": "x64", "arch": "x64",
...@@ -38,6 +39,7 @@ ...@@ -38,6 +39,7 @@
"noqt": false, "noqt": false,
"devDependencies": { "devDependencies": {
"topikm6-frame": "^6.0.0", "topikm6-frame": "^6.0.0",
"topikm6-topsys": "^6.1.0",
"topikm6-templateclass": "^1.0.0" "topikm6-templateclass": "^1.0.0"
}, },
"prefix": "dist/topikm/qt5.6.3-linuxx86_64/", "prefix": "dist/topikm/qt5.6.3-linuxx86_64/",
...@@ -56,7 +58,7 @@ ...@@ -56,7 +58,7 @@
] ]
}, },
{ {
"name": "topikm6-topsys-debug", "name": "usermgt-debug",
"version": "6.1.63", "version": "6.1.63",
"os": "windows", "os": "windows",
"arch": "x86", "arch": "x86",
...@@ -65,6 +67,7 @@ ...@@ -65,6 +67,7 @@
"noqt": false, "noqt": false,
"devDependencies": { "devDependencies": {
"topikm6-frame-debug": "^6.0.0", "topikm6-frame-debug": "^6.0.0",
"topikm6-topsys-debug": "^6.1.0",
"topikm6-templateclass-debug": "^1.0.0" "topikm6-templateclass-debug": "^1.0.0"
}, },
"prefix": "dist/topikm/qt5.6.3-win32-msvc2015/", "prefix": "dist/topikm/qt5.6.3-win32-msvc2015/",
......
#include "custommoduleplugin.h" #include "custommoduleplugin.h"
#include "sysusermgt/musermgt.h" #include "sysusermgt/sysusermgt.h"
#include "sysmainwindow/msysmainwindow.h" //#include "sysmainwindow/msysmainwindow.h"
QStringList TopSysPlugin::getClassList() QStringList TopSysPlugin::getClassList()
{ {
return QStringList()<< QStringLiteral("Musermgt") return QStringList()<< QStringLiteral("Musermgt");
<< QStringLiteral("SysMainWindow");
} }
TopClassAbs *TopSysPlugin::newClass(const QString &iClassName, TopClassAbs *TopSysPlugin::newClass(const QString &iClassName,
const QString &iModuleName, const QString &iModuleName,
const QVariantMap &iUrlPars) const QVariantMap &iUrlPars)
{ {
if (iClassName == QStringLiteral("SysMainWindow")) { if (iClassName == QStringLiteral("Musermgt")) {
return new SysMainWindow(iModuleName, iUrlPars, nullptr);
} else if (iClassName == QStringLiteral("Musermgt")) {
return new Musermgt(iModuleName, iUrlPars, nullptr); return new Musermgt(iModuleName, iUrlPars, nullptr);
} }
return nullptr; return nullptr;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
# # # #
############################################################################# #############################################################################
TARGET = $$qtLibraryTarget(musermgt-plugin) TARGET = $$qtLibraryTarget(topikm6-custommodule-plugin)
QT += core sql widgets script network xml scripttools printsupport QT += core sql widgets script network xml scripttools printsupport
win32 { win32 {
...@@ -49,8 +49,6 @@ win32 { ...@@ -49,8 +49,6 @@ win32 {
LIBS += -ldbghelp LIBS += -ldbghelp
LIBS += -luser32 LIBS += -luser32
} }
include (sysmainwindow/sysmainwindow.pri)
include (sysusermgt/sysusermgt.pri) include (sysusermgt/sysusermgt.pri)
DIST_DIR = $$PWD/../../../dist DIST_DIR = $$PWD/../../../dist
...@@ -66,10 +64,6 @@ win32{ ...@@ -66,10 +64,6 @@ win32{
DESTDIR = $${DESTDIR}/plugins DESTDIR = $${DESTDIR}/plugins
} }
TRANSLATIONS += topikm6_topsys_zhcn.ts \
topikm6_topsys_en.ts \
topikm6_topsys_zhtw.ts
QM_LIST = $$PWD/*.qm QM_LIST = $$PWD/*.qm
DEST_LANGUAGE_PATH = $$system_path($${TOPIKM_SDKPATH}/language) DEST_LANGUAGE_PATH = $$system_path($${TOPIKM_SDKPATH}/language)
......
This diff is collapsed.
#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
#include "SysMainWindow.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 <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>
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);
}
initMainWidget();
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();
}
SysMainWindow::~SysMainWindow()
{
if (this->isHookExists("onDestory")) {
this->callHooks("onDestory");
}
}
//初始化主界面
void SysMainWindow::initMainWidget()
{
mBodySplitter = new QSplitter(this);
mBodySplitter->setObjectName("mBodySplitter");
setCentralWidget(mBodySplitter);
mMgtSplitter = new QSplitter(this);
mBodySplitter->addWidget(mMgtSplitter);
mBodyWgt = new QWidget(this);
QVBoxLayout *bodyLayout = new QVBoxLayout(mBodyWgt);
bodyLayout->setMargin(0);
bodyLayout->setSpacing(0);
mMgtSplitter->addWidget(mBodyWgt);
}
//打开当前选择模块
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);
}
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 MWINDOWS_H
#define MWINDOWS_H
#include <QStackedWidget>
#include <topcore/topclassabs.h>
#include <topcore/topclasshelper.h>
#include <tdatabaseutil/tsqlselectorv2.h>
#include <QSystemTrayIcon>
#include <QLineEdit>
#include <QSplitter>
#include <QPushButton>
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 TSplitter;
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:public TopClassAbs
{
Q_OBJECT
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);
private:
QMap<QString, QWidget *> mUrlAddressWidgetMap; // urlAddress:QWidget
QMap<QString, QVariantMap> mUrlAddressConfigMap;
QHBoxLayout *Hboxlayout;
QLineEdit Title;
QLabel *mMessageLabel = nullptr;
StackedWidget *mStackedWidget = nullptr;
QSplitter *mBodySplitter = nullptr;
QSplitter *mMgtSplitter = nullptr;
QWidget *mBodyWgt;
void initMainWidget();
};
#endif
HEADERS += \
##$$PWD/sysmainwindow.h \
$$PWD/msysmainwindow.h \
$$PWD/topquickbutton.h \
$$PWD/topquicktoolbar.h
SOURCES += \
##$$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
...@@ -15,9 +15,7 @@ class TSplitter; ...@@ -15,9 +15,7 @@ class TSplitter;
class Musermgt : public TopClassAbs class Musermgt : public TopClassAbs
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit Musermgt(const QString &iModuleNameStr = QString(""), explicit Musermgt(const QString &iModuleNameStr = QString(""),
const QVariantMap &iUrlPars = QVariantMap(), const QVariantMap &iUrlPars = QVariantMap(),
QWidget *iParent = nullptr); QWidget *iParent = nullptr);
...@@ -29,39 +27,38 @@ public: ...@@ -29,39 +27,38 @@ public:
NaviFilter, NaviFilter,
CategoryTreeViewAndAdvancedQuery CategoryTreeViewAndAdvancedQuery
}; };
~Musermgt(); ~Musermgt();
public slots: public slots:
void refresh(bool iResetPageBol = true); //刷新表格信息 void refresh(bool iResetPageBol = true); //刷新表格信息
void refreshDetail(const QString &iUid); //刷新右侧详细信息 void refreshDetail(const QString &iUid); //刷新右侧详细信息
void reload(); //详细表单刷新后重新载入数据 void reload(); //详细表单刷新后重新载入数据
bool DetailModified() const; //用于判断详细表单的数据是否发生改变 bool DetailModified() const; //用于判断详细表单的数据是否发生改变
void setIsDetailModified(bool iIsDetailModified); //设置详细表单的状态(是否发生改变) void setIsDetailModified(bool iIsDetailModified); //设置详细表单的状态(是否发生改变)
QVariantList selectedItems(); //返回选中的表格数据LIST void newItem(); //"新建"功能
void newItem(); //"新建"功能 void saveItem(); //保存用户信息,对应action-保存
void addUser(); //新增用户,对应action-保存 void removeUser(const QVariantList &iItems); //删除表格里的用户,对应右键菜单里的action-删除
void removeUser(const QVariantList &iItems); //删除表格里的用户,对应右键菜单里的action-删除
QString detailUid() const; //返回当前条目的uid
void setDetailUid(const QString &iUid, bool iForceRefresh = false); //设置条目的uid void setDetailUid(const QString &iUid, bool iForceRefresh = false); //设置条目的uid
void setData(const QVariantMap &iDataMap);
QVariantList selectedItems(); //返回选中的表格数据LIST
QString detailUid() const; //返回当前条目的uid
private slots: private slots:
void onPageChanged(); //翻页对应的槽函数 void onPageChanged(); //翻页对应的槽函数
void onSelectionChanged(); //当表单中选择改变时对应的槽函数 void onSelectionChanged(); //当表单中选择改变时对应的槽函数
void onDetailSaved(const QVariant &iUidStr); //保存详细表单时对应的槽函数 void onDetailSaved(const QVariant &iUidStr); //保存详细表单时对应的槽函数
void onDetailChanged(bool iIsDetailModified); //详细表单内容改变时的槽函数 void onDetailChanged(bool iIsDetailModified); //详细表单内容改变时的槽函数
void onDetailDataChanged(); void onDetailDataChanged();
signals: signals:
void isDetailModifiedChanged(bool iIsDetailModified); //详细表单发生改变时发射该信号 void isDetailModifiedChanged(bool iIsDetailModified); //详细表单发生改变时发射该信号
void detailUidChanged(const QString &iDetailUid); //当左侧选中条目改变时详细表单的UID变化,发送该信号刷新详细表单 void detailUidChanged(const QString &iDetailUid); //当左侧选中条目改变时详细表单的UID变化,发送该信号刷新详细表单
void detailSaved(const QString &iUid); //当详细表单数据保存时发送 void detailSaved(const QVariant &iUid); //当详细表单数据保存时发送
void selectionChanged(); //左侧表单选中条目变化时发送该信号 void selectionChanged(); //左侧表单选中条目变化时发送该信号
private: private:
void initAdvanceCfgMap();
void initTableView(); //初始化界面 void initTableView(); //初始化界面
void initNavi();
Musermgt::NaviType str2NaviType(const QString &iType); Musermgt::NaviType str2NaviType(const QString &iType);
QVariantList parseCategoryConfig(); QVariantList parseCategoryConfig();
QVariantMap getDefaultQueryDataFromCfgMap();
private: private:
TSplitter *mBodySplitter = nullptr; TSplitter *mBodySplitter = nullptr;
TSplitter *mBodyWidget = nullptr; TSplitter *mBodyWidget = nullptr;
...@@ -72,17 +69,12 @@ private: ...@@ -72,17 +69,12 @@ private:
QWidget *mBodyWgt = nullptr; QWidget *mBodyWgt = nullptr;
QString mLastDetailUid; QString mLastDetailUid;
QString mDetailUid; QString mDetailUid;
NaviType mNaviType = NaviType::CategoryTreeView; NaviType mNaviType = NaviType::CategoryTreeView;
QWidget *mNaviView = nullptr; QWidget *mNaviView = nullptr;
QVariantMap mAdvancedQueryCfgMap; QVariantMap mAdvancedQueryCfgMap;
bool IsDetailchange = false; bool IsDetailchange = false;
TopClassTableConf mTableConf; TopClassTableConf mTableConf;
QTimer *mRefreshTimer = nullptr;
QVariantList mSelectedItems; QVariantList mSelectedItems;
void initAdvanceCfgMap();
QVariantMap getDefaultQueryDataFromCfgMap();
}; };
#endif //MUSERMGT #endif //MUSERMGT
HEADERS += \ HEADERS += \
$$PWD/musermgt.h \ $$PWD/sysusermgt.h
SOURCES += \ SOURCES += \
$$PWD/musermgt.cpp \ $$PWD/sysusermgt.cpp
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# 模块标题 # 模块标题
sys_title: "System Config" sys_title: "Module Menu"
sys_title_en: "" sys_title_en: ""
sys_title_zhcn: "系统设置" sys_title_zhcn: "模块菜单"
sys_title_zhtw: "" sys_title_zhtw: ""
# 模块图标(普通图标在font awesome中找 http://fontawesome.io/icons/) # 模块图标(普通图标在font awesome中找 http://fontawesome.io/icons/)
sys_icon: "toplinker-cd" sys_icon: "toplinker-cd"
# 模块对应的插件DLL名称 # 模块对应的插件DLL名称
sys_plugin: "musermgt-plugin" sys_plugin: "topikm6-topsys-plugin"
# 模块对应的类名 # 模块对应的类名
sys_class: "SysMainWindow" sys_class: "SysMainWindow"
......
try {
this.addUser();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "plus"
LABEL: "Add"
LABEL_ZHCN: "添加客户"
LABEL_ZHTW: "添加客戶"
ACCEL: "Ctrl+N"
TOOLTIP: "Add Customer"
TOOLTIP_ZHCN: "添加客户"
TOOLTIP_ZHTW: "添加客戶"
CHECKED: ""
GROUP: ""
LABEL_EN: ""
LABEL_JP: ""
TOOLTIP_EN: ""
TOOLTIP_JP: ""
PERMISSION: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return (this.state() != 'EDIT') ? 'enable' : 'hide';"
---ACTION---*/
\ No newline at end of file
try {
this.copy();
} 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.DetailModified() ? 'hide' : 'enable';"
---ACTION---*/
\ No newline at end of file
try { try {
this.addUser(); this.saveItem();
} catch(e) { } catch(e) {
print(e); print(e);
} }
......
...@@ -12,16 +12,12 @@ ...@@ -12,16 +12,12 @@
name: 'formlayout', name: 'formlayout',
type: 'FormGridLayout', type: 'FormGridLayout',
property: { property: {
// label_alignment: 'AlignTop | AlignRight',
// horizontal_spacing: 10,
// vertical_spacing: 10,
// margin: 10,
columns: 2 columns: 2
}, },
child: [ child: [
{ {
name: "id", name: "id",
type: "LineEdit", type: "IntLineEdit",
title: self.ttr(""), title: self.ttr(""),
pack: {column_span: 2}, pack: {column_span: 2},
initCallback: function(obj,value,self) { initCallback: function(obj,value,self) {
...@@ -48,7 +44,7 @@ ...@@ -48,7 +44,7 @@
if (val.trim() == '') { if (val.trim() == '') {
return [title + self.ttr(" can not be null"), 'Error']; return [title + self.ttr(" can not be null"), 'Error'];
} else if (!val.match(new RegExp('^[A-Za-z0-9_]+$'))) { } else if (!val.match(new RegExp('^[A-Za-z0-9_]+$'))) {
return [title + self.ttr(" can only contain [A-Za-z0-9]!"), 'Error']; return [title + self.ttr("can only contain [A-Za-z0-9]!"), 'Error'];
} }
}, },
}, },
...@@ -63,7 +59,7 @@ ...@@ -63,7 +59,7 @@
}, },
{ {
name: "attr_data.age", name: "attr_data.age",
type: "LineEdit", type: "IntLineEdit",
title: self.ttr("Age"), title: self.ttr("Age"),
validate: function (obj, val, title, moment, self) { validate: function (obj, val, title, moment, self) {
if (!val.match(new RegExp('^[0-9_]+$'))) { if (!val.match(new RegExp('^[0-9_]+$'))) {
......
...@@ -3,26 +3,14 @@ ...@@ -3,26 +3,14 @@
"Navigation": {en: "Navigation", zhcn: "导航栏", zhtw: "導航欄"} "Navigation": {en: "Navigation", zhcn: "导航栏", zhtw: "導航欄"}
"Display Navigation": {en: "Display Navigation", zhcn: "显示导航栏", zhtw: "顯示導航欄"} "Display Navigation": {en: "Display Navigation", zhcn: "显示导航栏", zhtw: "顯示導航欄"}
"Hide Navigation": {en: "Hide Navigation", zhcn: "隐藏导航栏", zhtw: "隱藏導航欄"} "Hide Navigation": {en: "Hide Navigation", zhcn: "隐藏导航栏", zhtw: "隱藏導航欄"}
"Catergory": {en: "Catergory", zhcn: "分类", zhtw: "分類"}
"Password": {en: "Password", zhcn: "密码", zhtw: "密码"} "Password": {en: "Password", zhcn: "密码", zhtw: "密码"}
"UserName": {en: "UserName", zhcn: "用户名", zhtw: "用户名"} "UserName": {en: "UserName", zhcn: "用户名", zhtw: "用户名"}
"FullName": {en: "FullName", zhcn: "全名", zhtw: "全名"} "FullName": {en: "FullName", zhcn: "全名", zhtw: "全名"}
"Status": {en: "Status", zhcn: "状态", zhtw: "状态"} "Status": {en: "Status", zhcn: "状态", zhtw: "状态"}
"Class": {en: "Maintenance Class", zhcn: "维护类型", zhtw: "維護類型"}
"Load data successful!": {en: "Load data successful!" ,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": {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: "確定"} "Ok": {en: "OK", zhcn: "确定", zhtw: "確定"}
"Cancel": {en: "Cancel", zhcn: "取消", zhtw: "取消"} "Cancel": {en: "Cancel", zhcn: "取消", zhtw: "取消"}
"Cycle Value": {en: "Cycle Value", zhcn: "周期", zhtw: "週期"} "Name": {en: "Name", zhcn: "姓名", zhtw: "姓名"}
"Cycle Unit": {en: "Cycle Unit", zhcn: "周期单位", zhtw: "週期單位"} "can only contain [A-Za-z0-9]!": {en: "can only contain [A-Za-z0-9]!", zhcn: "只能包含A-Z,a-z,0-9!",zhtw: "只能包含A-Z,a-z,0-9!"}
"Name": {en: "Name", zhcn: "姓名", zhtw: "姓名"} "Are you sure you are a hundred years old?": {en: "Are you sure you are a hundred years old?", zhcn: "你确定你有这么老/这么小?", zhtw: "你确定你有这么老/这么小?"}
\ No newline at end of file \ No newline at end of file
# 模块标题 # 模块标题
sys_title: "My test program" sys_title: "Custom module"
sys_title_en: "My test program" sys_title_en: "Custom module"
sys_title_zhcn: "我的测试程序" sys_title_zhcn: "自定义模块"
sys_title_zhtw: "" sys_title_zhtw: ""
# 模块图标 # 模块图标
sys_icon: "wpforms" sys_icon: "wpforms"
# 模块对应的插件DLL名称 # 模块对应的插件DLL名称
sys_plugin: "musermgt-plugin" sys_plugin: "topikm6-custommodule-plugin"
# 模块对应的类名 # 模块对应的类名
sys_class: "Musermgt" sys_class: "Musermgt"
# 许可证验证键 # 许可证验证键
...@@ -21,7 +21,9 @@ sys_save_action: "" ...@@ -21,7 +21,9 @@ sys_save_action: ""
sys_enum_list: [] sys_enum_list: []
# 该模块用到的除了Action之外的权限列表 # 该模块用到的除了Action之外的权限列表
sys_permission_list: [] sys_permission_list: []
# 导航栏 default_value : {
password: "123456",
}
# 主表格 # 主表格
view { view {
...@@ -40,33 +42,33 @@ view { ...@@ -40,33 +42,33 @@ view {
}, },
{ {
"name": "username", "name": "username",
"display": "登录名", "display": "UserName",
"displayRole": "$username", "displayRole": "$username",
"size": 100 "size": 100
}, },
{ {
"name": "fullname", "name": "fullname",
"display": "全名", "display": "FullName",
"displayRole": "$fullname", "displayRole": "$fullname",
"size": 100, "size": 100,
"search": "string" "search": "string"
}, },
{ {
"name": "status", "name": "status",
"display": "状态", "display": "status",
"displayRole": "$status.text", "displayRole": "$status.text",
"size": 100, "size": 100,
"format": "enum(tpm-machine-maintenance-plan-status)" "format": "enum(tpm-machine-maintenance-plan-status)"
}, },
{ {
"name": "attr_data.age", "name": "attr_data.age",
"display": "年龄", "display": "Age",
"displayRole": "$attr_data.age", "displayRole": "$attr_data.age",
"size": 100 "size": 100
}, },
{ {
"name": "attr_data.gender", "name": "attr_data.gender",
"display": "性别", "display": "Gender",
"displayRole": "$attr_data.gender.text", "displayRole": "$attr_data.gender.text",
"size": 100 "size": 100
"format": "enum(tpm-machine-maintenance-plan-gender)" "format": "enum(tpm-machine-maintenance-plan-gender)"
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
{"type":"toolitem","action":"new"}, {"type":"toolitem","action":"new"},
{"type":"stretcher"}, {"type":"stretcher"},
{"type":"searchentry","name":"SEARCH_ENTRY"} {"type":"searchentry","name":"SEARCH_ENTRY"}
{"type":"toolitem","action":"refresh"} {"type":"toolitem","action":"refresh"}
] ]
# 表格的右键菜单 # 表格的右键菜单
"TABLEVIEW_POPUP": [ "TABLEVIEW_POPUP": [
{"type":"menuitem","action":"new"}, {"type":"menuitem","action":"new"},
{"type":"separator"}, {"type":"separator"},
{"type":"menuitem","action":"delete"}, {"type":"menuitem","action":"delete"},
{"type":"separator"}, {"type":"separator"},
......
try {
this.addUser();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "plus"
LABEL: "Add"
LABEL_ZHCN: "添加客户"
LABEL_ZHTW: "添加客戶"
ACCEL: "Ctrl+N"
TOOLTIP: "Add Customer"
TOOLTIP_ZHCN: "添加客户"
TOOLTIP_ZHTW: "添加客戶"
CHECKED: ""
GROUP: ""
LABEL_EN: ""
LABEL_JP: ""
TOOLTIP_EN: ""
TOOLTIP_JP: ""
PERMISSION: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return (this.state() != 'EDIT') ? 'enable' : 'hide';"
---ACTION---*/
\ No newline at end of file
try {
this.copy();
} 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.DetailModified() ? 'hide' : 'enable';"
---ACTION---*/
\ No newline at end of file
...@@ -4,27 +4,27 @@ try { ...@@ -4,27 +4,27 @@ try {
if (ans != 'Yes') { if (ans != 'Yes') {
return; return;
} }
this.removeUser(this.selectedItems()); this.deleteItems(this.selectedItems());
} catch (e) { } catch (e) {
print(e); print(e);
} }
/*---ACTION--- /*---ACTION---
ICON: "times-circle" ICON: "times-circle"
LABEL: "Delete" LABEL: "Delete"
LABEL_ZHCN: "刪除" LABEL_ZHCN: "刪除"
LABEL_ZHTW: "刪除" LABEL_ZHTW: "刪除"
ACCEL: "Delete" ACCEL: "Delete"
TOOLTIP: "Delete" TOOLTIP: "Delete"
TOOLTIP_ZHCN: "删除" TOOLTIP_ZHCN: "删除"
TOOLTIP_ZHTW: "刪除" TOOLTIP_ZHTW: "刪除"
PERMISSION: "" PERMISSION: ""
CHECKED: "" CHECKED: ""
GROUP: "" GROUP: ""
STYLE: "size=small button_style=both" STYLE: "size=small button_style=both"
LANG: "JavaScript" LANG: "JavaScript"
STATUS: "Release" STATUS: "Release"
VERSION: "1" VERSION: "1"
STATEHOOK: "if(this.selectedItems().length > 0 && !this.DetailModified()){return 'enable'}else{return 'disable'}" STATEHOOK: "if(this.selectedItems().length > 0 && !this.isDetailModified()){return 'enable'}else{return 'disable'}"
---ACTION---*/ ---ACTION---*/
\ No newline at end of file \ No newline at end of file
...@@ -20,5 +20,5 @@ STYLE: "button_style=both" ...@@ -20,5 +20,5 @@ STYLE: "button_style=both"
LANG: "JavaScript" LANG: "JavaScript"
STATUS: "Release" STATUS: "Release"
VERSION: "1" VERSION: "1"
STATEHOOK: "if (!this.DetailModified()){return 'enable'} else {return 'disable'}" STATEHOOK: "if (!this.isDetailModified()){return 'enable'} else {return 'disable'}"
---ACTION---*/ ---ACTION---*/
\ No newline at end of file
...@@ -12,16 +12,12 @@ ...@@ -12,16 +12,12 @@
name: 'formlayout', name: 'formlayout',
type: 'FormGridLayout', type: 'FormGridLayout',
property: { property: {
// label_alignment: 'AlignTop | AlignRight',
// horizontal_spacing: 10,
// vertical_spacing: 10,
// margin: 10,
columns: 2 columns: 2
}, },
child: [ child: [
{ {
name: "id", name: "id",
type: "LineEdit", type: "IntLineEdit",
title: self.ttr(""), title: self.ttr(""),
pack: {column_span: 2}, pack: {column_span: 2},
initCallback: function(obj,value,self) { initCallback: function(obj,value,self) {
...@@ -48,7 +44,7 @@ ...@@ -48,7 +44,7 @@
if (val.trim() == '') { if (val.trim() == '') {
return [title + self.ttr(" can not be null"), 'Error']; return [title + self.ttr(" can not be null"), 'Error'];
} else if (!val.match(new RegExp('^[A-Za-z0-9_]+$'))) { } else if (!val.match(new RegExp('^[A-Za-z0-9_]+$'))) {
return [title + self.ttr(" can only contain [A-Za-z0-9]!"), 'Error']; return [title + self.ttr("can only contain [A-Za-z0-9]!"), 'Error'];
} }
}, },
}, },
...@@ -63,7 +59,7 @@ ...@@ -63,7 +59,7 @@
}, },
{ {
name: "attr_data.age", name: "attr_data.age",
type: "LineEdit", type: "IntLineEdit",
title: self.ttr("Age"), title: self.ttr("Age"),
validate: function (obj, val, title, moment, self) { validate: function (obj, val, title, moment, self) {
if (!val.match(new RegExp('^[0-9_]+$'))) { if (!val.match(new RegExp('^[0-9_]+$'))) {
......
...@@ -12,4 +12,6 @@ ...@@ -12,4 +12,6 @@
"Basic Info": {en: "Basic Info", zhcn: "基本信息", zhtw: "基本信息"} "Basic Info": {en: "Basic Info", zhcn: "基本信息", zhtw: "基本信息"}
"Ok": {en: "OK", zhcn: "确定", zhtw: "確定"} "Ok": {en: "OK", zhcn: "确定", zhtw: "確定"}
"Cancel": {en: "Cancel", zhcn: "取消", zhtw: "取消"} "Cancel": {en: "Cancel", zhcn: "取消", zhtw: "取消"}
"Name": {en: "Name", zhcn: "姓名", zhtw: "姓名"} "Name": {en: "Name", zhcn: "姓名", zhtw: "姓名"}
\ No newline at end of file "can only contain [A-Za-z0-9]!": {en: "can only contain [A-Za-z0-9]!", zhcn: "只能包含A-Z,a-z,0-9!",zhtw: "只能包含A-Z,a-z,0-9!"}
"Are you sure you are a hundred years old?": {en: "Are you sure you are a hundred years old?", zhcn: "你确定你有这么老/这么小?", zhtw: "你确定你有这么老/这么小?"}
\ No newline at end of file
...@@ -22,7 +22,13 @@ sys_enum_list: [] ...@@ -22,7 +22,13 @@ sys_enum_list: []
# 该模块用到的除了Action之外的权限列表 # 该模块用到的除了Action之外的权限列表
sys_permission_list: [] sys_permission_list: []
navi: {
__type__:NONE
}
default_value : {
password: "123456"
}
# 主表格 # 主表格
view { view {
# 数据项, 默认包含表头中配置的数据项 # 数据项, 默认包含表头中配置的数据项
...@@ -40,33 +46,33 @@ view { ...@@ -40,33 +46,33 @@ view {
}, },
{ {
"name": "username", "name": "username",
"display": "登录名", "display": "UserName",
"displayRole": "$username", "displayRole": "$username",
"size": 100 "size": 100
}, },
{ {
"name": "fullname", "name": "fullname",
"display": "全名", "display": "FullName",
"displayRole": "$fullname", "displayRole": "$fullname",
"size": 100, "size": 100,
"search": "string" "search": "string"
}, },
{ {
"name": "status", "name": "status",
"display": "状态", "display": "status",
"displayRole": "$status.text", "displayRole": "$status.text",
"size": 100, "size": 100,
"format": "enum(tpm-machine-maintenance-plan-status)" "format": "enum(tpm-machine-maintenance-plan-status)"
}, },
{ {
"name": "attr_data.age", "name": "attr_data.age",
"display": "年龄", "display": "Age",
"displayRole": "$attr_data.age", "displayRole": "$attr_data.age",
"size": 100 "size": 100
}, },
{ {
"name": "attr_data.gender", "name": "attr_data.gender",
"display": "性别", "display": "Gender",
"displayRole": "$attr_data.gender.text", "displayRole": "$attr_data.gender.text",
"size": 100 "size": 100
"format": "enum(tpm-machine-maintenance-plan-gender)" "format": "enum(tpm-machine-maintenance-plan-gender)"
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
{"type":"toolitem","action":"new"}, {"type":"toolitem","action":"new"},
{"type":"stretcher"}, {"type":"stretcher"},
{"type":"searchentry","name":"SEARCH_ENTRY"} {"type":"searchentry","name":"SEARCH_ENTRY"}
{"type":"toolitem","action":"refresh"} {"type":"toolitem","action":"refresh"}
] ]
# 表格的右键菜单 # 表格的右键菜单
"TABLEVIEW_POPUP": [ "TABLEVIEW_POPUP": [
{"type":"menuitem","action":"new"}, {"type":"menuitem","action":"new"},
{"type":"separator"}, {"type":"separator"},
{"type":"menuitem","action":"delete"}, {"type":"menuitem","action":"delete"},
{"type":"separator"}, {"type":"separator"},
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
"DETAIL_TOOLBAR": [ "DETAIL_TOOLBAR": [
{"type":"toolitem","action":"save_detail"}, {"type":"toolitem","action":"save_detail"},
{"type":"stretcher"}, {"type":"stretcher"},
{"type":"toolitem","action":"copy_detail"},
{"type":"toolitem","action":"cancel_detail"}, {"type":"toolitem","action":"cancel_detail"},
{"type":"toolitem","action":"refresh_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