|
@@ -1,277 +0,0 @@
|
|
|
-<template>
|
|
|
- <div class="table-box">
|
|
|
- <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listAgMangeApi">
|
|
|
- <!-- 表格 header 按钮 -->
|
|
|
- <template #tableHeader="scope">
|
|
|
- <el-button type="primary" v-auth="['biz:agMange:add']" :icon="CirclePlus" @click="openDialog(1, '算法配置新增')"> 新增 </el-button>
|
|
|
- <el-button type="primary" v-auth="['biz:agMange:import']" :icon="Upload" plain @click="batchAdd"> 导入 </el-button>
|
|
|
- <el-button type="primary" v-auth="['biz:agMange:export']" :icon="Download" plain @click="downloadFile"> 导出 </el-button>
|
|
|
- <el-button
|
|
|
- type="danger"
|
|
|
- v-auth="['biz:agMange:remove']"
|
|
|
- :icon="Delete"
|
|
|
- plain
|
|
|
- :disabled="!scope.isSelected"
|
|
|
- @click="batchDelete(scope.selectedListIds)"
|
|
|
- >
|
|
|
- 批量删除
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
- <!-- 表格操作 -->
|
|
|
- <template #operation="scope">
|
|
|
- <el-button type="primary" link :icon="View" v-auth="['biz:agMange:query']" @click="openDialog(3, '算法配置查看', scope.row)">
|
|
|
- 查看
|
|
|
- </el-button>
|
|
|
- <el-button type="primary" link :icon="EditPen" v-auth="['biz:agMange:edit']" @click="openDialog(2, '算法配置编辑', scope.row)">
|
|
|
- 编辑
|
|
|
- </el-button>
|
|
|
- <el-button type="primary" link :icon="Delete" v-auth="['biz:agMange:remove']" @click="deleteAgMange(scope.row)"> 删除 </el-button>
|
|
|
- </template>
|
|
|
- </ProTable>
|
|
|
- <FormDialog ref="formDialogRef" />
|
|
|
- <ImportExcel ref="dialogRef" />
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script setup lang="tsx" name="AgMange">
|
|
|
-import { ref, reactive } from 'vue'
|
|
|
-import { useHandleData } from '@/hooks/useHandleData'
|
|
|
-import { useDownload } from '@/hooks/useDownload'
|
|
|
-import { ElMessageBox } from 'element-plus'
|
|
|
-import ProTable from '@/components/ProTable/index.vue'
|
|
|
-import ImportExcel from '@/components/ImportExcel/index.vue'
|
|
|
-import FormDialog from '@/components/FormDialog/index.vue'
|
|
|
-import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
|
|
-import { Delete, EditPen, Download, Upload, View, CirclePlus } from '@element-plus/icons-vue'
|
|
|
-import {
|
|
|
- listAgMangeApi,
|
|
|
- delAgMangeApi,
|
|
|
- addAgMangeApi,
|
|
|
- updateAgMangeApi,
|
|
|
- importTemplateApi,
|
|
|
- importAgMangeDataApi,
|
|
|
- exportAgMangeApi,
|
|
|
- getAgMangeApi
|
|
|
-} from '@/api/modules/biz/agMange'
|
|
|
-
|
|
|
-// ProTable 实例
|
|
|
-const proTable = ref<ProTableInstance>()
|
|
|
-
|
|
|
-// 删除算法配置信息
|
|
|
-const deleteAgMange = async (params: any) => {
|
|
|
- await useHandleData(delAgMangeApi, params.id, `删除【params.id】算法配置`)
|
|
|
- proTable.value?.getTableList()
|
|
|
-}
|
|
|
-
|
|
|
-// 批量删除算法配置信息
|
|
|
-const batchDelete = async (ids: string[]) => {
|
|
|
- await useHandleData(delAgMangeApi, ids, '删除所选算法配置信息')
|
|
|
- proTable.value?.clearSelection()
|
|
|
- proTable.value?.getTableList()
|
|
|
-}
|
|
|
-
|
|
|
-// 导出算法配置列表
|
|
|
-const downloadFile = async () => {
|
|
|
- ElMessageBox.confirm('确认导出算法配置数据?', '温馨提示', { type: 'warning' }).then(() =>
|
|
|
- useDownload(exportAgMangeApi, '算法配置列表', proTable.value?.searchParam)
|
|
|
- )
|
|
|
-}
|
|
|
-
|
|
|
-// 批量添加算法配置
|
|
|
-const dialogRef = ref<InstanceType<typeof ImportExcel> | null>(null)
|
|
|
-const batchAdd = () => {
|
|
|
- const params = {
|
|
|
- title: '算法配置',
|
|
|
- tempApi: importTemplateApi,
|
|
|
- importApi: importAgMangeDataApi,
|
|
|
- getTableList: proTable.value?.getTableList
|
|
|
- }
|
|
|
- dialogRef.value?.acceptParams(params)
|
|
|
-}
|
|
|
-
|
|
|
-const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
|
|
|
-// 打开弹框的功能
|
|
|
-const openDialog = async (type: number, title: string, row?: any) => {
|
|
|
- let res = { data: {} }
|
|
|
- if (row?.id) {
|
|
|
- res = await getAgMangeApi(row?.id || null)
|
|
|
- }
|
|
|
- // 重置表单
|
|
|
- setFormItems()
|
|
|
- const params = {
|
|
|
- title,
|
|
|
- width: 580,
|
|
|
- isEdit: type !== 3,
|
|
|
- fieldList: formItems,
|
|
|
- model: type == 1 ? {} : res.data,
|
|
|
- api: type == 1 ? addAgMangeApi : updateAgMangeApi,
|
|
|
- getTableList: proTable.value?.getTableList
|
|
|
- }
|
|
|
- formDialogRef.value?.openDialog(params)
|
|
|
-}
|
|
|
-
|
|
|
-// 表格配置项
|
|
|
-const columns = reactive<ColumnProps<any>[]>([
|
|
|
- { type: 'selection', fixed: 'left', width: 70 },
|
|
|
- { prop: 'id', label: '主键ID' },
|
|
|
- {
|
|
|
- prop: 'subsystem',
|
|
|
- label: '分系统',
|
|
|
- search: {
|
|
|
- el: 'input'
|
|
|
- },
|
|
|
- width: 120
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'algorithmName',
|
|
|
- label: '算法名称',
|
|
|
- search: {
|
|
|
- el: 'input'
|
|
|
- },
|
|
|
- width: 120
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'algorithmAddress',
|
|
|
- label: '算法地址',
|
|
|
- search: {
|
|
|
- el: 'input'
|
|
|
- },
|
|
|
- width: 120
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'parameterConfig',
|
|
|
- label: '参数配置',
|
|
|
- search: {
|
|
|
- el: 'input'
|
|
|
- },
|
|
|
- width: 120
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'createdBy',
|
|
|
- label: '创建人',
|
|
|
- search: {
|
|
|
- el: 'input'
|
|
|
- },
|
|
|
- width: 120
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'createdAt',
|
|
|
- label: '创建时间',
|
|
|
- search: {
|
|
|
- el: 'date-picker',
|
|
|
- props: { type: 'datetimerange', valueFormat: 'YYYY-MM-DD HH:mm:ss' }
|
|
|
- },
|
|
|
- width: 120
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'updatedBy',
|
|
|
- label: '更新人',
|
|
|
- search: {
|
|
|
- el: 'input'
|
|
|
- },
|
|
|
- width: 120
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'updatedAt',
|
|
|
- label: '更新时间',
|
|
|
- search: {
|
|
|
- el: 'date-picker',
|
|
|
- props: { type: 'datetimerange', valueFormat: 'YYYY-MM-DD HH:mm:ss' }
|
|
|
- },
|
|
|
- width: 120
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'remarks',
|
|
|
- label: '备注',
|
|
|
- search: {
|
|
|
- el: 'input'
|
|
|
- },
|
|
|
- width: 120
|
|
|
- },
|
|
|
- { prop: 'operation', label: '操作', width: 230, fixed: 'right' }
|
|
|
-])
|
|
|
-// 表单配置项
|
|
|
-let formItems: ProForm.ItemsOptions[] = []
|
|
|
-const setFormItems = () => {
|
|
|
- formItems = [
|
|
|
- {
|
|
|
- label: '分系统',
|
|
|
- prop: 'subsystem',
|
|
|
- rules: [{ required: true, message: '分系统不能为空', trigger: 'blur' }],
|
|
|
- compOptions: {
|
|
|
- placeholder: '请输入分系统'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- label: '算法名称',
|
|
|
- prop: 'algorithmName',
|
|
|
- rules: [{ required: true, message: '算法名称不能为空', trigger: 'blur' }],
|
|
|
- compOptions: {
|
|
|
- placeholder: '请输入算法名称'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- label: '算法地址',
|
|
|
- prop: 'algorithmAddress',
|
|
|
- rules: [{ required: true, message: '算法地址不能为空', trigger: 'blur' }],
|
|
|
- compOptions: {
|
|
|
- placeholder: '请输入算法地址'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- label: '参数配置',
|
|
|
- prop: 'parameterConfig',
|
|
|
- rules: [{ required: true, message: '参数配置不能为空', trigger: 'blur' }],
|
|
|
- compOptions: {
|
|
|
- type: 'textarea',
|
|
|
- clearable: true,
|
|
|
- placeholder: '请输入内容'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- label: '创建人',
|
|
|
- prop: 'createdBy',
|
|
|
- rules: [{ required: true, message: '创建人不能为空', trigger: 'blur' }],
|
|
|
- compOptions: {
|
|
|
- placeholder: '请输入创建人'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- label: '创建时间',
|
|
|
- prop: 'createdAt',
|
|
|
- rules: [{ required: true, message: '创建时间不能为空', trigger: 'change' }],
|
|
|
- compOptions: {
|
|
|
- elTagName: 'date-picker',
|
|
|
- type: 'date',
|
|
|
- placeholder: '请选择创建时间'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- label: '更新人',
|
|
|
- prop: 'updatedBy',
|
|
|
- rules: [{ required: true, message: '更新人不能为空', trigger: 'blur' }],
|
|
|
- compOptions: {
|
|
|
- placeholder: '请输入更新人'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- label: '更新时间',
|
|
|
- prop: 'updatedAt',
|
|
|
- rules: [{ required: true, message: '更新时间不能为空', trigger: 'change' }],
|
|
|
- compOptions: {
|
|
|
- elTagName: 'date-picker',
|
|
|
- type: 'date',
|
|
|
- placeholder: '请选择更新时间'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- label: '备注',
|
|
|
- prop: 'remarks',
|
|
|
- rules: [{ required: true, message: '备注不能为空', trigger: 'blur' }],
|
|
|
- compOptions: {
|
|
|
- placeholder: '请输入备注'
|
|
|
- }
|
|
|
- }
|
|
|
- ]
|
|
|
-}
|
|
|
-</script>
|