Files
tianrunCRM/Assets/trCRM/upgradeRes4Dev/priority/lua/db/DBCust.lua

132 lines
3.2 KiB
Lua
Raw Normal View History

2020-07-04 14:41:25 +08:00
---@class _DBCust
2020-07-28 21:02:59 +08:00
---@field custId
2020-07-04 14:41:25 +08:00
---@field custName
---@field custType
2020-07-14 22:04:03 +08:00
---@field phoneNo
2020-07-04 14:41:25 +08:00
---@field address
---@field companyName
---@field taskId
---@field serviceNo
---@field companyid
2020-07-08 08:01:34 +08:00
---@field jsonStr
2020-07-04 14:41:25 +08:00
---@field dealflag
---@field custFrom
---@field customerLabel
---@field assignTime
---@field lastFollowUpTime
---@field loginNo
---@field createTime
---@field uploginno
---@field updateTime
--================================================
DBCust = {}
local db = {}
DBCust.FilterGroup = {
custFromList = "custFromList", -- 客户来源
custTypeList = "custTypeList", -- list 客户类型
dealFlagList = "dealFlagList", -- list 客户状态
loginNoList = "loginNoList", -- list 归属工号
2020-07-18 21:12:14 +08:00
taskList = "taskList", -- list 任务名称
2020-07-20 22:20:21 +08:00
followUpTypeList = "followUpTypeList", -- 跟进类型
opportunityList = "opportunityList" -- 商机
2020-07-04 14:41:25 +08:00
}
DBCust.FieldType = {
popuplist = "下拉框",
checkbox = "复选框",
multext = "大文本框",
number = "数字文本框",
dateTime = "时间文本框",
text = "普通文本框",
2020-07-18 21:12:14 +08:00
phone = "电话号码框",
2020-07-20 22:20:21 +08:00
empty = "empty"
2020-07-18 21:12:14 +08:00
}
---@class _FieldMode
_FieldMode = {
inputOnly = 0, -- 纯输入
showOnly = 1, -- 纯展示模式
modifyOnly = 2, -- 修改模式
showAndModify = 3, -- 展示械式同时也可以modify
2020-07-20 22:20:21 +08:00
button = 4 -- 类似按钮的功能
2020-07-04 14:41:25 +08:00
}
DBCust.onGetFilter = function(data)
db.filters = data
local list = {}
for i, v in ipairs(data.loginNoList or {}) do
table.insert(list, {name = v.loginName, value = v.loginNo})
end
db.filters.loginNoList = list
-- 转换成poplist
db.taskFields = {}
db.filtersPopup = {}
for k, cells in pairs(data) do
db.filtersPopup[k] = {}
---@type System.Collections.ArrayList
db.filtersPopup[k].options = ArrayList()
db.filtersPopup[k].values = ArrayList()
2020-07-08 08:01:34 +08:00
-- db.filtersPopup[k].options:Add("")
-- db.filtersPopup[k].values:Add("")
2020-07-04 14:41:25 +08:00
for i, s in ipairs(cells) do
db.filtersPopup[k].options:Add(s.name)
db.filtersPopup[k].values:Add(tostring(s.value))
if k == DBCust.FilterGroup.taskList then
db.taskFields[tostring(s.value)] = s.fieldAttr -- 设置任务的扩展字段
end
end
end
-- 加上“全部”的选择
--[[
for k, v in pairs(DBCust.FilterGroup) do
local list = DBCust.getFilter(v)
if list then
table.insert(list, 1, {name = "全部", value = -1})
end
end
]]
end
DBCust.getFieldsByTask = function(taskValue)
2020-07-10 13:22:24 +08:00
if not taskValue then
return {}
end
2020-07-14 22:04:03 +08:00
taskValue = tostring(taskValue)
2020-07-10 13:22:24 +08:00
return db.taskFields[taskValue] or {}
2020-07-04 14:41:25 +08:00
end
DBCust.getFilter = function(filterName)
if filterName then
return db.filters[filterName]
end
return db.filters
end
DBCust.getFilter4Popup = function(filterName)
if filterName then
return db.filtersPopup[filterName]
end
return db.filters
end
DBCust.onGetCusts = function(list)
db.custs = list
end
-- DBCust.getCusts = function(callback)
-- if db.custs == nil then
-- NetProto.send.list_customers()
-- end
-- return db.custs
-- end
DBCust.clean = function()
db = {}
end
return DBCust