Commit f6b76856 by 宋春膨

Merge remote-tracking branch 'origin/weiqiao-vue3' into weiqiao-vue3

parents 33196f48 713a778a
...@@ -8,9 +8,7 @@ enum Api { ...@@ -8,9 +8,7 @@ enum Api {
List = '/jcsj/ckwz/list', List = '/jcsj/ckwz/list',
Info = '/jcsj/ckwz/info', Info = '/jcsj/ckwz/info',
RokeStockLocation = '/jcsj/ckwz', RokeStockLocation = '/jcsj/ckwz',
Tree = '/jcsj/ckwz/tree',
} }
/** /**
...@@ -88,6 +86,20 @@ export async function deleteRokeStockLocation(ids: string[], mode: ErrorMessageM ...@@ -88,6 +86,20 @@ export async function deleteRokeStockLocation(ids: string[], mode: ErrorMessageM
); );
} }
/**
* @description: 获取位置树数据
*/
export async function getRokeStockLocationTree(mode: ErrorMessageMode = 'modal') {
return defHttp.get<any>(
{
url: Api.Tree,
},
{
errorMessageMode: mode,
},
);
}
...@@ -4,15 +4,13 @@ import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel'; ...@@ -4,15 +4,13 @@ import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
* @description: RokeProcess分页参数 模型 * @description: RokeProcess分页参数 模型
*/ */
export interface RokeProcessPageParams extends BasicPageParams { export interface RokeProcessPageParams extends BasicPageParams {
name: string; code: string;
defaultReporter: string; name: string;
categoryId: string; categoryId: string;
collectionSchemeId: string; collectionSchemeId: string;
note: string;
} }
/** /**
...@@ -21,18 +19,243 @@ export interface RokeProcessPageParams extends BasicPageParams { ...@@ -21,18 +19,243 @@ export interface RokeProcessPageParams extends BasicPageParams {
export interface RokeProcessPageModel { export interface RokeProcessPageModel {
id: string; id: string;
code: string;
name: string; name: string;
categoryId: string; categoryId: string;
collectionSchemeId: string; collectionSchemeId: string;
}
/**
* @description: RokeProcess表类型
*/
export interface RokeProcessModel {
id: string;
deleteMark: string;
messageMainAttachmentId: string;
name: string;
code: string;
categoryId: string;
processType: string;
internalCode: string;
active: string;
withoutWoProduce: string;
note: string;
ratedWorkingHours: string; ratedWorkingHours: string;
companyId: string;
isPress: string;
prepareWorkHours: string;
collectionSchemeId: string;
qualityMode: string;
qcSchemeId: string;
isQuality: string;
salaryType: string;
baseQty: string;
salaryUnit: string;
salary: string;
salaryCode: string;
qcSalaryBasis: string;
qcSalaryType: string;
qcBaseQty: string;
qcSalaryUnit: string;
qcSalary: string;
qcSalaryCode: string;
defaultReporter: string;
collectionItem: string;
inspectionCollectionItem: string;
inspectionScheme: string;
inspectionDepartment: string;
inspectionStaff: string;
defectProcessing: string;
createDate: string;
createUserId: string;
modifyDate: string;
modifyUserId: string;
zyzdFile: string;
zyzdtpFile: string;
mesProcessItemList?: MesProcessItemModel;
mesProcessProductList?: MesProcessProductModel;
}
/**
* @description: MesProcessItem表类型
*/
export interface MesProcessItemModel {
id: string;
processId: string;
code: string;
name: string;
required: string;
categoryId: string;
contentType: string;
dataType: string;
dictId: string;
relatedModelId: string;
relatedModelName: string;
relatedModelDomain: string;
standardValue: string;
upperValue: string;
lowerValue: string;
note: string; note: string;
companyId: string;
qualityCategoryId: string;
analysisMethod: string;
qualityMethodId: string;
destructive: string;
keyItem: string;
deleteMark: string;
createDate: string;
createUserId: string;
modifyDate: string;
modifyUserId: string;
} }
0; /**
* @description: MesProcessProduct表类型
*/
export interface MesProcessProductModel {
id: string;
deleteMark: string;
cpbh: string;
cpmc: string;
nbdm: string;
hjzt: string;
cptp: string;
kxs: string;
kcg: string;
wllx: string;
cplx: string;
gg: string;
xh: string;
fpl: string;
bzzl: string;
erpid: string;
zygf: string;
bz: string;
p1: string;
p2: string;
p3: string;
p4: string;
p5: string;
p6: string;
p7: string;
p8: string;
p9: string;
p10: string;
createDate: string;
createUserId: string;
modifyDate: string;
modifyUserId: string;
processId: string;
isFeeding: string;
number: string;
}
/** /**
* @description: RokeProcess分页返回值结构 * @description: RokeProcess分页返回值结构
......
...@@ -8,7 +8,7 @@ export const searchFormSchema: FormSchema[] = [ ...@@ -8,7 +8,7 @@ export const searchFormSchema: FormSchema[] = [
defaultValue: undefined, defaultValue: undefined,
component: 'Input', component: 'Input',
}, },
{ /* {
field: 'parentId', field: 'parentId',
label: '上级位置', label: '上级位置',
defaultValue: undefined, defaultValue: undefined,
...@@ -33,7 +33,7 @@ export const searchFormSchema: FormSchema[] = [ ...@@ -33,7 +33,7 @@ export const searchFormSchema: FormSchema[] = [
showSearch: true, showSearch: true,
getPopupContainer: () => document.body, getPopupContainer: () => document.body,
}, },
}, },*/
{ {
field: 'locationType', field: 'locationType',
label: '位置类型', label: '位置类型',
......
<template> <template>
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
<div class="w-1/5 xl:w-1/5 mr-2">
<ResizePageWrapper :hasLeft="false"> <BasicTree
title="上级位置"
toolbar
<template #resizeRight> search
<BasicTable @register="registerTable" isMenuTable ref="tableRef" :defaultExpandAll="true"
:clickRowToExpand="true"
:treeData="treeData"
:fieldNames="{ key: 'id', title: 'name' }"
@select="handleSelect"
> >
<template #title="item"> &nbsp;&nbsp;{{ item.name }} </template>
</BasicTree>
</div>
<div class="w-4/5 xl:w-4/5">
<BasicTable @register="registerTable" isMenuTable ref="tableRef">
<template #toolbar> <template #toolbar>
<template v-for="button in tableButtonConfig" :key="button.code"> <template v-for="button in tableButtonConfig" :key="button.code">
...@@ -45,29 +53,22 @@ ...@@ -45,29 +53,22 @@
</BasicTable> </BasicTable>
</template> </div>
<CkwzModal @register="registerModal" @success="handleFormSuccess" @cancel="handleFormCancel" />
</PageWrapper>
<CkwzModal @register="registerModal" @success="handleFormSuccess" @cancel="handleFormCancel"/>
</ResizePageWrapper>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed,provide,Ref, createVNode, import { ref, computed, provide, Ref, createVNode, onMounted
} from 'vue'; } from 'vue';
import { Modal } from 'ant-design-vue'; import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table'; import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getRokeStockLocationPage, deleteRokeStockLocation} from '/@/api/jcsj/ckwz'; import { getRokeStockLocationPage, deleteRokeStockLocation, getRokeStockLocationTree} from '/@/api/jcsj/ckwz';
import { ResizePageWrapper } from '/@/components/Page'; import { PageWrapper } from '/@/components/Page';
import { BasicTree, TreeItem } from '/@/components/Tree';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n'; import { useI18n } from '/@/hooks/web/useI18n';
import { usePermission } from '/@/hooks/web/usePermission'; import { usePermission } from '/@/hooks/web/usePermission';
...@@ -117,6 +118,10 @@ ...@@ -117,6 +118,10 @@
const { enableLockeData,handleOpenFormEnableLockeData, handleCloseFormEnableLocke, handleHasEnableLocke } = const { enableLockeData,handleOpenFormEnableLockeData, handleCloseFormEnableLocke, handleHasEnableLocke } =
useConcurrentLock(); useConcurrentLock();
// 树相关
const treeData = ref<TreeItem[]>([]);
const selectedParentId = ref<string>('');
const { notification } = useMessage(); const { notification } = useMessage();
const { t } = useI18n(); const { t } = useI18n();
defineEmits(['register']); defineEmits(['register']);
...@@ -181,7 +186,12 @@ ...@@ -181,7 +186,12 @@
}, },
bordered:false, bordered:false,
beforeFetch: (params) => { beforeFetch: (params) => {
pageParamsInfo.value = {...params, FormId: formIdComputedRef.value,PK: 'id' } pageParamsInfo.value = {
...params,
FormId: formIdComputedRef.value,
PK: 'id',
parentId: selectedParentId.value || undefined,
};
return pageParamsInfo.value; return pageParamsInfo.value;
}, },
afterFetch: (res) => { afterFetch: (res) => {
...@@ -298,11 +308,38 @@ ...@@ -298,11 +308,38 @@
} }
function handleSuccess() { function handleSuccess() {
reload();
}
// 树选择处理
function handleSelect(selectIds: string[]) {
selectedParentId.value = selectIds[0] || '';
reload(); reload();
}
// 加载树数据
async function loadTreeData() {
try {
const result = await getRokeStockLocationTree();
// 处理接口返回的数据格式:{code: 0, data: [...], success: true}
// defHttp 可能会自动提取 data,但也可能需要手动处理
let data = result;
if (result && typeof result === 'object' && 'data' in result && Array.isArray(result.data)) {
data = result.data;
} else if (result && typeof result === 'object' && 'success' in result && result.data) {
data = result.data;
}
if (Array.isArray(data)) {
treeData.value = data as TreeItem[];
}
} catch (error) {
console.error('加载位置树失败:', error);
} }
}
onMounted(() => {
loadTreeData();
});
function handleFormSuccess() { function handleFormSuccess() {
......
...@@ -4,36 +4,16 @@ import { uploadApi } from '/@/api/sys/upload'; ...@@ -4,36 +4,16 @@ import { uploadApi } from '/@/api/sys/upload';
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{ {
field: 'name', field: 'code',
label: '名称', label: '编码',
defaultValue: undefined, defaultValue: undefined,
component: 'Input', component: 'Input',
}, },
{ {
field: 'defaultReporter', field: 'name',
label: '默认报工人员', label: '名称',
defaultValue: undefined, defaultValue: undefined,
component: 'XjrSelect', component: 'Input',
componentProps: {
datasourceType: 'api',
apiConfig: {
path: '/bmxx/getEmployeeList',
method: 'GET',
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',
valueField: 'value',
mode: 'multiple',
showSearch: true,
getPopupContainer: () => document.body,
},
}, },
{ {
field: 'categoryId', field: 'categoryId',
...@@ -56,8 +36,19 @@ export const searchFormSchema: FormSchema[] = [ ...@@ -56,8 +36,19 @@ export const searchFormSchema: FormSchema[] = [
defaultValue: undefined, defaultValue: undefined,
component: 'XjrSelect', component: 'XjrSelect',
componentProps: { componentProps: {
datasourceType: 'staticData', datasourceType: 'api',
staticOptions: [{ key: 1, label: '无', value: '无' }], apiConfig: {
path: '/jcxx/getCollectionSchemeList',
method: 'GET',
apiId: 'copy1767064303024d70507',
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 mes_collection_scheme where delete_mark = 0";\r\nreturn db.select(sql);',
},
labelField: 'label', labelField: 'label',
valueField: 'value', valueField: 'value',
mode: 'multiple', mode: 'multiple',
...@@ -65,33 +56,14 @@ export const searchFormSchema: FormSchema[] = [ ...@@ -65,33 +56,14 @@ export const searchFormSchema: FormSchema[] = [
getPopupContainer: () => document.body, getPopupContainer: () => document.body,
}, },
}, },
{
field: 'note',
label: '备注',
defaultValue: undefined,
component: 'Input',
},
]; ];
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
resizable: true, resizable: true,
dataIndex: 'name', dataIndex: 'code',
title: '名称', title: '编码',
componentType: 'input', componentType: 'auto-code',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'categoryId',
title: '工序类别',
componentType: 'select',
fixed: false, fixed: false,
sorter: true, sorter: true,
...@@ -102,28 +74,22 @@ export const columns: BasicColumn[] = [ ...@@ -102,28 +74,22 @@ export const columns: BasicColumn[] = [
{ {
resizable: true, resizable: true,
dataIndex: 'collectionSchemeId', dataIndex: 'name',
title: '采集方案', title: '名称',
componentType: 'select', componentType: 'input',
customRender: ({ record }) => {
const staticOptions = [{ key: 1, label: '无', value: '无' }];
return staticOptions.filter((x) => x.value == record.collectionSchemeId)[0]?.label;
},
fixed: false, fixed: false,
sorter: true, sorter: true,
styleConfig: undefined, styleConfig: undefined,
listStyle: undefined, listStyle: '',
}, },
{ {
resizable: true, resizable: true,
dataIndex: 'ratedWorkingHours', dataIndex: 'categoryId',
title: '额定工时', title: '工序类别',
componentType: 'number', componentType: 'select',
fixed: false, fixed: false,
sorter: true, sorter: true,
...@@ -134,9 +100,9 @@ export const columns: BasicColumn[] = [ ...@@ -134,9 +100,9 @@ export const columns: BasicColumn[] = [
{ {
resizable: true, resizable: true,
dataIndex: 'note', dataIndex: 'collectionSchemeId',
title: '备注', title: '采集方案',
componentType: 'textarea', componentType: 'associate-select',
fixed: false, fixed: false,
sorter: true, sorter: true,
...@@ -214,7 +180,7 @@ export const formProps: FormProps = { ...@@ -214,7 +180,7 @@ export const formProps: FormProps = {
labelCol: { span: 3, offset: 0 }, labelCol: { span: 3, offset: 0 },
labelAlign: 'left', labelAlign: 'left',
layout: 'horizontal', layout: 'horizontal',
size: 'small', size: 'default',
schemas: [ schemas: [
{ {
key: '04fbf175bf2a4661a06e44126776617b', key: '04fbf175bf2a4661a06e44126776617b',
...@@ -228,6 +194,29 @@ export const formProps: FormProps = { ...@@ -228,6 +194,29 @@ export const formProps: FormProps = {
span: 8, span: 8,
list: [ list: [
{ {
key: 'e0f5ab09b1e541d3bff26b82ad0ccf53',
field: 'code',
label: '编码',
type: 'auto-code',
component: 'AutoCodeRule',
colProps: { span: 24 },
componentProps: {
width: '100%',
span: 7,
placeholder: '请输入编码组件组件',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
showLabel: true,
autoCodeRule: 'GX',
required: false,
isShow: false,
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
{
key: '60af544637c442bcb20cdbf2cd71a2c2', key: '60af544637c442bcb20cdbf2cd71a2c2',
field: 'name', field: 'name',
label: '名称', label: '名称',
...@@ -240,7 +229,6 @@ export const formProps: FormProps = { ...@@ -240,7 +229,6 @@ export const formProps: FormProps = {
span: 7, span: 7,
defaultValue: '', defaultValue: '',
placeholder: '', placeholder: '',
maxlength: null,
prefix: '', prefix: '',
suffix: '', suffix: '',
addonBefore: '', addonBefore: '',
...@@ -262,50 +250,28 @@ export const formProps: FormProps = { ...@@ -262,50 +250,28 @@ export const formProps: FormProps = {
}, },
}, },
{ {
key: 'aa72d19636d540078e40a0dae8b90e3c', key: 'f7c26bba94034dcdbc816e49607d64e9',
field: 'defaultReporter', field: 'zyzdFile',
label: '默认报工人员', label: '作业指导',
type: 'select', type: 'upload',
component: 'XjrSelect', component: 'Upload',
colProps: { span: 24 }, colProps: { span: 24 },
componentProps: { componentProps: {
width: '100%', api: uploadApi,
span: 7, span: 7,
placeholder: '', defaultValue: '',
accept: '',
maxNumber: 10,
maxSize: 100,
showLabel: true, showLabel: true,
showSearch: false, multiple: true,
isMultiple: false,
clearable: false,
disabled: false, disabled: false,
staticOptions: [
{ key: 1, label: 'Option 1', value: 'Option 1' },
{ key: 2, label: 'Option 2', value: 'Option 2' },
{ key: 3, label: 'Option 3', value: 'Option 3' },
],
defaultSelect: null,
datasourceType: 'api',
params: null,
labelField: 'label',
valueField: 'value',
apiConfig: {
path: '/bmxx/getEmployeeList',
method: 'GET',
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: [],
required: false, required: false,
rules: [],
events: {},
isShow: true, isShow: true,
events: {},
listType: 'text',
sourceType: 'album,camera',
tooltipConfig: { visible: false, title: '提示文本' }, tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
}, },
}, },
], ],
...@@ -334,7 +300,6 @@ export const formProps: FormProps = { ...@@ -334,7 +300,6 @@ export const formProps: FormProps = {
{ key: 2, label: 'Option 2', value: 'Option 2' }, { key: 2, label: 'Option 2', value: 'Option 2' },
{ key: 3, label: 'Option 3', value: 'Option 3' }, { key: 3, label: 'Option 3', value: 'Option 3' },
], ],
defaultSelect: null,
datasourceType: 'dic', datasourceType: 'dic',
params: { itemId: '2005547790246666242' }, params: { itemId: '2005547790246666242' },
labelField: 'name', labelField: 'name',
...@@ -352,7 +317,7 @@ export const formProps: FormProps = { ...@@ -352,7 +317,7 @@ export const formProps: FormProps = {
'var sql="select id as value,name as label from roke_process_category";\r\nreturn db.select(sql);', 'var sql="select id as value,name as label from roke_process_category";\r\nreturn db.select(sql);',
}, },
dicOptions: [], dicOptions: [],
required: false, required: true,
rules: [], rules: [],
events: {}, events: {},
isShow: true, isShow: true,
...@@ -362,26 +327,29 @@ export const formProps: FormProps = { ...@@ -362,26 +327,29 @@ export const formProps: FormProps = {
}, },
}, },
{ {
key: 'aabb539eede446daa35c754416cc50ae', key: 'ca8257a46070472e9639110b11f7f3bd',
field: 'prepareWorkHours', field: 'ratedWorkingHours',
label: '是否委外', label: '额定工时',
type: 'switch', type: 'number',
component: 'Switch', component: 'InputNumber',
colProps: { span: 24 }, colProps: { span: 24 },
defaultValue: 0, defaultValue: 0,
componentProps: { componentProps: {
width: '100%',
span: 7, span: 7,
defaultValue: 0, defaultValue: 0,
checkedChildren: '', min: 0,
unCheckedChildren: '', step: 0.01,
checkedColor: '#303030',
unCheckedColor: '#bbbdbf',
showLabel: true,
disabled: false, disabled: false,
events: {}, showLabel: true,
controls: true,
required: false,
subTotal: false,
isShow: true, isShow: true,
rules: [],
events: {},
tooltipConfig: { visible: false, title: '提示文本' }, tooltipConfig: { visible: false, title: '提示文本' },
style: {}, style: { width: '100%' },
}, },
}, },
], ],
...@@ -390,79 +358,58 @@ export const formProps: FormProps = { ...@@ -390,79 +358,58 @@ export const formProps: FormProps = {
span: 8, span: 8,
list: [ list: [
{ {
key: '55d03e0607bc4ea281a248fdcfc571bb', key: '6a8f658eb0e046e48c3dac472c0e51ae',
field: 'collectionSchemeId', field: 'collectionSchemeId',
label: '采集方案', label: '采集方案',
type: 'select', type: 'associate-select',
component: 'XjrSelect', component: 'AssociateSelect',
colProps: { span: 24 }, colProps: { span: 24 },
componentProps: { componentProps: {
width: '100%', width: '100%',
span: 7, span: 7,
placeholder: '', placeholder: '请选择采集方案',
showLabel: true, showLabel: true,
showSearch: false, showSearch: true,
isMultiple: false,
clearable: false,
disabled: false, disabled: false,
staticOptions: [{ key: 1, label: '无', value: '无' }], datasourceType: 'api',
defaultSelect: '无',
datasourceType: 'staticData',
params: null,
labelField: 'label', labelField: 'label',
valueField: 'value', valueField: 'value',
apiConfig: {}, apiConfig: {
path: '/jcxx/getCollectionSchemeList',
method: 'GET',
apiId: 'copy1767064303024d70507',
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 mes_collection_scheme where delete_mark = 0";\r\nreturn db.select(sql);',
},
dicOptions: [], dicOptions: [],
required: false, required: false,
rules: [], rules: [],
events: {}, events: {},
isShow: true, isShow: true,
tooltipConfig: { visible: false, title: '提示文本' }, tooltipConfig: { visible: false, title: '提示文本' },
defaultSelect: '2005534898818441218',
style: { width: '100%' }, style: { width: '100%' },
}, },
}, },
{ {
key: 'ca8257a46070472e9639110b11f7f3bd', key: 'c0730ef93c40445195dac1ed93677144',
field: 'ratedWorkingHours',
label: '额定工时',
type: 'number',
component: 'InputNumber',
colProps: { span: 24 },
defaultValue: 0,
componentProps: {
width: '100%',
span: 7,
defaultValue: 0,
min: 0,
max: 100,
step: 0.01,
maxlength: null,
disabled: false,
showLabel: true,
controls: true,
required: false,
subTotal: false,
isShow: true,
rules: [],
events: {},
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
{
key: 'e2c431530e954e53852f9a6026987e0d',
field: 'active', field: 'active',
label: '有效', label: '有效',
type: 'switch', type: 'switch',
component: 'Switch', component: 'Switch',
colProps: { span: 24 }, colProps: { span: 24 },
defaultValue: 1, defaultValue: 1,
componentProps: { componentProps: {
span: 5, span: 7,
defaultValue: 1, defaultValue: 1,
checkedChildren: '', checkedChildren: '',
unCheckedChildren: '', unCheckedChildren: '',
checkedColor: '#303030', checkedColor: '#5c7cff',
unCheckedColor: '#bbbdbf', unCheckedColor: '#bbbdbf',
showLabel: true, showLabel: true,
disabled: false, disabled: false,
...@@ -489,55 +436,83 @@ export const formProps: FormProps = { ...@@ -489,55 +436,83 @@ export const formProps: FormProps = {
}, },
}, },
{ {
key: '24f0714c9f3a4242b1bcefff04bb7314', key: '6cf0d93568bf4236970c03902399e4c8',
field: '', field: '',
label: '', label: '',
type: 'tab', type: 'grid',
colProps: { span: 24 }, colProps: { span: 24 },
component: 'Tab', component: 'Grid',
children: [ children: [
{ {
span: 24, span: 24,
name: '作业规范',
prefix: '',
suffix: '',
activeColor: '#1c8dff',
folderId: '',
imageUrl: '',
conFolderId: '',
conImageUrl: '',
list: [ list: [
{ {
key: 'f7c26bba94034dcdbc816e49607d64e9', key: '037bf18717bf496f8a1fc0e8605a8a7d',
field: 'zyzdFile', field: 'note',
label: '作业指导', label: '备注',
type: 'upload', type: 'textarea',
component: 'Upload', component: 'InputTextArea',
colProps: { span: 24 }, colProps: { span: 24 },
defaultValue: '',
componentProps: { componentProps: {
api: uploadApi, width: '100%',
span: '', span: 1,
defaultValue: '', defaultValue: '',
accept: 'pdf,png,jpg', placeholder: '请输入备注',
maxNumber: 10, rows: 4,
maxSize: 100, autoSize: false,
showLabel: true, showCount: false,
multiple: true,
disabled: false, disabled: false,
showLabel: true,
allowClear: false,
required: false, required: false,
isShow: true, isShow: true,
isShowAi: false,
rules: [],
events: {}, events: {},
listType: 'text',
sourceType: 'album,camera',
tooltipConfig: { visible: false, title: '提示文本' }, tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
}, },
}, },
], ],
}, },
],
componentProps: {
gutter: 16,
justify: 'start',
align: 'top',
isShow: true,
showBorder: false,
bordercolor: '#d9d9d9',
bordershowtype: [true, true, true, true],
borderwidth: 1,
padding: '10px',
margin: '10px',
},
},
{ {
span: 24, key: '03c19c5ac95b4d139d8380ede64f14ff',
name: '作业指导图片', field: '',
prefix: '', label: '',
type: 'grid',
colProps: { span: 24 },
component: 'Grid',
children: [
{
span: 24,
list: [
{
key: '24f0714c9f3a4242b1bcefff04bb7314',
field: '',
label: '',
type: 'tab',
colProps: { span: 24 },
component: 'Tab',
children: [
{
span: 24,
name: '产品/物料',
prefix: '',
suffix: '', suffix: '',
activeColor: '#1c8dff', activeColor: '#1c8dff',
folderId: '', folderId: '',
...@@ -546,56 +521,175 @@ export const formProps: FormProps = { ...@@ -546,56 +521,175 @@ export const formProps: FormProps = {
conImageUrl: '', conImageUrl: '',
list: [ list: [
{ {
key: 'f0db1f4ee6254dd58b8f6e5f66ab7030', key: '7cb7c6cdf3ec417280dc49e19dd39ffa',
field: '',
label: '', label: '',
type: 'grid', field: 'mesProcessProductList',
type: 'form',
component: 'SubForm',
required: true,
colProps: { span: 24 }, colProps: { span: 24 },
component: 'Grid', componentProps: {
children: [ mainKey: 'mesProcessProductList',
columns: [
{ {
span: 12, key: '00c0e93b675841f48265b896515a5241',
list: [ title: '编号',
dataIndex: 'cpbh',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{ {
key: 'f40c42bc3b174f7589179a6b8976eb65', key: '91863c5a0ec24d76ade8735cd401059b',
field: 'zyzdtpFile', title: '名称',
label: '作业指导', dataIndex: 'cpmc',
type: 'upload', componentType: 'Input',
component: 'Upload', defaultValue: '',
colProps: { span: 24 },
componentProps: { componentProps: {
api: '#{upload}#', width: '100%',
span: 7, span: '',
defaultValue: '', defaultValue: '',
accept: '', placeholder: '',
maxNumber: 10, prefix: '',
maxSize: 50, suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true, showLabel: true,
multiple: false, required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: '6c749d8f7bde474da082c659146f473c',
title: '数量',
dataIndex: 'number',
componentType: 'InputNumber',
defaultValue: 0,
componentProps: {
width: '100%',
span: '',
defaultValue: 0,
min: 0,
step: 1,
disabled: false, disabled: false,
showLabel: true,
controls: true,
required: false, required: false,
subTotal: false,
isShow: true, isShow: true,
rules: [],
events: {}, events: {},
listType: 'picture',
sourceType: 'album,camera',
tooltipConfig: { visible: false, title: '提示文本' }, tooltipConfig: { visible: false, title: '提示文本' },
listStyle: "return 'width:100%'",
}, },
}, },
], {
key: 'cb38672445b24eedb2b10addf520de2e',
title: '是否投料',
dataIndex: 'isFeeding',
componentType: 'Switch',
defaultValue: 1,
componentProps: {
span: '',
defaultValue: 1,
checkedChildren: '',
unCheckedChildren: '',
checkedColor: '#545454',
unCheckedColor: '#bbbdbf',
showLabel: true,
disabled: false,
events: {},
isShow: true,
tooltipConfig: { visible: false, title: '提示文本' },
}, },
{ span: 12, list: [] }, },
], {
key: '1084a7c39baf47ba9a0251cb4e2f8c14',
title: '备注',
dataIndex: 'bz',
componentType: 'InputTextArea',
defaultValue: '',
componentProps: { componentProps: {
gutter: 16, width: '100%',
justify: 'start', span: '',
align: 'top', defaultValue: '',
placeholder: '请输入备注',
rows: 2,
autoSize: false,
showCount: false,
disabled: false,
showLabel: true,
allowClear: false,
required: false,
isShow: true, isShow: true,
isShowAi: false,
rules: [],
events: {},
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{ title: '操作', key: 'action', fixed: 'right', width: '50px' },
],
span: '24',
preloadType: 'api',
apiConfig: {},
itemId: '',
dicOptions: [],
useSelectButton: false,
buttonName: '选择数据',
showLabel: true,
showComponentBorder: true,
showBorder: false, showBorder: false,
bordercolor: '#d9d9d9', bordercolor: '#f0f0f0',
bordershowtype: [true, true, true, true], bordershowtype: [true, true, true, true],
borderwidth: 1, borderwidth: 1,
padding: '10px', showIndex: false,
margin: '10px', isShow: true,
multipleHeads: [],
buttonList: [],
topButtonList: [],
isExport: false,
isImport: false,
isDeleteSelected: true,
isListView: false,
viewList: [],
isShowAdd: true,
isShowDelete: true,
hasCheckedCol: true,
events: {},
showPagenation: true,
}, },
}, },
], ],
...@@ -603,44 +697,148 @@ export const formProps: FormProps = { ...@@ -603,44 +697,148 @@ export const formProps: FormProps = {
{ {
span: 0, span: 0,
name: '采集项', name: '采集项',
prefix: null, list: [
suffix: null,
activeColor: null,
folderId: null,
imageUrl: null,
conFolderId: null,
conImageUrl: null,
list: [],
},
],
componentProps: { tabPosition: 'top', size: 'default', type: 'line', isShow: true },
},
{ {
key: '03c19c5ac95b4d139d8380ede64f14ff', key: '3fd474ce5f8c4bf78bd86dc701cbdc4f',
field: '',
label: '', label: '',
type: 'grid', field: 'mesProcessItemList',
type: 'form',
component: 'SubForm',
required: true,
colProps: { span: 24 }, colProps: { span: 24 },
component: 'Grid', componentProps: {
children: [ mainKey: 'mesProcessItemList',
columns: [
{ {
span: 24, key: '3999831fde0a4e879f64f33eb2a1edd1',
list: [ title: '编码',
dataIndex: 'code',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{ {
key: '04ae7a540acd4c46949c6fd53e652a45', key: 'ab6576e960ee44b4af09975e64088f05',
field: 'note', title: '名称',
label: '备注', dataIndex: 'name',
type: 'textarea', componentType: 'Input',
component: 'InputTextArea',
colProps: { span: 24 },
defaultValue: '', defaultValue: '',
componentProps: { componentProps: {
width: '100%', width: '100%',
span: 0, span: '',
defaultValue: '', defaultValue: '',
placeholder: '请输入备注', placeholder: '',
maxlength: null, prefix: '',
rows: 4, suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: '745cb3bb014d4dd9ba38139d17b2f305',
title: '数据类型',
dataIndex: 'dataType',
componentType: 'XjrSelect',
componentProps: {
width: '100%',
span: '',
placeholder: '',
showLabel: true,
showSearch: false,
isMultiple: false,
clearable: false,
disabled: false,
staticOptions: [
{ key: 1, label: 'Option 1', value: 'Option 1' },
{ key: 2, label: 'Option 2', value: 'Option 2' },
{ key: 3, label: 'Option 3', value: 'Option 3' },
],
datasourceType: 'dic',
params: { itemId: '2004076331787718658' },
labelField: 'name',
valueField: 'value',
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
},
dicOptions: [],
required: false,
rules: [],
events: {},
isShow: true,
tooltipConfig: { visible: false, title: '提示文本' },
itemId: '2004076331787718658',
listStyle: "return 'border: 0'",
},
},
{
key: '36a40652260d491e8a088ff843aab982',
title: '是否必填',
dataIndex: 'required',
componentType: 'Switch',
defaultValue: 0,
componentProps: {
span: '',
defaultValue: 0,
checkedChildren: '',
unCheckedChildren: '',
checkedColor: '#1C8DFF',
unCheckedColor: '#bbbdbf',
showLabel: true,
disabled: false,
events: {},
isShow: true,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: 'f3ba1f809888475d925665668e2a1851',
title: '备注',
dataIndex: 'note',
componentType: 'InputTextArea',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '',
rows: 2,
autoSize: false, autoSize: false,
showCount: false, showCount: false,
disabled: false, disabled: false,
...@@ -652,9 +850,45 @@ export const formProps: FormProps = { ...@@ -652,9 +850,45 @@ export const formProps: FormProps = {
rules: [], rules: [],
events: {}, events: {},
tooltipConfig: { visible: false, title: '提示文本' }, tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
}, },
}, },
{ title: '操作', key: 'action', fixed: 'right', width: '50px' },
],
span: '24',
preloadType: 'api',
apiConfig: {},
itemId: '',
dicOptions: [],
useSelectButton: false,
buttonName: '选择数据',
showLabel: true,
showComponentBorder: true,
showBorder: false,
bordercolor: '#f0f0f0',
bordershowtype: [true, true, true, true],
borderwidth: 1,
showIndex: false,
isShow: true,
multipleHeads: [],
buttonList: [],
topButtonList: [],
isExport: false,
isImport: false,
isDeleteSelected: false,
isListView: false,
viewList: [],
isShowAdd: false,
isShowDelete: true,
hasCheckedCol: false,
events: {},
showPagenation: true,
},
},
],
},
],
componentProps: { tabPosition: 'top', size: 'default', type: 'line', isShow: true },
},
], ],
}, },
], ],
...@@ -682,11 +916,11 @@ export const formProps: FormProps = { ...@@ -682,11 +916,11 @@ export const formProps: FormProps = {
export const treeConfig = { export const treeConfig = {
id: '', id: '',
isMultiple: false,
name: '', name: '',
type: 1, type: 1,
configTip: '', configTip: '',
config: [], config: [],
isMultiple: false,
}; };
export const formButtons = [ export const formButtons = [
...@@ -699,7 +933,6 @@ export const formButtons = [ ...@@ -699,7 +933,6 @@ export const formButtons = [
isShow: true, isShow: true,
index: 2, index: 2,
type: 1, type: 1,
modal: null,
}, },
{ {
key: 'cancel', key: 'cancel',
...@@ -710,7 +943,6 @@ export const formButtons = [ ...@@ -710,7 +943,6 @@ export const formButtons = [
isShow: true, isShow: true,
index: 1, index: 1,
type: 1, type: 1,
modal: null,
}, },
{ {
key: 'reset', key: 'reset',
...@@ -721,6 +953,5 @@ export const formButtons = [ ...@@ -721,6 +953,5 @@ export const formButtons = [
isShow: true, isShow: true,
index: 0, index: 0,
type: 1, type: 1,
modal: null,
}, },
]; ];
export const permissionList = [ export const permissionList = [
{ {
required: false,
view: true,
edit: false,
disabled: true,
isSaveTable: false,
tableName: '',
fieldName: '编码',
fieldId: 'code',
isSubTable: false,
showChildren: true,
type: 'auto-code',
key: 'e0f5ab09b1e541d3bff26b82ad0ccf53',
children: [],
options: {},
},
{
required: true, required: true,
view: true, view: true,
edit: true, edit: true,
...@@ -23,17 +39,18 @@ export const permissionList = [ ...@@ -23,17 +39,18 @@ export const permissionList = [
disabled: false, disabled: false,
isSaveTable: false, isSaveTable: false,
tableName: '', tableName: '',
fieldName: '默认报工人员', fieldName: '作业指导',
fieldId: 'defaultReporter', fieldId: 'zyzdFile',
isSubTable: false, isSubTable: false,
showChildren: true, showChildren: true,
type: 'select', type: 'upload',
key: 'aa72d19636d540078e40a0dae8b90e3c', key: 'f7c26bba94034dcdbc816e49607d64e9',
children: [], children: [],
options: {}, options: {},
defaultValue: '',
}, },
{ {
required: false, required: true,
view: true, view: true,
edit: true, edit: true,
disabled: false, disabled: false,
...@@ -55,12 +72,12 @@ export const permissionList = [ ...@@ -55,12 +72,12 @@ export const permissionList = [
disabled: false, disabled: false,
isSaveTable: false, isSaveTable: false,
tableName: '', tableName: '',
fieldName: '是否委外', fieldName: '额定工时',
fieldId: 'prepareWorkHours', fieldId: 'ratedWorkingHours',
isSubTable: false, isSubTable: false,
showChildren: true, showChildren: true,
type: 'switch', type: 'number',
key: 'aabb539eede446daa35c754416cc50ae', key: 'ca8257a46070472e9639110b11f7f3bd',
children: [], children: [],
options: {}, options: {},
defaultValue: 0, defaultValue: 0,
...@@ -76,11 +93,11 @@ export const permissionList = [ ...@@ -76,11 +93,11 @@ export const permissionList = [
fieldId: 'collectionSchemeId', fieldId: 'collectionSchemeId',
isSubTable: false, isSubTable: false,
showChildren: true, showChildren: true,
type: 'select', type: 'associate-select',
key: '55d03e0607bc4ea281a248fdcfc571bb', key: '6a8f658eb0e046e48c3dac472c0e51ae',
children: [], children: [],
options: {}, options: {},
defaultValue: '', defaultValue: '2005534898818441218',
}, },
{ {
required: false, required: false,
...@@ -89,15 +106,15 @@ export const permissionList = [ ...@@ -89,15 +106,15 @@ export const permissionList = [
disabled: false, disabled: false,
isSaveTable: false, isSaveTable: false,
tableName: '', tableName: '',
fieldName: '额定工时', fieldName: '有效',
fieldId: 'ratedWorkingHours', fieldId: 'active',
isSubTable: false, isSubTable: false,
showChildren: true, showChildren: true,
type: 'number', type: 'switch',
key: 'ca8257a46070472e9639110b11f7f3bd', key: 'c0730ef93c40445195dac1ed93677144',
children: [], children: [],
options: {}, options: {},
defaultValue: 0, defaultValue: 1,
}, },
{ {
required: false, required: false,
...@@ -106,65 +123,194 @@ export const permissionList = [ ...@@ -106,65 +123,194 @@ export const permissionList = [
disabled: false, disabled: false,
isSaveTable: false, isSaveTable: false,
tableName: '', tableName: '',
fieldName: '有效的', fieldName: '备注',
fieldId: 'active', fieldId: 'note',
isSubTable: false, isSubTable: false,
showChildren: true, showChildren: true,
type: 'switch', type: 'textarea',
key: 'e2c431530e954e53852f9a6026987e0d', key: '037bf18717bf496f8a1fc0e8605a8a7d',
children: [], children: [],
options: {}, options: {},
defaultValue: 1, defaultValue: '',
}, },
{ {
required: false, required: true,
view: true,
edit: true,
disabled: false,
isSubTable: true,
showChildren: false,
tableName: 'mesProcessProductList',
fieldName: '',
fieldId: 'mesProcessProductList',
type: 'form',
key: '7cb7c6cdf3ec417280dc49e19dd39ffa',
children: [
{
required: true,
view: true, view: true,
edit: true, edit: true,
disabled: false, disabled: false,
isSubTable: false,
isSaveTable: false, isSaveTable: false,
tableName: '', showChildren: false,
fieldName: '作业指导', tableName: 'mesProcessProductList',
fieldId: 'zyzdFile', fieldName: '编号',
fieldId: 'cpbh',
type: 'Input',
key: '00c0e93b675841f48265b896515a5241',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false, isSubTable: false,
showChildren: true, isSaveTable: false,
type: 'upload', showChildren: false,
key: 'f7c26bba94034dcdbc816e49607d64e9', tableName: 'mesProcessProductList',
fieldName: '名称',
fieldId: 'cpmc',
type: 'Input',
key: '91863c5a0ec24d76ade8735cd401059b',
children: [], children: [],
options: {},
defaultValue: '',
}, },
{ {
required: false, required: true,
view: true, view: true,
edit: true, edit: true,
disabled: false, disabled: false,
isSubTable: false,
isSaveTable: false, isSaveTable: false,
tableName: '', showChildren: false,
fieldName: '作业指导', tableName: 'mesProcessProductList',
fieldId: 'zyzdtpFile', fieldName: '数量',
fieldId: 'number',
type: 'InputNumber',
key: '6c749d8f7bde474da082c659146f473c',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false, isSubTable: false,
showChildren: true, isSaveTable: false,
type: 'upload', showChildren: false,
key: 'f40c42bc3b174f7589179a6b8976eb65', tableName: 'mesProcessProductList',
fieldName: '是否投料',
fieldId: 'isFeeding',
type: 'Switch',
key: 'cb38672445b24eedb2b10addf520de2e',
children: [], children: [],
options: {},
defaultValue: '',
}, },
{ {
required: false, required: true,
view: true, view: true,
edit: true, edit: true,
disabled: false, disabled: false,
isSubTable: false,
isSaveTable: false, isSaveTable: false,
tableName: '', showChildren: false,
tableName: 'mesProcessProductList',
fieldName: '备注', fieldName: '备注',
fieldId: 'note', fieldId: 'bz',
type: 'InputTextArea',
key: '1084a7c39baf47ba9a0251cb4e2f8c14',
children: [],
},
],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: true,
showChildren: false,
tableName: 'mesProcessItemList',
fieldName: '',
fieldId: 'mesProcessItemList',
type: 'form',
key: '3fd474ce5f8c4bf78bd86dc701cbdc4f',
children: [
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false, isSubTable: false,
showChildren: true, isSaveTable: false,
type: 'textarea', showChildren: false,
key: '04ae7a540acd4c46949c6fd53e652a45', tableName: 'mesProcessItemList',
fieldName: '编码',
fieldId: 'code',
type: 'Input',
key: '3999831fde0a4e879f64f33eb2a1edd1',
children: [], children: [],
options: {}, },
defaultValue: '', {
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesProcessItemList',
fieldName: '名称',
fieldId: 'name',
type: 'Input',
key: 'ab6576e960ee44b4af09975e64088f05',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesProcessItemList',
fieldName: '数据类型',
fieldId: 'dataType',
type: 'XjrSelect',
key: '745cb3bb014d4dd9ba38139d17b2f305',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesProcessItemList',
fieldName: '是否必填',
fieldId: 'required',
type: 'Switch',
key: '36a40652260d491e8a088ff843aab982',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesProcessItemList',
fieldName: '备注',
fieldId: 'note',
type: 'InputTextArea',
key: 'f3ba1f809888475d925665668e2a1851',
children: [],
},
],
}, },
]; ];
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
//展示在列表内的按钮 //展示在列表内的按钮
const actionButtons = ref<string[]>(["view","edit","delete"]); const actionButtons = ref<string[]>(["view","edit","delete"]);
const buttonConfigs = computed(()=>{ const buttonConfigs = computed(()=>{
const list = [{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true},{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isEnableLock":true},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}] const list = [{"buttonId":"2005548723533832192","name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true,"isUse":true},{"buttonId":"2005548723533832193","name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true},{"buttonId":"2005548723533832194","name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isUse":true,"isEnableLock":true},{"buttonId":"2005548723533832195","name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}]
return filterButtonAuth(list); return filterButtonAuth(list);
}) })
......
...@@ -12,40 +12,40 @@ ...@@ -12,40 +12,40 @@
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref, onMounted, nextTick, watch } from 'vue'; import { reactive, ref, onMounted, nextTick, watch } from 'vue';
import { formProps, formEventConfigs } from './config'; import { formProps, formEventConfigs } from './config';
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue'; import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
import { addMesProductionPlan, getMesProductionPlan, updateMesProductionPlan } from '/@/api/scgl/scjh'; import { addMesProductionPlan, getMesProductionPlan, updateMesProductionPlan } from '/@/api/scgl/scjh';
import { cloneDeep, isString } from 'lodash-es'; import { cloneDeep, isString } from 'lodash-es';
import { FormDataProps } from '/@/components/Designer/src/types'; import { FormDataProps } from '/@/components/Designer/src/types';
import { usePermission } from '/@/hooks/web/usePermission'; import { usePermission } from '/@/hooks/web/usePermission';
import CustomButtonModal from '/@/components/Form/src/components/CustomButtonModal.vue'; import CustomButtonModal from '/@/components/Form/src/components/CustomButtonModal.vue';
import { FromPageType } from '/@/enums/workflowEnum'; import { FromPageType } from '/@/enums/workflowEnum';
import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent,} from '/@/hooks/web/useFormEvent'; import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent,} from '/@/hooks/web/useFormEvent';
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm'; import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig'; import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
const { filterFormSchemaAuth } = usePermission(); const { filterFormSchemaAuth } = usePermission();
const RowKey = 'id'; const RowKey = 'id';
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'update:value']); const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'update:value']);
const props = defineProps({ const props = defineProps({
fromPage: { fromPage: {
type: Number, type: Number,
default: FromPageType.MENU, default: FromPageType.MENU,
}, },
}); });
const systemFormRef = ref(); const systemFormRef = ref();
const data: { formDataProps: FormDataProps } = reactive({ const data: { formDataProps: FormDataProps } = reactive({
formDataProps: cloneDeep(formProps), formDataProps: cloneDeep(formProps),
}); });
const state = reactive({ const state = reactive({
formModel: {}, formModel: {},
formInfo:{formId:'',formName:''} formInfo:{formId:'',formName:''}
}); });
const { currentRoute } = useRouter(); const { currentRoute } = useRouter();
watch( watch(
() => state.formModel, () => state.formModel,
(val) => { (val) => {
emits('update:value', val); emits('update:value', val);
...@@ -53,9 +53,9 @@ ...@@ -53,9 +53,9 @@
{ {
deep: true, deep: true,
}, },
); );
onMounted(async () => { onMounted(async () => {
try { try {
if (props.fromPage == FromPageType.MENU) { if (props.fromPage == FromPageType.MENU) {
setMenuPermission(); setMenuPermission();
...@@ -86,14 +86,14 @@ ...@@ -86,14 +86,14 @@
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单 formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单
} }
} catch (error) {} } catch (error) {}
}); });
// 根据菜单页面权限,设置表单属性(必填,禁用,显示) // 根据菜单页面权限,设置表单属性(必填,禁用,显示)
function setMenuPermission() { function setMenuPermission() {
data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!); data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!);
} }
// 校验form 通过返回表单数据 // 校验form 通过返回表单数据
async function validate() { async function validate() {
let values = []; let values = [];
try { try {
values = await systemFormRef.value?.validate(); values = await systemFormRef.value?.validate();
...@@ -106,11 +106,24 @@ ...@@ -106,11 +106,24 @@
} finally { } finally {
} }
return values; return values;
} }
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】 // 根据行唯一ID查询行数据,并设置表单数据 【编辑】
async function setFormDataFromId(rowId) { async function setFormDataFromId(rowId) {
try { try {
const record = await getMesProductionPlan(rowId); const record = await getMesProductionPlan(rowId);
// 处理 mesProductionPlanProductList 字段映射
if (record.mesProductionPlanProductList && Array.isArray(record.mesProductionPlanProductList)) {
record.mesProductionPlanProductList = record.mesProductionPlanProductList.map((item) => {
return {
...item,
wuLiaoBianHao8001: item.cpbh || item.wuLiaoBianHao8001, // 物料编号
naBuDaiMa1765: item.nbdm || item.naBuDaiMa1765, // 内部代码
xingHao5094: item.xh || item.xingHao5094, // 型号
heJinZhuangTai4056: item.hjzt || item.heJinZhuangTai4056, // 合金状态 (兼容 hzjt 和 hjzt)
'guiGe(ChiCun)9562': item.gg || item['guiGe(ChiCun)9562'], // 规格(尺寸)
};
});
}
setFieldsValue(record); setFieldsValue(record);
state.formModel = record; state.formModel = record;
await getFormDataEvent(formEventConfigs, state.formModel, await getFormDataEvent(formEventConfigs, state.formModel,
...@@ -119,9 +132,9 @@ ...@@ -119,9 +132,9 @@
} catch (error) { } catch (error) {
} }
} }
// 辅助返回表单数据 // 辅助返回表单数据
async function getFieldsValue() { async function getFieldsValue() {
let values = []; let values = [];
try { try {
values = await systemFormRef.value?.getFieldsValue(); values = await systemFormRef.value?.getFieldsValue();
...@@ -134,25 +147,25 @@ ...@@ -134,25 +147,25 @@
} finally { } finally {
} }
return values; return values;
} }
// 辅助设置表单数据 // 辅助设置表单数据
function setFieldsValue(record) { function setFieldsValue(record) {
systemFormRef.value.setFieldsValue(record); systemFormRef.value.setFieldsValue(record);
} }
// 重置表单数据 // 重置表单数据
async function resetFields() { async function resetFields() {
await systemFormRef.value.resetFields(); await systemFormRef.value.resetFields();
} }
// 设置表单数据全部为Disabled 【查看】 // 设置表单数据全部为Disabled 【查看】
async function setDisabledForm( ) { async function setDisabledForm( ) {
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas)); data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas));
} }
// 获取行键值 // 获取行键值
function getRowKey() { function getRowKey() {
return RowKey; return RowKey;
} }
// 更新api表单数据 // 更新api表单数据
async function update({ values, rowId }) { async function update({ values, rowId }) {
try { try {
values[RowKey] = rowId; values[RowKey] = rowId;
state.formModel = values; state.formModel = values;
...@@ -162,9 +175,9 @@ ...@@ -162,9 +175,9 @@
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单 formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单
return saveVal; return saveVal;
} catch (error) {} } catch (error) {}
} }
// 新增api表单数据 // 新增api表单数据
async function add(values) { async function add(values) {
try { try {
state.formModel = values; state.formModel = values;
let saveVal = await addMesProductionPlan(values); let saveVal = await addMesProductionPlan(values);
...@@ -173,9 +186,9 @@ ...@@ -173,9 +186,9 @@
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单 formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单
return saveVal; return saveVal;
} catch (error) {} } catch (error) {}
} }
// 根据工作流页面权限,设置表单属性(必填,禁用,显示) // 根据工作流页面权限,设置表单属性(必填,禁用,显示)
async function setWorkFlowForm(obj: WorkFlowFormParams) { async function setWorkFlowForm(obj: WorkFlowFormParams) {
try { try {
if (obj.formId) state.formInfo.formId = obj.formId; if (obj.formId) state.formInfo.formId = obj.formId;
if (obj.formName) state.formInfo.formName = obj.formName; if (obj.formName) state.formInfo.formName = obj.formName;
...@@ -195,18 +208,18 @@ ...@@ -195,18 +208,18 @@
await loadFormEvent(formEventConfigs, state.formModel, await loadFormEvent(formEventConfigs, state.formModel,
systemFormRef.value, systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单 formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单
} }
function handleChange(val) { function handleChange(val) {
emits('update:value', val); emits('update:value', val);
} }
async function sendMessageForAllIframe() { async function sendMessageForAllIframe() {
try { try {
if (systemFormRef.value && systemFormRef.value.sendMessageForAllIframe) { if (systemFormRef.value && systemFormRef.value.sendMessageForAllIframe) {
systemFormRef.value.sendMessageForAllIframe(); systemFormRef.value.sendMessageForAllIframe();
} }
} catch (error) {} } catch (error) {}
} }
defineExpose({ defineExpose({
setFieldsValue, setFieldsValue,
resetFields, resetFields,
validate, validate,
...@@ -219,7 +232,6 @@ ...@@ -219,7 +232,6 @@
getRowKey, getRowKey,
getFieldsValue, getFieldsValue,
sendMessageForAllIframe sendMessageForAllIframe
}); });
</script> </script>
\ 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