Browse Source

部门管理扩展联系人 电话 地址

Liuqi 6 years ago
parent
commit
d6de78c5c9

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

@@ -17,6 +17,8 @@ type Base_Organize struct {
 	Fax               string    `xorm:"VARCHAR(50)"`
 	Postalcode        string    `xorm:"VARCHAR(50)"`
 	Address           string    `xorm:"VARCHAR(50)"`
+	Contacts          string    `xorm:"VARCHAR(50)"`
+	Phone             string    `xorm:"VARCHAR(100)"`
 	Web               string    `xorm:"VARCHAR(50)"`
 	Bank              string    `xorm:"VARCHAR(50)"`
 	Bankaccount       string    `xorm:"VARCHAR(50)"`
@@ -53,6 +55,9 @@ type Base_Orgatree struct {
 type Base_Organizebandparentname struct {
 	Id          int
 	Parentid    int
+	Phone  string
+	Address     string
+	Contacts    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 from Base_Organize a
+	sql = `select a.*,b.Fullname Parentname,a.Phone Phone,a.Address Address,a.Contacts Contacts 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)

+ 10 - 1
src/dashoo.cn/backend/api/controllers/casbin/organize.go

@@ -24,6 +24,9 @@ type OrganizesController struct {
 type OrganizeModel struct {
 	Parentid        int    `json:"parentid"`
 	Fullname        string `json:"fullname"`
+	Contacts        string `json:"Contacts"`
+	Phone        string `json:"Phone"`
+	Address        string `json:"Address"`
 	Description     string `json:"description"`
 	HaveChild       int    `json:"havechild"`
 	IsInnerOrganize int
@@ -153,6 +156,9 @@ func (this *OrganizesController) AddOrganize() {
 	// 编辑后添加一条数据
 	entity.Fullname = model.Fullname
 	entity.Parentid = model.Parentid
+	entity.Contacts = model.Contacts
+	entity.Phone = model.Phone
+	entity.Address = model.Address
 	entity.Description = model.Description
 	entity.Createuserid, _ = utils.StrTo(this.User.Id).Int()
 	entity.Createby = this.User.Realname
@@ -206,10 +212,13 @@ func (this *OrganizesController) EditOrganize() {
 	if has {
 		entity.Fullname = model.Fullname
 		entity.Parentid = model.Parentid
+		entity.Contacts = model.Contacts
+		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", "Modifieduserid", "Modifiedby"}
+		var cols []string = []string{"Fullname", "Parentid", "Description","Contacts","Phone","Address","Modifieduserid", "Modifiedby"}
 		err := svc.UpdateEntityAndBackupByCols(id, &entity, &entityempty, cols, utils.ToStr(this.User.Id), this.User.Realname)
 
 		if err == nil {

+ 48 - 28
src/dashoo.cn/frontend_web/src/pages/system/organize.vue

@@ -52,6 +52,9 @@
             </el-table-column>
             <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="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>
             <el-table-column label="操作时间" align="center" prop="Modifiedon">
               <template slot-scope="scope">
@@ -76,6 +79,15 @@
         <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-input v-model="organizeform.Contacts" auto-complete="off"></el-input>
+        </el-form-item>
+        <el-form-item label="电话" label-width="120px">
+          <el-input v-model="organizeform.Phone" auto-complete="off"></el-input>
+        </el-form-item>
+        <el-form-item label="地址" label-width="120px">
+          <el-input v-model="organizeform.Address" auto-complete="off"></el-input>
+        </el-form-item>
         <el-form-item label="描述" label-width="120px">
           <el-input type="textarea" v-model="organizeform.description" auto-complete="off"></el-input>
         </el-form-item>
@@ -114,7 +126,7 @@
   export default {
     name: 'organize',
 
-    data() {
+    data () {
       return {
         loading: false,
         loadingTmp: false,
@@ -134,6 +146,9 @@
           parentid: 0,
           fullname: '',
           description: '',
+          Contacts: '',
+          Phone: '',
+          Address: '',
           id: 0
         },
         rulesorganize: {
@@ -172,20 +187,20 @@
       }
     },
 
-    created() {
+    created () {
       // initial data
       this.initData()
       this.getorgtreelist()
       this.userdepartment.push(parseInt(this.authUser.Profile.DepartmentId))
       this.selectedorg = [parseInt(this.authUser.Profile.DepartmentId)]
     },
-    updated() {},
+    updated () {},
     watch: {},
     computed: mapGetters({
       authUser: 'authUser'
     }),
     methods: {
-      initData() {
+      initData () {
         let _this = this
         // paginate
         let params = {
@@ -197,8 +212,8 @@
         }
         // request
         this.$axios.get('organizes/listbandparentname', {
-            params
-          })
+          params
+        })
           .then(res => {
             // response
             _this.tablelist = res.data.items
@@ -218,15 +233,15 @@
         //     })
         //   }).catch(() => {})
       },
-      getorgtreelist() {
+      getorgtreelist () {
         let _this = this
         // request
         let params = {
           IsInnerOrganize: this.organizeform.IsInnerOrganize
         }
         _this.$axios.get('organizes/list', {
-            params
-          })
+          params
+        })
           .then(res => {
             _this.orgtreelist = window.toolfun_gettreejson(res.data.items, 'Id', 'Parentid', 'Id,Fullname')
           })
@@ -235,16 +250,16 @@
             console.error(err)
           })
       },
-      orgtreeNodeClick(data) {
+      orgtreeNodeClick (data) {
         this.parentid = data.id + ''
         this.currentPage = 1
         this.initData()
       },
-      seachdata() {
+      seachdata () {
         this.currentPage = 1
         this.initData()
       },
-      permission(v) {
+      permission (v) {
         this.binddevices = []
         this.permissiondialogtitle = '权限设置'
         this.permissiondatadialogVisible = true
@@ -262,12 +277,12 @@
             console.error(err)
           })
       },
-      savepermission() {
+      savepermission () {
         let _this = this
         _this.$axios.put('/equipment/permission/' + this.currId, {
-            EquipmentIds: this.binddevices + '',
-            OrganizeName: this.currOrganName
-          })
+          EquipmentIds: this.binddevices + '',
+          OrganizeName: this.currOrganName
+        })
           .then(res => {
             // response
             if (res.data.code === 0) {
@@ -285,12 +300,12 @@
           })
           .catch(() => {})
       },
-      handleSizeChange(value) {
+      handleSizeChange (value) {
         this.size = value
         this.currentPage = 1
         this.initData()
       },
-      handleCurrentChange(value) {
+      handleCurrentChange (value) {
         this.currentPage = value
         this.initData()
       },
@@ -312,7 +327,7 @@
         _this.syncOrgLoading = true
         rtxApi.syncOrganize(this.$axios).then(res => {
           _this.syncOrgLoading = false
-          //response
+          // response
           if (res.data.items) {
             this.$message({
               type: 'success',
@@ -339,7 +354,7 @@
         val = val.replace('T', ' ')
         return val.substring(0, 19)
       },
-      opendatadialog(item, v, index) {
+      opendatadialog (item, v, index) {
         this.operatingitem = item
         this.datadialogVisible = true
         this.clearorganizeform()
@@ -378,6 +393,9 @@
                 _this.dialogtitle = `编辑组织信息(${v.Fullname})`
                 _this.organizeform.parentid = v.Parentid
                 _this.organizeform.fullname = v.Fullname
+                _this.organizeform.Contacts = v.Contacts
+                _this.organizeform.Phone = v.Phone
+                _this.organizeform.Address = v.Address
                 _this.organizeform.description = v.Description
                 _this.organizeform.id = v.Id
                 // 选中状态
@@ -402,7 +420,7 @@
             })
         }
       },
-      savedata(formName) {
+      savedata (formName) {
         let _this = this
         this.$refs[formName].validate((valid) => {
           if (valid) {
@@ -475,7 +493,7 @@
           }
         })
       },
-      deletedata(val) {
+      deletedata (val) {
         let _this = this
         _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
           confirmButtonText: '确定',
@@ -514,29 +532,31 @@
           //   .catch(() => {})
         }).catch(() => {})
       },
-      resetForm(formName) {
-        //this.$refs[formName].resetFields()
+      resetForm (formName) {
+        // this.$refs[formName].resetFields()
       },
-      clearorganizeform() {
+      clearorganizeform () {
         this.organizeform = {
           parentid: 0,
           fullname: '',
+          Contacts: '',
+          Phone: '',
+          Address: '',
           description: '',
           id: 0
         }
       },
-      searchCommand(command) {
+      searchCommand (command) {
         if (command == 'clear') {
           this.clearSearch()
         }
       },
-      clearSearch() {
+      clearSearch () {
         this.keyword = ''
         this.initData()
       }
     }
   }
-
 </script>
 
 <style lang="scss">