parent
55aa03989e
commit
bf64e4527e
16 changed files with 1613 additions and 10 deletions
@ -0,0 +1,81 @@ |
|||||||
|
import { defHttp } from '/src/utils/http/axios'; |
||||||
|
import { useMessage } from "/src/hooks/web/useMessage"; |
||||||
|
|
||||||
|
const { createConfirm } = useMessage(); |
||||||
|
|
||||||
|
enum Api { |
||||||
|
list = '/expert/expert/listself', |
||||||
|
save='/expert/expert/add', |
||||||
|
edit='/expert/expert/editself', |
||||||
|
deleteOne = '/expert/expert/delete', |
||||||
|
deleteBatch = '/expert/expert/deleteBatch', |
||||||
|
importExcel = '/expert/expert/importExcel', |
||||||
|
exportXls = '/expert/expert/exportXls', |
||||||
|
handleupAPI = '/expert/expert/handleup' |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 导出api |
||||||
|
* @param params |
||||||
|
*/ |
||||||
|
export const getExportUrl = Api.exportXls; |
||||||
|
|
||||||
|
/** |
||||||
|
* 导入api |
||||||
|
*/ |
||||||
|
export const getImportUrl = Api.importExcel; |
||||||
|
|
||||||
|
/** |
||||||
|
* 列表接口 |
||||||
|
* @param params |
||||||
|
*/ |
||||||
|
export const list = (params) => defHttp.get({ url: Api.list, params }); |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除单个 |
||||||
|
* @param params |
||||||
|
* @param handleSuccess |
||||||
|
*/ |
||||||
|
export const deleteOne = (params,handleSuccess) => { |
||||||
|
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { |
||||||
|
handleSuccess(); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 用于完善信息的提交审核 |
||||||
|
* @param params |
||||||
|
* @param handleSuccess |
||||||
|
*/ |
||||||
|
export const handleupAPI = (params) => defHttp.get({ url: Api.handleupAPI, params }); |
||||||
|
|
||||||
|
/** |
||||||
|
* 批量删除 |
||||||
|
* @param params |
||||||
|
* @param handleSuccess |
||||||
|
*/ |
||||||
|
export const batchDelete = (params, handleSuccess) => { |
||||||
|
createConfirm({ |
||||||
|
iconType: 'warning', |
||||||
|
title: '确认删除', |
||||||
|
content: '是否删除选中数据', |
||||||
|
okText: '确认', |
||||||
|
cancelText: '取消', |
||||||
|
onOk: () => { |
||||||
|
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { |
||||||
|
handleSuccess(); |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 保存或者更新 |
||||||
|
* @param params |
||||||
|
* @param isUpdate |
||||||
|
*/ |
||||||
|
export const saveOrUpdate = (params, isUpdate) => { |
||||||
|
let url = isUpdate ? Api.edit : Api.save; |
||||||
|
return defHttp.post({ url: url, params }, { isTransformResponse: false }); |
||||||
|
} |
@ -0,0 +1,79 @@ |
|||||||
|
import {BasicColumn} from '/src/components/Table'; |
||||||
|
import {FormSchema} from '/src/components/Table'; |
||||||
|
import { rules} from '/src/utils/helper/validator'; |
||||||
|
import { render } from '/src/utils/common/renderUtils'; |
||||||
|
import { getWeekMonthQuarterYear } from '/src/utils'; |
||||||
|
//列表数据 |
||||||
|
export const columns: BasicColumn[] = [ |
||||||
|
{ |
||||||
|
title: '用户名', |
||||||
|
align: "center", |
||||||
|
dataIndex: 'seusername' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '毕业院校', |
||||||
|
align: "center", |
||||||
|
dataIndex: 'colleges' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '专业', |
||||||
|
align: "center", |
||||||
|
dataIndex: 'major' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '研究方向', |
||||||
|
align: "center", |
||||||
|
dataIndex: 'directioncal_dictText' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '研究类型', |
||||||
|
align: "center", |
||||||
|
dataIndex: 'research' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '学历', |
||||||
|
align: "center", |
||||||
|
dataIndex: 'educationcal' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '专家简介', |
||||||
|
align: "center", |
||||||
|
dataIndex: 'expinfo' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '部门审核', |
||||||
|
align: "center", |
||||||
|
dataIndex: 'compopen_dictText', |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '管理员审核', |
||||||
|
align: "center", |
||||||
|
dataIndex: 'adminopen_dictText', |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '管理员审核', |
||||||
|
align: "center", |
||||||
|
dataIndex: 'adminopen_dictText', |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '专家状态', |
||||||
|
align: "center", |
||||||
|
dataIndex: 'expsture', |
||||||
|
customRender:({text}) => { |
||||||
|
return render.renderSwitch(text, [{text:'正常',value:'Y'},{text:'异常',value:'N'}]); |
||||||
|
}, |
||||||
|
}, |
||||||
|
]; |
||||||
|
|
||||||
|
// 高级查询数据 |
||||||
|
export const superQuerySchema = { |
||||||
|
seusername: {title: '用户名',order: 0,view: 'text', type: 'string',}, |
||||||
|
colleges: {title: '毕业院校',order: 1,view: 'text', type: 'string',}, |
||||||
|
major: {title: '专业',order: 2,view: 'text', type: 'string',}, |
||||||
|
directioncal: {title: '研究方向',order: 3,view: 'text', type: 'string',}, |
||||||
|
research: {title: '研究类型',order: 4,view: 'text', type: 'string',}, |
||||||
|
educationcal: {title: '学历',order: 5,view: 'text', type: 'string',}, |
||||||
|
expinfo: {title: '专家简介',order: 6,view: 'text', type: 'string',}, |
||||||
|
compopen: {title: '部门审核',order: 7,view: 'switch', type: 'string',}, |
||||||
|
adminopen: {title: '管理员审核',order: 8,view: 'switch', type: 'string',}, |
||||||
|
}; |
@ -0,0 +1,282 @@ |
|||||||
|
<template> |
||||||
|
<div class="p-2"> |
||||||
|
<!--查询区域--> |
||||||
|
<div class="jeecg-basic-table-form-container"> |
||||||
|
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol"> |
||||||
|
<a-row :gutter="24"> |
||||||
|
<a-col :lg="6"> |
||||||
|
<a-form-item name="seusername"> |
||||||
|
<template #label><span title="用户名">用户名</span></template> |
||||||
|
<a-input placeholder="请输入用户名" v-model:value="queryParam.seusername" allow-clear ></a-input> |
||||||
|
</a-form-item> |
||||||
|
</a-col> |
||||||
|
<a-col :lg="6"> |
||||||
|
<a-form-item name="directioncal"> |
||||||
|
<template #label><span title="研究方向">研究方向</span></template> |
||||||
|
<a-input placeholder="请输入研究方向" v-model:value="queryParam.directioncal" allow-clear ></a-input> |
||||||
|
</a-form-item> |
||||||
|
</a-col> |
||||||
|
<template v-if="toggleSearchStatus"> |
||||||
|
<a-col :lg="6"> |
||||||
|
<a-form-item name="research"> |
||||||
|
<template #label><span title="研究类型">研究类型</span></template> |
||||||
|
<a-input placeholder="请输入研究类型" v-model:value="queryParam.research" allow-clear ></a-input> |
||||||
|
</a-form-item> |
||||||
|
</a-col> |
||||||
|
</template> |
||||||
|
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||||
|
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons"> |
||||||
|
<a-col :lg="6"> |
||||||
|
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button> |
||||||
|
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button> |
||||||
|
<a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px"> |
||||||
|
{{ toggleSearchStatus ? '收起' : '展开' }} |
||||||
|
<Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" /> |
||||||
|
</a> |
||||||
|
</a-col> |
||||||
|
</span> |
||||||
|
</a-col> |
||||||
|
</a-row> |
||||||
|
</a-form> |
||||||
|
</div> |
||||||
|
<!--引用表格--> |
||||||
|
<BasicTable @register="registerTable" :rowSelection="rowSelection"> |
||||||
|
<!--插槽:table标题--> |
||||||
|
<template #tableTitle> |
||||||
|
<!-- <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> |
||||||
|
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> |
||||||
|
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>--> |
||||||
|
<a-dropdown v-if="selectedRowKeys.length > 0"> |
||||||
|
<template #overlay> |
||||||
|
<a-menu> |
||||||
|
<a-menu-item key="1" @click="batchHandleDelete"> |
||||||
|
<Icon icon="ant-design:delete-outlined"></Icon> |
||||||
|
删除 |
||||||
|
</a-menu-item> |
||||||
|
</a-menu> |
||||||
|
</template> |
||||||
|
<a-button>批量操作 |
||||||
|
<Icon icon="mdi:chevron-down"></Icon> |
||||||
|
</a-button> |
||||||
|
</a-dropdown> |
||||||
|
<!-- 高级查询 --> |
||||||
|
<super-query :config="superQueryConfig" @search="handleSuperQuery" /> |
||||||
|
</template> |
||||||
|
<!--操作栏--> |
||||||
|
<template #action="{ record }"> |
||||||
|
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> |
||||||
|
</template> |
||||||
|
<template v-slot:bodyCell="{ column, record, index, text }"> |
||||||
|
</template> |
||||||
|
</BasicTable> |
||||||
|
<!-- 表单区域 --> |
||||||
|
<ExpertModal ref="registerModal" @success="handleSuccess"></ExpertModal> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script lang="ts" name="expert-expert" setup> |
||||||
|
import { ref, reactive } from 'vue'; |
||||||
|
import { BasicTable, useTable, TableAction } from '/src/components/Table'; |
||||||
|
import { useListPage } from '/src/hooks/system/useListPage'; |
||||||
|
import { columns, superQuerySchema } from './Expert.data'; |
||||||
|
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl,handleupAPI } from './Expert.api'; |
||||||
|
import { downloadFile } from '/src/utils/common/renderUtils'; |
||||||
|
import ExpertModal from './components/ExpertModal.vue' |
||||||
|
import { useUserStore } from '/src/store/modules/user'; |
||||||
|
import JDictSelectTag from '/src/components/Form/src/jeecg/components/JDictSelectTag.vue'; |
||||||
|
import JSwitch from '/src/components/Form/src/jeecg/components/JSwitch.vue'; |
||||||
|
import JSelectMultiple from '/src/components/Form/src/jeecg/components/JSelectMultiple.vue'; |
||||||
|
|
||||||
|
const formRef = ref(); |
||||||
|
const queryParam = reactive<any>({}); |
||||||
|
const toggleSearchStatus = ref<boolean>(false); |
||||||
|
const registerModal = ref(); |
||||||
|
const userStore = useUserStore(); |
||||||
|
//注册table数据 |
||||||
|
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ |
||||||
|
tableProps: { |
||||||
|
title: '专家管理', |
||||||
|
api: list, |
||||||
|
columns, |
||||||
|
canResize:false, |
||||||
|
useSearchForm: false, |
||||||
|
actionColumn: { |
||||||
|
width: 120, |
||||||
|
fixed: 'right', |
||||||
|
}, |
||||||
|
beforeFetch: async (params) => { |
||||||
|
return Object.assign(params, queryParam); |
||||||
|
}, |
||||||
|
}, |
||||||
|
exportConfig: { |
||||||
|
name: "专家管理", |
||||||
|
url: getExportUrl, |
||||||
|
params: queryParam, |
||||||
|
}, |
||||||
|
importConfig: { |
||||||
|
url: getImportUrl, |
||||||
|
success: handleSuccess |
||||||
|
}, |
||||||
|
}); |
||||||
|
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext; |
||||||
|
const labelCol = reactive({ |
||||||
|
xs:24, |
||||||
|
sm:4, |
||||||
|
xl:6, |
||||||
|
xxl:4 |
||||||
|
}); |
||||||
|
const wrapperCol = reactive({ |
||||||
|
xs: 24, |
||||||
|
sm: 20, |
||||||
|
}); |
||||||
|
|
||||||
|
// 高级查询配置 |
||||||
|
const superQueryConfig = reactive(superQuerySchema); |
||||||
|
|
||||||
|
/** |
||||||
|
* 高级查询事件 |
||||||
|
*/ |
||||||
|
function handleSuperQuery(params) { |
||||||
|
Object.keys(params).map((k) => { |
||||||
|
queryParam[k] = params[k]; |
||||||
|
}); |
||||||
|
searchQuery(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增事件 |
||||||
|
*/ |
||||||
|
function handleAdd() { |
||||||
|
registerModal.value.disableSubmit = false; |
||||||
|
registerModal.value.add(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 编辑事件 |
||||||
|
*/ |
||||||
|
function handleEdit(record: Recordable) { |
||||||
|
registerModal.value.disableSubmit = false; |
||||||
|
registerModal.value.edit(record); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 详情 |
||||||
|
*/ |
||||||
|
function handleDetail(record: Recordable) { |
||||||
|
registerModal.value.disableSubmit = true; |
||||||
|
registerModal.value.edit(record); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除事件 |
||||||
|
*/ |
||||||
|
async function handleDelete(record) { |
||||||
|
await deleteOne({ id: record.id }, handleSuccess); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除事件 |
||||||
|
*/ |
||||||
|
async function handleup(record) { |
||||||
|
await handleupAPI({ id: record.id }, handleSuccess); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 批量删除事件 |
||||||
|
*/ |
||||||
|
async function batchHandleDelete() { |
||||||
|
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 成功回调 |
||||||
|
*/ |
||||||
|
function handleSuccess() { |
||||||
|
(selectedRowKeys.value = []) && reload(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 操作栏 |
||||||
|
*/ |
||||||
|
function getTableAction(record) { |
||||||
|
return [ |
||||||
|
{ |
||||||
|
label: '编辑', |
||||||
|
onClick: handleEdit.bind(null, record), |
||||||
|
}, |
||||||
|
]; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 下拉操作栏 |
||||||
|
*/ |
||||||
|
function getDropDownAction(record) { |
||||||
|
return [ |
||||||
|
{ |
||||||
|
label: '详情', |
||||||
|
onClick: handleDetail.bind(null, record), |
||||||
|
}/*, { |
||||||
|
label: '删除', |
||||||
|
popConfirm: { |
||||||
|
title: '是否确认删除', |
||||||
|
confirm: handleDelete.bind(null, record), |
||||||
|
placement: 'topLeft', |
||||||
|
}, |
||||||
|
}*/, { |
||||||
|
label: '上报审核', |
||||||
|
popConfirm: { |
||||||
|
title: '请确定信息已完善', |
||||||
|
confirm: handleup.bind(null, record), |
||||||
|
placement: 'topLeft', |
||||||
|
}, |
||||||
|
} |
||||||
|
] |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询 |
||||||
|
*/ |
||||||
|
function searchQuery() { |
||||||
|
reload(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 重置 |
||||||
|
*/ |
||||||
|
function searchReset() { |
||||||
|
formRef.value.resetFields(); |
||||||
|
selectedRowKeys.value = []; |
||||||
|
//刷新数据 |
||||||
|
reload(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="less" scoped> |
||||||
|
.jeecg-basic-table-form-container { |
||||||
|
padding: 0; |
||||||
|
.table-page-search-submitButtons { |
||||||
|
display: block; |
||||||
|
margin-bottom: 24px; |
||||||
|
white-space: nowrap; |
||||||
|
} |
||||||
|
.query-group-cust{ |
||||||
|
min-width: 100px !important; |
||||||
|
} |
||||||
|
.query-group-split-cust{ |
||||||
|
width: 30px; |
||||||
|
display: inline-block; |
||||||
|
text-align: center |
||||||
|
} |
||||||
|
.ant-form-item:not(.ant-form-item-with-help){ |
||||||
|
margin-bottom: 16px; |
||||||
|
height: 32px; |
||||||
|
} |
||||||
|
:deep(.ant-picker),:deep(.ant-input-number){ |
||||||
|
width: 100%; |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
@ -0,0 +1,26 @@ |
|||||||
|
-- 注意:该页面对应的前台目录为views/expert文件夹下 |
||||||
|
-- 如果你想更改到其他目录,请修改sql中component字段对应的值 |
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) |
||||||
|
VALUES ('2024092603239210260', NULL, '专家管理', '/expert/expertList', 'expert/ExpertList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2024-09-26 15:23:26', NULL, NULL, 0); |
||||||
|
|
||||||
|
-- 权限控制sql |
||||||
|
-- 新增 |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024092603239210261', '2024092603239210260', '添加专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-26 15:23:26', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 编辑 |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024092603239210262', '2024092603239210260', '编辑专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-26 15:23:26', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 删除 |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024092603239210263', '2024092603239210260', '删除专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-26 15:23:26', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 批量删除 |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024092603239210264', '2024092603239210260', '批量删除专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-26 15:23:26', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 导出excel |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024092603239210265', '2024092603239210260', '导出excel_专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-26 15:23:26', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 导入excel |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024092603239210266', '2024092603239210260', '导入excel_专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-26 15:23:26', NULL, NULL, 0, 0, '1', 0); |
@ -0,0 +1,26 @@ |
|||||||
|
-- 注意:该页面对应的前台目录为views/expert文件夹下 |
||||||
|
-- 如果你想更改到其他目录,请修改sql中component字段对应的值 |
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) |
||||||
|
VALUES ('2024092910425270310', NULL, '专家管理', '/expert/expertList', 'expert/ExpertList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2024-09-29 10:42:31', NULL, NULL, 0); |
||||||
|
|
||||||
|
-- 权限控制sql |
||||||
|
-- 新增 |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024092910425270311', '2024092910425270310', '添加专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-29 10:42:31', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 编辑 |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024092910425270312', '2024092910425270310', '编辑专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-29 10:42:31', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 删除 |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024092910425270313', '2024092910425270310', '删除专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-29 10:42:31', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 批量删除 |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024092910425270314', '2024092910425270310', '批量删除专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-29 10:42:31', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 导出excel |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024092910425270315', '2024092910425270310', '导出excel_专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-29 10:42:31', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 导入excel |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024092910425270316', '2024092910425270310', '导入excel_专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-29 10:42:31', NULL, NULL, 0, 0, '1', 0); |
@ -0,0 +1,26 @@ |
|||||||
|
-- 注意:该页面对应的前台目录为views/expert文件夹下 |
||||||
|
-- 如果你想更改到其他目录,请修改sql中component字段对应的值 |
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) |
||||||
|
VALUES ('2024093009506560560', NULL, '专家管理', '/expert/expertList', 'expert/ExpertList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2024-09-30 09:50:56', NULL, NULL, 0); |
||||||
|
|
||||||
|
-- 权限控制sql |
||||||
|
-- 新增 |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024093009506560561', '2024093009506560560', '添加专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-30 09:50:56', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 编辑 |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024093009506560562', '2024093009506560560', '编辑专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-30 09:50:56', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 删除 |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024093009506560563', '2024093009506560560', '删除专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-30 09:50:56', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 批量删除 |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024093009506560564', '2024093009506560560', '批量删除专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-30 09:50:56', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 导出excel |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024093009506560565', '2024093009506560560', '导出excel_专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-30 09:50:56', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 导入excel |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('2024093009506560566', '2024093009506560560', '导入excel_专家管理', NULL, NULL, 0, NULL, NULL, 2, 'expert:expert:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-09-30 09:50:56', NULL, NULL, 0, 0, '1', 0); |
@ -0,0 +1,176 @@ |
|||||||
|
<template> |
||||||
|
<a-spin :spinning="confirmLoading"> |
||||||
|
<JFormContainer :disabled="disabled"> |
||||||
|
<template #detail> |
||||||
|
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="ExpertForm"> |
||||||
|
<a-row> |
||||||
|
<a-col :span="24" v-if="formData.adminopen === '3' || formData.compopen === '3'"> |
||||||
|
<a-form-item label="异常备注" v-bind="validateInfos.errinfo" id="ExpertForm-backinfo" name="backinfo"> |
||||||
|
<a-input v-model:value="formData.backinfo" placeholder="请输入异常备注" allow-clear disabled="true"></a-input> |
||||||
|
</a-form-item> |
||||||
|
</a-col> |
||||||
|
|
||||||
|
|
||||||
|
</a-row> |
||||||
|
</a-form> |
||||||
|
</template> |
||||||
|
</JFormContainer> |
||||||
|
</a-spin> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script lang="ts" setup> |
||||||
|
import JDictSelectTag from '/src/components/Form/src/jeecg/components/JDictSelectTag.vue'; |
||||||
|
import JSelectDept from '/src/components/Form/src/jeecg/components/JSelectDept.vue'; |
||||||
|
import JImageUpload from '/src/components/Form/src/jeecg/components/JImageUpload.vue'; |
||||||
|
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue'; |
||||||
|
import { defHttp } from '/src/utils/http/axios'; |
||||||
|
import { useMessage } from '/src/hooks/web/useMessage'; |
||||||
|
import JSwitch from '/src/components/Form/src/jeecg/components/JSwitch.vue'; |
||||||
|
import { getValueType } from '/src/utils'; |
||||||
|
import { saveOrUpdate } from '../Expert.api'; |
||||||
|
import { Form } from 'ant-design-vue'; |
||||||
|
import JFormContainer from '/src/components/Form/src/container/JFormContainer.vue'; |
||||||
|
const props = defineProps({ |
||||||
|
formDisabled: { type: Boolean, default: false }, |
||||||
|
formData: { type: Object, default: () => ({})}, |
||||||
|
formBpm: { type: Boolean, default: true } |
||||||
|
}); |
||||||
|
const formRef = ref(); |
||||||
|
const useForm = Form.useForm; |
||||||
|
const emit = defineEmits(['register', 'ok']); |
||||||
|
const formData = reactive<Record<string, any>>({ |
||||||
|
id: '', |
||||||
|
seusername: '', |
||||||
|
psd: '', |
||||||
|
sepsd: '', |
||||||
|
realname: '', |
||||||
|
workon: '', |
||||||
|
sex: '', |
||||||
|
ssdep: '', |
||||||
|
topPic: '', |
||||||
|
phone: '', |
||||||
|
emails: '', |
||||||
|
colleges: '', |
||||||
|
major: '', |
||||||
|
directioncal: '', |
||||||
|
research: '', |
||||||
|
educationcal: '', |
||||||
|
expinfo: '', |
||||||
|
compopen: '', |
||||||
|
adminopen: '', |
||||||
|
backinfo: '', |
||||||
|
}); |
||||||
|
const { createMessage } = useMessage(); |
||||||
|
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } }); |
||||||
|
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } }); |
||||||
|
const confirmLoading = ref<boolean>(false); |
||||||
|
//表单验证 |
||||||
|
const validatorRules = reactive({ |
||||||
|
/* psd: [{ required: true, message: '请输入密码!'},], |
||||||
|
sepsd: [{ required: true, message: '请输入确认密码!'},],*/ |
||||||
|
workon: [{ required: true, message: '请输入工号!'},], |
||||||
|
ssdep: [{ required: true, message: '请输入部门!'},], |
||||||
|
emails: [{ required: true, message: '请输入邮箱!'},], |
||||||
|
phone: [{ required: true, message: '请输入电话!'},], |
||||||
|
seusername: [{ required: true, message: '请输入用户名!'},], |
||||||
|
}); |
||||||
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false }); |
||||||
|
|
||||||
|
// 表单禁用 |
||||||
|
const disabled = computed(()=>{ |
||||||
|
if(props.formBpm === true){ |
||||||
|
if(props.formData.disabled === false){ |
||||||
|
return false; |
||||||
|
}else{ |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
|
return props.formDisabled; |
||||||
|
}); |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 新增 |
||||||
|
*/ |
||||||
|
function add() { |
||||||
|
edit({}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 编辑 |
||||||
|
*/ |
||||||
|
function edit(record) { |
||||||
|
nextTick(() => { |
||||||
|
resetFields(); |
||||||
|
const tmpData = {}; |
||||||
|
Object.keys(formData).forEach((key) => { |
||||||
|
if(record.hasOwnProperty(key)){ |
||||||
|
tmpData[key] = record[key] |
||||||
|
} |
||||||
|
}) |
||||||
|
//赋值 |
||||||
|
Object.assign(formData, tmpData); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 提交数据 |
||||||
|
*/ |
||||||
|
async function submitForm() { |
||||||
|
try { |
||||||
|
// 触发表单验证 |
||||||
|
await validate(); |
||||||
|
} catch ({ errorFields }) { |
||||||
|
if (errorFields) { |
||||||
|
const firstField = errorFields[0]; |
||||||
|
if (firstField) { |
||||||
|
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' }); |
||||||
|
} |
||||||
|
} |
||||||
|
return Promise.reject(errorFields); |
||||||
|
} |
||||||
|
confirmLoading.value = true; |
||||||
|
const isUpdate = ref<boolean>(false); |
||||||
|
//时间格式化 |
||||||
|
let model = formData; |
||||||
|
if (model.id) { |
||||||
|
isUpdate.value = true; |
||||||
|
} |
||||||
|
//循环数据 |
||||||
|
for (let data in model) { |
||||||
|
//如果该数据是数组并且是字符串类型 |
||||||
|
if (model[data] instanceof Array) { |
||||||
|
let valueType = getValueType(formRef.value.getProps, data); |
||||||
|
//如果是字符串类型的需要变成以逗号分割的字符串 |
||||||
|
if (valueType === 'string') { |
||||||
|
model[data] = model[data].join(','); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
await saveOrUpdate(model, isUpdate.value) |
||||||
|
.then((res) => { |
||||||
|
if (res.success) { |
||||||
|
createMessage.success(res.message); |
||||||
|
emit('ok'); |
||||||
|
} else { |
||||||
|
createMessage.warning(res.message); |
||||||
|
} |
||||||
|
}) |
||||||
|
.finally(() => { |
||||||
|
confirmLoading.value = false; |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
defineExpose({ |
||||||
|
add, |
||||||
|
edit, |
||||||
|
submitForm, |
||||||
|
}); |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="less" scoped> |
||||||
|
.antd-modal-form { |
||||||
|
padding: 14px; |
||||||
|
} |
||||||
|
</style> |
@ -0,0 +1,77 @@ |
|||||||
|
<template> |
||||||
|
<j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭"> |
||||||
|
<ExpertForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></ExpertForm> |
||||||
|
</j-modal> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script lang="ts" setup> |
||||||
|
import { ref, nextTick, defineExpose } from 'vue'; |
||||||
|
import ExpertForm from './ExpertForm.vue' |
||||||
|
import JModal from '/src/components/Modal/src/JModal/JModal.vue'; |
||||||
|
|
||||||
|
const title = ref<string>(''); |
||||||
|
const width = ref<number>(800); |
||||||
|
const visible = ref<boolean>(false); |
||||||
|
const disableSubmit = ref<boolean>(false); |
||||||
|
const registerForm = ref(); |
||||||
|
const emit = defineEmits(['register', 'success']); |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增 |
||||||
|
*/ |
||||||
|
function add() { |
||||||
|
title.value = '新增'; |
||||||
|
visible.value = true; |
||||||
|
nextTick(() => { |
||||||
|
registerForm.value.add(); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 编辑 |
||||||
|
* @param record |
||||||
|
*/ |
||||||
|
function edit(record) { |
||||||
|
title.value = disableSubmit.value ? '详情' : '编辑'; |
||||||
|
visible.value = true; |
||||||
|
nextTick(() => { |
||||||
|
registerForm.value.edit(record); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 确定按钮点击事件 |
||||||
|
*/ |
||||||
|
function handleOk() { |
||||||
|
registerForm.value.submitForm(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* form保存回调事件 |
||||||
|
*/ |
||||||
|
function submitCallback() { |
||||||
|
handleCancel(); |
||||||
|
emit('success'); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 取消按钮回调事件 |
||||||
|
*/ |
||||||
|
function handleCancel() { |
||||||
|
visible.value = false; |
||||||
|
} |
||||||
|
|
||||||
|
defineExpose({ |
||||||
|
add, |
||||||
|
edit, |
||||||
|
disableSubmit, |
||||||
|
}); |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="less"> |
||||||
|
/**隐藏样式-modal确定按钮 */ |
||||||
|
.jee-hidden { |
||||||
|
display: none !important; |
||||||
|
} |
||||||
|
</style> |
||||||
|
<style lang="less" scoped></style> |
@ -0,0 +1,87 @@ |
|||||||
|
import {defHttp} from '/@/utils/http/axios'; |
||||||
|
import { useMessage } from "/@/hooks/web/useMessage"; |
||||||
|
|
||||||
|
const { createConfirm } = useMessage(); |
||||||
|
|
||||||
|
enum Api { |
||||||
|
list = '/expproject/expproject/listself', |
||||||
|
save='/expproject/expproject/add', |
||||||
|
edit='/expproject/expproject/edit', |
||||||
|
deleteOne = '/expproject/expproject/delete', |
||||||
|
deleteBatch = '/expproject/expproject/deleteBatch', |
||||||
|
importExcel = '/expproject/expproject/importExcel', |
||||||
|
exportXls = '/expproject/expproject/exportXls', |
||||||
|
queryDataById = '/expproject/expproject/queryById', |
||||||
|
expandproList = '/expproject/expproject/queryExpandproByMainId', |
||||||
|
createexpawaitup= '/expproject/expproject/createexpawait', |
||||||
|
} |
||||||
|
/** |
||||||
|
* 导出api |
||||||
|
* @param params |
||||||
|
*/ |
||||||
|
export const getExportUrl = Api.exportXls; |
||||||
|
|
||||||
|
/** |
||||||
|
* 导入api |
||||||
|
*/ |
||||||
|
export const getImportUrl = Api.importExcel; |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询子表数据 |
||||||
|
* @param params |
||||||
|
*/ |
||||||
|
export const queryExpandproListByMainId = (id) => defHttp.get({url: Api.expandproList, params:{ id }}); |
||||||
|
|
||||||
|
/** |
||||||
|
* 列表接口 |
||||||
|
* @param params |
||||||
|
*/ |
||||||
|
export const list = (params) => |
||||||
|
defHttp.get({url: Api.list, params}); |
||||||
|
|
||||||
|
/** |
||||||
|
* 随机生成专家接口 |
||||||
|
* @param params |
||||||
|
*/ |
||||||
|
export const createexpawait = (params) => defHttp.get({url: Api.createexpawaitup, params}); |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除单个 |
||||||
|
*/ |
||||||
|
export const deleteOne = (params,handleSuccess) => { |
||||||
|
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { |
||||||
|
handleSuccess(); |
||||||
|
}); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 批量删除 |
||||||
|
* @param params |
||||||
|
*/ |
||||||
|
export const batchDelete = (params, handleSuccess) => { |
||||||
|
createConfirm({ |
||||||
|
iconType: 'warning', |
||||||
|
title: '确认删除', |
||||||
|
content: '是否删除选中数据', |
||||||
|
okText: '确认', |
||||||
|
cancelText: '取消', |
||||||
|
onOk: () => { |
||||||
|
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { |
||||||
|
handleSuccess(); |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 保存或者更新 |
||||||
|
* @param params |
||||||
|
*/ |
||||||
|
export const saveOrUpdate = (params, isUpdate) => { |
||||||
|
let url = isUpdate ? Api.edit : Api.save; |
||||||
|
return defHttp.post({url: url, params}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据id查询数据 |
||||||
|
* @param params |
||||||
|
*/ |
||||||
|
export const queryDataById = (id) => defHttp.get({url: Api.queryDataById, params:{ id }}); |
@ -0,0 +1,105 @@ |
|||||||
|
import {BasicColumn} from '/@/components/Table'; |
||||||
|
import {FormSchema} from '/@/components/Table'; |
||||||
|
import { rules} from '/@/utils/helper/validator'; |
||||||
|
import { render } from '/@/utils/common/renderUtils'; |
||||||
|
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types' |
||||||
|
import { getWeekMonthQuarterYear } from '/@/utils'; |
||||||
|
//列表数据 |
||||||
|
export const columns: BasicColumn[] = [ |
||||||
|
{ |
||||||
|
title: '专家类型', |
||||||
|
align:"center", |
||||||
|
dataIndex: 'exptype_dictText' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '需要专家个数', |
||||||
|
align:"center", |
||||||
|
dataIndex: 'needexp' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '简介', |
||||||
|
align:"center", |
||||||
|
dataIndex: 'proinfo' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '附件', |
||||||
|
align:"center", |
||||||
|
dataIndex: 'profile', |
||||||
|
}, |
||||||
|
]; |
||||||
|
|
||||||
|
//子表表格配置 |
||||||
|
export const expandproColumns: JVxeColumn[] = [ |
||||||
|
{ |
||||||
|
title: '专家名称', |
||||||
|
key: 'expname', |
||||||
|
type: JVxeTypes.popup, |
||||||
|
popupCode:"findexp", |
||||||
|
fieldConfig: [ |
||||||
|
{ source: 'username', target: 'expid' }, |
||||||
|
{ source: 'realname', target: 'expname' }, |
||||||
|
{ source: 'fdid', target: 'exptype' }, |
||||||
|
{ source: 'sysduid', target: 'ssdep' }, |
||||||
|
{ source: 'phone', target: 'phone' }, |
||||||
|
{ source: 'email', target: 'emil' }, |
||||||
|
], |
||||||
|
|
||||||
|
width:"200px", |
||||||
|
placeholder: '请输入${title}', |
||||||
|
defaultValue:'', |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '所属领域', |
||||||
|
key: 'exptype', |
||||||
|
type: JVxeTypes.input, |
||||||
|
disabled:true, |
||||||
|
width:"200px", |
||||||
|
placeholder: '请输入${title}', |
||||||
|
defaultValue:'', |
||||||
|
}, |
||||||
|
/* { |
||||||
|
title: '所属单位', |
||||||
|
key: 'ssdep', |
||||||
|
type: JVxeTypes.selectSearch, |
||||||
|
dictCode:"sys_depart,depart_name,id", |
||||||
|
width:"200px", |
||||||
|
placeholder: '请输入${title}', |
||||||
|
defaultValue:'', |
||||||
|
},*/ |
||||||
|
{ |
||||||
|
title: '专家电话', |
||||||
|
key: 'phone', |
||||||
|
type: JVxeTypes.input, |
||||||
|
width:"200px", |
||||||
|
placeholder: '请输入${title}', |
||||||
|
defaultValue:'', |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '专家邮箱', |
||||||
|
key: 'emil', |
||||||
|
type: JVxeTypes.input, |
||||||
|
width:"200px", |
||||||
|
placeholder: '请输入${title}', |
||||||
|
defaultValue:'', |
||||||
|
}, |
||||||
|
] |
||||||
|
|
||||||
|
// 高级查询数据 |
||||||
|
export const superQuerySchema = { |
||||||
|
exptype: {title: '专家类型',order: 1,view: 'sel_search', type: 'string',dictTable: "discipline_fieid", dictCode: 'id', dictText: 'name',}, |
||||||
|
needexp: {title: '需要专家个数',order: 2,view: 'number', type: 'number',}, |
||||||
|
proinfo: {title: '简介',order: 3,view: 'text', type: 'string',}, |
||||||
|
profile: {title: '附件',order: 4,view: 'file', type: 'string',}, |
||||||
|
//子表高级查询 |
||||||
|
expandpro: { |
||||||
|
title: '评审专家', |
||||||
|
view: 'table', |
||||||
|
fields: { |
||||||
|
expname: {title: '专家名称',order: 1,view: 'popup', type: 'string',code: 'findexp', orgFields: 'realname', destFields: 'expname', popupMulti: false,}, |
||||||
|
exptype: {title: '所属领域',order: 2,view: 'text', type: 'string',}, |
||||||
|
ssdep: {title: '所属单位',order: 3,view: 'sel_search', type: 'string',dictTable: "sys_depart", dictCode: 'id', dictText: 'depart_name',}, |
||||||
|
phone: {title: '专家电话',order: 4,view: 'text', type: 'string',}, |
||||||
|
emil: {title: '专家邮箱',order: 5,view: 'text', type: 'string',}, |
||||||
|
} |
||||||
|
}, |
||||||
|
}; |
@ -0,0 +1,277 @@ |
|||||||
|
<template> |
||||||
|
<div class="p-2"> |
||||||
|
<!--查询区域--> |
||||||
|
<div class="jeecg-basic-table-form-container"> |
||||||
|
<a-form ref="formRef" @keyup.enter.native="reload" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol"> |
||||||
|
<a-row :gutter="24"> |
||||||
|
<a-col :lg="6"> |
||||||
|
<a-form-item name="proname"> |
||||||
|
<template #label><span title="项目名称">项目名称</span></template> |
||||||
|
<a-input placeholder="请输入项目名称" v-model:value="queryParam.proname" allow-clear ></a-input> |
||||||
|
</a-form-item> |
||||||
|
</a-col> |
||||||
|
<a-col :lg="6"> |
||||||
|
<a-form-item name="exptype"> |
||||||
|
<template #label><span title="专家类型">专家类型</span></template> |
||||||
|
<j-search-select placeholder="请选择专家类型" v-model:value="queryParam.exptype" dict="discipline_fieid,name,id" allow-clear /> |
||||||
|
</a-form-item> |
||||||
|
</a-col> |
||||||
|
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||||
|
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons"> |
||||||
|
<a-col :lg="6"> |
||||||
|
<a-button type="primary" preIcon="ant-design:search-outlined" @click="reload">查询</a-button> |
||||||
|
<a-button preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button> |
||||||
|
<a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px"> |
||||||
|
{{ toggleSearchStatus ? '收起' : '展开' }} |
||||||
|
<Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" /> |
||||||
|
</a> |
||||||
|
</a-col> |
||||||
|
</span> |
||||||
|
</a-col> |
||||||
|
</a-row> |
||||||
|
</a-form> |
||||||
|
</div> |
||||||
|
<!--引用表格--> |
||||||
|
<BasicTable @register="registerTable" :rowSelection="rowSelection"> |
||||||
|
<!--插槽:table标题--> |
||||||
|
<template #tableTitle> |
||||||
|
<!-- <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> |
||||||
|
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> |
||||||
|
<j-upload-button type="primary" v-auth="'expproject:expproject:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>--> |
||||||
|
<a-dropdown v-if="selectedRowKeys.length > 0"> |
||||||
|
<template #overlay> |
||||||
|
<!-- <a-menu> |
||||||
|
<a-menu-item key="1" @click="batchHandleDelete"> |
||||||
|
<Icon icon="ant-design:delete-outlined"></Icon> |
||||||
|
删除 |
||||||
|
</a-menu-item> |
||||||
|
</a-menu>--> |
||||||
|
</template> |
||||||
|
<a-button >批量操作 |
||||||
|
<Icon icon="mdi:chevron-down"></Icon> |
||||||
|
</a-button> |
||||||
|
</a-dropdown> |
||||||
|
<!-- 高级查询 --> |
||||||
|
<super-query :config="superQueryConfig" @search="handleSuperQuery" /> |
||||||
|
</template> |
||||||
|
<!--操作栏--> |
||||||
|
<template #action="{ record }"> |
||||||
|
<TableAction :actions="getTableAction(record)" /> |
||||||
|
</template> |
||||||
|
<!--字段回显插槽--> |
||||||
|
<template v-slot:bodyCell="{ column, record, index, text }"> |
||||||
|
<template v-if="column.dataIndex==='profile'"> |
||||||
|
<!--文件字段回显插槽--> |
||||||
|
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> |
||||||
|
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button> |
||||||
|
</template> |
||||||
|
</template> |
||||||
|
</BasicTable> |
||||||
|
<!-- 表单区域 --> |
||||||
|
<ExpprojectModal @register="registerModal" @success="handleSuccess"></ExpprojectModal> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script lang="ts" name="expproject-expproject" setup> |
||||||
|
import {ref, reactive, computed, unref} from 'vue'; |
||||||
|
import {BasicTable, useTable, TableAction} from '/@/components/Table'; |
||||||
|
import { useListPage } from '/@/hooks/system/useListPage' |
||||||
|
import {useModal} from '/@/components/Modal'; |
||||||
|
import ExpprojectModal from './components/ExpprojectModal.vue' |
||||||
|
import {columns, superQuerySchema} from './Expproject.data'; |
||||||
|
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl,createexpawait} from './Expproject.api'; |
||||||
|
import {downloadFile} from '/@/utils/common/renderUtils'; |
||||||
|
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; |
||||||
|
import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue'; |
||||||
|
import JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue'; |
||||||
|
import { useUserStore } from '/@/store/modules/user'; |
||||||
|
const formRef = ref(); |
||||||
|
const queryParam = reactive<any>({}); |
||||||
|
const checkedKeys = ref<Array<string | number>>([]); |
||||||
|
//注册model |
||||||
|
const [registerModal, {openModal}] = useModal(); |
||||||
|
const userStore = useUserStore(); |
||||||
|
//注册table数据 |
||||||
|
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ |
||||||
|
tableProps:{ |
||||||
|
title: '专家项目表', |
||||||
|
api: list, |
||||||
|
columns, |
||||||
|
canResize:false, |
||||||
|
useSearchForm: false, |
||||||
|
actionColumn: { |
||||||
|
width: 120, |
||||||
|
fixed:'right' |
||||||
|
}, |
||||||
|
beforeFetch: async (params) => { |
||||||
|
return Object.assign(params, queryParam); |
||||||
|
}, |
||||||
|
}, |
||||||
|
exportConfig: { |
||||||
|
name:"专家项目表", |
||||||
|
url: getExportUrl, |
||||||
|
params: queryParam, |
||||||
|
}, |
||||||
|
importConfig: { |
||||||
|
url: getImportUrl, |
||||||
|
success: handleSuccess |
||||||
|
}, |
||||||
|
}) |
||||||
|
|
||||||
|
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext |
||||||
|
|
||||||
|
// 高级查询配置 |
||||||
|
const superQueryConfig = reactive(superQuerySchema); |
||||||
|
|
||||||
|
/** |
||||||
|
* 高级查询事件 |
||||||
|
*/ |
||||||
|
function handleSuperQuery(params) { |
||||||
|
Object.keys(params).map((k) => { |
||||||
|
queryParam[k] = params[k]; |
||||||
|
}); |
||||||
|
reload(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增事件 |
||||||
|
*/ |
||||||
|
function handleAdd() { |
||||||
|
openModal(true, { |
||||||
|
isUpdate: false, |
||||||
|
showFooter: true, |
||||||
|
}); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 编辑事件 |
||||||
|
*/ |
||||||
|
function handleEdit(record: Recordable) { |
||||||
|
openModal(true, { |
||||||
|
record, |
||||||
|
isUpdate: true, |
||||||
|
showFooter: true, |
||||||
|
}); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 详情 |
||||||
|
*/ |
||||||
|
function handleDetail(record: Recordable) { |
||||||
|
openModal(true, { |
||||||
|
record, |
||||||
|
isUpdate: true, |
||||||
|
showFooter: false, |
||||||
|
}); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 删除事件 |
||||||
|
*/ |
||||||
|
async function handleDelete(record) { |
||||||
|
await deleteOne({id: record.id}, handleSuccess); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 随机生成专家 |
||||||
|
*/ |
||||||
|
async function createexp(record) { |
||||||
|
await createexpawait({id: record.id}, handleSuccess); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 批量删除事件 |
||||||
|
*/ |
||||||
|
async function batchHandleDelete() { |
||||||
|
await batchDelete({ids: selectedRowKeys.value},handleSuccess); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 成功回调 |
||||||
|
*/ |
||||||
|
function handleSuccess() { |
||||||
|
(selectedRowKeys.value = []) && reload(); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 操作栏 |
||||||
|
*/ |
||||||
|
function getTableAction(record){ |
||||||
|
return [ |
||||||
|
{ |
||||||
|
label: '详情', |
||||||
|
onClick: handleDetail.bind(null, record), |
||||||
|
} |
||||||
|
] |
||||||
|
} |
||||||
|
/** |
||||||
|
* 下拉操作栏 |
||||||
|
*/ |
||||||
|
function getDropDownAction(record){ |
||||||
|
return [ |
||||||
|
{ |
||||||
|
label: '详情', |
||||||
|
onClick: handleDetail.bind(null, record), |
||||||
|
}, { |
||||||
|
label: '删除', |
||||||
|
popConfirm: { |
||||||
|
title: '是否确认删除', |
||||||
|
confirm: handleDelete.bind(null, record), |
||||||
|
placement: 'topLeft' |
||||||
|
}, |
||||||
|
}, { |
||||||
|
label: '生成专家', |
||||||
|
popConfirm: { |
||||||
|
title: '是否随机生成专家', |
||||||
|
confirm: createexp.bind(null, record), |
||||||
|
placement: 'topLeft' |
||||||
|
}, |
||||||
|
} |
||||||
|
] |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------------以下为原生查询需要添加的-------------------------- */ |
||||||
|
const toggleSearchStatus = ref<boolean>(false); |
||||||
|
const labelCol = reactive({ |
||||||
|
xs:24, |
||||||
|
sm:4, |
||||||
|
xl:6, |
||||||
|
xxl:4 |
||||||
|
}); |
||||||
|
const wrapperCol = reactive({ |
||||||
|
xs: 24, |
||||||
|
sm: 20, |
||||||
|
}); |
||||||
|
/** |
||||||
|
* 重置 |
||||||
|
*/ |
||||||
|
function searchReset() { |
||||||
|
formRef.value.resetFields(); |
||||||
|
selectedRowKeys.value = []; |
||||||
|
//刷新数据 |
||||||
|
reload(); |
||||||
|
} |
||||||
|
|
||||||
|
</script> |
||||||
|
<style lang="less" scoped> |
||||||
|
.jeecg-basic-table-form-container { |
||||||
|
padding: 0; |
||||||
|
.table-page-search-submitButtons { |
||||||
|
display: block; |
||||||
|
margin-bottom: 24px; |
||||||
|
white-space: nowrap; |
||||||
|
} |
||||||
|
.query-group-cust{ |
||||||
|
min-width: 100px !important; |
||||||
|
} |
||||||
|
.query-group-split-cust{ |
||||||
|
width: 30px; |
||||||
|
display: inline-block; |
||||||
|
text-align: center |
||||||
|
} |
||||||
|
.ant-form-item:not(.ant-form-item-with-help){ |
||||||
|
margin-bottom: 16px; |
||||||
|
height: 32px; |
||||||
|
} |
||||||
|
:deep(.ant-picker),:deep(.ant-input-number){ |
||||||
|
width: 100%; |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
@ -0,0 +1,26 @@ |
|||||||
|
-- 注意:该页面对应的前台目录为views/expproject文件夹下 |
||||||
|
-- 如果你想更改到其他目录,请修改sql中component字段对应的值 |
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) |
||||||
|
VALUES ('202410230508460320', NULL, '专家项目表', '/expproject/expprojectList', 'expproject/ExpprojectList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2024-10-23 17:08:32', NULL, NULL, 0); |
||||||
|
|
||||||
|
-- 权限控制sql |
||||||
|
-- 新增 |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('202410230508460321', '202410230508460320', '添加专家项目表', NULL, NULL, 0, NULL, NULL, 2, 'expproject:expproject:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-10-23 17:08:32', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 编辑 |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('202410230508460322', '202410230508460320', '编辑专家项目表', NULL, NULL, 0, NULL, NULL, 2, 'expproject:expproject:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-10-23 17:08:32', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 删除 |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('202410230508460323', '202410230508460320', '删除专家项目表', NULL, NULL, 0, NULL, NULL, 2, 'expproject:expproject:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-10-23 17:08:32', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 批量删除 |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('202410230508460324', '202410230508460320', '批量删除专家项目表', NULL, NULL, 0, NULL, NULL, 2, 'expproject:expproject:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-10-23 17:08:32', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 导出excel |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('202410230508460325', '202410230508460320', '导出excel_专家项目表', NULL, NULL, 0, NULL, NULL, 2, 'expproject:expproject:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-10-23 17:08:32', NULL, NULL, 0, 0, '1', 0); |
||||||
|
-- 导入excel |
||||||
|
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
||||||
|
VALUES ('202410230508460326', '202410230508460320', '导入excel_专家项目表', NULL, NULL, 0, NULL, NULL, 2, 'expproject:expproject:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-10-23 17:08:32', NULL, NULL, 0, 0, '1', 0); |
@ -0,0 +1,227 @@ |
|||||||
|
<template> |
||||||
|
<a-spin :spinning="loading"> |
||||||
|
<JFormContainer :disabled="disabled"> |
||||||
|
<template #detail> |
||||||
|
<a-form v-bind="formItemLayout" name="ExpprojectForm" ref="formRef"> |
||||||
|
<a-row> |
||||||
|
<a-col :span="24"> |
||||||
|
<a-form-item label="项目名称" v-bind="validateInfos.proname" id="ExpprojectForm-proname" name="proname"> |
||||||
|
<a-input v-model:value="formData.proname" placeholder="请输入项目名称" allow-clear ></a-input> |
||||||
|
</a-form-item> |
||||||
|
</a-col> |
||||||
|
<a-col :span="24"> |
||||||
|
<a-form-item label="专家类型" v-bind="validateInfos.exptype" id="ExpprojectForm-exptype" name="exptype"> |
||||||
|
<j-search-select v-model:value="formData.exptype" dict="discipline_fieid,name,id" allow-clear /> |
||||||
|
</a-form-item> |
||||||
|
</a-col> |
||||||
|
<a-col :span="24"> |
||||||
|
<a-form-item label="需要专家个数" v-bind="validateInfos.needexp" id="ExpprojectForm-needexp" name="needexp"> |
||||||
|
<a-input-number v-model:value="formData.needexp" placeholder="请输入需要专家个数" style="width: 100%" /> |
||||||
|
</a-form-item> |
||||||
|
</a-col> |
||||||
|
<a-col :span="24"> |
||||||
|
<a-form-item label="简介" v-bind="validateInfos.proinfo" id="ExpprojectForm-proinfo" name="proinfo"> |
||||||
|
<a-textarea v-model:value="formData.proinfo" :rows="4" placeholder="请输入简介" /> |
||||||
|
</a-form-item> |
||||||
|
</a-col> |
||||||
|
<a-col :span="24"> |
||||||
|
<a-form-item label="附件" v-bind="validateInfos.profile" id="ExpprojectForm-profile" name="profile"> |
||||||
|
<j-upload v-model:value="formData.profile" ></j-upload> |
||||||
|
</a-form-item> |
||||||
|
</a-col> |
||||||
|
</a-row> |
||||||
|
</a-form> |
||||||
|
</template> |
||||||
|
</JFormContainer> |
||||||
|
|
||||||
|
<!-- 子表单区域 --> |
||||||
|
<a-tabs v-model:activeKey="activeKey" animated> |
||||||
|
<a-tab-pane tab="评审专家" key="expandpro" :forceRender="true"> |
||||||
|
<j-vxe-table |
||||||
|
:keep-source="true" |
||||||
|
resizable |
||||||
|
ref="expandproTableRef" |
||||||
|
:loading="expandproTable.loading" |
||||||
|
:columns="expandproTable.columns" |
||||||
|
:dataSource="expandproTable.dataSource" |
||||||
|
:height="340" |
||||||
|
:disabled="disabled" |
||||||
|
:rowNumber="true" |
||||||
|
:rowSelection="true" |
||||||
|
:toolbar="true"/> |
||||||
|
</a-tab-pane> |
||||||
|
</a-tabs> |
||||||
|
</a-spin> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script lang="ts"> |
||||||
|
import { defineComponent, ref, reactive, computed, toRaw, onMounted } from 'vue'; |
||||||
|
import { defHttp } from '/@/utils/http/axios'; |
||||||
|
import { useValidateAntFormAndTable } from '/@/hooks/system/useJvxeMethods'; |
||||||
|
import { queryExpandproListByMainId, queryDataById, saveOrUpdate } from '../Expproject.api'; |
||||||
|
import { JVxeTable } from '/@/components/jeecg/JVxeTable'; |
||||||
|
import {expandproColumns} from '../Expproject.data'; |
||||||
|
import JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue'; |
||||||
|
import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue'; |
||||||
|
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue'; |
||||||
|
import { Form } from 'ant-design-vue'; |
||||||
|
const useForm = Form.useForm; |
||||||
|
|
||||||
|
export default defineComponent({ |
||||||
|
name: "ExpprojectForm", |
||||||
|
components:{ |
||||||
|
JSearchSelect, |
||||||
|
JUpload, |
||||||
|
JVxeTable, |
||||||
|
JFormContainer, |
||||||
|
}, |
||||||
|
props:{ |
||||||
|
formDisabled:{ |
||||||
|
type: Boolean, |
||||||
|
default: false |
||||||
|
}, |
||||||
|
formData: { type: Object, default: ()=>{} }, |
||||||
|
formBpm: { type: Boolean, default: true } |
||||||
|
}, |
||||||
|
emits:['success'], |
||||||
|
setup(props, {emit}) { |
||||||
|
const loading = ref(false); |
||||||
|
const formRef = ref(); |
||||||
|
const expandproTableRef = ref(); |
||||||
|
const expandproTable = reactive<Record<string, any>>({ |
||||||
|
loading: false, |
||||||
|
columns: expandproColumns, |
||||||
|
dataSource: [] |
||||||
|
}); |
||||||
|
const activeKey = ref('expandpro'); |
||||||
|
const formData = reactive<Record<string, any>>({ |
||||||
|
id: '', |
||||||
|
proname: '', |
||||||
|
exptype: '', |
||||||
|
needexp: 0, |
||||||
|
proinfo: '', |
||||||
|
profile: '', |
||||||
|
}); |
||||||
|
|
||||||
|
//表单验证 |
||||||
|
const validatorRules = reactive({ |
||||||
|
needexp: [{ required: false}, { pattern: /^-?\d+$/, message: '请输入整数!'},], |
||||||
|
}); |
||||||
|
const {resetFields, validate, validateInfos} = useForm(formData, validatorRules, {immediate: false}); |
||||||
|
const dbData = {}; |
||||||
|
const formItemLayout = { |
||||||
|
labelCol: {xs: {span: 24}, sm: {span: 5}}, |
||||||
|
wrapperCol: {xs: {span: 24}, sm: {span: 16}}, |
||||||
|
}; |
||||||
|
|
||||||
|
// 表单禁用 |
||||||
|
const disabled = computed(()=>{ |
||||||
|
if(props.formBpm === true){ |
||||||
|
if(props.formData.disabled === false){ |
||||||
|
return false; |
||||||
|
}else{ |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
|
return props.formDisabled; |
||||||
|
}); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function add() { |
||||||
|
resetFields(); |
||||||
|
expandproTable.dataSource = []; |
||||||
|
} |
||||||
|
|
||||||
|
async function edit(row) { |
||||||
|
//主表数据 |
||||||
|
await queryMainData(row.id); |
||||||
|
//子表数据 |
||||||
|
const expandproDataList = await queryExpandproListByMainId(row['id']); |
||||||
|
expandproTable.dataSource = [...expandproDataList]; |
||||||
|
} |
||||||
|
|
||||||
|
async function queryMainData(id) { |
||||||
|
const row = await queryDataById(id); |
||||||
|
resetFields(); |
||||||
|
const tmpData = {}; |
||||||
|
Object.keys(formData).forEach((key) => { |
||||||
|
if(row.hasOwnProperty(key)){ |
||||||
|
tmpData[key] = row[key] |
||||||
|
} |
||||||
|
}) |
||||||
|
//赋值 |
||||||
|
Object.assign(formData,tmpData); |
||||||
|
} |
||||||
|
|
||||||
|
const {getSubFormAndTableData, transformData} = useValidateAntFormAndTable(activeKey, { |
||||||
|
'expandpro': expandproTableRef, |
||||||
|
}); |
||||||
|
|
||||||
|
async function getFormData() { |
||||||
|
try { |
||||||
|
// 触发表单验证 |
||||||
|
await validate(); |
||||||
|
} catch ({ errorFields }) { |
||||||
|
if (errorFields) { |
||||||
|
const firstField = errorFields[0]; |
||||||
|
if (firstField) { |
||||||
|
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' }); |
||||||
|
} |
||||||
|
} |
||||||
|
return Promise.reject(errorFields); |
||||||
|
} |
||||||
|
return transformData(toRaw(formData)) |
||||||
|
} |
||||||
|
|
||||||
|
async function submitForm() { |
||||||
|
const mainData = await getFormData(); |
||||||
|
const subData = await getSubFormAndTableData(); |
||||||
|
const values = Object.assign({}, dbData, mainData, subData); |
||||||
|
console.log('表单提交数据', values) |
||||||
|
const isUpdate = values.id ? true : false |
||||||
|
await saveOrUpdate(values, isUpdate); |
||||||
|
//关闭弹窗 |
||||||
|
emit('success'); |
||||||
|
} |
||||||
|
|
||||||
|
function setFieldsValue(values) { |
||||||
|
if(values){ |
||||||
|
Object.keys(values).map(k=>{ |
||||||
|
formData[k] = values[k]; |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 值改变事件触发-树控件回调 |
||||||
|
* @param key |
||||||
|
* @param value |
||||||
|
*/ |
||||||
|
function handleFormChange(key, value) { |
||||||
|
formData[key] = value; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
return { |
||||||
|
expandproTableRef, |
||||||
|
expandproTable, |
||||||
|
validatorRules, |
||||||
|
validateInfos, |
||||||
|
activeKey, |
||||||
|
loading, |
||||||
|
formData, |
||||||
|
setFieldsValue, |
||||||
|
handleFormChange, |
||||||
|
formItemLayout, |
||||||
|
disabled, |
||||||
|
getFormData, |
||||||
|
submitForm, |
||||||
|
add, |
||||||
|
edit, |
||||||
|
formRef, |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
</script> |
||||||
|
<style lang="less" scoped></style> |
@ -0,0 +1,67 @@ |
|||||||
|
<template> |
||||||
|
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" :width="800" @ok="handleSubmit"> |
||||||
|
<expproject-form ref="formComponent" :formDisabled="formDisabled" :formBpm="false" @success="submitSuccess"></expproject-form> |
||||||
|
</BasicModal> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script lang="ts"> |
||||||
|
import { ref, unref } from 'vue'; |
||||||
|
import { BasicModal, useModalInner } from '/@/components/Modal'; |
||||||
|
import ExpprojectForm from './ExpprojectForm.vue'; |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "TestCgMainVxeModal", |
||||||
|
components:{ |
||||||
|
BasicModal, |
||||||
|
ExpprojectForm |
||||||
|
}, |
||||||
|
emits:['register','success'], |
||||||
|
setup(_p, {emit}){ |
||||||
|
const formComponent = ref() |
||||||
|
const isUpdate = ref(true); |
||||||
|
const formDisabled = ref(false); |
||||||
|
const title = ref('') |
||||||
|
|
||||||
|
//表单赋值 |
||||||
|
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { |
||||||
|
setModalProps({confirmLoading: false,showCancelBtn:data?.showFooter,showOkBtn:data?.showFooter}); |
||||||
|
isUpdate.value = !!data?.isUpdate; |
||||||
|
formDisabled.value = !data?.showFooter; |
||||||
|
title.value = data?.isUpdate ? (unref(formDisabled) ? '详情' : '编辑') : '新增'; |
||||||
|
if (unref(isUpdate)) { |
||||||
|
formComponent.value.edit(data.record) |
||||||
|
}else{ |
||||||
|
formComponent.value.add() |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
function handleSubmit() { |
||||||
|
formComponent.value.submitForm(); |
||||||
|
} |
||||||
|
|
||||||
|
function submitSuccess(){ |
||||||
|
emit('success'); |
||||||
|
closeModal(); |
||||||
|
} |
||||||
|
|
||||||
|
return { |
||||||
|
registerModal, |
||||||
|
title, |
||||||
|
formComponent, |
||||||
|
formDisabled, |
||||||
|
handleSubmit, |
||||||
|
submitSuccess |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
||||||
|
<style lang="less" scoped> |
||||||
|
/** 时间和数字输入框样式 */ |
||||||
|
:deep(.ant-input-number) { |
||||||
|
width: 100%; |
||||||
|
} |
||||||
|
|
||||||
|
:deep(.ant-calendar-picker) { |
||||||
|
width: 100%; |
||||||
|
} |
||||||
|
</style> |
Loading…
Reference in new issue