|
|
@@ -0,0 +1,240 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+<!-- <el-alert-->
|
|
|
+<!-- type="info"-->
|
|
|
+<!-- :closable="false"-->
|
|
|
+<!-- show-icon-->
|
|
|
+<!-- style="margin-bottom: 12px;"-->
|
|
|
+<!-- />-->
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ icon="el-icon-download"
|
|
|
+ size="mini"
|
|
|
+ @click="handleDownload"
|
|
|
+ >下载模板</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ icon="el-icon-upload"
|
|
|
+ size="mini"
|
|
|
+ @click="handleUpload"
|
|
|
+ v-hasPermi="['company:user:transfer']"
|
|
|
+ >导入数据</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table height="500" v-loading="loading" :data="list" border>
|
|
|
+ <el-table-column align="center" label="任务编码" prop="id"/>
|
|
|
+ <el-table-column align="center" label="上传时间" prop="createTime" width="150"/>
|
|
|
+ <el-table-column align="center" label="完成时间" prop="finishTime" width="150"/>
|
|
|
+ <el-table-column align="center" label="总条数" prop="totalCount"/>
|
|
|
+ <el-table-column align="center" label="成功条数" prop="successCount"/>
|
|
|
+ <el-table-column align="center" label="失败条数" prop="failCount"/>
|
|
|
+ <el-table-column align="center" label="提交人" prop="submitUserName"/>
|
|
|
+ <el-table-column align="center" label="状态" prop="status">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag v-for="item in statusConstant" :key="item.state" :type="item.type" v-if="scope.row.status === item.state">{{ item.label }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="操作" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ @click="handleDetail(scope.row)"
|
|
|
+ >查看</el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ v-if="scope.row.failCount > 0"
|
|
|
+ @click="downloadFail(scope.row)"
|
|
|
+ >失败内容下载</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="total>0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="queryParams.pageNum"
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+
|
|
|
+ <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
|
|
+ <el-upload ref="upload"
|
|
|
+ :limit="1" accept=".xlsx, .xls"
|
|
|
+ :headers="upload.headers"
|
|
|
+ :action="upload.url"
|
|
|
+ :disabled="upload.isUploading"
|
|
|
+ :on-progress="handleFileUploadProgress"
|
|
|
+ :on-success="handleFileSuccess"
|
|
|
+ :auto-upload="false"
|
|
|
+ drag>
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
+ <div class="el-upload__text">
|
|
|
+ 将文件拖到此处,或
|
|
|
+ <em>点击上传</em>
|
|
|
+ </div>
|
|
|
+ <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
|
|
|
+ </el-upload>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary"
|
|
|
+ :loading="upload.isUploading"
|
|
|
+ :disabled="upload.isUploading"
|
|
|
+ @click="submitFileForm">立即执行</el-button>
|
|
|
+ <el-button @click="upload.open = false">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-drawer
|
|
|
+ :title="detail.title"
|
|
|
+ :visible.sync="detail.open"
|
|
|
+ :direction="detail.direction"
|
|
|
+ size="80%"
|
|
|
+ append-to-body>
|
|
|
+ <el-table height="700" v-loading="detail.loading" :data="detail.list" border>
|
|
|
+ <el-table-column align="center" label="ID" prop="id" width="80"/>
|
|
|
+ <el-table-column align="center" label="原归属销售ID" prop="oldCompanyUserId"/>
|
|
|
+ <el-table-column align="center" label="原归属销售" prop="oldCompanyUserName"/>
|
|
|
+ <el-table-column align="center" label="项目" prop="projectName"/>
|
|
|
+ <el-table-column align="center" label="会员ID" prop="userId"/>
|
|
|
+ <el-table-column align="center" label="会员名称" prop="userName"/>
|
|
|
+ <el-table-column align="center" label="新归属销售ID" prop="newCompanyUserId"/>
|
|
|
+ <el-table-column align="center" label="新归属销售" prop="newCompanyUserName"/>
|
|
|
+ <el-table-column align="center" label="上传时间" prop="createTime" width="100"/>
|
|
|
+ <el-table-column align="center" label="完成时间" prop="finishTime" width="100"/>
|
|
|
+ <el-table-column align="center" label="状态" prop="status">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag v-for="item in statusConstant" :key="'d'+item.state" :type="item.type" v-if="scope.row.status === item.state">{{ item.label }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="原因" prop="reason"/>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="detail.total>0"
|
|
|
+ :total="detail.total"
|
|
|
+ :page.sync="detail.queryParams.pageNum"
|
|
|
+ :limit.sync="detail.queryParams.pageSize"
|
|
|
+ @pagination="getDetails"
|
|
|
+ />
|
|
|
+ </el-drawer>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { downloadFailedData, importTemplate, transferTaskDetails, transferTaskList } from '@/api/users/user'
|
|
|
+import { getToken } from '@/utils/auth'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'TransferUpload',
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ loading: true,
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10
|
|
|
+ },
|
|
|
+ list: [],
|
|
|
+ total: 0,
|
|
|
+ upload: {
|
|
|
+ open: false,
|
|
|
+ title: '导入转移数据',
|
|
|
+ isUploading: false,
|
|
|
+ headers: { Authorization: 'Bearer ' + getToken() },
|
|
|
+ url: process.env.VUE_APP_BASE_API + '/user/fsUser/importData'
|
|
|
+ },
|
|
|
+ detail: {
|
|
|
+ taskId: null,
|
|
|
+ loading: true,
|
|
|
+ open: false,
|
|
|
+ title: '转移数据详情',
|
|
|
+ direction: 'rtl',
|
|
|
+ list: [],
|
|
|
+ total: 0,
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10
|
|
|
+ }
|
|
|
+ },
|
|
|
+ statusConstant: [
|
|
|
+ { state: 1, type: 'success', label: '执行成功' },
|
|
|
+ { state: 2, type: 'warning', label: '执行失败' }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getList() {
|
|
|
+ this.loading = true
|
|
|
+ transferTaskList(this.queryParams).then(response => {
|
|
|
+ this.list = response.rows
|
|
|
+ this.total = response.total
|
|
|
+ this.loading = false
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleDownload() {
|
|
|
+ importTemplate().then((response) => {
|
|
|
+ this.download(response.msg)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleUpload() {
|
|
|
+ this.upload.open = true
|
|
|
+ },
|
|
|
+ submitFileForm() {
|
|
|
+ this.$refs.upload.submit()
|
|
|
+ },
|
|
|
+ handleFileUploadProgress() {
|
|
|
+ this.upload.isUploading = true
|
|
|
+ },
|
|
|
+ handleFileSuccess(response) {
|
|
|
+ this.upload.open = false
|
|
|
+ this.upload.isUploading = false
|
|
|
+ this.$refs.upload.clearFiles()
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.msgSuccess(response.msg)
|
|
|
+ } else {
|
|
|
+ this.msgError(response.msg)
|
|
|
+ }
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ handleDetail(row) {
|
|
|
+ this.detail.open = true
|
|
|
+ this.detail.taskId = row.id
|
|
|
+ this.getDetails()
|
|
|
+ },
|
|
|
+ getDetails() {
|
|
|
+ this.detail.loading = true
|
|
|
+ transferTaskDetails(this.detail.taskId, this.detail.queryParams).then(response => {
|
|
|
+ this.detail.list = response.rows
|
|
|
+ this.detail.total = response.total
|
|
|
+ this.detail.loading = false
|
|
|
+ }).catch(() => {
|
|
|
+ this.detail.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ downloadFail(row) {
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: '导出中',
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
+ })
|
|
|
+ downloadFailedData(row.id).then(response => {
|
|
|
+ this.download(response.msg)
|
|
|
+ loading.close()
|
|
|
+ }).catch(() => {
|
|
|
+ loading.close()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|