|
@@ -27,8 +27,10 @@
|
|
|
</el-form>
|
|
|
|
|
|
<el-row :gutter="10" style="margin-bottom: 10px" v-if="!userInfo.subsidiaryId">
|
|
|
- <el-col :span="5">
|
|
|
- <el-button type="primary" size="small" @click="handleAdd">添加产品</el-button>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-button type="primary" size="mini" @click="handleAdd">添加产品</el-button>
|
|
|
+ <!-- <el-button type="primary" size="mini" @click="importExcel" v-db-click>导入Excel</el-button>
|
|
|
+ <el-button type="primary" size="mini" @click="historyManagement" v-db-click>导入历史管理</el-button> -->
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
|
|
@@ -112,6 +114,85 @@
|
|
|
<el-dialog v-if="openDetails" :visible.sync="openDetails" width="98%" append-to-body>
|
|
|
<ProductDetails :rowData="rowData" @clickCancel="clickCancelDetails"></ProductDetails>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <!-- 导入SKU -->
|
|
|
+ <el-dialog title="导入SKU" v-if="openImportExcel" :visible.sync="openImportExcel" style="margin-top: 15vh" width="30%" append-to-body>
|
|
|
+ <div
|
|
|
+ v-loading="loadingStatus"
|
|
|
+ element-loading-text="导入中,请稍后"
|
|
|
+ element-loading-spinner="el-icon-loading"
|
|
|
+ element-loading-background="rgba(0, 0, 0, 0.2)"
|
|
|
+ >
|
|
|
+ <el-row :gutter="10" style="margin-bottom: 15px">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-upload
|
|
|
+ class="upload-demo"
|
|
|
+ :action="actionProduct"
|
|
|
+ :headers="{ 'Blade-Auth': 'bearer ' + token }"
|
|
|
+ :show-file-list="false"
|
|
|
+ :before-upload="beforeUpload"
|
|
|
+ :on-progress="excelProgress"
|
|
|
+ :on-success="excelSuccess"
|
|
|
+ :on-error="excelError"
|
|
|
+ accept=".xlsx"
|
|
|
+ >
|
|
|
+ <el-button type="primary" size="mini">导入文件</el-button>
|
|
|
+ </el-upload>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-tooltip placement="bottom" effect="light">
|
|
|
+ <div slot="content">
|
|
|
+ <div v-html="getStyle(errMsg)" style="max-height: 500px; overflow: auto; line-height: normal"></div>
|
|
|
+ </div>
|
|
|
+ <div style="cursor: pointer; color: #940819; overflow: hidden; white-space: nowrap; text-overflow: ellipsis">{{ errMsg }}</div>
|
|
|
+ </el-tooltip>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <div style="width: 100%; text-align: center; padding-top: 16px">
|
|
|
+ <el-button @click="openImportExcel = false">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- SKU导入历史 -->
|
|
|
+ <el-dialog title="SKU导入历史" v-if="openHistory" :visible.sync="openHistory" width="40%" style="margin-top: 15vh" append-to-body>
|
|
|
+ <div
|
|
|
+ v-loading="loadingVersion"
|
|
|
+ element-loading-text="还原版本中,请稍后"
|
|
|
+ element-loading-spinner="el-icon-loading"
|
|
|
+ element-loading-background="rgba(0, 0, 0, 0.2)"
|
|
|
+ >
|
|
|
+ <el-table
|
|
|
+ :data="historyList"
|
|
|
+ :cell-style="{ padding: '0' }"
|
|
|
+ :row-style="{ height: '35px' }"
|
|
|
+ header-row-class-name="tableHeader"
|
|
|
+ v-loading="loadingHistory"
|
|
|
+ border
|
|
|
+ >
|
|
|
+ <el-table-column label="版本时间" align="center" prop="createTime" />
|
|
|
+ <el-table-column label="导入人" align="center" prop="userName" />
|
|
|
+ <el-table-column label="操作" align="center" width="100" fixed="right">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="text" @click="restoreVersion(scope.row)" v-db-click>还原版本</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="historyTotal > 0"
|
|
|
+ :total="historyTotal"
|
|
|
+ :page.sync="queryParamsTwo.pageNum"
|
|
|
+ :limit.sync="queryParamsTwo.pageSize"
|
|
|
+ @pagination="getHistoryList"
|
|
|
+ />
|
|
|
+ <div style="width: 100%; text-align: center; padding-top: 16px">
|
|
|
+ <el-button type="primary" @click="openHistory = false">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -121,6 +202,7 @@ import { del } from '@/api/product/customProductLibrary'
|
|
|
import { mapGetters } from 'vuex'
|
|
|
import Product from './product'
|
|
|
import ProductDetails from './details'
|
|
|
+import { versionList, versionListCount, backupVersion } from '@/api/shengde/group/order/orderManagement.js'
|
|
|
|
|
|
export default {
|
|
|
name: 'groupSKU',
|
|
@@ -158,16 +240,26 @@ export default {
|
|
|
fileData: [],
|
|
|
rowData: {},
|
|
|
openDetails: false,
|
|
|
- // brandName: [],
|
|
|
+ openImportExcel: false,
|
|
|
+ actionProduct: process.env.VUE_APP_ACTION_PRODUCT_URL,
|
|
|
+ loadingStatus: false,
|
|
|
+ openHistory: false,
|
|
|
+ loadingHistory: false,
|
|
|
+ queryParamsTwo: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ model: '1',
|
|
|
+ },
|
|
|
+ historyList: [],
|
|
|
+ historyTotal: 0,
|
|
|
+ loadingVersion: false,
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
- // this.brandName = this.dictData.filter((item) => item.code === 'brand_name')[0].children
|
|
|
- },
|
|
|
+ created() {},
|
|
|
mounted() {
|
|
|
this.getList()
|
|
|
},
|
|
|
- computed: mapGetters(['dictData', 'userInfo']),
|
|
|
+ computed: mapGetters(['dictData', 'userInfo', 'token']),
|
|
|
methods: {
|
|
|
handleNodeClick(data) {
|
|
|
this.queryParams.pageNum = 1
|
|
@@ -265,6 +357,86 @@ export default {
|
|
|
openFile(path) {
|
|
|
window.open(path)
|
|
|
},
|
|
|
+ importExcel() {
|
|
|
+ this.errMsg = ''
|
|
|
+ this.openImportExcel = true
|
|
|
+ },
|
|
|
+ getStyle(text) {
|
|
|
+ if (text) {
|
|
|
+ return text.replace(/\n|\r\n/g, '<br>')
|
|
|
+ } else {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeUpload(file) {
|
|
|
+ this.errMsg = ''
|
|
|
+ const isLt50M = file.size / 1024 / 1024 < 50
|
|
|
+ if (!isLt50M) {
|
|
|
+ this.$message.error('上传文件大小不能超过50MB!')
|
|
|
+ }
|
|
|
+ return isLt50M
|
|
|
+ },
|
|
|
+ excelProgress() {
|
|
|
+ this.loadingStatus = true
|
|
|
+ },
|
|
|
+ excelSuccess(msg) {
|
|
|
+ if (msg && msg.data) {
|
|
|
+ this.msgSuccess('文件导入成功: ' + msg.data)
|
|
|
+ } else {
|
|
|
+ this.msgSuccess('文件导入成功')
|
|
|
+ }
|
|
|
+ this.loadingStatus = false
|
|
|
+ this.openImportExcel = false
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ excelError(err) {
|
|
|
+ var res = JSON.parse(err.message)
|
|
|
+ this.errMsg = '导入失败: ' + res.msg
|
|
|
+ this.loadingStatus = false
|
|
|
+ },
|
|
|
+ historyManagement() {
|
|
|
+ this.historyTotal = 0
|
|
|
+ this.historyList = []
|
|
|
+ this.queryParamsTwo = {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ model: '1',
|
|
|
+ }
|
|
|
+ this.loadingVersion = false
|
|
|
+ this.openHistory = true
|
|
|
+ this.getHistoryList()
|
|
|
+ },
|
|
|
+ getHistoryList() {
|
|
|
+ this.loadingHistory = true
|
|
|
+ versionList(this.queryParamsTwo).then(
|
|
|
+ (res) => {
|
|
|
+ this.historyList = res.data.data.list
|
|
|
+ this.loadingHistory = false
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.log('versionList:' + err)
|
|
|
+ this.loadingHistory = false
|
|
|
+ }
|
|
|
+ )
|
|
|
+ versionListCount(this.queryParamsTwo).then((res) => {
|
|
|
+ this.historyTotal = res.data.data.count
|
|
|
+ })
|
|
|
+ },
|
|
|
+ restoreVersion(row) {
|
|
|
+ this.loadingVersion = true
|
|
|
+ backupVersion({ id: row.id }).then(
|
|
|
+ (res) => {
|
|
|
+ this.msgSuccess('版本还原成功')
|
|
|
+ this.loadingVersion = false
|
|
|
+ this.openHistory = false
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.log('backupVersion: ' + err)
|
|
|
+ this.loadingVersion = false
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
},
|
|
|
}
|
|
|
</script>
|