|
|
|
@ -15,6 +15,7 @@ |
|
|
|
|
:loading="loading" |
|
|
|
|
:columns="columns" |
|
|
|
|
:dataSource="dataSource" |
|
|
|
|
@valueChange="handleValueChange" |
|
|
|
|
@save="handleTableSave" |
|
|
|
|
/> |
|
|
|
|
</a-card> |
|
|
|
@ -68,11 +69,11 @@ const columns = ref<JVxeColumn[]>([ |
|
|
|
|
// 列的宽度 |
|
|
|
|
width: 260, |
|
|
|
|
// 如果加上了该属性,就代表当前单元格是可编辑的,type就是表单的类型,input就是简单的输入框 |
|
|
|
|
type: JVxeTypes.inputNumber, |
|
|
|
|
type: JVxeTypes.normal, |
|
|
|
|
}, |
|
|
|
|
{ key: 'specialFee', title: '专项经费', width: 260, type: JVxeTypes.inputNumber }, |
|
|
|
|
{ key: 'selfFee', title: '自筹经费', width: 260, type: JVxeTypes.inputNumber }, |
|
|
|
|
{ key: 'specialFeeMark', title: '专项经费说明', width: 260, type: JVxeTypes.textarea }, |
|
|
|
|
{ key: 'selfFee', title: '自筹经费', width: 130, type: JVxeTypes.inputNumber }, |
|
|
|
|
{ key: 'specialFeeMark', title: '专项经费说明', width: 380, type: JVxeTypes.textarea }, |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
// 查询url地址 |
|
|
|
@ -88,6 +89,31 @@ enum Api { |
|
|
|
|
|
|
|
|
|
loadData(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 当选择的行变化时触发的事件 |
|
|
|
|
function handleSelectRowChange(event) { |
|
|
|
|
/*console.log("handleSelectRowChange") |
|
|
|
|
selectedRows.value = event.selectedRows; |
|
|
|
|
console.log("handleSelectRowChange-event:", event) |
|
|
|
|
const {type, row, column, value, target, $table} = event |
|
|
|
|
// row.totalFee = event.value; |
|
|
|
|
console.log('--------------------') |
|
|
|
|
console.log('selfFee',row.selfFee) |
|
|
|
|
console.log('totalFee',row.totalFee)*/ |
|
|
|
|
// target.$refs.vxe.columns[4].options = this.stationIdList; |
|
|
|
|
// target.$refs.vxe.columns[17].options = this.userIdList; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
function handleValueChange(event) { |
|
|
|
|
console.log('handleValueChange.event: ', event); |
|
|
|
|
const {type, row, column, value, target, $table} = event |
|
|
|
|
/*console.log('selfFee',row.specialFee) |
|
|
|
|
console.log('selfFee',row.selfFee) |
|
|
|
|
console.log('--------------------')*/ |
|
|
|
|
row.totalFee = row.selfFee + row.specialFee; |
|
|
|
|
console.log('the new totalFee',row.totalFee) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 加载数据 |
|
|
|
|
async function loadData() { |
|
|
|
|
loading.value = true; |
|
|
|
@ -140,6 +166,7 @@ function handleTableSave({ $table, target }) { |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
createMessage.success(`保存成功!`); |
|
|
|
|
loadData(); |
|
|
|
|
}) |
|
|
|
|
.finally(() => { |
|
|
|
|
loading.value = false; |
|
|
|
@ -170,6 +197,7 @@ function handleTableSave({ $table, target }) { |
|
|
|
|
function handleEditClosed(event) { |
|
|
|
|
let { $table, row, column } = event; |
|
|
|
|
let field = column.property; |
|
|
|
|
// console.log('field',field); |
|
|
|
|
// 判断单元格值是否被修改 |
|
|
|
|
if ($table.isUpdateByRow(row, field)) { |
|
|
|
|
// 校验当前行 |
|
|
|
@ -177,9 +205,9 @@ function handleEditClosed(event) { |
|
|
|
|
// 校验通过 |
|
|
|
|
if (!errMap) { |
|
|
|
|
// 【模拟保存】 |
|
|
|
|
let hideLoading = createMessage.loading(`正在保存"${column.title}"`, 0); |
|
|
|
|
console.log('即时保存数据:', row); |
|
|
|
|
defHttp |
|
|
|
|
// let hideLoading = createMessage.loading(`正在保存"${column.title}"`, 0); |
|
|
|
|
console.log('-----handleEditClosed()--即时保存行row数据:', JSON.stringify(row)); |
|
|
|
|
/*defHttp |
|
|
|
|
.put({ |
|
|
|
|
url: Api.saveRow, |
|
|
|
|
params: row, |
|
|
|
@ -191,7 +219,7 @@ function handleEditClosed(event) { |
|
|
|
|
}) |
|
|
|
|
.finally(() => { |
|
|
|
|
hideLoading(); |
|
|
|
|
}); |
|
|
|
|
});*/ |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -207,9 +235,9 @@ function handlePageChange(event) { |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
// 当选择的行变化时触发的事件 |
|
|
|
|
function handleSelectRowChange(event) { |
|
|
|
|
selectedRows.value = event.selectedRows; |
|
|
|
|
} |
|
|
|
|
// function handleSelectRowChange(event) { |
|
|
|
|
// selectedRows.value = event.selectedRows; |
|
|
|
|
// } |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<style scoped></style> |
|
|
|
|