修改入住与退租,报修相关代码
dev
zxf 5 months ago
parent 65de61448b
commit 0473745c07

@ -16,9 +16,48 @@
<el-form-item label="入住日期">
<el-date-picker
v-model="dataForm.checkInDate"
type="date"
placeholder="选择入住日期"
style="width: 180px"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
style="width: 280px"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
clearable
/>
</el-form-item>
<el-form-item label="钥匙交接状态">
<el-select v-model="dataForm.keyHandover" placeholder="请选择钥匙交接状态" clearable style="width: 180px">
<el-option v-if="!dict.type.sys_yes_no" label="无数据" value="" disabled />
<el-option
v-else
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="是否申请装修">
<el-select v-model="dataForm.decorationApply" placeholder="请选择是否申请装修" clearable style="width: 180px">
<el-option v-if="!dict.type.sys_yes_no" label="无数据" value="" disabled />
<el-option
v-else
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="物业费起算日期">
<el-date-picker
v-model="dataForm.propertyFeeStart"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
style="width: 280px"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
clearable
@ -48,6 +87,7 @@
header-align="center"
align="center"
label="租赁信息"
show-overflow-tooltip
:formatter="tenantHouseFormatter">
</el-table-column>
<el-table-column
@ -74,7 +114,8 @@
prop="keyHandover"
header-align="center"
align="center"
label="钥匙交接状态">
label="钥匙交接状态"
:formatter="sysYesNoFormatter">
</el-table-column>
<el-table-column
prop="propertyFeeStart"
@ -86,7 +127,8 @@
prop="decorationApply"
header-align="center"
align="center"
label="是否申请装修">
label="是否申请装修"
:formatter="sysYesNoFormatter">
</el-table-column>
<el-table-column
prop="decorationDeposit"
@ -149,16 +191,16 @@
components: {
AddOrUpdate
},
dicts: ['dept_type'],
dicts: ['dept_type','sys_yes_no'],
data () {
return {
dataForm: {
tenantHouseId: '',
userType: '',
userId: '',
checkInDate: '',
checkInDate: [],
keyHandover: '',
propertyFeeStart: '',
propertyFeeStart: [],
decorationApply: '',
decorationDeposit: '',
decorationPeriod: '',
@ -196,14 +238,14 @@
tenantHouseId: '',
userType: '',
userId: '',
checkInDate: '',
checkInDate: [],
keyHandover: '',
propertyFeeStart: '',
propertyFeeStart: [],
decorationApply: '',
decorationDeposit: '',
decorationPeriod: '',
handlerId: '',
remark: '',
remark: ''
}
this.getDataList()
},
@ -220,9 +262,17 @@
if (this.dataForm.tenantHouseId) params.tenantHouseId = this.dataForm.tenantHouseId;
if (this.dataForm.userType) params.userType = this.dataForm.userType;
if (this.dataForm.userId) params.userId = this.dataForm.userId;
if (this.dataForm.checkInDate) params.checkInDate = this.dataForm.checkInDate;
//
if (this.dataForm.checkInDate && this.dataForm.checkInDate.length === 2) {
params.checkInDateStart = this.dataForm.checkInDate[0];
params.checkInDateEnd = this.dataForm.checkInDate[1];
}
if (this.dataForm.keyHandover) params.keyHandover = this.dataForm.keyHandover;
if (this.dataForm.propertyFeeStart) params.propertyFeeStart = this.dataForm.propertyFeeStart;
//
if (this.dataForm.propertyFeeStart && this.dataForm.propertyFeeStart.length === 2) {
params.propertyFeeStartStart = this.dataForm.propertyFeeStart[0];
params.propertyFeeStartEnd = this.dataForm.propertyFeeStart[1];
}
if (this.dataForm.decorationApply) params.decorationApply = this.dataForm.decorationApply;
if (this.dataForm.decorationDeposit) params.decorationDeposit = this.dataForm.decorationDeposit;
if (this.dataForm.decorationPeriod) params.decorationPeriod = this.dataForm.decorationPeriod;
@ -324,11 +374,11 @@
if (row.userType === '1') {
//
const owner = this.ownerList.find(item => item.id === cellValue)
return owner ? `${owner.ownerName} (${owner.id})` : cellValue
return owner ? `${owner.ownerName}` : cellValue
} else if (row.userType === '2') {
//
const tenant = this.tenantList.find(item => item.id === cellValue)
return tenant ? `${tenant.tenantName} (${tenant.id})` : cellValue
return tenant ? `${tenant.tenantName}` : cellValue
}
return cellValue
},
@ -338,10 +388,16 @@
const tenantHouse = this.tenantHouseList.find(item => item.id === cellValue)
if (tenantHouse) {
//
return `月租金: ${tenantHouse.rentAmount || 0}元 - ${tenantHouse.rentBeginTime || ''}${tenantHouse.rentEndTime || ''}`
return `${tenantHouse.rentBeginTime || ''}${tenantHouse.rentEndTime || ''}`
}
return cellValue
},
// /
sysYesNoFormatter(row, column, cellValue) {
if (!cellValue) return ''
const dict = this.dict.type.sys_yes_no?.find(item => item.value === cellValue)
return dict ? dict.label : cellValue
},
}
}
</script>

@ -1,6 +1,11 @@
<template>
<div class="tab-content">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="租赁信息">
<el-select v-model="dataForm.tenantHouseId" placeholder="请选择租赁信息" clearable style="width: 300px">
<el-option v-for="item in checkInList" :key="item.id" :label="getCheckInLabel(item)" :value="item.tenantHouseId"></el-option>
</el-select>
</el-form-item>
<el-form-item label="退租日期">
<el-date-picker
v-model="dataForm.checkOutDate"
@ -35,7 +40,10 @@
prop="tenantHouseId"
header-align="center"
align="center"
label="租赁信息id">
label="租赁信息">
<template slot-scope="scope">
{{ getCheckInName(scope.row.tenantHouseId) }}
</template>
</el-table-column>
<el-table-column
prop="checkOutDate"
@ -53,7 +61,8 @@
prop="utilityFeeClea"
header-align="center"
align="center"
label="水电费结清状态">
label="水电费结清状态"
:formatter="sysYesNoFormatter">
</el-table-column>
<el-table-column
prop="unpaidAmount"
@ -115,12 +124,21 @@
<script>
import AddOrUpdate from '../../out/pmcheckout-add-and-update'
import * as api from '@/api/pmcheckout.js'
import * as checkInApi from '@/api/pmcheckin.js'
import * as tenantHouseApi from '@/api/pmtenanthouse.js'
import * as tenantApi from '@/api/pmtenant.js'
import * as ownerApi from '@/api/pmowner.js'
export default {
components: {
AddOrUpdate
},
dicts: ['sys_yes_no'],
data () {
return {
checkInList: [],
tenantHouseList: [], //
ownerList: [], //
tenantList: [], //
dataForm: {
tenantHouseId: '',
checkOutDate: '',
@ -147,8 +165,23 @@
mounted() {
//
this.getDataList()
//
this.loadCheckInList()
//
this.getTenantHouseList()
//
this.getOwnerList()
this.getTenantList()
},
methods: {
//
loadCheckInList() {
checkInApi.pmcheckinListApi({ page: 1, limit: 9999 }).then(res => {
this.checkInList = res.list || []
}).catch(() => {
this.checkInList = []
})
},
//
resetForm() {
this.dataForm = {
@ -207,13 +240,68 @@
selectionChangeHandle (val) {
this.dataListSelections = val
},
// /
//
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// /
sysYesNoFormatter(row, column, cellValue) {
if (!cellValue) return ''
const dict = this.dict.type.sys_yes_no?.find(item => item.value === cellValue)
return dict ? dict.label : cellValue
},
// ID/
getCheckInName(tenantHouseId) {
const checkIn = this.checkInList.find(item => item.tenantHouseId === tenantHouseId)
if (checkIn) {
return checkIn.userName
}
//
const tenantHouse = this.tenantHouseList.find(item => item.id === tenantHouseId)
if (tenantHouse) {
return `${tenantHouse.rentBeginTime || ''}${tenantHouse.rentEndTime || ''}`
}
return tenantHouseId
},
//
getCheckInLabel(item) {
if (!item) return ''
let label = item.userName || ''
//
const tenantHouse = this.tenantHouseList.find(th => th.id === item.tenantHouseId)
if (tenantHouse) {
const timeRange = `${tenantHouse.rentBeginTime || ''}${tenantHouse.rentEndTime || ''}`
label = `${label} (${timeRange})`
}
return label
},
//
getTenantHouseList() {
tenantHouseApi.pmtenanthouseListApi({ page: 1, limit: 1000 }).then(res => {
this.tenantHouseList = res.list || []
}).catch(e => {
console.error('获取租赁信息列表失败:', e)
})
},
//
getOwnerList() {
ownerApi.pmownerListApi({ page: 1, limit: 1000 }).then(res => {
this.ownerList = res.list || []
}).catch(e => {
console.error('获取业主列表失败:', e)
})
},
//
getTenantList() {
tenantApi.pmtenantListApi({ page: 1, limit: 1000 }).then(res => {
this.tenantList = res.list || []
}).catch(e => {
console.error('获取租户列表失败:', e)
})
},
//
deleteHandle (id) {
let ids = []

@ -5,16 +5,16 @@
:close-on-click-modal="false"
:visible.sync="visible">
<!-- 新增和修改表单 -->
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataSubmit()" label-width="80px">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataSubmit()" label-width="120px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="租赁信息" prop="tenantHouseId">
<el-select v-model="dataForm.tenantHouseId" placeholder="请选择租赁信息" :style="{ width: '100%' }"
<el-select v-model="dataForm.tenantHouseId" placeholder="请选择租赁信息" :style="{ width: '100%' }" filterable
:disabled="dataForm.userType !== '2'">
<el-option
v-for="item in tenantHouseList"
:key="item.id"
:label="`月租金: ${item.rentAmount || 0}元 - ${item.rentBeginTime || ''}至${item.rentEndTime || ''}`"
:label="`${item.rentBeginTime || ''}至${item.rentEndTime || ''}`"
:value="item.id"
/>
</el-select>
@ -38,7 +38,7 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="业主/租户" prop="userId">
<el-select v-model="dataForm.userId" placeholder="请选择" :style="{ width: '100%' }">
<el-select v-model="dataForm.userId" placeholder="请选择" :style="{ width: '100%' }" filterable>
<!-- 业主类型 -->
<el-option-group v-if="dataForm.userType === '1'" label="业主">
<el-option
@ -78,7 +78,16 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="钥匙交接状态" prop="keyHandover">
<el-input v-model="dataForm.keyHandover" placeholder="钥匙交接状态"></el-input>
<el-select v-model="dataForm.keyHandover" placeholder="请选择钥匙交接状态" :style="{ width: '100%' }">
<el-option v-if="!dict.type.sys_yes_no" label="无数据" value="" disabled />
<el-option
v-else
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
@ -97,12 +106,21 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="是否申请装修" prop="decorationApply">
<el-input v-model="dataForm.decorationApply" placeholder="是否申请装修"></el-input>
<el-select v-model="dataForm.decorationApply" placeholder="请选择是否申请装修" :style="{ width: '100%' }">
<el-option v-if="!dict.type.sys_yes_no" label="无数据" value="" disabled />
<el-option
v-else
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="装修押金" prop="decorationDeposit">
<el-input v-model="dataForm.decorationDeposit" placeholder="装修押金"></el-input>
<el-input-number v-model="dataForm.decorationDeposit" placeholder="装修押金" :min="0" :precision="2" style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
</el-row>
@ -140,7 +158,7 @@ import * as tenantApi from '@/api/pmtenant.js'
import * as ownerApi from '@/api/pmowner.js'
export default {
dicts: ['dept_type'],
dicts: ['dept_type','sys_yes_no'],
data() {
return {
visible: false,
@ -153,7 +171,7 @@ export default {
keyHandover: '',
propertyFeeStart: '',
decorationApply: '',
decorationDeposit: '',
decorationDeposit: 0,
decorationPeriod: '',
handlerId: '',
remark: '',
@ -162,22 +180,11 @@ export default {
ownerList: [], //
tenantList: [], //
dataRule: {
tenantHouseId: [
{
required: function (rule, value, callback) {
if (this.dataForm.userType === '2' && !value) {
callback(new Error('租赁信息id 为必填项'))
} else {
callback()
}
}, message: '租赁信息id 为必填项', trigger: 'blur, change'
}
],
userType: [
{required: true, message: '入住类型(业主 / 租户) 为必填项', trigger: 'blur'}
{required: true, message: '入住类型 为必填项', trigger: 'blur'}
],
userId: [
{required: true, message: '业主/租户 ID 为必填项', trigger: 'blur'}
{required: true, message: '业主/租户 为必填项', trigger: 'blur'}
],
}
}
@ -186,6 +193,12 @@ export default {
'dataForm.userType'(newVal) {
// id
//
//
this.getTenantHouseList()
},
'dataForm.userId'() {
// ID
this.getTenantHouseList()
}
},
methods: {
@ -207,7 +220,12 @@ export default {
},
//
getTenantHouseList() {
tenantHouseApi.pmtenanthouseListApi({page: 1, limit: 1000}).then(res => {
const params = {page: 1, limit: 1000}
// rentId使userIdrentId
if (this.dataForm.userType === '2' && this.dataForm.userId) {
params.rentId = this.dataForm.userId
}
tenantHouseApi.pmtenanthouseListApi(params).then(res => {
this.tenantHouseList = res.list || []
}).catch(e => {
console.error('获取租赁信息列表失败:', e)

@ -8,8 +8,10 @@
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataSubmit()" label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="租赁信息id" prop="tenantHouseId">
<el-input v-model="dataForm.tenantHouseId" placeholder="租赁信息id"></el-input>
<el-form-item label="租赁信息" prop="tenantHouseId">
<el-select v-model="dataForm.tenantHouseId" placeholder="请选择租赁信息" style="width: 100%">
<el-option v-for="item in checkInList" :key="item.id" :label="getCheckInLabel(item)" :value="item.tenantHouseId"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
@ -33,19 +35,28 @@
</el-col>
<el-col :span="12">
<el-form-item label="水电费结清状态" prop="utilityFeeClea">
<el-input v-model="dataForm.utilityFeeClea" placeholder="水电费结清状态"></el-input>
<el-select v-model="dataForm.utilityFeeClea" placeholder="请选择水电费结清状态" :style="{ width: '100%' }">
<el-option v-if="!dict.type.sys_yes_no" label="无数据" value="" disabled />
<el-option
v-else
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="未缴费用" prop="unpaidAmount">
<el-input v-model="dataForm.unpaidAmount" placeholder="未缴费用"></el-input>
<el-input-number v-model="dataForm.unpaidAmount" placeholder="未缴费用" :min="0" :precision="2" style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="押金退还金额" prop="depositRefund">
<el-input v-model="dataForm.depositRefund" placeholder="押金退还金额"></el-input>
<el-input-number v-model="dataForm.depositRefund" placeholder="押金退还金额" :min="0" :precision="2" style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
</el-row>
@ -78,50 +89,37 @@
<script>
import * as api from '@/api/pmcheckout.js'
import * as checkInApi from '@/api/pmcheckin.js'
import * as tenantHouseApi from '@/api/pmtenanthouse.js'
export default {
dicts: ['sys_yes_no'],
data () {
return {
checkInList: [],
tenantHouseList: [], //
visible: false,
dataForm: {
id: 0,
tenantHouseId: '' ,
checkOutDate: '' ,
houseDamage: '' ,
utilityFeeClea: '' ,
unpaidAmount: '' ,
depositRefund: '' ,
confirmationNo: '' ,
handlerId: '' ,
remark: '' ,
id: null,
tenantHouseId: '' ,
checkOutDate: '' ,
houseDamage: '' ,
utilityFeeClea: '' ,
unpaidAmount: 0 ,
depositRefund: 0 ,
confirmationNo: '' ,
handlerId: '' ,
remark: '' ,
},
dataRule: {
tenantHouseId: [
{ required: true, message: '租赁信息id 为必填项', trigger: 'blur' }
{ required: true, message: '租赁信息 为必填项', trigger: 'blur' }
],
checkOutDate: [
{ required: true, message: '退租日期 为必填项', trigger: 'blur' }
],
houseDamage: [
{ required: true, message: '房屋损坏情况 为必填项', trigger: 'blur' }
],
utilityFeeClea: [
{ required: true, message: '水电费结清状态 为必填项', trigger: 'blur' }
],
unpaidAmount: [
{ required: true, message: '未缴费用 为必填项', trigger: 'blur' }
],
depositRefund: [
{ required: true, message: '押金退还金额 为必填项', trigger: 'blur' }
],
confirmationNo: [
{ required: true, message: '退租确认单编号 为必填项', trigger: 'blur' }
],
handlerId: [
{ required: true, message: '经办人 为必填项', trigger: 'blur' }
],
remark: [
{ required: true, message: '备注 为必填项', trigger: 'blur' }
],
}
}
},
@ -136,20 +134,58 @@
this.dataForm = res;
}.bind(this))
}
//
this.loadCheckInList()
}.bind(this))
},
//
loadCheckInList() {
checkInApi.pmcheckinListApi({ page: 1, limit: 9999 }).then(res => {
this.checkInList = res.list || []
}).catch(() => {
this.checkInList = []
})
//
this.getTenantHouseList()
},
//
getTenantHouseList() {
tenantHouseApi.pmtenanthouseListApi({ page: 1, limit: 1000 }).then(res => {
this.tenantHouseList = res.list || []
}).catch(e => {
console.error('获取租赁信息列表失败:', e)
})
},
//
getCheckInLabel(item) {
if (!item) return ''
let label = item.userName || ''
//
const tenantHouse = this.tenantHouseList.find(th => th.id === item.tenantHouseId)
if (tenantHouse) {
const timeRange = `${tenantHouse.rentBeginTime || ''}${tenantHouse.rentEndTime || ''}`
label = `${label} (${timeRange})`
}
return label
},
//
dataSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
//
const submitData = { ...this.dataForm }
if (submitData.checkOutDate) {
submitData.checkOutDate = this.formatDate(submitData.checkOutDate)
}
if (this.dataForm.id) {
api.pmcheckoutUpdateApi(this.dataForm).then(function(res) {
api.pmcheckoutUpdateApi(submitData).then(function(res) {
this.$message.success('保存成功')
this.visible = false
this.$emit('refreshDataList')
}.bind(this));
} else {
api.pmcheckoutCreateApi(this.dataForm).then(function(res) {
api.pmcheckoutCreateApi(submitData).then(function(res) {
this.$message.success('新增成功')
this.visible = false
this.$emit('refreshDataList')
@ -157,6 +193,15 @@
}
}
})
},
// yyyy-MM-dd
formatDate(date) {
if (!date) return ''
const d = new Date(date)
const year = d.getFullYear()
const month = String(d.getMonth() + 1).padStart(2, '0')
const day = String(d.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
}
}
}

@ -3,60 +3,104 @@
<el-dialog
:title="!dataForm.id ? '添加' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
:append-to-body="true"
:visible.sync="visible" width="800px">
<!-- 新增和修改表单 -->
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataSubmit()" label-width="80px">
<el-form-item label="订单id" prop="orderId">
<el-input v-model="dataForm.orderId" placeholder="订单id"></el-input>
</el-form-item>
<el-form-item label="派单人" prop="assignerId">
<el-input v-model="dataForm.assignerId" placeholder="派单人"></el-input>
</el-form-item>
<el-form-item label="执行人" prop="executorId">
<el-input v-model="dataForm.executorId" placeholder="执行人"></el-input>
</el-form-item>
<el-form-item label="执行部门" prop="executorDept">
<el-input v-model="dataForm.executorDept" placeholder="执行部门"></el-input>
</el-form-item>
<el-form-item label="联系方式" prop="phone">
<el-input v-model="dataForm.phone" placeholder="联系方式"></el-input>
</el-form-item>
<el-form-item label="派单时间" prop="assignTime">
<el-input v-model="dataForm.assignTime" placeholder="派单时间"></el-input>
</el-form-item>
<el-form-item label="派单工作内容" prop="assigneContext">
<el-input v-model="dataForm.assigneContext" placeholder="派单工作内容"></el-input>
</el-form-item>
<el-form-item label="派单备注" prop="dispatchNote">
<el-input v-model="dataForm.dispatchNote" placeholder="派单备注"></el-input>
</el-form-item>
<el-form-item label="预计完成时间" prop="expectedCompleteTime">
<el-input v-model="dataForm.expectedCompleteTime" placeholder="预计完成时间"></el-input>
</el-form-item>
<el-form-item label="实际完成时间" prop="completeTime">
<el-input v-model="dataForm.completeTime" placeholder="实际完成时间"></el-input>
</el-form-item>
<el-form-item label="处理内容" prop="handleContent">
<el-input v-model="dataForm.handleContent" placeholder="处理内容"></el-input>
</el-form-item>
<el-form-item label="耗材使用" prop="consumables">
<el-input v-model="dataForm.consumables" placeholder="耗材使用"></el-input>
</el-form-item>
<el-form-item label="维修费用" prop="costAmount">
<el-input v-model="dataForm.costAmount" placeholder="维修费用"></el-input>
</el-form-item>
<el-form-item label="完成照片" prop="completePhoto">
<el-input v-model="dataForm.completePhoto" placeholder="完成照片"></el-input>
</el-form-item>
<el-form-item label="业主确认" prop="ownerConfirm">
<el-input v-model="dataForm.ownerConfirm" placeholder="业主确认"></el-input>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-input v-model="dataForm.status" placeholder="状态"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
</el-form-item>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataSubmit()" label-width="120px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="派单人" prop="assignerId">
<el-select v-model="dataForm.assignerId" placeholder="请选择派单人" style="width: 100%">
<el-option v-for="item in adminList" :key="item.id" :label="item.realName" :value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="执行人" prop="executorId">
<el-select v-model="dataForm.executorId" placeholder="请选择执行人" style="width: 100%">
<el-option v-for="item in adminList" :key="item.id" :label="item.realName" :value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="执行部门" prop="executorDept">
<el-input v-model="dataForm.executorDept" placeholder="执行部门"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系方式" prop="phone">
<el-input v-model="dataForm.phone" placeholder="联系方式"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="派单时间" prop="assignTime">
<el-date-picker v-model="dataForm.assignTime" type="datetime" placeholder="选择派单时间" style="width: 100%"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="派单工作内容" prop="assigneContext">
<el-input v-model="dataForm.assigneContext" placeholder="派单工作内容"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="派单备注" prop="dispatchNote">
<el-input v-model="dataForm.dispatchNote" placeholder="派单备注"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="预计完成时间" prop="expectedCompleteTime">
<el-date-picker v-model="dataForm.expectedCompleteTime" type="datetime" placeholder="选择预计完成时间" style="width: 100%"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="实际完成时间" prop="completeTime">
<el-date-picker v-model="dataForm.completeTime" type="datetime" placeholder="选择实际完成时间" style="width: 100%"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="处理内容" prop="handleContent">
<el-input v-model="dataForm.handleContent" placeholder="处理内容"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="耗材使用" prop="consumables">
<el-input v-model="dataForm.consumables" placeholder="耗材使用"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="维修费用" prop="costAmount">
<el-input v-model="dataForm.costAmount" placeholder="维修费用"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="业主确认" prop="ownerConfirm">
<el-select v-model="dataForm.ownerConfirm" placeholder="请选择业主确认" style="width: 100%">
<el-option label="是" value="是"></el-option>
<el-option label="否" value="否"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="状态" prop="status">
<el-select v-model="dataForm.status" placeholder="状态" style="width: 100%">
<el-option v-for="(item, index) in dict.type.dispatch_status" :key="index" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="完成照片" prop="completePhoto">
<FileUploadVO
:value="completePhotoFiles"
@input="updateCompletePhotoFiles"
></FileUploadVO>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="备注" type="textarea"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
@ -67,117 +111,254 @@
<script>
import * as api from '@/api/pmmaintenancedispatch.js'
import * as adminApi from '@/api/systemadmin.js'
import FileUploadVO from '@/components/FileUploadVO/index.vue'
export default {
components: {
FileUploadVO
},
dicts: ['dispatch_status'],
data () {
return {
visible: false,
completePhotoFiles: [], //
adminList: [], //
dataForm: {
id: 0,
orderId: '' ,
assignerId: '' ,
executorId: '' ,
executorDept: '' ,
phone: '' ,
assignTime: '' ,
assigneContext: '' ,
dispatchNote: '' ,
expectedCompleteTime: '' ,
completeTime: '' ,
handleContent: '' ,
consumables: '' ,
costAmount: '' ,
completePhoto: '' ,
ownerConfirm: '' ,
status: '' ,
remark: '' ,
orderId: '' ,
assignerId: '' ,
executorId: '' ,
executorDept: '' ,
phone: '' ,
assignTime: '' ,
assigneContext: '' ,
dispatchNote: '' ,
expectedCompleteTime: '' ,
completeTime: '' ,
handleContent: '' ,
consumables: '' ,
costAmount: '' ,
completePhoto: '' ,
ownerConfirm: '' ,
status: '' ,
remark: '' ,
files: []
},
dataRule: {
orderId: [
{ required: true, message: '订单id 为必填项', trigger: 'blur' }
],
assignerId: [
{ required: true, message: '派单人 为必填项', trigger: 'blur' }
],
executorId: [
{ required: true, message: '执行人 为必填项', trigger: 'blur' }
],
executorDept: [
{ required: true, message: '执行部门 为必填项', trigger: 'blur' }
],
phone: [
{ required: true, message: '联系方式 为必填项', trigger: 'blur' }
],
assignTime: [
{ required: true, message: '派单时间 为必填项', trigger: 'blur' }
],
assigneContext: [
{ required: true, message: '派单工作内容 为必填项', trigger: 'blur' }
],
dispatchNote: [
{ required: true, message: '派单备注 为必填项', trigger: 'blur' }
],
expectedCompleteTime: [
{ required: true, message: '预计完成时间 为必填项', trigger: 'blur' }
],
completeTime: [
{ required: true, message: '实际完成时间 为必填项', trigger: 'blur' }
],
handleContent: [
{ required: true, message: '处理内容 为必填项', trigger: 'blur' }
],
consumables: [
{ required: true, message: '耗材使用 为必填项', trigger: 'blur' }
],
costAmount: [
{ required: true, message: '维修费用 为必填项', trigger: 'blur' }
],
completePhoto: [
{ required: true, message: '完成照片 为必填项', trigger: 'blur' }
],
// assigneContext: [
// { required: true, message: ' ', trigger: 'blur' }
// ],
// dispatchNote: [
// { required: true, message: ' ', trigger: 'blur' }
// ],
// expectedCompleteTime: [
// { required: true, message: ' ', trigger: 'blur' }
// ],
// completeTime: [
// { required: true, message: ' ', trigger: 'blur' }
// ],
// handleContent: [
// { required: true, message: ' ', trigger: 'blur' }
// ],
// consumables: [
// { required: true, message: '使 ', trigger: 'blur' }
// ],
// costAmount: [
// { required: true, message: ' ', trigger: 'blur' }
// ],
// completePhoto: [
// { required: true, message: ' ', trigger: 'blur' }
// ],
ownerConfirm: [
{ required: true, message: '业主确认 为必填项', trigger: 'blur' }
],
status: [
{ required: true, message: '状态 为必填项', trigger: 'blur' }
],
remark: [
{ required: true, message: '备注 为必填项', trigger: 'blur' }
],
// remark: [
// { required: true, message: ' ', trigger: 'blur' }
// ],
}
}
},
mounted() {
//
this.loadAdminList()
},
methods: {
init (id) { //
init (id, orderId) { //
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(function() {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
// API
api.pmmaintenancedispatchDetailApi(id).then(function(res) {
this.dataForm = res;
//
if (res.files && res.files.length > 0) {
// filesFileUploadVO
this.completePhotoFiles = res.files.map((file, index) => ({
attachFileUrl: file.attDir || file.filePath || file.url || '',
attDir: file.attDir || file.filePath || file.url || '',
name: file.name || file.fileName || '',
oldName: file.name || file.fileName || '',
attId: file.attId || '',
uid: file.id || file.fileId || index + new Date().getTime()
}))
} else {
this.completePhotoFiles = []
}
}.bind(this)).catch(function() {
// API
this.dataForm = {
id: id,
orderId: orderId || '',
assignerId: '',
executorId: '',
executorDept: '',
phone: '',
assignTime: '',
assigneContext: '',
dispatchNote: '',
expectedCompleteTime: '',
completeTime: '',
handleContent: '',
consumables: '',
costAmount: '',
completePhoto: '',
ownerConfirm: '',
status: '',
remark: '',
files: []
}
this.completePhotoFiles = []
}.bind(this))
} else if (orderId) {
// IDID
this.dataForm.orderId = orderId
this.completePhotoFiles = []
this.dataForm.files = []
//
this.$refs['dataForm'].resetFields()
}
}.bind(this))
},
//
updateCompletePhotoFiles(files) {
this.completePhotoFiles = files
// dataForm.files
if (files && files.length > 0) {
// FileUploadVOSystemAttachment
this.dataForm.files = files.map(file => {
//
let attDir = file.attDir || file.attachFileUrl || ''
// /file/public/
if (attDir.startsWith('/file/public/')) {
attDir = attDir.replace('/file/public/', '')
} else if (attDir.startsWith('/file/')) {
attDir = attDir.replace('/file/', '')
}
return {
// SystemAttachment
attId: file.id || file.attId || '', //
name: file.name || file.oldName || '', //
attDir: attDir, //
attSize: file.attSize || '', //
attType: file.attType || '', //
//
fileName: file.name || file.oldName || '',
filePath: attDir,
url: attDir,
createTime: null,
createdBy: null,
createTimeStr: null,
delFlag: '0',
updateBy: null,
updateTime: null,
i18nCode: '',
i18nLanguage: '',
originalFileName: file.name || file.oldName || '',
position: 0,
remark: file.remark || '',
sort: 0,
status: ''
}
})
} else {
this.dataForm.files = []
}
},
//
loadAdminList() {
adminApi.adminList({ page: 1, limit: 999 }).then((res) => {
this.adminList = res.list || []
}).catch(() => {
this.adminList = []
})
},
//
dataSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
if (this.dataForm.id) {
api.pmmaintenancedispatchUpdateApi(this.dataForm).then(function(res) {
this.$message.success('保存成功')
//
const submitData = { ...this.dataForm }
if (submitData.assignTime) {
submitData.assignTime = this.formatDate(submitData.assignTime)
}
if (submitData.expectedCompleteTime) {
submitData.expectedCompleteTime = this.formatDate(submitData.expectedCompleteTime)
}
if (submitData.completeTime) {
submitData.completeTime = this.formatDate(submitData.completeTime)
}
// id
if (this.dataForm.id === 0) {
//
api.pmmaintenancedispatchCreateApi(submitData).then((res) => {
this.$message.success('新增成功')
this.visible = false
this.$emit('refreshDataList')
}.bind(this));
// ID
this.$emit('refreshDataList', this.dataForm.orderId)
}).catch(() => {
this.$message.error('新增失败')
})
} else {
api.pmmaintenancedispatchCreateApi(this.dataForm).then(function(res) {
this.$message.success('新增成功')
//
api.pmmaintenancedispatchUpdateApi(submitData).then((res) => {
this.$message.success('修改成功')
this.visible = false
this.$emit('refreshDataList')
}.bind(this));
// ID
this.$emit('refreshDataList', this.dataForm.orderId)
}).catch(() => {
this.$message.error('修改失败')
})
}
}
})
},
// yyyy-MM-dd HH:mm:ss
formatDate(date) {
if (!date) return ''
const d = new Date(date)
const year = d.getFullYear()
const month = String(d.getMonth() + 1).padStart(2, '0')
const day = String(d.getDate()).padStart(2, '0')
const hours = String(d.getHours()).padStart(2, '0')
const minutes = String(d.getMinutes()).padStart(2, '0')
const seconds = String(d.getSeconds()).padStart(2, '0')
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
}
}
}

@ -0,0 +1,178 @@
<template>
<div>
<div style="margin-bottom: 10px;">
<el-button type="primary" size="small" @click="addDispatch"></el-button>
</div>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column prop="assignerName" header-align="center" align="center" label="派单人"></el-table-column>
<el-table-column prop="executorName" header-align="center" align="center" label="执行人"></el-table-column>
<el-table-column prop="executorDept" header-align="center" align="center" label="执行部门"></el-table-column>
<el-table-column prop="phone" header-align="center" align="center" label="联系方式"></el-table-column>
<el-table-column prop="assignTime" header-align="center" align="center" label="派单时间"></el-table-column>
<el-table-column prop="assigneContext" header-align="center" align="center" label="派单工作内容"></el-table-column>
<el-table-column prop="dispatchNote" header-align="center" align="center" label="派单备注"></el-table-column>
<el-table-column prop="expectedCompleteTime" header-align="center" align="center" label="预计完成时间"></el-table-column>
<el-table-column prop="completeTime" header-align="center" align="center" label="实际完成时间"></el-table-column>
<el-table-column prop="handleContent" header-align="center" align="center" label="处理内容"></el-table-column>
<el-table-column prop="consumables" header-align="center" align="center" label="耗材使用"></el-table-column>
<el-table-column prop="costAmount" header-align="center" align="center" label="维修费用"></el-table-column>
<el-table-column header-align="center" align="center" label="业主确认">
<template slot-scope="scope">
{{ scope.row.ownerConfirm === 1 ? '是' : '否' }}
</template>
</el-table-column>
<el-table-column header-align="center" align="center" label="状态">
<template slot-scope="scope">
<dict-tag :options="dict.type.dispatch_status" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column prop="remark" header-align="center" align="center" label="备注"></el-table-column>
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
<template slot-scope="dispatchScope">
<el-button type="text" size="small" @click="editDispatch(dispatchScope.row.id)">{{ '' }}</el-button>
<el-button type="text" size="small" @click="deleteDispatch(dispatchScope.row.id)" style="color: #f56c6c;">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
v-if="showSearch"
hide-on-single-page
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
</div>
</template>
<script>
import DictTag from '@/components/DictTag'
import * as adminApi from '@/api/systemadmin.js'
import * as dispatchApi from '@/api/pmmaintenancedispatch.js'
export default {
components: {
DictTag
},
dicts: ['dispatch_status'],
props: {
orderId: {
type: [Number, String],
required: true
},
showSearch: {
type: Boolean,
default: true
}
},
data() {
return {
adminList: [], //
dataForm: {
assignerId: '',
executorId: '',
status: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false
}
},
watch: {
// ID
orderId(newVal) {
this.getDataList()
}
},
// activated() {
// this.getDataList()
// },
mounted() {
this.getDataList()
},
methods: {
//
addDispatch() {
this.$emit('addDispatch', this.orderId)
},
//
editDispatch(id) {
this.$emit('editDispatch', id)
},
//
deleteDispatch(id) {
this.$confirm('确定要删除这条派单记录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
dispatchApi.pmmaintenancedispatchDeleteApi([id]).then(() => {
this.$message.success('删除成功')
this.getDataList()
this.$emit('refreshDataList')
}).catch(() => {
this.$message.error('删除失败')
})
}).catch(() => {})
},
//
resetForm() {
this.dataForm = {
assignerId: '',
executorId: '',
status: ''
}
this.pageIndex = 1
this.getDataList()
},
//
getDataList() {
this.dataListLoading = true
const params = {
page: this.pageIndex,
limit: this.pageSize,
orderId: this.orderId
}
//
if (this.dataForm.assignerId) params.assignerId = this.dataForm.assignerId
if (this.dataForm.executorId) params.executorId = this.dataForm.executorId
if (this.dataForm.status) params.status = this.dataForm.status
dispatchApi.pmmaintenancedispatchListApi(params).then((res) => {
this.dataListLoading = false
//
this.dataList = res.list || []
this.totalPage = res.total
}).catch(() => {
this.dataListLoading = false
this.dataList = []
this.totalPage = 0
})
},
//
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
}
}
}
</script>
<style lang="scss" scoped>
</style>

@ -4,42 +4,12 @@
<el-form-item label="业主类型">
<el-input v-model="dataForm.ownerType" placeholder="请输入业主类型" clearable></el-input>
</el-form-item>
<el-form-item label="业主id">
<el-input v-model="dataForm.ownerId" placeholder="请输入业主id" clearable></el-input>
</el-form-item>
<el-form-item label="房屋id">
<el-input v-model="dataForm.houseId" placeholder="请输入房屋id" clearable></el-input>
</el-form-item>
<el-form-item label="房屋业主id">
<el-input v-model="dataForm.houseOwnerId" placeholder="请输入房屋业主id" clearable></el-input>
</el-form-item>
<el-form-item label="报修单号">
<el-input v-model="dataForm.orderNo" placeholder="请输入报修单号" clearable></el-input>
</el-form-item>
<el-form-item label="故障类型">
<el-input v-model="dataForm.faultType" placeholder="请输入故障类型" clearable></el-input>
</el-form-item>
<el-form-item label="故障描述">
<el-input v-model="dataForm.faultDesc" placeholder="请输入故障描述" clearable></el-input>
</el-form-item>
<el-form-item label="故障照片">
<el-input v-model="dataForm.faultPhoto" placeholder="请输入故障照片" clearable></el-input>
</el-form-item>
<el-form-item label="报修渠道">
<el-input v-model="dataForm.reportChannel" placeholder="请输入报修渠道" clearable></el-input>
</el-form-item>
<el-form-item label="报修时间">
<el-input v-model="dataForm.reportTime" placeholder="请输入报修时间" clearable></el-input>
</el-form-item>
<el-form-item label="紧急程度">
<el-input v-model="dataForm.urgencyLevel" placeholder="请输入紧急程度" clearable></el-input>
</el-form-item>
<el-form-item label="状态">
<el-input v-model="dataForm.status" placeholder="请输入状态" clearable></el-input>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="dataForm.remark" placeholder="请输入备注" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()"></el-button>
<el-button @click="resetForm()"></el-button>
@ -59,35 +29,43 @@
align="center"
width="50">
</el-table-column>
<el-table-column
prop="id"
header-align="center"
align="center"
label="id">
<el-table-column type="expand" header-align="center" align="center">
<template slot-scope="scope">
<DispatchList
:ref="'dispatchList_' + scope.row.id"
:orderId="scope.row.id"
@addDispatch="addDispatch"
@editDispatch="editDispatch"
@refreshDataList="getDataList"
/>
</template>
</el-table-column>
<el-table-column
prop="ownerType"
header-align="center"
align="center"
label="业主类型">
<template slot-scope="scope">
<dict-tag :options="dict.type.owner_Type" :value="scope.row.ownerType"/>
</template>
</el-table-column>
<el-table-column
prop="ownerId"
header-align="center"
align="center"
label="业主id">
label="业主名称">
<template slot-scope="scope">
{{ getOwnerName(scope.row.ownerId) }}
</template>
</el-table-column>
<el-table-column
prop="houseId"
header-align="center"
align="center"
label="房屋id">
</el-table-column>
<el-table-column
prop="houseOwnerId"
header-align="center"
align="center"
label="房屋业主id">
label="房屋名称">
<template slot-scope="scope">
{{ getHouseName(scope.row.houseId) }}
</template>
</el-table-column>
<el-table-column
prop="orderNo"
@ -100,19 +78,17 @@
header-align="center"
align="center"
label="故障类型">
<template slot-scope="scope">
<dict-tag :options="dict.type.fault_type" :value="scope.row.faultType"/>
</template>
</el-table-column>
<el-table-column
prop="faultDesc"
header-align="center"
align="center"
show-overflow-tooltip
label="故障描述">
</el-table-column>
<el-table-column
prop="faultPhoto"
header-align="center"
align="center"
label="故障照片">
</el-table-column>
<el-table-column
prop="reportChannel"
header-align="center"
@ -136,55 +112,17 @@
header-align="center"
align="center"
label="状态">
<template slot-scope="scope">
<dict-tag :options="dict.type.fault_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column
prop="remark"
header-align="center"
align="center"
show-overflow-tooltip
label="备注">
</el-table-column>
<el-table-column
prop="delFlag"
header-align="center"
align="center"
label="删除标志0代表存在 2代表删除">
</el-table-column>
<el-table-column
prop="createDept"
header-align="center"
align="center"
label="创建部门">
</el-table-column>
<el-table-column
prop="createBy"
header-align="center"
align="center"
label="创建人">
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
label="创建时间">
</el-table-column>
<el-table-column
prop="updateBy"
header-align="center"
align="center"
label="修改人">
</el-table-column>
<el-table-column
prop="updateTime"
header-align="center"
align="center"
label="修改时间">
</el-table-column>
<el-table-column
prop="tenantId"
header-align="center"
align="center"
label="租户ID">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
@ -208,13 +146,21 @@
</el-pagination>
<!-- 表单弹窗, 新增数据和修改数据 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<!-- 派单记录弹窗 -->
<DispatchAddOrUpdate v-if="dispatchAddOrUpdateVisible" ref="dispatchAddOrUpdate" @refreshDataList="loadDispatchList"></DispatchAddOrUpdate>
</div>
</template>
<script>
import AddOrUpdate from './pmmaintenanceorder-add-and-update'
import DispatchAddOrUpdate from '../dispatch/pmmaintenancedispatch-add-and-update'
import DispatchList from './DispatchList'
import * as api from '@/api/pmmaintenanceorder.js'
import * as ownerApi from '@/api/pmowner.js'
import * as houseApi from '@/api/pmhouse.js'
import DictTag from '@/components/DictTag'
export default {
dicts: ['owner_Type','fault_type','fault_status'],
data () {
return {
dataForm: {
@ -239,20 +185,84 @@
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
addOrUpdateVisible: false,
dispatchAddOrUpdateVisible: false,
ownerList: [],
houseList: []
}
},
components: {
AddOrUpdate
AddOrUpdate,
DispatchAddOrUpdate,
DispatchList,
DictTag
},
activated () {
this.getDataList()
},
mounted() {
//
this.getDataList()
//
this.loadOwnerList()
this.loadHouseList()
},
methods: {
//
loadOwnerList() {
ownerApi.pmownerListApi({ page: 1, limit: 9999 }).then(res => {
this.ownerList = res.list || []
})
},
//
loadHouseList() {
houseApi.pmhouseListApi({ page: 1, limit: 9999 }).then(res => {
this.houseList = res.list || []
})
},
//
editDispatch(id) {
this.dispatchAddOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.dispatchAddOrUpdate.init(id)
})
},
//
addDispatch(orderId) {
this.dispatchAddOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.dispatchAddOrUpdate.init(0, orderId)
})
},
//
loadDispatchList(orderId) {
this.$nextTick(() => {
if (orderId) {
// ID
const dispatchListRef = this.$refs['dispatchList_' + orderId]
if (dispatchListRef && dispatchListRef[0]) {
dispatchListRef[0].getDataList()
}
} else {
//
this.dataList.forEach(item => {
const dispatchListRef = this.$refs['dispatchList_' + item.id]
if (dispatchListRef && dispatchListRef[0]) {
dispatchListRef[0].getDataList()
}
})
}
})
},
// ID
getOwnerName(ownerId) {
const owner = this.ownerList.find(item => item.id === ownerId)
return owner ? owner.ownerName : ownerId
},
// ID
getHouseName(houseId) {
const house = this.houseList.find(item => item.id === houseId)
return house ? `${house.unitNo}单元 ${house.floorNo}${house.houseNo}` : houseId
},
//
resetForm() {
this.dataForm = {

@ -6,74 +6,222 @@
:visible.sync="visible">
<!-- 新增和修改表单 -->
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataSubmit()" label-width="80px">
<el-form-item label="业主类型" prop="ownerType">
<el-input v-model="dataForm.ownerType" placeholder="业主类型"></el-input>
</el-form-item>
<el-form-item label="业主id" prop="ownerId">
<el-input v-model="dataForm.ownerId" placeholder="业主id"></el-input>
</el-form-item>
<el-form-item label="房屋id" prop="houseId">
<el-input v-model="dataForm.houseId" placeholder="房屋id"></el-input>
</el-form-item>
<el-form-item label="房屋业主id" prop="houseOwnerId">
<el-input v-model="dataForm.houseOwnerId" placeholder="房屋业主id"></el-input>
</el-form-item>
<el-form-item label="报修单号" prop="orderNo">
<el-input v-model="dataForm.orderNo" placeholder="报修单号"></el-input>
</el-form-item>
<el-form-item label="故障类型" prop="faultType">
<el-input v-model="dataForm.faultType" placeholder="故障类型"></el-input>
</el-form-item>
<el-form-item label="故障描述" prop="faultDesc">
<el-input v-model="dataForm.faultDesc" placeholder="故障描述"></el-input>
</el-form-item>
<el-form-item label="故障照片" prop="faultPhoto">
<el-input v-model="dataForm.faultPhoto" placeholder="故障照片"></el-input>
</el-form-item>
<el-form-item label="报修渠道" prop="reportChannel">
<el-input v-model="dataForm.reportChannel" placeholder="报修渠道"></el-input>
</el-form-item>
<el-form-item label="报修时间" prop="reportTime">
<el-input v-model="dataForm.reportTime" placeholder="报修时间"></el-input>
</el-form-item>
<el-form-item label="紧急程度" prop="urgencyLevel">
<el-input v-model="dataForm.urgencyLevel" placeholder="紧急程度"></el-input>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-input v-model="dataForm.status" placeholder="状态"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
</el-form-item>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="业主名称" prop="ownerId">
<el-select v-model="dataForm.ownerId" placeholder="请选择业主" clearable style="width: 100%" @change="handleOwnerChange">
<el-option
v-for="item in ownerList"
:key="item.id"
:label="item.ownerName"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="业主类型" prop="ownerType">
<el-select v-model="dataForm.ownerType" placeholder="请选择业主类型" clearable disabled style="width: 100%">
<el-option
v-for="dict in dict.type.owner_Type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="房屋名称" prop="houseId">
<el-select v-model="dataForm.houseId" placeholder="选择房屋" clearable style="width: 100%" @change="handleHouseChange" disabled>
<el-option
v-for="item in ownerHouseList"
:key="item.id"
:label="`${item.unitNo}单元 ${item.floorNo}层 ${item.houseNo}室`"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报修单号" prop="orderNo">
<el-input v-model="dataForm.orderNo" placeholder="报修单号"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="故障类型" prop="faultType">
<el-select v-model="dataForm.faultType" placeholder="请选择故障类型" clearable style="width: 100%">
<el-option
v-for="dict in dict.type.fault_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报修渠道" prop="reportChannel">
<el-input v-model="dataForm.reportChannel" placeholder="报修渠道"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="报修时间" prop="reportTime">
<el-date-picker
v-model="dataForm.reportTime"
type="datetime"
placeholder="选择报修时间"
style="width: 100%"
></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="紧急程度" prop="urgencyLevel">
<el-input v-model="dataForm.urgencyLevel" placeholder="紧急程度"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="状态" prop="status">
<el-select v-model="dataForm.status" placeholder="选择状态" clearable style="width: 100%">
<el-option
v-for="dict in dict.type.fault_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<!-- 隐藏的房屋业主id字段 -->
<el-form-item label="房屋业主id" prop="houseOwnerId" v-show="false">
<el-input v-model="dataForm.houseOwnerId" placeholder="房屋业主id" readonly></el-input>
</el-form-item>
<!-- 故障照片单独一行 -->
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="故障照片" prop="faultPhoto">
<FileUploadVO
:value="faultPhotoFiles"
@input="updateFaultPhotoFiles"
></FileUploadVO>
</el-form-item>
</el-col>
</el-row>
<!-- 故障描述 -->
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="故障描述" prop="faultDesc">
<el-input v-model="dataForm.faultDesc" placeholder="故障描述" type="textarea"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="备注" type="textarea"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- 显示添加报修派单记录按钮 -->
<!-- <div style="margin-bottom: 20px;">-->
<!-- <el-button type="success" @click="addDispatchRecord"></el-button>-->
<!-- </div>-->
<!-- &lt;!&ndash; 报修派单记录列表 &ndash;&gt;-->
<!-- <div class="dispatch-records-container">-->
<!-- <el-table :data="dispatchRecords" style="width: 100%">-->
<!-- <el-table-column prop="assignerId" label="派单人" width="120"></el-table-column>-->
<!-- <el-table-column prop="executorId" label="执行人" width="120"></el-table-column>-->
<!-- <el-table-column prop="executorDept" label="执行部门" width="150"></el-table-column>-->
<!-- <el-table-column prop="phone" label="联系方式" width="120"></el-table-column>-->
<!-- <el-table-column label="派单时间" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- {{ formatDisplayDate(scope.row.assignTime) }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="assigneContext" label="派单工作内容" width="200"></el-table-column>-->
<!-- <el-table-column label="预计完成时间" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- {{ formatDisplayDate(scope.row.expectedCompleteTime) }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="实际完成时间" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- {{ formatDisplayDate(scope.row.completeTime) }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="status" label="状态" width="100">-->
<!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.dispatch_status" :value="scope.row.status"></dict-tag>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="remark" label="备注" width="150"></el-table-column>-->
<!-- <el-table-column label="操作" width="180" fixed="right">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button type="text" size="small" @click="editDispatchRecord(scope.row.id)">{{ '' }}</el-button>-->
<!-- <el-button type="text" size="small" @click="deleteDispatchRecord(scope.row.id, scope.$index)">{{ '删除' }}</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- </el-table>-->
<!-- </div>-->
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataSubmit()"></el-button>
</span>
<!-- 报修派单记录弹窗 -->
<add-or-update-dispatch ref="addOrUpdateDispatch" :orderId="dataForm.id" @refreshDataList="getDispatchRecords" @saveDispatchRecord="saveDispatchRecord"></add-or-update-dispatch>
</el-dialog>
</template>
<script>
import * as api from '@/api/pmmaintenanceorder.js'
import * as ownerApi from '@/api/pmowner.js'
import * as houseApi from '@/api/pmhouse.js'
import * as ownerHouseRelApi from '@/api/pmownerhouserel.js'
import * as dispatchApi from '@/api/pmmaintenancedispatch.js'
import FileUploadVO from '@/components/FileUploadVO/index.vue'
import AddOrUpdateDispatch from '../dispatch/pmmaintenancedispatch-add-and-update.vue'
export default {
components: {
FileUploadVO,
AddOrUpdateDispatch
},
dicts: ['owner_Type','fault_type','fault_status','dispatch_status'],
data () {
return {
visible: false,
ownerList: [],
houseList: [],
ownerHouseList: [], //
faultPhotoFiles: [], //
dispatchRecords: [], //
dataForm: {
id: 0,
ownerType: '' ,
ownerId: '' ,
houseId: '' ,
houseOwnerId: '' ,
orderNo: '' ,
faultType: '' ,
faultDesc: '' ,
faultPhoto: '' ,
reportChannel: '' ,
reportTime: '' ,
urgencyLevel: '' ,
status: '' ,
remark: '' ,
ownerType: '',
ownerId: '',
houseId: '',
houseOwnerId: '',
orderNo: '',
faultType: '',
faultDesc: '',
faultPhoto: null,
reportChannel: '',
reportTime: '',
urgencyLevel: '',
status: '',
remark: '',
files: []
},
dataRule: {
ownerType: [
@ -85,40 +233,124 @@
houseId: [
{ required: true, message: '房屋id 为必填项', trigger: 'blur' }
],
houseOwnerId: [
{ required: true, message: '房屋业主id 为必填项', trigger: 'blur' }
],
orderNo: [
{ required: true, message: '报修单号 为必填项', trigger: 'blur' }
],
faultType: [
{ required: true, message: '故障类型 为必填项', trigger: 'blur' }
],
faultDesc: [
{ required: true, message: '故障描述 为必填项', trigger: 'blur' }
],
faultPhoto: [
{ required: true, message: '故障照片 为必填项', trigger: 'blur' }
],
reportChannel: [
{ required: true, message: '报修渠道 为必填项', trigger: 'blur' }
],
reportTime: [
{ required: true, message: '报修时间 为必填项', trigger: 'blur' }
],
urgencyLevel: [
{ required: true, message: '紧急程度 为必填项', trigger: 'blur' }
],
status: [
{ required: true, message: '状态 为必填项', trigger: 'blur' }
],
remark: [
{ required: true, message: '备注 为必填项', trigger: 'blur' }
],
}
}
},
mounted() {
this.handleGetOwnerList()
this.handleGetHouseList()
},
methods: {
//
handleGetOwnerList() {
ownerApi.pmownerListApi({ page: 1, limit: 9999 }).then(res => {
this.ownerList = res.list || []
})
},
//
handleGetHouseList() {
houseApi.pmhouseListApi({ page: 1, limit: 9999 }).then(res => {
this.houseList = res.list || []
})
},
//
handleOwnerChange(ownerId) {
//
if (ownerId) {
const selectedOwner = this.ownerList.find(owner => owner.id === ownerId)
if (selectedOwner && selectedOwner.ownerType) {
this.dataForm.ownerType = selectedOwner.ownerType
}
} else {
//
this.dataForm.ownerType = ''
}
//
if (ownerId) {
ownerHouseRelApi.pmownerhouserelListApi({ ownerId: ownerId, page: 1, limit: 9999 }).then(res => {
const relList = res.list || []
// ID
const houseIds = relList.map(item => item.houseId)
//
this.ownerHouseList = this.houseList.filter(house => houseIds.includes(house.id))
//
if (this.ownerHouseList.length > 0) {
this.dataForm.houseId = this.ownerHouseList[0].id
this.dataForm.houseOwnerId = ownerId
} else {
this.dataForm.houseId = ''
this.dataForm.houseOwnerId = ''
}
})
} else {
this.ownerHouseList = []
this.dataForm.houseId = ''
this.dataForm.houseOwnerId = ''
}
},
//
handleHouseChange(houseId) {
if (houseId) {
// IDID
this.dataForm.houseOwnerId = this.dataForm.ownerId
} else {
// ID
this.dataForm.houseOwnerId = ''
}
},
//
updateFaultPhotoFiles(files) {
this.faultPhotoFiles = files
// dataForm.files
if (files && files.length > 0) {
// FileUploadVOSystemAttachment
this.dataForm.files = files.map(file => {
//
let attDir = file.attDir || file.attachFileUrl || ''
// /file/public/
if (attDir.startsWith('/file/public/')) {
attDir = attDir.replace('/file/public/', '')
} else if (attDir.startsWith('/file/')) {
attDir = attDir.replace('/file/', '')
}
return {
// SystemAttachment
attId: file.id || file.attId || '', //
name: file.name || file.oldName || '', //
attDir: attDir, //
attSize: file.attSize || '', //
attType: file.attType || '', //
//
fileName: file.name || file.oldName || '',
filePath: attDir,
url: attDir,
createTime: null,
createdBy: null,
createTimeStr: null,
delFlag: '0',
updateBy: null,
updateTime: null,
i18nCode: '',
i18nLanguage: '',
originalFileName: file.name || file.oldName || '',
position: 0,
remark: file.remark || '',
sort: 0,
status: ''
}
})
} else {
this.dataForm.files = []
}
},
init (id) { //
this.dataForm.id = id || 0
this.visible = true
@ -126,23 +358,275 @@
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
api.pmmaintenanceorderDetailApi(id).then(function(res) {
this.dataForm = res;
//
if (res.reportTime) {
res.reportTime = new Date(res.reportTime)
}
//
const orderDetail = res;
//
if (this.houseList.length === 0) {
//
this.handleGetHouseList();
}
//
if (this.ownerList.length === 0) {
//
this.handleGetOwnerList();
}
//
setTimeout(() => {
// ID
if (orderDetail.ownerId) {
ownerHouseRelApi.pmownerhouserelListApi({ ownerId: orderDetail.ownerId, page: 1, limit: 9999 }).then(relRes => {
const relList = relRes.list || []
// ID
const houseIds = relList.map(item => item.houseId)
//
this.ownerHouseList = this.houseList.filter(house => houseIds.includes(house.id))
//
this.dataForm = orderDetail;
//
if (orderDetail.files && orderDetail.files.length > 0) {
// filesFileUploadVO
this.faultPhotoFiles = orderDetail.files.map((file, index) => ({
attachFileUrl: file.attDir || file.filePath || file.url || '',
attDir: file.attDir || file.filePath || file.url || '',
name: file.name || file.fileName || '',
oldName: file.name || file.fileName || '',
attId: file.attId || '',
uid: file.id || file.fileId || index + new Date().getTime()
}))
} else {
this.faultPhotoFiles = []
}
//
this.getDispatchRecords()
})
} else {
// ID
this.dataForm = orderDetail;
//
if (orderDetail.files && orderDetail.files.length > 0) {
// filesFileUploadVO
this.faultPhotoFiles = orderDetail.files.map((file, index) => ({
attachFileUrl: file.attDir || file.filePath || file.url || '',
attDir: file.attDir || file.filePath || file.url || '',
name: file.name || file.fileName || '',
oldName: file.name || file.fileName || '',
attId: file.attId || '',
uid: file.id || file.fileId || index + new Date().getTime()
}))
} else {
this.faultPhotoFiles = []
}
//
this.getDispatchRecords()
}
}, 500); // 500
}.bind(this))
} else {
//
this.faultPhotoFiles = []
this.dataForm.files = []
//
this.dispatchRecords = []
//
this.dataForm.reportTime = new Date()
}
}.bind(this))
},
//
formatDate(date) {
if (!date) return null
// dateDate
if (typeof date === 'string') {
date = new Date(date)
}
// dateDate
if (isNaN(date.getTime())) {
return null
}
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
},
//
formatDisplayDate(date) {
if (!date) return ''
// dateDate
if (typeof date === 'string') {
date = new Date(date)
}
// dateDate
if (isNaN(date.getTime())) {
return ''
}
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
return `${year}-${month}-${day} ${hours}:${minutes}`
},
//
getDispatchRecords() {
if (!this.dataForm.id) return
console.log('getDispatchRecords - start')
dispatchApi.pmmaintenancedispatchListApi({
orderId: this.dataForm.id
}).then(function(res) {
try {
console.log('getDispatchRecords - res:', res)
// APIfiles
const apiRecords = Array.isArray(res) ? res : (res.list || [])
const newRecords = apiRecords.map(apiRecord => {
// files
const localRecord = this.dispatchRecords.find(item => item.id === apiRecord.id)
if (localRecord && localRecord.files) {
apiRecord.files = localRecord.files
}
return apiRecord
})
// ID
const localNewRecords = this.dispatchRecords.filter(item => item.id === 0 || item.id === '0')
if (localNewRecords && localNewRecords.length > 0) {
newRecords.push(...localNewRecords)
}
this.dispatchRecords = newRecords
console.log('getDispatchRecords - updated dispatchRecords:', this.dispatchRecords)
} catch (error) {
console.log('getDispatchRecords - error:', error)
this.dispatchRecords = []
}
}.bind(this)).catch(function(err) {
console.log('getDispatchRecords - err:', err)
this.dispatchRecords = []
}.bind(this))
},
//
addDispatchRecord() {
if (this.$refs.addOrUpdateDispatch) {
// ID
this.$refs.addOrUpdateDispatch.init(0, this.dataForm.id)
}
},
//
editDispatchRecord(id) {
console.log((this.$refs.addOrUpdateDispatch));
if (this.$refs.addOrUpdateDispatch) {
console.log((this.$refs.addOrUpdateDispatch));
this.$refs.addOrUpdateDispatch.init(id, this.dataForm.id)
}
},
//
deleteDispatchRecord(id, index) {
this.$confirm('确定要删除这条报修派单记录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (id) {
// IDAPI
dispatchApi.pmmaintenancedispatchDeleteApi([id]).then(() => {
this.$message.success('删除成功')
//
this.dispatchRecords.splice(index, 1)
}).catch(() => {
this.$message.error('删除失败')
})
} else {
// ID
this.dispatchRecords.splice(index, 1)
this.$message.success('删除成功')
}
}).catch(() => {
this.$message.info('已取消删除')
})
},
//
saveDispatchRecord(recordData) {
if (!recordData) return
//
const existingIndex = this.dispatchRecords.findIndex(record => record.id === recordData.id)
// Date
const formattedRecord = { ...recordData }
//
if (formattedRecord.assignTime && typeof formattedRecord.assignTime === 'string' && formattedRecord.assignTime !== '') {
formattedRecord.assignTime = new Date(formattedRecord.assignTime)
}
//
if (formattedRecord.expectedCompleteTime && typeof formattedRecord.expectedCompleteTime === 'string' && formattedRecord.expectedCompleteTime !== '') {
formattedRecord.expectedCompleteTime = new Date(formattedRecord.expectedCompleteTime)
}
//
if (formattedRecord.completeTime && typeof formattedRecord.completeTime === 'string' && formattedRecord.completeTime !== '') {
formattedRecord.completeTime = new Date(formattedRecord.completeTime)
}
if (existingIndex !== -1) {
//
this.dispatchRecords.splice(existingIndex, 1, formattedRecord)
} else {
//
this.dispatchRecords.push(formattedRecord)
}
},
//
dataSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
//
const submitData = { ...this.dataForm }
//
if (submitData.reportTime) {
submitData.reportTime = this.formatDate(submitData.reportTime)
}
//
if (this.dispatchRecords && this.dispatchRecords.length > 0) {
submitData.pmMaintenanceDispatchList = this.dispatchRecords.map(record => {
const formattedRecord = { ...record }
//
if (formattedRecord.assignTime) {
formattedRecord.assignTime = this.formatDate(formattedRecord.assignTime)
}
//
if (formattedRecord.expectedCompleteTime) {
formattedRecord.expectedCompleteTime = this.formatDate(formattedRecord.expectedCompleteTime)
}
//
if (formattedRecord.completeTime) {
formattedRecord.completeTime = this.formatDate(formattedRecord.completeTime)
}
// ididnull
if (formattedRecord.id === 0) {
formattedRecord.id = null
}
return formattedRecord
})
} else {
submitData.pmMaintenanceDispatchList = []
}
if (this.dataForm.id) {
api.pmmaintenanceorderUpdateApi(this.dataForm).then(function(res) {
api.pmmaintenanceorderUpdateApi(submitData).then(function(res) {
this.$message.success('保存成功')
this.visible = false
this.$emit('refreshDataList')
}.bind(this));
} else {
api.pmmaintenanceorderCreateApi(this.dataForm).then(function(res) {
api.pmmaintenanceorderCreateApi(submitData).then(function(res) {
this.$message.success('新增成功')
this.visible = false
this.$emit('refreshDataList')
@ -154,3 +638,15 @@
}
}
</script>
<style scoped>
.dispatch-records-container {
margin-top: 20px;
}
.no-data-tip {
text-align: center;
padding: 20px;
color: #909399;
}
</style>

@ -1,20 +1,8 @@
<template>
<div class="divBox">
<el-row :gutter="20">
<!--部门数据-->
<el-col :span="4" :xs="24">
<div class="head-container">
<el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small" prefix-icon="el-icon-search"
style="margin-bottom: 20px"/>
</div>
<div class="head-container">
<el-tree :data="deptTreeOptions" :props="defaultProps" :expand-on-click-node="false"
:filter-node-method="filterNode" ref="tree" node-key="deptId" default-expand-all highlight-current
@node-click="handleNodeClick"/>
</div>
</el-col>
<!--业主数据-->
<el-col :span="20" :xs="24">
<el-col :span="24" :xs="24">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="业主姓名">
<el-input v-model="dataForm.ownerName" placeholder="请输入业主姓名" clearable></el-input>
@ -76,11 +64,7 @@
</el-table-column>
<el-table-column prop="emergencyPhone" header-align="center" align="center" label="紧急联系电话">
</el-table-column>
<el-table-column prop="deptId" header-align="center" align="center" label="所属部门">
<template slot-scope="scope">
{{ getDeptName(scope.row.deptId) }}
</template>
</el-table-column>
<el-table-column prop="houseId" header-align="center" align="center" label="所属房屋">
<template slot-scope="scope">
{{ getHouseName(scope.row.houseId) }}
@ -116,7 +100,6 @@
<script>
import AddOrUpdate from './pmowner-add-and-update'
import * as api from '@/api/pmowner.js'
import * as deptApi from '@/api/sysdept.js'
import * as houseApi from '@/api/pmhouse.js'
import TenatList from '@/views/pm/tenant/index';
import DictTag from '@/components/DictTag'
@ -130,14 +113,8 @@ export default {
dicts: ['owner_Type','owner_status','tenant_status'],
data() {
return {
deptTreeOptions: [],
deptMap: {},
houseMap: {},
deptName: undefined,
defaultProps: {
children: "children",
label: "deptName"
},
dataForm: {
ownerName: '',
ownerType: '',
@ -161,19 +138,15 @@ export default {
}
},
watch: {
deptName(val) {
this.$refs.tree.filter(val);
}
},
// activated () {
// this.getDataList()
// },
mounted() {
//
this.getDataList()
this.handleGetDeptList()
this.handleGetHouseList()
},
//
this.getDataList()
this.handleGetHouseList()
},
methods: {
//
resetForm() {
@ -189,12 +162,7 @@ export default {
remark: '',
}
},
handleGetDeptList() {
deptApi.deptTreeSelect({type: '1'}).then(res => {
this.deptTreeOptions = res
this.buildDeptMap(res)
})
},
handleGetHouseList() {
houseApi.pmhouseListApi({page: 1, limit: 9999}).then(res => {
const houseList = res.list || []
@ -203,24 +171,8 @@ export default {
})
})
},
filterNode(value, data) {
if (!value) return true;
return data.deptName.indexOf(value) !== -1;
},
handleNodeClick(data) {
this.dataForm.deptId = data.deptId;
this.getDataList();
},
buildDeptMap(depts) {
depts.forEach(dept => {
this.deptMap[dept.deptId] = dept.deptName
if (dept.children && dept.children.length > 0) {
this.buildDeptMap(dept.children)
}
})
},
getDeptName(deptId) {
return this.deptMap[deptId] || '-'
return '-'
},
getHouseName(houseId) {
return this.houseMap[houseId] || '-'
@ -243,7 +195,6 @@ export default {
if (this.dataForm.emergencyContact) params.emergencyContact = this.dataForm.emergencyContact;
if (this.dataForm.emergencyPhone) params.emergencyPhone = this.dataForm.emergencyPhone;
if (this.dataForm.status) params.status = this.dataForm.status;
if (this.dataForm.deptId) params.deptId = this.dataForm.deptId;
if (this.dataForm.remark) params.remark = this.dataForm.remark;
api.pmownerListApi(params).then(res => {

@ -57,19 +57,6 @@
<el-input v-model="dataForm.emergencyPhone" placeholder="紧急联系电话"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属部门" prop="deptId">
<treeselect
v-model="dataForm.deptId"
:options="deptTreeOptions"
:normalizer="normalizer"
placeholder="选择部门"
style="width: 100%"
></treeselect>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="所属房屋" prop="houseId">
<el-select v-model="dataForm.houseId" placeholder="选择房屋" clearable style="width: 100%">
@ -82,6 +69,8 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="业主状态" prop="status">
<el-select v-model="dataForm.status" placeholder="请选择业主状态" style="width: 100%;">
@ -159,18 +148,15 @@
import * as tenantApi from '@/api/pmtenant.js'
import * as houseApi from '@/api/pmhouse.js'
import * as rentRecordApi from '@/api/pmtenanthouse.js'
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import TenantAddAndUpdate from './tenant-add-and-update.vue'
import DictTag from '@/components/DictTag'
export default {
components: { Treeselect, TenantAddAndUpdate, DictTag },
components: { TenantAddAndUpdate, DictTag },
dicts: ['tenant_type','owner_Type','owner_status','tenant_status'],
data () {
return {
visible: false,
deptTreeOptions: [],
deptMap: {}, //
houseList: [],
tenantList: [],
@ -184,7 +170,6 @@
emergencyContact: '' ,
emergencyPhone: '' ,
status: '' ,
deptId: null ,
houseId: null ,
remark: '' ,
},
@ -192,9 +177,6 @@
ownerName: [
{ required: true, message: '业主姓名 为必填项', trigger: 'blur' }
],
deptId: [
{ required: true, message: '部门 为必填项', trigger: 'blur' }
],
ownerType: [
{ required: true, message: '业主类型 为必填项', trigger: 'blur' }
],
@ -205,43 +187,10 @@
}
},
mounted() {
this.handleGetDeptList()
this.handleGetHouseList()
},
methods: {
handleGetDeptList() {
// type=1
deptApi.deptTreeSelect({type: '1'}).then(res => {
this.deptTreeOptions = res
//
this.buildDeptMap(res)
//
if (this.tenantList && this.tenantList.length > 0) {
this.tenantList.forEach(tenant => {
if (tenant.deptId) {
tenant.deptName = this.getDeptName(tenant.deptId)
} else {
tenant.deptName = null
}
})
}
//
deptApi.deptTreeSelect().then(allRes => {
//
this.buildDeptMap(allRes)
//
if (this.tenantList && this.tenantList.length > 0) {
this.tenantList.forEach(tenant => {
if (tenant.deptId) {
tenant.deptName = this.getDeptName(tenant.deptId)
} else {
tenant.deptName = null
}
})
}
})
})
},
//
buildDeptMap(depts) {
depts.forEach(dept => {
@ -356,16 +305,7 @@
this.$message.info('已取消删除')
})
},
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.deptId ? node.deptId : '0',
label: node.deptName ? node.deptName : '顶级部门',
children: node.children
};
},
init (id) { //
this.dataForm.id = id || 0
this.visible = true
@ -410,7 +350,6 @@
emergencyContact: this.dataForm.emergencyContact,
emergencyPhone: this.dataForm.emergencyPhone,
status: this.dataForm.status,
deptId: this.dataForm.deptId,
houseId: this.dataForm.houseId,
remark: this.dataForm.remark,
pmTenants: this.tenantList.map(tenant => ({

@ -32,15 +32,6 @@
<el-form-item label="工作单位" prop="company">
<el-input v-model="dataForm.company" placeholder="工作单位"></el-input>
</el-form-item>
<el-form-item label="所属部门" prop="deptId">
<treeselect
v-model="dataForm.deptId"
:options="deptTreeOptions"
:normalizer="normalizer"
placeholder="选择部门"
style="width: 100%"
></treeselect>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="dataForm.status" placeholder="请选择状态" style="width: 100%;">
<el-option
@ -110,14 +101,11 @@
import * as api from '@/api/pmtenant.js'
import * as relApi from '@/api/pmtentanthouserel.js'
import * as rentRecordApi from '@/api/pmtenanthouse.js'
import * as deptApi from '@/api/sysdept.js'
import RentRecordAddAndUpdate from './rent-record-add-and-update.vue'
import DictTag from '@/components/DictTag'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default {
components: {RentRecordAddAndUpdate, DictTag, Treeselect},
components: {RentRecordAddAndUpdate, DictTag},
props: {
ownerId: {
type: String,
@ -129,20 +117,18 @@ export default {
return {
visible: false,
rentRecords: [],
deptTreeOptions: [],
dataForm: {
id: 0,
ownerId: '',
tenantName: '',
tenantType: '',
idCard: '',
phome: '',
company: '',
status: '',
tenantId: '',
deptId: null,
remark: ''
},
id: 0,
ownerId: '',
tenantName: '',
tenantType: '',
idCard: '',
phome: '',
company: '',
status: '',
tenantId: '',
remark: ''
},
dataRule: {
tenantName: [
{required: true, message: '租户姓名 为必填项', trigger: 'blur'}
@ -153,32 +139,14 @@ export default {
idCard: [
{required: true, message: '身份证号 为必填项', trigger: 'blur'}
],
deptId: [
{required: true, message: '所属部门 为必填项', trigger: 'blur'}
],
}
}
},
mounted() {
this.handleGetDeptList()
},
methods: {
handleGetDeptList() {
// type=2
deptApi.deptTreeSelect({type: '2'}).then(res => {
this.deptTreeOptions = res
})
},
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children
}
return {
id: node.deptId ? node.deptId : '0',
label: node.deptName ? node.deptName : '顶级部门',
children: node.children
}
},
init(id, ownerId) { //
this.dataForm.id = id || 0
// ownerId
@ -200,7 +168,6 @@ export default {
this.dataForm.company = ''
this.dataForm.status = ''
this.dataForm.remark = ''
this.dataForm.deptId = null
this.rentRecords = []
}
})

@ -1,20 +1,8 @@
<template>
<div class="divBox">
<el-row :gutter="20">
<!--部门数据-->
<el-col :span="4" :xs="24">
<div class="head-container">
<el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small" prefix-icon="el-icon-search"
style="margin-bottom: 20px" />
</div>
<div class="head-container">
<el-tree :data="deptTreeOptions" :props="defaultProps" :expand-on-click-node="false"
:filter-node-method="filterNode" ref="tree" node-key="deptId" default-expand-all highlight-current
@node-click="handleNodeClick" />
</div>
</el-col>
<!--租户数据-->
<el-col :span="20" :xs="24">
<el-col :span="24" :xs="24">
<el-form v-if="showSearch" :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="租户姓名">
<el-input v-model="dataForm.tenantName" placeholder="请输入租户姓名" clearable></el-input>
@ -93,16 +81,7 @@
align="center"
label="联系电话">
</el-table-column>
<el-table-column
prop="company"
header-align="center"
align="center"
label="工作单位">
</el-table-column>
<el-table-column prop="deptId" label="所属部门" width="150">
<template slot-scope="scope">
{{ getDeptName(scope.row.deptId) }}
</template>
<el-table-column prop="company" header-align="center" align="center" label="工作单位">
</el-table-column>
<el-table-column
prop="status"
@ -187,8 +166,7 @@
<script>
import TenantAddAndUpdate from '@/views/pm/pmowner/tenant-add-and-update'
import * as api from '@/api/pmtenant.js'
import * as deptApi from "@/api/sysdept";
import RecordList from '@/views/pm/tenant/record/index.vue';
import RecordList from '@/views/pm/tenant/record/index.vue';
export default {
dicts: ['owner_Type','owner_status','tenant_status','tenant_type'],
@ -205,13 +183,6 @@
},
data () {
return {
deptTreeOptions: [],
deptMap: {}, //
deptName: undefined,
defaultProps: {
children: "children",
label: "deptName"
},
dataForm: {
// ID
ownerId: this.ownerId,
@ -243,59 +214,16 @@
ownerId(newVal) {
this.dataForm.ownerId = newVal;
this.getDataList();
},
deptName(val) {
this.$refs.tree.filter(val);
}
},
activated () {
this.getDataList()
},
mounted() {
this.handleGetDeptList()
//
this.getDataList()
},
methods: {
handleGetDeptList() {
//
deptApi.deptTreeSelect({type: '2'}).then(allRes => {
this.deptTreeOptions = allRes
//
this.buildDeptMap(allRes)
//
if (this.tenantList && this.tenantList.length > 0) {
this.tenantList.forEach(tenant => {
if (tenant.deptId) {
tenant.deptName = this.getDeptName(tenant.deptId)
} else {
tenant.deptName = null
}
})
}
})
},
filterNode(value, data) {
if (!value) return true;
return data.deptName.indexOf(value) !== -1;
},
handleNodeClick(data) {
this.dataForm.deptId = data.deptId;
this.getDataList();
},
//
buildDeptMap(depts) {
depts.forEach(dept => {
this.deptMap[dept.deptId] = dept.deptName
if (dept.children && dept.children.length > 0) {
this.buildDeptMap(dept.children)
}
})
},
// ID
getDeptName(deptId) {
return this.deptMap[deptId] || '未分配'
},
//
resetForm() {
this.dataForm = {
@ -308,7 +236,6 @@
company: '',
status: '',
remark: '',
deptId: null,
}
this.getDataList()
},
@ -330,7 +257,6 @@
if (this.dataForm.status) params.status = this.dataForm.status;
if (this.dataForm.remark) params.remark = this.dataForm.remark;
if (this.dataForm.ownerId) params.ownerId = this.dataForm.ownerId;
if (this.dataForm.deptId) params.deptId = this.dataForm.deptId;
api.pmtenantListApi(params).then(res => {
this.dataListLoading = false

@ -2,12 +2,15 @@ package com.zbkj.modules.autogencode.controller;
import java.util.Arrays;
import java.util.Map;
import java.util.List;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zbkj.common.request.PageParamRequest;
import com.zbkj.common.response.CommonResult;
import com.zbkj.common.page.CommonPage;
import com.zbkj.modules.autogencode.entity.PmOwner;
import com.zbkj.modules.autogencode.entity.PmTenant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -20,6 +23,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zbkj.modules.autogencode.entity.PmCheckIn;
import com.zbkj.modules.autogencode.service.PmCheckInService;
import com.zbkj.modules.autogencode.service.PmOwnerService;
import com.zbkj.modules.autogencode.service.PmTenantService;
@ -33,6 +38,12 @@ public class PmCheckInController {
@Autowired
private PmCheckInService pmCheckInService;
@Autowired
private PmOwnerService pmOwnerService;
@Autowired
private PmTenantService pmTenantService;
/**
@ -70,6 +81,13 @@ public class PmCheckInController {
if (request.getCheckInDate() != null) {
queryWrapper.eq(PmCheckIn::getCheckInDate, request.getCheckInDate());
}
// 入住日期范围
if (request.getCheckInDateStart() != null) {
queryWrapper.ge(PmCheckIn::getCheckInDate, request.getCheckInDateStart());
}
if (request.getCheckInDateEnd() != null) {
queryWrapper.le(PmCheckIn::getCheckInDate, request.getCheckInDateEnd());
}
// 钥匙交接状态
if (StrUtil.isNotBlank(request.getKeyHandover())) {
@ -80,6 +98,13 @@ public class PmCheckInController {
if (request.getPropertyFeeStart() != null) {
queryWrapper.eq(PmCheckIn::getPropertyFeeStart, request.getPropertyFeeStart());
}
// 物业费起算日期范围
if (request.getPropertyFeeStartStart() != null) {
queryWrapper.ge(PmCheckIn::getPropertyFeeStart, request.getPropertyFeeStartStart());
}
if (request.getPropertyFeeStartEnd() != null) {
queryWrapper.le(PmCheckIn::getPropertyFeeStart, request.getPropertyFeeStartEnd());
}
// 是否申请装修
if (StrUtil.isNotBlank(request.getDecorationApply())) {
@ -158,9 +183,80 @@ public class PmCheckInController {
condition(queryWrapper, request);
CommonPage<PmCheckIn> page = CommonPage.restPage(pmCheckInService.pageList(queryWrapper, pageParamRequest));
// 需要通过 入住类型(业主 / 租户) 判断, 翻译userId可以参考 D:\crmebTwo\admin\src\views\pm\check\in\pmcheckin-add-and-update.vue
setUserName(page);
return CommonResult.success(page);
}
/**
*
* / userId/
*/
private void setUserName(CommonPage<PmCheckIn> page) {
if (page == null || page.getList() == null || page.getList().isEmpty()) {
return;
}
List<PmCheckIn> list = page.getList();
// 收集所有需要查询的业主ID和租户ID
java.util.Set<Long> ownerIds = new java.util.HashSet<>();
java.util.Set<Long> tenantIds = new java.util.HashSet<>();
for (PmCheckIn checkIn : list) {
if (checkIn.getUserId() == null || StrUtil.isBlank(checkIn.getUserType())) {
continue;
}
if ("1".equals(checkIn.getUserType())) {
ownerIds.add(checkIn.getUserId());
} else if ("2".equals(checkIn.getUserType())) {
tenantIds.add(checkIn.getUserId());
}
}
// 批量查询业主和租户信息
java.util.Map<Long, PmOwner> ownerMap = new java.util.HashMap<>();
java.util.Map<Long, PmTenant> tenantMap = new java.util.HashMap<>();
if (!ownerIds.isEmpty()) {
List<PmOwner> ownerList = pmOwnerService.listByIds(ownerIds);
for (PmOwner owner : ownerList) {
ownerMap.put(owner.getId(), owner);
}
}
if (!tenantIds.isEmpty()) {
List<PmTenant> tenantList = pmTenantService.listByIds(tenantIds);
for (PmTenant tenant : tenantList) {
tenantMap.put(tenant.getId(), tenant);
}
}
// 设置用户名称
for (PmCheckIn checkIn : list) {
if (checkIn.getUserId() == null || StrUtil.isBlank(checkIn.getUserType())) {
continue;
}
if ("1".equals(checkIn.getUserType())) {
// 业主类型
PmOwner owner = ownerMap.get(checkIn.getUserId());
if (owner != null) {
checkIn.setUserName(owner.getOwnerName());
}
} else if ("2".equals(checkIn.getUserType())) {
// 租户类型
PmTenant tenant = tenantMap.get(checkIn.getUserId());
if (tenant != null) {
checkIn.setUserName(tenant.getTenantName());
}
}
}
}
/**
*

@ -1,13 +1,18 @@
package com.zbkj.modules.autogencode.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Random;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zbkj.common.model.system.SystemAttachment;
import com.zbkj.common.request.PageParamRequest;
import com.zbkj.common.response.CommonResult;
import com.zbkj.common.page.CommonPage;
import com.zbkj.service.service.SystemAdminService;
import com.zbkj.service.service.SystemAttachmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -20,6 +25,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zbkj.modules.autogencode.entity.PmMaintenanceDispatch;
import com.zbkj.modules.autogencode.service.PmMaintenanceDispatchService;
import com.zbkj.common.model.system.SystemAdmin;
@ -32,8 +38,12 @@ import com.zbkj.modules.autogencode.service.PmMaintenanceDispatchService;
public class PmMaintenanceDispatchController {
@Autowired
private PmMaintenanceDispatchService pmMaintenanceDispatchService;
@Autowired
private SystemAdminService systemAdminService;
@Autowired
private SystemAttachmentService systemAttachmentService;
/**
*
@ -188,6 +198,26 @@ public class PmMaintenanceDispatchController {
condition(queryWrapper, request);
CommonPage<PmMaintenanceDispatch> page = CommonPage.restPage(pmMaintenanceDispatchService.pageList(queryWrapper, pageParamRequest));
// 翻译派单人姓名和执行人姓名
List<PmMaintenanceDispatch> list = page.getList();
for (PmMaintenanceDispatch item : list) {
// 派单人姓名
if (item.getAssignerId() != null) {
SystemAdmin assigner = systemAdminService.getById(item.getAssignerId());
if (assigner != null) {
item.setAssignerName(assigner.getRealName());
}
}
// 执行人姓名
if (item.getExecutorId() != null) {
SystemAdmin executor = systemAdminService.getById(item.getExecutorId());
if (executor != null) {
item.setExecutorName(executor.getRealName());
}
}
}
return CommonResult.success(page);
}
@ -198,15 +228,38 @@ public class PmMaintenanceDispatchController {
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
public CommonResult<PmMaintenanceDispatch> info(@PathVariable("id") Long id){
PmMaintenanceDispatch pmMaintenanceDispatch = pmMaintenanceDispatchService.getById(id);
setDispatchFile(pmMaintenanceDispatch);
return CommonResult.success(pmMaintenanceDispatch);
}
private void setDispatchFile(PmMaintenanceDispatch dispatch) {
Long completePhoto = dispatch.getCompletePhoto();
if (completePhoto != null) {
List<SystemAttachment> list = systemAttachmentService.list(new LambdaQueryWrapper<SystemAttachment>()
.eq(SystemAttachment::getFileId, completePhoto));
dispatch.setFiles(list);
}
}
private void updateDispatchFile(PmMaintenanceDispatch dispatch) {
Long newId = System.currentTimeMillis() + new Random().nextInt(10);
List<SystemAttachment> files = dispatch.getFiles();
if (files != null) {
for (SystemAttachment attachment : files) {
attachment.setFileId(String.valueOf(newId));
}
systemAttachmentService.updateBatchById(files);
dispatch.setCompletePhoto(newId);
}
}
/**
*
*/
@RequestMapping(value = "/save", method = RequestMethod.POST)
public CommonResult<String> save(@RequestBody PmMaintenanceDispatch pmMaintenanceDispatch){
updateDispatchFile(pmMaintenanceDispatch);
if (pmMaintenanceDispatchService.save(pmMaintenanceDispatch)) {
return CommonResult.success();
}
@ -218,6 +271,7 @@ public class PmMaintenanceDispatchController {
*/
@RequestMapping(value = "/update", method = RequestMethod.POST)
public CommonResult<String> update(@RequestBody PmMaintenanceDispatch pmMaintenanceDispatch){
updateDispatchFile(pmMaintenanceDispatch);
if (pmMaintenanceDispatchService.updateById(pmMaintenanceDispatch)) {
return CommonResult.success();
}

@ -1,7 +1,9 @@
package com.zbkj.modules.autogencode.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Random;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -20,6 +22,10 @@ import org.springframework.security.access.prepost.PreAuthorize;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zbkj.modules.autogencode.entity.PmMaintenanceOrder;
import com.zbkj.modules.autogencode.service.PmMaintenanceOrderService;
import com.zbkj.common.model.system.SystemAttachment;
import com.zbkj.service.service.SystemAttachmentService;
import com.zbkj.modules.autogencode.entity.PmMaintenanceDispatch;
import com.zbkj.modules.autogencode.service.PmMaintenanceDispatchService;
@ -33,6 +39,12 @@ public class PmMaintenanceOrderController {
@Autowired
private PmMaintenanceOrderService pmMaintenanceOrderService;
@Autowired
private SystemAttachmentService systemAttachmentService;
@Autowired
private PmMaintenanceDispatchService pmMaintenanceDispatchService;
/**
@ -179,15 +191,61 @@ public class PmMaintenanceOrderController {
public CommonResult<PmMaintenanceOrder> info(@PathVariable("id") Long id){
PmMaintenanceOrder pmMaintenanceOrder = pmMaintenanceOrderService.getById(id);
// 设置文件信息
if (pmMaintenanceOrder != null) {
setFile(pmMaintenanceOrder);
// 查询该订单对应的所有报修派单记录
LambdaQueryWrapper<PmMaintenanceDispatch> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PmMaintenanceDispatch::getOrderId, id);
// 查询所有记录,不使用分页
List<PmMaintenanceDispatch> dispatchList = pmMaintenanceDispatchService.list(queryWrapper);
// 处理每个报修派单记录的完成照片文件
for (PmMaintenanceDispatch dispatch : dispatchList) {
setDispatchFile(dispatch);
}
pmMaintenanceOrder.setPmMaintenanceDispatchList(dispatchList);
}
return CommonResult.success(pmMaintenanceOrder);
}
private void setFile(PmMaintenanceOrder pmMaintenanceOrder) {
Long faultPhoto = pmMaintenanceOrder.getFaultPhoto();
if (faultPhoto != null) {
List<SystemAttachment> list = systemAttachmentService.list(new LambdaQueryWrapper<SystemAttachment>()
.eq(SystemAttachment::getFileId, faultPhoto));
pmMaintenanceOrder.setFiles(list);
}
}
private void setDispatchFile(PmMaintenanceDispatch dispatch) {
Long completePhoto = dispatch.getCompletePhoto();
if (completePhoto != null) {
List<SystemAttachment> list = systemAttachmentService.list(new LambdaQueryWrapper<SystemAttachment>()
.eq(SystemAttachment::getFileId, completePhoto));
dispatch.setFiles(list);
}
}
/**
*
*/
@RequestMapping(value = "/save", method = RequestMethod.POST)
public CommonResult<String> save(@RequestBody PmMaintenanceOrder pmMaintenanceOrder){
// 处理文件保存
if (pmMaintenanceOrder.getFiles() != null) {
updateFile(pmMaintenanceOrder);
}
if (pmMaintenanceOrderService.save(pmMaintenanceOrder)) {
// 获取保存后的订单ID
Long orderId = pmMaintenanceOrder.getId();
// 获取报修派单记录列表
List<PmMaintenanceDispatch> dispatchList = pmMaintenanceOrder.getPmMaintenanceDispatchList();
// 处理报修派单记录列表
handleDispatchRecords(orderId, dispatchList);
return CommonResult.success();
}
return CommonResult.failed();
@ -198,12 +256,76 @@ public class PmMaintenanceOrderController {
*/
@RequestMapping(value = "/update", method = RequestMethod.POST)
public CommonResult<String> update(@RequestBody PmMaintenanceOrder pmMaintenanceOrder){
// 处理文件更新
if (pmMaintenanceOrder.getFiles() != null) {
updateFile(pmMaintenanceOrder);
}
if (pmMaintenanceOrderService.updateById(pmMaintenanceOrder)) {
// 获取订单ID
Long orderId = pmMaintenanceOrder.getId();
// 获取报修派单记录列表
List<PmMaintenanceDispatch> dispatchList = pmMaintenanceOrder.getPmMaintenanceDispatchList();
// 处理报修派单记录列表
handleDispatchRecords(orderId, dispatchList);
return CommonResult.success();
}
return CommonResult.failed();
}
private void updateFile(PmMaintenanceOrder pmMaintenanceOrder) {
Long newId = System.currentTimeMillis() + new Random().nextInt(1000);
List<SystemAttachment> files = pmMaintenanceOrder.getFiles();
if (files != null) {
for (SystemAttachment attachment : files) {
attachment.setFileId(String.valueOf(newId));
}
systemAttachmentService.updateBatchById(files);
pmMaintenanceOrder.setFaultPhoto(newId);
}
}
private void updateDispatchFile(PmMaintenanceDispatch dispatch) {
Long newId = System.currentTimeMillis() + new Random().nextInt(1000);
List<SystemAttachment> files = dispatch.getFiles();
if (files != null) {
for (SystemAttachment attachment : files) {
attachment.setFileId(String.valueOf(newId));
}
systemAttachmentService.updateBatchById(files);
dispatch.setCompletePhoto(newId);
}
}
/**
*
* @param orderId ID
* @param dispatchList
*/
private void handleDispatchRecords(Long orderId, List<PmMaintenanceDispatch> dispatchList) {
// 处理报修派单记录列表
if (dispatchList != null && !dispatchList.isEmpty()) {
for (PmMaintenanceDispatch dispatch : dispatchList) {
// 将订单ID放入报修派单记录对象
dispatch.setOrderId(orderId);
// 处理完成照片文件
updateDispatchFile(dispatch);
// 判断报修派单记录是否有ID进行更新或保存
if (dispatch.getId() != null) {
// 有ID更新报修派单记录
pmMaintenanceDispatchService.updateById(dispatch);
} else {
// 无ID保存报修派单记录
pmMaintenanceDispatchService.save(dispatch);
}
}
}
}
/**
* :id
*/

@ -280,45 +280,67 @@ public class PmOwnerController {
return CommonResult.success(pmOwner);
}
// 新增的时候需要创建一个部门部门名称就是业主的名称ownerName然后将这个部门的部门Id放入到业主的deptId中
// 修改的时候需要做判断,是否需要修改对应的部门的名称
/**
*
*/
@RequestMapping(value = "/save", method = RequestMethod.POST)
public CommonResult<String> save(@RequestBody PmOwner pmOwner){
if (pmOwnerService.save(pmOwner)) {
Long ownerId = pmOwner.getId();
if (pmOwner.getHouseId() != null) {
PmOwnerHouseRel rel = new PmOwnerHouseRel();
rel.setOwnerId(ownerId);
rel.setHouseId(pmOwner.getHouseId());
rel.setRelType("1");
rel.setBindTime(new java.util.Date());
pmOwnerHouseRelService.save(rel);
}
if (pmOwner.getPmTenants() != null && !pmOwner.getPmTenants().isEmpty()) {
for (PmTenant tenant : pmOwner.getPmTenants()) {
if (pmTenantService.save(tenant)) {
Long tenantId = tenant.getId();
// 创建部门,部门名称为业主名称
SysDept sysDept = new SysDept();
sysDept.setParentId(0L); // 设置为根部门的子部门
sysDept.setAncestors("0"); // 祖级列表
sysDept.setDeptName(pmOwner.getOwnerName()); // 部门名称为业主名称
sysDept.setOrderNum(0);
sysDept.setStatus("0"); // 正常状态
sysDept.setDelFlag("0"); // 未删除
sysDept.setType("1"); // 部门类型为业主
// 保存部门
if (sysDeptService.save(sysDept)) {
// 将部门ID设置到业主的deptId中
pmOwner.setDeptId(sysDept.getDeptId());
// 保存业主信息
if (pmOwnerService.save(pmOwner)) {
Long ownerId = pmOwner.getId();
PmTenantHouseRel tenantHouseRel = new PmTenantHouseRel();
tenantHouseRel.setTenantHouseId(tenantId);
tenantHouseRel.setOwnerId(ownerId);
tenantHouseRel.setTenantId(tenant.getTenantId());
tenantHouseRel.setDelFlag("0");
pmTenantHouseRelService.save(tenantHouseRel);
if (pmOwner.getHouseId() != null) {
PmOwnerHouseRel rel = new PmOwnerHouseRel();
rel.setOwnerId(ownerId);
rel.setHouseId(pmOwner.getHouseId());
rel.setRelType("1");
rel.setBindTime(new java.util.Date());
pmOwnerHouseRelService.save(rel);
}
if (tenant.getPmTenantHouses() != null && !tenant.getPmTenantHouses().isEmpty()) {
for (PmTenantHouse tenantHouse : tenant.getPmTenantHouses()) {
tenantHouse.setRentId(tenantId);
pmTenantHouseService.save(tenantHouse);
if (pmOwner.getPmTenants() != null && !pmOwner.getPmTenants().isEmpty()) {
for (PmTenant tenant : pmOwner.getPmTenants()) {
if (pmTenantService.save(tenant)) {
Long tenantId = tenant.getId();
PmTenantHouseRel tenantHouseRel = new PmTenantHouseRel();
tenantHouseRel.setTenantHouseId(tenantId);
tenantHouseRel.setOwnerId(ownerId);
tenantHouseRel.setTenantId(tenant.getTenantId());
tenantHouseRel.setDelFlag("0");
pmTenantHouseRelService.save(tenantHouseRel);
if (tenant.getPmTenantHouses() != null && !tenant.getPmTenantHouses().isEmpty()) {
for (PmTenantHouse tenantHouse : tenant.getPmTenantHouses()) {
tenantHouse.setRentId(tenantId);
pmTenantHouseService.save(tenantHouse);
}
}
}
}
}
return CommonResult.success();
}
return CommonResult.success();
}
return CommonResult.failed();
}
@ -328,6 +350,22 @@ public class PmOwnerController {
*/
@RequestMapping(value = "/update", method = RequestMethod.POST)
public CommonResult<String> update(@RequestBody PmOwner pmOwner){
// 获取旧的业主信息
PmOwner oldOwner = pmOwnerService.getById(pmOwner.getId());
// 比较业主名称是否发生变化
if (oldOwner != null && !oldOwner.getOwnerName().equals(pmOwner.getOwnerName())) {
// 业主名称发生变化,更新对应的部门名称
Long deptId = oldOwner.getDeptId();
if (deptId != null) {
SysDept sysDept = sysDeptService.getById(deptId);
if (sysDept != null) {
sysDept.setDeptName(pmOwner.getOwnerName());
sysDeptService.updateById(sysDept);
}
}
}
if (pmOwnerService.updateById(pmOwner)) {
Long ownerId = pmOwner.getId();

@ -27,7 +27,9 @@ import com.zbkj.modules.autogencode.entity.PmTenantHouseRel;
import com.zbkj.modules.autogencode.service.PmTenantService;
import com.zbkj.modules.autogencode.service.PmTenantHouseRelService;
import com.zbkj.common.model.user.User;
import com.zbkj.common.model.system.SysDept;
import com.zbkj.service.service.UserService;
import com.zbkj.service.service.SysDeptService;
@ -49,6 +51,9 @@ public class PmTenantController {
@Autowired
private UserService userService;
@Autowired
private SysDeptService sysDeptService;
@ -191,13 +196,32 @@ public class PmTenantController {
return CommonResult.success(pmTenant);
}
/**
*
*/
@RequestMapping(value = "/save", method = RequestMethod.POST)
public CommonResult<PmTenant> save(@RequestBody PmTenant pmTenant){
if (pmTenantService.save(pmTenant)) {
return CommonResult.success(pmTenant);
// 创建部门,部门名称为租户名称
SysDept sysDept = new SysDept();
sysDept.setParentId(0L); // 设置为根部门的子部门
sysDept.setAncestors("0"); // 祖级列表
sysDept.setDeptName(pmTenant.getTenantName()); // 部门名称为租户名称
sysDept.setOrderNum(0);
sysDept.setStatus("0"); // 正常状态
sysDept.setDelFlag("0"); // 未删除
sysDept.setType("2"); // 部门类型为租户
// 保存部门
if (sysDeptService.save(sysDept)) {
// 将部门ID设置到租户的deptId中
pmTenant.setDeptId(sysDept.getDeptId());
// 保存租户信息
if (pmTenantService.save(pmTenant)) {
return CommonResult.success(pmTenant);
}
}
return CommonResult.failed();
}
@ -207,6 +231,22 @@ public class PmTenantController {
*/
@RequestMapping(value = "/update", method = RequestMethod.POST)
public CommonResult<String> update(@RequestBody PmTenant pmTenant){
// 获取旧的租户信息
PmTenant oldTenant = pmTenantService.getById(pmTenant.getId());
// 比较租户名称是否发生变化
if (oldTenant != null && !oldTenant.getTenantName().equals(pmTenant.getTenantName())) {
// 租户名称发生变化,更新对应的部门名称
Long deptId = oldTenant.getDeptId();
if (deptId != null) {
SysDept sysDept = sysDeptService.getById(deptId);
if (sysDept != null) {
sysDept.setDeptName(pmTenant.getTenantName());
sysDeptService.updateById(sysDept);
}
}
}
if (pmTenantService.updateById(pmTenant)) {
return CommonResult.success();
}

@ -1,9 +1,11 @@
package com.zbkj.modules.autogencode.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.io.Serializable;
@ -42,8 +44,27 @@ public class PmCheckIn implements Serializable {
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "入住日期")
private Date checkInDate;
/**
*
*/
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "入住日期开始")
private Date checkInDateStart;
/**
*
*/
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "入住日期结束")
private Date checkInDateEnd;
/**
*
*/
@ -53,8 +74,27 @@ public class PmCheckIn implements Serializable {
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "物业费起算日期")
private Date propertyFeeStart;
/**
*
*/
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "物业费起算日期开始")
private Date propertyFeeStartStart;
/**
*
*/
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "物业费起算日期结束")
private Date propertyFeeStartEnd;
/**
*
*/
@ -116,4 +156,11 @@ public class PmCheckIn implements Serializable {
@ApiModelProperty(value = "租户ID")
private String tenantId;
/**
* /
*/
@TableField(exist = false)
@ApiModelProperty(value = "业主/租户名称")
private String userName;
}

@ -2,6 +2,7 @@ package com.zbkj.modules.autogencode.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
@ -29,6 +30,7 @@ public class PmCheckOut implements Serializable {
/**
* 退
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "退租日期")
private Date checkOutDate;
/**

@ -1,13 +1,17 @@
package com.zbkj.modules.autogencode.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zbkj.common.model.system.SystemAttachment;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import lombok.Data;
@ -88,7 +92,7 @@ public class PmMaintenanceDispatch implements Serializable {
@ApiModelProperty(value = "维修费用")
private BigDecimal costAmount;
/**
*
*
*/
@ApiModelProperty(value = "完成照片")
private Long completePhoto;
@ -143,4 +147,23 @@ public class PmMaintenanceDispatch implements Serializable {
@ApiModelProperty(value = "租户ID")
private String tenantId;
/**
*
*/
@TableField(exist = false)
private List<SystemAttachment> files;
/**
*
*/
@TableField(exist = false)
private String assignerName;
/**
*
*/
@TableField(exist = false)
private String executorName;
}

@ -3,11 +3,16 @@ package com.zbkj.modules.autogencode.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.zbkj.common.model.system.SystemAttachment;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@Data
@ -69,6 +74,8 @@ public class PmMaintenanceOrder implements Serializable {
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@ApiModelProperty(value = "报修时间")
private Date reportTime;
/**
@ -122,4 +129,20 @@ public class PmMaintenanceOrder implements Serializable {
@ApiModelProperty(value = "租户ID")
private String tenantId;
/**
*
*/
@TableField(exist = false)
private List<SystemAttachment> files;
/**
*
*/
@TableField(exist = false)
private List<PmMaintenanceDispatch> pmMaintenanceDispatchList;
}

@ -126,3 +126,9 @@ public class PmOwner implements Serializable {
private List<PmTenant> pmTenants;
}

@ -88,3 +88,8 @@ public class PmOwnerHouseRel implements Serializable {
private String tenantId;
}

@ -9,7 +9,15 @@ import org.springframework.stereotype.Service;
import com.zbkj.modules.autogencode.dao.PmCheckInDao;
import com.zbkj.modules.autogencode.entity.PmCheckIn;
import com.zbkj.modules.autogencode.entity.PmTenantHouse;
import com.zbkj.modules.autogencode.entity.PmTenantHouseRel;
import com.zbkj.modules.autogencode.entity.PmTenant;
import com.zbkj.modules.autogencode.entity.PmOwner;
import com.zbkj.modules.autogencode.service.PmCheckInService;
import com.zbkj.modules.autogencode.service.PmTenantHouseService;
import com.zbkj.modules.autogencode.service.PmTenantHouseRelService;
import com.zbkj.modules.autogencode.service.PmTenantService;
import com.zbkj.modules.autogencode.service.PmOwnerService;
import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.PageParamRequest;
@ -17,6 +25,7 @@ import javax.annotation.Resource;
import java.util.Map;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@Service("pmCheckInService")
@ -26,6 +35,18 @@ public class PmCheckInServiceImpl extends ServiceImpl<PmCheckInDao, PmCheckIn> i
@Resource
private PmCheckInDao dao;
@Resource
private PmTenantHouseService pmTenantHouseService;
@Resource
private PmTenantHouseRelService pmTenantHouseRelService;
@Resource
private PmTenantService pmTenantService;
@Resource
private PmOwnerService pmOwnerService;
/**
*
@ -35,7 +56,62 @@ public class PmCheckInServiceImpl extends ServiceImpl<PmCheckInDao, PmCheckIn> i
PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
return dao.selectList(queryWrapper);
List<PmCheckIn> list = dao.selectList(queryWrapper);
// 翻译业主/租户名称
translateUserName(list);
return list;
}
/**
* /
*/
private void translateUserName(List<PmCheckIn> list) {
if (list == null || list.isEmpty()) {
return;
}
for (PmCheckIn checkIn : list) {
if (checkIn.getTenantHouseId() == null) {
continue;
}
// 获取租赁信息
PmTenantHouse tenantHouse = pmTenantHouseService.getById(checkIn.getTenantHouseId());
if (tenantHouse == null) {
continue;
}
// 获取租赁关系
LambdaQueryWrapper<PmTenantHouseRel> relWrapper = new LambdaQueryWrapper<>();
relWrapper.eq(PmTenantHouseRel::getTenantHouseId, checkIn.getTenantHouseId());
List<PmTenantHouseRel> relList = pmTenantHouseRelService.list(relWrapper);
if (relList == null || relList.isEmpty()) {
continue;
}
PmTenantHouseRel rel = relList.get(0);
// 根据入住类型获取对应的名称
if ("业主".equals(checkIn.getUserType())) {
// 获取业主名称
if (rel.getOwnerId() != null) {
PmOwner owner = pmOwnerService.getById(rel.getOwnerId());
if (owner != null) {
checkIn.setUserName(owner.getOwnerName());
}
}
} else if ("租户".equals(checkIn.getUserType())) {
// 获取租户名称
if (tenantHouse.getRentId() != null) {
PmTenant tenant = pmTenantService.getById(tenantHouse.getRentId());
if (tenant != null) {
checkIn.setUserName(tenant.getTenantName());
}
}
}
}
}

@ -110,4 +110,7 @@ public class SysDept implements Serializable {
*/
@ApiModelProperty(value = "部门类型")
private String type;
}
}

Loading…
Cancel
Save