This commit is contained in:
2025-07-20 19:20:12 +08:00
parent 83d732d805
commit b8f943ca79
7 changed files with 104 additions and 158 deletions

View File

@ -74,7 +74,7 @@
<!-- checkbox -->
<template v-else-if="item.showType === 'department'">
<MOSTY.Department clearable v-model="item.ssbmdm" />
<MOSTY.Department clearable v-model="searchObj[item.prop]" />
</template>
<!-- checkbox -->
<template v-else-if="item.showType === 'checkbox'">
@ -125,7 +125,6 @@
<!-- 级联选择 -->
<el-cascader
v-else-if="item.showType === 'cascader'"
@change="changeca"
v-model="searchObj[item.prop]"
:props="item.props"
:show-all-levels="item.showAllLevels"
@ -151,11 +150,8 @@
import {
ref,
reactive,
watch,
watchEffect,
nextTick,
getCurrentInstance,
toRefs
} from "vue";
import * as MOSTY from "@/components/MyComponents/index";
const { proxy } = getCurrentInstance();
@ -183,6 +179,12 @@ const props = defineProps({
defaultVal: "",
label: "输入"
},
{
showType: "department",
prop: "deptKey",
defaultVal: "",
label: "输入"
},
{
showType: "daterange",
prop: "daterangeKey",
@ -215,9 +217,6 @@ const props = defineProps({
{
showType: "radio",
defaultVal: ""
// prop: "cascaderKey",
// label: "级联选择",
// checkStrictly: false //点击任意选中
},
{
showType: "defaultTime",
@ -237,16 +236,9 @@ const props = defineProps({
}
});
let loadingPage = ref(false);
const isShowDate = ref(false);
const emit = defineEmits(["submit", "reset"]);
let searchObj = reactive({});
const timeConfig = reactive({
//时间字典筛选和自定义日期组件相关数据
typeValue: "01", //时间字典类型默认
timeArry: [] //时间筛选自定义默认值
});
//全所或自定义选择按钮
const slectType = ref("qs");
// select 的一些默认配置
const selectDefault = {
clearable: true, // 是否可以清空
@ -362,53 +354,6 @@ const dateShortcuts = [
}
}
];
//自定义时间选择 item 配置项 value 选中的值
const screenSelect = (item, value) => {
if (value == "08") {
searchObj[item.prop] = value;
isShowDate.value = true;
} else {
timeConfig.typeValue = value;
searchObj[item.prop] = value;
submit();
}
};
//自定义时间确定时间
const chooseDateOk = (item) => {
timeConfig.typeValue = "08";
if (timeConfig.timeArry && timeConfig.timeArry.length) {
//选择了时间
searchObj[item.propStart] = timeConfig.timeArry[0];
searchObj[item.propEnd] = timeConfig.timeArry[1];
} else {
//清空了时间
searchObj[item.prop] = "01";
timeConfig.typeValue = "01";
}
isShowDate.value = false;
submit();
};
//全所-部门选择回调
const organizatioHland = (val) => {
let item = getArr.find((item) => item.showType == "qsOrZdy");
searchObj[item.propBm] = val?.data?.orgCode || "";
if (!val || val == "") {
//清空了部门选择后清空责任区ID
slectType.value = "qs";
delete searchObj[item.propZrq];
}
submit();
};
//全所-责任区回调
const zrqHland = (val) => {
let item = getArr.find((item) => item.showType == "qsOrZdy");
searchObj[item.propZrq] = val || ""; //责任区选择
submit();
};
//自定义时间取消事件
const popoverCancel = (item) => {
isShowDate.value = false;
};
// 设置不可选的日期
const disabledDate = (time) => {
return time.getTime() > Date.now();
@ -513,10 +458,6 @@ const cascaderLazyProps = reactive({
resolve(options);
}
});
// 级联框选择
function changeca(v) {
console.log("vvvv", v);
}
// 获取到传过来的参数
let getArr = reactive([]);
const submit = () => {
@ -529,25 +470,22 @@ const reset = () => {
emit("submit", searchObj);
emit("reset", false);
};
let dataOptions = reactive([]); //时间字典筛选
watchEffect(() => {
loadingPage.value = true;
getArr = JSON.parse(JSON.stringify(props.searchArr));
getArr = getArr.map((item) => {
let arr = JSON.parse(JSON.stringify(props.searchArr));
getArr = arr.map((item) => {
switch (item.showType) {
case "select":
item = { ...selectDefault, ...item };
item.options = reactive(item.options);
getOptions[item.prop] = item.options;
break;
case "input":
item = { ...inputDefault, ...item };
case "input":
item = { ...inputDefault, ...item };
break;
case "daterange":
item = { ...daterangeDefault, ...item };
if (item.defaultShortcuts) {
item.shortcuts = shortcuts;
}
if (item.defaultShortcuts) item.shortcuts = shortcuts;
break;
case "date":
item = { ...defaultDate, ...item };