增加批次商品选择
This commit is contained in:
@@ -97,6 +97,7 @@ const findBySelectRetail = (params)=>postAction("/supplier/findBySelect_retail",
|
||||
//单据相关
|
||||
const findBillDetailByNumber = (params)=>getAction("/depotHead/getDetailByNumber",params);
|
||||
const findStockByDepotAndBarCode = (params)=>getAction("/depotItem/findStockByDepotAndBarCode",params);
|
||||
const getBatchNumberList = (params)=>getAction("/depotItem/getBatchNumberList",params);
|
||||
const findFinancialDetailByNumber = (params)=>getAction("/accountHead/getDetailByNumber",params);
|
||||
|
||||
export {
|
||||
@@ -176,6 +177,7 @@ export {
|
||||
findBySelectRetail,
|
||||
findBillDetailByNumber,
|
||||
findStockByDepotAndBarCode,
|
||||
getBatchNumberList,
|
||||
findFinancialDetailByNumber
|
||||
}
|
||||
|
||||
|
||||
@@ -405,7 +405,9 @@
|
||||
@mouseover="()=>{handleMouseoverCommono(row,col)}"
|
||||
@mouseout="()=>{handleMouseoutCommono(row,col)}">
|
||||
|
||||
<j-select-material
|
||||
<j-select-list
|
||||
:rows="getPopupJshRows(row)"
|
||||
:kind="col.kind"
|
||||
:multi="col.multi"
|
||||
:value="getPopupJshValue(id)"
|
||||
@change="(v)=>handleChangePopupJshCommon(v,id,row,col,rowIndex)" />
|
||||
@@ -767,14 +769,14 @@
|
||||
import { getFileAccessHttpUrl } from '@/api/manage';
|
||||
import JInputPop from '@/components/jeecg/minipop/JInputPop'
|
||||
import JFilePop from '@/components/jeecg/minipop/JFilePop'
|
||||
import JSelectMaterial from '@/components/jeecgbiz/JSelectMaterial'
|
||||
import JSelectList from '@/components/jeecgbiz/JSelectList'
|
||||
|
||||
// 行高,需要在实例加载完成前用到
|
||||
let rowHeight = 42
|
||||
|
||||
export default {
|
||||
name: 'JEditableTable',
|
||||
components: { JDate, Draggable, JInputPop, JFilePop, JSelectMaterial },
|
||||
components: { JDate, Draggable, JInputPop, JFilePop, JSelectList },
|
||||
provide() {
|
||||
return {
|
||||
parentIsJEditableTable: true,
|
||||
@@ -2704,6 +2706,11 @@
|
||||
getPopupJshValue(id) {
|
||||
return this.popupJshValues[id]
|
||||
},
|
||||
/** popupJsh构造传值 */
|
||||
getPopupJshRows(row) {
|
||||
let { values } = this.getValuesSync({ validate: false, rowIds: [row.id] })
|
||||
return JSON.stringify(values[0])
|
||||
},
|
||||
handleRadioChange(value, id, row, column) {
|
||||
this.radioValues = this.bindValuesChange(value, id, 'radioValues')
|
||||
// 做单个表单验证
|
||||
|
||||
91
jshERP-web/src/components/jeecgbiz/JSelectList.vue
Normal file
91
jshERP-web/src/components/jeecgbiz/JSelectList.vue
Normal file
@@ -0,0 +1,91 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-input-search
|
||||
v-model="names"
|
||||
placeholder="请选择"
|
||||
readOnly
|
||||
@search="onSearch">
|
||||
</a-input-search>
|
||||
<j-select-material-modal v-if="kind === 'material'" ref="selectModal" :modal-width="modalWidth" :rows="rows" :multi="multi" :bar-code="value" @ok="selectOK" @initComp="initComp"/>
|
||||
<j-select-batch-modal v-if="kind === 'batch'" ref="selectModal" :modal-width="modalWidth" :rows="rows" :multi="multi" :bar-code="value" @ok="selectOK" @initComp="initComp"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import JSelectMaterialModal from './modal/JSelectMaterialModal'
|
||||
import JSelectBatchModal from './modal/JSelectBatchModal'
|
||||
|
||||
export default {
|
||||
name: 'JSelectList',
|
||||
components: {JSelectMaterialModal, JSelectBatchModal},
|
||||
props: {
|
||||
modalWidth: {
|
||||
type: Number,
|
||||
default: 1200,
|
||||
required: false
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
rows: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
kind: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
multi: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
ids: "",
|
||||
names: "",
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.ids = this.value
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
this.ids = val
|
||||
}
|
||||
},
|
||||
model: {
|
||||
prop: 'value',
|
||||
event: 'change'
|
||||
},
|
||||
methods: {
|
||||
initComp(name) {
|
||||
this.names = name
|
||||
},
|
||||
onSearch() {
|
||||
this.$refs.selectModal.showModal()
|
||||
},
|
||||
selectOK(rows, idstr) {
|
||||
console.log("选中id", idstr)
|
||||
if (!rows) {
|
||||
this.ids = ''
|
||||
} else {
|
||||
this.names = idstr
|
||||
this.ids = idstr
|
||||
}
|
||||
this.$emit("change", this.ids)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
248
jshERP-web/src/components/jeecgbiz/modal/JSelectBatchModal.vue
Normal file
248
jshERP-web/src/components/jeecgbiz/modal/JSelectBatchModal.vue
Normal file
@@ -0,0 +1,248 @@
|
||||
<template>
|
||||
<a-modal
|
||||
:width="modalWidth"
|
||||
:visible="visible"
|
||||
:title="title"
|
||||
@ok="handleSubmit"
|
||||
@cancel="close"
|
||||
cancelText="关闭"
|
||||
style="top:5%;height: 100%;overflow-y: hidden"
|
||||
wrapClassName="ant-modal-cust-warp"
|
||||
>
|
||||
<a-row :gutter="10" style="padding: 10px; margin: -10px">
|
||||
<a-col :md="24" :sm="24">
|
||||
<!-- 查询区域 -->
|
||||
<div class="table-page-search-wrapper">
|
||||
<!-- 搜索区域 -->
|
||||
<a-form layout="inline" @keyup.enter.native="onSearch">
|
||||
<a-row :gutter="24">
|
||||
<a-col :md="6" :sm="8">
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="批号">
|
||||
<a-input placeholder="请输入批号" v-model="queryParam.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||
<a-col :md="6" :sm="24">
|
||||
<a-button type="primary" @click="onSearch">查询</a-button>
|
||||
<a-button style="margin-left: 8px" @click="searchReset(1)">重置</a-button>
|
||||
</a-col>
|
||||
</span>
|
||||
</a-row>
|
||||
</a-form>
|
||||
<a-table
|
||||
ref="table"
|
||||
:scroll="scrollTrigger"
|
||||
size="middle"
|
||||
rowKey="id"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type: getType}"
|
||||
:loading="loading"
|
||||
:customRow="rowAction">
|
||||
</a-table>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getAction } from '@/api/manage'
|
||||
import {getBatchNumberList} from '@/api/api'
|
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||
|
||||
export default {
|
||||
name: 'JSelectBatchModal',
|
||||
mixins:[JeecgListMixin],
|
||||
components: {},
|
||||
props: ['modalWidth', 'rows', 'multi', 'barCode'],
|
||||
data() {
|
||||
return {
|
||||
queryParam: {
|
||||
name: "",
|
||||
depotId: '',
|
||||
barCode: ''
|
||||
},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
categoryTree:[],
|
||||
columns: [
|
||||
{dataIndex: 'batchNumber', title: '批号', width: 100, align: 'left'},
|
||||
{dataIndex: 'barCode', title: '条码', width: 100},
|
||||
{dataIndex: 'name', title: '名称', width: 100},
|
||||
{dataIndex: 'standard', title: '规格', width: 80},
|
||||
{dataIndex: 'model', title: '型号', width: 80},
|
||||
{dataIndex: 'expirationDateStr', title: '有效期至', width: 80},
|
||||
{dataIndex: 'totalNum', title: '库存', width: 80}
|
||||
],
|
||||
scrollTrigger: {},
|
||||
dataSource: [],
|
||||
selectedRowKeys: [],
|
||||
selectRows: [],
|
||||
selectIds: [],
|
||||
title: '选择批号',
|
||||
isorter: {
|
||||
column: 'createTime',
|
||||
order: 'desc'
|
||||
},
|
||||
departTree: [],
|
||||
depotList: [],
|
||||
visible: false,
|
||||
form: this.$form.createForm(this),
|
||||
loading: false,
|
||||
expandedKeys: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 计算属性的 getter
|
||||
getType: function () {
|
||||
return this.multi == true ? 'checkbox' : 'radio';
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
barCode: {
|
||||
immediate: true,
|
||||
handler() {
|
||||
this.initBarCode()
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.loadData()
|
||||
},
|
||||
methods: {
|
||||
initBarCode() {
|
||||
if (this.barCode) {
|
||||
this.$emit('initComp', this.barCode)
|
||||
} else {
|
||||
// JSelectUserByDep组件bug issues/I16634
|
||||
this.$emit('initComp', '')
|
||||
}
|
||||
},
|
||||
async loadData(arg) {
|
||||
if(this.rows) {
|
||||
if(JSON.parse(this.rows).depotId && JSON.parse(this.rows).barCode ){
|
||||
this.queryParam.depotId = JSON.parse(this.rows).depotId-0
|
||||
this.queryParam.barCode = JSON.parse(this.rows).barCode
|
||||
}
|
||||
}
|
||||
if (arg === 1) {
|
||||
this.ipagination.current = 1;
|
||||
}
|
||||
this.loading = true
|
||||
let params = this.getQueryParams()//查询条件
|
||||
await getBatchNumberList(params).then((res) => {
|
||||
if (res && res.code === 200) {
|
||||
this.dataSource = res.data.rows
|
||||
this.ipagination.total = res.data.total
|
||||
}
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
showModal() {
|
||||
this.visible = true;
|
||||
this.loadData();
|
||||
this.form.resetFields();
|
||||
},
|
||||
getQueryParams() {
|
||||
let param = Object.assign({}, this.queryParam, this.isorter);
|
||||
return param;
|
||||
},
|
||||
getQueryField() {
|
||||
let str = 'id,';
|
||||
for (let a = 0; a < this.columns.length; a++) {
|
||||
str += ',' + this.columns[a].dataIndex;
|
||||
}
|
||||
return str;
|
||||
},
|
||||
searchReset(num) {
|
||||
let that = this;
|
||||
if (num !== 0) {
|
||||
if(this.rows) {
|
||||
this.queryParam.name=''
|
||||
if(JSON.parse(this.rows).depotId && JSON.parse(this.rows).barCode ){
|
||||
this.queryParam.depotId = JSON.parse(this.rows).depotId-0
|
||||
this.queryParam.barCode = JSON.parse(this.rows).barCode
|
||||
}
|
||||
}
|
||||
that.loadData(1);
|
||||
}
|
||||
that.selectedRowKeys = [];
|
||||
that.selectIds = [];
|
||||
},
|
||||
close() {
|
||||
this.searchReset(0);
|
||||
this.visible = false;
|
||||
},
|
||||
handleSubmit() {
|
||||
let that = this;
|
||||
this.getSelectRows();
|
||||
that.$emit('ok', that.selectRows, that.selectIds);
|
||||
that.searchReset(0)
|
||||
that.close();
|
||||
},
|
||||
//获取选择信息
|
||||
getSelectRows(rowId) {
|
||||
let dataSource = this.dataSource;
|
||||
let ids = "";
|
||||
this.selectRows = [];
|
||||
for (let i = 0, len = dataSource.length; i < len; i++) {
|
||||
if (this.selectedRowKeys.includes(dataSource[i].id)) {
|
||||
this.selectRows.push(dataSource[i]);
|
||||
ids = ids + "," + dataSource[i].batchNumber
|
||||
}
|
||||
}
|
||||
this.selectIds = ids.substring(1);
|
||||
},
|
||||
onSelectChange(selectedRowKeys, selectionRows) {
|
||||
this.selectedRowKeys = selectedRowKeys;
|
||||
this.selectionRows = selectionRows;
|
||||
},
|
||||
onSearch() {
|
||||
this.loadData(1);
|
||||
},
|
||||
modalFormOk() {
|
||||
this.loadData();
|
||||
},
|
||||
rowAction(record, index) {
|
||||
return {
|
||||
on: {
|
||||
click: () => {
|
||||
let arr = []
|
||||
arr.push(record.id)
|
||||
this.selectedRowKeys = arr
|
||||
},
|
||||
dblclick: () => {
|
||||
let arr = []
|
||||
arr.push(record.id)
|
||||
this.selectedRowKeys = arr
|
||||
this.handleSubmit()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ant-table-tbody .ant-table-row td {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
#components-layout-demo-custom-trigger .trigger {
|
||||
font-size: 18px;
|
||||
line-height: 64px;
|
||||
padding: 0 24px;
|
||||
cursor: pointer;
|
||||
transition: color .3s;
|
||||
}
|
||||
</style>
|
||||
@@ -6,7 +6,7 @@
|
||||
@ok="handleSubmit"
|
||||
@cancel="close"
|
||||
cancelText="关闭"
|
||||
style="margin-top: -70px"
|
||||
style="top:5%;height: 100%;overflow-y: hidden"
|
||||
wrapClassName="ant-modal-cust-warp"
|
||||
>
|
||||
<a-row :gutter="10" style="padding: 10px; margin: -10px">
|
||||
@@ -76,11 +76,11 @@
|
||||
name: 'JSelectMaterialModal',
|
||||
mixins:[JeecgListMixin],
|
||||
components: {},
|
||||
props: ['modalWidth', 'multi', 'barCode'],
|
||||
props: ['modalWidth', 'rows', 'multi', 'barCode'],
|
||||
data() {
|
||||
return {
|
||||
queryParam: {
|
||||
q: "",
|
||||
q: '',
|
||||
depotId: ''
|
||||
},
|
||||
labelCol: {
|
||||
@@ -163,6 +163,11 @@
|
||||
}
|
||||
},
|
||||
async loadData(arg) {
|
||||
if(this.rows) {
|
||||
if(JSON.parse(this.rows).depotId){
|
||||
this.queryParam.depotId = JSON.parse(this.rows).depotId-0
|
||||
}
|
||||
}
|
||||
if (arg === 1) {
|
||||
this.ipagination.current = 1;
|
||||
}
|
||||
@@ -233,7 +238,6 @@
|
||||
this.visible = false;
|
||||
},
|
||||
handleTableChange(pagination, filters, sorter) {
|
||||
//TODO 筛选
|
||||
if (Object.keys(sorter).length > 0) {
|
||||
this.isorter.column = sorter.field;
|
||||
this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc';
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { FormTypes } from '@/utils/JEditableTableUtil'
|
||||
import {findBySelectSup,findBySelectCus,findBySelectRetail,getMaterialByBarCode,findStockByDepotAndBarCode,getAccount,getPersonByNumType} from '@/api/api'
|
||||
import {findBySelectSup,findBySelectCus,findBySelectRetail,getMaterialByBarCode,findStockByDepotAndBarCode,getAccount,
|
||||
getPersonByNumType, getBatchNumberList} from '@/api/api'
|
||||
import { getAction,putAction } from '@/api/manage'
|
||||
import { getMpListShort, getNowFormatDateTime } from "@/utils/util"
|
||||
import Vue from 'vue'
|
||||
@@ -213,7 +214,7 @@ export const BillModalMixin = {
|
||||
onValueChange(event) {
|
||||
let that = this
|
||||
const { type, row, column, value, target } = event
|
||||
let param,operNumber,unitPrice,taxUnitPrice,allPrice,taxRate,taxMoney,taxLastMoney
|
||||
let param,batchNumber,operNumber,unitPrice,taxUnitPrice,allPrice,taxRate,taxMoney,taxLastMoney
|
||||
switch(column.key) {
|
||||
case "depotId":
|
||||
if(row.barCode){
|
||||
@@ -274,6 +275,27 @@ export const BillModalMixin = {
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "batchNumber":
|
||||
batchNumber = value-0
|
||||
getBatchNumberList({name:'', depotId: row.depotId, barCode: row.barCode, batchNumber: batchNumber}).then((res) => {
|
||||
if (res && res.code === 200) {
|
||||
if(res.data && res.data.rows) {
|
||||
let info = res.data.rows[0]
|
||||
operNumber = info.totalNum
|
||||
taxRate = row.taxRate-0 //税率
|
||||
unitPrice = row.unitPrice-0 //单价
|
||||
taxUnitPrice = row.taxUnitPrice-0
|
||||
allPrice = (unitPrice*operNumber).toFixed(2)-0
|
||||
taxMoney =((taxRate*0.01)*allPrice).toFixed(2)-0
|
||||
taxLastMoney = (allPrice + taxMoney).toFixed(2)-0
|
||||
target.setValues([{rowKey: row.id, values: {expirationDate: info.expirationDateStr, operNumber: operNumber,
|
||||
allPrice: allPrice, taxMoney: taxMoney, taxLastMoney: taxLastMoney}}])
|
||||
target.recalcAllStatisticsColumns()
|
||||
that.autoChangePrice(target)
|
||||
}
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "operNumber":
|
||||
operNumber = value-0
|
||||
taxRate = row.taxRate-0 //税率
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
{ title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: true,
|
||||
{ title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true },
|
||||
|
||||
@@ -177,7 +177,7 @@
|
||||
{ title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: true,
|
||||
{ title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true },
|
||||
@@ -187,8 +187,8 @@
|
||||
{ title: '库存', key: 'stock', width: '5%', type: FormTypes.input, readonly: true },
|
||||
{ title: '单位', key: 'unit', width: '4%', type: FormTypes.input, readonly: true },
|
||||
{ title: '序列号', key: 'snList', width: '5%', type: FormTypes.input },
|
||||
{ title: '批号', key: 'batchNumber', width: '5%', type: FormTypes.input },
|
||||
{ title: '有效期', key: 'expirationDate',width: '7%', type: FormTypes.input },
|
||||
{ title: '批号', key: 'batchNumber', width: '7%', type: FormTypes.popupJsh, kind: 'batch', multi: false },
|
||||
{ title: '有效期', key: 'expirationDate',width: '5%', type: FormTypes.input, readonly: true },
|
||||
{ title: '多属性', key: 'sku', width: '4%', type: FormTypes.input, readonly: true },
|
||||
{ title: '原数量', key: 'preNumber', width: '4%', type: FormTypes.input, readonly: true },
|
||||
{ title: '已入库', key: 'finishNumber', width: '4%', type: FormTypes.input, readonly: true },
|
||||
|
||||
@@ -125,6 +125,7 @@
|
||||
{title: '序列号',align: "left", dataIndex: 'serialNumber', width: 180},
|
||||
{title: '商品条码', align: "center",dataIndex: 'materialCode', width: 120},
|
||||
{title: '商品名称', align: "center",dataIndex: 'materialName', width: 120},
|
||||
{title: '仓库', align: "center", dataIndex: 'depotName', width: 150},
|
||||
{
|
||||
title: '单据编号', align: "center", dataIndex: 'depotHeadNumber', width: 150,
|
||||
scopedSlots: { customRender: 'numberCustomRender' },
|
||||
|
||||
Reference in New Issue
Block a user