|
@@ -0,0 +1,321 @@
|
|
|
+<template>
|
|
|
+ <basicDetails
|
|
|
+ ref="detailsRef"
|
|
|
+ :titleText="mainData.name"
|
|
|
+ :editData="mainData"
|
|
|
+ :mainAreaData="mainAreaData"
|
|
|
+ :isGroup="false"
|
|
|
+ :turnPageId="20220914135203"
|
|
|
+ :ownertable="mainData.groupname == '客户联系人'?'sys_enterprise_contacts':mainData.groupname == '项目联系人'?'sa_project_contacts':'sys_phonebook'"
|
|
|
+ :idname="mainData.groupname == '客户联系人'?'contactsid':mainData.groupname == '项目联系人'?'sa_project_contactsid':'sys_phonebookid'"
|
|
|
+ :ownerid="mainData.groupname == '客户联系人'?mainData.contactsid:mainData.groupname == '项目联系人'?mainData.sa_project_contactsid:$route.query.id"
|
|
|
+ :tabs="['详细信息','关联客户','关联项目']"
|
|
|
+ :pageChange="true"
|
|
|
+ @teamList="teamList"
|
|
|
+ >
|
|
|
+ <template slot="customOperation">
|
|
|
+ <edit class="inline-16" v-if="tool.checkAuth($route.name,'update')" :data="mainData" :group="group" :tagList="tagList" :disabled="mainData.disabled" @onEditSuccess="queryMainData();$refs.detailsRef.$refs.tag.queryTag()"></edit>
|
|
|
+ <el-button class="inline-16" v-if="tool.checkAuth($route.name,'delete')" :type="!mainData.disabled?'':'primary'" size="mini" @click="onDel" :disabled="!mainData.disabled">删 除</el-button>
|
|
|
+ </template>
|
|
|
+ <div slot="slot0">
|
|
|
+ <detailed :detailData="mainData"></detailed>
|
|
|
+ </div>
|
|
|
+ <div slot="slot1">
|
|
|
+ <customerData :data="mainData"></customerData>
|
|
|
+ </div>
|
|
|
+ <div slot="slot2">
|
|
|
+ <projectData :data="mainData"></projectData>
|
|
|
+ </div>
|
|
|
+ </basicDetails>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import detailed from '../modules/detailsData'
|
|
|
+import customerData from '../modules/customerData'
|
|
|
+import projectData from '../modules/projectData'
|
|
|
+import basicDetails from '@/components/normal-basic-layout-new/details/index'
|
|
|
+import edit from '../modules/edit'
|
|
|
+import {mapGetters} from "vuex";
|
|
|
+export default {
|
|
|
+ name: "index",
|
|
|
+ components:{detailed,customerData,projectData,edit,basicDetails},
|
|
|
+ data(){
|
|
|
+ return {
|
|
|
+ mainData: {
|
|
|
+ disabled:false,
|
|
|
+ },
|
|
|
+ mainAreaData:'',
|
|
|
+ groupParam:{
|
|
|
+ "id": "20220831164303",
|
|
|
+ "content": {
|
|
|
+ "nocache":true,
|
|
|
+ "where":{
|
|
|
+ "condition":"",
|
|
|
+ "groupname":"",
|
|
|
+ "tag":[]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ group:[],
|
|
|
+ tagList:[],
|
|
|
+ teamData:[],
|
|
|
+ userInfo:JSON.parse(window.sessionStorage.getItem('active_account')),
|
|
|
+ agentData:[],
|
|
|
+ ownertable:'',
|
|
|
+ idname:''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch:{
|
|
|
+ async teamData(val){
|
|
|
+ /*if (this.mainData.groupname == '客户联系人'){
|
|
|
+ this.ownertable = 'sys_enterprise_contacts'
|
|
|
+ this.idname = "contactsid"
|
|
|
+ }else if (this.mainData.groupname == '客户联系人'){
|
|
|
+ this.ownertable = 'sa_project_contacts'
|
|
|
+ this.idname = "sa_project_contactsid"
|
|
|
+ }else {
|
|
|
+ this.ownertable = 'sys_phonebook'
|
|
|
+ this.idname = "sys_phonebookid"
|
|
|
+ }*/
|
|
|
+ if (this.mainData.groupname == '客户联系人'){
|
|
|
+ const agent = await this.$api.requested({
|
|
|
+ "id":20230329122604,
|
|
|
+ "content": {
|
|
|
+ "ownertable":"sys_enterprise_contacts",
|
|
|
+ "ownerid":this.mainData.contactsid
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.agentData = agent.data
|
|
|
+ }else if (this.mainData.groupname == '项目联系人'){
|
|
|
+ const agent = await this.$api.requested({
|
|
|
+ "id":20230329122604,
|
|
|
+ "content": {
|
|
|
+ "ownertable":"sa_project_contacts",
|
|
|
+ "ownerid":this.mainData.sa_project_contactsid
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.agentData = agent.data
|
|
|
+ }else {
|
|
|
+ const agent = await this.$api.requested({
|
|
|
+ "id":20230329122604,
|
|
|
+ "content": {
|
|
|
+ "ownertable":"sys_phonebook",
|
|
|
+ "ownerid":this.$route.query.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.agentData = agent.data
|
|
|
+ }
|
|
|
+ if (this.mainData.leader.length !== 0){
|
|
|
+ if (JSON.parse(window.sessionStorage.getItem('active_account')).userid === this.mainData.leader[0].userid){
|
|
|
+
|
|
|
+ this.mainData.disabled = true
|
|
|
+ }else {
|
|
|
+ let flag = 0
|
|
|
+ for (var i=0;i<val[0].team.length;i++){
|
|
|
+ if (val[0].team[i].userid === JSON.parse(window.sessionStorage.getItem('active_account')).userid){
|
|
|
+ if (val[0].team[i].editable === 1){
|
|
|
+ this.mainData.disabled = true
|
|
|
+ flag =1
|
|
|
+ break
|
|
|
+ }else {
|
|
|
+ flag = 0
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ flag === 0?this.agentData.editable === 0?this.mainData.disabled = false:this.mainData.disabled = true:this.mainData.disabled = true
|
|
|
+ this.$refs.detailsRef.$refs.group.editdataleader = this.agentData.editdataleader
|
|
|
+ }
|
|
|
+ console.log(this.mainData.disabled,'权限结果')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ async teamList(val){
|
|
|
+ this.teamData = val
|
|
|
+ },
|
|
|
+ async queryMainData(){
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": "20220914135203",
|
|
|
+ "content": {
|
|
|
+ "sys_phonebookid": this.$route.query.id,
|
|
|
+ /*"sa_project_contactsid": this.$route.query.sa_project_contactsid,*/
|
|
|
+ /*"contactsid":this.$route.query.contactsid*/
|
|
|
+ "groupname":this.$route.query.groupname
|
|
|
+ },
|
|
|
+ })
|
|
|
+ console.log(res.data,'res返回数据')
|
|
|
+ this.mainData = Object.assign({},this.mainData,res.data)
|
|
|
+ console.log(res.data.groupname,'groupname')
|
|
|
+ if (res.data.groupname == '客户联系人'){
|
|
|
+ this.$refs.detailsRef.$refs.group.queryGroupNew('sys_enterprise_contacts',res.data.contactsid)
|
|
|
+ this.$refs.detailsRef.$refs.task.listDataNew('sys_enterprise_contacts',res.data.contactsid)
|
|
|
+ this.$refs.detailsRef.$refs.follow.queryLogsNew('sys_enterprise_contacts',res.data.contactsid)
|
|
|
+ }else if (res.data.groupname == '项目联系人'){
|
|
|
+ this.$refs.detailsRef.$refs.group.queryGroupNew('sa_project_contacts',res.data.sa_project_contactsid)
|
|
|
+ this.$refs.detailsRef.$refs.task.listDataNew('sa_project_contacts',res.data.sa_project_contactsid)
|
|
|
+ this.$refs.detailsRef.$refs.follow.queryLogsNew('sa_project_contacts',res.data.sa_project_contactsid)
|
|
|
+ }else {
|
|
|
+ this.$refs.detailsRef.$refs.group.queryGroupNew('sys_phonebook',res.data.sys_phonebookid)
|
|
|
+ this.$refs.detailsRef.$refs.task.listDataNew('sys_phonebook',res.data.sys_phonebookid)
|
|
|
+ this.$refs.detailsRef.$refs.follow.queryLogsNew('sys_phonebook',res.data.sys_phonebookid)
|
|
|
+ }
|
|
|
+ this.changeDataStructure()
|
|
|
+ },
|
|
|
+ changeDataStructure () {
|
|
|
+ this.mainAreaData = [
|
|
|
+ {
|
|
|
+ label:'姓名',
|
|
|
+ value: this.mainData.name
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'联系方式',
|
|
|
+ value: this.mainData.phonenumber
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'分级',
|
|
|
+ value: this.mainData.grade
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'单位',
|
|
|
+ value: this.mainData.company
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'部门',
|
|
|
+ value: this.mainData.depname
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'职位',
|
|
|
+ value: this.mainData.position
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'群组',
|
|
|
+ value: this.mainData.groupname
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'负责人',
|
|
|
+ value: this.mainData.leader
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ async groupList(){
|
|
|
+ const res = await this.$api.requested(this.groupParam)
|
|
|
+ let k = 0
|
|
|
+ for (var i=0;i<res.data.length;i++){
|
|
|
+ if (res.data[i].groupname !== '项目联系人' && res.data[i].groupname !== '客户联系人' ){
|
|
|
+ this.group[k] = res.data[i]
|
|
|
+ k++
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(this.group,'groupList')
|
|
|
+ },
|
|
|
+ async getTagList () {
|
|
|
+ let res = await this.$api.requested({
|
|
|
+ "id": 20220929085401,
|
|
|
+ "content": {
|
|
|
+ "ownertable":"sys_phonebook",
|
|
|
+ "ownerid":102
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.tagList = res.data.option
|
|
|
+ },
|
|
|
+ onDel(){
|
|
|
+
|
|
|
+
|
|
|
+ if (this.mainData.groupname === '客户联系人'){
|
|
|
+ this.$confirm('是否确认删除当前客户的联系人?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ closeOnClickModal:false,
|
|
|
+ type: 'warning'
|
|
|
+ }).then(async () => {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": "20221018145502",
|
|
|
+ "content": {
|
|
|
+ "contactsid":this.mainData.contactsid,
|
|
|
+ "ownerid":this.mainData.sa_customersid,
|
|
|
+ "ownertable":"sa_customers",
|
|
|
+ "sys_enterpriseid":this.mainData.sys_enterpriseid
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+ this.$store.dispatch('changeDetailDrawer',false)
|
|
|
+ this.$emit('delSuccess')
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }else if (this.mainData.groupname === '项目联系人') {
|
|
|
+ this.$confirm('是否确认删除当前项目的联系人?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ closeOnClickModal:false,
|
|
|
+ type: 'warning'
|
|
|
+ }).then(async () => {
|
|
|
+
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": "20221111130904",
|
|
|
+ "content": {
|
|
|
+ "ownerid":this.mainData.sa_projectid,
|
|
|
+ "ownertable":"sa_project",
|
|
|
+ "sa_project_contactsids":[this.mainData.sa_project_contactsid]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+ this.$store.dispatch('changeDetailDrawer',false)
|
|
|
+ this.$emit('delSuccess')
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ this.$confirm('是否确认删除当前联系人?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ closeOnClickModal:false,
|
|
|
+ type: 'warning'
|
|
|
+ }).then(async () => {
|
|
|
+
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": "20220831164703",
|
|
|
+ "content": {
|
|
|
+ "sys_phonebookid":this.mainData.sys_phonebookid
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+ this.$store.dispatch('changeDetailDrawer',false)
|
|
|
+ this.$emit('delSuccess')
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ // 监听切换数据,上一页,下一页
|
|
|
+ pageChange(id,rowindex){
|
|
|
+ this.$router.replace({path:'/phonebookDetail',query:{id:id,contactsid:this.$route.query.contactsid,sa_project_contactsid:this.$route.query.sa_project_contactsid,rowindex:rowindex,portrait:''}})
|
|
|
+ this.queryMainData(id)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.groupList()
|
|
|
+ this.getTagList()
|
|
|
+ this.queryMainData()
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+</style>
|