Skip to content

Commit

Permalink
原生表单新增携带 createTime 等系统字段 #1033
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangdaiscott committed Feb 23, 2024
1 parent a47d098 commit 4a85768
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,14 @@
function edit(record) {
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){
tmpData[key] = record[key]
}
})
//赋值
Object.assign(formData, record);
Object.assign(formData, tmpData);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,15 @@
resetFields();
expandedRowKeys.value = [];
treeData.value = await loadTreeData({ async: false, pcode: '' });
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){
tmpData[key] = record[key]
}
})
//赋值
Object.assign(formData, record);
model = record
Object.assign(formData,tmpData);
model = tmpData
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,14 @@
function edit(record) {
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){
tmpData[key] = record[key]
}
})
//赋值
Object.assign(formData, record);
Object.assign(formData,tmpData);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,14 @@
function edit(record) {
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){
tmpData[key] = record[key]
}
})
//赋值
Object.assign(formData, record);
Object.assign(formData,tmpData);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,14 @@

async function queryMainData(id) {
const row = await queryDataById(id);
Object.keys(row).map(k => {
formData[k] = row[k];
});
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(row.hasOwnProperty(key)){
tmpData[key] = row[key]
}
})
//赋值
Object.assign(formData,tmpData);
}

const {getSubFormAndTableData, transformData} = useValidateAntFormAndTable(activeKey, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,20 @@

async function initFormData(mainId) {
resetFields();
let tmpData = {}
if(mainId){
let list = await query${sub.entityName}ListByMainId(mainId);
if(list && list.length>0){
let temp = list[0];
Object.keys(temp).map(k=>{
formData[k] = temp[k];
Object.keys(formData).forEach((key) => {
if(temp.hasOwnProperty(key)){
tmpData[key] = temp[key]
}
})
}
}
//赋值
Object.assign(formData,tmpData);
}

async function getFormData() {
Expand Down

0 comments on commit 4a85768

Please sign in to comment.