给商品增加期初库存批量设置的功能
This commit is contained in:
92
jshERP-web/src/views/material/modules/BatchSetStockModal.vue
Normal file
92
jshERP-web/src/views/material/modules/BatchSetStockModal.vue
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
<template>
|
||||||
|
<a-modal
|
||||||
|
:title="title"
|
||||||
|
:width="500"
|
||||||
|
:visible="visible"
|
||||||
|
:confirm-loading="confirmLoading"
|
||||||
|
@ok="handleOk"
|
||||||
|
@cancel="handleCancel"
|
||||||
|
cancelText="关闭"
|
||||||
|
wrapClassName="ant-modal-cust-warp"
|
||||||
|
style="top:35%;height: 30%;overflow-y: hidden">
|
||||||
|
<template slot="footer">
|
||||||
|
<a-button key="back" v-if="isReadOnly" @click="handleCancel">
|
||||||
|
关闭
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
<a-spin :spinning="confirmLoading">
|
||||||
|
<a-form :form="form">
|
||||||
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="请输入数量">
|
||||||
|
<a-input placeholder="请输入数量" v-decorator.trim="[ 'number', validatorRules.number]" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</a-spin>
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'BatchSetStockModal',
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
title:"批量设置",
|
||||||
|
visible: false,
|
||||||
|
isReadOnly: false,
|
||||||
|
batchType: '',
|
||||||
|
model: {},
|
||||||
|
labelCol: {
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 5 },
|
||||||
|
},
|
||||||
|
wrapperCol: {
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 16 },
|
||||||
|
},
|
||||||
|
confirmLoading: false,
|
||||||
|
form: this.$form.createForm(this),
|
||||||
|
validatorRules:{
|
||||||
|
number:{
|
||||||
|
rules: [
|
||||||
|
{ required: true, message: '请输入数量!' }
|
||||||
|
]}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
add (type) {
|
||||||
|
this.batchType = type
|
||||||
|
if(type === 'initStock') {
|
||||||
|
this.title = '期初库存-批量设置'
|
||||||
|
} else if(type === 'lowSafeStock') {
|
||||||
|
this.title = '最低安全库存-批量设置'
|
||||||
|
} else if(type === 'highSafeStock') {
|
||||||
|
this.title = '最高安全库存-批量设置'
|
||||||
|
}
|
||||||
|
this.edit({});
|
||||||
|
},
|
||||||
|
edit (record) {
|
||||||
|
this.form.resetFields();
|
||||||
|
this.model = Object.assign({}, record);
|
||||||
|
this.visible = true;
|
||||||
|
},
|
||||||
|
close () {
|
||||||
|
this.$emit('close');
|
||||||
|
this.visible = false;
|
||||||
|
},
|
||||||
|
handleOk () {
|
||||||
|
let number = this.form.getFieldValue('number')
|
||||||
|
this.$emit('ok', number, this.batchType);
|
||||||
|
this.visible = false
|
||||||
|
},
|
||||||
|
handleCancel () {
|
||||||
|
this.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -180,14 +180,14 @@
|
|||||||
:actionButton="true"
|
:actionButton="true"
|
||||||
@added="onAdded">
|
@added="onAdded">
|
||||||
<template #buttonAfter>
|
<template #buttonAfter>
|
||||||
<a-button @click="batchSet('purchase')">采购价-批量</a-button>
|
<a-button @click="batchSetPrice('purchase')">采购价-批量</a-button>
|
||||||
<a-button style="margin-left: 8px" @click="batchSet('commodity')">零售价-批量</a-button>
|
<a-button style="margin-left: 8px" @click="batchSetPrice('commodity')">零售价-批量</a-button>
|
||||||
<a-button style="margin-left: 8px" @click="batchSet('wholesale')">销售价-批量</a-button>
|
<a-button style="margin-left: 8px" @click="batchSetPrice('wholesale')">销售价-批量</a-button>
|
||||||
<a-button style="margin-left: 8px" @click="batchSet('low')">最低售价-批量</a-button>
|
<a-button style="margin-left: 8px" @click="batchSetPrice('low')">最低售价-批量</a-button>
|
||||||
</template>
|
</template>
|
||||||
</j-editable-table>
|
</j-editable-table>
|
||||||
<!-- 表单区域 -->
|
<!-- 表单区域 -->
|
||||||
<batch-set-price-modal ref="modalForm" @ok="batchSetPricemodalFormOk"></batch-set-price-modal>
|
<batch-set-price-modal ref="priceModalForm" @ok="batchSetPriceModalFormOk"></batch-set-price-modal>
|
||||||
</div>
|
</div>
|
||||||
<a-row class="form-row" :gutter="24">
|
<a-row class="form-row" :gutter="24">
|
||||||
<a-col :lg="24" :md="24" :sm="24">
|
<a-col :lg="24" :md="24" :sm="24">
|
||||||
@@ -237,7 +237,15 @@
|
|||||||
:maxHeight="300"
|
:maxHeight="300"
|
||||||
:rowNumber="true"
|
:rowNumber="true"
|
||||||
:rowSelection="false"
|
:rowSelection="false"
|
||||||
:actionButton="false"/>
|
:actionButton="false">
|
||||||
|
<template #buttonAfter>
|
||||||
|
<a-button style="margin: 0px 0px 8px 0px" @click="batchSetStock('initStock')">期初库存-批量</a-button>
|
||||||
|
<a-button style="margin-left: 8px" @click="batchSetStock('lowSafeStock')">最低安全库存-批量</a-button>
|
||||||
|
<a-button style="margin-left: 8px" @click="batchSetStock('highSafeStock')">最高安全库存-批量</a-button>
|
||||||
|
</template>
|
||||||
|
</j-editable-table>
|
||||||
|
<!-- 表单区域 -->
|
||||||
|
<batch-set-stock-modal ref="stockModalForm" @ok="batchSetStockModalFormOk"></batch-set-stock-modal>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane key="4" tab="图片信息" forceRender>
|
<a-tab-pane key="4" tab="图片信息" forceRender>
|
||||||
<a-row class="form-row" :gutter="24">
|
<a-row class="form-row" :gutter="24">
|
||||||
@@ -258,6 +266,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import pick from 'lodash.pick'
|
import pick from 'lodash.pick'
|
||||||
import BatchSetPriceModal from './BatchSetPriceModal'
|
import BatchSetPriceModal from './BatchSetPriceModal'
|
||||||
|
import BatchSetStockModal from './BatchSetStockModal'
|
||||||
import UnitModal from '../../system/modules/UnitModal'
|
import UnitModal from '../../system/modules/UnitModal'
|
||||||
import JEditableTable from '@/components/jeecg/JEditableTable'
|
import JEditableTable from '@/components/jeecg/JEditableTable'
|
||||||
import { FormTypes, VALIDATE_NO_PASSED, getRefPromise, validateFormAndTables } from '@/utils/JEditableTableUtil'
|
import { FormTypes, VALIDATE_NO_PASSED, getRefPromise, validateFormAndTables } from '@/utils/JEditableTableUtil'
|
||||||
@@ -271,6 +280,7 @@
|
|||||||
name: "MaterialModal",
|
name: "MaterialModal",
|
||||||
components: {
|
components: {
|
||||||
BatchSetPriceModal,
|
BatchSetPriceModal,
|
||||||
|
BatchSetStockModal,
|
||||||
UnitModal,
|
UnitModal,
|
||||||
JImageUpload,
|
JImageUpload,
|
||||||
JDate,
|
JDate,
|
||||||
@@ -778,15 +788,19 @@
|
|||||||
this.maxBarCodeInfo = this.maxBarCodeInfo + 1
|
this.maxBarCodeInfo = this.maxBarCodeInfo + 1
|
||||||
target.setValues([{rowKey: row.id, values: {barCode: this.maxBarCodeInfo, commodityUnit: unit?unit:''}}])
|
target.setValues([{rowKey: row.id, values: {barCode: this.maxBarCodeInfo, commodityUnit: unit?unit:''}}])
|
||||||
},
|
},
|
||||||
batchSet(type) {
|
batchSetPrice(type) {
|
||||||
if(this.skuSwitch || this.model.id){
|
if(this.skuSwitch || this.model.id){
|
||||||
this.$refs.modalForm.add(type);
|
this.$refs.priceModalForm.add(type);
|
||||||
this.$refs.modalForm.disableSubmit = false;
|
this.$refs.priceModalForm.disableSubmit = false;
|
||||||
} else {
|
} else {
|
||||||
this.$message.warning('抱歉,只有开启多属性才能进行批量操作!');
|
this.$message.warning('抱歉,只有开启多属性才能进行批量操作!');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
batchSetPricemodalFormOk(price, batchType) {
|
batchSetStock(type) {
|
||||||
|
this.$refs.stockModalForm.add(type);
|
||||||
|
this.$refs.stockModalForm.disableSubmit = false;
|
||||||
|
},
|
||||||
|
batchSetPriceModalFormOk(price, batchType) {
|
||||||
let arr = this.meTable.dataSource
|
let arr = this.meTable.dataSource
|
||||||
if(arr.length === 0) {
|
if(arr.length === 0) {
|
||||||
this.$message.warning('请先录入条码、单位等信息!');
|
this.$message.warning('请先录入条码、单位等信息!');
|
||||||
@@ -813,6 +827,26 @@
|
|||||||
this.meTable.dataSource = meTableData
|
this.meTable.dataSource = meTableData
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
batchSetStockModalFormOk(stock, batchType) {
|
||||||
|
let arr = this.depotTable.dataSource
|
||||||
|
let depotTableData = []
|
||||||
|
for (let i = 0; i < arr.length; i++) {
|
||||||
|
let depotInfo = {name: arr[i].name, initStock: arr[i].initStock,
|
||||||
|
lowSafeStock: arr[i].lowSafeStock, highSafeStock: arr[i].highSafeStock}
|
||||||
|
if (batchType === 'initStock') {
|
||||||
|
depotInfo.initStock = stock - 0
|
||||||
|
} else if (batchType === 'lowSafeStock') {
|
||||||
|
depotInfo.lowSafeStock = stock - 0
|
||||||
|
} else if (batchType === 'highSafeStock') {
|
||||||
|
depotInfo.highSafeStock = stock - 0
|
||||||
|
}
|
||||||
|
if (arr[i].id) {
|
||||||
|
depotInfo.id = arr[i].id
|
||||||
|
}
|
||||||
|
depotTableData.push(depotInfo)
|
||||||
|
}
|
||||||
|
this.depotTable.dataSource = depotTableData
|
||||||
|
},
|
||||||
initMaterialAttribute() {
|
initMaterialAttribute() {
|
||||||
getAllMaterialAttribute({}).then((res)=>{
|
getAllMaterialAttribute({}).then((res)=>{
|
||||||
if(res && res.code===200) {
|
if(res && res.code===200) {
|
||||||
|
|||||||
Reference in New Issue
Block a user