Commit a7793256 by chuishuo

测试优化前端

parent 987d696f
......@@ -148,6 +148,13 @@
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">关 闭</el-button>
</div>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="handleCountViewInfo(row)"
/>
</el-dialog>
</div>
</template>
......
......@@ -11,46 +11,46 @@
>
<el-form-item label="物料" prop="materialId">
<common-dict-select
v-model="searchParams.materialId"
dict-url="/inventory/materials/getMapList"
value-key="id"
label-key="material_name"
placeholder="请选择物料"
@change="handleQuery"
@loaded="handleDictLoaded('material', $event)"
v-model="searchParams.materialId"
dict-url="/inventory/materials/getMapList"
value-key="id"
label-key="material_name"
placeholder="请选择物料"
@change="handleQuery"
@loaded="handleDictLoaded('material', $event)"
/>
</el-form-item>
<el-form-item label="仓库" prop="warehouseId">
<el-input
v-model="queryWarehouseName"
placeholder="请选择仓库"
readonly
@focus="openWarehouseSelector"
:suffix-icon="''"
v-model="queryWarehouseName"
placeholder="请选择仓库"
readonly
@focus="openWarehouseSelector"
:suffix-icon="''"
>
<template v-if="queryWarehouseName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearQueryWarehouse"
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearQueryWarehouse"
></i>
</template>
</el-input>
</el-form-item>
<el-form-item label="库位" prop="locationId">
<el-input
v-model="queryLocationName"
placeholder="请选择库位"
readonly
@focus="openLocationSelector"
:suffix-icon="''"
:disabled="!searchParams.warehouseId"
v-model="queryLocationName"
placeholder="请选择库位"
readonly
@focus="openLocationSelector"
:suffix-icon="''"
:disabled="!searchParams.warehouseId"
>
<template v-if="queryLocationName" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearQueryLocation"
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearQueryLocation"
></i>
</template>
</el-input>
......@@ -59,14 +59,14 @@
<!-- 仓库选择组件 -->
<WarehouseSelector
v-model="warehouseSelectorVisible"
@selected="handleWarehouseSelected"
v-model="warehouseSelectorVisible"
@selected="handleWarehouseSelected"
/>
<!-- 库位选择组件 -->
<LocationSelector
v-model="locationSelectorVisible"
:warehousesId="searchParams.warehouseId"
@selected="handleLocationSelected"
v-model="locationSelectorVisible"
:warehousesId="searchParams.warehouseId"
@selected="handleLocationSelected"
/>
<!-- 表格 -->
......@@ -135,23 +135,42 @@
</el-table-column>
<el-table-column label="是否已调整" align="center" prop="adjusted" v-if="isConfirm" width="150px" >
<template slot-scope="scope">
<el-input v-model="scope.row.adjusted" placeholder="请输入是否已调整0否1是" disabled />
<!-- <el-input v-model="scope.row.adjusted" placeholder="请输入是否已调整0否1是" disabled />-->
<div class="el-input__inner disabled-input" style="padding: 0 15px; height: 32px; line-height: 32px;">
<dict-tag :options="dict.type.is_adjusted" :value="scope.row.adjusted"/>
</div>
</template>
</el-table-column>
<el-table-column prop="adjustedType" label="调整原因类型" width="80">
<el-table-column prop="adjustedType" align="center" label="调整原因类型" width="150px">
<template slot-scope="scope">
<dict-tag :options="dict.type.adjusted_type" :value="scope.row.adjustedType"/>
<el-select
v-model="scope.row.adjustedType"
placeholder="请选择调整原因类型"
:disabled="isConfirm"
:style="getAdjustTypeErrorStyle(scope.row)"
@change="handleItemChange(scope.row)"
clearable
size="small"
>
<el-option
v-for="item in dict.type.adjusted_type"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="调整原因" align="center" prop="adjustmentReason" width="150px" >
<template slot-scope="scope">
<el-input
v-model="scope.row.adjustmentReason"
placeholder="请输入调整原因"
type="text"
:disabled="isConfirm"
:style="(Number(scope.row.varianceQuantity)||0)!==0 && !scope.row.adjustmentReason ? {border:'1px solid #f56c6c',boxShadow:'0 0 0 2px rgba(245,108,108,0.2)'} : {}"
@input="handleItemChange(scope.row)"
v-model="scope.row.adjustmentReason"
placeholder="请输入调整原因"
type="text"
:disabled="isConfirm"
:style="(Number(scope.row.varianceQuantity)||0)!==0 && !scope.row.adjustmentReason ? {border:'1px solid #f56c6c',boxShadow:'0 0 0 2px rgba(245,108,108,0.2)'} : {}"
@input="handleItemChange(scope.row)"
/>
</template>
</el-table-column>
......@@ -186,7 +205,7 @@ import WarehouseSelector from "@/views/compononents/WarehouseSelector.vue"
import LocationSelector from "@/views/compononents/LocationSelector.vue"
export default {
name: "stocktakeItemsTable",
dicts: ['adjusted_type'],
dicts: ['adjusted_type','is_adjusted'],
components: { CommonDictSelect,WarehouseSelector,LocationSelector }, // 注册通用字典组件
props: {
// 接收父组件传递的子表原始数据(双向绑定)
......@@ -304,7 +323,7 @@ export default {
/** 打开库位选择器 */
openLocationSelector() {
if (!this.currentWarehouseId) {
if (!this.searchParams.warehouseId) {
this.$message.warning("请先选择仓库")
return
}
......@@ -368,7 +387,23 @@ export default {
this.materialDict = data
}
},
// 计算调整类型的错误样式
getAdjustTypeErrorStyle(row) {
// 1. 先统一转换差异数量为数字(避免字符串/空值问题)
const varianceQty = Number(row.varianceQuantity) || 0;
// 2. 统一转换调整类型为字符串(覆盖数字0/字符串0/空值)
const adjustedType = String(row.adjustedType || '0').trim();
// 3. 核心条件:差异数量≠0 且 调整类型是0/空/未选择
if (varianceQty !== 0 && (adjustedType === '0' || adjustedType === '')) {
return {
border: '1px solid #f56c6c',
boxShadow: '0 0 0 2px rgba(245,108,108,0.2)'
};
}
// 无错误时返回空样式
return {};
},
// 校验调整原因必填项
validateAdjustReason() {
const invalidRows = this.filteredItemsList.filter(row => {
......@@ -378,13 +413,14 @@ export default {
const isVarianceNonZero = varianceQty !== 0;
// 3. 调整原因为空(处理null/''/全空格)
const isReasonEmpty = !row.adjustmentReason || row.adjustmentReason.trim() === '';
// 4.调整原因类型为0-未调整
const isTypeZearo = !row.adjustedType || row.adjustedType.trim() === '0';
// 最终条件:差异非0 且 调整原因为空 → 才需要提示
return isVarianceNonZero && isReasonEmpty;
return isVarianceNonZero && isReasonEmpty && isTypeZearo;
});
if (invalidRows.length > 0) {
this.$message.error(`第${invalidRows.map(r => r.index).join(',')}行差异数量非0,请填写调整原因`);
this.$message.error(`第${invalidRows.map(r => r.index).join(',')}行差异数量非0,请填写调整原因,并选择正确的调整原因类型`);
return false;
}
return true;
......@@ -406,6 +442,7 @@ export default {
row.varianceAmount = null;
row.varianceQuantity = null;
row.adjustmentReason = null;
row.adjustedType = '0';
} else {
// 处理空值/非数字情况,默认0
const actualQty = Number(row.actualQuantity) || 0
......@@ -429,21 +466,26 @@ export default {
.app-container {
padding: 16px;
}
.page-container {
background: #fff;
padding: 16px;
border-radius: 4px;
}
.table-container {
margin-top: 16px;
}
.mb8 {
margin-bottom: 8px;
}
:deep(.el-table) {
--el-table-header-text-color: #606266;
--el-table-row-hover-bg-color: #f5f7fa;
}
.disabled-input {
background-color: #f5f7fa !important;
border: 1px solid #e5e6eb !important;
......
......@@ -45,6 +45,26 @@ public class StocktakesVo extends Stocktakes
// 库位ID数组
private String[] locationIdArray;
private String adjustedType;
private String adjustmentReason;
public String getAdjustedType() {
return adjustedType;
}
public void setAdjustedType(String adjustedType) {
this.adjustedType = adjustedType;
}
public String getAdjustmentReason() {
return adjustmentReason;
}
public void setAdjustmentReason(String adjustmentReason) {
this.adjustmentReason = adjustmentReason;
}
public String[] getPlannedDateArray() {
return plannedDateArray;
}
......
......@@ -149,6 +149,8 @@ public class StocktakesServiceImpl implements IStocktakesService
Long varianceQuantity = stocktakeItems.getVarianceQuantity();
if (varianceQuantity != null && varianceQuantity != 0L) {
stocktakeItems.setAdjusted(1L);
}else {
stocktakeItems.setAdjusted(0L);
}
// 修改 子表
int i = stocktakeItemsService.updateStocktakeItems(stocktakeItems);
......@@ -270,6 +272,8 @@ public class StocktakesServiceImpl implements IStocktakesService
stocktakeItems.setIsUsed(1L);
stocktakeItems.setCreateUserCode(createUserCode);
stocktakeItems.setCreateTime(createTime);
stocktakeItems.setUpdateUserCode(null);
stocktakeItems.setUpdateTime(null);
list.add(stocktakeItems);
}
......
......@@ -126,7 +126,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
,dict.dict_label as hazardName
,IFNULL(st_it.variance_quantity, '0') as varianceQuantity
,IFNULL(st_it.variance_amount, '0') as varianceAmount
,(select dict.dict_label from sys_dict_data dict where st_it.adjusted_type = dict.dict_sort and dict.status =0 and dict.dict_type ='adjusted_type') as adjustedType
,st_it.adjustment_reason as adjustmentReason
,st_it.adjusted_type as adjustedType
-- ,(select dict.dict_label from sys_dict_data dict where st_it.adjusted_type = dict.dict_sort and dict.status =0 and dict.dict_type ='adjusted_type') as adjustedType
from stocktakes st
left join stocktake_items st_it on st.id = st_it.stocktake_id and st_it.is_used = 1
left join materials ma on st_it.material_id = ma.id and ma.is_used = 1
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论