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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
<!--
 * @Descripttion: 
 * @version: 
 * @Author: Pengjiantian
 * @Date: 2019-08-26 15:08:09
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2019-10-28 14:06:25
 -->
<template>
  <div id="area" style="min-width:1265px">
  <!-- <div> -->
    <el-container style="min-width:auto">
      <el-main style="overflow:hidden">
        <el-form label-position="right" ref="form" :model="form" id="search-form" class="search-form">
          <!-- <el-row :gutter="20"> -->
            <!-- <el-col> -->
              <el-form-item label="楼栋编号" prop="buildId">
                <el-input v-model="form.buildId" placeholder="请输入"></el-input>
              </el-form-item>
            <!-- </el-col> -->
            <!-- <el-col> -->
              <el-form-item label="项目名称" prop="productname">
                <el-input v-model="form.productname" placeholder="请输入"></el-input>
              </el-form-item>
            <!-- </el-col> -->
            <!-- <el-col> -->
              <el-form-item label="楼栋或车位楼层" prop="buildName">
                <el-input v-model="form.buildName" placeholder="请输入"></el-input>
              </el-form-item>
            <!-- </el-col> -->
            <search-select
              v-show="showFormMore"
              label="楼栋交易阶段"
              codeNo="buildTransStatus"
              v-model="form.buildTransStatus"
              prop="buildTransStatus"
            ></search-select>
            <search-select v-show="showFormMore" label="准入状态" codeNo="admittanceType" v-model="form.flag" prop="flag"></search-select>
            <!-- <el-col :md="8" :lg="6" :offset="showFormMore?12:0"> -->
            <!-- <el-col style="flex: 1;display:flex;justify-content:flex-end"> -->
              <el-form-item :class="showFormMore?'pull-right':'pull-right'">
                <el-button size="mini" @click="handleReset">重置</el-button>
                <el-button type="primary" size="mini" @click="handleSubmit" style="margin-left:22px">搜索</el-button>
                <el-button type="text" @click="handleFormMore">
                  {{ formMoreText }}
                  <i :class="showFormMore?'el-icon-arrow-up':'el-icon-arrow-down'"></i>
                </el-button>
              </el-form-item>
            <!-- </el-col> -->
          <!-- </el-row> -->
        </el-form>
        <el-row>
          <el-button
            type="primary"
            icon="el-icon-circle-plus-outline"
            size="mini"
            @click="handleAdd"
                        v-if="powerControl.addAuilding"
            >新增楼栋或车位楼层</el-button
          >
        </el-row>
        <el-row>
          <el-table
            v-loading="listLoading"
            :data="tableData"
            fit
            highlight-current-row
            style="width: 100%;margin-top: 30px;"
          >
            <el-table-column label=" " type="index" align="center" width="50px"> </el-table-column>
            <el-table-column prop="buildId" label="楼栋编号" width="180"> </el-table-column>
            <el-table-column prop="productname" label="项目名称" width="180"> </el-table-column>
            <el-table-column prop="buildName" label="楼栋或车位楼层" width="180"> </el-table-column>
            <el-table-column prop="propertytypeDesc" label="物业类型" width="180"> </el-table-column>
            <el-table-column prop="buildTransStatusDesc" label="楼栋交易阶段" width="180"> </el-table-column>
            <el-table-column prop="flagDesc" label="准入状态" width="180"> </el-table-column>
            <el-table-column prop="admittancedate" label="准入时间" width="180"> </el-table-column>
            <el-table-column prop="exitdate" label="准出时间" width="180"> </el-table-column>
            <el-table-column prop="shproductDesc" label="是否社会化" width="180"> </el-table-column>
            <el-table-column prop="housedate" label="预计交房日期" width="180"> </el-table-column>
            <el-table-column prop="updateuseridDesc" label="修改人" width="180"> </el-table-column>
            <el-table-column label="申请管理" fixed="right" width="126">
              <!-- <template slot-scope="scope">
                <el-button
                  v-if="scope.row.opertion.admittance"
                  type="text"
                  size="small"
                  @click="handleAdmittance(scope.row)"
                  >准入</el-button
                >
                <el-button v-if="scope.row.opertion.modify" type="text" size="small" @click="handleModify(scope.row)"
                  >修改</el-button
                >
                <el-button v-if="scope.row.opertion.prompt" type="text" size="small" @click="handlePrompt(scope.row)"
                  >准出</el-button
                >
                <el-button v-if="scope.row.opertion.detail" type="text" size="small" @click="handleDetail(scope.row)"
                  >详情</el-button
                >
              </template> -->
                            <template slot-scope="scope">
                                <!-- style="margin:0 20px 0 0" -->
                                <!-- 默认显示第一个 -->
                                <el-button
                                    type="text"
                                    @click="handler(scope.row,scope.row.btns[0])"
                                >{{scope.row.btns[0]}}</el-button>
                                <!-- 只有两个按钮时默认显示 -->
                                <el-button
                                    type="text"
                                    @click="handler(scope.row,scope.row.btns[1])"
                                    v-if="scope.row.btns.length === 2"
                                >{{scope.row.btns[1]}}</el-button>
                                <el-popover
                                    :ref="scope.$index"
                                    placement="bottom"
                                    @show="scope.row.isSwitch=true;$set(tableData,scope.$index,scope.row)"
                                    @hide="scope.row.isSwitch=false;$set(tableData,scope.$index,scope.row)"
                                    trigger="hover"
                                    popper-class="custom_popper"
                                    v-if="scope.row.btns.length !== 2"
                                >
                                    <div style="text-align: center; margin: 2px 0">
                                        <el-button
                                            type="text"
                                            style="padding:0"
                                            v-for="(item,index) in scope.row.btns"
                                            :key="index"
                                            v-show="index!=0"
                                            @click="scope._self.$refs[scope.$index].doClose();handler(scope.row,item)"
                                        >{{item}}</el-button>
                                    </div>
                                    <!-- 只有一个按钮时置灰 -->
                                    <el-button style="margin-left:20px;margin-right:6px" type="text" slot="reference" :disabled="scope.row.btns.length<2">
                                        更多
                                        <i
                                            :class="[{'el-icon-arrow-down':!scope.row.isSwitch && scope.row.btns.length>2},{'el-icon-arrow-up':scope.row.isSwitch}]"
                                        ></i>
                                    </el-button>
                                </el-popover>
              </template>
            </el-table-column>
          </el-table>
          <pagination
            v-show="total > 0"
            :total="total"
            :page.sync="listQuery.currentPage"
            :limit.sync="listQuery.pageSize"
            @pagination="initTable"
          />
        </el-row>
      </el-main>
    </el-container>
  </div>
</template>
 
<script>
import '../../style/areaBuilding.styl'
// import '@/views/area/style/table.styl'
import { qryBuildListByPage, buildAdmitIn, buildAdmitOut } from '@/api/area/building'
import Pagination from '@/components/Pagination'
import SearchSelect from './SearchSelect'
export default {
  components: { SearchSelect, Pagination },
  data: function() {
    return {
      form: {
        buildId: '',
        buildName: '',
        buildTransStatus: '',
        flag: '',
        productname: ''
      },
      formMoreText: '展开',
      showFormMore: false,
      // 分页
      listLoading: true,
      tableData: [],
      total: 0,
      listQuery: {
        currentPage: 1,
        pageSize: 10
            },
            powerControl:{
                addAuilding: false, // 新增楼栋
                qryBuildDetail: false, // 修改
                queryBuildTabAttrs: false, // 详情
                buildAdmitIn: false, // 准入
                buildAdmitOut: false, // 准出
            }
    }
  },
  created() {
    this.initTable()
    },
    mounted() {
        if (this.window.location.host.indexOf('236') != -1 || this.window.location.host.indexOf('localhost') != -1) {
            this.powerControl.addAuilding = this.window.top._area_building_add = true // 新增楼栋
            this.powerControl.qryBuildDetail = this.window.top._server_qryBuildDetail = true // 修改
            this.powerControl.queryBuildTabAttrs = this.window.top._server_queryBuildTabAttrs = true // 详情
            this.powerControl.buildAdmitIn = this.window.top._server_buildAdmitIn = true // 准入
            this.powerControl.buildAdmitOut = this.window.top._server_buildAdmitOut = true // 准出
        } else {
            this.powerControl.addAuilding = this.window.top._server_qryBuildDetail // 新增楼栋
            this.powerControl.qryBuildDetail = this.window.top._server_qryBuildDetail // 修改
            this.powerControl.queryBuildTabAttrs = this.window.top._server_queryBuildTabAttrs // 详情
            this.powerControl.buildAdmitIn = this.window.top._server_buildAdmitIn // 准入
            this.powerControl.buildAdmitOut = this.window.top._server_buildAdmitOut // 准出
        }
    },
  methods: {
    initTable() {
            this.listLoading = true
      let params = Object.assign(this.listQuery, this.form)
      qryBuildListByPage(params).then(res => {
                this.tableData = res.result.records
                this.showBtn(this.tableData)
        this.total = res.result.total
                this.listLoading = false
      })
    },
    handleFormMore() {
      this.showFormMore = !this.showFormMore
      this.showFormMore ? (this.formMoreText = '收起') : (this.formMoreText = '展开')
    },
    handleSubmit() {
            // 每次搜索都是从第一页开始搜索
            this.listQuery.currentPage = 1
      this.initTable()
    },
    handleReset() {
      this.$refs['form'].resetFields()
        },
        // 列表更多处理
        // 处理列表各种操作管理
    handler(row, key) {
      switch (key) {
        case '修改':
          this.handleModify(row)
          break
        case '详情':
          this.handleDetail(row)
          break
        case '准入':
          this.handleAdmittance(row)
          break
        case '准出':
          this.handlePrompt(row)
          break
        default:
          break
      }
    },
        // 排序展示列表需要的按钮
    showBtn(array) {
            // 给每一行数据天年btns属性
      array.forEach(val => {
        val.btns = []
        val.opertion.detail==1 && this.powerControl.queryBuildTabAttrs ?val.btns.push('详情'):''
        val.opertion.modify==1 && this.powerControl.qryBuildDetail ?val.btns.push('修改'):''
        val.opertion.admittance==1 && this.powerControl.buildAdmitIn ?val.btns.push('准入'):''
        val.opertion.prompt==1 && this.powerControl.buildAdmitOut ?val.btns.push('准出'):''
      });
        },
    // 新增
    handleAdd() {
      let buildParams = {
        pageType: 'update',
        serialNo: '',
        objectNo: ''
      }
      this.$store.commit('SET_buildParams', buildParams)
      this.$router.push({ path: '/area/building/update/buildInfo' })
    },
    // 修改
    handleModify(row) {
      let buildParams = {
        pageType: 'update',
        serialNo: row.serialno,
                objectNo: row.objectno,
        operation: 'modify',
        projectid: row.projectid,
        readonly: true
            }
      this.$store.commit('SET_buildParams', buildParams)
      this.$router.push({ path: '/area/building/update/buildInfo' })
    },
    // 准入
    async handleAdmittance(row) {
      let params = { serialNo: row.serialno }
      let confirm = await this.$confirm(`请确认是否准入"${row.productname}"!`, '楼栋准入确认', {
        confirmButtonText: '确定',
                cancelButtonText: '取消',
                customClass: 'build_messages_box',
                confirmButtonClass: 'build_messages_box_confirm',
                cancelButtonClass: 'build_messages_box_cancel',
        center: true
      })
        .then(() => {
          return true
        })
        .catch(() => {})
      if (confirm) {
        let res = await buildAdmitIn(params)
        if (res.code === '00') {
          this.$message.success('处理成功!')
          this.initTable()
        }
      }
    },
    // 准出
    async handlePrompt(row) {
      let params = { serialNo: row.serialno }
      let confirm = await this.$confirm(`请确认是否准出"${row.productname}"!`, '楼栋准出确认', {
        confirmButtonText: '确定',
                cancelButtonText: '取消',
                customClass: 'build_messages_box',
                confirmButtonClass: 'build_messages_box_confirm',
                cancelButtonClass: 'build_messages_box_cancel',
        center: true
      })
        .then(() => {
          return true
        })
        .catch(() => {})
      if (confirm) {
        let res = await buildAdmitOut(params)
        if (res.code === '00') {
          this.$message.success('处理成功!')
          this.initTable()
        }
      }
        },
        // 详情
    handleDetail(row) {
      let buildParams = {
        pageType: 'details',
        serialNo: row.serialno
      }
      this.$store.commit('SET_buildParams', buildParams)
      this.$router.push({ path: '/area/building/details/buildInfo' })
    }
  }
}
</script>
 
<style lang="stylus">
    .build_messages_box.el-message-box--center
        width 458px
        height 173px
        .el-message-box__header
            // font-family PingFangSC-Medium,PingFangSC
            font-size 18px
            font-width bold
            padding-top 40px
            .el-message-box__headerbtn
                top 20px
                right 20px
                background rgba(245,245,245,1)
        .el-message-box__content
            line-height 20px
        .el-message-box__btns
            padding-top 30px
            .build_messages_box_confirm
                margin-left 40px
            .build_messages_box_cancel,.build_messages_box_confirm
                width 120px
                height 30px
                span
                    font-size 14px
</style>