徐景良 2024-06-12 13:37:40 +08:00
commit 97147b4c1b
10 changed files with 134 additions and 15 deletions

View File

@ -6,6 +6,7 @@ enum Api {
addData = '/api/BaseDataAuthAddForm/permission/data',
editData = '/api/BaseDataAuthUpdateForm/permission/data/',
delData = '/api/BaseDataAuthDeleteForm/permission/data/',
fieldOptions = '/api/BaseDataAuthGetEntityByCode',
}
export const getTablesListData = (params?: AccountParams) => {
return defHttp.get<AccountListGetResultModel>({
@ -19,6 +20,12 @@ export const getDetailsData = (params?: AccountParams) => {
params,
});
};
export const getFieldListData = (params?: AccountParams) => {
return defHttp.get<AccountListGetResultModel>({
url: Api.fieldOptions,
params,
});
};
export const addTableData = (params?: AccountParams) => {
return defHttp.post<AccountListGetResultModel>({
url: Api.addData,

View File

@ -17,6 +17,7 @@ export interface AccountParams {
key: string;
page: any;
limit: any;
code: any;
}
export type AccountListGetResultModel = BasicFetchResult<AccountListItem>;

View File

@ -292,9 +292,9 @@
element.show = true;
}
});
console.log(formColumns);
//
const values = await validate();
// const values = await validate();
const values = getFieldsValue();
if (Object.keys(FieldsValue.value).length == 0) {
FieldsValue.value = values;
}
@ -307,9 +307,9 @@
}
}
}
setFieldsValue({
...FieldsValue.value,
});
setTimeout(() => {
setFieldsValue(FieldsValue.value);
}, 10);
}
async function getFormDetail() {
@ -427,7 +427,7 @@
}
}
async function getIssueInfo() {
console.log("111",props.issueId);
console.log('111', props.issueId);
}
defineExpose({
getForm,
@ -451,6 +451,6 @@
}
.my-form-viewer {
overflow: auto;
height: calc( 100vh - 350px);
height: calc(100vh - 350px);
}
</style>

View File

@ -121,7 +121,7 @@
uid: '-1',
name: item,
status: 'done',
url: server+item
url: server+'/'+item
})
console.log("fileListItem",fileList.value)
}

View File

@ -118,7 +118,7 @@ import { fileUploadApi } from '@/api/sys/upload';
uid: '-1',
name: item,
status: 'done',
url: server+item
url: server+'/'+item
})
console.log("fileListItem",fileList.value)
}

View File

@ -125,6 +125,7 @@
import CallModalFormItem from './CallModalFormItem/index.vue';
import { CardGourp } from '@/components/FormViewer/index.ts'
import { subTableStore } from '@/store/modules/subTable';
import { changeCardStructure, cardNestStructure } from '@/views/demo/onlineform/util.ts';
const subTableDataStore = subTableStore();
@ -407,6 +408,13 @@
}
if (!unref(isUpdate) && unref(isDetail)) {
getTitle.value = '详情';
data.tab = changeCardStructure(data.tab)
data.tab.forEach(itemComponent => {
if(itemComponent.component){
itemComponent.componentProps.disabled = true
}
})
data.tab = cardNestStructure(data.tab)
if (Object.keys(cardValues.value).length > 0) {
Object.keys(cardValues.value).forEach((cardItem) => {
let cardItemKeyList = Object.keys(cardValues.value[cardItem]);

View File

@ -203,7 +203,9 @@
item.csType = element.data[currentIndex].csType;
}
});
console.log(item.label, item.csType);
if (item.csType == 'int') {
console.log(item);
item.componentProps.options.forEach((optionChild) => {
optionChild.value = Number(optionChild.value);
});
@ -216,6 +218,9 @@
if (item.columns) {
item.columns = changeCloums(item.columns, tableData);
}
if(item.component === 'CardGroup'){
item.componentProps.options = changeCloums(item.componentProps.options,tableData)
}
if (
item.component != 'CardGroup' &&
item.component != 'Grid' &&
@ -245,6 +250,11 @@
list.csType = element.data[currentIndex].csType;
}
});
if (list.csType == 'int') {
list.componentProps.options.forEach((optionChild) => {
optionChild.value = Number(optionChild.value);
});
}
}
// csType
if (list.type == 'subTable') {
@ -253,6 +263,9 @@
if (list.columns) {
list.columns = changeCloums(list.columns, tableData);
}
if(list.component === 'CardGroup'){
list.componentProps.options = changeCloums(list.componentProps.options,tableData)
}
if (
list.component != 'CardGroup' &&
list.component != 'Grid' &&
@ -310,6 +323,11 @@
childItem.csType = element.data[currentIndex].csType;
}
});
if(childItem.component === 'CardGroup'){
childItem.componentProps.options = changeCloums(childItem.componentProps.options,tableData)
}else if(childItem.columns){
childItem.columns = changeCloums(childItem.columns, tableData);
}
});
}
});
@ -358,6 +376,7 @@
console.log('正常提交');
// saveFormDatas.value.scheme.scheme = JSON.stringify(schems);
setTimeout(() => {
// console.log(schems);
submitSaveClick(schems);
}, 500);
}

View File

@ -38,4 +38,64 @@ export const cardNestStructure = (data) => {
}
})
return result
}
}
export const changeCardStructure = (data) => {
let result = [];
if (data && data.length > 0) {
data.forEach((item) => {
if (item.component === 'Tabs') {
item.componentProps.options = changeCardStructure(item.componentProps.options);
} else if (item.component === 'CardGroup') {
item.componentProps.options = changeCardStructure(item.componentProps.options);
item.componentProps.options.forEach((childItem) => {
if (childItem.pfield) {
result.push(childItem);
} else {
result.push({ ...childItem, ptype: 'card', pfield: item.field });
}
});
item.componentProps.options = [];
} else if (item.component === 'Grid' && item.label === '栅格布局') {
item.columns = changeCardStructure(item.columns);
item.columns.forEach((childItem) => {
childItem.children.forEach((col) => {
result.push({ ...col, ptype: 'gridlayout', pfield: item.field });
});
});
} else if (item.children && !item.field) {
item.children = changeCardStructure(item.children);
} else if (item.children && item.field.indexOf('use_card') === -1) {
item.children = changeCardStructure(item.children);
item.children = [];
} else {
if (['Card'].includes(item.component)) {
item.columns[0].children = changeCardStructure(item.columns[0].children);
if (item.component === 'Card' && item.columns[0].children) {
item.columns[0].children.forEach((childItem) => {
if (childItem.pfield) {
result.push(childItem);
} else {
result.push({ ...childItem, ptype: 'card', pfield: item.field });
}
});
item.columns[0].children = [];
}
} else if (item.field && item.field.indexOf('use_card') !== -1) {
item.children = changeCardStructure(item.children);
item.children.forEach((childItem) => {
if (childItem.pfield) {
result.push(childItem);
} else {
result.push({ ...childItem, ptype: 'card', pfield: item.field });
}
});
item.children = [];
}
}
result.push(item);
});
return result;
} else {
return data;
}
};

View File

@ -205,6 +205,7 @@
arr.push({
orgId: element.id,
posId: 0,
level: element.level,
});
});
var query = {

View File

@ -68,7 +68,6 @@
v-model:value="item.f_FieldId"
placeholder="请选择"
:options="fieldOptions"
:field-names="{ label: 'label', value: 'key' }"
/>
</div>
<div>
@ -138,7 +137,7 @@
import { getRoleListByPage } from '@/api/demo/system';
import { getAccountList } from '@/api/demo/system';
import { fun_GetPageList } from '@/api/demo/formModule';
import { addTableData, editTableData } from '@/api/permission/data';
import { addTableData, editTableData, getFieldListData } from '@/api/permission/data';
import { useMessage } from '@/hooks/web/useMessage';
const { createMessage } = useMessage();
@ -236,13 +235,14 @@
formData.value.objectId = '';
}
function codeChange(e) {
console.log('eeeee', e);
codeOptions.value.forEach((item) => {
if (item.value == e) {
fieldOptions.value = item.column;
// fieldOptions.value = item.column;
getFieldOptionsList(e);
formData.value.formula.conditions = [];
}
});
console.log('fieldOptions', fieldOptions)
}
function getCodeListData() {
fun_GetPageList().then((res: Recordable) => {
@ -255,13 +255,36 @@
column: JSON.parse(item.scheme).table.columns,
});
if (formData.value.code == item.id) {
fieldOptions.value = JSON.parse(item.scheme).table.columns;
getFieldOptionsList(item.id);
// fieldOptions.value = JSON.parse(item.scheme).table.columns;
}
});
}
codeOptions.value = arr;
});
}
function getFieldOptionsList(code: any) {
const param = {
code: code,
};
getFieldListData(param).then((res: Recordable) => {
const arr = JSON.parse(res.scheme).formInfo.tabList;
console.log('arr', arr);
const newArr: any = [];
arr.forEach((ele) => {
ele.schemas.forEach((item) => {
if (item.componentProps && item.componentProps.fieldName) {
newArr.push({
label: item.label,
value: item.componentProps.fieldName,
});
}
});
});
console.log('newArr', newArr);
fieldOptions.value = newArr;
});
}
function getRoleListData() {
getRoleListByPage().then((res: Recordable) => {
const arr: any = [];