| | |
| | | <script> |
| | | import ValueTable from '../../tool/value-table.vue' |
| | | import file from '../../../util/file' |
| | | import excelFountion from '../../../util/excelFountion' |
| | | export default { |
| | | props: ['sonLaboratory', 'orderId', 'state'], |
| | | components: { |
| | |
| | | this.componentData.entity.sonLaboratory = this.sonLaboratory; |
| | | this.id = this.orderId; |
| | | this.getUserInfo() |
| | | // excelFountion.handel('SUM(MAX(SUM(A1,B1,C1),2,3)*2-MIN(A1:D3),1,2)') |
| | | }, |
| | | mounted() { |
| | | this.getTypeDicts() |
| | |
| | | } else { |
| | | this.param[b.i].resValue = b |
| | | } */ |
| | | if (b.i !== undefined) { |
| | | if (b.i !== undefined&&!this.param[b.i].resValue) { |
| | | this.param[b.i].resValue = b |
| | | } |
| | | } |
| | | if (b.v.ps != undefined && b.v.ps.value === 'ç»è®º') { |
| | | if (b.i !== undefined) { |
| | | if (b.i !== undefined&&!this.param[b.i].insResult) { |
| | | this.param[b.i].insResult = b |
| | | conclusionList.forEach((n, i) => { |
| | | if (n.r == b.r && n.c == b.c) { |
| | |
| | | } else { |
| | | item.v.v = 0 |
| | | } |
| | | console.log(this.param) |
| | | this.saveInsContext() |
| | | } |
| | | } else { |
| | |
| | | str = str.replaceAll('MAX', 'Math.max') |
| | | str = str.replaceAll('MIN', 'Math.min') |
| | | str = str.replaceAll('ï¼', ',') |
| | | console.log(str) |
| | | try { |
| | | if(this.getInspectionValueType(item.i)==1){ |
| | | comResult = eval(str) |
| | |
| | | }) |
| | | } else { |
| | | this.$axios.post(this.$api.standardTree.upStandardProducts, { |
| | | ids: this.moreSelects.map(a => a.id), |
| | | ids: JSON.stringify(this.moreSelects.map(a => a.id)), |
| | | standardProductList: { |
| | | section: this.sectionRow.section, |
| | | ask: this.sectionRow.ask, |
| | |
| | | Vue.prototype.PROJECT = 'æ£æµä¸å¿' |
| | | // Vue.prototype.PROJECT = 'è£
å¤çµç¼' |
| | | //æ¬å° |
| | | // Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80"; |
| | | Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80"; |
| | | // const javaApi = 'http://127.0.0.1:8001'; |
| | | // const javaApi = 'http://192.168.0.104:8001'; |
| | | const javaApi = 'http://192.168.0.104:8001'; |
| | | |
| | | //äº |
| | | // Vue.prototype.LOCATIONVUE = "http://114.132.189.42:8080"; |
| | | // const javaApi = 'http://114.132.189.42:1234'; |
| | | |
| | | //æ£æµä¸å¿æ£å¼åº |
| | | Vue.prototype.LOCATIONVUE = "http://10.1.200.86:8080"; |
| | | const javaApi = 'http://10.1.200.86:8001'; |
| | | // Vue.prototype.LOCATIONVUE = "http://10.1.200.86:8080"; |
| | | // const javaApi = 'http://10.1.200.86:8001'; |
| | | |
| | | //è£
å¤çµç¼æµè¯åº |
| | | // Vue.prototype.LOCATIONVUE = "http://10.16.173.59"; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | let f = 'SUM(MAX(1,2,3)*2-MIN(1,2,3),1,2)' |
| | | |
| | | |
| | | function changeParameter(f){ |
| | | let regex = /[=\+\-\*\%\(\)\/\^\s]/g; |
| | | let fouList = [ |
| | | "SUM", |
| | | 'MAX', |
| | | 'MIN' |
| | | ] |
| | | f = f.replace(regex, ',') |
| | | fouList.forEach(item=>{ |
| | | f = f.replaceAll(item,',') |
| | | }) |
| | | let arr = f.split(',').filter(item=>{ |
| | | return item&& /[a-zA-Z]/.test(item) |
| | | }); |
| | | let arr2 = [] |
| | | arr.forEach(item=>{ |
| | | if(item.includes(':')){ |
| | | |
| | | let r0 = getIdFromColumnName(item.split(':')[0]).r; |
| | | let c0 = getIdFromColumnName(item.split(':')[0]).c; |
| | | let r1 = getIdFromColumnName(item.split(':')[1]).r; |
| | | let c1 = getIdFromColumnName(item.split(':')[1]).c; |
| | | for (let i = Number(r0); i <= Number(r1); i++) { |
| | | for (let u = Number(c0); u <= Number(c1); u++) { |
| | | arr2.push({ |
| | | r: i, |
| | | c: u |
| | | }) |
| | | } |
| | | } |
| | | }else{ |
| | | arr2.push(getIdFromColumnName(item)) |
| | | } |
| | | }) |
| | | return arr2; |
| | | } |
| | | function SUM(...val){ |
| | | let num = 0; |
| | | if(val&&val.length>0){ |
| | | val.forEach(item=>{ |
| | | num+=item; |
| | | }) |
| | | } |
| | | console.log('SUM',num) |
| | | return num; |
| | | } |
| | | function MAX(...val){ |
| | | let max = 0; |
| | | if(val&&val.length>0){ |
| | | max = Math.max(...val) |
| | | } |
| | | console.log('MAX',max) |
| | | return max; |
| | | } |
| | | function MIN(...val){ |
| | | let min = 0; |
| | | if(val&&val.length>0){ |
| | | min = Math.min(...val) |
| | | } |
| | | console.log('MIN',min) |
| | | return min; |
| | | } |
| | | function handel(f){ |
| | | console.log(changeParameter(f)) |
| | | // console.log(eval(f)) |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ®åæ è·ååå |
| | | * @param {Object} cellId |
| | | */ |
| | | function getColumnNameFromId(cellId){ |
| | | if (! Array.isArray(cellId)) { |
| | | cellId = cellId.split('-'); |
| | | } |
| | | var i = cellId[0]; |
| | | var letter = ''; |
| | | if (i > 701) { |
| | | letter += String.fromCharCode(64 + parseInt(i / 676)); |
| | | letter += String.fromCharCode(64 + parseInt((i % 676) / 26)); |
| | | } else if (i > 25) { |
| | | letter += String.fromCharCode(64 + parseInt(i / 26)); |
| | | } |
| | | letter += String.fromCharCode(65 + (i % 26)); |
| | | return letter + (parseInt(cellId[1]) + 1); |
| | | } |
| | | console.log("getColumnNameFromId",getColumnNameFromId([1,1]))//B2 |
| | | /** |
| | | * æ ¹æ®ååè·ååæ |
| | | * @param {Object} id |
| | | * @param {Object} arr |
| | | */ |
| | | function getIdFromColumnName(id, arr) { |
| | | // Get the letters |
| | | var t = /^[a-zA-Z]+/.exec(id); |
| | | if (t) { |
| | | // Base 26 calculation |
| | | var code = 0; |
| | | for (var i = 0; i < t[0].length; i++) { |
| | | code += parseInt(t[0].charCodeAt(i) - 64) * Math.pow(26, (t[0].length - 1 - i)); |
| | | } |
| | | code--; |
| | | // Make sure jexcel starts on zero |
| | | if (code < 0) { |
| | | code = 0; |
| | | } |
| | | |
| | | // Number |
| | | var number = parseInt(/[0-9]+$/.exec(id)); |
| | | if (number > 0) { |
| | | number--; |
| | | } |
| | | |
| | | if (arr == true) { |
| | | id = [ code, number ]; |
| | | } else { |
| | | // id = code + '-' + number; |
| | | id = { |
| | | c:code, |
| | | r:number |
| | | } |
| | | } |
| | | } |
| | | return id; |
| | | } |
| | | |
| | | console.log("getIdFromColumnName",getIdFromColumnName("B2",true))//[1,1] |
| | | |
| | | |
| | | export default { |
| | | handel |
| | | } |