给订单增加导入明细Excel的功能
This commit is contained in:
BIN
jshERP-web/public/doc/bill_item_template.xls
Normal file
BIN
jshERP-web/public/doc/bill_item_template.xls
Normal file
Binary file not shown.
115
jshERP-web/src/views/bill/dialog/ImportItemModal.vue
Normal file
115
jshERP-web/src/views/bill/dialog/ImportItemModal.vue
Normal file
@@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<a-modal
|
||||
:title="title"
|
||||
:width="500"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
:maskStyle="{'top':'93px','left':'154px'}"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭"
|
||||
wrapClassName="ant-modal-cust-warp"
|
||||
style="top:20%;height: 55%;overflow-y: hidden">
|
||||
<template slot="footer">
|
||||
<a-button key="back" @click="handleCancel">
|
||||
关闭
|
||||
</a-button>
|
||||
</template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form">
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="模板">
|
||||
<span><a href="/doc/bill_item_template.xls" target="_blank"><b>明细Excel模板[下载]</b></a></span>
|
||||
</a-form-item>
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="文件">
|
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader"
|
||||
:data="setFileData" :action="importExcelUrl" @change="handleImportExcel">
|
||||
<a-button type="primary" icon="import">导入</a-button>
|
||||
</a-upload>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
import Vue from 'vue'
|
||||
|
||||
export default {
|
||||
name: "ImportItemModal",
|
||||
components: {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
title:"明细导入",
|
||||
visible: false,
|
||||
prefixNo: '',
|
||||
model: {},
|
||||
tokenHeader: {'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
confirmLoading: false,
|
||||
form: this.$form.createForm(this),
|
||||
url: {
|
||||
importExcelUrl: "/depotItem/importItemExcel",
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl: function () {
|
||||
return `${window._CONFIG['domianURL']}${this.url.importExcelUrl}`;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add (prefixNo) {
|
||||
this.prefixNo = prefixNo
|
||||
this.form.resetFields()
|
||||
this.model = Object.assign({}, {})
|
||||
this.visible = true
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
//导入
|
||||
handleImportExcel(info){
|
||||
if (info.file.status !== 'uploading') {
|
||||
console.log(info.file, info.fileList);
|
||||
}
|
||||
if (info.file.status === 'done') {
|
||||
if (info.file.response) {
|
||||
if (info.file.response.code === 200) {
|
||||
this.$message.success('文件导入成功')
|
||||
this.$emit('ok', info.file.response.data.rows);
|
||||
this.close()
|
||||
} else if (info.file.response.code === 500) {
|
||||
this.$message.warn(info.file.response.data.message)
|
||||
}
|
||||
} else {
|
||||
this.$message.error(`${info.file.name} ${info.file.response.data}.`);
|
||||
}
|
||||
} else if (info.file.status === 'error') {
|
||||
this.$message.error(`文件导入失败: ${info.file.msg} `);
|
||||
}
|
||||
},
|
||||
setFileData() {
|
||||
return {
|
||||
'prefixNo': this.prefixNo
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -807,6 +807,19 @@ export const BillModalMixin = {
|
||||
this.scanStatus = true
|
||||
this.scanBarCode = ''
|
||||
},
|
||||
onImport(prefixNo) {
|
||||
this.$refs.importItemModalForm.add(prefixNo);
|
||||
},
|
||||
importItemModalFormOk(data) {
|
||||
this.materialTable.dataSource = data
|
||||
this.$nextTick(() => {
|
||||
let discountLastMoney = 0
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
discountLastMoney += data[i].taxLastMoney
|
||||
}
|
||||
this.form.setFieldsValue({'discountLastMoney':discountLastMoney})
|
||||
});
|
||||
},
|
||||
//保存并审核
|
||||
handleOkAndCheck() {
|
||||
this.billStatus = '1'
|
||||
|
||||
@@ -89,6 +89,9 @@
|
||||
<a-button style="margin-left: 8px" @click="handleHistoryBillList"><a-icon type="history" />历史单据</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="24" style="float:left;padding-bottom: 5px;padding-left:20px;">
|
||||
<a-button icon="import" @click="onImport(prefixNo)">导入明细</a-button>
|
||||
</a-row>
|
||||
</template>
|
||||
</j-editable-table>
|
||||
<a-row class="form-row" :gutter="24">
|
||||
@@ -161,6 +164,7 @@
|
||||
</a-form>
|
||||
</a-spin>
|
||||
<many-account-modal ref="manyAccountModalForm" @ok="manyAccountModalFormOk"></many-account-modal>
|
||||
<import-item-modal ref="importItemModalForm" @ok="importItemModalFormOk"></import-item-modal>
|
||||
<vendor-modal ref="vendorModalForm" @ok="vendorModalFormOk"></vendor-modal>
|
||||
<account-modal ref="accountModalForm" @ok="accountModalFormOk"></account-modal>
|
||||
<link-bill-list ref="linkBillList" @ok="linkBillListOk"></link-bill-list>
|
||||
@@ -171,6 +175,7 @@
|
||||
<script>
|
||||
import pick from 'lodash.pick'
|
||||
import ManyAccountModal from '../dialog/ManyAccountModal'
|
||||
import ImportItemModal from '../dialog/ImportItemModal'
|
||||
import LinkBillList from '../dialog/LinkBillList'
|
||||
import VendorModal from '../../system/modules/VendorModal'
|
||||
import AccountModal from '../../system/modules/AccountModal'
|
||||
@@ -189,6 +194,7 @@
|
||||
mixins: [JEditableTableMixin,BillModalMixin],
|
||||
components: {
|
||||
ManyAccountModal,
|
||||
ImportItemModal,
|
||||
LinkBillList,
|
||||
VendorModal,
|
||||
AccountModal,
|
||||
@@ -273,7 +279,8 @@
|
||||
url: {
|
||||
add: '/depotHead/addDepotHeadAndDetail',
|
||||
edit: '/depotHead/updateDepotHeadAndDetail',
|
||||
detailList: '/depotItem/getDetailList'
|
||||
detailList: '/depotItem/getDetailList',
|
||||
importExcelUrl: "/depotItem/importItemExcel",
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -89,6 +89,9 @@
|
||||
<a-button style="margin-left: 8px" @click="handleHistoryBillList"><a-icon type="history" />历史单据</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="24" style="float:left;padding-bottom: 5px;padding-left:20px;">
|
||||
<a-button icon="import" @click="onImport(prefixNo)">导入明细</a-button>
|
||||
</a-row>
|
||||
</template>
|
||||
</j-editable-table>
|
||||
<a-row class="form-row" :gutter="24">
|
||||
@@ -161,6 +164,7 @@
|
||||
</a-form>
|
||||
</a-spin>
|
||||
<many-account-modal ref="manyAccountModalForm" @ok="manyAccountModalFormOk"></many-account-modal>
|
||||
<import-item-modal ref="importItemModalForm" @ok="importItemModalFormOk"></import-item-modal>
|
||||
<customer-modal ref="customerModalForm" @ok="customerModalFormOk"></customer-modal>
|
||||
<account-modal ref="accountModalForm" @ok="accountModalFormOk"></account-modal>
|
||||
<history-bill-list ref="historyBillListModalForm"></history-bill-list>
|
||||
@@ -170,6 +174,7 @@
|
||||
<script>
|
||||
import pick from 'lodash.pick'
|
||||
import ManyAccountModal from '../dialog/ManyAccountModal'
|
||||
import ImportItemModal from '../dialog/ImportItemModal'
|
||||
import CustomerModal from '../../system/modules/CustomerModal'
|
||||
import AccountModal from '../../system/modules/AccountModal'
|
||||
import HistoryBillList from '../dialog/HistoryBillList'
|
||||
@@ -187,6 +192,7 @@
|
||||
mixins: [JEditableTableMixin, BillModalMixin],
|
||||
components: {
|
||||
ManyAccountModal,
|
||||
ImportItemModal,
|
||||
CustomerModal,
|
||||
AccountModal,
|
||||
HistoryBillList,
|
||||
|
||||
Reference in New Issue
Block a user