物业之前,新工作台
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="楼栋类型" prop="buildingUse">
|
||||
<el-select v-model="form.buildingUse" placeholder="选择楼栋类型">
|
||||
<el-option v-for="(item, index) in housetypelist" :key="index" :label="item" :value="index"></el-option>
|
||||
<el-option v-for="(item, index) in com_build_use" :key="index" :label="item.label" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="楼栋朝向" prop="buildToward">
|
||||
@@ -45,13 +45,16 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { getCommunitylistAPI } from '@/api/system/community';
|
||||
import { addBuildingApi, editBuildingApi } from '@/api/system/house';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
|
||||
const houseStore = useHouseStore();
|
||||
const { currentVilageInfo } = storeToRefs(houseStore);
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_build_use } = toRefs<any>(proxy?.useDict('com_build_use'));
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const formRef = ref();
|
||||
@@ -59,12 +62,11 @@ const form = ref({
|
||||
buildingName: '',
|
||||
buildToward: '',
|
||||
buildTall: '',
|
||||
buildingUse: 0,
|
||||
buildingUse: '0',
|
||||
buildStructure: '',
|
||||
unitCount: null,
|
||||
floorCount: null
|
||||
});
|
||||
const housetypelist = ['住宅', '办公', '商用', '公寓'];
|
||||
const rules = ref({
|
||||
buildingName: [{ required: true, message: '请输入楼栋名称', trigger: 'blur' }],
|
||||
buildingUse: [{ required: true, message: '请选择楼栋类型', trigger: 'blur' }],
|
||||
@@ -74,15 +76,12 @@ const rules = ref({
|
||||
// 判断新增还是编辑
|
||||
const buildingId = route.query.buildingId as string;
|
||||
if (buildingId) {
|
||||
console.log('edit');
|
||||
getBuildingById();
|
||||
} else {
|
||||
console.log('add');
|
||||
}
|
||||
|
||||
/** 编辑楼栋 */
|
||||
function getBuildingById() {
|
||||
console.log(houseStore.currentBuildingInfoList);
|
||||
houseStore.currentBuildingInfoList.forEach((item) => {
|
||||
if (item.id == buildingId) {
|
||||
form.value.buildingName = item.buildingName;
|
||||
@@ -98,9 +97,7 @@ function getBuildingById() {
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
console.log(form.value);
|
||||
if (buildingId) {
|
||||
console.log('修改');
|
||||
editBuildingApi({
|
||||
...form.value,
|
||||
villageId: currentVilageInfo.value.villageId,
|
||||
@@ -115,7 +112,6 @@ const submitForm = () => {
|
||||
ElMessage.error('修改失败');
|
||||
});
|
||||
} else {
|
||||
console.log(' 添加');
|
||||
addBuildingApi({
|
||||
...form.value,
|
||||
villageId: currentVilageInfo.value.villageId
|
||||
|
||||
@@ -123,7 +123,6 @@ if (route.query.id) {
|
||||
};
|
||||
housetype.value = res.data.houseType.split('');
|
||||
handlechangeBuild(form.value.buildingId);
|
||||
console.log(form.value);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -142,7 +141,6 @@ function handlechangeBuild(id: string) {
|
||||
name: index + 1 + '楼'
|
||||
};
|
||||
});
|
||||
console.log(units.value, floors.value);
|
||||
});
|
||||
}
|
||||
const submitForm = () => {
|
||||
@@ -156,16 +154,15 @@ const submitForm = () => {
|
||||
if (houseid.value) {
|
||||
EditHouseApi(data).then(() => {
|
||||
ElMessage.success('修改成功');
|
||||
houseStore.switchBuilding(houseStore.currentBuildingInfo.id);
|
||||
houseStore.updateCureentBuilding();
|
||||
router.push({
|
||||
path: '/house/houselist'
|
||||
});
|
||||
});
|
||||
} else {
|
||||
addHouseAPI(data).then((res) => {
|
||||
console.log(res);
|
||||
ElMessage.success('添加成功');
|
||||
houseStore.switchBuilding(houseStore.currentBuildingInfo.id);
|
||||
houseStore.updateCureentBuilding();
|
||||
router.push({
|
||||
path: '/house/houselist'
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
}"
|
||||
:key="index"
|
||||
>
|
||||
<div class="buildingname" @click="switchBuilding(item.id)">{{ item.buildingName ?? '测试数据' }}</div>
|
||||
<div class="buildingname" @click="switchBuilding(item.id ?? null)">{{ item.buildingName ?? '测试数据' }}</div>
|
||||
<div class="buildactions flex align-center justify-around">
|
||||
<el-icon class="pointer hover-color-blue" @click="editBuilding(item.id)"><Setting /></el-icon>
|
||||
<el-icon class="pointer hover-color-red" @click="deleteBuilding(item.id)"><Delete /></el-icon>
|
||||
@@ -27,10 +27,12 @@
|
||||
<script setup lang="ts">
|
||||
import { deleteBuildingApi } from '@/api/system/house';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
|
||||
const houseStore = useHouseStore();
|
||||
const { switchBuilding } = houseStore; // 方法
|
||||
const { currentBuildingInfoList, currentBuildingInfo } = storeToRefs(houseStore); // 数据
|
||||
const router = useRouter();
|
||||
|
||||
const handleAddBuilding = () => {
|
||||
router.push({
|
||||
path: '/house/addbuilding'
|
||||
@@ -47,12 +49,9 @@ const editBuilding = (id: number) => {
|
||||
const deleteBuilding = (id: number) => {
|
||||
deleteBuildingApi(id)
|
||||
.then(() => {
|
||||
console.log('删除成功');
|
||||
houseStore.deleteBuildingFun(id);
|
||||
})
|
||||
.catch(() => {
|
||||
console.log('删除失败');
|
||||
});
|
||||
.catch(() => {});
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ function handleChangeCheckhouses(val: string[]) {
|
||||
function contextMenuFun(val: { type: string; value: string }) {
|
||||
switch (val.type) {
|
||||
case 'edit':
|
||||
console.log('你选择了:', val);
|
||||
router.push({
|
||||
path: '/house/addHouse',
|
||||
query: {
|
||||
@@ -56,7 +55,6 @@ function contextMenuFun(val: { type: string; value: string }) {
|
||||
console.log('你选择了:', val);
|
||||
break;
|
||||
case 'main':
|
||||
console.log('你选择了:', val);
|
||||
router.push({
|
||||
path: '/house/HouseDetails',
|
||||
query: {
|
||||
@@ -65,7 +63,6 @@ function contextMenuFun(val: { type: string; value: string }) {
|
||||
});
|
||||
break;
|
||||
case 'delete':
|
||||
console.log('你选择了:', val);
|
||||
deleteHouseApi(val.value).then(() => {
|
||||
ElMessage.success('删除成功');
|
||||
houseStore.switchBuilding(houseStore.currentBuildingInfo.id);
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
<div class="Unit_top flex align-center justify-between">
|
||||
<div>
|
||||
<span class="text-size-16px text-color-black text-widget-bold mr-30px">
|
||||
<strong>{{ houseStore.currentBuildingInfo.buildingName }}</strong>
|
||||
<strong>{{ houseStore.currentBuildingInfo?.buildingName }}</strong>
|
||||
</span>
|
||||
<span class="mr-30px">楼栋朝向:{{ houseStore.currentBuildingInfo.buildToward }}</span>
|
||||
<span class="mr-30px">楼高:{{ houseStore.currentBuildingInfo.buildTall }}(m)</span>
|
||||
<span class="mr-30px">楼栋结构:{{ houseStore.currentBuildingInfo.buildStructure }} </span>
|
||||
<span class="mr-30px">楼栋朝向:{{ houseStore.currentBuildingInfo?.buildToward }}</span>
|
||||
<span class="mr-30px">楼高:{{ houseStore.currentBuildingInfo?.buildTall ? `${houseStore.currentBuildingInfo?.buildTall}(m)` : '' }}</span>
|
||||
<span class="mr-30px">楼栋结构:{{ houseStore.currentBuildingInfo?.buildStructure }} </span>
|
||||
</div>
|
||||
<div class="rightActions">
|
||||
<span class="mr-20px" @click="handleAddHouse">+增加房屋</span>
|
||||
<span class="mr-20px">收费标准设置</span>
|
||||
<!-- <span class="mr-20px">收费标准设置</span> -->
|
||||
<span @click="deleteAllhouse">删除</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -35,7 +35,6 @@ function handleAddHouse() {
|
||||
|
||||
function deleteAllhouse() {
|
||||
const checkhouse = houseStore.checkoutHouses;
|
||||
console.log(checkhouse);
|
||||
if (checkhouse.length > 0) {
|
||||
let deletecount = 0;
|
||||
checkhouse.forEach((item) => {
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
<div
|
||||
class="housetype"
|
||||
:class="{
|
||||
active: houseStore.buildingtype === index
|
||||
active: buildingtype == house.value
|
||||
}"
|
||||
@click="houseStore.switchHouseType(index)"
|
||||
v-for="(house, index) in housetypelist"
|
||||
@click="houseStore.switchHouseType(house.value)"
|
||||
v-for="(house, index) in com_build_use"
|
||||
:key="index"
|
||||
>
|
||||
{{ house }}
|
||||
{{ house.label }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -32,9 +32,13 @@ import building from './components/building.vue';
|
||||
import unit from './components/unit.vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
|
||||
const houseStore = useHouseStore();
|
||||
const { currentVilageInfo } = storeToRefs(houseStore);
|
||||
const housetypelist = ['住宅', '办公', '商用', '公寓'];
|
||||
const { buildingtype, currentVilageInfo } = storeToRefs(houseStore);
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_build_use } = toRefs<any>(proxy?.useDict('com_build_use'));
|
||||
|
||||
houseStore.initHouse(houseStore.buildingtype);
|
||||
// 初始化数据
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user