<!-- 保存页面 -->
<template>
<el-dialog title="资产管理_易耗品_供货商表信息" :visible.sync="visiable" width="70%">
<el-form ref="form" :rules="rules" :model="formData" label-width="100px" label-position="right">
<el-form-item label="供货商名称:" prop="supplierName">
<el-input placeholder="供货商名称" v-model="formData.supplierName"></el-input>
</el-form-item>
<el-form-item label="供货商介绍:" prop="supplierIntroduce">
<el-input placeholder="供货商介绍" v-model="formData.supplierIntroduce"></el-input>
</el-form-item>
<el-form-item label="供货商地址:" prop="supplierAddress">
<el-input placeholder="供货商地址" v-model="formData.supplierAddress"></el-input>
</el-form-item>
<el-form-item label="供货商电话:" prop="supplierPhone">
<el-input placeholder="供货商电话" v-model="formData.supplierPhone"></el-input>
</el-form-item>
<!-- <el-form-item label="供货商经度:" prop="supplierX">
<el-input placeholder="供货商经度" v-model="formData.supplierX"></el-input>
</el-form-item>
<el-form-item label="供货商纬度:" prop="supplierY">
<el-input placeholder="供货商纬度" v-model="formData.supplierY"></el-input>
</el-form-item>
<el-form-item label="位置">
<div id="container" style="height:300px">您使用的浏览器版本过低,请换高版本浏览器查看。</div>
</el-form-item> -->
<el-form-item label="经度:" prop="supplierX">
<el-input placeholder="经度" v-model="formData.supplierX"></el-input>
</el-form-item>
<el-form-item label="纬度:" prop="supplierY">
<el-input placeholder="纬度" v-model="formData.supplierY"></el-input>
</el-form-item>
<el-form-item label="位置">
<div id="container" style="height:300px">您使用的浏览器版本过低,请换高版本浏览器查看。</div>
</el-form-item>
<el-form-item label="供货商排序:" prop="supplierOrder">
<el-slider placeholder="供货商排序" v-model="formData.supplierOrder" :step="10" show-stops>
</el-slider>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button round @click="visiable = false">取消</el-button>
<el-button round type="primary" @click="saveInfo('form')">保存</el-button>
</span>
</el-dialog>
</template>
<script>
import { MP } from "@/utils/map";
import fetch from "@/utils/fetch.js";
import { Message } from "element-ui";
export default {
data() {
return {
visiable: false,
formData: {
supplierName: "",
supplierIntroduce: "",
supplierAddress: "",
supplierPhone: "",
supplierX: "",
supplierY: "",
},
rules: {},
m: null,
type: "",
};
},
created: function () {
this.getDepartmentTreeList();
this.handleOpen();
},
methods: {
// 初始化
init(r) {
this.visiable = !this.visiable;
if (r != null) {
// 编辑
this.formData = JSON.parse(JSON.stringify(r));
} else {
// 新增
if (JSON.stringify(this.formData) != "{}") {
this.formData = {};
this.$refs.form.resetFields();
}
}
},
handleOpen() {
var that = this;
this.$nextTick(() => {
MP("R8b2KReUQd2osuCG4ORGqftcxvLXpNlG").then(BMap => {
this.m = new BMap.Map("ccontainer");
var point = new BMap.Point(125.349631, 43.869385);
var markers = new BMap.Marker(point);
this.m.addOverlay(markers);
markers.setAnimation(BMAP_ANIMATION_BOUNCE);
this.m.centerAndZoom("长春", 10);
this.m.enableScrollWheelZoom();
this.m.addEventListener("click", function (e) {
that.m.clearOverlays();
var marker = new BMap.Marker(
new BMap.Point(e.point.lng, e.point.lat)
);
that.m.addOverlay(marker);
marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
that.formData.supplierX = e.point.lng;
that.formData.supplierY = e.point.lat;
});
});
});
},
getDepartmentTreeList() {
//获取数据
fetch
.get("/api/assetsyhsupplier")
.then(res => {
if (res.code == "1") {
Message({
message: res.msg,
type: "error",
duration: 5 * 1000
});
}
})
.catch(error => {
console.log(error);
});
},
},
};
</script>
<style scoped>
</style>