87 lines
2.6 KiB
Lua
87 lines
2.6 KiB
Lua
DBOrder = {}
|
|
local db = {}
|
|
|
|
DBOrder.PopListGroup = {
|
|
urgencyLevels = "urgencyLevels", -- 紧急程序
|
|
templateList = "templateList" -- 订单模板
|
|
}
|
|
|
|
DBOrder.onGetFilter = function(data)
|
|
db.filters = data
|
|
|
|
-- 转换成poplist
|
|
db.filtersPopup = {}
|
|
db.templateFields = {}
|
|
db.templateInfor = {}
|
|
db.nextHandlerList = {}
|
|
for k, cells in pairs(data) do
|
|
db.filtersPopup[k] = {}
|
|
---@type System.Collections.ArrayList
|
|
db.filtersPopup[k].options = ArrayList()
|
|
db.filtersPopup[k].values = ArrayList()
|
|
-- db.filtersPopup[k].options:Add("")
|
|
-- db.filtersPopup[k].values:Add("")
|
|
for i, s in ipairs(cells) do
|
|
local key = tostring(s.value)
|
|
db.filtersPopup[k].options:Add(s.name)
|
|
db.filtersPopup[k].values:Add(key)
|
|
if k == DBOrder.PopListGroup.templateList then
|
|
db.templateInfor[key] = s
|
|
db.templateFields[key] = s.fieldAttr -- 设置任务的扩展字段
|
|
-- db.templateFields[key]
|
|
if s.nextHandlerList then
|
|
db.nextHandlerList[key] = {} -- 下一步处理人
|
|
db.nextHandlerList[key].options = ArrayList()
|
|
db.nextHandlerList[key].values = ArrayList()
|
|
for l, u in ipairs(s.nextHandlerList) do
|
|
db.nextHandlerList[key].options:Add(u.loginName)
|
|
db.nextHandlerList[key].values:Add(tostring(u.loginNo))
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
DBOrder.getPopupList = function(popGroup)
|
|
if popGroup then
|
|
return db.filtersPopup[popGroup]
|
|
end
|
|
return db.filters
|
|
end
|
|
|
|
DBOrder.getFields = function(templateId)
|
|
if not templateId then
|
|
return {}
|
|
end
|
|
templateId = tostring(templateId)
|
|
return db.templateFields[templateId] or {}
|
|
end
|
|
|
|
DBOrder.getTemplateInfor = function(templateId)
|
|
if not templateId then
|
|
return {}
|
|
end
|
|
templateId = tostring(templateId)
|
|
return db.templateInfor[templateId] or {}
|
|
end
|
|
|
|
DBOrder.getNextHandler = function(templateId)
|
|
if not templateId then
|
|
return nil
|
|
end
|
|
templateId = tostring(templateId)
|
|
return db.nextHandlerList[templateId]
|
|
end
|
|
|
|
--==============================================================================
|
|
DBOrder.onGetProducts = function(content)
|
|
db.products = content.productList
|
|
end
|
|
|
|
DBOrder.getProducts = function()
|
|
return db.products
|
|
end
|
|
--==============================================================================
|
|
return DBOrder
|