Browse Source

添加组织管理单位级别字段和输入

Liuqi 6 years ago
parent
commit
dd901f0514

+ 1 - 0
src/dashoo.cn/backend/api/business/organize/organize.go

@@ -58,6 +58,7 @@ type Base_Organizebandparentname struct {
 	Phone  string
 	Address     string
 	Contacts    string
+	Category    string
 	Fullname    string
 	Description string
 	Createon    time.Time

+ 1 - 1
src/dashoo.cn/backend/api/business/organize/organizeService.go

@@ -90,7 +90,7 @@ func (s *OrganizeService) GetListbandparentname(pageIndex, itemsPerPage int64, o
 	if pageIndex > 0 {
 		limitstr = ` limit ` + utils.ToStr((pageIndex-1)*itemsPerPage) + "," + utils.ToStr(itemsPerPage)
 	}
-	sql = `select a.*,b.Fullname Parentname,a.Phone Phone,a.Address Address,a.Contacts Contacts from Base_Organize a
+	sql = `select a.*,b.Fullname Parentname,a.Phone Phone,a.Address Address,a.Contacts Contacts, a.Category Category from Base_Organize a
 		left join Base_Organize b on a.ParentId=b.Id
 		where ` + searchstring + ` order by ` + order + limitstr
 	List := make([]Base_Organizebandparentname, 0)

+ 6 - 3
src/dashoo.cn/backend/api/controllers/casbin/organize.go

@@ -25,8 +25,9 @@ type OrganizeModel struct {
 	Parentid        int    `json:"parentid"`
 	Fullname        string `json:"fullname"`
 	Contacts        string `json:"Contacts"`
-	Phone        string `json:"Phone"`
-	Address        string `json:"Address"`
+	Category        string `json:"Category"`
+	Phone           string `json:"Phone"`
+	Address         string `json:"Address"`
 	Description     string `json:"description"`
 	HaveChild       int    `json:"havechild"`
 	IsInnerOrganize int
@@ -157,6 +158,7 @@ func (this *OrganizesController) AddOrganize() {
 	entity.Fullname = model.Fullname
 	entity.Parentid = model.Parentid
 	entity.Contacts = model.Contacts
+	entity.Category = model.Category
 	entity.Phone = model.Phone
 	entity.Address = model.Address
 	entity.Description = model.Description
@@ -213,12 +215,13 @@ func (this *OrganizesController) EditOrganize() {
 		entity.Fullname = model.Fullname
 		entity.Parentid = model.Parentid
 		entity.Contacts = model.Contacts
+		entity.Category = model.Category
 		entity.Phone = model.Phone
 		entity.Address = model.Address
 		entity.Description = model.Description
 		entity.Modifieduserid, _ = utils.StrTo(this.User.Id).Int()
 		entity.Modifiedby = this.User.Realname
-		var cols []string = []string{"Fullname", "Parentid", "Description","Contacts","Phone","Address","Modifieduserid", "Modifiedby"}
+		var cols []string = []string{"Fullname", "Parentid", "Description","Contacts","Phone","Category","Address","Modifieduserid", "Modifiedby"}
 		err := svc.UpdateEntityAndBackupByCols(id, &entity, &entityempty, cols, utils.ToStr(this.User.Id), this.User.Realname)
 
 		if err == nil {

+ 38 - 0
src/dashoo.cn/frontend_web/src/pages/system/organize.vue

@@ -53,6 +53,7 @@
             <el-table-column prop="Fullname" align="center" label="组织名称" show-overflow-tooltip></el-table-column>
             <el-table-column prop="Parentname" align="center" label="上级组织" show-overflow-tooltip></el-table-column>
             <el-table-column prop="Contacts" align="center" label="联系人" show-overflow-tooltip></el-table-column>
+            <el-table-column prop="Category" align="center" label="单位级别" show-overflow-tooltip :formatter="formatUnit"></el-table-column>
             <el-table-column prop="Phone" align="center" label="联系电话" show-overflow-tooltip></el-table-column>
             <el-table-column prop="Address" align="center" label="地址" show-overflow-tooltip></el-table-column>
             <el-table-column prop="Description" align="center" label="备注" show-overflow-tooltip></el-table-column>
@@ -79,6 +80,16 @@
         <el-form-item label="组织名称" prop="fullname" label-width="120px">
           <el-input v-model="organizeform.fullname" auto-complete="off"></el-input>
         </el-form-item>
+        <el-form-item label="所在单位级别"  label-width="120px">
+            <el-select v-model="unitvalue" placeholder="请选择">
+              <el-option
+                v-for="item in unitoptions"
+                :key="item.unitvalue"
+                :label="item.unitlabel"
+                :value="item.unitvalue">
+              </el-option>
+            </el-select>
+        </el-form-item>      
         <el-form-item label="联系人" label-width="120px">
           <el-input v-model="organizeform.Contacts" auto-complete="off"></el-input>
         </el-form-item>
@@ -128,6 +139,17 @@
 
     data () {
       return {
+        unitoptions: [{
+          unitvalue: '',
+          unitlabel: '无'
+        }, {
+          unitvalue: 'unit',
+          unitlabel: '二级单位'
+        }, {
+          unitvalue: 'ThrUnit',
+          unitlabel: '三级单位'
+        }],
+        unitvalue: '',
         loading: false,
         loadingTmp: false,
         syncOrgLoading: false,
@@ -145,6 +167,7 @@
           IsInnerOrganize: 1,
           parentid: 0,
           fullname: '',
+          Category: '',
           description: '',
           Contacts: '',
           Phone: '',
@@ -390,10 +413,12 @@
           this.$axios.get('organizes/parentlist/' + v.Parentid, {})
             .then(res => {
               if (res.data.code === 0) {
+                console.log(_this.organizeform)
                 _this.dialogtitle = `编辑组织信息(${v.Fullname})`
                 _this.organizeform.parentid = v.Parentid
                 _this.organizeform.fullname = v.Fullname
                 _this.organizeform.Contacts = v.Contacts
+                _this.unitvalue = v.Category
                 _this.organizeform.Phone = v.Phone
                 _this.organizeform.Address = v.Address
                 _this.organizeform.description = v.Description
@@ -422,6 +447,7 @@
       },
       savedata (formName) {
         let _this = this
+        _this.organizeform.Category = _this.unitvalue
         this.$refs[formName].validate((valid) => {
           if (valid) {
             _this.organizeform.parentid = parseInt(_this.selectedorg[_this.selectedorg.length - 1])
@@ -465,6 +491,7 @@
                   console.error(err)
                 })
             } else if (_this.operatingitem === 2) {
+              _this.organizeform.Category = _this.unitvalue
               _this.organizeform.IsInnerOrganize = 1
               _this.$axios.put('organizes/' + _this.organizeform.id, _this.organizeform)
                 .then(res => {
@@ -540,11 +567,13 @@
           parentid: 0,
           fullname: '',
           Contacts: '',
+          Category: '',
           Phone: '',
           Address: '',
           description: '',
           id: 0
         }
+        this.unitvalue = ''
       },
       searchCommand (command) {
         if (command == 'clear') {
@@ -554,6 +583,15 @@
       clearSearch () {
         this.keyword = ''
         this.initData()
+      },
+      formatUnit (row, column) {
+        if (row.Category === '') {
+          return ''
+        } else if (row.Category === 'unit') {
+          return '二级单位'
+        } else {
+          return '三级单位'
+        }
       }
     }
   }