调整高级数据生成code规范

This commit is contained in:
zyy 2019-12-20 13:48:37 +08:00
parent 4f5fe2c9bb
commit 6a82d745d9
9 changed files with 30 additions and 18 deletions

View File

@ -45,3 +45,15 @@ export function getUID(type, list) {
// use Math.random to make id as unique as possible.
}
var base = 0;
/**
* @public
* @param {string} type
* @return {string}
*/
export function setUID(type) {
// use Math.random to make id as unique as possible.
return [(type || ''), base++, Math.random().toFixed(5)].join('_');
}

View File

@ -3,11 +3,11 @@ 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.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
BASE_API = 'http://192.168.3.82:9000'; // 杜康
} else {
BASE_API = process.env.VUE_APP_BASE_API;
}

View File

@ -64,7 +64,7 @@
</template>
<script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid';
import { setUID } from '@/jmapNew/utils/Uid';
import { postAutoSignalNew, putAutoSignalNew } from '@/api/jmap/mapdraft';
import { ViewMode } from '@/scripts/ConstDic';
import { formatName } from '@/utils/runPlan';
@ -174,7 +174,7 @@ export default {
this.$refs.form.validate((valid) => {
if (valid) {
this.loading = true;
postAutoSignalNew(this.buildModel(getUID('autoSingle'))).then(resp => {
postAutoSignalNew(this.buildModel(setUID('autoSingle'))).then(resp => {
this.$message.success(this.$t('map.automaticSignalSuccessful'));
this.loading = false;
this.clear();

View File

@ -83,7 +83,7 @@
</template>
<script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid';
import { setUID } from '@/jmapNew/utils/Uid';
import { addRouteUnit, setRouteUnit } from '@/api/jmap/pathunit';
import PathRoute from './pathRoute';
import { ViewMode } from '@/scripts/ConstDic';
@ -123,7 +123,7 @@ export default {
loading: false,
addModel: {
mapId: '',
code: getUID('RouteUnit'),
code: setUID('RouteUnit'),
startSectionCode: '',
endSectionCode: '',
mapRouteUnitRelList: []
@ -262,7 +262,7 @@ export default {
this.editShow = false;
this.addModel = {
mapId: this.mapInfo.id,
code: getUID('RouteUnit'),
code: setUID('RouteUnit'),
startSectionCode: '',
endSectionCode: '',
mapRouteUnitRelList: []

View File

@ -122,7 +122,7 @@
</template>
<script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid';
import { setUID } from '@/jmapNew/utils/Uid';
import { postContinueProtect, putContinueProtect, delContinueProtect } from '@/api/jmap/mapdraft';
import { ViewMode } from '@/scripts/ConstDic';
import { deepAssign } from '@/utils/index';
@ -289,7 +289,7 @@ export default {
},
createProtect(parentFunction) {
if (this.addModel.unlockSectionCode && this.addModel.relSectionSwitchList.length) {
const model = this.buildModel(getUID('Protect'));
const model = this.buildModel(setUID('Protect'));
postContinueProtect(model).then(resp => {
this.$emit(parentFunction, model.code);
}).catch(() => {

View File

@ -207,7 +207,7 @@
</template>
<script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid';
import { setUID } from '@/jmapNew/utils/Uid';
import { postRouteNew, putRouteNew, getRouteNewList, getContinueProtectList } from '@/api/jmap/mapdraft';
import RouteDetail from './detail';
import ProtectOperate from './protect';
@ -426,10 +426,10 @@ export default {
this.$refs.form.validate((valid) => {
if (valid) {
this.loading = true;
postRouteNew(this.buildModel(overlapCode, getUID('Route'))).then(response => {
postRouteNew(this.buildModel(overlapCode, setUID('Route'))).then(response => {
this.$message.success('创建成功');
this.loading = false;
this.routeList.push(this.buildModel(getUID('Route')));
this.routeList.push(this.buildModel(setUID('Route')));
this.clear();
}).catch(() => {
this.$messageBox(this.$t('tip.operationAbnormal'));

View File

@ -152,7 +152,7 @@
</template>
<script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid';
import { setUID } from '@/jmapNew/utils/Uid';
import { addRouting, updateRouting } from '@/api/jmap/mapdraft';
import { ViewMode } from '@/scripts/ConstDic';
import { formatName } from '@/utils/runPlan';
@ -327,7 +327,7 @@ export default {
this.$refs.form.validate((valid) => {
if (valid) {
this.loading = true;
addRouting(this.buildModel(getUID('Routing'))).then(resp => {
addRouting(this.buildModel(setUID('Routing'))).then(resp => {
this.$message.success(this.$t('tip.pathCreationSuccessful'));
this.loading = false;
this.clear();

View File

@ -44,7 +44,7 @@
</template>
<script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid';
import { setUID } from '@/jmapNew/utils/Uid';
import { postApproachSection, putApproachSection } from '@/api/jmap/mapdraft';
import { ViewMode } from '@/scripts/ConstDic';
import { formatName } from '@/utils/runPlan';
@ -146,7 +146,7 @@ export default {
this.$refs.form.validate((valid) => {
if (valid) {
this.loading = true;
postApproachSection(this.buildModel(getUID('signalSection'))).then(resp => {
postApproachSection(this.buildModel(setUID('signalSection'))).then(resp => {
this.$message.success(this.$t('map.signalSectionSuccessful'));
this.loading = false;
this.clear();

View File

@ -44,7 +44,7 @@
</template>
<script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid';
import { setUID } from '@/jmapNew/utils/Uid';
import { postAutoReentry, putAutoReentry, getRouteNewList } from '@/api/jmap/mapdraft';
import { ViewMode } from '@/scripts/ConstDic';
import { formatName } from '@/utils/runPlan';
@ -159,7 +159,7 @@ export default {
this.$refs.form.validate((valid) => {
if (valid) {
this.loading = true;
postAutoReentry(this.buildModel(getUID('TurnedAround'))).then(resp => {
postAutoReentry(this.buildModel(setUID('TurnedAround'))).then(resp => {
this.$message.success('创建折返成功!');
this.loading = false;
this.clear();