|
@@ -48,7 +48,7 @@ export default {
|
|
|
let length = this.params['puOrderItemList'].filter(item => item.delFlag === '0').length;
|
|
|
return `${length ?
|
|
|
(length > 8 ? 500 :
|
|
|
- (length *60) +100)
|
|
|
+ (length *60) +170)
|
|
|
: 120}px`
|
|
|
},
|
|
|
set(){}
|
|
@@ -720,6 +720,40 @@ export default {
|
|
|
|
|
|
this.download('/pu/order/downloadFailData',{}, `物料信息模板${new Date().getTime()}.xlsx`);
|
|
|
},
|
|
|
+ getSummaries(param){
|
|
|
+ const { columns, data } = param;
|
|
|
+ const sums = [];
|
|
|
+ let { tabColumns, tabName } = this;
|
|
|
+
|
|
|
+ columns.forEach((column, index) => {
|
|
|
+
|
|
|
+ if (index === 0) {
|
|
|
+ sums[index] = '合计';
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const values = data.map(item => Number(item[column.property]));
|
|
|
+
|
|
|
+ let sumColumn = tabColumns.find(tab => tab.key === tabName).tableColumns.filter(({key,isSummary}) => isSummary && key === column.property);
|
|
|
+
|
|
|
+ if (sumColumn.length) {
|
|
|
+ sums[index] = values.reduce((prev, curr) => {
|
|
|
+ const value = Number(curr);
|
|
|
+ if (!isNaN(value)) {
|
|
|
+ return prev + curr;
|
|
|
+ } else {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ }, 0);
|
|
|
+ sums[index];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return sums;
|
|
|
+
|
|
|
+ // return 0
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
},
|
|
|
created() {},
|
|
@@ -889,129 +923,135 @@ export default {
|
|
|
@change="(virtualList) => tableData = virtualList"
|
|
|
:virtualized="true"
|
|
|
>
|
|
|
- <!-- row-key绑定列唯一值,height一定要设置否则会滚动条滚动位置不对且数据滚动全部加载完后会出现白板-->
|
|
|
- <el-table
|
|
|
- border
|
|
|
- :data="tableData"
|
|
|
- style="width: 100%"
|
|
|
- :height="tabHeight"
|
|
|
- >
|
|
|
- <el-table-column label="序号">
|
|
|
- <template slot-scope="scope">
|
|
|
- {{ scope.$index + 1 }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- v-for="(cColumn, cIndex) in column.tableColumns"
|
|
|
- :key="cIndex"
|
|
|
- :prop="cColumn.key"
|
|
|
- :label="cColumn.title"
|
|
|
- :width="cColumn.width"
|
|
|
+ <template slot-scope="{ headerCellFixedStyle, cellFixedStyle }">
|
|
|
+ <!-- row-key绑定列唯一值,height一定要设置否则会滚动条滚动位置不对且数据滚动全部加载完后会出现白板-->
|
|
|
+ <el-table
|
|
|
+ border
|
|
|
+ :data="tableData"
|
|
|
+ style="width: 100%"
|
|
|
+ :headerCellStyle="headerCellFixedStyle"
|
|
|
+ :cellStyle="cellFixedStyle"
|
|
|
+ max-height="500px"
|
|
|
+ show-summary
|
|
|
+ :summary-method="getSummaries"
|
|
|
>
|
|
|
- <template slot="header" slot-scope="scope">
|
|
|
- <span v-if="cColumn.require" style="color: #ff4949">*</span>
|
|
|
- <span>
|
|
|
- {{ cColumn.title }}
|
|
|
- </span>
|
|
|
- </template>
|
|
|
- <template slot-scope="scope">
|
|
|
-
|
|
|
- <el-form-item
|
|
|
- label-width="0"
|
|
|
+ <el-table-column label="序号">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.$index + 1 }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ v-for="(cColumn, cIndex) in column.tableColumns"
|
|
|
+ :key="cIndex"
|
|
|
+ :prop="cColumn.key"
|
|
|
+ :label="cColumn.title"
|
|
|
+ :width="cColumn.width"
|
|
|
>
|
|
|
- <!-- :prop="`${column.key}.${scope.$index}.${[cColumn.key]}`"
|
|
|
- :rules="{ required: cColumn.require || false, message: `${cColumn.title}不能为空`, trigger: 'change' }" -->
|
|
|
-
|
|
|
- <span v-if="!cColumn.inputType">
|
|
|
- {{ scope.row[cColumn.key] }}
|
|
|
- </span>
|
|
|
-
|
|
|
- <el-input v-if="cColumn.inputType === 'Input'"
|
|
|
- v-model="scope.row[cColumn.key]"
|
|
|
- :placeholder="cColumn.placeholder"
|
|
|
- :clearable="cColumn.clearable"
|
|
|
- :disabled="cColumn.disabled"
|
|
|
- :size="size"
|
|
|
- style="width: 100%"
|
|
|
- ></el-input>
|
|
|
-
|
|
|
- <dr-popover-select v-if="cColumn.inputType === 'PopoverSelect'"
|
|
|
- v-model="scope.row[cColumn.key]"
|
|
|
- :source.sync="scope.row"
|
|
|
- :title="cColumn.title"
|
|
|
- :value-key="cColumn.valueKey"
|
|
|
- :disabled="cColumn.disabled"
|
|
|
- :type="cColumn.referName"
|
|
|
- :multiple="cColumn.multiple"
|
|
|
- :placeholder="cColumn.placeholder"
|
|
|
- :data-mapping="cColumn.dataMapping"
|
|
|
- :query-params="cColumn.queryParams"
|
|
|
- size="mini"
|
|
|
- @change="handleTabReferChange"
|
|
|
- ></dr-popover-select>
|
|
|
-
|
|
|
- <el-select v-if="cColumn.inputType === 'Select'"
|
|
|
- v-model="scope.row[cColumn.key]" size="mini"
|
|
|
- :disabled="cColumn.disabled"
|
|
|
- :clearable="cColumn.clearable"
|
|
|
- :placeholder="cColumn.placeholder"
|
|
|
- style="width: 100%"
|
|
|
- @change="handleTabSelectChange(cColumn.key,scope.row)"
|
|
|
+ <template slot="header" slot-scope="scope">
|
|
|
+ <span v-if="cColumn.require" style="color: #ff4949">*</span>
|
|
|
+ <span>
|
|
|
+ {{ cColumn.title }}
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="scope">
|
|
|
+
|
|
|
+ <el-form-item
|
|
|
+ label-width="0"
|
|
|
+ >
|
|
|
+ <!-- :prop="`${column.key}.${scope.$index}.${[cColumn.key]}`"
|
|
|
+ :rules="{ required: cColumn.require || false, message: `${cColumn.title}不能为空`, trigger: 'change' }" -->
|
|
|
+
|
|
|
+ <span v-if="!cColumn.inputType">
|
|
|
+ {{ scope.row[cColumn.key] }}
|
|
|
+ </span>
|
|
|
+
|
|
|
+ <el-input v-if="cColumn.inputType === 'Input'"
|
|
|
+ v-model="scope.row[cColumn.key]"
|
|
|
+ :placeholder="cColumn.placeholder"
|
|
|
+ :clearable="cColumn.clearable"
|
|
|
+ :disabled="cColumn.disabled"
|
|
|
+ :size="size"
|
|
|
+ style="width: 100%"
|
|
|
+ ></el-input>
|
|
|
+
|
|
|
+ <dr-popover-select v-if="cColumn.inputType === 'PopoverSelect'"
|
|
|
+ v-model="scope.row[cColumn.key]"
|
|
|
+ :source.sync="scope.row"
|
|
|
+ :title="cColumn.title"
|
|
|
+ :value-key="cColumn.valueKey"
|
|
|
+ :disabled="cColumn.disabled"
|
|
|
+ :type="cColumn.referName"
|
|
|
+ :multiple="cColumn.multiple"
|
|
|
+ :placeholder="cColumn.placeholder"
|
|
|
+ :data-mapping="cColumn.dataMapping"
|
|
|
+ :query-params="cColumn.queryParams"
|
|
|
+ size="mini"
|
|
|
+ @change="handleTabReferChange"
|
|
|
+ ></dr-popover-select>
|
|
|
+
|
|
|
+ <el-select v-if="cColumn.inputType === 'Select'"
|
|
|
+ v-model="scope.row[cColumn.key]" size="mini"
|
|
|
+ :disabled="cColumn.disabled"
|
|
|
+ :clearable="cColumn.clearable"
|
|
|
+ :placeholder="cColumn.placeholder"
|
|
|
+ style="width: 100%"
|
|
|
+ @change="handleTabSelectChange(cColumn.key,scope.row)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in dict.type[cColumn.referName]"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+
|
|
|
+ <el-checkbox v-if="cColumn.inputType === 'Checkbox'"
|
|
|
+ v-model="scope.row[cColumn.key]"
|
|
|
+ :disabled="cColumn.disabled"
|
|
|
+ true-label="Y"
|
|
|
+ false-label="N"
|
|
|
+ @change="handleTabCheckbox(cColumn.key,scope.row)"
|
|
|
+ ></el-checkbox>
|
|
|
+ <el-input-number v-if="cColumn.inputType === 'InputNumber'"
|
|
|
+ v-model="scope.row[cColumn.key]"
|
|
|
+ :precision="cColumn.precision"
|
|
|
+ :controls-position="cColumn.controlsPosition"
|
|
|
+ :max="getInputNumberMax(cColumn.key, scope.row)"
|
|
|
+ :min="cColumn.key === 'reservedQty' ? 0 : -Infinity"
|
|
|
+ @change="handleInputChange(scope.row, cColumn.key)"
|
|
|
+ :placeholder="cColumn.placeholder"
|
|
|
+ :clearable="cColumn.clearable"
|
|
|
+ :disabled="cColumn.disabled"
|
|
|
+ :size="size"
|
|
|
+ style="width: 100%"
|
|
|
+ ></el-input-number>
|
|
|
+
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 修订:不可删除、增行
|
|
|
+ 编辑:自制:可删可增 -->
|
|
|
+ <!-- v-if="!handleIsRevise()" -->
|
|
|
+ <VirtualColumn
|
|
|
+ v-if="!handleIsRevise()"
|
|
|
+ vfixed="right"
|
|
|
+ label="操作"
|
|
|
+ width="120"
|
|
|
>
|
|
|
- <el-option
|
|
|
- v-for="item in dict.type[cColumn.referName]"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- ></el-option>
|
|
|
- </el-select>
|
|
|
-
|
|
|
- <el-checkbox v-if="cColumn.inputType === 'Checkbox'"
|
|
|
- v-model="scope.row[cColumn.key]"
|
|
|
- :disabled="cColumn.disabled"
|
|
|
- true-label="Y"
|
|
|
- false-label="N"
|
|
|
- @change="handleTabCheckbox(cColumn.key,scope.row)"
|
|
|
- ></el-checkbox>
|
|
|
- <el-input-number v-if="cColumn.inputType === 'InputNumber'"
|
|
|
- v-model="scope.row[cColumn.key]"
|
|
|
- :precision="cColumn.precision"
|
|
|
- :controls-position="cColumn.controlsPosition"
|
|
|
- :max="getInputNumberMax(cColumn.key, scope.row)"
|
|
|
- :min="cColumn.key === 'reservedQty' ? 0 : -Infinity"
|
|
|
- @change="handleInputChange(scope.row, cColumn.key)"
|
|
|
- :placeholder="cColumn.placeholder"
|
|
|
- :clearable="cColumn.clearable"
|
|
|
- :disabled="cColumn.disabled"
|
|
|
- :size="size"
|
|
|
- style="width: 100%"
|
|
|
- ></el-input-number>
|
|
|
-
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
-
|
|
|
- <!-- 修订:不可删除、增行
|
|
|
- 编辑:自制:可删可增 -->
|
|
|
- <!-- v-if="!handleIsRevise()" -->
|
|
|
- <el-table-column
|
|
|
- v-if="!handleIsRevise()"
|
|
|
- fixed="right"
|
|
|
- label="操作"
|
|
|
- width="120" >
|
|
|
- <template slot-scope="scope"
|
|
|
- >
|
|
|
- <!-- v-if="!handleIsRevise()" -->
|
|
|
- <el-button
|
|
|
- @click.native.prevent="delTableRow(params[tabName], scope.row,tabName)"
|
|
|
- type="text"
|
|
|
- size="small"
|
|
|
- > 删行
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ @click.native.prevent="delTableRow(params[tabName], scope.row,tabName)"
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ > 删行
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </VirtualColumn>
|
|
|
+
|
|
|
+ </el-table>
|
|
|
+ </template>
|
|
|
</virtual-scroll>
|
|
|
|
|
|
</el-tab-pane>
|