zhaoxiaoqiang1
2026-01-04 f1d30d03186c79ca2cbcfe60d6d2ce7d73fba97b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<template>
  <div class="house-info">
    <el-row class="add-button" v-if="addorupdate === '01'">
      <el-col :span="24">
        <el-button
          type="primary"
          size="small"
          icon="el-icon-circle-plus-outline"
          @click="handleAddCus"
          class="add_btn"
        >新增</el-button>
      </el-col>
    </el-row>
    <ProTable
      :pageInfo="pageInfo"
      @doAction="doAction"
      @handleCurrentChange="handleCurrentChange"
      @handleSizeChange="handleSizeChange"
      :isAutoIndex="true"
      :list="records"
      :header="tableHeader"
      :loading="loading"
    />
    <el-dialog
      :title="dialogTitle"
      v-if="dialogVisible"
      :visible.sync="dialogVisible"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :destroy-on-close="true"
      :show-close="false"
      custom-class="stock_dialog"
      width="890px"
      center
    >
      <PropertyOwner
        @closeDialog="closeDialog"
        :addOrModify="addOrModify"
        :customerId="customerId"
        :tempRecord="tempRecord"
      />
    </el-dialog>
    <Dialog
      v-model="isDelete"
      title="房产信息删除确认"
      :buttons="[{text: '取消'},{text: '确定', type: 'primary'}]"
      @handleClick="clickDelete"
      :contentText="`请确认是否需要删除${tempRecord.houseSerialno}房产的信息?`"
    ></Dialog>
  </div>
</template>
 
<script>
import ProTable from "@/views/components/ProTable";
import Dialog from "../components/Dialog";
import PropertyOwner from "./PropertyOwner";
 
import { qryCusHouseList, delHouseInfo } from "@/http/api.js";
import { enterpriseCusOtherShareholder } from "../config/column.config";
export default {
  components: {
    ProTable,
    Dialog,
    PropertyOwner
  },
  props: {
    tableHeader: {
      type: [Object, Array],
      default: () => {
        return [];
      }
    },
    addorupdate: {
      type: [String],
      default: ""
    }
  },
  created() {
    this.init();
  },
  data() {
    return {
      operateBtns: [{ label: "删除", type: "DELETE", value: true }],
      columnConfig: [...enterpriseCusOtherShareholder],
      loading: false,
      pageInfo: {
        currentPage: 1,
        pageSize: 10,
        total: 0
      },
      records: [],
      dialogVisible: false,
      dialogTitle: "",
      objectNo: "", // 存储customerId
      tempRecord: {},
      addOrModify: "", // 0-新增 1-修改
      isDelete: false,
      customerId: ""
    };
  },
  methods: {
    async init() {
      const { $route, pageInfo } = this;
      const { query } = $route;
      const { customerId } = query;
      this.customerId = customerId;
      const params = {
        customerId,
        ...pageInfo
      };
      const { result } = await qryCusHouseList(params);
      this.records = result.records.map(item => {
        const newItem = { ...item };
        newItem.operationOption = [
          { type: "delete", label: "删除", value: true },
          { type: "edit", label: "修改", value: true }
        ];
        return newItem;
      });
      this.$set(this.pageInfo, "total", result.total);
    },
    handleAddCus() {
      this.addOrModify = "0";
      this.dialogTitle = this.addOrModify === "0" ? "新增" : "修改";
      this.dialogVisible = true;
    },
    closeDialog(type) {
      this.dialogVisible = false;
      if (type === "add") {
        this.init();
      }
      // tempRecord = {}  避免修改未做任何操作导致tempRecord对象仍然保存上一次的数据
      this.tempRecord = {}
    },
    // 修改翻页条数
    handleSizeChange(val) {
      this.pageInfo.pageSize = val;
      this.getBoardList();
    },
    // 修改翻页数
    handleCurrentChange(val) {
      this.pageInfo.currentPage = val;
      this.getBoardList();
    },
    // 表单事件回调
    doAction(name, item, { type }) {
      this.tempRecord = item;
      if (type === "delete") {
        this.isDelete = true;
      }
      if (type === "edit") {
        this.addOrModify = "1";
        this.dialogTitle = "修改";
        this.dialogVisible = true;
      }
    },
    clickDelete(index) {
      if (index === 0) {
        this.isDelete = false;
      } else {
        this.toDelete();
      }
    },
    async toDelete() {
      const { tempRecord } = this;
      const { houseSerialno } = tempRecord;
      try {
        await delHouseInfo({ houseSerialno });
        this.$message.success("删除成功");
        this.isDelete = false;
        this.init();
      } catch (error) {
        this.$message.warning("删除失败");
        this.isDelete = false;
      }
      this.tempRecord = {}
    },
    async handleClickRowBtn(type, item) {
      // 编辑详情
      // if (type === "EDIT") {
      //   this.$router.push({
      //     name: "clientsModify",
      //     query: { from: "edit", ...item }
      //   });
      // }
      // // 处理详情
      // if (type === "DETAIL") {
      //   this.$router.push({
      //     name: "clientsDetail",
      //     query: { from: "edit", ...item }
      //   });
      // }
      // if (type === "DELETE") {
      //   const params = {
      //     dirno: item.dirno
      //   };
      //   const delRes = await delBusinessImageCatalog(params);
      //   if (delRes && delRes.code === "00") {
      //     this.$message.success("删除成功");
      //     this.$refs.imageTablelist.getTableList();
      //   }
      // }
    }
  }
};
</script>
 
<style lang="less" scoped>
.house-info {
  & .add-button {
    margin-bottom: 20px;
  }
}
</style>