|
|
|
@ -3,6 +3,7 @@ import { EnvFormRulesType, EnvFormType } from '@/views/Auth/Env/DataModal.js'; |
|
|
|
|
import { h, onMounted, ref, watch } from 'vue'; |
|
|
|
|
import { ReloadOutlined, SettingOutlined } from '@ant-design/icons-vue'; |
|
|
|
|
import { useBaseDataStore } from '@/stores'; |
|
|
|
|
import AntdModalTemplate from '@/components/AntDesignVue/CustomAntDesignVue/AntdModalTemplate/index.vue'; |
|
|
|
|
const baseDataStore = useBaseDataStore(); |
|
|
|
|
|
|
|
|
|
defineOptions({ |
|
|
|
@ -44,29 +45,16 @@ const handleAck = () => { |
|
|
|
|
if (Array.isArray(value.envVal) && value.envVal.length > 0) { |
|
|
|
|
data.envVal = value.envVal.slice(-1)[0]; |
|
|
|
|
} |
|
|
|
|
props.data.handleAck(data).then(() => { |
|
|
|
|
clearInput(); |
|
|
|
|
}).catch(e => e); |
|
|
|
|
props.data.handleAck(data).catch(e => e); |
|
|
|
|
}) |
|
|
|
|
.catch((err) => { |
|
|
|
|
formRef.value.scrollToField(err?.errorFields[0]?.name); |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
// ! 取消 |
|
|
|
|
const handleCancel = () => { |
|
|
|
|
props.data.handleCancel(); |
|
|
|
|
clearInput(); |
|
|
|
|
}; |
|
|
|
|
// ! 清除表单验证记录 |
|
|
|
|
function clearValidate() { |
|
|
|
|
formRef.value?.clearValidate(); |
|
|
|
|
} |
|
|
|
|
// ! 清理表单内容 |
|
|
|
|
function clearInput() { |
|
|
|
|
formRef.value.resetFields(); |
|
|
|
|
clearValidate(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ! pid |
|
|
|
|
watch(props.data.formData, (newVal, oldVal) => { |
|
|
|
|
if (newVal.pid != '') { |
|
|
|
@ -106,6 +94,7 @@ onMounted(() => { |
|
|
|
|
<AFlex gap="small"> |
|
|
|
|
<ACascader |
|
|
|
|
flex="1" |
|
|
|
|
:disabled="props.data.isUpdate" |
|
|
|
|
allowClear |
|
|
|
|
showSearch |
|
|
|
|
v-model:value="props.data.formData.pid" |
|
|
|
@ -123,7 +112,7 @@ onMounted(() => { |
|
|
|
|
<ASelect |
|
|
|
|
placeholder="请选择所属服务" |
|
|
|
|
ref="serviceKey" |
|
|
|
|
:disabled="serviceKeyDisabled" |
|
|
|
|
:disabled="serviceKeyDisabled || props.data.isUpdate" |
|
|
|
|
v-model:value="props.data.formData.serviceKey" |
|
|
|
|
:options="baseDataStore.state.serviceList" |
|
|
|
|
:field-names="{ label: 'serviceName', value: 'serviceKey', options: 'children' }" |
|
|
|
@ -182,7 +171,7 @@ onMounted(() => { |
|
|
|
|
</AFormItem> |
|
|
|
|
</AForm> |
|
|
|
|
<template #footer> |
|
|
|
|
<AButton type="dashed" @click="handleCancel">取消</AButton> |
|
|
|
|
<AButton type="dashed" @click="props.data.handleCancel">取消</AButton> |
|
|
|
|
<AckCreateAntdButton @click="handleAck" /> |
|
|
|
|
</template> |
|
|
|
|
</AntdModalTemplate> |
|
|
|
|