Commit f69c6930 by ZP

feat(jcsj/bzxx): 更新班组信息组件配置和数据获取逻辑

- 更改API路径从CodeGeneration/selection到/bmxx/getEmployeeList和/bmxx/getworkteamList
- 更新API配置包括新的apiId、apiParams和SQL查询脚本
- 添加自定义渲染函数处理managerName和parentName显示
- 修改字段配置将placeholder设为自动生成,禁用自动编号字段
- 重构子表单配置将rokeEmployeeList更改为rokeWorkTeamEmployeeRelList
- 添加班组id和班组成员等新字段配置并设置为禁用状态
- 更新权限配置同步字段名称变更
- 实现afterFetch钩子异步获取员工和班组信息并映射到对应字段
parent 2fcdcc8a
...@@ -22,9 +22,16 @@ export const searchFormSchema: FormSchema[] = [ ...@@ -22,9 +22,16 @@ export const searchFormSchema: FormSchema[] = [
componentProps: { componentProps: {
datasourceType: 'api', datasourceType: 'api',
apiConfig: { apiConfig: {
path: 'CodeGeneration/selection', path: '/bmxx/getEmployeeList',
method: 'GET', method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7', apiId: 'copy1765432049337d61208',
apiParams: [
{ key: '1', title: 'Query Params', tableInfo: [] },
{ key: '2', title: 'Header', tableInfo: [] },
{ key: '3', title: 'Body' },
],
script:
'var sql="select *,id as value,name as label from roke_employee where active = 1 and delete_mark = 0";\r\nreturn db.select(sql);',
}, },
labelField: 'label', labelField: 'label',
valueField: 'value', valueField: 'value',
...@@ -41,9 +48,16 @@ export const searchFormSchema: FormSchema[] = [ ...@@ -41,9 +48,16 @@ export const searchFormSchema: FormSchema[] = [
componentProps: { componentProps: {
datasourceType: 'api', datasourceType: 'api',
apiConfig: { apiConfig: {
path: 'CodeGeneration/selection', path: '/bmxx/getworkteamList',
method: 'GET', method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7', apiId: 'eeb487680f4a46f8b6bb1113a443fff4',
apiParams: [
{ key: '1', title: 'Query Params', tableInfo: [] },
{ key: '2', title: 'Header', tableInfo: [] },
{ key: '3', title: 'Body' },
],
script:
'var sql="select id as value,name as label from roke_work_team";\r\nreturn db.select(sql);',
}, },
labelField: 'label', labelField: 'label',
valueField: 'value', valueField: 'value',
...@@ -98,6 +112,7 @@ export const columns: BasicColumn[] = [ ...@@ -98,6 +112,7 @@ export const columns: BasicColumn[] = [
styleConfig: undefined, styleConfig: undefined,
listStyle: undefined, listStyle: undefined,
customRender: ({ record }) => record.managerName || record.managerId,
}, },
{ {
...@@ -111,6 +126,7 @@ export const columns: BasicColumn[] = [ ...@@ -111,6 +126,7 @@ export const columns: BasicColumn[] = [
styleConfig: undefined, styleConfig: undefined,
listStyle: undefined, listStyle: undefined,
customRender: ({ record }) => record.parentName || record.parentId,
}, },
{ {
...@@ -220,16 +236,16 @@ export const formProps: FormProps = { ...@@ -220,16 +236,16 @@ export const formProps: FormProps = {
width: '100%', width: '100%',
span: 7, span: 7,
defaultValue: '', defaultValue: '',
placeholder: '', placeholder: '自动生成',
maxlength: null, maxlength: null,
prefix: '', prefix: '',
suffix: '', suffix: '',
addonBefore: '', addonBefore: '',
addonAfter: '', addonAfter: '',
disabled: false, disabled: true,
allowClear: false, allowClear: false,
showLabel: true, showLabel: true,
required: true, required: false,
rules: [], rules: [],
events: {}, events: {},
listStyle: '', listStyle: '',
...@@ -308,9 +324,16 @@ export const formProps: FormProps = { ...@@ -308,9 +324,16 @@ export const formProps: FormProps = {
labelField: 'label', labelField: 'label',
valueField: 'value', valueField: 'value',
apiConfig: { apiConfig: {
path: 'CodeGeneration/selection', path: '/bmxx/getEmployeeList',
method: 'GET', method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7', apiId: 'copy1765432049337d61208',
apiParams: [
{ key: '1', title: 'Query Params', tableInfo: [] },
{ key: '2', title: 'Header', tableInfo: [] },
{ key: '3', title: 'Body' },
],
script:
'var sql="select *,id as value,name as label from roke_employee where active = 1 and delete_mark = 0";\r\nreturn db.select(sql);',
}, },
dicOptions: [], dicOptions: [],
required: false, required: false,
...@@ -349,9 +372,16 @@ export const formProps: FormProps = { ...@@ -349,9 +372,16 @@ export const formProps: FormProps = {
labelField: 'label', labelField: 'label',
valueField: 'value', valueField: 'value',
apiConfig: { apiConfig: {
path: 'CodeGeneration/selection', path: '/bmxx/getworkteamList',
method: 'GET', method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7', apiId: 'eeb487680f4a46f8b6bb1113a443fff4',
apiParams: [
{ key: '1', title: 'Query Params', tableInfo: [] },
{ key: '2', title: 'Header', tableInfo: [] },
{ key: '3', title: 'Body' },
],
script:
'var sql="select id as value,name as label from roke_work_team";\r\nreturn db.select(sql);',
}, },
dicOptions: [], dicOptions: [],
required: false, required: false,
...@@ -457,18 +487,18 @@ export const formProps: FormProps = { ...@@ -457,18 +487,18 @@ export const formProps: FormProps = {
{ {
key: '203371e1507844af97e5b82500bfc0c8', key: '203371e1507844af97e5b82500bfc0c8',
label: '', label: '',
field: 'rokeEmployeeList', field: 'rokeWorkTeamEmployeeRelList',
type: 'form', type: 'form',
component: 'SubForm', component: 'SubForm',
required: true, required: true,
colProps: { span: 24 }, colProps: { span: 24 },
componentProps: { componentProps: {
mainKey: 'rokeEmployeeList', mainKey: 'rokeWorkTeamEmployeeRelList',
columns: [ columns: [
{ {
key: '62efed4085cf4e368a702b2f8f76eabc', key: '41c418f3422e411fba4025e1ba607791',
title: '班组成员', title: '班组id',
dataIndex: 'name', dataIndex: 'workTeamId',
componentType: 'Input', componentType: 'Input',
defaultValue: '', defaultValue: '',
componentProps: { componentProps: {
...@@ -489,6 +519,37 @@ export const formProps: FormProps = { ...@@ -489,6 +519,37 @@ export const formProps: FormProps = {
events: {}, events: {},
listStyle: '', listStyle: '',
isSave: false, isSave: false,
isShow: false,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: '1beafaffe43343a0b16f99b251346fea',
title: '班组成员',
dataIndex: 'danXingWenBen1923',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: true,
isShow: true, isShow: true,
scan: false, scan: false,
bordered: true, bordered: true,
...@@ -497,9 +558,9 @@ export const formProps: FormProps = { ...@@ -497,9 +558,9 @@ export const formProps: FormProps = {
}, },
}, },
{ {
key: 'e975697cbcf24c8a92cab2801ff637a0', key: '6788a481e9e7433b9c36e8dad4eeccdd',
title: '编号', title: '编号',
dataIndex: 'code', dataIndex: 'danXingWenBen7962',
componentType: 'Input', componentType: 'Input',
defaultValue: '', defaultValue: '',
componentProps: { componentProps: {
...@@ -512,14 +573,14 @@ export const formProps: FormProps = { ...@@ -512,14 +573,14 @@ export const formProps: FormProps = {
suffix: '', suffix: '',
addonBefore: '', addonBefore: '',
addonAfter: '', addonAfter: '',
disabled: false, disabled: true,
allowClear: false, allowClear: false,
showLabel: true, showLabel: true,
required: false, required: false,
rules: [], rules: [],
events: {}, events: {},
listStyle: '', listStyle: '',
isSave: false, isSave: true,
isShow: true, isShow: true,
scan: false, scan: false,
bordered: true, bordered: true,
...@@ -528,9 +589,9 @@ export const formProps: FormProps = { ...@@ -528,9 +589,9 @@ export const formProps: FormProps = {
}, },
}, },
{ {
key: '24544b2861214e55aca40e9963bbf656', key: '7b9f6f042ea340d09409b007adf681db',
title: '工号', title: '工号',
dataIndex: 'jobNumber', dataIndex: 'gongHao4014',
componentType: 'Input', componentType: 'Input',
defaultValue: '', defaultValue: '',
componentProps: { componentProps: {
...@@ -543,14 +604,14 @@ export const formProps: FormProps = { ...@@ -543,14 +604,14 @@ export const formProps: FormProps = {
suffix: '', suffix: '',
addonBefore: '', addonBefore: '',
addonAfter: '', addonAfter: '',
disabled: false, disabled: true,
allowClear: false, allowClear: false,
showLabel: true, showLabel: true,
required: false, required: false,
rules: [], rules: [],
events: {}, events: {},
listStyle: '', listStyle: '',
isSave: false, isSave: true,
isShow: true, isShow: true,
scan: false, scan: false,
bordered: true, bordered: true,
...@@ -559,9 +620,9 @@ export const formProps: FormProps = { ...@@ -559,9 +620,9 @@ export const formProps: FormProps = {
}, },
}, },
{ {
key: '744dd16ab5a142168c82096ea8a6ef27', key: '9170dea64ef8410597607c96057b7eeb',
title: '电话', title: '电话',
dataIndex: 'phone', dataIndex: 'dianHua7940',
componentType: 'Input', componentType: 'Input',
defaultValue: '', defaultValue: '',
componentProps: { componentProps: {
...@@ -574,25 +635,25 @@ export const formProps: FormProps = { ...@@ -574,25 +635,25 @@ export const formProps: FormProps = {
suffix: '', suffix: '',
addonBefore: '', addonBefore: '',
addonAfter: '', addonAfter: '',
disabled: false, disabled: true,
allowClear: false, allowClear: false,
showLabel: true, showLabel: true,
required: false, required: false,
rules: [], rules: [],
events: {}, events: {},
listStyle: '', listStyle: '',
isSave: false, isSave: true,
isShow: true, isShow: true,
scan: false, scan: false,
bordered: true, bordered: true,
isShowAi: true, isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' }, tooltipConfig: { visible: false, title: '提示文本' },
}, },
}, },
{ {
key: '57acb3998b07400e9661dfadff3debc3', key: '526f26d97e2e4b1f9800348c295d0d7d',
title: '职位', title: '职位',
dataIndex: 'positionId', dataIndex: 'zhiWei8331',
componentType: 'Input', componentType: 'Input',
defaultValue: '', defaultValue: '',
componentProps: { componentProps: {
...@@ -605,14 +666,14 @@ export const formProps: FormProps = { ...@@ -605,14 +666,14 @@ export const formProps: FormProps = {
suffix: '', suffix: '',
addonBefore: '', addonBefore: '',
addonAfter: '', addonAfter: '',
disabled: false, disabled: true,
allowClear: false, allowClear: false,
showLabel: true, showLabel: true,
required: false, required: false,
rules: [], rules: [],
events: {}, events: {},
listStyle: '', listStyle: '',
isSave: false, isSave: true,
isShow: true, isShow: true,
scan: false, scan: false,
bordered: true, bordered: true,
...@@ -621,9 +682,9 @@ export const formProps: FormProps = { ...@@ -621,9 +682,9 @@ export const formProps: FormProps = {
}, },
}, },
{ {
key: '4369fd57584d4ffc9b1d1392302b4348', key: 'f95aab6e4e4a46b2ba2e6b679f3521d8',
title: '部门', title: '部门',
dataIndex: 'departmentId', dataIndex: 'danXingWenBen7768',
componentType: 'Input', componentType: 'Input',
defaultValue: '', defaultValue: '',
componentProps: { componentProps: {
...@@ -636,14 +697,14 @@ export const formProps: FormProps = { ...@@ -636,14 +697,14 @@ export const formProps: FormProps = {
suffix: '', suffix: '',
addonBefore: '', addonBefore: '',
addonAfter: '', addonAfter: '',
disabled: false, disabled: true,
allowClear: false, allowClear: false,
showLabel: true, showLabel: true,
required: false, required: false,
rules: [], rules: [],
events: {}, events: {},
listStyle: '', listStyle: '',
isSave: false, isSave: true,
isShow: true, isShow: true,
scan: false, scan: false,
bordered: true, bordered: true,
...@@ -652,9 +713,9 @@ export const formProps: FormProps = { ...@@ -652,9 +713,9 @@ export const formProps: FormProps = {
}, },
}, },
{ {
key: 'ebc9d43a5f654f00b3d9e4414a715dfd', key: '03da44c148cb46c988a63c5d1f9f173e',
title: '技能等级', title: '技能等级',
dataIndex: 'skillLevelId', dataIndex: 'jiNenDengJi2532',
componentType: 'Input', componentType: 'Input',
defaultValue: '', defaultValue: '',
componentProps: { componentProps: {
...@@ -667,14 +728,14 @@ export const formProps: FormProps = { ...@@ -667,14 +728,14 @@ export const formProps: FormProps = {
suffix: '', suffix: '',
addonBefore: '', addonBefore: '',
addonAfter: '', addonAfter: '',
disabled: false, disabled: true,
allowClear: false, allowClear: false,
showLabel: true, showLabel: true,
required: false, required: false,
rules: [], rules: [],
events: {}, events: {},
listStyle: '', listStyle: '',
isSave: false, isSave: true,
isShow: true, isShow: true,
scan: false, scan: false,
bordered: true, bordered: true,
......
export const permissionList = [ export const permissionList = [
{ {
required: true, required: false,
view: true, view: true,
edit: true, edit: false,
disabled: false, disabled: false,
isSaveTable: false, isSaveTable: false,
tableName: '', tableName: '',
...@@ -106,9 +106,9 @@ export const permissionList = [ ...@@ -106,9 +106,9 @@ export const permissionList = [
disabled: false, disabled: false,
isSubTable: true, isSubTable: true,
showChildren: false, showChildren: false,
tableName: 'rokeEmployeeList', tableName: 'rokeWorkTeamEmployeeRelList',
fieldName: '', fieldName: '',
fieldId: 'rokeEmployeeList', fieldId: 'rokeWorkTeamEmployeeRelList',
type: 'form', type: 'form',
key: '203371e1507844af97e5b82500bfc0c8', key: '203371e1507844af97e5b82500bfc0c8',
children: [ children: [
...@@ -120,11 +120,26 @@ export const permissionList = [ ...@@ -120,11 +120,26 @@ export const permissionList = [
isSubTable: false, isSubTable: false,
isSaveTable: false, isSaveTable: false,
showChildren: false, showChildren: false,
tableName: 'rokeEmployeeList', tableName: 'rokeWorkTeamEmployeeRelList',
fieldName: '班组id',
fieldId: 'workTeamId',
type: 'Input',
key: '41c418f3422e411fba4025e1ba607791',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'rokeWorkTeamEmployeeRelList',
fieldName: '班组成员', fieldName: '班组成员',
fieldId: 'name', fieldId: 'danXingWenBen1923',
type: 'Input', type: 'Input',
key: '62efed4085cf4e368a702b2f8f76eabc', key: '1beafaffe43343a0b16f99b251346fea',
children: [], children: [],
}, },
{ {
...@@ -135,11 +150,11 @@ export const permissionList = [ ...@@ -135,11 +150,11 @@ export const permissionList = [
isSubTable: false, isSubTable: false,
isSaveTable: false, isSaveTable: false,
showChildren: false, showChildren: false,
tableName: 'rokeEmployeeList', tableName: 'rokeWorkTeamEmployeeRelList',
fieldName: '编号', fieldName: '编号',
fieldId: 'code', fieldId: 'danXingWenBen7962',
type: 'Input', type: 'Input',
key: 'e975697cbcf24c8a92cab2801ff637a0', key: '6788a481e9e7433b9c36e8dad4eeccdd',
children: [], children: [],
}, },
{ {
...@@ -150,11 +165,11 @@ export const permissionList = [ ...@@ -150,11 +165,11 @@ export const permissionList = [
isSubTable: false, isSubTable: false,
isSaveTable: false, isSaveTable: false,
showChildren: false, showChildren: false,
tableName: 'rokeEmployeeList', tableName: 'rokeWorkTeamEmployeeRelList',
fieldName: '工号', fieldName: '工号',
fieldId: 'jobNumber', fieldId: 'gongHao4014',
type: 'Input', type: 'Input',
key: '24544b2861214e55aca40e9963bbf656', key: '7b9f6f042ea340d09409b007adf681db',
children: [], children: [],
}, },
{ {
...@@ -165,11 +180,11 @@ export const permissionList = [ ...@@ -165,11 +180,11 @@ export const permissionList = [
isSubTable: false, isSubTable: false,
isSaveTable: false, isSaveTable: false,
showChildren: false, showChildren: false,
tableName: 'rokeEmployeeList', tableName: 'rokeWorkTeamEmployeeRelList',
fieldName: '电话', fieldName: '电话',
fieldId: 'phone', fieldId: 'dianHua7940',
type: 'Input', type: 'Input',
key: '744dd16ab5a142168c82096ea8a6ef27', key: '9170dea64ef8410597607c96057b7eeb',
children: [], children: [],
}, },
{ {
...@@ -180,11 +195,11 @@ export const permissionList = [ ...@@ -180,11 +195,11 @@ export const permissionList = [
isSubTable: false, isSubTable: false,
isSaveTable: false, isSaveTable: false,
showChildren: false, showChildren: false,
tableName: 'rokeEmployeeList', tableName: 'rokeWorkTeamEmployeeRelList',
fieldName: '职位', fieldName: '职位',
fieldId: 'positionId', fieldId: 'zhiWei8331',
type: 'Input', type: 'Input',
key: '57acb3998b07400e9661dfadff3debc3', key: '526f26d97e2e4b1f9800348c295d0d7d',
children: [], children: [],
}, },
{ {
...@@ -195,11 +210,11 @@ export const permissionList = [ ...@@ -195,11 +210,11 @@ export const permissionList = [
isSubTable: false, isSubTable: false,
isSaveTable: false, isSaveTable: false,
showChildren: false, showChildren: false,
tableName: 'rokeEmployeeList', tableName: 'rokeWorkTeamEmployeeRelList',
fieldName: '部门', fieldName: '部门',
fieldId: 'departmentId', fieldId: 'danXingWenBen7768',
type: 'Input', type: 'Input',
key: '4369fd57584d4ffc9b1d1392302b4348', key: 'f95aab6e4e4a46b2ba2e6b679f3521d8',
children: [], children: [],
}, },
{ {
...@@ -210,11 +225,11 @@ export const permissionList = [ ...@@ -210,11 +225,11 @@ export const permissionList = [
isSubTable: false, isSubTable: false,
isSaveTable: false, isSaveTable: false,
showChildren: false, showChildren: false,
tableName: 'rokeEmployeeList', tableName: 'rokeWorkTeamEmployeeRelList',
fieldName: '技能等级', fieldName: '技能等级',
fieldId: 'skillLevelId', fieldId: 'jiNenDengJi2532',
type: 'Input', type: 'Input',
key: 'ebc9d43a5f654f00b3d9e4414a715dfd', key: '03da44c148cb46c988a63c5d1f9f173e',
children: [], children: [],
}, },
], ],
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
import CustomButtonModal from '/@/components/Form/src/components/CustomButtonModal.vue'; import CustomButtonModal from '/@/components/Form/src/components/CustomButtonModal.vue';
import { executeListStyle, getValue } from '/@/hooks/web/useListStyle';//列表样式配置 import { executeListStyle, getValue } from '/@/hooks/web/useListStyle';//列表样式配置
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { defHttp } from '/@/utils/http/axios';
...@@ -184,12 +185,55 @@ ...@@ -184,12 +185,55 @@
pageParamsInfo.value = {...params, FormId: formIdComputedRef.value,PK: 'id' } pageParamsInfo.value = {...params, FormId: formIdComputedRef.value,PK: 'id' }
return pageParamsInfo.value; return pageParamsInfo.value;
}, },
afterFetch: (res) => { afterFetch: async (res) => {
if (res && res.items && res.items.length > 0) {
const managerIds = [...new Set(res.items.map(item => item.managerId).filter(Boolean))];
const parentIds = [...new Set(res.items.map(item => item.parentId).filter(Boolean))];
const managerMap = new Map();
const parentMap = new Map();
if (managerIds.length > 0) {
try {
const managerRes = await defHttp.get({
url: '/bmxx/getEmployeeList',
params: { ids: managerIds.join(',') },
});
if (managerRes && managerRes.length > 0) {
managerRes.forEach(item => {
managerMap.set(item.id, item.name);
});
}
} catch (error) {
console.error('获取班组长信息失败:', error);
}
}
if (parentIds.length > 0) {
try {
const parentRes = await defHttp.get({
url: '/bmxx/getworkteamList',
params: { ids: parentIds.join(',') },
});
if (parentRes && parentRes.length > 0) {
parentRes.forEach(item => {
parentMap.set(item.id, item.name);
});
}
} catch (error) {
console.error('获取上级班组信息失败:', error);
}
}
res.items.forEach(item => {
if (item.managerId) {
item.managerName = managerMap.get(item.managerId) || item.managerId;
}
if (item.parentId) {
item.parentName = parentMap.get(item.parentId) || item.parentId;
}
});
}
}, },
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
...@@ -382,4 +426,4 @@ ...@@ -382,4 +426,4 @@
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment