Browse Source

自定义表单

v1
超级管理员 2 years ago
parent
commit
a308d16e77
  1. 49
      api/authentication/signcode.go
  2. 27
      api/authentication/type.go
  3. 214
      api/shiyan/maptostruct/shiyan.go
  4. 29
      api/shiyan/maptostruct/type.go
  5. 559
      api/shiyan/数据结构收集/allzhujian.ts
  6. 134
      api/shiyan/数据结构收集/下拉选这框.ts
  7. 61
      api/shiyan/数据结构收集/分割线.ts
  8. 81
      api/shiyan/数据结构收集/单行文本.ts
  9. 190
      api/shiyan/数据结构收集/单选按钮.ts
  10. 659
      api/shiyan/数据结构收集/卡片.ts
  11. 65
      api/shiyan/数据结构收集/取色器.ts
  12. 77
      api/shiyan/数据结构收集/图片文件.ts
  13. 86
      api/shiyan/数据结构收集/多行文本.ts
  14. 114
      api/shiyan/数据结构收集/多选按钮.ts
  15. 164
      api/shiyan/数据结构收集/子表.ts
  16. 159
      api/shiyan/数据结构收集/容器.ts
  17. 75
      api/shiyan/数据结构收集/富文本.ts
  18. 65
      api/shiyan/数据结构收集/开关.ts
  19. 106
      api/shiyan/数据结构收集/弹性布局.ts
  20. 60
      api/shiyan/数据结构收集/按钮.ts
  21. 50
      api/shiyan/数据结构收集/文字.ts
  22. 86
      api/shiyan/数据结构收集/日期选择器.ts
  23. 74
      api/shiyan/数据结构收集/时间选择器.ts
  24. 78
      api/shiyan/数据结构收集/栅格.ts
  25. 206
      api/shiyan/数据结构收集/标签页.ts
  26. 59
      api/shiyan/数据结构收集/标题.ts
  27. 98
      api/shiyan/数据结构收集/树形控件.ts
  28. 76
      api/shiyan/数据结构收集/格栅布局.ts
  29. 69
      api/shiyan/数据结构收集/滑块.ts
  30. 163
      api/shiyan/数据结构收集/级联选择器.ts
  31. 66
      api/shiyan/数据结构收集/计数器.ts
  32. 68
      api/shiyan/数据结构收集/评分.ts
  33. 69
      api/shiyan/数据结构收集/选择用户.ts
  34. 4
      api/version1/entry.go
  35. 563
      api/version1/matrixApi/api.go
  36. 85
      api/version1/matrixApi/type.go
  37. 149
      api/version1/publicapi/api.go
  38. 22
      api/version1/publicapi/type.go
  39. 1
      api/version1/user/userCont.go
  40. 2
      apirouter/apishiyan/maptostruct.go
  41. 4
      apirouter/authenticationroute/entry.go
  42. 20
      apirouter/authenticationroute/signcoderoute.go
  43. 6
      apirouter/entry.go
  44. 18
      apirouter/v1/customerformrouter/router.go
  45. 4
      apirouter/v1/customerformrouter/type.go
  46. 8
      apirouter/v1/matrixRouters/pc.go
  47. 21
      apirouter/v1/public/router.go
  48. 4
      apirouter/v1/public/type.go
  49. 2
      config/configDatabase/database.go
  50. 1
      go.mod
  51. 1
      go.sum
  52. 14
      initialization/databaseinit/mysql.go
  53. 12
      initialization/route/initRoute.go
  54. 3
      main.go
  55. 1
      middleware/grocerystore/redis.go
  56. 4
      models/modelAppPlatform/matrix_content.go
  57. 6
      models/modelAppPlatform/matrix_frame.go
  58. 2
      models/modelAppPlatform/matrix_handler.go
  59. 74
      models/modelsschool/test_paper.go
  60. 3
      overall/appConfig.go
  61. 4
      overall/publicmethod/technique.go
  62. 4
      overall/publicmethod/type.go
  63. 45
      scheduledtask/time_task_cron.go

49
api/authentication/signcode.go

@ -0,0 +1,49 @@
package authentication
import (
"appPlatform/middleware/grocerystore"
"appPlatform/overall"
"appPlatform/overall/publicmethod"
"fmt"
"github.com/gin-gonic/gin"
)
// 验证身份
func (a *ApiMethod) SignCode(c *gin.Context) {
userKey := c.Request.Header.Get("user-key")
userToken := c.Request.Header.Get("user-token")
if userKey == "" || userToken == "" {
publicmethod.Result(1, userKey, c, "验证失败!未知识别符!")
return
}
var requestData SignCodeStr
err := c.ShouldBindJSON(&requestData)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if requestData.Code == "" {
publicmethod.Result(1, err, c, "验证失败!未知识别符!")
return
}
redisFileKey := fmt.Sprintf("ScanCode:Aut:IdentRec_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, requestData.Code)
redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS4)
userRedisToken, isTrue := redisClient.HashGetAll(redisFileKey)
if !isTrue {
publicmethod.Result(1, userRedisToken, c, "验证失败!不是授权用户!1")
return
}
// sf := publicmethod.MapOut[string]()
if userToken != userRedisToken["usertoken"] || userKey != userRedisToken["userkey"] {
// sf["userToken"] = userToken
// sf["userToken_es"] = userRedisToken["usertoken"]
// sf["userKey"] = userKey
// sf["userkey_es"] = userRedisToken["userkey"]
// publicmethod.Result(1, sf, c, "验证失败!不是授权用户!2")
publicmethod.Result(1, err, c, "验证失败!不是授权用户!2")
return
}
redisClient.DelKey(redisFileKey)
publicmethod.Result(0, err, c)
}

27
api/authentication/type.go

@ -0,0 +1,27 @@
package authentication
import (
"appPlatform/overall/publicmethod"
"github.com/gin-gonic/gin"
)
type ApiMethod struct{}
// 身份验证
func (a *ApiMethod) Index(c *gin.Context) {
outputCont := publicmethod.MapOut[string]()
outputCont["index"] = "身份验证"
publicmethod.Result(0, outputCont, c)
}
type ApiEntry struct {
SingCodeApi ApiMethod
}
var AppApiEntry = new(ApiEntry)
// 验证字符串
type SignCodeStr struct {
Code string `json:"code"`
}

214
api/shiyan/maptostruct/shiyan.go

@ -0,0 +1,214 @@
package maptostruct
import (
"appPlatform/models/modelsschool"
"appPlatform/overall"
"appPlatform/overall/publicmethod"
"crypto/md5"
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
"github.com/gin-gonic/gin"
"gorm.io/gorm/clause"
)
/*
*
@ 作者: 秦东
@ 时间: 2023-08-08 14:16:31
@ 功能: 获取车场车位信息
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) CharParking(c *gin.Context) {
var requestData SendParkCont
c.ShouldBindJSON(&requestData)
var charCont CharParkCont
requestData.Data = charCont
requestData.Ts = strconv.FormatInt(time.Now().Unix(), 10)
jsonByte, err := json.Marshal(requestData.Data)
signStrAll := fmt.Sprintf("%v%v%v%v", string(jsonByte), requestData.Ts, requestData.ParkId, requestData.AccessKey)
// signStrAll := fmt.Sprintf("%v%v%v", requestData.Ts, requestData.ParkId, requestData.AccessKey)
//计算签名
mdNew := md5.New()
mdNew.Write([]byte(signStrAll))
signStrAllMd5 := fmt.Sprintf("%x", mdNew.Sum(nil))
signStrAllMd5Big := strings.ToUpper(signStrAllMd5)
requestData.Sign = signStrAllMd5Big
var toForData SendParkInfo
toForData.Data = string(jsonByte)
toForData.ParkId = requestData.ParkId
toForData.Ts = requestData.Ts
toForData.Sign = signStrAllMd5Big
sendDate, _ := json.Marshal(toForData)
callBackByte := publicmethod.CurlPostJosn("http://1.116.211.94:8002/parkservapi/api_GetParkPlace", sendDate)
var toForDataIng SendParkInfoIng
toForDataIng.Data = requestData.Data
toForDataIng.ParkId = requestData.ParkId
toForDataIng.Ts = requestData.Ts
toForDataIng.Sign = signStrAllMd5Big
sendDateing, _ := json.Marshal(toForDataIng)
callBackByteIf := publicmethod.CurlPostJosn("http://1.116.211.94:8002/LPApi.asmx/api_GetGatesInfo", sendDateing)
outData := publicmethod.MapOut[string]()
outData["err"] = err
outData["signStrAll"] = signStrAll
outData["signStrAllMd5"] = signStrAllMd5
outData["signStrAllMd5Big"] = signStrAllMd5Big
outData["requestData"] = requestData
outData["sendDate"] = string(sendDate)
outData["callBackByte"] = string(callBackByte)
outData["toForData"] = toForData
outData["callBackByteIf"] = string(callBackByteIf)
// fmt.Printf("%v\n", outData)
publicmethod.Result(0, outData, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-08-16 16:39:13
@ 功能: 迁移试卷数据
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) TestPage(c *gin.Context) {
var testPageList []int64
err := overall.CONSTANT_DB_Server.Model(&modelsschool.TestPaper{}).Select("tp_id").Find(&testPageList).Error
if err != nil {
publicmethod.Result(0, err, c)
return
}
countPage := len(testPageList)
fmt.Printf("余数---》%v\n", countPage)
if len(testPageList) > 0 {
var saveData []int64
jibuqi := 0
for i := 0; i < countPage; i++ {
if i != 0 && i%1000 == 0 {
saveData = append(saveData, testPageList[i])
jibuqi++
syncSeting.Add(1)
// time.Sleep(20 * time.Millisecond)
go dengdai(saveData, jibuqi)
saveData = saveData[:0]
// break
} else {
saveData = append(saveData, testPageList[i])
}
}
if len(saveData) > 0 {
syncSeting.Add(1)
go dengdai(saveData, jibuqi)
fmt.Printf("余数---》%v\n", len(saveData))
}
syncSeting.Wait()
}
// var countPages int64
// overall.CONSTANT_DB_Tidb.Model(&modelsschool.TestPaper{}).Select("tp_id").Count(&countPages)
publicmethod.Result(0, countPage, c)
}
func dengdai(testPageList []int64, jibuqi int) {
defer syncSeting.Done()
// fmt.Printf("金晶科技了%v-------><---", jibuqi)
var testPageListCont []modelsschool.TestPaper
errEs := overall.CONSTANT_DB_Server.Model(&modelsschool.TestPaper{}).Where("tp_id IN ?", testPageList).Find(&testPageListCont).Error
if errEs == nil {
var saveCont []modelsschool.TestPaper
for i := 0; i < len(testPageListCont); i++ {
saveCont = append(saveCont, testPageListCont[i])
if i != 0 && i%10 == 0 {
overall.CONSTANT_DB_Tidb.Clauses(clause.OnConflict{DoNothing: true}).Create(&saveCont)
saveCont = saveCont[:0]
}
}
if len(saveCont) > 0 {
overall.CONSTANT_DB_Tidb.Clauses(clause.OnConflict{DoNothing: true}).Create(&saveCont)
}
// for _, v := range testPageListCont {
// // var testPageCont modelsschool.TestPaper
// // err := overall.CONSTANT_DB_Server.Where("tp_id = ?", v).First(&testPageCont).Error
// // // fmt.Printf("金晶科技了%v---->%v\n", v, err)
// // if err == nil {
// overall.CONSTANT_DB_Tidb.Clauses(clause.OnConflict{DoNothing: true}).Create(&v)
// // }
// }
}
// var testPageListCont []modelsschool.TestPaper
// err := overall.CONSTANT_DB_Server.Model(&modelsschool.TestPaper{}).Where("tp_id IN ?", testPageList).Find(&testPageListCont).Error
// if err == nil {
// // overall.CONSTANT_DB_Tidb.Create(&testPageListCont)
// overall.CONSTANT_DB_Tidb.Clauses(clause.OnConflict{DoNothing: true}).Create(&testPageListCont)
// }
// time.Sleep(100 * time.Millisecond)
}
func TestPageTimeTask() {
var testPageList []int64
err := overall.CONSTANT_DB_Server.Model(&modelsschool.TestPaper{}).Select("tp_id").Find(&testPageList).Error
if err != nil {
tadyTime := time.Now().Unix()
fmt.Printf("没有数据%v--%v\n", err, publicmethod.UnixTimeToDay(tadyTime, 11))
return
}
countPage := len(testPageList)
// fmt.Printf("余数---》%v\n", countPage)
if len(testPageList) > 0 {
var saveData []int64
jibuqi := 0
for i := 0; i < countPage; i++ {
if i != 0 && i%1000 == 0 {
saveData = append(saveData, testPageList[i])
jibuqi++
syncSeting.Add(1)
// time.Sleep(20 * time.Millisecond)
go dengdai(saveData, jibuqi)
saveData = saveData[:0]
// break
} else {
saveData = append(saveData, testPageList[i])
}
}
if len(saveData) > 0 {
syncSeting.Add(1)
go dengdai(saveData, jibuqi)
// fmt.Printf("余数---》%v\n", len(saveData))
}
syncSeting.Wait()
}
// var countPages int64
// overall.CONSTANT_DB_Tidb.Model(&modelsschool.TestPaper{}).Select("tp_id").Count(&countPages)
}

29
api/shiyan/maptostruct/type.go

@ -77,3 +77,32 @@ type UpdateMiniTemp struct {
Orderkey string `json:"orderkey"` //流程识别符
Enforcer string `json:"enforcer"` //执行人
}
type CharParkCont struct{}
type SendParkCont struct {
Data CharParkCont `json:"data"`
ParkId string `json:"parkId"` //注:这里传值车场编号
Ts string `json:"ts"` //时间戳,精确到秒,数字格式
Sign string `json:"sign"` //签名,字符串格式
AccessKey string `json:"accessKey"` //
}
type SendParkInfo struct {
ParkId string `json:"parkId"` //注:这里传值车场编号
Data string `json:"data"`
Ts string `json:"ts"` //时间戳,精确到秒,数字格式
Sign string `json:"sign"` //签名,字符串格式
}
type SendParkInfoIng struct {
ParkId string `json:"parkId"` //注:这里传值车场编号
Data CharParkCont `json:"data"`
Ts string `json:"ts"` //时间戳,精确到秒,数字格式
Sign string `json:"sign"` //签名,字符串格式
}
type worker struct {
in chan int
done chan bool
}

559
api/shiyan/数据结构收集/allzhujian.ts

@ -0,0 +1,559 @@
const opt = {
list: [
{
type: "grid",
columns: [
{
attr:
{
span: 12
},
list: [
{
type: "input",
control:
{
modelValue: "",
placeholder: "请输入姓名"
},
config:
{},
name: "input1690848993703",
item:
{
label: "姓名"
}
}]
},
{
attr:
{
span: 12
},
list: [
{
type: "radio",
control:
{
modelValue: ""
},
options: [
{
label: "男",
value: "1"
},
{
label: "女",
value: "2"
}],
config:
{
optionsType: 0,
transformData: "number"
},
name: "radio1690848996254",
item:
{
label: "性别"
}
}],
type: "gridChild"
},
{
list: [
{
type: "select",
control:
{
modelValue: "",
appendToBody: true,
placeholder: "请选择民族"
},
options: [
{
label: "汉族",
value: "1"
},
{
label: "回族",
value: "2"
},
{
label: "满族",
value: "3"
},
{
label: "维吾尔族",
value: "4"
}],
config:
{
optionsType: 0
},
name: "select1690849137964",
item:
{
label: "民族"
}
}],
attr:
{
span: 12
}
},
{
list: [
{
type: "radio",
control:
{
modelValue: ""
},
options: [
{
label: "已婚",
value: "1"
},
{
label: "未婚",
value: "2"
}],
config:
{
optionsType: 0,
transformData: "number"
},
name: "radio1690849410161",
item:
{
label: "婚姻状况"
}
}],
attr:
{
span: 12
},
type: "gridChild"
},
{
list: [
{
type: "input",
control:
{
modelValue: ""
},
config:
{},
name: "input1690849482442",
item:
{
label: "联系电话"
}
}],
attr:
{
span: 12
}
},
{
list: [
{
type: "input",
control:
{
modelValue: "",
placeholder: "请输入家庭住址"
},
config:
{},
name: "input1690849626122",
item:
{
label: "家庭住址"
}
}],
attr:
{
span: 12
}
}],
control:
{},
config:
{}
},
{
type: "divider",
control:
{},
config:
{},
item:
{
label: "人员属性"
}
},
{
type: "tabs",
columns: [
{
label: "基本信息",
list: [
{
type: "upload",
control:
{
modelValue: ""
},
config:
{},
name: "upload1690849946230",
item:
{
label: "图片/文件"
}
}]
},
{
label: "行政组织关系",
list: [
{
type: "tinymce",
control:
{
modelValue: ""
},
config:
{},
name: "tinymce1690849980035",
item:
{
label: "富文本"
}
}]
},
{
label: "紧急联系人",
list: [
{
type: "title",
control:
{
modelValue: "标题"
},
config:
{}
}]
},
{
label: "教育经历",
list: [
{
type: "txt",
control:
{
modelValue: "这是一段文字说明"
},
config:
{}
}]
}],
control:
{},
config:
{
span: ""
}
},
{
type: "flex",
list: [
{
type: "treeSelect",
control:
{
modelValue: "",
data: [
[]
],
renderAfterExpand: false
},
config:
{
optionsType: 0,
optionsFun: ""
},
name: "treeSelect1690850331372",
item:
{
label: "树形控件"
}
}],
tableData: [],
control:
{},
config:
{
addBtnText: "添加一行"
},
name: "flex1690850046691"
},
{
type: "textarea",
control:
{
modelValue: ""
},
config:
{},
name: "textarea1690850327911",
item:
{
label: "多行文本"
}
},
{
type: "cascader",
control:
{
modelValue: []
},
options: [
[]
],
config:
{
optionsType: 1,
optionsFun: "org/govthreeing",
method: "post",
label: "name",
value: "id",
transformData: "string"
},
name: "cascader1690850727709",
item:
{
label: "级联选择器"
}
},
{
type: "rate",
control:
{
modelValue: 0
},
config:
{},
name: "rate1690858082610",
item:
{
label: "评分"
}
},
{
type: "slider",
control:
{
modelValue: 0
},
config:
{},
name: "slider1690858085171",
item:
{
label: "滑块"
}
},
{
type: "checkbox",
control:
{
modelValue: []
},
options: [
{
label: "结果1",
value: "1"
},
{
label: "结果2",
value: "2"
},
{
label: "结果3",
value: "3"
}],
config:
{
optionsType: 0
},
name: "checkbox1690858133654",
item:
{
label: "多选框组"
}
},
{
type: "select",
control:
{
modelValue: "",
appendToBody: true
},
options: [],
config:
{
optionsType: 0
},
name: "select1690858188721",
item:
{
label: "下拉选择框"
}
},
{
type: "datePicker",
control:
{
modelValue: "",
type: "date"
},
config:
{},
name: "datePicker1690858198926",
item:
{
label: "日期选择器"
}
},
{
type: "timePicker",
control:
{
modelValue: ""
},
config:
{},
name: "timePicker1690858223852",
item:
{
label: "时间选择器"
}
},
{
type: "colorPicker",
control:
{
modelValue: ""
},
config:
{},
name: "colorPicker1690858227551",
item:
{
label: "取色器"
}
},
{
type: "switch",
control:
{
modelValue: false
},
config:
{},
name: "switch1690858231044",
item:
{
label: "开关"
}
},
{
type: "inputNumber",
control:
{
modelValue: 0
},
config:
{},
name: "inputNumber1690858235582",
item:
{
label: "计数器"
}
},
{
type: "cascader",
control:
{
modelValue: []
},
options: [],
config:
{
optionsType: 0
},
name: "cascader1690858239039",
item:
{
label: "级联选择器"
}
},
{
type: "slider",
control:
{
modelValue: 0
},
config:
{},
name: "slider1690858246408",
item:
{
label: "滑块"
}
},
{
type: "button",
control:
{
label: "保存"
},
config:
{}
},
{
type: "component",
control:
{
modelValue: ""
},
config:
{},
name: "component1690858760867",
item:
{
label: "自定义组件",
rules: []
},
customRules: [
{
type: "required",
message: "必填项1",
trigger: "blur"
},
{
type: "required",
message: "必填项2",
trigger: "blur"
}]
}],
form:
{
size: "default",
name: ""
},
config:
{}
}

134
api/shiyan/数据结构收集/下拉选这框.ts

@ -0,0 +1,134 @@
//基础
const select ={
list: [
{
type: "select",
control:
{
modelValue: "",
appendToBody: true
},
options: [],
config:
{
optionsType: 0
},
name: "select1690944007204",
item:
{
label: "下拉选择框"
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//固定选项
const selectGuDing = {
list: [
{
type: "select",
control:
{
modelValue: [],
appendToBody: true,
placeholder: "请选择您需要的内容",
multiple: true,
clearable: true,
disabled: true,
ziDingYi: "自定义字段"
},
options: [
{
label: "男",
value: "1"
},
{
label: "女",
value: "2"
},
{
label: "跨性别",
value: "3"
}],
config:
{
optionsType: 0,
addAll: "下拉选择内容",
className: "自定义Class",
help: "帮助信息",
span: 12,
editDisabled: true,
disabledAdd: true,
disabledEdit: true,
disabledDetail: true,
linkKey: true,
linkValue: "$.sssdf > 1",
linkResult: "disabled",
transformData: "number"
},
name: "select1690944007204",
item:
{
label: "下拉选择框",
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//使用数据源
const selectGuDingShujuyuan = {
list: [
{
type: "select",
control:
{
modelValue: "",
appendToBody: true
},
options: [],
config:
{
optionsType: 1,
optionsFun: "org/govthreeaboutman",
addAll: "选择全部",
label: "name",
value: "id",
transformData: "number"
},
name: "select1691568880802",
item:
{
label: "下拉选择框",
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}

61
api/shiyan/数据结构收集/分割线.ts

@ -0,0 +1,61 @@
let divideropt = {
list: [
{
type: "divider",
control:
{},
config:
{},
item:
{
label: "分割线"
}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}
let dividerAllopt = {
list: [
{
type: "divider",
control:
{
direction: "horizontal",
contentPosition: "center",
borderStyle: "solid"
},
config:
{
className: "自定义Class",
span: 24,
linkKey: true
},
item:
{
label: "分割线"
}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}

81
api/shiyan/数据结构收集/单行文本.ts

@ -0,0 +1,81 @@
const oneText = {
list: [
{
type: "input",
control:
{
modelValue: ""
},
config:
{},
name: "input1690861187851",
item:
{
label: "单行文本"
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//满配
const oneAllText = {
list: [
{
type: "input",
control:
{
modelValue: "",
placeholder: "占位1内容",
disabled: true
},
config:
{
className: "自定义class",
help: "帮助信息",
span: 12,
prepend: "文本前缀",
append: "文本后缀",
editDisabled: true,
disabledAdd: true,
disabledEdit: true,
disabledDetail: true,
linkKey: true,
linkValue: "$input1690861475666>1",
linkResult: "disabled"
},
name: "input1690861475666",
item:
{
label: "单行文本",
showLabel: true,
rules: [
{
name: false
}]
},
customRules: [
{
type: "required",
message: "必填项",
trigger: "blur"
},
{
type: "mobile",
message: "请输入手机号码",
trigger: "blur"
}]
}],
form:
{
size: "default",
name: ""
},
config:
{}
}

190
api/shiyan/数据结构收集/单选按钮.ts

@ -0,0 +1,190 @@
const radioSmaill = {
list: [
{
type: "radio",
control:
{
modelValue: ""
},
options: [],
config:
{
optionsType: 0
},
name: "radio1690867322720",
item:
{
label: "单选框组"
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//赋值
const radioValue = {
list: [
{
type: "radio",
control:
{
modelValue: ""
},
options: [
{
label: "男",
value: "1"
},
{
label: "女",
value: "2"
}],
config:
{
optionsType: 0,
transformData: "number",
className: "自定义Class",
help: "帮助信息",
span: 12
},
name: "radio1690867322720",
item:
{
label: "单选框组",
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//满配
const radioAll = {
list: [
{
type: "radio",
control:
{
modelValue: "",
disabled: true
},
options: [
{
label: "男",
value: "1"
},
{
label: "女",
value: "2"
}],
config:
{
optionsType: 0,
transformData: "number",
className: "自定义Class",
help: "帮助信息",
span: 12,
editDisabled: true,
disabledAdd: true,
disabledEdit: true,
disabledDetail: true,
linkKey: true,
linkResult: "disabled",
linkValue: "$.radio1690867322720 > 1"
},
name: "radio1690867322720",
item:
{
label: "单选框组",
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}],
showLabel: true
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//数据源
const radioData = {
list: [
{
type: "radio",
control:
{
modelValue: "",
disabled: true
},
options: [
{
label: "男",
value: "1"
},
{
label: "女",
value: "2"
}],
config:
{
optionsType: 1,
transformData: "none",
className: "自定义Class",
help: "帮助信息",
span: 12,
editDisabled: true,
disabledAdd: true,
disabledEdit: true,
disabledDetail: true,
linkKey: true,
linkResult: "disabled",
linkValue: "$.radio1690867322720 > 1",
optionsFun: "org/govthreeing",
label: "name",
value: "id"
},
name: "radio1690867322720",
item:
{
label: "单选框组",
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}],
showLabel: true
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}

659
api/shiyan/数据结构收集/卡片.ts

@ -0,0 +1,659 @@
let cardopt = {
list: [
{
type: "card",
list: [],
control:
{},
config:
{},
item:
{
label: "卡片布局"
}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}
let cardallopt = {
list: [
{
type: "card",
list: [],
control:
{},
config:
{
className: "自定义Class",
help: "帮助信息",
span: 24
},
item:
{
label: "卡片布局1"
}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}
//卡片聂荣
let cardsstatopt = {
list: [
{
type: "card",
list: [
{
type: "input",
control:
{
modelValue: ""
},
config:
{},
name: "input1692582254140",
item:
{
label: "单行文本"
}
},
{
type: "timePicker",
control:
{
modelValue: ""
},
config:
{},
name: "timePicker1692582259714",
item:
{
label: "时间选择器"
}
},
{
type: "textarea",
control:
{
modelValue: ""
},
config:
{},
name: "textarea1692582257011",
item:
{
label: "多行文本"
}
},
{
type: "treeSelect",
control:
{
modelValue: "",
data: [],
renderAfterExpand: false
},
config:
{
optionsType: 0
},
name: "treeSelect1692582282336",
item:
{
label: "树形控件"
}
}],
control:
{},
config:
{
className: "自定义Class",
help: "帮助信息",
span: 24
},
item:
{
label: "卡片布局1"
}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}

65
api/shiyan/数据结构收集/取色器.ts

@ -0,0 +1,65 @@
//基础版
const colseopt = {
list: [
{
type: "colorPicker",
control:
{
modelValue: ""
},
config:
{},
name: "colorPicker1691716670670",
item:
{
label: "取色器"
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//满配
const manPeiopt = {
list: [
{
type: "colorPicker",
control:
{
modelValue: "",
colorFormat: "rgb"
},
config:
{
className: "自定义Class",
help: "帮助信息",
span: 12,
linkKey: true,
linkValue: "$.index>1",
linkResult: "disabled"
},
name: "colorPicker1691716670670",
item:
{
label: "取色器",
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}

77
api/shiyan/数据结构收集/图片文件.ts

@ -0,0 +1,77 @@
//图片文件
let uploadopt = {
list: [
{
type: "upload",
control:
{
modelValue: ""
},
config:
{},
name: "upload1692580064168",
item:
{
label: "图片/文件"
}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}
//满配
let uploadAllopt = {
list: [
{
type: "upload",
control:
{
modelValue: "",
action: "org/govthreeaboutman",
listType: "picture-card",
name: "上传字段名"
},
config:
{
className: "自定义class",
help: "帮助信息",
span: 12,
tip: "提示文字",
btnText: "按钮文字 "
},
name: "upload1692580064168",
item:
{
label: "图片/文件",
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}

86
api/shiyan/数据结构收集/多行文本.ts

@ -0,0 +1,86 @@
const doubleText = {
list: [
{
type: "textarea",
control:
{
modelValue: "",
placeholder: "占位内容",
rows: 5,
disabled: true
},
config:
{
className: "class_name",
help: "帮助信息",
span: 12,
editDisabled: true,
disabledAdd: true,
disabledEdit: true,
disabledDetail: true,
linkKey: true,
linkValue: "$textarea1690861245769.>1",
linkResult: "disabled"
},
name: "textarea1690861245769",
item:
{
label: "多行文本",
showLabel: false,
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
const smaillDoubleText = {
list: [
{
type: "textarea",
control:
{
modelValue: "",
placeholder: "占位内容",
rows: 5,
disabled: false
},
config:
{
className: "class_name",
help: "帮助信息",
span: 12,
editDisabled: false,
disabledAdd: false,
disabledEdit: false,
disabledDetail: false,
linkKey: false,
linkValue: "$textarea1690861245769.>1",
linkResult: "disabled"
},
name: "textarea1690861245769",
item:
{
label: "多行文本",
showLabel: false,
rules: []
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}

114
api/shiyan/数据结构收集/多选按钮.ts

@ -0,0 +1,114 @@
//基础状态
const checkbox = {
list: [
{
type: "checkbox",
control:
{
modelValue: []
},
options: [],
config:
{
optionsType: 0
},
name: "checkbox1690867750313",
item:
{
label: "多选框组"
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//固定选项
const checkboxGDXX = {
list: [
{
type: "checkbox",
control:
{
modelValue: []
},
options: [
{
label: "男",
value: "1"
},
{
label: "女",
value: "2"
},
{
label: "跨性别",
value: "3"
}],
config:
{
optionsType: 0,
optionsFun: "",
className: "自定义Class",
help: "帮助信息",
span: 20
},
name: "checkbox1690867750313",
item:
{
label: "多选框组"
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//数据源
const checkboxOptData = {
list: [
{
type: "checkbox",
control:
{
modelValue: []
},
options: [],
config:
{
optionsType: 1,
optionsFun: "org/govthreeaboutman",
label: "name",
value: "id",
transformData: "number",
className: "自定义Class",
help: "帮助信息",
span: 12
},
name: "checkbox1690940822941",
item:
{
label: "多选框组",
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}

164
api/shiyan/数据结构收集/子表.ts

@ -0,0 +1,164 @@
//子表
let tableopt = {
list: [
{
type: "table",
list: [],
tableData: [],
control:
{
border: true
},
config:
{
addBtnText: "添加一行"
},
name: "table1692578653387"
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}
//满配
let Allopt = {
list: [
{
type: "table",
list: [
{
name: "index",
type: "index",
item:
{
label: "序号"
},
control:
{},
config:
{}
}],
tableData: [],
control:
{
border: true,
mySetUp: 123456
},
config:
{
addBtnText: "添加一行",
className: "自定义Class",
span: 12,
delBtnText: "删除一行",
editDisabled: true,
disabledAdd: true,
disabledEdit: true,
disabledDetail: true,
linkKey: true,
linkValue: "$index>1"
},
name: "table1692578653387"
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}
//添加表单
let addTableOpt = {
list: [
{
type: "table",
list: [
{
name: "index",
type: "index",
item:
{
label: "序号"
},
control:
{},
config:
{}
},
{
type: "input",
control:
{
modelValue: ""
},
config:
{},
name: "input1692579453797",
item:
{
label: "单行文本"
}
},
{
type: "input",
control:
{
modelValue: ""
},
config:
{},
name: "input1692579456835",
item:
{
label: "单行文本"
}
}],
tableData: [],
control:
{
border: true,
mySetUp: 123456
},
config:
{
addBtnText: "添加一行",
className: "自定义Class",
span: 12,
delBtnText: "删除一行",
editDisabled: true,
disabledAdd: true,
disabledEdit: true,
disabledDetail: true,
linkKey: true,
linkValue: "$index>1"
},
name: "table1692578653387"
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}

159
api/shiyan/数据结构收集/容器.ts

@ -0,0 +1,159 @@
let divopt = {
list: [
{
type: "div",
control:
{},
config:
{},
list: []
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}
//满配
let divAllopt = {
list: [
{
type: "div",
control:
{},
config:
{
className: "自定义Class",
textAlign: "right",
span: 24
},
list: []
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}
//配置组卷
let divGroupopt = {
list: [
{
type: "colorPicker",
control:
{
modelValue: ""
},
config:
{},
name: "colorPicker1692597441542",
item:
{
label: "取色器"
}
},
{
type: "timePicker",
control:
{
modelValue: ""
},
config:
{},
name: "timePicker1692597438680",
item:
{
label: "时间选择器"
}
},
{
type: "div",
control:
{},
config:
{
className: "自定义Class",
textAlign: "right",
span: 24
},
list: [
{
type: "radio",
control:
{
modelValue: ""
},
options: [],
config:
{
optionsType: 0
},
name: "radio1692597425964",
item:
{
label: "单选框组"
}
},
{
type: "select",
control:
{
modelValue: "",
appendToBody: true
},
options: [],
config:
{
optionsType: 0
},
name: "select1692597423918",
item:
{
label: "下拉选择框"
}
},
{
type: "rate",
control:
{
modelValue: 0
},
config:
{},
name: "rate1692597422208",
item:
{
label: "评分"
}
}]
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}

75
api/shiyan/数据结构收集/富文本.ts

@ -0,0 +1,75 @@
let tinymceopt = {
list: [
{
type: "tinymce",
control:
{
modelValue: ""
},
config:
{},
name: "tinymce1692580637828",
item:
{
label: "富文本"
}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}
let tinymcccckAllopt = {
list: [
{
type: "tinymce",
control:
{
modelValue: "",
placeholder: "占位内容",
height: "500",
width: "100",
imgUrl: "org/govthreeaboutman1",
blobUrl: "org/govthreeaboutman2"
},
config:
{
className: "自定义Class",
help: "帮助信息",
span: 12,
style: "label"
},
name: "tinymce1692580637828",
item:
{
label: "富文本1",
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}

65
api/shiyan/数据结构收集/开关.ts

@ -0,0 +1,65 @@
//基础配置
const switchopt = {
list: [
{
type: "switch",
control:
{
modelValue: false
},
config:
{},
name: "switch1691718873012",
item:
{
label: "开关"
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//满配
const switchAllopt = {
list: [
{
type: "switch",
control:
{
modelValue: false,
activeValue: "男",
inactiveValue: "女",
disabled: true
},
config:
{
className: "自定义Class",
help: "帮助信息",
span: 12,
editDisabled: true,
disabledAdd: true,
disabledEdit: true,
disabledDetail: true,
linkKey: true,
linkValue: "$.in>1",
linkResult: "disabled"
},
name: "switch1691718873012",
item:
{
label: "开关"
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}

106
api/shiyan/数据结构收集/弹性布局.ts

@ -0,0 +1,106 @@
//弹性布局
let flexopt = {
list: [
{
type: "flex",
list: [],
tableData: [],
control:
{},
config:
{
addBtnText: "添加一行"
},
name: "flex1692596274265"
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}
//添加元素
let flexAddopt = {
list: [
{
type: "flex",
list: [
{
type: "input",
control:
{
modelValue: ""
},
config:
{},
name: "input1692596410497",
item:
{
label: "单行文本"
}
},
{
type: "timePicker",
control:
{
modelValue: ""
},
config:
{},
name: "timePicker1692596417527",
item:
{
label: "时间选择器"
}
},
{
type: "datePicker",
control:
{
modelValue: "",
type: "date"
},
config:
{},
name: "datePicker1692596415114",
item:
{
label: "日期选择器"
}
}],
tableData: [],
control:
{},
config:
{
addBtnText: "添加一行",
className: "自定义Class",
span: 24,
delBtnText: "删除一行",
linkKey: false
},
name: "flex1692596274265"
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}

60
api/shiyan/数据结构收集/按钮.ts

@ -0,0 +1,60 @@
//按钮
const buttonopt = {
list: [
{
type: "button",
control:
{
label: "保存"
},
config:
{}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}
//满配按钮
let buttonAllopt = {
list: [
{
type: "button",
control:
{
label: "提交",
type: "warning",
key: "submit"
},
config:
{
className: "自定义样式",
span: 12,
textAlign: "center",
disabledAdd: true,
disabledDetail: true,
linkKey: true,
linkValue: "$.index>1 "
}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}

50
api/shiyan/数据结构收集/文字.ts

@ -0,0 +1,50 @@
//文字组件
const testopt = {
list: [
{
type: "txt",
control:
{
modelValue: ""
},
config:
{}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//加配文字
const textPulsopt = {
list: [
{
type: "txt",
control:
{
modelValue: "文字组件内容编辑框"
},
config:
{
className: "自定义class",
span: 12
}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}

86
api/shiyan/数据结构收集/日期选择器.ts

@ -0,0 +1,86 @@
//基础状态
const optJichu = {
list: [
{
type: "datePicker",
control:
{
modelValue: "",
type: "date",
placeholder: "请选择时间",
format: "YYYYMMDD"
},
config:
{
className: "自定义Class",
help: "帮助信息",
span: 12,
linkKey: false
},
name: "datePicker1691569007578",
item:
{
label: "日期选择器标题",
showLabel: false,
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//修改属性
const optXiugai = {
list: [
{
type: "datePicker",
control:
{
modelValue: "",
type: "date",
placeholder: "请选择时间",
format: "YYYYMMDD"
},
config:
{
className: "自定义Class",
help: "帮助信息",
span: 12,
linkKey: true,
disabledAdd: true,
disabledEdit: true,
disabledDetail: true,
linkValue: "$.datePicker1691569007578 < 1",
linkResult: "disabled"
},
name: "datePicker1691569007578",
item:
{
label: "日期选择器标题",
showLabel: true,
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}

74
api/shiyan/数据结构收集/时间选择器.ts

@ -0,0 +1,74 @@
//基础模式
const timeShiFen = {
list: [
{
type: "timePicker",
control:
{
modelValue: "",
placeholder: "占位内容",
format: "H:m"
},
config:
{
className: "自定义Class",
help: "帮助信息",
span: 12
},
name: "timePicker1691627090604",
item:
{
label: "时间选择器1"
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//高配版
const opt = {
list: [
{
type: "timePicker",
control:
{
modelValue: "",
placeholder: "占位内容",
format: "H:m"
},
config:
{
className: "自定义Class",
help: "帮助信息",
span: 12,
disabledAdd: true,
disabledEdit: true,
disabledDetail: true,
linkKey: true,
linkValue: "$.index>1",
linkResult: "disabled"
},
name: "timePicker1691627090604",
item:
{
label: "时间选择器1",
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}

78
api/shiyan/数据结构收集/栅格.ts

@ -0,0 +1,78 @@
let gridopt = {
list: [
{
type: "grid",
columns: [
{
attr:
{
span: 12
},
list: []
},
{
attr:
{
span: 12
},
list: []
}],
control:
{},
config:
{}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}
let gridAddopt = {
list: [
{
type: "grid",
columns: [
{
attr:
{
span: 12
},
list: []
},
{
attr:
{
span: 12
},
list: []
}],
control:
{},
config:
{
className: "自定义Class",
span: 16
}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}

206
api/shiyan/数据结构收集/标签页.ts

@ -0,0 +1,206 @@
let tabsopt = {
list: [
{
type: "tabs",
columns: [
{
label: "Tab1",
list: []
}],
control:
{},
config:
{}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}
let tabsEmptyopt = {
list: [
{
type: "tabs",
columns: [
{
label: "Tab1",
list: []
},
{
label: "标签名称1",
list: []
},
{
label: "标签名称2",
list: []
},
{
label: "标签名称3",
list: []
}],
control:
{},
config:
{
className: "自定义Class",
span: 24,
linkKey: false
}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}
//标签页有内容
let tabsContopt = {
list: [
{
type: "tabs",
columns: [
{
label: "Tab1",
list: [
{
type: "input",
control:
{
modelValue: ""
},
config:
{},
name: "input1692581910388",
item:
{
label: "单行文本"
}
}]
},
{
label: "标签名称1",
list: []
},
{
label: "标签名称2",
list: [
{
type: "input",
control:
{
modelValue: ""
},
config:
{},
name: "input1692581940524",
item:
{
label: "单行文本"
}
},
{
type: "input",
control:
{
modelValue: ""
},
config:
{},
name: "input1692581942508",
item:
{
label: "单行文本"
}
},
{
type: "input",
control:
{
modelValue: ""
},
config:
{},
name: "input1692581945189",
item:
{
label: "单行文本"
}
}]
},
{
label: "标签名称3",
list: [
{
type: "radio",
control:
{
modelValue: ""
},
options: [],
config:
{
optionsType: 0
},
name: "radio1692581949000",
item:
{
label: "单选框组"
}
},
{
type: "checkbox",
control:
{
modelValue: []
},
options: [],
config:
{
optionsType: 0
},
name: "checkbox1692581950900",
item:
{
label: "多选框组"
}
}]
}],
control:
{},
config:
{
className: "自定义Class",
span: 24,
linkKey: false
}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}

59
api/shiyan/数据结构收集/标题.ts

@ -0,0 +1,59 @@
//标题
const titleopt = {
list: [
{
type: "title",
control:
{
modelValue: "标题"
},
config:
{}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}
//满配标题
const titlePulssssopt = {
list: [
{
type: "title",
control:
{
modelValue: "标题1111111"
},
config:
{
className: "自定义Class",
help: "帮助信息",
span: 12,
disabledAdd: true,
disabledEdit: true,
disabledDetail: true,
linkKey: true,
linkValue: "$.intex > 1"
}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}

98
api/shiyan/数据结构收集/树形控件.ts

@ -0,0 +1,98 @@
//基础
const treeSelectopt = {
list: [
{
type: "treeSelect",
control:
{
modelValue: "",
data: [],
renderAfterExpand: false
},
config:
{
optionsType: 0
},
name: "treeSelect1691736048146",
item:
{
label: "树形控件"
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//数据源
const treeDatyaopt = {
list: [
{
type: "treeSelect",
control:
{
modelValue: [],
data: [],
renderAfterExpand: false,
placeholder: "暂未内容",
multiple: true,
disabled: true
},
config:
{
optionsType: 1,
className: "自定义Class",
help: "帮助信息",
span: 12,
editDisabled: true,
disabledAdd: true,
disabledEdit: true,
disabledDetail: true,
linkKey: true,
linkValue: "$.index>1",
linkResult: "hidden",
optionsFun: "org/govthreeaboutman",
label: "name",
value: "id",
beforeRequest: (data, route) =>
{
// data经过处理后返回
console.log('beforeRequest', data)
return data
},
afterResponse: (res) =>
{
// res返回数据
console.log('afterResponse', res)
return res
},
transformData: "number"
},
name: "treeSelect1691740231369",
item:
{
label: "树形控件",
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}

76
api/shiyan/数据结构收集/格栅布局.ts

@ -0,0 +1,76 @@
const grid = {
list: [
{
type: "grid",
columns: [
{
attr:
{
span: 12
},
list: []
},
{
attr:
{
span: 12
},
list: []
},
{
list: [],
attr:
{
span: 12
}
},
{
list: [],
attr:
{
span: 12
},
type: "gridChild"
},
{
list: [],
attr:
{
span: 12
}
},
{
list: [],
attr:
{
span: 12
},
type: "gridChild"
},
{
list: [],
attr:
{
span: 12
}
},
{
list: [],
attr:
{
span: 12
}
}],
control:
{},
config:
{}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}

69
api/shiyan/数据结构收集/滑块.ts

@ -0,0 +1,69 @@
//基础
const slideropt = {
list: [
{
type: "slider",
control:
{
modelValue: 0
},
config:
{},
name: "slider1691734730906",
item:
{
label: "滑块"
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//配置项
const sliderSetopt = {
list: [
{
type: "slider",
control:
{
modelValue: 0,
min: 1,
max: 100,
step: 2
},
config:
{
className: "自定义Class",
help: "帮助信息",
span: 12,
disabledAdd: true,
disabledEdit: true,
disabledDetail: true,
linkKey: true,
linkValue: "$.index>1",
linkResult: "hidden"
},
name: "slider1691734730906",
item:
{
label: "滑块",
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}

163
api/shiyan/数据结构收集/级联选择器.ts

@ -0,0 +1,163 @@
//基础
const casecaderopt = {
list: [
{
type: "cascader",
control:
{
modelValue: []
},
options: [],
config:
{
optionsType: 1,
optionsFun: "",
method: "post"
},
name: "cascader1691719736761",
item:
{
label: "级联选择器"
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//数据源
const cascaderDataopt = {
list: [
{
type: "cascader",
control:
{
modelValue: [],
disabled: true
},
options: [],
config:
{
optionsType: 1,
optionsFun: "org/govthreeaboutman",
method: "post",
className: "自定义Class",
help: "帮助信息",
span: 12,
editDisabled: true,
disabledAdd: true,
disabledEdit: true,
disabledDetail: true,
linkKey: true,
linkValue: "$.index>1",
linkResult: "hidden",
label: "name",
value: "id",
transformData: "number",
beforeRequest: (data, route) =>
{
// data经过处理后返回
console.log('beforeRequest1212121', data)
return data
},
afterResponse: (res) =>
{
// res返回数据
console.log('afterResponse饭否和', res)
return res
}
},
name: "cascader1691719736761",
item:
{
label: "级联选择器",
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//固定选项
const cascaderGuDingopt = {
list: [
{
type: "cascader",
control:
{
modelValue: [],
disabled: true
},
options: [
{
label: "男",
value: 1
},
{
label: "女",
value: 2
}],
config:
{
optionsType: 0,
optionsFun: "",
method: "post",
className: "自定义Class",
help: "帮助信息",
span: 12,
editDisabled: true,
disabledAdd: true,
disabledEdit: true,
disabledDetail: true,
linkKey: true,
linkValue: "$.index>1",
linkResult: "hidden",
label: "name",
value: "id",
transformData: "number",
beforeRequest: (data, route) =>
{
// data经过处理后返回
console.log('beforeRequest1212121', data)
return data
},
afterResponse: (res) =>
{
// res返回数据
console.log('afterResponse饭否和', res)
return res
}
},
name: "cascader1691719736761",
item:
{
label: "级联选择器",
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}

66
api/shiyan/数据结构收集/计数器.ts

@ -0,0 +1,66 @@
//计算器
const inputNumberopt = {
list: [
{
type: "inputNumber",
control:
{
modelValue: 0
},
config:
{},
name: "inputNumber1691719538953",
item:
{
label: "计数器"
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//全陪
const AllNumberopt = {
list: [
{
type: "inputNumber",
control:
{
modelValue: 0
},
config:
{
className: "自定义Class",
help: "帮助信息",
span: 12,
disabledAdd: true,
disabledEdit: true,
disabledDetail: true,
linkKey: true,
linkValue: "$.index>1",
linkResult: "disabled"
},
name: "inputNumber1691719538953",
item:
{
label: "计数器",
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}

68
api/shiyan/数据结构收集/评分.ts

@ -0,0 +1,68 @@
//基础
const rateopt = {
list: [
{
type: "rate",
control:
{
modelValue: 0
},
config:
{},
name: "rate1691734301601",
item:
{
label: "评分"
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}
//配置版
const rateoptDatopt = {
list: [
{
type: "rate",
control:
{
modelValue: 0,
disabled: true,
max: 10
},
config:
{
className: "自定义Class",
help: "帮助细腻些",
span: 12,
disabledAdd: true,
disabledEdit: true,
disabledDetail: true,
linkKey: true,
linkValue: "$.index>1",
linkResult: "disabled"
},
name: "rate1691734301601",
item:
{
label: "评分",
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: ""
},
config:
{}
}

69
api/shiyan/数据结构收集/选择用户.ts

@ -0,0 +1,69 @@
let expanduseropt = {
list: [
{
type: "expand-user",
control:
{
modelValue: ""
},
config:
{},
name: "expand-user1692597622203",
item:
{
label: "选择用户"
}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}
let expandUserAllopt = {
list: [
{
type: "expand-user",
control:
{
modelValue: ""
},
config:
{
className: "自定义Class",
help: "帮助信息",
span: 24
},
name: "expand-user1692597622203",
item:
{
label: "选择用户",
rules: [
{
required: true,
message: "必填项",
trigger: "change"
}]
}
}],
form:
{
size: "default",
name: "eeee",
labelWidth: "180px",
class: "form-row-3",
showColon: true
},
config:
{
addLoad: true
}
}

4
api/version1/entry.go

@ -1,10 +1,12 @@
package version1
import (
"appPlatform/api/version1/customerform"
"appPlatform/api/version1/dict"
"appPlatform/api/version1/grantpowers"
matrixapi "appPlatform/api/version1/matrixApi"
"appPlatform/api/version1/menus"
"appPlatform/api/version1/publicapi"
"appPlatform/api/version1/user"
)
@ -14,6 +16,8 @@ type ApiEntry struct {
DictApi dict.ApiMethod //字典
GranSystemPowerApi grantpowers.ApiMethod //系统授权
MatrixApi matrixapi.ApiMethod //权限矩阵
PublicApi publicapi.ApiMethod //公共方法
CustomerFormApi customerform.ApiMethod //自定表单
}
var AppApiEntry = new(ApiEntry)

563
api/version1/matrixApi/api.go

@ -5,6 +5,9 @@ import (
"appPlatform/models/modelshr"
"appPlatform/overall"
"appPlatform/overall/publicmethod"
"sort"
"strconv"
"time"
"github.com/gin-gonic/gin"
)
@ -33,10 +36,10 @@ func (a *ApiMethod) MatrixList(c *gin.Context) {
requestData.Page = 1
}
if requestData.PageSize == 0 {
requestData.PageSize = 15
requestData.PageSize = 10
}
var matrixInfoList []modelAppPlatform.MatrixContent
gormDb := overall.CONSTANT_DB_AppPlatform.Where("`state` = 1")
gormDb := overall.CONSTANT_DB_AppPlatform.Model(&modelAppPlatform.MatrixContent{}).Where("`state` = 1")
if requestData.KeyWords != "" {
gormDb = gormDb.Where("`name` like ?", "%"+requestData.KeyWords+"%")
}
@ -73,3 +76,559 @@ func (a *ApiMethod) MatrixList(c *gin.Context) {
}
publicmethod.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(sendList)), sendList, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-07-04 16:35:46
@ 功能: 添加权限矩阵
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) AddMatrixCont(c *gin.Context) {
var requestData AddMatrixCont
err := c.ShouldBindJSON(&requestData)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if requestData.Name == "" {
publicmethod.Result(1, requestData.Name, c, "请输入矩阵名称!")
return
}
if requestData.Org == 0 {
publicmethod.Result(1, requestData.Name, c, "请选择归属行政组织!")
return
}
var isd int64
gormDb := overall.CONSTANT_DB_AppPlatform.Model(&modelAppPlatform.MatrixContent{}).Select("Count(`id`)").Where("`name` = ?", requestData.Name)
var sunOrg publicmethod.GetOrgAllParent
sunOrg.GetOrgSonAllId(requestData.Org)
sunOrg.Id = append(sunOrg.Id, requestData.Org)
gormDb = gormDb.Where("`org` IN ?", sunOrg.Id)
err = gormDb.Find(&isd).Error
if err == nil && isd > 0 {
publicmethod.Result(1, isd, c, "该矩阵已经存在!请不要重复使用!")
return
}
var matrixCont modelAppPlatform.MatrixContent
matrixCont.Name = requestData.Name //名称"`
matrixCont.Center = requestData.Center //描述"`
matrixCont.Org = requestData.Org //归属行政组织"`
matrixCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
matrixCont.Time = time.Now().Unix() //创建时间"`
err = overall.CONSTANT_DB_AppPlatform.Create(&matrixCont).Error
if err != nil {
publicmethod.Result(104, err, c)
return
}
publicmethod.Result(0, err, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-07-05 07:46:56
@ 功能: 编辑权限矩阵
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) EditMatrixCont(c *gin.Context) {
var requestData EditMatrixCont
c.ShouldBindJSON(&requestData)
if requestData.Id == 0 {
publicmethod.Result(1, requestData.Name, c, "未知矩阵!")
return
}
where := publicmethod.MapOut[string]()
where["`id`"] = requestData.Id
var matrixInfo modelAppPlatform.MatrixContent
err := matrixInfo.GetCont(where)
if err != nil {
publicmethod.Result(107, err, c)
return
}
editInfo := publicmethod.MapOut[string]()
if requestData.Name != "" && requestData.Name != matrixInfo.Name {
var isd int64
gormDb := overall.CONSTANT_DB_AppPlatform.Model(&modelAppPlatform.MatrixContent{}).Select("Count(`id`)").Where("`name` = ?", requestData.Name)
var sunOrg publicmethod.GetOrgAllParent
sunOrg.GetOrgSonAllId(requestData.Org)
sunOrg.Id = append(sunOrg.Id, requestData.Org)
gormDb = gormDb.Where("`org` IN ?", sunOrg.Id)
err = gormDb.Find(&isd).Error
if err == nil && isd > 0 {
publicmethod.Result(1, requestData.Name, c, "该矩阵已经存在!请不要重复使用!")
return
} else {
editInfo["`name`"] = requestData.Name
}
}
if requestData.Center != "" && requestData.Center != matrixInfo.Center {
editInfo["`center`"] = requestData.Center
}
if requestData.Org != 0 && requestData.Org != matrixInfo.Org {
editInfo["`org`"] = requestData.Org
}
if len(editInfo) > 0 {
editInfo["`time`"] = time.Now().Unix()
err = matrixInfo.EiteCont(where, editInfo)
if err != nil {
publicmethod.Result(106, err, c)
return
}
}
publicmethod.Result(0, err, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-07-05 08:49:44
@ 功能: 编辑矩阵状态
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) EditStatusCont(c *gin.Context) {
var requestData EditState
err := c.ShouldBindJSON(&requestData)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if len(requestData.Id) < 1 {
publicmethod.Result(1, requestData.Id, c, "未知矩阵!")
return
}
if requestData.Status != 3 {
saveData := publicmethod.MapOut[string]()
saveData["state"] = requestData.Status
saveData["time"] = time.Now().Unix()
err = overall.CONSTANT_DB_AppPlatform.Model(&modelAppPlatform.MatrixContent{}).Where("`id` IN ?", requestData.Id).Updates(saveData).Error
if err != nil {
publicmethod.Result(106, err, c)
return
}
} else { //判断是否强制删除
if requestData.IsTrue {
overall.CONSTANT_DB_AppPlatform.Where("`id` IN ?", requestData.Id).Delete(&modelAppPlatform.MatrixContent{})
overall.CONSTANT_DB_AppPlatform.Where("`mc_id` IN ?", requestData.Id).Delete(&modelAppPlatform.MatrixFrame{})
overall.CONSTANT_DB_AppPlatform.Where("`mc_id` IN ?", requestData.Id).Delete(&modelAppPlatform.MatrixHandler{})
} else {
saveData := publicmethod.MapOut[string]()
saveData["state"] = requestData.Status
saveData["time"] = time.Now().Unix()
err = overall.CONSTANT_DB_AppPlatform.Model(&modelAppPlatform.MatrixContent{}).Where("`id` IN ?", requestData.Id).Updates(saveData).Error
if err != nil {
publicmethod.Result(106, err, c)
return
}
}
}
publicmethod.Result(0, err, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-07-06 10:31:04
@ 功能: 设置矩阵字段
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) SetupMatrixField(c *gin.Context) {
var requestData HaveMatrixField
err := c.ShouldBindJSON(&requestData)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if requestData.Id == 0 {
publicmethod.Result(1, err, c, "未知矩阵!请检查提交数据")
return
}
if len(requestData.Factor) < 1 {
publicmethod.Result(1, err, c, "未知矩阵条件字段!请检查提交数据")
return
}
if len(requestData.Outcome) < 1 {
publicmethod.Result(1, err, c, "未知矩阵取值字段!请检查提交数据")
return
}
for _, v := range requestData.Factor {
AddOrEditMatrixField(requestData.Id, v)
}
for _, s := range requestData.Outcome {
AddOrEditMatrixField(requestData.Id, s)
}
publicmethod.Result(0, requestData, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-07-06 10:48:33
@ 功能: 新增或编辑权限矩阵基础字段
@ 参数
#matrixId 矩阵Id
#cont 矩阵内容
@ 返回值
#
@ 方法原型
#
*/
func AddOrEditMatrixField(matrixId int64, cont MatrixField) (err error) {
var matrixFramCont modelAppPlatform.MatrixFrame
err = matrixFramCont.GetCont(map[string]interface{}{"`mc_id`": matrixId, "`pinyin`": cont.PinYin})
if err != nil {
var newCont modelAppPlatform.MatrixFrame
newCont.Name = cont.Name //名称"`
newCont.Types = cont.Types //骨架类型(1:人力资源;2:行政组织;2:分部;)"`
newCont.Condition = cont.Condition //骨架取值类型(1:作为条件使用;2:作为取值使用)"`
newCont.State = 1 //状态(1:启用;2:禁用;3:删除)"`
newCont.McId = matrixId //矩阵ID"`
newCont.Time = time.Now().Unix() //创建时间"`
newCont.PinYin = cont.PinYin //拼音(标识使用)"`
err = overall.CONSTANT_DB_AppPlatform.Create(&newCont).Error
} else {
if matrixFramCont.Name != cont.Name {
var editCont modelAppPlatform.MatrixFrame
err = editCont.EiteCont(map[string]interface{}{"`id`": matrixFramCont.Id}, map[string]interface{}{"`name`": cont.Name, "`time`": time.Now().Unix()})
}
}
return
}
/*
*
@ 作者: 秦东
@ 时间: 2023-07-06 13:10:35
@ 功能: 获取矩阵字段
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) GetMatrixField(c *gin.Context) {
var requestData publicmethod.CommonId[int64]
err := c.ShouldBindJSON(&requestData)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if requestData.Id == 0 {
publicmethod.Result(1, err, c, "未知矩阵!请检查提交数据")
return
}
var contList []modelAppPlatform.MatrixFrame
err = overall.CONSTANT_DB_AppPlatform.Where("`state` = 1 AND `mc_id` = ?", requestData.Id).Find(&contList).Error
if err != nil {
publicmethod.Result(107, err, c)
return
}
var sendData HaveMatrixField
sendData.Id = requestData.Id
for _, v := range contList {
var contInfo MatrixField
contInfo.Id = v.Id
contInfo.Name = v.Name
contInfo.Types = v.Types //骨架类型(1:人力资源;2:行政组织;2:分部;)
contInfo.Condition = v.Condition //骨架取值类型(1:作为条件使用;2:作为取值使用)
contInfo.PinYin = v.PinYin
contInfo.IsEdit = false //是否可更改
contInfo.PyEdit = true //
if v.Condition == 1 {
sendData.Factor = append(sendData.Factor, contInfo)
} else {
sendData.Outcome = append(sendData.Outcome, contInfo)
}
}
publicmethod.Result(0, sendData, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-07-10 11:07:41
@ 功能:
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) SubmitMatrixData(c *gin.Context) {
var requestData []ReceiveMartix
c.ShouldBindJSON(&requestData)
if len(requestData) < 1 {
publicmethod.Result(1, requestData, c, "未知矩阵!请检查提交数据")
return
}
var matrixMainId int64 = 0
var matrixContList []modelAppPlatform.MatrixHandler
for _, v := range requestData {
if len(v.UserList) > 0 {
numberInt, _ := strconv.ParseInt(v.Number, 10, 64)
matrixMainId = v.McId
for _, w := range v.UserList {
var matrixCont modelAppPlatform.MatrixHandler
matrixCont.Number = numberInt //:批号"`
matrixCont.Name = w.Name //使用者名称"`
handIdInt, _ := strconv.ParseInt(w.Id, 10, 64)
matrixCont.HandId = handIdInt //使用者标识符"`
matrixCont.Types = v.Types //骨架类型(1:人力资源;2:行政组织;2:分部;)"`
matrixCont.McId = v.McId //矩阵ID"`
matrixCont.MhId = v.MhId //骨架ID"`
matrixCont.Time = time.Now().Unix() //创建时间"`
matrixContList = append(matrixContList, matrixCont)
}
}
}
if len(matrixContList) < 1 {
publicmethod.Result(1, requestData, c, "未知矩阵!请检查提交数据")
return
}
if matrixMainId != 0 {
var delMatrix modelAppPlatform.MatrixHandler
err := delMatrix.DelCont(map[string]interface{}{"`mc_id`": matrixMainId})
if err == nil {
overall.CONSTANT_DB_AppPlatform.Create(&matrixContList)
}
} else {
overall.CONSTANT_DB_AppPlatform.Create(&matrixContList)
}
publicmethod.Result(0, matrixContList, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-07-10 14:10:15
@ 功能: 获取矩阵取值
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) GainMatrixData(c *gin.Context) {
var requestData publicmethod.CommonId[int64]
err := c.ShouldBindJSON(&requestData)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if requestData.Id == 0 {
publicmethod.Result(1, err, c, "未知矩阵!请检查提交数据")
return
}
var matrixNumber []int64
err = overall.CONSTANT_DB_AppPlatform.Model(&modelAppPlatform.MatrixHandler{}).Distinct("`number`").Where("`mc_id` = ?", requestData.Id).Find(&matrixNumber).Error
if err != nil || len(matrixNumber) < 1 {
publicmethod.Result(107, err, c)
return
}
var matrixFramList []modelAppPlatform.MatrixFrame
err = overall.CONSTANT_DB_AppPlatform.Where("`state` = 1 AND `mc_id` = ?", requestData.Id).Find(&matrixFramList).Error
if err != nil || len(matrixFramList) < 1 {
publicmethod.Result(107, err, c)
return
}
matrixDataList := make([]interface{}, 0)
for _, v := range matrixNumber {
matrixHang := publicmethod.MapOut[string]()
for _, w := range matrixFramList {
//
var sendCont SendMatrixFieldVal
sendCont.Id = w.Id
sendCont.Types = w.Types
sendCont.IsEdit = false
sendCont.PinYin = w.PinYin
var handCont []modelAppPlatform.MatrixHandler
overall.CONSTANT_DB_AppPlatform.Where("`mc_id` = ? AND `mh_id` = ? AND `number` = ?", requestData.Id, w.Id, v).Find(&handCont)
if len(handCont) > 0 {
for _, j := range handCont {
sendCont.Number = strconv.FormatInt(j.Number, 10)
var userCont UserListCont
userCont.Id = strconv.FormatInt(j.HandId, 10)
if j.Types == 1 {
var orgCont modelshr.AdministrativeOrganization
orgCont.GetCont(map[string]interface{}{"`id`": j.HandId}, "`name`")
userCont.Name = orgCont.Name
} else {
var userContIng modelshr.PersonArchives
userContIng.GetCont(map[string]interface{}{"`key`": j.HandId}, "`name`", "`icon`", "`icon_photo`")
userCont.Name = userContIng.Name
userCont.Icons = userContIng.Icon
if userContIng.Icon == "" {
userCont.Icons = userContIng.IconPhoto
}
}
sendCont.UserList = append(sendCont.UserList, userCont)
}
}
matrixHang[sendCont.PinYin] = sendCont
}
// fmt.Printf("%v\n", matrixHang)
matrixDataList = append(matrixDataList, matrixHang)
}
publicmethod.Result(0, matrixDataList, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-07-11 08:28:27
@ 功能: 矩阵取值
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) MatrixValue(c *gin.Context) {
// requestData := publicmethod.MapOut[string]()
var requestData OneMatrixVal
err := c.ShouldBindJSON(&requestData)
var matrixContNumber []int64
gormDb := overall.CONSTANT_DB_AppPlatform.Model(&modelAppPlatform.MatrixHandler{}).Select("`number`")
for _, v := range requestData.Condition {
gormDb = gormDb.Or("`hand_id` = ? AND `mh_id` = ? AND `mc_id` = ?", v.Val, v.Id, requestData.Id)
}
err = gormDb.Find(&matrixContNumber).Error
wligibleMap := make(map[int64]int)
for _, v := range matrixContNumber {
if _, isOk := wligibleMap[v]; isOk {
wligibleMap[v]++
} else {
wligibleMap[v] = 1
}
}
var sicleEligible []Condition[int64]
for k, v := range wligibleMap {
var sicleCont Condition[int64]
sicleCont.Id = k
sicleCont.Val = int64(v)
sicleEligible = append(sicleEligible, sicleCont)
}
sort.Slice(sicleEligible, func(i, j int) bool {
return sicleEligible[i].Val < sicleEligible[j].Val
})
conditionCount := sicleEligible[len(sicleEligible)-1]
conditionLength := len(requestData.Condition)
if conditionCount.Val != int64(conditionLength) {
publicmethod.Result(0, err, c)
return
}
//获取最终结果
var finalResult []modelAppPlatform.MatrixHandler
err = overall.CONSTANT_DB_AppPlatform.Where("`number` = ? AND `mc_id` = ? AND `mh_id` IN ?", conditionCount.Id, requestData.Id, requestData.ValueField).Find(&finalResult).Error
if err != nil || len(finalResult) < 1 {
publicmethod.Result(1, finalResult, c, "没有操作人")
}
var sendList []SendMatrixVal
for _, v := range finalResult {
var sendCont SendMatrixVal
sendCont.Id = strconv.FormatInt(v.HandId, 10)
if v.Types == 1 {
var orgCont modelshr.AdministrativeOrganization
orgCont.GetCont(map[string]interface{}{"`id`": v.HandId}, "`name`", "`number`", "`superior`", "`wechat_organization_id`")
sendCont.Number = orgCont.Number
sendCont.Name = orgCont.Name
sendCont.WechatId = strconv.FormatInt(orgCont.WechatOrganizationId, 10) //微信相关参数
sendCont.Icon = "" //人物头像
sendCont.OrgId = strconv.FormatInt(orgCont.Superior, 10) //人员行政组织或行政组织上级
} else {
var userCont modelshr.PersonArchives
userCont.GetCont(map[string]interface{}{"`key`": v.HandId}, "`number`", "`name`", "`icon`", "`icon_photo`", "`wechat`", "`work_wechat`", "`admin_org`")
sendCont.Number = userCont.Number
sendCont.Name = userCont.Name
sendCont.WechatId = userCont.Wechat //微信相关参数
if userCont.WorkWechat != "" {
sendCont.WechatId = userCont.WorkWechat
}
sendCont.Icon = userCont.Icon
if userCont.IconPhoto != "" {
sendCont.Icon = userCont.IconPhoto
} //人物头像
sendCont.OrgId = strconv.FormatInt(userCont.AdminOrg, 10) //人员行政组织或行政组织上级
}
sendList = append(sendList, sendCont)
}
sendData := publicmethod.MapOut[string]()
sendData["err"] = err
sendData["requestData"] = requestData
sendData["matrixContList"] = matrixContNumber
sendData["wligibleMap"] = wligibleMap
sendData["sicleEligible"] = sicleEligible[len(sicleEligible)-1]
sendData["finalResult"] = finalResult
publicmethod.Result(0, sendList, c)
}

85
api/version1/matrixApi/type.go

@ -24,7 +24,7 @@ type SearchMatrix struct {
// 输出权限矩阵列表
type SendMatrix struct {
Id int `json:"id"`
Id int64 `json:"id"`
Name string `json:"name"`
Center string `json:"center"`
Org int64 `json:"org"`
@ -32,3 +32,86 @@ type SendMatrix struct {
State int `json:"status"`
Time int64 `json:"time"`
}
// 编辑权限矩阵内容
type AddMatrixCont struct {
Name string `json:"name"`
Center string `json:"center"`
Org int64 `json:"org"`
}
// 修改矩阵内容
type EditMatrixCont struct {
publicmethod.CommonId[int64]
AddMatrixCont
}
// 修改状态
type EditState struct {
Id []string `json:"id"`
Status int `json:"status"`
IsTrue bool `json:"istrue"`
}
// 矩阵字段数据
type MatrixField struct {
publicmethod.CommonId[int64]
publicmethod.PublicName
Types int `json:"types"` //骨架类型(1:人力资源;2:行政组织;2:分部;)
Condition int `json:"condition"` //骨架取值类型(1:作为条件使用;2:作为取值使用)
PinYin string `json:"pinyin"`
IsEdit bool `json:"isedit"` //是否可更改
PyEdit bool `json:"pyedit"` //是否可更改
}
// 提交矩阵字段数据
type HaveMatrixField struct {
publicmethod.CommonId[int64]
Factor []MatrixField `json:"factor"`
Outcome []MatrixField `json:"outcome"`
}
// 接收矩阵字段取值
type ReceiveMartix struct {
publicmethod.CommonId[int64]
McId int64 `json:"mcid"`
MhId int64 `json:"mhid"`
Number string `json:"number"`
Types int `json:"types"`
UserList []UserListCont `json:"userlist"`
}
type UserListCont struct {
publicmethod.CommonId[string]
publicmethod.PublicName
Icons string `json:"icon"`
}
// 输出矩阵字段值
type SendMatrixFieldVal struct {
publicmethod.CommonId[int64]
Number string `json:"number"`
Types int `json:"types"`
IsEdit bool `json:"isedit"`
PinYin string `json:"pinyin"`
UserList []UserListCont `json:"userlist"`
}
type OneMatrixVal struct {
publicmethod.CommonId[int64]
ValueField []int64 `json:"valuefield"`
Condition []Condition[string] `json:"condition"`
}
type Condition[T publicmethod.GenericityVariable] struct {
publicmethod.CommonId[T]
Val T `json:"val"`
}
// 输出矩阵判断值
type SendMatrixVal struct {
publicmethod.CommonId[string] //人员识别符或行政组织ID
Number string `json:"number"` //编号
publicmethod.PublicName //名称
WechatId string `json:"wechatid"` //微信相关参数
Icon string `json:"icon"` //人物头像
OrgId string `json:"orgid"` //人员行政组织或行政组织上级
}

149
api/version1/publicapi/api.go

@ -0,0 +1,149 @@
package publicapi
import (
"appPlatform/middleware/grocerystore"
"appPlatform/overall"
"appPlatform/overall/publicmethod"
"fmt"
"strconv"
"strings"
"unicode"
"github.com/gin-gonic/gin"
)
/*
*
@ 作者: 秦东
@ 时间: 2023-07-05 11:41:12
@ 功能:获取汉字首字母
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) ChineseInitial(c *gin.Context) {
var requestData publicmethod.PublicName
err := c.ShouldBindJSON(&requestData)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if requestData.Name == "" {
publicmethod.Result(1, requestData.Name, c, "请输入关键字!")
return
}
var wordStr string
for _, v := range requestData.Name {
if unicode.Is(unicode.Han, v) {
firstWord := publicmethod.ChineseFirstWordCapitalize(fmt.Sprintf("%c", v))
smallWord := strings.ToLower(firstWord)
// fmt.Printf("sddff--->%v----------->%v\n", firstWord, smallWord)
wordStr = fmt.Sprintf("%v%v", wordStr, smallWord)
} else {
wordStr = fmt.Sprintf("%v%c", wordStr, v)
}
}
// fmt.Printf("请输入关键字!----->%v\n", wordStr)
// firstWord := publicmethod.ChineseFirstWordCapitalize(requestData.Name)
// smallWord := strings.ToLower(firstWord)
var keyField string
jbq := 0
for _, kj := range wordStr {
if jbq < 1 {
if !unicode.IsNumber(kj) {
jbq++
}
}
if jbq > 0 {
keyField = fmt.Sprintf("%v%c", keyField, kj)
}
}
publicmethod.Result(0, keyField, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-07-07 09:27:19
@ 功能: 输出编号
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) SendNumber(c *gin.Context) {
var requestData publicmethod.CommonId[int64]
err := c.ShouldBindJSON(&requestData)
if err != nil {
requestData.Id = 9
}
if requestData.Id == 0 {
requestData.Id = 9
}
uuid := publicmethod.GetUUid(requestData.Id)
var sendCont SendUUID
sendCont.UuId = uuid
sendCont.UuIdString = strconv.FormatInt(uuid, 10)
publicmethod.Result(0, sendCont, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-07-20 11:41:00
@ 功能: 生成身份验证唯一识别符
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) GenerateSignCode(c *gin.Context) {
userKey := c.Request.Header.Get("user-key")
userToken := c.Request.Header.Get("user-token")
if userKey == "" || userToken == "" {
publicmethod.Result(1, userKey, c, "验证失败!未知识别符!")
return
}
uuid := publicmethod.GetUUid(6)
uuidStr := strconv.FormatInt(uuid, 10)
signCode := publicmethod.Sha1Encryption(uuidStr)
var singCodeMd5 publicmethod.Md5Encryption
singCodeMd5.Md5EncryptionInit(signCode)
signCodeRedisKey := singCodeMd5.Md5EncryptionAlgorithm()
redisFileKey := fmt.Sprintf("ScanCode:Aut:IdentRec_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, signCodeRedisKey)
redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS4)
redisClient.SetRedisTime(180)
writeRedisData := map[string]interface{}{
"userkey": userKey,
"usertoken": userToken,
}
redisClient.HashMsetAdd(redisFileKey, writeRedisData)
sendCode := publicmethod.MapOut[string]()
sendCode["code"] = signCode
publicmethod.Result(0, sendCode, c)
}

22
api/version1/publicapi/type.go

@ -0,0 +1,22 @@
package publicapi
import (
"appPlatform/overall/publicmethod"
"github.com/gin-gonic/gin"
)
type ApiMethod struct{}
// 公共函数入口
func (a *ApiMethod) Index(c *gin.Context) {
outputCont := publicmethod.MapOut[string]()
outputCont["index"] = "公共函数入口"
publicmethod.Result(0, outputCont, c)
}
// 输出UUID
type SendUUID struct {
UuId int64 `json:"uuid"`
UuIdString string `json:"uuidstring"`
}

1
api/version1/user/userCont.go

@ -105,6 +105,7 @@ func GetUserPower(appType string, postId int64, roleList []string) (menuPoint, o
orgList = publicmethod.MergeStruct[string](orgIdList, orgList)
}
}
// fmt.Printf("职务权限:---->%v\n:---->%v\n", emPower, orgList)
//获取角色权限
if len(roleList) > 0 {
var roleId []int64

2
apirouter/apishiyan/maptostruct.go

@ -16,5 +16,7 @@ func (a *ApiRouter) RouterGroup(router *gin.RouterGroup) {
apiRouter.GET("", methodBinding.Index) //入口
apiRouter.POST("", methodBinding.Index) //入口
apiRouter.POST("charparking", methodBinding.CharParking) //获取车场车位信息
apiRouter.POST("testpage", methodBinding.TestPage) //获取车场车位信息
}
}

4
apirouter/authenticationroute/entry.go

@ -0,0 +1,4 @@
package authenticationroute
//身份验证
type ApiRouter struct{}

20
apirouter/authenticationroute/signcoderoute.go

@ -0,0 +1,20 @@
package authenticationroute
import (
"appPlatform/api/authentication"
"github.com/gin-gonic/gin"
)
//实验
func (a *ApiRouter) RouterGroup(router *gin.RouterGroup) {
apiRouter := router.Group("signcode")
var methodBinding = authentication.AppApiEntry.SingCodeApi
{
apiRouter.GET("", methodBinding.Index) //入口
apiRouter.POST("", methodBinding.Index) //入口
apiRouter.POST("signcode", methodBinding.SignCode) //验证身份
}
}

6
apirouter/entry.go

@ -2,10 +2,13 @@ package apirouter
import (
"appPlatform/apirouter/apishiyan"
"appPlatform/apirouter/authenticationroute"
"appPlatform/apirouter/v1/customerformrouter"
dictrouters "appPlatform/apirouter/v1/dict_routers"
"appPlatform/apirouter/v1/grantsystempower"
matrixrouters "appPlatform/apirouter/v1/matrixRouters"
menusrouters "appPlatform/apirouter/v1/menusRouters"
"appPlatform/apirouter/v1/public"
userrouters "appPlatform/apirouter/v1/userRouters"
)
@ -17,6 +20,9 @@ type RouterGroup struct {
DictRouter dictrouters.ApiRouter
GrantPowerRouter grantsystempower.ApiRouter
MatrixApiRouter matrixrouters.ApiRouter
PublicRouters public.ApiRouter
SignCodeRouter authenticationroute.ApiRouter
CustomerFormRouter customerformrouter.ApiRouter
}
var RouterGroupEntry = new(RouterGroup)

18
apirouter/v1/customerformrouter/router.go

@ -0,0 +1,18 @@
package customerformrouter
import (
"appPlatform/api/version1"
"github.com/gin-gonic/gin"
)
// 权限矩阵PC端
func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter := router.Group("customer_form")
var methodBinding = version1.AppApiEntry.CustomerFormApi
{
apiRouter.GET("", methodBinding.Index) //入口
apiRouter.POST("", methodBinding.Index) //入口
}
}

4
apirouter/v1/customerformrouter/type.go

@ -0,0 +1,4 @@
package customerformrouter
//公共路由
type ApiRouter struct{}

8
apirouter/v1/matrixRouters/pc.go

@ -15,5 +15,13 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter.GET("", methodBinding.Index) //入口
apiRouter.POST("", methodBinding.Index) //入口
apiRouter.POST("matrixlist", methodBinding.MatrixList) //矩阵列表
apiRouter.POST("addmatrixcont", methodBinding.AddMatrixCont) //添加权限矩阵
apiRouter.POST("editmatrixcont", methodBinding.EditMatrixCont) //编辑权限矩阵
apiRouter.POST("editstatuscont", methodBinding.EditStatusCont) //编辑矩阵状态
apiRouter.POST("setup_matrix_field", methodBinding.SetupMatrixField) //设置矩阵字段
apiRouter.POST("get_matrix_field", methodBinding.GetMatrixField) //获取矩阵字段
apiRouter.POST("submit_matrix_data", methodBinding.SubmitMatrixData) //提交矩阵取值
apiRouter.POST("gain_matrix_data", methodBinding.GainMatrixData) //获取矩阵取值
apiRouter.POST("matrix_val", methodBinding.MatrixValue) //获取矩阵单一取值
}
}

21
apirouter/v1/public/router.go

@ -0,0 +1,21 @@
package public
import (
"appPlatform/api/version1"
"github.com/gin-gonic/gin"
)
// 权限矩阵PC端
func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter := router.Group("public")
var methodBinding = version1.AppApiEntry.PublicApi
{
apiRouter.GET("", methodBinding.Index) //入口
apiRouter.POST("", methodBinding.Index) //入口
apiRouter.POST("chinese_initial", methodBinding.ChineseInitial) //获取汉字首字母
apiRouter.POST("send_number", methodBinding.SendNumber) //输出编号
apiRouter.POST("generate_sign_code", methodBinding.GenerateSignCode) //生成身份验证唯一识别符
}
}

4
apirouter/v1/public/type.go

@ -0,0 +1,4 @@
package public
//公共路由
type ApiRouter struct{}

2
config/configDatabase/database.go

@ -28,6 +28,8 @@ type MysqlSetUp struct {
Managearchives MasterMysqlSetUp `mapstructure:"managearchives" json:"managearchives" yaml:"managearchives"` //管理档案
SystemPermission MasterMysqlSetUp `mapstructure:"systempermission" json:"systempermission" yaml:"systempermission"` //系统权限配置数据库
Storage MasterMysqlSetUp `mapstructure:"storage" json:"storage" yaml:"storage"` //仓储系统数据库
ServerMaster MasterMysqlSetUp `mapstructure:"servermaster" json:"servermaster" yaml:"servermaster"` //仓储系统数据库
TidbrMaster MasterMysqlSetUp `mapstructure:"tidbrmaster" json:"tidbrmaster" yaml:"tidbrmaster"` //仓储系统数据库
}
type MasterMysqlSetUp struct {

1
go.mod

@ -36,6 +36,7 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect

1
go.sum

@ -473,6 +473,7 @@ github.com/qiniu/api.v7/v7 v7.4.1/go.mod h1:VE5oC5rkE1xul0u1S2N0b2Uxq9/6hZzhyqjg
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/richardlehane/mscfb v1.0.3/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk=
github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=

14
initialization/databaseinit/mysql.go

@ -128,4 +128,18 @@ func LoadDatabase() {
} else {
fmt.Printf("%v数据库开启成功!\n", sqlConfig.Storage.Name)
}
overall.CONSTANT_DB_Server = sqlConfig.ServerMaster.OpenSql()
if overall.CONSTANT_DB_Server == nil {
fmt.Printf("%v数据库开启失败!云服务器\n", sqlConfig.ServerMaster.Name)
} else {
fmt.Printf("%v数据库开启成功!云服务器\n", sqlConfig.ServerMaster.Name)
}
overall.CONSTANT_DB_Tidb = sqlConfig.TidbrMaster.OpenSql()
if overall.CONSTANT_DB_Tidb == nil {
fmt.Printf("%v数据库开启失败!私有云服务器\n", sqlConfig.TidbrMaster.Name)
} else {
fmt.Printf("%v数据库开启成功!私有云服务器\n", sqlConfig.TidbrMaster.Name)
}
}

12
initialization/route/initRoute.go

@ -30,7 +30,11 @@ func InitialRouter() *gin.Engine {
{
shiyanApi.RouterGroup(appLoadRouterGroup)
}
//auto2.0身份验证
signCodeApi := apirouter.RouterGroupEntry.SignCodeRouter
{
signCodeApi.RouterGroup(appLoadRouterGroup)
}
}
//验证身份接口 鉴权Url(主要应用端使用)
@ -54,6 +58,12 @@ func InitialRouter() *gin.Engine {
//权限矩阵
matrixRouterApi := apirouter.RouterGroupEntry.MatrixApiRouter
matrixRouterApi.RouterGroupPc(VerifyIdentity)
//公共函数
publicRouterApi := apirouter.RouterGroupEntry.PublicRouters
publicRouterApi.RouterGroupPc(VerifyIdentity)
//自定义表单
customerFormRouterApi := apirouter.RouterGroupEntry.CustomerFormRouter
customerFormRouterApi.RouterGroupPc(VerifyIdentity)
}
//验证身份接口 无需鉴权Url(主要web端使用)
VerifyIdentityWeb := router.Group("")

3
main.go

@ -4,6 +4,7 @@ import (
"appPlatform/initialization/app"
"appPlatform/initialization/databaseinit"
"appPlatform/initialization/nosql"
"appPlatform/scheduledtask"
)
func main() {
@ -12,6 +13,6 @@ func main() {
//加载Redis
nosql.LoadRedis()
//启动定时任务
// scheduledtask.TimeTask()
scheduledtask.TimeTask()
app.RunItem()
}

1
middleware/grocerystore/redis.go

@ -164,6 +164,7 @@ func (r *RedisStoreType) HashGetAll(hashName string) (map[string]string, bool) {
// rdb := RedisInit()
// fmt.Printf("strKEy:===>%v\n", r.PreKey+hashName)
val, err := r.RedisDb.HGetAll(r.Context, r.PreKey+hashName).Result()
// fmt.Printf("strKEy:==1=>%v==1=>%v\n", val, err)
if err != nil {
return val, false
}

4
models/modelAppPlatform/matrix_content.go

@ -7,11 +7,11 @@ import (
// 权限矩阵基础信息表
type MatrixContent struct {
Id int `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"`
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:名称"`
Center string `json:"center" gorm:"column:center;type:mediumtext;default:'';comment:描述"`
Org int64 `json:"org" gorm:"column:org;type:bigint(20) unsigned;default:0;not null;comment:归属行政组织"`
State int `json:"status" gorm:"column:status;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
State int `json:"status" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
}

6
models/modelAppPlatform/matrix_frame.go

@ -7,12 +7,14 @@ import (
// 权限矩阵基础字段框架表
type MatrixFrame struct {
Id int `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"`
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:名称"`
Types int `json:"type" gorm:"column:type;type:int(1);default:1;not null;comment:骨架类型(1:人力资源;2:行政组织;2:分部;)"`
Condition int `json:"condition" gorm:"column:condition;type:int(1) unsigned;default:2;not null;comment:骨架取值类型(1:作为条件使用;2:作为取值使用)"`
State int `json:"status" gorm:"column:status;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
State int `json:"status" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
McId int64 `json:"mc_id" gorm:"column:mc_id;type:bigint(20) unsigned;default:0;not null;comment:矩阵ID"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
PinYin string `json:"pinyin" gorm:"column:pinyin;type:varchar(200) unsigned;default:'';not null;comment:拼音(标识使用)"`
}
func (MatrixFrame *MatrixFrame) TableName() string {

2
models/modelAppPlatform/matrix_handler.go

@ -7,7 +7,7 @@ import (
// 权限矩阵基础字段框架表
type MatrixHandler struct {
Id int `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"`
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
Number int64 `json:"number" gorm:"column:number;type:bigint(20) unsigned;default:0;not null;comment:批号"`
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:使用者名称"`
HandId int64 `json:"handid" gorm:"column:hand_id;type:bigint(20) unsigned;default:0;not null;comment:使用者标识符"`

74
models/modelsschool/test_paper.go

@ -0,0 +1,74 @@
package modelsschool
import (
"appPlatform/overall"
"strings"
)
// 权限矩阵基础字段框架表
type TestPaper struct {
Id int64 `json:"id" gorm:"primaryKey;column:tp_id;type:bigint(20) unsigned;not null;comment:Id;index"`
UserKey int64 `json:"tp_u_key" gorm:"column:tp_u_key;type:bigint(20) unsigned;default:0;not null;comment:员工唯一识别符"`
ExamKey int64 `json:"tp_exa_key" gorm:"column:tp_exa_key;type:bigint(20) unsigned;default:0;not null;comment:考试项目唯一识别符"`
RightKey string `json:"tp_right_key" gorm:"column:tp_right_key;type:mediumtext;default:'';comment:正确答案"`
UserReply string `json:"tp_reply" gorm:"column:tp_reply;type:mediumtext;default:'';comment:员工提交答案"`
Fraction int `json:"tp_fraction" gorm:"column:tp_fraction;type:int(5);default:1;not null;comment:分数"`
SumFraction int `json:"tp_sum_fraction" gorm:"column:tp_sum_fraction;type:int(5);default:1;not null;comment:总分"`
PasseLine int `json:"tp_pass_line" gorm:"column:tp_pass_line;type:int(3);default:1;not null;comment:及格线"`
FrequencyCount int `json:"tp_frequency" gorm:"column:tp_frequency;type:int(2);default:1;not null;comment:考试次数"`
DepartmentId int64 `json:"tp_bf_id" gorm:"column:tp_bf_id;type:bigint(20) unsigned;default:0;not null;comment:分厂"`
PosticsId int64 `json:"tp_ws_id" gorm:"column:tp_ws_id;type:bigint(20) unsigned;default:0;not null;comment:工段"`
DutiesId int64 `json:"tp_wp_id" gorm:"column:tp_wp_id;type:bigint(20) unsigned;default:0;not null;comment:职务"`
Group int64 `json:"tp_group" gorm:"column:tp_group;type:bigint(20) unsigned;default:0;not null;comment:集团"`
Start int64 `json:"tp_start" gorm:"column:tp_start;type:bigint(20) unsigned;default:0;not null;comment:开始考试时间"`
EiteTime int64 `json:"tp_eite" gorm:"column:tp_eite;type:bigint(20) unsigned;default:0;not null;comment:修改时间"`
SetUp int `json:"tp_set" gorm:"column:tp_set;type:int(1);default:1;not null;comment:状态(1:考试中;2:结束考试)"`
ExamCount int `json:"tp_exam_sum" gorm:"column:tp_exam_sum;type:int(4);default:1;not null;comment:考题总数"`
Grade int `json:"tp_grade" gorm:"column:tp_grade;type:int(1);default:1;not null;comment:考试评级(1:不及格;2:及格;3:良好;4:优秀)"`
UnifiedExamination int `json:"ps_gen_exa" gorm:"column:ps_gen_exa;type:int(1);default:1;not null;comment:统考(1:是;2:否)"`
}
func (TestPaper *TestPaper) TableName() string {
return "test_paper"
}
// 编辑内容
func (cont *TestPaper) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_Master.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *TestPaper) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_Master.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *TestPaper) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_Master.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *TestPaper) ContMap(whereMap interface{}, field ...string) (countAry []TestPaper, err error) {
gormDb := overall.CONSTANT_DB_Master.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *TestPaper) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_Master.Where(whereMap).Delete(&cont).Error
return
}

3
overall/appConfig.go

@ -41,6 +41,9 @@ var (
CONSTANT_DB_MANAGE_ARCHIVES *gorm.DB //管理档案
CONSTANT_DB_System_Permission *gorm.DB //系统权限配置数据库
CONSTANT_DB_Storage *gorm.DB //仓储系统数据库
CONSTANT_DB_Server *gorm.DB //线上数据库
CONSTANT_DB_Tidb *gorm.DB //私有云数据库
//Redis
CONSTANT_REDIS0 *redis.Client
CONSTANT_REDIS1 *redis.Client

4
overall/publicmethod/technique.go

@ -1356,11 +1356,11 @@ func GetPostOfUsEmpowerCont(orgId, postId int64, systemName string) (sysPowerCon
#func GetNewAccredit(systemName, roleId string, userKey, orgId, postId int64) (roleName, pointId, operation string, level int)
*/
func GetNewAccredit(systemName, roleId string, userKey, orgId, postId int64) (roleName, pointId, operation string, level int) {
fmt.Printf("jsonStr---1--->%v---->%v---->%v---->%v---->%v\n", systemName, roleId, userKey, orgId, postId)
// fmt.Printf("jsonStr---1--->%v---->%v---->%v---->%v---->%v\n", systemName, roleId, userKey, orgId, postId)
redisFileKey := fmt.Sprintf("Licence:PowerLoginApi_%v_%v_%v_%v", systemName, userKey, orgId, postId)
redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS3)
userRedisToken, isTrue := redisClient.HashGetAll(redisFileKey)
fmt.Printf("jsonStr---2--->%v---->%v---->%v---->%v---->%v---->%v\n", systemName, roleId, userKey, orgId, postId, userRedisToken)
// fmt.Printf("jsonStr---2--->%v---->%v---->%v---->%v---->%v---->%v\n", systemName, roleId, userKey, orgId, postId, userRedisToken)
if isTrue == false {
var pointIdAry []string

4
overall/publicmethod/type.go

@ -34,6 +34,10 @@ type PublicId struct {
Id string `json:"id"`
}
type CommonId[T GenericityVariable] struct {
Id T `json:"id"`
}
// 通用name结构体
type PublicName struct {
Name string `json:"name"`

45
scheduledtask/time_task_cron.go

@ -0,0 +1,45 @@
package scheduledtask
import (
"appPlatform/api/shiyan/maptostruct"
"fmt"
"time"
"github.com/robfig/cron/v3"
)
/*
*
@ 作者: 秦东
@ 时间: 2023-08-17 10:13:56
@ 功能: 定时任务模块 跟随主函数一起启动执行周期性任务操作
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func TimeTask() {
fmt.Println("------------准备启动定时任务--------------")
go func() {
c := cron.New(cron.WithSeconds()) //声明定时任务启动器
/*
加载任务场景
AddFunc("任务时间格式","执行的任务")
*/
c.AddFunc("0 0 2 * * *", func() {
fmt.Printf("执行定时任务--同步试卷数据---->%v\n", time.Now().UTC())
maptostruct.TestPageTimeTask()
}) //每3秒执行一个任务
c.Start() //启动
defer c.Stop() //设定全部执行后,最后关闭定时任务
select {}
}()
fmt.Printf("定时任务启动成功!TIME:%v\n", time.Now().UTC())
}
Loading…
Cancel
Save