|
|
@ -5,6 +5,7 @@ import type { Ref } from 'vue' |
|
|
|
import { |
|
|
|
import { |
|
|
|
FieldsInj, |
|
|
|
FieldsInj, |
|
|
|
IsFormInj, |
|
|
|
IsFormInj, |
|
|
|
|
|
|
|
IsKanbanInj, |
|
|
|
MetaInj, |
|
|
|
MetaInj, |
|
|
|
ReloadRowDataHookInj, |
|
|
|
ReloadRowDataHookInj, |
|
|
|
computedInject, |
|
|
|
computedInject, |
|
|
@ -50,18 +51,20 @@ const fields = computedInject(FieldsInj, (_fields) => { |
|
|
|
return _fields?.value ?? [] |
|
|
|
return _fields?.value ?? [] |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isKanban = inject(IsKanbanInj, ref(false)) |
|
|
|
|
|
|
|
|
|
|
|
provide(MetaInj, meta) |
|
|
|
provide(MetaInj, meta) |
|
|
|
|
|
|
|
|
|
|
|
const { commentsDrawer, changedColumns, state: rowState, isNew, loadRow } = useProvideExpandedFormStore(meta, row) |
|
|
|
const { commentsDrawer, changedColumns, state: rowState, isNew, loadRow } = useProvideExpandedFormStore(meta, row) |
|
|
|
|
|
|
|
|
|
|
|
if (props.loadRow) { |
|
|
|
if (props.loadRow) { |
|
|
|
await loadRow() |
|
|
|
loadRow() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (props.rowId) { |
|
|
|
if (props.rowId) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
await loadRow(props.rowId) |
|
|
|
loadRow(props.rowId) |
|
|
|
} catch (e) { |
|
|
|
} catch (e: any) { |
|
|
|
if (e.response?.status === 404) { |
|
|
|
if (e.response?.status === 404) { |
|
|
|
// todo: i18n |
|
|
|
// todo: i18n |
|
|
|
message.error('Record not found') |
|
|
|
message.error('Record not found') |
|
|
@ -108,12 +111,14 @@ reloadHook.on(() => { |
|
|
|
|
|
|
|
|
|
|
|
provide(ReloadRowDataHookInj, reloadHook) |
|
|
|
provide(ReloadRowDataHookInj, reloadHook) |
|
|
|
|
|
|
|
|
|
|
|
// adding column titles to changedColumns if they are preset (e.g. kanban) |
|
|
|
if (isKanban.value) { |
|
|
|
|
|
|
|
// adding column titles to changedColumns if they are preset |
|
|
|
for (const [k, v] of Object.entries(row.value.row)) { |
|
|
|
for (const [k, v] of Object.entries(row.value.row)) { |
|
|
|
if (v) { |
|
|
|
if (v) { |
|
|
|
changedColumns.value.add(k) |
|
|
|
changedColumns.value.add(k) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<script lang="ts"> |
|
|
|
<script lang="ts"> |
|
|
|