|
@ -0,0 +1,56 @@ |
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
|
|
import { updatePoint } from 'apis/point' |
|
|
|
|
|
import { FtMessage } from 'libs/message' |
|
|
|
|
|
import { inject, ref } from 'vue' |
|
|
|
|
|
|
|
|
|
|
|
const emits = defineEmits(['ok', 'cancel']) |
|
|
|
|
|
|
|
|
|
|
|
const data = inject('currentData') |
|
|
|
|
|
|
|
|
|
|
|
const form = ref<Point.Point>(data as Point.Point) |
|
|
|
|
|
const formRef = ref() |
|
|
|
|
|
|
|
|
|
|
|
const rules = { |
|
|
|
|
|
position: [ |
|
|
|
|
|
{ required: true, message: '请输入坐标', trigger: 'blur' }, |
|
|
|
|
|
], |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const okHandle = async () => { |
|
|
|
|
|
try { |
|
|
|
|
|
const valid = await formRef.value.validate() |
|
|
|
|
|
if (!valid) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await updatePoint(form.value) |
|
|
|
|
|
FtMessage.success('保存成功') |
|
|
|
|
|
emits('ok') |
|
|
|
|
|
} |
|
|
|
|
|
catch (error) { |
|
|
|
|
|
console.log(error) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
const cancel = () => { |
|
|
|
|
|
emits('cancel') |
|
|
|
|
|
} |
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
|
|
<FtDialog visible title="编辑" width="30%" :ok-handle="okHandle" @cancel="cancel"> |
|
|
|
|
|
<el-form ref="formRef" label-width="auto" :model="form" :rules="rules"> |
|
|
|
|
|
<el-form-item label="名称"> |
|
|
|
|
|
<span>{{ form.name }}</span> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
<el-form-item label="坐标" prop="position"> |
|
|
|
|
|
<el-input v-model="form.position" placeholder="请输入坐标" /> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-form> |
|
|
|
|
|
</FtDialog> |
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|
|
|
.el-tag { |
|
|
|
|
|
margin-right: 5px; |
|
|
|
|
|
} |
|
|
|
|
|
</style> |