{"id":1493,"date":"2023-06-26T09:36:32","date_gmt":"2023-06-26T01:36:32","guid":{"rendered":"http:\/\/www.plm.cn\/?p=1493"},"modified":"2023-07-09T14:33:22","modified_gmt":"2023-07-09T06:33:22","slug":"mobox%e4%bd%8e%e4%bb%a3%e7%a0%81%e5%bc%80%e5%8f%91-%e6%95%b0%e6%8d%ae%e5%b1%9e%e6%80%a7%e8%ae%be%e7%bd%ae","status":"publish","type":"post","link":"http:\/\/www.plm.cn\/1493\/","title":{"rendered":"Mobox\u4f4e\u4ee3\u7801\u5f00\u53d1-\u6570\u636e\u5c5e\u6027\u8bbe\u7f6e"},"content":{"rendered":"
\u8bf4\u660e\uff1a\u8bbe\u7f6e\u5f53\u524dLua\u811a\u672c\u6b63\u5728\u5904\u7406\u7684\u6570\u636e\u5bf9\u8c61\u5c5e\u6027
\n\u4f7f\u7528\u9891\u6b21\uff1a\u4e2d<\/p><\/blockquote>\nsetCurEditDataObjAttr<\/strong>\u00a0(strLuaDEID, strAttrSetInfo )<\/p><\/blockquote>\n
\u8f93\u5165\u53c2\u6570\uff1a<\/strong><\/p>\n
\n\n
\n \n\u5e8f\u53f7<\/th>\n \u53c2\u6570<\/th>\n \u5fc5\u6709<\/th>\n \u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n \n 1<\/td>\n strLuaDEID<\/strong><\/td>\n Y<\/td>\n Lua C++\u6570\u636e\u4ea4\u6362\u533a\u6807\u8bc6, \u662f\u4e00\u4e2aGUID<\/td>\n<\/tr>\n \n 2<\/td>\n strAttrSetInfo<\/strong><\/td>\n Y<\/td>\n \u6570\u636e\u5bf9\u8c61\u5c5e\u6027\u5c5e\u6027\u8bbe\u7f6e\uff0cJson\u683c\u5f0f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n strAttrSetInfo \u683c\u5f0f\uff1a<\/p><\/blockquote>\n
[<\/span> \r\n {<\/span>\"attr\"<\/span>:<\/span>\"attr1\"<\/span>,<\/span>\"value\"<\/span>:<\/span>\"xxx1\"<\/span>}<\/span>,<\/span>\r\n {<\/span>\"attr\"<\/span>:<\/span>\"attr2\"<\/span>,<\/span>\"value\"<\/span>:<\/span>\"xxx2\"<\/span>}<\/span>,<\/span>\r\n ...\r\n ]<\/span>\r\n<\/pre>\n
\u8f93\u51fa\u53c2\u6570\uff1a<\/strong><\/p>\n
\n
- \n
\n
- nRet<\/strong>\u00a0= 0 \u8868\u793a\u6210\u529f, \u975e\u96f6\u5931\u8d25<\/li>\n<\/ol>\n<\/li>\n
- \n
\n
- nCount<\/strong>\u00a0\u6210\u529f\u8bbe\u7f6e\u5c5e\u6027\u6570\u91cf<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n
\nExample<\/p>\n<\/div>\n
\u4e00\u822c\u7528\u5728\u5c0f\u7a97\u53e3\u521d\u59cb\u5316,\u521b\u5efa\u524d\uff0c\u4fee\u6539\u524d\u7b49\u4e8b\u4ef6\u4e2d\u3002\u628a\u64cd\u4f5c\u73af\u5883\u4e2d\u7684\u6709\u4e9b\u5168\u5c40\u53d8\u91cf\u8bbe\u7f6e\u5230\u5c0f\u7a97\u53e3\u5f39\u51fa\u65f6\u6b63\u5728\u7f16\u8f91\u7684\u5c5e\u6027\u4e2d\u3002<\/p><\/blockquote>\n
json =<\/span> require<\/span> (<\/span>\"json\"<\/span>)<\/span>\r\nmobox =<\/span> require<\/span> (<\/span>\"OILua_JavelinExt\"<\/span>)<\/span>\r\nrequire<\/span> (<\/span>\"oi_basestrfunc\"<\/span>)<\/span>\r\n\r\nfunction<\/span> Initial<\/span> (<\/span> strLuaDEID )<\/span> \r\n local<\/span> nRet,<\/span> strRetInfo,<\/span> strPrjCode\r\n\r\n -- \u83b7\u53d6\u5f53\u524d\u70b9\u4e2d\u7684\u4efb\u52a1\u6807\u8bc6<\/span>\r\n nRet,<\/span> strPrjCode =<\/span> mobox.<\/span>getGlobalAttrValue<\/span>(<\/span> strLuaDEID,<\/span> \"S_PRJ_CODE\"<\/span> )<\/span>\r\n if<\/span> (<\/span> nRet ~=<\/span> 0<\/span> )<\/span> then<\/span>\r\n mobox.<\/span>error<\/span>(<\/span> strLuaDEID,<\/span> \"\u7cfb\u7edf\u65e0\u6cd5\u83b7\u53d6\u4efb\u52a1\u6807\u8bc6!\"<\/span> )<\/span>\r\n return<\/span>\r\n end<\/span>\r\n\r\n local<\/span> setAttr =<\/span> '[{\"attr\":\"S_PRJ_CODE\",\"value\":\"'<\/span>..<\/span>strPrjCode..<\/span>'\"}]'<\/span>\r\n mobox.<\/span>setCurEditDataObjAttr<\/span>(<\/span> strLuaDEID,<\/span>setAttr )<\/span>\r\n -- \u8bbe\u7f6e\u5c0f\u7a97\u53e3\u5f39\u6846\u91cc\u7684\u5c5e\u6027<\/span>\r\n local<\/span> strAction =<\/span> '[{\"action_type\":\"set_dlg_attr\",\"value\":'<\/span>..<\/span>setAttr..<\/span>'}]'<\/span>\r\n mobox.<\/span>setAction<\/span>(<\/span> strLuaDEID,<\/span> strAction )<\/span> \r\n\r\nend<\/span>\r\n<\/pre>\n
\n","protected":false},"excerpt":{"rendered":"setCurEditDataObjAttr \u8bf4\u660e\uff1a\u8bbe\u7f6e\u5f53\u524dLua\u811a\u672c\u6b63\u5728\u5904\u7406\u7684\u6570\u636e\u5bf9\u8c61\u5c5e\u6027 \u4f7f\u7528\u9891\u6b21\uff1a\u4e2d se […]<\/p>\n","protected":false},"author":1,"featured_media":1490,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,5,1],"tags":[13],"class_list":["post-1493","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-eckf","category-plmcenter","category-didaima","tag-shouche"],"_links":{"self":[{"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/posts\/1493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/comments?post=1493"}],"version-history":[{"count":1,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/posts\/1493\/revisions"}],"predecessor-version":[{"id":1494,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/posts\/1493\/revisions\/1494"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/media\/1490"}],"wp:attachment":[{"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/media?parent=1493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/categories?post=1493"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.plm.cn\/wp-json\/wp\/v2\/tags?post=1493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}