|
@@ -0,0 +1,122 @@
|
|
|
+<template>
|
|
|
+ <el-dialog
|
|
|
+ :visible.sync="visible"
|
|
|
+ title="导入重打数据"
|
|
|
+ append-to-body
|
|
|
+ width="500px"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ >
|
|
|
+ <el-form
|
|
|
+ ref="form"
|
|
|
+ :model="uploadData"
|
|
|
+ label-width="80px"
|
|
|
+ >
|
|
|
+ <div class="overflow-auto">
|
|
|
+ <el-row :gutter="0">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item prop="file" label="上传文件" :rules="[{
|
|
|
+ required: true,
|
|
|
+ message: '请选择需要上传的文件'
|
|
|
+ }]">
|
|
|
+ <el-input :value="uploadData.file ? uploadData.file.name : ''" read-only>
|
|
|
+ <template #append>
|
|
|
+ <el-upload
|
|
|
+ ref="upload"
|
|
|
+ action=""
|
|
|
+ :auto-upload="false"
|
|
|
+ :multiple="false"
|
|
|
+ :show-file-list="false"
|
|
|
+ accept=".xls,.xlsx, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
|
|
|
+ :on-change="onFileChange"
|
|
|
+ >
|
|
|
+ <div class="el-button el-button--primary" style="border-radius: 0 4px 4px 0;">浏览</div>
|
|
|
+ </el-upload>
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <template #footer>
|
|
|
+ <div class="flex center dialog-footer">
|
|
|
+ <el-button
|
|
|
+ @click="onCloseBtnClick"
|
|
|
+ >取消</el-button>
|
|
|
+
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="onImportDataBtnClick"
|
|
|
+ >确定</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ </template>
|
|
|
+
|
|
|
+<script>
|
|
|
+// import BasePage from '@@/utils/BasePage'
|
|
|
+import BaseCurdList from '@@/utils/BaseCurdList'
|
|
|
+import PrintCode from '@@/entries/PrintCode'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'DialogImportReprint',
|
|
|
+ // extends: BasePage,
|
|
|
+ extends: BaseCurdList(PrintCode),
|
|
|
+ data: () => ({
|
|
|
+ visible: false,
|
|
|
+ activeCollapseName: '1',
|
|
|
+ uploadData: {
|
|
|
+ file: null
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ methods: {
|
|
|
+ open () {
|
|
|
+ this.uploadData = {
|
|
|
+ file: null
|
|
|
+ }
|
|
|
+
|
|
|
+ this.visible = true
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.upload.clearFiles()
|
|
|
+ this.$refs.form.resetFields()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onFileChange (event) {
|
|
|
+ this.uploadData.file = event.raw
|
|
|
+ const uploadEl = this.$refs.upload
|
|
|
+ const { uploadFiles } = uploadEl
|
|
|
+ uploadFiles.splice(0, uploadFiles.length, event)
|
|
|
+ },
|
|
|
+ onImportDataBtnClick () {
|
|
|
+ this.$refs.form.validate(flag => {
|
|
|
+ if (!flag) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$$request(this.$$api.importData, this.uploadData).then((data) => {
|
|
|
+ if (typeof data === 'number') {
|
|
|
+ this.$notify({
|
|
|
+ title: '成功',
|
|
|
+ message: `成功导入重打印标签 ${data}个`,
|
|
|
+ type: 'success',
|
|
|
+ position: 'bottom-right'
|
|
|
+ })
|
|
|
+ this.close()
|
|
|
+ }
|
|
|
+ }).catch(console.error).finally(() => {})
|
|
|
+ })
|
|
|
+ },
|
|
|
+ close () {
|
|
|
+ this.$refs.upload.clearFiles()
|
|
|
+ this.uploadData.file = null
|
|
|
+ this.visible = false
|
|
|
+ },
|
|
|
+ onCloseBtnClick () {
|
|
|
+ this.close()
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+ <style lang="scss"></style>
|