tab.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <div class="normal-panel tab__panel">
  3. <div>
  4. <el-tabs v-model="activeName" @tab-click="handleClick">
  5. <el-tab-pane v-for="(tab,index) in tabs" :key="index" :label="$t(tab)" :name="'tab' + index"></el-tab-pane>
  6. <el-tab-pane v-if="isFollow" :label="$t('跟进动态')" name="follow"></el-tab-pane>
  7. <el-tab-pane :label="$t('附件')" name="file"></el-tab-pane>
  8. <el-tab-pane :label="$t('操作记录')" name="log"></el-tab-pane>
  9. </el-tabs>
  10. </div>
  11. <div v-show="'tab'+index === activeName" v-for="(item,index) in tabs" :key="index">
  12. <slot v-if="'tab'+index === activeName" :name="'slot' + index"></slot>
  13. </div>
  14. <div v-show="activeName === 'follow'">
  15. <followTable :ownertable="ownertable" :disabled="disabled" @newFollow="newFollow" ref="followRef"></followTable>
  16. </div>
  17. <div v-show="activeName === 'file'">
  18. <attachmentList v-if="activeName === 'file'" :disabled="$route.path == '/contractDetail'?false:disabled" :status="status" :attachmentDisabled="$route.path == '/contractDetail'?false:attachmentDisabled" :attinfos="attinfo_attachment" @onSuccess="queryAttments" @cancelEdit="queryAttments" :issalehr="issalehr">
  19. <upload slot="upload" :folderid="folderid" :status="status" :attachmentDisabled="$route.path == '/contractDetail'?false:attachmentDisabled" :disabled="$route.path == '/contractDetail'?false:disabled"
  20. :bindData="{ ownertable: ownertable, ownerid: editData[idname], usetype: 'default' }"
  21. @onSuccess="queryAttments" :hidemediastock="hidemediastock"></upload>
  22. </attachmentList>
  23. </div>
  24. <div v-show="activeName === 'log'" >
  25. <datalog v-if="activeName === 'log'" :status="status" :editData="editData" :idname="idname" :ownertable="ownertable" ></datalog>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. import attachmentList from '@/components/attachment_list/index.vue'
  31. import upload from '@/components/upload/hw_obs_upload.vue'
  32. import datalog from '../datalog/index.vue'
  33. import followTable from '../followTable/index'
  34. export default {
  35. props:['tabs','editData','ownertable','idname','status','attachmentDisabled','disabled','isFollow'],
  36. components:{
  37. attachmentList,
  38. upload,
  39. datalog,
  40. followTable
  41. },
  42. data () {
  43. return {
  44. activeName:'tab0',
  45. attinfo_attachment:[],
  46. folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
  47. hidemediastock:!JSON.parse(sessionStorage.getItem('activeApp')).selectfileinattachment,
  48. hrid:JSON.parse(sessionStorage.getItem('active_account')).hrid,
  49. issalehr:false,
  50. siteid:JSON.parse(sessionStorage.getItem('active_account')).siteid
  51. }
  52. },
  53. methods:{
  54. async queryAttments () {
  55. console.log(this.idname,'---')
  56. const res = await this.$api.requested({
  57. "classname": "system.attachment.Attachment",
  58. "method": "queryFileLink",
  59. "content": {
  60. "ownertable": this.ownertable,
  61. "ownerid": this.editData[this.idname],
  62. "usetype":""
  63. }
  64. })
  65. this.attinfo_attachment = res.data
  66. },
  67. handleClick(){
  68. console.log(this.activeName)
  69. this.$emit('onTabClick',this.activeName)
  70. },
  71. newFollow(){
  72. this.$emit('newFollow')
  73. },
  74. /*判断是否业务员*/
  75. async isSalesman(){
  76. const res = await this.$api.requested({
  77. classname: "webmanage.hr.hr",
  78. content: {
  79. hrid: this.hrid
  80. },
  81. method: "query_hrMain"
  82. })
  83. if (res.code == 0){
  84. this.issalehr = false
  85. }else {
  86. res.data.issalehr && (this.siteid == 'HY' || this.siteid == 'YOSTEST1') ? this.issalehr = true : this.issalehr = false
  87. }
  88. }
  89. },
  90. mounted () {
  91. setTimeout(() => {
  92. if (!this.tabs) {this.activeName = 'file'} else {
  93. this.activeName = 'tab0'
  94. }
  95. }, 1000);
  96. this.isSalesman()
  97. },
  98. watch: {
  99. activeName (val) {
  100. val === 'file'?this.queryAttments():''
  101. }
  102. },
  103. }
  104. </script>
  105. <style>
  106. .tab__panel .el-tabs__item{
  107. color:#999
  108. }
  109. .tab__panel .el-tabs__item.is-active {
  110. color:#3874f6
  111. }
  112. </style>
  113. <style scoped>
  114. .tab__panel{
  115. padding:0 10px 10px 10px;
  116. border-radius:5px;
  117. }
  118. </style>