Merge branch 'main' of http://123.132.248.154:10000/HC_YFZX/CaiYuanYiTiHua
commit
aa5f26bb7f
|
|
@ -222,6 +222,7 @@
|
|||
if (index == 0) {
|
||||
itemColumnChild.itemProps.hidden = false;
|
||||
}
|
||||
itemColumnChild.colProps.span = itemColumn.span;
|
||||
arr.push(itemColumnChild);
|
||||
val.children.push(itemColumnChild);
|
||||
});
|
||||
|
|
@ -249,7 +250,16 @@
|
|||
item.rules[0].pattern = new RegExp(item.rules[0].pattern.slice(1, -1));
|
||||
}
|
||||
}
|
||||
arr.push(item);
|
||||
if (item.columns) {
|
||||
item.columns.forEach((col) => {
|
||||
col.children.forEach((chld) => {
|
||||
chld.colProps.span = col.span;
|
||||
arr.push(chld);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
arr.push(item);
|
||||
}
|
||||
formColumns.value = arr;
|
||||
if (item.component === 'Card') {
|
||||
cardLayout.value.push(item);
|
||||
|
|
@ -356,7 +366,7 @@
|
|||
subTableList.value = data.recordChildren;
|
||||
} else {
|
||||
if (tabsColumns.value.length < 1) {
|
||||
resetFields();
|
||||
// resetFields();
|
||||
}
|
||||
subTableList.value = [];
|
||||
}
|
||||
|
|
@ -374,8 +384,6 @@
|
|||
});
|
||||
|
||||
function tabsChange(e) {
|
||||
console.log('eee', e);
|
||||
console.log('tabsColumns', tabsColumns);
|
||||
const columns: FormSchema[] = [];
|
||||
tabsColumns.value.forEach((item) => {
|
||||
item.children.forEach((val) => {
|
||||
|
|
@ -390,11 +398,8 @@
|
|||
columns.push(val);
|
||||
});
|
||||
});
|
||||
console.log('columns', columns);
|
||||
console.log('formColumns', formColumns);
|
||||
const obj = getFieldsValue();
|
||||
console.log('values', getFieldsValue());
|
||||
// resetFields();
|
||||
|
||||
setTimeout(() => {
|
||||
updateSchema(columns);
|
||||
resetFields();
|
||||
|
|
@ -433,7 +438,9 @@
|
|||
labelWidth: 100,
|
||||
schemas: formColumns,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { lg: 24, md: 24 },
|
||||
actionColOptions: {
|
||||
span: 24,
|
||||
},
|
||||
});
|
||||
//表单填写数据
|
||||
async function ModalSureClick() {
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@
|
|||
const arr: any = [];
|
||||
formScheme.value.formInfo.tabList.forEach((item, index) => {
|
||||
item.schemas.forEach((val) => {
|
||||
if (val.type == 'subTable' && val.columns) {
|
||||
if (val.columns) {
|
||||
console.log('val', val);
|
||||
val.columns.forEach((col) => {
|
||||
col.children.forEach((chil) => {
|
||||
|
|
@ -235,9 +235,21 @@
|
|||
formScheme.value.formInfo.schemas = arr;
|
||||
}
|
||||
if (formScheme.value.formInfo.tabList && formScheme.value.formInfo.tabList.length == 1) {
|
||||
formScheme.value.formInfo.schemas = formScheme.value.formInfo.tabList[0].schemas;
|
||||
const arr: any = [];
|
||||
formScheme.value.formInfo.tabList[0].schemas.forEach((item) => {
|
||||
if (item.columns) {
|
||||
item.columns.forEach((col) => {
|
||||
col.children.forEach((chil) => {
|
||||
arr.push(chil);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
arr.push(item);
|
||||
}
|
||||
});
|
||||
formScheme.value.formInfo.schemas = arr;
|
||||
}
|
||||
delete formScheme.value.formInfo.tabList;
|
||||
// delete formScheme.value.formInfo.tabList;
|
||||
formScheme.value.formInfo.schemas.forEach((tab: any) => {
|
||||
if (!notInColumns.includes(tab.component)) {
|
||||
columns.push(tab);
|
||||
|
|
|
|||
|
|
@ -117,50 +117,52 @@
|
|||
return arr;
|
||||
}
|
||||
const changeCardStructure = (data) => {
|
||||
let result = []
|
||||
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.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(["Grid","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 = []
|
||||
|
||||
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 });
|
||||
}
|
||||
}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.componentProps.options = [];
|
||||
} 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 (['Grid', 'Card'].includes(item.component)) {
|
||||
item.columns[0].children = changeCardStructure(item.columns[0].children);
|
||||
if (
|
||||
(item.component === 'Card' || item.component === 'Grid') &&
|
||||
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 = []
|
||||
});
|
||||
item.children = [];
|
||||
}
|
||||
}
|
||||
result.push(item);
|
||||
|
|
@ -169,7 +171,7 @@
|
|||
}else{
|
||||
return data
|
||||
}
|
||||
}
|
||||
};
|
||||
async function designSendGrandson(value) {
|
||||
let designTab = JSON.parse(value);
|
||||
let schems = saveFormDatas.value.scheme.scheme
|
||||
|
|
@ -493,23 +495,23 @@
|
|||
}
|
||||
|
||||
const cardNestStructure = (data) => {
|
||||
let childList = {}
|
||||
let result = []
|
||||
data.forEach(item => {
|
||||
if(item.schemas){
|
||||
item.schemas = cardNestStructure(item.schemas)
|
||||
result.push(item)
|
||||
}else if(item.ptype){
|
||||
if(Object.keys(item).includes('children')){
|
||||
item.children = childList[item.field] || []
|
||||
let childList = {};
|
||||
let result = [];
|
||||
data.forEach((item) => {
|
||||
if (item.schemas) {
|
||||
item.schemas = cardNestStructure(item.schemas);
|
||||
result.push(item);
|
||||
} else if (item.ptype) {
|
||||
if (Object.keys(item).includes('children')) {
|
||||
item.children = childList[item.field] || [];
|
||||
}
|
||||
if(item.component === 'CardGroup' && Object.keys(item).includes('componentProps')){
|
||||
item.componentProps.options = childList[item.field] || []
|
||||
if (item.component === 'CardGroup' && Object.keys(item).includes('componentProps')) {
|
||||
item.componentProps.options = childList[item.field] || [];
|
||||
}
|
||||
let pushItem = {}
|
||||
Object.keys(item).forEach(key => {
|
||||
if(key !== 'ptype' && key !== 'pfield'){
|
||||
pushItem[key] = item[key]
|
||||
let pushItem = {};
|
||||
Object.keys(item).forEach((key) => {
|
||||
if (key !== 'ptype' && key !== 'pfield') {
|
||||
pushItem[key] = item[key];
|
||||
}
|
||||
});
|
||||
if (childList[item.pfield]) {
|
||||
|
|
@ -517,18 +519,17 @@
|
|||
} else {
|
||||
childList[item.pfield] = [pushItem];
|
||||
}
|
||||
|
||||
}else if(item.component === 'CardGroup'){
|
||||
item.componentProps.options = childList[item.field] || []
|
||||
result.push(item)
|
||||
}else if(item.component === 'Card'){
|
||||
item.columns[0].children = childList[item.field] || []
|
||||
result.push(item)
|
||||
}else if(item.field && item.field.indexOf('use_card') !== -1){
|
||||
item.children = childList[item.field] || []
|
||||
result.push(item)
|
||||
}else{
|
||||
result.push(item)
|
||||
} else if (item.component === 'CardGroup') {
|
||||
item.componentProps.options = childList[item.field] || [];
|
||||
result.push(item);
|
||||
} else if (item.component === 'Card' || item.component === 'Grid') {
|
||||
item.columns[0].children = childList[item.field] || [];
|
||||
result.push(item);
|
||||
} else if (item.field.indexOf('use_card') !== -1) {
|
||||
item.children = childList[item.field] || [];
|
||||
result.push(item);
|
||||
} else {
|
||||
result.push(item);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,10 @@
|
|||
{{ getCodesTypeArrByType(record.type) }}
|
||||
</template>
|
||||
<template v-if="column.key === 'explanation' && !isDetail">
|
||||
<a-input v-model:value="record.explanation" placeholder="请输入备注" />
|
||||
<a-input
|
||||
v-model:value="record.explanation"
|
||||
placeholder="请输入备注,备注内不能含有英文字符的,和:"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.key === 'action' && (!record.isOldColumn || !isUpdate)">
|
||||
<TableAction
|
||||
|
|
@ -65,11 +68,13 @@
|
|||
import { BasicModal, useModalInner } from '@/components/Modal';
|
||||
import { BasicTable, useTable, TableAction } from '@/components/Table';
|
||||
import { columns, columns_isDetail } from './modal.data';
|
||||
import { useMessage } from '@/hooks/web/useMessage';
|
||||
// api
|
||||
import { createPicTable, updateTable } from '@/api/database/index';
|
||||
import { getLoad } from '@/api/sys/sysDataItemDetail';
|
||||
|
||||
const emit = defineEmits(['submit']);
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
|
|
@ -162,34 +167,44 @@
|
|||
let arr = getDataSource();
|
||||
// console.log('record', arr);
|
||||
let newArr: any = [];
|
||||
let flag = true;
|
||||
arr.forEach((item) => {
|
||||
if (
|
||||
item.explanation &&
|
||||
(item.explanation.indexOf(':') > -1 || item.explanation.indexOf(',') > -1)
|
||||
) {
|
||||
createMessage.warn('备注内不能含有英文字符的,和:');
|
||||
flag = false;
|
||||
}
|
||||
newArr.push({
|
||||
name: item.name,
|
||||
type: item.type,
|
||||
explanation: item.explanation,
|
||||
});
|
||||
});
|
||||
const param: any = {
|
||||
tableName: tableName.value,
|
||||
tableInfos: newArr,
|
||||
};
|
||||
// console.log('param', param);
|
||||
if (isUpdate.value) {
|
||||
updateTable(param).then((res: Recordable) => {
|
||||
console.log('res', res);
|
||||
setTableData([]);
|
||||
tableName.value = null;
|
||||
emit('submit');
|
||||
closeModal();
|
||||
});
|
||||
} else {
|
||||
createPicTable(param).then((res: Recordable) => {
|
||||
console.log('res', res);
|
||||
setTableData([]);
|
||||
tableName.value = null;
|
||||
emit('submit');
|
||||
closeModal();
|
||||
});
|
||||
if (flag) {
|
||||
const param: any = {
|
||||
tableName: tableName.value,
|
||||
tableInfos: newArr,
|
||||
};
|
||||
console.log('param', param);
|
||||
if (isUpdate.value) {
|
||||
updateTable(param).then((res: Recordable) => {
|
||||
console.log('res', res);
|
||||
setTableData([]);
|
||||
tableName.value = null;
|
||||
emit('submit');
|
||||
closeModal();
|
||||
});
|
||||
} else {
|
||||
createPicTable(param).then((res: Recordable) => {
|
||||
console.log('res', res);
|
||||
setTableData([]);
|
||||
tableName.value = null;
|
||||
emit('submit');
|
||||
closeModal();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
// 字典类型
|
||||
|
|
|
|||
Loading…
Reference in New Issue