|
@@ -1,133 +1,176 @@
|
|
|
<template>
|
|
|
- <a-modal
|
|
|
- :title="modalTitle"
|
|
|
- :width="800"
|
|
|
- :visible="visible"
|
|
|
- :confirmLoading="confirmLoading"
|
|
|
- @cancel="handleCancel"
|
|
|
- >
|
|
|
+ <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
|
|
|
<a-form :form="form">
|
|
|
-
|
|
|
<a-form-item v-show="false" >
|
|
|
<a-input v-decorator="['id']" type="hidden"/>
|
|
|
+ <a-input v-decorator="['storeId']" type="hidden"/>
|
|
|
</a-form-item>
|
|
|
-
|
|
|
- <a-form-item
|
|
|
- label="入库单号"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- disabled
|
|
|
- v-decorator="['inNo', {rules: [{required: false, message: '入库单号不能为空'}]}]" />
|
|
|
- </a-form-item>
|
|
|
- <a-form-item
|
|
|
- label="入库类型"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-select v-decorator="['type', {rules: [{required: true, message: '入库类型不能为空'}]}]" placeholder="请选择">
|
|
|
- <a-select-option
|
|
|
- v-for="(label,value) in typeMap"
|
|
|
- :key="value"
|
|
|
- :label="label"
|
|
|
- :value="parseInt(value)">{{ label }}
|
|
|
- </a-select-option>
|
|
|
- </a-select>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item
|
|
|
- label="仓库id"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- v-show="false"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- v-decorator="['storeId', {rules: [{required: true, message: '仓库id不能为空'}]}]" />
|
|
|
- </a-form-item>
|
|
|
- <a-form-item
|
|
|
- label="采购单号"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- disabled
|
|
|
- style="width:70%;margin-right:5px"
|
|
|
- v-decorator="['purchaseId']" />
|
|
|
- <a-button type="primary" @click="handlePurchaseOrderSelect">查看明细</a-button>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item
|
|
|
- label="发运单号"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- disabled
|
|
|
- style="width:70%;margin-right:5px"
|
|
|
- v-decorator="['purchaseDispatchOrderId']" />
|
|
|
- <a-button type="primary" @click="handlePurchaseOrderSelect">查看明细</a-button>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item
|
|
|
- label="仓库"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- disabled
|
|
|
- style="width:70%;margin-right:5px"
|
|
|
- v-decorator="['storeName', {rules: [{required: true, message: '仓库名称不能为空'}]}]" />
|
|
|
- <a-button type="primary" @click="handleStoreSelect">选择仓库</a-button>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item
|
|
|
- label="备注"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-textarea
|
|
|
- :rows="4"
|
|
|
- v-decorator="['remark', {rules: [{required: false, message: '备注不能为空'}]}]"/>
|
|
|
- </a-form-item>
|
|
|
+ <a-row :gutter="24">
|
|
|
+ <a-col :lg="12" :md="24" :sm="24">
|
|
|
+ <a-form-item
|
|
|
+ label="入库单号"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-input
|
|
|
+ disabled
|
|
|
+ v-decorator="['inNo', {rules: [{required: false, message: '入库单号不能为空'}]}]" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+<!-- <a-col :lg="12" :md="24" :sm="24">
|
|
|
+ <a-form-item
|
|
|
+ label="采购单号"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-input
|
|
|
+ disabled
|
|
|
+ style="width:70%;margin-right:5px"
|
|
|
+ v-decorator="['purchaseId']" />
|
|
|
+ <a-button type="primary" style="width:30%" @click="handlePurchaseOrderSelect">查看明细</a-button>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>-->
|
|
|
+ <a-col :lg="12" :md="24" :sm="24">
|
|
|
+ <a-form-item
|
|
|
+ label="操作人"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-select v-decorator="['userId']" placeholder="请选择">
|
|
|
+ <a-select-option
|
|
|
+ v-for="({userId, realName}) in userList"
|
|
|
+ :key="userId"
|
|
|
+ :label="realName"
|
|
|
+ :value="userId">{{ realName }}
|
|
|
+ </a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :lg="12" :md="24" :sm="24">
|
|
|
+ <a-form-item
|
|
|
+ label="操作时间"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-date-picker
|
|
|
+ style="width: 100%"
|
|
|
+ :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
|
|
|
+ v-decorator="['userTime']" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+<!-- <a-col :lg="12" :md="24" :sm="24">
|
|
|
+ <a-form-item
|
|
|
+ label="发运单号"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-input
|
|
|
+ disabled
|
|
|
+ style="width:70%"
|
|
|
+ v-decorator="['purchaseDispatchOrderId']" />
|
|
|
+ <a-button type="primary" style="width:30%" @click="handlePurchaseOrderSelect">查看明细</a-button>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>-->
|
|
|
+ <a-col :lg="12" :md="24" :sm="24">
|
|
|
+ <a-form-item
|
|
|
+ label="仓库"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-input
|
|
|
+ disabled
|
|
|
+ style="width:70%"
|
|
|
+ v-decorator="['storeName', {rules: [{required: true, message: '仓库不能为空'}]}]" />
|
|
|
+ <a-button type="primary" style="width:30%" @click="handleStoreSelect">选择仓库</a-button>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :lg="12" :md="24" :sm="24">
|
|
|
+ <a-form-item
|
|
|
+ label="入库类型"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-select v-decorator="['type', {rules: [{required: true, message: '入库类型不能为空'}]}]" placeholder="请选择">
|
|
|
+ <a-select-option
|
|
|
+ v-for="(label,value) in typeMap"
|
|
|
+ :key="value"
|
|
|
+ :label="label"
|
|
|
+ :value="parseInt(value)">{{ label }}
|
|
|
+ </a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :lg="12" :md="24" :sm="24">
|
|
|
+ <a-form-item
|
|
|
+ label="备注"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-textarea
|
|
|
+ :rows="4"
|
|
|
+ v-decorator="['remark', {rules: [{required: false, message: '备注不能为空'}]}]"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
</a-form>
|
|
|
|
|
|
- <a-tabs type="card" default-active-key="1">
|
|
|
- <a-tab-pane key="1" tab="入库详情">
|
|
|
- <div class="table-operator">
|
|
|
- <a-button size="small" type="primary" @click="handleSpareStoreSelect">
|
|
|
- <a-icon type="plus"/>
|
|
|
- 添加
|
|
|
- </a-button>
|
|
|
- <a-button class="margin-left8" size="small" type="danger" @click="handleDel">
|
|
|
- <a-icon type="delete"/>
|
|
|
- 删除
|
|
|
- </a-button>
|
|
|
+ <title-divider title="备件明细" width="90px"></title-divider>
|
|
|
+ <div class="table-operator">
|
|
|
+ <a-button size="small" type="primary" @click="handleSpareStoreSelect">
|
|
|
+ <a-icon type="plus"/>
|
|
|
+ 添加
|
|
|
+ </a-button>
|
|
|
+ <a-button class="margin-left8" size="small" type="danger" @click="handleDel">
|
|
|
+ <a-icon type="delete"/>
|
|
|
+ 删除
|
|
|
+ </a-button>
|
|
|
+ </div>
|
|
|
+ <a-table
|
|
|
+ bordered
|
|
|
+ :data-source="data"
|
|
|
+ :columns="columns"
|
|
|
+ tableLayout="auto"
|
|
|
+ rowKey="id"
|
|
|
+ :row-selection="rowSelection">
|
|
|
+ <template slot="num" slot-scope="text, record">
|
|
|
+ <div class="editable-cell-input-wrapper">
|
|
|
+ <a-input :value="text" :id="record.spareId + ',num'" @change="$event => onQuantityChange($event, record.id, 'num')" />
|
|
|
</div>
|
|
|
- <a-table
|
|
|
- bordered
|
|
|
- :data-source="data"
|
|
|
- :columns="columns"
|
|
|
- tableLayout="auto"
|
|
|
- rowKey="id"
|
|
|
- :row-selection="rowSelection">
|
|
|
- <span slot="action" slot-scope="record">
|
|
|
- <template>
|
|
|
- <a @click="handleDetailSelect(record)">修改</a>
|
|
|
- <a-divider type="vertical" />
|
|
|
- <a-popconfirm title="是否要删除该条数据?" @confirm="handleDelOne(record.id)">
|
|
|
- <a>删除</a>
|
|
|
- </a-popconfirm>
|
|
|
- </template>
|
|
|
- </span>
|
|
|
- </a-table>
|
|
|
- </a-tab-pane>
|
|
|
- </a-tabs>
|
|
|
+ </template>
|
|
|
+ <template slot="price" slot-scope="text, record">
|
|
|
+ <div class="editable-cell-input-wrapper">
|
|
|
+ <a-input :value="text" :id="record.spareId + ',price'" @change="$event => onPriceChange($event, record.id, 'price')" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template slot="totalPrice" slot-scope="text, record">
|
|
|
+ <div class="editable-cell-input-wrapper">
|
|
|
+ <a-input :value="text" :id="record.spareId + ',totalPrice'" @change="$event => onTotalPriceChange($event, record.id, 'totalPrice')" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <span slot="action" slot-scope="record">
|
|
|
+ <template>
|
|
|
+ <a @click="handleDetailSelect(record)">修改</a>
|
|
|
+ <a-divider type="vertical" />
|
|
|
+ <a-popconfirm title="是否要删除该条数据?" @confirm="handleDelOne(record.id)">
|
|
|
+ <a>删除</a>
|
|
|
+ </a-popconfirm>
|
|
|
+ </template>
|
|
|
+ </span>
|
|
|
+ </a-table>
|
|
|
+ <a-row :gutter="48">
|
|
|
+ <a-col :md="48" :sm="48">
|
|
|
+ <span class="table-page-search-submitButtons" style="float: right;margin-top: 10px">
|
|
|
+ <a-button type="primary" @click="save()">提交</a-button>
|
|
|
+ <a-button style="margin-left: 8px" @click="handleCancel()">返回</a-button>
|
|
|
+ </span>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
<detail-base-form ref="detailBaseForm" @selected="handleDetailSelected"/>
|
|
|
- <template slot="footer">
|
|
|
- <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
|
|
|
- </template>
|
|
|
<store-select-modal ref="storeSelectModal" @selected="handleStoreSelected"/>
|
|
|
<purchase-order-select-modal ref="purchaseOrderSelectModal" @selected="handlePurchaseOrderSelected"/>
|
|
|
-<!-- <spare-part-info-select-modal :type="'checkbox'" ref="spareSelectModal" @selected="handleSpareSelected"/>-->
|
|
|
+ <!-- <spare-part-info-select-modal :type="'checkbox'" ref="spareSelectModal" @selected="handleSpareSelected"/>-->
|
|
|
<spare-store-select-modal ref="spareStoreSelectModal" @selected="handleSpareStoreSelected"/>
|
|
|
- </a-modal>
|
|
|
+ </a-card>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
@@ -138,6 +181,8 @@ import PurchaseOrderSelectModal from '@/views/purchase/purchase-order/modules/Pu
|
|
|
import StoreSelectModal from '@/views/store/store/modules/StoreSelectModal'
|
|
|
import SparePartInfoSelectModal from '@/views/sqarepartmanage/sparepartinfo/modules/SparePartInfoSelectModal'
|
|
|
import SpareStoreSelectModal from '@/views/store/sparestore/modules/SpareStoreSelectModal'
|
|
|
+import {queryUsersByParentDeptNatureAll} from "@/api/upms/user";
|
|
|
+import BaseTool from "@/utils/tool";
|
|
|
|
|
|
export default {
|
|
|
name: 'BaseInStoreForm',
|
|
@@ -154,8 +199,10 @@ export default {
|
|
|
modalTitle: null,
|
|
|
form: this.$form.createForm(this),
|
|
|
visible: false,
|
|
|
+ maskClosable: false,
|
|
|
storeId: null,
|
|
|
typeMap: {},
|
|
|
+ userList: {},
|
|
|
rowSelection: {
|
|
|
onChange: (selectedRowKeys, selectedRows) => {
|
|
|
this.selectedRowKeys = selectedRowKeys
|
|
@@ -192,21 +239,21 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
title: '数量',
|
|
|
- dataIndex: 'num'
|
|
|
+ dataIndex: 'num',
|
|
|
+ width: 120,
|
|
|
+ scopedSlots: { customRender: 'num' }
|
|
|
},
|
|
|
{
|
|
|
title: '单价',
|
|
|
dataIndex: 'price',
|
|
|
- customRender: (text, record, index) => {
|
|
|
- return this.BaseTool.Amount.formatter(text)
|
|
|
- }
|
|
|
+ width: 150,
|
|
|
+ scopedSlots: { customRender: 'price' }
|
|
|
},
|
|
|
{
|
|
|
title: '总价',
|
|
|
dataIndex: 'totalPrice',
|
|
|
- customRender: (text, record, index) => {
|
|
|
- return this.BaseTool.Amount.formatter(text)
|
|
|
- }
|
|
|
+ width: 150,
|
|
|
+ scopedSlots: { customRender: 'totalPrice' }
|
|
|
},
|
|
|
{
|
|
|
title: '操作',
|
|
@@ -216,6 +263,7 @@ export default {
|
|
|
}
|
|
|
],
|
|
|
data: [],
|
|
|
+ user: this.$store.getters.userInfo,
|
|
|
selectedRowKeys: [],
|
|
|
selectedRows: [],
|
|
|
options: {
|
|
@@ -234,6 +282,11 @@ export default {
|
|
|
methods: {
|
|
|
base (record) {
|
|
|
this.visible = true
|
|
|
+ const params = { includeMy: true, deptId: this.user.companyId }
|
|
|
+ params.nature = this.DictCache.VALUE.SYS_DEPT_NATURE.FEN_GONG_SI
|
|
|
+ queryUsersByParentDeptNatureAll(params).then(res => {
|
|
|
+ this.userList = res.data
|
|
|
+ })
|
|
|
// 如果是空标识添加
|
|
|
if (this.BaseTool.Object.isBlank(record)) {
|
|
|
this.modalTitle = '添加'
|
|
@@ -242,6 +295,8 @@ export default {
|
|
|
}
|
|
|
this.modalTitle = '编辑'
|
|
|
this.storeId = record.storeId
|
|
|
+ record.userTime = this.BaseTool.Moment(record.userTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
|
|
|
+
|
|
|
const { form: { setFieldsValue } } = this
|
|
|
// 日期处理
|
|
|
this.$nextTick(() => {
|
|
@@ -249,6 +304,8 @@ export default {
|
|
|
'id',
|
|
|
'inNo',
|
|
|
'storeId',
|
|
|
+ 'userId',
|
|
|
+ 'userTime',
|
|
|
'storeName',
|
|
|
'purchaseId',
|
|
|
'purchaseDispatchOrderId',
|
|
@@ -272,6 +329,7 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
values.detailList = this.data
|
|
|
+ values.userTime = BaseTool.Date.formatter(values.userTime, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
|
|
|
// 日期处理
|
|
|
if (this.BaseTool.String.isBlank(values.id)) {
|
|
|
addInStoreForm(values)
|
|
@@ -296,10 +354,12 @@ export default {
|
|
|
this.form.resetFields()
|
|
|
if (this.BaseTool.Object.isNotBlank(values)) {
|
|
|
this.$emit('ok', values)
|
|
|
+ } else {
|
|
|
+ this.$emit('ok')
|
|
|
}
|
|
|
},
|
|
|
handleStoreSelect () {
|
|
|
- this.$refs.storeSelectModal.base({}, {})
|
|
|
+ this.$refs.storeSelectModal.base({}, { filter: -1 })
|
|
|
},
|
|
|
handleStoreSelected (record, keys, rows) {
|
|
|
// 重新选择了仓库,则明细需要全部清空
|
|
@@ -360,6 +420,10 @@ export default {
|
|
|
this.data = data.filter(item => id !== item.id)
|
|
|
},
|
|
|
handleSpareStoreSelect () {
|
|
|
+ if (this.storeId == null) {
|
|
|
+ this.$message.error('请先选择入库仓库')
|
|
|
+ return
|
|
|
+ }
|
|
|
this.$refs.spareStoreSelectModal.base({}, { storeId: this.storeId })
|
|
|
},
|
|
|
handleSpareStoreSelected (record, keys, rows) {
|
|
@@ -367,7 +431,7 @@ export default {
|
|
|
for (let i = 0; i < rows.length; i++) {
|
|
|
var find = false
|
|
|
for (let j = 0; j < data.length; j++) {
|
|
|
- if (rows[i].id === data[j].id || rows[i].spareId === data[j].spareId) {
|
|
|
+ if (rows[i].spareId === data[j].spareId) {
|
|
|
find = true
|
|
|
break
|
|
|
}
|
|
@@ -403,6 +467,48 @@ export default {
|
|
|
data.push(selectData)
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ onQuantityChange (e, id, attr) {
|
|
|
+ const value = e.target.value
|
|
|
+ console.log(value)
|
|
|
+ if (value !== 0 && !value) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const data = [...this.data]
|
|
|
+ const target = data.find(item => item.id === id)
|
|
|
+ if (target) {
|
|
|
+ target[attr] = value
|
|
|
+ target['totalPrice'] = Math.floor(value * target['price'] * 10000) / 10000
|
|
|
+ this.data = data
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onPriceChange (e, id, attr) {
|
|
|
+ const value = e.target.value
|
|
|
+ console.log(value)
|
|
|
+ if (value !== 0 && !value) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const data = [...this.data]
|
|
|
+ const target = data.find(item => item.id === id)
|
|
|
+ if (target) {
|
|
|
+ target[attr] = value
|
|
|
+ target['totalPrice'] = Math.floor(value * target['num'] * 10000) / 10000
|
|
|
+ this.data = data
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onTotalPriceChange (e, id, attr) {
|
|
|
+ const value = e.target.value
|
|
|
+ console.log(value)
|
|
|
+ if (value !== 0 && !value) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const data = [...this.data]
|
|
|
+ const target = data.find(item => item.id === id)
|
|
|
+ if (target) {
|
|
|
+ target[attr] = value
|
|
|
+ target['price'] = Math.floor(value * 10000 / target['num']) / 10000
|
|
|
+ this.data = data
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|