郑永安
2023-06-19 2befd4a5d3733520b69ed97da88e675b6b086a3c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<template>
 
    <el-dialog title="标签退回" :visible.sync="dialogFormVisible" width="380px">
 
            <el-tabs tab-position="left" style="height: 140px;">
                <el-tab-pane label="部分退回">
                    <el-form :model="form">
                        <div style="margin: 0 20px 20px 40px">
                            <el-button type="text"   @click="viewHandle">下载excel模板</el-button>
                        </div>
                        <div style="margin: 20px 20px 20px 40px">
                            <el-upload
                                class="upload"
                                :action="actionUrlPrefixx+'/contract/'+this.ordercode+'/returnTag'"
                                :headers="headers"
                                :on-preview="handlePreview"
                                :on-remove="handleRemove"
                                :before-remove="beforeRemove"
                                :limit="1"
                                :on-exceed="handleExceed"
                                :on-success="handleSuccess"
                                :on-error="handleError"
                                :show-file-list="false"
                                :file-list="fileList">
                                <el-button size="small" type="primary">点击上传</el-button>
                            </el-upload>
                        </div>
 
                    </el-form>
                </el-tab-pane>
                <el-tab-pane label="全部退回">
                    <div style="margin: 20px 20px 20px 40px">
                        <el-button type="warning" plain @click="returnAllTagHandler">全部退回</el-button>
                    </div>
                </el-tab-pane>
            </el-tabs>
 
 
 
    </el-dialog>
</template>
 
<script>
  const exampleFile = require('@/assets/example/returntag.xlsx')
  import { getToken } from '@/utils/auth'
  export default {
    name: 'index',
    data() {
      return {
        headers:{   'Authorization':getToken()},
        dialogFormVisible: false,
        actionUrlPrefixx:process.env.BASE_API,
        form: {
          name: '',
          region: '',
          date1: '',
          date2: '',
          delivery: false,
          type: [],
          resource: '',
          desc: ''
        },
        formLabelWidth: '120px',
        fileList:[],
        ordercode:''
      };
    },
    methods:{
      showDialog(ordercode){
        this.dialogFormVisible = true
        this.ordercode = ordercode
      },
      viewHandle(){
        window.open(exampleFile, '_blank')
      },
      handleRemove(file, fileList) {
        if (file && file.status==="success") {
          this.dataForm.productList = []
          return this.$confirm(`已清空产品信息`);
        }
      },
      handleExceed(files, fileList) {
        this.$message.warning(`当前限制选择 1个文件,本次选择了 ${files.length} 个文件`);
      },
      beforeRemove(file, fileList) {
        if (file && file.status==="success") {
          //移除方法
          return this.$confirm(`确定移除 ${ file.name },并清空产品信息吗?`);
        }
      },
      handleSuccess(response, file, fileList) {
        if (response.code === '200') {
          this.$notify({
            title: '成功',
            duration: 2000,
            message: '标签退回成功',
            type: 'success'
          })
          this.fileList = []
          this.dialogFormVisible=false
          this.$emit("getinfo")
        }else{
          this.$message.warning(response.message);
          this.fileList = []
        }
 
      },
      handleError(response, file, fileList) {
        this.fileList = []
      },
      handlePreview(file) {
      },
      returnAllTagHandler(){
 
      }
    }
  }
</script>
 
<style scoped>
 
</style>