初步完成

This commit is contained in:
hoteas 2022-03-28 01:14:09 +08:00
parent fec195b3a1
commit 38d3d77c59
3 changed files with 677 additions and 113 deletions

View File

@ -1,5 +1,5 @@
{
"id": "64ca196b86ad0201f85acc22b5269830",
"id": "f8350c6049369d77d9e9d17c7a516c44",
"label": "HoTime管理平台",
"menus": [
{
@ -66,6 +66,22 @@
{
"label": "项目管理",
"table": "proj"
},
{
"label": "标签管理",
"table": "visit_tag"
},
{
"label": "标签管理",
"table": "out_tag"
},
{
"label": "车辆管理",
"table": "car"
},
{
"label": "用章管理",
"table": "seal_tag"
}
],
"name": "sys"
@ -251,6 +267,121 @@
],
"table": "admin"
},
"car": {
"auth": [
"show",
"add",
"delete",
"edit",
"info"
],
"columns": [
{
"add": false,
"edit": false,
"label": "ID",
"name": "id",
"sortable": true,
"type": "number"
},
{
"label": "名称",
"name": "name",
"type": "text"
},
{
"add": false,
"edit": false,
"label": "创建时间",
"list": false,
"name": "create_time",
"type": "time"
},
{
"add": false,
"edit": false,
"label": "变更时间",
"name": "modify_time",
"type": "time"
},
{
"label": "状态",
"name": "state",
"options": [
{
"name": "已启用",
"value": "0"
},
{
"name": "未启用",
"value": "1"
},
{
"name": "异常",
"value": "2"
}
],
"type": "select"
},
{
"label": "描述",
"list": false,
"name": "description",
"type": "text"
},
{
"label": "车牌号码",
"name": "sn",
"type": "text"
}
],
"label": "车辆管理",
"search": [
{
"label": "请输入关键词",
"name": "keyword",
"type": "search",
"value": null
},
{
"label": "时间段",
"name": "daterange",
"type": "search",
"value": null
},
{
"label": "排序",
"name": "sort",
"type": "search",
"value": null
},
{
"label": "状态",
"name": "state",
"options": [
{
"name": "已启用",
"value": "0"
},
{
"name": "未启用",
"value": "1"
},
{
"name": "异常",
"value": "2"
},
{
"name": "全部",
"value": null
}
],
"type": "select",
"value": null
}
],
"table": "car"
},
"category": {
"auth": [
"show",
@ -1619,6 +1750,116 @@
],
"table": "org"
},
"out_tag": {
"auth": [
"show",
"add",
"delete",
"edit",
"info"
],
"columns": [
{
"add": false,
"edit": false,
"label": "ID",
"name": "id",
"sortable": true,
"type": "number"
},
{
"label": "名称",
"name": "name",
"type": "text"
},
{
"add": false,
"edit": false,
"label": "创建时间",
"list": false,
"name": "create_time",
"type": "time"
},
{
"add": false,
"edit": false,
"label": "变更时间",
"name": "modify_time",
"type": "time"
},
{
"label": "状态",
"name": "state",
"options": [
{
"name": "已启用",
"value": "0"
},
{
"name": "未启用",
"value": "1"
},
{
"name": "异常",
"value": "2"
}
],
"type": "select"
},
{
"label": "描述",
"list": false,
"name": "description",
"type": "text"
}
],
"label": "标签管理",
"search": [
{
"label": "请输入关键词",
"name": "keyword",
"type": "search",
"value": null
},
{
"label": "时间段",
"name": "daterange",
"type": "search",
"value": null
},
{
"label": "排序",
"name": "sort",
"type": "search",
"value": null
},
{
"label": "状态",
"name": "state",
"options": [
{
"name": "已启用",
"value": "0"
},
{
"name": "未启用",
"value": "1"
},
{
"name": "异常",
"value": "2"
},
{
"name": "全部",
"value": null
}
],
"type": "select",
"value": null
}
],
"table": "out_tag"
},
"proj": {
"auth": [
"show",
@ -2251,6 +2492,116 @@
],
"table": "role"
},
"seal_tag": {
"auth": [
"show",
"add",
"delete",
"edit",
"info"
],
"columns": [
{
"add": false,
"edit": false,
"label": "ID",
"name": "id",
"sortable": true,
"type": "number"
},
{
"label": "名称",
"name": "name",
"type": "text"
},
{
"add": false,
"edit": false,
"label": "创建时间",
"list": false,
"name": "create_time",
"type": "time"
},
{
"add": false,
"edit": false,
"label": "变更时间",
"name": "modify_time",
"type": "time"
},
{
"label": "状态",
"name": "state",
"options": [
{
"name": "已启用",
"value": "0"
},
{
"name": "未启用",
"value": "1"
},
{
"name": "异常",
"value": "2"
}
],
"type": "select"
},
{
"label": "描述",
"list": false,
"name": "description",
"type": "text"
}
],
"label": "用章管理",
"search": [
{
"label": "请输入关键词",
"name": "keyword",
"type": "search",
"value": null
},
{
"label": "时间段",
"name": "daterange",
"type": "search",
"value": null
},
{
"label": "排序",
"name": "sort",
"type": "search",
"value": null
},
{
"label": "状态",
"name": "state",
"options": [
{
"name": "已启用",
"value": "0"
},
{
"name": "未启用",
"value": "1"
},
{
"name": "异常",
"value": "2"
},
{
"name": "全部",
"value": null
}
],
"type": "select",
"value": null
}
],
"table": "seal_tag"
},
"system": {
"auth": [
"show",
@ -2766,6 +3117,38 @@
"sortable": true,
"type": "number",
"value": "name"
},
{
"label": "拜访方式",
"link": "visit_tag",
"name": "visit_tag_id",
"sortable": true,
"type": "number",
"value": "name"
},
{
"label": "外出方式",
"link": "out_tag",
"name": "out_tag_id",
"sortable": true,
"type": "number",
"value": "name"
},
{
"label": "车辆",
"link": "car",
"name": "car_id",
"sortable": true,
"type": "number",
"value": "name"
},
{
"label": "印章",
"link": "seal_tag",
"name": "seal_tag_id",
"sortable": true,
"type": "number",
"value": "name"
}
],
"label": "任务管理",
@ -3271,6 +3654,38 @@
"list": false,
"name": "files",
"type": "file"
},
{
"label": "拜访方式",
"link": "visit_tag",
"name": "visit_tag_id",
"sortable": true,
"type": "number",
"value": "name"
},
{
"label": "外出类型",
"link": "out_tag",
"name": "out_tag_id",
"sortable": true,
"type": "number",
"value": "name"
},
{
"label": "车辆",
"link": "car",
"name": "car_id",
"sortable": true,
"type": "number",
"value": "name"
},
{
"label": "印章",
"link": "seal_tag",
"name": "seal_tag_id",
"sortable": true,
"type": "number",
"value": "name"
}
],
"label": "任务执行",
@ -3608,6 +4023,11 @@
"sortable": true,
"type": "number",
"value": "name"
},
{
"label": "职位",
"name": "position",
"type": "text"
}
],
"label": "客户管理",
@ -3657,6 +4077,116 @@
],
"table": "user"
},
"visit_tag": {
"auth": [
"show",
"add",
"delete",
"edit",
"info"
],
"columns": [
{
"add": false,
"edit": false,
"label": "ID",
"name": "id",
"sortable": true,
"type": "number"
},
{
"label": "名称",
"name": "name",
"type": "text"
},
{
"add": false,
"edit": false,
"label": "创建时间",
"list": false,
"name": "create_time",
"type": "time"
},
{
"add": false,
"edit": false,
"label": "变更时间",
"name": "modify_time",
"type": "time"
},
{
"label": "状态",
"name": "state",
"options": [
{
"name": "已启用",
"value": "0"
},
{
"name": "未启用",
"value": "1"
},
{
"name": "异常",
"value": "2"
}
],
"type": "select"
},
{
"label": "描述",
"list": false,
"name": "description",
"type": "text"
}
],
"label": "标签管理",
"search": [
{
"label": "请输入关键词",
"name": "keyword",
"type": "search",
"value": null
},
{
"label": "时间段",
"name": "daterange",
"type": "search",
"value": null
},
{
"label": "排序",
"name": "sort",
"type": "search",
"value": null
},
{
"label": "状态",
"name": "state",
"options": [
{
"name": "已启用",
"value": "0"
},
{
"name": "未启用",
"value": "1"
},
{
"name": "异常",
"value": "2"
},
{
"name": "全部",
"value": null
}
],
"type": "select",
"value": null
}
],
"table": "visit_tag"
},
"wechat": {
"auth": [
"show",

View File

@ -36,45 +36,45 @@ func main() {
}
if len(that.RouterString)==2{
if that.HandlerStr == "/app/proj" &&that.Req.Method == "POST"{
that.RespFunc= func() {
if that.RespData["status"]!=nil&&that.RespData.GetCeilInt64("status")==0{
companyId:= ObjToInt(that.Req.FormValue("company_id"))
userId:= ObjToInt(that.Req.FormValue("user_id"))
zoneId:= ObjToInt(that.Req.FormValue("zone_id"))
channelId:= ObjToInt(that.Req.FormValue("channel_id"))
categoryId:= ObjToInt(that.Req.FormValue("category_id"))
projId:=that.RespData.GetCeilInt("result")
if companyId!=0{
if len(that.RouterString) == 2 {
if that.HandlerStr == "/app/proj" && that.Req.Method == "POST" {
that.RespFunc = func() {
if that.RespData["status"] != nil && that.RespData.GetCeilInt64("status") == 0 {
companyId := ObjToInt(that.Req.FormValue("company_id"))
userId := ObjToInt(that.Req.FormValue("user_id"))
zoneId := ObjToInt(that.Req.FormValue("zone_id"))
channelId := ObjToInt(that.Req.FormValue("channel_id"))
categoryId := ObjToInt(that.Req.FormValue("category_id"))
projId := that.RespData.GetCeilInt("result")
if companyId != 0 {
cdata:=Map{"proj_id":projId}
if userId!=0{
cdata["user_id"]=userId
cdata := Map{"proj_id": projId}
if userId != 0 {
cdata["user_id"] = userId
}
if zoneId!=0{
cdata["zone_id"]=zoneId
if zoneId != 0 {
cdata["zone_id"] = zoneId
}
if channelId!=0{
cdata["channel_id"]=channelId
if channelId != 0 {
cdata["channel_id"] = channelId
}
that.Db.Update("company",cdata,Map{"id":companyId})
that.Db.Update("company", cdata, Map{"id": companyId})
}
projD:=Map{}
if categoryId!=0{
category:=that.Db.Get("category","*",Map{"id":categoryId})
projD["name"]=category.GetString("name")
projD := Map{}
if categoryId != 0 {
category := that.Db.Get("category", "*", Map{"id": categoryId})
projD["name"] = category.GetString("name")
}
if companyId!=0{
company:=that.Db.Get("company","*",Map{"id":companyId})
projD["level"]=company.GetString("level")
if companyId != 0 {
company := that.Db.Get("company", "*", Map{"id": companyId})
projD["level"] = company.GetString("level")
}
if len(projD)!=0{
if len(projD) != 0 {
that.Db.Update("proj",projD,Map{"id":projId})
that.Db.Update("proj", projD, Map{"id": projId})
}
}
@ -84,157 +84,155 @@ func main() {
}
//查询列表插入
if that.HandlerStr == "/app/task_admin" &&that.Req.Method == "GET"{
that.Req.Form.Set("admin_id",that.Session("admin_id").ToStr())
that.RespFunc= func() {
if that.RespData["status"]!=nil&&that.RespData.GetCeilInt64("status")==0 {
taskAdmin:=that.RespData.GetMap("result").GetSlice("data")
for k,_:=range taskAdmin{
v:=taskAdmin.GetMap(k)
if that.HandlerStr == "/app/task_admin" && that.Req.Method == "GET" {
that.Req.Form.Set("admin_id", that.Session("admin_id").ToStr())
that.RespFunc = func() {
if that.RespData["status"] != nil && that.RespData.GetCeilInt64("status") == 0 {
taskAdmin := that.RespData.GetMap("result").GetSlice("data")
for k, _ := range taskAdmin {
v := taskAdmin.GetMap(k)
v["task"] = that.Db.Get("task", "*", Map{"id": v.GetCeilInt("task_id")})
}
that.RespData["result"]=Map{"count":that.RespData.GetMap("result").GetCeilInt("count"),"data":taskAdmin}
that.RespData["result"] = Map{"count": that.RespData.GetMap("result").GetCeilInt("count"), "data": taskAdmin}
}
}
}
//查询详情插入
if len(that.RouterString)==3&&strings.Contains(that.HandlerStr ,"/app/task_admin") &&that.Req.Method == "GET"{
that.RespFunc= func() {
if that.RespData["status"]!=nil&&that.RespData.GetCeilInt64("status")==0 {
taskAdmin:=that.RespData.GetMap("result")
if len(that.RouterString) == 3 && strings.Contains(that.HandlerStr, "/app/task_admin") && that.Req.Method == "GET" {
that.RespFunc = func() {
if that.RespData["status"] != nil && that.RespData.GetCeilInt64("status") == 0 {
taskAdmin := that.RespData.GetMap("result")
taskAdmin["task"] = that.Db.Get("task", "*", Map{"id": taskAdmin.GetCeilInt("task_id")})
taskAdmin["admins"]=that.Db.Select("task",Map{"[><]admin":"admin.id=task.admin_id"},"*",Map{"task_id":taskAdmin.GetCeilInt("task_id"),"ORDER":"modify_time DESC"})
taskAdmin["admins"] = that.Db.Select("task", Map{"[><]admin": "admin.id=task.admin_id"}, "*", Map{"task_id": taskAdmin.GetCeilInt("task_id"), "ORDER": "modify_time DESC"})
}
}
}
//编辑详情插入
if len(that.RouterString)==3&&strings.Contains(that.HandlerStr ,"/app/task_admin") &&that.Req.Method == "PUT"{
that.RespFunc= func() {
if that.RespData["status"]!=nil&&that.RespData.GetCeilInt64("status")==0 {
taskAdminID:=that.RouterString[2]
taskAdmin:=that.Db.Get("task_admin","*",Map{"id":taskAdminID})
if len(that.RouterString) == 3 && strings.Contains(that.HandlerStr, "/app/task_admin") && that.Req.Method == "PUT" {
that.RespFunc = func() {
if that.RespData["status"] != nil && that.RespData.GetCeilInt64("status") == 0 {
taskAdminID := that.RouterString[2]
taskAdmin := that.Db.Get("task_admin", "*", Map{"id": taskAdminID})
taskAdminStatus := taskAdmin.GetCeilInt64("status")
taskAdminStatus:=taskAdmin.GetCeilInt64("status")
that.Log["task_id"]=taskAdmin.GetCeilInt("task_id")
that.Log["type"]=4
that.Log["task_id"] = taskAdmin.GetCeilInt("task_id")
that.Log["type"] = 4
//执行者,状态为1部分执行不能审批状态
if taskAdminStatus==1{
if taskAdminStatus == 1 {
that.Log["name"]="执行"
that.Log["name"] = "执行"
taskData:=Map{}
taskAdmins:=that.Db.Select("task_admin","*",Map{"AND":Map{"task_id":taskAdmin.GetCeilInt("task_id"),"role":0}})
for _,v :=range taskAdmins{
if v.GetCeilInt("status")!=1{
taskData["status"]=4
taskData := Map{}
taskAdmins := that.Db.Select("task_admin", "*", Map{"AND": Map{"task_id": taskAdmin.GetCeilInt("task_id"), "role": 0}})
for _, v := range taskAdmins {
if v.GetCeilInt("status") != 1 {
taskData["status"] = 4
break
}
}
//全部执行完成,则变更任务为待审批,同时将所有审批者权限设置为待审批,没有执行完成则全部变部分执行完成,审批者不操作
if taskData.GetCeilInt("status")!=4{
taskData["status"]=1
that.Db.Update("task_admin",Map{"status":1},Map{"AND":Map{"task_id":taskAdmin.GetCeilInt("task_id"),"role":Slice{1,3}}})
that.Db.Update("task",Map{"status":1},Map{"id":taskAdmin.GetCeilInt("task_id")})
}else{
that.Db.Update("task",taskData,Map{"id":taskAdmin.GetCeilInt("task_id")})
if taskData.GetCeilInt("status") != 4 {
taskData["status"] = 1
that.Db.Update("task_admin", Map{"status": 1}, Map{"AND": Map{"task_id": taskAdmin.GetCeilInt("task_id"), "role": Slice{1, 3}}})
that.Db.Update("task", Map{"status": 1}, Map{"id": taskAdmin.GetCeilInt("task_id")})
} else {
that.Db.Update("task", taskData, Map{"id": taskAdmin.GetCeilInt("task_id")})
}
}
//审批者,状态为2已完成执行部分审批或全部审批状态
if taskAdminStatus==2{
that.Log["name"]="审批"
taskData:=Map{}
taskAdmins:=that.Db.Select("task_admin","*",Map{"AND":Map{"task_id":taskAdmin.GetCeilInt("task_id"),"role":Slice{1,3}}})
for _,v :=range taskAdmins{
if v.GetCeilInt("status")!=2{
taskData["status"]=5
if taskAdminStatus == 2 {
that.Log["name"] = "审批"
taskData := Map{}
taskAdmins := that.Db.Select("task_admin", "*", Map{"AND": Map{"task_id": taskAdmin.GetCeilInt("task_id"), "role": Slice{1, 3}}})
for _, v := range taskAdmins {
if v.GetCeilInt("status") != 2 {
taskData["status"] = 5
break
}
}
//全部审批完成,则变更任务为已审批,同时将所有审批者权限设置为待审批,没有执行完成则全部变部分执行完成,审批者不操作
if taskData.GetCeilInt("status")!=5{
taskData["status"]=2
that.Db.Update("task_admin",Map{"status":2},Map{"AND":Map{"task_id":taskAdmin.GetCeilInt("task_id")}})
that.Db.Update("task",Map{"status":2},Map{"id":taskAdmin.GetCeilInt("task_id")})
}else{
that.Db.Update("task",taskData,Map{"id":taskAdmin.GetCeilInt("task_id")})
if taskData.GetCeilInt("status") != 5 {
taskData["status"] = 2
that.Db.Update("task_admin", Map{"status": 2}, Map{"AND": Map{"task_id": taskAdmin.GetCeilInt("task_id")}})
that.Db.Update("task", Map{"status": 2}, Map{"id": taskAdmin.GetCeilInt("task_id")})
} else {
that.Db.Update("task", taskData, Map{"id": taskAdmin.GetCeilInt("task_id")})
}
}
//审批者,状态为3驳回状态则将所有人状态都设置为驳回状态
if taskAdminStatus==3{
if taskAdminStatus == 3 {
that.Log["name"]="驳回"
that.Log["name"] = "驳回"
that.Db.Update("task_admin",Map{"status":3},Map{"AND":Map{"task_id":taskAdmin.GetCeilInt("task_id")}})
that.Db.Update("task",Map{"status":3},Map{"id":taskAdmin.GetCeilInt("task_id")})
that.Db.Update("task_admin", Map{"status": 3}, Map{"AND": Map{"task_id": taskAdmin.GetCeilInt("task_id")}})
that.Db.Update("task", Map{"status": 3}, Map{"id": taskAdmin.GetCeilInt("task_id")})
}
}
}
}
if that.HandlerStr == "/app/task" &&that.Req.Method == "POST"{
that.RespFunc= func() {
if that.RespData["status"]!=nil&&that.RespData.GetCeilInt64("status")==0{
if that.HandlerStr == "/app/task" && that.Req.Method == "POST" {
that.RespFunc = func() {
if that.RespData["status"] != nil && that.RespData.GetCeilInt64("status") == 0 {
executorData := ObjToMap(that.Req.FormValue("executor_data"))
approverData := ObjToMap(that.Req.FormValue("approver_data"))
readerData := ObjToMap(that.Req.FormValue("reader_data"))
taskId:=that.RespData.GetCeilInt("result")
task:= that.Db.Get("task","admin_id,name,create_time,modify_time,state,company_id,proj_id,reward,reward_money,reward_description,type,zone_id,extend_data,city_id,status,user_id,zone_id",Map{"id":taskId})
task["task_id"]=taskId
taskId := that.RespData.GetCeilInt("result")
task := that.Db.Get("task", "admin_id,name,create_time,modify_time,state,company_id,proj_id,reward,reward_money,reward_description,type,zone_id,extend_data,city_id,status,user_id,zone_id,out_tag_id,visit_tag_id,car_id,seal_tag_id", Map{"id": taskId})
task["task_id"] = taskId
that.Log["task_id"]=taskId
that.Log["task_id"] = taskId
adminId:=task.GetCeilInt64("admin_id")
adminMap:=Map{}
if approverData!=nil{
admins:=approverData.GetMap("admin")
for k,_:=range admins{
admin:=admins.GetMap(k)
if admin==nil{
adminId := task.GetCeilInt64("admin_id")
adminMap := Map{}
if approverData != nil {
admins := approverData.GetMap("admin")
for k, _ := range admins {
admin := admins.GetMap(k)
if admin == nil {
continue
}
task["admin_id"]=admin.GetCeilInt64("id")
adminMap[task.GetString("admin_id")]=task["admin_id"]
task["admin_id"] = admin.GetCeilInt64("id")
adminMap[task.GetString("admin_id")] = task["admin_id"]
task["role"]=1
that.Db.Insert("task_admin",task)
task["role"] = 1
that.Db.Insert("task_admin", task)
}
}
if executorData!=nil{
admins:=executorData.GetMap("admin")
for k,_:=range admins{
admin:=admins.GetMap(k)
if admin==nil{
if executorData != nil {
admins := executorData.GetMap("admin")
for k, _ := range admins {
admin := admins.GetMap(k)
if admin == nil {
continue
}
task["admin_id"]=admin.GetCeilInt64("id")
task["admin_id"] = admin.GetCeilInt64("id")
//转换为执行&审批者
if adminMap[task.GetString("admin_id")]!=nil{
that.Db.Update("task_admin",Map{"role":3},Map{"AND":Map{"admin_id":task["admin_id"],"task_id":taskId}})
if adminMap[task.GetString("admin_id")] != nil {
that.Db.Update("task_admin", Map{"role": 3}, Map{"AND": Map{"admin_id": task["admin_id"], "task_id": taskId}})
}else {
} else {
adminMap[task.GetString("admin_id")]=task["admin_id"]
task["role"]=0
that.Db.Insert("task_admin",task)
adminMap[task.GetString("admin_id")] = task["admin_id"]
task["role"] = 0
that.Db.Insert("task_admin", task)
}
}
}
if readerData!=nil {
if readerData != nil {
admins := readerData.GetMap("admin")
for k, _ := range admins {
admin := admins.GetMap(k)
@ -252,6 +250,42 @@ func main() {
}
}
if task.GetCeilInt("type") != 0 {
//that.Db.Update("task",Map{"status":2},Map{"id":taskId})
if executorData == nil {
task["admin_id"] = adminId
task["role"] = 3
//task["status"]=2
that.Db.Insert("task_admin", task)
} else {
//that.Db.Update("task_admin",Map{"status":2},Map{"task_id":taskId})
}
admin := that.Db.Get("admin", "org_id", Map{"id": adminId})
org := that.Db.Get("org", "index", Map{"id": admin.GetCeilInt64("org_id")})
orgstr := strings.Split(org.GetString("index"), ",")
orgs := Slice{}
for _, v := range orgstr {
if v != "" && v != ObjToStr(admin.GetCeilInt64("org_id")) {
orgs = append(orgs, v)
}
}
if len(orgs) != 0 {
admins := that.Db.Select("admin", "id", Map{"org_id": orgs})
for _, v := range admins {
task["admin_id"] = v.GetCeilInt("id")
task["role"] = 2
//task["status"]=2
that.Db.Insert("task_admin", task)
}
}
}
}
}
}

Binary file not shown.