Commit f137b2fb authored by yyh's avatar yyh

增量流程处理

parent 4b729e8e
......@@ -102,7 +102,7 @@ export default class ProofItem extends Vue {
private editIncrementProof(incrementProof: any, currentIndex: number) {
const preProof = this.incrementList.length < 2
? this.proof
: this.incrementList.find( (proof, index) => index === (currentIndex - 1));
: this.incrementList[currentIndex + 1];
return {
incrementProof,
baseProof: this.proof,
......
......@@ -122,6 +122,9 @@ export default class Index extends Vue {
id: '',
name: '',
};
private baseProof: any = '';
private preProof: any = '';
private isZengliang: boolean = false;
private async addProofHandler() {
let query: any = {
......@@ -129,14 +132,7 @@ export default class Index extends Vue {
proofName: this.proofName,
};
if ( this.isZengliang ) {
let preProof = null;
if (this.currentProof.increment_num > 0) {
const incrementProofListResult = await this.$api.proof.incrementList(this.currentProof.hash);
preProof = (incrementProofListResult.results || [])[0];
} else {
preProof = this.currentProof;
}
query = {...query, baseProof: JSON.stringify(this.currentProof), preProof: JSON.stringify(preProof)};
query = {...query, baseProof: JSON.stringify(this.baseProof), preProof: JSON.stringify(this.preProof)};
}
this.$router.push({ name: 'ProofDetail', query});
}
......@@ -296,7 +292,20 @@ export default class Index extends Vue {
private goToBROWSER(proof: any) {
location.href = process.env.VUE_APP_BROWSER + `/product?hash=${proof.hash}`;
}
private increment(proof: any) {
private async increment(proof: any) {
const { increment_num } = proof;
if ( increment_num > 0 ) {
const { results } = await this.$api.proof.incrementList(this.currentProof.hash);
const preProof = results[0];
if (!preProof.hash) {
this.$toast('请先上链上一条存证');
return Promise.reject('请先上链上一条存证');
}
this.preProof = preProof;
} else {
this.preProof = proof;
}
this.baseProof = proof;
this.showAddProof = true;
this.isZengliang = true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment