zk 2 年 前
コミット
77a86680a1

+ 3 - 3
server/model/autocode/organization.go

@@ -4,9 +4,9 @@ package autocode
 // Organization 结构体
 // 如果含有time.Time 请自行import time包
 type Organization struct {
-	CODE       string         `json:"value" form:"CODE" gorm:"column:CODE;comment:;type:varchar(20);"`
-	NAME       string         `json:"label" form:"NAME" gorm:"column:NAME;comment:;type:varchar(50);"`
-	PARENTCODE string         `json:"parentcode" form:"PARENTCODE" gorm:"column:PARENT_CODE;comment:;type:varchar(20);"`
+	CODE       string         `json:"code" form:"code" gorm:"column:CODE;comment:;type:varchar(20);"`
+	NAME       string         `json:"name" form:"name" gorm:"column:NAME;comment:;type:varchar(50);"`
+	PARENTCODE string         `json:"parentcode" form:"parentcode" gorm:"column:PARENT_CODE;comment:;type:varchar(20);"`
 	Optimistic *int           `json:"optimistic" form:"optimistic" gorm:"column:optimistic;comment:;type:int"`
 	Postition  string         `json:"postition" form:"postition" gorm:"column:postition;comment:;type:varchar(225);"`
 	Children   []Organization `json:"children" gorm:"-"`

+ 2 - 3
server/router/autocode/organization.go

@@ -18,8 +18,8 @@ func (s *OrganizationRouter) InitOrganizationRouter(Router *gin.RouterGroup) {
 		organizationRouter.DELETE("deleteOrganization", organizationApi.DeleteOrganization)           // 删除Organization
 		organizationRouter.DELETE("deleteOrganizationByIds", organizationApi.DeleteOrganizationByIds) // 批量删除Organization
 		organizationRouter.PUT("updateOrganization", organizationApi.UpdateOrganization)              // 更新Organization
-		//organizationRouter.GET("findOrganization", organizationApi.FindOrganization)        // 根据ID获取Organization
-		//organizationRouter.GET("getOrganizationList", organizationApi.GetOrganizationList)  // 获取Organization列表
+		organizationRouter.GET("findOrganizationP", organizationApi.FindOrganization)                 // 根据ID获取Organization
+		organizationRouter.GET("getOrganizationList", organizationApi.GetOrganizationList)            // 获取Organization列表
 	}
 }
 
@@ -29,7 +29,6 @@ func (s *ContentRouter) InitOrganizationPRouter(Router *gin.RouterGroup) {
 	{
 		organizationRouter.GET("findOrganization", organizationApi.FindOrganization)         // 根据ID获取Organization
 		organizationRouter.GET("findOrganizationTree", organizationApi.FindOrganizationTree) // 根据ID获取Organization
-		organizationRouter.GET("getOrganizationList", organizationApi.GetOrganizationList)   // 获取Organization列表
 		//contentRouter.GET("findContent", contentApi.FindContent) // 根据ID获取Content
 	}
 }

+ 3 - 0
server/service/autocode/organization.go

@@ -51,6 +51,9 @@ func (organizationService *OrganizationService) GetOrganizationInfoList(info aut
 	offset := info.PageSize * (info.Page - 1)
 	// 创建db
 	db := global.GVA_DB.Model(&autocode.Organization{})
+	if info.PARENTCODE != "" {
+		db.Where("PARENT_CODE=?", info.PARENTCODE)
+	}
 	var organizations []autocode.Organization
 	// 如果有条件搜索 下方会自动创建搜索语句
 	err = db.Count(&total).Error

+ 1 - 1
web/src/api/organization.js

@@ -74,7 +74,7 @@ export const updateOrganization = (data) => {
 // @Router /organization/findOrganization [get]
 export const findOrganization = (params) => {
   return service({
-    url: '/organization/findOrganization',
+    url: '/organization/findOrganizationP',
     method: 'get',
     params
   })

+ 14 - 17
web/src/view/organization/organization.vue

@@ -28,12 +28,9 @@
       @selection-change="handleSelectionChange"
     >
       <el-table-column type="selection" width="55" />
-      <el-table-column label="日期" width="180">
-        <template #default="scope">{{ formatDate(scope.row.CreatedAt) }}</template>
-      </el-table-column>
-      <el-table-column label="区域编码" prop="CODE" />
-      <el-table-column label="区域名称" prop="NAME" />
-      <el-table-column label="上级区域" prop="PARENTCODE" />
+      <el-table-column label="区域编码" prop="code" />
+      <el-table-column label="区域名称" prop="name" />
+      <el-table-column label="上级区域" prop="parentcode" />
       <el-table-column label="optimistic字段" prop="optimistic" />
       <el-table-column label="中心点" prop="postition" />
       <el-table-column label="按钮组">
@@ -56,13 +53,13 @@
     <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" title="弹窗操作">
       <el-form :model="formData" label-position="right" label-width="80px">
         <el-form-item label="CODE字段:">
-          <el-input v-model="formData.CODE" clearable placeholder="请输入" />
+          <el-input v-model="formData.code" clearable placeholder="请输入" />
         </el-form-item>
         <el-form-item label="NAME字段:">
-          <el-input v-model="formData.NAME" clearable placeholder="请输入" />
+          <el-input v-model="formData.name" clearable placeholder="请输入" />
         </el-form-item>
         <el-form-item label="PARENTCODE字段:">
-          <el-input v-model="formData.PARENTCODE" clearable placeholder="请输入" />
+          <el-input v-model="formData.parentcode" clearable placeholder="请输入" />
         </el-form-item>
         <el-form-item label="optimistic字段:">
           <el-input v-model.number="formData.optimistic" clearable placeholder="请输入" />
@@ -99,9 +96,9 @@ export default {
       deleteVisible: false,
       multipleSelection: [],
       formData: {
-        CODE: '',
-        NAME: '',
-        PARENTCODE: '',
+        code: '',
+        name: '',
+        parentcode: '',
         optimistic: 0,
       }
     }
@@ -155,7 +152,7 @@ export default {
       }
     },
     async updateOrganization(row) {
-      const res = await findOrganization({ ID: row.ID })
+      const res = await findOrganization({ code: row.code })
       this.type = 'update'
       if (res.code === 0) {
         this.formData = res.data.reorganization
@@ -165,14 +162,14 @@ export default {
     closeDialog() {
       this.dialogFormVisible = false
       this.formData = {
-        CODE: '',
-        NAME: '',
-        PARENTCODE: '',
+        code: '',
+        name: '',
+        parentcode: '',
         optimistic: 0,
       }
     },
     async deleteOrganization(row) {
-      const res = await deleteOrganization({ ID: row.ID })
+      const res = await deleteOrganization({ code: row.code })
       if (res.code === 0) {
         this.$message({
           type: 'success',