105 lines
2.3 KiB
Vue
105 lines
2.3 KiB
Vue
<template>
|
|
<div class="edit-popup">
|
|
<popup
|
|
ref="popupRef"
|
|
title="选择地点"
|
|
:async="true"
|
|
width="550px"
|
|
@confirm="handleSubmit"
|
|
@close="handleClose"
|
|
>
|
|
<el-form>
|
|
<el-form-item label="">
|
|
<el-input
|
|
style="width: 300px; margin-right: 16px"
|
|
placeholder="请输入要搜索的地址"
|
|
/>
|
|
<el-button type="primary">搜索</el-button>
|
|
</el-form-item>
|
|
<el-form-item label="地图">
|
|
<MapContainer></MapContainer>
|
|
</el-form-item>
|
|
</el-form>
|
|
</popup>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup name="taskTemplateEdit">
|
|
import type { FormInstance } from "element-plus";
|
|
import Popup from "@/components/popup/index.vue";
|
|
import {
|
|
apiTaskTemplateAdd,
|
|
apiTaskTemplateEdit,
|
|
apiTaskTemplateDetail,
|
|
} from "@/api/task_template";
|
|
import { timeFormat } from "@/utils/util";
|
|
import type { PropType } from "vue";
|
|
import { dictDataLists } from "@/api/setting/dict";
|
|
import MapContainer from "@/components/map/MapContainer.vue";
|
|
defineProps({
|
|
dictData: {
|
|
type: Object as PropType<Record<string, any[]>>,
|
|
default: () => ({}),
|
|
},
|
|
});
|
|
const emit = defineEmits(["success", "close"]);
|
|
const formRef = shallowRef<FormInstance>();
|
|
const popupRef = shallowRef<InstanceType<typeof Popup>>();
|
|
const mode = ref("add");
|
|
const datalist = ref([]);
|
|
|
|
// 获取详情
|
|
const setFormData = async (data: Record<any, any>) => {
|
|
for (const key in formData) {
|
|
if (data[key] != null && data[key] != undefined) {
|
|
//@ts-ignore
|
|
formData[key] = data[key];
|
|
}
|
|
}
|
|
};
|
|
|
|
const getDetail = async (row: Record<string, any>) => {
|
|
const data = await apiTaskTemplateDetail({
|
|
id: row.id,
|
|
});
|
|
setFormData(data);
|
|
};
|
|
|
|
// 地图控件
|
|
const mapShow = ref(false);
|
|
const mapPopupRef = ref(null);
|
|
|
|
// 选择任务类型
|
|
const changeTaskType = (e: any) => {
|
|
if (e == 32) {
|
|
mapShow.value = true; //为三轮车时
|
|
mapPopupRef.value.open();
|
|
}
|
|
};
|
|
|
|
// 提交按钮
|
|
const handleSubmit = async () => {
|
|
return console.log("ss");
|
|
|
|
popupRef.value?.close();
|
|
emit("success");
|
|
};
|
|
|
|
//打开弹窗
|
|
const open = (type = "add") => {
|
|
mode.value = type;
|
|
popupRef.value?.open();
|
|
};
|
|
|
|
// 关闭回调
|
|
const handleClose = () => {
|
|
emit("close");
|
|
};
|
|
|
|
defineExpose({
|
|
open,
|
|
setFormData,
|
|
getDetail,
|
|
});
|
|
</script>
|
|
|