Commit 008e4b60 authored by ‘oliver.hui’'s avatar ‘oliver.hui’

second

parent cbeea10f
Pipeline #30112 failed with stage
in 37 seconds
......@@ -4,6 +4,7 @@
#include <QToolBar>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <Qdebug>
#include <tbaseutil/tdataresponse.h>
#include <tbaseutil/tdataparse.h>
#include <tbaseutil/ttheme.h>
......@@ -91,12 +92,14 @@ SysUser::~SysUser()
void SysUser::reload()
{
qDebug() << "***************reload";
QString uidStr = lastUid().isEmpty() ? uid() : lastUid();
setUid(uidStr, true);
}
void SysUser::copy()
{
qDebug() << "***************copy";
setLastUid(this->uid());
setUid(0, false);
QVariantMap data;
......@@ -111,6 +114,7 @@ void SysUser::copy()
void SysUser::create()
{
qDebug() << "***************create";
setLastUid(this->uid());
setUid(0, true);
QVariantMap defaultValueMap;
......@@ -123,6 +127,7 @@ void SysUser::create()
void SysUser::clearData()
{
qDebug() << "***************clearData";
mUiLoader->loadValues(QVariantMap(), true);
if (mRoleTableView != nullptr) {
mRoleTableView->loadData(QVariantList());
......@@ -131,6 +136,7 @@ void SysUser::clearData()
void SysUser::setData(const QVariantMap &iDataMap)
{
qDebug() << "***************setData";
mUiLoader->loadValues(iDataMap, false);
if (iDataMap.contains("username")) {
setTitle(ttr("User-%1").arg(iDataMap.value("username").toString()));
......@@ -139,6 +145,7 @@ void SysUser::setData(const QVariantMap &iDataMap)
QVariantMap SysUser::getData() const
{
qDebug() << "***************getData";
QVariantMap dataMap = mUiLoader->getAllValues(true).toVariant().toMap();
QStringList keys = dataMap.keys();
for (QString key: keys) {
......@@ -170,6 +177,7 @@ QVariantMap SysUser::getData() const
void SysUser::saveData()
{
qDebug() << "***************saveData";
QVariantList errLst = mUiLoader->validateAll("COMMIT", true, "ERROR");
if (!errLst.isEmpty()) {
QStringList errStrLst;
......@@ -263,6 +271,7 @@ void SysUser::showAddRoleDialog()
void SysUser::uidChangeEvent(const QString &iUidStr)
{
qDebug() << "***************uidChangeEvent";
if (iUidStr.toInt() == 0) {
setTitle(ttr("New User"));
clearData();
......
......@@ -3,6 +3,7 @@
#include <QGraphicsDropShadowEffect>
#include <QToolBar>
#include <QVBoxLayout>
#include <Qdebug>
#include <tbaseutil/tdataparse.h>
#include <tbaseutil/tdataresponse.h>
#include <tbaseutil/tenumlist.h>
......@@ -122,6 +123,7 @@ SysUserMgt::~SysUserMgt()
void SysUserMgt::refresh(bool iResetPageBol)
{
qDebug() << "************************ is refresh";
t::loading(this);
TSqlSelectorV2 selector = getSqlSelector(iResetPageBol);
QVariant data = doThreadWork(new TopClassSqlThread(this), TOPSQLTHREAD_SELECT_ARRAYMAP, QVariant::fromValue(selector));
......@@ -161,29 +163,32 @@ void SysUserMgt::deleteItem(const QVariantList &iIdLst)
QVariantList SysUserMgt::selectedItems()
{
qDebug() << "************************ is selectedItems";
return mSelectedLst;
}
TopClassAbs *SysUserMgt::openItem(int iUserIdInt)
{
QString detailModuleName = "sys-user";
if (!config("detail_module_name").toString().isEmpty()) {
detailModuleName = config("detail_module_name").toString();
}
SysUser *detail = qobject_cast<SysUser *>(APP->openModule(detailModuleName));
if (detail != nullptr) {
detail->setConfig("product_category", this->config("product_category"));
connect(detail, SIGNAL(dataSaved(QVariant)), this, SLOT(onDetailSaved(QVariant)));
connect(this, SIGNAL(destroyed()), detail, SLOT(close()));
detail->setUid(iUserIdInt);
}
return detail;
}
//TopClassAbs *SysUserMgt::openItem(int iUserIdInt)
//{
// qDebug() << "************************open is working";
// QString detailModuleName = "sys-user";
// if (!config("detail_module_name").toString().isEmpty()) {
// detailModuleName = config("detail_module_name").toString();
// }
// SysUser *detail = qobject_cast<SysUser *>(APP->openModule(detailModuleName));
// if (detail != nullptr) {
// detail->setConfig("product_category", this->config("product_category"));
// connect(detail, SIGNAL(dataSaved(QVariant)), this, SLOT(onDetailSaved(QVariant)));
// connect(this, SIGNAL(destroyed()), detail, SLOT(close()));
// detail->setUid(iUserIdInt);
// }
// return detail;
//}
void SysUserMgt::newItem()
{
qDebug() << "************************newItem is selectedItems";
mBodySplitter->cacheSizes();
mDetailView->create();
mDetailView->refreshActionState();
......@@ -191,6 +196,7 @@ void SysUserMgt::newItem()
bool SysUserMgt::canModify()
{
qDebug() << "************************canModify is ";
return !mDetailView->isDataModified();
}
......@@ -249,6 +255,7 @@ void SysUserMgt::onPageChanged()
void SysUserMgt::onSelectionChanged()
{
qDebug() << "************************onSelectionChanged is selectedItems";
if (mTableView != nullptr) {
//因为Action的State函数中用到getSelectedList, 所以TableView选择更改时,
//将其保存至mSelectedLst中, 这样可以加快Action状态的刷新速度;
......@@ -279,6 +286,7 @@ void SysUserMgt::onDetailSaved(const QVariant &iUidStr)
void SysUserMgt::onDetailChanged()
{
qDebug() << "*******************************ondetailchanged is working";
bool isModified = mDetailView->isDataModified();
mTableView->setEnabled(!isModified);
if (isModified) {
......@@ -294,6 +302,7 @@ void SysUserMgt::onDetailChanged()
TSqlSelectorV2 SysUserMgt::getSqlSelector(bool iResetPageBol)
{
qDebug() << "************************getSqlSelector is working";
TSqlSelectorV2 selector;
if (!mTableConf->dbSql.isEmpty()) {
selector.setTable(QString("(%1) _TEMP_TABLE_").arg(mTableConf->dbSql));
......
......@@ -25,7 +25,7 @@ public slots:
void refresh(bool iResetPageBol = true);
void deleteItem(const QVariantList &iIdLst);
QVariantList selectedItems();
TopClassAbs *openItem(int iUserIdInt);
// TopClassAbs *openItem(int iUserIdInt);
void newItem();
bool canModify();
bool isPasswordValidityControl();
......
......@@ -3,6 +3,7 @@
#include <QGraphicsDropShadowEffect>
#include <QToolBar>
#include <QVBoxLayout>
#include <QDebug>
#include <tbaseutil/tdataparse.h>
#include <tbaseutil/tdataresponse.h>
#include <tbaseutil/tenumlist.h>
......@@ -228,11 +229,12 @@ void SysUserMgtV1::initDetailView()
mDetailView = new SysUserV1(detailModuleName, config(), this);
//功能
connect(mDetailView, SIGNAL(windowModifyChanged(bool)), this, SLOT(onDetailChanged()));
connect(mDetailView, SIGNAL(dataSaved(QVariant)), this, SLOT(onDetailSaved(QVariant)));
connect(mDetailView, SIGNAL(windowModifyChanged(bool)), SLOT(onDetailChanged()));
mDetailView->resize(TTHEME_DP(config("detail.perfect_size.width", mDetailView->perfectSize().width()).toInt()), mDetailView->height());
mCenterSplitter->addWidget(mDetailView);
}
//点击事件模块
......@@ -264,17 +266,21 @@ void SysUserMgtV1::onSelectionChanged()
//detelet也会用到,构造函数,newitem,onselectionchangged,ondetailchangged
QVariantList SysUserMgtV1::selectedItems()
{
qDebug() << "****************************selectedItems is working";
return mSelectedLst;
}
bool SysUserMgtV1::canModify()
{
qDebug() << "****************************canModify is working";
//例如 当datamoifed处于修改 则不可切换 取相反
return !mDetailView->isDataModified();
}
//页面变化覆盖模块
void SysUserMgtV1::onDetailChanged(){
qDebug() << "***************************************ondetailchanged is working";
bool isModified = mDetailView->isDataModified();
mTableView->setEnabled(!isModified);
if (isModified) {
......@@ -402,6 +408,7 @@ void SysUserMgtV1::fillTableData(const TDataResponse &iDataRes)
//新建模块 同时触发内容页变化detailchanged覆盖
void SysUserMgtV1::newItem()
{
qDebug() << "****************************newitem is working";
mCenterSplitter->cacheSizes();
mDetailView->create();
mDetailView->refreshActionState();
......
......@@ -87,6 +87,9 @@ void SysUserV1::initCenterUi()
mUiLoader->setProperty("SS_BORDER", 1);
mUiLoader->setUiStr(ui("user-info").toString());
mBodyLayout->addWidget(mUiLoader,0);
//数据更改关联功能。之前以为initdetail涵盖了数据修改 但uiloader数据修改其实应该具体设置
connect(mUiLoader, SIGNAL(dataChanged()), this, SLOT(setDataModified()));
}
void SysUserV1::resizeEvent(QResizeEvent *iEvent)
......@@ -161,6 +164,7 @@ void SysUserV1::create(){
//意义不明未深究
defaultValueMap = defaultValueMap.unite(config("default_value").toMap());
//
defaultValueMap
setData(defaultValueMap);
//设置数据处于修改 默认true
setDataModified();
......@@ -187,7 +191,7 @@ void SysUserV1::saveData(){
}
t::saving(this);
QVariantMap saveData = getData();
//问题 意义不明?
//问题 意义不明? 对应_hooks_.js
if(isHookExists("handleSaveData")){
saveData = callHooksQuick("handleSaveData", QVariantList() << saveData).toVariant().toMap();
}
......
......@@ -33,7 +33,8 @@ private:
void initCenterUi();
private:
QStringList mProductCategoryLst;
QStringList mProductCategoryLst;
QHBoxLayout *mBodyLayout = nullptr;
TUiLoader *mUiLoader = nullptr;
};
......
try {
var ans = TMessageBox.question(this, this.ttr("Are you sure to delete selected items?"), '', this.ttr('Delete'),
[this.ttr("Delete") + ":Yes:Yes:Error", this.ttr("Cancel") + ":Cancel:Cancel:Normal"]);
if (ans != 'Yes') {
return;
}
this.deleteItem(this.selectedItems());
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "times-circle"
LABEL: "Delete"
LABEL_ZHCN: "删除"
LABEL_ZHTW: "刪除"
ACCEL: "Delete"
TOOLTIP: "Delete User"
TOOLTIP_ZHCN: "删除用户"
TOOLTIP_ZHTW: "刪除用戶"
PERMISSION: "sys-user-delete"
CHECKED: ""
GROUP: ""
STYLE: "size=small button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "if(this.selectedItems().length > 0 && this.canModify()){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: "Add new item"
TOOLTIP_ZHCN: "新建条目"
TOOLTIP_ZHTW: "新建條目"
PERMISSION: "sys-user-create"
CHECKED: ""
GROUP: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "if(this.canModify()){return 'enable'}else{return 'disable'}"
---ACTION---*/
\ No newline at end of file
try {
if (this.selectedItems().length > 0) {
var item = this.openItem(this.selectedItems()[0]);
item.show();
}
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "desktop"
LABEL: "Open In New Window"
LABEL_ZHCN: "在新窗口中打开"
LABEL_ZHTW: "在新窗口中打開"
ACCEL: ""
TOOLTIP: "Open In New Window"
TOOLTIP_ZHCN: "在新窗口中打开"
TOOLTIP_ZHTW: "在新窗口中打開"
PERMISSION: "sys-user-read"
CHECKED: ""
GROUP: ""
STYLE: "size=small 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 {
this.refresh(false);
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "refresh"
LABEL: "Refresh"
LABEL_ZHCN: "刷新"
LABEL_ZHTW: "刷新"
ACCEL: "F5"
TOOLTIP: "Reload data from database"
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 {
var ans = TMessageBox.question(this, this.ttr("Are you sure to reset password?"), '', this.ttr('Reset password'),
[this.ttr("Reset") + ":Yes:Yes", this.ttr("Cancel") + ":Cancel:Cancel:Normal"]);
if (ans != 'Yes') {
return;
}
this.resetPassword();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "reset"
LABEL: "Reset Password"
LABEL_ZHCN: "重置密码"
LABEL_ZHTW: "重置密碼"
ACCEL: ""
TOOLTIP: "Reset Password"
TOOLTIP_ZHCN: "重置密码"
TOOLTIP_ZHTW: "重置密碼"
PERMISSION: "sys-user-reset-password"
CHECKED: ""
GROUP: ""
STYLE: " button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "if(this.selectedItems().length > 0 && this.canModify()){return 'enable'}else{return 'disable'}"
---ACTION---*/
\ No newline at end of file
try {
var ans = TMessageBox.question(this, this.ttr("Are you sure the reset password effective date?"), '', this.ttr('Reset password'),
[this.ttr("Reset") + ":Yes:Yes", this.ttr("Cancel") + ":Cancel:Cancel:Normal"]);
if (ans != 'Yes') {
return;
}
this.resetPasswordValidityDate();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "reset"
LABEL: "Reset Password Validity"
LABEL_ZHCN: "重置密码生效日期"
LABEL_ZHTW: "重置密碼生效日期"
ACCEL: ""
TOOLTIP: "Reset Password Validity"
TOOLTIP_ZHCN: "重置密码生效日期"
TOOLTIP_ZHTW: "重置密碼生效日期"
PERMISSION: "sys-user-password-validity-control"
CHECKED: ""
GROUP: ""
STYLE: " button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "if(this.selectedItems().length > 0 && this.canModify() && this.isPasswordValidityControl()){return 'enable'}else{return 'disable'}"
---ACTION---*/
\ No newline at end of file
"Add Role": {en: "Add Role",zhcn: "添加角色",zhtw: "添加角色"}
"Current login user can not be deleted!": {en: "Current login user can not be deleted!",zhcn: "当前登陆的用户不可删除!",zhtw: "當前登錄的用戶不可刪除!"}
"Full Name": {en: "Full Name",zhcn: "全名",zhtw: "全名"}
"Login Name": {en: "Login Name",zhcn: "登录名",zhtw: "登錄名"}
"Mail": {en: "Mail",zhcn: "邮箱",zhtw: "郵箱"}
"New User": {en: "New User",zhcn: "新建用户",zhtw: "新建用戶"}
"Role Name": {en: "Role Name",zhcn: "角色名称",zhtw: "角色名稱"}
"Staff ID": {en: "Staff ID",zhcn: "工号",zhtw: "工號"}
"Status": {en: "Status",zhcn: "状态",zhtw: "狀態"}
"Reset password...": {en: "",zhcn: "重置密码...",zhtw: "重置密碼..."}
"Reset password failed!": {en: "",zhcn: "重置密码失败!",zhtw: "重置密碼失敗!"}
"Reset password success!": {en: "",zhcn: "重置密码成功!",zhtw: "重置密碼成功!"}
"Are you sure to reset password?": {en: "",zhcn: "确认重置密码吗?",zhtw: "確認重置密碼嗎?"}
"Are you sure the reset password effective date?": {en: "",zhcn: "确认重置密码生效日期吗?",zhtw: "確認重置密碼生效日期嗎?"}
"Reset password": {en: "",zhcn: "重置密码",zhtw: "重置密碼"}
"Reset": {en: "Reset",zhcn: "重置",zhtw: "重置"}
"Reset password validity date failed!": {en: "Reset password validity date failed!",zhcn: "重置密码生效日期失败!",zhtw: "重置密碼生效日期失敗!"}
"Reset password validity date success!": {en: "Reset password validity date success!",zhcn: "重置密码生效日期成功!",zhtw: "重置密碼生效日期成功!"}
"Navigation": {en: "Navigation",zhcn: "导航栏",zhtw: "導航欄"}
"Cancel": {en: "Cancel",zhcn: "取消",zhtw: "取消"}
"Ok": {en: "Ok",zhcn: "确认",zhtw: "確認"}
"Show Navigation": {en: "Show Navigation",zhcn: "打开导航栏",zhtw: "打開導航欄"}
"Hide Navigation": {en: "Hide Navigation",zhcn: "关闭导航栏",zhtw: "關閉導航欄"}
\ No newline at end of file
# 模块标题
sys_title: "User Management"
sys_title_en: "User Management"
sys_title_zhcn: "用户管理"
sys_title_zhtw: "用戶管理"
# 模块图标(普通图标在font awesome中找 http://fontawesome.io/icons/)
sys_icon: "user-o"
# 模块对应的插件DLL名称
sys_plugin: "topikm6-topsys-plugin"
# 模块对应的类名
sys_class: "SysUserMgt"
# 打开模块的权限
sys_open_right: "sys-user-read"
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: ""
# 该模块用到的枚举列表
sys_enum_list: ["sys-user-status"]
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
#详情页面的初始大小
detail.perfect_size.width: 600
# 产品类型,此选项用于当多个产品共用一个数据库时,只想看到自已产品的用户;
# * 表示匹配所有产品
product_category: []
navi: {
is_expanded: "true"
}
view: {
data_keys: [
"id",
"username",
"fullname",
"staffid",
"mail",
"contcat_id",
"remark",
"status",
"department_id"
]
primary_key: "id"
horizontal_header: [
{
"name": "username",
"display": "Login Name",
"displayRole": "$username",
"dataType": "string",
"resizeMode": "Interactive",
"search": "string"
},
{
"name": "fullname",
"display": "Full Name",
"displayRole": "$fullname",
"dataType": "string",
"resizeMode": "Interactive",
"search": "string"
},
{
"name": "staffid",
"display": "Staff ID",
"displayRole": "$staffid",
"dataType": "string",
"resizeMode": "Interactive",
"search": "string"
},
{
"name": "mail",
"display": "Mail",
"displayRole": "$mail",
"dataType": "string",
"resizeMode": "Interactive",
"size": "200"
},
{
"name": "status",
"display": "Status",
"displayRole": "$status.text",
"resizeMode": "Interactive",
"decorationRole": "$status.icon",
"format": "enum(sys-user-status)"
},
{
"name": "remark",
"display": "Remark",
"displayRole": "$remark",
"resizeMode": "Interactive",
},
]
data_set: {
db_table_name: "",
db_sql: "select U.id, U.username, U.staffid, C.mail, U.remark, U.status, U.contcat_id, U.fullname, U.department_id, U.product_category from sys_user AS U LEFT JOIN pub_contacts AS C ON U.contcat_id = C.id"
}
}
# 多工厂同步(用户的增删改)
multi_plant_sync: false
function func(self) {
return {
type: "FormGridLayout",
child: [
{
name: "username",
type: "LineEdit",
pack: { label: self.ttr("Login Name") },
property: {
user_data: { field_name: "username", operator: "like" }
}
},
{
name: "fullname",
type: "LineEdit",
pack: { label: self.ttr("Full Name") },
property: {
user_data: { field_name: "fullname", operator: "like" }
}
},
{
name: "staffid",
type: "LineEdit",
pack: { label: self.ttr("Staff ID") },
property: {
user_data: { field_name: "staffid", operator: "like" }
}
},
{
name: "status",
type: "ComboBox",
pack: { label: self.ttr("Status") },
property: {
item_list: TOPENM.enumList("sys-user-status").toComboList(),
user_data: { field_name: "status" }
}
},
]
};
}
# 表格的右键菜单
"TABLEVIEW_POPUP": [
{"type":"menuitem","action":"new"},
{"type":"separator"},
{"type":"menuitem","action":"open"},
{"type":"separator"},
{"type":"menuitem","action":"delete"},
{"type":"separator"},
{"type":"menuitem","action":"refresh"},
{"type":"separator"},
{"type":"menuitem","action":"reset_password"},
{"type":"menuitem","action":"reset_password_validity"}
]
# 工具栏
"MAIN_TOOLBAR": [
{"type":"spacing","size":10},
{"type":"toolitem","action":"new"},
{"type":"stretcher"},
{"type":"searchentry","name":"SEARCH_ENTRY"},
{"type":"toolitem","action":"refresh"}
]
# 底部工具栏
"BOTTOM_TOOLBAR" : [
{"type":"stretcher"},
{"type":"pagetool","name":"PAGE_TOOL"}
]
\ No newline at end of file
// 保存联系人数据时的额外处理(标准产品中注释掉,项目配置需要时启用)
// this.handleContactData = function (iContactData, iUserData) {
// var data = iContactData;
// data['attr_data'] = {
// staffid: _.toString(iUserData['staffid'])
// };
// print(_.toString(data));
// return data;
// }
// 保存用户数据时的额外处理
// this.handleSaveData = function (iSaveData) {
// var data = iSaveData;
// data['attr_data']['effective_date'] = "";
// return data;
// }
\ No newline at end of file
try {
this.reload();
} catch(e) {
print(e);
}
/*---ACTION---
ICON: "times"
LABEL: "Cancel"
LABEL_ZHCN: "取消"
LABEL_ZHTW: "取消"
ACCEL: ""
TOOLTIP: "Cancel Edit"
TOOLTIP_ZHCN: "取消编辑"
TOOLTIP_ZHTW: "刷新編輯"
CHECKED: ""
GROUP: ""
STYLE: "button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return (this.isDataModified() ) ? '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 selected item"
TOOLTIP_ZHCN: "复制选中条目"
TOOLTIP_ZHTW: "複製選中條目"
PERMISSION: "sys-user-edit"
CHECKED: ""
GROUP: ""
STYLE: "button_style=icon"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return (this.isDataModified() || this.uid() == 0) ? 'hide' : 'enable';"
---ACTION---*/
\ No newline at end of file
try {
this.reload();
} 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.isDataModified() || this.uid() == 0) ? 'hide' : 'enable';"
---ACTION---*/
\ No newline at end of file
try {
this.saveData();
} catch (e) {
print(e);
}
/*---ACTION---
ICON: "save"
LABEL: "Save"
LABEL_ZHCN: "保存"
LABEL_ZHTW: "保存"
ACCEL: "Ctrl+S"
TOOLTIP: "Save data to database"
TOOLTIP_ZHCN: "保存数据至数据库"
TOOLTIP_ZHTW: "保存數據至數據庫"
PERMISSION: "sys-user-edit"
CHECKED: ""
GROUP: ""
STYLE: " button_style=both"
LANG: "JavaScript"
STATUS: "Release"
VERSION: "1"
STATEHOOK: "return (this.isDataModified() ) ? 'enable' : 'disable';"
---ACTION---*/
\ No newline at end of file
"Add Role": {en: "Add Role",zhcn: "添加角色",zhtw: "添加角色"}
"Admin can not be deleted!": {en: "Admin can not be deleted!",zhcn: "Admin不能被删除!",zhtw: "Admin不能被刪除!"}
"Are you sure to delete selected roles?": {en: "Are you sure to delete selected roles?",zhcn: "确定要删除选择的角色吗?",zhtw: "確定要刪除選擇的角色嗎?"}
"Full Name": {en: "Full Name",zhcn: "全名",zhtw: "全名"}
"Login Name": {en: "Login Name",zhcn: "登录名",zhtw: "登錄名"}
"Mail": {en: "Mail",zhcn: "邮箱",zhtw: "郵箱"}
"New User": {en: "New User",zhcn: "新建用户",zhtw: "新建用戶"}
"Password": {en: "Password",zhcn: "密码",zhtw: "密碼"}
"Remove Role": {en: "Remove Role",zhcn: "移除角色",zhtw: "移除角色"}
"Role": {en: "Role",zhcn: "角色",zhtw: "角色"}
"Role Name": {en: "Role Name",zhcn: "角色名称",zhtw: "角色名稱"}
"Saving data failed!": {en: "Saving data failed!",zhcn: "保存数据失败!",zhtw: "保存數據失敗!"}
"Staff ID": {en: "Staff ID",zhcn: "工号",zhtw: "工號"}
"Status": {en: "Status",zhcn: "状态",zhtw: "狀態"}
"User Information": {en: "User Information",zhcn: "用户信息",zhtw: "用戶信息"}
"User-%1": {en: "User-%1",zhcn: "用户-%1",zhtw: "用戶-%1"}
"invalid mail format": {en: "invalid mail format",zhcn: "无效的邮箱格式;",zhtw: "無效的郵箱格式;"}
"Product Category": {en: "Product Category",zhcn: "产品分类",zhtw: "產品分類"}
"'%1' already exists!": {en: "'%1' already exists!", zhcn: "'%1' 已经存在!", zhtw: "'%1' 已經存在!"}
"Clear All": {en: "Clear All",zhcn: "清除选择",zhtw: "清除選擇"}
"Password Validity Control": {en: "Password Validity Control",zhcn: "密码有效期管控",zhtw: "密碼有效期管控"}
"Validity Period": {en: "Validity Period",zhcn: "有效期",zhtw: "有效期"}
"Month": {en: "Month",zhcn: "月",zhtw: "月"}
\ No newline at end of file
# 模块标题
sys_title: "User"
sys_title_en: ""
sys_title_zhcn: "用户信息"
sys_title_zhtw: "用戶信息"
# 模块图标(普通图标在font awesome中找 http://fontawesome.io/icons/)
sys_icon: "user"
# 模块对应的插件DLL名称
sys_plugin: "topikm6-topsys-plugin"
# 模块对应的类名
sys_class: "SysUser"
# 打开模块的权限
sys_open_right: "sys-user-read"
# 当关闭窗口时,如果提示是否保存,保存调用的action
sys_save_action: "save"
# 该模块用到的枚举列表
sys_enum_list: ["sys-user-status", "sys-product-category"]
# 该模块用到的除了Action之外的权限列表
sys_permission_list: []
# 模块的最佳显示尺寸
perfect_size : {
width: 800
height: 600
}
# 模块的最大尺寸
maximum_size.width: 800
# 新建用户时默认值:
default_value : {
status: "active",
password: "123456",
product_category: "*",
"attr_data.password_validity_control": 1,
"attr_data.validity_period": 6
}
# 工具栏
"MAIN_TOOLBAR": [
{"type":"toolitem","action":"save"},
{"type":"stretcher"},
{"type":"toolitem","action":"copy"},
{"type":"toolitem","action":"cancel"},
{"type":"toolitem","action":"refresh"}
]
function func(self) {
return [
{
name: 'tablewidgt',
type: 'TabWidget',
property: {stylesheet:"QTabWidget{background-color:red}"},
pack: { stretch: 1 },
child: [
{
name: 'userinfo_page',
type: 'ScrollArea',
property: { widget_resizable: true, frame_shape: 'NoFrame'},
pack: { label: self.ttr("User Information") },
child: {
name: 'formlayout',
type: 'FormLayout',
property: { label_alignment: 'AlignRight', margin: 20, vertical_spacing: 10, horizontal_spacing: 20 },
pack: {},
child: [
{
name: 'id',
type: 'LineEdit',
title: self.ttr('ID'),
property: { enabled: false },
pack: { label: self.ttr('ID') },
state: function(obj) {
return "Hide";
}
},
{
name: 'username',
type: 'LineEdit',
title: self.ttr('Login Name'),
property: {},
pack: { label: self.ttr('Login 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'];
}
},
},
{
name: 'password',
type: 'LineEdit',
title: self.ttr('Password'),
property: { echo_mode: 'Password' },
pack: { label: self.ttr('Password') },
state: function(obj,self) {
return 'Hide';
}
},
{
name: 'fullname',
type: 'LineEdit',
title: self.ttr('Full Name'),
property: {},
pack: { label: self.ttr('Full Name') },
validate: 'NOTNULL'
},
{
name: 'staffid',
type: 'LineEdit',
title: self.ttr('Staff ID'),
property: {},
pack: { label: self.ttr('Staff ID') },
},
{
name: 'contcat_id',
type: 'LineEdit',
property: { enabled: false },
state: function(obj,self) {
return 'Hide';
}
},
{
name: 'mail',
type: 'LineEdit',
title: self.ttr('Mail'),
property: {},
validate: function (obj, val, title, moment) {
if (val != '') {
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter.test(val)) {
return [self.ttr("invalid mail format"), 'ERROR']
}
}
},
pack: { label: self.ttr('Mail') },
},
{
name: 'remark',
type: 'PlainTextEdit',
title: self.ttr('Remark'),
property: { vertical_scroll_bar_policy: 'ScrollBarAlwaysOff' },
pack: { label: self.ttr('Remark') },
},
{
name: 'status',
type: 'ComboBox',
title: self.ttr('Status'),
property: { item_list: TOPENM.enumList("sys-user-status").toComboList() },
pack: { label: self.ttr('Status') },
validate: function (obj, val, title, moment, self) {
if (val.trim() == '') {
return [title + self.ttr(" can not be null"), 'Error'];
}
}
},
{
name: 'attr_data.password_validity_control',
type: 'CheckBox',
title: self.ttr('Password Validity Control'),
property: {},
pack: { label: self.ttr('Password Validity Control') },
// getter : function(obj, self) {
// return obj.getData("current_names");
// },
// setter: function(obj,value,self){
// obj.setData("current_names", value);
// },
callback: function (obj, checked, self) {
if (checked) {
this.setState("attr_data.validity_period", "show");
} else {
this.setState("attr_data.validity_period", "hide");
}
},
setter: function (obj, value, self) {
if (value === 1 || value == true || value === 'on' || value === 'yes') {
obj.setIntValue(1);
this.setState("attr_data.validity_period", "show");
} else {
obj.setIntValue(0);
this.setState("attr_data.validity_period", "hide");
}
},
state: function (obj, self) {
if (APP.hasRight("sys-user-password-validity-control")) {
return 'Show';
} else {
return 'Hide';
}
}
},
{
name: 'attr_data.validity_period',
type: 'IntLineEdit',
title: self.ttr('Validity Period'),
property: { min_value: 0 },
pack: { label: self.ttr('Validity Period') },
state: function (obj, self) {
if (APP.hasRight("sys-user-password-validity-control") &&
this.getValue('attr_data.password_validity_control') == 1) {
return 'Show';
} else {
return 'Hide';
}
},
child: [
{
name: "validity_period_unit",
type: "Label",
property: {
text: " " + self.ttr('Month') + " ",
alignment: "HCenter|VCenter",
fixed_height: 26,
stylesheet: "background-color: white;border-left: 1px solid lightgray;"
}
}
]
},
{
name: 'product_category',
type: 'MultiComboBox',
title: self.ttr('Product Category'),
property: { item_list: TOPENM.enumList("sys-product-category").toComboList(), name_format: 'A,B' },
pack: { label: self.ttr('Product Category') },
getter : function(obj, self)
{
return obj.getData("current_names");
},
setter: function(obj,value,self){
obj.setData("current_names", value);
},
state: function(obj, self) {
return 'hide';
}
}
]
}
},
{
name: 'ROLE_PAGE',
type: 'VBoxLayout',
property: { spacing: 0, margin: 0 },
pack: { label: self.ttr("Role") },
child: [
{
name: 'role_toolbar',
type: 'ToolBar',
property: {style:"size=normal" ,spacing: 0, margin: 0},
pack: {},
child: [
{
name: 'plus-circle',
type: 'Action',
property: { text: self.ttr('Add Role'), icon: 'plus-circle', shortcut: '', tooltip: '',style:' button_style=both' },
callback: function (obj, checked, self) {
self.showAddRoleDialog();
},
},
{
name: 'act_remove_role',
type: 'Action',
property: { text: self.ttr('Remove Role'), icon: 'minus-circle', shortcut: '', tooltip: '',style:'button_style=both' },
callback: function (obj, checked, self) {
this.getObject('ROLE_LIST').removeSelectedRows();
},
state: function (obj, self) {
var selectionData = [];
selectionData = this.getObject("ROLE_LIST").selectedRowDataMaps();
if (selectionData.length > 0) {
return 'enable';
} else {
return 'disable';
}
}
},
{
name: 'tool_bar_separator',
type:'Separator'
}
]
},
{
name: 'ROLE_LIST',
type: 'TableView',
property: {},
pack: {},
setter: function (obj, value) {
if (value == null) {
value = [];
}
obj.loadData(value);
},
initCallback: function (obj) {
obj.setHeaderItem(
[
{ name: 'id', displayRole: '$id' },
{ name: 'name', display: self.ttr('Role Name'),resizeMode: 'Interactive',displayRole: '$name',search:'int'},
{ name: 'description', display: self.ttr('Description'),resizeMode: 'Stretch',displayRole: '$description',search:'string'},
]
);
obj.setData('data_keys',["id", "name", "description"]);
obj.setData("sort_indicator_shown", false);
},
}
]
}
]
},
];
}
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