调整发布地图接口流程
This commit is contained in:
parent
98ce2d5890
commit
7997ac6fe0
@ -89,14 +89,14 @@ export function putMapOffLine(mapId) {
|
||||
});
|
||||
}
|
||||
|
||||
/** 修改发布地图名称*/
|
||||
export function updatePublishMapName(data) {
|
||||
return request({
|
||||
url: `/api/map/${data.mapId}/updateName`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
// /** 修改发布地图名称*/
|
||||
// export function updatePublishMapName(data) {
|
||||
// return request({
|
||||
// url: `/api/map/${data.mapId}/updateName`,
|
||||
// method: 'put',
|
||||
// data: data
|
||||
// });
|
||||
// }
|
||||
|
||||
// 检测地图名称唯一性
|
||||
export function checkMapName(name) {
|
||||
@ -123,10 +123,19 @@ export function hasDoorStationList(mapId) {
|
||||
});
|
||||
}
|
||||
|
||||
/** 修改发布地图城市*/
|
||||
export function updatePublishMapCity(data) {
|
||||
// /** 修改发布地图城市*/
|
||||
// export function updatePublishMapCity(data) {
|
||||
// return request({
|
||||
// url: `/api/map/${data.mapId}/city`,
|
||||
// method: 'put',
|
||||
// data: data
|
||||
// });
|
||||
// }
|
||||
|
||||
// 修改地图基本信息
|
||||
export function updatePublishMapInfo(data) {
|
||||
return request({
|
||||
url: `/api/map/${data.mapId}/city`,
|
||||
url: `/api/map/${data.mapId}/info`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
|
@ -2,9 +2,9 @@ export function getBaseUrl() {
|
||||
let BASE_API;
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// BASE_API = 'https://joylink.club/jlcloud';
|
||||
BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
|
||||
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
||||
BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
|
||||
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
|
||||
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
|
||||
|
@ -6,7 +6,7 @@
|
||||
</div>
|
||||
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" style="width: 91%;margin-left:4%;margin-top:20px;" />
|
||||
<create-ibp ref="createScript" :title="'创建数据'" @reloadTable="reloadTable" />
|
||||
<create-ibp ref="modifyScript" :title="'修改数据'" @reloadTable="reloadTable" @create="handleConfirmModify" />
|
||||
<create-ibp ref="modifyScript" :title="'修改数据'" @reloadTable="reloadTable" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
|
||||
<el-dialog title="编辑地图" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
|
||||
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button>
|
||||
@ -11,82 +11,59 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import { updatePublishMapName } from '@/api/jmap/map';
|
||||
export default {
|
||||
name: 'PublishMapDraft',
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default() {
|
||||
return '';
|
||||
}
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default() {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
cityList: [],
|
||||
lineCodeList: [],
|
||||
formModel: {
|
||||
mapId: '',
|
||||
cityCode: '',
|
||||
name: ''
|
||||
name: '',
|
||||
lineCode: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
form() {
|
||||
let form = {};
|
||||
if (this.type == 'updateMapName') {
|
||||
form = {
|
||||
labelWidth: '150px',
|
||||
items: [
|
||||
{ prop: 'name', label: this.$t('publish.mapName'), type: 'text', required: true}
|
||||
]
|
||||
};
|
||||
} else {
|
||||
form = {
|
||||
labelWidth: '150px',
|
||||
items: [
|
||||
{ prop: 'cityCode', label: this.$t('publish.city'), type: 'select', required: true, options: this.cityList}
|
||||
]
|
||||
};
|
||||
}
|
||||
const form = {
|
||||
labelWidth: '150px',
|
||||
items: [
|
||||
{ prop: 'name', label: this.$t('publish.mapName'), type: 'text', required: true },
|
||||
{ prop: 'cityCode', label: this.$t('publish.city'), type: 'select', required: true, options: this.cityList },
|
||||
{ prop: 'lineCode', label: '线路类型', type: 'select', required: true, options: this.lineCodeList }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
rules() {
|
||||
let crules = {};
|
||||
if (this.type == 'updateMapName') {
|
||||
crules = {
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.pleaseInputMapName'), trigger: 'blur', max: 100 },
|
||||
{ required: true, message: this.$t('rules.pleaseInputMapName'), trigger: 'change', max: 100 }
|
||||
]
|
||||
};
|
||||
} else {
|
||||
crules = {
|
||||
id: [
|
||||
{ required: true, message: this.$t('rules.pleaseSelectCity'), trigger: 'change', max: 100 }
|
||||
]
|
||||
};
|
||||
}
|
||||
const crules = {
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.pleaseInputMapName'), trigger: 'blur', max: 100 },
|
||||
{ required: true, message: this.$t('rules.pleaseInputMapName'), trigger: 'change', max: 100 }
|
||||
],
|
||||
id: [
|
||||
{ required: true, message: this.$t('rules.pleaseSelectCity'), trigger: 'change', max: 100 }
|
||||
],
|
||||
lineCode: [
|
||||
{ required: true, message: '请选择线路类型', trigger: 'change' }
|
||||
]
|
||||
};
|
||||
return crules;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doShow({row, cityList}) {
|
||||
doShow({row, cityList, lineCodeList}) {
|
||||
this.formModel.mapId = row.id;
|
||||
if (this.type == 'updateMapName') {
|
||||
this.formModel.name = row.name;
|
||||
} else {
|
||||
this.cityList = cityList.map(elem => { return { value: elem.code, label: elem.name }; });
|
||||
this.formModel.cityCode = row.cityCode;
|
||||
}
|
||||
this.formModel.name = row.name;
|
||||
this.formModel.lineCode = row.lineCode;
|
||||
this.cityList = cityList.map(elem => { return { value: elem.code, label: elem.name }; });
|
||||
this.lineCodeList = lineCodeList.map(elem => { return { value: elem.code, label: elem.name }; });
|
||||
this.formModel.cityCode = row.cityCode;
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
doCreate() {
|
||||
@ -103,86 +80,6 @@ export default {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// export default {
|
||||
// name: 'PublishMapDraft',
|
||||
// data() {
|
||||
// return {
|
||||
// title: this.$t('publish.updateMapName'),
|
||||
// display: 1,
|
||||
// UserLoading: false,
|
||||
// formModel: {
|
||||
// mapId: '',
|
||||
// name: ''
|
||||
// }
|
||||
// };
|
||||
// },
|
||||
// computed: {
|
||||
// isEdit() {
|
||||
// return this.$route.params.mode.toUpperCase() == 'edit'.toUpperCase();
|
||||
// },
|
||||
|
||||
// form() {
|
||||
// const form = {
|
||||
// labelWidth: '140px',
|
||||
// items: [
|
||||
// { prop: 'name', label: this.$t('publish.mapName'), type: 'text', required: false }
|
||||
// ]
|
||||
// };
|
||||
// return form;
|
||||
// },
|
||||
|
||||
// rules() {
|
||||
// const baseRules = {
|
||||
// name: [
|
||||
// { required: true, message: this.$t('rules.pleaseInputMapName'), trigger: 'blur' }
|
||||
// ]
|
||||
// };
|
||||
|
||||
// // 清空表单验证提示信息
|
||||
// this.$nextTick(function () {
|
||||
// this.$refs.dataform.clearValidate();
|
||||
// });
|
||||
|
||||
// return baseRules;
|
||||
// },
|
||||
// height() {
|
||||
// return this.$store.state.app.height - 130;
|
||||
// }
|
||||
// },
|
||||
// mounted() {
|
||||
// this.initLoadPage();
|
||||
// },
|
||||
// methods: {
|
||||
// initLoadPage() {
|
||||
// // 清空表单验证提示信息
|
||||
// this.display = 1;
|
||||
// // 加载发布课程列表
|
||||
// if (this.isEdit) {
|
||||
// this.formModel.mapId = this.$route.params.mapId;
|
||||
// this.formModel.name = this.$route.query.name;
|
||||
// } else {
|
||||
// this.$nextTick(function () {
|
||||
// this.$refs.dataform.resetForm();
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// update() {
|
||||
// this.$refs.dataform.validateForm(() => {
|
||||
// updatePublishMapName(this.formModel).then(response => {
|
||||
// this.display = 2;
|
||||
// this.turnback();
|
||||
// this.$message.success(this.$t('publish.updateSuccess'));
|
||||
// }).catch(() => {
|
||||
// this.$messageBox(this.$t('error.updateFailed'));
|
||||
// });
|
||||
// });
|
||||
// },
|
||||
// turnback() {
|
||||
// this.$router.go(-1);
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
/deep/ .el-dialog--center .el-dialog__body{
|
||||
|
@ -1,8 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||
<update-operate ref="updateMapName" :title="$t('publish.updateMapName')" type="updateMapName" @create="handleUpdateMap" />
|
||||
<update-operate ref="updateCityName" :title="$t('publish.updateCityName')" type="updateCityName" @create="handleCityUpdate" />
|
||||
<update-operate ref="updateMapInfo" @create="handleUpdate" />
|
||||
<set-project ref="setProject" @refresh="reloadTable" />
|
||||
<copy-map ref="copyMap" @refresh="reloadTable" />
|
||||
<local-map ref="localMap" />
|
||||
@ -11,7 +10,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getPublishMapList, delPublishMap, getPublishMapExport, putMapOnLine, putMapOffLine, updatePublishMapName, updatePublishMapCity, simulationCheck, localImportMap } from '@/api/jmap/map';
|
||||
import { getPublishMapList, delPublishMap, getPublishMapExport, putMapOnLine, putMapOffLine, simulationCheck, localImportMap, updatePublishMapInfo } from '@/api/jmap/map';
|
||||
import { getLineCodeList } from '@/api/management/mapline';
|
||||
import localStore from 'storejs';
|
||||
import UpdateOperate from './draft.vue';
|
||||
@ -82,6 +81,10 @@ export default {
|
||||
title: this.$t('global.operate'),
|
||||
width: this.$i18n.locale == 'en' ? '650' : '650',
|
||||
buttons: [
|
||||
{
|
||||
name: '编辑信息',
|
||||
handleClick: this.editMap
|
||||
},
|
||||
{
|
||||
name: this.$t('publish.publishHistory'),
|
||||
handleClick: this.publicList,
|
||||
@ -105,17 +108,10 @@ export default {
|
||||
type: 'danger',
|
||||
showControl: () => { return this.isShow != -1; }
|
||||
},
|
||||
{
|
||||
name: this.$t('publish.updateMapName'),
|
||||
handleClick: this.handleUpdate
|
||||
},
|
||||
{
|
||||
name: this.$t('publish.updateCityName'),
|
||||
handleClick: this.handleUpdateCity
|
||||
},
|
||||
{
|
||||
name: this.$t('global.exportMap'),
|
||||
handleClick: this.handleExportMap
|
||||
handleClick: this.handleExportMap,
|
||||
type: 'default'
|
||||
},
|
||||
// {
|
||||
// name: this.$t('global.export'),
|
||||
@ -173,19 +169,25 @@ export default {
|
||||
this.lineCodeList = response.data;
|
||||
});
|
||||
},
|
||||
// 编辑名称
|
||||
handleUpdate(index, row) {
|
||||
this.$refs.updateMapName.doShow({row:row});
|
||||
},
|
||||
handleSetProject(index, row) {
|
||||
this.$refs.setProject.doShow(row);
|
||||
},
|
||||
handleCopy(index, row) {
|
||||
this.$refs.copyMap.doShow(row);
|
||||
},
|
||||
// 编辑城市
|
||||
handleUpdateCity(index, row) {
|
||||
this.$refs.updateCityName.doShow({row:row, cityList:this.cityList});
|
||||
// 编辑地图信息
|
||||
editMap(index, row) {
|
||||
this.$refs.updateMapInfo.doShow({row:row, cityList:this.cityList, lineCodeList: this.lineCodeList});
|
||||
},
|
||||
handleUpdate(data) {
|
||||
updatePublishMapInfo(data).then(response => {
|
||||
this.reloadTable();
|
||||
this.$message.success(this.$t('publish.updateSuccess'));
|
||||
}).catch((error) => {
|
||||
if (error.code != 500) {
|
||||
this.$message.error(`更新失败:${error.message}`);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 删除
|
||||
handleDelete(index, row) {
|
||||
@ -204,24 +206,6 @@ export default {
|
||||
});
|
||||
}).catch(() => { });
|
||||
},
|
||||
handleUpdateMap(data) {
|
||||
delete data.cityCode;
|
||||
updatePublishMapName(data).then(response => {
|
||||
this.reloadTable();
|
||||
this.$message.success(this.$t('publish.updateSuccess'));
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('error.updateFailed'));
|
||||
});
|
||||
},
|
||||
handleCityUpdate(data) {
|
||||
delete data.name;
|
||||
updatePublishMapCity(data).then(response => {
|
||||
this.reloadTable();
|
||||
this.$message.success(this.$t('publish.updateSuccess'));
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('error.updateFailed'));
|
||||
});
|
||||
},
|
||||
reloadTable() {
|
||||
this.queryList.reload();
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user