Browse Source

详情组件修改 实现子表编辑保存功能

master
陈薪名 1 year ago
parent
commit
dd019195c1
  1. 23
      src/components/Detail/src/Detail.vue

23
src/components/Detail/src/Detail.vue

@ -56,11 +56,12 @@
@success="getList"
:rules="detailAllSchemasRules"
:formAllSchemas="detailAllSchemas"
:isBusiness="false"
:isBusiness="true"
:apiUpdate="apiUpdate"
:apiCreate="apiCreate"
@searchTableSuccess="searchTableSuccess"
:detailData="detailData"
@submitForm="submitForm"
/>
</div>
</template>
@ -257,7 +258,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
//
buttondata.value = [
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1','1','PLAN_PURCHASE_READY','1'])}), //
defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['1','1','PLAN_PURCHASE_READY','1'])}), //
// defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['1','1','PLAN_PURCHASE_READY','1'])}), //
]
} finally {
detailLoading.value = false
@ -337,6 +338,24 @@ const formRef = ref()
const openForm = async (type: string, row?: number) => {
formRef.value.open(type, row, masterParmas.value)
}
// form
const submitForm = async (formType, data) => {
try {
if (formType === 'create') {
await props.apiCreate(data)
message.success(t('common.createSuccess'))
} else {
await props.apiUpdate(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
}
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
emit('searchTableSuccessDetail', formField, searchField, val, formRef)

Loading…
Cancel
Save