|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <el-table :data="tableData" border style="width: 100%" :header-cell-style="{'text-align': 'center'}" :cell-style="{'text-align': 'center'}" :span-method="objectSpanMethod">
|
|
|
+ <el-table :data="tableData" border style="width: 100%" :header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }" :span-method="objectSpanMethod">
|
|
|
<el-table-column prop="category" label="《产品市场服务协议》指标描述"> </el-table-column>
|
|
|
<el-table-column prop="subCategory" label="《市场服务包合同》指标描述"> </el-table-column>
|
|
|
<el-table-column label="评价值">
|
|
@@ -17,7 +17,7 @@
|
|
|
:controls="false"
|
|
|
:min="0"
|
|
|
:max="scope.row.max"
|
|
|
- @change="e => percentageChange(e, scope.row)"
|
|
|
+ @change="(e) => percentageChange(e, scope.row)"
|
|
|
/><span>%</span>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -39,6 +39,7 @@
|
|
|
|
|
|
<script>
|
|
|
import tableData from './table1';
|
|
|
+import BigNumber from 'bignumber.js';
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -46,29 +47,33 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ setInfo(info) {
|
|
|
+ const result = new BigNumber(info).multipliedBy('0.9');
|
|
|
+ this.tableData[0].total = result;
|
|
|
+ },
|
|
|
initInfo(info) {
|
|
|
const tableDataCopy = JSON.parse(JSON.stringify(tableData));
|
|
|
this.tableData = tableDataCopy;
|
|
|
},
|
|
|
redemptionFn(redemptionResult) {
|
|
|
const tableDataCopy = JSON.parse(JSON.stringify(tableData));
|
|
|
- tableDataCopy.forEach(item => {
|
|
|
- const curr = redemptionResult.find(iten => iten.itemId === item.itemId);
|
|
|
+ tableDataCopy.forEach((item) => {
|
|
|
+ const curr = redemptionResult.find((iten) => iten.itemId === item.itemId);
|
|
|
if (curr) {
|
|
|
item.total = curr.total;
|
|
|
}
|
|
|
});
|
|
|
this.tableData = tableDataCopy;
|
|
|
- this.tableData.forEach(item => {
|
|
|
+ this.tableData.forEach((item) => {
|
|
|
this.percentageChange(item.total, item);
|
|
|
});
|
|
|
},
|
|
|
|
|
|
percentageChange(e, item) {
|
|
|
const label = item.category;
|
|
|
- const arr = this.tableData.filter(item => item.category === label);
|
|
|
+ const arr = this.tableData.filter((item) => item.category === label);
|
|
|
const sum = arr.reduce((total, item) => total + item.total, 0);
|
|
|
- this.tableData.forEach(item => {
|
|
|
+ this.tableData.forEach((item) => {
|
|
|
if (item.category === label) {
|
|
|
item.percentageOfIndividualitems = sum;
|
|
|
}
|
|
@@ -78,12 +83,12 @@ export default {
|
|
|
let sumC = this.tableData[6].percentageOfIndividualitems;
|
|
|
|
|
|
const sumD = sumA * sumB * sumC;
|
|
|
- this.tableData.forEach(item => {
|
|
|
+ this.tableData.forEach((item) => {
|
|
|
item.totalPercentage = sumD / 10000;
|
|
|
});
|
|
|
this.$emit('totalPercentageChange', sumD);
|
|
|
},
|
|
|
- objectSpanMethod({row, column, rowIndex, columnIndex}) {
|
|
|
+ objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
if (columnIndex === 0 || columnIndex === 3) {
|
|
|
if (rowIndex === 0) {
|
|
|
return {
|