数据填报
This commit is contained in:
parent
ae2ff1ced4
commit
86a7f990d3
@ -96,7 +96,7 @@
|
|||||||
</a-select> -->
|
</a-select> -->
|
||||||
<!-- 流域下拉框 -->
|
<!-- 流域下拉框 -->
|
||||||
<a-select
|
<a-select
|
||||||
:value="formData.rvcd"
|
:value="formData.reachcd"
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
@change="lyChange"
|
@change="lyChange"
|
||||||
show-search
|
show-search
|
||||||
@ -330,7 +330,7 @@ const initForm = () => {
|
|||||||
// 下拉菜单
|
// 下拉菜单
|
||||||
// shuJuTianBaoStore.getBaseOption();
|
// shuJuTianBaoStore.getBaseOption();
|
||||||
shuJuTianBaoStore.getSelectForOption();
|
shuJuTianBaoStore.getSelectForOption();
|
||||||
shuJuTianBaoStore.getEngOption(formData.rvcd);
|
shuJuTianBaoStore.getEngOption(formData.reachcd);
|
||||||
}
|
}
|
||||||
if (item.fieldProps?.required) {
|
if (item.fieldProps?.required) {
|
||||||
rules[item.name] = [
|
rules[item.name] = [
|
||||||
@ -363,23 +363,23 @@ const triggerManualValuesChange = (changedKey: string, newValue: any) => {
|
|||||||
// };
|
// };
|
||||||
|
|
||||||
const lyChange = (value: any) => {
|
const lyChange = (value: any) => {
|
||||||
formData.rvcd = value;
|
formData.reachcd = value;
|
||||||
formData.rstcd = "";
|
formData.rstcd = "";
|
||||||
shuJuTianBaoStore.getEngOption(formData.rvcd);
|
shuJuTianBaoStore.getEngOption(formData.reachcd);
|
||||||
|
// debugger
|
||||||
// 【关键修改】手动触发 valuesChange,因为 a-form-item-rest 阻断了自动监听
|
// 【关键修改】手动触发 valuesChange,因为 a-form-item-rest 阻断了自动监听
|
||||||
triggerManualValuesChange("rvcd", formData.rvcd);
|
triggerManualValuesChange("reachcd", formData.reachcd);
|
||||||
};
|
};
|
||||||
|
|
||||||
const stcdIdChange = (value: any) => {
|
const stcdIdChange = (value: any) => {
|
||||||
if (props.zhujianfujian == "fu") {
|
if (props.zhujianfujian == "fu") {
|
||||||
formData.rstcd = value;
|
formData.rstcd = value;
|
||||||
shuJuTianBaoStore.getFpssOption(formData.rvcd, value);
|
shuJuTianBaoStore.getFpssOption(formData.reachcd, value);
|
||||||
// 【关键修改】手动触发 valuesChange
|
// 【关键修改】手动触发 valuesChange
|
||||||
triggerManualValuesChange("rstcd", formData.rstcd);
|
triggerManualValuesChange("rstcd", formData.rstcd);
|
||||||
} else {
|
} else {
|
||||||
formData.stcd = value;
|
formData.stcd = value;
|
||||||
shuJuTianBaoStore.getFpssOption(formData.rvcd, value);
|
shuJuTianBaoStore.getFpssOption(formData.reachcd, value);
|
||||||
// 【关键修改】手动触发 valuesChange
|
// 【关键修改】手动触发 valuesChange
|
||||||
triggerManualValuesChange("stcd", formData.stcd);
|
triggerManualValuesChange("stcd", formData.stcd);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,7 +61,7 @@ export const useShuJuTianBaoStore = defineStore('shuJuTianBao', () => {
|
|||||||
const getEngOption = async (rvcd: string) => {
|
const getEngOption = async (rvcd: string) => {
|
||||||
try {
|
try {
|
||||||
engLoading.value = true;
|
engLoading.value = true;
|
||||||
const param = rvcd === 'all' ? {} : { rvcd };
|
const param = rvcd === 'all' ? {} : { reachcd: rvcd };
|
||||||
const res = await getEngInfoDropdown(param);
|
const res = await getEngInfoDropdown(param);
|
||||||
if (res.data && Array.isArray(res.data)) {
|
if (res.data && Array.isArray(res.data)) {
|
||||||
// 直接赋值给 ref
|
// 直接赋值给 ref
|
||||||
@ -78,7 +78,7 @@ export const useShuJuTianBaoStore = defineStore('shuJuTianBao', () => {
|
|||||||
const getFpssOption = async (rvcd: string, rstcd: string) => {
|
const getFpssOption = async (rvcd: string, rstcd: string) => {
|
||||||
try {
|
try {
|
||||||
fpssLoading.value = true;
|
fpssLoading.value = true;
|
||||||
const param = rvcd === 'all' ? {} : { rvcd };
|
const param = rvcd === 'all' ? {} : { reachcd:rvcd };
|
||||||
const res = await getFpssDropdown({...param, rstcd: rstcd});
|
const res = await getFpssDropdown({...param, rstcd: rstcd});
|
||||||
fpssOption.value = res.data;
|
fpssOption.value = res.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@ -18,9 +18,9 @@
|
|||||||
>
|
>
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item label="流域" name="rvcd">
|
<a-form-item label="流域" name="reachcd">
|
||||||
<a-select
|
<a-select
|
||||||
v-model:value="formData.rvcd"
|
v-model:value="formData.reachcd"
|
||||||
:loading="hbrvcdLoading"
|
:loading="hbrvcdLoading"
|
||||||
placeholder="请选择流域"
|
placeholder="请选择流域"
|
||||||
:disabled="isView"
|
:disabled="isView"
|
||||||
@ -67,7 +67,7 @@
|
|||||||
v-model:value="formData.rstcd"
|
v-model:value="formData.rstcd"
|
||||||
:loading="engLoading"
|
:loading="engLoading"
|
||||||
placeholder="请选择电站名称"
|
placeholder="请选择电站名称"
|
||||||
:disabled="isView || !formData.rvcd"
|
:disabled="isView || !formData.reachcd"
|
||||||
show-search
|
show-search
|
||||||
allowClear
|
allowClear
|
||||||
:filter-option="filterOption"
|
:filter-option="filterOption"
|
||||||
@ -395,16 +395,16 @@ const getHbrvcdDropdownSelect = async () => {
|
|||||||
// await getEngInfoDropdownSelect(baseId);
|
// await getEngInfoDropdownSelect(baseId);
|
||||||
// await getFpssDropdownSelect(formData.rstcd, baseId);
|
// await getFpssDropdownSelect(formData.rstcd, baseId);
|
||||||
// };
|
// };
|
||||||
const hbrvcdChange = async (rvcd: string) => {
|
const hbrvcdChange = async (reachcd: string) => {
|
||||||
formData.rstcd = undefined;
|
formData.rstcd = undefined;
|
||||||
formData.stcd = undefined;
|
formData.stcd = undefined;
|
||||||
await getEngInfoDropdownSelect(rvcd);
|
await getEngInfoDropdownSelect(reachcd);
|
||||||
// await getFpssDropdownSelect(formData.rstcd, rvcd);
|
// await getFpssDropdownSelect(formData.rstcd, rvcd);
|
||||||
};
|
};
|
||||||
const getEngInfoDropdownSelect = async (rvcd: string) => {
|
const getEngInfoDropdownSelect = async (reachcd: string) => {
|
||||||
try {
|
try {
|
||||||
engLoading.value = true;
|
engLoading.value = true;
|
||||||
const res = await getEngInfoDropdown({ rvcd });
|
const res = await getEngInfoDropdown({ reachcd });
|
||||||
engOption.value = res.data;
|
engOption.value = res.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取电站列表失败', error);
|
console.error('获取电站列表失败', error);
|
||||||
@ -414,12 +414,12 @@ const getEngInfoDropdownSelect = async (rvcd: string) => {
|
|||||||
};
|
};
|
||||||
const engChange = async (rstcd: string) => {
|
const engChange = async (rstcd: string) => {
|
||||||
formData.stcd = undefined;
|
formData.stcd = undefined;
|
||||||
await getFpssDropdownSelect(rstcd, formData.rvcd);
|
await getFpssDropdownSelect(rstcd, formData.reachcd);
|
||||||
};
|
};
|
||||||
const getFpssDropdownSelect = async (rstcd: string, rvcd: string) => {
|
const getFpssDropdownSelect = async (rstcd: string, reachcd: string) => {
|
||||||
try {
|
try {
|
||||||
fpssLoading.value = true;
|
fpssLoading.value = true;
|
||||||
const res = await getFpssDropdown({ rstcd, rvcd });
|
const res = await getFpssDropdown({ rstcd, reachcd });
|
||||||
fpssOption.value = res.data;
|
fpssOption.value = res.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取流量列表失败', error);
|
console.error('获取流量列表失败', error);
|
||||||
@ -454,7 +454,7 @@ const weightError = ref<string>('');
|
|||||||
// 表单数据模型
|
// 表单数据模型
|
||||||
const defaultFormData = reactive({
|
const defaultFormData = reactive({
|
||||||
id: undefined,
|
id: undefined,
|
||||||
rvcd: undefined,
|
reachcd: undefined,
|
||||||
stcd: undefined,
|
stcd: undefined,
|
||||||
rstcd: undefined,
|
rstcd: undefined,
|
||||||
strdt: undefined,
|
strdt: undefined,
|
||||||
@ -479,7 +479,7 @@ const filterOption = (inputValue: string, option: any) => {
|
|||||||
};
|
};
|
||||||
// 验证规则
|
// 验证规则
|
||||||
const rules: Record<string, Rule[]> = {
|
const rules: Record<string, Rule[]> = {
|
||||||
rvcd: [{ required: true, message: '请选择流域', trigger: 'change' }],
|
reachcd: [{ required: true, message: '请选择流域', trigger: 'change' }],
|
||||||
rstcd: [{ required: true, message: '请选择电站', trigger: 'change' }],
|
rstcd: [{ required: true, message: '请选择电站', trigger: 'change' }],
|
||||||
stcd: [{ required: true, message: '请选择过鱼设施', trigger: 'change' }],
|
stcd: [{ required: true, message: '请选择过鱼设施', trigger: 'change' }],
|
||||||
strdt: [{ required: true, message: '请选择过鱼时间', trigger: 'change' }],
|
strdt: [{ required: true, message: '请选择过鱼时间', trigger: 'change' }],
|
||||||
@ -858,8 +858,8 @@ watch(
|
|||||||
// 弹窗打开时,初始化数据
|
// 弹窗打开时,初始化数据
|
||||||
// getBaseDropdownSelect();// 基地
|
// getBaseDropdownSelect();// 基地
|
||||||
getHbrvcdDropdownSelect(); // 流域
|
getHbrvcdDropdownSelect(); // 流域
|
||||||
getEngInfoDropdownSelect(formData.rvcd);
|
getEngInfoDropdownSelect(formData.reachcd);
|
||||||
getFpssDropdownSelect(formData.rstcd, formData.rvcd);
|
getFpssDropdownSelect(formData.rstcd, formData.reachcd);
|
||||||
initForm();
|
initForm();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -133,7 +133,7 @@ const localTypeDate = ref<string>(null);
|
|||||||
const basicSearchRef = ref<any>();
|
const basicSearchRef = ref<any>();
|
||||||
|
|
||||||
const initSearchData = {
|
const initSearchData = {
|
||||||
rvcd: "all",
|
reachcd: "all",
|
||||||
// baseId: "all",
|
// baseId: "all",
|
||||||
stcd: null,
|
stcd: null,
|
||||||
rstcd: null,
|
rstcd: null,
|
||||||
@ -150,7 +150,7 @@ const searchData = ref<any>({ ...initSearchData });
|
|||||||
const searchList: any = computed(() => [
|
const searchList: any = computed(() => [
|
||||||
{
|
{
|
||||||
type: "waterStation",
|
type: "waterStation",
|
||||||
name: "rvcd",
|
name: "reachcd",
|
||||||
label: "流域",
|
label: "流域",
|
||||||
fieldProps: {
|
fieldProps: {
|
||||||
allowClear: true
|
allowClear: true
|
||||||
@ -222,7 +222,7 @@ const onValuesChange = (changedValues: any, allValues: any) => {
|
|||||||
if (
|
if (
|
||||||
Object.keys(changedValues)[0] == "rstcd" ||
|
Object.keys(changedValues)[0] == "rstcd" ||
|
||||||
Object.keys(changedValues)[0] == "baseId" ||
|
Object.keys(changedValues)[0] == "baseId" ||
|
||||||
Object.keys(changedValues)[0] == "rvcd"
|
Object.keys(changedValues)[0] == "reachcd"
|
||||||
) {
|
) {
|
||||||
const formInstance = basicSearchRef.value?.formData;
|
const formInstance = basicSearchRef.value?.formData;
|
||||||
formInstance.stcd = null;
|
formInstance.stcd = null;
|
||||||
|
|||||||
@ -885,11 +885,11 @@ const handleSearchFinish = (values: any) => {
|
|||||||
dataType: 'string',
|
dataType: 'string',
|
||||||
value: values.rstcd
|
value: values.rstcd
|
||||||
},
|
},
|
||||||
values.rvcd !== 'all' && {
|
values.reachcd !== 'all' && {
|
||||||
field: 'rvcd',
|
field: 'reachcd',
|
||||||
operator: 'eq',
|
operator: 'eq',
|
||||||
dataType: 'string',
|
dataType: 'string',
|
||||||
value: values.rvcd
|
value: values.reachcd
|
||||||
}
|
}
|
||||||
// values.baseId !== "all" && {
|
// values.baseId !== "all" && {
|
||||||
// field: "baseId",
|
// field: "baseId",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user