Merge branch 'main' into property-only-app

property-only-app
wx-jincw 3 months ago
commit e20f33ddb8

@ -61,3 +61,15 @@ export function pmmaintenanceorderListApi(params) {
}) })
} }
/**
* pmmaintenanceorder更新状态和备注
* @param data
*/
export function pmmaintenanceorderUpdateStatusAndRemarkApi(data) {
return request({
url: `autogencode/pmmaintenanceorder/updateStatusAndRemark`,
method: 'POST',
data
})
}

@ -1,8 +1,21 @@
<template> <template>
<div> <div>
<div style="margin-bottom: 10px;">
<el-form :inline="true" :model="searchForm" @keyup.enter.native="getDataList()" style="margin-bottom: 10px;">
<el-form-item label="货架代码">
<el-input v-model="searchForm.shelfCode" placeholder="请输入货架代码" clearable size="small"></el-input>
</el-form-item>
<el-form-item label="货架名称">
<el-input v-model="searchForm.shelfName" placeholder="请输入货架名称" clearable size="small"></el-input>
</el-form-item>
<el-form-item>
<el-button size="small" @click="getDataList()"></el-button>
<el-button size="small" @click="resetSearchForm()"></el-button>
<!-- <div style="margin-bottom: 10px;">-->
<el-button type="primary" size="small" @click="addShelf"></el-button> <el-button type="primary" size="small" @click="addShelf"></el-button>
</div> <!-- </div>-->
</el-form-item>
</el-form>
<el-table <el-table
:data="dataList" :data="dataList"
border border
@ -167,6 +180,10 @@ export default {
warehouseId: '', warehouseId: '',
remark: '' remark: ''
}, },
searchForm: {
shelfCode: '',
shelfName: ''
},
dataList: [], dataList: [],
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
@ -238,6 +255,15 @@ export default {
this.pageIndex = 1 this.pageIndex = 1
this.getDataList() this.getDataList()
}, },
//
resetSearchForm() {
this.searchForm = {
shelfCode: '',
shelfName: ''
}
this.pageIndex = 1
this.getDataList()
},
// //
getDataList() { getDataList() {
this.dataListLoading = true this.dataListLoading = true
@ -248,9 +274,8 @@ export default {
} }
// //
if (this.dataForm.shelfCode) params.shelfCode = this.dataForm.shelfCode if (this.searchForm.shelfCode) params.shelfCode = this.searchForm.shelfCode
if (this.dataForm.shelfName) params.shelfName = this.dataForm.shelfName if (this.searchForm.shelfName) params.shelfName = this.searchForm.shelfName
if (this.dataForm.remark) params.remark = this.dataForm.remark
api.cmshelfListApi(params).then((res) => { api.cmshelfListApi(params).then((res) => {
this.dataListLoading = false this.dataListLoading = false

@ -32,7 +32,7 @@
<el-form-item> <el-form-item>
<el-button @click="getDataList()"></el-button> <el-button @click="getDataList()"></el-button>
<el-button @click="resetForm()"></el-button> <el-button @click="resetForm()"></el-button>
<el-button v-hasPermi="['autogencode:fmbillcharge:save']" type="primary" @click="addOrUpdateHandle()"></el-button> <el-button v-hasPermi="['autogencode:fmbillcharge:save']" type="primary" @click="addOrUpdateHandle()"></el-button>
<el-button v-hasPermi="['autogencode:fmbillcharge:delete']" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0"></el-button> <el-button v-hasPermi="['autogencode:fmbillcharge:delete']" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>

@ -47,7 +47,7 @@
<el-form-item> <el-form-item>
<el-button @click="getDataList()"></el-button> <el-button @click="getDataList()"></el-button>
<el-button @click="resetForm()"></el-button> <el-button @click="resetForm()"></el-button>
<el-button v-hasPermi="['autogencode:fmcash:save']" type="primary" @click="addOrUpdateHandle()"></el-button> <el-button v-hasPermi="['autogencode:fmcash:save']" type="primary" @click="addOrUpdateHandle()"></el-button>
<el-button v-hasPermi="['autogencode:fmcash:delete']" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0"></el-button> <el-button v-hasPermi="['autogencode:fmcash:delete']" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>

@ -102,7 +102,7 @@
:default-building-id="dataForm.id" :default-building-id="dataForm.id"
:default-project-id="dataForm.projectId" :default-project-id="dataForm.projectId"
@close="houseVisible = false" @close="houseVisible = false"
@refresh-data-list="refreshHouseList" @refreshDataList="refreshHouseList"
@add-house-to-list="addHouseToList" @add-house-to-list="addHouseToList"
/> />
</div> </div>

@ -53,6 +53,7 @@
border border
v-loading="dataListLoading" v-loading="dataListLoading"
@selection-change="selectionChangeHandle" @selection-change="selectionChangeHandle"
:row-key="row => row.id"
style="width: 100%;"> style="width: 100%;">
<el-table-column <el-table-column
type="selection" type="selection"
@ -60,6 +61,64 @@
align="center" align="center"
width="50"> width="50">
</el-table-column> </el-table-column>
<el-table-column
type="expand"
header-align="center"
align="center">
<template slot-scope="scope">
<div class="maintenance-records-container">
<el-form :inline="true" :model="getMaintenanceRecordSearchForm(scope.row.id)" @keyup.enter.native="getMaintenanceRecords(scope.row.id)" style="margin-bottom: 10px;">
<el-form-item label="维保日期">
<el-date-picker
v-model="getMaintenanceRecordSearchForm(scope.row.id).execTimeRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
size="small">
</el-date-picker>
</el-form-item>
<el-form-item label="执行人">
<el-input v-model="getMaintenanceRecordSearchForm(scope.row.id).executorName" placeholder="请输入执行人" clearable size="small"></el-input>
</el-form-item>
<el-form-item label="执行部门">
<el-input v-model="getMaintenanceRecordSearchForm(scope.row.id).executorDeptName" placeholder="请输入执行部门" clearable size="small"></el-input>
</el-form-item>
<el-form-item>
<el-button size="small" @click="getMaintenanceRecords(scope.row.id)"></el-button>
<el-button size="small" @click="resetMaintenanceRecordSearchForm(scope.row.id)"></el-button>
<el-button type="primary" size="small" @click="addMaintenanceRecord(scope.row.id)"></el-button>
</el-form-item>
</el-form>
<el-table :data="getMaintenanceRecordsByPlanId(scope.row.id)" style="width: 100%">
<el-table-column prop="execTime" label="维保日期" width="180"></el-table-column>
<el-table-column prop="executorName" label="执行人" width="120"></el-table-column>
<el-table-column prop="executorDeptName" label="执行部门" width="150"></el-table-column>
<el-table-column prop="content" label="维保内容" width="200"></el-table-column>
<el-table-column prop="consumables" label="耗材使用" width="150"></el-table-column>
<el-table-column prop="costAmount" label="维保费用" width="120">
<template slot-scope="recordScope">
{{ recordScope.row.costAmount || 0 }}
</template>
</el-table-column>
<el-table-column prop="status" label="维保状态" width="120">
<template slot-scope="scope">
<dict-tag :options="dict.type.maintenance_status" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column prop="result" label="维保结果" width="150"></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="recordScope">
<el-button type="text" size="small" @click="editMaintenanceRecord(recordScope.row.id, scope.row.id)">{{ '修改' }}</el-button>
<el-button type="text" size="small" @click="deleteMaintenanceRecord(recordScope.row.id, scope.row.id)" style="color: #f56c6c;">{{ '删除' }}</el-button>
</template>
</el-table-column>
</el-table>
</div>
</template>
</el-table-column>
<el-table-column <el-table-column
prop="facilityId" prop="facilityId"
header-align="center" header-align="center"
@ -130,7 +189,7 @@
fixed="right" fixed="right"
header-align="center" header-align="center"
align="center" align="center"
width="150" width="180"
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ '' }}</el-button> <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ '' }}</el-button>
@ -149,17 +208,22 @@
</el-pagination> </el-pagination>
<!-- 表单弹窗, 新增数据和修改数据 --> <!-- 表单弹窗, 新增数据和修改数据 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<!-- 维保记录表单弹窗 -->
<add-or-update-record ref="addOrUpdateRecord" :visible="maintenanceRecordFormVisible" :planId="currentPlanId" @close="maintenanceRecordFormVisible = false" @refreshDataList="saveMaintenanceRecord"></add-or-update-record>
</div> </div>
</template> </template>
<script> <script>
import AddOrUpdate from './pmfacilitymaintenanceplan-add-and-update' import AddOrUpdate from './pmfacilitymaintenanceplan-add-and-update'
import AddOrUpdateRecord from '../record/pmfacilitymaintenacerecord-add-and-update'
import * as api from '@/api/pmfacilitymaintenanceplan.js' import * as api from '@/api/pmfacilitymaintenanceplan.js'
import * as apiByProject from '@/api/pmproject.js' import * as apiByProject from '@/api/pmproject.js'
import * as apiByBuilding from '@/api/pmbuilding.js' import * as apiByBuilding from '@/api/pmbuilding.js'
import * as apiByFacility from '@/api/pmfacility.js' import * as apiByFacility from '@/api/pmfacility.js'
import * as apiByRecord from '@/api/pmfacilitymaintenacerecord.js'
export default { export default {
dicts: ['maintenance_type'], dicts: ['maintenance_type','maintenance_status'],
data () { data () {
return { return {
dataForm: { dataForm: {
@ -184,11 +248,17 @@
addOrUpdateVisible: false, addOrUpdateVisible: false,
projectList: [], projectList: [],
buildingList: [], buildingList: [],
facilityList: [] facilityList: [],
//
maintenanceRecordsMap: {}, //
maintenanceRecordSearchForms: {}, //
maintenanceRecordFormVisible: false,
currentPlanId: null
} }
}, },
components: { components: {
AddOrUpdate AddOrUpdate,
AddOrUpdateRecord
}, },
activated () { activated () {
this.getDataList() this.getDataList()
@ -350,6 +420,98 @@
}) })
}) })
}, },
//
getMaintenanceRecords(planId) {
const params = {
planId: planId
}
//
const searchForm = this.getMaintenanceRecordSearchForm(planId)
//
if (searchForm.execTimeRange && searchForm.execTimeRange.length === 2) {
params.execTimeStart = searchForm.execTimeRange[0]
params.execTimeEnd = searchForm.execTimeRange[1]
}
if (searchForm.executorName) params.executorName = searchForm.executorName
if (searchForm.executorDeptName) params.executorDeptName = searchForm.executorDeptName
apiByRecord.pmfacilitymaintenacerecordListApi(params).then(res => {
if (!this.maintenanceRecordsMap[planId]) {
this.$set(this.maintenanceRecordsMap, planId, [])
}
this.$set(this.maintenanceRecordsMap, planId, res.list || [])
}).catch(e => {
if (!this.maintenanceRecordsMap[planId]) {
this.$set(this.maintenanceRecordsMap, planId, [])
}
this.$set(this.maintenanceRecordsMap, planId, [])
})
},
// ID
getMaintenanceRecordsByPlanId(planId) {
if (!this.maintenanceRecordsMap[planId]) {
this.getMaintenanceRecords(planId)
return []
}
return this.maintenanceRecordsMap[planId]
},
//
getMaintenanceRecordSearchForm(planId) {
if (!this.maintenanceRecordSearchForms[planId]) {
this.$set(this.maintenanceRecordSearchForms, planId, {
execTime: '',
executorId: '',
executorDept: ''
})
}
return this.maintenanceRecordSearchForms[planId]
},
//
resetMaintenanceRecordSearchForm(planId) {
this.$set(this.maintenanceRecordSearchForms, planId, {
execTimeRange: [],
executorName: '',
executorDeptName: ''
})
this.getMaintenanceRecords(planId)
},
//
addMaintenanceRecord(planId) {
this.currentPlanId = planId
this.maintenanceRecordFormVisible = true
if (this.$refs.addOrUpdateRecord) {
this.$refs.addOrUpdateRecord.init(0, planId)
}
},
//
editMaintenanceRecord(id, planId) {
this.currentPlanId = planId
this.maintenanceRecordFormVisible = true
if (this.$refs.addOrUpdateRecord) {
this.$refs.addOrUpdateRecord.init(id, planId)
}
},
//
deleteMaintenanceRecord(id, planId) {
this.$confirm('确定要删除这条维保记录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
apiByRecord.pmfacilitymaintenacerecordDeleteApi([id]).then(() => {
this.$message.success('删除成功')
this.getMaintenanceRecords(planId)
}).catch(() => {
// this.$message.error('')
})
}).catch(() => {})
},
//
saveMaintenanceRecord() {
if (this.currentPlanId) {
this.getMaintenanceRecords(this.currentPlanId)
}
}
} }
} }
</script> </script>

@ -46,12 +46,40 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="执行人" prop="executorId"> <el-form-item label="执行人" prop="executorId">
<el-input v-model="dataForm.executorId" placeholder="执行人"></el-input> <el-select v-model="dataForm.executorId" placeholder="请选择执行人" style="width: 100%">
<el-option
v-for="person in personList"
:key="person.uid"
:label="person.realName"
:value="person.uid">
</el-option>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="执行部门" prop="executorDept"> <el-form-item label="执行部门" prop="executorDept">
<el-input v-model="dataForm.executorDept" placeholder="执行部门"></el-input> <el-popover
placement="bottom-start"
width="300"
trigger="click"
v-model="deptPopoverVisible">
<el-tree
:data="deptTreeData"
:props="{ label: 'deptName', value: 'deptId', children: 'children' }"
node-key="deptId"
highlight-current
default-expand-all
@node-click="handleDeptNodeClick">
</el-tree>
<el-input
slot="reference"
v-model="deptName"
placeholder="请选择执行部门"
readonly
suffix-icon="el-icon-arrow-down"
style="width: 100%">
</el-input>
</el-popover>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -87,7 +115,14 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="维保状态" prop="status"> <el-form-item label="维保状态" prop="status">
<el-input v-model="dataForm.status" placeholder="维保状态"></el-input> <el-select v-model="dataForm.status" placeholder="请选择维保状态" style="width: 100%">
<el-option
v-for="item in dict.maintenance_status"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -104,11 +139,14 @@
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="备注" type="textarea"></el-input> <el-input v-model="dataForm.remark" placeholder="备注" type="textarea"></el-input>
</el-form-item> </el-form-item>
<el-col :span="12">
<el-form-item label="文件id" prop="fileId">
<el-input v-model="dataForm.fileId" placeholder="文件id"></el-input>
</el-form-item>
</el-col> </el-col>
<el-col :span="24">
<el-form-item label="附件上传" prop="files">
<FileUploadVO
:value="fileList"
@input="updateFileList"
></FileUploadVO>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
@ -120,14 +158,23 @@
</template> </template>
<script> <script>
import request from '@/utils/request'
import * as api from '@/api/pmfacilitymaintenacerecord.js' import * as api from '@/api/pmfacilitymaintenacerecord.js'
import * as apiByProject from '@/api/pmproject.js' import * as apiByProject from '@/api/pmproject.js'
import * as apiByBuilding from '@/api/pmbuilding.js' import * as apiByBuilding from '@/api/pmbuilding.js'
import * as apiByFacility from '@/api/pmfacility.js' import * as apiByFacility from '@/api/pmfacility.js'
import * as apiByPlan from '@/api/pmfacilitymaintenanceplan.js'
import * as apiByUser from '@/api/ebuser.js'
import * as apiByDept from '@/api/dept.js'
import FileUploadVO from '@/components/FileUploadVO/index.vue'
export default { export default {
components: {
FileUploadVO
},
dicts: ['maintenance_status'],
props: { props: {
planId: { planId: {
type: Number, type: [String, Number],
default: 0 default: 0
} }
}, },
@ -137,6 +184,12 @@
projectList: [], projectList: [],
buildingList: [], buildingList: [],
facilityList: [], facilityList: [],
personList: [],
deptList: [],
deptTreeData: [],
deptName: '',
deptPopoverVisible: false,
fileList: [], //
dataForm: { dataForm: {
id: '' , id: '' ,
planId: this.planId || '' , planId: this.planId || '' ,
@ -153,24 +206,54 @@
result: '' , result: '' ,
fileId: '' , fileId: '' ,
remark: '' , remark: '' ,
files: [] ,
}, },
dataRule: { dataRule: {
executorId: [ executorId: [
{ required: true, message: '执行人 为必填项', trigger: 'blur' } { required: true, message: '执行人 为必填项', trigger: 'change' }
], ],
executorDept: [ executorDept: [
{ required: true, message: '执行部门 为必填项', trigger: 'blur' } { required: true, message: '执行部门 为必填项', trigger: 'change' }
], ],
execTime: [ execTime: [
{ required: true, message: '执行时间 为必填项', trigger: 'blur' } { required: true, message: '执行时间 为必填项', trigger: 'blur' }
], ],
content: [ // content: [
{ required: true, message: '实际维保内容 为必填项', trigger: 'blur' } // { required: true, message: ' ', trigger: 'blur' }
], // ],
} }
} }
}, },
methods: { methods: {
//
updateFileList(files) {
this.fileList = 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 || '', //
}
})
} else {
this.dataForm.files = []
}
},
// //
getProjectList() { getProjectList() {
apiByProject.pmprojectListByAllApi().then(res => { apiByProject.pmprojectListByAllApi().then(res => {
@ -211,6 +294,76 @@
this.facilityList = [] this.facilityList = []
}) })
}, },
//
getPersonList() {
// API
apiByUser.ebuserListApiByAll({ hasOwnerTenantId: true }).then(res => {
try {
this.personList = Array.isArray(res) ? res : (res.list || [])
} catch (processingErr) {
this.personList = []
}
}).catch(err => {
this.personList = []
console.error('获取执行人列表失败:', err)
})
},
//
getDeptList() {
return new Promise((resolve, reject) => {
// API
apiByDept.deptTreeSelect().then(res => {
try {
const treeData = Array.isArray(res) ? res : (res.data || [])
//
this.deptTreeData = treeData
//
this.deptList = this.flattenDeptTree(treeData)
resolve()
} catch (processingErr) {
this.deptTreeData = []
this.deptList = []
reject(processingErr)
}
}).catch(err => {
this.deptTreeData = []
this.deptList = []
console.error('获取执行部门列表失败:', err)
reject(err)
})
})
},
//
flattenDeptTree(treeData) {
const result = []
const flatten = (nodes) => {
nodes.forEach(node => {
result.push({
id: node.deptId,
name: node.deptName
})
if (node.children && node.children.length > 0) {
flatten(node.children)
}
})
}
flatten(treeData)
return result
},
// ID
getDeptNameById(deptId) {
if (!deptId) return ''
const dept = this.deptList.find(item => item.id == deptId)
return dept ? dept.name : ''
},
//
handleDeptNodeClick(data) {
this.dataForm.executorDept = data.deptId
this.deptName = data.deptName
this.deptPopoverVisible = false
//
this.$refs.dataForm.validateField('executorDept')
},
// //
handleProjectChange(projectId) { handleProjectChange(projectId) {
this.dataForm.buildingId = '' // this.dataForm.buildingId = '' //
@ -235,8 +388,36 @@
this.dataForm.facilityId = facilityId || this.dataForm.facilityId this.dataForm.facilityId = facilityId || this.dataForm.facilityId
this.dataForm.buildingId = buildingId || this.dataForm.buildingId this.dataForm.buildingId = buildingId || this.dataForm.buildingId
this.dataForm.projectId = projectId || this.dataForm.projectId this.dataForm.projectId = projectId || this.dataForm.projectId
// //
this.getProjectList() this.getProjectList()
//
this.getPersonList()
//
this.getDeptList()
// ID
if (finalPlanId) {
apiByPlan.pmfacilitymaintenanceplanDetailApi(finalPlanId).then(res => {
if (res) {
//
this.dataForm.projectId = res.projectId || this.dataForm.projectId
this.dataForm.buildingId = res.buildingId || this.dataForm.buildingId
this.dataForm.facilityId = res.facilityId || this.dataForm.facilityId
// ID
if (this.dataForm.projectId) {
this.getBuildingList(this.dataForm.projectId)
// ID
if (this.dataForm.buildingId) {
this.getFacilityList(this.dataForm.projectId, this.dataForm.buildingId)
}
}
}
}).catch(err => {
console.error('获取计划详情失败:', err)
})
} else {
// ID // ID
if (this.dataForm.projectId) { if (this.dataForm.projectId) {
this.getBuildingList(this.dataForm.projectId) this.getBuildingList(this.dataForm.projectId)
@ -245,11 +426,33 @@
this.getFacilityList(this.dataForm.projectId, this.dataForm.buildingId) this.getFacilityList(this.dataForm.projectId, this.dataForm.buildingId)
} }
} }
}
if (this.dataForm.id) { if (this.dataForm.id) {
api.pmfacilitymaintenacerecordDetailApi(id).then(res => { api.pmfacilitymaintenacerecordDetailApi(id).then(res => {
this.dataForm = res; this.dataForm = res;
//
if (res.files && res.files.length > 0) {
this.fileList = res.files.map(file => ({
id: file.attId || file.id || '',
name: file.name || file.oldName || '',
attDir: file.attDir || file.attachFileUrl || '',
attSize: file.attSize || '',
attType: file.attType || '',
oldName: file.name || file.oldName || ''
}))
} else {
this.fileList = []
}
// //
this.getProjectList() this.getProjectList()
//
this.getPersonList()
//
this.getDeptList().then(() => {
//
this.deptName = this.getDeptNameById(this.dataForm.executorDept)
})
// ID // ID
if (this.dataForm.projectId) { if (this.dataForm.projectId) {
this.getBuildingList(this.dataForm.projectId) this.getBuildingList(this.dataForm.projectId)
@ -259,6 +462,9 @@
} }
} }
}) })
} else {
//
this.fileList = []
} }
}) })
}, },
@ -266,10 +472,27 @@
dataSubmit () { dataSubmit () {
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate((valid) => {
if (valid) { if (valid) {
// if (this.dataForm.id) {
this.$emit('saveMaintenanceRecord', this.dataForm) //
api.pmfacilitymaintenacerecordUpdateApi(this.dataForm).then(res => {
this.$message.success('修改成功')
this.$emit('refreshDataList')
this.visible = false
}).catch(err => {
this.$message.error('修改失败')
console.error(err)
})
} else {
//
api.pmfacilitymaintenacerecordCreateApi(this.dataForm).then(res => {
this.$message.success('保存成功') this.$message.success('保存成功')
this.$emit('refreshDataList')
this.visible = false this.visible = false
}).catch(err => {
this.$message.error('保存失败')
console.error(err)
})
}
} }
}) })
} }

@ -221,7 +221,7 @@
api.pmhouseUpdateApi(this.dataForm).then(function(res) { api.pmhouseUpdateApi(this.dataForm).then(function(res) {
this.$message.success('保存成功') this.$message.success('保存成功')
this.$emit('close') this.$emit('close')
this.$emit('refresh-data-list') this.$emit('refreshDataList')
}.bind(this)); }.bind(this));
} else { } else {
// //
@ -230,7 +230,7 @@
api.pmhouseCreateApi(this.dataForm).then(function(res) { api.pmhouseCreateApi(this.dataForm).then(function(res) {
this.$message.success('新增成功') this.$message.success('新增成功')
this.$emit('close') this.$emit('close')
this.$emit('refresh-data-list') this.$emit('refreshDataList')
}.bind(this)); }.bind(this));
} else { } else {
// ID // ID

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<div style="margin-bottom: 10px;"> <div style="margin-bottom: 10px;">
<el-button type="primary" size="small" @click="addDispatch"></el-button> <el-button type="primary" size="small" @click="addDispatch"></el-button>
</div> </div>
<el-table <el-table
:data="dataList" :data="dataList"

@ -2,13 +2,37 @@
<div class="divBox"> <div class="divBox">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="业主类型"> <el-form-item label="业主类型">
<el-input v-model="dataForm.ownerType" placeholder="请输入业主类型" clearable></el-input> <el-select v-model="dataForm.ownerType" placeholder="请选择业主类型" clearable>
<el-option
v-for="dict in dict.type.owner_type"
:key="dict.value"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="报修单号"> <el-form-item label="报修单号">
<el-input v-model="dataForm.orderNo" placeholder="请输入报修单号" clearable></el-input> <el-input v-model="dataForm.orderNo" placeholder="请输入报修单号" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label="故障类型"> <el-form-item label="故障类型">
<el-input v-model="dataForm.faultType" placeholder="请输入故障类型" clearable></el-input> <el-select v-model="dataForm.faultType" placeholder="请选择故障类型" clearable>
<el-option
v-for="dict in dict.type.fault_type"
:key="dict.value"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="状态">
<el-select v-model="dataForm.status" placeholder="请选择状态" clearable>
<el-option
v-for="dict in dict.type.fault_status"
:key="dict.value"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="getDataList()"></el-button> <el-button @click="getDataList()"></el-button>
@ -124,6 +148,7 @@
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ '' }}</el-button> <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ '' }}</el-button>
<el-button v-if="scope.row.status !== '99'" type="text" size="small" @click="completeOrder(scope.row.id)">{{ '' }}</el-button>
<el-button v-hasPermi="['autogencode:pmmaintenanceorder:delete']" type="text" size="small" @click="deleteHandle(scope.row.id)" style="color: #f56c6c;"></el-button> <el-button v-hasPermi="['autogencode:pmmaintenanceorder:delete']" type="text" size="small" @click="deleteHandle(scope.row.id)" style="color: #f56c6c;"></el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -328,6 +353,28 @@ import DictTag from '@/components/DictTag'
}) })
}) })
}, },
//
completeOrder (id) {
this.$prompt('请输入办结备注', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPlaceholder: '请输入备注信息'
}).then(({ value }) => {
// API
api.pmmaintenanceorderUpdateStatusAndRemarkApi({
id: id,
status: '99', // 99
remark: value
}).then(res => {
this.$message.success('办结成功')
this.getDataList()
}).catch(() => {
this.$message.error('办结失败')
})
}).catch(() => {
this.$message.info('已取消办结')
})
},
} }
} }
</script> </script>

@ -34,7 +34,7 @@
@click="addOrUpdateHandle()">新增业主 @click="addOrUpdateHandle()">新增业主
</el-button> </el-button>
<el-button v-hasPermi="['autogencode:pmowner:delete']" type="danger" @click="deleteHandle()" <el-button v-hasPermi="['autogencode:pmowner:delete']" type="danger" @click="deleteHandle()"
:disabled="dataListSelections.length <= 0">批量 :disabled="dataListSelections.length <= 0">批量
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -75,7 +75,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ '' }}</el-button> <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ '' }}</el-button>
<el-button v-hasPermi="['autogencode:pmowner:delete']" type="text" size="small" <el-button v-hasPermi="['autogencode:pmowner:delete']" type="text" size="small"
@click="deleteHandle(scope.row.id)" style="color: #f56c6c;"> @click="deleteHandle(scope.row.id)" style="color: #f56c6c;">
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -207,31 +207,31 @@ export default {
this.$refs.addOrUpdate.init(id) this.$refs.addOrUpdate.init(id)
}) })
}, },
// //
deleteHandle(id) { deleteHandle(id) {
let ids = [] let ids = []
let idText = '' let idText = ''
// id // id
if (id) { if (id) {
ids = [id] ids = [id]
idText = id idText = id
} else { } else {
// //
ids = this.dataListSelections.map(item => { ids = this.dataListSelections.map(item => {
return item.id return item.id
}) })
idText = ids.join(',') idText = ids.join(',')
} }
this.$confirm(`确定进行除操作?`, '提示', { this.$confirm(`确定进行除操作?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// API // API
api.pmownerDeleteApi(ids).then(res => { api.pmownerDeleteApi(ids).then(res => {
this.$message.success('除成功') this.$message.success('除成功')
this.getDataList() this.getDataList()
}) })
}) })

@ -238,7 +238,7 @@ export default {
if (id) { if (id) {
pmHouseApi.pmhouseFreeApi([id]).then(() => { pmHouseApi.pmhouseFreeApi([id]).then(() => {
this.$message.success('删除成功') this.$message.success('删除成功')
this.rentRecords.splice(index, 1) this.getRentRecords() //
}).catch(() => { }).catch(() => {
this.$message.error('删除失败') this.$message.error('删除失败')
}) })

@ -1,8 +1,28 @@
<template> <template>
<div> <div>
<div style="margin-bottom: 10px;">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()" style="margin-bottom: 10px;">
<el-form-item label="楼栋编号">
<el-input v-model="dataForm.buildingNo" placeholder="请输入楼栋编号" clearable size="small"></el-input>
</el-form-item>
<el-form-item label="楼栋类型">
<el-select v-model="dataForm.buildingType" placeholder="请选择楼栋类型" clearable size="small">
<el-option
v-for="dict in dict.type.building_type"
:key="dict.value"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button size="small" @click="getDataList()"></el-button>
<el-button size="small" @click="resetForm()"></el-button>
<!-- <div style="margin-bottom: 10px;">-->
<el-button type="primary" size="small" @click="addBuilding"></el-button> <el-button type="primary" size="small" @click="addBuilding"></el-button>
</div> <!-- </div>-->
</el-form-item>
</el-form>
<el-table <el-table
:data="dataList" :data="dataList"
border border
@ -79,9 +99,6 @@
:append-to-body="true" :append-to-body="true"
:before-close="handleHouseDialogClose"> :before-close="handleHouseDialogClose">
<div> <div>
<div style="margin-bottom: 10px;">
<el-button type="primary" size="small" @click="addHouse"></el-button>
</div>
<el-form :inline="true" :model="houseSearchForm" @keyup.enter.native="getHouseDataList()" style="margin-bottom: 10px;"> <el-form :inline="true" :model="houseSearchForm" @keyup.enter.native="getHouseDataList()" style="margin-bottom: 10px;">
<el-form-item label="单元号"> <el-form-item label="单元号">
<el-input v-model="houseSearchForm.unitNo" placeholder="请输入单元号" clearable size="small"></el-input> <el-input v-model="houseSearchForm.unitNo" placeholder="请输入单元号" clearable size="small"></el-input>
@ -108,6 +125,7 @@
<el-form-item> <el-form-item>
<el-button size="small" @click="getHouseDataList()"></el-button> <el-button size="small" @click="getHouseDataList()"></el-button>
<el-button size="small" @click="resetHouseSearchForm()"></el-button> <el-button size="small" @click="resetHouseSearchForm()"></el-button>
<el-button type="primary" size="small" @click="addHouse"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table
@ -291,6 +309,11 @@
limit: this.pageSize, limit: this.pageSize,
projectId: this.projectId projectId: this.projectId
} }
//
if (this.dataForm.buildingNo) params.buildingNo = this.dataForm.buildingNo;
if (this.dataForm.buildingType) params.buildingType = this.dataForm.buildingType;
api.pmbuildingListApi(params).then(res => { api.pmbuildingListApi(params).then(res => {
this.dataListLoading = false this.dataListLoading = false
this.dataList = res.list || [] this.dataList = res.list || []
@ -303,6 +326,16 @@
this.dataListLoading = false this.dataListLoading = false
}) })
}, },
//
resetForm() {
this.dataForm = {
buildingNo: '',
buildingType: ''
}
this.pageIndex = 1
this.getDataList()
},
sizeChangeHandle (val) { sizeChangeHandle (val) {
this.pageSize = val this.pageSize = val
this.pageIndex = 1 this.pageIndex = 1

@ -15,10 +15,12 @@ import com.zbkj.common.response.CommonResult;
import com.zbkj.common.page.CommonPage; import com.zbkj.common.page.CommonPage;
import com.zbkj.common.exception.ExceptionCodeEnum; import com.zbkj.common.exception.ExceptionCodeEnum;
import com.zbkj.modules.autogencode.entity.*; import com.zbkj.modules.autogencode.entity.*;
import com.zbkj.modules.autogencode.entity.CkStockChange;
import com.zbkj.modules.autogencode.service.CkBillCargoService; import com.zbkj.modules.autogencode.service.CkBillCargoService;
import com.zbkj.modules.autogencode.service.CkBillStockService; import com.zbkj.modules.autogencode.service.CkBillStockService;
import com.zbkj.modules.autogencode.service.CkCargoStockService; import com.zbkj.modules.autogencode.service.CkCargoStockService;
import com.zbkj.modules.autogencode.service.CkBillCargoMenuRelService; import com.zbkj.modules.autogencode.service.CkBillCargoMenuRelService;
import com.zbkj.modules.autogencode.service.CkStockChangeService;
import com.zbkj.modules.autogencode.service.PmDailyMenuDtlService; import com.zbkj.modules.autogencode.service.PmDailyMenuDtlService;
import com.zbkj.modules.autogencode.service.PmDailyMenuService; import com.zbkj.modules.autogencode.service.PmDailyMenuService;
import com.zbkj.service.service.SystemAttachmentService; import com.zbkj.service.service.SystemAttachmentService;
@ -68,6 +70,9 @@ public class CkBillController {
@Autowired @Autowired
private PmDailyMenuService pmDailyMenuService; private PmDailyMenuService pmDailyMenuService;
@Autowired
private CkStockChangeService ckStockChangeService;
/** /**
* *
*/ */
@ -438,10 +443,30 @@ public class CkBillController {
*/ */
@RequestMapping(value = "/delete", method = RequestMethod.POST) @RequestMapping(value = "/delete", method = RequestMethod.POST)
public CommonResult<String> delete(@RequestBody Long[] ids){ public CommonResult<String> delete(@RequestBody Long[] ids){
if (ckBillService.removeByIds(Arrays.asList(ids))) { for (int i = 0; i < ids.length; i++) {
return CommonResult.success(); Long id = ids[i];
CkBill ckBill = ckBillService.getById(id);
if (ckBill.getBillStatus().equals("1")) {
return CommonResult.failed("此单据已经提交,不允许删除");
} }
return CommonResult.failed(); LambdaQueryWrapper<CkBillCargo> wrapper = new LambdaQueryWrapper<>();
wrapper.select(CkBillCargo::getId);
wrapper.eq(CkBillCargo::getBillId,id);
List<Object> list = ckBillCargoService.listObjs(wrapper);
ckBillCargoService.remove(wrapper);
// ckBillCargoService.removeBatchByIds(list);
//删除入库记录
ckStockChangeService.remove(new LambdaQueryWrapper<CkStockChange>().eq(CkStockChange::getBillId,id));
//单据明细下出入库信息
if (!list.isEmpty()) {
LambdaQueryWrapper<CkBillStock> stockWapper = new LambdaQueryWrapper<>();
stockWapper.in(CkBillStock::getBillCargoId,list);
ckBillStockService.remove(stockWapper);
}
ckBillService.removeById(id);
}
return CommonResult.success();
} }

@ -19,7 +19,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zbkj.modules.autogencode.entity.CmCustQualify; import com.zbkj.modules.autogencode.entity.CmCustQualify;
import com.zbkj.modules.autogencode.entity.CmCustQualifyFile;
import com.zbkj.modules.autogencode.service.CmCustQualifyService; import com.zbkj.modules.autogencode.service.CmCustQualifyService;
import com.zbkj.modules.autogencode.service.CmCustQualifyFileService;
@ -33,6 +35,9 @@ public class CmCustQualifyController {
@Autowired @Autowired
private CmCustQualifyService cmCustQualifyService; private CmCustQualifyService cmCustQualifyService;
@Autowired
private CmCustQualifyFileService cmCustQualifyFileService;
/** /**
@ -174,6 +179,17 @@ public class CmCustQualifyController {
*/ */
@RequestMapping(value = "/delete", method = RequestMethod.POST) @RequestMapping(value = "/delete", method = RequestMethod.POST)
public CommonResult<String> delete(@RequestBody Long[] ids){ public CommonResult<String> delete(@RequestBody Long[] ids){
// 检查是否有已经提交的资质文件
for (Long id : ids) {
LambdaQueryWrapper<CmCustQualifyFile> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CmCustQualifyFile::getQualifyId, id);
queryWrapper.eq(CmCustQualifyFile::getDelFlag, "0");
long count = cmCustQualifyFileService.count(queryWrapper);
if (count > 0) {
return CommonResult.failed("删除失败,该资质下存在已经提交的资质文件,请先删除这些文件");
}
}
if (cmCustQualifyService.removeByIds(Arrays.asList(ids))) { if (cmCustQualifyService.removeByIds(Arrays.asList(ids))) {
return CommonResult.success(); return CommonResult.success();
} }
@ -181,3 +197,7 @@ public class CmCustQualifyController {
} }
} }

@ -60,12 +60,12 @@ public class CmShelfController {
// 货架代码 // 货架代码
if (StrUtil.isNotBlank(request.getShelfCode())) { if (StrUtil.isNotBlank(request.getShelfCode())) {
queryWrapper.eq(CmShelf::getShelfCode, request.getShelfCode()); queryWrapper.like(CmShelf::getShelfCode, request.getShelfCode());
} }
// 货架名称 // 货架名称
if (StrUtil.isNotBlank(request.getShelfName())) { if (StrUtil.isNotBlank(request.getShelfName())) {
queryWrapper.eq(CmShelf::getShelfName, request.getShelfName()); queryWrapper.like(CmShelf::getShelfName, request.getShelfName());
} }
// 归属仓库ID // 归属仓库ID

@ -59,7 +59,7 @@ public class PmBuildingController {
// 楼栋编号 // 楼栋编号
if (StrUtil.isNotBlank(request.getBuildingNo())) { if (StrUtil.isNotBlank(request.getBuildingNo())) {
queryWrapper.eq(PmBuilding::getBuildingNo, request.getBuildingNo()); queryWrapper.like(PmBuilding::getBuildingNo, request.getBuildingNo());
} }
// 总层数 // 总层数

@ -673,6 +673,24 @@ public class PmCheckInController {
*/ */
@RequestMapping(value = "/delete", method = RequestMethod.POST) @RequestMapping(value = "/delete", method = RequestMethod.POST)
public CommonResult<String> delete(@RequestBody Long[] ids){ public CommonResult<String> delete(@RequestBody Long[] ids){
// 检查是否有对应的退房信息
List<PmCheckIn> checkInList = pmCheckInService.listByIds(Arrays.asList(ids));
List<Long> tenantHouseIds = new ArrayList<>();
for (PmCheckIn checkIn : checkInList) {
if (checkIn.getTenantHouseId() != null) {
tenantHouseIds.add(checkIn.getTenantHouseId());
}
}
if (!tenantHouseIds.isEmpty()) {
LambdaQueryWrapper<PmCheckOut> checkoutQuery = new LambdaQueryWrapper<>();
checkoutQuery.in(PmCheckOut::getTenantHouseId, tenantHouseIds);
long checkoutCount = pmCheckOutService.count(checkoutQuery);
if (checkoutCount > 0) {
return CommonResult.failed("删除失败,该入住记录下存在对应的退房信息,请先删除对应的退房信息");
}
}
if (pmCheckInService.removeByIds(Arrays.asList(ids))) { if (pmCheckInService.removeByIds(Arrays.asList(ids))) {
return CommonResult.success(); return CommonResult.success();
} }

@ -575,6 +575,7 @@ public class PmComplaintSuggestionController {
*/ */
@RequestMapping(value = "/delete", method = RequestMethod.POST) @RequestMapping(value = "/delete", method = RequestMethod.POST)
public CommonResult<String> delete(@RequestBody Long[] ids){ public CommonResult<String> delete(@RequestBody Long[] ids){
if (pmComplaintSuggestionService.removeByIds(Arrays.asList(ids))) { if (pmComplaintSuggestionService.removeByIds(Arrays.asList(ids))) {
return CommonResult.success(); return CommonResult.success();
} }

@ -1,13 +1,22 @@
package com.zbkj.modules.autogencode.controller; package com.zbkj.modules.autogencode.controller;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random;
import java.util.stream.Collectors;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zbkj.common.model.system.SysDept;
import com.zbkj.common.model.system.SystemAttachment;
import com.zbkj.common.model.user.User;
import com.zbkj.common.request.PageParamRequest; import com.zbkj.common.request.PageParamRequest;
import com.zbkj.common.response.CommonResult; import com.zbkj.common.response.CommonResult;
import com.zbkj.common.page.CommonPage; import com.zbkj.common.page.CommonPage;
import com.zbkj.service.service.SysDeptService;
import com.zbkj.service.service.SystemAttachmentService;
import com.zbkj.service.service.UserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -33,6 +42,15 @@ public class PmFacilityMaintenaceRecordController {
@Autowired @Autowired
private PmFacilityMaintenaceRecordService pmFacilityMaintenaceRecordService; private PmFacilityMaintenaceRecordService pmFacilityMaintenaceRecordService;
@Autowired
private SysDeptService sysDeptService;
@Autowired
private UserService userService;
@Autowired
private SystemAttachmentService systemAttachmentService;
/** /**
@ -91,6 +109,14 @@ public class PmFacilityMaintenaceRecordController {
queryWrapper.eq(PmFacilityMaintenaceRecord::getExecTime, request.getExecTime()); queryWrapper.eq(PmFacilityMaintenaceRecord::getExecTime, request.getExecTime());
} }
// 执行时间范围查询
if (request.getExecTimeStart() != null) {
queryWrapper.ge(PmFacilityMaintenaceRecord::getExecTime, request.getExecTimeStart());
}
if (request.getExecTimeEnd() != null) {
queryWrapper.le(PmFacilityMaintenaceRecord::getExecTime, request.getExecTimeEnd());
}
// 实际维保内容 // 实际维保内容
if (StrUtil.isNotBlank(request.getContent())) { if (StrUtil.isNotBlank(request.getContent())) {
queryWrapper.eq(PmFacilityMaintenaceRecord::getContent, request.getContent()); queryWrapper.eq(PmFacilityMaintenaceRecord::getContent, request.getContent());
@ -161,6 +187,18 @@ public class PmFacilityMaintenaceRecordController {
queryWrapper.eq(PmFacilityMaintenaceRecord::getTenantId, request.getTenantId()); queryWrapper.eq(PmFacilityMaintenaceRecord::getTenantId, request.getTenantId());
} }
// 执行人名称(虚拟字段,通过子查询关联用户表)
if (StrUtil.isNotBlank(request.getExecutorName())) {
queryWrapper.inSql(PmFacilityMaintenaceRecord::getExecutorId,
"select uid from eb_user where real_name like '%" + request.getExecutorName() + "%'");
}
// 执行部门名称(虚拟字段,通过子查询关联部门表)
if (StrUtil.isNotBlank(request.getExecutorDeptName())) {
queryWrapper.inSql(PmFacilityMaintenaceRecord::getExecutorDept,
"select dept_id from sys_dept where dept_name like '%" + request.getExecutorDeptName() + "%'");
}
} }
@ -177,7 +215,43 @@ public class PmFacilityMaintenaceRecordController {
// 应用搜索条件 // 应用搜索条件
condition(queryWrapper, request); condition(queryWrapper, request);
CommonPage<PmFacilityMaintenaceRecord> page = CommonPage.restPage(pmFacilityMaintenaceRecordService.pageList(queryWrapper, pageParamRequest));
List<PmFacilityMaintenaceRecord> pmFacilityMaintenaceRecords = pmFacilityMaintenaceRecordService.pageList(queryWrapper, pageParamRequest);
// 查询出用户表和部门表然后做成map之后为pmFacilityMaintenaceRecords赋值执行部门名称和执行人名称也就是虚拟字段
if (pmFacilityMaintenaceRecords != null && !pmFacilityMaintenaceRecords.isEmpty()) {
// 查询用户表做成map
LambdaQueryWrapper<User> userQueryWrapper = new LambdaQueryWrapper<>();
List<User> userList = userService.list(userQueryWrapper);
Map<Long, String> userMap = userList.stream()
.collect(Collectors.toMap(
user -> Long.valueOf(user.getUid()),
User::getRealName,
(existing, replacement) -> existing
));
// 查询部门表做成map
LambdaQueryWrapper<SysDept> deptQueryWrapper = new LambdaQueryWrapper<>();
List<SysDept> deptList = sysDeptService.list(deptQueryWrapper);
Map<Long, String> deptMap = deptList.stream()
.collect(Collectors.toMap(
SysDept::getDeptId,
SysDept::getDeptName,
(existing, replacement) -> existing
));
// 为pmFacilityMaintenaceRecords赋值执行部门名称和执行人名称
for (PmFacilityMaintenaceRecord record : pmFacilityMaintenaceRecords) {
if (userMap != null && record.getExecutorId() != null) {
record.setExecutorName(userMap.get(record.getExecutorId()));
}
if (deptMap != null && record.getExecutorDept() != null) {
record.setExecutorDeptName(deptMap.get(record.getExecutorDept()));
}
}
}
CommonPage<PmFacilityMaintenaceRecord> page = CommonPage.restPage(pmFacilityMaintenaceRecords);
return CommonResult.success(page); return CommonResult.success(page);
} }
@ -189,6 +263,9 @@ public class PmFacilityMaintenaceRecordController {
public CommonResult<PmFacilityMaintenaceRecord> info(@PathVariable("id") Long id){ public CommonResult<PmFacilityMaintenaceRecord> info(@PathVariable("id") Long id){
PmFacilityMaintenaceRecord pmFacilityMaintenaceRecord = pmFacilityMaintenaceRecordService.getById(id); PmFacilityMaintenaceRecord pmFacilityMaintenaceRecord = pmFacilityMaintenaceRecordService.getById(id);
// 设置文件列表
setFile(pmFacilityMaintenaceRecord);
return CommonResult.success(pmFacilityMaintenaceRecord); return CommonResult.success(pmFacilityMaintenaceRecord);
} }
@ -197,6 +274,11 @@ public class PmFacilityMaintenaceRecordController {
*/ */
@RequestMapping(value = "/save", method = RequestMethod.POST) @RequestMapping(value = "/save", method = RequestMethod.POST)
public CommonResult<String> save(@RequestBody PmFacilityMaintenaceRecord pmFacilityMaintenaceRecord){ public CommonResult<String> save(@RequestBody PmFacilityMaintenaceRecord pmFacilityMaintenaceRecord){
// 处理文件保存
if (pmFacilityMaintenaceRecord.getFiles() != null) {
updateFile(pmFacilityMaintenaceRecord);
}
if (pmFacilityMaintenaceRecordService.save(pmFacilityMaintenaceRecord)) { if (pmFacilityMaintenaceRecordService.save(pmFacilityMaintenaceRecord)) {
return CommonResult.success(); return CommonResult.success();
} }
@ -208,12 +290,44 @@ public class PmFacilityMaintenaceRecordController {
*/ */
@RequestMapping(value = "/update", method = RequestMethod.POST) @RequestMapping(value = "/update", method = RequestMethod.POST)
public CommonResult<String> update(@RequestBody PmFacilityMaintenaceRecord pmFacilityMaintenaceRecord){ public CommonResult<String> update(@RequestBody PmFacilityMaintenaceRecord pmFacilityMaintenaceRecord){
// 处理文件保存
if (pmFacilityMaintenaceRecord.getFiles() != null) {
updateFile(pmFacilityMaintenaceRecord);
}
if (pmFacilityMaintenaceRecordService.updateById(pmFacilityMaintenaceRecord)) { if (pmFacilityMaintenaceRecordService.updateById(pmFacilityMaintenaceRecord)) {
return CommonResult.success(); return CommonResult.success();
} }
return CommonResult.failed(); return CommonResult.failed();
} }
/**
*
*/
private void updateFile(PmFacilityMaintenaceRecord pmFacilityMaintenaceRecord) {
Long newId = System.currentTimeMillis() + new Random().nextInt(1000);
List<SystemAttachment> files = pmFacilityMaintenaceRecord.getFiles();
if (files != null && !files.isEmpty()) {
for (SystemAttachment attachment : files) {
attachment.setFileId(String.valueOf(newId));
}
systemAttachmentService.updateBatchById(files);
pmFacilityMaintenaceRecord.setFileId(newId);
}
}
/**
*
*/
private void setFile(PmFacilityMaintenaceRecord pmFacilityMaintenaceRecord) {
Long fileId = pmFacilityMaintenaceRecord.getFileId();
if (fileId != null) {
List<SystemAttachment> list = systemAttachmentService.list(new LambdaQueryWrapper<SystemAttachment>()
.eq(SystemAttachment::getFileId, fileId));
pmFacilityMaintenaceRecord.setFiles(list);
}
}
/** /**
* :id * :id
*/ */

@ -353,27 +353,36 @@ public class PmHouseController {
} }
pmHouseService.updateBatchById(list); pmHouseService.updateBatchById(list);
// 对应的PmTenantHouse ,还有 PmOwnerHouseRel 删除掉 // 对应的PmOwnerHouseRel 删除掉
// 查询与这些房屋相关的PmOwnerHouseRel记录 // 查询与这些房屋相关的PmOwnerHouseRel记录
List<PmOwnerHouseRel> rels = pmOwnerHouseRelService.list(new LambdaQueryWrapper<PmOwnerHouseRel>() List<PmOwnerHouseRel> rels = pmOwnerHouseRelService.list(new LambdaQueryWrapper<PmOwnerHouseRel>()
.in(PmOwnerHouseRel::getHouseId, ids)); .in(PmOwnerHouseRel::getHouseId, ids));
if (rels != null && !rels.isEmpty()) { if (rels != null && !rels.isEmpty()) {
// 获取所有关联的tenantHouseId
List<Long> tenantHouseIds = rels.stream()
.map(PmOwnerHouseRel::getTenantHouseId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
// 删除PmOwnerHouseRel记录 // 删除PmOwnerHouseRel记录
pmOwnerHouseRelService.removeByIds(rels.stream() pmOwnerHouseRelService.removeByIds(rels.stream()
.map(PmOwnerHouseRel::getId) .map(PmOwnerHouseRel::getId)
.filter(Objects::nonNull) .filter(Objects::nonNull)
.collect(Collectors.toList())); .collect(Collectors.toList()));
// 删除对应的PmTenantHouse记录 // 检查每个tenantHouseId是否还有其他关联的PmOwnerHouseRel记录
if (!tenantHouseIds.isEmpty()) { // 如果没有则删除对应的PmTenantHouse记录
pmTenantHouseService.removeByIds(tenantHouseIds); List<Long> tenantHouseIds = rels.stream()
.map(PmOwnerHouseRel::getTenantHouseId)
.filter(Objects::nonNull)
.distinct()
.collect(Collectors.toList());
for (Long tenantHouseId : tenantHouseIds) {
// 查询该tenantHouseId是否还有其他关联的PmOwnerHouseRel记录
int count = pmOwnerHouseRelService.count(new LambdaQueryWrapper<PmOwnerHouseRel>()
.eq(PmOwnerHouseRel::getTenantHouseId, tenantHouseId)
.eq(PmOwnerHouseRel::getDelFlag, "0"));
// 如果没有其他关联记录则删除PmTenantHouse记录
if (count == 0) {
pmTenantHouseService.removeById(tenantHouseId);
}
} }
} }

@ -4,6 +4,8 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.ArrayList;
import java.util.HashMap;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -196,23 +198,71 @@ public class PmMaintenanceOrderController {
CommonPage<PmMaintenanceOrder> page = CommonPage.restPage(pmMaintenanceOrderService.pageList(queryWrapper, pageParamRequest)); CommonPage<PmMaintenanceOrder> page = CommonPage.restPage(pmMaintenanceOrderService.pageList(queryWrapper, pageParamRequest));
// 翻译业主名称和房屋名称 // 收集所有需要查询的ID
List<Long> ownerIds = new ArrayList<>();
List<Long> tenantIds = new ArrayList<>();
List<Long> houseIds = new ArrayList<>();
for (PmMaintenanceOrder item : page.getList()) {
// 收集业主/租户ID
if (item.getOwnerId() != null) {
if ("1".equals(item.getOwnerType())) {
ownerIds.add(item.getOwnerId());
} else if ("2".equals(item.getOwnerType())) {
tenantIds.add(item.getOwnerId());
}
}
// 收集房屋ID
if (item.getHouseId() != null) {
houseIds.add(item.getHouseId());
}
}
// 批量查询并构建map
Map<Long, PmOwner> ownerMap = new HashMap<>();
if (!ownerIds.isEmpty()) {
List<PmOwner> owners = pmOwnerService.listByIds(ownerIds);
for (PmOwner owner : owners) {
ownerMap.put(owner.getId(), owner);
}
}
Map<Long, PmTenant> tenantMap = new HashMap<>();
if (!tenantIds.isEmpty()) {
List<PmTenant> tenants = pmTenantService.listByIds(tenantIds);
for (PmTenant tenant : tenants) {
tenantMap.put(tenant.getId(), tenant);
}
}
Map<Long, PmHouse> houseMap = new HashMap<>();
if (!houseIds.isEmpty()) {
List<PmHouse> houses = pmHouseService.listByIds(houseIds);
for (PmHouse house : houses) {
houseMap.put(house.getId(), house);
}
}
// 翻译业主名称、房屋名称并设置文件信息
for (PmMaintenanceOrder item : page.getList()) { for (PmMaintenanceOrder item : page.getList()) {
// 设置文件信息
setFile(item);
// 翻译业主名称 // 翻译业主名称
if (item.getOwnerId() != null) { if (item.getOwnerId() != null) {
if ("1".equals(item.getOwnerType())) { if ("1".equals(item.getOwnerType())) {
PmOwner owner = pmOwnerService.getById(item.getOwnerId()); PmOwner owner = ownerMap.get(item.getOwnerId());
item.setOwnerName(owner != null ? owner.getOwnerName() : ""); item.setOwnerName(owner != null ? owner.getOwnerName() : "");
} else if ("2".equals(item.getOwnerType())) { } else if ("2".equals(item.getOwnerType())) {
PmTenant tenant = pmTenantService.getById(item.getOwnerId()); PmTenant tenant = tenantMap.get(item.getOwnerId());
item.setOwnerName(tenant != null ? tenant.getTenantName() : ""); item.setOwnerName(tenant != null ? tenant.getTenantName() : "");
} }
} }
// 翻译房屋名称 // 翻译房屋名称
if (item.getHouseId() != null) { if (item.getHouseId() != null) {
PmHouse house = pmHouseService.getById(item.getHouseId()); PmHouse house = houseMap.get(item.getHouseId());
if (house != null) { if (house != null) {
StringBuilder houseName = new StringBuilder(); StringBuilder houseName = new StringBuilder();
if (house.getUnitNo() != null) { if (house.getUnitNo() != null) {
@ -404,6 +454,46 @@ public class PmMaintenanceOrderController {
} }
} }
/**
*
*/
@RequestMapping(value = "/updateStatusAndRemark", method = RequestMethod.POST)
public CommonResult<String> updateStatusAndRemark(@RequestBody Map<String, Object> params) {
Long id = null;
Object idObj = params.get("id");
if (idObj != null) {
if (idObj instanceof Number) {
id = ((Number) idObj).longValue();
} else if (idObj instanceof String) {
try {
id = Long.parseLong((String) idObj);
} catch (NumberFormatException e) {
return CommonResult.failed("订单ID格式错误");
}
}
}
String status = (String) params.get("status");
String remark = (String) params.get("remark");
if (id == null) {
return CommonResult.failed("订单ID不能为空");
}
PmMaintenanceOrder pmMaintenanceOrder = pmMaintenanceOrderService.getById(id);
if (pmMaintenanceOrder == null) {
return CommonResult.failed("订单不存在");
}
// 只修改状态和备注
pmMaintenanceOrder.setStatus(status);
pmMaintenanceOrder.setRemark(remark);
if (pmMaintenanceOrderService.updateById(pmMaintenanceOrder)) {
return CommonResult.success();
}
return CommonResult.failed();
}
/** /**
* :id * :id
*/ */

@ -3,6 +3,7 @@ package com.zbkj.modules.autogencode.controller;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.ArrayList;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
@ -290,7 +291,20 @@ public class PmTenantController {
return CommonResult.failed("删除失败,该租户下存在关联的员工,请先处理相关员工"); return CommonResult.failed("删除失败,该租户下存在关联的员工,请先处理相关员工");
} }
// 获取租户对应的部门ID
List<Long> deptIds = new ArrayList<>();
List<PmTenant> tenants = pmTenantService.listByIds(Arrays.asList(ids));
for (PmTenant tenant : tenants) {
if (tenant.getDeptId() != null) {
deptIds.add(tenant.getDeptId());
}
}
if (pmTenantService.removeByIds(Arrays.asList(ids))) { if (pmTenantService.removeByIds(Arrays.asList(ids))) {
// 删除对应的SysDept
if (!deptIds.isEmpty()) {
sysDeptService.removeByIds(deptIds);
}
return CommonResult.success(); return CommonResult.success();
} }
return CommonResult.failed(); return CommonResult.failed();

@ -3,6 +3,8 @@ package com.zbkj.modules.autogencode.entity;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
@ -20,6 +22,7 @@ public class PmComplaintSuggestion implements Serializable {
*/ */
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
@TableId @TableId
@JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;
/** /**
* *

@ -1,14 +1,17 @@
package com.zbkj.modules.autogencode.entity; package com.zbkj.modules.autogencode.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.zbkj.common.model.system.SystemAttachment;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
import lombok.Data; import lombok.Data;
@ -134,5 +137,35 @@ public class PmFacilityMaintenaceRecord implements Serializable {
*/ */
@ApiModelProperty(value = "租户ID") @ApiModelProperty(value = "租户ID")
private String tenantId; private String tenantId;
/**
*
*/
@ApiModelProperty(value = "执行人名称")
@TableField(exist = false)
private String executorName;
/**
*
*/
@ApiModelProperty(value = "执行部门名称")
@TableField(exist = false)
private String executorDeptName;
/**
*
*/
@ApiModelProperty(value = "执行时间开始")
@TableField(exist = false)
private String execTimeStart;
/**
*
*/
@ApiModelProperty(value = "执行时间结束")
@TableField(exist = false)
private String execTimeEnd;
/**
*
*/
@ApiModelProperty(value = "附件列表")
@TableField(exist = false)
private List<SystemAttachment> files;
} }

@ -4,8 +4,9 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.Data; import lombok.Data;

@ -1,3 +1,11 @@
/*
* @Author: zxf 1532322479@qq.com
* @Date: 2025-06-21 12:18:44
* @LastEditors: zxf 1532322479@qq.com
* @LastEditTime: 2026-03-21 15:39:21
* @FilePath: \crmebTwo\crmeb\crmeb-front\src\main\java\com\zbkj\front\config\JacksonConfig.java
* @Description: ,`customMade`, koroFileHeader : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
package com.zbkj.front.config; package com.zbkj.front.config;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;

Loading…
Cancel
Save