From dd61d0f5d1176107de45e0d23e25cc0a761b7124 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期三, 26 六月 2024 15:09:45 +0800
Subject: [PATCH] 修改标准库
---
src/components/view/b2-standard.vue | 2
src/main.js | 8 +-
src/components/do/b1-inspect-order-plan/Inspection.vue | 8 +-
src/util/excelFountion.js | 136 +++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 146 insertions(+), 8 deletions(-)
diff --git a/src/components/do/b1-inspect-order-plan/Inspection.vue b/src/components/do/b1-inspect-order-plan/Inspection.vue
index 1a6e052..629895c 100644
--- a/src/components/do/b1-inspect-order-plan/Inspection.vue
+++ b/src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -482,6 +482,7 @@
<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: {
@@ -626,6 +627,7 @@
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()
@@ -1087,12 +1089,12 @@
} 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) {
@@ -1235,6 +1237,7 @@
} else {
item.v.v = 0
}
+ console.log(this.param)
this.saveInsContext()
}
} else {
@@ -1304,7 +1307,6 @@
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)
diff --git a/src/components/view/b2-standard.vue b/src/components/view/b2-standard.vue
index 3d354d1..9c1979c 100644
--- a/src/components/view/b2-standard.vue
+++ b/src/components/view/b2-standard.vue
@@ -1289,7 +1289,7 @@
})
} 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,
diff --git a/src/main.js b/src/main.js
index a051bd2..ef61e96 100644
--- a/src/main.js
+++ b/src/main.js
@@ -15,17 +15,17 @@
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";
diff --git a/src/util/excelFountion.js b/src/util/excelFountion.js
new file mode 100644
index 0000000..b8c51a1
--- /dev/null
+++ b/src/util/excelFountion.js
@@ -0,0 +1,136 @@
+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
+}
--
Gitblit v1.9.3