Commit 829119a5 authored by xinzhedeai's avatar xinzhedeai

企业孵化首页

parent 3f7285f6
......@@ -31,4 +31,12 @@ export function edit(data) {
})
}
export default { add, edit, del }
export function getCompanyDicts() {
return request({
url: 'api/company/dic',
method: 'get'
})
}
export default { add, edit, del, getCompanyDicts }
......@@ -45,7 +45,8 @@ export default {
display:flex;
flex-direction:column;
//padding:.925vh 0;
background-color:#00154e;
// background-color:#00154e;
background-color:#fff;
height:100%;
.common-page{margin-top:75px;}
box-sizing: border-box;
......
......@@ -53,6 +53,21 @@ export const constantRouterMap = [
}
]
},
// {
// path: "/home/enterprise",
// //component: Layout,
// component: HomeLayout,
// redirect: "noredirect",
// hidden:true,
// children: [
// {
// path: "center",
// component: resolve => require(["@/views/system/home/enterprise"], resolve),
// name: "首页-企业",
// meta: { title: "首页", affix:true }
// }
// ]
// },
{
path: "/edge/Screen",
component: (resolve) => {
......
......@@ -27,8 +27,7 @@
style="width: 320px"
size="middle"
>
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
<el-option :label="item.name" :value="item.value" v-for="item in companyLevelList" :key="item.name"></el-option>
</el-select>
</el-form-item>
<el-form-item label="联系人">
......@@ -64,7 +63,7 @@
</el-row>
<el-row>
<el-form-item label="剩余企业孵化的面积(m²)">
{{ remainingArea }}
{{ remainingArea }}
</el-form-item>
</el-row>
<el-row>
......@@ -73,7 +72,7 @@
v-model="formInline.address"
placeholder=""
size="small"
style="width: 360px;"
style="width: 360px"
disabled
></el-input>
<div
......@@ -83,7 +82,7 @@
<cu-amap ref="amap" :options="amapOptions()" />
</div>
</el-form-item>
<el-form-item style="margin-left: 80px;">
<el-form-item style="margin-left: 80px">
<el-upload
class="upload-demo"
:action="`${baseAPI}api/file/upload?modelName=incubator`"
......@@ -96,30 +95,40 @@
:on-exceed="handleExceed"
:file-list="fileList"
:show-file-list="false"
style="margin-bottom: 6px;"
style="margin-bottom: 6px"
>
<span style="margin-right: 14px">孵化器展示上传</span>
<el-button size="mini" type="default">上传图片</el-button>
</el-upload>
<div :style="'width:500px;' + 'height:300px' + ';'">
<div class="imgShowraper">
<img :src="`${baseAPI}file/${formInline.incubatorImage}`" alt="" width="500" height="300px" />
<img
:src="`${baseAPI}file/${formInline.incubatorImage}`"
alt=""
width="500"
height="300px"
/>
</div>
</div>
</el-form-item>
<el-row style=" display: flex;
justify-content: center; margin-top: 60px;"><el-button type="primary" size="small" @click="edit">保存修改信息</el-button></el-row>
<el-row
style="display: flex; justify-content: center; margin-top: 60px"
><el-button type="primary" size="small" @click="edit"
>保存修改信息</el-button
></el-row
>
</el-row>
</el-form>
</div>
</div>
</div>
</template>
<script>
var baseAPI = process.env.NODE_ENV === 'development' ? process.env.VUE_APP_LOCAL_API + '/' : (VUE_APP_API.ServiceURL || process.env.VUE_APP_LOCAL_API) + '/';
var baseAPI =
process.env.NODE_ENV === "development"
? process.env.VUE_APP_LOCAL_API + "/"
: (VUE_APP_API.ServiceURL || process.env.VUE_APP_LOCAL_API) + "/";
import crudHome from "@/api/system/home";
import IconSelect from "@/components/IconSelect";
import Treeselect from "@riophae/vue-treeselect";
......@@ -131,6 +140,9 @@ import crudOperation from "@crud/CRUD.operation";
import udOperation from "@crud/UD.operation";
import DateRangePicker from "@/components/DateRangePicker";
import dic from "@/api/system/dict";
import cuAmap from "@/components/AMap";
// crud交由presenter持有
......@@ -171,24 +183,24 @@ export default {
mixins: [presenter(), header(), form(defaultForm), crud()],
data() {
return {
baseAPI:baseAPI,
baseAPI: baseAPI,
labelPosition: "right",
fileList: [],
cmap: null,
Dict: { selectList: [] },
formInline: {
address: "",
contactPerson: "",
contactPhone: "",
id:'',
incubationArea:'',
incubatorImage:'',
incubatorLevel:'',
incubatorName:'',
latitude:'',
longitude:'',
operatingAgency:'',
totalArea:'',
id: "",
incubationArea: "",
incubatorImage: "",
incubatorLevel: "",
incubatorName: "",
latitude: "",
longitude: "",
operatingAgency: "",
totalArea: "",
},
menus: [],
......@@ -206,17 +218,21 @@ export default {
computed: {
remainingArea() {
return this.formInline.totalArea - this.formInline.incubationArea;
}
},
},
mounted(){
this.getData()
mounted() {
// this.getData();
dic.getCompanyDicts().then((res) => {
console.log(res)
this.companyLevelList = res.body.companyLevel || []
});
},
methods: {
handleSuccess(response, file) {
// 处理上传成功
console.log('Upload success:', response, file);
console.log("Upload success:", response, file);
this.formInline.incubatorImage = response.body
this.formInline.incubatorImage = response.body;
// this.fileList.push(file); // 存储已上传文件
// this.tableData.push({
// name: file.name,
......@@ -225,10 +241,10 @@ export default {
},
handleError(err, file) {
// 处理上传错误
console.error('Upload failed:', err, file);
console.error("Upload failed:", err, file);
this.tableData.push({
name: file.name,
status: '上传失败',
status: "上传失败",
});
},
handleRemove(file, fileList) {
......@@ -247,19 +263,9 @@ export default {
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}?`);
},
initMap(lng, lat){
// var opts = {
// center:[lng || 107.260044, lat || 36.737982],
// showLabel: true,
// pitch: 40,
// zoom: 4,
// mapStyle: 'amap://styles/blue',
// };
var cmap = this.$refs.amap.init(amapOptions());
},
amapOptions(cmap) {
var item = this.formInline.item,
self = this,
var VUE = this;
var self = this,
form = this.formInline;
return {
zoom: 12,
......@@ -267,29 +273,33 @@ export default {
//showLabel: true,
//pitch: 40,
onload: function (cmap) {
this.Dict.cmap = cmap;
var center = cmap.options.center;
var lng = form.longitude || center[0],
lat = form.latitude || center[1];
if (lng && lat) {
cmap.setCenter([lng, lat]);
// debugger
VUE.cmap = cmap;
var center = cmap.options.center;
var lng = form.longitude || center[0],
lat = form.latitude || center[1];
if (lng && lat) {
cmap.setCenter([lng, lat]);
// 添加标记
cmap.addMarker({
lnglat: [lng, lat],
title: "",
draggable: true,
dragend: function (e) {
var lnglat = e.lnglat;
cmap.deGeocode([lnglat.lng, lnglat.lat], function (addr) {
form.address = addr;
form.longitude = lnglat.lng;
form.latitude = lnglat.lat;
self.$forceUpdate();
});
},
});
}
// 添加标记
cmap.addMarker({
lnglat: [lng, lat],
title: "",
draggable: true,
dragend: function (e) {
var lnglat = e.lnglat;
cmap.deGeocode([lnglat.lng, lnglat.lat], function (addr) {
form.address = addr;
form.longitude = lnglat.lng;
form.latitude = lnglat.lat;
self.$forceUpdate();
});
},
});
}
VUE.getData(function () {});
},
click: function (e, cmap) {
var lnglat = e.lnglat;
......@@ -320,22 +330,34 @@ export default {
onSubmit() {
console.log("submit!");
},
edit(){
edit() {
crudHome.edit(this.formInline).then((res) => {
if(res && res.code === 200){
this.$message.warning(res.msg)
if (res && res.code === 200) {
this.$message.success('保存成功'); // res.msg
}
});
},
getData() {
crudHome.getData().then((res) => {
this.formInline = res.body
this.formInline.incubatorImage = res.body.incubatorImage
// this.$refs.amap.init(amapOptions());
const center = [this.formInline.lat, this.formInline.lng ];
this.$refs.amap.map.setCenter(center);
this.Dict.cmap.marker.setPosition(new AMap.LngLat(this.formInline.lng, this.formInline.lat));
});
getData(fn) {
crudHome.getData().then((res) => {
this.formInline = res.body;
this.formInline.incubatorImage = res.body.incubatorImage;
const lat = this.formInline.latitude
const lng = this.formInline.longitude
// this.$refs.amap.init(amapOptions());
const center = [lng, lat];
// setTimeout(() => {
// 定位中心地址
this.$refs.amap.setCenter(center);
console.log("map", this.cmap);
// 定位marker设置
this.cmap.marker.setPosition(
new AMap.LngLat(lng, lat)
);
// }, 3000);
console.log();
fn && fn()
});
},
// 选中图标
selected(name) {
......@@ -345,11 +367,14 @@ export default {
};
</script>
<style>
.app-main {
/* .app-main {
background-color: #fff !important;
}
} */
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
.app-container{
background-color: #f5f6fb;
}
.header {
background: #f5f6fb;
height: 52px;
......@@ -363,7 +388,7 @@ export default {
display: block;
background: no-repeat top left url("~@/assets/images/iconNew/icon1.png");
position: absolute;
top: 25px;
top: 32px;
left: 28px;
height: 100%;
width: 1.58rem;
......@@ -371,7 +396,7 @@ export default {
}
}
.body {
background-color: #fff;
.title {
color: #1890ff;
height: 48px;
......@@ -391,7 +416,10 @@ export default {
}
}
}
::v-deep .el-input__inner{
::v-deep .el-input {
width: 320px;
}
::v-deep .el-input__inner {
height: 38px;
}
::v-deep .el-input-number .el-input__inner {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment