3 changed files with 85 additions and 1 deletions
@ -0,0 +1,67 @@ |
|||||
|
<script setup lang="ts"> |
||||
|
import { getPointList, updatePoint } from 'apis/point' |
||||
|
import { getPoint } from 'apis/system' |
||||
|
import { onMounted, ref } from 'vue' |
||||
|
|
||||
|
const emits = defineEmits(['ok', 'cancel']) |
||||
|
|
||||
|
const pointList = ref<Point.Point[]>([]) |
||||
|
onMounted(async () => { |
||||
|
pointList.value = await getPointList() |
||||
|
form.value!.position = await getPoint() |
||||
|
}) |
||||
|
|
||||
|
const form = ref<Point.UpdateParams>({}) |
||||
|
const formRef = ref() |
||||
|
const rules = { |
||||
|
id: [ |
||||
|
{ required: true, message: '请选择名称', trigger: 'change' }, |
||||
|
], |
||||
|
} |
||||
|
|
||||
|
const okHandle = async () => { |
||||
|
try { |
||||
|
const valid = await formRef.value.validate() |
||||
|
if (!valid) { |
||||
|
return |
||||
|
} |
||||
|
await updatePoint(form.value!) |
||||
|
emits('ok') |
||||
|
} |
||||
|
catch (error) { |
||||
|
console.log(error) |
||||
|
} |
||||
|
} |
||||
|
const cancel = () => { |
||||
|
emits('cancel') |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<template> |
||||
|
<FtDialog visible title="保存坐标" width="40%" :ok-handle="okHandle" @cancel="cancel"> |
||||
|
<el-form ref="formRef" label-width="auto" :model="form" :rules="rules"> |
||||
|
<el-form-item label="当前坐标"> |
||||
|
<span>{{ form?.position }}</span> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="名称" prop="id"> |
||||
|
<el-select v-model="form.id" placeholder="请选择名称"> |
||||
|
<el-option |
||||
|
v-for="item in pointList" |
||||
|
:key="item.id" |
||||
|
:label="item.name" |
||||
|
:value="item.code" |
||||
|
/> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
</FtDialog> |
||||
|
</template> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
.item-box { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: space-between; |
||||
|
padding: 5px; |
||||
|
} |
||||
|
</style> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue