Ver Fonte

reactor:事件管理调整;

zhangchong há 6 meses atrás
pai
commit
5a6890384a

+ 17 - 4
src/components/Hotspot/event.vue

@@ -21,6 +21,7 @@
 					:clearable="props.clearable"
 					:render-after-expand="false"
 					highlight-current
+					:check-strictly="props.checkStrictly"
 				>
 				</el-tree-select>
 			</el-col>
@@ -52,6 +53,8 @@
 				v-loading="state.loading"
 				highlight-current
 				@node-click="nodeClickDialog"
+				:check-strictly="props.checkStrictly"
+				:expand-on-click-node="false"
 			>
 			</el-tree>
 		</el-scrollbar>
@@ -91,6 +94,10 @@ const props = defineProps({
 		type: Boolean,
 		default: false,
 	},
+	checkStrictly: {
+		type: Boolean,
+		default: false,
+	},
 } as any);
 const emit = defineEmits(['update:modelValue', 'update:externalArr', 'change']);
 const internalValue = computed({
@@ -173,13 +180,19 @@ const resetQuery = (formEl: FormInstance | undefined) => {
 };
 const tableRadio = ref();
 const nodeClickDialog = (val: any, node: any) => {
-	if (node.isLeaf) {
+	if(props.checkStrictly){ // 可以选择任意一级
 		tableRadio.value = val.id;
 		externalArr.value = getParentId(node, externalArr.value);
 		emit('change', val, node, externalArr.value);
-	} else {
-		tableRadio.value = null;
-		externalArr.value = [];
+	}else{
+		if (node.isLeaf) {
+			tableRadio.value = val.id;
+			externalArr.value = getParentId(node, externalArr.value);
+			emit('change', val, node, externalArr.value);
+		} else {
+			tableRadio.value = null;
+			externalArr.value = [];
+		}
 	}
 };
 const onSave = () => {

+ 20 - 5
src/components/Hotspot/index.vue

@@ -21,6 +21,7 @@
 					:clearable="props.clearable"
 					highlight-current
 					@clear="clear"
+					:check-strictly="props.checkStrictly"
 				>
 				</el-tree-select>
 			</el-col>
@@ -52,6 +53,8 @@
 				v-loading="state.loading"
 				highlight-current
 				@node-click="nodeClickDialog"
+				:check-strictly="props.checkStrictly"
+				:expand-on-click-node="false"
 			>
 			</el-tree>
 		</el-scrollbar>
@@ -91,6 +94,11 @@ const props = defineProps({
 		type: Boolean,
 		default: false,
 	},
+	checkStrictly: {
+		// 选择任意一级
+		type: Boolean,
+		default: false,
+	},
 } as any);
 const emit = defineEmits(['update:modelValue', 'update:externalArr', 'change', 'getCurrentData']);
 const internalValue = computed({
@@ -176,23 +184,30 @@ const resetQuery = (formEl: FormInstance | undefined) => {
 };
 const tableRadio = ref();
 const nodeClickDialog = (val: any, node: any) => {
-	if (node.isLeaf) {
+	if (props.checkStrictly) {
+		// 可以选择任意一级
 		tableRadio.value = val.id;
 		externalArr.value = getParentId(node, externalArr.value);
 		emit('change', val, node, externalArr.value);
 	} else {
-		tableRadio.value = null;
-		externalArr.value = [];
+		if (node.isLeaf) {
+			tableRadio.value = val.id;
+			externalArr.value = getParentId(node, externalArr.value);
+			emit('change', val, node, externalArr.value);
+		} else {
+			tableRadio.value = null;
+			externalArr.value = [];
+		}
 	}
 };
 const onSave = () => {
 	internalValue.value = tableRadio.value;
 	dialogVisible.value = false;
 };
-const clear = ()=>{
+const clear = () => {
 	internalValue.value = null;
 	emit('change', null, null, []);
-}
+};
 defineExpose({});
 </script>
 <style scoped lang="scss">

+ 3 - 1
src/views/auxiliary/eventClass/component/Event-add.vue

@@ -13,12 +13,13 @@
 					</el-form-item>
 				</el-col>
         <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
-          <el-form-item label="事件分类" prop="parentId" :rules="[{ required: true, message: '请选择上级事件', trigger: 'change' }]">
+          <el-form-item label="事件分类" prop="parentId" :rules="[{ required: false, message: '请选择上级事件', trigger: 'change' }]">
             <event-select
                 v-model="state.ruleForm.parentId"
                 v-model:externalArr="state.eventCategoryExternal"
                 placeholder="请选择上级事件"
                 clearable
+								checkStrictly
             />
           </el-form-item>
         </el-col>
@@ -82,6 +83,7 @@ const onSubmit = (formEl: FormInstance | undefined) => {
 			.catch(() => {
 				emit('updateList');
 				state.loading = false;
+				closeDialog();
 			});
 	});
 };

+ 1 - 0
src/views/auxiliary/eventClass/component/Event-edit.vue

@@ -69,6 +69,7 @@ const onSubmit = (formEl: FormInstance | undefined) => {
 			.catch(() => {
 				emit('updateList');
 				state.loading = false;
+				closeDialog();
 			});
 	});
 };

+ 21 - 19
src/views/auxiliary/eventClass/index.vue

@@ -40,14 +40,14 @@
 						v-model:expanded-row-keys="state.expandedRowKeys"
 						:columns="state.columns"
 						:data="state.tableData"
-						expand-column-key="eventFullName"
+						expand-column-key="eventName"
 						fixed
 						:width="width"
 						:height="height"
 						ref="virtuallyTableRef"
-            :scrollbar-always-on="true"
-            :row-height="40"
-            :header-height="40"
+						:scrollbar-always-on="true"
+						:row-height="40"
+						:header-height="40"
 					>
 					</el-table-v2>
 				</template>
@@ -67,7 +67,6 @@ import { throttle } from '@/utils/tools';
 import other from '@/utils/other';
 import { treeEventClassAll, treeEventClassDelete } from '@/api/auxiliary/eventClass';
 import { auth } from '@/utils/authFunction';
-import { useResizeObserver } from '@vueuse/core';
 // 引入组件
 const EventAdd = defineAsyncComponent(() => import('@/views/auxiliary/eventClass/component/Event-add.vue')); // 新增事件
 const EventEdit = defineAsyncComponent(() => import('@/views/auxiliary/eventClass/component/Event-edit.vue')); // 修改事件
@@ -189,8 +188,8 @@ const state = reactive<any>({
 			},
 		},
 		{
-			key: 'eventFullName',
-			dataKey: 'eventFullName',
+			key: 'eventName',
+			dataKey: 'eventName',
 			title: '区域名称',
 			width: 600,
 		},
@@ -221,10 +220,13 @@ const state = reactive<any>({
 			title: '操作',
 			width: 100,
 			cellRenderer: (data: any) => {
-				return (
-					auth('auxiliary:eventClass:edit') ?
-					<el-button link type="primary" onClick={() => onEdit(data)}>修改</el-button> : ''
-				)
+				return auth('auxiliary:eventClass:edit') ? (
+					<el-button link type="primary" onClick={() => onEdit(data)}>
+						修改
+					</el-button>
+				) : (
+					''
+				);
 			},
 		},
 	],
@@ -236,7 +238,7 @@ const formatTable = (list: any[], keyword: string) => {
 	if (!list.length || !Array.isArray(list)) return [];
 	let emptyArr: any[] = [];
 	list.map((item) => {
-		if (item.eventFullName.includes(keyword)) {
+		if (item.eventName.includes(keyword)) {
 			if (item.children && Array.isArray(item.children) && item.children.length > 0) {
 				item.children = formatTable(item.children, keyword);
 			}
@@ -331,7 +333,7 @@ const getNames = (arr: any) => {
 	if (!arr) return [];
 	arr.forEach((v: any) => {
 		if (v.checked) {
-			names.value.push(v.eventFullName);
+			names.value.push(v.eventName);
 		}
 		if (v.children?.length) {
 			getNames(v.children);
@@ -347,10 +349,10 @@ const onDelete = () => {
 	ElMessageBox.confirm(`此操作将永久删除选择的【${idArray.value.length}】个事件, 是否继续?`, '提示', {
 		confirmButtonText: '确定',
 		cancelButtonText: '取消',
-    type: 'warning',
-    draggable: true,
-    cancelButtonClass: 'default-button',
-    autofocus: false,
+		type: 'warning',
+		draggable: true,
+		cancelButtonClass: 'default-button',
+		autofocus: false,
 	})
 		.then(() => {
 			treeEventClassDelete(idArray.value).then(() => {
@@ -376,9 +378,9 @@ const queryList = async () => {
 };
 // 修改
 const eventEditRef = ref<RefType>();
-const onEdit = (data:any)=>{
+const onEdit = (data: any) => {
 	eventEditRef.value.openDialog(data.rowData);
-}
+};
 // 页面加载时
 onMounted(() => {
 	queryList();

+ 1 - 0
src/views/business/order/index.vue

@@ -696,6 +696,7 @@ const queryList = (isQuery: boolean = false) => {
 			})
 			.catch(() => {
 				state.loading = false;
+				totalLoading.value = false;
 			});
 	}
 };