diff --git a/base/model/model.go b/base/model/model.go index d601dedf..42376ba0 100644 --- a/base/model/model.go +++ b/base/model/model.go @@ -173,14 +173,15 @@ func GetPageBySql(sql string, param *PageParam, toModel interface{}, args ...int countSql := strings.Replace(sql, selectCol, "COUNT(*) AS total ", 1) // 查询count var count int - db.Raw(countSql, args...).Scan(&count) + err := db.Raw(countSql, args...).Scan(&count).Error + biz.ErrIsNilAppendErr(err, "查询失败: %s") if count == 0 { return &PageResult{Total: 0, List: []string{}} } // 分页查询 limitSql := sql + " LIMIT " + strconv.Itoa(param.PageNum-1) + ", " + strconv.Itoa(param.PageSize) - err := db.Raw(limitSql).Scan(toModel).Error - biz.ErrIsNil(err, "查询失败") + err = db.Raw(limitSql).Scan(toModel).Error + biz.ErrIsNil(err, "查询失败: %s") return &PageResult{Total: int64(count), List: toModel} } diff --git a/lastupdate.tmp b/lastupdate.tmp deleted file mode 100755 index 0e345af9..00000000 --- a/lastupdate.tmp +++ /dev/null @@ -1 +0,0 @@ -{"/Users/hml/Desktop/project/go/mayfly-go/controllers":1610075329396211594} \ No newline at end of file diff --git a/mayfly_go_web/src/views/ops/machine/MachineEdit.vue b/mayfly_go_web/src/views/ops/machine/MachineEdit.vue index d2255096..0aebd4d7 100644 --- a/mayfly_go_web/src/views/ops/machine/MachineEdit.vue +++ b/mayfly_go_web/src/views/ops/machine/MachineEdit.vue @@ -2,17 +2,11 @@
- @@ -57,6 +51,9 @@ export default defineComponent({ visible: { type: Boolean, }, + projects: { + type: Array, + }, machine: { type: [Boolean, Object], }, @@ -68,8 +65,11 @@ export default defineComponent({ const machineForm: any = ref(null); const state = reactive({ dialogVisible: false, + projects: [], form: { id: null, + projectId: null, + projectName: null, name: null, port: 22, username: null, @@ -131,6 +131,7 @@ export default defineComponent({ watch(props, async (newValue) => { state.dialogVisible = newValue.visible; + state.projects = newValue.projects; if (newValue.machine) { state.form = { ...newValue.machine }; } else { @@ -138,6 +139,14 @@ export default defineComponent({ } }); + const changeProject = (projectId: number) => { + for (let p of state.projects as any) { + if (p.id == projectId) { + state.form.projectName = p.name; + } + } + }; + const btnOk = async () => { machineForm.value.validate((valid: boolean) => { if (valid) { @@ -148,7 +157,7 @@ export default defineComponent({ setTimeout(() => { state.btnLoading = false; }, 1000); - + cancel(); }); } else { @@ -171,6 +180,7 @@ export default defineComponent({ return { ...toRefs(state), machineForm, + changeProject, btnOk, cancel, }; diff --git a/mayfly_go_web/src/views/ops/machine/MachineList.vue b/mayfly_go_web/src/views/ops/machine/MachineList.vue index a06ddc16..f5c73446 100644 --- a/mayfly_go_web/src/views/ops/machine/MachineList.vue +++ b/mayfly_go_web/src/views/ops/machine/MachineList.vue @@ -35,8 +35,20 @@
- - + + + + +
@@ -54,12 +66,13 @@ {{ `${scope.row.ip}:${scope.row.port}` }} + + -