|
@@ -65,14 +65,6 @@
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryWarningList-refresh">查询</a-button>
|
|
|
<a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="inventoryWarningList-reset">重置</a-button>
|
|
|
- <!-- <a-button
|
|
|
- style="margin-left: 8px"
|
|
|
- type="primary"
|
|
|
- class="button-warning"
|
|
|
- @click="handleExport"
|
|
|
- :disabled="disabled"
|
|
|
- :loading="exportLoading"
|
|
|
- id="inventoryWarningList-export">导出</a-button> -->
|
|
|
<a @click="advanced=!advanced" style="margin-left: 5px">
|
|
|
{{ advanced ? '收起' : '展开' }}
|
|
|
<a-icon :type="advanced ? 'up' : 'down'"/>
|
|
@@ -84,8 +76,8 @@
|
|
|
<!-- 操作按钮 -->
|
|
|
<div class="table-operator">
|
|
|
<a-button type="primary" v-if="$hasPermissions('B_inventoryWarningBatchSave')" id="inventoryWarningList-update" @click="handleupdate">批量更新</a-button>
|
|
|
- <span style="margin-left: 8px" v-if="$hasPermissions('B_inventoryWarningBatchSave')">
|
|
|
- <template v-if="hasSelected">{{ `已选 ${selectedRowKeys.length} 项` }}</template>
|
|
|
+ <span style="margin-left: 5px" v-if="$hasPermissions('B_inventoryWarningBatchSave')">
|
|
|
+ <template v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
|
|
|
</span>
|
|
|
</div>
|
|
|
<!-- 列表 -->
|
|
@@ -94,16 +86,12 @@
|
|
|
ref="table"
|
|
|
:style="{ height: tableHeight+84.5+'px' }"
|
|
|
size="small"
|
|
|
- :row-selection="$hasPermissions('B_inventoryWarningBatchSave') ? {
|
|
|
- selectedRowKeys: selectedRowKeys,
|
|
|
- onChange: onChange,
|
|
|
- onSelect: onSelectChange,
|
|
|
- onSelectAll: onSelectAllChange
|
|
|
- } : null"
|
|
|
:rowKey="(record) => record.id"
|
|
|
+ :row-selection="$hasPermissions('B_inventoryWarningBatchSave') ? { columnWidth: 40 } : null"
|
|
|
+ @rowSelection="rowSelectionFun"
|
|
|
:columns="columns"
|
|
|
:data="loadData"
|
|
|
- :scroll="{ x: 1490, y: tableHeight }"
|
|
|
+ :scroll="{ x: 1330, y: tableHeight }"
|
|
|
:defaultLoadData="false"
|
|
|
bordered>
|
|
|
<!-- 产品分类 -->
|
|
@@ -131,6 +119,8 @@
|
|
|
:precision="0"
|
|
|
:min="0"
|
|
|
:max="999999"
|
|
|
+ style="width: 100%;"
|
|
|
+ @change="numChange(record)"
|
|
|
placeholder="请输入在途数" />
|
|
|
</div>
|
|
|
</template>
|
|
@@ -144,6 +134,8 @@
|
|
|
:precision="0"
|
|
|
:min="0"
|
|
|
:max="999999"
|
|
|
+ style="width: 100%;"
|
|
|
+ @change="numChange(record)"
|
|
|
placeholder="请输入最大库存数" />
|
|
|
</div>
|
|
|
</template>
|
|
@@ -157,6 +149,8 @@
|
|
|
:precision="0"
|
|
|
:min="0"
|
|
|
:max="record.upperLimit"
|
|
|
+ style="width: 100%;"
|
|
|
+ @change="numChange(record)"
|
|
|
placeholder="请输入最小库存数" />
|
|
|
</div>
|
|
|
</template>
|
|
@@ -182,7 +176,6 @@ import { STable, VSelect } from '@/components'
|
|
|
import { stockWarnList, stockWarnSaveBatch } from '@/api/stockWarn'
|
|
|
import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
|
|
|
import { dealerProductTypeList } from '@/api/dealerProductType'
|
|
|
-// import { downloadExcel } from '@/libs/JGPrint.js'
|
|
|
export default {
|
|
|
name: 'InventoryWarning',
|
|
|
components: { STable, VSelect },
|
|
@@ -208,20 +201,19 @@ export default {
|
|
|
productTypeList: [], // 产品类别下拉数据
|
|
|
productType: [],
|
|
|
columns: [
|
|
|
- { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
|
|
|
+ { title: '序号', dataIndex: 'no', width: 50, align: 'center' },
|
|
|
{ title: '产品编码', dataIndex: 'productCode', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品名称', dataIndex: 'productName', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'productName', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
{ title: '原厂编码', dataIndex: 'productOrigCode', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品品牌', dataIndex: 'brandName', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: 150, align: 'center' },
|
|
|
- // { title: '实时库存数(个)', scopedSlots: { customRender: 'stockQty' }, width: 110, align: 'center' },
|
|
|
- { title: '在途数(个)', scopedSlots: { customRender: 'inTransit' }, width: 100, align: 'center' },
|
|
|
- { title: '总库存数(个)', dataIndex: 'currentStockQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '最大库存数(个)', scopedSlots: { customRender: 'upperLimit' }, width: 110, align: 'center' },
|
|
|
- { title: '最小库存数(个)', scopedSlots: { customRender: 'lowerLimit' }, width: 110, align: 'center' },
|
|
|
+ { title: '产品品牌', dataIndex: 'brandName', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: 120, align: 'center' },
|
|
|
+ { title: '在途数(个)', scopedSlots: { customRender: 'inTransit' }, width: 80, align: 'center' },
|
|
|
+ { title: '总库存数(个)', dataIndex: 'currentStockQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '最大库存数(个)', scopedSlots: { customRender: 'upperLimit' }, width: 100, align: 'center' },
|
|
|
+ { title: '最小库存数(个)', scopedSlots: { customRender: 'lowerLimit' }, width: 100, align: 'center' },
|
|
|
{ title: '差异数量', dataIndex: 'differenceNum', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '预警提示', scopedSlots: { customRender: 'stockState' }, width: 100, align: 'center' },
|
|
|
- { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
|
|
|
+ { title: '操作', scopedSlots: { customRender: 'action' }, width: 80, align: 'center', fixed: 'right' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
@@ -234,12 +226,12 @@ export default {
|
|
|
const no = (data.pageNo - 1) * data.pageSize
|
|
|
for (var i = 0; i < data.list.length; i++) {
|
|
|
data.list[i].no = no + i + 1
|
|
|
- if (this.selectedRowKeys) { // 处理切换页码后 上页已选已输数据保留
|
|
|
- const ind = this.selectedRowKeys.indexOf(data.list[i].id)
|
|
|
+ if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys) { // 处理切换页码后 上页已选已输数据保留
|
|
|
+ const ind = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.indexOf(data.list[i].id)
|
|
|
if (ind >= 0) {
|
|
|
- data.list[i].inTransit = this.selectedRows[ind].inTransit
|
|
|
- data.list[i].upperLimit = this.selectedRows[ind].upperLimit
|
|
|
- data.list[i].lowerLimit = this.selectedRows[ind].lowerLimit
|
|
|
+ data.list[i].inTransit = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows[ind].inTransit
|
|
|
+ data.list[i].upperLimit = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows[ind].upperLimit
|
|
|
+ data.list[i].lowerLimit = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows[ind].lowerLimit
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -249,23 +241,31 @@ export default {
|
|
|
return data
|
|
|
})
|
|
|
},
|
|
|
- selectedRowKeys: [],
|
|
|
- selectedRows: [],
|
|
|
- loading: false
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
- hasSelected () {
|
|
|
- return this.selectedRowKeys.length > 0
|
|
|
+ loading: false,
|
|
|
+ rowSelectionInfo: null
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 表格选中项
|
|
|
+ rowSelectionFun (obj) {
|
|
|
+ this.rowSelectionInfo = obj || null
|
|
|
+ },
|
|
|
+ numChange (row) {
|
|
|
+ if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys) { // 处理切换页码后 上页已选已输数据保留
|
|
|
+ const ind = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.indexOf(row.id)
|
|
|
+ if (ind >= 0) {
|
|
|
+ this.rowSelectionInfo.selectedRows[ind].inTransit = row.inTransit
|
|
|
+ this.rowSelectionInfo.selectedRows[ind].upperLimit = row.upperLimit
|
|
|
+ this.rowSelectionInfo.selectedRows[ind].lowerLimit = row.lowerLimit
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
// 保存
|
|
|
handleSave (row, isBatch) {
|
|
|
const params = []
|
|
|
if (isBatch) { // 批量更新
|
|
|
const dataInd = []
|
|
|
- this.selectedRows.map((item, index) => {
|
|
|
+ this.rowSelectionInfo && this.rowSelectionInfo.selectedRows.map((item, index) => {
|
|
|
if ((!item.inTransit && item.inTransit != 0) || (!item.upperLimit && item.upperLimit != 0) || (!item.lowerLimit && item.lowerLimit != 0)) {
|
|
|
dataInd.push(item.no)
|
|
|
}
|
|
@@ -310,43 +310,13 @@ export default {
|
|
|
if (res.status == 200) {
|
|
|
this.$message.success(res.message)
|
|
|
this.$refs.table.refresh()
|
|
|
- this.selectedRowKeys = []
|
|
|
- this.selectedRows = []
|
|
|
+ this.$refs.table.clearSelected() // 清空表格选中项
|
|
|
this.spinning = false
|
|
|
} else {
|
|
|
this.spinning = false
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- onChange (selectedRowKeys, selectedRows) {
|
|
|
- this.selectedRowKeys = selectedRowKeys
|
|
|
- },
|
|
|
- onSelectChange (record, selected, selectedRows, nativeEvent) {
|
|
|
- if (selected) { // 选择
|
|
|
- this.selectedRows.push(record)
|
|
|
- } else { // 取消
|
|
|
- this.selectedRows = selectedRows
|
|
|
- }
|
|
|
- },
|
|
|
- // 本页全选/取消全选
|
|
|
- onSelectAllChange (selected, selectedRows, changeRows) {
|
|
|
- const _this = this
|
|
|
- if (selected) { // 选择
|
|
|
- this.selectedRows = [...this.selectedRows, ...changeRows]
|
|
|
- } else { // 取消
|
|
|
- const arrId = []
|
|
|
- this.selectedRows.map((item, index) => {
|
|
|
- this.selectedRows.map((subItem, ind) => {
|
|
|
- if (item.id == subItem.id) {
|
|
|
- arrId.push(index)
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- arrId.map((item, index) => {
|
|
|
- _this.selectedRows = _this.selectedRows.slice(item, item + 1)
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
// 重置
|
|
|
resetSearchForm () {
|
|
|
this.queryParam.productCode = ''
|
|
@@ -362,7 +332,7 @@ export default {
|
|
|
},
|
|
|
// 批量更新
|
|
|
handleupdate () {
|
|
|
- if (this.selectedRowKeys.length < 1) {
|
|
|
+ if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1) {
|
|
|
this.$message.warning('请在列表勾选后再进行批量操作!')
|
|
|
return
|
|
|
}
|
|
@@ -408,15 +378,6 @@ export default {
|
|
|
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
)
|
|
|
},
|
|
|
- // 导出
|
|
|
- handleExport () {
|
|
|
- const params = this.queryParam
|
|
|
- this.exportLoading = true
|
|
|
- // customerBundleExportDelay(params).then(res => {
|
|
|
- // this.exportLoading = false
|
|
|
- // downloadExcel(res, '库存预警')
|
|
|
- // })
|
|
|
- },
|
|
|
pageInit () {
|
|
|
const _this = this
|
|
|
this.$nextTick(() => { // 页面渲染完成后的回调
|