| | |
| | | export default { |
| | | // workstates: ["å¨çº¿æµ®å
","é¢å
çµ","æ ¸å®¹æµè¯","åçµæ¾çµ","å
黿µè¯","K1/D1æµè¯", '离线å
»æ¤æµè¯', 'æªç¥'], |
| | | workstates: ["忢", "æåæ¾çµ", "æ¾çµæµè¯", "æåå
çµ", "æ£å¨å
çµ"], |
| | | // alarmstates: ["ç»§çµå¨K1åè¦","é讯åè¦","设å¤è¿æ¸©åè¦","äºæç®¡D1åè¦"], |
| | | // stopreasons: { |
| | | // 0:'è®¾å¤æçµ',1:'æå¨ç»æ¢',2:'æ¾çµæ¶é´å°',3:'æ¾çµå®¹éå°',4:'åä½çµåä¸éå°',5:'å使¸©åº¦ä¸éå°',6:'ç»ç«¯çµåä¸éå°', |
| | |
| | | ], |
| | | // æ¾çµå°æ¶ç |
| | | HourRate: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20], |
| | | // ææµæ»é¶æ®µæ° |
| | | flowOverCount: [1, 2, 3], |
| | | dischargeRules: { |
| | | //æµ®å
çµå(V) |
| | | AutoTestStartVol: { |
| | |
| | | pattern: /^[0-9]{1,4}$/, |
| | | regVal: true, |
| | | min: 1, |
| | | max: 2000, |
| | | msg: 'åå¼èå´1~2000ï¼æ´æ°ï¼' |
| | | max: 9999, |
| | | msg: 'åå¼èå´1~9999ï¼æ´æ°ï¼' |
| | | }, |
| | | // æ¾çµçµæµ |
| | | DisCurr: { |
| | | pattern: /^[0-9]{1,3}$/, |
| | | regVal: true, |
| | | min: 1, |
| | | max: 300, |
| | | msg: 'åå¼èå´1~300ï¼æ´æ°ï¼' |
| | | max: 150, |
| | | msg: 'åå¼èå´1~150ï¼æ´æ°ï¼' |
| | | }, |
| | | //颿¾åç |
| | | DisPower: { |
| | | pattern: /^[0-9]{1,3}$/, |
| | | pattern: /^[0-9]{1}(\.[0-9]{0,1})?$/, |
| | | regVal: true, |
| | | min: 1, |
| | | max: 300, |
| | | msg: 'åå¼èå´1~300ï¼æ´æ°ï¼' |
| | | min: 0, |
| | | max: 7.5, |
| | | msg: 'åå¼èå´0~7.5 (ä¿çä¸ä½å°æ°)' |
| | | }, |
| | | //æ¾çµé»å¼ |
| | | DisPreRes: { |
| | | pattern: /^[0-9]{1,3}$/, |
| | | pattern: /^[0-9]{1,3}(\.[0-9]{0,2})?$/, |
| | | regVal: true, |
| | | min: 1, |
| | | max: 300, |
| | | msg: 'åå¼èå´1~300ï¼æ´æ°ï¼' |
| | | min: 0.05, |
| | | max: 655, |
| | | msg: 'åå¼èå´0.05~655ï¼ä¿ç两ä½å°æ°ï¼' |
| | | }, |
| | | //æ¾çµæ¶é¿ |
| | | DisTime: { |
| | | pattern: /^[0-9]{1,3}$/, |
| | | regVal: true, |
| | | min: 1, |
| | | min: 0, |
| | | max: 500, |
| | | msg: 'åå¼èå´1~500ï¼æ´æ°ï¼' |
| | | msg: 'åå¼èå´0~500ï¼æ´æ°ï¼' |
| | | }, |
| | | //å
å®éç½® |
| | | DisWaitTime: { |
| | | pattern: /^[0-9]{1,3}$/, |
| | | regVal: true, |
| | | min: 1, |
| | | min: 0, |
| | | max: 500, |
| | | msg: 'åå¼èå´1~500ï¼æ´æ°ï¼' |
| | | msg: 'åå¼èå´0~500ï¼æ´æ°ï¼' |
| | | }, |
| | | //æµ®å
æ¶é¿ |
| | | FloatCharTimeLong: { |
| | | pattern: /^[0-9]{1,3}$/, |
| | | regVal: true, |
| | | min: 1, |
| | | max: 300, |
| | | msg: 'åå¼èå´1~300ï¼æ´æ°ï¼' |
| | | }, |
| | | // //æµ®å
æ¶é¿ |
| | | // FloatCharTimeLong: { |
| | | // pattern: /^[0-9]{1,3}$/, |
| | | // regVal: true, |
| | | // min: 1, |
| | | // max: 300, |
| | | // msg: 'åå¼èå´1~300ï¼æ´æ°ï¼' |
| | | // }, |
| | | //ç»ç«¯ä¸é |
| | | GroupVol_Low: { |
| | | pattern: /^[0-9]+(\.[0-9]{0,1})?$/, |
| | | regVal: true, |
| | | min: 43, |
| | | max: 54, |
| | | msg: 'åå¼èå´43.0~54.0' |
| | | min: 1, |
| | | max: 285, |
| | | msg: 'åå¼èå´1~285' |
| | | }, |
| | | //åä½ä¸é |
| | | MonVolHightLimit: { |
| | | pattern: /^[0-9]{1,3}$/, |
| | | pattern: /^[0-9]{1,2}(\.[0-9]{0,2})?$/, |
| | | regVal: true, |
| | | min: 1, |
| | | max: 300, |
| | | msg: 'åå¼èå´1~300ï¼æ´æ°ï¼' |
| | | max: 16, |
| | | msg: 'åå¼èå´1~16ï¼ä¿ç两ä½å°æ°ï¼' |
| | | }, |
| | | //åä½ä¸éæ°é |
| | | MonVolHightLimitCount: { |
| | |
| | | MonomerLowCount: { |
| | | pattern: /^[0-9]{1,3}$/, |
| | | regVal: true, |
| | | min: 0, |
| | | min: 1, |
| | | max: 240, |
| | | msg: 'åå¼èå´0~240ï¼æ´æ°ï¼' |
| | | }, |
| | |
| | | MonomerVol_Low: { |
| | | pattern: /^[0-9]{1,2}(\.[0-9]{0,2})?$/, |
| | | regVal: true, |
| | | min: 1.8, |
| | | max: 2.25, |
| | | msg: 'åå¼èå´1.80~2.25ï¼ä¿ç两ä½å°æ°ï¼' |
| | | min: 0, |
| | | max: 20, |
| | | msg: 'åå¼èå´0~20ï¼ä¿ç两ä½å°æ°ï¼' |
| | | }, |
| | | //æ´»åæ¬¡æ° |
| | | OffLineYHTimes: { |
| | |
| | | pattern: /^[0-9]{1,3}$/, |
| | | regVal: true, |
| | | min: 1, |
| | | max: 125, |
| | | msg: 'åå¼èå´1~125ï¼æ´æ°ï¼' |
| | | max: 285, |
| | | msg: 'åå¼èå´1~285ï¼æ´æ°ï¼' |
| | | } |
| | | }, |
| | | // stateList: [ |
| | | // { |
| | | // id: 1, |
| | | // name: "workState", |
| | | // type: "", |
| | | // icon: "", |
| | | // text: "设å¤å·¥ä½ç¶æï¼", |
| | | // value: "å¨çº¿æµ®å
", |
| | | // show: false |
| | | // }, |
| | | // { |
| | | // id: 2, |
| | | // name: "connect", |
| | | // type: "", |
| | | // icon: "el-icon-tongxun", |
| | | // text: "设å¤é讯ï¼", |
| | | // value: "æ£å¸¸", |
| | | // show: false |
| | | // }, |
| | | // { |
| | | // id: 3, |
| | | // name: "devTemp", |
| | | // type: "", |
| | | // icon: "el-icon-wendu", |
| | | // text: "è®¾å¤æ¸©åº¦ï¼", |
| | | // value: "æ£å¸¸", |
| | | // show: false |
| | | // }, |
| | | // { |
| | | // id: 4, |
| | | // name: "contact", |
| | | // type: "", |
| | | // icon: "el-icon-fenxiang", |
| | | // text: "å¹²æ¥ç¹ï¼", |
| | | // value: "æ£å¸¸", |
| | | // show: false |
| | | // }, |
| | | // { |
| | | // id: 5, |
| | | // name: "stopReason", |
| | | // type: "", |
| | | // icon: "", |
| | | // text: "æ ¸å®¹ç»æ¢åå ï¼", |
| | | // value: "æªç¥", |
| | | // show: false |
| | | // }, |
| | | // { |
| | | // id: 6, |
| | | // name: "failReason", |
| | | // type: "", |
| | | // icon: "", |
| | | // text: "æä½å¤±è´¥åå ï¼", |
| | | // value: "æªç¥", |
| | | // show: false |
| | | // }, |
| | | // { |
| | | // id: 7, |
| | | // name: "resDay", |
| | | // type: "", |
| | | // icon: "", |
| | | // text: "å©ä½å¤©æ°ï¼", |
| | | // value: "0", |
| | | // notShow: true, |
| | | // show: false |
| | | // }, |
| | | // { |
| | | // id: 8, |
| | | // name: "workMode", |
| | | // type: "", |
| | | // icon: "", |
| | | // text: "工使¨¡å¼ï¼", |
| | | // value: "忢", |
| | | // notShow: true, |
| | | // show: false |
| | | // }, |
| | | // { |
| | | // id: 9, |
| | | // name: "groupVol", |
| | | // type: "", |
| | | // icon: "", |
| | | // text: "ç»ç«¯çµåï¼", |
| | | // value: "0", |
| | | // unit: "V", |
| | | // notShow: true, |
| | | // show: false |
| | | // }, |
| | | // { |
| | | // id: 10, |
| | | // name: "peakVol", |
| | | // type: "", |
| | | // icon: "", |
| | | // text: "å³°å¼çµåï¼", |
| | | // value: "0", |
| | | // unit: "V", |
| | | // notShow: true, |
| | | // show: false |
| | | // } |
| | | // ], |
| | | stateList: [ |
| | | { |
| | | id: 1, |
| | | name: "workState", |
| | | type: "", |
| | | icon: "", |
| | | text: "设å¤å·¥ä½ç¶æï¼", |
| | | value: "å¨çº¿æµ®å
", |
| | | show: false |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: "connect", |
| | | type: "", |
| | | icon: "el-icon-tongxun", |
| | | text: "设å¤é讯ï¼", |
| | | value: "æ£å¸¸", |
| | | show: false |
| | | }, |
| | | { |
| | | id: 3, |
| | | name: "devTemp", |
| | | type: "", |
| | | icon: "el-icon-wendu", |
| | | text: "è®¾å¤æ¸©åº¦ï¼", |
| | | value: "æ£å¸¸", |
| | | show: false |
| | | }, |
| | | { |
| | | id: 4, |
| | | name: "contact", |
| | | type: "", |
| | | icon: "el-icon-fenxiang", |
| | | text: "å¹²æ¥ç¹ï¼", |
| | | value: "æ£å¸¸", |
| | | show: false |
| | | }, |
| | | { |
| | | id: 5, |
| | | name: "stopReason", |
| | | type: "", |
| | | icon: "", |
| | | text: "æ ¸å®¹ç»æ¢åå ï¼", |
| | | value: "æªç¥", |
| | | show: false |
| | | }, |
| | | { |
| | | id: 6, |
| | | name: "failReason", |
| | | type: "", |
| | | icon: "", |
| | | text: "æä½å¤±è´¥åå ï¼", |
| | | value: "æªç¥", |
| | | show: false |
| | | }, |
| | | { |
| | | id: 7, |
| | | name: "resDay", |
| | | type: "", |
| | | icon: "", |
| | | text: "å©ä½å¤©æ°ï¼", |
| | | value: "0", |
| | | notShow: true, |
| | | show: false |
| | | }, |
| | | { |
| | | id: 8, |
| | | name: "workMode", |
| | | type: "", |
| | | icon: "", |
| | | text: "工使¨¡å¼ï¼", |
| | | value: "忢", |
| | | notShow: true, |
| | | show: false |
| | | }, |
| | | { |
| | | id: 9, |
| | | name: "groupVol", |
| | | type: "", |
| | | icon: "", |
| | | text: "ç»ç«¯çµåï¼", |
| | | value: "0", |
| | | unit: "V", |
| | | notShow: true, |
| | | show: false |
| | | }, |
| | | { |
| | | id: 10, |
| | | name: "peakVol", |
| | | type: "", |
| | | icon: "", |
| | | text: "å³°å¼çµåï¼", |
| | | value: "0", |
| | | unit: "V", |
| | | notShow: true, |
| | | show: false |
| | | } |
| | | ], |
| | | // getItemByName(name, list) { |
| | | // let result = false; |
| | | // for(let i=0; i<list.length; i++) { |
| | |
| | | this.workState = false; |
| | | }; |
| | | |
| | | // 设置循ç¯ä½ ä½ä¸å¼å§ |
| | | Timeout.prototype.init = function (callback, time) { |
| | | this.callback = callback; |
| | | this.time = time; |
| | | this.workState = true; |
| | | }; |
| | | |
| | | // å
³éåéå¯è®¡æ¶å¨ |
| | | Timeout.prototype.restart = function() { |
| | | this.workState = true; |
| | | this.open(); |
| | | }; |
| | | |
| | | export default Timeout; |
New file |
| | |
| | | <template> |
| | | <div class="contain"> |
| | | <!-- canvas --> |
| | | <!-- è°è¯æ¨¡å¼æ¶ æ¾ç¤ºååæ ååæ å®ä½ æµ®çªæ¾ç¤ºæ¾å¤§ç»è ç¹å»å
ç´ ï¼æå°å
ç´ å¯¹è±¡ä¿¡æ¯ --> |
| | | <div class="main"> |
| | | <div class="tools-handle" |
| | | v-if="debug" |
| | | @click="showDebug = !showDebug" |
| | | >•••</div> |
| | | <div class="tools" v-show="showDebug"> |
| | | <!-- æ¾ç¤ºé¼ æ åå线 --> |
| | | <div class="btn" :class="{'active': showCross}" @click="showCrossClick">ååæ </div> |
| | | <div class="btn" :class="{active: setCross}" @click="setCrossClick">åæ å®ä½</div> |
| | | </div> |
| | | <div class="wraper" ref="wraper"> |
| | | <div class="canvas-container" |
| | | :class="canvasWrapClass" |
| | | ref="can" |
| | | :style="canvasStyle" |
| | | @click="wrapClick" |
| | | > |
| | | <canvas |
| | | v-for="(item, idx) in levelArr" |
| | | :key="'level_' + idx" |
| | | :width="width" |
| | | :height="height" |
| | | :ref="item"></canvas> |
| | | <!-- <canvas |
| | | :width="width" |
| | | :height="height" |
| | | ref="stateL"></canvas> |
| | | <canvas |
| | | :width="width" |
| | | :height="height" |
| | | ref="flushL"></canvas> |
| | | <slot></slot> --> |
| | | </div> |
| | | <!-- <canvas ref='can' |
| | | class="can" |
| | | :width="width" |
| | | :height="height" |
| | | ></canvas> --> |
| | | <!-- é¼ æ åç¹ååå
æ --> |
| | | <div :class="['line-h', {'hide': !showCross && !setCross}]" :style="{left: 0, top: crossTop}"></div> |
| | | <div :class="['line-v', {'hide': !showCross && !setCross}]" :style="{left: crossLeft, top: 0}"></div> |
| | | |
| | | <div class="pos_contain" :style="canvasStyle"> |
| | | <slot></slot> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- é¼ æ åcanvasåæ --> |
| | | <div :class="['mouseInfo', {'hide': !showCross}]" :style="posObj"> |
| | | é¼ æ åç¹xåæ :<span>{{pointX}}</span><br /> |
| | | é¼ æ åç¹yåæ :<span>{{pointY}}</span> |
| | | </div> |
| | | <!-- åæ å®ä½ --> |
| | | <div :class="['setInfo', {'hide': !setCross}]" :style="posObj"> |
| | | xåæ : <input type="text" v-model="inputX"><div class="_btn" @click="sub('inputX')">-</div><div class="_btn" @click="add('inputX')">+</div><br /> |
| | | yåæ : <input type="text" v-model="inputY"><div class="_btn" @click="sub('inputY')">-</div><div class="_btn" @click="add('inputY')">+</div> |
| | | </div> |
| | | <!-- æ¾å¤§é --> |
| | | <div :class="['magnify', {'hide': !showCross && !setCross}]" :style="[posObj, bgObj]"></div> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | // import Draw from './js/draw'; |
| | | |
| | | import common from './js/common'; |
| | | let { |
| | | transSize |
| | | ,throttle |
| | | } = common; |
| | | |
| | | export default { |
| | | gridWidth: 10 |
| | | ,lineWidth: 4 |
| | | ,strokeStyle: '#00f7f9' |
| | | // 离å±canvas |
| | | ,offscreenCanvas: null |
| | | ,dataTransfer: null |
| | | // ç»å¸çcss尺寸 |
| | | ,canvasW: 0 |
| | | ,canvasH: 0 |
| | | // éæå±çbase64å¾ è°è¯ç¨ä½æ¾å¤§éå¾ |
| | | ,canvasImg: '' |
| | | ,props: { |
| | | width: { |
| | | type: Number |
| | | ,default: 1800 |
| | | } |
| | | ,height: { |
| | | type: Number |
| | | ,default: 880 |
| | | } |
| | | ,debug: { |
| | | type: Boolean |
| | | ,default: false |
| | | } |
| | | ,wrapClass: { |
| | | type: [String, Array] |
| | | ,default: '' |
| | | } |
| | | ,levelArr: { |
| | | type: Array |
| | | ,default () { |
| | | return ['staticL']; |
| | | } |
| | | } |
| | | // |
| | | ,hasFlush: { |
| | | type: Boolean |
| | | ,default: false |
| | | } |
| | | } |
| | | ,data() { |
| | | return { |
| | | // æ¯å¦æ¾ç¤ºè°è¯å·¥å
· |
| | | showDebug: false |
| | | ,posObj: { |
| | | left: 'auto' |
| | | ,right: 'auto' |
| | | ,top: 'auto' |
| | | ,bottom: 'auto' |
| | | ,'--trans': 90 + 'px' |
| | | } |
| | | ,testSrc: '' |
| | | ,isMounted: false |
| | | ,resizeF: false |
| | | ,ratio: 1 |
| | | // æ¯å¦æ¾ç¤ºé¼ æ åå线 è°è¯ç¨ |
| | | ,showCross: false |
| | | ,setCross: false |
| | | // æ¯å¦èªç±ç»çº¿ é»è®¤ä¸ºfalse |
| | | // ,freeLine: false |
| | | // canvaséç对象æ¯å¦å¯æå¨ |
| | | // ,canvas_dragable: true |
| | | // canvas ä¸è¢«é䏿æ½ç对象 |
| | | // ,canvas_select_obj: null |
| | | // å½åcanvas_obj_id |
| | | // ,canvas_select_obj_id: false |
| | | // ç¹å»ä½ç½®ç¸å¯¹å¯¹è±¡çåç§» |
| | | // ,offsetX: 0 |
| | | // ,offsetY: 0 |
| | | // ç»å¸ä¸é¼ æ åæ |
| | | // ,mouseX: 0 |
| | | // ,mouseY: 0 |
| | | // è°è¯ç¨ç é¼ æ ç¹åçcanvasåæ |
| | | ,pointX: 0 |
| | | ,pointY: 0 |
| | | // è¾å
¥åæ å®ä½ |
| | | ,inputX: 0 |
| | | ,inputY: 0 |
| | | ,mouseTop: 0 |
| | | ,mouseLeft: 0 |
| | | }; |
| | | } |
| | | ,computed: { |
| | | wrapWidth: { |
| | | get () { |
| | | // æ·»å 便 |
| | | this.resizeF; |
| | | if (this.isMounted) { |
| | | let rect = this.$refs.wraper.getBoundingClientRect(); |
| | | // console.log(rect, '00000'); |
| | | return rect.width; |
| | | } else { |
| | | return 0; |
| | | } |
| | | } |
| | | } |
| | | ,wrapHeight () { |
| | | // æ·»å 便 |
| | | this.resizeF; |
| | | if (this.isMounted) { |
| | | let rect = this.$refs.wraper.getBoundingClientRect(); |
| | | // console.log(rect, '00000'); |
| | | return rect.height; |
| | | } else { |
| | | return 0; |
| | | } |
| | | } |
| | | ,canvasStyle () { |
| | | if (!this.isMounted) return {}; |
| | | let obj = transSize( |
| | | this.wrapWidth, |
| | | this.wrapHeight |
| | | ,this.width |
| | | ,this.height |
| | | ,{ |
| | | width: this.width |
| | | ,height: this.height |
| | | ,left: 0 |
| | | ,top: 0 |
| | | ,right: 0 |
| | | ,bottom: 0 |
| | | }); |
| | | // console.log(obj, '=='); |
| | | return { |
| | | width: obj.width + 'px' |
| | | ,height: obj.height + 'px' |
| | | } |
| | | } |
| | | // æ¾å¤§éèæ¯ |
| | | ,bgObj () { |
| | | let res = {}; |
| | | if (this.isMounted && this.debug) { |
| | | // console.log(this.$refs[this.levelArr[0]][0].toDataURL()); |
| | | // debugger; |
| | | res.backgroundImage = 'url(' + this.$refs[this.levelArr[0]][0].toDataURL() + ')'; |
| | | res.backgroundPosition = (this.pointX * 2 - 100) * -1 + 'px ' + (this.pointY * 2 - 100) * -1 + 'px'; |
| | | res.backgroundSize = this.width * 2 + 'px ' + this.height * 2 + 'px'; |
| | | } |
| | | return res; |
| | | } |
| | | // obj set |
| | | ,transObj: { |
| | | get () { |
| | | return null; |
| | | } |
| | | ,set (val) { |
| | | // console.log('transObj set', val); |
| | | this.ratio = val.width / this.width; |
| | | this.$emit('ratioChanged', this.ratio); |
| | | // $can && $can.setRatio(this.ratio); |
| | | |
| | | this.recycleStyle = { |
| | | // width: val.width + 'px' |
| | | height: val.height + 'px' |
| | | ,left: (this.wrapWidth - val.width) / 2 + 'px' |
| | | }; |
| | | |
| | | this.$options.canvasW = val.width; |
| | | this.$options.canvasH = val.height; |
| | | // console.log(this.ratio, 'ratio'); |
| | | } |
| | | } |
| | | ,crossLeft () { |
| | | return this.mouseLeft + (this.wrapWidth - this.$options.canvasW) / 2 + 'px'; |
| | | } |
| | | ,crossTop () { |
| | | return this.mouseTop + (this.wrapHeight - this.$options.canvasH) / 2 + 'px'; |
| | | } |
| | | ,canvasWrapClass () { |
| | | if ('string' == typeof(this.wrapClass)) { |
| | | return this.wrapClass.split(/\s+/); |
| | | } else { |
| | | return this.wrapClass; |
| | | } |
| | | } |
| | | } |
| | | ,watch: { |
| | | wrapWidth (n) { |
| | | if (n) { |
| | | this.transObj = transSize( |
| | | this.wrapWidth, |
| | | this.wrapHeight |
| | | ,this.width |
| | | ,this.height |
| | | ,{ |
| | | width: this.width |
| | | ,height: this.height |
| | | ,left: 0 |
| | | ,top: 0 |
| | | ,right: 0 |
| | | ,bottom: 0 |
| | | }); |
| | | } |
| | | } |
| | | ,wrapHeight (n) { |
| | | if (n) { |
| | | this.transObj = transSize( |
| | | this.wrapWidth, |
| | | this.wrapHeight |
| | | ,this.width |
| | | ,this.height |
| | | ,{ |
| | | width: this.width |
| | | ,height: this.height |
| | | ,left: 0 |
| | | ,top: 0 |
| | | ,right: 0 |
| | | ,bottom: 0 |
| | | }); |
| | | } |
| | | } |
| | | // ,canvas_select_obj (n) { |
| | | // // console.log($can, 'select changed'); |
| | | // if (n) { |
| | | // this.canvas_select_obj_id = n.id; |
| | | // $can && $can.setSelectedId(n.id); |
| | | // } else { |
| | | // this.canvas_select_obj_id = false; |
| | | // $can && $can.setSelectedId(-1); |
| | | // } |
| | | // } |
| | | ,inputX (n) { |
| | | this.mouseLeft = n * this.ratio; |
| | | this.pointX = n * 1; |
| | | if (!this.debug) { |
| | | return false; |
| | | } |
| | | if (n < this.width / 2) { |
| | | this.posObj.left = 'auto'; |
| | | this.posObj.right = 20 + 'px'; |
| | | } else { |
| | | this.posObj.right = 'auto'; |
| | | this.posObj.left = 20 + 'px'; |
| | | } |
| | | } |
| | | ,inputY (n) { |
| | | this.mouseTop = n * this.ratio; |
| | | this.pointY = n * 1; |
| | | if (!this.debug) { |
| | | return false; |
| | | } |
| | | if (n < this.height / 2) { |
| | | this.posObj.top = 'auto'; |
| | | this.posObj.bottom = 20 + 'px'; |
| | | this.posObj['--trans'] = -90 + 'px'; |
| | | } else { |
| | | this.posObj.bottom = 'auto'; |
| | | this.posObj.top = 20 + 'px'; |
| | | this.posObj['--trans'] = 90 + 'px'; |
| | | } |
| | | } |
| | | } |
| | | ,methods: { |
| | | resizeHandle () { |
| | | this.resizeF = !this.resizeF; |
| | | } |
| | | ,showCrossClick () { |
| | | this.setCross = false; |
| | | this.showCross = !this.showCross; |
| | | } |
| | | ,setCrossClick () { |
| | | this.showCross = false; |
| | | this.setCross = !this.setCross; |
| | | this.inputX = 0; |
| | | this.inputY = 0; |
| | | } |
| | | ,canvasMouseMoveHandle (e) { |
| | | if (this.showCross) { |
| | | this.pointX = Math.round(e.offsetX / this.ratio); |
| | | this.pointY = Math.round(e.offsetY / this.ratio); |
| | | |
| | | // this.mouseLeft = Math.round(e.offsetX / this.ratio); |
| | | // this.mouseTop = Math.round(e.offsetY / this.ratio); |
| | | this.mouseTop = e.offsetY; |
| | | this.mouseLeft = e.offsetX; |
| | | |
| | | // // é¼ æ å¨ç»å¸ç第1象é å®ä½å¨ç¬¬3象é |
| | | // if (this.pointX > this.width / 2 |
| | | // && this.pointY < this.height / 2) { |
| | | // this.posObj = { |
| | | // left: 20 + 'px' |
| | | // ,bottom: 20 + 'px' |
| | | // }; |
| | | // } |
| | | // // é¼ æ å¨ç»å¸ç第2象é å®ä½å¨ç¬¬4象é |
| | | // if (this.pointX < this.width / 2 |
| | | // && this.pointY < this.height / 2) { |
| | | // this.posObj = { |
| | | // right: 20 + 'px' |
| | | // ,bottom: 20 + 'px' |
| | | // }; |
| | | // } |
| | | // // é¼ æ å¨ç»å¸ç第3象é å®ä½å¨ç¬¬1象é |
| | | // if (this.pointX < this.width / 2 |
| | | // && this.pointY > this.height / 2) { |
| | | // this.posObj = { |
| | | // right: 20 + 'px' |
| | | // ,top: 20 + 'px' |
| | | // }; |
| | | // } |
| | | // // é¼ æ å¨ç»å¸ç第4象é å®ä½å¨ç¬¬2象é |
| | | // if (this.pointX > this.width / 2 |
| | | // && this.pointY > this.height / 2) { |
| | | // this.posObj = { |
| | | // left: 20 + 'px' |
| | | // ,top: 20 + 'px' |
| | | // }; |
| | | // } |
| | | if (this.pointX > this.width / 2) { |
| | | this.posObj.right = 'auto'; |
| | | this.posObj.left = 20 + 'px'; |
| | | } else { |
| | | this.posObj.left = 'auto'; |
| | | this.posObj.right = 20 + 'px'; |
| | | } |
| | | |
| | | if (this.pointY > this.height / 2) { |
| | | this.posObj.bottom = 'auto'; |
| | | this.posObj.top = 20 + 'px'; |
| | | this.posObj['--trans'] = 90 + 'px'; |
| | | } else { |
| | | this.posObj.top = 'auto'; |
| | | this.posObj.bottom = 20 + 'px'; |
| | | this.posObj['--trans'] = -90 + 'px'; |
| | | } |
| | | } |
| | | } |
| | | // ç»å¸åå§å |
| | | // ,init () { |
| | | // let can = this.$refs.can; |
| | | // $can = new Draw(can, {gridWidth: this.$options.gridWidth}); |
| | | // } |
| | | |
| | | // ç»å¸åºåç¹å» debug |
| | | ,wrapClick (e) { |
| | | if (!this.debug) { |
| | | return false; |
| | | } |
| | | this.$emit('debugClick', e); |
| | | } |
| | | |
| | | // å·¥å
·éæ© åæ¢æ¨¡å¼ |
| | | ,changeMode (obj) { |
| | | this.activeMode = obj.name; |
| | | } |
| | | |
| | | ,getStyle (obj) { |
| | | return { |
| | | left: obj.position.left + 'px', |
| | | top: obj.position.top + 'px', |
| | | width: obj.position.width + 'px', |
| | | height: obj.position.height + 'px' |
| | | } |
| | | } |
| | | ,sub (obj) { |
| | | if (this[obj] > 0) { |
| | | this[obj]--; |
| | | } |
| | | } |
| | | ,add (obj) { |
| | | if ((obj == 'inputX' && this[obj] < this.width) || (obj == 'inputY' && this[obj] < this.height)) { |
| | | this[obj]++; |
| | | } |
| | | } |
| | | } |
| | | ,mounted () { |
| | | this.isMounted = true; |
| | | this.$nextTick(() => { |
| | | this.resizeHandle(); |
| | | }); |
| | | |
| | | window.addEventListener('resize', this.resizeHandle); |
| | | let can = this.$refs.can; |
| | | |
| | | // $can.drawGrid(can.getContext('2d')); |
| | | // $can.drawSeparateLine(can.getContext('2d')); |
| | | |
| | | |
| | | // can.addEventListener('mousedown', this.canvasMouseDownHandle); |
| | | can.addEventListener('mousemove', throttle((e) => {this.canvasMouseMoveHandle(e)}, 100)); |
| | | // window.addEventListener('mouseup', this.canvasMouseUpHandle); |
| | | |
| | | } |
| | | ,beforeDestroy () { |
| | | // window.removeEventListener('mouseup', this.canvasMouseUpHandle); |
| | | window.removeEventListener('resize', this.resizeHandle); |
| | | } |
| | | }; |
| | | </script> |
| | | <style scoped> |
| | | .contain { |
| | | width: 100%; |
| | | height: 100%; |
| | | display: -webkit-flex; |
| | | display: flex; |
| | | overflow: hidden; |
| | | position: relative; |
| | | user-select: none; |
| | | -moz-user-select: none; |
| | | -webkit-user-select: none; |
| | | -ms-user-select: none; |
| | | text-align: center; |
| | | } |
| | | .main { |
| | | flex: 1; |
| | | display: -webkit-flex; |
| | | display: flex; |
| | | flex-direction: column; |
| | | } |
| | | .wraper { |
| | | flex: 1; |
| | | background: rgba(0,0,0,.25); |
| | | position: relative; |
| | | } |
| | | .canvas-container { |
| | | /*background: gray;*/ |
| | | /* background: rgba(66,66,66, 1); */ |
| | | position: absolute; |
| | | left: 50%; |
| | | top: 50%; |
| | | -webkit-transform: translate(-50%, -50%); |
| | | transform: translate(-50%, -50%); |
| | | z-index: 1; |
| | | } |
| | | .canvas-container canvas { |
| | | position: absolute; |
| | | left: 0; |
| | | top: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | .pos { |
| | | position: absolute; |
| | | right: 0; |
| | | bottom: 0; |
| | | width: 0; |
| | | height: 0; |
| | | z-index: -999; |
| | | } |
| | | .btn { |
| | | background: #00f7f9; |
| | | border-radius: 6px; |
| | | margin: 6px; |
| | | } |
| | | .wrap_res { |
| | | position: fixed; |
| | | left: 0; |
| | | right: 0; |
| | | top: 0; |
| | | bottom: 0; |
| | | display: -webkit-flex; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | z-index: 99; |
| | | background: rgba(30, 30, 30, .6); |
| | | } |
| | | .tools-handle { |
| | | background: rgba(128, 128, 128, .2); |
| | | height: 12px; |
| | | font-size: 12px; |
| | | cursor: pointer; |
| | | } |
| | | .tools { |
| | | position: absolute; |
| | | padding: 6px; |
| | | z-index: 99; |
| | | } |
| | | .tools .btn { |
| | | width: 60px; |
| | | height: 60px; |
| | | border-radius: 6px; |
| | | border: 2px #ccc solid; |
| | | margin-left: 4px; |
| | | background-color: transparent; |
| | | display: -webkit-flex; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | } |
| | | .tools .btn.active { |
| | | background-color: rgba(200, 200, 200, .6); |
| | | } |
| | | |
| | | .setInfo, |
| | | .mouseInfo { |
| | | position: absolute; |
| | | /* top: 20px; |
| | | right: 20px; */ |
| | | padding: 20px; |
| | | -webkit-border-radius: 8px; |
| | | border-radius: 8px; |
| | | background: rgba(0, 0, 0, .8); |
| | | z-index: 99; |
| | | } |
| | | .setInfo { |
| | | /* right: 300px; */ |
| | | } |
| | | .magnify.hide, |
| | | .setInfo.hide, |
| | | .mouseInfo.hide { |
| | | display: none; |
| | | } |
| | | .setInfo input, |
| | | .mouseInfo span { |
| | | color: #090; |
| | | font-weight: 700; |
| | | padding-left: .6em; |
| | | } |
| | | .line-h, |
| | | .line-v { |
| | | position: absolute; |
| | | left: 50px; |
| | | background: #0f0; |
| | | z-index: 2; |
| | | } |
| | | .line-h.hide, |
| | | .line-v.hide { |
| | | display: none; |
| | | } |
| | | .magnify { |
| | | width: 200px; /* no */ |
| | | height: 200px; /* no */ |
| | | position: absolute; |
| | | background: rgba(0, 0, 0, .8); |
| | | border: 1px #00f7f9 solid; |
| | | transform: translateY(var(--trans)); |
| | | z-index: 99; |
| | | } |
| | | .magnify::before, |
| | | .magnify::after { |
| | | content: ''; |
| | | position: absolute; |
| | | background: #0f0; |
| | | } |
| | | .magnify::before { |
| | | width: 1px; |
| | | height: 100%; |
| | | left: 50%; |
| | | top: 0; |
| | | transform: translateX(-50%) scaleX(.5); |
| | | } |
| | | .magnify::after { |
| | | width: 100%; |
| | | height: 1px; |
| | | left: 0; |
| | | top: 50%; |
| | | transform: translateY(-50%) scaleY(.5); |
| | | } |
| | | .line-v { |
| | | height: 100%; |
| | | width: 1px; |
| | | } |
| | | .line-h { |
| | | width: 100%; |
| | | height: 1px; |
| | | } |
| | | |
| | | .pos_contain { |
| | | position: absolute; |
| | | left: 50%; |
| | | top: 50%; |
| | | transform: translate(-50%, -50%); |
| | | /* z-index: -1; */ |
| | | } |
| | | ._btn { |
| | | display: inline-block; |
| | | margin-left: 1em; |
| | | width: 20px; |
| | | height: 20px; |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="contain"> |
| | | <diagram |
| | | wrap-class="wrap" |
| | | :width="$options.width" |
| | | :height="$options.height" |
| | | :debug="true" |
| | | @ratioChanged="ratioChanged" |
| | | @debugClick="debugClick" |
| | | > |
| | | <canvas |
| | | :width="$options.width" |
| | | :height="$options.height" |
| | | ref="staticL"></canvas> |
| | | <canvas |
| | | :width="$options.width" |
| | | :height="$options.height" |
| | | ref="stateL"></canvas> |
| | | <canvas |
| | | :width="$options.width" |
| | | :height="$options.height" |
| | | ref="flushL"></canvas> |
| | | </diagram> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import diagram from './diagram.vue'; |
| | | import Diagram from './js/diagram'; |
| | | import Timeout from '@/assets/js/Timeout'; |
| | | |
| | | import { |
| | | list |
| | | ,update |
| | | ,updateBalls |
| | | } from './js/draw_diagram'; |
| | | |
| | | let staticL, stateL, flushL; |
| | | export default { |
| | | width: 1200 |
| | | ,height: 800 |
| | | ,components: { |
| | | diagram |
| | | } |
| | | ,data() { |
| | | return { |
| | | timer: new Timeout() |
| | | ,moveBall: null |
| | | }; |
| | | } |
| | | ,methods: { |
| | | ratioChanged (ratio) { |
| | | // console.log(ratio); |
| | | staticL && staticL.setRatio(ratio); |
| | | flushL && flushL.setRatio(ratio); |
| | | stateL && stateL.setRatio(ratio); |
| | | } |
| | | ,init () { |
| | | staticL = new Diagram(this.$refs.staticL); |
| | | stateL = new Diagram(this.$refs.stateL); |
| | | flushL = new Diagram(this.$refs.flushL); |
| | | this.moveBall = updateBalls(flushL); |
| | | } |
| | | ,drawStatic () { |
| | | staticL.importObjList(list); |
| | | staticL.drawAll(); |
| | | } |
| | | ,drawFlush () { |
| | | |
| | | } |
| | | // è°è¯æ¶çç¹å» |
| | | ,debugClick (o) { |
| | | let point = { |
| | | x: o.offsetX |
| | | ,y: o.offsetY |
| | | }; |
| | | let inObj = staticL.mousePointInObj([point.x, point.y], undefined); |
| | | let canvas_obj_id_arr = staticL.getObjIdArr(); |
| | | let canvas_obj = staticL.getObjList(); |
| | | if (inObj) { |
| | | for (let i = 0, j = canvas_obj_id_arr.length; i < j; i++) { |
| | | let id = canvas_obj_id_arr[i]; |
| | | let _inObj = staticL.mousePointInObj([point.x, point.y], id); |
| | | if (_inObj) { |
| | | let _obj = canvas_obj[id]; |
| | | console.log('----obj', _obj, id); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ,getRTData () { |
| | | return new Promise((resolve, reject) => { |
| | | let res = { |
| | | Q1: Math.random() > 0.5 |
| | | ,Q2: Math.random() > 0.5 |
| | | ,Q3: Math.random() > 0.5 |
| | | ,Q4: Math.random() > 0.5 |
| | | ,Q5: Math.random() > 0.5 |
| | | }; |
| | | setTimeout(() => { |
| | | resolve(res); |
| | | }, 300); |
| | | }); |
| | | } |
| | | ,loop () { |
| | | this.timer.start(() => { |
| | | this.getRTData().then((res) => { |
| | | update(this.moveBall, stateL, res); |
| | | }).catch((err) => { |
| | | console.error(err); |
| | | this.timer.open(); |
| | | }); |
| | | this.timer.open(); |
| | | }, 1000); |
| | | } |
| | | } |
| | | ,mounted () { |
| | | this.init(); |
| | | this.drawStatic(); |
| | | this.loop(); |
| | | } |
| | | ,beforeDestroy () { |
| | | this.timer.stop(); |
| | | } |
| | | }; |
| | | </script> |
| | | <style> |
| | | .contain { |
| | | widows: 100%; |
| | | height: 100%; |
| | | } |
| | | .wrap { |
| | | background: rgba(66, 66, 66, 1); |
| | | } |
| | | </style> |
New file |
| | |
| | | /** |
| | | * 转æ¢å°ºå¯¸ canvas缩æ¾å è¿åç尺寸ä¸å¯¹ è¦åè°æ´ |
| | | * @param {[type]} width canvasçCSS宽度 |
| | | * @param {[type]} height canvasçCSSé«åº¦ |
| | | * @param {[type]} canvasWidth canvasçç»å¸å®½åº¦ |
| | | * @param {[type]} canvasHeight canvasçç»å¸é«åº¦ |
| | | * @param {[type]} obj éè¦è½¬æ¢ç尺寸对象 |
| | | * @return {[type]} 转æ¢åç尺寸对象 |
| | | */ |
| | | const transSize = function (width, height, canvasWidth, canvasHeight, obj) { |
| | | if (!obj) { |
| | | return { |
| | | width: 0 |
| | | ,height: 0 |
| | | ,left: 0 |
| | | ,top: 0 |
| | | ,right: 0 |
| | | ,bottom: 0 |
| | | } |
| | | } |
| | | let res = {}, |
| | | _ratio, |
| | | ratio = canvasWidth / canvasHeight; |
| | | // 妿宽髿¯å¤§äºç»å¸ç宽髿¯ 忝ä¾ä»¥é«åº¦æ¥è®¡ç® åä¹ä»¥å®½åº¦è®¡ç® |
| | | if (width / height > ratio) { |
| | | _ratio = height / canvasHeight; |
| | | let _width = (width - height * ratio) / 2; |
| | | res.width = 'number' == typeof obj.width ? obj.width * _ratio : obj.width; |
| | | res.height = 'number' == typeof obj.height ? obj.height * _ratio : obj.height; |
| | | res.top = obj.top * _ratio; |
| | | res.bottom = obj.bottom * _ratio; |
| | | res.left = obj.left * _ratio + _width; |
| | | res.right = obj.right * _ratio + _width; |
| | | } else { |
| | | _ratio = width / canvasWidth; |
| | | let _height = (height - width / ratio) / 2; |
| | | res.width = 'number' == typeof obj.width ? obj.width * _ratio : obj.width; |
| | | res.height = 'number' == typeof obj.height ? obj.height * _ratio : obj.height; |
| | | res.top = obj.top * _ratio + _height; |
| | | res.bottom = obj.bottom * _ratio + _height; |
| | | res.left = obj.left * _ratio; |
| | | res.right = obj.right * _ratio; |
| | | } |
| | | // console.log('trans', res, 'obj', obj); |
| | | // console.trace('transSize callStack'); |
| | | return res; |
| | | } |
| | | |
| | | // 鲿 |
| | | const debounce = function (fn, delay = 500) { |
| | | var timer = null; |
| | | return function () { |
| | | var _this = this; |
| | | var args = arguments; |
| | | if (timer) clearTimeout(timer); |
| | | timer = setTimeout(function () { |
| | | fn.apply(_this, args); |
| | | }, delay); |
| | | }; |
| | | } |
| | | |
| | | // èæµ |
| | | const throttle = function (fn, delay = 300){ |
| | | var lastTime, timer; |
| | | return function () { |
| | | var _this = this; |
| | | var args = arguments; |
| | | var nowTime = Date.now(); |
| | | if(lastTime && nowTime - lastTime < delay){ |
| | | if (timer) clearTimeout(timer); |
| | | timer = setTimeout(function () { |
| | | lastTime = nowTime; |
| | | fn.apply(_this, args); |
| | | }, delay) |
| | | }else{ |
| | | lastTime = nowTime; |
| | | fn.apply(_this, args); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ§è¡æå®æ¬¡æ°ç宿¶å¨ |
| | | * @param {åè°} func |
| | | * @param {çå¾
æ¶é´} w |
| | | * @param {é夿¬¡æ°} t |
| | | */ |
| | | const interval = function (func, w, t){ |
| | | let interv = function () { |
| | | if(typeof t === "undefined" || t-- > 0){ |
| | | setTimeout(interv, w); |
| | | try{ |
| | | func.call(null); |
| | | } |
| | | catch (e) { |
| | | t = 0; |
| | | throw e.toString(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | setTimeout(interv, w); |
| | | } |
| | | |
| | | export default { |
| | | debounce, |
| | | interval, |
| | | throttle, |
| | | transSize |
| | | } |
New file |
| | |
| | | // è®°æ°å¨éå
|
| | | function counter (start) { |
| | | let count = start || 0; |
| | | return function () { |
| | | return count++; |
| | | } |
| | | } |
| | | /** |
| | | * ç§ææ¹æ³ |
| | | */ |
| | | // çæId |
| | | const createObjId = Symbol('createObjId'); |
| | | // çææè¿å计æ°å¨ |
| | | const createCounter = Symbol('createCounter'); |
| | | // æ·»å objå°å¯¹è±¡æ°ç» |
| | | const addToObj = Symbol('addToObj'); |
| | | /** |
| | | * ç§æå±æ§ |
| | | */ |
| | | // ç¨æ¥åå¨å
ç´ Id |
| | | const objIdArr = Symbol('objIdArr'); |
| | | // é®ä¸ºå
ç´ Idå¼ä¸ºå
ç´ çè¿å对象 |
| | | const objList = Symbol('objList'); |
| | | // 计æ°å¨å表 |
| | | const counterList = Symbol('counterList'); |
| | | |
| | | /** |
| | | * canvas ç»ææå¾çç±» |
| | | */ |
| | | |
| | | export default class Diagram { |
| | | constructor ($$el, opts) { |
| | | let defaults = { |
| | | strokeStyle: '#50cef5' |
| | | ,fillStyle: '#50cef5' |
| | | // ,lineWidth: 4 |
| | | ,lineWidth: 2 |
| | | ,gridWidth: 50 |
| | | }; |
| | | opts = Object.assign({}, defaults, opts); |
| | | this.canvas = $$el; |
| | | this.width = this.canvas.width; |
| | | this.height = this.canvas.height; |
| | | this.context = this.canvas.getContext('2d'); |
| | | this.gridWidth = opts.gridWidth; |
| | | // ç¨æ¥åå¨å
ç´ Id |
| | | this[objIdArr] = []; |
| | | // é®ä¸ºå
ç´ Idå¼ä¸ºå
ç´ çè¿å对象 |
| | | this[objList] = {}; |
| | | // 计æ°å¨å表 |
| | | this[counterList] = {}; |
| | | // åå§å |
| | | this.lineWidth = opts.lineWidth; |
| | | this.context.lineWidth = opts.lineWidth; |
| | | // ç¼©æ¾æ¯ä¾ |
| | | this.ratio = 1; |
| | | // éä¸ç对象çid |
| | | this.selected_obj_id = -1; |
| | | // this.context.strokeStyle = '#000'; |
| | | // this.context.fillStyle = "#000"; |
| | | |
| | | this.strokeStyle = opts.strokeStyle; |
| | | this.context.strokeStyle = opts.strokeStyle; |
| | | this.fillStyle = opts.fillStyle; |
| | | this.context.fillStyle = opts.fillStyle; |
| | | // ç¨æ¥åæ¾å¿«ç
§ åå§1px * 1px |
| | | // this.imageData = this.context.createImageData(1, 1); |
| | | // ç¨æ¥åæ¾ç¦»å±canvaså¿«ç
§ æ§è½æ¯getImageData好 |
| | | // åç§»å¨å°ççæ¶åç§»å¨ä¸æ¡çº¿æ®µæéè¦çå·æ°æ¬¡æ° é»è®¤40 |
| | | this.COUNT = opts.count || 40; |
| | | this.offscreenCanvas = null; |
| | | } |
| | | |
| | | /** |
| | | * ç»ç¦»å±canvas 线段 ä¸ä¼ åæ¶ç»ææçº¿æ®µ ä¼ å¯¹è±¡id åç»æå®çº¿æ®µå¯¹è±¡ |
| | | */ |
| | | getLineOffscreenCanvas (id) { |
| | | let offscreenCanvas = document.createElement('canvas'); |
| | | let offscreenCanvasContext = offscreenCanvas.getContext('2d'); |
| | | let ratio = this.ratio; |
| | | offscreenCanvas.width = this.width; |
| | | offscreenCanvas.height = this.height; |
| | | if (id) { |
| | | this.drawObj(offscreenCanvasContext, id); |
| | | } else { |
| | | this[objIdArr].forEach((v) => { |
| | | let obj = this[objList][v]; |
| | | if (obj.type == 'line') { |
| | | this.drawObj(offscreenCanvasContext, obj.id); |
| | | } |
| | | }); |
| | | } |
| | | return offscreenCanvas; |
| | | } |
| | | |
| | | // æ´æ° select_obj_id |
| | | setSelectedId (id) { |
| | | // console.log(id, this[objList][id], 'selected'); |
| | | if (!id || !this[objList][id]) { |
| | | return false; |
| | | } |
| | | this.selected_obj_id = id; |
| | | } |
| | | |
| | | // è·åobjList |
| | | getObjList () { |
| | | return this[objList]; |
| | | } |
| | | |
| | | // è·åobjIdArr |
| | | getObjIdArr () { |
| | | return this[objIdArr]; |
| | | } |
| | | |
| | | // æ¸
é¤ç»å¸ |
| | | clearCanvas () { |
| | | this[objList] = {}; |
| | | this[objIdArr] = []; |
| | | this[counterList] = {}; |
| | | |
| | | this.context.clearRect(0, 0, this.width, this.height); |
| | | } |
| | | |
| | | // çæå¯¹è±¡çId |
| | | [createObjId] (type) { |
| | | let counter = this[counterList]['counter_' + type].counter(); |
| | | return type + '_' + counter; |
| | | } |
| | | |
| | | // çææè¿å计æ°å¨ |
| | | [createCounter] (type, start) { |
| | | if (!this[counterList]['counter_' + type]) { |
| | | this[counterList]['counter_' + type] = { |
| | | counter: counter(start) |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 导å
¥å¤é¨å¯¹è±¡å表 |
| | | importObjList (list) { |
| | | this[objIdArr] = Object.keys(list); |
| | | this[objList] = list; |
| | | this.initCounter(); |
| | | } |
| | | |
| | | // åå§å计æ°å¨ ä»å¤é¨å¯¼å
¥åè°ç¨; |
| | | initCounter () { |
| | | let reg = /^(\S+)_(\d+)$/; |
| | | let obj = {}; |
| | | this[objIdArr].forEach((v) => { |
| | | let res = reg.exec(v); |
| | | obj[res[1]] = obj[res[1]] || {max: 0}; |
| | | obj[res[1]]['max'] = res[2] > obj[res[1]]['max'] ? res[2] * 1 : obj[res[1]]['max']; |
| | | }); |
| | | Object.keys(obj).forEach((v) => { |
| | | this[createCounter](v, obj[v].max + 1); |
| | | }); |
| | | } |
| | | |
| | | // æ·»å ç¸å
³ä¿¡æ¯å°objList |
| | | [addToObj] (type, opts) { |
| | | this[createCounter](type); |
| | | let id = this[createObjId](type); |
| | | this[objIdArr].push(id); |
| | | // console.log(this[objIdArr]); |
| | | // debugger; |
| | | opts['id'] = id; |
| | | this[objList][id] = opts; |
| | | } |
| | | updateCanvas () { |
| | | this.context.save(); |
| | | this.context.fillStyle = "rgba(0, 0, 0, 0.85)"; |
| | | this.context.globalCompositeOperation = 'destination-in'; |
| | | this.context.fillRect(0, 0, this.canvas.width, this.canvas.height); |
| | | this.context.restore(); |
| | | } |
| | | // å¿«ç
§ |
| | | snapshoot (canvas) { |
| | | this.offscreenCanvas = canvas; |
| | | } |
| | | |
| | | // 设置对象çåæ° |
| | | setOption (id, attr, value) { |
| | | if (!this[objList][id]) { |
| | | return false; |
| | | } |
| | | this[objList][id][attr] = value; |
| | | } |
| | | // 读å对象çåæ° |
| | | // getOption (id) { |
| | | // let res = false; |
| | | // let list = this[objIdArr]; |
| | | |
| | | // for (let i = 0, j = list.length; i < j; i++) { |
| | | // if (this[objList][list[i]].id == id) { |
| | | // res = this[objList][] |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | setRatio (ratio) { |
| | | this.ratio = ratio; |
| | | } |
| | | |
| | | drawObj (ctx, id) { |
| | | let obj = this[objList][id]; |
| | | if (!obj) { |
| | | return false; |
| | | } |
| | | // debugger; |
| | | // ç»å¶å¯¹è±¡ |
| | | this[obj.method](ctx, obj); |
| | | } |
| | | |
| | | removeObj (id) { |
| | | this[objIdArr] = this[objIdArr].filter((v) => { |
| | | return id != v; |
| | | }); |
| | | delete this[objList][id]; |
| | | this.drawAll(); |
| | | } |
| | | |
| | | /** |
| | | * ç»å¶çº¿æ¡ æ ¹æ®å¯¹è±¡éçmethod屿§æ¥è°ç¨ç |
| | | */ |
| | | drawLine (ctx, opts) { |
| | | ctx.save(); |
| | | ctx.lineWidth = opts.lineWidth || this.lineWidth; |
| | | ctx.strokeStyle = opts.color || this.strokeStyle; |
| | | ctx.globalCompositeOperation = "destination-over"; |
| | | ctx.beginPath(); |
| | | |
| | | for (let i = 0, j = opts.points.length - 1; i < j; i++) { |
| | | if (i == 0) { |
| | | ctx.moveTo(opts.points[i][0], opts.points[i][1]); |
| | | } |
| | | ctx.lineTo(opts.points[i + 1][0], opts.points[i + 1][1]); |
| | | } |
| | | ctx.stroke(); |
| | | ctx.closePath(); |
| | | |
| | | ctx.restore(); |
| | | } |
| | | |
| | | |
| | | // ç»åç¹ |
| | | drawPoint (ctx, opts) { |
| | | ctx.save(); |
| | | ctx.strokeStyle = opts.strokeStyle; |
| | | ctx.fillStyle = opts.fillStyle; |
| | | |
| | | ctx.beginPath(); |
| | | ctx.arc(opts.x, opts.y, opts.r, 0, 2 * Math.PI); |
| | | ctx.closePath(); |
| | | |
| | | ctx.fill(); |
| | | ctx.restore(); |
| | | } |
| | | |
| | | /** |
| | | * ç»å¶è®¾å¤ å¾å æ ¹æ®å¯¹è±¡éçmethod屿§æ¥è°ç¨ |
| | | */ |
| | | drawDevImg (ctx, opts) { |
| | | ctx.save(); |
| | | ctx.lineWidth = this.lineWidth; |
| | | ctx.strokeStyle = this.strokeStyle; |
| | | ctx.translate(opts.x, opts.y); |
| | | ctx.beginPath(); |
| | | let img = opts.img; |
| | | // console.log(Date.now()); |
| | | // let img = new Image(); |
| | | // img.src = opts.src; |
| | | // console.log(img, Date.now()) |
| | | // ctx.drawImage(img, opts.x, opts.y, opts.width, opts.height); |
| | | if (img.complete) { |
| | | // ctx.drawImage(img, opts.x, opts.y, opts.width, opts.height); |
| | | ctx.drawImage(img, 0, 0, opts.width, opts.height); |
| | | } else { |
| | | img.addEventListener('load', () => { |
| | | console.log(img.complete, Date.now(), '??'); |
| | | // ctx.drawImage(img, 0, 0, opts.width, opts.height); |
| | | this.drawDevImg(ctx, opts); |
| | | // setTimeout(() => { |
| | | // ctx.drawImage(img, opts.x, opts.y, opts.width, opts.height); |
| | | // }, 500); |
| | | }); |
| | | } |
| | | ctx.closePath(); |
| | | ctx.restore(); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®json ç»å¶å¼å
³ |
| | | */ |
| | | drawSwitch (ctx, opts) { |
| | | // ç»åå |
| | | let r = 4; |
| | | let color = '#50cef5'; |
| | | ctx.save(); |
| | | ctx.translate(opts.x, opts.y); |
| | | ctx.fillStyle = color; |
| | | ctx.strokeStyle = color; |
| | | ctx.beginPath(); |
| | | ctx.arc(0, 0, r, 0, Math.PI * 2); |
| | | ctx.closePath(); |
| | | ctx.stroke(); |
| | | ctx.beginPath(); |
| | | if ('ver' == opts.direction) { |
| | | ctx.arc(0, opts.distance, r, 0, Math.PI * 2); |
| | | } else { |
| | | ctx.arc(opts.distance, 0, r, 0, Math.PI * 2); |
| | | } |
| | | ctx.closePath(); |
| | | ctx.stroke(); |
| | | ctx.fillStyle = '#fff'; |
| | | ctx.font = '16px Arial'; |
| | | if ('ver' == opts.direction) { |
| | | if (opts.name) { |
| | | ctx.textAlign = 'start'; |
| | | ctx.textBaseline = 'bottom'; |
| | | ctx.fillText(opts.name, 10, -10); |
| | | } |
| | | if (opts.description) { |
| | | ctx.textAlign = 'end'; |
| | | ctx.textBaseline = 'middle'; |
| | | ctx.fillText(opts.description, -4, opts.distance / 2); |
| | | } |
| | | } else { |
| | | if (opts.name) { |
| | | ctx.textAlign = 'right'; |
| | | ctx.textBaseline = 'bottom'; |
| | | ctx.fillText(opts.name, -10, -10); |
| | | } |
| | | if (opts.description) { |
| | | ctx.textAlign = 'center'; |
| | | ctx.textBaseline = 'top'; |
| | | ctx.fillText(opts.description, opts.distance / 2, 4); |
| | | } |
| | | } |
| | | |
| | | // ç»è¿çº¿ |
| | | ctx.save(); |
| | | if (opts.isOn) { |
| | | ctx.rotate(-6 * Math.PI / 180); |
| | | } else { |
| | | ctx.rotate(-30 * Math.PI / 180); |
| | | } |
| | | ctx.lineWidth = this.lineWidth; |
| | | ctx.strokeStyle = color; |
| | | ctx.globalCompositeOperation = 'destination-over'; |
| | | ctx.beginPath(); |
| | | if ('ver' == opts.direction) { |
| | | ctx.moveTo(0, r); |
| | | ctx.lineTo(0, opts.distance); |
| | | } else { |
| | | ctx.moveTo(r, 0); |
| | | ctx.lineTo(opts.distance, 0); |
| | | } |
| | | ctx.stroke(); |
| | | ctx.closePath(); |
| | | |
| | | if (opts.clickAble) { |
| | | ctx.beginPath(); |
| | | ctx.fillStyle = this.strokeStyle; |
| | | if ('ver' == opts.direction) { |
| | | ctx.arc(0, opts.distance - opts.r, opts.r, - Math.PI / 2, Math.PI / 2); |
| | | } else { |
| | | ctx.arc(opts.distance - opts.r, 0, opts.r, - Math.PI, 0); |
| | | } |
| | | ctx.fill(); |
| | | ctx.closePath(); |
| | | } |
| | | ctx.restore(); |
| | | |
| | | ctx.restore(); |
| | | } |
| | | |
| | | |
| | | |
| | | // å¤æé¼ æ ç¹å»çä½ç½®ææ²¡ææ ç´ ç¨ææ²¡æé¢è²å¼æ¥å¤æ |
| | | mousePointInObj (mousePoint, obj) { |
| | | let offscreenCanvas; |
| | | if (!obj) { |
| | | offscreenCanvas = this.getOffscreenCanvas(true, undefined); |
| | | } else { |
| | | offscreenCanvas = this.getOffscreenCanvas(false, obj); |
| | | // that.drawMonitor(offscreenCanvas); |
| | | } |
| | | let offscreenCanvasContext = offscreenCanvas.getContext('2d'); |
| | | let ratio = this.ratio; |
| | | // console.log('ratio', ratio); |
| | | // åä¹ä¸ªç¹ 容差 |
| | | // console.log(mousePoint); |
| | | let res = offscreenCanvasContext.getImageData(mousePoint[0] / ratio - 1, mousePoint[1] / ratio - 1, 3, 3); |
| | | // console.log(res, 'getImageData'); |
| | | let transparentCount = 0; |
| | | for (let i = 0, j = res.data.length; i < j; i += 4) { |
| | | // let r = res.data[i]; |
| | | // let g = res.data[i + 1]; |
| | | // let b = res.data[i + 2]; |
| | | let a = res.data[i + 3]; |
| | | if (!a) { |
| | | // console.log('è¿ä¸ªåç´ æ²¡æå
容'); |
| | | transparentCount++; |
| | | } |
| | | } |
| | | // console.log(transparentCount, 'transparentCount'); |
| | | return transparentCount < 3 * 3; |
| | | } |
| | | |
| | | |
| | | |
| | | // é¼ æ ç¹å»å¤å¨ä¸å¨çº¿æ®µä¸ |
| | | _pointInLine (mousePoint, pointS, pointE) { |
| | | let offscreenCanvas = document.createElement('canvas'); |
| | | let offscreenCanvasContext = offscreenCanvas.getContext('2d'); |
| | | offscreenCanvas.width = this.width; |
| | | offscreenCanvas.height = this.height; |
| | | offscreenCanvasContext.save(); |
| | | offscreenCanvasContext.lineWidth = this.lineWidth; |
| | | offscreenCanvasContext.strokeStyle = this.strokeStyle; |
| | | offscreenCanvasContext.globalCompositeOperation = "destination-over"; |
| | | offscreenCanvasContext.beginPath(); |
| | | offscreenCanvasContext.moveTo(pointS[0], pointS[1]); |
| | | offscreenCanvasContext.lineTo(pointE[0], pointE[1]); |
| | | offscreenCanvasContext.stroke(); |
| | | offscreenCanvasContext.closePath(); |
| | | offscreenCanvasContext.restore(); |
| | | let ratio = this.ratio; |
| | | let res = offscreenCanvasContext.getImageData(mousePoint[0] / ratio - 1, mousePoint[1] / ratio - 1, 3, 3); |
| | | let transparentCount = 0; |
| | | for (let i = 0, j = res.data.length; i < j; i += 4) { |
| | | // let r = res.data[i]; |
| | | // let g = res.data[i + 1]; |
| | | // let b = res.data[i + 2]; |
| | | let a = res.data[i + 3]; |
| | | if (!a) { |
| | | // console.log('è¿ä¸ªåç´ æ²¡æå
容'); |
| | | transparentCount++; |
| | | } |
| | | } |
| | | // console.log(transparentCount, 'transparentCount'); |
| | | return transparentCount < 3 * 3; |
| | | } |
| | | |
| | | |
| | | // å¤æé¼ æ æ¯å¦ç¹å»ç线段 |
| | | mousePointInLine (mousePoint, id) { |
| | | let offscreenCanvas = this.getLineOffscreenCanvas(id); |
| | | let offscreenCanvasContext = offscreenCanvas.getContext('2d'); |
| | | let ratio = this.ratio; |
| | | // åä¹ä¸ªç¹ 容差 |
| | | // console.log(mousePoint); |
| | | let res = offscreenCanvasContext.getImageData(mousePoint[0] / ratio - 1, mousePoint[1] / ratio - 1, 3, 3); |
| | | // console.log(res, 'getImageData'); |
| | | let transparentCount = 0; |
| | | for (let i = 0, j = res.data.length; i < j; i += 4) { |
| | | let r = res.data[i]; |
| | | let g = res.data[i + 1]; |
| | | let b = res.data[i + 2]; |
| | | let a = res.data[i + 3]; |
| | | if ((!r && !g && !b) || !a) { |
| | | // console.log('è¿ä¸ªåç´ æ²¡æå
容'); |
| | | transparentCount++; |
| | | } |
| | | } |
| | | // console.log(transparentCount, 'transparentCount'); |
| | | return transparentCount < 3 * 3; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ç»è线 |
| | | * @param {[type]} ctx ç»å¸ä¸ä¸æ |
| | | * @return {[type]} [description] |
| | | */ |
| | | drawDashLine (ctx, opts) { |
| | | ctx.save(); |
| | | ctx.lineWidth = opts.lineWidth; |
| | | ctx.strokeStyle = opts.color; |
| | | ctx.globalCompositeOperation = "destination-over"; |
| | | // 设置è线 |
| | | ctx.setLineDash([2, 4]); |
| | | ctx.beginPath(); |
| | | for (let i = 0, j = opts.points.length; i < j; i++) { |
| | | if (0 == i) { |
| | | ctx.moveTo(opts.points[0][0], opts.points[0][1]); |
| | | } else { |
| | | ctx.lineTo(opts.points[i][0], opts.points[i][1]); |
| | | } |
| | | } |
| | | ctx.stroke(); |
| | | ctx.closePath(); |
| | | ctx.restore(); |
| | | } |
| | | |
| | | // åé¤äºå½åç§»å¨çå
ç´ ä¹å¤çå
ç´ ç»å¶ç¦»å±canvas |
| | | getOffscreenCanvas (drawAll, objId) { |
| | | let offscreenCanvas = document.createElement('canvas'); |
| | | let offscreenCanvasContext = offscreenCanvas.getContext('2d'); |
| | | offscreenCanvas.width = this.width; |
| | | offscreenCanvas.height = this.height; |
| | | // console.log(objId, 'objId'); |
| | | // console.trace('getOffscreenCanvas'); |
| | | // ä¸ç»å
¨é¨ |
| | | if (!drawAll) { |
| | | // æå®objId ååªç»æå®å¯¹è±¡ |
| | | if (objId) { |
| | | this.drawObj(offscreenCanvasContext, objId); |
| | | } |
| | | // ç»å
¨é¨ |
| | | } else { |
| | | // drawAll, no objId åç»å
¨é¨ æobjId åç»é¤äºobjIdçå
¨é¨ |
| | | // console.log(objId, 'draw snapshoot', this.selected_obj_id, this[objIdArr]); |
| | | this.drawSubjoin(offscreenCanvasContext); |
| | | // drawGrid(offscreenCanvasContext, that); |
| | | // drawSeparateLine(offscreenCanvasContext, that); |
| | | this[objIdArr].forEach((v) => { |
| | | if (objId && v == this.selected_obj_id) { |
| | | return false; |
| | | } |
| | | // console.log('draw all and grid'); |
| | | this.drawObj(offscreenCanvasContext, v); |
| | | }); |
| | | } |
| | | return offscreenCanvas; |
| | | } |
| | | |
| | | /** |
| | | * ç§»å¨çå°ç 表示æµåç |
| | | */ |
| | | moveBall (opts, count, ballNum) { |
| | | ballNum = ballNum || 1; |
| | | // console.log(opts, count, ballNum); |
| | | let points = opts.points; |
| | | let step = 0; |
| | | let delta = 0; |
| | | opts.fillStyle = opts.fillStyle || '#fff'; |
| | | let point0, point1, point2, point3; |
| | | let pointMax, pointMin; |
| | | // åæ®µå å䏿®µçé¿åº¦ |
| | | let pointLen; |
| | | switch (opts.direction) { |
| | | // åä¸ |
| | | case 'top': |
| | | point3 = points[3] > points[1] ? points[3] : points[1]; |
| | | point1 = points[3] > points[1] ? points[1] : points[3]; |
| | | |
| | | pointLen = Math.round((point3 - point1) / ballNum); |
| | | |
| | | for (let i = 0; i < ballNum; i++) { |
| | | pointMax = point3 - pointLen * i; |
| | | pointMin = point3 - pointLen * (i + 1); |
| | | if (i == ballNum - 1) { |
| | | pointMin = point1; |
| | | } |
| | | |
| | | step = (pointMax - pointMin) / this.COUNT; |
| | | delta = pointMax; |
| | | delta -= step * count; |
| | | if (delta < pointMin) { |
| | | delta = pointMax; |
| | | } |
| | | |
| | | this.drawPoint(this.context, { |
| | | x: points[2], |
| | | y: delta, |
| | | fillStyle: opts.fillStyle, |
| | | r: 6 |
| | | }); |
| | | } |
| | | // this.draw |
| | | break; |
| | | // åä¸ |
| | | case 'bottom': |
| | | // debugger; |
| | | point3 = points[3] > points[1] ? points[3] : points[1]; |
| | | point1 = points[3] > points[1] ? points[1] : points[3]; |
| | | |
| | | pointLen = Math.round((point3 - point1) / ballNum); |
| | | |
| | | for (let i = 0; i < ballNum; i++) { |
| | | pointMax = point3 - pointLen * i; |
| | | pointMin = point3 - pointLen * (i + 1); |
| | | if (i == ballNum - 1) { |
| | | pointMin = point1; |
| | | } |
| | | |
| | | step = (pointMax - pointMin) / this.COUNT; |
| | | delta = pointMin; |
| | | delta += step * count; |
| | | if (delta > pointMax) { |
| | | delta = pointMin; |
| | | } |
| | | |
| | | this.drawPoint(this.context, { |
| | | x: points[2], |
| | | y: delta, |
| | | fillStyle: opts.fillStyle, |
| | | r: 6 |
| | | }); |
| | | } |
| | | |
| | | break; |
| | | // åå·¦ |
| | | case 'left': |
| | | point2 = points[2] > points[0] ? points[2] : points[0]; |
| | | point0 = points[2] > points[0] ? points[0] : points[2]; |
| | | |
| | | pointLen = Math.round((point2 - point0) / ballNum); |
| | | |
| | | for (let i = 0; i < ballNum; i++) { |
| | | pointMax = point2 - pointLen * i; |
| | | pointMin = point2 - pointLen * (i + 1); |
| | | if (i == ballNum - 1) { |
| | | pointMin = point0; |
| | | } |
| | | |
| | | step = (pointMax - pointMin) / this.COUNT; |
| | | delta = pointMax; |
| | | delta -= step * count; |
| | | if (delta < pointMin) { |
| | | delta = pointMax; |
| | | } |
| | | |
| | | this.drawPoint(this.context, { |
| | | x: delta, |
| | | y: points[1], |
| | | fillStyle: opts.fillStyle, |
| | | r: 6 |
| | | }); |
| | | } |
| | | |
| | | // step = (point2 - point0) / this.COUNT; |
| | | // delta = point2; |
| | | // delta -= step * count; |
| | | // if (delta < point0) { |
| | | // delta = point2; |
| | | // } |
| | | // this.drawPoint(this.context, { |
| | | // x: delta, |
| | | // y: points[1], |
| | | // fillStyle: opts.fillStyle, |
| | | // r: 6 |
| | | // }); |
| | | break; |
| | | // åå³ |
| | | case 'right': |
| | | point2 = points[2] > points[0] ? points[2] : points[0]; |
| | | point0 = points[2] > points[0] ? points[0] : points[2]; |
| | | |
| | | pointLen = Math.round((point2 - point0) / ballNum); |
| | | |
| | | for (let i = 0; i < ballNum; i++) { |
| | | pointMax = point2 - pointLen * i; |
| | | pointMin = point2 - pointLen * (i + 1); |
| | | if (i == ballNum - 1) { |
| | | pointMin = point0; |
| | | } |
| | | |
| | | step = (pointMax - pointMin) / this.COUNT; |
| | | delta = pointMin; |
| | | delta += step * count; |
| | | if (delta > pointMax) { |
| | | delta = pointMin; |
| | | } |
| | | |
| | | this.drawPoint(this.context, { |
| | | x: delta, |
| | | y: points[1], |
| | | fillStyle: opts.fillStyle, |
| | | r: 6 |
| | | }); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | // ç»äºæç®¡ |
| | | drawDiode (ctx, opts) { |
| | | let color = '#b370fe'; |
| | | let height = 20; |
| | | ctx.save(); |
| | | ctx.fillStyle = color; |
| | | ctx.lineWidth = 2; |
| | | ctx.strokeStyle = color; |
| | | ctx.translate(opts.x, opts.y); |
| | | ctx.textAlign = 'right'; |
| | | ctx.textBaseline = 'bottom'; |
| | | ctx.font = '20px Arial' |
| | | if (opts.name) { |
| | | ctx.fillText(opts.name, 0, 0); |
| | | } |
| | | // æ°´å¹³æ¹åçè¿æ¯ç«ç´æ¹åç |
| | | if (!opts.isHor) { |
| | | ctx.rotate(-Math.PI / 2); |
| | | } |
| | | ctx.beginPath(); |
| | | ctx.moveTo(0, 0); |
| | | ctx.lineTo(0, height); |
| | | ctx.lineTo(height / 2, height / 2); |
| | | ctx.closePath(); |
| | | ctx.fill(); |
| | | ctx.beginPath(); |
| | | ctx.moveTo(height / 2, 0); |
| | | ctx.lineTo(height / 2, height); |
| | | ctx.stroke(); |
| | | ctx.closePath(); |
| | | ctx.restore(); |
| | | } |
| | | |
| | | drawRect (ctx, opts) { |
| | | ctx.save(); |
| | | ctx.translate(opts.x, opts.y); |
| | | ctx.strokeStyle = opts.strokeStyle || 'transparent'; |
| | | ctx.lineWidth = opts.lineWidth || this.lineWidth; |
| | | ctx.beginPath(); |
| | | ctx.rect(0, 0, opts.width, opts.height); |
| | | ctx.closePath(); |
| | | ctx.stroke(); |
| | | ctx.restore(); |
| | | } |
| | | |
| | | // ç»çµé» |
| | | drawResistance (ctx, opts) { |
| | | let width = 60; |
| | | let height = 10; |
| | | ctx.save(); |
| | | ctx.textAlign = 'start'; |
| | | ctx.strokeStyle = opts.color || this.strokeStyle; |
| | | ctx.fillStyle = '#fff'; |
| | | ctx.font = '16px Arial'; |
| | | ctx.translate(opts.x, opts.y); |
| | | ctx.beginPath(); |
| | | if (opts.isHor) { |
| | | ctx.rect(0, 0, width, height); |
| | | if (opts.name) { |
| | | ctx.textBaseline = 'bottom'; |
| | | ctx.fillText(opts.name, 0, - 8); |
| | | } |
| | | } else { |
| | | ctx.rect(0, 0, height, width); |
| | | if (opts.name) { |
| | | ctx.textBaseline = 'top'; |
| | | ctx.fillText(opts.name, height + 8, 0); |
| | | } |
| | | } |
| | | ctx.closePath(); |
| | | ctx.stroke(); |
| | | ctx.restore(); |
| | | } |
| | | |
| | | // ç»çµæ |
| | | drawInductance (ctx, opts) { |
| | | let r = 6; |
| | | ctx.save(); |
| | | ctx.fillStyle = '#fff'; |
| | | ctx.strokeStyle = opts.color; |
| | | ctx.translate(opts.x, opts.y); |
| | | for (let i = 0, j = 4; i < j; i++) { |
| | | let x = r * 2 * i + r; |
| | | ctx.beginPath(); |
| | | ctx.arc(x, 0, r, Math.PI, 2 * Math.PI); |
| | | ctx.stroke(); |
| | | ctx.closePath(); |
| | | } |
| | | ctx.beginPath(); |
| | | ctx.moveTo(0, - r - 4); |
| | | ctx.lineTo(8 * r, - r - 4); |
| | | ctx.moveTo(0, - r - 10); |
| | | ctx.lineTo(8 * r, - r - 10); |
| | | ctx.stroke(); |
| | | ctx.closePath(); |
| | | if (opts.name) { |
| | | ctx.textAlign = 'start'; |
| | | ctx.textBaseline = 'bottom'; |
| | | ctx.font = '16px Arial'; |
| | | ctx.fillText(opts.name, 0, -r -16); |
| | | } |
| | | ctx.restore(); |
| | | } |
| | | |
| | | // ç»æ´æµå¨ |
| | | drawRectifier (ctx, opts) { |
| | | this.drawDevImg(ctx, opts); |
| | | ctx.save(); |
| | | ctx.translate(opts.x, opts.y); |
| | | // ctx.fillText(opts.name, 0, 0); |
| | | ctx.font = '16px Arial'; |
| | | ctx.textAlign = 'start'; |
| | | ctx.fillStyle = '#fff'; |
| | | let arr = opts.name.split(''); |
| | | // ä¸å¿å¨Yè½´ä¸åºæ° |
| | | let center = (arr.length - 1) / 2; |
| | | arr.forEach((v, i) => { |
| | | ctx.fillText(v, opts.width + 6, opts.height / 2 + (i - center) * 20 + 6); |
| | | }); |
| | | ctx.restore(); |
| | | } |
| | | |
| | | // ç»çµæ± ç» |
| | | drawBatts (ctx, opts) { |
| | | this.drawDevImg(ctx, opts); |
| | | ctx.save(); |
| | | ctx.translate(0, opts.height + opts.distance); |
| | | this.drawDevImg(ctx, opts); |
| | | ctx.restore(); |
| | | ctx.save(); |
| | | ctx.translate(opts.x, opts.y); |
| | | ctx.font = '16px Arial'; |
| | | ctx.textAlign = 'start'; |
| | | ctx.fillStyle = '#fff'; |
| | | let arr = opts.name.split(''); |
| | | // ä¸å¿å¨Yè½´ä¸åºæ° |
| | | let center = (arr.length - 1) / 2; |
| | | arr.forEach((v, i) => { |
| | | ctx.fillText(v, opts.width + 6, opts.height + opts.distance / 2 + (i - center) * 20 + 6); |
| | | }); |
| | | this.drawDashLine(ctx, { |
| | | color: '#00f7f9' |
| | | ,lineWidth: 4 |
| | | ,points: [[opts.width / 2, opts.height], [opts.width / 2, opts.height + opts.distance]] |
| | | }); |
| | | ctx.restore(); |
| | | } |
| | | |
| | | // ç»è´è½½ |
| | | drawLoad (ctx, opts) { |
| | | this.drawDevImg(ctx, opts); |
| | | ctx.save(); |
| | | ctx.translate(opts.x, opts.y); |
| | | ctx.font = '16px Arial'; |
| | | ctx.textAlign = 'start'; |
| | | ctx.fillStyle = '#fff'; |
| | | let arr = opts.name.split(''); |
| | | // ä¸å¿å¨Yè½´ä¸åºæ° |
| | | let center = (arr.length - 1) / 2; |
| | | arr.forEach((v, i) => { |
| | | ctx.fillText(v, opts.width + 6, opts.height / 2 + (i - center) * 20 + 6); |
| | | }); |
| | | ctx.restore(); |
| | | } |
| | | |
| | | // ç»å¶å
¨é¨å¯¹è±¡ |
| | | drawAll () { |
| | | let offscreenCanvas = document.createElement('canvas'); |
| | | let offscreenCanvasContext = offscreenCanvas.getContext('2d'); |
| | | offscreenCanvas.width = this.width; |
| | | offscreenCanvas.height = this.height; |
| | | this.drawSubjoin(offscreenCanvasContext); |
| | | this[objIdArr].forEach((v) => { |
| | | this.drawObj(offscreenCanvasContext, v); |
| | | }); |
| | | |
| | | let can = this.canvas; |
| | | let context = this.context; |
| | | context.clearRect(0, 0, can.width, can.height); |
| | | // æé¤ç»å¸ ä»ç¼åä¸å离å±canvas éç» |
| | | context.drawImage(offscreenCanvas, 0, 0, can.width, can.height); |
| | | } |
| | | |
| | | // ç»å¶éå å
ç´ |
| | | drawSubjoin (ctx) { |
| | | // if (this.drawGrid) { |
| | | // this.drawGrid(ctx); |
| | | // } |
| | | // if (this.drawSeparateLine) { |
| | | // this.drawSeparateLine(ctx); |
| | | // } |
| | | } |
| | | |
| | | drawGrid (ctx) { |
| | | // å¯ä»¥ç¨ç¦»å±canvasä¼å |
| | | let canvasW = this.width; |
| | | let canvasH = this.height; |
| | | let width = this.gridWidth; |
| | | ctx.save(); |
| | | ctx.lineWidth = 1; |
| | | ctx.strokeStyle = '#999'; |
| | | // ç»æ¨ªçº¿ |
| | | for (let i = 0, j = canvasH; i <= j; i += width) { |
| | | ctx.beginPath(); |
| | | ctx.moveTo(0, i); |
| | | ctx.lineTo(canvasW, i); |
| | | ctx.stroke(); |
| | | ctx.closePath(); |
| | | } |
| | | // ç»ç«çº¿ |
| | | for (let i = 0, j = canvasW; i <= j; i += width) { |
| | | ctx.beginPath(); |
| | | ctx.moveTo(i, 0); |
| | | ctx.lineTo(i, canvasH); |
| | | ctx.stroke(); |
| | | ctx.closePath(); |
| | | } |
| | | ctx.restore(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // ç»è®¾å¤å¾ç |
| | | draw_Dev (opts, whetherAdd) { |
| | | whetherAdd = whetherAdd === undefined || !!whetherAdd; |
| | | let { |
| | | context |
| | | ,img |
| | | ,type |
| | | ,x |
| | | ,y |
| | | ,width |
| | | ,height |
| | | } = opts; |
| | | let ratio = this.ratio; |
| | | x = Math.round(x / ratio); |
| | | y = Math.round(y / ratio); |
| | | |
| | | // img.crossOrigin = ''; |
| | | |
| | | |
| | | // console.log(obj, '-=-='); |
| | | if (img.complete) { |
| | | context.drawImage(img, x, y, width, height); |
| | | } else { |
| | | img.addEventListener('load', () => { |
| | | context.drawImage(img, x, y, width, height); |
| | | }); |
| | | } |
| | | |
| | | let periphery = this.getPeripheryPoints(img, width, height); |
| | | |
| | | let options = { |
| | | type: type |
| | | ,src: img.src |
| | | ,points: [] |
| | | ,width: width |
| | | ,height: height |
| | | ,x: x |
| | | ,y: y |
| | | ,center: [x + width / 2, y + height / 2] |
| | | ,periphery |
| | | ,method: 'drawDevImg' |
| | | }; |
| | | whetherAdd && this[addToObj](type, options); |
| | | } |
| | | |
| | | // è·åpanelå®ä½æ°æ® |
| | | getPanelPos (subName, count) { |
| | | let res = []; |
| | | let list = this[objList]; |
| | | let name_pre = 'rect_' + subName + '_'; |
| | | for (let i = 0; i < count; i++) { |
| | | let name = name_pre + i; |
| | | console.log(list, name); |
| | | res.push(list[name]); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | drawSwitch1 (ctx, opts) { |
| | | // this.resetPosition(opts); |
| | | ctx.save(); |
| | | ctx.lineWidth = this.lineWidth; |
| | | ctx.strokeStyle = this.strokeStyle; |
| | | ctx.fillStyle = this.fillStyle; |
| | | ctx.fillStyle = '#fff'; |
| | | ctx.textAlign = 'center'; |
| | | ctx.textBaseline = 'middle'; |
| | | ctx.font = '14px Arial'; |
| | | ctx.translate(opts.x, opts.y); |
| | | ctx.beginPath(); |
| | | ctx.arc(0, 0, opts.r, 0, Math.PI * 2); |
| | | ctx.fill(); |
| | | ctx.closePath(); |
| | | ctx.beginPath(); |
| | | ctx.arc(opts.distance, 0, opts.r, 0, Math.PI * 2); |
| | | ctx.fill(); |
| | | ctx.closePath(); |
| | | |
| | | ctx.save(); |
| | | if (opts.isOn) { |
| | | ctx.rotate(-3 * Math.PI / 180); |
| | | } else { |
| | | ctx.rotate(-30 * Math.PI / 180); |
| | | } |
| | | ctx.lineWidth = this.lineWidth; |
| | | ctx.strokeStyle = this.strokeStyle; |
| | | ctx.globalCompositeOperation = 'destination-over'; |
| | | ctx.beginPath(); |
| | | ctx.moveTo(0, 0); |
| | | ctx.lineTo(opts.distance, 0); |
| | | ctx.stroke(); |
| | | ctx.closePath(); |
| | | ctx.restore(); |
| | | // æå |
| | | ctx.fillText(opts.txt, opts.distance / 2, - Math.tan(36 * Math.PI / 180) * opts.distance); |
| | | ctx.globalCompositeOperation = 'destination-over'; |
| | | if (opts.block) { |
| | | if (opts.blockLeft) { |
| | | ctx.moveTo(0, 0); |
| | | ctx.lineTo(- 20 - opts.blockWidth, 0); |
| | | ctx.rect(- 20 - opts.blockWidth, - opts.blockHeight / 2, opts.blockWidth, opts.blockHeight); |
| | | } else { |
| | | ctx.moveTo(opts.distance, 0); |
| | | ctx.lineTo(opts.distance + 20 + opts.blockWidth, 0); |
| | | ctx.rect(opts.distance + 20, - opts.blockHeight / 2, opts.blockWidth, opts.blockHeight); |
| | | } |
| | | ctx.stroke(); |
| | | ctx.closePath(); |
| | | |
| | | } |
| | | |
| | | ctx.restore(); |
| | | |
| | | } |
| | | |
| | | // ç»å¼å
³ |
| | | draw_Switch_1 (opts, whetherAdd) { |
| | | whetherAdd = whetherAdd == undefined || !!whetherAdd; |
| | | let type = 'switch1'; |
| | | let { |
| | | context |
| | | ,x |
| | | ,y |
| | | ,txt |
| | | ,isOn |
| | | // æ¯å¦å¸¦å°æ¹å |
| | | ,block |
| | | ,blockLeft |
| | | } = opts; |
| | | |
| | | let r = 3; |
| | | let distance = 20; |
| | | let blockWidth = 10; |
| | | let blockHeight = 8; |
| | | |
| | | context.save(); |
| | | context.fillStyle = '#fff'; |
| | | context.textAlign = 'center'; |
| | | context.textBaseline = 'middle'; |
| | | context.font = '14px Arial'; |
| | | context.translate(x, y); |
| | | context.beginPath(); |
| | | context.arc(0, 0, r, 0, Math.PI * 2); |
| | | context.fill(); |
| | | context.closePath(); |
| | | context.beginPath(); |
| | | context.arc(distance, 0, r, 0, Math.PI * 2); |
| | | context.fill(); |
| | | context.closePath(); |
| | | |
| | | context.save(); |
| | | if (isOn) { |
| | | context.rotate(-3 * Math.PI / 180); |
| | | } else { |
| | | context.rotate(-30 * Math.PI / 180); |
| | | } |
| | | context.lineWidth = this.lineWidth; |
| | | context.strokeStyle = this.strokeStyle; |
| | | context.globalCompositeOperation = 'destination-over'; |
| | | context.beginPath(); |
| | | context.moveTo(0, 0); |
| | | context.lineTo(distance, 0); |
| | | context.stroke(); |
| | | context.closePath(); |
| | | context.restore(); |
| | | // æå |
| | | context.fillText(txt, distance / 2, - Math.tan(36 * Math.PI / 180) * distance); |
| | | context.globalCompositeOperation = 'destination-over'; |
| | | if (block) { |
| | | if (blockLeft) { |
| | | context.moveTo(0, 0); |
| | | context.lineTo(- 20 - blockWidth, 0); |
| | | context.rect(- 20 - blockWidth, - blockHeight / 2, blockWidth, blockHeight); |
| | | } else { |
| | | context.moveTo(distance, 0); |
| | | context.lineTo(distance + 20 + blockWidth, 0); |
| | | context.rect(distance + 20, - blockHeight / 2, blockWidth, blockHeight); |
| | | } |
| | | context.stroke(); |
| | | context.closePath(); |
| | | |
| | | } |
| | | |
| | | context.restore(); |
| | | |
| | | |
| | | let periphery = { |
| | | point_left: [0, 0] |
| | | ,point_right: [distance, 0] |
| | | // è¿ä¸ªæ±½ååªæå·¦å³è¿æ¥ ä¸ä¸çç¹å¯ä»¥ä¸ç¨ |
| | | ,point_top: [-1, -1] |
| | | ,point_bottom: [-1, -1] |
| | | } |
| | | let options = { |
| | | type: type |
| | | ,x: x |
| | | ,y: y |
| | | ,r |
| | | ,txt |
| | | ,isOn |
| | | // æ¯å¦å¸¦å°æ¹å |
| | | ,block |
| | | ,blockLeft |
| | | ,distance |
| | | ,blockWidth |
| | | ,blockHeight |
| | | // ,name: name |
| | | ,center: [x + distance / 2, y] |
| | | ,periphery |
| | | ,method: 'drawSwitch1' |
| | | }; |
| | | |
| | | whetherAdd && this[addToObj](type, options); |
| | | } |
| | | |
| | | draw_switch (opts, whetherAdd) { |
| | | whetherAdd = whetherAdd == undefined || !!whetherAdd; |
| | | let type = 'switch'; |
| | | let context = this.context; |
| | | this.drawSwitch(context, opts); |
| | | |
| | | let options = Object.assign({}, opts, { |
| | | type |
| | | ,method: 'drawSwitch' |
| | | }); |
| | | |
| | | whetherAdd && this[addToObj](type, options); |
| | | } |
| | | |
| | | drawTitle (ctx, opts) { |
| | | ctx.save(); |
| | | ctx.beginPath(); |
| | | ctx.translate(this.width / 2, 6); |
| | | ctx.textAlign = 'center'; |
| | | ctx.textBaseline = 'top'; |
| | | ctx.font = '24px Arial'; |
| | | ctx.fillStyle = opts.color || '#fff'; |
| | | ctx.fillText(opts.title, 0, 0); |
| | | ctx.closePath(); |
| | | ctx.restore(); |
| | | } |
| | | |
| | | |
| | | // ç»ç©å½¢å 使¡ |
| | | drawRect1 (opts, whetherAdd) { |
| | | whetherAdd = whetherAdd == undefined || !!whetherAdd; |
| | | let type = 'rect'; |
| | | let { |
| | | x |
| | | ,y |
| | | ,width |
| | | ,height |
| | | ,subName |
| | | ,color |
| | | } = opts; |
| | | |
| | | if (subName) { |
| | | type += '_' + subName; |
| | | } |
| | | |
| | | let context = this.context; |
| | | |
| | | context.save(); |
| | | context.translate(x, y); |
| | | context.beginPath(); |
| | | context.lineWidth = 1; |
| | | context.strokeStyle = color || this.strokeStyle; |
| | | context.strokeRect(0, 0, width, height); |
| | | context.closePath(); |
| | | context.restore(); |
| | | |
| | | let options = { |
| | | method: 'drawRect' |
| | | ,x |
| | | ,y |
| | | ,strokeStyle: color |
| | | ,lineWidth: opts.lineWidth |
| | | ,tlPoint: { |
| | | x: x |
| | | ,y: y |
| | | } |
| | | ,trPoint: { |
| | | x: x + width |
| | | ,y: y |
| | | } |
| | | ,brPoint: { |
| | | x: x + width |
| | | ,y: y + height |
| | | } |
| | | ,blPoint: { |
| | | x: x |
| | | ,y: y + height |
| | | } |
| | | ,top: y |
| | | ,left: x |
| | | ,right: x + width |
| | | ,bottom: y + height |
| | | ,width: width |
| | | ,height: height |
| | | } |
| | | whetherAdd && this[addToObj](type, options); |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | export default {"width":1050,"height":800,"data":{"power_0":{"type":"power","src":"http://localhost:9090/dragdemo/img/cgj.6b79ac54.png","points":[],"width":100,"height":90,"x":50,"y":105,"center":[100,150],"periphery":{"point_left":[5,45],"point_top":[50,8],"point_right":[99,45],"point_bottom":[50,83]},"method":"drawDevImg","id":"power_0"},"power_1":{"type":"power","src":"http://localhost:9090/dragdemo/img/clx.f73c4e0d.png","points":[],"width":88,"height":90,"x":156,"y":305,"center":[200,350],"periphery":{"point_left":[1,45],"point_top":[44,0],"point_right":[87,45],"point_bottom":[44,89]},"method":"drawDevImg","id":"power_1"},"power_2":{"type":"power","src":"http://localhost:9090/dragdemo/img/czt.65e41f78.png","points":[],"width":60,"height":90,"x":20,"y":555,"center":[50,600],"periphery":{"point_left":[0,45],"point_top":[30,0],"point_right":[59,45],"point_bottom":[30,89]},"method":"drawDevImg","id":"power_2"},"load_0":{"type":"load","src":"http://localhost:9090/dragdemo/img/tbdj.812f40c1.png","points":[],"width":114,"height":90,"x":793,"y":155,"center":[850,200],"periphery":{"point_left":[6,45],"point_top":[57,15],"point_right":[113,45],"point_bottom":[57,85]},"method":"drawDevImg","id":"load_0"},"load_1":{"type":"load","src":"http://localhost:9090/dragdemo/img/gsz.3b4dfa80.png","points":[],"width":80,"height":90,"x":960,"y":355,"center":[1000,400],"periphery":{"point_left":[0,45],"point_top":[40,0],"point_right":[79,45],"point_bottom":[40,89]},"method":"drawDevImg","id":"load_1"},"load_2":{"type":"load","src":"http://localhost:9090/dragdemo/img/zdcsxt.7692b31e.png","points":[],"width":60,"height":90,"x":820,"y":605,"center":[850,650],"periphery":{"point_left":[2,45],"point_top":[30,0],"point_right":[58,45],"point_bottom":[30,89]},"method":"drawDevImg","id":"load_2"},"line1_0":{"type":"line","points":[[149,150],[350,150]],"center":null,"method":"drawLine","dragLinePoints":[],"dragLineDirection":null,"dragLinePosition":null,"id":"line1_0"},"line1_1":{"type":"line","points":[[193,350],[350,350]],"center":null,"method":"drawLine","dragLinePoints":[],"dragLineDirection":null,"dragLinePosition":null,"id":"line1_1"},"line1_2":{"type":"line","points":[[79,600],[350,600]],"center":null,"method":"drawLine","dragLinePoints":[],"dragLineDirection":null,"dragLinePosition":null,"id":"line1_2"},"line1_3":{"type":"line","points":[[700,200],[799,200]],"center":null,"method":"drawLine","dragLinePoints":[],"dragLineDirection":null,"dragLinePosition":null,"id":"line1_3"},"line1_4":{"type":"line","points":[[700,400],[960,400]],"center":null,"method":"drawLine","dragLinePoints":[],"dragLineDirection":null,"dragLinePosition":null,"id":"line1_4"},"line1_5":{"type":"line","points":[[700,650],[822,650]],"center":null,"method":"drawLine","dragLinePoints":[],"dragLineDirection":null,"dragLinePosition":null,"id":"line1_5"},"switch_0":{"type":"switch","height":80,"isOn":false,"method":"drawSwitch","r":6,"x":350,"y":464,"id":"switch_0"},"switch_1":{"type":"switch","height":80,"isOn":false,"clickAble":true,"method":"drawSwitch","r":6,"x":700,"y":492,"id":"switch_1"},"test_0":{"type":"test","width":90,"height":60,"x":505,"y":220,"name":"åè¯è®¾å¤","center":[550,250],"method":"drawTest","periphery":{"point_left":[0,30],"point_right":[90,30],"point_top":[45,0],"point_bottom":[45,60]},"id":"test_0"},"test_1":{"type":"test","width":90,"height":60,"x":505,"y":620,"name":"åè¯è®¾å¤","center":[550,650],"method":"drawTest","periphery":{"point_left":[0,30],"point_right":[90,30],"point_top":[45,0],"point_bottom":[45,60]},"id":"test_1"},"line2_0":{"type":"line","points":[[550,280],[550,620]],"center":[550,"*"],"method":"drawLine","dragLinePoints":[],"dragLineDirection":null,"dragLinePosition":null,"id":"line2_0"},"line1_6":{"type":"line","points":[[350,250],[505,250]],"center":null,"method":"drawLine","dragLinePoints":[],"dragLineDirection":null,"dragLinePosition":null,"id":"line1_6"},"line1_7":{"type":"line","points":[[350,650],[505,650]],"center":null,"method":"drawLine","dragLinePoints":[],"dragLineDirection":null,"dragLinePosition":null,"id":"line1_7"},"line1_8":{"type":"line","points":[[595,250],[700,250]],"center":null,"method":"drawLine","dragLinePoints":[],"dragLineDirection":null,"dragLinePosition":null,"id":"line1_8"},"line1_9":{"type":"line","points":[[595,650],[700,650]],"center":null,"method":"drawLine","dragLinePoints":[],"dragLineDirection":null,"dragLinePosition":null,"id":"line1_9"}}} |
| | |
| | | <el-input v-model.number="params.CharSotpCurr"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell pr16"> |
| | | <!-- <div class="table-cell pr16"> |
| | | <el-form-item label="å
çµå®¹é(AH)" prop="CharCap"> |
| | | <el-input v-model.number="params.CharCap"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | </div> --> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="åä½ä¸é(V)" prop="MonVolHightLimit"> |
| | | <el-input v-model.number="params.MonVolHightLimit"></el-input> |
| | | <el-input v-model="params.MonVolHightLimit"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell"> |
| | |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="æµ®å
æ¶é¿(åé)" prop="FloatCharTimeLong"> |
| | | <el-input v-model.number="params.FloatCharTimeLong"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | </div> |
| | | <div class="table-row"> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="ææµæ»é¶æ®µæ°" prop="FlowOver_Count"> |
| | | <el-select v-model="params.FlowOver_Count" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="item in flowOverCount" :key="item" |
| | | :label="item" |
| | | :value="item"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="ææµ1é¶æ®µå
çµçµæµ" prop="FlowOver_CharCurr_1"> |
| | | <el-input v-model.number="params.FlowOver_CharCurr_1"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="ææµ2é¶æ®µå
çµçµæµ" prop="FlowOver_CharCurr_2"> |
| | | <el-input v-model.number="params.FlowOver_CharCurr_2"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell"> |
| | | <el-form-item label="ææµ3é¶æ®µå
çµçµæµ" prop="FlowOver_CharCurr_3"> |
| | | <el-input v-model.number="params.FlowOver_CharCurr_3"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | </div> |
| | | <div class="table-row"> |
| | | <div class="table-cell pr16"> |
| | | </div> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="ææµ1é¶æ®µå
çµæ¶é¿" prop="FlowOver_CharTime_1"> |
| | | <el-input v-model.number="params.FlowOver_CharTime_1"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="ææµ2é¶æ®µå
çµæ¶é¿" prop="FlowOver_CharTime_2"> |
| | | <el-input v-model.number="params.FlowOver_CharTime_2"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell"> |
| | | <el-form-item label="ææµ3é¶æ®µå
çµæ¶é¿" prop="FlowOver_CharTime_3"> |
| | | <el-input v-model.number="params.FlowOver_CharTime_3"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | </div> |
| | |
| | | <div class="table-row"> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="æ¾çµé»å¼(mΩ)" prop="DisPreRes"> |
| | | <el-input v-model.number="params.DisPreRes"></el-input> |
| | | <el-input v-model="params.DisPreRes"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="颿¾åç(KW)" prop="DisPower"> |
| | | <el-input v-model.number="params.DisPower"></el-input> |
| | | <el-input v-model="params.DisPower"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell pr16"> |
| | |
| | | return { |
| | | setFaceShow: false, |
| | | startFaceShow: false, |
| | | flowOverCount: const_aio.flowOverCount, |
| | | cmd: cmd, // æä½å½ä»¤ |
| | | startTestFlag: false, // å¯å¨æµè¯çç¶æ |
| | | setTestFlag: false, // è®¾ç½®åæ°çç¶æ |
| | |
| | | params: { |
| | | AutoTestStartVol: 0, //æµ®å
çµå(V) |
| | | BattGroupNum: 0, //çµæ± ç»ç¼å· |
| | | CharCap: 0, //å
çµå®¹é(AH) |
| | | CharCap: 0, //å
çµå®¹é(AH)(䏿¾ç¤º) |
| | | CharHighTmp: 0, //å
çµè¿æ¸© |
| | | CharSotpCurr: 0, //æªæ¢çµæµ |
| | | CharTimeLong: 0, //å
çµæ¶é¿ |
| | |
| | | OffLineYHOnceCycle: 1, //æ´»åèµ·ç¹ |
| | | OffLineYHTimes: 1, //æ´»åæ¬¡æ° |
| | | OffLineYH_Cycle: 0, //çµæ± ç»æ 称容é |
| | | FlowOver_Count: 1, //ææµæ»é¶æ®µæ° |
| | | FlowOver_CharCurr_1: 0,//ææµ1é¶æ®µå
çµçµæµ |
| | | FlowOver_CharCurr_2: 0,//ææµ2é¶æ®µå
çµçµæµ |
| | | FlowOver_CharCurr_3: 0,//ææµ3é¶æ®µå
çµçµæµ |
| | | FlowOver_CharTime_1: 0, //ææµ3é¶æ®µå
çµæ¶é¿ |
| | | FlowOver_CharTime_2: 0, //ææµ3é¶æ®µå
çµæ¶é¿ |
| | | FlowOver_CharTime_3: 0, //ææµ3é¶æ®µå
çµæ¶é¿ |
| | | OffLineYHstarttime: "2000-01-01 00:00:00",//å
»æ¤å¼å§æ¶é´ |
| | | OnLineVol_Low: 0, //å
çµçµå |
| | | OnlineLowAction: 0, //æµè¯ç±»å 0:æçµæµï¼1ï¼æåçï¼2ï¼æçµé» |
| | |
| | | }, |
| | | trigger: 'change' |
| | | }], |
| | | CharCap: [{ |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, rules.CharCap) |
| | | }, |
| | | trigger: 'change' |
| | | }], |
| | | // CharCap: [{ |
| | | // validator(rule, value, callback) { |
| | | // testVal(rule, value, callback, rules.CharCap) |
| | | // }, |
| | | // trigger: 'change' |
| | | // }], |
| | | CharHighTmp: [{ |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, rules.CharHighTmp) |
| | |
| | | }, |
| | | trigger: 'change' |
| | | }], |
| | | FloatCharTimeLong: [{ |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, rules.FloatCharTimeLong) |
| | | }, |
| | | trigger: 'change' |
| | | }], |
| | | // FloatCharTimeLong: [{ |
| | | // validator(rule, value, callback) { |
| | | // testVal(rule, value, callback, rules.FloatCharTimeLong) |
| | | // }, |
| | | // trigger: 'change' |
| | | // }], |
| | | GroupVol_Low: [{ |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, rules.GroupVol_Low) |
| | |
| | | OffLineYHOnceCycle: 1, //æ´»åèµ·ç¹ |
| | | OffLineYHTimes: 1, //æ´»åæ¬¡æ° |
| | | OffLineYH_Cycle: 0, //çµæ± ç»æ 称容é |
| | | FlowOver_Count: 1, //ææµæ»é¶æ®µæ° |
| | | FlowOver_CharCurr_1: 0,//ææµ1é¶æ®µå
çµçµæµ |
| | | FlowOver_CharCurr_2: 0,//ææµ2é¶æ®µå
çµçµæµ |
| | | FlowOver_CharCurr_3: 0,//ææµ3é¶æ®µå
çµçµæµ |
| | | FlowOver_CharTime_1: 0, //ææµ3é¶æ®µå
çµæ¶é¿ |
| | | FlowOver_CharTime_2: 0, //ææµ3é¶æ®µå
çµæ¶é¿ |
| | | FlowOver_CharTime_3: 0, //ææµ3é¶æ®µå
çµæ¶é¿ |
| | | OffLineYHstarttime: "2000-01-01 00:00:00",//å
»æ¤å¼å§æ¶é´ |
| | | OnLineVol_Low: 0, //å
çµçµå |
| | | OnlineLowAction: 0, //æµè¯ç±»å 0:æçµæµï¼1ï¼æåçï¼2ï¼æçµé» |
| | |
| | | |
| | | // æ¥è¯¢åå° |
| | | this.$apis.aio.realtime.getParams({ |
| | | dev_id: '618500001' || this.batt.FBSDeviceId |
| | | dev_id: this.batt.FBSDeviceId |
| | | ,op_cmd: const_aio.cmd.getParams |
| | | }).then(res => { |
| | | let rs = JSON.parse(res.data.result); |
| | | console.log(rs, '-------====='); |
| | | console.log('00000', rs, '-------====='); |
| | | // debugger; |
| | | if(rs.code == 1) { |
| | | let fsparam = rs.data[0]; |
| | |
| | | setParams() { |
| | | // çå¾
æ¡ |
| | | let loading = this.$layer.loading(1); |
| | | this.params.dev_id = 618500001; |
| | | // this.params.dev_id = 618500001; |
| | | // 请æ±åå° |
| | | this.$apis.aio.realtime.setParams(this.params).then(res => { |
| | | let rs = JSON.parse(res.data.result); |
New file |
| | |
| | | <template> |
| | | <div class="params-container"> |
| | | <el-form |
| | | ref="ruleForm" |
| | | size="mini" |
| | | label-position="top" |
| | | :model="params" |
| | | :rules="rules" |
| | | class="params-dialog"> |
| | | <el-form-item label="çµæ± ç»åç§°"> |
| | | <el-input v-model="otherParams.groupName" readonly></el-input> |
| | | </el-form-item> |
| | | <div class="table-layout"> |
| | | <div class="table-row"> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="设å¤ID"> |
| | | <el-input v-model="otherParams.FBSDeviceId" readonly></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell"> |
| | | <el-form-item label="çµæ± ç»ä¿¡æ¯"> |
| | | <el-input v-model="otherParams.groupInfo" readonly></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | </div> |
| | | <div class="table-row"> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="çµæ± ç»ç¼å·"> |
| | | <el-input v-model="otherParams.GroupIndexInFBSDevice" readonly></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="table-layout"> |
| | | <div class="table-row"> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="å
çµçµå(V)" prop="DisCurr"> |
| | | <el-input v-model="params.DisCurr"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="å
çµçµæµ(A)"> |
| | | <el-input v-model="params.HourRate"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell"> |
| | | <el-form-item label="æµ®å
çµå(V)" prop="DisCap"> |
| | | <el-input v-model="params.DisCap"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | </div> |
| | | <div class="table-row"> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="æµ®å
çµæµ(A)" prop="DisCap"> |
| | | <el-input v-model="params.DisCap"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="å
çµå®¹é(AH)" prop="DisTime"> |
| | | <el-input v-model="params.DisTime"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell"> |
| | | <el-form-item label="åä½ä¸é(V)" prop="MonomerVol_Low"> |
| | | <el-input v-model="params.MonomerVol_Low"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | </div> |
| | | <div class="table-row"> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="ä¸é个æ°(个)" prop="GroupVol_Low"> |
| | | <el-input v-model="params.GroupVol_Low"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="åå
æ¶é¿(åé)" prop="MonomerLowCount"> |
| | | <el-input v-model="params.MonomerLowCount"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell"> |
| | | <el-form-item label="æµ®å
æ¶é¿(åé)"> |
| | | <el-input v-model="params.DCVolHighLimit"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="form-footer"> |
| | | <!-- <three-btn>æ¸
é¤åè¦</three-btn> --> |
| | | <three-btn :disabled="!startTestFlag" @click="startTestCheck">å¯å¨å
çµ</three-btn> |
| | | <three-btn @click="getParams(true)">读å</three-btn> |
| | | <three-btn :disabled="!setTestFlag" @click="submitFrom">设å®</three-btn> |
| | | </div> |
| | | </el-form> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | testVal |
| | | } from "@/assets/js/tools"; |
| | | import { |
| | | const_aio |
| | | } from "@/assets/js/const" |
| | | import config from "@/assets/js/config"; |
| | | // import checkFace from "@/components/checkFace"; |
| | | export default { |
| | | name: "dischargeParams", |
| | | components: { |
| | | // checkFace |
| | | }, |
| | | props: { |
| | | batt: { |
| | | type: Object, |
| | | default() { |
| | | return {} |
| | | } |
| | | } |
| | | }, |
| | | data() { |
| | | let cmd = const_aio.cmd; |
| | | let testType = const_aio.testType; |
| | | let rules = const_aio.dischargeRules; |
| | | let batt = this.batt; |
| | | // ä¿®æ¹ç»ç«¯ä¸éçåå¼èå´ |
| | | rules.GroupVol_Low.min = (batt.MonCount*batt.MonVolStd*0.875).toHold(1); |
| | | rules.GroupVol_Low.max = (batt.MonCount*batt.MonVolStd*1.125).toHold(1); |
| | | rules.GroupVol_Low.msg = "åå¼èå´"+rules.GroupVol_Low.min+"~"+rules.GroupVol_Low.max+"(ä¿çä¸ä½å°æ°)"; |
| | | |
| | | // ä¿®æ¹çµæ± åä½ä¸éçåå¼èå´ |
| | | rules.MonomerVol_Low.min = (batt.MonVolStd*0.9).toHold(1); |
| | | rules.MonomerVol_Low.max = (batt.MonVolStd*1.2).toHold(1); |
| | | rules.MonomerVol_Low.msg = "åå¼èå´"+rules.MonomerVol_Low.min+"~"+rules.MonomerVol_Low.max+"(ä¿çä¸ä½å°æ°)"; |
| | | |
| | | return { |
| | | setFaceShow: false, |
| | | startFaceShow: false, |
| | | cmd: cmd, // æä½å½ä»¤ |
| | | startTestFlag: false, // å¯å¨æµè¯çç¶æ |
| | | setTestFlag: false, // è®¾ç½®åæ°çç¶æ |
| | | testType: testType, // æµè¯ç±»å |
| | | params: { |
| | | num: 0, //å½ä»¤ |
| | | dev_id: 0, //设å¤id |
| | | BattGroupNum: 0, //çµæ± ç»ç¼å· |
| | | DisCurr: 0, //æ¾çµçµæµ |
| | | DisCap: 0, //æ¾çµå®¹é |
| | | DisTime: 0, //æ¾çµæ¶é¿ |
| | | GroupVol_Low: 0, //ç»ç«¯ä¸ééå¼ |
| | | HourRate: 0, //æ¾çµå°æ¶ç |
| | | MonomerLowCount: 0, //åä½ä¸éæ°é |
| | | MonomerVol_Low: 0, //åä½ä¸ééå¼ |
| | | OnlineLowAction: 0, //å¨çº¿çµåä½å¤ç |
| | | TestCmd: 37, //æµè¯ç±»å |
| | | ChargeCurrSet: 0, //å
çµçµæµ |
| | | DCVolHighLimit: 0, //ååä¸é |
| | | MonomerTmp_High: 0 //温度ä¸é |
| | | }, |
| | | ranges: { |
| | | GroupVol_Low: { |
| | | name: 'ç»ç«¯çµåä¸é', |
| | | unit: 'V', |
| | | min: rules.GroupVol_Low.min, |
| | | max: rules.GroupVol_Low.max |
| | | }, |
| | | MonomerVol_Low: { |
| | | name: 'åä½çµåä¸é', |
| | | unit: 'V', |
| | | min: rules.MonomerVol_Low.min, |
| | | max: rules.MonomerVol_Low.max |
| | | } |
| | | }, |
| | | rules: { |
| | | DisCurr: [{ |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, rules.DisCurr) |
| | | }, |
| | | trigger: 'change' |
| | | }], |
| | | DisCap: [{ |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, rules.DisCap) |
| | | }, |
| | | trigger: 'change' |
| | | }], |
| | | DisTime: [{ |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, rules.DisTime) |
| | | }, |
| | | trigger: 'change' |
| | | }], |
| | | MonomerVol_Low: [{ |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, rules.MonomerVol_Low) |
| | | }, |
| | | trigger: 'change' |
| | | }], |
| | | GroupVol_Low: [{ |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, rules.GroupVol_Low) |
| | | }, |
| | | trigger: 'change' |
| | | }], |
| | | }, |
| | | } |
| | | }, |
| | | methods: { |
| | | initParams() { |
| | | // åå§ååæ° |
| | | this.params = { |
| | | num: 0, //å½ä»¤ |
| | | dev_id: 0, //设å¤id |
| | | BattGroupNum: 0, //çµæ± ç»ç¼å· |
| | | DisCurr: 0, //æ¾çµçµæµ |
| | | DisCap: 0, //æ¾çµå®¹é |
| | | DisTime: 0, //æ¾çµæ¶é¿ |
| | | GroupVol_Low: 0, //ç»ç«¯ä¸ééå¼ |
| | | HourRate: 0, //æ¾çµå°æ¶ç |
| | | MonomerLowCount: 0, //åä½ä¸éæ°é |
| | | MonomerVol_Low: 0, //åä½ä¸ééå¼ |
| | | OnlineLowAction: 0, //å¨çº¿çµåä½å¤ç |
| | | TestCmd: 37, //æµè¯ç±»å |
| | | ChargeCurrSet: 0, //å
çµçµæµ |
| | | DCVolHighLimit: 0, //ååä¸é |
| | | MonomerTmp_High: 0 //温度ä¸é |
| | | }; |
| | | }, |
| | | // è·ååæ° |
| | | getParams(showLoad) { |
| | | // å®ä¹çå¾
æ¡ |
| | | let loading; |
| | | if (showLoad) { |
| | | loading = this.$layer.loading(1); |
| | | } |
| | | // å¯å¨æé®ä¸å¯ç¹å» |
| | | this.startTestFlag = false; |
| | | |
| | | // æ¥è¯¢åå° |
| | | this.$apis.dischargeTest.bts.getParams({ |
| | | num: this.cmd.get, |
| | | dev_id: this.batt.FBSDeviceId |
| | | }).then(res => { |
| | | let rs = JSON.parse(res.data.result); |
| | | if(rs.code == 1) { |
| | | let testType = this.testType; |
| | | let fsparam = rs.data[0].fsparam; |
| | | let isIn = this.checkValIsInObjects(fsparam.TestCmd, testType); |
| | | // éå忰屿§å¹¶èµå¼ |
| | | for (let key in this.params) { |
| | | if (key === "TestCmd" && !isIn) { |
| | | this.params.TestCmd = 37; |
| | | } else { |
| | | this.params[key] = fsparam[key]; |
| | | } |
| | | } |
| | | // 设置çå½ä»¤ådev_id |
| | | this.params.num = this.cmd.set; |
| | | this.params.dev_id = this.batt.FBSDeviceId; |
| | | this.params.BattGroupNum = this.otherParams.GroupIndexInFBSDevice; |
| | | this.$layer.msg('读åæåï¼'); |
| | | // 设置æé®å¯ç¹å» |
| | | this.setTestFlag = true; |
| | | }else { |
| | | // åå§ååæ° |
| | | this.initParams(); |
| | | // 设置æé®ä¸å¯ç¹å» |
| | | this.setTestFlag = false; |
| | | this.$layer.msg('读å失败ï¼'); |
| | | } |
| | | // å
³éçå¾
æ¡ |
| | | this.$layer.close(loading); |
| | | }).catch(error=>{ |
| | | console.log(error); |
| | | // åå§ååæ° |
| | | this.initParams(); |
| | | // 设置æé®ä¸å¯ç¹å» |
| | | this.setTestFlag = false; |
| | | // å
³éçå¾
æ¡ |
| | | this.$layer.close(loading); |
| | | this.$layer.msg('读å失败ï¼è¯»å请æ±å¼å¸¸ï¼'); |
| | | }); |
| | | }, |
| | | // æäº¤è¡¨åè®¾ç½®åæ° |
| | | submitFrom() { |
| | | this.$refs.ruleForm.validate((valid) => { |
| | | // æ ¡éªéè¿ |
| | | if (valid) { |
| | | // è®¾ç½®åæ° |
| | | this.setParamsCheck(); |
| | | } else { |
| | | this.$layer.msg('å卿 ¡éªæªéè¿çæ°æ®ï¼'); |
| | | return false; |
| | | } |
| | | }); |
| | | }, |
| | | setParamsCheck() { |
| | | if(config.dischargeByFace.value) { |
| | | this.setFaceShow = true; |
| | | }else { |
| | | this.setParams(true); |
| | | } |
| | | }, |
| | | // è®¾ç½®åæ° |
| | | setParams() { |
| | | // çå¾
æ¡ |
| | | let loading = this.$layer.loading(1); |
| | | // 请æ±åå° |
| | | this.$apis.dischargeTest.bts.setParams(this.params).then(res => { |
| | | let rs = JSON.parse(res.data.result); |
| | | if (rs.code == 1) { |
| | | // å¯å¨æé®å¯ç¹å» |
| | | this.startTestFlag = true; |
| | | // æç¤ºä¿¡æ¯ |
| | | this.$layer.msg('设置æå'); |
| | | } else { |
| | | // å¯å¨æé®ä¸å¯ç¹å» |
| | | this.startTestFlag = false; |
| | | // æç¤ºä¿¡æ¯ |
| | | this.$layer.msg('设置失败ï¼'); |
| | | } |
| | | // å
³éçå¾
æ¡ |
| | | this.$layer.close(loading); |
| | | }).catch(error => { |
| | | console.log(error); |
| | | // å
³éçå¾
æ¡ |
| | | this.$layer.close(loading); |
| | | // å¯å¨æé®ä¸å¯ç¹å» |
| | | this.startTestFlag = false; |
| | | // æç¤ºä¿¡æ¯ |
| | | this.$layer.msg('设置失败ï¼è®¾ç½®è¯·æ±å¼å¸¸ï¼'); |
| | | }); |
| | | }, |
| | | startTestCheck() { |
| | | if(config.dischargeByFace.value) { |
| | | this.startFaceShow = true; |
| | | }else { |
| | | this.confirmStartTest(); |
| | | } |
| | | }, |
| | | // ç¡®è®¤æ¡ |
| | | confirmStartTest() { |
| | | this.$layer.prompt({title: 'è¾å
¥å¯å¨å£ä»¤ï¼å¹¶ç¡®è®¤', formType: 2, area: ['300px', '180px']}, (pass, index) => { |
| | | // 请æ±åå°æ ¡éªå¯ç |
| | | this.$apis.login.checkUserPwd(pass).then(res=>{ |
| | | let rs = JSON.parse(res.data.result); |
| | | if(rs.code == 1) { |
| | | // å
³éå¼¹åºæ¡ |
| | | this.$layer.close(index); |
| | | this.$layer.msg("å¯ç æ£æµéè¿ï¼å¯å¨æµè¯"); |
| | | // å¯å¨æµè¯ |
| | | this.startTest(); |
| | | }else { |
| | | this.$layer.msg("å¯å¨å£ä»¤é误ï¼"); |
| | | } |
| | | }).catch(error=>{ |
| | | console.log(error); |
| | | this.$layer.msg("ç½ç»è¯·æ±å¼å¸¸"); |
| | | }); |
| | | }); |
| | | |
| | | }, |
| | | // å¯å¨ |
| | | startTest() { |
| | | // çå¾
æ¡ |
| | | let loading = this.$layer.loading(1); |
| | | // 请æ±åå° |
| | | this.$apis.dischargeTest.bts.start({ |
| | | num: this.cmd.start, |
| | | dev_id: this.batt.FBSDeviceId, |
| | | BattGroupNum: this.batt.GroupIndexInFBSDevice+1, |
| | | }).then(res => { |
| | | let rs = JSON.parse(res.data.result); |
| | | if (rs.code == 1) { |
| | | // æç¤ºä¿¡æ¯ |
| | | this.$layer.msg('å¯å¨æµè¯æå'); |
| | | } else { |
| | | // æç¤ºä¿¡æ¯ |
| | | this.$layer.msg('å¯å¨æµè¯å¤±è´¥ï¼'); |
| | | } |
| | | // å
³éçå¾
æ¡ |
| | | this.$layer.close(loading); |
| | | }).catch(error => { |
| | | console.log(error); |
| | | // å
³éçå¾
æ¡ |
| | | this.$layer.close(loading); |
| | | // æç¤ºä¿¡æ¯ |
| | | this.$layer.msg('å¯å¨æµè¯å¤±è´¥ï¼å¯å¨æµè¯è¯·æ±å¼å¸¸ï¼'); |
| | | }); |
| | | }, |
| | | checkValIsInObjects(val, objects) { |
| | | let rs = false; |
| | | for(let i=0; i<objects.length; i++) { |
| | | let obj = objects[i]; |
| | | if(obj.value === val) { |
| | | rs = true; |
| | | break; |
| | | } |
| | | } |
| | | return false; |
| | | }, |
| | | setFaceSuccess() { |
| | | this.setFaceShow = false; |
| | | this.setParams(); |
| | | }, |
| | | startFaceSuccess() { |
| | | this.startFaceShow = false; |
| | | this.startTest(); |
| | | }, |
| | | }, |
| | | computed: { |
| | | otherParams() { |
| | | let batt = this.batt; |
| | | let groupInfo = 'å使°é:' + this.batt.MonCount + ";çµå(V):" |
| | | + this.batt.MonVolStd + ";容é(AH):" + this.batt.MonCapStd; |
| | | return { |
| | | groupName: batt.StationName + "-" + batt.BattGroupName, |
| | | FBSDeviceId: batt.FBSDeviceId, |
| | | groupInfo: groupInfo, |
| | | GroupIndexInFBSDevice: this.batt.GroupIndexInFBSDevice + 1, |
| | | } |
| | | }, |
| | | rangeLabel() { |
| | | let ranges = this.ranges; |
| | | let result = {}; |
| | | for(let key in ranges) { |
| | | let item = ranges[key]; |
| | | result[key] = item.name+"("+item.min+"~"+item.max+item.unit+")"; |
| | | } |
| | | return result; |
| | | }, |
| | | }, |
| | | mounted() { |
| | | // è·åæ°æ® |
| | | this.getParams(true); |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .form-footer { |
| | | margin-top: 16px; |
| | | margin-bottom: 16px; |
| | | text-align: right; |
| | | } |
| | | |
| | | .form-footer .three-btn { |
| | | margin-left: 12px; |
| | | } |
| | | .params-container { |
| | | padding: 0.4rem; |
| | | background-color: #ececec; |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="params-container"> |
| | | <el-form |
| | | ref="ruleForm" |
| | | size="mini" |
| | | label-position="top" |
| | | :model="params" |
| | | :rules="rules" |
| | | class="params-dialog"> |
| | | <el-form-item label="çµæ± ç»åç§°"> |
| | | <el-input v-model="otherParams.groupName" readonly></el-input> |
| | | </el-form-item> |
| | | <div class="table-layout"> |
| | | <div class="table-row"> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="设å¤ID"> |
| | | <el-input v-model="otherParams.FBSDeviceId" readonly></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell"> |
| | | <el-form-item label="çµæ± ç»ä¿¡æ¯"> |
| | | <el-input v-model="otherParams.groupInfo" readonly></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | </div> |
| | | <div class="table-row"> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="çµæ± ç»ç¼å·"> |
| | | <el-input v-model="otherParams.GroupIndexInFBSDevice" readonly></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="table-layout"> |
| | | <div class="table-row"> |
| | | <div class="table-cell"> |
| | | <el-form-item label="æ¾çµæ¨¡å¼"> |
| | | <!-- æçµæµ åç çµé» --> |
| | | <el-select v-model="params.TestCmd" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="item in testType" :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="é¢è®¾çµæµ(A)" prop="DisCurr"> |
| | | <el-input v-model="params.DisCurr"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="é¢è®¾å®¹é(AH)"> |
| | | <el-input v-model="params.HourRate"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell"> |
| | | <el-form-item label="æ¾çµé»å¼(mΩ)" prop="DisCap"> |
| | | <el-input v-model="params.DisCap"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | </div> |
| | | <div class="table-row"> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="颿¾åç(KW)" prop="DisTime"> |
| | | <el-input v-model="params.DisTime"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="颿¾æ¶é´(åé)" prop="MonomerVol_Low"> |
| | | <el-input v-model="params.MonomerVol_Low"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell"> |
| | | <el-form-item label="ç»ç«¯ä¸é(V)" prop="GroupVol_Low"> |
| | | <el-input v-model="params.GroupVol_Low"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | </div> |
| | | <div class="table-row"> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="åä½ä¸é(V)" prop="GroupVol_Low"> |
| | | <el-input v-model="params.GroupVol_Low"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | <div class="table-cell pr16"> |
| | | <el-form-item label="åä½ä¸éæ°é(个)" prop="MonomerLowCount"> |
| | | <el-input v-model="params.MonomerLowCount"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="form-footer"> |
| | | <!-- <three-btn>æ¸
é¤åè¦</three-btn> --> |
| | | <three-btn :disabled="!startTestFlag" @click="startTestCheck">å¯å¨æ¾çµ</three-btn> |
| | | <three-btn @click="getParams(true)">读å</three-btn> |
| | | <three-btn :disabled="!setTestFlag" @click="submitFrom">设å®</three-btn> |
| | | </div> |
| | | <!-- <el-dialog |
| | | title="äººè¸æ ¡éª" width="480px" |
| | | :visible.sync="setFaceShow" |
| | | :close-on-click-modal="false" top="0" |
| | | :modal="false" |
| | | class="dialog-center" |
| | | :modal-append-to-body="false" :destroy-on-close="true"> |
| | | <check-face v-if="setFaceShow" @checkSuccess="setFaceSuccess"></check-face> |
| | | </el-dialog> |
| | | <el-dialog |
| | | title="äººè¸æ ¡éª" width="480px" |
| | | :visible.sync="startFaceShow" |
| | | :close-on-click-modal="false" top="0" |
| | | :modal="false" |
| | | class="dialog-center" |
| | | :modal-append-to-body="false" :destroy-on-close="true"> |
| | | <check-face v-if="startFaceShow" @checkSuccess="startFaceSuccess"></check-face> |
| | | </el-dialog> --> |
| | | </el-form> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | testVal |
| | | } from "@/assets/js/tools"; |
| | | import { |
| | | const_aio |
| | | } from "@/assets/js/const" |
| | | import config from "@/assets/js/config"; |
| | | // import checkFace from "@/components/checkFace"; |
| | | export default { |
| | | name: "dischargeParams", |
| | | components: { |
| | | // checkFace |
| | | }, |
| | | props: { |
| | | batt: { |
| | | type: Object, |
| | | default() { |
| | | return {} |
| | | } |
| | | } |
| | | }, |
| | | data() { |
| | | let cmd = const_aio.cmd; |
| | | let testType = const_aio.testType; |
| | | let rules = const_aio.dischargeRules; |
| | | let batt = this.batt; |
| | | // ä¿®æ¹ç»ç«¯ä¸éçåå¼èå´ |
| | | rules.GroupVol_Low.min = (batt.MonCount*batt.MonVolStd*0.875).toHold(1); |
| | | rules.GroupVol_Low.max = (batt.MonCount*batt.MonVolStd*1.125).toHold(1); |
| | | rules.GroupVol_Low.msg = "åå¼èå´"+rules.GroupVol_Low.min+"~"+rules.GroupVol_Low.max+"(ä¿çä¸ä½å°æ°)"; |
| | | |
| | | // ä¿®æ¹çµæ± åä½ä¸éçåå¼èå´ |
| | | rules.MonomerVol_Low.min = (batt.MonVolStd*0.9).toHold(1); |
| | | rules.MonomerVol_Low.max = (batt.MonVolStd*1.2).toHold(1); |
| | | rules.MonomerVol_Low.msg = "åå¼èå´"+rules.MonomerVol_Low.min+"~"+rules.MonomerVol_Low.max+"(ä¿çä¸ä½å°æ°)"; |
| | | |
| | | return { |
| | | setFaceShow: false, |
| | | startFaceShow: false, |
| | | cmd: cmd, // æä½å½ä»¤ |
| | | startTestFlag: false, // å¯å¨æµè¯çç¶æ |
| | | setTestFlag: false, // è®¾ç½®åæ°çç¶æ |
| | | testType: testType, // æµè¯ç±»å |
| | | params: { |
| | | num: 0, //å½ä»¤ |
| | | dev_id: 0, //设å¤id |
| | | BattGroupNum: 0, //çµæ± ç»ç¼å· |
| | | DisCurr: 0, //æ¾çµçµæµ |
| | | DisCap: 0, //æ¾çµå®¹é |
| | | DisTime: 0, //æ¾çµæ¶é¿ |
| | | GroupVol_Low: 0, //ç»ç«¯ä¸ééå¼ |
| | | HourRate: 0, //æ¾çµå°æ¶ç |
| | | MonomerLowCount: 0, //åä½ä¸éæ°é |
| | | MonomerVol_Low: 0, //åä½ä¸ééå¼ |
| | | OnlineLowAction: 0, //å¨çº¿çµåä½å¤ç |
| | | TestCmd: 37, //æµè¯ç±»å |
| | | ChargeCurrSet: 0, //å
çµçµæµ |
| | | DCVolHighLimit: 0, //ååä¸é |
| | | MonomerTmp_High: 0 //温度ä¸é |
| | | }, |
| | | ranges: { |
| | | GroupVol_Low: { |
| | | name: 'ç»ç«¯çµåä¸é', |
| | | unit: 'V', |
| | | min: rules.GroupVol_Low.min, |
| | | max: rules.GroupVol_Low.max |
| | | }, |
| | | MonomerVol_Low: { |
| | | name: 'åä½çµåä¸é', |
| | | unit: 'V', |
| | | min: rules.MonomerVol_Low.min, |
| | | max: rules.MonomerVol_Low.max |
| | | } |
| | | }, |
| | | rules: { |
| | | DisCurr: [{ |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, rules.DisCurr) |
| | | }, |
| | | trigger: 'change' |
| | | }], |
| | | DisCap: [{ |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, rules.DisCap) |
| | | }, |
| | | trigger: 'change' |
| | | }], |
| | | DisTime: [{ |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, rules.DisTime) |
| | | }, |
| | | trigger: 'change' |
| | | }], |
| | | MonomerVol_Low: [{ |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, rules.MonomerVol_Low) |
| | | }, |
| | | trigger: 'change' |
| | | }], |
| | | GroupVol_Low: [{ |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, rules.GroupVol_Low) |
| | | }, |
| | | trigger: 'change' |
| | | }], |
| | | }, |
| | | } |
| | | }, |
| | | methods: { |
| | | initParams() { |
| | | // åå§ååæ° |
| | | this.params = { |
| | | num: 0, //å½ä»¤ |
| | | dev_id: 0, //设å¤id |
| | | BattGroupNum: 0, //çµæ± ç»ç¼å· |
| | | DisCurr: 0, //æ¾çµçµæµ |
| | | DisCap: 0, //æ¾çµå®¹é |
| | | DisTime: 0, //æ¾çµæ¶é¿ |
| | | GroupVol_Low: 0, //ç»ç«¯ä¸ééå¼ |
| | | HourRate: 0, //æ¾çµå°æ¶ç |
| | | MonomerLowCount: 0, //åä½ä¸éæ°é |
| | | MonomerVol_Low: 0, //åä½ä¸ééå¼ |
| | | OnlineLowAction: 0, //å¨çº¿çµåä½å¤ç |
| | | TestCmd: 37, //æµè¯ç±»å |
| | | ChargeCurrSet: 0, //å
çµçµæµ |
| | | DCVolHighLimit: 0, //ååä¸é |
| | | MonomerTmp_High: 0 //温度ä¸é |
| | | }; |
| | | }, |
| | | // è·ååæ° |
| | | getParams(showLoad) { |
| | | // å®ä¹çå¾
æ¡ |
| | | let loading; |
| | | if (showLoad) { |
| | | loading = this.$layer.loading(1); |
| | | } |
| | | // å¯å¨æé®ä¸å¯ç¹å» |
| | | this.startTestFlag = false; |
| | | |
| | | // æ¥è¯¢åå° |
| | | this.$apis.dischargeTest.bts.getParams({ |
| | | num: this.cmd.get, |
| | | dev_id: this.batt.FBSDeviceId |
| | | }).then(res => { |
| | | let rs = JSON.parse(res.data.result); |
| | | if(rs.code == 1) { |
| | | let testType = this.testType; |
| | | let fsparam = rs.data[0].fsparam; |
| | | let isIn = this.checkValIsInObjects(fsparam.TestCmd, testType); |
| | | // éå忰屿§å¹¶èµå¼ |
| | | for (let key in this.params) { |
| | | if (key === "TestCmd" && !isIn) { |
| | | this.params.TestCmd = 37; |
| | | } else { |
| | | this.params[key] = fsparam[key]; |
| | | } |
| | | } |
| | | // 设置çå½ä»¤ådev_id |
| | | this.params.num = this.cmd.set; |
| | | this.params.dev_id = this.batt.FBSDeviceId; |
| | | this.params.BattGroupNum = this.otherParams.GroupIndexInFBSDevice; |
| | | this.$layer.msg('读åæåï¼'); |
| | | // 设置æé®å¯ç¹å» |
| | | this.setTestFlag = true; |
| | | }else { |
| | | // åå§ååæ° |
| | | this.initParams(); |
| | | // 设置æé®ä¸å¯ç¹å» |
| | | this.setTestFlag = false; |
| | | this.$layer.msg('读å失败ï¼'); |
| | | } |
| | | // å
³éçå¾
æ¡ |
| | | this.$layer.close(loading); |
| | | }).catch(error=>{ |
| | | console.log(error); |
| | | // åå§ååæ° |
| | | this.initParams(); |
| | | // 设置æé®ä¸å¯ç¹å» |
| | | this.setTestFlag = false; |
| | | // å
³éçå¾
æ¡ |
| | | this.$layer.close(loading); |
| | | this.$layer.msg('读å失败ï¼è¯»å请æ±å¼å¸¸ï¼'); |
| | | }); |
| | | }, |
| | | // æäº¤è¡¨åè®¾ç½®åæ° |
| | | submitFrom() { |
| | | this.$refs.ruleForm.validate((valid) => { |
| | | // æ ¡éªéè¿ |
| | | if (valid) { |
| | | // è®¾ç½®åæ° |
| | | this.setParamsCheck(); |
| | | } else { |
| | | this.$layer.msg('å卿 ¡éªæªéè¿çæ°æ®ï¼'); |
| | | return false; |
| | | } |
| | | }); |
| | | }, |
| | | setParamsCheck() { |
| | | if(config.dischargeByFace.value) { |
| | | this.setFaceShow = true; |
| | | }else { |
| | | this.setParams(true); |
| | | } |
| | | }, |
| | | // è®¾ç½®åæ° |
| | | setParams() { |
| | | // çå¾
æ¡ |
| | | let loading = this.$layer.loading(1); |
| | | // 请æ±åå° |
| | | this.$apis.dischargeTest.bts.setParams(this.params).then(res => { |
| | | let rs = JSON.parse(res.data.result); |
| | | if (rs.code == 1) { |
| | | // å¯å¨æé®å¯ç¹å» |
| | | this.startTestFlag = true; |
| | | // æç¤ºä¿¡æ¯ |
| | | this.$layer.msg('设置æå'); |
| | | } else { |
| | | // å¯å¨æé®ä¸å¯ç¹å» |
| | | this.startTestFlag = false; |
| | | // æç¤ºä¿¡æ¯ |
| | | this.$layer.msg('设置失败ï¼'); |
| | | } |
| | | // å
³éçå¾
æ¡ |
| | | this.$layer.close(loading); |
| | | }).catch(error => { |
| | | console.log(error); |
| | | // å
³éçå¾
æ¡ |
| | | this.$layer.close(loading); |
| | | // å¯å¨æé®ä¸å¯ç¹å» |
| | | this.startTestFlag = false; |
| | | // æç¤ºä¿¡æ¯ |
| | | this.$layer.msg('设置失败ï¼è®¾ç½®è¯·æ±å¼å¸¸ï¼'); |
| | | }); |
| | | }, |
| | | startTestCheck() { |
| | | if(config.dischargeByFace.value) { |
| | | this.startFaceShow = true; |
| | | }else { |
| | | this.confirmStartTest(); |
| | | } |
| | | }, |
| | | // ç¡®è®¤æ¡ |
| | | confirmStartTest() { |
| | | this.$layer.prompt({title: 'è¾å
¥å¯å¨å£ä»¤ï¼å¹¶ç¡®è®¤', formType: 2, area: ['300px', '180px']}, (pass, index) => { |
| | | // 请æ±åå°æ ¡éªå¯ç |
| | | this.$apis.login.checkUserPwd(pass).then(res=>{ |
| | | let rs = JSON.parse(res.data.result); |
| | | if(rs.code == 1) { |
| | | // å
³éå¼¹åºæ¡ |
| | | this.$layer.close(index); |
| | | this.$layer.msg("å¯ç æ£æµéè¿ï¼å¯å¨æµè¯"); |
| | | // å¯å¨æµè¯ |
| | | this.startTest(); |
| | | }else { |
| | | this.$layer.msg("å¯å¨å£ä»¤é误ï¼"); |
| | | } |
| | | }).catch(error=>{ |
| | | console.log(error); |
| | | this.$layer.msg("ç½ç»è¯·æ±å¼å¸¸"); |
| | | }); |
| | | }); |
| | | |
| | | }, |
| | | // å¯å¨ |
| | | startTest() { |
| | | // çå¾
æ¡ |
| | | let loading = this.$layer.loading(1); |
| | | // 请æ±åå° |
| | | this.$apis.dischargeTest.bts.start({ |
| | | num: this.cmd.start, |
| | | dev_id: this.batt.FBSDeviceId, |
| | | BattGroupNum: this.batt.GroupIndexInFBSDevice+1, |
| | | }).then(res => { |
| | | let rs = JSON.parse(res.data.result); |
| | | if (rs.code == 1) { |
| | | // æç¤ºä¿¡æ¯ |
| | | this.$layer.msg('å¯å¨æµè¯æå'); |
| | | } else { |
| | | // æç¤ºä¿¡æ¯ |
| | | this.$layer.msg('å¯å¨æµè¯å¤±è´¥ï¼'); |
| | | } |
| | | // å
³éçå¾
æ¡ |
| | | this.$layer.close(loading); |
| | | }).catch(error => { |
| | | console.log(error); |
| | | // å
³éçå¾
æ¡ |
| | | this.$layer.close(loading); |
| | | // æç¤ºä¿¡æ¯ |
| | | this.$layer.msg('å¯å¨æµè¯å¤±è´¥ï¼å¯å¨æµè¯è¯·æ±å¼å¸¸ï¼'); |
| | | }); |
| | | }, |
| | | checkValIsInObjects(val, objects) { |
| | | let rs = false; |
| | | for(let i=0; i<objects.length; i++) { |
| | | let obj = objects[i]; |
| | | if(obj.value === val) { |
| | | rs = true; |
| | | break; |
| | | } |
| | | } |
| | | return false; |
| | | }, |
| | | setFaceSuccess() { |
| | | this.setFaceShow = false; |
| | | this.setParams(); |
| | | }, |
| | | startFaceSuccess() { |
| | | this.startFaceShow = false; |
| | | this.startTest(); |
| | | }, |
| | | }, |
| | | computed: { |
| | | otherParams() { |
| | | let batt = this.batt; |
| | | let groupInfo = 'å使°é:' + this.batt.MonCount + ";çµå(V):" |
| | | + this.batt.MonVolStd + ";容é(AH):" + this.batt.MonCapStd; |
| | | return { |
| | | groupName: batt.StationName + "-" + batt.BattGroupName, |
| | | FBSDeviceId: batt.FBSDeviceId, |
| | | groupInfo: groupInfo, |
| | | GroupIndexInFBSDevice: this.batt.GroupIndexInFBSDevice + 1, |
| | | } |
| | | }, |
| | | rangeLabel() { |
| | | let ranges = this.ranges; |
| | | let result = {}; |
| | | for(let key in ranges) { |
| | | let item = ranges[key]; |
| | | result[key] = item.name+"("+item.min+"~"+item.max+item.unit+")"; |
| | | } |
| | | return result; |
| | | }, |
| | | }, |
| | | mounted() { |
| | | // è·åæ°æ® |
| | | this.getParams(true); |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .form-footer { |
| | | margin-top: 16px; |
| | | margin-bottom: 16px; |
| | | text-align: right; |
| | | } |
| | | |
| | | .form-footer .three-btn { |
| | | margin-left: 12px; |
| | | } |
| | | .params-container { |
| | | padding: 0.4rem; |
| | | background-color: #ececec; |
| | | } |
| | | </style> |
New file |
| | |
| | | import { |
| | | Timeout |
| | | } from '@/assets/js/tools'; |
| | | |
| | | import screenImage from '@/assets/js/diagram/images/screen.png'; |
| | | import loadImage from '@/assets/js/diagram/images/load.png'; |
| | | import battImage from '@/assets/js/diagram/images/elegroup.png'; |
| | | |
| | | let Img_screen = new Image(); |
| | | let Img_load = new Image(); |
| | | let Img_batt = new Image(); |
| | | Img_screen.src = screenImage; |
| | | Img_load.src = loadImage; |
| | | Img_batt.src = battImage; |
| | | |
| | | // console.log(Date.now(), 'init') |
| | | |
| | | // if (Img_batt.complete) { |
| | | // console.log(Date.now(), 'batt'); |
| | | // } else { |
| | | // Img_batt.addEventListener('load', () => { |
| | | // console.log(Date.now(), 'batt load'); |
| | | // }); |
| | | // } |
| | | |
| | | // let Img_screen = 'url(' + screenImage + ')'; |
| | | // let Img_load = 'url(' + loadImage + ')'; |
| | | // let Img_batt = 'url(' + battImage + ')'; |
| | | |
| | | // function getDataUrl (img) { |
| | | // let can = document.createElement('canvas'); |
| | | // let offCtx = can.getContext('2d'); |
| | | // let width = img.width; |
| | | // let height = img.height; |
| | | // can.width = width; |
| | | // can.height = height; |
| | | // console.dir(img); |
| | | // if (img.complete) { |
| | | // offCtx.drawImage(img, 0, 0, width, height); |
| | | // } else { |
| | | // img.addEventListener('load', () => { |
| | | // offCtx.drawImage(img, 0, 0, width, height); |
| | | // }); |
| | | // } |
| | | // return can; |
| | | // } |
| | | |
| | | // console.log(getDataUrl(Img_batt)); |
| | | |
| | | |
| | | let timer = new Timeout(); |
| | | const BALLCOLOR = '#00f7f9'; |
| | | let list = { |
| | | // äºæç®¡ |
| | | 'diode_0': { |
| | | x: 720 |
| | | ,y: 50 |
| | | ,method: 'drawDiode' |
| | | ,isHor: true |
| | | ,name: 'D1' |
| | | } |
| | | // äºæç®¡ |
| | | ,'diode_1': { |
| | | x: 628 |
| | | ,y: 254 |
| | | ,method: 'drawDiode' |
| | | } |
| | | ,'diode_2': { |
| | | x: 628 |
| | | ,y: 552 |
| | | ,method: 'drawDiode' |
| | | } |
| | | // èçº¿æ¡ |
| | | ,'dashline_0': { |
| | | points: [[106, 82], [870, 82], [870, 730], [106, 730], [106, 82]] |
| | | ,method: 'drawDashLine' |
| | | ,color: '#00f7f9' |
| | | ,lineWidth: 4 |
| | | } |
| | | // çµé» |
| | | ,'resistance_0': { |
| | | x: 800 |
| | | ,y: 216 |
| | | ,name: 'R1' |
| | | ,method: 'drawResistance' |
| | | } |
| | | // ,'switch_0': { |
| | | // x: 300 |
| | | // ,y: 120 |
| | | // ,distance: 60 |
| | | // ,method: 'drawSwitch' |
| | | // ,isOn: false |
| | | // ,name: 'K1' |
| | | // ,description: '80A' |
| | | // } |
| | | // ,'switch_1': { |
| | | // x: 300 |
| | | // ,y: 330 |
| | | // ,distance: 60 |
| | | // ,method: 'drawSwitch' |
| | | // ,isOn: false |
| | | // ,name: 'K2' |
| | | // ,description: '80A' |
| | | // } |
| | | // ,'switch_2': { |
| | | // x: 300 |
| | | // ,y: 420 |
| | | // ,distance: 60 |
| | | // ,method: 'drawSwitch' |
| | | // ,isOn: false |
| | | // ,name: 'K3' |
| | | // ,description: '80A' |
| | | // } |
| | | // ,'switch_3': { |
| | | // x: 820 |
| | | // ,y: 60 |
| | | // ,distance: 60 |
| | | // ,method: 'drawSwitch' |
| | | // ,isOn: false |
| | | // ,name: 'K4' |
| | | // // ,description: '80A' |
| | | // } |
| | | // ,'switch_4': { |
| | | // x: 660 |
| | | // ,y: 420 |
| | | // ,distance: 60 |
| | | // ,method: 'drawSwitch' |
| | | // ,isOn: false |
| | | // ,name: 'K5' |
| | | // ,description: '80A' |
| | | // } |
| | | // ,'switch_5': { |
| | | // x: 580 |
| | | // ,y: 220 |
| | | // ,distance: 60 |
| | | // ,method: 'drawSwitch' |
| | | // ,isOn: false |
| | | // ,direction: 'ver' |
| | | // } |
| | | // ,'switch_6': { |
| | | // x: 580 |
| | | // ,y: 520 |
| | | // ,distance: 60 |
| | | // ,method: 'drawSwitch' |
| | | // ,isOn: false |
| | | // ,direction: 'ver' |
| | | // } |
| | | ,'inductance_0': { |
| | | x: 404 |
| | | ,y: 420 |
| | | ,method: 'drawInductance' |
| | | ,name: 'L1' |
| | | ,color: '#00f7f9' |
| | | } |
| | | ,'rectifier_0': { |
| | | x: 120 |
| | | ,y: 160 |
| | | ,name: 'æ´æµå¨' |
| | | ,method: 'drawRectifier' |
| | | ,width: 68 |
| | | ,height: 100 |
| | | ,img: Img_screen |
| | | } |
| | | ,'rectifier_1': { |
| | | x: 950 |
| | | ,y: 320 |
| | | ,name: 'æ´æµå¨' |
| | | ,method: 'drawRectifier' |
| | | ,width: 80 |
| | | ,height: 120 |
| | | ,img: Img_screen |
| | | } |
| | | ,'load_0': { |
| | | x: 1180 |
| | | ,y: 320 |
| | | ,method: 'drawLoad' |
| | | ,name: 'ç¨æ·è´è½½' |
| | | ,width: 80 |
| | | ,height: 140 |
| | | ,img: Img_load |
| | | } |
| | | ,'batts_0': { |
| | | x: 30 |
| | | ,y: 480 |
| | | ,method: 'drawBatts' |
| | | ,name: 'çµæ± ç»' |
| | | ,width: 36 |
| | | ,height: 60 |
| | | ,distance: 24 |
| | | ,img: Img_batt |
| | | } |
| | | ,'line_0': { |
| | | points: [[47, 480], [47, 60], [720, 60]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_1': { |
| | | points: [[730, 60], [816, 60]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_2': { |
| | | points: [[884, 60], [1222, 60], [1222, 323]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_3': { |
| | | points: [[1222, 458], [1222, 700], [47, 700], [47, 624]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_4': { |
| | | points: [[154, 162], [154, 120], [296, 120]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_5': { |
| | | points: [[364, 120], [805, 120], [805, 216]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_6': { |
| | | points: [[805, 276], [805, 420], [724, 420]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_7': { |
| | | points: [[452, 420], [656, 420]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_8': { |
| | | points: [[364, 420], [404, 420]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_9': { |
| | | points: [[47, 420], [296, 420]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_10': { |
| | | points: [[154, 260], [154, 330], [296, 330]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_11': { |
| | | points: [[364, 330], [384, 330], [384, 420]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_12': { |
| | | points: [[580, 120], [580, 216]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_13': { |
| | | points: [[580, 284], [580, 516]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_14': { |
| | | points: [[580, 584], [580, 700]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_15': { |
| | | points: [[580, 196], [638, 196], [638, 244]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_16': { |
| | | points: [[638, 254], [638, 304], [580, 304]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_17': { |
| | | points: [[580, 496], [638, 496], [638, 542]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_18': { |
| | | points: [[638, 552], [638, 604], [580, 604]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_19': { |
| | | points: [[990, 60], [990, 322]] |
| | | ,method: 'drawLine' |
| | | } |
| | | ,'line_20': { |
| | | points: [[990, 440], [990, 700]] |
| | | ,method: 'drawLine' |
| | | } |
| | | }; |
| | | |
| | | // ç»é¢æ¿ |
| | | // const drawPanel = (can) => { |
| | | // can.drawRect1({ |
| | | // x: 400 |
| | | // ,y: 10 |
| | | // ,width: 260 |
| | | // ,height: 40 |
| | | // ,subName: 'title' |
| | | // // ,color: '#f00' |
| | | // }, true); |
| | | // } |
| | | // 颿¿ä½ç½®ä¿¡æ¯ |
| | | const panelPos = { |
| | | // title |
| | | title: { |
| | | left: 400 |
| | | ,top: 10 |
| | | ,width: 260 |
| | | ,height: 40 |
| | | } |
| | | } |
| | | |
| | | let firstTime = true; |
| | | |
| | | const resetFirstTime = function () { |
| | | firstTime = true; |
| | | } |
| | | // let ballList = []; |
| | | const updateBalls = (can, ballList) => { |
| | | let count = 0; |
| | | return function (ballList) { |
| | | can.updateCanvas(); |
| | | // console.log(ballList, '--------'); |
| | | for (let i = 0, j = ballList.length; i < j; i++) { |
| | | can.moveBall({ |
| | | points: ballList[i].points |
| | | ,direction: ballList[i].direction |
| | | ,fillStyle: ballList[i].fillStyle |
| | | }, count, ballList[i].ballNum); |
| | | } |
| | | count++; |
| | | count %= can.COUNT; |
| | | } |
| | | } |
| | | |
| | | const update = function (callback, stateL, status, ballList) { |
| | | if (!timer.callback) { |
| | | timer.init(function () { |
| | | callback(ballList); |
| | | timer.open(); |
| | | }, 1000 / 30); |
| | | } |
| | | |
| | | // console.log(status, 'status'); |
| | | let ctx = stateL.context; |
| | | stateL.clearCanvas(); |
| | | // stateL.drawLine(ctx, { |
| | | // points: [[500, 100], [500, 500], [800, 500]], |
| | | // color: status.Q1 ? '#00f7f9' : '#ccc' |
| | | // }); |
| | | // stateL.drawLine(ctx, { |
| | | // points: [[480, 200], [480, 600], [780, 600]], |
| | | // color: status.Q2 ? '#00f7f9' : '#ccc' |
| | | // }); |
| | | // æ¾çµçµæµ |
| | | // list1ä¸list3å
Œ
±ç第ä¸é¨å |
| | | const list0 = [ |
| | | {points: [47, 480, 47, 420], direction: status.state == 2 ? 'top' : 'bottom', fillStyle: BALLCOLOR, ballNum: 1} |
| | | ]; |
| | | |
| | | const list1 = [ |
| | | {points: [47, 480, 47, 420], direction: status.state == 2 ? 'top' : 'bottom', fillStyle: BALLCOLOR, ballNum: 1} |
| | | ,{points: [47, 420, 580, 420], direction: status.state == 2 ? 'right' : 'left', fillStyle: BALLCOLOR, ballNum: 4} |
| | | ,{points: [580, 420, 580, 700], direction: status.state == 2 ? 'bottom' : 'top', fillStyle: BALLCOLOR, ballNum: 3} |
| | | ]; |
| | | |
| | | const list2 = [ |
| | | {points: [580, 420, 580, 120], direction: 'top', fillStyle: BALLCOLOR, ballNum: 3} |
| | | ,{points: [580, 120, 805, 120], direction: 'right', fillStyle: BALLCOLOR, ballNum: 2} |
| | | ,{points: [805, 120, 805, 216], direction: 'bottom', fillStyle: BALLCOLOR, ballNum: 1} |
| | | ,{points: [805, 276, 805, 420], direction: 'bottom', fillStyle: BALLCOLOR, ballNum: 1} |
| | | ,{points: [580, 420, 805, 420], direction: 'left', fillStyle: BALLCOLOR, ballNum: 2} |
| | | ]; |
| | | |
| | | const list3 = [ |
| | | {points: [47, 420, 47, 60], direction: 'top', fillStyle: BALLCOLOR, ballNum: 4} |
| | | ,{points: [47, 60, 1222, 60], direction: 'right', fillStyle: BALLCOLOR, ballNum: 10} |
| | | ,{points: [1222, 323, 1222, 60], direction: 'bottom', fillStyle: BALLCOLOR, ballNum: 3} |
| | | ,{points: [1222, 458, 1222, 700], direction: 'bottom', fillStyle: BALLCOLOR, ballNum: 3} |
| | | ,{points: [580, 700, 1222, 700], direction: 'left', fillStyle: BALLCOLOR, ballNum: 5} |
| | | ]; |
| | | // list1ä¸list3å
Œ
±ç¬¬äºé¨å |
| | | const list30 = [ |
| | | {points: [47, 700, 580, 700], direction: status.state == 2 ? 'left' : 'right', fillStyle: BALLCOLOR, ballNum: 4} |
| | | ,{points: [47, 624, 47, 700], direction: status.state == 2 ? 'top' : 'bottom', fillStyle: BALLCOLOR, ballNum: 1} |
| | | ]; |
| | | |
| | | const list4 = [ |
| | | {points: [154, 162, 154, 120], direction: 'top', fillStyle: BALLCOLOR, ballNum: 1} |
| | | ,{points: [154, 120, 580, 120], direction: 'right', fillStyle: BALLCOLOR, ballNum: 4} |
| | | ,{points: [580, 420, 580, 120], direction: 'bottom', fillStyle: BALLCOLOR, ballNum: 3} |
| | | ,{points: [580, 420, 384, 420], direction: 'left', fillStyle: BALLCOLOR, ballNum: 2} |
| | | ,{points: [384, 330, 384, 420], direction: 'top', fillStyle: BALLCOLOR, ballNum: 1} |
| | | ,{points: [154, 330, 384, 330], direction: 'left', fillStyle: BALLCOLOR, ballNum: 2} |
| | | ,{points: [154, 330, 154, 260], direction: 'top', fillStyle: BALLCOLOR, ballNum: 1} |
| | | ]; |
| | | // console.log('q3, q4, q5', status.Q3, status.Q4, status.Q5); |
| | | // æ¸
空æ°ç» 䏿¹åå°å; |
| | | ballList.length = 0; |
| | | let Q1 = status.state == 2 && firstTime; |
| | | let Q2 = status.state == 2 && !firstTime; |
| | | let Q3 = status.main; |
| | | let Q4 = status.state == 4 && firstTime; |
| | | let Q5 = status.state == 4 && !firstTime; |
| | | |
| | | stateL.draw_switch({ |
| | | x: 300 |
| | | ,y: 420 |
| | | ,distance: 60 |
| | | ,method: 'drawSwitch' |
| | | ,isOn: Q1 || Q5 |
| | | ,name: 'K3' |
| | | ,description: '80A' |
| | | }); |
| | | stateL.draw_switch({ |
| | | x: 580 |
| | | ,y: 520 |
| | | ,distance: 60 |
| | | ,method: 'drawSwitch' |
| | | ,isOn: Q1 || Q5 |
| | | ,direction: 'ver' |
| | | }); |
| | | |
| | | stateL.draw_switch({ |
| | | x: 660 |
| | | ,y: 420 |
| | | ,distance: 60 |
| | | ,method: 'drawSwitch' |
| | | ,isOn: Q2 |
| | | ,name: 'K5' |
| | | ,description: '80A' |
| | | }); |
| | | |
| | | stateL.draw_switch({ |
| | | x: 580 |
| | | ,y: 220 |
| | | ,distance: 60 |
| | | ,method: 'drawSwitch' |
| | | ,isOn: Q2 || Q4 |
| | | ,direction: 'ver' |
| | | }); |
| | | stateL.draw_switch({ |
| | | x: 300 |
| | | ,y: 120 |
| | | ,distance: 60 |
| | | ,method: 'drawSwitch' |
| | | ,isOn: Q4 |
| | | ,name: 'K1' |
| | | ,description: '80A' |
| | | }); |
| | | |
| | | stateL.draw_switch({ |
| | | x: 300 |
| | | ,y: 330 |
| | | ,distance: 60 |
| | | ,method: 'drawSwitch' |
| | | ,isOn: Q4 |
| | | ,name: 'K2' |
| | | ,description: '80A' |
| | | }); |
| | | |
| | | stateL.draw_switch({ |
| | | x: 820 |
| | | ,y: 60 |
| | | ,distance: 60 |
| | | ,method: 'drawSwitch' |
| | | ,isOn: Q3 |
| | | ,name: 'K4' |
| | | }) |
| | | |
| | | |
| | | if (Q1 || Q5) { |
| | | ballList.push(...list1, ...list0, ...list30); |
| | | // console.log('q3', ballList); |
| | | } |
| | | if (Q2) { |
| | | |
| | | ballList.push(...list2); |
| | | // console.log('q4', ballList); |
| | | } |
| | | if (Q3) { |
| | | ballList.push(...list3, ...list0, ...list30); |
| | | } |
| | | if (Q4) { |
| | | ballList.push(...list4); |
| | | } |
| | | timer.open(); |
| | | firstTime = !firstTime; |
| | | |
| | | }; |
| | | |
| | | export { |
| | | list |
| | | ,panelPos |
| | | ,resetFirstTime |
| | | // ,drawPanel |
| | | ,update |
| | | ,updateBalls |
| | | } |
| | |
| | | <flex-layout direction="row" class="page-real-time" :no-bg="true"> |
| | | <!-- å
æ¾çµä¸ä½æº --> |
| | | <content-box style="margin-left: 4px; margin-right: 4px;" :title="battFullName"> |
| | | <!-- <div slot="box-tools" class="box-tools"> |
| | | <div slot="box-tools" class="box-tools"> |
| | | <el-tooltip class="item" effect="dark" content="å岿°æ®" placement="bottom"> |
| | | <i class="iconfont el-icon-jinru" @click="syncPage"></i> |
| | | </el-tooltip> |
| | | </div> |
| | | <div slot="box-tools" class="box-tools" style="right: 40px;"> |
| | | <!-- <div slot="box-tools" class="box-tools" style="right: 40px;"> |
| | | <el-tooltip class="item" effect="dark" content="åå²å®æ¶æ°æ®" placement="bottom"> |
| | | <i class="el-iconfont el-icon-s-marketing" @click="historyRealTimeDataDialog.show=true"></i> |
| | | </el-tooltip> |
| | |
| | | <li class="hdw-menu-item" v-if="control.data.clearAlerm.show"> |
| | | <a @click="clearAlerm" href="javascript:void(0);">æ¸
é¤åè¦</a> |
| | | </li> |
| | | <li class="hdw-menu-item" v-if="control.data.pause.show"> |
| | | <!-- <li class="hdw-menu-item" v-if="control.data.pause.show"> |
| | | <a @click="pause(type)" href="javascript:void(0);">æå{{typeStr}}}</a> |
| | | </li> |
| | | </li> --> |
| | | </ul> |
| | | </div> |
| | | <button class="hdw-btn transparentBtn" slot="reference"> |
| | |
| | | </div> |
| | | </div> |
| | | </science-box> --> |
| | | <!-- <circuit-diagram |
| | | <circuit-diagram |
| | | ref="circuitDiagram" |
| | | :width="diagramOpt.width" |
| | | :height="diagramOpt.height" |
| | | wrap-class="wrap" |
| | | :debug="true" |
| | | :levelArr="['staticL', 'stateL', 'flushL']" |
| | | @ratioChanged="ratioChanged" |
| | | @debugClick="debugClick" |
| | | > |
| | | <canvas |
| | | :width="$options.width" |
| | | :height="$options.height" |
| | | ref="staticL"></canvas> |
| | | <canvas |
| | | :width="$options.width" |
| | | :height="$options.height" |
| | | ref="stateL"></canvas> |
| | | <canvas |
| | | :width="$options.width" |
| | | :height="$options.height" |
| | | ref="flushL"></canvas> |
| | | </circuit-diagram> --> |
| | | <div class="info-panel" :style="getStyle('title', 1)">{{diagram.desc}}</div> |
| | | </circuit-diagram> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="çµå" name="vol"> |
| | | <bar-chart ref="vol" id="vol" unit="V" right-menu></bar-chart> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="å
é»" name="res"> |
| | | <!-- <el-tab-pane label="å
é»" name="res"> |
| | | <bar-chart ref="res" id="res" unit="mΩ" max-color="red" min-color="green" right-menu></bar-chart> |
| | | </el-tab-pane> |
| | | </el-tab-pane> --> |
| | | <el-tab-pane label="温度" name="temp"> |
| | | <bar-chart ref="temp" id="temp" unit="â" max-color="red" min-color="green" right-menu></bar-chart> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="çµå¯¼" name="conduct"> |
| | | <!-- <el-tab-pane label="çµå¯¼" name="conduct"> |
| | | <bar-chart ref="conduct" id="conduct" right-menu></bar-chart> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="åè¡¡çµæµ" name="curr"> |
| | | </el-tab-pane> --> |
| | | <!-- <el-tab-pane label="åè¡¡çµæµ" name="curr"> |
| | | <bar-chart ref="curr" id="curr" unit="A" right-menu></bar-chart> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="æ¼æ¶²çµå" name="leakVol"> |
| | | <bar-chart ref="leakVol" id="leakVol" unit="V" right-menu></bar-chart> |
| | | </el-tab-pane> |
| | | </el-tab-pane> --> |
| | | |
| | | <el-tab-pane label="æ°æ®è¡¨æ ¼" name="tblData" class="el-table-wrapper"> |
| | | <el-table |
| | |
| | | <script> |
| | | import ContentBox from "@/components/ContentBox"; |
| | | import BarChart from "@/components/chart/BarChart"; |
| | | // import ChargeDialogContent from './components/chargeDialogContent'; |
| | | // import DischargeDialogContent from './components/dischargeDialogContent'; |
| | | import ActivateDialogContent from './components/activateDialogContent'; |
| | | import { |
| | | realTimeSearch, |
| | | realTimeGroup, |
| | | realTimePowerOff, |
| | | realTimeAlarm |
| | | } from '@/assets/js/realTime'; |
| | | |
| | | import { |
| | | Timeout, |
| | | getBarNum, |
| | | sethoubeiTime, |
| | | regEquipType, |
| | | formatSeconds, |
| | | isHasPermit |
| | | } from '@/assets/js/tools'; |
| | | |
| | | import { |
| | | list |
| | | ,panelPos |
| | | ,resetFirstTime |
| | | ,update |
| | | ,updateBalls |
| | | } from './js/draw_diagram'; |
| | | |
| | | import battGroupMager from '@/assets/js/apis/dataMager/battGroupMager'; |
| | | import getMarkLineData from "@/components/chart/js/getMarkLineData"; |
| | | |
| | | // import CircuitDiagram from '@/components/diagram/diagram'; |
| | | import CircuitDiagram from '@/components/diagram/diagram'; |
| | | |
| | | import Diagram from '@/components/diagram/js/diagram'; |
| | | import common from '@/components/diagram/js/common'; |
| | | let interval = common.interval; |
| | | |
| | | import { |
| | | const_aio |
| | | } from '@/assets/js/const'; |
| | | |
| | | let vol, resChart, temp, conduct, currChart, leakVol; |
| | | let staticL, stateL, flushL; |
| | | let tblData = []; |
| | | let ballList = []; |
| | | export default { |
| | | name: "realTimeAio", |
| | | components: { |
| | |
| | | // ChargeDialogContent, |
| | | // DischargeDialogContent, |
| | | ActivateDialogContent, |
| | | // CircuitDiagram |
| | | CircuitDiagram |
| | | }, |
| | | watch: { |
| | | "$route.params.BattGroupId"(BattGroupId) { |
| | |
| | | let isCanTest = isHasPermit('batt_test_op_permit', permits); |
| | | // let stateList = const_61850.stateList; |
| | | return { |
| | | acTabs: "vol", |
| | | isCanTest: !0 || isCanTest, |
| | | acTabs: "eleLine", |
| | | isCanTest: isCanTest, |
| | | dialogTitle: 'å
çµåæ°è®¾ç½®', |
| | | type: '', // å½åç¶æ charge discharge activate |
| | | moveBall: null, |
| | | // k4ç¶æ |
| | | main: false, |
| | | /* çµæ± ç¶æ 模å ç»ç«¯å±ç¤º */ |
| | | inputs: { |
| | | group_vol: 0 /* 端çµå-ç»ç«¯çµå */ , |
| | |
| | | batt_state: 0 /* çµæ± ç¶æ */ |
| | | }, |
| | | control: { |
| | | show: !0 || false, |
| | | show: true, |
| | | data: { |
| | | startCharge: { // å¯å¨å
çµ |
| | | show: true, |
| | |
| | | show: true, |
| | | typeshow: false, |
| | | id: 17 |
| | | }, |
| | | pause: { |
| | | show: false, |
| | | typeshow: false, |
| | | id: 18 |
| | | } |
| | | } |
| | | }, |
| | |
| | | show: false, |
| | | type: '' |
| | | }, |
| | | timer: new Timeout('movingRingSystemRealTime'), |
| | | timer: new Timeout('movingRingSysteRrealTime'), |
| | | timer2: new Timeout(), |
| | | table: { |
| | | headers: [ |
| | | { |
| | |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "res1", |
| | | label: "å
é»(mΩ)", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "temp1", |
| | | label: "温度(â)", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "conduct1", |
| | | label: "çµå¯¼", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "curr1", |
| | | label: "åè¡¡çµæµ(A)", |
| | | width: "" |
| | | }, |
| | | { |
| | | prop: "leakVol1", |
| | | label: "æ¼æ¶²çµå(V)", |
| | | width: "" |
| | | } |
| | | ], |
| | | datas: [] |
| | | }, |
| | |
| | | powerCut: 1, |
| | | temp: 0 // è®¾å¤æ¸©åº¦ |
| | | }, |
| | | diagramOpt: { |
| | | width: 1300, |
| | | height: 760, |
| | | } |
| | | ,stateList: const_aio.stateList |
| | | ,sta: { |
| | | Q1: false |
| | | ,Q2: false |
| | | ,Q3: false |
| | | ,Q4: false |
| | | ,Q5: false |
| | | } |
| | | } |
| | | }, |
| | | watch: { |
| | | 'diagram.type' (n) { |
| | | if (n == 2 || n ==4) { |
| | | resetFirstTime(); |
| | | } |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | tabClick(tab) { |
| | | // æ ¹æ®tabæ´æ°çµè·¯å¾ |
| | | if(this.acTabs === "eleLine") { |
| | | this.diagram.update = true; |
| | | }else { |
| | | this.diagram.update = false; |
| | | // this.diagram.update = true; |
| | | // console.log(this.timer2, 'timer2', this.timer2.callback, stateL); |
| | | this.$refs.circuitDiagram.resizeHandle(); |
| | | // debugger; |
| | | this.timer2.restart(); |
| | | // this.$nextTick(() => { |
| | | // this.timer2.restart(); |
| | | // }); |
| | | // this.init(); |
| | | // this.drawStatic(); |
| | | // this.loop(); |
| | | } else { |
| | | // this.diagram.update = false; |
| | | this.timer2.stop(); |
| | | } |
| | | // æ´æ°å¾è¡¨ |
| | | this.setChart(); |
| | |
| | | case 'vol': |
| | | this.$refs.vol.setOption(vol); |
| | | break; |
| | | case 'res': |
| | | this.$refs.res.setOption(resChart); |
| | | break; |
| | | // case 'res': |
| | | // this.$refs.res.setOption(resChart); |
| | | // break; |
| | | case 'temp': |
| | | this.$refs.temp.setOption(temp); |
| | | break; |
| | | case 'conduct': |
| | | this.$refs.conduct.setOption(conduct); |
| | | break; |
| | | case 'curr': |
| | | this.$refs.curr.setOption(currChart); |
| | | break; |
| | | case 'leakVol': |
| | | this.$refs.leakVol.setOption(leakVol); |
| | | break; |
| | | // case 'conduct': |
| | | // this.$refs.conduct.setOption(conduct); |
| | | // break; |
| | | // case 'curr': |
| | | // this.$refs.curr.setOption(currChart); |
| | | // break; |
| | | // case 'leakVol': |
| | | // this.$refs.leakVol.setOption(leakVol); |
| | | // break; |
| | | } |
| | | }, |
| | | getBattGroupInfo(BattGroupId) { |
| | | console.log(BattGroupId, 'battGroupId'); |
| | | // console.log(BattGroupId, 'battGroupId'); |
| | | this.$apis.dataMager.battGroupMager.getBattGroupInfo(BattGroupId).then(res=>{ |
| | | let rs = JSON.parse(res.data.result); |
| | | console.log(rs, 'rs'); |
| | | // console.log(rs, 'rs'); |
| | | if(rs.code == 1) { |
| | | this.leafClick(rs.data[0]); |
| | | }else { |
| | |
| | | // å使¸©åº¦ |
| | | this.setChartMarkLine(temp, "Temperature", "Batt_Alarm_Type_MonTmp", list); |
| | | // åä½å
é» |
| | | this.setChartMarkLine(resChart, "Resistance", "Batt_Alarm_Type_MonRes", list); |
| | | // this.setChartMarkLine(resChart, "Resistance", "Batt_Alarm_Type_MonRes", list); |
| | | // åä½çµå¯¼ |
| | | this.setChartMarkLine(conduct, "Conductance", "Batt_Alarm_Type_MonRes", list); |
| | | // this.setChartMarkLine(conduct, "Conductance", "Batt_Alarm_Type_MonRes", list); |
| | | } |
| | | }); |
| | | }, |
| | |
| | | high = parseFloat(std_mon_tmp*item.alm_high_coe).toHold(1); |
| | | low = parseFloat(std_mon_tmp*item.alm_low_coe).toHold(1); |
| | | break; |
| | | case "Resistance": |
| | | let std_mon_res = (1*(batt.MonVolStd/2))/(batt.MonCapStd/100); |
| | | high = parseFloat(std_mon_res*item.alm_high_coe).toHold(3); |
| | | low = parseFloat(std_mon_res*item.alm_low_coe).toHold(3); |
| | | break; |
| | | case "Conductance": |
| | | let std_mon_ser = batt.MonSerStd; |
| | | high = parseFloat(std_mon_ser*item.alm_high_coe).toHold(0); |
| | | low = parseFloat(std_mon_ser*item.alm_low_coe).toHold(0); |
| | | break; |
| | | // case "Resistance": |
| | | // let std_mon_res = (1*(batt.MonVolStd/2))/(batt.MonCapStd/100); |
| | | // high = parseFloat(std_mon_res*item.alm_high_coe).toHold(3); |
| | | // low = parseFloat(std_mon_res*item.alm_low_coe).toHold(3); |
| | | // break; |
| | | // case "Conductance": |
| | | // let std_mon_ser = batt.MonSerStd; |
| | | // high = parseFloat(std_mon_ser*item.alm_high_coe).toHold(0); |
| | | // low = parseFloat(std_mon_ser*item.alm_low_coe).toHold(0); |
| | | // break; |
| | | } |
| | | // ä½åè¦ |
| | | chartData.series[0].markLine.data[0].yAxis = low; |
| | |
| | | BattGroupId: batt.BattGroupId |
| | | }).then(res => { |
| | | let rs = JSON.parse(res.data.result); |
| | | console.log(rs, 'rs'); |
| | | // console.log(rs, 'rs==========='); |
| | | let data = []; |
| | | if (rs.code == 1) { |
| | | data = rs.data.map(item => { |
| | |
| | | tblData = data; |
| | | } |
| | | |
| | | |
| | | // çµåå¼ |
| | | let volTempVol = []; |
| | | if (rs.code == 1) { |
| | |
| | | vol.title.text = "æå¤§å¼=" + volBarNum.max.toFixed(2) + "V;æå°å¼=" + volBarNum.min.toFixed(2) + "V;å¹³åå¼=" + volBarNum.avg |
| | | .toFixed(2) + "V"; |
| | | vol.series[0].data = volTempVol; |
| | | |
| | | // å
é» |
| | | let volTempres = []; |
| | | if (rs.code == 1) { |
| | | volTempres = rs.data.map(item => { |
| | | return ["#" + item.mon_num, item.mon_res]; |
| | | }); |
| | | } |
| | | let resBarNum = getBarNum(volTempres); |
| | | resChart.title.text = "æå¤§å¼=" + resBarNum.max.toFixed(2) + "mΩ;æå°å¼=" + resBarNum.min.toFixed(2) + "mΩ;å¹³åå¼=" + |
| | | resBarNum.avg.toFixed(2) + "mΩ"; |
| | | resChart.series[0].data = volTempres; |
| | | |
| | | // 温度 |
| | | let volTempte = []; |
| | |
| | | tempBarNum.avg.toFixed(1) + "â"; |
| | | temp.series[0].data = volTempte; |
| | | |
| | | // çµå¯¼ |
| | | let conductTemp = []; |
| | | if (rs.code == 1) { |
| | | conductTemp = rs.data.map(item => { |
| | | return ["#" + item.mon_num, item.mon_res ? (1 / item.mon_res * 1000).toFixed(0) : 0]; |
| | | }); |
| | | } |
| | | let conductBarNum = getBarNum(conductTemp); |
| | | conduct.title.text = "æå¤§å¼=" + conductBarNum.max.toFixed(0) + ";æå°å¼=" + conductBarNum.min.toFixed(0) + ";å¹³åå¼=" + |
| | | conductBarNum.avg.toFixed(0); |
| | | conduct.series[0].data = conductTemp; |
| | | // åè¡¡çµæµ |
| | | let currTemp = []; |
| | | if (rs.code == 1) { |
| | | currTemp = rs.data.map(item => { |
| | | return ["#" + item.mon_num, item.mon_JH_curr]; |
| | | }); |
| | | } |
| | | let currBarNum = getBarNum(currTemp); |
| | | currChart.title.text = "æå¤§å¼=" + currBarNum.max.toFixed(1) + "mA;æå°å¼=" + currBarNum.min.toFixed(1) + "mA;å¹³åå¼=" + |
| | | currBarNum.avg.toFixed(1) + "mA"; |
| | | currChart.series[0].data = currTemp; |
| | | // æ¼æ¶²çµå |
| | | let leakVolTemp = []; |
| | | if(rs.code == 1){ |
| | | leakVolTemp = rs.data.map(item => { |
| | | return ["#" + item.mon_num, item.mon_LY_vol]; |
| | | }); |
| | | } |
| | | let leakVolNum = getBarNum(leakVolTemp); |
| | | leakVol.title.text = "æå¤§å¼=" + leakVolNum.max.toFixed(1) + "V;æå°å¼=" + leakVolNum.min.toFixed(1) + "V;å¹³åå¼=" + |
| | | leakVolNum.avg.toFixed(1) + 'V'; |
| | | leakVol.series[0].data = leakVolTemp; |
| | | // æ´æ°çµåå¾è¡¨ |
| | | this.setChart(); |
| | | }); |
| | | }, |
| | | // åç¶çº§åé忥页é¢çæä»¤ |
| | | syncPage() { |
| | | let batt = this.batt; |
| | | let search = |
| | | "?province=" + |
| | | batt.StationName1 + |
| | | "&city=" + |
| | | batt.StationName2 + |
| | | "&county=" + |
| | | batt.StationName5 + |
| | | "&home=" + |
| | | batt.StationName3 + |
| | | "&batt=" + |
| | | batt.BattGroupId; |
| | | window.parent.postMessage({ |
| | | cmd: "syncPage", |
| | | params: { |
| | | pageInfo: { |
| | | label: "å岿°æ®", |
| | | name: "history", |
| | | src: "#/history" + search, |
| | | closable: true |
| | | } |
| | | } |
| | | }, |
| | | "*" |
| | | ); |
| | | }, |
| | | // 设置stateListçå¼ |
| | | setStateList(name, value, type) { |
| | | let stateList = this.stateList; |
| | | for (let i = 0; i < stateList.length; i++) { |
| | | let state = stateList[i]; |
| | | if (state.name == name) { |
| | | state.value = value; |
| | | state.type = type ? type : ""; |
| | | } |
| | | } |
| | | }, |
| | | /* 宿¶ç»ç«¯ä¿¡æ¯ */ |
| | | realTimeGroupss() { |
| | | var batt = this.batt; |
| | | realTimeGroup(batt.BattGroupId).then(res => { |
| | | let rsa = JSON.parse(res.data.result); |
| | | // console.log(rsa, '??', rsa.data[0]); |
| | | if (rsa.code == 1) { |
| | | this.inputs = rsa.data[0]; |
| | | console.log(this.inputs.rec_datetime, 'æ´æ°æ¶é´'); |
| | | } |
| | | }); |
| | | }, |
| | | /* æ¥è¯¢çµè·¯å¾å¼å
³ç¶æåä¿¡æ¯ */ |
| | | realTimePowerOffs() { |
| | | let batt = this.batt; |
| | | // 设å¤ä¸º61850æ¾ç¤ºå³ä¾§ç颿¿ |
| | | // if (regEquipType(batt.FBSDeviceId, "equip61850")) { |
| | | // this.stateListShow = true; |
| | | // } else { |
| | | // this.stateListShow = false; |
| | | // } |
| | | |
| | | // æ¥è¯¢åå°æ°æ® |
| | | realTimePowerOff({ |
| | | dev_id: batt.FBSDeviceId |
| | | }).then(res => { |
| | | let rs = JSON.parse(res.data.result); |
| | | // console.log('ç¶æï¼', rs); |
| | | let outTime = 2 * 60; //设å¤è¶
æ¶æ¶é´(2åé) |
| | | let isOutTime = true; //éè®¯ä¸æ å¤æè®¾å¤æ¯å¦éè®¯ä¸æ true:䏿 false:æ£å¸¸ |
| | | if (rs.code == 1) { |
| | | let data = rs.data[0]; |
| | | // åºç¡ä¿¡æ¯ |
| | | this.setEquipBase(data); |
| | | |
| | | // 夿æ¯å¦è¶
æ¶ |
| | | var nowTime = new Date(data.note).getTime(); //å½åæ¶é´ |
| | | var record = new Date(data.record_datetime).getTime(); |
| | | if (Math.abs(nowTime - record) / 1000 > outTime) { |
| | | this.disconnect(); |
| | | } else { |
| | | // æªè¶
æ¶æ§è¡é»è¾ |
| | | let dev_id = batt.FBSDeviceId; |
| | | this.diagram.powerCut = 0; |
| | | // |
| | | this.diagram.type = data.dev_workstate; |
| | | this.diagram.desc = const_aio.workstates[data.dev_workstate]; |
| | | |
| | | } |
| | | } else { |
| | | // 设å¤å¤äºæªè¿æ¥ |
| | | this.disconnect(); |
| | | } |
| | | }); |
| | | }, |
| | | disconnect() { |
| | | // è®¾å¤æªè¿æ¥ |
| | | this.diagram.type = -1; |
| | | this.setStateList("workState", "æªè¿æ¥"); |
| | | this.diagram.temp = 0; |
| | | // éè®¯ç¶æ |
| | | // this.setStateList("connect", "å¼å¸¸", "table-row-error"); |
| | | // 温度 |
| | | // this.setStateList("devTemp", "æªç¥", "table-row-warn"); |
| | | // å¹²æ¥ç¹ |
| | | // this.setStateList("contact", "æªç¥", "table-row-warn"); |
| | | // æ ¸å®¹ç»æ¢åå |
| | | // this.setStateList("stopReason", "æªç¥"); |
| | | // æä½å¤±è´¥åå |
| | | // this.setStateList("failReason", "æªç¥"); |
| | | }, |
| | | // åºç¡ä¿¡æ¯ |
| | | setEquipBase(data) { |
| | | // 设å¤ç温度 |
| | | this.diagram.temp = data.dev_temp; |
| | | }, |
| | | startTimer() { |
| | | this.timer.start(() => { |
| | | this.$axios |
| | | .all([ |
| | | this.realTimeSearch(), |
| | | // this.realTimeGroupss(), |
| | | // this.realTimePowerOffs(), |
| | | this.realTimeGroupss(), |
| | | this.realTimePowerOffs(), |
| | | // this.realTimeStateList(), |
| | | //this.inversionInfo() |
| | | // this.inversionInfo() |
| | | ]) |
| | | .then(() => { |
| | | this.timer.open(); |
| | |
| | | monitorPage() { |
| | | // è·åç¼åçsession |
| | | let name = sessionStorage.getItem('acTabs'); |
| | | // console.log(name, 'session acTabs'); |
| | | if(name === "movingRingSystemRealTime" && this.acTabs === "eleLine") { |
| | | this.diagram.update = true; |
| | | }else { |
| | |
| | | this.dialog.show = true; |
| | | } |
| | | // æå |
| | | ,pause (type) { |
| | | console.log('æå', type) |
| | | } |
| | | // ,pause (type) { |
| | | // console.log('æå', type) |
| | | // } |
| | | ,clearAlerm () { |
| | | console.log('clearAlerm'); |
| | | // æ¸
é¤åè¦ |
| | |
| | | } |
| | | ); |
| | | } |
| | | ,ratioChanged (ratio) { |
| | | // console.log(ratio); |
| | | staticL && staticL.setRatio(ratio); |
| | | flushL && flushL.setRatio(ratio); |
| | | stateL && stateL.setRatio(ratio); |
| | | } |
| | | ,init () { |
| | | // console.log(this.$refs.circuitDiagram); |
| | | let circuitDiagram = this.$refs.circuitDiagram; |
| | | // console.log(circuitDiagram.$refs.staticL[0]); |
| | | // debugger; |
| | | staticL = new Diagram(circuitDiagram.$refs.staticL[0]); |
| | | stateL = new Diagram(circuitDiagram.$refs.stateL[0]); |
| | | flushL = new Diagram(circuitDiagram.$refs.flushL[0]); |
| | | this.moveBall = updateBalls(flushL, ballList); |
| | | } |
| | | ,drawStatic () { |
| | | staticL.importObjList(list); |
| | | // drawPanel(staticL); |
| | | staticL.drawAll(); |
| | | } |
| | | ,drawFlush () { |
| | | |
| | | } |
| | | // è°è¯æ¶çç¹å» |
| | | ,debugClick (o) { |
| | | let point = { |
| | | x: o.offsetX |
| | | ,y: o.offsetY |
| | | }; |
| | | let inObj = staticL.mousePointInObj([point.x, point.y], undefined); |
| | | let canvas_obj_id_arr = staticL.getObjIdArr(); |
| | | let canvas_obj = staticL.getObjList(); |
| | | if (inObj) { |
| | | for (let i = 0, j = canvas_obj_id_arr.length; i < j; i++) { |
| | | let id = canvas_obj_id_arr[i]; |
| | | let _inObj = staticL.mousePointInObj([point.x, point.y], id); |
| | | if (_inObj) { |
| | | let _obj = canvas_obj[id]; |
| | | console.log('----obj', _obj, id); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | ,loop () { |
| | | this.timer2.init(() => { |
| | | // console.log('loop'); |
| | | update(this.moveBall, stateL, {state: this.diagram.type, main: this.main}, ballList); |
| | | this.timer2.open(); |
| | | |
| | | }, 1000); |
| | | } |
| | | ,getStyle (type) { |
| | | if (!staticL) { |
| | | return {}; |
| | | } |
| | | let pos = panelPos[type]; |
| | | let ratio = staticL.ratio; |
| | | return { |
| | | top: pos.top * ratio + 'px' |
| | | ,left: pos.left * ratio + 'px' |
| | | ,width: pos.width * ratio + 'px' |
| | | ,height: pos.height * ratio + 'px' |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | | console.log(this.$route.params, 'mounted'); |
| | | // console.log(this.$route.params, 'mounted'); |
| | | let BattGroupId = this.$route.params.BattGroupId; |
| | | this.getBattGroupInfo(BattGroupId); |
| | | this.initChart(); |
| | |
| | | window.addEventListener('resize', this.resize); |
| | | // çæ§æ¯å¦å·²ç»åæ¢å°å½åé¡µé¢ |
| | | this.monitorPage(); |
| | | |
| | | this.init(); |
| | | interval(this.drawStatic, 100, 50); |
| | | // this.drawStatic(); |
| | | this.loop(); |
| | | this.timer2.open(); |
| | | }, |
| | | beforeDestroy () { |
| | | this.timer.stop(); |
| | | this.timer2.stop(); |
| | | } |
| | | } |
| | | </script> |
| | |
| | | .hdw-menu-item a:active { |
| | | background-color: rgb(34, 100, 167); |
| | | } |
| | | .info-panel { |
| | | position: absolute; |
| | | /* background: #999; */ |
| | | } |
| | | >>> .wrap { |
| | | /* background: rgba(66, 66, 66, 1); */ |
| | | } |
| | | </style> |
| | |
| | | è§£å³æ¹æ¡ï¼å¨åå°è¿åï¼å½ä»¤æ§è¡å¤±è´¥æ¶ï¼å¨å设å¤åé忢å¯å¨æµè¯çå½ä»¤ |
| | | ``` |
| | | |
| | | |
| | | |
| | | #å
æ¾çµä¸ä½æº |
| | | ####2021-07-29 |
| | | ``` |
| | | quint16 test_mode; //æ¾çµç±»å |
| | | quint16 acstop_op; //åçµå¤ç |
| | | quint16 nominal_cap; ////æ 称容é èå´0-9999AH |
| | | quint16 hourly_rate; //å°æ¶ç èå´1-10,20 |
| | | quint16 preset_cur; //æ¾çµçµæµ, èå´1-150A |
| | | quint16 preset_cap; //æ¾çµå®¹é èå´0-9999AH |
| | | quint16 preset_time; //颿¾æ¶é´ åéåä½ï¼æ²¡ç¨éå®èå´ |
| | | quint16 mon_lower; //åä½ä¸é å辨ç0.01,èå´0-20V |
| | | quint16 group_lower; //ç»ç«¯ä¸é å辨ç0.1,èå´1-285V |
| | | quint16 mon_number; //å使°é 1-300 |
| | | quint16 group_number; //ç»æ° ä¸å¯è®¾å¼ï¼ç®å为1 |
| | | quint16 lower_number; //ä¸éä¸ªæ° èå´1è³å使»æ° |
| | | quint16 mon_vol; //åªåå¼1.2, 2.0ï¼6.0ï¼12.0ï¼3.2ï¼3.7 |
| | | quint16 dischg_mode; //æ¾çµæ¨¡å¼:0ææµæ¾çµ 1æåçæ¾çµ |
| | | quint16 pre_power; //颿¾åç å辨ç0.1 èå´0-7.5kw |
| | | quint16 pre_res; //æ¾çµé»å¼ å辨ç0.01 èå´0.05ââ655 |
| | | |
| | | |
| | | quint16 chrg_curr; //å
çµçµæµ//èå´1-100A |
| | | quint16 chrg_vol; //å
çµçµå//èå´1-285V |
| | | quint16 chrg_vol_2; //æµ®å
çµå//èå´å°äºå
çµçµå |
| | | quint16 chrg_cap; //å
çµå®¹é (䏿¾ç¤º) |
| | | quint16 chrg_time; //å
çµæ¶é¿ èå´æ²¡æéå¶ |
| | | quint16 chrg_time_2; //æµ®å
æ¶é¿ èå´æ²¡æéå¶ |
| | | quint16 chrg_stopcurr; //æªæ¢çµæµ å°äºå
çµçµæµ |
| | | quint16 grp_uppervol; //ç»ç«¯ä¸é ä¸å¯è®¾ç½®ï¼æ¯å
çµçµå大5V |
| | | quint16 mon_uppervol; //åä½ä¸é å辨ç0.01ï¼èå´0-16V |
| | | quint16 mon_uppernum; //åä½ä¸éæ°é èå´å¤§äº0ï¼å°äºå使»æ° |
| | | |
| | | quint16 chrg_temp; //å
çµè¿æ¸© |
| | | quint16 dischrg_temp; //æ¾çµè¿æ¸© |
| | | |
| | | quint16 cycle_start; //æ´»åèµ·ç¹ 0æ¾çµ ï¼1å
çµ |
| | | quint16 cycle_times; //æ´»åæ¬¡æ° 1-50次 |
| | | quint16 waitdis_time; //å
å®éç½® 0-500åé |
| | | quint16 waitchr_time; //æ¾å®éç½® 0-500åé |
| | | |
| | | quint8 chargeC_num; //ææµæ»é¶æ®µæ° 1-3 |
| | | quint8 C_Curr_Num; //å½åè®¾ç½®é¶æ®µindex   0-2 |
| | | quint16 C_charge[3];//ææµé¶æ®µå
çµçµæµ èå´1-100A |
| | | quint16 C_time[3]; //ææµé¶æ®µå
çµæ¶é´ |
| | | |
| | | ``` |