年前最后一次更新。楼栋 房屋

dev
bibi 3 years ago
parent c9cfbd6f16
commit 8efa6fa4d3

@ -9,6 +9,30 @@ export function buildingList(params) {
params: params, params: params,
}) })
} }
// 楼栋新增
export function buildInsert(params) {
return httpService({
url: `/user/building/insert`,
method: 'post',
data: params,
})
}
// 楼栋新增
export function buildInfo(params) {
return httpService({
url: `/user/building/findById`,
method: 'get',
params: params,
})
}
// 楼栋修改
export function buildUpdate(params) {
return httpService({
url: `/user/building/updateBuilding`,
method: 'post',
data: params,
})
}
// 楼栋删除 // 楼栋删除
export function buildingDel(params) { export function buildingDel(params) {
return httpService({ return httpService({
@ -17,7 +41,32 @@ export function buildingDel(params) {
data: params, data: params,
}) })
} }
/**
* 单元
* list update del
*/
export function unitAdd(params) {
return httpService({
url: `/user/unit/insertUnit`,
method: 'post',
data: params,
})
}
export function unitUpdate(params) {
return httpService({
url: `/user/unit/updateUnit`,
method: 'post',
data: params,
})
}
export function unitDel(params) {
return httpService({
url: `/user/unit/deleteUnit`,
method: 'post',
data: params,
})
}
// 房屋
// 房屋列表 // 房屋列表
export function houseList(params) { export function houseList(params) {
return httpService({ return httpService({
@ -26,7 +75,7 @@ export function houseList(params) {
params: params, params: params,
}) })
} }
// 房屋列表 // 房屋新增
export function houseInsert(params) { export function houseInsert(params) {
return httpService({ return httpService({
url: `/user/estate/insert`, url: `/user/estate/insert`,
@ -42,7 +91,7 @@ export function houseDel(params) {
data: params, data: params,
}) })
} }
// 房屋租切换 // 房屋租切换
export function isEnableLease(params) { export function isEnableLease(params) {
return httpService({ return httpService({
url: `/user/estate/isEnableLease`, url: `/user/estate/isEnableLease`,
@ -50,3 +99,35 @@ export function isEnableLease(params) {
params: params, params: params,
}) })
} }
// 房屋设置 房屋类型
export function estateType(params) {
return httpService({
url: `/user/estateType/list`,
method: 'get',
params: params,
})
}
// 类型新增
export function estateTypeInsert(params) {
return httpService({
url: `/user/estateType/insert`,
method: 'post',
data: params,
})
}
// 类型修改
export function estateTypeUpdate(params) {
return httpService({
url: `/user/estateType/update`,
method: 'post',
data: params,
})
}
// 类型删除
export function estateTypeDel(params) {
return httpService({
url: `/user/estateType/delete`,
method: 'post',
data: params,
})
}

@ -1,10 +1,13 @@
import store from '@/store' import store from '@/store'
export default { export default {
install: function (Vue) { install: function (Vue) {
Vue.prototype.$upload = process.env.VUE_APP_URL + store.getters.getCommunityCode +'/manage/user/upload/uploadTestMinioImg' // 上传
Vue.prototype.ImgUrl = (src) => { Vue.prototype.$upload = process.env.VUE_APP_URL + store.getters.getCommunityCode + '/manage/user/upload/uploadImg'
return process.env.VUE_APP_STATIC + src // 静态地址
Vue.prototype.$ImgUrl = (src) => {
return process.env.VUE_APP_STATIC + store.getters.getCommunityCode + '/' + src
} }
// 时间格式化
Vue.prototype.formatDate = (time, fmt) => { Vue.prototype.formatDate = (time, fmt) => {
if (time > 0) { if (time > 0) {
let date = new Date(time * 1000) let date = new Date(time * 1000)

@ -13,6 +13,20 @@
:key="index" :key="index"
:header="item.name" :header="item.name"
> >
<a-button
type="link"
icon="form"
slot="extra"
@click="editRole(item.id)"
>
</a-button>
<a-button
type="link"
slot="extra"
style="color: #ff4d4f"
icon="delete"
@click="delRole(item.id)"
></a-button>
<div <div
v-for="(rolechild, indexs) in item.childrenList" v-for="(rolechild, indexs) in item.childrenList"
class="role-card" class="role-card"
@ -141,7 +155,7 @@ export default {
title: "是否删除", title: "是否删除",
// okText:'', // okText:'',
// cancelText:'', // cancelText:'',
icon: "", icon: "delete",
onOk:()=> { onOk:()=> {
roleDel({roleId:id}).then(res=>{ roleDel({roleId:id}).then(res=>{
if(res.code === 200){ if(res.code === 200){
@ -180,7 +194,7 @@ export default {
title: "是否删除", title: "是否删除",
// okText:'', // okText:'',
// cancelText:'', // cancelText:'',
icon: "", icon: "delete",
onOk: function () { onOk: function () {
console.log(data); console.log(data);
}, },

@ -18,6 +18,20 @@
:key="index" :key="index"
:header="item.name" :header="item.name"
> >
<a-button
type="link"
icon="form"
slot="extra"
@click="editRole(item.id)"
>
</a-button>
<a-button
type="link"
slot="extra"
style="color: #ff4d4f"
icon="delete"
@click="delRole(item.id)"
></a-button>
<div <div
v-for="(rolechild, indexs) in item.childrenList" v-for="(rolechild, indexs) in item.childrenList"
class="role-card" class="role-card"
@ -91,7 +105,7 @@
@close="sendClose" @close="sendClose"
> >
<div class="drawer-content"> <div class="drawer-content">
<div class="cardTitle">所有角色</div> <div class="cardTitle">所有角色</div>
<a-tree <a-tree
v-model="tree.checkedKeys" v-model="tree.checkedKeys"
checkable checkable
@ -99,11 +113,15 @@
:auto-expand-parent="tree.autoExpandParent" :auto-expand-parent="tree.autoExpandParent"
:selected-keys="tree.selectedKeys" :selected-keys="tree.selectedKeys"
:tree-data="roleList" :tree-data="roleList"
:checkStrictly="true" :checkStrictly="true"
:replaceFields="{ children:'childrenList', title:'name', key:'id' }" :replaceFields="{
children: 'childrenList',
title: 'name',
key: 'id',
}"
@expand="onExpand" @expand="onExpand"
@select="onSelect" @select="onSelect"
@check="onCheck" @check="onCheck"
/> />
</div> </div>
<div class="drawer-footer"> <div class="drawer-footer">
@ -142,7 +160,7 @@ export default {
}, },
data() { data() {
return { return {
tree:{ tree: {
expandedKeys: [], expandedKeys: [],
autoExpandParent: true, autoExpandParent: true,
checkedKeys: [], checkedKeys: [],
@ -181,7 +199,7 @@ export default {
}, },
deep: true, deep: true,
}, },
'tree.checkedKeys'(val) { "tree.checkedKeys"(val) {
// console.log('onCheck', val); // console.log('onCheck', val);
}, },
}, },
@ -193,7 +211,7 @@ export default {
getData() { getData() {
getrolelist().then((res) => { getrolelist().then((res) => {
this.roleList = res.data; this.roleList = res.data;
this.afterroleList = JSON.parse(JSON.stringify(this.roleList)) this.afterroleList = JSON.parse(JSON.stringify(this.roleList));
}); });
}, },
getPeople() { getPeople() {
@ -225,7 +243,7 @@ export default {
title: "是否删除", title: "是否删除",
// okText:'', // okText:'',
// cancelText:'', // cancelText:'',
icon: "", icon: "delete",
onOk: () => { onOk: () => {
roleDel({ roleId: id }).then((res) => { roleDel({ roleId: id }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
@ -271,7 +289,7 @@ export default {
for (let name of data.roleNameList) { for (let name of data.roleNameList) {
haveid.push(name.id); haveid.push(name.id);
} }
this.tree.checkedKeys = haveid this.tree.checkedKeys = haveid;
this.send.show = true; this.send.show = true;
}, },
onExpand(expandedKeys) { onExpand(expandedKeys) {
@ -282,16 +300,15 @@ export default {
this.tree.autoExpandParent = false; this.tree.autoExpandParent = false;
}, },
onCheck(checkedKeys) { onCheck(checkedKeys) {
const arr = [] const arr = [];
this.tree.checkedKeys = checkedKeys; this.tree.checkedKeys = checkedKeys;
for(let k of this.tree.checkedKeys.checked){ for (let k of this.tree.checkedKeys.checked) {
arr.push(k) arr.push(k);
} }
this.form.roleId = arr.toString() this.form.roleId = arr.toString();
console.log(this.form.roleId);
}, },
onSelect(selectedKeys, info) { onSelect(selectedKeys, info) {
console.log('onSelect', info); console.log("onSelect", info);
this.tree.selectedKeys = selectedKeys; this.tree.selectedKeys = selectedKeys;
}, },
// multiRole(data){ // multiRole(data){
@ -312,7 +329,8 @@ export default {
const res = await assignRoles(this.form); const res = await assignRoles(this.form);
if (res.code === 200) { if (res.code === 200) {
this.$message.success(res.msg); this.$message.success(res.msg);
this.getData(); this.getPeople();
this.sendClose();
} else { } else {
this.$message.error(res.msg); this.$message.error(res.msg);
} }
@ -321,10 +339,6 @@ export default {
this.form.manageUserId = undefined; this.form.manageUserId = undefined;
this.send.show = false; this.send.show = false;
}, },
// sendClose(){
// this.form.manageUserId = undefined
// this.send.show = false
// },
Actions(data) { Actions(data) {
console.log(data); console.log(data);
}, },

@ -66,4 +66,66 @@ export const pagination = {
showTotal: (total) => `${total}`, showTotal: (total) => `${total}`,
showSizeChanger: true, showSizeChanger: true,
showQuickJumper: true, showQuickJumper: true,
}
export const form = {
cascVal:[],
id:null,
actualName: "",
sex: null,
idCard: "",
tel: "",
birthday: "",
password: "",
email: "",
address: "",
idCardImgUrls: [],
departmentId: "",
departmentIdPath: "",
positionId: "",
entryDate: "",
salary: "",
dataImgUrls: [],
emergencyContact: "",
emergencyContactNumber: "",
emergencyContactAddress: "",
maritalStatus: "",
nation: "",
politicalOutlook: "",
accountType: "",
remake: "",
}
export const rules = {
actualName: [
{ required: true, message: "请输入真实姓名", trigger: "blur" },
],
sex: [{ required: true, message: "请选择性别", trigger: "change" }],
idCard: [
{ required: true, message: "请输入身份证号", trigger: "blur" },
],
tel: [
{ required: true, message: "请输入手机号", trigger: "blur" },
{ min: 11, max: 11, message: "手机号只能为11位", trigger: "blur" },
],
cascVal:[{ type: 'array',required: true, message: "请选择岗位", trigger: "change" },],
entryDate: [
{ required: true, message: "请选择入职时间", trigger: "change" },
],
}
export const sexOption = [
{
id: 1,
name: "男",
},
{
id: 2,
name: "女",
},
{
id: 3,
name: "保密",
},
]
import store from "@/store";
export const uploadHeaders = {
"manage-login-token": store.getters.getToken,
} }

@ -1,5 +1,6 @@
<template> <template>
<div> <div>
<!-- 员工 新增修改表单 -->
<a-form-model <a-form-model
title="1d2" title="1d2"
layout="vertical" layout="vertical"
@ -72,6 +73,7 @@
:action="`${$upload}`" :action="`${$upload}`"
:headers="uploadHeaders" :headers="uploadHeaders"
list-type="picture-card" list-type="picture-card"
accept='.jpg,.JPG,.png,.PNG,.jpeg,.JPEG'
:file-list="idcardfileList" :file-list="idcardfileList"
@preview="handlePreview" @preview="handlePreview"
@change="idcardhandleChange" @change="idcardhandleChange"
@ -93,7 +95,7 @@
<a-divider></a-divider> <a-divider></a-divider>
<a-row> <a-row>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="岗位" prop='departmentIdPath'> <a-form-model-item label="岗位" prop='cascVal'>
<a-cascader <a-cascader
:field-names="{ :field-names="{
label: 'name', label: 'name',
@ -102,9 +104,8 @@
}" }"
:options="treeData" :options="treeData"
placeholder="请选择" placeholder="请选择"
change-on-select
@change="onChange" @change="onChange"
v-model="cascVal" v-model="form.cascVal"
/> />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
@ -125,14 +126,17 @@
<a-col :span="24"> <a-col :span="24">
<div>上传资料</div> <div>上传资料</div>
<a-upload <a-upload
:action="`${$baseUrl}/user/upload/uploadManageUserData`" :action="`${$upload}`"
:headers="uploadHeaders" :headers="uploadHeaders"
accept='.jpg,.JPG,.png,.PNG,.pdf,.PDF'
list-type="picture" list-type="picture"
:default-file-list="fileList" :file-list="fileList"
@preview="handlePreview"
@change="fileChange"
> >
<a-button> <a-icon type="upload"/> 点击上传 </a-button> <a-button> <a-icon type="upload"/> 点击上传 </a-button>
</a-upload> </a-upload>
<span style="color: #00000073">支持上传PNGJPG,PDF文件</span> <span style="color: #00000073">支持上传PNGJPGPDF文件</span>
</a-col> </a-col>
</a-row> </a-row>
<div style="margin-top: 20px">联系信息</div> <div style="margin-top: 20px">联系信息</div>
@ -209,8 +213,8 @@
</template> </template>
<script> <script>
import { insertManageUser,departmentList,manageUserInfo,EditManageUser } from "@/api/basic/department"; import { form, rules, sexOption, uploadHeaders } from "./config"
import store from "@/store"; import { insertManageUser, departmentList, manageUserInfo, EditManageUser } from "@/api/basic/department";
function getBase64(file) { function getBase64(file) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const reader = new FileReader(); const reader = new FileReader();
@ -228,119 +232,19 @@ export default {
}, },
editId:Number, editId:Number,
}, },
watch: {
editId: {
handler(val) {
if(val === null){
return
}
this.form.id =val;
manageUserInfo({id:this.form.id}).then(res=>{
let data = res.data
this.form.actualName = data.actualName
this.form.sex = data.sex
this.form.idCard = data.idCard
this.form.tel = data.tel
this.telephoneNum = data.tel
this.form.birthday = data.birthday
this.form.password = data.password
this.form.email = data.email
this.form.address = data.address
this.form.entryDate = data.entryDate
this.form.salary = data.salary
this.form.emergencyContact = data.emergencyContact
this.form.emergencyContactNumber = data.emergencyContactNumber
this.form.emergencyContactAddress = data.emergencyContactAddress
this.form.maritalStatus = data.maritalStatus
this.form.nation = data.nation
this.form.politicalOutlook = data.politicalOutlook
this.form.accountType = data.accountType
this.form.remake = data.remake
//
this.cascVal = []
let path = data.departmentIdPath.split(':')
path.pop()
path.splice(0,1)
path.push(data.positionId)
path.forEach(element => {
this.cascVal.push(Number(element))
});
//
this.form.idCardImgUrls = data.idCardImgUrls || []
})
},
immediate: true,
},
},
data() { data() {
return { return {
form,
rules,
sexOption,
uploadHeaders,
previewVisible: false, previewVisible: false,
previewImage: "", previewImage: "",
imgLoading: false, imgLoading: false,
treeData:[], treeData:[], //
cascVal:[], telephoneNum:"", //
telephoneNum:"", idcardfileList: [], //
uploadHeaders: { fileList:[], //
"manage-login-token": store.getters.getToken,
},
sexOption: [
{
id: 1,
name: "男",
},
{
id: 2,
name: "女",
},
{
id: 3,
name: "保密",
},
],
form: {
id:null,
actualName: "",
sex: null,
idCard: "",
tel: "",
birthday: "",
password: "",
email: "",
address: "",
idCardImgUrls: [],
departmentId: "",
departmentIdPath: "",
positionId: "",
entryDate: "",
salary: "",
dataImgUrls: "",
emergencyContact: "",
emergencyContactNumber: "",
emergencyContactAddress: "",
maritalStatus: "",
nation: "",
politicalOutlook: "",
accountType: "",
remake: "",
},
rules: {
actualName: [
{ required: true, message: "请输入真实姓名", trigger: "blur" },
],
sex: [{ required: true, message: "请选择性别", trigger: "change" }],
idCard: [
{ required: true, message: "请输入身份证号", trigger: "blur" },
],
tel: [
{ required: true, message: "请输入手机号", trigger: "blur" },
{ min: 11, max: 11, message: "手机号只能为11位", trigger: "blur" },
],
entryDate: [
{ required: true, message: "请选择入职时间", trigger: "change" },
],
},
idcardfileList: [],
fileList:[]
}; };
}, },
created() { created() {
@ -350,10 +254,46 @@ export default {
getData(){ getData(){
departmentList().then((res) => { departmentList().then((res) => {
this.treeData = res.data; this.treeData = res.data;
// type 1 2
this.positionDisabled(this.treeData)
}); });
}, },
// disabled
positionDisabled(arr){
arr.forEach((item,index)=>{
if(item.type=== 1 && (item.childList.length===0 || item.childList===null)){
arr[index].disabled=true
}else if(item.type === 2){
arr[index].disabled=false
}else{
this.positionDisabled(item.childList)
}
})
},
// //
submit() { submit() {
let arr = []
let file = []
for(let item of this.idcardfileList){
//
if(item.response){
arr.push(item.response.data)
}else{
//
arr.push(item.url.split('/')[item.url.split('/').length-1])
}
}
for(let item of this.fileList){
//
if(item.response){
file.push(item.response.data)
}else{
//
file.push(item.url.split('/')[item.url.split('/').length-1])
}
}
this.form.idCardImgUrls = arr
this.form.dataImgUrls = file
this.$refs.ruleForm.validate((valid) => { this.$refs.ruleForm.validate((valid) => {
if (!valid) { if (!valid) {
return; return;
@ -362,7 +302,7 @@ export default {
insertManageUser(this.form).then((res) => { insertManageUser(this.form).then((res) => {
if(res.code===200){ if(res.code===200){
this.$message.success(res.msg) this.$message.success(res.msg)
this.success() this.$emit('success')
this.close() this.close()
} }
}); });
@ -370,11 +310,11 @@ export default {
if(this.form.tel === this.telephoneNum){ if(this.form.tel === this.telephoneNum){
this.form.tel = null this.form.tel = null
} }
console.log(this.form); // console.log(this.form);
EditManageUser(this.form).then((res) => { EditManageUser(this.form).then((res) => {
if(res.code===200){ if(res.code===200){
this.$message.success(res.msg) this.$message.success(res.msg)
this.success() this.$emit('success')
this.close() this.close()
} }
}); });
@ -384,18 +324,28 @@ export default {
// //
close() { close() {
this.$refs.ruleForm.resetFields(); this.$refs.ruleForm.resetFields();
this.cascVal = [] this.form.cascVal = []
}, this.idcardfileList =[]
success(){ this.fileList =[]
this.$emit('success')
}, },
async handlePreview(file) { async handlePreview(file) {
console.log(file);
if(file.name.indexOf('pdf')!==-1){
if(file.response){
window.open(this.$ImgUrl(file.response.data))
return
}else{
window.open(file.url)
return
}
}
if (!file.url && !file.preview) { if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj); file.preview = await getBase64(file.originFileObj);
} }
this.previewImage = file.url || file.preview; this.previewImage = file.url || file.preview;
this.previewVisible = true; this.previewVisible = true;
}, },
//
onChange(data) { onChange(data) {
// data [1,2,2] // data [1,2,2]
// yyyy-mm-dd hh:mm:ss // yyyy-mm-dd hh:mm:ss
@ -415,13 +365,87 @@ export default {
}, },
idcardhandleChange(info) { idcardhandleChange(info) {
this.idcardfileList = info.fileList this.idcardfileList = info.fileList
if(info.file.status === 'done'){ },
this.form.idCardImgUrls.push(info.file.response.data) fileChange(info) {
} this.fileList = info.fileList
},
},
watch: {
editId: {
handler(val) {
// console.log(val);
if(val === null){
return
}
this.form.id =val;
manageUserInfo({id:this.form.id}).then(res=>{
let data = res.data
//
this.form.actualName = data.actualName
this.form.sex = data.sex
this.form.idCard = data.idCard
this.form.tel = data.tel
this.telephoneNum = data.tel
this.form.birthday = data.birthday
this.form.password = data.password
this.form.email = data.email
this.form.address = data.address
this.form.entryDate = data.entryDate
this.form.salary = data.salary
this.form.emergencyContact = data.emergencyContact
this.form.emergencyContactNumber = data.emergencyContactNumber
this.form.emergencyContactAddress = data.emergencyContactAddress
this.form.maritalStatus = data.maritalStatus
this.form.nation = data.nation
this.form.politicalOutlook = data.politicalOutlook
this.form.accountType = data.accountType
this.form.remake = data.remake
//
this.form.cascVal = []
let path = data.departmentIdPath.split(':')
path.pop()
path.splice(0,1)
path.push(data.positionId)
path.forEach(element => {
this.form.cascVal.push(Number(element))
});
//
//
if(!data.idCardImgList.length){
this.idcardfileList=[]
}
const arr = []
for(let item of data.idCardImgList){
let obj = {
name:item.url.split('_')[0],
url: this.$ImgUrl(item.url),
uid:item.url.split('_')[1],
status:'done',
}
arr.push(obj)
}
this.idcardfileList = arr
//
if(!data.dataImgList.length){
this.fileList=[]
}
const file = []
for(let item of data.dataImgList){
let obj = {
name:item.url.split('_')[0] +'.'+ item.url.split('.')[1],
url: this.$ImgUrl(item.url),
uid:item.url.split('_')[1],
status:'done',
thumbUrl: this.$ImgUrl(item.url),
}
file.push(obj)
}
this.fileList = file
})
},
immediate: true,
}, },
}, },
}; };
</script> </script>
<style lang="less" scoped>
</style>

@ -309,12 +309,6 @@ export default {
} }
} }
}, },
edit(row){
this.show.addStaffShow = true;
this.type = 'edit'
this.editId = row.id
this.show.addStaffTitle = "修改员工信息"
},
// //
handleOk() { handleOk() {
if (this.depepartmentTitle === "新增组织架构") { if (this.depepartmentTitle === "新增组织架构") {
@ -349,7 +343,7 @@ export default {
} else { } else {
this.$confirm({ this.$confirm({
title: "是否删除", title: "是否删除",
icon: "", icon: "delete",
onOk: () => { onOk: () => {
departmentDel({ id: this.choose.id, type: this.choose.type }).then( departmentDel({ id: this.choose.id, type: this.choose.type }).then(
(res) => { (res) => {
@ -389,15 +383,22 @@ export default {
}, },
// //
addStaff() { addStaff() {
this.type = 'add'
this.show.addStaffShow = true;
},
edit(row){
this.show.addStaffShow = true; this.show.addStaffShow = true;
this.type = 'edit'
this.editId = row.id
this.show.addStaffTitle = "修改员工信息"
}, },
addStaffSubmit() { addStaffSubmit() {
this.$refs.addform.submit(); this.$refs.addform.submit();
}, },
addStaffClose() { addStaffClose() {
this.editId =null
this.$refs.addform.close(); this.$refs.addform.close();
this.show.addStaffShow = false; this.show.addStaffShow = false;
this.editId =null
}, },
resetPsw(id){ resetPsw(id){
this.show.resetPswShow = true this.show.resetPswShow = true

@ -52,4 +52,63 @@ export const pagination = {
current: 1, current: 1,
total: 0, total: 0,
pageSize: 10, pageSize: 10,
}
export const ActionsList = [
{
label: "批量删除",
value: 1,
},
]
export const form = {
id:undefined,
name: '',
buildingInfoImgUrls:[]
}
export const rules = {
name:[{required:true,message:'请输入楼栋',trigger:'blur'}],
}
export const unitColumns = [
{
title: "单元名称",
dataIndex: "name",
width: "15%",
},
{
title: "楼层数",
dataIndex: "floor",
width: "15%",
},
{
title: "公共楼层数",
dataIndex: "publicFloor",
width: "18%",
},
{
title: "是否有电梯",
dataIndex: "elevator",
width: "18%",
customRender:function( elevator ){
switch (elevator) {
case 1:
return '有'
case 0:
return '无'
default:
break;
}
}
},
{
title: "操作",
dataIndex: "action",
key: "action",
width: "180",
fixed: "right",
scopedSlots: { customRender: "action" },
},
]
import store from "@/store";
export const uploadHeaders = {
"manage-login-token": store.getters.getToken,
} }

@ -0,0 +1,360 @@
<template>
<div>
<a-drawer
:title="formTitle"
:width="720"
:visible="show"
:body-style="{ paddingBottom: '80px' }"
@close="close"
>
<div class="drawer-content" v-if="formType !== 3">
楼栋信息
<a-divider></a-divider>
<a-form-model
layout="vertical"
ref="ruleForm"
:model="form"
:rules="rules"
>
<a-form-model-item label="楼栋号" prop="name">
<a-input
v-model="form.name"
placeholder="请输入楼栋号"
style="width: 50%"
/>
</a-form-model-item>
<a-form-model-item
label="上传照片"
style="width: 70%"
prop="fileList"
>
<a-upload
:action="`${$upload}`"
:headers="uploadHeaders"
accept='.jpg,.JPG,.png,.PNG'
list-type="picture"
:file-list="fileList"
@preview="handlePreview"
@change="fileChange"
>
<a-button> <a-icon type="upload" /> 点击上传 </a-button>
</a-upload>
<a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
<img alt="example" style="width: 100%" :src="previewImage" />
</a-modal>
</a-form-model-item>
</a-form-model>
</div>
<!-- 详情 -->
<div class="drawer-content detail" v-else-if="formType===3">
楼栋信息
<a-divider></a-divider>
<a-form layout="vertical">
<a-form-item label="楼栋号" prop="name">
<span>{{form.name}}</span>
</a-form-item>
<a-form-item label="楼栋照片" style="width: 70%" v-if="fileList.length>0">
<a-upload
:action="`${$upload}`"
:headers="uploadHeaders"
accept='.jpg,.JPG,.png,.PNG'
list-type="picture"
:file-list="fileList"
@preview="handlePreview"
@change="fileChange"
>
</a-upload>
<a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
<img alt="example" style="width: 100%" :src="previewImage" />
</a-modal>
</a-form-item>
</a-form>
单元信息
<a-divider></a-divider>
<a-button class='add-btn' @click='addUnit' style="margin-bottom:5px">新增单元</a-button>
<a-table :columns="unitColumns" :data-source="unitData" :row-key="record => record.id">
<span slot="action" slot-scope="text, row">
<a-space><a @click="addUnit(text, row)">编辑</a>
<a @click="delUnit(text, row)">删除</a></a-space>
</span>
</a-table>
</div>
<!-- foot -->
<div class="drawer-footer">
<a-button :style="{ marginRight: '8px' }" @click="close">
关闭
</a-button>
<a-button type="primary" @click="submit" v-if="formType !==3">
提交
</a-button>
<a-button type="primary" @click="edit" v-else> </a-button>
</div>
</a-drawer>
<!-- 单元 -->
<a-modal
:title="unit.modalTitle"
:visible="unit.showModal"
@ok="unitSubmit"
@cancel="unitClose"
>
<div>
<a-form-model
ref="unForm"
:model="unit.unitForm"
:rules="unit.rules"
layout="vertical"
>
<a-form-model-item prop='name' label='单元名称'>
<a-input placeholder='请输入' v-model="unit.unitForm.name"/>
</a-form-model-item>
<a-form-model-item prop='floor' label='楼层数'>
<a-input placeholder='请输入' v-model.number="unit.unitForm.floor"/>
</a-form-model-item>
<a-form-model-item prop='publicFloor' label='公共楼层数'>
<a-input placeholder='请输入' v-model.number="unit.unitForm.publicFloor"/>
</a-form-model-item>
<a-form-model-item prop='elevator' label='是否有电梯'>
<a-select placeholder='请选择' v-model="unit.unitForm.elevator">
<a-select-option :value='1'></a-select-option>
<a-select-option :value='0'></a-select-option>
</a-select>
</a-form-model-item>
</a-form-model>
</div>
</a-modal>
</div>
</template>
<script>
import { form, rules, unitColumns,uploadHeaders } from "./config";
import { buildInsert,buildUpdate, buildInfo, unitAdd, unitUpdate, unitDel } from '@/api/basic/estate'
function getBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = (error) => reject(error);
});
}
export default {
props: {
show: Boolean,
type: Number,
editId: Number,
},
data() {
return {
form,
rules,
unitColumns,
uploadHeaders,
previewVisible: false,
previewImage: "",
imgLoading: false,
formTitle:'新增楼栋',
fileList: [], //list
unitData: [], //
formType: 1, //1 add 2edit 3detail
unit:{//
showModal:false, //
modalTitle:'',
unitForm:{ //
id:null,
name:'',
floor:null,
elevator:undefined,
publicFloor:null,
manageBuildingId:null
},
rules:{
name:[{required:true,message:'请输入单元名称',trigger:'blur'}],
floor:[{required:true,message:'请输入楼层数',trigger:'blur'}],
elevator:[{required:true,message:'是否有电梯',trigger:'change'}],
publicFloor:[{required:true,message:'公共楼层数',trigger:'blur'}],
}
}
};
},
methods: {
getInfo(){
buildInfo({buildingId:this.form.id}).then(res=>{
this.form.name =res.data.name
this.unitData =res.data.manageUnitFBIVoList
if(!res.data.buildingInfoImgList.length){
this.fileList=[]
}
const file = []
for(let item of res.data.buildingInfoImgList){
let obj = {
name:item.url.split('_')[0] +'.'+ item.url.split('.')[1],
url: this.$ImgUrl(item.url),
uid:item.url.split('_')[1],
status:'done',
thumbUrl: this.$ImgUrl(item.url),
}
file.push(obj)
}
this.fileList = file
})
},
close() {// drawer
this.$emit('close');
this.form = {
id:null,
name: '',
buildingInfoImgUrls:[]
}
this.unitData =[]
this.fileList = []
},
edit(){//
this.formType = 2;
},
submit(){//
let file = []
for(let item of this.fileList){
//
if(item.response){
file.push(item.response.data)
}else{
//
file.push(item.url.split('/')[item.url.split('/').length-1])
}
}
this.form.buildingInfoImgUrls = file
this.$refs.ruleForm.validate(async valid => {
if (valid) {
if(this.formType ===1){
const res = await buildInsert(this.form)
if(res.code === 200){
this.$message.success(res.msg)
this.close()
}else{
this.$message.error(res.msg)
}
}else if(this.formType ===2){
const res = await buildUpdate(this.form)
if(res.code === 200){
this.$message.success(res.msg)
this.close()
}else{
this.$message.error(res.msg)
}
}
}
});
},
addUnit(data,row){//
console.log(row);
if(row!==undefined){
this.unit.modalTitle='修改单元'
this.unit.unitForm= {...row}
this.unit.unitForm.manageBuildingId = this.form.id
}else{
this.unit.modalTitle='新增单元'
}
this.unit.showModal=true
console.log(this.unit.unitForm);
},
unitSubmit(){//
this.$refs.unForm.validate(async valid => {
if (valid) {
if(this.unit.modalTitle==='新增单元'){
let res = await unitAdd(this.unit.unitForm)
if(res.code === 200){
this.$message.success(res.msg)
this.getInfo()
this.unitClose()
}else{
this.$message.error(res.msg)
}
}else{
let res = await unitUpdate(this.unit.unitForm)
if(res.code === 200){
this.$message.success(res.msg)
this.getInfo()
this.unitClose()
}else{
this.$message.error(res.msg)
}
}
}
});
},
delUnit(data,row){
this.$confirm({
title: "是否删除",
icon: "delete",
onOk: async() => {
let res = await unitDel({unitIds:[row.id]})
if(res.code === 200){
this.$message.success(res.msg)
this.getInfo()
}else{
this.$message.error(res.msg)
}
},
});
},
unitClose(){
this.unit.showModal = false;
this.$refs.unForm.resetFields()
},
async handlePreview(file) {
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
}
this.previewImage = file.url || file.preview;
this.previewVisible = true;
},
handleCancel() {
this.previewVisible = false;
},
fileChange(info) {
this.fileList = info.fileList
},
},
watch: {
type: {
handler(val) {
this.formType = val;
},
},
editId:{
handler(val) {
this.form.id = val;
this.unit.unitForm.manageBuildingId = val
if(this.formType !== 1){
this.getInfo()
}
},
},
formType:{
handler(val) {
switch (val) {
case 1:
this.formTitle ='新增楼栋'
break;
case 2:
this.formTitle ='修改楼栋'
break;
case 3:
this.formTitle ='楼栋详情'
break;
default:
break;
}
},
}
},
};
</script>
<style lang="less" scoped>
.detail{
/deep/.anticon svg{
display:none;
}
}
</style>

@ -5,7 +5,7 @@
<a-row> <a-row>
<a-col :span='20'> <a-col :span='20'>
<a-space size="large"> <a-space size="large">
<a-input placeholder="请输入楼栋名称" /> <a-input v-model="searchForm.name" placeholder="请输入楼栋名称" />
<a-button type="primary" @click='getData()'> </a-button> <a-button type="primary" @click='getData()'> </a-button>
<a-button @click='reset()'> </a-button> <a-button @click='reset()'> </a-button>
</a-space> </a-space>
@ -25,189 +25,37 @@
> >
<template v-slot:actionBox="data"> <template v-slot:actionBox="data">
<a-space size="small"> <a-space size="small">
<a class="ant-dropdown-link" @click='detail(data)'>详情</a> <a class="ant-dropdown-link" @click='detail(data.data.id)'>详情</a>
<a class="ant-dropdown-link" @click='del([data.data.id])'>删除</a> <a class="ant-dropdown-link" @click='del([data.data.id])'>删除</a>
</a-space> </a-space>
</template> </template>
</commonTable> </commonTable>
<!-- 添加 --> <curd-form :show='drawerConfig.show' :type="drawerConfig.type" @close='close' :editId='editId'></curd-form>
<a-drawer
title="添加楼栋"
:width="720"
:visible="drawerConfig.addShow"
:body-style="{ paddingBottom: '80px' }"
@close="addClose"
>
<div class="drawer-content">
楼栋信息
<a-divider></a-divider>
<a-form-model
layout='vertical'
ref="ruleForm"
:model="form"
:rules="rules"
>
<a-form-model-item label="楼栋号" prop="name">
<a-input v-model="form.name" placeholder='请输入楼栋号' style="width:50%"/>
</a-form-model-item>
<a-form-model-item label='上传照片' style="width:70%" prop='fileList'>
<a-upload
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
list-type="picture"
:default-file-list="fileList"
>
<a-button> <a-icon type="upload" /> 点击上传 </a-button>
</a-upload>
</a-form-model-item>
</a-form-model>
</div>
<div class="drawer-footer">
<a-button :style="{ marginRight: '8px' }" @click="addClose">
关闭
</a-button>
<a-button type="primary" @click="addClose"> </a-button>
</div>
</a-drawer>
<!-- 详情 -->
<a-drawer
title="楼栋详情"
:width="720"
:visible="drawerConfig.detailShow"
:body-style="{ paddingBottom: '80px' }"
@close="detailClose"
>
<!-- 编辑 -->
<div class="drawer-content" v-if="drawerConfig.editNow">
楼栋信息
<a-divider></a-divider>
<a-form-model
layout='vertical'
ref="ruleForm"
:model="form"
:rules="rules"
>
<a-form-model-item label="楼栋号" prop="name">
<a-input v-model="form.name" placeholder='请输入楼栋号' style="width:50%"/>
</a-form-model-item>
<a-form-model-item label='上传照片' style="width:70%" prop='fileList'>
</a-form-model-item>
</a-form-model>
</div>
<!-- 详情 -->
<div class="drawer-content" v-else>
楼栋信息
<a-divider></a-divider>
<a-form
layout='vertical'
>
<a-form-item label="楼栋号" prop="name">
<span>1</span>
</a-form-item>
<a-form-item label='上传照片' style="width:70%" >
</a-form-item>
</a-form>
单元信息
<a-divider></a-divider>
<a-table :columns="unitColumns" :data-source="unitData">
<span slot="action" slot-scope="text, row">
<a-button @click="edit(text,row)"></a-button>
<a-button @click="del(text,row)"></a-button>
</span>
</a-table>
</div>
<div class="drawer-footer">
<a-button :style="{ marginRight: '8px' }" @click="detailClose">
关闭
</a-button>
<a-button type="primary" @click="detailClose" v-if="drawerConfig.editNow"> </a-button>
<a-button type="primary" @click="drawerConfig.editNow=true" v-else> </a-button>
</div>
</a-drawer>
<!-- <a-modal
title="新增单元"
:visible="addUnitShow"
@ok="addSubmit"
@cancel="addClose"
>
<div></div>
</a-modal> -->
</div> </div>
</template> </template>
<script> <script>
import { columns,pagination,searchForm} from "./depend/config" import { columns,pagination,searchForm,ActionsList} from "./depend/config"
import { buildingList,buildingDel } from "@/api/basic/estate" import { buildingList,buildingDel } from "@/api/basic/estate"
import curdForm from './depend/form.vue'
export default { export default {
components: {
curdForm
},
data() { data() {
return { return {
pagination, pagination,
columns, columns,
searchForm, searchForm,
ActionsList,
drawerConfig:{ drawerConfig:{
addShow:false, type:1,
detailShow:false, show:false,
title:'添加楼栋',
editNow:false,
},
addUnitShow:false,
form:{
name:''
},
rules:{
name:[{required:true,message:'请输入楼栋',trigger:'blur'}],
fileList:[{required:true}]
}, },
fileList: [],
tableChoosed: [], tableChoosed: [],
unitData:[],
unitColumns: [
{
title: "单元名称",
dataIndex: "name",
width: "15%",
},
{
title: "楼层数",
dataIndex: "floor",
width: "15%",
},
{
title: "公共楼层数",
dataIndex: "publicFloor",
width: "18%",
},
{
title: "是否有电梯",
dataIndex: "elevator",
width: "18%",
customRender:function(elevator){
switch (elevator) {
case 1:
return '有'
case 0:
return '无'
default:
break;
}
}
},
{
title: "操作",
dataIndex: "action",
key: "action",
width: "180",
fixed: "right",
scopedSlots: { customRender: "action" },
},
],
// //
tableData: [], tableData: [],
ActionsList: [ editId:undefined,
{
label: "批量删除",
value: 1,
},
],
}; };
}, },
created() { created() {
@ -225,28 +73,23 @@ export default {
this.tableData = res.data.rows this.tableData = res.data.rows
}, },
addBuilding(){ addBuilding(){
this.drawerConfig.addShow = true this.drawerConfig.show = true
this.drawerConfig.type = 1
}, },
addSubmit(){ close(){
this.$refs.ruleForm.validate(valid => { this.drawerConfig.show = false
if (valid) { this.drawerConfig.type = 1;
alert('submit!'); this.editId = null
} else { this.getData()
console.log('error submit!!');
return false;
}
});
},
addClose(){
this.drawerConfig.addShow = false
}, },
detail(data){ detail(data){
console.log(data); this.drawerConfig.show = true;
this.drawerConfig.detailShow = true; this.drawerConfig.type = 3;
this.editId = data
}, },
detailClose(){ reset(){
this.drawerConfig.detailShow = false; this.searchForm.name =''
this.drawerConfig.editNow = false; this.getData()
}, },
handleTableChange(pagination) { handleTableChange(pagination) {
console.log(pagination); console.log(pagination);
@ -254,15 +97,17 @@ export default {
pager.current = pagination.current; pager.current = pagination.current;
pager.pageSize = pagination.pageSize; pager.pageSize = pagination.pageSize;
this.pagination = pager; this.pagination = pager;
this.getData()
}, },
del(ids) { del(ids) {
this.$confirm({ this.$confirm({
title: "是否删除", title: "是否删除",
icon: "", icon: "delete",
onOk: ()=>{ onOk: ()=>{
buildingDel({buildingIds:ids}).then(res=>{ buildingDel({buildingIds:ids}).then(res=>{
if(res.code === 200){ if(res.code === 200){
this.$message.success(res.msg) this.$message.success(res.msg)
this.getData()
}else{ }else{
this.$message.error(res.msg) this.$message.error(res.msg)
} }

@ -166,7 +166,7 @@ export default {
title: "是否" + (operate === 1 ? "通过" : "驳回"), title: "是否" + (operate === 1 ? "通过" : "驳回"),
// okText:'', // okText:'',
// cancelText:'', // cancelText:'',
icon: "", icon: "form",
onOk: async() =>{ onOk: async() =>{
const res = await review({ const res = await review({
estateReviewId: estateReviewId, estateReviewId: estateReviewId,

@ -196,7 +196,7 @@ export default {
title: "是否删除", title: "是否删除",
// okText:'', // okText:'',
// cancelText:'', // cancelText:'',
icon: "", icon: "delete",
onOk: function () { onOk: function () {
console.log(data); console.log(data);
}, },

@ -59,3 +59,14 @@ export const pagination = {
showSizeChanger: true, showSizeChanger: true,
showQuickJumper: true, showQuickJumper: true,
} }
// 操作
export const ActionsList = [
{
label: "批量删除",
value: 1,
},
// {
// label: "批量导出",
// value: 2,
// },
]

@ -0,0 +1,33 @@
/**
* 表单
*
*/
// 表单
export const form = {
manageBuildingId:undefined,
manageUnitId:undefined,
floorLocation:undefined,
name:undefined,
indoorArea:undefined,
constructionArea:undefined,
manageEstateTypeId:undefined,
isEnableLease:undefined,
houseTypeHall:undefined,
houseTypeRoom:undefined,
houseTypeBathroom:undefined,
estateImgUrls:[],
remarks:undefined,
}
export const rules = {
floorLocation: [
{ required: true, message: "楼层位置", trigger: "blur" },
],
name: [
{ required: true, message: "请输入房屋名称", trigger: "blur" },
],
}
import store from "@/store";
export const uploadHeaders = {
"manage-login-token": store.getters.getToken,
}

@ -0,0 +1,164 @@
<template>
<div>
<a-form-model
layout="vertical"
ref="ruleForm"
:model="form"
:rules="rules"
:wrapper-col="{ span: 18 }"
>
<a-row>
<a-col :span="12">
<a-form-model-item label="楼栋" prop="manageBuildingId">
<a-select
v-model="form.manageBuildingId"
placeholder="请选择楼栋"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="单元" prop="manageUnitId">
<a-select v-model="form.manageUnitId" placeholder="请选择单元" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="楼层" prop="floorLocation">
<a-select v-model="form.floorLocation" placeholder="请选择楼层" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="房屋名称" prop="name">
<a-input v-model="form.name" placeholder="请输入房屋名称" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="室内面积" prop="indoorArea">
<a-input
type="number"
v-model="form.indoorArea"
placeholder="请输入室内面积"
suffix="㎡"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="建筑面积" prop="constructionArea">
<a-input
v-model="form.constructionArea"
type="number"
suffix="㎡"
placeholder="请输入建筑面积"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="房屋类型" prop="manageEstateTypeId">
<a-select
mode="multiple"
v-model="form.manageEstateTypeId"
placeholder="请选择房屋类型"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="是否开启租赁" prop="isEnableLease">
<a-select v-model="form.isEnableLease" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<div>房屋户型</div>
</a-col>
<a-col :span="4">
<a-form-model-item label="厅" prop="houseTypeHall">
<a-input type="number" :min="0" v-model="form.houseTypeHall" />
</a-form-model-item>
</a-col>
<a-col :span="4">
<a-form-model-item label="室" prop="houseTypeRoom">
<a-input type="number" :min="0" v-model="form.houseTypeRoom" />
</a-form-model-item>
</a-col>
<a-col :span="4">
<a-form-model-item label="卫" prop="houseTypeBathroom">
<a-input type="number" :min="0" v-model="form.houseTypeBathroom" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="房屋照片" prop="estateImgUrls">
<a-upload
:action="`${$upload}`"
list-type="picture-card"
:file-list="fileList"
@preview="handlePreview"
@change="handleChange"
>
<div v-if="fileList.length < 5">
<a-icon type="plus" />
<div class="ant-upload-text">Upload</div>
</div>
</a-upload>
<a-modal
:visible="previewVisible"
:footer="null"
@cancel="handleCancel"
>
<img alt="example" style="width: 100%" :src="previewImage" />
</a-modal>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="备注" prop="remarks">
<a-textarea v-model="form.remarks" :rows="4" />
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</div>
</template>
<script>
import { form, rules, uploadHeaders } from "./form.js";
function getBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = error => reject(error);
});
}
export default {
props: {
editId: Number,
},
data() {
return {
form,
rules,
uploadHeaders,
fileList: [],
previewVisible: false,
previewImage: "",
};
},
methods: {
async handlePreview(file) {
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
}
this.previewImage = file.url || file.preview;
this.previewVisible = true;
},
handleCancel() {
this.previewVisible = false;
},
handleChange({ fileList }) {
this.fileList = fileList;
console.log(this.fileList);
},
},
watch: {},
};
</script>
<style lang="less" scoped>
</style>

@ -8,12 +8,15 @@
<a-input placeholder="请输入房屋名称" /> <a-input placeholder="请输入房屋名称" />
<a-select style="width: 200px" placeholder="请选择房屋类型" /> <a-select style="width: 200px" placeholder="请选择房屋类型" />
<a-select style="width: 200px" placeholder="请选择是否开启租赁" /> <a-select style="width: 200px" placeholder="请选择是否开启租赁" />
<a-button type="primary" @click='getData'> </a-button> <a-button type="primary" @click="getData"> </a-button>
<a-button> </a-button> <a-button> </a-button>
</a-space> </a-space>
</a-col> </a-col>
<a-col :span="4"> <a-col :span="4">
<a-button class="add-btn" @click="drawerConfig.addShow = true">添加房屋</a-button> <a-space>
<a-button class="add-btn" @click="drawerConfig.addShow = true">添加房屋</a-button>
<a-button @click="drawerConfig.houseType = true">房屋配置</a-button>
</a-space>
</a-col> </a-col>
</a-row> </a-row>
</div> </div>
@ -70,8 +73,8 @@
</span> </span>
<span slot="action" slot-scope="text, row"> <span slot="action" slot-scope="text, row">
<a-space> <a-space>
<a class="ant-dropdown-link" @click='edit(row)'></a> <a class="ant-dropdown-link" @click="edit(row)"></a>
<a class="ant-dropdown-link" @click='del([row.id])'></a> <a class="ant-dropdown-link" @click="del([row.id])"></a>
</a-space> </a-space>
</span> </span>
<span slot="tags" slot-scope="tag"> <span slot="tags" slot-scope="tag">
@ -82,7 +85,10 @@
</a-tag> </a-tag>
</span> </span>
<span slot="switch" slot-scope="switchV, row"> <span slot="switch" slot-scope="switchV, row">
<a-switch :checked="switchV === 1" @change="handleEnable(row)"></a-switch> <a-switch
:checked="switchV === 1"
@change="handleEnable(row)"
></a-switch>
</span> </span>
</a-table> </a-table>
</div> </div>
@ -96,140 +102,7 @@
<div class="drawer-content"> <div class="drawer-content">
基本信息 基本信息
<a-divider></a-divider> <a-divider></a-divider>
<a-form-model <vue-form></vue-form>
layout="vertical"
ref="ruleForm"
:model="form"
:rules="rules"
:wrapper-col="{span:18}"
>
<a-row>
<a-col :span="12">
<a-form-model-item label="楼栋" prop="manageBuildingId">
<a-select
v-model="form.manageBuildingId"
placeholder="请选择楼栋"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="单元" prop="manageUnitId">
<a-select
v-model="form.manageUnitId"
placeholder="请选择单元"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="楼层" prop="floorLocation">
<a-select
v-model="form.floorLocation"
placeholder="请选择楼层"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="房屋名称" prop="name">
<a-input
v-model="form.name"
placeholder="请输入房屋名称"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="室内面积" prop="indoorArea">
<a-input
type="number"
v-model="form.indoorArea"
placeholder="请输入室内面积"
suffix="㎡"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="建筑面积" prop="constructionArea">
<a-input
v-model="form.constructionArea"
type="number"
suffix="㎡"
placeholder="请输入建筑面积"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="房屋类型" prop="manageEstateTypeId">
<a-select
mode="multiple"
v-model="form.manageEstateTypeId"
placeholder="请选择房屋类型"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="是否开启租赁" prop="isEnableLease">
<a-select
v-model="form.isEnableLease"
/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<div>房屋户型</div>
</a-col>
<a-col :span="4">
<a-form-model-item label="厅" prop="houseTypeHall">
<a-input
type="number"
:min="0"
v-model="form.houseTypeHall"
/>
</a-form-model-item>
</a-col>
<a-col :span="4">
<a-form-model-item label="室" prop="houseTypeRoom">
<a-input
type="number"
:min="0"
v-model="form.houseTypeRoom"
/>
</a-form-model-item>
</a-col>
<a-col :span="4">
<a-form-model-item label="卫" prop="houseTypeBathroom">
<a-input
type="number"
:min="0"
v-model="form.houseTypeBathroom"
/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="房屋照片" prop="estateImgUrls">
<a-upload
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
list-type="picture-card"
:file-list="fileList"
@preview="handlePreview"
@change="handleChange"
>
<div v-if="fileList.length < 8">
<a-icon type="plus" />
<div class="ant-upload-text">
Upload
</div>
</div>
</a-upload>
<a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
<img alt="example" style="width: 100%" :src="previewImage" />
</a-modal>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="备注" prop="remarks">
<a-textarea v-model="form.remarks" :rows="4"/>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</div> </div>
<div class="drawer-footer"> <div class="drawer-footer">
<a-button :style="{ marginRight: '8px' }" @click="addClose"> <a-button :style="{ marginRight: '8px' }" @click="addClose">
@ -238,140 +111,204 @@
<a-button type="primary" @click="addClose"> </a-button> <a-button type="primary" @click="addClose"> </a-button>
</div> </div>
</a-drawer> </a-drawer>
<!-- 房屋类型 -->
<a-drawer
title="房屋设置"
:width="720"
:visible="drawerConfig.houseType"
:body-style="{ paddingBottom: '80px' }"
@close="drawerConfig.houseType=false"
>
<div class="drawer-content">
房屋类型
<a-divider></a-divider>
<!-- tags -->
<span v-for="item in typeList" :key="item.id">
<a-input
v-if="item.show"
ref="input"
type="text"
size="small"
:style="{ width: '78px','padding-bottom':'3px','margin-right':'7px' }"
v-model="item.name"
@blur="editType(item)"
@keyup.enter="editType(item)"
/>
<a-tag
v-else closable @close="delType(item.id)"
@click="editInput(item)" >
{{item.name}}
</a-tag>
</span>
<!-- addTag -->
<span>
<a-input
v-if="inputVisible"
ref="addInput"
type="text"
size="small"
:style="{ width: '78px','padding-bottom':'3px'}"
:value="typeForm.name"
@change="handleInputChange"
@blur="handleInputConfirm"
@keyup.enter="handleInputConfirm"
/>
<a-tag v-else style="background: #fff; borderStyle: dashed;" @click="addShow">
<a-icon type="plus" /> 新增类型
</a-tag>
</span>
</div>
<div class="drawer-footer">
<a-button :style="{ marginRight: '8px' }" @click="drawerConfig.houseType=false">
关闭
</a-button>
</div>
</a-drawer>
</div> </div>
</template> </template>
<script> <script>
function getBase64(file) { import { columns, pagination, searchForm, ActionsList } from "./depend/config";
return new Promise((resolve, reject) => { import { houseList, houseDel, isEnableLease, estateType, estateTypeInsert, estateTypeDel, estateTypeUpdate } from "@/api/basic/estate";
const reader = new FileReader(); import vueForm from "./depend/form.vue";
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = error => reject(error);
});
}
import { columns,pagination,searchForm } from "./depend/config"
import { houseList, houseDel, isEnableLease} from '@/api/basic/estate'
export default { export default {
components: {
vueForm,
},
data() { data() {
return { return {
drawerConfig:{ drawerConfig: {
addShow:false, addShow: false,
houseType: false
}, },
previewVisible: false, pagination,
previewImage: '', searchForm,
fileList: [ columns,
{ ActionsList,
uid: '-1', inputVisible: false,
name: 'image.png', typeForm:{
status: 'done', id: null,
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png', name: ''
},
{
uid: '-2',
name: 'image.png',
status: 'done',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
},
{
uid: '-3',
name: 'image.png',
status: 'done',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
},
{
uid: '-4',
name: 'image.png',
status: 'done',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
},
{
uid: '-5',
name: 'image.png',
status: 'error',
},
],
form:{
manageBuildingId:undefined,
manageUnitId:undefined,
floorLocation:undefined,
name:undefined,
indoorArea:undefined,
constructionArea:undefined,
manageEstateTypeId:undefined,
isEnableLease:undefined,
houseTypeHall:undefined,
houseTypeRoom:undefined,
houseTypeBathroom:undefined,
estateImgUrls:undefined,
remarks:undefined,
}, },
rules:{},
pagination:pagination ,
searchForm:searchForm,
columns:columns ,
activeAction: undefined, activeAction: undefined,
loading: false, loading: false,
// index // index
selectedRowKeys: [], selectedRowKeys: [],
tableChoosed: [], tableChoosed: [],
// tableData: [],
// typeList:[]
//
tableData:[],
ActionsList: [
{
label: "批量删除",
value: 1,
},
// {
// label: "",
// value: 2,
// },
],
}; };
}, },
created() { created() {
this.getData() this.getData();
this.getType()
}, },
methods: { methods: {
async getData() { async getData() {
const res = await houseList( const res = await houseList({
{ pageNum: this.pagination.current,
pageNum:this.pagination.current, size: this.pagination.pageSize,
size:this.pagination.pageSize, name: this.searchForm.name,
name:this.searchForm.name, isEnableLease: this.searchForm.isEnableLease,
isEnableLease:this.searchForm.isEnableLease, manageEstateTypeId: this.searchForm.manageEstateTypeId,
manageEstateTypeId:this.searchForm.manageEstateTypeId, });
} this.tableData = res.data.rows;
) },
this.tableData = res.data.rows async getType() {
this.typeList = []
const res = await estateType();
const arr = res.data;
arr.forEach(ele => {
ele.show = false;
})
this.typeList = arr;
}, },
addHouse() {}, addHouse() {},
handleCancel() { addClose() {
this.previewVisible = false; this.drawerConfig.addShow = false;
}, },
async handlePreview(file) { //
if (!file.url && !file.preview) { addShow(){
file.preview = await getBase64(file.originFileObj); this.inputVisible = true;
} this.$nextTick(function() {
this.previewImage = file.url || file.preview; this.$refs.addInput.focus();
this.previewVisible = true; });
}, },
handleChange({ fileList }) { //
this.fileList = fileList; delType(id){
this.$confirm({
title: "是否删除",
icon:'delete',
onOk:async()=>{
let res = await estateTypeDel({manageEstateTypeIds:[id]})
if(res.code=== 200){
this.$message.success(res.msg);
this.getType()
}else{
this.$message.error(res.msg);
this.getType()
}
},
onCancel:()=>{
this.getType() //
}
})
}, },
handleEnable: async function(data) { // input
const res = await isEnableLease({ editInput(obj,i) {
estateId:data.id obj.show = true; // v-if show = trueinput
this.$nextTick(()=>{ //nextTickrefs.inputundefineddom
console.log(this.$refs.input[0]);//V-IFinputrefs.input10index
console.log(this.$refs.input[0].focus());//$refs.input[0].focus()undefinedfunction
this.$refs.input[0].focus() //
}) })
if(res.code===200){ },
//
async editType(item){
let res = await estateTypeUpdate({
id: item.id,
name: item.name
})
if(res.code === 200){
this.$message.success(res.msg) this.$message.success(res.msg)
this.getData() item.show = false
}else{ }else{
this.$message.error(res.msg) this.$message.error(res.msg)
} }
}, },
handleInputChange(e) {
this.typeForm.name = e.target.value;
},
async handleInputConfirm() {
if(this.typeForm.name === ''){
this.inputVisible = false;
return
}
let res = await estateTypeInsert({
name:this.typeForm.name,
})
if(res.code === 200){
this.$message.success(res.msg);
this.inputVisible = false;
this.typeForm.name = ''
this.getType()
}else{
this.$message.error(res.msg);
}
},
//
handleEnable: async function (data) {
const res = await isEnableLease({
estateId: data.id,
});
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
} else {
this.$message.error(res.msg);
}
},
handleTableChange(pagination) { handleTableChange(pagination) {
console.log(pagination); console.log(pagination);
const pager = { ...this.pagination }; const pager = { ...this.pagination };
@ -382,31 +319,28 @@ export default {
del(ids) { del(ids) {
this.$confirm({ this.$confirm({
title: "是否删除", title: "是否删除",
icon: "", icon: "delete",
onOk:() =>{ onOk: () => {
houseDel({estateIds:ids}).then(res=>{ houseDel({ estateIds: ids }).then((res) => {
if(res.code === 200){ if (res.code === 200) {
this.$message.success(res.msg) this.$message.success(res.msg);
}else{ } else {
this.$message.error(res.msg) this.$message.error(res.msg);
} }
}) });
}, },
}); });
}, },
Actions(data) { Actions(data) {
// //
if(data===1){ if (data === 1) {
this.del(this.selectedRowKeys) this.del(this.selectedRowKeys);
this.activeAction = undefined; this.activeAction = undefined;
} }
}, },
onSelectChange(selectedRowKeys) { onSelectChange(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys; this.selectedRowKeys = selectedRowKeys;
}, },
addClose(){
this.drawerConfig.addShow = false;
}
}, },
computed: { computed: {
// selection // selection
@ -427,4 +361,7 @@ export default {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
/deep/.ant-tag{
margin-bottom: 8px;
}
</style> </style>

@ -146,7 +146,7 @@ export function del(data) {
title: "是否删除", title: "是否删除",
// okText:'删除', // okText:'删除',
// cancelText:'取消', // cancelText:'取消',
icon: "", icon: "delete",
onOk: function () { onOk: function () {
console.log(data); console.log(data);
}, },

Loading…
Cancel
Save