|
@@ -88,7 +88,7 @@
|
|
|
<div class="editable-row-operations">
|
|
|
<span v-if="record.editable">
|
|
|
<a @click="() => save(record.key)">保存</a>
|
|
|
- <a-popconfirm title="Sure to cancel?" @confirm="() => cancel(record.key)">
|
|
|
+ <a-popconfirm title="确定要取消吗" @confirm="() => cancel(record.key)">
|
|
|
<a>取消</a>
|
|
|
</a-popconfirm>
|
|
|
</span>
|
|
@@ -126,19 +126,19 @@ export default {
|
|
|
typeData: [], // 产品类别下拉数据
|
|
|
columns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: 70, align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'productNum', width: 160, align: 'center' },
|
|
|
- { title: '产品名称', dataIndex: 'productName', width: 200, align: 'center', ellipsis: true },
|
|
|
- { title: '级别', dataIndex: 'productNasme', width: 100, align: 'center' },
|
|
|
- { title: '原厂编码', dataIndex: 'productOldNum', width: 160, align: 'center' },
|
|
|
- { title: '产品品牌', dataIndex: 'productBrand', width: 200, align: 'center' },
|
|
|
- { title: '产品分类', dataIndex: 'productType', width: 200, align: 'center' },
|
|
|
+ { title: '产品编码', dataIndex: 'productNum', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'productName', width: 200, align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '级别', dataIndex: 'productNasme', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '原厂编码', dataIndex: 'productOldNum', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品品牌', dataIndex: 'productBrand', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品分类', dataIndex: 'productType', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '实时库存数(个)', dataIndex: 'inventoryNumy', width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '在途数(个)', scopedSlots: { customRender: 'onWayNum' }, width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '总库存数(个)', dataIndex: 'inventoryNumw', width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '最大库存数(个)', scopedSlots: { customRender: 'maxInventory' }, width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '最小库存数(个)', scopedSlots: { customRender: 'minInventory' }, width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '差异数量', dataIndex: 'inventoryNumh', width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '预警提示', dataIndex: 'inventoryNum', width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '预警提示', dataIndex: 'inventoryNum', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 240, align: 'center' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
@@ -159,7 +159,7 @@ export default {
|
|
|
pageNo: 1,
|
|
|
pageSize: 10,
|
|
|
list: [
|
|
|
- { id: '1', productNum: 'jgqp11111111111', productName: '产品1', productOldNum: 'jgqp111123545', productBrand: '箭冠品牌', productType: '产品分类1', inventoryNum: '5', inventoryMoney: '122' }
|
|
|
+ { key: '1', id: '1', productNum: 'jgqp11111111111', productName: '产品1', productOldNum: 'jgqp111123545', productBrand: '箭冠品牌', productType: '产品分类1', inventoryNum: '5', inventoryMoney: '122' }
|
|
|
]
|
|
|
}
|
|
|
const no = (data.pageNo - 1) * data.pageSize
|
|
@@ -208,43 +208,49 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
handleChange(value, key, column) {
|
|
|
- const newData = [...this.data];
|
|
|
+ const newData = [...this.loadData];
|
|
|
const target = newData.filter(item => key === item.key)[0];
|
|
|
if (target) {
|
|
|
target[column] = value;
|
|
|
- this.data = newData;
|
|
|
+ this.loadData = newData;
|
|
|
}
|
|
|
},
|
|
|
+ // 编辑
|
|
|
edit(key) {
|
|
|
- const newData = [...this.data];
|
|
|
- const target = newData.filter(item => key === item.key)[0];
|
|
|
- this.editingKey = key;
|
|
|
+ console.log(111,this.loadData)
|
|
|
+ const newData = [...this.loadData]
|
|
|
+ console.log(333)
|
|
|
+ const target = newData.filter(item => key === item.key)[0]
|
|
|
+ this.editingKey = key
|
|
|
if (target) {
|
|
|
- target.editable = true;
|
|
|
- this.data = newData;
|
|
|
+ target.editable = true
|
|
|
+ this.loadData = newData
|
|
|
}
|
|
|
+ console.log(222)
|
|
|
},
|
|
|
+ // 保存
|
|
|
save(key) {
|
|
|
- const newData = [...this.data];
|
|
|
+ const newData = [...this.loadData];
|
|
|
const newCacheData = [...this.cacheData];
|
|
|
const target = newData.filter(item => key === item.key)[0];
|
|
|
const targetCache = newCacheData.filter(item => key === item.key)[0];
|
|
|
if (target && targetCache) {
|
|
|
delete target.editable;
|
|
|
- this.data = newData;
|
|
|
+ this.loadData = newData;
|
|
|
Object.assign(targetCache, target);
|
|
|
this.cacheData = newCacheData;
|
|
|
}
|
|
|
this.editingKey = '';
|
|
|
},
|
|
|
+ // 取消
|
|
|
cancel(key) {
|
|
|
- const newData = [...this.data];
|
|
|
+ const newData = [...this.loadData];
|
|
|
const target = newData.filter(item => key === item.key)[0];
|
|
|
this.editingKey = '';
|
|
|
if (target) {
|
|
|
Object.assign(target, this.cacheData.filter(item => key === item.key)[0]);
|
|
|
delete target.editable;
|
|
|
- this.data = newData;
|
|
|
+ this.loadData = newData;
|
|
|
}
|
|
|
},
|
|
|
// 导出
|
|
@@ -256,6 +262,7 @@ export default {
|
|
|
this.download(res)
|
|
|
})
|
|
|
},
|
|
|
+ // 下载
|
|
|
download (data) {
|
|
|
if (!data) { return }
|
|
|
const url = window.URL.createObjectURL(new Blob([data]))
|