|
|
|
|
@ -21,7 +21,7 @@
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item :label="dataForm.ownerType === '1' ? '业主/租户' : '业主/租户'" prop="ownerId">
|
|
|
|
|
<el-form-item :label="dataForm.ownerType === '1' ? '名称' : '名称'" prop="ownerId">
|
|
|
|
|
<el-select v-if="dataForm.ownerType === '1'" v-model="dataForm.ownerId" placeholder="请选择业主" clearable
|
|
|
|
|
style="width: 100%" @change="handleOwnerChange" filterable>
|
|
|
|
|
<el-option
|
|
|
|
|
@ -104,7 +104,7 @@
|
|
|
|
|
<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%" filterable>
|
|
|
|
|
<el-select v-model="dataForm.status" placeholder="选择状态" clearable style="width: 100%" filterable disabled>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in dict.type.fault_status"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
@ -119,13 +119,26 @@
|
|
|
|
|
<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">
|
|
|
|
|
<el-form-item label="故障照片" prop="faultPhoto" :disabled="!canUploadFaultPhoto">
|
|
|
|
|
<FileUploadVO
|
|
|
|
|
:value="faultPhotoFiles"
|
|
|
|
|
@input="updateFaultPhotoFiles"
|
|
|
|
|
:disabled="!canUploadFaultPhoto"
|
|
|
|
|
></FileUploadVO>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<!-- 处理后文件(修复凭证) -->
|
|
|
|
|
<el-row :gutter="20" v-if="showAfterProcess">
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="修复凭证" prop="afterProcessFiles" :disabled="!canUploadAfterProcess">
|
|
|
|
|
<FileUploadVO
|
|
|
|
|
:value="afterProcessFiles"
|
|
|
|
|
@input="updateAfterProcessFiles"
|
|
|
|
|
:disabled="!canUploadAfterProcess"
|
|
|
|
|
></FileUploadVO>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
@ -224,9 +237,13 @@ export default {
|
|
|
|
|
ownerList: [],
|
|
|
|
|
tenantList: [],
|
|
|
|
|
houseList: [],
|
|
|
|
|
ownerHouseList: [], // 所选业主/租户的房屋列表
|
|
|
|
|
ownerHouseList: [], // 所选名称的房屋列表
|
|
|
|
|
faultPhotoFiles: [], // 故障照片文件列表
|
|
|
|
|
afterProcessFiles: [], // 修复凭证文件列表
|
|
|
|
|
dispatchRecords: [], // 报修派单记录列表
|
|
|
|
|
canUploadFaultPhoto: true, // 是否可以上传故障照片
|
|
|
|
|
canUploadAfterProcess: false, // 是否可以上传修复凭证
|
|
|
|
|
showAfterProcess: false, // 是否显示修复凭证上传组件
|
|
|
|
|
dataForm: {
|
|
|
|
|
ownerType: '',
|
|
|
|
|
ownerId: '',
|
|
|
|
|
@ -239,9 +256,10 @@ export default {
|
|
|
|
|
reportChannel: '',
|
|
|
|
|
reportTime: '',
|
|
|
|
|
urgencyLevel: '',
|
|
|
|
|
status: '',
|
|
|
|
|
status: '0',
|
|
|
|
|
remark: '',
|
|
|
|
|
files: []
|
|
|
|
|
files: [], // 故障照片文件
|
|
|
|
|
afterProcessFiles: [] // 修复凭证文件
|
|
|
|
|
},
|
|
|
|
|
dataRule: {
|
|
|
|
|
ownerType: [
|
|
|
|
|
@ -289,7 +307,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
// 处理业主类型变化
|
|
|
|
|
handleOwnerTypeChange(ownerType) {
|
|
|
|
|
// 清空业主/租户ID和房屋ID
|
|
|
|
|
// 清空名称ID和房屋ID
|
|
|
|
|
this.dataForm.ownerId = ''
|
|
|
|
|
this.dataForm.houseId = ''
|
|
|
|
|
this.dataForm.houseOwnerId = ''
|
|
|
|
|
@ -384,6 +402,26 @@ export default {
|
|
|
|
|
this.dataForm.houseOwnerId = ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 设置文件上传权限
|
|
|
|
|
setFileUploadPermissions(status) {
|
|
|
|
|
switch (status) {
|
|
|
|
|
case '0': // 待处理
|
|
|
|
|
case '1': // 处理中
|
|
|
|
|
this.canUploadFaultPhoto = true;
|
|
|
|
|
this.canUploadAfterProcess = false;
|
|
|
|
|
this.showAfterProcess = false;
|
|
|
|
|
break;
|
|
|
|
|
case '99': // 已办结
|
|
|
|
|
this.canUploadFaultPhoto = false;
|
|
|
|
|
this.canUploadAfterProcess = true;
|
|
|
|
|
this.showAfterProcess = true;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
this.canUploadFaultPhoto = true;
|
|
|
|
|
this.canUploadAfterProcess = false;
|
|
|
|
|
this.showAfterProcess = false;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 更新故障照片文件列表
|
|
|
|
|
updateFaultPhotoFiles(files) {
|
|
|
|
|
this.faultPhotoFiles = files
|
|
|
|
|
@ -406,7 +444,7 @@ export default {
|
|
|
|
|
name: file.name || file.oldName || '', // 附件名称
|
|
|
|
|
attDir: attDir, // 附件路径
|
|
|
|
|
attSize: file.attSize || '', // 附件大小
|
|
|
|
|
attType: file.attType || '', // 附件类型
|
|
|
|
|
attType: 'fault_photo', // 故障照片类型
|
|
|
|
|
// 保留原有字段以保持兼容性
|
|
|
|
|
fileName: file.name || file.oldName || '',
|
|
|
|
|
filePath: attDir,
|
|
|
|
|
@ -430,6 +468,52 @@ export default {
|
|
|
|
|
this.dataForm.files = []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 更新修复凭证文件列表
|
|
|
|
|
updateAfterProcessFiles(files) {
|
|
|
|
|
this.afterProcessFiles = files
|
|
|
|
|
// 将文件保存到dataForm.afterProcessFiles中
|
|
|
|
|
if (files && files.length > 0) {
|
|
|
|
|
// 将FileUploadVO返回的文件格式转换为后端SystemAttachment需要的格式
|
|
|
|
|
this.dataForm.afterProcessFiles = 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: 'repair_photo', // 修复凭证类型
|
|
|
|
|
// 保留原有字段以保持兼容性
|
|
|
|
|
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.afterProcessFiles = []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
init(id) { // 初始化表单验证规则
|
|
|
|
|
this.dataForm.id = id || 0
|
|
|
|
|
this.visible = true
|
|
|
|
|
@ -488,40 +572,57 @@ export default {
|
|
|
|
|
// 重新设置房屋ID
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
// 先设置所有表单字段,确保即使详情中没有的字段也能正确设置
|
|
|
|
|
this.dataForm = {
|
|
|
|
|
...this.dataForm,
|
|
|
|
|
id: orderDetail.id,
|
|
|
|
|
ownerType: orderDetail.ownerType || '',
|
|
|
|
|
ownerId: orderDetail.ownerId || '',
|
|
|
|
|
houseId: houseId,
|
|
|
|
|
houseOwnerId: orderDetail.houseOwnerId || '',
|
|
|
|
|
orderNo: orderDetail.orderNo || '',
|
|
|
|
|
faultType: orderDetail.faultType || '',
|
|
|
|
|
faultDesc: orderDetail.faultDesc || '',
|
|
|
|
|
faultPhoto: orderDetail.faultPhoto || null,
|
|
|
|
|
reportChannel: orderDetail.reportChannel || '',
|
|
|
|
|
reportTime: orderDetail.reportTime || '',
|
|
|
|
|
urgencyLevel: orderDetail.urgencyLevel || '',
|
|
|
|
|
status: orderDetail.status || '',
|
|
|
|
|
remark: orderDetail.remark || '',
|
|
|
|
|
files: orderDetail.files || []
|
|
|
|
|
};
|
|
|
|
|
// 触发房屋选择变化,设置房屋业主ID
|
|
|
|
|
this.handleHouseChange(houseId);
|
|
|
|
|
// 处理故障照片文件列表
|
|
|
|
|
if (orderDetail.files && orderDetail.files.length > 0) {
|
|
|
|
|
// 转换files为FileUploadVO需要的格式
|
|
|
|
|
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.dataForm = {
|
|
|
|
|
...this.dataForm,
|
|
|
|
|
id: orderDetail.id,
|
|
|
|
|
ownerType: orderDetail.ownerType || '',
|
|
|
|
|
ownerId: orderDetail.ownerId || '',
|
|
|
|
|
houseId: houseId,
|
|
|
|
|
houseOwnerId: orderDetail.houseOwnerId || '',
|
|
|
|
|
orderNo: orderDetail.orderNo || '',
|
|
|
|
|
faultType: orderDetail.faultType || '',
|
|
|
|
|
faultDesc: orderDetail.faultDesc || '',
|
|
|
|
|
faultPhoto: orderDetail.faultPhoto || null,
|
|
|
|
|
reportChannel: orderDetail.reportChannel || '',
|
|
|
|
|
reportTime: orderDetail.reportTime || '',
|
|
|
|
|
urgencyLevel: orderDetail.urgencyLevel || '',
|
|
|
|
|
status: orderDetail.status || '',
|
|
|
|
|
remark: orderDetail.remark || '',
|
|
|
|
|
files: orderDetail.files || [],
|
|
|
|
|
afterProcessFiles: orderDetail.afterProcessFiles || []
|
|
|
|
|
};
|
|
|
|
|
// 触发房屋选择变化,设置房屋业主ID
|
|
|
|
|
this.handleHouseChange(houseId);
|
|
|
|
|
// 设置文件上传权限
|
|
|
|
|
this.setFileUploadPermissions(orderDetail.status || '0');
|
|
|
|
|
// 处理故障照片文件列表
|
|
|
|
|
if (orderDetail.files && orderDetail.files.length > 0) {
|
|
|
|
|
// 转换files为FileUploadVO需要的格式
|
|
|
|
|
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 = []
|
|
|
|
|
}
|
|
|
|
|
// 处理修复凭证文件列表
|
|
|
|
|
if (orderDetail.afterProcessFiles && orderDetail.afterProcessFiles.length > 0) {
|
|
|
|
|
// 转换afterProcessFiles为FileUploadVO需要的格式
|
|
|
|
|
this.afterProcessFiles = orderDetail.afterProcessFiles.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.afterProcessFiles = []
|
|
|
|
|
}
|
|
|
|
|
// 获取该订单的报修派单记录
|
|
|
|
|
this.getDispatchRecords()
|
|
|
|
|
});
|
|
|
|
|
@ -530,9 +631,13 @@ export default {
|
|
|
|
|
});
|
|
|
|
|
}.bind(this))
|
|
|
|
|
} else {
|
|
|
|
|
// 新增时清空故障照片文件列表
|
|
|
|
|
// 新增时设置默认文件上传权限
|
|
|
|
|
this.setFileUploadPermissions('0'); // 默认为待处理状态
|
|
|
|
|
// 新增时清空故障照片和修复照片文件列表
|
|
|
|
|
this.faultPhotoFiles = []
|
|
|
|
|
this.afterProcessFiles = []
|
|
|
|
|
this.dataForm.files = []
|
|
|
|
|
this.dataForm.afterProcessFiles = []
|
|
|
|
|
// 新增时清空报修派单记录
|
|
|
|
|
this.dispatchRecords = []
|
|
|
|
|
// 新增时设置默认报修时间为当前时间
|
|
|
|
|
|