tab.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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/index1.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','tabName','SalesmanQ'],
  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: (() => { try { return !JSON.parse(sessionStorage.getItem('activeApp')).selectfileinattachment } catch(e) { return false } })(),
  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 && res.data.issalehr && (this.siteid == 'HY' || this.siteid == 'YOSTEST1') ? this.issalehr = true : this.issalehr = false
  87. this.$emit('hrMain',res.data)
  88. }
  89. }
  90. },
  91. mounted () {
  92. setTimeout(() => {
  93. console.log(this.tabs.length,'tabs长度')
  94. if (this.tabs.length == 0 && this.$route.path !== '/contractDetail') {
  95. this.activeName = 'file'
  96. } else {
  97. this.activeName = this.tabName?this.tabName:'tab0'
  98. }
  99. }, 100);
  100. if (this.SalesmanQ == '不执行'){
  101. }else {
  102. this.isSalesman()
  103. }
  104. },
  105. watch: {
  106. activeName (val) {
  107. val === 'file'?this.queryAttments():''
  108. }
  109. },
  110. }
  111. </script>
  112. <style>
  113. .tab__panel .el-tabs__item{
  114. color:#999
  115. }
  116. .tab__panel .el-tabs__item.is-active {
  117. color:#3874f6
  118. }
  119. </style>
  120. <style scoped>
  121. .tab__panel{
  122. padding:0 10px 10px 10px;
  123. border-radius:5px;
  124. }
  125. </style>