YueYunyun 2 лет назад
Родитель
Сommit
d62cc34fe3
25 измененных файлов с 193 добавлено и 156 удалено
  1. 4 5
      SERVER/IotAdmin/app/iot/models/meter_calc.go
  2. 8 5
      SERVER/IotAdmin/app/system/router/router.go
  3. 2 0
      SERVER/IotAdmin/app/system/service/dto/sys_dict_type.go
  4. 6 3
      SERVER/IotAdmin/app/system/service/dto/sys_login_log.go
  5. 6 1
      SERVER/IotAdmin/app/system/service/dto/sys_opera_log.go
  6. 2 0
      SERVER/IotAdmin/app/system/service/dto/sys_role.go
  7. 2 0
      SERVER/IotAdmin/app/system/service/dto/sys_user.go
  8. 10 9
      SERVER/IotAdmin/template/v4/vue-view.go.template
  9. 44 14
      UI/IOTADMIN.VUE/src/components/table/VbDataTable.vue
  10. 0 1
      UI/IOTADMIN.VUE/src/components/table/partials/toolbar/TableSearchFrom.vue
  11. 3 2
      UI/IOTADMIN.VUE/src/views/dev-tools/gen/_ImportTable.vue
  12. 3 2
      UI/IOTADMIN.VUE/src/views/dev-tools/gen/index.vue
  13. 4 5
      UI/IOTADMIN.VUE/src/views/schedule/job/index.vue
  14. 3 2
      UI/IOTADMIN.VUE/src/views/system/api/index.vue
  15. 3 2
      UI/IOTADMIN.VUE/src/views/system/config/index.vue
  16. 3 2
      UI/IOTADMIN.VUE/src/views/system/dict/_data.vue
  17. 5 30
      UI/IOTADMIN.VUE/src/views/system/dict/index.vue
  18. 15 9
      UI/IOTADMIN.VUE/src/views/system/log/login.vue
  19. 26 22
      UI/IOTADMIN.VUE/src/views/system/log/oper.vue
  20. 4 5
      UI/IOTADMIN.VUE/src/views/system/menu/index.vue
  21. 4 5
      UI/IOTADMIN.VUE/src/views/system/notice/index.vue
  22. 4 5
      UI/IOTADMIN.VUE/src/views/system/org/index.vue
  23. 8 6
      UI/IOTADMIN.VUE/src/views/system/post/index.vue
  24. 11 10
      UI/IOTADMIN.VUE/src/views/system/role/index.vue
  25. 13 11
      UI/IOTADMIN.VUE/src/views/system/user/index.vue

+ 4 - 5
SERVER/IotAdmin/app/iot/models/meter_calc.go

@@ -1,11 +1,10 @@
 package models
 
 type IotMeterCalc struct {
-	Id   string `gorm:"type:varchar(50);not null;comment:设备编码"`
-	Time int    `gorm:"type:int;not null;comment:更新时间"`
-	Data string `json:"data" gorm:"type:varchar(500);not null;comment:计算数据"`
-	//DataJson interface{} `json:"data" gorm:"type:varchar(500);not null;comment:计算数据"`
-	Device *IotDevice `json:"-" gorm:"foreignKey:Id;references:id;joinForeignKey:Sn;references:sn"`
+	Id     string     `gorm:"type:varchar(50);not null;comment:设备编码"`
+	Time   int        `gorm:"type:int;not null;comment:更新时间"`
+	Data   string     `json:"data" gorm:"type:varchar(500);not null;comment:计算数据"`
+	Device *IotDevice `json:"-" gorm:"foreignKey:Sn"`
 }
 
 func (*IotMeterCalc) TableName() string {

+ 8 - 5
SERVER/IotAdmin/app/system/router/router.go

@@ -74,14 +74,17 @@ func sysBaseRouter(r *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
 		r.GET("/", apis.Admin)
 	}
 	r.GET("/info", handler.Ping)
-	v1 := r.Group("/api/")
+	r1 := r.Group("/api/")
 	{
-		v1.POST("/login", authMiddleware.LoginHandler)
+		r1.POST("/login", authMiddleware.LoginHandler)
 		// Refresh time can be longer than token timeout
-		v1.GET("/refresh-token", authMiddleware.RefreshHandler)
-		v1.POST("/logout", handler.LogOut)
+		r1.GET("/refresh-token", authMiddleware.RefreshHandler)
 		// 验证码
-		v1.GET("/captcha", (&apis.SystemApi{}).GenerateCaptchaHandler)
+		r1.GET("/captcha", (&apis.SystemApi{}).GenerateCaptchaHandler)
+	}
+	r2 := r.Group("/api/").Use(authMiddleware.MiddlewareFunc())
+	{
+		r2.POST("/logout", handler.LogOut)
 	}
 	wss := r.Group("").Use(authMiddleware.MiddlewareFunc())
 	{

+ 2 - 0
SERVER/IotAdmin/app/system/service/dto/sys_dict_type.go

@@ -13,6 +13,8 @@ type SysDictTypeGetPageReq struct {
 	DictName       string `form:"dictName" search:"type:icontains;column:dict_name;table:sys_dict_type"`
 	DictType       string `form:"dictType" search:"type:icontains;column:dict_type;table:sys_dict_type"`
 	Status         int    `form:"status" search:"type:exact;column:status;table:sys_dict_type"`
+	BeginTime      string `form:"beginTime" search:"type:gte;column:created_at;table:sys_dict_type" comment:"创建时间"`
+	EndTime        string `form:"endTime" search:"type:lte;column:created_at;table:sys_dict_type" comment:"创建时间"`
 }
 
 type SysDictTypeOrder struct {

+ 6 - 3
SERVER/IotAdmin/app/system/service/dto/sys_login_log.go

@@ -8,16 +8,19 @@ import (
 
 type SysLoginLogGetPageReq struct {
 	dto.Pagination `search:"-"`
-	Username       string `form:"username" search:"type:exact;column:username;table:sys_login_log" comment:"用户名"`
+	Username       string `form:"username" search:"type:contains;column:username;table:sys_login_log" comment:"用户名"`
 	Status         string `form:"status" search:"type:exact;column:status;table:sys_login_log" comment:"状态"`
 	Ipaddr         string `form:"ipaddr" search:"type:exact;column:ipaddr;table:sys_login_log" comment:"ip地址"`
 	LoginLocation  string `form:"loginLocation" search:"type:exact;column:login_location;table:sys_login_log" comment:"归属地"`
-	BeginTime      string `form:"beginTime" search:"type:gte;column:ctime;table:sys_login_log" comment:"创建时间"`
-	EndTime        string `form:"endTime" search:"type:lte;column:ctime;table:sys_login_log" comment:"创建时间"`
+	BeginTime      string `form:"beginTime" search:"type:gte;column:login_time;table:sys_login_log" comment:"创建时间"`
+	EndTime        string `form:"endTime" search:"type:lte;column:login_time;table:sys_login_log" comment:"创建时间"`
 	SysLoginLogOrder
 }
 
 type SysLoginLogOrder struct {
+	UsernameOrder  string `search:"type:order;column:username;table:sys_login_log" form:"usernameOrder"`
+	StatusOrder    string `search:"type:order;column:status;table:sys_login_log" form:"statusOrder"`
+	LoginTimeOrder string `search:"type:order;column:login_time;table:sys_login_log" form:"loginTimeOrder"`
 	CreatedAtOrder string `search:"type:order;column:created_at;table:sys_login_log" form:"createdAtOrder"`
 }
 

+ 6 - 1
SERVER/IotAdmin/app/system/service/dto/sys_opera_log.go

@@ -17,6 +17,7 @@ type SysOperaLogGetPageReq struct {
 	dto.Pagination `search:"-"`
 	Title          string `form:"title" search:"type:contains;column:title;table:sys_opera_log" comment:"操作模块"`
 	Method         string `form:"method" search:"type:contains;column:method;table:sys_opera_log" comment:"函数"`
+	OperatorType   string `form:"requestMethod" search:"type:contains;column:operator_type;table:sys_opera_log" comment:"操作类型"`
 	RequestMethod  string `form:"requestMethod" search:"type:contains;column:request_method;table:sys_opera_log" comment:"请求方式: GET POST PUT DELETE"`
 	OperUrl        string `form:"operUrl" search:"type:contains;column:oper_url;table:sys_opera_log" comment:"访问地址"`
 	OperIp         string `form:"operIp" search:"type:exact;column:oper_ip;table:sys_opera_log" comment:"客户端ip"`
@@ -27,7 +28,11 @@ type SysOperaLogGetPageReq struct {
 }
 
 type SysOperaLogOrder struct {
-	CreatedAtOrder string `search:"type:order;column:created_at;table:sys_opera_log" form:"createdAtOrder"`
+	OperatorTypeOrder  string `search:"type:order;column:operator_type;table:sys_opera_log" form:"operatorTypeOrder"`
+	RequestMethodOrder string `search:"type:order;column:request_method;table:sys_opera_log" form:"requestMethodOrder"`
+	StatusOrder        string `search:"type:order;column:status;table:sys_opera_log" form:"statusOrder"`
+	OperUrlOrder       string `search:"type:order;column:oper_url;table:sys_opera_log" form:"operUrlOrder"`
+	CreatedAtOrder     string `search:"type:order;column:created_at;table:sys_opera_log" form:"createdAtOrder"`
 }
 
 func (m *SysOperaLogGetPageReq) GetNeedSearch() interface{} {

+ 2 - 0
SERVER/IotAdmin/app/system/service/dto/sys_role.go

@@ -19,6 +19,8 @@ type SysRoleGetPageReq struct {
 	Remark    string `form:"remark" search:"type:exact;column:remark;table:sys_role" comment:"备注"`        // 备注
 	Admin     bool   `form:"admin" search:"type:exact;column:admin;table:sys_role" comment:"是否管理员"`
 	DataScope string `form:"dataScope" search:"type:exact;column:data_scope;table:sys_role" comment:"是否管理员"`
+	BeginTime string `form:"beginTime" search:"type:gte;column:created_at;table:sys_role" comment:"创建时间"`
+	EndTime   string `form:"endTime" search:"type:lte;column:created_at;table:sys_role" comment:"创建时间"`
 }
 
 type SysRoleOrder struct {

+ 2 - 0
SERVER/IotAdmin/app/system/service/dto/sys_user.go

@@ -18,6 +18,8 @@ type SysUserGetPageReq struct {
 	Email          string `form:"email" search:"type:contains;column:email;table:sys_user" comment:"邮箱"`
 	PostId         string `form:"postId" search:"type:exact;column:post_id;table:sys_user" comment:"岗位"`
 	Status         string `form:"status" search:"type:exact;column:status;table:sys_user" comment:"状态"`
+	BeginTime      string `form:"beginTime" search:"type:gte;column:created_at;table:sys_user" comment:"创建时间"`
+	EndTime        string `form:"endTime" search:"type:lte;column:created_at;table:sys_user" comment:"创建时间"`
 	OrgJoin        `search:"type:left;on:org_id:org_id;table:sys_user;join:sys_org"`
 	SysUserOrder
 }

+ 10 - 9
SERVER/IotAdmin/template/v4/vue-view.go.template

@@ -332,25 +332,26 @@ function submitForm() {
     }
 }
 /** 查询按钮 */
-function handleQuery() {
+function handleQuery(query?: any) {
+    query = query || tableRef.value?.getQueryParams() || queryParams.value
     {{- range .Columns -}}
     {{- if ( eq .GoField "CreatedAt")}}
-    addDateRange(queryParams.value, queryParams.value.dateRange)
+    addDateRange(query, query.dateRange)
     {{- else if and (eq .IsQuery "1") (eq .HtmlType "datetime")}}
-    addDateRange(queryParams.value, queryParams.value.dateRange{{.BJsonField}})
+    addDateRange(query, query.dateRange{{.BJsonField}})
     {{- end -}}
     {{- end }}
-    tableRef.value?.search()
+    tableRef.value?.query(query)
 }
 /** 查询重置按钮 */
-function resetQuery() {
+function resetQuery(query?: any) {
     {{- range .Columns -}}
     {{- if ( eq .GoField "CreatedAt")}}
-    queryParams.value.dateRange = []
-    addDateRange(queryParams.value, queryParams.value.dateRange)
+    query.dateRange = []
+    addDateRange(query, query.dateRange)
     {{- else if and (eq .IsQuery "1") (eq .HtmlType "datetime")}}
-    queryParams.value.dateRange{{.BJsonField}} = []
-    addDateRange(queryParams.value, queryParams.value.dateRange{{.BJsonField}})
+    query.dateRange{{.BJsonField}} = []
+    addDateRange(query, query.dateRange{{.BJsonField}})
     {{- end -}}
     {{- end }}
 }

+ 44 - 14
UI/IOTADMIN.VUE/src/components/table/VbDataTable.vue

@@ -49,8 +49,8 @@ const props = withDefaults(
 		searchFormRowItems?: VbFormRowItem[]
 		searchFormItems?: VbFormItem[]
 		searchFormSpan?: number
-		customSearchFun?: () => void
-		resetSearchFormFun?: () => void
+		customSearchFun?: (query?: any) => void
+		resetSearchFormFun?: (query: any) => void
 		/* left toolbar */
 		handleBtns?: ToolBtn[]
 		handlePerm?: string
@@ -177,8 +177,8 @@ const emits = defineEmits<{
 const tableBoxRef = ref()
 const tableContentRef = ref()
 const id = ref("")
-
-const { data, queryParams, searchFormRowItems, searchFormItems } = toRefs(props)
+const emptyQueryParams = JSON.stringify(props.queryParams ? props.queryParams : {})
+const { data, searchFormRowItems, searchFormItems } = toRefs(props)
 const leftFixedRef = ref()
 const tableResponsiveRef = ref()
 const rightFixedRef = ref()
@@ -250,6 +250,15 @@ const loading: WritableComputedRef<boolean> = computed({
 		emits("update:loading", value)
 	}
 })
+const _innerQueryParams = ref<any>()
+const innerQueryParams: WritableComputedRef<any> = computed({
+	get(): boolean {
+		return _innerQueryParams.value ?? props.queryParams
+	},
+	set(value: any): void {
+		_innerQueryParams.value = value
+	}
+})
 
 const rowColumns = computed(() => {
 	const rowCols: Header[] = []
@@ -381,7 +390,7 @@ const defaultHandleFuns = {
 		if (props.exportUrl) {
 			download(
 				props.exportUrl,
-				{ ...queryParams },
+				{ ...innerQueryParams },
 				`${props.exportName ? props.exportName + "_" : ""}${new Date().getTime()}.xlsx`
 			)
 		} else {
@@ -396,8 +405,11 @@ const resetData = () => {
 
 const remote = (id?: string) => {
 	const params = props.noPage
-		? queryParams.value
-		: Object.assign({ pageIndex: currentPage.value, pageSize: pageSize.value }, queryParams.value)
+		? innerQueryParams.value
+		: Object.assign(
+				{ pageIndex: currentPage.value, pageSize: pageSize.value },
+				innerQueryParams.value
+			)
 	if (sortParams.value.length) {
 		sortParams.value.forEach((v: any) => {
 			if (v.order && v.label) {
@@ -468,8 +480,8 @@ const remote = (id?: string) => {
 			loading.value = false
 			if (props.isLazy) {
 				if (props.isLazySearch) {
-					Object.keys(queryParams.value).forEach((v) => {
-						queryParams.value[v] = undefined
+					Object.keys(innerQueryParams.value).forEach((v) => {
+						innerQueryParams.value[v] = undefined
 					})
 					if (!data.length) {
 						const item = {}
@@ -563,7 +575,7 @@ const loadHandleBtns = () => {
 }
 const customSearch = () => {
 	if (props.customSearchFun) {
-		props.customSearchFun()
+		props.customSearchFun(innerQueryParams.value)
 	} else {
 		search()
 	}
@@ -589,6 +601,12 @@ function calcTableBoxStyle() {
 	}
 	return style
 }
+function query(query?: any) {
+	if (query) {
+		innerQueryParams.value = Object.assign({}, query)
+	}
+	search()
+}
 function search(isReset = true) {
 	if (isReset) {
 		resetData()
@@ -600,6 +618,9 @@ function search(isReset = true) {
 		remote(props.isLazy ? props.rootId : undefined)
 	}
 }
+function getQueryParams() {
+	return innerQueryParams.value
+}
 function getSelected() {
 	return getSelecteds()[0]
 }
@@ -614,7 +635,7 @@ function getData() {
 }
 provide(symbolKeys.tableBox, tableBoxRef)
 provide(symbolKeys.searchFrom, {
-	queryParams,
+	queryParams: innerQueryParams,
 	searchFormRowItems,
 	searchFormItems,
 	searchFormSpan: props.searchFormSpan
@@ -753,7 +774,8 @@ const onRowDbClick = (v: any) => {
 	props.rowDbClick && props.rowDbClick(row)
 }
 const onReset = () => {
-	props.resetSearchFormFun && props.resetSearchFormFun()
+	innerQueryParams.value = JSON.parse(emptyQueryParams)
+	props.resetSearchFormFun && props.resetSearchFormFun(innerQueryParams.value)
 	customSearch()
 }
 const onTreeToggle = (v: any) => {
@@ -902,14 +924,22 @@ onMounted(init)
 onUnmounted(() => {
 	tableResponsiveRef.value?.removeEventListener("scroll", onFixedScrollX, true)
 })
-watch(() => props.queryParams, customSearch, { deep: props.autoSearch })
+watch(
+	() => props.queryParams,
+	(val: any) => {
+		innerQueryParams.value = val
+		customSearch()
+	},
+	{ deep: props.autoSearch }
+)
 defineExpose({
 	tableRef: tableBoxRef,
-	search,
+	query,
 	getSelected,
 	getSelectedIds,
 	getSelecteds,
 	getData,
+	getQueryParams,
 	defaultHandleFuns
 })
 </script>

+ 0 - 1
UI/IOTADMIN.VUE/src/components/table/partials/toolbar/TableSearchFrom.vue

@@ -47,7 +47,6 @@ function resetForm() {
 	searchFormRef.value.clearValidate()
 	searchFormRef.value.resetFields()
 	VbUtil.EventHandlerUtil.trigger(tableBox.value, "vbtable.reset")
-	setTimeout(query, 100)
 }
 </script>
 

+ 3 - 2
UI/IOTADMIN.VUE/src/views/dev-tools/gen/_ImportTable.vue

@@ -66,8 +66,9 @@ const { queryParams, emptyFormData } = toRefs(opts)
 const form = ref<any>(emptyFormData.value)
 
 /** 查询按钮 */
-function handleQuery() {
-	tableRef.value?.search()
+function handleQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	tableRef.value?.query(query)
 }
 /** 查询重置按钮 */
 function resetQuery() {}

+ 3 - 2
UI/IOTADMIN.VUE/src/views/dev-tools/gen/index.vue

@@ -112,8 +112,9 @@ const editTableRef = ref()
 const editTableData = ref<any>({})
 
 /** 查询按钮 */
-function handleQuery() {
-	tableRef.value?.search()
+function handleQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	tableRef.value?.query(query)
 }
 /** 查询重置按钮 */
 function resetQuery() {}

+ 4 - 5
UI/IOTADMIN.VUE/src/views/schedule/job/index.vue

@@ -271,13 +271,12 @@ function submitForm() {
 	}
 }
 /** 查询按钮 */
-function handleQuery() {
-	tableRef.value?.search()
+function handleQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	tableRef.value?.query(query)
 }
 /** 查询重置按钮 */
-function resetQuery() {
-	queryParams.value = opts.queryParams
-}
+function resetQuery() {}
 
 function handleStart(row: any) {
 	message

+ 3 - 2
UI/IOTADMIN.VUE/src/views/system/api/index.vue

@@ -185,8 +185,9 @@ function submitForm() {
 	}
 }
 /** 查询按钮 */
-function handleQuery() {
-	tableRef.value?.search()
+function handleQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	tableRef.value?.query(query)
 }
 /** 查询重置按钮 */
 function resetQuery() {}

+ 3 - 2
UI/IOTADMIN.VUE/src/views/system/config/index.vue

@@ -112,8 +112,9 @@ function handleDelete(rows: any[]) {
 	tableRef.value.defaultHandleFuns.handleDelete("", rows)
 }
 /** 搜索按钮操作 */
-function handleQuery() {
-	tableRef.value?.search()
+function handleQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	tableRef.value?.query(query)
 }
 /** 重置按钮操作 */
 function resetQuery() {

+ 3 - 2
UI/IOTADMIN.VUE/src/views/system/dict/_data.vue

@@ -119,8 +119,9 @@ function handleDelete(rows: any[]) {
 	tableRef.value.defaultHandleFuns.handleDelete("", rows)
 }
 /** 搜索按钮操作 */
-function handleQuery() {
-	tableRef.value?.search()
+function handleQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	tableRef.value?.query(query)
 }
 /** 重置按钮操作 */
 function resetQuery() {

+ 5 - 30
UI/IOTADMIN.VUE/src/views/system/dict/index.vue

@@ -22,8 +22,7 @@ const opts = reactive({
 	queryParams: {
 		dictName: undefined,
 		dictType: undefined,
-		status: undefined,
-		dateRangeCreateTime: []
+		status: undefined
 	},
 	searchFormItems: [
 		{
@@ -64,27 +63,6 @@ const opts = reactive({
 				placeholder: "请选择状态",
 				dictType: "sys_common_status"
 			}
-		},
-		{
-			field: "createTime",
-			label: "创建时间",
-			required: false,
-			component: "D",
-			class: "w-100",
-			placeholder: "请选择创建时间",
-			props: {
-				type: "daterange",
-				valueFormat: "YYYY-MM-DD",
-				rangeSeparator: "-",
-				startPlaceholder: "开始日期",
-				endPlaceholder: "结束日期"
-			},
-			listeners: {
-				change: (v: any) => {
-					queryParams.value.dateRangeCreateTime = v
-				}
-			},
-			span: 5
 		}
 	],
 	permission: permissionNames.SystemDict,
@@ -132,15 +110,12 @@ function handleDelete(rows: any[]) {
 	tableRef.value.defaultHandleFuns.handleDelete("", rows)
 }
 /** 搜索按钮操作 */
-function handleQuery() {
-	addDateRange(queryParams.value, queryParams.value.dateRangeCreateTime)
-	tableRef.value?.search()
+function handleQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	tableRef.value?.query(query)
 }
 /** 重置按钮操作 */
-function resetQuery() {
-	queryParams.value.dateRangeCreateTime = [] as any
-	addDateRange(queryParams.value, queryParams.value.dateRangeCreateTime)
-}
+function resetQuery() {}
 
 /** 提交按钮 */
 function submitForm() {

+ 15 - 9
UI/IOTADMIN.VUE/src/views/system/log/login.vue

@@ -2,6 +2,7 @@
 import apis from "@a"
 import { permissionNames } from "@@/services/PermissionNames"
 import dayjs from "dayjs"
+//const emptyQueryParams = JSON.stringify(props.queryParams ? props.queryParams : {})
 
 const tableRef = ref()
 const opts = reactive<any>({
@@ -17,7 +18,7 @@ const opts = reactive<any>({
 	],
 	queryParams: {
 		ipaddr: undefined,
-		userName: undefined,
+		username: undefined,
 		status: undefined,
 		dateRange: []
 	},
@@ -36,7 +37,7 @@ const opts = reactive<any>({
 			}
 		},
 		{
-			field: "userName",
+			field: "username",
 			label: "用户名称",
 			placeholder: "请输入用户名称",
 			required: false,
@@ -78,7 +79,8 @@ const opts = reactive<any>({
 					//dateRange.value = v
 					queryParams.value.dateRange = v
 				}
-			}
+			},
+			span: 6
 		}
 	] as any,
 	permission: permissionNames.SystemLoginLog,
@@ -98,13 +100,15 @@ const opts = reactive<any>({
 	deleteEntityFun: apis.system.loginLogApi.delLog
 })
 const { queryParams } = toRefs(opts)
-function handleQuery() {
-	addDateRange(queryParams.value, queryParams.value.dateRange)
-	tableRef.value?.search()
+function handleQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	addDateRange(query, query.dateRange)
+	tableRef.value?.query(query)
 }
-function resetQuery() {
-	queryParams.value.dateRange = []
-	addDateRange(queryParams.value, queryParams.value.dateRange)
+function resetQuery(query: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	query.dateRange = []
+	addDateRange(query, query.dateRange)
 }
 // function handleDelete(rows: any) {
 //   const infoIds = rows.map((v: any) => v.infoId)
@@ -168,6 +172,8 @@ function handleUnlock(row: any) {
 			key-field="infoId"
 			:handle-perm="opts.permission"
 			:handle-funs="opts.handleFuns"
+			sort-field="loginTime"
+			sort-order="desc"
 			:search-form-items="opts.searchFormItems"
 			:columns="opts.columns"
 			:custom-btns="opts.customBtns"

+ 26 - 22
UI/IOTADMIN.VUE/src/views/system/log/oper.vue

@@ -20,11 +20,12 @@ const tableRef = ref()
 const opts = reactive<any>({
 	columns: [
 		// { field: "title", name: `系统模块` },
-		{ field: "operUrl", name: `请求地址` },
-		{ field: "operatorType", name: `请求类型`, width: 120 },
-		{ field: "status", name: `请求状态`, width: 120 },
-		{ field: "operIp", name: `主机`, width: 180 },
-		{ field: "operLocation", name: `操作地点`, width: 180 },
+		{ field: "operUrl", name: `请求地址`, isSort: true },
+		{ field: "requestMethod", name: `请求类型`, width: 100, isSort: true },
+		{ field: "operIp", name: `主机`, width: 150 },
+		{ field: "operLocation", name: `操作地点`, width: 160 },
+		{ field: "operatorType", name: `操作类型`, width: 100, isSort: true },
+		{ field: "status", name: `操作状态`, width: 100, isSort: true },
 		{ field: "operName", name: `操作人员`, width: 120, isSort: true },
 		{ field: "operTime", name: `操作日期`, width: 185, isSort: true },
 		{ field: "actions", name: `操作`, width: 100 }
@@ -63,6 +64,16 @@ const opts = reactive<any>({
 				}
 			}
 		},
+		{
+			field: "operatorType",
+			label: "操作类型",
+			required: false,
+			component: "Dict",
+			props: {
+				placeholder: "请选择操作类型",
+				dictType: "sys_oper_type"
+			}
+		},
 		{
 			field: "status",
 			label: "操作状态",
@@ -73,16 +84,6 @@ const opts = reactive<any>({
 				dictType: "sys_common_status"
 			}
 		},
-		// {
-		// 	field: "businessType",
-		// 	label: "操作类型",
-		// 	required: false,
-		// 	component: "Dict",
-		// 	props: {
-		// 		placeholder: "请选择操作类型",
-		// 		dictType: "sys_oper_type"
-		// 	}
-		// },
 		{
 			field: "dateRange",
 			label: "操作时间",
@@ -103,7 +104,8 @@ const opts = reactive<any>({
 					//dateRange.value = v
 					queryParams.value.dateRange = v
 				}
-			}
+			},
+			span: 6
 		}
 	],
 	permission: permissionNames.SystemOperLog,
@@ -118,13 +120,15 @@ const opts = reactive<any>({
 })
 const { queryParams } = toRefs(opts)
 
-function handleQuery() {
-	addDateRange(queryParams.value, queryParams.value.dateRange)
-	tableRef.value?.search()
+function handleQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	addDateRange(query, query.dateRange)
+	tableRef.value?.query()
 }
-function resetQuery() {
-	queryParams.value.dateRange = []
-	addDateRange(queryParams.value, queryParams.value.dateRange)
+function resetQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	query.dateRange = []
+	addDateRange(query, query.dateRange)
 }
 
 function handleClean() {

+ 4 - 5
UI/IOTADMIN.VUE/src/views/system/menu/index.vue

@@ -116,13 +116,12 @@ const opts = reactive({
 const { queryParams, emptyFormData } = toRefs(opts)
 const form = ref<any>(emptyFormData.value)
 /** 搜索按钮操作 */
-function handleQuery() {
-	tableRef.value?.search()
+function handleQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	tableRef.value?.query(query)
 }
 /** 重置按钮操作 */
-function resetQuery() {
-	//
-}
+function resetQuery() {}
 
 const menuOptions = ref<any>([])
 const apiOptions = ref<any>([])

+ 4 - 5
UI/IOTADMIN.VUE/src/views/system/notice/index.vue

@@ -95,13 +95,12 @@ const opts = reactive({
 })
 const { queryParams, emptyFormData, form } = toRefs(opts)
 /** 搜索按钮操作 */
-function handleQuery() {
-	tableRef.value?.search()
+function handleQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	tableRef.value?.query(query)
 }
 /** 重置按钮操作 */
-function resetQuery() {
-	//
-}
+function resetQuery() {}
 
 /** 修改按钮操作 */
 function handleUpdate(row: any) {

+ 4 - 5
UI/IOTADMIN.VUE/src/views/system/org/index.vue

@@ -103,13 +103,12 @@ const { queryParams, emptyFormData } = toRefs(opts)
 const form = ref(emptyFormData.value)
 
 /** 搜索按钮操作 */
-function handleQuery() {
-	tableRef.value?.search()
+function handleQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	tableRef.value?.query(query)
 }
 /** 重置按钮操作 */
-function resetQuery() {
-	//
-}
+function resetQuery() {}
 
 const orgOptions = ref<any>([])
 function reset() {

+ 8 - 6
UI/IOTADMIN.VUE/src/views/system/post/index.vue

@@ -129,14 +129,16 @@ function submitForm() {
 	}
 }
 /** 查询按钮 */
-function handleQuery() {
-	addDateRange(queryParams.value, queryParams.value.dateRange)
-	tableRef.value?.search()
+function handleQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	addDateRange(query, query.dateRange)
+	tableRef.value?.query()
 }
 /** 查询重置按钮 */
-function resetQuery() {
-	queryParams.value.dateRange = []
-	addDateRange(queryParams.value, queryParams.value.dateRange)
+function resetQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	query.dateRange = []
+	addDateRange(query, query.dateRange)
 }
 const formItems = ref([
 	{

+ 11 - 10
UI/IOTADMIN.VUE/src/views/system/role/index.vue

@@ -56,7 +56,7 @@ const opts = reactive({
 		roleName: undefined,
 		roleKey: undefined,
 		status: undefined,
-		dateRangeCreateTime: undefined
+		dateRange: undefined
 	},
 	searchFormItems: [
 		{
@@ -99,7 +99,7 @@ const opts = reactive({
 			}
 		},
 		{
-			field: "dateRangeCreateTime",
+			field: "dateRange",
 			label: "创建时间",
 			class: "w-100",
 			required: false,
@@ -114,7 +114,7 @@ const opts = reactive({
 			},
 			listeners: {
 				change: (v: any) => {
-					queryParams.value.dateRangeCreateTime = v
+					queryParams.value.dateRange = v
 				}
 			},
 			span: 5
@@ -264,16 +264,17 @@ const { queryParams, emptyFormData } = toRefs(opts)
 const form = ref<any>(emptyFormData.value)
 
 /** 搜索按钮操作 */
-function handleQuery() {
-	addDateRange(queryParams.value, queryParams.value.dateRangeCreateTime)
-	tableRef.value?.search()
+function handleQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	addDateRange(query, query.dateRange)
+	tableRef.value?.query()
 }
 
 /** 重置按钮操作 */
-function resetQuery() {
-	queryParams.value.dateRangeCreateTime = [] as any
-	addDateRange(queryParams.value, queryParams.value.dateRangeCreateTime)
-	//
+function resetQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	query.dateRange = []
+	addDateRange(query, query.dateRange)
 }
 
 /** 添加角色 */

+ 13 - 11
UI/IOTADMIN.VUE/src/views/system/user/index.vue

@@ -113,13 +113,15 @@ const tableOpts = reactive({
 	}
 })
 const { permission, columns, queryParams, searchFormItems, handleFuns } = toRefs(tableOpts)
-function handleQuery() {
-	addDateRange(queryParams.value, queryParams.value.dateRange)
-	tableRef.value?.search()
+function handleQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	addDateRange(query, query.dateRange)
+	tableRef.value?.query()
 }
-function resetQuery() {
-	queryParams.value.dateRange = []
-	addDateRange(queryParams.value, queryParams.value.dateRange)
+function resetQuery(query?: any) {
+	query = query || tableRef.value?.getQueryParams() || queryParams.value
+	query.dateRange = []
+	addDateRange(query, query.dateRange)
 	queryParams.value.orgId = undefined
 	orgTreeRef.value?.setCurrentKey("")
 }
@@ -266,23 +268,23 @@ const modalOpts = reactive({
 		sex: "0",
 		status: "2",
 		remark: undefined,
-		postId: 1,
-		roleId: 2
+		postId: undefined,
+		roleId: undefined
 	}
 })
 const { title: modalTitle, emptyFormData, formItems } = toRefs(modalOpts)
 const form = ref(emptyFormData)
 function reset() {
-	form.value = Object.assign({}, emptyFormData.value)
+	form.value = emptyFormData.value
 }
 const initPassword = ref(undefined)
 function handleCreate() {
 	modalTitle.value = "新增用户"
 	reset()
-	initPassword.value = undefined
 	apis.system.userApi.getUser("0").then(({ data }) => {
 		setOptions(data)
-		console.log("USER", form.value)
+		form.value = emptyFormData.value
+		form.value.password = initPassword.value
 		modalRef.value.show()
 	})
 }