2024-12-24 20:22:36 +08:00
|
|
|
|
2024-11-21 14:42:26 +08:00
|
|
|
<template>
|
2024-12-24 20:22:36 +08:00
|
|
|
<el-dialog :title="dialogTitle"
|
|
|
|
|
v-model='dialogVisible'
|
|
|
|
|
@close="close"
|
|
|
|
|
v-bind="dialogBig"
|
|
|
|
|
width="1400px">
|
|
|
|
|
<div class="dialog-content" >
|
|
|
|
|
<el-form :model='formContent' label-width="auto" class="form-three ">
|
|
|
|
|
<el-form-item label="脚本名称" prop='name'>
|
|
|
|
|
<el-input v-model='formContent.name' />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="参照标准名称" prop='standardName'>
|
|
|
|
|
<el-input v-model='formContent.standardName' />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="标准推行年份" prop='standardTime'>
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="formContent.standardTime"
|
|
|
|
|
type="year"
|
|
|
|
|
placeholder="请选择标准推行年份"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label='值类型' prop='valueType' >
|
|
|
|
|
<el-select v-model="formContent.valueType" filterable clearable placeholder="请选择值类型">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in dictStore.getDictData('Script_Value_Type')"
|
|
|
|
|
:key="item.id"
|
|
|
|
|
:label="item.name"
|
|
|
|
|
:value="item.id"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</div>
|
|
|
|
|
<TestScriptDetail />
|
|
|
|
|
<template #footer>
|
|
|
|
|
<div >
|
|
|
|
|
<el-button @click='close()'>取 消</el-button>
|
|
|
|
|
<el-button type="primary" @click='save()'>保存</el-button>
|
2024-11-21 14:42:26 +08:00
|
|
|
</div>
|
2024-12-24 20:22:36 +08:00
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
2024-11-21 14:42:26 +08:00
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
<script setup lang='ts'>
|
2024-12-24 20:22:36 +08:00
|
|
|
import { dialogBig } from '@/utils/elementBind'
|
|
|
|
|
import { computed, ref } from 'vue'
|
|
|
|
|
import { useDictStore } from '@/stores/modules/dict'
|
|
|
|
|
import TestScriptDetail from '@/views/machine/testScript/components/testScriptDetail.vue';
|
|
|
|
|
import { type TestScript } from '@/api/device/interface/testScript';
|
|
|
|
|
|
|
|
|
|
const modeId = ref()
|
2024-11-21 14:42:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// 定义弹出组件元信息
|
|
|
|
|
const dialogFormRef = ref()
|
2024-12-24 20:22:36 +08:00
|
|
|
const dictStore = useDictStore()
|
2024-11-21 14:42:26 +08:00
|
|
|
function useMetaInfo() {
|
|
|
|
|
const dialogVisible = ref(false)
|
2024-12-24 20:22:36 +08:00
|
|
|
const titleType = ref('add')
|
|
|
|
|
const formContent = ref<TestScript.ResTestScript>({
|
|
|
|
|
name: '',
|
|
|
|
|
type: '',
|
|
|
|
|
valueType:'',
|
|
|
|
|
pattern: modeId.value,
|
|
|
|
|
standardName: '',
|
|
|
|
|
standardTime: '',
|
|
|
|
|
state:1,
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
return { dialogVisible, titleType,formContent }
|
2024-11-21 14:42:26 +08:00
|
|
|
}
|
|
|
|
|
|
2024-12-24 20:22:36 +08:00
|
|
|
const { dialogVisible, titleType,formContent } = useMetaInfo()
|
|
|
|
|
|
|
|
|
|
let dialogTitle = computed(() => {
|
|
|
|
|
return titleType.value === 'add' ? '新增检测脚本' : '编辑检测脚本'
|
|
|
|
|
})
|
|
|
|
|
|
2024-11-21 14:42:26 +08:00
|
|
|
// 清空formContent
|
|
|
|
|
const resetFormContent = () => {
|
|
|
|
|
formContent.value = {
|
2024-12-24 20:22:36 +08:00
|
|
|
name: '',
|
|
|
|
|
type: '',
|
|
|
|
|
valueType:'',
|
|
|
|
|
pattern: modeId.value,
|
|
|
|
|
standardName: '',
|
|
|
|
|
standardTime: '',
|
|
|
|
|
state:1,
|
2024-11-21 14:42:26 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 关闭弹窗
|
|
|
|
|
const close = () => {
|
|
|
|
|
dialogVisible.value = false
|
|
|
|
|
// 清空dialogForm中的值
|
|
|
|
|
resetFormContent()
|
|
|
|
|
// 重置表单
|
|
|
|
|
dialogFormRef.value?.resetFields()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 保存数据
|
|
|
|
|
const save = () => {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 打开弹窗,可能是新增,也可能是编辑
|
2024-12-24 20:22:36 +08:00
|
|
|
const open = (sign: string,row: any,currentMode: string) => {
|
|
|
|
|
titleType.value = sign
|
|
|
|
|
modeId.value = dictStore.getDictData('Pattern').find(item => item.name === currentMode)?.id;
|
2024-11-21 14:42:26 +08:00
|
|
|
// 重置表单
|
|
|
|
|
dialogFormRef.value?.resetFields()
|
|
|
|
|
dialogVisible.value = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 对外映射
|
|
|
|
|
defineExpose({ open })
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
refreshTable: (() => Promise<void>) | undefined;
|
|
|
|
|
}>()
|
|
|
|
|
|
2024-12-24 20:22:36 +08:00
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
<style scoped>
|
|
|
|
|
/* .dialog-content {
|
|
|
|
|
padding: 10px;
|
|
|
|
|
} */
|
|
|
|
|
</style>
|