合并
This commit is contained in:
@ -234,7 +234,7 @@ const showSearch = ref(true);
|
||||
const uploadRef = ref<any>(null);
|
||||
|
||||
// 方阵表单模型(核心修复:使用reactive并显式声明结构)
|
||||
const formM = reactive<MatrixForm>({
|
||||
const formM = ref<MatrixForm>({
|
||||
landId: undefined,
|
||||
unitBoList: [{ unitProjectArea: '', unitProjectStatus: '', unitProjectId: [] }]
|
||||
});
|
||||
@ -424,11 +424,11 @@ const getfangzhenList = async () => {
|
||||
/** 关联方阵 */
|
||||
const handleView = async (row: LandBlockVO) => {
|
||||
if (!row?.id) return proxy?.$modal.msgWarning('请选择有效的地块');
|
||||
|
||||
console.log('🚀 ~ handleView ~ row:', row);
|
||||
// 重置方阵表单
|
||||
resetMatrix();
|
||||
// 绑定当前地块ID
|
||||
formM.landId = row.id;
|
||||
formM.value.landId = row.id;
|
||||
// 打开弹窗
|
||||
dialogMatrix.visible = true;
|
||||
|
||||
@ -437,7 +437,7 @@ const handleView = async (row: LandBlockVO) => {
|
||||
|
||||
/** 新增方阵表单项 */
|
||||
const addUnitBoItem = () => {
|
||||
formM.unitBoList.push({
|
||||
formM.value.unitBoList.push({
|
||||
unitProjectArea: '',
|
||||
unitProjectStatus: '',
|
||||
unitProjectId: []
|
||||
@ -448,10 +448,10 @@ const addUnitBoItem = () => {
|
||||
|
||||
/** 删除方阵表单项 */
|
||||
const removeUnitBoItem = (index: number) => {
|
||||
if (formM.unitBoList.length <= 1) {
|
||||
if (formM.value.unitBoList.length <= 1) {
|
||||
return proxy?.$modal.msgWarning('至少保留一项方阵配置');
|
||||
}
|
||||
formM.unitBoList.splice(index, 1);
|
||||
formM.value.unitBoList.splice(index, 1);
|
||||
landBlockFormMatrixRef.value?.clearValidate();
|
||||
};
|
||||
|
||||
@ -459,11 +459,11 @@ const removeUnitBoItem = (index: number) => {
|
||||
const submitFormMatrix = () => {
|
||||
landBlockFormMatrixRef.value?.validate(async (valid: boolean) => {
|
||||
if (!valid) return;
|
||||
if (!formM.landId) return proxy?.$modal.msgWarning('地块ID异常,请重新选择地块');
|
||||
if (!formM.value.landId) return proxy?.$modal.msgWarning('地块ID异常,请重新选择地块');
|
||||
|
||||
try {
|
||||
// 处理方阵数据(修复ID拆分逻辑)
|
||||
const unitBoListParams = formM.unitBoList.map((item) => {
|
||||
const unitBoListParams = formM.value.unitBoList.map((item) => {
|
||||
// 取级联选择的最后一层值
|
||||
const lastLevelValue = item.unitProjectId[item.unitProjectId.length - 1];
|
||||
if (!lastLevelValue) throw new Error('请选择完整的方阵');
|
||||
@ -482,7 +482,7 @@ const submitFormMatrix = () => {
|
||||
|
||||
// 调用关联接口
|
||||
const res = await LandUnit({
|
||||
landId: formM.landId,
|
||||
landId: formM.value.landId,
|
||||
unitBoList: unitBoListParams
|
||||
});
|
||||
|
||||
@ -507,12 +507,12 @@ const cancelMatrix = () => {
|
||||
|
||||
/** 方阵表单重置 */
|
||||
const resetMatrix = () => {
|
||||
formM.landId = undefined;
|
||||
formM.unitBoList = [{ unitProjectArea: '', unitProjectStatus: '', unitProjectId: [] }];
|
||||
if (landBlockFormMatrixRef.value) {
|
||||
landBlockFormMatrixRef.value.resetFields();
|
||||
landBlockFormMatrixRef.value.clearValidate();
|
||||
}
|
||||
formM.value.landId = undefined;
|
||||
formM.value.unitBoList = [{ unitProjectArea: '', unitProjectStatus: '', unitProjectId: [] }];
|
||||
};
|
||||
|
||||
/** 监听项目变化,刷新数据 */
|
||||
|
Reference in New Issue
Block a user