优化商品导入的界面展示方式
This commit is contained in:
@@ -83,14 +83,7 @@
|
|||||||
<!-- 操作按钮区域 -->
|
<!-- 操作按钮区域 -->
|
||||||
<div class="table-operator" style="margin-top: 5px">
|
<div class="table-operator" style="margin-top: 5px">
|
||||||
<a-button v-if="btnEnableList.indexOf(1)>-1" @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
<a-button v-if="btnEnableList.indexOf(1)>-1" @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||||
<a-upload v-if="btnEnableList.indexOf(1)>-1" name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
|
<a-button v-if="btnEnableList.indexOf(1)>-1" @click="handleImportXls()" type="primary" icon="import">导入</a-button>
|
||||||
<a-popover title="表格模板">
|
|
||||||
<template slot="content">
|
|
||||||
<p><a target="_blank" href="/doc/goods_template.xls"><b>商品Excel模板下载</b></a></p>
|
|
||||||
</template>
|
|
||||||
<a-button type="primary" icon="import">导入</a-button>
|
|
||||||
</a-popover>
|
|
||||||
</a-upload>
|
|
||||||
<a-button type="primary" icon="download" @click="handleExportXls('商品信息')">导出</a-button>
|
<a-button type="primary" icon="download" @click="handleExportXls('商品信息')">导出</a-button>
|
||||||
<a-dropdown>
|
<a-dropdown>
|
||||||
<a-menu slot="overlay">
|
<a-menu slot="overlay">
|
||||||
@@ -161,6 +154,7 @@
|
|||||||
<!-- table区域-end -->
|
<!-- table区域-end -->
|
||||||
<!-- 表单区域 -->
|
<!-- 表单区域 -->
|
||||||
<material-modal ref="modalForm" @ok="modalFormOk"></material-modal>
|
<material-modal ref="modalForm" @ok="modalFormOk"></material-modal>
|
||||||
|
<material-import-modal ref="modalImportForm" @ok="modalFormOk"></material-import-modal>
|
||||||
<batch-set-info-modal ref="batchSetInfoModalForm" @ok="modalFormOk"></batch-set-info-modal>
|
<batch-set-info-modal ref="batchSetInfoModalForm" @ok="modalFormOk"></batch-set-info-modal>
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
@@ -168,6 +162,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import MaterialModal from './modules/MaterialModal'
|
import MaterialModal from './modules/MaterialModal'
|
||||||
|
import MaterialImportModal from './modules/MaterialImportModal'
|
||||||
import BatchSetInfoModal from './modules/BatchSetInfoModal'
|
import BatchSetInfoModal from './modules/BatchSetInfoModal'
|
||||||
import { queryMaterialCategoryTreeList } from '@/api/api'
|
import { queryMaterialCategoryTreeList } from '@/api/api'
|
||||||
import { postAction } from '@/api/manage'
|
import { postAction } from '@/api/manage'
|
||||||
@@ -182,6 +177,7 @@
|
|||||||
mixins:[JeecgListMixin],
|
mixins:[JeecgListMixin],
|
||||||
components: {
|
components: {
|
||||||
MaterialModal,
|
MaterialModal,
|
||||||
|
MaterialImportModal,
|
||||||
BatchSetInfoModal,
|
BatchSetInfoModal,
|
||||||
JEllipsis,
|
JEllipsis,
|
||||||
JDate
|
JDate
|
||||||
@@ -374,6 +370,10 @@
|
|||||||
this.$refs.modalForm.isReadOnly = true
|
this.$refs.modalForm.isReadOnly = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handleImportXls() {
|
||||||
|
this.$refs.modalImportForm.init();
|
||||||
|
this.$refs.modalImportForm.title = "商品导入";
|
||||||
|
},
|
||||||
searchReset() {
|
searchReset() {
|
||||||
this.queryParam = {
|
this.queryParam = {
|
||||||
mpList: getMpListShort(Vue.ls.get('materialPropertyList')) //扩展属性
|
mpList: getMpListShort(Vue.ls.get('materialPropertyList')) //扩展属性
|
||||||
|
|||||||
112
jshERP-web/src/views/material/modules/MaterialImportModal.vue
Normal file
112
jshERP-web/src/views/material/modules/MaterialImportModal.vue
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
<template>
|
||||||
|
<a-modal
|
||||||
|
:title="title"
|
||||||
|
:width="400"
|
||||||
|
:visible="visible"
|
||||||
|
:confirm-loading="confirmLoading"
|
||||||
|
@cancel="handleCancel"
|
||||||
|
wrapClassName="ant-modal-cust-warp"
|
||||||
|
style="top:25%;height: 45%;overflow-y: hidden">
|
||||||
|
<template slot="footer">
|
||||||
|
<a-button key="back" @click="handleCancel">取消</a-button>
|
||||||
|
</template>
|
||||||
|
<a-spin :spinning="confirmLoading">
|
||||||
|
<a-row class="form-row" :gutter="24">
|
||||||
|
<a-col :md="24" :sm="24">
|
||||||
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="第一步:">
|
||||||
|
<a target="_blank" href="/doc/goods_template.xls"><b>商品Excel模板[下载]</b></a>
|
||||||
|
<p>注意:模板中的第一行请勿删除</p>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
<a-row class="form-row" :gutter="24">
|
||||||
|
<a-col :md="24" :sm="24">
|
||||||
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="第二步:">
|
||||||
|
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleMaterialImportExcel">
|
||||||
|
<a-button type="primary" icon="import">导入</a-button>
|
||||||
|
</a-upload>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-spin>
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { ACCESS_TOKEN } from "@/store/mutation-types"
|
||||||
|
import Vue from 'vue'
|
||||||
|
export default {
|
||||||
|
name: 'MaterialImportModal',
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
title:"",
|
||||||
|
visible: false,
|
||||||
|
model: {},
|
||||||
|
labelCol: {
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 5 },
|
||||||
|
},
|
||||||
|
wrapperCol: {
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 18 },
|
||||||
|
},
|
||||||
|
confirmLoading: false,
|
||||||
|
disableMixinCreated: true,
|
||||||
|
tokenHeader: {'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)},
|
||||||
|
url: {
|
||||||
|
importExcelUrl: "/material/importExcel",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
importExcelUrl: function () {
|
||||||
|
return `${window._CONFIG['domianURL']}${this.url.importExcelUrl}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init () {
|
||||||
|
this.model = Object.assign({}, '')
|
||||||
|
this.visible = true
|
||||||
|
},
|
||||||
|
/* 导入 */
|
||||||
|
handleMaterialImportExcel(info){
|
||||||
|
this.loading = true
|
||||||
|
if (info.file.status !== 'uploading') {
|
||||||
|
console.log(info.file, info.fileList);
|
||||||
|
}
|
||||||
|
if (info.file.status === 'done') {
|
||||||
|
if (info.file.response) {
|
||||||
|
// this.$message.success(`${info.file.name} 文件上传成功`);
|
||||||
|
if (info.file.response.code === 200) {
|
||||||
|
this.$message.success(info.file.response.data || `${info.file.name} 文件上传成功`)
|
||||||
|
} else {
|
||||||
|
this.$message.warning(info.file.response.data)
|
||||||
|
}
|
||||||
|
this.$emit('ok')
|
||||||
|
this.visible = false;
|
||||||
|
this.loading = false
|
||||||
|
} else {
|
||||||
|
this.$message.error(`${info.file.name} ${info.file.response.data}.`);
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
} else if (info.file.status === 'error') {
|
||||||
|
this.$message.error(`文件上传失败: ${info.file.msg} `)
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
close () {
|
||||||
|
this.$emit('close');
|
||||||
|
this.visible = false;
|
||||||
|
},
|
||||||
|
handleCancel () {
|
||||||
|
this.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user