|
|
@ -81,26 +81,26 @@ const DetailModal = defineComponent({ |
|
|
|
const onChangePlugin = changePlugin |
|
|
|
const onChangePlugin = changePlugin |
|
|
|
|
|
|
|
|
|
|
|
watch( |
|
|
|
watch( |
|
|
|
() => props.show, |
|
|
|
() => props.show, |
|
|
|
async () => { |
|
|
|
async () => { |
|
|
|
props.show && props.currentRecord && setDetail(props.currentRecord) |
|
|
|
props.show && props.currentRecord && setDetail(props.currentRecord) |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
watch( |
|
|
|
watch( |
|
|
|
() => state.json, |
|
|
|
() => state.json, |
|
|
|
() => { |
|
|
|
() => { |
|
|
|
if (!state.json?.length) return |
|
|
|
if (!state.json?.length) return |
|
|
|
state.json.forEach((item) => { |
|
|
|
state.json.forEach((item) => { |
|
|
|
const mergedItem = isFunction(item) ? item() : item |
|
|
|
const mergedItem = isFunction(item) ? item() : item |
|
|
|
mergedItem.name = t( |
|
|
|
mergedItem.name = t( |
|
|
|
'security.alarm_instance' + '.' + mergedItem.field |
|
|
|
'security.alarm_instance' + '.' + mergedItem.field |
|
|
|
) |
|
|
|
) |
|
|
|
}) |
|
|
|
}) |
|
|
|
const { rules: fieldsRules, elements: fieldsElements } = |
|
|
|
const { rules: fieldsRules, elements: fieldsElements } = |
|
|
|
getElementByJson(state.json, state.detailForm) |
|
|
|
getElementByJson(state.json, state.detailForm) |
|
|
|
rules.value = fieldsRules |
|
|
|
rules.value = fieldsRules |
|
|
|
elements.value = fieldsElements |
|
|
|
elements.value = fieldsElements |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
onMounted(() => { |
|
|
@ -137,66 +137,66 @@ const DetailModal = defineComponent({ |
|
|
|
} = this |
|
|
|
} = this |
|
|
|
const { currentRecord } = props |
|
|
|
const { currentRecord } = props |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<Modal |
|
|
|
<Modal |
|
|
|
show={show} |
|
|
|
show={show} |
|
|
|
title={t( |
|
|
|
title={t( |
|
|
|
currentRecord?.id |
|
|
|
currentRecord?.id |
|
|
|
? 'security.alarm_instance.edit_alarm_instance' |
|
|
|
? 'security.alarm_instance.edit_alarm_instance' |
|
|
|
: 'security.alarm_instance.create_alarm_instance' |
|
|
|
: 'security.alarm_instance.create_alarm_instance' |
|
|
|
)} |
|
|
|
)} |
|
|
|
onConfirm={onSubmit} |
|
|
|
onConfirm={onSubmit} |
|
|
|
confirmLoading={saving || loading} |
|
|
|
confirmLoading={saving || loading} |
|
|
|
onCancel={onCancel} |
|
|
|
onCancel={onCancel} |
|
|
|
> |
|
|
|
> |
|
|
|
{{ |
|
|
|
{{ |
|
|
|
default: () => ( |
|
|
|
default: () => ( |
|
|
|
<Form |
|
|
|
<Form |
|
|
|
ref='detailFormRef' |
|
|
|
ref='detailFormRef' |
|
|
|
loading={loading || pluginsLoading} |
|
|
|
loading={loading || pluginsLoading} |
|
|
|
meta={{ |
|
|
|
meta={{ |
|
|
|
...meta, |
|
|
|
...meta, |
|
|
|
rules: { |
|
|
|
rules: { |
|
|
|
...meta.rules, |
|
|
|
...meta.rules, |
|
|
|
...rules |
|
|
|
...rules |
|
|
|
}, |
|
|
|
}, |
|
|
|
elements: [ |
|
|
|
elements: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
path: 'instanceName', |
|
|
|
path: 'instanceName', |
|
|
|
label: t('security.alarm_instance.alarm_instance_name'), |
|
|
|
label: t('security.alarm_instance.alarm_instance_name'), |
|
|
|
widget: ( |
|
|
|
widget: ( |
|
|
|
<NInput |
|
|
|
<NInput |
|
|
|
v-model={[detailForm.instanceName, 'value']} |
|
|
|
v-model={[detailForm.instanceName, 'value']} |
|
|
|
placeholder={t( |
|
|
|
placeholder={t( |
|
|
|
'security.alarm_instance.alarm_instance_name_tips' |
|
|
|
'security.alarm_instance.alarm_instance_name_tips' |
|
|
|
)} |
|
|
|
)} |
|
|
|
/> |
|
|
|
/> |
|
|
|
) |
|
|
|
) |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
path: 'pluginDefineId', |
|
|
|
path: 'pluginDefineId', |
|
|
|
label: t('security.alarm_instance.select_plugin'), |
|
|
|
label: t('security.alarm_instance.select_plugin'), |
|
|
|
widget: ( |
|
|
|
widget: ( |
|
|
|
<NSelect |
|
|
|
<NSelect |
|
|
|
v-model={[detailForm.pluginDefineId, 'value']} |
|
|
|
v-model={[detailForm.pluginDefineId, 'value']} |
|
|
|
options={uiPlugins} |
|
|
|
options={uiPlugins} |
|
|
|
disabled={!!currentRecord?.id} |
|
|
|
disabled={!!currentRecord?.id} |
|
|
|
placeholder={t( |
|
|
|
placeholder={t( |
|
|
|
'security.alarm_instance.select_plugin_tips' |
|
|
|
'security.alarm_instance.select_plugin_tips' |
|
|
|
)} |
|
|
|
)} |
|
|
|
on-update:value={onChangePlugin} |
|
|
|
on-update:value={onChangePlugin} |
|
|
|
/> |
|
|
|
/> |
|
|
|
) |
|
|
|
) |
|
|
|
}, |
|
|
|
}, |
|
|
|
...elements |
|
|
|
...elements |
|
|
|
] |
|
|
|
] |
|
|
|
}} |
|
|
|
}} |
|
|
|
layout={{ |
|
|
|
layout={{ |
|
|
|
cols: 24 |
|
|
|
cols: 24 |
|
|
|
}} |
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
) |
|
|
|
) |
|
|
|
}} |
|
|
|
}} |
|
|
|
</Modal> |
|
|
|
</Modal> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|