index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <div class="container">
  3. <div class="container normal-panel normal-margin flex-align-stretch flex-between">
  4. <div>
  5. <div class="flex-align-center">
  6. <p class="appname inline-16">{{routerName}}</p>
  7. <div class="flex-align-center">
  8. <p class="normal-title inline-16">{{titleText}}</p>
  9. <div>
  10. <el-button :disabled="rowindex === 1" size="mini" icon="el-icon-arrow-left" @click="previous()"></el-button>
  11. <el-button :disabled="rowindex === total" size="mini" @click="next()"><i class="el-icon-arrow-right"></i></el-button>
  12. </div>
  13. </div>
  14. </div>
  15. <div v-if="tags">
  16. <el-tag style="margin-right:10px" v-for="item in tags" :key="item.index" size="mini" effect="light">{{item}}</el-tag>
  17. </div>
  18. <div v-else>
  19. <slot name="tags"></slot>
  20. </div>
  21. </div>
  22. <div>
  23. <slot name="customOperation"></slot>
  24. <cpAdd :formPath="formPath" :data="editData" btnType="default" @onAddSuccess="onSuccess"></cpAdd>
  25. </div>
  26. </div>
  27. <el-row :gutter="20">
  28. <el-col :span="18">
  29. <div class="container normal-panel normal-margin">
  30. <el-descriptions title="基本信息" :column="4">
  31. <el-descriptions-item v-for="item in mainAreaData" :key="item.index" :label="item.label">{{item.value?item.value:'--'}}</el-descriptions-item>
  32. </el-descriptions>
  33. </div>
  34. <div class="my-tabs">
  35. <el-tabs v-model="activeName" type="card">
  36. <el-tab-pane v-for="(tab,index) in tabs" :key="index" :label="tab" :name="'tab' + index"></el-tab-pane>
  37. <el-tab-pane label="附件" name="file"></el-tab-pane>
  38. <el-tab-pane label="操作记录" name="log"></el-tab-pane>
  39. </el-tabs>
  40. </div>
  41. <div v-show="'tab'+index === activeName" v-for="(item,index) in tabs" :key="index">
  42. <slot :name="'slot' + index"></slot>
  43. </div>
  44. <slot name="custom"></slot>
  45. </el-col>
  46. <el-col :span="6">
  47. <group></group>
  48. <follow-up></follow-up>
  49. </el-col>
  50. </el-row>
  51. </div>
  52. </template>
  53. <script>
  54. import cpAdd from '../modules/cpEdit.vue'
  55. import followUp from './modules/followUp.vue'
  56. import group from './modules/group.vue'
  57. export default {
  58. props:['titleText','mainAreaData','turnPageId','idname','formPath','editData','tags','tabs'],
  59. data () {
  60. return {
  61. activeName:'tab0',
  62. routerName:'',
  63. rowindex:0,
  64. total:0,
  65. param:{
  66. "id": '',
  67. "content": {
  68. "isExport":false,
  69. "pageNumber": 1,
  70. "pageSize": 1,
  71. "where": {
  72. "condition": ""
  73. }
  74. }
  75. }
  76. }
  77. },
  78. components:{
  79. cpAdd,
  80. followUp,
  81. group
  82. },
  83. methods:{
  84. async queryData (pageNumber) {
  85. this.param.id = this.turnPageId
  86. this.param.content.pageNumber = pageNumber
  87. const res = await this.$api.requested(this.param)
  88. this.total = res.total
  89. this.$emit('pageChange',res.data[0][this.idname],res.data[0].rowindex)
  90. },
  91. next () {
  92. this.rowindex += 1
  93. this.queryData(this.rowindex)
  94. },
  95. previous () {
  96. this.rowindex -= 1
  97. this.queryData(this.rowindex)
  98. },
  99. onSuccess () {
  100. this.$emit('onEditSuccess')
  101. }
  102. },
  103. created () {
  104. this.routerName = this.$route.meta.title
  105. this.rowindex = Number(this.$route.query.rowindex)
  106. },
  107. }
  108. </script>
  109. <style>
  110. </style>
  111. <style scoped>
  112. .appname{
  113. display: inline;
  114. background: #FA8C19;
  115. color:#fff;
  116. border-radius: 4px;
  117. padding: 2px 10px;
  118. font-size: 12px;
  119. }
  120. </style>