公告,活动,投诉接口对接完成
This commit is contained in:
168
src/views/system/Decoration/addDecoration.vue
Normal file
168
src/views/system/Decoration/addDecoration.vue
Normal file
@@ -0,0 +1,168 @@
|
||||
<template>
|
||||
<div class="ResidentMainBox p-2 w-full">
|
||||
<PageHeader title="装修编辑"></PageHeader>
|
||||
<div class="ResidentMainBody">
|
||||
<el-card>
|
||||
<template #header>
|
||||
<div class="title">基本信息</div>
|
||||
</template>
|
||||
<div class="addBuildingFormBody">
|
||||
<div class="formbox">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="房屋" prop="urgencyLevel">
|
||||
<el-cascader @change="handleChange" v-model="userHousepath" :options="treedata" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="申请人" prop="urgencyLevel">
|
||||
<el-input v-model.trim="form.author" placeholder="请输入申请人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="装修公司" prop="noticeTitle">
|
||||
<el-input v-model.trim="form.noticeTitle" placeholder="请输入装修公司" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="装修内容" prop="author">
|
||||
<el-input v-model.trim="form.author" placeholder="请输入装修内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="装修押金(元)" prop="urgencyLevel">
|
||||
<el-input v-model.trim="form.author" placeholder="请输入装修押金" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||
<el-button @click="handleBack">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { addDecoration, getDecoration, updateDecoration } from '@/api/system/Decoration';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
import { CascaderValue } from 'element-plus';
|
||||
|
||||
const houseStore = useHouseStore();
|
||||
const { treedata } = storeToRefs(houseStore);
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const formRef = ref();
|
||||
const form = ref({
|
||||
'id': null,
|
||||
'houseId': null,
|
||||
'author': '',
|
||||
'noticeTitle': '',
|
||||
'urgencyLevel': '0',
|
||||
'publishStatus': ''
|
||||
});
|
||||
const rules = {
|
||||
noticeTitle: [{ required: true, message: '请输入公告标题', trigger: 'blur' }],
|
||||
urgencyLevel: [{ required: true, message: '请选择紧急程度', trigger: 'blur' }],
|
||||
author: [{ required: true, message: '请输入作者名称', trigger: 'blur' }],
|
||||
noticeContent: [{ required: true, message: '请输入公告内容', trigger: 'blur' }]
|
||||
};
|
||||
const userid = ref();
|
||||
|
||||
// ! 投诉 ====================================================================================================
|
||||
function init() {
|
||||
getDecoration(userid.value).then((res) => {
|
||||
form.value = {
|
||||
...form.value,
|
||||
...res.data
|
||||
};
|
||||
console.log(form.value);
|
||||
});
|
||||
}
|
||||
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
init();
|
||||
}
|
||||
|
||||
// 获取房屋
|
||||
const userHousepath = ref([]);
|
||||
function handleChange(val: (string | number)[]) {
|
||||
if (val.length >= 3) {
|
||||
form.value.houseId = val.pop() as number;
|
||||
} else {
|
||||
form.value.houseId = null;
|
||||
}
|
||||
}
|
||||
// 提交
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
if (userid.value) {
|
||||
updateDecoration(form.value).then(() => {
|
||||
ElMessage.success('编辑成功');
|
||||
handleBack();
|
||||
});
|
||||
} else {
|
||||
addDecoration(form.value).then(() => {
|
||||
ElMessage.success('添加成功');
|
||||
handleBack();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 返回
|
||||
function handleBack() {
|
||||
router.push({
|
||||
path: '/repair/noticepc'
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.ResidentMainBox {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.ResidentMainBody {
|
||||
margin-top: 20px;
|
||||
flex: 1;
|
||||
|
||||
.formbox {
|
||||
width: 1000px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
&:deep(div.el-step__head.is-process) {
|
||||
& > div.el-step__line {
|
||||
width: 0;
|
||||
border: 1px dashed gray;
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
&:deep(.el-step.is-vertical .el-step__line) {
|
||||
top: 20px;
|
||||
}
|
||||
&:deep(div.el-step__head.is-finish) {
|
||||
& > div.el-step__line {
|
||||
width: 0;
|
||||
border: 1px solid var(--el-color-primary);
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user