2020-07-08
This commit is contained in:
@@ -29,6 +29,8 @@ function TRPNewCust:init(csObj)
|
||||
uiobjs.starGridPrefab2 = getChild(uiobjs.starGrid2.transform, "00000").gameObject
|
||||
|
||||
uiobjs.ExtendRoot = getCC(uiobjs.Table.transform, "ExtendRoot", "CLCellLua")
|
||||
---@type CLUIFormRoot
|
||||
uiobjs.ExtendFormRoot = uiobjs.ExtendRoot:GetComponent("CLUIFormRoot")
|
||||
uiobjs.elements = uiobjs.DetailRoot.gameObject:GetComponentsInChildren(typeof(CLUIElement), true)
|
||||
uiobjs.ButtonSave = getChild(self.transform, "Top/ButtonSave")
|
||||
end
|
||||
@@ -48,9 +50,10 @@ function TRPNewCust:setData(paras)
|
||||
self.mdata.serviceNo = NetProto.loginNo
|
||||
self.mdata.customerLabel = 1
|
||||
end
|
||||
if type(self.mdata.jsonstr) == "string" then
|
||||
self.mdata.jsonstr = json.decode(self.mdata.jsonstr)
|
||||
if type(self.mdata.jsonStr) == "string" then
|
||||
self.mdata.jsonStr = json.decode(self.mdata.jsonStr)
|
||||
end
|
||||
self.mdata.jsonStr = self.mdata.jsonStr or {}
|
||||
end
|
||||
|
||||
---public 当有通用背板显示时的回调
|
||||
@@ -140,6 +143,9 @@ function TRPNewCust:onClickStar(cell, data)
|
||||
v.value = false
|
||||
end
|
||||
end
|
||||
if self.isNewCust then
|
||||
self.mdata.customerLabel = data.index
|
||||
end
|
||||
CLUIUtl.resetList4Lua(uiobjs.starGrid2, uiobjs.starGridPrefab2, stars, self:wrapFunc(self.initStarCell))
|
||||
if (not self.isNewCust) and data.index ~= self.mdata.customerLabel then
|
||||
-- 说明更改了星级
|
||||
@@ -169,12 +175,17 @@ function TRPNewCust:setElementMode(el)
|
||||
local input = el:GetComponent("UIInput")
|
||||
local inputOnGUI = el:GetComponent("UIInputOnGUI")
|
||||
local boxcollider = el:GetComponent("BoxCollider")
|
||||
local ButtonReset = getCC(el.transform, "ButtonReset", "MyInputReset")
|
||||
|
||||
if (not self.isNewCust) and (el.jsonKey == "taskId" or el.jsonKey == "phoneNo") then
|
||||
boxcollider.enabled = false
|
||||
else
|
||||
boxcollider.enabled = true
|
||||
end
|
||||
|
||||
if ButtonReset then
|
||||
ButtonReset.disabled = (not self.isNewCust)
|
||||
end
|
||||
if input then
|
||||
if isPopList or isPopCheckbox then
|
||||
input.enabled = false
|
||||
@@ -266,7 +277,7 @@ function TRPNewCust:sendModifymsg(key, val, isExtend)
|
||||
local content = {}
|
||||
content.id = self.mdata.custId
|
||||
if isExtend then
|
||||
content.jsonstr = {[key] = val}
|
||||
content.jsonStr = {[key] = val}
|
||||
else
|
||||
content[key] = val
|
||||
end
|
||||
@@ -278,10 +289,11 @@ function TRPNewCust:sendModifymsg(key, val, isExtend)
|
||||
if result.success then
|
||||
-- 更新本地数据
|
||||
if isExtend then
|
||||
self.mdata.jsonstr[key] = val
|
||||
self.mdata.jsonStr[key] = val
|
||||
else
|
||||
self.mdata[key] = val
|
||||
end
|
||||
CLAlert.add("修改成功", Color.white, 1)
|
||||
end
|
||||
end
|
||||
)
|
||||
@@ -295,7 +307,7 @@ function TRPNewCust:onPopupFieldValChg4Extend(go)
|
||||
local el = go:GetComponent("CLUIElement")
|
||||
if el then
|
||||
local err = el:checkValid()
|
||||
if (not isNilOrEmpty(el.value)) and tostring(el.value) ~= tostring(self.mdata.jsonstr[el.jsonKey]) then
|
||||
if (not isNilOrEmpty(el.value)) and tostring(el.value) ~= tostring(self.mdata.jsonStr[el.jsonKey]) then
|
||||
if isNilOrEmpty(err) then
|
||||
-- 有修改,发送数据
|
||||
self:sendModifymsg(el.jsonKey, el.value, true)
|
||||
@@ -329,7 +341,7 @@ function TRPNewCust:onClickInputField4Extend(go)
|
||||
end
|
||||
|
||||
function TRPNewCust:onFinishSetField4Extend(key, val)
|
||||
if tostring(val) ~= tostring(self.mdata.jsonstr[key]) then
|
||||
if tostring(val) ~= tostring(self.mdata.jsonStr[key]) then
|
||||
self:sendModifymsg(key, val, true)
|
||||
end
|
||||
end
|
||||
@@ -337,6 +349,27 @@ end
|
||||
function TRPNewCust:setEventDelegate()
|
||||
self.EventDelegate = {
|
||||
ButtonSave = function()
|
||||
local err = uiobjs.DetailRoot:checkValid()
|
||||
err = joinStr(err, uiobjs.ExtendFormRoot:checkValid())
|
||||
if not isNilOrEmpty(err) then
|
||||
CLAlert.add(err, Color.yellow, 1)
|
||||
return
|
||||
end
|
||||
|
||||
local cust = uiobjs.DetailRoot:getValue(true)
|
||||
cust.customerLabel = self.mdata.customerLabel
|
||||
local jsonStr = uiobjs.ExtendFormRoot:getValue(true)
|
||||
cust.jsonStr = jsonStr
|
||||
showHotWheel()
|
||||
NetProto.send.save_customer(
|
||||
cust,
|
||||
function(content)
|
||||
if content.success then
|
||||
getPanelAsy("PanelCustDetail", onLoadedPanel, cust)
|
||||
end
|
||||
hideHotWheel()
|
||||
end
|
||||
)
|
||||
end,
|
||||
InputTask = function()
|
||||
if self.isNewCust then
|
||||
|
||||
Reference in New Issue
Block a user