套餐详情增加查看附件功能
This commit is contained in:
@@ -26,10 +26,12 @@ import com.bms.common.enums.BusinessType;
|
|||||||
import com.bms.common.utils.MessageUtils;
|
import com.bms.common.utils.MessageUtils;
|
||||||
import com.bms.common.utils.StringUtils;
|
import com.bms.common.utils.StringUtils;
|
||||||
import com.bms.price.domain.PrcCustomerPriceSet;
|
import com.bms.price.domain.PrcCustomerPriceSet;
|
||||||
|
import com.bms.price.domain.PrcPriceExcelFile;
|
||||||
import com.bms.price.domain.PrcPriceSet;
|
import com.bms.price.domain.PrcPriceSet;
|
||||||
import com.bms.price.domain.PrcPriceSetDetail;
|
import com.bms.price.domain.PrcPriceSetDetail;
|
||||||
import com.bms.price.domain.PrcPriceSetSaveTask;
|
import com.bms.price.domain.PrcPriceSetSaveTask;
|
||||||
import com.bms.price.domain.PrcPriceSetVersion;
|
import com.bms.price.domain.PrcPriceSetVersion;
|
||||||
|
import com.bms.price.service.IPrcPriceExcelFileService;
|
||||||
import com.bms.price.service.IPrcPriceSetService;
|
import com.bms.price.service.IPrcPriceSetService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,6 +46,9 @@ public class PriceSetController extends BaseController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IPrcPriceSetService priceSetService;
|
private IPrcPriceSetService priceSetService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IPrcPriceExcelFileService priceExcelFileService;
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('price:set:list')")
|
@PreAuthorize("@ss.hasPermi('price:set:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(PrcPriceSet set)
|
public TableDataInfo list(PrcPriceSet set)
|
||||||
@@ -162,6 +167,15 @@ public class PriceSetController extends BaseController
|
|||||||
return toAjax(priceSetService.deleteVersion(psvId, getUsername()));
|
return toAjax(priceSetService.deleteVersion(psvId, getUsername()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Import excel attachments for a version (via prc_price_set_product.psv_id / pef_id). */
|
||||||
|
@PreAuthorize("@ss.hasPermi('price:set:list')")
|
||||||
|
@GetMapping("/version/{psvId}/excelFiles")
|
||||||
|
public AjaxResult versionExcelFiles(@PathVariable Long psvId)
|
||||||
|
{
|
||||||
|
List<PrcPriceExcelFile> list = priceExcelFileService.selectByPsvId(psvId);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('price:set:audit')")
|
@PreAuthorize("@ss.hasPermi('price:set:audit')")
|
||||||
@Log(title = "Price set disable", businessType = BusinessType.UPDATE)
|
@Log(title = "Price set disable", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/disable/{priceSetId}")
|
@PutMapping("/disable/{priceSetId}")
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ public interface PrcPriceExcelFileMapper
|
|||||||
|
|
||||||
public List<PrcPriceExcelFile> selectByRedlineProductCode(@Param("productCode") String productCode);
|
public List<PrcPriceExcelFile> selectByRedlineProductCode(@Param("productCode") String productCode);
|
||||||
|
|
||||||
|
/** Distinct excel files linked by prc_price_set_product.pef_id for a version. */
|
||||||
|
public List<PrcPriceExcelFile> selectByPsvId(@Param("psvId") Long psvId);
|
||||||
|
|
||||||
public int insertPrcPriceExcelFile(PrcPriceExcelFile row);
|
public int insertPrcPriceExcelFile(PrcPriceExcelFile row);
|
||||||
|
|
||||||
public int updatePrcPriceExcelFile(PrcPriceExcelFile row);
|
public int updatePrcPriceExcelFile(PrcPriceExcelFile row);
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ public interface IPrcPriceExcelFileService
|
|||||||
|
|
||||||
List<PrcPriceExcelFile> selectByRedlineProductCode(String productCode);
|
List<PrcPriceExcelFile> selectByRedlineProductCode(String productCode);
|
||||||
|
|
||||||
|
/** Import excel files for a price-set version via prc_price_set_product.psv_id. */
|
||||||
|
List<PrcPriceExcelFile> selectByPsvId(Long psvId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persist uploaded Excel under upload/price/excel and insert metadata row.
|
* Persist uploaded Excel under upload/price/excel and insert metadata row.
|
||||||
*
|
*
|
||||||
|
|||||||
+11
@@ -59,6 +59,17 @@ public class PrcPriceExcelFileServiceImpl implements IPrcPriceExcelFileService
|
|||||||
return list == null ? java.util.Collections.emptyList() : list;
|
return list == null ? java.util.Collections.emptyList() : list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PrcPriceExcelFile> selectByPsvId(Long psvId)
|
||||||
|
{
|
||||||
|
if (psvId == null)
|
||||||
|
{
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
List<PrcPriceExcelFile> list = excelFileMapper.selectByPsvId(psvId);
|
||||||
|
return list == null ? Collections.emptyList() : list;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PrcPriceExcelFile saveImportExcel(String excelType, Date effectiveTime, byte[] bytes,
|
public PrcPriceExcelFile saveImportExcel(String excelType, Date effectiveTime, byte[] bytes,
|
||||||
String filename, String operName) throws Exception
|
String filename, String operName) throws Exception
|
||||||
|
|||||||
@@ -125,4 +125,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
order by f.effective_time desc, f.pef_id desc
|
order by f.effective_time desc, f.pef_id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByPsvId" resultMap="PrcPriceExcelFileResult">
|
||||||
|
select distinct f.pef_id, f.excel_type, f.effective_time, f.file_name, f.file_path, f.file_size,
|
||||||
|
f.content_type, f.file_extension, f.oss_id, f.sheet_names, f.remark,
|
||||||
|
f.created_by, f.create_time, f.updated_by, f.update_time
|
||||||
|
from prc_price_excel_file f
|
||||||
|
inner join prc_price_set_product psp on psp.pef_id = f.pef_id
|
||||||
|
where psp.psv_id = #{psvId}
|
||||||
|
and psp.pef_id is not null
|
||||||
|
order by f.effective_time desc, f.pef_id desc
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -136,6 +136,14 @@ export function createPriceSetVersion(priceSetId) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Import excel attachments for a price-set version (via prc_price_set_product.psv_id). */
|
||||||
|
export function listPriceSetVersionExcelFiles(psvId) {
|
||||||
|
return request({
|
||||||
|
url: '/price/set/version/' + psvId + '/excelFiles',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function deletePriceSetVersion(psvId) {
|
export function deletePriceSetVersion(psvId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/price/set/version/' + psvId,
|
url: '/price/set/version/' + psvId,
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
<template>
|
||||||
|
<el-drawer v-model="visible" size="860px" :title="title" append-to-body>
|
||||||
|
<el-table v-loading="loading" :data="list" border max-height="calc(100vh - 160px)" empty-text="该版本暂无导入附件">
|
||||||
|
<el-table-column label="文件名称" prop="fileName" min-width="220" show-overflow-tooltip />
|
||||||
|
<el-table-column label="生效时间" prop="effectiveTime" width="170" align="center" />
|
||||||
|
<el-table-column label="大小" width="100" align="right">
|
||||||
|
<template #default="{ row }">{{ formatSize(row.fileSize) }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="上传人" prop="createBy" width="110" align="center" show-overflow-tooltip />
|
||||||
|
<el-table-column label="上传时间" prop="createTime" width="170" align="center" />
|
||||||
|
<el-table-column label="操作" width="90" align="center" fixed="right">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button link type="primary" :disabled="!row.filePath" @click="handleDownload(row)">下载</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { listPriceSetVersionExcelFiles } from '@/api/price/set'
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
|
const visible = ref(false)
|
||||||
|
const title = ref('')
|
||||||
|
const loading = ref(false)
|
||||||
|
const list = ref([])
|
||||||
|
const version = ref(null)
|
||||||
|
|
||||||
|
function open(row) {
|
||||||
|
version.value = row
|
||||||
|
const no = (row && row.versionNo) || ''
|
||||||
|
title.value = no ? (no + ' · 导入附件') : '导入附件'
|
||||||
|
visible.value = true
|
||||||
|
loadList()
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadList() {
|
||||||
|
if (!version.value || version.value.psvId == null) return
|
||||||
|
loading.value = true
|
||||||
|
listPriceSetVersionExcelFiles(version.value.psvId).then(res => {
|
||||||
|
list.value = res.data || []
|
||||||
|
}).finally(() => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatSize(bytes) {
|
||||||
|
const n = Number(bytes)
|
||||||
|
if (!n || n < 0) return '-'
|
||||||
|
if (n < 1024) return n + ' B'
|
||||||
|
if (n < 1024 * 1024) return (n / 1024).toFixed(1) + ' KB'
|
||||||
|
return (n / (1024 * 1024)).toFixed(2) + ' MB'
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDownload(row) {
|
||||||
|
if (!row || !row.filePath) {
|
||||||
|
proxy.$modal.msgWarning('文件路径不存在')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
proxy.$download.resource(row.filePath)
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ open })
|
||||||
|
</script>
|
||||||
@@ -38,9 +38,10 @@
|
|||||||
<el-table-column :label="colRows" width="100" align="center">
|
<el-table-column :label="colRows" width="100" align="center">
|
||||||
<template #default="{ row }">{{ detailCount(row) }}</template>
|
<template #default="{ row }">{{ detailCount(row) }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="colAction" width="380" align="center" fixed="right">
|
<el-table-column :label="colAction" width="460" align="center" fixed="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button link type="primary" @click="openDetails(row)">查看详情</el-button>
|
<el-button link type="primary" @click="openDetails(row)">查看详情</el-button>
|
||||||
|
<el-button link type="primary" @click="emit('view-import-attach', row)">查看附件</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="showEditButton(row)"
|
v-if="showEditButton(row)"
|
||||||
link
|
link
|
||||||
@@ -90,7 +91,7 @@ const props = defineProps({
|
|||||||
versions: { type: Array, default: () => [] },
|
versions: { type: Array, default: () => [] },
|
||||||
modelValue: { type: [Number, String], default: undefined }
|
modelValue: { type: [Number, String], default: undefined }
|
||||||
})
|
})
|
||||||
const emit = defineEmits(['update:modelValue', 'copy-version', 'create-version', 'open-details', 'activate', 'reschedule', 'edit', 'remove'])
|
const emit = defineEmits(['update:modelValue', 'copy-version', 'create-version', 'open-details', 'view-import-attach', 'activate', 'reschedule', 'edit', 'remove'])
|
||||||
|
|
||||||
const title = '套餐版本'
|
const title = '套餐版本'
|
||||||
const colNo = '版本号'
|
const colNo = '版本号'
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
@copy-version="onCopyVersion"
|
@copy-version="onCopyVersion"
|
||||||
@create-version="onCreateVersion"
|
@create-version="onCreateVersion"
|
||||||
@open-details="onOpenVersionDetails"
|
@open-details="onOpenVersionDetails"
|
||||||
|
@view-import-attach="onViewImportAttach"
|
||||||
@activate="onActivateVersion"
|
@activate="onActivateVersion"
|
||||||
@reschedule="onRescheduleVersion"
|
@reschedule="onRescheduleVersion"
|
||||||
@edit="onEditVersion"
|
@edit="onEditVersion"
|
||||||
@@ -37,6 +38,7 @@
|
|||||||
:version="detailVersion"
|
:version="detailVersion"
|
||||||
:set-type="set.setType"
|
:set-type="set.setType"
|
||||||
/>
|
/>
|
||||||
|
<set-version-excel-file-drawer ref="versionExcelDrawerRef" />
|
||||||
|
|
||||||
<el-dialog
|
<el-dialog
|
||||||
v-model="activateVisible"
|
v-model="activateVisible"
|
||||||
@@ -81,6 +83,7 @@ import SetBasicInfoCard from './components/detail/SetBasicInfoCard.vue'
|
|||||||
import SetCustomerTable from './components/detail/SetCustomerTable.vue'
|
import SetCustomerTable from './components/detail/SetCustomerTable.vue'
|
||||||
import SetVersionTable from './components/detail/SetVersionTable.vue'
|
import SetVersionTable from './components/detail/SetVersionTable.vue'
|
||||||
import SetVersionDetailDrawer from './components/detail/SetVersionDetailDrawer.vue'
|
import SetVersionDetailDrawer from './components/detail/SetVersionDetailDrawer.vue'
|
||||||
|
import SetVersionExcelFileDrawer from './components/detail/SetVersionExcelFileDrawer.vue'
|
||||||
import PriceEditPanel from './components/create/PriceEditPanel.vue'
|
import PriceEditPanel from './components/create/PriceEditPanel.vue'
|
||||||
import { usePriceSetRefData } from './composables/usePriceSetRefData'
|
import { usePriceSetRefData } from './composables/usePriceSetRefData'
|
||||||
import {
|
import {
|
||||||
@@ -98,6 +101,7 @@ const set = ref({})
|
|||||||
const currentPsvId = ref()
|
const currentPsvId = ref()
|
||||||
const detailDrawerVisible = ref(false)
|
const detailDrawerVisible = ref(false)
|
||||||
const detailVersion = ref(null)
|
const detailVersion = ref(null)
|
||||||
|
const versionExcelDrawerRef = ref()
|
||||||
const editVisible = ref(false)
|
const editVisible = ref(false)
|
||||||
const editPsvId = ref(undefined)
|
const editPsvId = ref(undefined)
|
||||||
|
|
||||||
@@ -106,6 +110,11 @@ function onOpenVersionDetails(row) {
|
|||||||
detailDrawerVisible.value = true
|
detailDrawerVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onViewImportAttach(row) {
|
||||||
|
if (!row || row.psvId == null) return
|
||||||
|
versionExcelDrawerRef.value?.open?.(row)
|
||||||
|
}
|
||||||
|
|
||||||
function load() {
|
function load() {
|
||||||
const id = route.query.priceSetId
|
const id = route.query.priceSetId
|
||||||
if (!id) return
|
if (!id) return
|
||||||
|
|||||||
Reference in New Issue
Block a user