From d492850f1cc64ddcfaf43798af9c76c2505414fd Mon Sep 17 00:00:00 2001
From: renkang <8417338+k94314517@user.noreply.gitee.com>
Date: 星期五, 24 一月 2025 18:24:31 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/2.0.1' into 2.0.1
---
admin/src/views/project/components/floorLevel.vue | 69 ++++++++++++++++++++++++++--------
1 files changed, 53 insertions(+), 16 deletions(-)
diff --git a/admin/src/views/project/components/floorLevel.vue b/admin/src/views/project/components/floorLevel.vue
index 4e5d94c..a593b63 100644
--- a/admin/src/views/project/components/floorLevel.vue
+++ b/admin/src/views/project/components/floorLevel.vue
@@ -1,21 +1,20 @@
<template>
- <GlobalWindow title="妤煎眰绠$悊" :showConfirm="false" :visible.sync="visible" width="800px">
+ <GlobalWindow title="妤煎眰绠$悊" @close="close" :showConfirm="false" :visible.sync="visible" width="800px">
<div class="head">
<div class="title">妤煎眰鍒楄〃</div>
<el-button type="primary" @click="editClick()">鏂板缓妤煎眰</el-button>
</div>
<el-table :data="list" stripe>
- <el-table-column prop="id" label="妤煎眰缂栫爜" min-width="100px"></el-table-column>
+ <el-table-column prop="code" label="妤煎眰缂栫爜" min-width="100px"></el-table-column>
<el-table-column prop="name" label="妤煎眰鍚嶇О" min-width="100px"></el-table-column>
<el-table-column label="鎿嶄綔" min-width="100px">
<template slot-scope="{row}">
- <el-button type="text" @click="$refs.operaYwBuildingWindow.open('缂栬緫妤煎畤', row)" icon="el-icon-edit"
+ <el-button type="text" @click="editClick(row)" icon="el-icon-edit"
v-permissions="['business:ywbuilding:update']">缂栬緫</el-button>
- <el-button type="text" @click="deleteById(row)" icon="el-icon-delete"
+ <el-button type="text" @click="handleDel(row)" icon="el-icon-delete"
v-permissions="['business:ywbuilding:delete']">鍒犻櫎</el-button>
</template>
</el-table-column>
- <el-table-column prop="projectName" label="鎵�灞為」鐩�" min-width="100px"></el-table-column>
</el-table>
<div class="mt20">
<Pagination @size-change="handleSizeChange" @current-change="getList" :pagination="pagination" />
@@ -33,7 +32,7 @@
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="showModal = false">鍙� 娑�</el-button>
- <el-button type="primary" @click="showModal = false">纭� 瀹�</el-button>
+ <el-button type="primary" :loading="subLoading" @click="onSubmit">纭� 瀹�</el-button>
</span>
</el-dialog>
</GlobalWindow>
@@ -42,8 +41,9 @@
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
-import { fetchList, detailById, deleteById, create } from '@/api/project/yeFloor'
+import { fetchList, detailById, deleteById, create, updateById } from '@/api/project/yeFloor'
import Pagination from '@/components/common/Pagination'
+import { Message } from 'element-ui'
export default {
extends: BaseOpera,
components: { GlobalWindow, Pagination },
@@ -54,6 +54,7 @@
id: '',
visible: false,
showModal: false,
+ subLoading: false,
list: [],
pagination: {
pageSize: 10,
@@ -65,32 +66,68 @@
param: {},
rules: {
name: [{ required: true, message: '璇疯緭鍏ユゼ灞傚悕绉�' }],
- area: [{ required: true, message: '璇疯緭鍏ユゼ灞傜紪鐮�' }],
+ code: [{ required: true, message: '璇疯緭鍏ユゼ灞傜紪鐮�' }],
},
}
},
created() {
},
methods: {
- getList(buildingId) {
- const { pagination } = this
+ onSubmit() {
+ this.$refs['form'].validate((valid) => {
+ if (valid) {
+ const { param, id } = this
+ this.subLoading = true
+ let fn = param.id ? updateById : create
+ fn({ ...param, buildingId: id }).then(res => {
+ this.showModal = false
+ this.subLoading = false
+ Message.success('鎻愪氦鎴愬姛')
+ this.getList()
+ }, () => {
+ this.subLoading = false
+ })
+ }
+ })
+ },
+ getList(page) {
+ const { pagination, id } = this
+ // this.buildingId =
let capacity = pagination.pageSize
- let page = pagination.page
- fetchList({ capacity, page, model: { buildingId } }).then(res => {
- this.list = res
+ let paget = page || pagination.page
+ fetchList({ capacity, page: paget, model: { buildingId: id } }).then(res => {
+ this.list = res.records
+ this.pagination.total = res.total
})
},
editClick(row) {
- if(row && row.id){
+ if (row && row.id) {
this.title = '缂栬緫妤煎眰'
- }else{
+ this.param = { ...row }
+ } else {
this.title = '鏂板缓妤煎眰'
+ this.param = {}
}
this.showModal = true
-
+ },
+ handleDel(row) {
+ this.$confirm('纭畾鍒犻櫎璇ユゼ灞�, 鏄惁缁х画?', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ deleteById(row.id).then(res => {
+ Message.success('鍒犻櫎鎴愬姛')
+ this.getList()
+ })
+ })
+ },
+ close() {
+ this.$emit('success')
},
handleSizeChange(capacity) {
this.pagination.pageSize = capacity
+ this.getList()
}
}
}
--
Gitblit v1.9.3