Blame view

src/components/room/roomContracts.vue 3.22 KB
af1bcbd6   wuxw   房屋页面开发中
1
  <template>
81955f61   wuxw   优化房屋页面
2
3
4
5
6
7
    <el-dialog :visible.sync="visible" :title="$t('roomContracts.title')" width="90%" top="5vh" custom-class="custom-modal"
      @close="handleClose">
      <el-table :data="roomContractsInfo.contracts" stripe border style="width: 100%; margin-top: 15px">
        <el-table-column prop="contractName" :label="$t('roomContracts.contractName')" align="center" />
        <el-table-column prop="contractCode" :label="$t('roomContracts.contractCode')" align="center" />
        <el-table-column prop="parentContractCode" :label="$t('roomContracts.parentContractCode')" align="center">
af1bcbd6   wuxw   房屋页面开发中
8
9
10
11
          <template slot-scope="scope">
            {{ scope.row.parentContractCode || '-' }}
          </template>
        </el-table-column>
81955f61   wuxw   优化房屋页面
12
13
14
15
16
17
18
        <el-table-column prop="contractTypeName" :label="$t('roomContracts.contractType')" align="center" />
        <el-table-column prop="operator" :label="$t('roomContracts.operator')" align="center" />
        <el-table-column prop="amount" :label="$t('roomContracts.amount')" align="center" />
        <el-table-column prop="startTime" :label="$t('roomContracts.startTime')" align="center" />
        <el-table-column prop="endTime" :label="$t('roomContracts.endTime')" align="center" />
        <el-table-column prop="createTime" :label="$t('roomContracts.createTime')" align="center" />
        <el-table-column prop="stateName" :label="$t('roomContracts.state')" align="center" />
af1bcbd6   wuxw   房屋页面开发中
19
      </el-table>
81955f61   wuxw   优化房屋页面
20
21
22
23
  
      <el-pagination v-if="pagination.total > 0" background layout="prev, pager, next" :total="pagination.total"
        :page-size="pagination.pageSize" :current-page="pagination.currentPage" @current-change="handlePageChange"
        style="margin-top: 20px; text-align: right" />
af1bcbd6   wuxw   房屋页面开发中
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
    </el-dialog>
  </template>
  
  <script>
  import { getRoomContracts } from '@/api/room/roomContractsApi'
  
  export default {
    name: 'RoomContracts',
    data() {
      return {
        visible: false,
        roomContractsInfo: {
          contracts: [],
          ownerId: '',
          roomId: ''
        },
        pagination: {
          total: 0,
          pageSize: 10,
          currentPage: 1
        }
      }
    },
    methods: {
      open(params) {
        this.roomContractsInfo.ownerId = params.ownerId || ''
        this.roomContractsInfo.roomId = params.roomId || ''
        this.pagination.currentPage = 1
        this.visible = true
        this.loadData()
      },
      handleClose() {
        this.visible = false
      },
      handlePageChange(currentPage) {
        this.pagination.currentPage = currentPage
        this.loadData()
      },
      async loadData() {
        try {
          const params = {
            page: this.pagination.currentPage,
            row: this.pagination.pageSize,
            communityId: this.getCommunityId(),
            objId: this.roomContractsInfo.ownerId
          }
81955f61   wuxw   优化房屋页面
70
  
af1bcbd6   wuxw   房屋页面开发中
71
72
73
          if (this.roomContractsInfo.roomId) {
            params.roomId = this.roomContractsInfo.roomId
          }
81955f61   wuxw   优化房屋页面
74
  
af1bcbd6   wuxw   房屋页面开发中
75
76
77
78
79
80
81
82
          const response = await getRoomContracts(params, this.roomContractsInfo.roomId)
          this.roomContractsInfo.contracts = response.data
          this.pagination.total = response.records
        } catch (error) {
          console.error('加载合同信息失败:', error)
          this.$message.error(this.$t('common.loadFailed'))
        }
      },
81955f61   wuxw   优化房屋页面
83
      
af1bcbd6   wuxw   房屋页面开发中
84
85
86
87
88
    }
  }
  </script>
  
  <style scoped>
81955f61   wuxw   优化房屋页面
89
  .custom-modal>>>.el-dialog__body {
af1bcbd6   wuxw   房屋页面开发中
90
91
92
    padding: 15px 20px;
  }
  </style>