|
|
@@ -4,6 +4,7 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
class Service{
|
|
|
|
|
|
constructor() {
|
|
|
+ this.footprint = [];
|
|
|
this.cache = [];
|
|
|
this.memory = [];
|
|
|
this.mem_pointer = -1;
|
|
|
@@ -20,6 +21,7 @@ class Service{
|
|
|
|
|
|
clearCache() {//set qufei will clear cache
|
|
|
this.cache = [];
|
|
|
+ this.footprint= [];
|
|
|
this.memory = [];
|
|
|
this.mem_pointer = -1;
|
|
|
this.cache_djcs = [];
|
|
|
@@ -125,6 +127,7 @@ class Service{
|
|
|
return x;
|
|
|
});
|
|
|
this.memory = [];
|
|
|
+ this.footprint = [];
|
|
|
this.memory.push(copy(this.cache));
|
|
|
this.mem_pointer = 0;
|
|
|
|
|
|
@@ -955,7 +958,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
body: JSON.stringify(
|
|
|
{
|
|
|
|
|
|
- "name": JSON.stringify(this.cache)
|
|
|
+ "name": JSON.stringify(this.cache.filter(x=>this.footprint.includes(x['key'])))
|
|
|
}
|
|
|
)
|
|
|
});
|
|
|
@@ -964,6 +967,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
console.error('error');
|
|
|
} else {
|
|
|
const data = await response.json();
|
|
|
+ this.footprint = [];
|
|
|
return data;
|
|
|
}
|
|
|
}
|
|
|
@@ -1094,7 +1098,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async cankao() {
|
|
|
+ async cankao() { //参考费率
|
|
|
|
|
|
const response = await fetch(this.ip().concat( "/cankao/"), {
|
|
|
method : "POST",
|
|
|
@@ -1390,10 +1394,18 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
+ updateFootprint(key) {
|
|
|
+ if (this.footprint.includes(key)) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ this.footprint.push(key);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
shanchu(key) {
|
|
|
if (this.cache.filter(x=>x['key'] == key).length > 0) {
|
|
|
+ this.updateFootprint(key);
|
|
|
///qd
|
|
|
let newData = this.cache.map(x=>{
|
|
|
if (x["key"] == key) {
|
|
|
@@ -1413,6 +1425,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
|
|
|
} else {
|
|
|
let qd = this.cache.filter(x=>x["_children"].filter(y=>y['key'] == key).length > 0)[0];
|
|
|
+ this.updateFootprint(qd['key']);
|
|
|
let qdbm = qd['清单编码'];
|
|
|
let newData = this.cache.map(x=>{
|
|
|
if (x["清单编码"] == qdbm) {
|
|
|
@@ -1790,6 +1803,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
//是否手动设置含量
|
|
|
let qd = this.cache.filter(x=>x["_children"].filter(y=>y['key']==row).length > 0)[0];
|
|
|
let de = qd["_children"].filter(x=>x['key'] == row)[0];
|
|
|
+ this.updateFootprint(qd['key']);
|
|
|
let bm = de['清单编码'];
|
|
|
let alreadyFuzhu = extractFuzhu(bm);//[xuhao]
|
|
|
let origin = de['dercj'];
|
|
|
@@ -1877,6 +1891,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
updateBeizhu(row, selected, xuhao) {//xuhao is for rename
|
|
|
let qd = this.cache.filter(x=>x["_children"].filter(y=>y['key']==row).length > 0)[0];
|
|
|
if (!qd) return [null, null];
|
|
|
+ this.updateFootprint(qd['key']);
|
|
|
let de = qd["_children"].filter(x=>x['key'] == row)[0];
|
|
|
if (de.hasOwnProperty("rcjdg")) {//底稿
|
|
|
|
|
|
@@ -1933,6 +1948,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
|
|
|
huan(old_index, new_bianhao, new_name, new_jia, row) {
|
|
|
let qd = this.cache.filter(x=>x["_children"].filter(y=>y['key']==row).length > 0)[0];
|
|
|
+ this.updateFootprint(qd['key']);
|
|
|
let de = qd["_children"].filter(x=>x['key'] == row)[0];
|
|
|
let rcj = copy(de['dercj']);
|
|
|
rcj[old_index][1] = new_bianhao;
|
|
|
@@ -1950,6 +1966,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
|
|
|
updateShuliang(value, row) {
|
|
|
let qd = this.cache.filter(x=>x["_children"].filter(y=>y['key']==row).length > 0)[0];
|
|
|
+ this.updateFootprint(qd['key']);
|
|
|
let de = qd["_children"].filter(x=>x['key'] == row)[0];
|
|
|
let origin = de['数量']
|
|
|
if (Number(origin) - Number(value) < 0.0001 && Number(origin) - Number(value) > -0.0001) {
|
|
|
@@ -1981,6 +1998,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
|
|
|
updateDeMingcheng(value, row) {
|
|
|
let qd = this.cache.filter(x=>x["_children"].filter(y=>y['key']==row).length > 0)[0];
|
|
|
+ this.updateFootprint(qd['key']);
|
|
|
let de = qd["_children"].filter(x=>x['key'] == row)[0];
|
|
|
de['名称'] = value;
|
|
|
|
|
|
@@ -2109,6 +2127,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
|
|
|
changguidinge(dingeclick, row) {
|
|
|
if (this.cache.filter(x=>x['key'] == row).length > 0) {
|
|
|
+ this.updateFootprint(row);
|
|
|
|
|
|
let res =dingeclick;
|
|
|
let keys = Object.keys(res['DEBH']);
|
|
|
@@ -2182,6 +2201,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
let bh = danxiangdinge_index(this.cache);
|
|
|
|
|
|
if (this.cache.filter(x=>x['key'] == row).length > 0) {
|
|
|
+ this.updateFootprint(row);
|
|
|
let selected = this.cache.filter(x=>x['key'] == row)[0];
|
|
|
let danwei = selected["单位"];
|
|
|
let mingcheng = selected['名称'];
|
|
|
@@ -2283,6 +2303,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
handleYuban(row, selected) {
|
|
|
let qd = this.cache.filter(x=>x["_children"].filter(y=>y['key']==row).length > 0)[0];
|
|
|
if (!qd) return [null, null];
|
|
|
+ this.updateFootprint(qd['key']);
|
|
|
let de = qd["_children"].filter(x=>x['key'] == row)[0];
|
|
|
let bm = de['清单编码'];
|
|
|
let alreadyFuzhu = extractFuzhu(bm);//[xuhao]
|
|
|
@@ -2312,6 +2333,7 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
handleRcjbc(row, rcjbc) {
|
|
|
let qd = this.cache.filter(x=>x["_children"].filter(y=>y['key']==row).length > 0)[0];
|
|
|
if (!qd) return [null, null];
|
|
|
+ this.updateFootprint(qd['key']);
|
|
|
let de = qd["_children"].filter(x=>x['key'] == row)[0];
|
|
|
let bm = de['清单编码'];
|
|
|
let alreadyFuzhu = extractFuzhu(bm);//[xuhao]
|