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