2025-10-30 19:30:06 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<Dialog
|
|
|
|
|
|
v-model="visible"
|
|
|
|
|
|
show-footer
|
|
|
|
|
|
diaTitle="新增参数对象"
|
2025-11-28 14:56:37 +08:00
|
|
|
|
:width="450"
|
2025-11-26 16:26:28 +08:00
|
|
|
|
@close="closeFun"
|
2025-10-30 19:30:06 +08:00
|
|
|
|
>
|
|
|
|
|
|
<template #default>
|
2025-11-28 14:56:37 +08:00
|
|
|
|
<TableForm
|
|
|
|
|
|
ref="tableFormRef"
|
|
|
|
|
|
tableName="PARAMETER_LIBRARY_FORM"
|
|
|
|
|
|
:data="formData"
|
|
|
|
|
|
showDisabled
|
|
|
|
|
|
@change="changeFun"
|
|
|
|
|
|
:formAttrs="{
|
|
|
|
|
|
files: {
|
|
|
|
|
|
accept: '.json'
|
|
|
|
|
|
}
|
|
|
|
|
|
}"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<div class="tip">
|
|
|
|
|
|
<el-tooltip
|
|
|
|
|
|
placement="top"
|
|
|
|
|
|
content="例:[{'parameterName': 'parameterName','parameterValue': 'parameterValue', 'unit': 'unit', 'description': 'description'}]"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-icon class="icon" :size="16">
|
|
|
|
|
|
<Warning />
|
|
|
|
|
|
</el-icon>
|
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
|
<span>参数对象上传的JSON文件格式必须遵守格式要求,否则无法解析!</span>
|
|
|
|
|
|
</div>
|
2025-10-30 19:30:06 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
<div class="dialog-footer">
|
2025-11-26 16:26:28 +08:00
|
|
|
|
<el-button @click="closeFun">取消</el-button>
|
2025-11-04 09:56:26 +08:00
|
|
|
|
<el-button type="primary" @click="onConfirmFun">确定</el-button>
|
2025-10-30 19:30:06 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</Dialog>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2025-11-28 14:56:37 +08:00
|
|
|
|
import { ref, onMounted } from 'vue';
|
2025-10-30 19:30:06 +08:00
|
|
|
|
import Dialog from '@/components/common/dialog/index.vue';
|
2025-11-28 14:56:37 +08:00
|
|
|
|
import TableForm from '@/components/common/table/tableForm.vue';
|
|
|
|
|
|
import { Warning } from '@element-plus/icons-vue';
|
2025-10-30 19:30:06 +08:00
|
|
|
|
|
2025-11-28 14:56:37 +08:00
|
|
|
|
const emits = defineEmits(['close', 'createFun']);
|
2025-10-30 19:30:06 +08:00
|
|
|
|
const props = defineProps(['libTypeInfo']);
|
|
|
|
|
|
const visible = ref(true);
|
2025-11-28 14:56:37 +08:00
|
|
|
|
const tableFormRef = ref<any>();
|
|
|
|
|
|
const formData = ref<any>({});
|
2025-10-30 19:30:06 +08:00
|
|
|
|
|
2025-11-26 16:26:28 +08:00
|
|
|
|
const closeFun = () => {
|
2025-10-30 19:30:06 +08:00
|
|
|
|
emits('close');
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-11-28 14:56:37 +08:00
|
|
|
|
const onConfirmFun = async() => {
|
|
|
|
|
|
const valid = await tableFormRef.value?.validateFun();
|
|
|
|
|
|
if (valid) {
|
|
|
|
|
|
emits('createFun', formData.value);
|
2025-10-30 19:30:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-11-28 14:56:37 +08:00
|
|
|
|
const changeFun = (data: any) => {
|
|
|
|
|
|
const { key, val } = data;
|
|
|
|
|
|
if (key === 'files') {
|
|
|
|
|
|
formData.value.file = val.raw;
|
|
|
|
|
|
formData.value.fileName = val.name;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (key === 'templateId') {
|
|
|
|
|
|
formData.value.templateName = val.label;
|
|
|
|
|
|
}
|
2025-10-30 19:30:06 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-11-26 16:26:28 +08:00
|
|
|
|
onMounted(() => {
|
2025-10-30 19:30:06 +08:00
|
|
|
|
if (props.libTypeInfo) {
|
2025-11-28 14:56:37 +08:00
|
|
|
|
formData.value.parameterLibraryName = props.libTypeInfo.libName;
|
|
|
|
|
|
formData.value.parameterLibraryCategoryName = props.libTypeInfo.name;
|
|
|
|
|
|
formData.value.parameterLibraryId = props.libTypeInfo.libId;
|
|
|
|
|
|
formData.value.parameterLibraryCategoryId = props.libTypeInfo.id;
|
2025-10-30 19:30:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
2025-11-26 16:26:28 +08:00
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.upload {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
.dialog-footer {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 40px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
|
}
|
|
|
|
|
|
.tip {
|
2025-11-28 14:56:37 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: flex-end;
|
2025-11-26 16:26:28 +08:00
|
|
|
|
padding-bottom: 10px;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
line-height: 14px;
|
|
|
|
|
|
color: var(--el-text-color-secondary);
|
2025-11-28 14:56:37 +08:00
|
|
|
|
.icon {
|
|
|
|
|
|
color: var(--el-color-danger);
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
}
|
|
|
|
|
|
span {
|
|
|
|
|
|
padding-left: 4px;
|
|
|
|
|
|
}
|
2025-11-26 16:26:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|