|
|
@@ -112,6 +112,27 @@
|
|
|
<el-form-item
|
|
|
:prop="'datasource.' + scope.$index + '.blockCount'"
|
|
|
:rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ :needPage="false"
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="form.datasource"
|
|
|
+ class="time-form"
|
|
|
+ :selection.sync="selection"
|
|
|
+ @columns-change="handleColumnChange"
|
|
|
+ @header-dragend="handleHeaderDragend"
|
|
|
+ :cache-key="cacheKeyUrl"
|
|
|
+ >
|
|
|
+ <!-- 表头工具栏 -->
|
|
|
+ <template v-slot:toolbar>
|
|
|
+ <div class="headbox">
|
|
|
+ <el-button
|
|
|
+ v-if="isShowAdd && needProduce != 4"
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ @click="handlAdd"
|
|
|
>
|
|
|
<el-input
|
|
|
v-model="scope.row.blockCount"
|
|
|
@@ -157,6 +178,42 @@
|
|
|
trigger: 'blur'
|
|
|
}
|
|
|
]"
|
|
|
+ 新增
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="danger"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ :disabled="!selection.length"
|
|
|
+ @click="batchRemove"
|
|
|
+ >
|
|
|
+ 批量删除
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-slot:technicalDrawings="{ row, $index }">
|
|
|
+ <el-form-item :prop="'datasource.' + $index + '.technicalDrawings'">
|
|
|
+ <fileMain v-model="row.technicalDrawings" type="view"></fileMain>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:remark="{ row, $index }">
|
|
|
+ <el-form-item :prop="'datasource.' + $index + '.remark'">
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
+ v-model="row.remark"
|
|
|
+ type="textarea"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:stockLedger="scope">
|
|
|
+ <el-form-item>
|
|
|
+ <el-popover
|
|
|
+ @hide="() => (selection = [])"
|
|
|
+ placement="right"
|
|
|
+ width="60%"
|
|
|
+ trigger="hover"
|
|
|
>
|
|
|
<el-select
|
|
|
v-if="needProduce == 4 && orderNoList.length > 1"
|
|
|
@@ -412,25 +469,31 @@
|
|
|
</template>
|
|
|
<!-- 操作列 -->
|
|
|
<template v-slot:action="scope">
|
|
|
- <el-popconfirm
|
|
|
- class="ele-action"
|
|
|
- title="确定要删除吗?"
|
|
|
- @confirm="remove(scope.$index)"
|
|
|
- >
|
|
|
- <template v-slot:reference>
|
|
|
- <el-link type="danger" :underline="false" icon="el-icon-delete">
|
|
|
- 删除
|
|
|
- </el-link>
|
|
|
- </template>
|
|
|
- </el-popconfirm>
|
|
|
- <el-link
|
|
|
- type="primary"
|
|
|
- :underline="false"
|
|
|
- icon="el-icon-edit"
|
|
|
- @click="selectStockLedgerDialogOpen(scope.row)"
|
|
|
- >
|
|
|
- 替代料
|
|
|
- </el-link>
|
|
|
+ <div>
|
|
|
+ <el-popconfirm
|
|
|
+ class="ele-action"
|
|
|
+ title="确定要删除吗?"
|
|
|
+ @confirm="remove(scope.$index)"
|
|
|
+ >
|
|
|
+ <template v-slot:reference>
|
|
|
+ <el-link
|
|
|
+ type="danger"
|
|
|
+ :underline="false"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-link>
|
|
|
+ </template>
|
|
|
+ </el-popconfirm>
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="selectStockLedgerDialogOpen(scope.row)"
|
|
|
+ >
|
|
|
+ 替代料
|
|
|
+ </el-link>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</ele-pro-table>
|
|
|
</div>
|
|
|
@@ -547,6 +610,7 @@
|
|
|
};
|
|
|
return {
|
|
|
cacheKeyUrl: 'eos-saleManage-invoice-inventoryTable-2026082501',
|
|
|
+ widthsVersion: 0,
|
|
|
current: {},
|
|
|
childrenColumns: [
|
|
|
{
|
|
|
@@ -630,9 +694,25 @@
|
|
|
},
|
|
|
columns() {
|
|
|
let columnsVersion = this.columnsVersion;
|
|
|
+ // 强制重新计算(每次进入时读取缓存宽度)
|
|
|
+ this.widthsVersion;
|
|
|
+ const cacheWidths = this.getStorage(this.cacheKeyUrl + 'Widths') || {};
|
|
|
+ const applyWidth = (col) => {
|
|
|
+ if (col.prop && cacheWidths[col.prop]) {
|
|
|
+ return { ...col, width: cacheWidths[col.prop], minWidth: undefined };
|
|
|
+ }
|
|
|
+ return col;
|
|
|
+ };
|
|
|
return [
|
|
|
{
|
|
|
width: 60,
|
|
|
+ type: 'selection',
|
|
|
+ columnKey: 'selection',
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 45,
|
|
|
type: 'index',
|
|
|
columnKey: 'index',
|
|
|
align: 'center',
|
|
|
@@ -1064,7 +1144,7 @@
|
|
|
fixed: 'right',
|
|
|
showOverflowTooltip: true
|
|
|
}
|
|
|
- ];
|
|
|
+ ].map(applyWidth);
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
@@ -1790,6 +1870,27 @@
|
|
|
this.setSort();
|
|
|
},
|
|
|
|
|
|
+ batchRemove() {
|
|
|
+ if (!this.selection.length) return;
|
|
|
+ this.$confirm('确定要批量删除选中的物品吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ const ids = this.selection.map(item => item.tempId ?? item.id);
|
|
|
+ this.form.datasource = this.form.datasource.filter(
|
|
|
+ item => !ids.includes(item.tempId ?? item.id)
|
|
|
+ );
|
|
|
+ this.selection = [];
|
|
|
+ this.setSort();
|
|
|
+ this.$refs.table.reload();
|
|
|
+ this.$message.success('删除成功');
|
|
|
+ }).catch(() => {});
|
|
|
+ },
|
|
|
+ // 清空表格
|
|
|
+ restTable() {
|
|
|
+ this.form.datasource = [];
|
|
|
+ },
|
|
|
// 重新排序
|
|
|
setSort() {
|
|
|
this.form.datasource.forEach((n, index) => {
|
|
|
@@ -1846,6 +1947,13 @@
|
|
|
|
|
|
callback(valid);
|
|
|
});
|
|
|
+ },
|
|
|
+ // 列头拖拽结束 - 保存列宽到本地缓存
|
|
|
+ handleHeaderDragend(newWidth, oldWidth, column) {
|
|
|
+ if (!column.property) return;
|
|
|
+ const widths = this.getStorage(this.cacheKeyUrl + 'Widths') || {};
|
|
|
+ widths[column.property] = newWidth;
|
|
|
+ this.setStorage(this.cacheKeyUrl + 'Widths', widths);
|
|
|
}
|
|
|
}
|
|
|
};
|