|
|
@@ -80,10 +80,14 @@ const FIRST_CROP_KEY_MAP = {
|
|
|
大田: "field",
|
|
|
};
|
|
|
const TAB_ORDER = ["果树", "大田"];
|
|
|
+/** 当前仅开放荔枝、水稻,其余点击提示暂未开放 */
|
|
|
+const ALLOWED_CROP_NAMES = new Set(["荔枝", "水稻"]);
|
|
|
const DEFAULT_COUNTY_CODE = "440113";
|
|
|
const MAP_KEY = "CZLBZ-LJICQ-R4A5J-BN62X-YXCRJ-GNBUT";
|
|
|
const DEFAULT_POINT = "POINT(113.6142086995688 23.585836479509055)";
|
|
|
|
|
|
+const isCropAllowed = (item) => ALLOWED_CROP_NAMES.has(item?.name);
|
|
|
+
|
|
|
const props = defineProps({
|
|
|
multiple: { type: Boolean, default: false },
|
|
|
});
|
|
|
@@ -212,7 +216,9 @@ const getCachedSelectedItems = () => {
|
|
|
if (!raw) return [];
|
|
|
const list = JSON.parse(raw);
|
|
|
if (!Array.isArray(list)) return [];
|
|
|
- return props.multiple ? list : list.slice(0, 1);
|
|
|
+ // 历史缓存可能含未开放品类,进页时过滤掉
|
|
|
+ const allowed = list.filter((item) => isCropAllowed(item));
|
|
|
+ return props.multiple ? allowed : allowed.slice(0, 1);
|
|
|
} catch {
|
|
|
return [];
|
|
|
}
|
|
|
@@ -352,6 +358,10 @@ const handleSearch = () => {
|
|
|
};
|
|
|
|
|
|
const handleSelect = (item) => {
|
|
|
+ if (!isCropAllowed(item)) {
|
|
|
+ ElMessage.warning("该品种暂未开放");
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (props.multiple) {
|
|
|
item.selected = !item.selected;
|
|
|
persistSelection();
|
|
|
@@ -364,9 +374,10 @@ const handleSelect = (item) => {
|
|
|
};
|
|
|
|
|
|
const handleNext = () => {
|
|
|
- const list = props.multiple
|
|
|
+ const list = (props.multiple
|
|
|
? sortFieldFirst(selectedItems.value)
|
|
|
- : selectedItems.value.slice(0, 1);
|
|
|
+ : selectedItems.value.slice(0, 1)
|
|
|
+ ).filter((item) => isCropAllowed(item));
|
|
|
if (!list.length) {
|
|
|
ElMessage.warning(props.multiple ? "请选择种植品类" : "请选择一个种植品类");
|
|
|
return;
|