src/api/model/mpk/pack.ts | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/model/mpk/file/MpkForm.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/model/mpk/menu/group/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/model/mpk/pack/PackForm.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/model/mpk/pack/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/model/mpk/project/ProjectPackage.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/api/model/mpk/pack.ts
对比新文件 @@ -0,0 +1,43 @@ import request from '@/config/axios' export interface MpkPackVO { id: string packName: string packDesc: string modelPath: string sort: number } export interface MpkPackPageReqVO extends PageParam { packName?: string } // 查询分页列表 export const getPage = (params: MpkPackPageReqVO) => { return request.get({ url: '/model/mpk/pack/page', params }) } // 查询列表 export const getList = () => { return request.get({ url: '/model/mpk/pack/list' }) } // 获得 export const getPack = (id: number) => { return request.get({ url: '/model/mpk/pack/get?id=' + id }) } // 新增 export const createPack = (data: MpkPackVO) => { return request.post({ url: '/model/mpk/pack/create', data }) } // 修改 export const updatePack = (data: MpkPackVO) => { return request.put({ url: '/model/mpk/pack/update', data }) } // 删除 export const deletePack = (id: string) => { return request.delete({ url: '/model/mpk/pack/delete?id=' + id }) } src/views/model/mpk/file/MpkForm.vue
@@ -468,7 +468,6 @@ methodSettings: [] } ] debugger }else { formData.value.modelMethods = [ { src/views/model/mpk/menu/group/index.vue
@@ -15,23 +15,7 @@ :inline="true" label-width="68px" > <el-form-item label="模型名称" prop="iconName"> <el-input v-model="queryParams.iconName" placeholder="请输入名称" clearable class="!w-240px" /> </el-form-item> <el-form-item> <el-button @click="handleQuery"> <Icon icon="ep:search" class="mr-5px"/> 搜索 </el-button> <el-button @click="resetQuery"> <Icon icon="ep:refresh" class="mr-5px"/> 重置 </el-button> <el-button type="primary" plain src/views/model/mpk/pack/PackForm.vue
对比新文件 @@ -0,0 +1,108 @@ <template> <Dialog v-model="dialogVisible" :title="dialogTitle"> <el-form ref="formRef" v-loading="formLoading" :model="formData" :rules="formRules" label-width="80px" > <el-form-item label="名称" prop="packName"> <el-input v-model="formData.packName" placeholder="请输入名称" /> </el-form-item> <el-form-item label="描述" prop="packDesc"> <el-input v-model="formData.packDesc" placeholder="请输入包名描述" /> </el-form-item> <el-form-item label="模型路径" prop="modelPath"> <el-input v-model="formData.modelPath" placeholder="请输入包名描述" /> </el-form-item> <el-form-item label="排序" prop="sort"> <el-input-number v-model="formData.sort" :min="0" clearable controls-position="right" /> </el-form-item> </el-form> <template #footer> <el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button> <el-button @click="dialogVisible = false">取 消</el-button> </template> </Dialog> </template> <script lang="ts" setup> import * as MpkPackApi from '@/api/model/mpk/pack' defineOptions({ name: 'MpkPackForm' }) const { t } = useI18n() // 国际化 const message = useMessage() // 消息弹窗 const dialogVisible = ref(false) // 弹窗的是否展示 const dialogTitle = ref('') // 弹窗的标题 const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 const formType = ref('') // 表单的类型:create - 新增;update - 修改 const formData = ref({ id: undefined, packName: '', packDesc: '', modelPath: '', sort: undefined }) const formRules = reactive({ packName: [{ required: true, message: '名称不能为空', trigger: 'blur' }] }) const formRef = ref() // 表单 Ref /** 打开弹窗 */ const open = async (type: string, id?: string) => { dialogVisible.value = true dialogTitle.value = t('action.' + type) formType.value = type resetForm() // 修改时,设置数据 if (id) { formLoading.value = true try { formData.value = await MpkPackApi.getPack(id) } finally { formLoading.value = false } } } defineExpose({ open }) // 提供 open 方法,用于打开弹窗 /** 提交表单 */ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 const submitForm = async () => { // 校验表单 if (!formRef) return const valid = await formRef.value.validate() if (!valid) return // 提交请求 formLoading.value = true try { const data = formData.value as MpkPackApi.MpkPackVO if (formType.value === 'create') { await MpkPackApi.createPack(data) message.success(t('common.createSuccess')) } else { await MpkPackApi.updatePack(data) message.success(t('common.updateSuccess')) } dialogVisible.value = false // 发送操作成功的事件 emit('success') } finally { formLoading.value = false } } /** 重置表单 */ const resetForm = () => { formData.value = { id: undefined, packName: '', packDesc: '', sort: undefined } formRef.value?.resetFields() } </script> src/views/model/mpk/pack/index.vue
对比新文件 @@ -0,0 +1,157 @@ <template> <!-- 搜索工作栏 --> <ContentWrap> <el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px" > <el-form-item label="名称" prop="packName"> <el-input v-model="queryParams.packName" placeholder="请输入名称" clearable class="!w-240px" /> </el-form-item> <el-form-item> <el-button @click="handleQuery"> <Pack pack="ep:search" class="mr-5px"/> 搜索 </el-button> <el-button @click="resetQuery"> <Pack pack="ep:refresh" class="mr-5px"/> 重置 </el-button> <el-button type="primary" plain @click="openForm('create')" v-hasPermi="['mpk:pack:create']" > <Pack pack="ep:plus" class="mr-5px" /> 新增 </el-button> </el-form-item> </el-form> </ContentWrap> <!-- 列表 --> <ContentWrap> <el-table v-loading="loading" :data="list" row-key="id" > <el-table-column prop="packName" label="名称"/> <el-table-column prop="packDesc" label="描述"/> <el-table-column prop="modelPath" label="模型路径"/> <el-table-column prop="sort" label="排序"/> <el-table-column label="操作" align="center" width="200px"> <template #default="scope"> <div class="flex items-center justify-center"> <el-button link type="primary" @click="openForm('update', scope.row.id)" v-hasPermi="['mpk:pack:update']" > 编辑 </el-button> <el-button link type="danger" @click="handleDelete(scope.row.id)" v-hasPermi="['mpk:pack:delete']"> <Pack pack="ep:delete"/>删除 </el-button> </div> </template> </el-table-column> </el-table> <!-- 分页 --> <Pagination v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNo" :total="total" @pagination="getList" /> </ContentWrap> <!-- 表单弹窗:添加/修改 --> <PackForm ref="formRef" @success="getList" /> </template> <script lang="ts" setup> import {dateFormatter} from '@/utils/formatTime' import * as MpkPackApi from '@/api/model/mpk/pack' import PackForm from './PackForm.vue' defineOptions({name: 'MpkPack'}) const message = useMessage() // 消息弹窗 const {t} = useI18n() // 国际化 const loading = ref(true) // 列表的加载中 const total = ref(0) // 列表的总页数 const list = ref([]) // 字典表格数据 const queryParams = reactive({ pageNo: 1, pageSize: 10, packName: '' }) const queryFormRef = ref() // 搜索的表单 const getList = async () => { loading.value = true try { const data = await MpkPackApi.getPage(queryParams) list.value = data.list total.value = data.total } finally { loading.value = false } } /** 搜索按钮操作 */ const handleQuery = () => { getList() } /** 重置按钮操作 */ const resetQuery = () => { queryParams.pageNo = 1 queryFormRef.value.resetFields() handleQuery() } /** 添加/修改操作 */ const formRef = ref() const openForm = (type: string, id?: string) => { formRef.value.open(type, id) } /** 删除按钮操作 */ const handleDelete = async (id: string) => { try { // 删除的二次确认 await message.delConfirm() // 发起删除 await MpkPackApi.deletePack(id) message.success(t('common.delSuccess')) // 刷新列表 await getList() } catch { } } /** 初始化 **/ onMounted(async () => { await getList() }) </script> <style scoped> .mpk-pack-list { height: 30px; margin: 0; } </style> src/views/model/mpk/project/ProjectPackage.vue
@@ -85,7 +85,6 @@ formLoading.value = true formData.zipFileName = 'IAILMPK.' + formData.projectCode + '.' + formatToDateString(new Date()) + '.zip' const data = await ProjectApi.packageProject(formData) debugger download.zip(data, formData.zipFileName) formLoading.value = false dialogVisible.value = false