Browse Source

锚点另一端设备过滤

zhaoyk 3 years ago
parent
commit
3cd064f520

+ 4 - 0
adm_comp/src/lib/DiagramModel.ts

@@ -199,6 +199,10 @@ export class Anchor {
 	
 	acceptRelations: Array<string>
 
+	toEquipmentTypes: Array<string>
+	
+	toDataFilter: DataFilter;
+
 	attachToOutline: boolean = true;
 	
 	multiple: boolean;

+ 6 - 1
adm_comp/src/lib/LegendEditor.ts

@@ -301,9 +301,14 @@ export class LegendEditor extends Editor{
 				if(this.focusAnchor.name)
 					info += '    ' + this.focusAnchor.name;
 				if(this.focusAnchor.multiple)
-					info += '    动态数量锚点';
+					info += '    动态数量';
 				if(this.focusAnchor.acceptRelations && this.focusAnchor.acceptRelations.length > 0)
 					info += '    ' + this.focusAnchor.acceptRelations;
+				if(this.focusAnchor.toEquipmentTypes && this.focusAnchor.toEquipmentTypes.length > 0){
+					info += '  --  ' + this.focusAnchor.toEquipmentTypes;
+					if(this.focusAnchor.toDataFilter)
+						info += ViewTool.filterToStr(this.focusAnchor.toDataFilter);
+				}
 			}
 			this.editorPart.dynInfo = info;
 		}

+ 30 - 7
adm_comp/src/views/DiagramLegend.vue

@@ -162,7 +162,7 @@
 						  v-model="propsData.toEquipmentTypes"
 						  multiple 
 						  placeholder="设备类型,输入名称或代码搜索"
-						  style="width: 600px;"
+						  style="width: 400px;"
 						  filterable
 						  remote
 						  :remote-method="queryEquipTypes"
@@ -175,6 +175,10 @@
 						  </el-option>
 						</el-select>
 					</el-form-item>
+					<el-form-item label="连线另一端设备过滤">
+						<el-input v-model="propsData.toDataFilterStr" :disabled="true" style="width: 400px;"></el-input>
+						&nbsp;<el-button size="mini" @click.prevent="editFilter1()">过滤条件</el-button>
+					</el-form-item>
 				</el-form>
 			</div>
 			
@@ -206,6 +210,7 @@
 	} from "vue-property-decorator";
 	import FilterPanel from '@/components/FilterPanel.vue';
 	import {LegendEditor} from '@/lib/LegendEditor';
+	import {ViewTool} from '@/lib/UIUtils';
 
 	@Component({components:{FilterPanel}})
 	export default class DiagramLegend extends Vue {
@@ -406,6 +411,8 @@
 					}
 				}
 				props.toEquipmentTypes = sel.toEquipmentTypes;
+				props.toDataFilter = sel.toDataFilter;
+				props.toDataFilterStr = ViewTool.filterToStr(props.toDataFilter);
 				
 				this.propsData = props;
 				this.dlgAnchorVisible = true;
@@ -457,7 +464,7 @@
 			
 			this.dlgFilterVisible = true;
 		}
-		
+
 		//修改数据匹配过滤条件
 		modifyFilter(){
 			var filter = (this.$refs.filterPanel as FilterPanel).buildFilter();
@@ -469,13 +476,20 @@
 				return;
 			}
 			
-			const legend = this.editor.getSelComp();
-			legend.dataFilter = filter;
+			if(this.currentAnchor) {
+				//锚点另一端设备过滤
+				this.propsData.toDataFilter = filter;
+				this.propsData.toDataFilterStr = ViewTool.filterToStr(filter);
+			} else {
+				const legend = this.editor.getSelComp();
+				legend.dataFilter = filter;
+				
+				this.editor.redraw();
+				
+				this.saveLegend();
+			}
 			
 			this.dlgFilterVisible = false;
-			this.editor.redraw();
-			
-			this.saveLegend();
 		}
 		
 		//编辑锚点信息
@@ -484,6 +498,13 @@
 			this.setProps('anchor');
 		}
 		
+		//编辑锚点另一端设备的过滤条件
+		editFilter1(){
+			this.dataFilter = this.propsData.toDataFilter != null ? this.propsData.toDataFilter : {};
+			
+			this.dlgFilterVisible = true;
+		}
+		
 		//修改锚点信息
 		modifyAnchor(){
 			this.currentAnchor.name = this.propsData.name;
@@ -499,6 +520,8 @@
 			}
 			this.currentAnchor.toEquipmentTypes = this.propsData.toEquipmentTypes;
 			
+			this.currentAnchor.toDataFilter = this.propsData.toDataFilter;
+			
 			this.dlgAnchorVisible = false;
 			this.editor.redraw();