mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-09-23 05:46:40 +08:00
feat(customer-info): 添加客户版本文件管理功能
- 新增客户版本文件 API 和相关组件 - 实现客户版本文件的查询、添加、编辑和删除功能 - 添加推送生产版本功能 - 优化客户信息列表,增加生产版本显示
This commit is contained in:
parent
d50a6cf958
commit
37ea0626d5
@ -16,6 +16,14 @@ export const customerInfoApi = {
|
||||
return postRequest('/customerInfo/queryPage', param);
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询客户名称id列表 @author hc
|
||||
*/
|
||||
queryNameAndId : () => {
|
||||
return postRequest('/customerInfo/queryNameAndId');
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 增加 @author hc
|
||||
*/
|
||||
|
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* 版本文件 api 封装
|
||||
*
|
||||
* @Author: hc
|
||||
* @Date: 2024-12-05 14:08:23
|
||||
* @Copyright zb
|
||||
*/
|
||||
import { postRequest, getRequest } from '/@/lib/axios';
|
||||
|
||||
export const customerVersionFileApi = {
|
||||
|
||||
/**
|
||||
* 分页查询 @author hc
|
||||
*/
|
||||
queryPage : (param) => {
|
||||
return postRequest('/customerVersionFile/queryPage', param);
|
||||
},
|
||||
/**
|
||||
* 推送生产版本 @author hc
|
||||
*/
|
||||
pushProVersion : (param) => {
|
||||
return postRequest('/customerVersionFile/pushProVersion', param);
|
||||
},
|
||||
|
||||
/**
|
||||
* 增加 @author hc
|
||||
*/
|
||||
add: (param) => {
|
||||
return postRequest('/customerVersionFile/add', param);
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改 @author hc
|
||||
*/
|
||||
update: (param) => {
|
||||
return postRequest('/customerVersionFile/update', param);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 删除 @author hc
|
||||
*/
|
||||
delete: (id) => {
|
||||
return getRequest(`/customerVersionFile/delete/${id}`);
|
||||
},
|
||||
|
||||
/**
|
||||
* 批量删除 @author hc
|
||||
*/
|
||||
batchDelete: (idList) => {
|
||||
return postRequest('/customerVersionFile/batchDelete', idList);
|
||||
},
|
||||
|
||||
};
|
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* 版本文件 枚举
|
||||
*
|
||||
* @Author: hc
|
||||
* @Date: 2024-12-05 14:08:23
|
||||
* @Copyright zb
|
||||
*/
|
||||
|
||||
|
||||
export default {
|
||||
};
|
@ -74,6 +74,7 @@
|
||||
|
||||
const formDefault = {
|
||||
customerName: undefined, //客户名称
|
||||
customerId: undefined, //客户id
|
||||
customerKey: undefined, //客户拉取jar包密钥
|
||||
};
|
||||
|
||||
|
@ -78,6 +78,7 @@
|
||||
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<div class="smart-table-operate">
|
||||
<a-button @click="showProVersion(record)" type="link">生产版本</a-button>
|
||||
<a-button @click="showForm(record)" type="link">编辑</a-button>
|
||||
<a-button @click="onDelete(record)" danger type="link">删除</a-button>
|
||||
</div>
|
||||
@ -130,11 +131,16 @@
|
||||
dataIndex: 'customerKey',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '当前生产版本',
|
||||
dataIndex: 'productionVersion',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
fixed: 'right',
|
||||
width: 90,
|
||||
width: 180,
|
||||
},
|
||||
]);
|
||||
|
||||
@ -191,6 +197,12 @@
|
||||
formRef.value.show(data);
|
||||
}
|
||||
|
||||
// ---------------------------- 显示生产版本详细信息 ----------------------------
|
||||
|
||||
function showProVersion(data) {
|
||||
formRef.value.show(data);
|
||||
}
|
||||
|
||||
// ---------------------------- 单个删除 ----------------------------
|
||||
//确认删除
|
||||
function onDelete(data){
|
||||
|
@ -0,0 +1,177 @@
|
||||
<!--
|
||||
* 版本文件
|
||||
*
|
||||
* @Author: hc
|
||||
* @Date: 2024-12-05 14:08:23
|
||||
* @Copyright zb
|
||||
-->
|
||||
<template>
|
||||
<a-drawer
|
||||
:title="form.customerInfoId ? '编辑' : '添加'"
|
||||
:width="500"
|
||||
:open="visibleFlag"
|
||||
@close="onClose"
|
||||
:maskClosable="false"
|
||||
:destroyOnClose="true"
|
||||
>
|
||||
<a-form ref="formRef" :model="form" :rules="rules" :label-col="{ span: 5 }" >
|
||||
<a-form-item label="客户" name="customerInfoId">
|
||||
<a-select
|
||||
v-model:value="value"
|
||||
show-search
|
||||
placeholder="选择客户"
|
||||
style="width: 200px"
|
||||
:options="options"
|
||||
:filter-option="filterOption"
|
||||
@change="handleChange"
|
||||
></a-select>
|
||||
<!-- <SmartEnumSelect width="100%" v-model:value="form.customerInfoId" enumName="" placeholder="客户id"/>-->
|
||||
</a-form-item>
|
||||
<a-form-item label="jar包" name="fileName" v-show="!form.customerInfoId">
|
||||
<FileUpload
|
||||
:maxSize="500"
|
||||
:maxUploadSize="1"
|
||||
:defaultFileList="form.file"
|
||||
:folder="FILE_FOLDER_TYPE_ENUM.COMMON.value"
|
||||
buttonText="上传 jar包"
|
||||
listType="text"
|
||||
@change="uploadFile"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="版本号" name="versionNumber">
|
||||
<a-input style="width: 100%" v-model:value="form.versionNumber" placeholder="版本号" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
<template #footer>
|
||||
<a-space>
|
||||
<a-button @click="onClose">取消</a-button>
|
||||
<a-button type="primary" @click="onSubmit">保存</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-drawer>
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive, ref, nextTick } from 'vue';
|
||||
import _ from 'lodash';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
import { customerVersionFileApi } from '/@/api/business/customer-info/customer-version-file-api';
|
||||
import { smartSentry } from '/@/lib/smart-sentry';
|
||||
import FileUpload from '/@/components/support/file-upload/index.vue';
|
||||
import { FILE_FOLDER_TYPE_ENUM } from '/@/constants/support/file-const';
|
||||
import {customerInfoApi} from "/@/api/business/customer-info/customer-info-api.js";
|
||||
|
||||
// ------------------------ 事件 ------------------------
|
||||
|
||||
const emits = defineEmits(['reloadList']);
|
||||
|
||||
// ------------------------ 显示与隐藏 ------------------------
|
||||
// 是否显示
|
||||
const visibleFlag = ref(false);
|
||||
|
||||
const options = ref([]);
|
||||
|
||||
async function show(rowData) {
|
||||
let nameAndId = await customerInfoApi.queryNameAndId();
|
||||
options.value = nameAndId.data.map(item => {
|
||||
return {
|
||||
label: item.customerName,
|
||||
value: item.customerId
|
||||
}
|
||||
})
|
||||
Object.assign(form, formDefault);
|
||||
if (rowData && !_.isEmpty(rowData)) {
|
||||
Object.assign(form, rowData);
|
||||
}
|
||||
// 使用字典时把下面这注释修改成自己的字典字段 有多个字典字段就复制多份同理修改 不然打开表单时不显示字典初始值
|
||||
// if (form.status && form.status.length > 0) {
|
||||
// form.status = form.status.map((e) => e.valueCode);
|
||||
// }
|
||||
visibleFlag.value = true;
|
||||
nextTick(() => {
|
||||
formRef.value.clearValidate();
|
||||
});
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
Object.assign(form, formDefault);
|
||||
visibleFlag.value = false;
|
||||
}
|
||||
|
||||
// ------------------------ 表单 ------------------------
|
||||
|
||||
// 组件ref
|
||||
const formRef = ref();
|
||||
|
||||
// const fileValue = ref()
|
||||
|
||||
const formDefault = {
|
||||
id: undefined, //主键id
|
||||
customerInfoId: undefined, //客户id
|
||||
fileName: undefined, //jar包名称
|
||||
fileKey: undefined, //文件key
|
||||
versionNumber: undefined, //版本号
|
||||
};
|
||||
|
||||
let form = reactive({ ...formDefault });
|
||||
|
||||
const rules = {
|
||||
customerInfoId: [{ required: true, message: '客户id 必选' }],
|
||||
versionNumber: [{ required: true, message: '版本号 必填' }],
|
||||
};
|
||||
|
||||
// 点击确定,验证表单
|
||||
async function onSubmit() {
|
||||
try {
|
||||
await formRef.value.validateFields();
|
||||
save();
|
||||
// console.log("form",form)
|
||||
} catch (err) {
|
||||
message.error('参数验证错误,请仔细填写表单数据!');
|
||||
}
|
||||
}
|
||||
|
||||
// 新建、编辑API
|
||||
async function save() {
|
||||
SmartLoading.show();
|
||||
try {
|
||||
if (form.customerInfoId) {
|
||||
let updateParam = {
|
||||
id: form.id,
|
||||
versionNumber: form.versionNumber
|
||||
}
|
||||
await customerVersionFileApi.update(updateParam);
|
||||
} else {
|
||||
await customerVersionFileApi.add(form);
|
||||
}
|
||||
message.success('操作成功');
|
||||
emits('reloadList');
|
||||
onClose();
|
||||
} catch (err) {
|
||||
smartSentry.captureError(err);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 上传文件
|
||||
const uploadFile = value => {
|
||||
form.fileKey = value[0].fileKey;
|
||||
};
|
||||
|
||||
// ------------------------ 下拉列表数据 ------------------------
|
||||
const handleChange = value => {
|
||||
form.customerInfoId = value;
|
||||
};
|
||||
const filterOption = (input, option) => {
|
||||
return option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
};
|
||||
const value = ref(undefined);
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
});
|
||||
|
||||
</script>
|
@ -0,0 +1,330 @@
|
||||
<!--
|
||||
* 版本文件
|
||||
*
|
||||
* @Author: hc
|
||||
* @Date: 2024-12-05 14:08:23
|
||||
* @Copyright zb
|
||||
-->
|
||||
<template>
|
||||
<!---------- 查询表单form begin ----------->
|
||||
<a-form class="smart-query-form">
|
||||
<a-row class="smart-query-form-row">
|
||||
<a-form-item label="客户" class="smart-query-form-item">
|
||||
<a-input style="width: 200px" v-model:value="queryForm.name" placeholder="客户" />
|
||||
</a-form-item>
|
||||
<a-form-item class="smart-query-form-item">
|
||||
<a-button type="primary" @click="onSearch">
|
||||
<template #icon>
|
||||
<SearchOutlined />
|
||||
</template>
|
||||
查询
|
||||
</a-button>
|
||||
<a-button @click="resetQuery" class="smart-margin-left10">
|
||||
<template #icon>
|
||||
<ReloadOutlined />
|
||||
</template>
|
||||
重置
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
</a-row>
|
||||
</a-form>
|
||||
<!---------- 查询表单form end ----------->
|
||||
|
||||
<a-card size="small" :bordered="false" :hoverable="true">
|
||||
<!---------- 表格操作行 begin ----------->
|
||||
<a-row class="smart-table-btn-block">
|
||||
<div class="smart-table-operate-block">
|
||||
<a-button @click="showForm" type="primary" size="small">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
新建
|
||||
</a-button>
|
||||
<a-button @click="confirmBatchDelete" type="primary" danger size="small" :disabled="selectedRowKeyList.length == 0">
|
||||
<template #icon>
|
||||
<DeleteOutlined />
|
||||
</template>
|
||||
批量删除
|
||||
</a-button>
|
||||
</div>
|
||||
<div class="smart-table-setting-block">
|
||||
<TableOperator v-model="columns" :tableId="null" :refresh="queryData" />
|
||||
</div>
|
||||
</a-row>
|
||||
<!---------- 表格操作行 end ----------->
|
||||
|
||||
<!---------- 表格 begin ----------->
|
||||
<a-table
|
||||
size="small"
|
||||
:dataSource="tableData"
|
||||
:columns="columns"
|
||||
rowKey="id"
|
||||
bordered
|
||||
:loading="tableLoading"
|
||||
:pagination="false"
|
||||
:row-selection="{ selectedRowKeys: selectedRowKeyList, onChange: onSelectChange }"
|
||||
>
|
||||
<template #bodyCell="{ text, record, column }">
|
||||
|
||||
<!-- 有图片预览时 注释解开并把下面的'picture'修改成自己的图片字段名即可 -->
|
||||
<!-- <template v-if="column.dataIndex === 'picture'">
|
||||
<FilePreview :fileList="text" type="picture" />
|
||||
</template> -->
|
||||
|
||||
<!-- 使用字典时 注释解开并把下面的'dict'修改成自己的字典字段名即可 有多个字典字段就复制多份同理修改 不然不显示字典 -->
|
||||
<!-- 方便修改tag的颜色 orange green purple success processing error default warning -->
|
||||
<!-- <template v-if="column.dataIndex === 'dict'">
|
||||
<a-tag color="cyan">
|
||||
{{ text && text.length > 0 ? text.map((e) => e.valueName).join(',') : '暂无' }}
|
||||
</a-tag>
|
||||
</template> -->
|
||||
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<div class="smart-table-operate">
|
||||
<a-button @click="pushProVersion(record)" type="link">推送版本</a-button>
|
||||
<a-button @click="showForm(record)" type="link">编辑</a-button>
|
||||
<a-button @click="onDelete(record)" danger type="link">删除</a-button>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
<!---------- 表格 end ----------->
|
||||
|
||||
<div class="smart-query-table-page">
|
||||
<a-pagination
|
||||
showSizeChanger
|
||||
showQuickJumper
|
||||
show-less-items
|
||||
:pageSizeOptions="PAGE_SIZE_OPTIONS"
|
||||
:defaultPageSize="queryForm.pageSize"
|
||||
v-model:current="queryForm.pageNum"
|
||||
v-model:pageSize="queryForm.pageSize"
|
||||
:total="total"
|
||||
@change="queryData"
|
||||
@showSizeChange="queryData"
|
||||
:show-total="(total) => `共${total}条`"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<CustomerVersionFileForm ref="formRef" @reloadList="queryData"/>
|
||||
|
||||
</a-card>
|
||||
</template>
|
||||
<script setup>
|
||||
import {reactive, ref, onMounted, nextTick} from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { SmartLoading } from '/src/components/framework/smart-loading';
|
||||
import { customerVersionFileApi } from '/src/api/business/customer-info/customer-version-file-api';
|
||||
import { PAGE_SIZE_OPTIONS } from '/src/constants/common-const';
|
||||
import { smartSentry } from '/src/lib/smart-sentry';
|
||||
import TableOperator from '/src/components/support/table-operator/index.vue';
|
||||
import CustomerVersionFileForm from './customer-version-file-form.vue';
|
||||
import _ from "lodash";
|
||||
//import FilePreview from '/@/components/support/file-preview/index.vue'; // 图片预览组件
|
||||
|
||||
// ---------------------------- 表格列 ----------------------------
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
title: '客户名称',
|
||||
dataIndex: 'customerInfoName',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: 'jar包名称',
|
||||
dataIndex: 'fileName',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '文件key',
|
||||
dataIndex: 'fileKey',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '版本号',
|
||||
dataIndex: 'versionNumber',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
fixed: 'right',
|
||||
width: 180,
|
||||
},
|
||||
]);
|
||||
|
||||
// ---------------------------- 查询数据表单和方法 ----------------------------
|
||||
|
||||
const queryFormState = {
|
||||
name: undefined, //客户
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
};
|
||||
// 查询表单form
|
||||
const queryForm = reactive({ ...queryFormState });
|
||||
// 表格加载loading
|
||||
const tableLoading = ref(false);
|
||||
// 表格数据
|
||||
const tableData = ref([]);
|
||||
// 总数
|
||||
const total = ref(0);
|
||||
|
||||
// 重置查询条件
|
||||
function resetQuery() {
|
||||
let pageSize = queryForm.pageSize;
|
||||
Object.assign(queryForm, queryFormState);
|
||||
queryForm.pageSize = pageSize;
|
||||
queryData();
|
||||
}
|
||||
|
||||
// 搜索
|
||||
function onSearch(){
|
||||
queryForm.pageNum = 1;
|
||||
queryData();
|
||||
}
|
||||
|
||||
// 查询数据
|
||||
async function queryData() {
|
||||
tableLoading.value = true;
|
||||
try {
|
||||
let queryResult = await customerVersionFileApi.queryPage(queryForm);
|
||||
tableData.value = queryResult.data.list;
|
||||
total.value = queryResult.data.total;
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
tableLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onMounted(queryData);
|
||||
|
||||
// ---------------------------- 添加/修改 ----------------------------
|
||||
const formRef = ref();
|
||||
|
||||
function showForm(data) {
|
||||
formRef.value.show(data);
|
||||
}
|
||||
// ---------------------------- 推送生产版本 ----------------------------
|
||||
function pushProVersion(data) {
|
||||
let pusData={
|
||||
"customerInfoId":null,
|
||||
"versionId":null
|
||||
};
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定推送',
|
||||
okText: '推送',
|
||||
okType: 'danger',
|
||||
onOk() {
|
||||
pusData.customerInfoId=data.customerInfoId;
|
||||
pusData.versionId=data.id;
|
||||
customerVersionFileApi.pushProVersion(pusData).then(res=>{
|
||||
if(res.ok){
|
||||
message.success(res.msg);
|
||||
}else{
|
||||
message.error(res.msg);
|
||||
}
|
||||
})
|
||||
},
|
||||
cancelText: '取消',
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------- 单个删除 ----------------------------
|
||||
//确认删除
|
||||
function onDelete(data){
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选吗?',
|
||||
okText: '删除',
|
||||
okType: 'danger',
|
||||
onOk() {
|
||||
requestDelete(data);
|
||||
},
|
||||
cancelText: '取消',
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
|
||||
//请求删除
|
||||
async function requestDelete(data){
|
||||
SmartLoading.show();
|
||||
try {
|
||||
let deleteForm = {
|
||||
goodsIdList: selectedRowKeyList.value,
|
||||
};
|
||||
await customerVersionFileApi.delete(data.id);
|
||||
message.success('删除成功');
|
||||
queryData();
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------- 批量删除 ----------------------------
|
||||
|
||||
// 选择表格行
|
||||
const selectedRowKeyList = ref([]);
|
||||
|
||||
function onSelectChange(selectedRowKeys) {
|
||||
selectedRowKeyList.value = selectedRowKeys;
|
||||
}
|
||||
|
||||
// 批量删除
|
||||
function confirmBatchDelete() {
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要批量删除这些数据吗?',
|
||||
okText: '删除',
|
||||
okType: 'danger',
|
||||
onOk() {
|
||||
requestBatchDelete();
|
||||
},
|
||||
cancelText: '取消',
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
|
||||
//请求批量删除
|
||||
async function requestBatchDelete() {
|
||||
try {
|
||||
SmartLoading.show();
|
||||
await customerVersionFileApi.batchDelete(selectedRowKeyList.value);
|
||||
message.success('删除成功');
|
||||
queryData();
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------ 显示与隐藏 ------------------------
|
||||
// 是否显示
|
||||
const visibleFlag = ref(false);
|
||||
|
||||
function show(rowData) {
|
||||
Object.assign(form, formDefault);
|
||||
if (rowData && !_.isEmpty(rowData)) {
|
||||
Object.assign(form, rowData);
|
||||
}
|
||||
// 使用字典时把下面这注释修改成自己的字典字段 有多个字典字段就复制多份同理修改 不然打开表单时不显示字典初始值
|
||||
// if (form.status && form.status.length > 0) {
|
||||
// form.status = form.status.map((e) => e.valueCode);
|
||||
// }
|
||||
visibleFlag.value = true;
|
||||
nextTick(() => {
|
||||
formRef.value.clearValidate();
|
||||
});
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
Object.assign(form, formDefault);
|
||||
visibleFlag.value = false;
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user