Commit 073585bc037c924aa1f344144bf384ffb863486d

Authored by 杨泽宇
2 parents bc046e9d 11fd81d3
src/views/community/housekeeper/index.vue
@@ -6,7 +6,8 @@ import HouseDetail from "./houseDetail.vue"; @@ -6,7 +6,8 @@ import HouseDetail from "./houseDetail.vue";
6 import ChangeAdmin from "./changeAdmin.vue"; 6 import ChangeAdmin from "./changeAdmin.vue";
7 import Pagination from "@/components/Pagination/index.vue"; 7 import Pagination from "@/components/Pagination/index.vue";
8 import { useRoute } from "vue-router"; 8 import { useRoute } from "vue-router";
9 -import type { ElForm } from 'element-plus' 9 +import type { ElForm } from "element-plus";
  10 +import File from "@/components/FileUpload/index.vue";
10 11
11 let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 12 let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例
12 const houseDetailRef = ref<InstanceType<typeof ElForm>>(); 13 const houseDetailRef = ref<InstanceType<typeof ElForm>>();
@@ -59,7 +60,7 @@ const search = (): void =&gt; { @@ -59,7 +60,7 @@ const search = (): void =&gt; {
59 const edit = (row: Object) => { 60 const edit = (row: Object) => {
60 data.title = "编辑楼宇"; 61 data.title = "编辑楼宇";
61 data.formObj = JSON.parse(JSON.stringify(row)); 62 data.formObj = JSON.parse(JSON.stringify(row));
62 - console.log( typeof data.formObj.grossArea); 63 + console.log(typeof data.formObj.grossArea);
63 data.formObj.neighborhoodId = JSON.parse(JSON.stringify(row)).neighborhoodId; 64 data.formObj.neighborhoodId = JSON.parse(JSON.stringify(row)).neighborhoodId;
64 data.dialogVisible = true; 65 data.dialogVisible = true;
65 }; 66 };
@@ -93,7 +94,7 @@ const changeData: void = () =&gt; { @@ -93,7 +94,7 @@ const changeData: void = () =&gt; {
93 * 弹框关闭 94 * 弹框关闭
94 */ 95 */
95 const dialogClose: void = () => { 96 const dialogClose: void = () => {
96 - console.log(111) 97 + console.log(111);
97 data.title = "新增楼宇"; 98 data.title = "新增楼宇";
98 data.formObj = {}; 99 data.formObj = {};
99 houseDetailRef.value.resetForm(); 100 houseDetailRef.value.resetForm();
@@ -121,6 +122,12 @@ const changeClose = () =&gt; { @@ -121,6 +122,12 @@ const changeClose = () =&gt; {
121 changeObj.originalId = null; 122 changeObj.originalId = null;
122 }; 123 };
123 /** 124 /**
  125 + * 下载模板
  126 + */
  127 +const down = () => {
  128 + window.open(`${import.meta.env.VITE_BASE_URL}building.xlsx`);
  129 +};
  130 +/**
124 * 监听路由参数变换 131 * 监听路由参数变换
125 */ 132 */
126 watchEffect(() => { 133 watchEffect(() => {
@@ -157,6 +164,14 @@ watchEffect(() =&gt; { @@ -157,6 +164,14 @@ watchEffect(() =&gt; {
157 <el-button type="primary" @click="data.dialogVisible = true" 164 <el-button type="primary" @click="data.dialogVisible = true"
158 >新增</el-button 165 >新增</el-button
159 > 166 >
  167 + <el-button type="success" @click="down()">下载模板</el-button>
  168 + </el-form-item>
  169 + <el-form-item>
  170 + <File
  171 + url="building/importExcel"
  172 + method="put"
  173 + @success="search"
  174 + ></File>
160 </el-form-item> 175 </el-form-item>
161 </el-row> 176 </el-row>
162 </el-form> 177 </el-form>
@@ -196,10 +211,18 @@ watchEffect(() =&gt; { @@ -196,10 +211,18 @@ watchEffect(() =&gt; {
196 > 211 >
197 <el-button type="text" size="mini" class="btn">房屋管理</el-button> 212 <el-button type="text" size="mini" class="btn">房屋管理</el-button>
198 </router-link> 213 </router-link>
199 - <el-button type="text" size="mini" @click="edit(scope.row)" class="btn" 214 + <el-button
  215 + type="text"
  216 + size="mini"
  217 + @click="edit(scope.row)"
  218 + class="btn"
200 >编辑</el-button 219 >编辑</el-button
201 > 220 >
202 - <el-button type="text" size="mini" @click="remove(scope.row.id)" class="btn" 221 + <el-button
  222 + type="text"
  223 + size="mini"
  224 + @click="remove(scope.row.id)"
  225 + class="btn"
203 >删除</el-button 226 >删除</el-button
204 > 227 >
205 </template> 228 </template>
@@ -247,7 +270,7 @@ watchEffect(() =&gt; { @@ -247,7 +270,7 @@ watchEffect(() =&gt; {
247 </template> 270 </template>
248 271
249 <style scoped> 272 <style scoped>
250 -.btn{  
251 - margin-left:8px 273 +.btn {
  274 + margin-left: 8px;
252 } 275 }
253 </style> 276 </style>
src/views/community/residence/communityDetail.vue
@@ -58,7 +58,7 @@ const rules = reactive({ @@ -58,7 +58,7 @@ const rules = reactive({
58 ], 58 ],
59 storeroomCount: [ 59 storeroomCount: [
60 { 60 {
61 - required: true, 61 + required: false,
62 message: "请输入储藏室数", 62 message: "请输入储藏室数",
63 trigger: "blur", 63 trigger: "blur",
64 }, 64 },
@@ -66,7 +66,7 @@ const rules = reactive({ @@ -66,7 +66,7 @@ const rules = reactive({
66 ], 66 ],
67 truckSpaceCount: [ 67 truckSpaceCount: [
68 { 68 {
69 - required: true, 69 + required: false,
70 message: "请输入车位数", 70 message: "请输入车位数",
71 trigger: "blur", 71 trigger: "blur",
72 }, 72 },