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

dev
bibi 3 years ago
parent c9cfbd6f16
commit 8efa6fa4d3

@ -9,6 +9,30 @@ export function buildingList(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) {
return httpService({
@ -17,7 +41,32 @@ export function buildingDel(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) {
return httpService({
@ -26,7 +75,7 @@ export function houseList(params) {
params: params,
})
}
// 房屋列表
// 房屋新增
export function houseInsert(params) {
return httpService({
url: `/user/estate/insert`,
@ -42,7 +91,7 @@ export function houseDel(params) {
data: params,
})
}
// 房屋租切换
// 房屋租切换
export function isEnableLease(params) {
return httpService({
url: `/user/estate/isEnableLease`,
@ -50,3 +99,35 @@ export function isEnableLease(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'
export default {
install: function (Vue) {
Vue.prototype.$upload = process.env.VUE_APP_URL + store.getters.getCommunityCode +'/manage/user/upload/uploadTestMinioImg'
Vue.prototype.ImgUrl = (src) => {
return process.env.VUE_APP_STATIC + src
// 上传
Vue.prototype.$upload = process.env.VUE_APP_URL + store.getters.getCommunityCode + '/manage/user/upload/uploadImg'
// 静态地址
Vue.prototype.$ImgUrl = (src) => {
return process.env.VUE_APP_STATIC + store.getters.getCommunityCode + '/' + src
}
// 时间格式化
Vue.prototype.formatDate = (time, fmt) => {
if (time > 0) {
let date = new Date(time * 1000)

@ -13,6 +13,20 @@
:key="index"
: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
v-for="(rolechild, indexs) in item.childrenList"
class="role-card"
@ -141,7 +155,7 @@ export default {
title: "是否删除",
// okText:'',
// cancelText:'',
icon: "",
icon: "delete",
onOk:()=> {
roleDel({roleId:id}).then(res=>{
if(res.code === 200){
@ -180,7 +194,7 @@ export default {
title: "是否删除",
// okText:'',
// cancelText:'',
icon: "",
icon: "delete",
onOk: function () {
console.log(data);
},

@ -18,6 +18,20 @@
:key="index"
: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
v-for="(rolechild, indexs) in item.childrenList"
class="role-card"
@ -100,7 +114,11 @@
:selected-keys="tree.selectedKeys"
:tree-data="roleList"
:checkStrictly="true"
:replaceFields="{ children:'childrenList', title:'name', key:'id' }"
:replaceFields="{
children: 'childrenList',
title: 'name',
key: 'id',
}"
@expand="onExpand"
@select="onSelect"
@check="onCheck"
@ -181,7 +199,7 @@ export default {
},
deep: true,
},
'tree.checkedKeys'(val) {
"tree.checkedKeys"(val) {
// console.log('onCheck', val);
},
},
@ -193,7 +211,7 @@ export default {
getData() {
getrolelist().then((res) => {
this.roleList = res.data;
this.afterroleList = JSON.parse(JSON.stringify(this.roleList))
this.afterroleList = JSON.parse(JSON.stringify(this.roleList));
});
},
getPeople() {
@ -225,7 +243,7 @@ export default {
title: "是否删除",
// okText:'',
// cancelText:'',
icon: "",
icon: "delete",
onOk: () => {
roleDel({ roleId: id }).then((res) => {
if (res.code === 200) {
@ -271,7 +289,7 @@ export default {
for (let name of data.roleNameList) {
haveid.push(name.id);
}
this.tree.checkedKeys = haveid
this.tree.checkedKeys = haveid;
this.send.show = true;
},
onExpand(expandedKeys) {
@ -282,16 +300,15 @@ export default {
this.tree.autoExpandParent = false;
},
onCheck(checkedKeys) {
const arr = []
const arr = [];
this.tree.checkedKeys = checkedKeys;
for (let k of this.tree.checkedKeys.checked) {
arr.push(k)
arr.push(k);
}
this.form.roleId = arr.toString()
console.log(this.form.roleId);
this.form.roleId = arr.toString();
},
onSelect(selectedKeys, info) {
console.log('onSelect', info);
console.log("onSelect", info);
this.tree.selectedKeys = selectedKeys;
},
// multiRole(data){
@ -312,7 +329,8 @@ export default {
const res = await assignRoles(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
this.getPeople();
this.sendClose();
} else {
this.$message.error(res.msg);
}
@ -321,10 +339,6 @@ export default {
this.form.manageUserId = undefined;
this.send.show = false;
},
// sendClose(){
// this.form.manageUserId = undefined
// this.send.show = false
// },
Actions(data) {
console.log(data);
},

@ -67,3 +67,65 @@ export const pagination = {
showSizeChanger: 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>
<div>
<!-- 员工 新增修改表单 -->
<a-form-model
title="1d2"
layout="vertical"
@ -72,6 +73,7 @@
:action="`${$upload}`"
:headers="uploadHeaders"
list-type="picture-card"
accept='.jpg,.JPG,.png,.PNG,.jpeg,.JPEG'
:file-list="idcardfileList"
@preview="handlePreview"
@change="idcardhandleChange"
@ -93,7 +95,7 @@
<a-divider></a-divider>
<a-row>
<a-col :span="12">
<a-form-model-item label="岗位" prop='departmentIdPath'>
<a-form-model-item label="岗位" prop='cascVal'>
<a-cascader
:field-names="{
label: 'name',
@ -102,9 +104,8 @@
}"
:options="treeData"
placeholder="请选择"
change-on-select
@change="onChange"
v-model="cascVal"
v-model="form.cascVal"
/>
</a-form-model-item>
</a-col>
@ -125,14 +126,17 @@
<a-col :span="24">
<div>上传资料</div>
<a-upload
:action="`${$baseUrl}/user/upload/uploadManageUserData`"
:action="`${$upload}`"
:headers="uploadHeaders"
accept='.jpg,.JPG,.png,.PNG,.pdf,.PDF'
list-type="picture"
:default-file-list="fileList"
:file-list="fileList"
@preview="handlePreview"
@change="fileChange"
>
<a-button> <a-icon type="upload"/> 点击上传 </a-button>
</a-upload>
<span style="color: #00000073">支持上传PNGJPG,PDF文件</span>
<span style="color: #00000073">支持上传PNGJPGPDF文件</span>
</a-col>
</a-row>
<div style="margin-top: 20px">联系信息</div>
@ -209,8 +213,8 @@
</template>
<script>
import { form, rules, sexOption, uploadHeaders } from "./config"
import { insertManageUser, departmentList, manageUserInfo, EditManageUser } from "@/api/basic/department";
import store from "@/store";
function getBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
@ -228,119 +232,19 @@ export default {
},
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() {
return {
form,
rules,
sexOption,
uploadHeaders,
previewVisible: false,
previewImage: "",
imgLoading: false,
treeData:[],
cascVal:[],
telephoneNum:"",
uploadHeaders: {
"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:[]
treeData:[], //
telephoneNum:"", //
idcardfileList: [], //
fileList:[], //
};
},
created() {
@ -350,10 +254,46 @@ export default {
getData(){
departmentList().then((res) => {
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() {
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) => {
if (!valid) {
return;
@ -362,7 +302,7 @@ export default {
insertManageUser(this.form).then((res) => {
if(res.code===200){
this.$message.success(res.msg)
this.success()
this.$emit('success')
this.close()
}
});
@ -370,11 +310,11 @@ export default {
if(this.form.tel === this.telephoneNum){
this.form.tel = null
}
console.log(this.form);
// console.log(this.form);
EditManageUser(this.form).then((res) => {
if(res.code===200){
this.$message.success(res.msg)
this.success()
this.$emit('success')
this.close()
}
});
@ -384,18 +324,28 @@ export default {
//
close() {
this.$refs.ruleForm.resetFields();
this.cascVal = []
},
success(){
this.$emit('success')
this.form.cascVal = []
this.idcardfileList =[]
this.fileList =[]
},
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) {
file.preview = await getBase64(file.originFileObj);
}
this.previewImage = file.url || file.preview;
this.previewVisible = true;
},
//
onChange(data) {
// data [1,2,2]
// yyyy-mm-dd hh:mm:ss
@ -415,13 +365,87 @@ export default {
},
idcardhandleChange(info) {
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>
<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() {
if (this.depepartmentTitle === "新增组织架构") {
@ -349,7 +343,7 @@ export default {
} else {
this.$confirm({
title: "是否删除",
icon: "",
icon: "delete",
onOk: () => {
departmentDel({ id: this.choose.id, type: this.choose.type }).then(
(res) => {
@ -389,15 +383,22 @@ export default {
},
//
addStaff() {
this.type = 'add'
this.show.addStaffShow = true;
},
edit(row){
this.show.addStaffShow = true;
this.type = 'edit'
this.editId = row.id
this.show.addStaffTitle = "修改员工信息"
},
addStaffSubmit() {
this.$refs.addform.submit();
},
addStaffClose() {
this.editId =null
this.$refs.addform.close();
this.show.addStaffShow = false;
this.editId =null
},
resetPsw(id){
this.show.resetPswShow = true

@ -53,3 +53,62 @@ export const pagination = {
total: 0,
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-col :span='20'>
<a-space size="large">
<a-input placeholder="请输入楼栋名称" />
<a-input v-model="searchForm.name" placeholder="请输入楼栋名称" />
<a-button type="primary" @click='getData()'> </a-button>
<a-button @click='reset()'> </a-button>
</a-space>
@ -25,189 +25,37 @@
>
<template v-slot:actionBox="data">
<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-space>
</template>
</commonTable>
<!-- 添加 -->
<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> -->
<curd-form :show='drawerConfig.show' :type="drawerConfig.type" @close='close' :editId='editId'></curd-form>
</div>
</template>
<script>
import { columns,pagination,searchForm} from "./depend/config"
import { columns,pagination,searchForm,ActionsList} from "./depend/config"
import { buildingList,buildingDel } from "@/api/basic/estate"
import curdForm from './depend/form.vue'
export default {
components: {
curdForm
},
data() {
return {
pagination,
columns,
searchForm,
ActionsList,
drawerConfig:{
addShow:false,
detailShow:false,
title:'添加楼栋',
editNow:false,
},
addUnitShow:false,
form:{
name:''
},
rules:{
name:[{required:true,message:'请输入楼栋',trigger:'blur'}],
fileList:[{required:true}]
type:1,
show:false,
},
fileList: [],
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: [],
ActionsList: [
{
label: "批量删除",
value: 1,
},
],
editId:undefined,
};
},
created() {
@ -225,28 +73,23 @@ export default {
this.tableData = res.data.rows
},
addBuilding(){
this.drawerConfig.addShow = true
this.drawerConfig.show = true
this.drawerConfig.type = 1
},
addSubmit(){
this.$refs.ruleForm.validate(valid => {
if (valid) {
alert('submit!');
} else {
console.log('error submit!!');
return false;
}
});
},
addClose(){
this.drawerConfig.addShow = false
close(){
this.drawerConfig.show = false
this.drawerConfig.type = 1;
this.editId = null
this.getData()
},
detail(data){
console.log(data);
this.drawerConfig.detailShow = true;
this.drawerConfig.show = true;
this.drawerConfig.type = 3;
this.editId = data
},
detailClose(){
this.drawerConfig.detailShow = false;
this.drawerConfig.editNow = false;
reset(){
this.searchForm.name =''
this.getData()
},
handleTableChange(pagination) {
console.log(pagination);
@ -254,15 +97,17 @@ export default {
pager.current = pagination.current;
pager.pageSize = pagination.pageSize;
this.pagination = pager;
this.getData()
},
del(ids) {
this.$confirm({
title: "是否删除",
icon: "",
icon: "delete",
onOk: ()=>{
buildingDel({buildingIds:ids}).then(res=>{
if(res.code === 200){
this.$message.success(res.msg)
this.getData()
}else{
this.$message.error(res.msg)
}

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

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

@ -59,3 +59,14 @@ export const pagination = {
showSizeChanger: 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-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-space>
</a-col>
<a-col :span="4">
<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-row>
</div>
@ -70,8 +73,8 @@
</span>
<span slot="action" slot-scope="text, row">
<a-space>
<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="edit(row)"></a>
<a class="ant-dropdown-link" @click="del([row.id])"></a>
</a-space>
</span>
<span slot="tags" slot-scope="tag">
@ -82,7 +85,10 @@
</a-tag>
</span>
<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>
</a-table>
</div>
@ -96,282 +102,213 @@
<div class="drawer-content">
基本信息
<a-divider></a-divider>
<a-form-model
layout="vertical"
ref="ruleForm"
:model="form"
:rules="rules"
:wrapper-col="{span:18}"
<vue-form></vue-form>
</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.houseType"
:body-style="{ paddingBottom: '80px' }"
@close="drawerConfig.houseType=false"
>
<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">
<div class="drawer-content">
房屋类型
<a-divider></a-divider>
<!-- tags -->
<span v-for="item in typeList" :key="item.id">
<a-input
type="number"
:min="0"
v-model="form.houseTypeRoom"
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-form-model-item>
</a-col>
<a-col :span="4">
<a-form-model-item label="卫" prop="houseTypeBathroom">
<a-tag
v-else closable @close="delType(item.id)"
@click="editInput(item)" >
{{item.name}}
</a-tag>
</span>
<!-- addTag -->
<span>
<a-input
type="number"
:min="0"
v-model="form.houseTypeBathroom"
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-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>
<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="addClose">
<a-button :style="{ marginRight: '8px' }" @click="drawerConfig.houseType=false">
关闭
</a-button>
<a-button type="primary" @click="addClose"> </a-button>
</div>
</a-drawer>
</div>
</template>
<script>
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);
});
}
import { columns,pagination,searchForm } from "./depend/config"
import { houseList, houseDel, isEnableLease} from '@/api/basic/estate'
import { columns, pagination, searchForm, ActionsList } from "./depend/config";
import { houseList, houseDel, isEnableLease, estateType, estateTypeInsert, estateTypeDel, estateTypeUpdate } from "@/api/basic/estate";
import vueForm from "./depend/form.vue";
export default {
components: {
vueForm,
},
data() {
return {
drawerConfig: {
addShow: false,
houseType: false
},
previewVisible: false,
previewImage: '',
fileList: [
{
uid: '-1',
name: 'image.png',
status: 'done',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
},
{
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,
pagination,
searchForm,
columns,
ActionsList,
inputVisible: false,
typeForm:{
id: null,
name: ''
},
rules:{},
pagination:pagination ,
searchForm:searchForm,
columns:columns ,
activeAction: undefined,
loading: false,
// index
selectedRowKeys: [],
tableChoosed: [],
//
//
//
tableData: [],
ActionsList: [
{
label: "批量删除",
value: 1,
},
// {
// label: "",
// value: 2,
// },
],
typeList:[]
};
},
created() {
this.getData()
this.getData();
this.getType()
},
methods: {
async getData() {
const res = await houseList(
{
const res = await houseList({
pageNum: this.pagination.current,
size: this.pagination.pageSize,
name: this.searchForm.name,
isEnableLease: this.searchForm.isEnableLease,
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() {},
handleCancel() {
this.previewVisible = false;
addClose() {
this.drawerConfig.addShow = false;
},
//
addShow(){
this.inputVisible = true;
this.$nextTick(function() {
this.$refs.addInput.focus();
});
},
//
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()
}
},
async handlePreview(file) {
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
onCancel:()=>{
this.getType() //
}
this.previewImage = file.url || file.preview;
this.previewVisible = true;
})
},
handleChange({ fileList }) {
this.fileList = fileList;
// input
editInput(obj,i) {
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() //
})
},
handleEnable: async function(data) {
const res = await isEnableLease({
estateId:data.id
//
async editType(item){
let res = await estateTypeUpdate({
id: item.id,
name: item.name
})
if(res.code === 200){
this.$message.success(res.msg)
this.getData()
item.show = false
}else{
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) {
console.log(pagination);
const pager = { ...this.pagination };
@ -382,31 +319,28 @@ export default {
del(ids) {
this.$confirm({
title: "是否删除",
icon: "",
icon: "delete",
onOk: () => {
houseDel({estateIds:ids}).then(res=>{
houseDel({ estateIds: ids }).then((res) => {
if (res.code === 200) {
this.$message.success(res.msg)
this.$message.success(res.msg);
} else {
this.$message.error(res.msg)
this.$message.error(res.msg);
}
})
});
},
});
},
Actions(data) {
//
if (data === 1) {
this.del(this.selectedRowKeys)
this.del(this.selectedRowKeys);
this.activeAction = undefined;
}
},
onSelectChange(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys;
},
addClose(){
this.drawerConfig.addShow = false;
}
},
computed: {
// selection
@ -427,4 +361,7 @@ export default {
display: flex;
justify-content: space-between;
}
/deep/.ant-tag{
margin-bottom: 8px;
}
</style>

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

Loading…
Cancel
Save