1. 
        

          產品中心 業內新聞 案例中心 視頻中心

          Mobox二開的彈窗選擇數據實現技巧 Mobox二開的彈窗選擇數據實現技巧

          Mobox二開的彈窗選擇數據實現技巧

          Mobox二開的彈窗選擇數據實現技巧

           

          需求描述

           

          (上圖為多選窗口)

          實現方式

          需要開發2個lua腳本

           

          Lua腳本【試驗類型選擇前

          –[[
          ? ? 這個腳本適合 單個選擇的獲取過程
          –]]

          json = require (“json”)

          mobox = require (“OILua_JavelinExt”)

          function BeforeSelectGP ( strLuaDEID )

          local nRet, strRetInfo ,strCondition

          strCondition = “”

          local action = ‘[{“action_type”:”open_data_query_dlg”,”value”:{“mulit_select”:0,”cls_name”:”供應商”,”order”:””,”grid_style”:”default”,”condition”:”‘..strCondition..'”}}]’

          mobox.setAction( strLuaDEID, action )

          end

           

          • 彈出窗口定義:? ?(注意粘貼下面內容的時候? ”? 可能是中文的,需要改成英文)
          • 單選 “mulit_select”:0??? 多選? “mulit_select”:1
          • 關聯表名 “cls_name”:”部分性能試驗”?? (部分性能試驗 這個是表名)
          • 排序 “order”:””????? (可以設置排序字段名)
          • 窗口grid “grid_style”:”procure”? (不設置就是默認grid)
          • 查詢條件 “condition”:”‘..strCondition..’”? ( strCondition 是變量,拼接的查詢條件)

           

          我們在彈出窗口前,可以將我們需要的通過上述參數設置好后 再彈出

          Lua腳本【試驗類型選擇后】? 單選和多選例子

          –[[

          這個腳本適合 單個選擇 的獲取過程

          –]]

           

          json? = require (“json”)

          mobox = require (“OILua_JavelinExt”)

          function AfterSelectSYTPYE ( strLuaDEID )

          local?? nRet,? strTpyeDESC , strOldDesc

           

          — 獲取當前選擇數據

          nRet, strRetInfo = mobox.getInputParameter( strLuaDEID )

          if ( nRet ~= 0 or? strRetInfo == ”) then

          mobox.error( strLuaDEID, “無法獲取導入數據!”)

          return

          end

           

          local retJson = json.decode( strRetInfo )

          local input_parameter = retJson[“parameter”]

          local n, nCount

           

          strTpyeDESC = input_parameter[“S_TST_TPYEDESC”]

           

          if ( strTpyeDESC == ”? ) then

          mobox.error( strLuaDEID, “試驗類型信息不對!”)

          return

          end

           

          — 設置試驗類型信息

          local setAttr = ‘[{“attr”:”S_TST_TPYEDESC”,”value”:”‘..strTpyeDESC..'”}]’

          mobox.setCurEditDataObjAttr( strLuaDEID,setAttr )

          下面是多選的例子

          –[[

          這個腳本適合 多個選擇 的獲取過程

          –]]

           

          json? = require (“json”)

          mobox = require (“OILua_JavelinExt”)

          function AfterSelectSYTPYE ( strLuaDEID )

          local?? nRet,? strTpyeDESC

          — 獲取當前選擇數據

          nRet, strRetInfo = mobox.getInputParameter( strLuaDEID )

          if ( nRet ~= 0 or? strRetInfo == ”) then

          mobox.error( strLuaDEID, “無法獲取導入數據!”)

          return

          end

          local retJson = json.decode( strRetInfo )

          local input_parameter = retJson[“parameter”]????? —? 或者 retJson.parameter

          local n, nCount

          nCount = #input_parameter

          strTpyeDESC =”

          for n = 1 , nCount do???????????????????????????????????? — 需要for循環

          ??????? if (strTpyeDESC ==”) then

          ??????????? strTpyeDESC = input_parameter[n].S_TST_TPYEDESC

          ??????? else

          ??????????? strTpyeDESC = strTpyeDESC .. ‘、’..input_parameter[n].S_TST_TPYEDESC

          ??????? end

          ?? ?end

          — 設置試驗類型信息

          local setAttr = ‘[{“attr”:”S_TST_TPYEDESC”,”value”:”‘..strTpyeDESC..'”}]’

          mobox.setCurEditDataObjAttr( strLuaDEID,setAttr )

           

          之后將這個腳本管理的窗口的定義里面

           

          標簽:低代碼腳本 上一篇: 下一篇:
          展開更多
          預約軟件體驗

          loading...

          日本高清一二三区