up
This commit is contained in:
@@ -1,20 +1,29 @@
|
||||
---@class _ParamFieldAttr
|
||||
---@field attrType
|
||||
---@field ifMust
|
||||
---@field ifMust boolean 1:true
|
||||
---@field attrName
|
||||
---@field attrValue
|
||||
---@field id
|
||||
---@field checkMin
|
||||
---@field checkMax
|
||||
---@field popOptions
|
||||
---@field popValues
|
||||
---@field donotJoinKey boolean 是否要拼接key
|
||||
|
||||
---@class _ParamCellExtendField
|
||||
---@field
|
||||
---@class _ParamCellExtendFiled
|
||||
---@field isEditMode boolean
|
||||
---@field attr _ParamFieldAttr
|
||||
---@field onSelect function 当选择了poplist
|
||||
---@field onClick function 当点击了输入框
|
||||
---@field onInputChange
|
||||
---@field onMultTextInputChg
|
||||
|
||||
-- xx单元
|
||||
local _cell = {}
|
||||
---@type Coolape.CLCellLua
|
||||
local csSelf = nil
|
||||
local transform = nil
|
||||
---@type _ParamCellExtendFiled
|
||||
local mData = nil
|
||||
---@type _ParamFieldAttr
|
||||
local attr
|
||||
@@ -56,6 +65,7 @@ end
|
||||
function _cell.show(go, data)
|
||||
mData = data
|
||||
attr = mData.attr
|
||||
attr.ifMust = attr.ifMust or 0
|
||||
|
||||
if data.isEditMode then
|
||||
_cell.enabeldObj(uiobjs.boxCollider, true)
|
||||
@@ -80,21 +90,26 @@ function _cell.show(go, data)
|
||||
end
|
||||
_cell.enabeldObj(uiobjs.Label4, false)
|
||||
_cell.enabeldObj(uiobjs.SpriteRight, false)
|
||||
|
||||
|
||||
if uiobjs.ButtonReset then
|
||||
uiobjs.ButtonReset.disabled = true
|
||||
end
|
||||
end
|
||||
|
||||
local jsonKey = joinStr(attr.id, "_", attr.attrName)
|
||||
local jsonKey
|
||||
if attr.donotJoinKey then
|
||||
jsonKey = attr.id
|
||||
else
|
||||
jsonKey = joinStr(attr.id, "_", attr.attrName)
|
||||
end
|
||||
if uiobjs.element then
|
||||
uiobjs.element.valueIsNumber = false
|
||||
uiobjs.element.isPhoneNum = false
|
||||
uiobjs.element.canNull = (attr.ifMust == 1 and false or true)
|
||||
uiobjs.element.canNull = (attr.ifMust == 0 and true or false)
|
||||
uiobjs.element.jsonKey = jsonKey
|
||||
uiobjs.element.labeName.text = attr.attrName
|
||||
elseif uiobjs.checkbox then
|
||||
uiobjs.checkbox.canNull = (attr.ifMust == 1 and false or true)
|
||||
uiobjs.checkbox.canNull = (attr.ifMust == 0 and true or false)
|
||||
uiobjs.checkbox.jsonKey = jsonKey
|
||||
uiobjs.checkbox.labeName.text = attr.attrName
|
||||
end
|
||||
@@ -119,13 +134,17 @@ function _cell.show(go, data)
|
||||
uiobjs.checkbox:init(attr)
|
||||
elseif attr.attrType == DBCust.FieldType.popuplist then
|
||||
_cell.enabeldObj(uiobjs.input, false)
|
||||
local strs = strSplit(attr.attrValue, "|")
|
||||
local array = ArrayList()
|
||||
array:Add("")
|
||||
for i, v in ipairs(strs) do
|
||||
array:Add(v)
|
||||
if attr.popOptions then
|
||||
uiobjs.popList:refreshItems(attr.popOptions, attr.popValues)
|
||||
else
|
||||
local strs = strSplit((attr.attrValue or ""), "|")
|
||||
local array = ArrayList()
|
||||
-- array:Add("")
|
||||
for i, v in ipairs(strs) do
|
||||
array:Add(v)
|
||||
end
|
||||
uiobjs.popList:refreshItems(array, array)
|
||||
end
|
||||
uiobjs.popList:refreshItems(array, array)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -143,9 +162,14 @@ end
|
||||
function _cell.uiEventDelegate(go)
|
||||
if attr.attrType == DBCust.FieldType.multext then
|
||||
-- 说明大文本框改变了
|
||||
mData.parent.onMultTextInputChg()
|
||||
NGUITools.AddWidgetCollider(csSelf.gameObject, false)
|
||||
uiobjs.Label4.enabled = (uiobjs.element.value == "" and true or false)
|
||||
Utl.doCallback(mData.onMultTextInputChg, csSelf.gameObject)
|
||||
elseif
|
||||
attr.attrType == DBCust.FieldType.number or attr.attrType == DBCust.FieldType.phone or
|
||||
attr.attrType == DBCust.FieldType.text
|
||||
then
|
||||
Utl.doCallback(mData.onInputChange, csSelf.gameObject)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user