|
|
@@ -33,6 +33,37 @@
|
|
|
>
|
|
|
打印条码
|
|
|
</el-button>
|
|
|
+
|
|
|
+ <div class="upload">
|
|
|
+ <!-- <el-upload
|
|
|
+ v-if="!isLoading"
|
|
|
+ :show-file-list="false"
|
|
|
+ class="upload-demo"
|
|
|
+ action=""
|
|
|
+ :before-upload="beforeUpload"
|
|
|
+ :on-success="successUpload"
|
|
|
+ :on-error="errorUpload"
|
|
|
+ >
|
|
|
+ <slot>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ plain
|
|
|
+ icon="el-icon-upload2"
|
|
|
+ >导入</el-button
|
|
|
+ >
|
|
|
+ </slot>
|
|
|
+ </el-upload> -->
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-upload2"
|
|
|
+ plain
|
|
|
+ @click="uploadFile"
|
|
|
+ >导入</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+
|
|
|
<!-- <el-button
|
|
|
v-if="selectedDime == 2 || selectedDime == 3"
|
|
|
size="small"
|
|
|
@@ -149,12 +180,42 @@
|
|
|
<!-- <printSr ref="printSrRef" :dimension="selectedDime"></printSr>
|
|
|
<printTg ref="printTgRef" :dimension="selectedDime"></printTg> -->
|
|
|
<allot ref="allotRef" :dimension="selectedDime"></allot>
|
|
|
+
|
|
|
+ <!-- 导入错误弹框 -->
|
|
|
+ <el-dialog
|
|
|
+ title="导入失败"
|
|
|
+ :visible.sync="exportErrorDioalogVisible"
|
|
|
+ width="60%"
|
|
|
+ >
|
|
|
+ <el-table :data="errorData" style="width: 100%">
|
|
|
+ <el-table-column label="名称" prop="name"> </el-table-column>
|
|
|
+ <el-table-column label="型号" prop="modeType"> </el-table-column>
|
|
|
+ <el-table-column label="编号" prop="codeNo"> </el-table-column>
|
|
|
+ <el-table-column label="物料组" prop="code"> </el-table-column>
|
|
|
+ <el-table-column label="失败原因" prop="remark"> </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="exportErrorDioalogVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="exportErrorDioalogVisible = false"
|
|
|
+ >确 定</el-button
|
|
|
+ >
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <importDialog
|
|
|
+ :defModule="moudleName"
|
|
|
+ ref="importDialogRef"
|
|
|
+ :fileUrl="'/wms/outintwo/importTemplate'"
|
|
|
+ fileName="库存导入模板"
|
|
|
+ @success="reload"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import print from '@/components/print/indexMultiple.vue';
|
|
|
import allot from './allot.vue';
|
|
|
+ import importDialog from '@/components/upload/import-dialogNew.vue';
|
|
|
// import print from './print.vue';
|
|
|
// import printSr from './printSr.vue';
|
|
|
// import printTg from './printTg.vue';
|
|
|
@@ -178,7 +239,7 @@
|
|
|
|
|
|
export default {
|
|
|
mixins: [tabMixins],
|
|
|
- components: { ItemSearch, print, allot },
|
|
|
+ components: { ItemSearch, print, allot, importDialog },
|
|
|
props: {
|
|
|
// 机构id
|
|
|
organizationId: [Number, String],
|
|
|
@@ -195,6 +256,7 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ moudleName: 'stock',
|
|
|
qualityStatus,
|
|
|
qualityResults,
|
|
|
config: [],
|
|
|
@@ -209,7 +271,10 @@
|
|
|
diffCacheKeyUrl:
|
|
|
'eos-439decaa-warehouseManagement-stockLedger-products',
|
|
|
cacheKeyUrl: 'eos-439decaa-warehouseManagement-stockLedger-products2', //默认查询key值
|
|
|
- columnsVersion: 1
|
|
|
+ columnsVersion: 1,
|
|
|
+ isLoading: false,
|
|
|
+ exportErrorDioalogVisible: false,
|
|
|
+ errorData: []
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
@@ -705,7 +770,40 @@
|
|
|
categoryCode: row.categoryCode
|
|
|
}
|
|
|
});
|
|
|
- }
|
|
|
+ },
|
|
|
+ beforeUpload(file) {
|
|
|
+ if (file.size / 1024 / 1024 > this.size) {
|
|
|
+ this.$message.error(`大小不能超过 ${this.size}MB`);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.limit > 0 && this.fileList.length === this.limit) {
|
|
|
+ this.$message.error(`最多上传 ${this.limit}个文件`);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ let formData = new FormData();
|
|
|
+ formData.append('file', file);
|
|
|
+ this.isLoading = true;
|
|
|
+ return importCategorySparePart(formData).then((res) => {
|
|
|
+ if (res.data.length > 0) {
|
|
|
+ this.exportErrorDioalogVisible = true;
|
|
|
+ this.errorData = res.data;
|
|
|
+ } else {
|
|
|
+ this.$message.success('导入成功!');
|
|
|
+ }
|
|
|
+ this.isLoading = false;
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ successUpload(response) {
|
|
|
+ this.isLoading = false;
|
|
|
+ },
|
|
|
+ errorUpload(response) {
|
|
|
+ this.isLoading = false;
|
|
|
+ },
|
|
|
+ uploadFile() {
|
|
|
+ this.$refs.importDialogRef.open();
|
|
|
+ },
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
@@ -728,3 +826,11 @@
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .upload {
|
|
|
+ display: inline-block;
|
|
|
+ width: 100px;
|
|
|
+ margin-left: 10px;
|
|
|
+ }
|
|
|
+</style>
|