23
This commit is contained in:
parent
794138877d
commit
b6d359a600
50
src/api/DouyinGoodsInfo.js
Normal file
50
src/api/DouyinGoodsInfo.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/DouyinGoodsInfo',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(id) {
|
||||
return request({
|
||||
url: 'api/DouyinGoodsInfo/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteAll() {
|
||||
return request({
|
||||
url: 'api/DouyinGoodsInfo/deleteAll',
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/DouyinGoodsInfo',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function downloadDouyinGoodsInfo(params) {
|
||||
return request({
|
||||
url: 'api/DouyinGoodsInfo/download',
|
||||
method: 'get',
|
||||
params,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
export function processImage(params) {
|
||||
return request({
|
||||
url: 'api/DouyinGoodsInfo/processImage',
|
||||
method: 'get',
|
||||
params,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div>
|
||||
<!-- 导入 -->
|
||||
<!-- 导入 -->
|
||||
<el-button
|
||||
size="mini"
|
||||
class="filter-item"
|
||||
|
|
@ -76,7 +76,7 @@ export default {
|
|||
this.upload.isUploading = false;
|
||||
this.$refs.upload.clearFiles();
|
||||
this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
|
||||
this.$emit("ok");
|
||||
this.$emit("ok", fileList);
|
||||
},
|
||||
// 提交上传文件
|
||||
submitFileForm() {
|
||||
|
|
|
|||
94
src/views/douyin/goods_info/form.vue
Normal file
94
src/views/douyin/goods_info/form.vue
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
<template>
|
||||
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
|
||||
<el-form-item label="商品id" >
|
||||
<el-input v-model="form.goodsId" style="width: 370px;"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品编号" >
|
||||
<el-input v-model="form.goodsNum" style="width: 370px;"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="cancel">取消</el-button>
|
||||
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { add, edit } from '@/api/DouyinGoodsInfo'
|
||||
export default {
|
||||
props: {
|
||||
isAdd: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false, dialog: false,
|
||||
form: {
|
||||
id: '',
|
||||
goodsId: '',
|
||||
goodsNum: ''
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cancel() {
|
||||
this.resetForm()
|
||||
},
|
||||
doSubmit() {
|
||||
this.loading = true
|
||||
if (this.isAdd) {
|
||||
this.doAdd()
|
||||
} else this.doEdit()
|
||||
},
|
||||
doAdd() {
|
||||
add(this.form).then(res => {
|
||||
this.resetForm()
|
||||
this.$notify({
|
||||
title: '添加成功',
|
||||
type: 'success',
|
||||
duration: 2500
|
||||
})
|
||||
this.loading = false
|
||||
this.$parent.init()
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
doEdit() {
|
||||
edit(this.form).then(res => {
|
||||
this.resetForm()
|
||||
this.$notify({
|
||||
title: '修改成功',
|
||||
type: 'success',
|
||||
duration: 2500
|
||||
})
|
||||
this.loading = false
|
||||
this.$parent.init()
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
resetForm() {
|
||||
this.dialog = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.form = {
|
||||
id: '',
|
||||
goodsId: '',
|
||||
goodsNum: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
199
src/views/douyin/goods_info/index copy.vue
Normal file
199
src/views/douyin/goods_info/index copy.vue
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<!-- 搜索 -->
|
||||
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
|
||||
<el-select v-model="query.type" clearable placeholder="类型" class="filter-item" style="width: 130px">
|
||||
<el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key"/>
|
||||
</el-select>
|
||||
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
|
||||
<!-- 新增 -->
|
||||
<div style="display: inline-block;margin: 0px 2px;">
|
||||
<el-button
|
||||
v-permission="['admin','DouyinGoodsInfo:add']"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="add">新增</el-button>
|
||||
</div>
|
||||
<div style="display: inline-block;margin: 0px 2px;">
|
||||
<el-button
|
||||
v-permission="['admin','DouyinGoodsInfo:add']"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="processImage">图片处理</el-button>
|
||||
</div>
|
||||
<!-- 导出 -->
|
||||
<div style="display: inline-block;">
|
||||
<el-button
|
||||
:loading="downloadLoading"
|
||||
size="mini"
|
||||
class="filter-item"
|
||||
type="warning"
|
||||
icon="el-icon-download"
|
||||
@click="download">导出</el-button>
|
||||
</div>
|
||||
<div style="display: inline-block;">
|
||||
<ImportData
|
||||
:title="'导入'"
|
||||
:url="'/api/DouyinGoodsInfo/importData'"
|
||||
:params="params"
|
||||
@ok="init"
|
||||
/>
|
||||
</div>
|
||||
<div style="display: inline-block;">
|
||||
<el-button
|
||||
:loading="delLoading"
|
||||
size="mini"
|
||||
class="filter-item"
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
v-permission="['admin','DouyinGoodsInfo:del']"
|
||||
@click="handleDeleteAll">删除所有</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<!--表单组件-->
|
||||
<eForm ref="form" :is-add="isAdd"/>
|
||||
<imageProcessor ref="form2" :is-add="isAdd"/>
|
||||
<!--表格渲染-->
|
||||
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
|
||||
<el-table-column prop="goodsId" label="商品id"/>
|
||||
<el-table-column prop="goodsNum" label="商品编号"/>
|
||||
<el-table-column v-if="checkPermission(['admin','DouyinGoodsInfo:edit','DouyinGoodsInfo:del'])" label="操作" width="150px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-permission="['admin','DouyinGoodsInfo:edit']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)"/>
|
||||
<el-popover
|
||||
v-permission="['admin','DouyinGoodsInfo:del']"
|
||||
:ref="scope.row.id"
|
||||
placement="top"
|
||||
width="180">
|
||||
<p>确定删除本条数据吗?</p>
|
||||
<div style="text-align: right; margin: 0">
|
||||
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
|
||||
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
|
||||
</div>
|
||||
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini"/>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<el-pagination
|
||||
:total="total"
|
||||
:current-page="page + 1"
|
||||
style="margin-top: 8px;"
|
||||
layout="total, prev, pager, next, sizes"
|
||||
@size-change="sizeChange"
|
||||
@current-change="pageChange"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import checkPermission from '@/utils/permission'
|
||||
import initData from '@/mixins/initData'
|
||||
import { del, downloadDouyinGoodsInfo,deleteAll } from '@/api/DouyinGoodsInfo'
|
||||
import eForm from './form'
|
||||
import imageProcessor from './index'
|
||||
export default {
|
||||
components: { eForm,imageProcessor },
|
||||
mixins: [initData],
|
||||
data() {
|
||||
return {
|
||||
delLoading: false,
|
||||
queryTypeOptions: [
|
||||
{ key: 'goodsId', display_name: '商品id' },
|
||||
{ key: 'goodsNum', display_name: '商品编号' }
|
||||
]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$nextTick(() => {
|
||||
this.init()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
processImage() {
|
||||
this.isAdd = false
|
||||
const _this = this.$refs.form2
|
||||
_this.dialog = true
|
||||
},
|
||||
handleDeleteAll() {
|
||||
this.delLoading = true
|
||||
deleteAll().then(res => {
|
||||
this.delLoading = false
|
||||
this.init()
|
||||
this.$notify({
|
||||
title: '删除成功',
|
||||
type: 'success',
|
||||
duration: 2500
|
||||
})
|
||||
}).catch(err => {
|
||||
this.delLoading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
beforeInit() {
|
||||
this.url = 'api/DouyinGoodsInfo'
|
||||
const sort = 'id,desc'
|
||||
this.params = { page: this.page, size: this.size, sort: sort }
|
||||
const query = this.query
|
||||
const type = query.type
|
||||
const value = query.value
|
||||
if (type && value) { this.params[type] = value }
|
||||
return true
|
||||
},
|
||||
subDelete(id) {
|
||||
this.delLoading = true
|
||||
del(id).then(res => {
|
||||
this.delLoading = false
|
||||
this.$refs[id].doClose()
|
||||
this.dleChangePage()
|
||||
this.init()
|
||||
this.$notify({
|
||||
title: '删除成功',
|
||||
type: 'success',
|
||||
duration: 2500
|
||||
})
|
||||
}).catch(err => {
|
||||
this.delLoading = false
|
||||
this.$refs[id].doClose()
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
add() {
|
||||
this.isAdd = true
|
||||
this.$refs.form.dialog = true
|
||||
},
|
||||
edit(data) {
|
||||
this.isAdd = false
|
||||
const _this = this.$refs.form
|
||||
_this.form = {
|
||||
id: data.id,
|
||||
goodsId: data.goodsId,
|
||||
goodsNum: data.goodsNum
|
||||
}
|
||||
_this.dialog = true
|
||||
},
|
||||
// 导出
|
||||
download() {
|
||||
this.beforeInit()
|
||||
this.downloadLoading = true
|
||||
downloadDouyinGoodsInfo(this.params).then(result => {
|
||||
downloadFile(result, 'DouyinGoodsInfo列表', 'xlsx')
|
||||
this.downloadLoading = false
|
||||
}).catch(() => {
|
||||
this.downloadLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
136
src/views/douyin/goods_info/index.vue
Normal file
136
src/views/douyin/goods_info/index.vue
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
<template>
|
||||
<div class="tool-container">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="Excel文件" >
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
:on-preview="handlePreview"
|
||||
:on-remove="handleRemove"
|
||||
:before-remove="beforeRemove"
|
||||
multiple
|
||||
:auto-upload="true"
|
||||
accept=".xlsx, .xls, .csv"
|
||||
method="get"
|
||||
:headers="upload.headers"
|
||||
:on-success="handleSuccess"
|
||||
:action="upload.url"
|
||||
:limit="1"
|
||||
:on-exceed="handleExceed"
|
||||
:file-list="fileList1">
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="图片压缩包文件" >
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
:on-preview="handlePreview"
|
||||
:on-remove="handleRemove2"
|
||||
:before-remove="beforeRemove"
|
||||
:auto-upload="true"
|
||||
accept=".zip, .rar"
|
||||
method="get"
|
||||
:headers="upload.headers"
|
||||
:action="upload.url"
|
||||
:on-success="handleSuccess2"
|
||||
:limit="1"
|
||||
:on-exceed="handleExceed"
|
||||
:file-list="fileList2">
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-button type="text" @click="cancel">取消</el-button>
|
||||
<el-button :loading="loading" type="primary" @click="download">图片处理</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { add, edit,processImage } from '@/api/DouyinGoodsInfo'
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { parseTime, downloadFile, parseDate } from '@/utils/index'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
upload: {
|
||||
// 是否显示弹出层(用户导入)
|
||||
open: false,
|
||||
// 弹出层标题(用户导入)
|
||||
title: "",
|
||||
// 是否禁用上传
|
||||
isUploading: false,
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: "Bearer " + getToken() },
|
||||
// 上传的地址
|
||||
url: "/api/DouyinGoodsInfo/saveFile"
|
||||
},
|
||||
fileList1: [],
|
||||
fileList2: [],
|
||||
loading: false, dialog: false,
|
||||
params: {},
|
||||
form: {
|
||||
id: '',
|
||||
goodsId: '',
|
||||
goodsNum: ''
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cancel() {
|
||||
this.params = {};
|
||||
this.fileList1 = [];
|
||||
this.fileList2 = [];
|
||||
},
|
||||
// 导出
|
||||
download() {
|
||||
this.loading = true
|
||||
processImage(this.params).then(result => {
|
||||
downloadFile(result, '图片处理结果', 'zip')
|
||||
this.cancel();
|
||||
this.loading = false
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
handleRemove(file, fileList) {
|
||||
console.log(file, fileList);
|
||||
this.params['excelFileName'] = '';
|
||||
},
|
||||
handleRemove2(file, fileList) {
|
||||
console.log(file, fileList);
|
||||
this.params['zipFileName'] = '';
|
||||
},
|
||||
handlePreview(file) {
|
||||
console.log(file);
|
||||
},
|
||||
handleExceed(files, fileList) {
|
||||
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
|
||||
},
|
||||
beforeRemove(file, fileList) {
|
||||
return this.$confirm(`确定移除 ${ file.name }?`);
|
||||
},
|
||||
handleSuccess(response, file, fileList) {
|
||||
this.params['excelFileName'] = file.name;
|
||||
},
|
||||
handleSuccess2(response, file, fileList) {
|
||||
this.params['zipFileName'] = file.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.tool-container {
|
||||
cen
|
||||
}
|
||||
</style>
|
||||
120
src/views/douyin/goods_info/index2.vue
Normal file
120
src/views/douyin/goods_info/index2.vue
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<div style="display: inline-block;margin: 0px 2px;">
|
||||
<el-button
|
||||
v-permission="['admin','DouyinGoodsInfo:add']"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="processImage">图片处理</el-button>
|
||||
</div>
|
||||
<imageProcessor ref="form2" :is-add="isAdd"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import checkPermission from '@/utils/permission'
|
||||
import initData from '@/mixins/initData'
|
||||
import { del, downloadDouyinGoodsInfo,deleteAll } from '@/api/DouyinGoodsInfo'
|
||||
import eForm from './form'
|
||||
import imageProcessor from './index'
|
||||
export default {
|
||||
components: { eForm,imageProcessor },
|
||||
mixins: [initData],
|
||||
data() {
|
||||
return {
|
||||
delLoading: false,
|
||||
queryTypeOptions: [
|
||||
{ key: 'goodsId', display_name: '商品id' },
|
||||
{ key: 'goodsNum', display_name: '商品编号' }
|
||||
]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$nextTick(() => {
|
||||
this.init()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
processImage() {
|
||||
this.isAdd = false
|
||||
const _this = this.$refs.form2
|
||||
_this.dialog = true
|
||||
},
|
||||
handleDeleteAll() {
|
||||
this.delLoading = true
|
||||
deleteAll().then(res => {
|
||||
this.delLoading = false
|
||||
this.init()
|
||||
this.$notify({
|
||||
title: '删除成功',
|
||||
type: 'success',
|
||||
duration: 2500
|
||||
})
|
||||
}).catch(err => {
|
||||
this.delLoading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
beforeInit() {
|
||||
this.url = 'api/DouyinGoodsInfo'
|
||||
const sort = 'id,desc'
|
||||
this.params = { page: this.page, size: this.size, sort: sort }
|
||||
const query = this.query
|
||||
const type = query.type
|
||||
const value = query.value
|
||||
if (type && value) { this.params[type] = value }
|
||||
return true
|
||||
},
|
||||
subDelete(id) {
|
||||
this.delLoading = true
|
||||
del(id).then(res => {
|
||||
this.delLoading = false
|
||||
this.$refs[id].doClose()
|
||||
this.dleChangePage()
|
||||
this.init()
|
||||
this.$notify({
|
||||
title: '删除成功',
|
||||
type: 'success',
|
||||
duration: 2500
|
||||
})
|
||||
}).catch(err => {
|
||||
this.delLoading = false
|
||||
this.$refs[id].doClose()
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
add() {
|
||||
this.isAdd = true
|
||||
this.$refs.form.dialog = true
|
||||
},
|
||||
edit(data) {
|
||||
this.isAdd = false
|
||||
const _this = this.$refs.form
|
||||
_this.form = {
|
||||
id: data.id,
|
||||
goodsId: data.goodsId,
|
||||
goodsNum: data.goodsNum
|
||||
}
|
||||
_this.dialog = true
|
||||
},
|
||||
// 导出
|
||||
download() {
|
||||
this.beforeInit()
|
||||
this.downloadLoading = true
|
||||
downloadDouyinGoodsInfo(this.params).then(result => {
|
||||
downloadFile(result, 'DouyinGoodsInfo列表', 'xlsx')
|
||||
this.downloadLoading = false
|
||||
}).catch(() => {
|
||||
this.downloadLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user