代码提交
This commit is contained in:
@ -45,6 +45,11 @@ export const getStoreProductPage = async (params: StoreProductPageReqVO) => {
|
|||||||
return await request.get({ url: `/product/store-product/page`, params })
|
return await request.get({ url: `/product/store-product/page`, params })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询已选商品列表
|
||||||
|
export const getSelectProductPage = async (data) => {
|
||||||
|
return await request.post({ url: `/product/store-product/coupon/page`, data })
|
||||||
|
}
|
||||||
|
|
||||||
// 查询商品详情
|
// 查询商品详情
|
||||||
export const getStoreProduct = async (id: number) => {
|
export const getStoreProduct = async (id: number) => {
|
||||||
return await request.get({ url: `/product/store-product/get?id=` + id })
|
return await request.get({ url: `/product/store-product/get?id=` + id })
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import request from '@/config/axios'
|
import request from '@/config/axios'
|
||||||
|
|
||||||
export interface DiscountCouponVO {
|
export interface ShippingTemplatesVO {
|
||||||
id: number
|
id: number
|
||||||
name: string
|
name: string
|
||||||
type: boolean
|
type: boolean
|
||||||
@ -11,31 +11,31 @@ export interface DiscountCouponVO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查询运费模板列表
|
// 查询运费模板列表
|
||||||
export const getDiscountCouponPage = async (params: DiscountCouponPageReqVO) => {
|
export const getShippingTemplatesPage = async (params: ShippingTemplatesPageReqVO) => {
|
||||||
return await request.get({ url: `/product/shipping-templates/page`, params })
|
return await request.get({ url: `/product/shipping-templates/page`, params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询运费模板详情
|
// 查询运费模板详情
|
||||||
export const getDiscountCoupon = async (id: number) => {
|
export const getShippingTemplates = async (id: number) => {
|
||||||
return await request.get({ url: `/product/shipping-templates/get?id=` + id })
|
return await request.get({ url: `/product/shipping-templates/get?id=` + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增运费模板
|
// 新增运费模板
|
||||||
export const createDiscountCoupon = async (data,id) => {
|
export const createShippingTemplates = async (data,id) => {
|
||||||
return await request.post({ url: `/product/shipping-templates/create/`+ id, data })
|
return await request.post({ url: `/product/shipping-templates/create/`+ id, data })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改运费模板
|
// 修改运费模板
|
||||||
export const updateDiscountCoupon = async (data: DiscountCouponVO) => {
|
export const updateShippingTemplates = async (data: ShippingTemplatesVO) => {
|
||||||
return await request.put({ url: `/product/shipping-templates/update`, data })
|
return await request.put({ url: `/product/shipping-templates/update`, data })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除运费模板
|
// 删除运费模板
|
||||||
export const deleteDiscountCoupon = async (id: number) => {
|
export const deleteShippingTemplates = async (id: number) => {
|
||||||
return await request.delete({ url: `/product/shipping-templates/delete?id=` + id })
|
return await request.delete({ url: `/product/shipping-templates/delete?id=` + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出运费模板 Excel
|
// 导出运费模板 Excel
|
||||||
export const exportDiscountCoupon = async (params) => {
|
export const exportShippingTemplates = async (params) => {
|
||||||
return await request.download({ url: `/product/shipping-templates/export-excel`, params })
|
return await request.download({ url: `/product/shipping-templates/export-excel`, params })
|
||||||
}
|
}
|
||||||
|
27
src/api/system/storeBackupRecord/index.js
Normal file
27
src/api/system/storeBackupRecord/index.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
// 获得备份记录分页
|
||||||
|
export function getStoreBackupRecordPage(query) {
|
||||||
|
return request.get({
|
||||||
|
url: '/system/backup/page',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建备份记录
|
||||||
|
export function createStoreBackupRecord() {
|
||||||
|
return request.post({
|
||||||
|
url: '/system/backup/backup',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 还原备份记录
|
||||||
|
export function rollbackBackupRecord() {
|
||||||
|
return request.post({
|
||||||
|
url: '/system/backup/revertBackup',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -13,7 +13,9 @@ export const CACHE_KEY = {
|
|||||||
THEME: 'theme',
|
THEME: 'theme',
|
||||||
LAYOUT: 'layout',
|
LAYOUT: 'layout',
|
||||||
ROLE_ROUTERS: 'roleRouters',
|
ROLE_ROUTERS: 'roleRouters',
|
||||||
DICT_CACHE: 'dictCache'
|
DICT_CACHE: 'dictCache',
|
||||||
|
BACK_UP:'back_up', // 备份
|
||||||
|
RESTORE:'restore', // 还原
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useCache = (type: CacheType = 'localStorage') => {
|
export const useCache = (type: CacheType = 'localStorage') => {
|
||||||
|
@ -12,15 +12,6 @@
|
|||||||
<span v-if="DetailData.state==1">已审核 </span>
|
<span v-if="DetailData.state==1">已审核 </span>
|
||||||
<span v-if="DetailData.state==2">用户已发货</span>
|
<span v-if="DetailData.state==2">用户已发货</span>
|
||||||
<span v-if="DetailData.state==3">退款成功</span>
|
<span v-if="DetailData.state==3">退款成功</span>
|
||||||
<<<<<<< HEAD
|
|
||||||
</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="售后状态">
|
|
||||||
<span v-if="DetailData.salesState==0">正常</span>
|
|
||||||
<span v-if="DetailData.salesState==1">用户取消 </span>
|
|
||||||
<span v-if="DetailData.salesState==2">商家拒绝</span>
|
|
||||||
</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="退款金额">{{ DetailData.refundAmount }}</el-descriptions-item>
|
|
||||||
=======
|
|
||||||
<span v-if="DetailData.state==4">用户取消</span>
|
<span v-if="DetailData.state==4">用户取消</span>
|
||||||
<span v-if="DetailData.state==5">商家拒绝</span>
|
<span v-if="DetailData.state==5">商家拒绝</span>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
@ -29,13 +20,12 @@
|
|||||||
<!-- <span v-if="DetailData.salesState==1">用户取消 </span>-->
|
<!-- <span v-if="DetailData.salesState==1">用户取消 </span>-->
|
||||||
<!-- <span v-if="DetailData.salesState==2">商家拒绝</span>-->
|
<!-- <span v-if="DetailData.salesState==2">商家拒绝</span>-->
|
||||||
<!-- </el-descriptions-item>-->
|
<!-- </el-descriptions-item>-->
|
||||||
<el-descriptions-item label="退款金额">{{ DetailData.refundAmount.toFixed(2) }}</el-descriptions-item>
|
<el-descriptions-item label="退款金额">{{ DetailData.refundAmount}}</el-descriptions-item>
|
||||||
>>>>>>> master
|
|
||||||
<el-descriptions-item label="申请原因">{{ DetailData.reasons }}</el-descriptions-item>
|
<el-descriptions-item label="申请原因">{{ DetailData.reasons }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="说明">{{ DetailData.explains }}</el-descriptions-item>
|
<el-descriptions-item label="说明">{{ DetailData.explains }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="说明图片" v-if="DetailData.explainImg">
|
<el-descriptions-item label="说明图片" v-if="DetailData.explainImg">
|
||||||
<div class="img-list">
|
<div class="img-list">
|
||||||
<el-image style="width: 100px; height: 100px" v-for="(item,index) in DetailData.explainImgList" :key="index" :src="item" />
|
<el-image style="width: 100px; height: 100px" :preview-src-list="DetailData.explainImgList" v-for="(item,index) in DetailData.explainImgList" :key="index" :src="item" />
|
||||||
</div>
|
</div>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="创建时间">{{ formatDate(DetailData.createTime)}}</el-descriptions-item>
|
<el-descriptions-item label="创建时间">{{ formatDate(DetailData.createTime)}}</el-descriptions-item>
|
||||||
@ -45,16 +35,27 @@
|
|||||||
<el-descriptions-item label="联系电话">{{ DetailData.phoneNumber }}</el-descriptions-item>
|
<el-descriptions-item label="联系电话">{{ DetailData.phoneNumber }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="收货地址">{{ DetailData.address }}</el-descriptions-item>
|
<el-descriptions-item label="收货地址">{{ DetailData.address }}</el-descriptions-item>
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
<el-descriptions title="用户退货物流信息" :column="2">
|
<el-descriptions title="用户退货物流信息" :column="2" v-if="DetailData.shipperCode">
|
||||||
<el-descriptions-item label="快递公司">{{ DetailData.deliveryName }}</el-descriptions-item>
|
<el-descriptions-item label="快递公司">{{ DetailData.deliveryName }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="快递单号">{{ DetailData.deliverySn }} <el-button type="primary" @click="getLogistic(DetailData.deliverySn,DetailData.shipperCode)">物流追踪</el-button></el-descriptions-item>
|
<el-descriptions-item label="快递单号">{{ DetailData.deliverySn }} <el-button type="primary" @click="getLogistic(DetailData.deliverySn,DetailData.shipperCode)">物流追踪</el-button></el-descriptions-item>
|
||||||
|
<el-descriptions-item label="退货说明">{{ DetailData.returnPolicy }}</el-descriptions-item>
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
<div class="logisticResult" v-for="(item, index) of logisticResult" :key="index">
|
<el-descriptions v-if="DetailData.returnVoucher">
|
||||||
<h3>{{item.actionName}}</h3>
|
<el-descriptions-item label="物流凭证" v-if="DetailData.returnVoucher">
|
||||||
<p>{{item.acceptStation}}</p>
|
<div class="img-list">
|
||||||
<p>{{item.acceptTime}}</p>
|
<el-image style="width: 100px; height: 100px" :preview-src-list="DetailData.returnVoucherList" v-for="(item,index) in DetailData.returnVoucherList" :key="index" :src="item" />
|
||||||
</div>
|
</div>
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
<el-timeline>
|
||||||
|
<el-timeline-item
|
||||||
|
v-for="(item, index) in logisticResult"
|
||||||
|
:key="index"
|
||||||
|
:timestamp="item.acceptTime"
|
||||||
|
>
|
||||||
|
{{ item.acceptStation }}
|
||||||
|
</el-timeline-item>
|
||||||
|
</el-timeline>
|
||||||
<!-- <el-button @click="innerDrawer = true">Click me!</el-button>
|
<!-- <el-button @click="innerDrawer = true">Click me!</el-button>
|
||||||
<el-drawer
|
<el-drawer
|
||||||
v-model="innerDrawer"
|
v-model="innerDrawer"
|
||||||
@ -77,7 +78,8 @@ const { t } = useI18n() // 国际化
|
|||||||
const dialogTitle = ref('') // 弹窗的标题
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
const drawer = ref(false)
|
const drawer = ref(false)
|
||||||
const DetailData = ref({
|
const DetailData = ref({
|
||||||
explainImgList: []
|
explainImgList: [],
|
||||||
|
returnVoucherList: []
|
||||||
})
|
})
|
||||||
const logisticResult = ref({})
|
const logisticResult = ref({})
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
@ -85,11 +87,13 @@ const open = async (type: string, id?: number) => {
|
|||||||
drawer.value = true
|
drawer.value = true
|
||||||
dialogTitle.value = t('action.' + type)
|
dialogTitle.value = t('action.' + type)
|
||||||
DetailData.value = await StoreAfterSalesApi.getStoreAfterSales(id)
|
DetailData.value = await StoreAfterSalesApi.getStoreAfterSales(id)
|
||||||
DetailData.value.explainImgList = DetailData.value.explainImg.split(',')
|
DetailData.value.explainImgList = DetailData.value.explainImg?.split(',')
|
||||||
|
DetailData.value.returnVoucherList = DetailData.value.returnVoucher?.split(',')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getLogistic = async(deliverySn,deliveryId) => {
|
const getLogistic = async(deliverySn,shipperCode) => {
|
||||||
const res = await StoreOrderApi.getLogistic(deliverySn, deliveryId)
|
const res = await StoreOrderApi.getLogistic(deliverySn, shipperCode)
|
||||||
if (res.success == "false") {
|
if (res.success == "false") {
|
||||||
message.error(res.reason)
|
message.error(res.reason)
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<el-input disabled v-model="formData.explains" placeholder="请输入说明" />
|
<el-input disabled v-model="formData.explains" placeholder="请输入说明" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="说明图片" prop="explainImg" v-if="formData.explainImg">
|
<el-form-item label="说明图片" prop="explainImg" v-if="formData.explainImg">
|
||||||
<el-image style="width: 100px; height: 100px" v-for="(item,index) in formData.explainImgList" :key="index" :src="item" />
|
<el-image style="width: 100px; height: 100px" :preview-src-list="formData.explainImgList" v-for="(item,index) in formData.explainImgList" :key="index" :src="item" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div class="group" v-if="formData.deliverySn">
|
<div class="group" v-if="formData.deliverySn">
|
||||||
<h3 class="group-title color-red">物流信息</h3>
|
<h3 class="group-title color-red">物流信息</h3>
|
||||||
@ -31,11 +31,11 @@
|
|||||||
<el-input disabled v-model="formData.deliverySn" placeholder="请输入物流单号" />
|
<el-input disabled v-model="formData.deliverySn" placeholder="请输入物流单号" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="退货说明">
|
<el-form-item label="退货说明">
|
||||||
<el-input disabled v-model="formData.explains" placeholder="请输入退货说明" />
|
<el-input disabled v-model="formData.returnPolicy" placeholder="请输入退货说明" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="上传凭证" prop="explainImg">
|
<el-form-item label="上传凭证" prop="explainImg" v-if="formData.returnVoucher">
|
||||||
<div class="img-list">
|
<div class="img-list">
|
||||||
<el-image style="width: 100px; height: 100px" v-for="(item,index) in formData.explainImgList" :key="index" :src="item" />
|
<el-image style="width: 100px; height: 100px" :preview-src-list="formData.returnVoucherList" v-for="(item,index) in formData.returnVoucherList" :key="index" :src="item" />
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
@ -87,7 +87,8 @@ const formData = ref({
|
|||||||
phoneNumber: undefined,
|
phoneNumber: undefined,
|
||||||
address: undefined,
|
address: undefined,
|
||||||
type: 0,
|
type: 0,
|
||||||
explainImgList: []
|
explainImgList: [],
|
||||||
|
returnVoucherList: []
|
||||||
})
|
})
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
consignee: [{ required: true, message: '请输入商家收货人', trigger: 'blur' }],
|
consignee: [{ required: true, message: '请输入商家收货人', trigger: 'blur' }],
|
||||||
@ -107,7 +108,8 @@ const open = async (type: string, id?: number) => {
|
|||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
formData.value = await StoreAfterSalesApi.getStoreAfterSales(id)
|
formData.value = await StoreAfterSalesApi.getStoreAfterSales(id)
|
||||||
formData.value.explainImgList = formData.value.explainImg.split(',')
|
formData.value.explainImgList = formData.value.explainImg?.split(',')
|
||||||
|
formData.value.returnVoucherList = formData.value.returnVoucher?.split(',')
|
||||||
} finally {
|
} finally {
|
||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
}
|
}
|
||||||
@ -173,7 +175,8 @@ const resetForm = () => {
|
|||||||
consignee: undefined,
|
consignee: undefined,
|
||||||
phoneNumber: undefined,
|
phoneNumber: undefined,
|
||||||
address: undefined,
|
address: undefined,
|
||||||
explainImgList: []
|
explainImgList: [],
|
||||||
|
returnVoucherList: []
|
||||||
}
|
}
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
@ -51,15 +51,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<<<<<<< HEAD
|
|
||||||
<el-table-column label="退款金额" align="center" prop="refundAmount" />
|
|
||||||
=======
|
|
||||||
<el-table-column label="退款金额" align="center">
|
<el-table-column label="退款金额" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{scope.row.refundAmount.toFixed(2)}}</span>
|
<span>{{scope.row.refundAmount.toFixed(2)}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
>>>>>>> master
|
|
||||||
<el-table-column label="服务类型" align="center">
|
<el-table-column label="服务类型" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span v-if="scope.row.serviceType==0">仅退款</span>
|
<span v-if="scope.row.serviceType==0">仅退款</span>
|
||||||
|
@ -21,9 +21,9 @@
|
|||||||
<el-descriptions-item label="支付时间">{{ formatDate(DetailData.payTime) }}</el-descriptions-item>
|
<el-descriptions-item label="支付时间">{{ formatDate(DetailData.payTime) }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="支付方式">{{ DetailData.payType }}</el-descriptions-item>
|
<el-descriptions-item label="支付方式">{{ DetailData.payType }}</el-descriptions-item>
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
<el-descriptions title="物流信息" :column="2">
|
<el-descriptions title="物流信息" :column="2" v-if="DetailData.deliveryId">
|
||||||
<el-descriptions-item label="快递公司">{{ DetailData.deliveryName }}</el-descriptions-item>
|
<el-descriptions-item label="快递公司">{{ DetailData.deliveryName }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="快递单号">{{ DetailData.deliveryId }} <el-button type="primary" @click="getLogistic(DetailData.deliverySn,DetailData.deliveryId)">物流追踪</el-button></el-descriptions-item>
|
<el-descriptions-item label="快递单号">{{ DetailData.deliveryId }} <el-button type="primary" @click="getLogistic(DetailData.deliveryId, DetailData.deliverySn)">物流追踪</el-button></el-descriptions-item>
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
<el-timeline>
|
<el-timeline>
|
||||||
<el-timeline-item
|
<el-timeline-item
|
||||||
|
@ -15,11 +15,7 @@
|
|||||||
<el-form-item label="发货类型" prop="deliveryType">
|
<el-form-item label="发货类型" prop="deliveryType">
|
||||||
<el-radio-group v-model="formData.deliveryType" @change="selectDelivery">
|
<el-radio-group v-model="formData.deliveryType" @change="selectDelivery">
|
||||||
<el-radio label="normal">手动填写</el-radio>
|
<el-radio label="normal">手动填写</el-radio>
|
||||||
<<<<<<< HEAD
|
|
||||||
<el-radio label="face">电子面单</el-radio>
|
|
||||||
=======
|
|
||||||
<!-- <el-radio label="face">电子面单</el-radio>-->
|
<!-- <el-radio label="face">电子面单</el-radio>-->
|
||||||
>>>>>>> master
|
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="快递公司" prop="deliverySn" v-if="isShow">
|
<el-form-item label="快递公司" prop="deliverySn" v-if="isShow">
|
||||||
|
@ -327,7 +327,10 @@ const queryParams = reactive({
|
|||||||
isPostage: null,
|
isPostage: null,
|
||||||
isShow: 1,
|
isShow: 1,
|
||||||
stock: 1,
|
stock: 1,
|
||||||
cateId: 0
|
cateId: 0,
|
||||||
|
ids: [],
|
||||||
|
couponScope: null
|
||||||
|
|
||||||
})
|
})
|
||||||
const multipleSelection = ref([])
|
const multipleSelection = ref([])
|
||||||
const initCouponForm = () => {
|
const initCouponForm = () => {
|
||||||
@ -540,16 +543,23 @@ const close = () => {
|
|||||||
const getProductList = async () => {
|
const getProductList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
|
if (visitDetail.value) {
|
||||||
|
queryParams.couponScope = formData.value.couponScope
|
||||||
|
queryParams.ids = JSON.parse(formData.value.scopeValues);
|
||||||
|
const listData = await StoreProductApi.getSelectProductPage(queryParams)
|
||||||
|
productList.value = listData.list
|
||||||
|
productTotal.value = listData.total
|
||||||
|
} else {
|
||||||
const listData = await StoreProductApi.getStoreProductPage(queryParams)
|
const listData = await StoreProductApi.getStoreProductPage(queryParams)
|
||||||
productList.value = listData.list
|
productList.value = listData.list
|
||||||
productTotal.value = listData.total
|
productTotal.value = listData.total
|
||||||
// 点击编辑时回显表格勾选
|
// 点击编辑时回显表格勾选
|
||||||
for (let i = 0; i < productList.value.length; i++) {
|
for (let i = 0; i < productList.value.length; i++) {
|
||||||
if (idList.value.includes(productList.value[i].id)) {
|
if (idList.value.includes(productList.value[i].id)) {
|
||||||
console.log(productList.value[i].id, 'testslkdfjlkds')
|
|
||||||
multipleTableRef.value.toggleRowSelection(productList.value[i])
|
multipleTableRef.value.toggleRowSelection(productList.value[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
210
src/views/system/storeBackupRecord/index.vue
Normal file
210
src/views/system/storeBackupRecord/index.vue
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
<template>
|
||||||
|
<ContentWrap>
|
||||||
|
<div class="search-row flex justify-between">
|
||||||
|
<div>
|
||||||
|
<el-button
|
||||||
|
plain
|
||||||
|
type="primary"
|
||||||
|
@click="doCreateStoreBackupRecord"
|
||||||
|
>备份
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
plain
|
||||||
|
:disabled="tableList.length<=0"
|
||||||
|
type="danger"
|
||||||
|
@click="doRollbackRecord"
|
||||||
|
>还原备份
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
plain
|
||||||
|
type="warning"
|
||||||
|
v-if="currentRow && false"
|
||||||
|
@click="handleClearCurrent"
|
||||||
|
>清除选择
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ContentWrap>
|
||||||
|
<ContentWrap>
|
||||||
|
<el-table
|
||||||
|
ref="tableRef"
|
||||||
|
highlight-current-row
|
||||||
|
v-loading="loading"
|
||||||
|
:data="tableList"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
label="ID"
|
||||||
|
align="center"
|
||||||
|
prop="id"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
label="创建人ID"
|
||||||
|
align="center"
|
||||||
|
prop="creator"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="创建人名称"
|
||||||
|
align="center"
|
||||||
|
prop="creatorName"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
prop="createTime"
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="修改人ID"
|
||||||
|
align="center"
|
||||||
|
prop="updater"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="修改人名称"
|
||||||
|
align="center"
|
||||||
|
prop="updaterName"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="修改时间"
|
||||||
|
align="center"
|
||||||
|
prop="updateTime"
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
/>
|
||||||
|
</el-table>
|
||||||
|
<Pagination
|
||||||
|
:total="tableTotal"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="doGetList"
|
||||||
|
/>
|
||||||
|
</ContentWrap>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import ContentWrap from "@/components/ContentWrap/src/ContentWrap.vue";
|
||||||
|
import { createStoreBackupRecord, getStoreBackupRecordPage, rollbackBackupRecord } from "@/api/system/storeBackupRecord";
|
||||||
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
|
import { dateFormatter } from "@/utils/formatTime";
|
||||||
|
import { CACHE_KEY, useCache } from "@/hooks/web/useCache";
|
||||||
|
|
||||||
|
const {wsCache} = useCache();
|
||||||
|
const tableRef = ref()
|
||||||
|
const loading = ref(true) // 列表的加载中
|
||||||
|
const tableTotal = ref(0) // 总数
|
||||||
|
const tableList = ref([]) // 表格
|
||||||
|
|
||||||
|
// 分页参数
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取列表
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async function doGetList() {
|
||||||
|
try {
|
||||||
|
loading.value = true
|
||||||
|
const {list, total} = await getStoreBackupRecordPage(queryParams);
|
||||||
|
tableList.value = list
|
||||||
|
tableTotal.value = total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备份
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
function doCreateStoreBackupRecord() {
|
||||||
|
const {flag, time} = verifyTime(0);
|
||||||
|
if (!flag) {
|
||||||
|
ElMessage.warning(`${ time }秒后才能操作`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ElMessageBox.confirm('确定要备份吗?', '提示', {
|
||||||
|
confirmButtonText: '备份',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: "info",
|
||||||
|
}).then(async () => {
|
||||||
|
await createStoreBackupRecord()
|
||||||
|
ElMessage.success('备份成功')
|
||||||
|
wsCache.set(CACHE_KEY.BACK_UP, Date.now())
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
await doGetList()
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 还原备份
|
||||||
|
*/
|
||||||
|
function doRollbackRecord() {
|
||||||
|
const {flag, time} = verifyTime(1);
|
||||||
|
if (!flag) {
|
||||||
|
ElMessage.warning(`${ time }秒后才能操作`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ElMessageBox.confirm('确定要还原备份吗?', '警告', {
|
||||||
|
confirmButtonText: '备份',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: "warning",
|
||||||
|
}).then(async () => {
|
||||||
|
await rollbackBackupRecord()
|
||||||
|
ElMessage.success('还原成功')
|
||||||
|
wsCache.set(CACHE_KEY.RESTORE, Date.now())
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
await doGetList()
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验时间
|
||||||
|
* @param {0|1} type 0备份 1还原
|
||||||
|
* @returns {{flag:boolean,time:number}}
|
||||||
|
*/
|
||||||
|
function verifyTime(type) {
|
||||||
|
const delayTime = 5 * 1000 * 60
|
||||||
|
const nowTime = Date.now()
|
||||||
|
const doTime = wsCache.get(type === 0 ? CACHE_KEY.BACK_UP : CACHE_KEY.RESTORE);
|
||||||
|
const diff = nowTime - doTime
|
||||||
|
if (!doTime) return ({
|
||||||
|
flag: true,
|
||||||
|
time: 0
|
||||||
|
})
|
||||||
|
if (diff < delayTime) return ({
|
||||||
|
flag: false,
|
||||||
|
time: Math.floor((delayTime - diff) / 1000)
|
||||||
|
})
|
||||||
|
else return ({
|
||||||
|
flag: true,
|
||||||
|
time: 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 👇选中行相关👇 */
|
||||||
|
const currentRow = ref(void (0)) // 当前选中的行
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选中行
|
||||||
|
* @param val
|
||||||
|
*/
|
||||||
|
function handleCurrentChange(val) {
|
||||||
|
currentRow.value = val
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除选中
|
||||||
|
*/
|
||||||
|
function handleClearCurrent() {
|
||||||
|
tableRef.value.setCurrentRow()
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
doGetList()
|
||||||
|
})
|
||||||
|
</script>
|
Reference in New Issue
Block a user