tab.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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'" :status="status" :attinfos="attinfo_attachment" @onSuccess="queryAttments" @cancelEdit="queryAttments" :issalehr="issalehr">
  19. <upload slot="upload" :folderid="folderid" :status="status"
  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" :ownerid="ownerid" ></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','ownerid','disabled','isFollow','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. console.log(this.ownerid,'ownerid操作记录')
  57. const res = await this.$api.requested({
  58. "classname": "system.attachment.Attachment",
  59. "method": "queryFileLink",
  60. "content": {
  61. "ownertable": this.ownertable,
  62. "ownerid": this.ownerid,
  63. "usetype":""
  64. }
  65. })
  66. this.attinfo_attachment = res.data
  67. },
  68. handleClick(){
  69. console.log(this.activeName)
  70. /*this.queryAttments()*/
  71. this.$emit('onTabClick')
  72. },
  73. newFollow(){
  74. this.$emit('newFollow')
  75. },
  76. /*判断是否业务员*/
  77. async isSalesman(){
  78. const res = await this.$api.requested({
  79. classname: "webmanage.hr.hr",
  80. content: {
  81. hrid: this.hrid
  82. },
  83. method: "query_hrMain"
  84. })
  85. if (res.code == 0){
  86. this.issalehr = false
  87. }else {
  88. res.data.issalehr && (this.siteid == 'HY' || this.siteid == 'YOSTEST1')?this.issalehr = true : this.issalehr = false
  89. }
  90. }
  91. },
  92. mounted () {
  93. setTimeout(() => {
  94. if (!this.tabs) {this.activeName = 'file'} else {
  95. this.activeName = 'tab0'
  96. }
  97. }, 1000);
  98. if (this.SalesmanQ == '不执行'){
  99. }else {
  100. this.isSalesman()
  101. }
  102. },
  103. watch: {
  104. activeName (val) {
  105. val === 'file'?this.queryAttments():''
  106. }
  107. },
  108. }
  109. </script>
  110. <style>
  111. .tab__panel .el-tabs__item{
  112. color:#999
  113. }
  114. .tab__panel .el-tabs__item.is-active {
  115. color:#3874f6
  116. }
  117. </style>
  118. <style scoped>
  119. .tab__panel{
  120. padding:0 10px 10px 10px;
  121. border-radius:5px;
  122. }
  123. </style>