|
|
@@ -17,21 +17,15 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="类型:" prop="issueType">
|
|
|
- <!-- <el-select
|
|
|
- v-model="queryForm.issueType"
|
|
|
- placeholder="全部"
|
|
|
- clearable
|
|
|
- :disabled="typeDisable"
|
|
|
- >
|
|
|
- <el-option v-for="item in options" :label="item.name" :value="item.id" />
|
|
|
- </el-select> -->
|
|
|
+ <el-form-item label="类型:" prop="issueTypeList">
|
|
|
<el-cascader
|
|
|
v-model="issueTypeValue"
|
|
|
:options="options"
|
|
|
:props="issueMainTypeProp"
|
|
|
- :show-all-levels="false"
|
|
|
clearable
|
|
|
+ collapse-tags
|
|
|
+ :show-all-levels="false"
|
|
|
+ popper-class="special-cascader"
|
|
|
:disabled="typeDisable"
|
|
|
@change="handleIssueMainTypeChange"
|
|
|
/>
|
|
|
@@ -40,14 +34,15 @@
|
|
|
<el-cascader
|
|
|
v-model="workLocation"
|
|
|
:options="locationOptions"
|
|
|
- :props="location"
|
|
|
+ :props="locationProp"
|
|
|
clearable
|
|
|
collapse-tags
|
|
|
:show-all-levels="false"
|
|
|
+ popper-class="special-cascader"
|
|
|
@change="handleCascaderChange"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="状态:" prop="issueState">
|
|
|
+ <el-form-item label="处理状态:" prop="issueState">
|
|
|
<el-select v-model="tempState" clearable @change="handleIssueStateChange">
|
|
|
<el-option
|
|
|
v-for="item in issueStateOptions"
|
|
|
@@ -57,6 +52,16 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="生效状态:" prop="hide">
|
|
|
+ <el-select v-model="queryForm.hide" clearable>
|
|
|
+ <el-option
|
|
|
+ v-for="item in hideStateOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="日期:">
|
|
|
<el-date-picker
|
|
|
v-model="dateRange"
|
|
|
@@ -85,8 +90,9 @@
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import type { FormInstance } from 'element-plus';
|
|
|
- import { computed, reactive, ref } from 'vue';
|
|
|
- import { sourceOptions, issueStateOptions } from './constant.question';
|
|
|
+ import { reactive, ref } from 'vue';
|
|
|
+ import { sourceOptions, hideStateOptions, issueStateOptions } from './constant.question';
|
|
|
+ import { TableQueryForm } from '@/api/datamanagement/alert-default';
|
|
|
|
|
|
interface Props {
|
|
|
isShowTab: boolean; // true展示数据,false默认数据
|
|
|
@@ -97,20 +103,8 @@
|
|
|
const props = defineProps<Props>();
|
|
|
const emits = defineEmits(['onSearch', 'onReset', 'onExport']);
|
|
|
|
|
|
- interface QueryModel {
|
|
|
- pageNumber: number;
|
|
|
- pageSize: number;
|
|
|
- source?: number; // 来源
|
|
|
- issueMainType?: number; // 一级类型
|
|
|
- issueType?: number; // 类型
|
|
|
- workspaceId?: number[]; // 地点=工位id
|
|
|
- issueState?: number[]; // 状态
|
|
|
- startTime?: string; // 开始时间(默认)
|
|
|
- endTime?: string; // 结束时间(默认)
|
|
|
- }
|
|
|
-
|
|
|
const formRef = ref<FormInstance>();
|
|
|
- const queryForm = reactive<QueryModel>({
|
|
|
+ const queryForm = reactive<TableQueryForm>({
|
|
|
pageNumber: 1,
|
|
|
pageSize: 10,
|
|
|
});
|
|
|
@@ -126,20 +120,17 @@
|
|
|
|
|
|
const options = ref<MainOption[]>([]);
|
|
|
const typeDisable = ref(true);
|
|
|
+ const issueTypeValue = ref([]); // 问题类型,级联选择器
|
|
|
+ const issueMainTypeProp = { multiple: true, expandTrigger: 'hover' as const };
|
|
|
+ const workShopIds = ref([]);
|
|
|
const workLocation = ref([]); // 级联选择器,为二维数组(提取workspaceId)
|
|
|
- const location = { multiple: true }; // 级联选择器(打开多选)
|
|
|
+ const locationProp = { multiple: true, expandTrigger: 'hover' as const }; // 级联选择器(打开多选)
|
|
|
const tempState = ref(''); // 状态,字符串转number[]
|
|
|
const dateRange = ref([]); // 时间段,拆分成startTime/endTime
|
|
|
const defaultTime = ref<[Date, Date]>([
|
|
|
new Date(2000, 1, 1, 0, 0, 0),
|
|
|
new Date(2000, 2, 1, 23, 59, 59),
|
|
|
]);
|
|
|
- const issueTypeValue = ref([]); // 问题类型,级联选择器
|
|
|
- const issueMainTypeProp = computed(() => {
|
|
|
- if (props.isShowTab) return { expandTrigger: 'hover' as const, checkStrictly: false };
|
|
|
- else return { expandTrigger: 'hover' as const, checkStrictly: true };
|
|
|
- });
|
|
|
- const workShopIds = ref([]);
|
|
|
|
|
|
const handleSearch = () => {
|
|
|
emits('onSearch', queryForm);
|
|
|
@@ -154,7 +145,7 @@
|
|
|
dateRange.value = [];
|
|
|
Reflect.deleteProperty(queryForm, 'startTime');
|
|
|
Reflect.deleteProperty(queryForm, 'endTime');
|
|
|
- Reflect.deleteProperty(queryForm, 'issueMainType');
|
|
|
+ Reflect.deleteProperty(queryForm, 'issueMainTypeList');
|
|
|
formRef.value?.resetFields();
|
|
|
emits('onReset', queryForm);
|
|
|
};
|
|
|
@@ -173,19 +164,20 @@
|
|
|
} else {
|
|
|
typeDisable.value = true;
|
|
|
options.value = [];
|
|
|
- queryForm.issueMainType = undefined;
|
|
|
- queryForm.issueType = undefined;
|
|
|
+ queryForm.issueMainTypeList = undefined;
|
|
|
+ queryForm.issueTypeList = undefined;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
const handleIssueMainTypeChange = () => {
|
|
|
- if (issueTypeValue.value) {
|
|
|
- queryForm.issueMainType = issueTypeValue.value[0];
|
|
|
- queryForm.issueType = issueTypeValue.value[1];
|
|
|
- } else {
|
|
|
- Reflect.deleteProperty(queryForm, 'issueMainType');
|
|
|
- Reflect.deleteProperty(queryForm, 'issueType');
|
|
|
- }
|
|
|
+ const arrMain = [];
|
|
|
+ const arrSub = [];
|
|
|
+ issueTypeValue.value.forEach((item) => {
|
|
|
+ arrMain.push(item[0]);
|
|
|
+ arrSub.push(item[1]);
|
|
|
+ });
|
|
|
+ queryForm.issueMainTypeList = [...new Set(arrMain)];
|
|
|
+ queryForm.issueTypeList = arrSub;
|
|
|
};
|
|
|
|
|
|
const handleCascaderChange = () => {
|
|
|
@@ -212,20 +204,70 @@
|
|
|
Reflect.deleteProperty(queryForm, 'endTime');
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+ // TODO: cascader点击任意位置选中,DOM方式实现一级,CSS方式无法穿透
|
|
|
+ // TODO: el-cascader组件需添加 @expand-change="handleLocationExpandChange"(当前暂时删除)
|
|
|
+ // const curLocationLevel = ref(0);
|
|
|
+ // const handleLocationExpandChange = (event) => {
|
|
|
+ // curLocationLevel.value = event.length;
|
|
|
+ // nextTick(() => {
|
|
|
+ // setCascaderDomEvent();
|
|
|
+ // });
|
|
|
+ // };
|
|
|
+
|
|
|
+ // const setCascaderDomEvent = () => {
|
|
|
+ // const cascaderDom = document.querySelectorAll('.special-cascader .el-cascader-menu__list');
|
|
|
+
|
|
|
+ // if (cascaderDom.length >= curLocationLevel.value - 1) {
|
|
|
+ // const optionDom = cascaderDom[curLocationLevel.value] as Element;
|
|
|
+ // optionDom.querySelectorAll('.el-cascader-node__label').forEach((label: Element) => {
|
|
|
+ // const nextDom = label.nextElementSibling;
|
|
|
+ // label.addEventListener('click', cascaderCheckEvent);
|
|
|
+ // if (!nextDom) {
|
|
|
+ // (label as HTMLElement).style.cursor = 'pointer';
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // if (curLocationLevel.value) {
|
|
|
+ // const optionDom = cascaderDom[curLocationLevel.value - 1] as Element;
|
|
|
+ // optionDom.querySelectorAll('.el-cascader-node__label').forEach((label: Element) => {
|
|
|
+ // const nextDom = label.nextElementSibling;
|
|
|
+ // label.addEventListener('click', cascaderCheckEvent);
|
|
|
+ // if (!nextDom) {
|
|
|
+ // (label as HTMLElement).style.cursor = 'pointer';
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+
|
|
|
+ // const cascaderCheckEvent = (event: MouseEvent) => {
|
|
|
+ // // 查找对应的输入框
|
|
|
+ // let brother = (event.target as HTMLElement).previousElementSibling; // 获取前一个兄弟元素
|
|
|
+ // const input = brother?.querySelector('input[type="checkbox"], input[type="radio"]'); // 支持复选框和单选框
|
|
|
+ // if (input) {
|
|
|
+ // (input as HTMLInputElement).click(); // 模拟点击复选框
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // 如果有子菜单,展开/收起子菜单
|
|
|
+ // const childMenu = (event.target as HTMLElement).nextElementSibling;
|
|
|
+ // if (childMenu && childMenu.classList.contains('el-cascader-menu__list')) {
|
|
|
+ // // 这里可以根据需求添加展开/收起的逻辑
|
|
|
+ // }
|
|
|
+ // };
|
|
|
</script>
|
|
|
|
|
|
-<style scoped lang="scss">
|
|
|
+<style scoped lang="less">
|
|
|
.el-form {
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
}
|
|
|
|
|
|
:deep(.el-form--inline .el-form-item) {
|
|
|
- margin-right: 0;
|
|
|
+ margin-right: 10px;
|
|
|
}
|
|
|
|
|
|
:deep(.el-form-item__label) {
|
|
|
- padding: 0;
|
|
|
+ padding-left: 10px;
|
|
|
}
|
|
|
|
|
|
.select-group {
|