qymljy 2 سال پیش
والد
کامیت
1699a6a2cc

+ 8 - 2
src/HManagement/addressList/addressBook/index.vue

@@ -12,7 +12,7 @@
       </template>
       <template #tableLeft style="padding: 0">
         <div style="margin: 0;padding: 0;min-width: 320px;max-width: 320px;">
-          <myGroup></myGroup>
+          <myGroup @clickGroup="clickGroup"></myGroup>
         </div>
       </template>
       <template v-slot:tbList="scope">
@@ -43,7 +43,7 @@
 
 <script>
 import normalBook from "@/components/normal-basic-layout/normalBook";
-import myGroup from '../mycontact/modules/group';
+import myGroup from '../mycontact/index';
 export default {
   name: "index",
   components:{normalBook,myGroup},
@@ -83,6 +83,12 @@ export default {
         }
       })
     },
+    clickGroup(val){
+      console.log(val,'1111')
+      this.$refs.basicLayout.param.content.groupname = val.groupname
+      this.$refs.basicLayout.param.content.sys_phonebookgroupid = val.sys_phonebookgroupid
+      this.listData()
+    }
   },
   mounted() {
     this.listData()

+ 5 - 4
src/HManagement/addressList/mycontact/index.vue

@@ -3,7 +3,7 @@
     <div class="flex-align-stretch" >
 
       <group ref="grouplist" :data="list" @setGroupData="setGroupData" @clickGroup="clickGroup">
-        <add-contact :tagList="tagList" v-if="tool.checkAuth($route.name,'addContact')" slot="addContact" :group="group" @onAddSuccess="onAddSuccess"></add-contact>
+<!--        <add-contact :tagList="tagList" v-if="tool.checkAuth($route.name,'addContact')" slot="addContact" :group="group" @onAddSuccess="onAddSuccess"></add-contact>-->
         <add-group v-if="tool.checkAuth($route.name,'addGroup')" slot="addGroup" @onSuccess="onAddSuccess"></add-group>
         <template v-slot:edit="scope">
           <editGroup v-if="tool.checkAuth($route.name,'editGroup')" :data="scope.data" @onSuccess="onAddSuccess"></editGroup>
@@ -124,8 +124,9 @@ export default {
       this.allGroup = all
 
     },
-    clickGroup (val,allData) {
-      this.$refs.contacts.condition = ''
+    clickGroup (val) {
+      this.$emit('clickGroup',val)
+     /* this.$refs.contacts.condition = ''
       this.$refs.contacts.tag = ''
       this.editIndex = ''
       this.groupname = val.groupname
@@ -138,7 +139,7 @@ export default {
         this.tagsList = this.tags.project.map(item=>item.tag)
       }else {
         this.tagsList = this.tags.phonebook.map(item=>item.tag)
-      }
+      }*/
      /* this.allData = allData*/
     },
     clickContacts (val) {

+ 381 - 0
src/HManagement/addressList/mycontact/index2.vue

@@ -0,0 +1,381 @@
+<template>
+  <div>
+    <div class="flex-align-stretch" >
+
+      <group ref="grouplist" :data="list" @setGroupData="setGroupData" @clickGroup="clickGroup">
+<!--        <add-contact :tagList="tagList" v-if="tool.checkAuth($route.name,'addContact')" slot="addContact" :group="group" @onAddSuccess="onAddSuccess"></add-contact>-->
+        <add-group v-if="tool.checkAuth($route.name,'addGroup')" slot="addGroup" @onSuccess="onAddSuccess"></add-group>
+        <template v-slot:edit="scope">
+          <editGroup v-if="tool.checkAuth($route.name,'editGroup')" :data="scope.data" @onSuccess="onAddSuccess"></editGroup>
+        </template>
+        <template v-slot:del="scope">
+          <delGroup v-if="tool.checkAuth($route.name,'deleteGroup')" :data="scope.data" @onSuccess="onAddSuccess"></delGroup>
+        </template>
+      </group>
+
+      <contacts style="flex:1 0 auto" :data="activeGroupData" :tags="tagsList" :activeContactsData="activeContactsData" :editIndex="editIndex" ref="contacts" @clickContacts="clickContacts" @filtetContacts="filtetContacts"></contacts>
+      <detail :activeContactsData="activeContactsData">
+        <template v-slot:edit="data">
+          <edit :tagList="tagList" v-if="tool.checkAuth($route.name,'update') && !(usertype === 0 && (groupname === '客户联系人' || groupname === '项目联系人')) " :data="data" :group="group" :allGroup="allGroup" :tagsList="tagsList" @onEditSuccess="onEditSuccess"></edit>
+        </template>
+        <template v-slot:del="data">
+          <ondel v-if="tool.checkAuth($route.name,'delete') && !(usertype === 0 && (groupname === '客户联系人' || groupname === '项目联系人'))" :data="data" @onDelSuccess="onDelSuccess"></ondel>
+        </template>
+      </detail>
+
+
+
+    </div>
+  </div>
+</template>
+
+<script>
+import addContact from './modules/addContact.vue'
+import addGroup from './modules/addGroup.vue'
+import group from './modules/group.vue'
+import contacts from './modules/contacts.vue'
+import detail from './modules/detail.vue'
+import edit from './modules/edit.vue'
+
+import  editGroup from './modules/editGroup.vue'
+import  delGroup from './modules/delGroup.vue'
+
+import ondel from './modules/del.vue'
+
+export default {
+  components:{
+    addContact,
+    addGroup,
+    group,
+    contacts,
+    detail,
+    ondel,
+    edit,
+    editGroup,
+    delGroup
+  },
+  data () {
+    return {
+      usertype:JSON.parse(sessionStorage.getItem('active_account')).usertype,
+      group:[],
+      allGroup:[],
+      activeGroupData:[],
+      activeContactsData:null,
+      tagList:[],
+      allData:[],
+      list:[],
+      editIndex:'',
+      type:'',
+      condition:'',
+      tag:[],
+      groupname:'',
+      tagsList:[],
+      tags:{
+        project:[],
+        custom:[],
+        phonebook:[],
+        allTags:[]
+      },
+      param:{
+        "id": "20220831164603",
+        "content": {
+          "nocache":true,
+          "where":{
+            "condition":"",
+            "groupname":"",
+            "tag":[]
+          }
+        }
+      },
+      paramTag:{
+        "id":"20220929085401",
+        "content":{
+          "nocache":true,
+          "ownertable":"",
+          "ownerid":0,
+        }
+      }
+    }
+  },
+  methods:{
+    async listData(){
+      console.log(this.tag,'tag编辑结果')
+      const res = await this.$api.requested(this.param)
+      this.list = res.data
+      this.$nextTick(()=>{
+        this.$refs.grouplist.listData()
+        /*this.filtetContacts(this.type,this.condition,this.tag)*/
+      })
+
+    },
+    onAddSuccess () {
+      this.listData()
+
+    },
+    onEditSuccess (form) {
+
+      this.editIndex = form.index
+      this.listData()
+
+
+    },
+    setGroupData (val,all) {
+      this.group = val
+      this.allGroup = all
+
+    },
+    clickGroup (val) {
+      this.$refs.contacts.condition = ''
+      this.$refs.contacts.tag = ''
+      this.editIndex = ''
+      this.groupname = val.groupname
+      this.activeGroupData = val.phonebook
+      this.activeContactsData = null
+
+      if (this.groupname === '客户联系人'){
+        this.tagsList = this.tags.custom.map(item=>item.tag)
+      }else if(this.groupname === '项目联系人'){
+        this.tagsList = this.tags.project.map(item=>item.tag)
+      }else {
+        this.tagsList = this.tags.phonebook.map(item=>item.tag)
+      }
+     /* this.allData = allData*/
+    },
+    clickContacts (val) {
+
+      this.activeContactsData = val
+    },
+    onDelSuccess (id) {
+      this.listData()
+
+    },
+    async contractList(){
+      const res = await this.$api.requested(this.param)
+      if (res.data){
+        res.data.forEach(item=>{
+          if (item.groupname === this.groupname){
+            this.activeGroupData = item.phonebook
+          }
+        })
+      }
+    },
+    filtetContacts (type,val,tag) {
+      this.type = type
+      this.condition = val
+      this.param.content.where.groupname = this.groupname
+      this.param.content.where.tag = tag
+      this.param.content.where.condition = val
+      this.tag = tag
+      this.contractList()
+      /*if (this.groupname){
+        let allData = []
+        this.list.forEach(item=>{
+
+          if (item.groupname === this.groupname){
+            allData = item
+            return
+          }
+
+        })
+
+        if (type === 'name'){
+
+          this.activeGroupData = allData.phonebook.filter(item=>{
+            return item.name.toLowerCase().includes(val.toLowerCase())
+          })
+          if (tag){
+            let selectData = []
+            let index = 0
+            this.activeGroupData.forEach(item=>{
+              item.tag.forEach(e=>{
+                if (e === tag) {
+                  selectData[index] = item
+                  index = index + 1
+                  return
+                }
+              })
+            })
+            this.activeGroupData = selectData
+
+          }else {
+
+          }
+
+        }else if(type === 'phonenumber'){
+          this.activeGroupData = allData.phonebook.filter(item=>{
+            return item.phonenumber.toLowerCase().includes(val.toLowerCase())
+          })
+          if (tag){
+            let selectData = []
+            let index = 0
+            this.activeGroupData.forEach(item=>{
+              item.tag.forEach(e=>{
+                if (e === tag) {
+                  selectData[index] = item
+                  index = index + 1
+                  return
+                }
+              })
+            })
+            this.activeGroupData = selectData
+
+          }else {
+
+          }
+        }else if(type === 'reset'){
+          this.groupname = ''
+          this.activeGroupData = []
+          this.$refs.grouplist.active = ''
+          this.tagsList = this.tags.allTags
+        } else {
+          this.activeGroupData = allData.phonebook
+          if (tag){
+            let selectData = []
+            let index = 0
+            this.activeGroupData.forEach(item=>{
+              item.tag.forEach(e=>{
+                if (e === tag) {
+                  selectData[index] = item
+                  index = index + 1
+                  return
+                }
+              })
+            })
+            this.activeGroupData = selectData
+
+          }else {
+
+          }
+        }
+      }else {
+
+        let allData = []
+        this.list.forEach((item)=>{
+          allData = allData.concat(item.phonebook)
+        })
+
+        if (type === 'name'){
+
+          this.activeGroupData = allData.filter(item=>{
+            return item.name.toLowerCase().includes(val.toLowerCase())
+          })
+          if (tag){
+            let selectData = []
+            let index = 0
+            this.activeGroupData.forEach(item=>{
+              item.tag.forEach(e=>{
+                if (e === tag) {
+                  selectData[index] = item
+                  index = index + 1
+                  return
+                }
+              })
+            })
+            this.activeGroupData = selectData
+
+          }else {
+
+          }
+        }else if(type === 'phonenumber'){
+          this.activeGroupData = allData.filter(item=>{
+            return item.phonenumber.toLowerCase().includes(val.toLowerCase())
+          })
+          if (tag){
+            let selectData = []
+            let index = 0
+            this.activeGroupData.forEach(item=>{
+              item.tag.forEach(e=>{
+                if (e === tag) {
+                  selectData[index] = item
+                  index = index + 1
+                  return
+                }
+              })
+            })
+            this.activeGroupData = selectData
+
+          }else {
+
+          }
+        }else if(type === 'reset'){
+          this.groupname = ''
+          this.activeGroupData = []
+          this.tagsList = this.tags.allTags
+        }else {
+          this.activeGroupData = allData
+          if (tag){
+            let selectData = []
+            let index = 0
+            this.activeGroupData.forEach(item=>{
+              item.tag.forEach(e=>{
+                if (e === tag) {
+                  selectData[index] = item
+                  index = index + 1
+                  return
+                }
+              })
+            })
+            this.activeGroupData = selectData
+
+          }else {
+            this.activeGroupData = []
+
+          }
+
+        }*/
+      /*}*/
+
+
+
+
+    },
+    async getTagList () {
+      let res = await this.$api.requested({
+        "id": 20220929085401,
+        "content": {
+            "ownertable":"sys_phonebook",
+            "ownerid":102
+        }
+      })
+      this.tagList = res.data.option
+      console.log(this.tagList)
+    },
+    async projectTag(){
+      this.paramTag.content.ownertable = 'sa_project_contacts'
+      const res = await this.$api.requested(this.paramTag)
+
+      this.tags.project = res.data.option
+
+      this.tags.allTags = this.tags.allTags.concat(this.tags.project)
+      this.customTag()
+    },
+    async customTag(){
+      this.paramTag.content.ownertable = 'plm_unit'
+      const res = await this.$api.requested(this.paramTag)
+
+      this.tags.custom = res.data.option
+      this.tags.allTags = this.tags.allTags.concat(this.tags.custom)
+      this.phonebookTag()
+    },
+    async phonebookTag(){
+      this.paramTag.content.ownertable = 'sys_phonebook'
+      const res = await this.$api.requested(this.paramTag)
+      this.tags.phonebook = res.data.option
+      this.tags.allTags = this.tags.allTags.concat(this.tags.phonebook)
+
+      this.tags.allTags = this.tags.allTags.map(item=>item.tag)
+      this.tags.allTags = [...new Set(this.tags.allTags)]
+      this.tagsList = this.tags.allTags
+
+    }
+  },
+  mounted () {
+    this.getTagList()
+    this.listData()
+    this.projectTag()
+  }
+}
+
+</script>
+<style>
+</style>

+ 4 - 3
src/HManagement/addressList/mycontact/modules/group.vue

@@ -1,8 +1,8 @@
 <template>
   <div class="normal-panel scroll-panel" style="width:400px">
     <div style="margin-bottom:30px">
-      <div style="display:flex;align-items:center;justify-content:space-between">
-        <p class="container normal-title" style="margin:5px 0">系统群组</p>
+      <div style="display:flex;align-items:flex-start;justify-content:space-between">
+        <p class="container normal-title">系统群组</p>
         <div style="margin-right:16px"><slot name="addContact"></slot></div>
       </div>
       <ul>
@@ -77,8 +77,9 @@ export default {
     },
 
     clickGroup (item) {
+      console.log(item,'选择的群组')
       this.active = item.rowindex
-      this.$emit('clickGroup',item,this.allData)
+      this.$emit('clickGroup',item)
     }
   },
   mounted () {

+ 1 - 1
src/HManagement/addressList/mygroup/modules/list.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="container normal-panel" style="padding-top: 0">
     <div style="margin-bottom:30px">
-      <p class="normal-title normal-margin">系统群组</p>
+<!--      <p class="normal-title normal-margin">系统群组</p>-->
       <ul>
         <li v-for="item in sysGroup" :key="item.index" class="pd-t-b flex-align-center flex-between">
           <div class="flex-align-stretch">

+ 1 - 1
src/components/normal-basic-layout/normalBook.vue

@@ -43,7 +43,7 @@
           <slot name="custom-right"></slot>
         </div>
       </div>
-      <div class="normal-panel " style="padding:16px;">
+      <div class="normal-panel " style="padding-right:16px;">
         <div style="display: flex;">
           <slot name="tableLeft"></slot>
           <div style="flex: 1;width: 70%" v-if="listType === 'table' && refreshTable">