fix bug
This commit is contained in:
parent
73e6245496
commit
4253e4506d
@ -109,5 +109,8 @@ public class TaskReportRespVO {
|
|||||||
@Schema(description = "报工状态")
|
@Schema(description = "报工状态")
|
||||||
private String reportProcess;
|
private String reportProcess;
|
||||||
|
|
||||||
|
private String procedureStatus;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,6 +98,9 @@ public class TaskReportDO extends BaseDO {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String procedureName;
|
private String procedureName;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String procedureStatus;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String updaterName;
|
private String updaterName;
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ public interface TaskReportMapper extends BaseMapperX<TaskReportDO> {
|
|||||||
query.selectAll(TaskReportDO.class)
|
query.selectAll(TaskReportDO.class)
|
||||||
.select("d.code as projectCode", "d.project_name as projectName", "c.name as projectSubName")
|
.select("d.code as projectCode", "d.project_name as projectName", "c.name as projectSubName")
|
||||||
.select("z.code as dispatchCode")
|
.select("z.code as dispatchCode")
|
||||||
.select("x.report_process as reportProcess")
|
.select("x.report_process as reportProcess","x.procedure_status as procedureStatus")
|
||||||
.select("f.material_name as materialName", "f.spec", "f.unit")
|
.select("f.material_name as materialName", "f.spec", "f.unit")
|
||||||
.select("y.name as procedureName")
|
.select("y.name as procedureName")
|
||||||
.select("u1.nickname as ownerName", "u2.nickname as updaterName")
|
.select("u1.nickname as ownerName", "u2.nickname as updaterName")
|
||||||
|
|||||||
@ -59,7 +59,7 @@
|
|||||||
<el-button type="primary" size="large" @click="userAddItem">新增</el-button>
|
<el-button type="primary" size="large" @click="userAddItem">新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-form ref="subFormRef" :model="formData.userList" label-width="0">
|
<el-form ref="subFormRef" :model="formData.userList" label-width="0">
|
||||||
<el-table :data="formData.userList" class="hl-table">
|
<el-table :data="formData.userList" class="hl-table" :cell-class-name="cellClassName">
|
||||||
<el-table-column type="index" label="序号" align="center" min-width="60" fixed />
|
<el-table-column type="index" label="序号" align="center" min-width="60" fixed />
|
||||||
<el-table-column prop="description" min-width="200" label="业务人员" align="center">
|
<el-table-column prop="description" min-width="200" label="业务人员" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@ -234,6 +234,11 @@ const closeForm = async () => {
|
|||||||
const handleUserSelection = (userId: number, currentRow: any, currentIndex: number) => {
|
const handleUserSelection = (userId: number, currentRow: any, currentIndex: number) => {
|
||||||
if (!userId) return // 如果清空选择,则无需验证
|
if (!userId) return // 如果清空选择,则无需验证
|
||||||
|
|
||||||
|
// 先清除所有标记
|
||||||
|
formData.value.userList.forEach(user => {
|
||||||
|
user.duplicate = false
|
||||||
|
})
|
||||||
|
|
||||||
// 检查同一用户是否已在相同岗位被选择
|
// 检查同一用户是否已在相同岗位被选择
|
||||||
const duplicateIndex = formData.value.userList.findIndex(
|
const duplicateIndex = formData.value.userList.findIndex(
|
||||||
(user, index) =>
|
(user, index) =>
|
||||||
@ -243,10 +248,11 @@ const handleUserSelection = (userId: number, currentRow: any, currentIndex: numb
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (duplicateIndex !== -1) {
|
if (duplicateIndex !== -1) {
|
||||||
message.error("该用户已在相同岗位被选择,请选择其他用户或岗位")
|
// 标记之前已选择的重复行,业务人员和岗位列都变色
|
||||||
currentRow.busyId = '' // 恢复选择
|
formData.value.userList[duplicateIndex].duplicate = true
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
// 强制更新视图
|
||||||
|
formData.value.userList = [...formData.value.userList]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -254,6 +260,11 @@ const handleUserSelection = (userId: number, currentRow: any, currentIndex: numb
|
|||||||
const handlePostSelection = (postId: number, currentRow: any, currentIndex: number) => {
|
const handlePostSelection = (postId: number, currentRow: any, currentIndex: number) => {
|
||||||
if (!postId || !currentRow.busyId) return // 如果没有选择岗位或用户,则无需验证
|
if (!postId || !currentRow.busyId) return // 如果没有选择岗位或用户,则无需验证
|
||||||
|
|
||||||
|
// 先清除所有标记
|
||||||
|
formData.value.userList.forEach(user => {
|
||||||
|
user.duplicate = false
|
||||||
|
})
|
||||||
|
|
||||||
// 检查同一用户是否已在相同岗位被选择
|
// 检查同一用户是否已在相同岗位被选择
|
||||||
const duplicateIndex = formData.value.userList.findIndex(
|
const duplicateIndex = formData.value.userList.findIndex(
|
||||||
(user, index) =>
|
(user, index) =>
|
||||||
@ -263,10 +274,11 @@ const handlePostSelection = (postId: number, currentRow: any, currentIndex: numb
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (duplicateIndex !== -1) {
|
if (duplicateIndex !== -1) {
|
||||||
message.error("该用户已在相同岗位被选择,请选择其他岗位或用户")
|
// 标记之前已选择的重复行,业务人员和岗位列都变色
|
||||||
currentRow.postId = '' // 恢复选择
|
formData.value.userList[duplicateIndex].duplicate = true
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
// 强制更新视图
|
||||||
|
formData.value.userList = [...formData.value.userList]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -317,6 +329,13 @@ const submitForm = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cellClassName = ({ row,column }) => {
|
||||||
|
// 重复时,业务人员列和岗位列都改变背景色
|
||||||
|
if ((column.label === '业务人员') && row.duplicate) {
|
||||||
|
return 'warning-row1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 重置表单 */
|
/** 重置表单 */
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
@ -339,3 +358,9 @@ watch(() => formData.value.postId, (newValue) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
:deep(.warning-row1) {
|
||||||
|
background-color: #b90d35 !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|||||||
@ -535,10 +535,12 @@ const floatMul = (a, b) => {
|
|||||||
return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c);
|
return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c);
|
||||||
}
|
}
|
||||||
const changeUnitPrice =(row:any)=>{
|
const changeUnitPrice =(row:any)=>{
|
||||||
|
extracted(row);
|
||||||
row.estimatedPrices=parseFloat((row.unitPrice* row.purchaseAmounts).toFixed(1))
|
row.estimatedPrices=parseFloat((row.unitPrice* row.purchaseAmounts).toFixed(1))
|
||||||
|
|
||||||
}
|
}
|
||||||
const changeEstimatedPrices =(row:any)=>{
|
const changeEstimatedPrices =(row:any)=>{
|
||||||
|
extracted(row);
|
||||||
row.unitPrice=parseFloat((row.estimatedPrices/row.purchaseAmounts).toFixed(1))
|
row.unitPrice=parseFloat((row.estimatedPrices/row.purchaseAmounts).toFixed(1))
|
||||||
}
|
}
|
||||||
const change1 =(row:any)=>{
|
const change1 =(row:any)=>{
|
||||||
@ -591,8 +593,7 @@ const updateCheckboxEnableState = (selectedRows) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 供应商选择时自动勾选当前行
|
// 供应商选择时自动勾选当前行
|
||||||
// 供应商选择时自动勾选当前行
|
function extracted(row) {
|
||||||
const onSupplierChange = (row) => {
|
|
||||||
// 如果当前行未被选中,则自动选中它
|
// 如果当前行未被选中,则自动选中它
|
||||||
if (!row.chkboxEnable) {
|
if (!row.chkboxEnable) {
|
||||||
// 获取表格实例并确保其存在后再执行选择操作
|
// 获取表格实例并确保其存在后再执行选择操作
|
||||||
@ -600,6 +601,11 @@ const onSupplierChange = (row) => {
|
|||||||
multipleTable.value.toggleRowSelection(row, true);
|
multipleTable.value.toggleRowSelection(row, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 供应商选择时自动勾选当前行
|
||||||
|
const onSupplierChange = (row) => {
|
||||||
|
// extracted(row);
|
||||||
// 触发原有的 change 逻辑
|
// 触发原有的 change 逻辑
|
||||||
change(row);
|
change(row);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -111,9 +111,9 @@
|
|||||||
|
|
||||||
<el-table-column label="报工进度" align="center" prop="reportProcess" width="160">
|
<el-table-column label="报工进度" align="center" prop="reportProcess" width="160">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag v-if="scope.row.reportProcess === '1'" type="warning">已报工</el-tag>
|
<el-tag v-if="scope.row.procedureStatus === '1'" type="warning">已报工</el-tag>
|
||||||
<el-tag v-else-if="scope.row.reportProcess === '2'" type="success">报工完成</el-tag>
|
<el-tag v-else-if="scope.row.procedureStatus === '2'" type="success">报工完成</el-tag>
|
||||||
<el-tag v-else>{{ scope.row.reportProcess }}</el-tag>
|
<el-tag v-else>未知</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<!-- <el-table-column-->
|
<!-- <el-table-column-->
|
||||||
@ -161,7 +161,7 @@
|
|||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.reportProcess == 2"
|
v-if="scope.row.procedureStatus == 2"
|
||||||
link
|
link
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="rework('update', scope.row.id)"
|
@click="rework('update', scope.row.id)"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user