This commit is contained in:
2020-07-10 13:22:24 +08:00
parent 8c154e38ba
commit 9549990b66
108 changed files with 5668 additions and 888 deletions

View File

@@ -17,10 +17,11 @@ function _cell.init(csObj)
uiobjs.LabelStatus = getCC(transform, "LabelStatus", "UIPopupList")
-- uiobjs.LabelCustName = getCC(transform, "LabelCustName", "UILabel")
-- uiobjs.SpriteStatus = getCC(transform, "SpriteStatus", "UISprite")
-- uiobjs.LabelServerNo = getCC(transform, "LabelServerNo", "UILabel")
uiobjs.LabelServerNo = getCC(transform, "LabelServerNo", "UILabel")
---@type CLUIFormRoot
uiobjs.formRoot = csSelf:GetComponent("CLUIFormRoot")
uiobjs.SpriteStatus = getChild(transform, "SpriteStatus")
uiobjs.SpriteHeadIcon = getCC(transform, "SpriteHeadBg/SpriteHeadIcon", "UITexture")
end
-- 显示,
@@ -36,6 +37,24 @@ function _cell.show(go, data)
else
SetActive(uiobjs.SpriteStatus.gameObject, false)
end
_cell.setHeadIcon()
end
function _cell.setHeadIcon()
---@type _DBUser
local user = DBUser.getUserById(mData.serviceNo)
if user then
uiobjs.LabelServerNo.text = user.loginName
DBUser.getIcon(
mData.serviceNo,
function(texture)
if texture and texture.name == user.imageUrl then
uiobjs.SpriteHeadIcon.mainTexture = texture
end
end
)
end
end
-- 取得数据

View File

@@ -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

View File

@@ -1,18 +1,19 @@
-- xx单元
---@class _ParamCellExtendFiledRoot
---@field data any
---@field fields table _ParamCellExtendFiled的list
---@field onFinish function 当加载完成
-- xx单元
local _cell = {}
---@type Coolape.CLCellLua
local csSelf = nil
local transform = nil
---@type _ParamCellExtendFiledRoot
local mData = nil
local uiobjs = {}
---@type _DBCust
local cust
local fields
local fieldsObjs = {}
local isEditMode = true
local taskId = nil
local isFieldLoading = false
local oldtaskId
local queue = CLLQueue.new()
local isLoading = false
-- 初始化,只调用一次
function _cell.init(csObj)
@@ -27,10 +28,14 @@ end
-- 显示,
-- 注意c#侧不会在调用show时调用refresh
function _cell.show(go, data)
mData = data
cust = data.data or {}
isEditMode = data.isEditMode
_cell.release()
queue:enQueue(data)
if not isLoading then
_cell.refresh()
end
end
function _cell.refresh()
--[[
local taskId = tostring(cust.taskId)
if (not isFieldLoading) or taskId ~= oldtaskId then
isFieldLoading = true
@@ -41,13 +46,23 @@ function _cell.show(go, data)
_cell.initField(1, taskId)
end
end
end
function _cell.initField(index, taskId)
if taskId ~= oldtaskId then
]]
if queue:size() == 0 then
return
end
local fileAttr = fields[index]
_cell.release()
isLoading = true
mData = queue:deQueue()
if mData.fields and #(mData.fields) > 0 then
showHotWheel()
_cell.initField(1)
else
_cell.onFinisInitFields()
end
end
function _cell.initField(index)
local fileAttr = mData.fields[index].attr
local name = ""
if fileAttr.attrType == DBCust.FieldType.popuplist then
name = "InputPoplist"
@@ -60,50 +75,51 @@ function _cell.initField(index, taskId)
else
name = "InputText"
end
CLUIOtherObjPool.borrowObjAsyn(name, _cell.onLoadField, {index = index, taskId = taskId})
CLUIOtherObjPool.borrowObjAsyn(name, _cell.onLoadField, index)
end
---@param go UnityEngine.GameObject
function _cell.onLoadField(name, go, orgs)
local index = orgs.index
local taskId = orgs.taskId
if taskId ~= oldtaskId then
hideHotWheel()
CLUIOtherObjPool.returnObj(go)
SetActive(go, false)
return
end
local index = orgs
go.transform.parent = transform
go.transform.localScale = Vector3.one
go.transform.localEulerAngles = Vector3.zero
local fileAttr = fields[index]
---@type _ParamCellExtendFiled
local param = mData.fields[index]
local cell = go:GetComponent("CLCellLua")
SetActive(go, true)
cell:init(
{
attr = fileAttr,
parent = _cell,
isEditMode = isEditMode,
onClick = mData.onClick,
onSelect = mData.onSelect
},
nil
)
--[[
---@type _ParamCellExtendFiled
local param = {
attr = fileAttr,
onMultTextInputChg = _cell.onMultTextInputChg,
isEditMode = isEditMode,
onClick = mData.onClick,
onSelect = mData.onSelect
}
]]
if param.attr.attrType == DBCust.FieldType.multext then
-- 要设置一次
param.orgOnMultTextInputChg = param.onMultTextInputChg
param.onMultTextInputChg = _cell.onMultTextInputChg
end
cell:init(param, nil)
table.insert(fieldsObjs, cell)
uiobjs.Table:Reposition()
if index == #fields then
if index == #(mData.fields) then
_cell.onFinisInitFields()
else
_cell.initField(index + 1, taskId)
_cell.initField(index + 1)
end
end
function _cell.onFinisInitFields()
isFieldLoading = false
isLoading = false
uiobjs.Table:Reposition()
uiobjs.formRoot:setValue(cust.jsonStr)
uiobjs.formRoot:setValue(mData.data)
Utl.doCallback(mData.onFinish)
hideHotWheel()
_cell.refresh()
end
function _cell.release()
@@ -114,8 +130,16 @@ function _cell.release()
fieldsObjs = {}
end
function _cell.onMultTextInputChg()
function _cell.onMultTextInputChg(go)
uiobjs.Table.repositionNow = true
---@param v _ParamCellExtendFiled
if mData then
for i, v in ipairs(mData.fields) do
if v.attr.attrType == DBCust.FieldType.multext then
Utl.doCallback(v.orgOnMultTextInputChg, go)
end
end
end
end
-- 取得数据

View File

@@ -0,0 +1,43 @@
-- xx单元
local _cell = {}
---@type Coolape.CLCellLua
local csSelf = nil
local transform = nil
local mData = nil
local uiobjs = {}
-- 初始化,只调用一次
function _cell.init(csObj)
csSelf = csObj
transform = csSelf.transform
uiobjs.SpriteIcon = getCC(transform, "SpriteIcon", "UISprite")
uiobjs.Label = getCC(transform, "Label", "UILabel")
uiobjs.Label2 = getCC(transform, "Label2", "UILabel")
end
-- 显示,
-- 注意c#侧不会在调用show时调用refresh
function _cell.refresh(data, index)
mData = data
if mData then
SetActive(uiobjs.SpriteIcon.gameObject, true)
CLUIUtl.setSpriteFit(uiobjs.SpriteIcon, joinStr("guid_", mData.index))
uiobjs.Label.text = mData.label
uiobjs.Label2.text = mData.label2
else
SetActive(uiobjs.SpriteIcon.gameObject, false)
uiobjs.Label.text = ""
uiobjs.Label2.text = ""
end
end
function _cell.refreshCurrent(index, data)
end
-- 取得数据
function _cell.getData()
return mData
end
--------------------------------------------
return _cell

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4c0d53b2d702140a5aff3c3f027c4107
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -22,7 +22,11 @@ end
function _cell.show(go, data)
mData = data
uiobjs.formRoot:setValue(mData)
uiobjs.ButtonPlayVoice.isEnabled = (not isNilOrEmpty(mData.recordfile))
if not isNilOrEmpty(mData.recordfile) then
SetActive(uiobjs.ButtonPlayVoice.gameObject, true)
else
SetActive(uiobjs.ButtonPlayVoice.gameObject, false)
end
uiobjs.LabelLen.text = joinStr("录音:", DateEx.toStrCn(tonumber(mData.answertime)*1000))
end

View File

@@ -220,7 +220,8 @@ function PanelCalender.onClickBtn(btnName)
oldSelectedCell = nil
curYear = DateTime.Now.Year
curMonth = DateTime.Now.Month
csSelf:show()
PanelCalender.show()
PanelCalender.refresh()
elseif btnName == "ButtonOkay" then
CLPanelManager.hidePanel(csSelf)
local dataStr = ""

View File

@@ -124,6 +124,7 @@ function CLLPStart.onLoadPanelAfter(p)
local count = #(lateLoadPanels)
if (panelIndex >= count) then
--已经加载完
isLogined = true
CLLPStart.connectServer()
end
end
@@ -144,10 +145,11 @@ function CLLPStart.connectServer()
-- showHotWheel()
-- Net.self:connect(selectedServer.host, bio2number(selectedServer.port))
isLogined = true
NetProto.init(
function(success)
if success then
CLLPStart.doEnterGame()
CLLPStart.showGuid()
else
CLUIUtl.showConfirm(
"与服务器失去联系",
@@ -232,6 +234,14 @@ function CLLPStart.doEnterGame()
end
end
CLLPStart.showGuid = function()
if Prefs.getShowGuid() then
getPanelAsy("PanelGuid", onLoadedPanelTT, CLLPStart.doEnterGame)
else
CLLPStart.doEnterGame()
end
end
CLLPStart.hideSplash = function()
local p2 = CLPanelManager.getPanel("PanelSplash")
if (p2 ~= nil) then

View File

@@ -35,6 +35,7 @@ function TRPCustDetail:init(csObj)
uiobjs.InputCustType = getCC(uiobjs.DetailRoot.transform, "InputCustType", "UIPopupList")
uiobjs.InputStatus = getCC(uiobjs.DetailRoot.transform, "InputStatus", "UIPopupList")
uiobjs.InputFrom = getCC(uiobjs.DetailRoot.transform, "InputFrom", "UIPopupList")
uiobjs.InputLogin = getCC(uiobjs.DetailRoot.transform, "InputLogin", "UIPopupList")
uiobjs.starGrid2 = getCC(uiobjs.DetailRoot.transform, "InputStars/Grid", "UIGrid")
uiobjs.starGridPrefab2 = getChild(uiobjs.starGrid2.transform, "00000").gameObject
@@ -80,6 +81,8 @@ function TRPCustDetail:show()
uiobjs.InputFrom:refreshItems(optionInfor.options, optionInfor.values)
optionInfor = DBCust.getFilter4Popup(DBCust.FilterGroup.taskList)
uiobjs.InputTask:refreshItems(optionInfor.options, optionInfor.values)
local poplist = DBUser.getPopList()
uiobjs.InputLogin:refreshItems(poplist.options, poplist.values)
-- 设置星级
local stars = {}
for i = 1, 5 do
@@ -109,7 +112,9 @@ function TRPCustDetail:showDetail()
SetActive(uiobjs.ExtendRoot.gameObject, true)
SetActive(uiobjs.Records.gameObject, false)
uiobjs.DetailRoot:setValue(self.mdata)
uiobjs.ExtendRoot:init({data = self.mdata, isEditMode = false}, nil)
-- uiobjs.ExtendRoot:init({data = self.mdata, isEditMode = false}, nil)
self:showExtentFiles(self.mdata.taskId)
-- 设置星级
local stars = {}
@@ -123,6 +128,25 @@ function TRPCustDetail:showDetail()
uiobjs.scrollView:ResetPosition()
end
---public 显示扩展字段
function TRPCustDetail:showExtentFiles(taskId)
---@type _ParamCellExtendFiledRoot
local param = {}
param.data = self.mdata and self.mdata.jsonStr or {}
-- param.onFinish = self:wrapFunc(self.setExtendFieldsMode)
param.fields = {}
local fields = DBCust.getFieldsByTask(taskId) or {}
---@type _ParamCellExtendFiled
local filedInfor
for i, v in ipairs(fields) do
filedInfor = {}
filedInfor.attr = v
filedInfor.isEditMode = false
table.insert(param.fields, filedInfor)
end
uiobjs.ExtendRoot:init(param, nil)
end
function TRPCustDetail:showRecords()
SetActive(uiobjs.DetailRoot.gameObject, false)
SetActive(uiobjs.ExtendRoot.gameObject, false)
@@ -224,6 +248,9 @@ function TRPCustDetail:setEventDelegate()
ButtonCall = function()
MyUtl.callCust(self.mdata)
end,
ButtonNewOrder = function()
getPanelAsy("PanelNewOrder", onLoadedPanelTT, self.mdata)
end,
ButtonMore = function()
getPanelAsy("PanelMoreProc4Cust", onLoadedPanelTT, self.mdata)
end

View File

@@ -102,9 +102,11 @@ function TRPCustFilter:refreshFilterBtnStatus()
if self:hadFilterVal() then
uiobjs.ButtonFilterLb.color = ColorEx.getColor(0xff2990dc)
uiobjs.ButtonFilterSp.color = ColorEx.getColor(0xff2990dc)
uiobjs.ButtonFilterSp.spriteName = "cust_funnel"
else
uiobjs.ButtonFilterLb.color = ColorEx.getColor(0xff999999)
uiobjs.ButtonFilterSp.color = ColorEx.getColor(0xff999999)
uiobjs.ButtonFilterSp.spriteName = "cust_screen"
end
end

View File

@@ -104,9 +104,11 @@ function TRPCustList:refreshFilterBtnStatus()
if self:hadFilterVal() then
uiobjs.ButtonFilterLb.color = ColorEx.getColor(0xff2990dc)
uiobjs.ButtonFilterSp.color = ColorEx.getColor(0xff2990dc)
uiobjs.ButtonFilterSp.spriteName = "cust_funnel"
else
uiobjs.ButtonFilterLb.color = ColorEx.getColor(0xff999999)
uiobjs.ButtonFilterSp.color = ColorEx.getColor(0xff999999)
uiobjs.ButtonFilterSp.spriteName = "cust_screen"
end
end

View File

@@ -0,0 +1,111 @@
-- xx界面
local TRPGuid = {}
---@type Coolape.CLPanelLua
local csSelf = nil
---@type UnityEngine.Transform
local transform = nil
local uiobjs = {}
local callback
-- 初始化,只会调用一次
function TRPGuid.init(csObj)
csSelf = csObj
transform = csObj.transform
--[[
上的组件getChild(transform, "offset", "Progress BarHong"):GetComponent("UISlider");
--]]
---@type UIGridPage
uiobjs.GridPage = getCC(transform, "PanelContent/Grid", "UIGridPage")
---@type UIGrid
uiobjs.GridIndex = getCC(transform, "GridIndex", "UIGrid")
uiobjs.GridIndexPrefab = getChild(uiobjs.GridIndex.transform, "00000").gameObject
uiobjs.ButtonEnter = getChild(transform, "ButtonEnter").gameObject
end
-- 设置数据
function TRPGuid.setData(paras)
callback = paras
end
--当有通用背板显示时的回调
function TRPGuid.onShowFrame()
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPGuid.show()
SetActive(uiobjs.ButtonEnter, false)
uiobjs.GridPage.cellWidth = NumEx.getIntPart(MyUtl.getSizeAdjust() * Screen.width)
local pages = ArrayList()
pages:Add({index = 1, label = "业务轻松查看", label2 = "随时查看实时业绩情况"})
pages:Add({index = 2, label = "客户随时跟进", label2 = "第一时间跟进客户记录消息内容"})
pages:Add({index = 3, label = "订单高效处理", label2 = "随时随地及时处理各类客户订单"})
uiobjs.GridPage:init(pages, TRPGuid.onShowPage, 0)
end
function TRPGuid.onShowPage(index, data)
SetActive(uiobjs.ButtonEnter, index == 2)
local list = {}
for i = 0, 2 do
if i == index then
table.insert(list, true)
else
table.insert(list, false)
end
end
CLUIUtl.resetList4Lua(
uiobjs.GridIndex,
uiobjs.GridIndexPrefab,
list,
function(cell, data)
local sp = cell:GetComponent("UISprite")
if data then
sp.color = ColorEx.getColor(0xff363636)
else
sp.color = ColorEx.getColor(0xff999999)
end
end
)
end
-- 刷新
function TRPGuid.refresh()
end
-- 关闭页面
function TRPGuid.hide()
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function TRPGuid.procNetwork(cmd, succ, msg, paras)
--[[
if(succ == NetSuccess) then
if(cmd == "xxx") then
-- TODO:
end
end
--]]
end
-- 处理ui上的事件例如点击等
function TRPGuid.uiEventDelegate(go)
local goName = go.name
if(goName == "ButtonEnter") then
Prefs.setShowGuid(false)
hideTopPanel(csSelf)
Utl.doCallback(callback)
end
end
-- 当顶层页面发生变化时回调
function TRPGuid.onTopPanelChange(topPanel)
end
-- 当按了返回键时关闭自己返值为true时关闭
function TRPGuid.hideSelfOnKeyBack()
return true
end
--------------------------------------------
return TRPGuid

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ccec78a7c3d1e429cb6e84a9be1dc177
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -82,8 +82,10 @@ function TRPNewCust:show()
uiobjs.InputFrom:refreshItems(optionInfor.options, optionInfor.values)
optionInfor = DBCust.getFilter4Popup(DBCust.FilterGroup.taskList)
uiobjs.InputTask:refreshItems(optionInfor.options, optionInfor.values)
optionInfor = DBCust.getFilter4Popup(DBCust.FilterGroup.loginNoList)
uiobjs.InputLogin:refreshItems(optionInfor.options, optionInfor.values)
-- optionInfor = DBCust.getFilter4Popup(DBCust.FilterGroup.loginNoList)
local poplist = DBUser.getPopList()
uiobjs.InputLogin:refreshItems(poplist.options, poplist.values)
self:refreshContent()
@@ -95,27 +97,31 @@ end
function TRPNewCust:refreshContent()
uiobjs.DetailRoot:setValue(self.mdata)
if self.isNewCust then
uiobjs.ExtendRoot:init(
{
data = self.mdata,
onFinish = self:wrapFunc(self.setExtendFieldsMode),
isEditMode = true
},
nil
)
else
uiobjs.ExtendRoot:init(
{
data = self.mdata,
isEditMode = true,
onFinish = self:wrapFunc(self.setExtendFieldsMode),
onClick = self:wrapFunc(self.onClickInputField4Extend),
onSelect = self:wrapFunc(self.onPopupFieldValChg4Extend)
},
nil
)
end
-- if self.isNewCust then
-- uiobjs.ExtendRoot:init(
-- {
-- data = self.mdata,
-- onFinish = self:wrapFunc(self.setExtendFieldsMode),
-- isEditMode = true
-- },
-- nil
-- )
-- else
-- uiobjs.ExtendRoot:init(
-- {
-- data = self.mdata,
-- isEditMode = true,
-- onFinish = self:wrapFunc(self.setExtendFieldsMode),
-- onClick = self:wrapFunc(self.onClickInputField4Extend),
-- onSelect = self:wrapFunc(self.onPopupFieldValChg4Extend)
-- },
-- nil
-- )
-- end
local taskId = self.mdata and self.mdata.taskId or nil
self:showExtentFiles(taskId)
-- 设置星级
stars = {}
@@ -126,6 +132,30 @@ function TRPNewCust:refreshContent()
self.csSelf:invoke4Lua(self:wrapFunc(self.reposition), 0.1)
end
---public 显示扩展字段
function TRPNewCust:showExtentFiles(taskId)
---@type _ParamCellExtendFiledRoot
local param = {}
param.data = self.mdata and self.mdata.jsonStr or {}
-- param.isEditMode = true
param.onFinish = self:wrapFunc(self.setExtendFieldsMode)
param.fields = {}
local fields = DBCust.getFieldsByTask(taskId) or {}
---@type _ParamCellExtendFiled
local filedInfor
for i, v in ipairs(fields) do
filedInfor = {}
filedInfor.attr = v
filedInfor.isEditMode = true
if not self.isNewCust then
filedInfor.onClick = self:wrapFunc(self.onClickInputField4Extend)
filedInfor.onSelect = self:wrapFunc(self.onPopupFieldValChg4Extend)
end
table.insert(param.fields, filedInfor)
end
uiobjs.ExtendRoot:init(param, nil)
end
function TRPNewCust:reposition()
uiobjs.DetailRootTabel.repositionNow = true
uiobjs.Table.repositionNow = true
@@ -182,7 +212,7 @@ function TRPNewCust:setElementMode(el)
else
boxcollider.enabled = true
end
if ButtonReset then
ButtonReset.disabled = (not self.isNewCust)
end
@@ -372,27 +402,7 @@ function TRPNewCust:setEventDelegate()
)
end,
InputTask = function()
if self.isNewCust then
uiobjs.ExtendRoot:init(
{
data = {taskId = uiobjs.InputTask.value},
onFinish = self:wrapFunc(self.setExtendFieldsMode),
isEditMode = true
},
nil
)
else
uiobjs.ExtendRoot:init(
{
data = self.mdata,
isEditMode = true,
onFinish = self:wrapFunc(self.setExtendFieldsMode),
onClick = self:wrapFunc(self.onClickInputField4Extend),
onSelect = self:wrapFunc(self.onPopupFieldValChg4Extend)
},
nil
)
end
self:showExtentFiles(uiobjs.InputTask.value)
end
}
end

View File

@@ -0,0 +1,448 @@
---@type IDBasePanel
local TRBasePanel = require("ui.panel.TRBasePanel")
---@class TRPNewOrder:TRBasePanel 邮件列表
local TRPNewOrder = class("TRPNewOrder", TRBasePanel)
local uiobjs = {}
local stars = {}
-- 初始化,只会调用一次
function TRPNewOrder:init(csObj)
TRPNewOrder.super.init(self, csObj)
self:initFiledsAttr()
self:setEventDelegate()
MyUtl.setContentView(getChild(self.transform, "PanelContent"), 132, 0)
---@type UIScrollView
uiobjs.scrollView = getCC(self.transform, "PanelContent", "UIScrollView")
---@type UITable
uiobjs.Table = getCC(uiobjs.scrollView.transform, "Table", "UITable")
---@type CLUIFormRoot
uiobjs.DetailFromRoot = getCC(uiobjs.Table.transform, "DetailRoot", "CLUIFormRoot")
uiobjs.DetailRoot = getCC(uiobjs.Table.transform, "DetailRoot", "CLCellLua")
---@type UITable
uiobjs.DetailRootTabel = uiobjs.DetailRoot:GetComponent("UITable")
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
function TRPNewOrder:initFiledsAttr()
---@type _ParamFieldAttr
local attr
self.baseFiledsAttr = {}
attr = {}
attr.attrName = "工单模板"
attr.id = ""
attr.attrType = DBCust.FieldType.popuplist
attr.ifMust = 1
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "工单名称"
attr.id = ""
attr.attrType = DBCust.FieldType.text
attr.ifMust = 1
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "紧急程序"
attr.id = ""
attr.attrType = DBCust.FieldType.popuplist
attr.ifMust = 0
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "客户号码"
attr.id = "phoneNo"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 1
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "所属任务"
attr.id = "taskId"
attr.attrType = DBCust.FieldType.popuplist
attr.ifMust = 0
attr.donotJoinKey = true
local popInfor = DBCust.getFilter4Popup(DBCust.FilterGroup.taskList)
attr.popOptions = popInfor.options
attr.popValues = popInfor.values
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "客户名称"
attr.id = "custName"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "公司名称"
attr.id = "companyName"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "联系地址"
attr.id = "address"
attr.attrType = DBCust.FieldType.text
attr.ifMust = 0
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
attr = {}
attr.attrName = "订单内容"
attr.id = ""
attr.attrType = DBCust.FieldType.multext
attr.ifMust = 0
attr.donotJoinKey = true
table.insert(self.baseFiledsAttr, attr)
end
-- 设置数据
---@param paras _ParamTRPNewOrder
function TRPNewOrder:setData(paras)
if paras and paras.orderId and paras.orderId > 0 then
self.isNewOrder = false
self.mdata = paras
else
--//TODO:初始值
self.isNewOrder = true
self.mdata = paras
end
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 当有通用背板显示时的回调
---@param cs Coolape.CLPanelLua
function TRPNewOrder:onShowFrame(cs)
if cs.frameObj then
---@type _BGFrame1Param
local d = {}
if self.isNewOrder then
d.title = "新建订单"
else
d.title = "修改订单"
end
d.panel = cs
cs.frameObj:init(d)
end
end
-- 显示在c#中。show为调用refreshshow和refresh的区别在于当页面已经显示了的情况当页面再次出现在最上层时只会调用refresh
function TRPNewOrder:show()
self:refreshContent()
SetActive(uiobjs.ButtonSave.gameObject, self.isNewOrder)
uiobjs.scrollView:ResetPosition()
end
function TRPNewOrder:refreshContent()
self:showBaseFields()
local taskId = self.mdata and self.mdata.taskId or nil
self:showExtentFiles(taskId)
self.csSelf:invoke4Lua(self:wrapFunc(self.reposition), 0.1)
end
function TRPNewOrder:showBaseFields()
---@type _ParamCellExtendFiledRoot
local param = {}
param.data = self.mdata or {}
param.onFinish = self:wrapFunc(self.setExtendFieldsMode)
param.fields = {}
---@type _ParamCellExtendFiled
local filedInfor
for i, v in ipairs(self.baseFiledsAttr) do
-- 工单模板
filedInfor = {}
filedInfor.attr = v
filedInfor.isEditMode = true
if filedInfor.attr.attrType == DBCust.FieldType.multext then
filedInfor.onMultTextInputChg = self:wrapFunc(self.reposition)
end
if not self.isNewOrder then
filedInfor.onClick = self:wrapFunc(self.onClickInputField4Extend)
filedInfor.onSelect = self:wrapFunc(self.onPopupFieldValChg4Extend)
end
table.insert(param.fields, filedInfor)
end
uiobjs.DetailRoot:init(param, nil)
end
---public 显示扩展字段
function TRPNewOrder:showExtentFiles(taskId)
---@type _ParamCellExtendFiledRoot
local param = {}
param.data = self.mdata and self.mdata.jsonStr or {}
-- param.isEditMode = true
param.onFinish = self:wrapFunc(self.setExtendFieldsMode)
param.fields = {}
local fields = DBCust.getFieldsByTask(taskId) or {}
---@type _ParamCellExtendFiled
local filedInfor
for i, v in ipairs(fields) do
filedInfor = {}
filedInfor.attr = v
filedInfor.isEditMode = true
if filedInfor.attr.attrType == DBCust.FieldType.multext then
filedInfor.onMultTextInputChg = self:wrapFunc(self.reposition)
end
if not self.isNewOrder then
filedInfor.onClick = self:wrapFunc(self.onClickInputField4Extend)
filedInfor.onSelect = self:wrapFunc(self.onPopupFieldValChg4Extend)
end
table.insert(param.fields, filedInfor)
end
uiobjs.ExtendRoot:init(param, nil)
end
function TRPNewOrder:reposition()
uiobjs.DetailRootTabel.repositionNow = true
uiobjs.Table.repositionNow = true
end
function TRPNewOrder:setExtendFieldsMode()
local elements = uiobjs.ExtendRoot.gameObject:GetComponentsInChildren(typeof(CLUIElement), true)
for i = 0, elements.Length - 1 do
self:setElementMode(elements[i])
end
self:reposition()
end
function TRPNewOrder:setElementMode(el)
local isPopList = el:GetComponent("UIPopupList")
local isPopCheckbox = el:GetComponent("CLUICheckbox")
---@type UIInput
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.isNewOrder) and (el.jsonKey == "taskId" or el.jsonKey == "phoneNo") then
boxcollider.enabled = false
else
boxcollider.enabled = true
end
if ButtonReset then
ButtonReset.disabled = (not self.isNewOrder)
end
if input then
if isPopList or isPopCheckbox then
input.enabled = false
if inputOnGUI then
inputOnGUI.enabled = false
end
else
if self.isNewOrder then
input.enabled = true
if inputOnGUI then
inputOnGUI.enabled = true
end
else
input.enabled = false
if inputOnGUI then
inputOnGUI.enabled = false
end
end
end
end
end
-- 刷新
function TRPNewOrder:refresh()
end
-- 关闭页面
function TRPNewOrder:hide()
if uiobjs.ExtendRoot.luaTable then
uiobjs.ExtendRoot.luaTable.release()
end
end
-- 网络请求的回调cmd指命succ成功失败msg消息paras服务器下行数据
function TRPNewOrder:procNetwork(cmd, succ, msg, paras)
if (succ == NetSuccess) then
if cmd == NetProto.cmds.update_customer then
self:refreshContent()
end
end
end
function TRPNewOrder:onPopupFieldValChg(go)
if self.isNewOrder then
return
end
---@type CLUIElement
local el = go:GetComponent("CLUIElement")
if el then
local err = el:checkValid()
if tostring(el.value) ~= tostring(self.mdata[el.jsonKey]) then
if isNilOrEmpty(err) then
self:sendModifymsg(el.jsonKey, el.value, false)
else
MyUtl.toastW(err)
end
end
end
end
function TRPNewOrder:onClickInputField(go)
if self.isNewOrder then
return
end
---@type CLUIElement
local el = go:GetComponent("CLUIElement")
if el then
getPanelAsy(
"PanelModifyFiled",
onLoadedPanelTT,
{
label = el.labeName.text,
key = el.jsonKey,
value = el.value,
canNull = el.canNull,
callback = self:wrapFunc(self.onFinishSetField)
}
)
end
end
function TRPNewOrder:onFinishSetField(key, val)
if tostring(val) ~= tostring(self.mdata[key]) then
self:sendModifymsg(key, val, false)
end
end
function TRPNewOrder:sendModifymsg(key, val, isExtend)
local content = {}
content.id = self.mdata.custId
if isExtend then
content.jsonStr = {[key] = val}
else
content[key] = val
end
showHotWheel()
NetProto.send.update_customer(
content,
function(result, orgs)
hideHotWheel()
if result.success then
-- 更新本地数据
if isExtend then
self.mdata.jsonStr[key] = val
else
self.mdata[key] = val
end
MyUtl.toastS("修改成功")
end
end
)
end
function TRPNewOrder:onPopupFieldValChg4Extend(go)
if self.isNewOrder then
return
end
---@type CLUIElement
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 isNilOrEmpty(err) then
-- 有修改,发送数据
self:sendModifymsg(el.jsonKey, el.value, true)
else
MyUtl.toastW(err)
end
end
end
end
function TRPNewOrder:onClickInputField4Extend(go)
if self.isNewOrder then
return
end
---@type CLUIElement
local el = go:GetComponent("CLUIElement")
if el then
getPanelAsy(
"PanelModifyFiled",
onLoadedPanelTT,
{
label = el.labeName.text,
key = el.jsonKey,
value = el.value,
canNull = el.canNull,
callback = self:wrapFunc(self.onFinishSetField4Extend)
}
)
end
end
function TRPNewOrder:onFinishSetField4Extend(key, val)
if tostring(val) ~= tostring(self.mdata.jsonStr[key]) then
self:sendModifymsg(key, val, true)
end
end
function TRPNewOrder:setEventDelegate()
self.EventDelegate = {
ButtonSave = function()
local err = uiobjs.DetailRoot:checkValid()
err = joinStr(err, uiobjs.ExtendFormRoot:checkValid())
if not isNilOrEmpty(err) then
MyUtl.toastW(err)
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()
self:showExtentFiles(uiobjs.InputTask.value)
end
}
end
-- 处理ui上的事件例如点击等
function TRPNewOrder:uiEventDelegate(go)
local func = self.EventDelegate[go.name]
if func then
func()
end
end
-- 当顶层页面发生变化时回调
function TRPNewOrder:onTopPanelChange(topPanel)
end
--------------------------------------------
return TRPNewOrder

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3b9f5a5843f39450881fdb763d1ad219
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: