|
@@ -57,51 +57,89 @@
|
|
|
<a-button id="inventoryWarningList-update" type="primary" @click="handleupdate">批量更新</a-button>
|
|
|
</div>
|
|
|
<!-- 列表 -->
|
|
|
- <s-table
|
|
|
+ <a-table
|
|
|
class="sTable"
|
|
|
ref="table"
|
|
|
size="default"
|
|
|
- :rowKey="(record) => record.id"
|
|
|
+ :rowKey="record => record.id"
|
|
|
:columns="columns"
|
|
|
- :data="loadData"
|
|
|
+ :dataSource="loadData"
|
|
|
+ :pagination="paginationProps"
|
|
|
+ :loading="loadingPage"
|
|
|
+ :scroll="{ x: 2210 }"
|
|
|
bordered>
|
|
|
<!-- 预警提示 -->
|
|
|
<template slot="warningTips" slot-scope="text, record">
|
|
|
- <span :class="[record.inventoryTotal == 1 ? 'green' : 'red']">{{record.warningTips}}</span>
|
|
|
+ <!-- 库存溢满:总库存数>最大库存数 -->
|
|
|
+ <span v-if="record.inventoryTotal > record.maxInventory" class="yellow">库存溢满</span>
|
|
|
+ <!-- 库存不足:总库存数<最小库存数 -->
|
|
|
+ <span v-if="record.inventoryTotal < record.minInventory" class="red">库存不足</span>
|
|
|
+ <!-- 库存缺货:当前库存数为0 -->
|
|
|
+ <span v-if="record.inventoryRealTime < 1" class="blue">库存缺货</span>
|
|
|
+ <!-- 库存正常:最小库存数≤总库存数≤最大库存数 -->
|
|
|
+ <span v-if="record.minInventory <= record.inventoryTotal <= record.maxInventory" class="green">库存正常</span>
|
|
|
</template>
|
|
|
<!-- 需要编辑的字段 -->
|
|
|
- <template
|
|
|
- v-for="col in ['onWayNum', 'maxInventory', 'minInventory']"
|
|
|
- :slot="col"
|
|
|
- slot-scope="text, record, index"
|
|
|
- >
|
|
|
- <div :key="col">
|
|
|
- <a-input
|
|
|
+ <!-- 在途数 -->
|
|
|
+ <template slot="onWayNum" slot-scope="text, record" >
|
|
|
+ <div>
|
|
|
+ <a-input-number
|
|
|
v-if="record.editable"
|
|
|
- style="margin: -5px 0"
|
|
|
- :value="text"
|
|
|
- @change="e => handleChange(e.target.value, record.key, col)"
|
|
|
- />
|
|
|
- <template v-else>
|
|
|
- {{ text }}
|
|
|
- </template>
|
|
|
+ id="inventoryWarningList-onWayNum"
|
|
|
+ :value="record.onWayNum"
|
|
|
+ :precision="0"
|
|
|
+ :min="0"
|
|
|
+ :max="record.inventoryTotal-record.inventoryRealTime"
|
|
|
+ placeholder="请输入在途数"
|
|
|
+ @change="e => handleChange(e, record.id, 'onWayNum')" />
|
|
|
+ <template v-else> {{ record.onWayNum }} </template>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <!-- 最大库存数 -->
|
|
|
+ <template slot="maxInventory" slot-scope="text, record" >
|
|
|
+ <div>
|
|
|
+ <a-input-number
|
|
|
+ v-if="record.editable"
|
|
|
+ id="inventoryWarningList-maxInventory"
|
|
|
+ :value="record.maxInventory"
|
|
|
+ :precision="0"
|
|
|
+ :min="0"
|
|
|
+ :max="999999"
|
|
|
+ placeholder="请输入最大库存数"
|
|
|
+ @change="e => handleChange(e, record.id, 'maxInventory')" />
|
|
|
+ <template v-else> {{ record.maxInventory }} </template>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <!-- 最小库存数 -->
|
|
|
+ <template slot="minInventory" slot-scope="text, record" >
|
|
|
+ <div>
|
|
|
+ <a-input-number
|
|
|
+ v-if="record.editable"
|
|
|
+ id="inventoryWarningList-minInventory"
|
|
|
+ :value="record.minInventory"
|
|
|
+ :precision="0"
|
|
|
+ :min="0"
|
|
|
+ :max="999999"
|
|
|
+ placeholder="请输入最小库存数"
|
|
|
+ @change="e => handleChange(e, record.id, 'minInventory')" />
|
|
|
+ <template v-else> {{ record.minInventory }} </template>
|
|
|
</div>
|
|
|
</template>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record">
|
|
|
<div class="editable-row-operations">
|
|
|
<span v-if="record.editable">
|
|
|
- <a @click="() => save(record.key)">保存</a>
|
|
|
- <a-popconfirm title="确定要取消吗" @confirm="() => cancel(record.key)">
|
|
|
- <a>取消</a>
|
|
|
+ <a-button type="primary" @click="() => save(record.id, record.onWayNum, record.maxInventory, record.minInventory)" style="margin-right: 10px;">保存</a-button>
|
|
|
+ <a-popconfirm title="确定要取消吗" @confirm="() => cancel(record.id)">
|
|
|
+ <a-button>取消</a-button>
|
|
|
</a-popconfirm>
|
|
|
</span>
|
|
|
<span v-else>
|
|
|
- <a :disabled="editingKey !== ''" @click="() => edit(record.key)">编辑</a>
|
|
|
+ <a-button type="primary" :disabled="editingId !== ''" @click="() => edit(record.id)">编辑</a-button type="primary">
|
|
|
</span>
|
|
|
</div>
|
|
|
</template>
|
|
|
- </s-table>
|
|
|
+ </a-table>
|
|
|
</a-card>
|
|
|
</template>
|
|
|
|
|
@@ -127,59 +165,159 @@ export default {
|
|
|
exportLoading: false, // 导出loading
|
|
|
disabled: false, // 查询、重置按钮是否可操作
|
|
|
brandData: [], // 产品品牌下拉数据
|
|
|
- typeData: [], // 产品类别下拉数据
|
|
|
+ typeData: [], // 产品类别下拉数据 160 * 3 + 200 * 2 + 100 + 140 * 5 + 120 * 3
|
|
|
columns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: 70, 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: 'productBrand', width: 160, 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: 'inventoryTotal', 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 || '--' } },
|
|
|
+ { title: '实时库存数(个)', dataIndex: 'inventoryRealTime', width: 150, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '在途数(个)', scopedSlots: { customRender: 'onWayNum' }, width: 150, align: 'center' },
|
|
|
+ { title: '总库存数(个)', dataIndex: 'inventoryTotal', width: 150, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '最大库存数(个)', scopedSlots: { customRender: 'maxInventory' }, width: 150, align: 'center' },
|
|
|
+ { title: '最小库存数(个)', scopedSlots: { customRender: 'minInventory' }, width: 150, align: 'center' },
|
|
|
+ { title: '差异数量', dataIndex: 'variabilityMeasures', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '预警提示', scopedSlots: { customRender: 'warningTips' }, width: 120, align: 'center' },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 240, align: 'center' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
- loadData: parameter => {
|
|
|
- this.disabled = true
|
|
|
- // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
|
|
|
- // const data = res.data
|
|
|
- // const no = (data.pageNo - 1) * data.pageSize
|
|
|
- // for (var i = 0; i < data.list.length; i++) {
|
|
|
- // data.list[i].no = no + i + 1
|
|
|
- // }
|
|
|
- // this.disabled = false
|
|
|
- // return data
|
|
|
- // })
|
|
|
- const _this = this
|
|
|
- return new Promise(function(resolve, reject){
|
|
|
- const data = {
|
|
|
- pageNo: 1,
|
|
|
- pageSize: 10,
|
|
|
- list: [
|
|
|
- { key: '1', id: '1', productNum: 'jgqp11111111111', productName: '产品1', productOldNum: 'jgqp111123545', productBrand: '箭冠品牌', productType: '产品分类1', inventoryNum: '5', inventoryMoney: '122' }
|
|
|
- ]
|
|
|
- }
|
|
|
- const no = (data.pageNo - 1) * data.pageSize
|
|
|
- for (var i = 0; i < data.list.length; i++) {
|
|
|
- data.list[i].no = no + i + 1
|
|
|
- }
|
|
|
- _this.disabled = false
|
|
|
- resolve(data)
|
|
|
- })
|
|
|
+ // loadData: parameter => {
|
|
|
+ // this.disabled = true
|
|
|
+ // // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
|
|
|
+ // // const data = res.data
|
|
|
+ // // const no = (data.pageNo - 1) * data.pageSize
|
|
|
+ // // for (var i = 0; i < data.list.length; i++) {
|
|
|
+ // // data.list[i].no = no + i + 1
|
|
|
+ // // }
|
|
|
+ // // this.disabled = false
|
|
|
+ // // return data
|
|
|
+ // // })
|
|
|
+ // const _this = this
|
|
|
+ // return new Promise(function(resolve, reject){
|
|
|
+ // const data = {
|
|
|
+ // pageNo: 1,
|
|
|
+ // pageSize: 10,
|
|
|
+ // list: [
|
|
|
+ // {
|
|
|
+ // key: '1',
|
|
|
+ // id: '1',
|
|
|
+ // productNum: 'jgqp11111111111',
|
|
|
+ // productName: '产品1',
|
|
|
+ // productOldNum: 'jgqp111123545',
|
|
|
+ // productBrand: '箭冠品牌',
|
|
|
+ // productType: '产品分类1',
|
|
|
+ // inventoryRealTime: 0,
|
|
|
+ // inventoryMoney: '122',
|
|
|
+ // onWayNum: 2,
|
|
|
+ // inventoryTotal: 5,
|
|
|
+ // maxInventory: 7,
|
|
|
+ // minInventory: 1,
|
|
|
+ // variabilityMeasures: 2
|
|
|
+ // }
|
|
|
+ // ]
|
|
|
+ // }
|
|
|
+ // const no = (data.pageNo - 1) * data.pageSize
|
|
|
+ // for (var i = 0; i < data.list.length; i++) {
|
|
|
+ // data.list[i].no = no + i + 1
|
|
|
+ // }
|
|
|
+ // _this.disabled = false
|
|
|
+ // resolve(data)
|
|
|
+ // })
|
|
|
+ // },
|
|
|
+ loadData: [
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ productNum: 'jgqp11111111111',
|
|
|
+ productName: '产品1',
|
|
|
+ productOldNum: 'jgqp111123545',
|
|
|
+ productBrand: '箭冠品牌',
|
|
|
+ productType: '产品分类1',
|
|
|
+ inventoryRealTime: 2,
|
|
|
+ inventoryMoney: '122',
|
|
|
+ onWayNum: 2,
|
|
|
+ inventoryTotal: 5,
|
|
|
+ maxInventory: 7,
|
|
|
+ minInventory: 1,
|
|
|
+ variabilityMeasures: 2
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ productNum: 'jgqp11111111111',
|
|
|
+ productName: '产品1',
|
|
|
+ productOldNum: 'jgqp111123545',
|
|
|
+ productBrand: '箭冠品牌',
|
|
|
+ productType: '产品分类1',
|
|
|
+ inventoryRealTime: 2,
|
|
|
+ inventoryMoney: '122',
|
|
|
+ onWayNum: 2,
|
|
|
+ inventoryTotal: 5,
|
|
|
+ maxInventory: 7,
|
|
|
+ minInventory: 1,
|
|
|
+ variabilityMeasures: 2
|
|
|
+ }
|
|
|
+ ], // 列表数据
|
|
|
+ loadingPage: false, // 加载中
|
|
|
+ pageNo: 1, // 分页页码
|
|
|
+ pageSize: 10, // 分页 每页多少条
|
|
|
+ paginationProps: {
|
|
|
+ showSizeChanger: true, // 是否可以改变 pageSize
|
|
|
+ total: 0, // 分页总条数
|
|
|
+ current: 1,
|
|
|
+ onShowSizeChange: (current, pageSize) => this.changePageSize(current, pageSize),
|
|
|
+ onChange: (current) => this.changePage(current)
|
|
|
},
|
|
|
openModal: false, // 查看库存详情 弹框
|
|
|
itemId: '', // 当前库存记录id
|
|
|
- editingKey: ''
|
|
|
+ editingId: ''
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 分页 一页多少条change
|
|
|
+ changePageSize (current, pageSize) {
|
|
|
+ this.editingId = ''
|
|
|
+ this.pageNo = current
|
|
|
+ this.pageSize = pageSize
|
|
|
+ this.pageInit()
|
|
|
+ },
|
|
|
+ // 分页 页码change
|
|
|
+ changePage (current) {
|
|
|
+ this.editingId = ''
|
|
|
+ this.pageNo = current
|
|
|
+ this.pageInit()
|
|
|
+ },
|
|
|
+ // 列表数据
|
|
|
+ pageInit (pageNo, pageSize) {
|
|
|
+ this.pageNo = pageNo || this.pageNo
|
|
|
+ this.pageSize = pageSize || this.pageSize
|
|
|
+ this.editingId = ''
|
|
|
+ // const params = {
|
|
|
+ // storeId: this.searchForm.storeId,
|
|
|
+ // itemId: this.searchForm.itemId,
|
|
|
+ // itemType: this.searchForm.itemType,
|
|
|
+ // pageNo: this.pageNo,
|
|
|
+ // pageSize: this.pageSize
|
|
|
+ // }
|
|
|
+ this.loadingPage = true
|
|
|
+ // storeItemPriceList(params).then(res => {
|
|
|
+ // if (res.status == 200) {
|
|
|
+ // const data = res.data
|
|
|
+ // this.paginationProps.total = res.data.count || 0
|
|
|
+ // this.paginationProps.current = this.pageNo
|
|
|
+ // const no = (data.pageNo - 1) * data.pageSize
|
|
|
+ // for (var i = 0; i < data.list.length; i++) {
|
|
|
+ // data.list[i].no = no + i + 1
|
|
|
+ // data.list[i].editable = false
|
|
|
+ // }
|
|
|
+ // this.loadData = data.list
|
|
|
+ // } else {
|
|
|
+ // this.loadData = []
|
|
|
+ // }
|
|
|
+ // this.loadingPage = false
|
|
|
+ // })
|
|
|
+ },
|
|
|
// 重置
|
|
|
resetSearchForm () {
|
|
|
this.queryParam.orderBundleNo = ''
|
|
@@ -188,7 +326,7 @@ export default {
|
|
|
this.queryParam.itemName = ''
|
|
|
this.oldTime = undefined
|
|
|
this.newTime = undefined
|
|
|
- this.$refs.table.refresh(true)
|
|
|
+ this.pageInit(1)
|
|
|
},
|
|
|
// 批量更新
|
|
|
handleupdate(){
|
|
@@ -211,50 +349,59 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- handleChange(value, key, column) {
|
|
|
- const newData = [...this.loadData];
|
|
|
- const target = newData.filter(item => key === item.key)[0];
|
|
|
+ // change
|
|
|
+ handleChange(value, id, column) {
|
|
|
+ const newData = [...this.loadData]
|
|
|
+ const target = newData.filter(item => id === item.id)[0]
|
|
|
if (target) {
|
|
|
- target[column] = value;
|
|
|
- this.loadData = newData;
|
|
|
+ target[column] = value
|
|
|
+ this.loadData = newData
|
|
|
}
|
|
|
},
|
|
|
// 编辑
|
|
|
- edit(key) {
|
|
|
- console.log(111,this.loadData)
|
|
|
+ edit(id) {
|
|
|
const newData = [...this.loadData]
|
|
|
- console.log(333)
|
|
|
- const target = newData.filter(item => key === item.key)[0]
|
|
|
- this.editingKey = key
|
|
|
+ const target = newData.filter(item => id === item.id)[0]
|
|
|
+ this.editingId = id
|
|
|
if (target) {
|
|
|
target.editable = true
|
|
|
this.loadData = newData
|
|
|
}
|
|
|
- console.log(222)
|
|
|
},
|
|
|
// 保存
|
|
|
- save(key) {
|
|
|
- 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.loadData = newData;
|
|
|
- Object.assign(targetCache, target);
|
|
|
- this.cacheData = newCacheData;
|
|
|
+ save(id, onWayNum, maxInventory, minInventory) {
|
|
|
+ // 更改后的值是否为空
|
|
|
+ if (!onWayNum) {
|
|
|
+ this.$message.warning('在途数不能为空')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!maxInventory) {
|
|
|
+ this.$message.warning('最大库存数不能为空')
|
|
|
+ return
|
|
|
}
|
|
|
- this.editingKey = '';
|
|
|
+ if (!minInventory) {
|
|
|
+ this.$message.warning('最小库存数不能为空')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // saveStoreItemPrice({
|
|
|
+ // id: id,
|
|
|
+ // accountPrice: accountPrice
|
|
|
+ // }).then(res => {
|
|
|
+ // if (res.status == 200) {
|
|
|
+ this.editingId = ''
|
|
|
+ this.pageInit()
|
|
|
+ // } else {
|
|
|
+ // this.$message.warning(res.message)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
},
|
|
|
// 取消
|
|
|
- cancel(key) {
|
|
|
- const newData = [...this.loadData];
|
|
|
- const target = newData.filter(item => key === item.key)[0];
|
|
|
- this.editingKey = '';
|
|
|
+ cancel(id) {
|
|
|
+ const newData = [...this.loadData]
|
|
|
+ const target = newData.filter(item => id === item.id)[0]
|
|
|
+ this.editingId = ''
|
|
|
if (target) {
|
|
|
- Object.assign(target, this.cacheData.filter(item => key === item.key)[0]);
|
|
|
- delete target.editable;
|
|
|
- this.loadData = newData;
|
|
|
+ this.pageInit()
|
|
|
}
|
|
|
},
|
|
|
// 导出
|