|
|
@@ -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>
|