diff --git a/.env.one b/.env.one new file mode 100644 index 0000000..942917e --- /dev/null +++ b/.env.one @@ -0,0 +1,5 @@ +NODE_ENV=one +VUE_APP_PREVIEW=true +VUE_APP_API_BASE_URL=/api +VUE_APP_API_URL=http://192.168.0.225:8099 +VUE_APP_PORT=8001 diff --git a/package.json b/package.json index bef7909..f6f956c 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "private": true, "scripts": { "serve": "vue-cli-service serve", + "serve:8001": "vue-cli-service serve --mode=one", "build": "vue-cli-service build", "test:unit": "vue-cli-service test:unit", "lint": "vue-cli-service lint", diff --git a/public/config.one.js b/public/config.one.js new file mode 100644 index 0000000..eab5067 --- /dev/null +++ b/public/config.one.js @@ -0,0 +1,11 @@ +// @ts-ignore +window._CONFIG = { + ImageryProviderUrl: '/map/mapWX/{z}/{x}/{y}.jpg', + RoadProviderUrl: '', + TerrainProviderUrl: '/map/mapTerrain/', + thirdLoginUrl: 'http://127.0.0.1:8080/thirdLogin', + clientId: '0123456789', + evaluationSrc: 'http://192.168.0.225:8088/thirdLogin/thirdLoginPage?username=admin', + VUE_APP_API_URL: 'http://192.168.0.225:8099', + VUE_APP_WEBSOCKET_URL: 'ws://192.168.0.225:8099', +} diff --git a/public/index.html b/public/index.html index c4fb356..4bdc69a 100644 --- a/public/index.html +++ b/public/index.html @@ -19,6 +19,9 @@ + <% if (process.env.NODE_ENV === 'one') { %> + + <% } %> <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %> <% } %> diff --git a/src/views/simulationScene/database/bzllsjk.vue b/src/views/simulationScene/database/bzllsjk.vue index ddbed3f..200a401 100644 --- a/src/views/simulationScene/database/bzllsjk.vue +++ b/src/views/simulationScene/database/bzllsjk.vue @@ -170,10 +170,11 @@ export default { tableConfig: { table: {}, immediate: false, - query: () => + query: (params) => this.$http({ url: `/baseData/fightPowerHierarchy/staff/${this.zzjg.selectedKeys[0]}`, method: 'get', + params, }), columns: [ { dataIndex: 'serial' }, @@ -218,10 +219,11 @@ export default { tableConfig: { table: {}, immediate: false, - query: () => + query: (params) => this.$http({ url: `/baseData/fightPowerHierarchy/weapon/${this.zzjg.selectedKeys[0]}`, method: 'get', + params, }), columns: [ { dataIndex: 'serial' }, diff --git a/src/views/simulationScene/database/fdsjk.vue b/src/views/simulationScene/database/fdsjk.vue index 516c35f..d02716d 100644 --- a/src/views/simulationScene/database/fdsjk.vue +++ b/src/views/simulationScene/database/fdsjk.vue @@ -43,7 +43,7 @@ export default { fdTable: { queryConfig: false, tableConfig: { - query: () => getAction('/team/list'), + query: (params) => getAction('/team/list', params), columns: [ { dataIndex: 'serial' }, { dataIndex: 'name', title: '分队名称', width: 'auto', minWidth: 160 }, diff --git a/src/views/simulationScene/database/jcsjk.vue b/src/views/simulationScene/database/jcsjk.vue index f2ec52d..281c022 100644 --- a/src/views/simulationScene/database/jcsjk.vue +++ b/src/views/simulationScene/database/jcsjk.vue @@ -46,11 +46,11 @@ export default { tableConfig: { table: {}, immediate: false, - query: () => + query: (params) => this.$http({ url: '/baseData/scenario/taskList', method: 'get', - params: { id: this.xd.selectedKeys[0] }, + params: { id: this.xd.selectedKeys[0], ...params }, }).then((res) => ({ data: res.data.map(([a, b, c], index) => ({ id: index, 0: a, 1: b, 2: c })), })), diff --git a/src/views/simulationScene/database/txsjk.vue b/src/views/simulationScene/database/txsjk.vue index 270c374..f712859 100644 --- a/src/views/simulationScene/database/txsjk.vue +++ b/src/views/simulationScene/database/txsjk.vue @@ -46,7 +46,7 @@ export default { txTable: { queryConfig: false, tableConfig: { - query: () => getAction('/icon/list'), + query: (params) => getAction('/icon/list', params), columns: [ { dataIndex: 'serial' }, { dataIndex: 'iconName', title: '军标名称', width: 'auto', align: 'center' }, diff --git a/src/views/simulationScene/database/zbsjk.vue b/src/views/simulationScene/database/zbsjk.vue index 359cc4f..ccdcdc5 100644 --- a/src/views/simulationScene/database/zbsjk.vue +++ b/src/views/simulationScene/database/zbsjk.vue @@ -519,7 +519,12 @@ export default { handleOpenEditZbflModal(data) { this.zbflModal.title = '编辑装备分类' this.zbflModal.mode = 'edit' - this.zbflModal.formData = { id: data.id, parentId: data.parentId, entityName: data.entityName,entityType: data.entityType } + this.zbflModal.formData = { + id: data.id, + parentId: data.parentId, + entityName: data.entityName, + entityType: data.entityType, + } this.zbflModal.visible = true }, handleSubmitZbfl(formData) { @@ -599,7 +604,7 @@ export default { handleOpenEditZbModal(record) { this.AECModal.opType = 3 this.AECModal.parentTableRowId = record.id - console.log('======'+record.id) + console.log('======' + record.id) this.AECModal.title = '编辑 ' + record.name + ' 实体' this.AECModal.visible = true }, diff --git a/src/views/simulationScene/database/zzllsjk.vue b/src/views/simulationScene/database/zzllsjk.vue index a8d7d86..b8b515f 100644 --- a/src/views/simulationScene/database/zzllsjk.vue +++ b/src/views/simulationScene/database/zzllsjk.vue @@ -5,19 +5,35 @@ - + @select="handleChangeZzjgSelected" + > @@ -167,10 +205,11 @@ export default { tableConfig: { table: {}, immediate: false, - query: () => + query: (params) => this.$http({ url: `/baseData/fightPowerHierarchy/staff/${this.zzjg.selectedKeys[0]}`, method: 'get', + params, }), columns: [ { dataIndex: 'serial' }, @@ -215,10 +254,11 @@ export default { tableConfig: { table: {}, immediate: false, - query: () => + query: (params) => this.$http({ url: `/baseData/fightPowerHierarchy/weapon/${this.zzjg.selectedKeys[0]}`, method: 'get', + params, }), columns: [ { dataIndex: 'serial' }, @@ -262,10 +302,11 @@ export default { tableConfig: { table: {}, immediate: false, - query: () => + query: (params) => this.$http({ url: `baseData/fightPowerHierarchy/supplier/getByOrgId?id=${this.zzjg.selectedKeys[0]}`, // 修改为material method: 'get', + params, }), columns: [ { dataIndex: 'serial' }, @@ -318,18 +359,18 @@ export default { return [ this.zzzbModal.mode === 'add' ? { - label: '装备名称', - prop: 'weaponId', - component: 'AntOriginTreeSelect', - options: { - dataSource: () => - this.$http({ - url: '/tree/armament', - method: 'get', - }), - readonly: false, - }, - } + label: '装备名称', + prop: 'weaponId', + component: 'AntOriginTreeSelect', + options: { + dataSource: () => + this.$http({ + url: '/tree/armament', + method: 'get', + }), + readonly: false, + }, + } : { label: '装备名称', prop: 'name', customRender: (v) => v }, { label: '装备数量', prop: 'number' }, ] @@ -338,19 +379,19 @@ export default { return [ this.zzwzModal.mode === 'add' ? { - label: '物资名称', - prop: 'supplierId', - component: 'AntOriginTreeSelect', - options: { - dataSource: () => - this.$http({ - url: '/suppliesDict/tree', - method: 'get', - }), - valueKey: 'key', - readonly: false, - }, - } + label: '物资名称', + prop: 'supplierId', + component: 'AntOriginTreeSelect', + options: { + dataSource: () => + this.$http({ + url: '/suppliesDict/tree', + method: 'get', + }), + valueKey: 'key', + readonly: false, + }, + } : { label: '物资名称', prop: 'name', customRender: (v) => v }, { label: '物资数量', prop: 'account' }, ] @@ -419,7 +460,7 @@ export default { }) this.$message.success('删除成功') this.getZzTree() - } catch (error) { } + } catch (error) {} }, handleOpenAddZzryModal() { @@ -470,7 +511,6 @@ export default { this.$refs['zzzb-table'].commitAction('query') }, - handleOpenAddZzwzModal() { this.zzwzModal.title = '新建组织物资' // 修改标题 this.zzwzModal.mode = 'add' diff --git a/src/views/subsystem/control/index.vue b/src/views/subsystem/control/index.vue index 32c23af..5c7c353 100644 --- a/src/views/subsystem/control/index.vue +++ b/src/views/subsystem/control/index.vue @@ -217,6 +217,11 @@ export default { }, created() { this.getRoomList() + + window.addEventListener('beforeunload', (e) => { + this.closeWebsocket() + return true + }) }, beforeDestroy() { this.closeWebsocket() @@ -252,6 +257,7 @@ export default { }, closeWebsocket() { this.ws && this.ws.close() + this.ws = null }, async getRoomDetail() { try { diff --git a/src/views/subsystem/display/index.vue b/src/views/subsystem/display/index.vue index 6b14e12..af9a810 100644 --- a/src/views/subsystem/display/index.vue +++ b/src/views/subsystem/display/index.vue @@ -42,6 +42,11 @@ export default { this.scenarioId = this.$route.params.scenarioId this.scenarioName = this.$route.params.scenarioName this.initWebsocket() + + window.addEventListener('beforeunload', (e) => { + this.closeWebsocket() + return true + }) }, mounted() { this.cesium = new window.MyCesium('display-cesium-container') @@ -67,6 +72,7 @@ export default { }, closeWebsocket() { this.ws && this.ws.close() + this.ws = null }, async getZzbzllTreeData(initPlot = false) { try { diff --git a/src/views/subsystem/model/index.vue b/src/views/subsystem/model/index.vue index 79f29c5..6de93d2 100644 --- a/src/views/subsystem/model/index.vue +++ b/src/views/subsystem/model/index.vue @@ -305,6 +305,11 @@ export default { this.scenarioId = this.$route.params.scenarioId this.scenarioName = this.$route.params.scenarioName this.initWebsocket() + + window.addEventListener('beforeunload', (e) => { + this.closeWebsocket() + return true + }) }, mounted() { this.cesium = new window.MyCesium('model-cesium-container') @@ -330,6 +335,7 @@ export default { }, closeWebsocket() { this.ws && this.ws.close() + this.ws = null }, getTree(target, treeData, checkedKeys) { treeData.forEach((item) => { @@ -484,6 +490,9 @@ export default { overflow: hidden; } ::v-deep { + .distance-legend { + left: 320px; + } .compass { right: 320px; } diff --git a/src/views/subsystem/scene/index.vue b/src/views/subsystem/scene/index.vue index 6b47f20..a83953c 100644 --- a/src/views/subsystem/scene/index.vue +++ b/src/views/subsystem/scene/index.vue @@ -286,6 +286,11 @@ export default { this.scenarioId = this.$route.params.scenarioId this.scenarioName = this.$route.params.scenarioName this.initWebsocket() + + window.addEventListener('beforeunload', (e) => { + this.closeWebsocket() + return true + }) }, mounted() { this.cesium = new window.MyCesium('scene-cesium-container') @@ -312,6 +317,7 @@ export default { }, closeWebsocket() { this.ws && this.ws.close() + this.ws = null }, getTree(target, treeData, checkedKeys) { treeData.forEach((item) => { @@ -387,6 +393,34 @@ export default { console.log(error) } }, + dragend(item, e) { + const minX = this.$refs['scene-cesium-container'].offsetLeft + const maxX = this.$refs['scene-cesium-container'].offsetLeft + this.$refs['scene-cesium-container'].offsetWidth + const minY = this.$refs['scene-cesium-container'].offsetTop + const maxY = this.$refs['scene-cesium-container'].offsetTop + this.$refs['scene-cesium-container'].offsetHeight + if (e.x < minX || e.x > maxX || e.Y < minY || e.Y > maxY) return + + const x = e.x - this.$refs['scene-cesium-container'].offsetLeft + const y = e.y - this.$refs['scene-cesium-container'].offsetTop + const { plotId, longitude, latitude } = this.cesium.addPlotByOffset(item.imgBase64, { x, y }) + this.savePlot(this.model.queryParams.force, item, { plotId, longitude, latitude }) + }, + async savePlot(force, item, { plotId, longitude, latitude }) { + try { + await postAction('/scenario/resource/save', { + id: plotId, + scenarioId: this.scenarioId, + type: force, + resourceType: item.type, + resourceId: item.id, + lng: longitude, + lat: latitude, + }) + this.getZzbzllTreeData() + } catch (error) { + console.log(error) + } + }, handleSelectZzbzll(selectedKeys, { node }) { this.cesium.setClientByCenter({ longitude: +node.dataRef.lng, latitude: +node.dataRef.lat }) this.blbz.modelData = node.dataRef @@ -473,6 +507,9 @@ export default { overflow: hidden; } ::v-deep { + .distance-legend { + left: 320px; + } .compass { right: 320px; } diff --git a/src/views/subsystem/scene/presetting.vue b/src/views/subsystem/scene/presetting.vue index 2a38806..094ba14 100644 --- a/src/views/subsystem/scene/presetting.vue +++ b/src/views/subsystem/scene/presetting.vue @@ -356,6 +356,34 @@ export default { console.log(error) } }, + dragend(item, e) { + const minX = this.$refs['scene-presetting-cesium-container'].offsetLeft + const maxX = this.$refs['scene-presetting-cesium-container'].offsetLeft + this.$refs['scene-presetting-cesium-container'].offsetWidth + const minY = this.$refs['scene-presetting-cesium-container'].offsetTop + const maxY = this.$refs['scene-presetting-cesium-container'].offsetTop + this.$refs['scene-presetting-cesium-container'].offsetHeight + if (e.x < minX || e.x > maxX || e.Y < minY || e.Y > maxY) return + + const x = e.x - this.$refs['scene-presetting-cesium-container'].offsetLeft + const y = e.y - this.$refs['scene-presetting-cesium-container'].offsetTop + const { plotId, longitude, latitude } = this.cesium.addPlotByOffset(item.imgBase64, { x, y }) + this.savePlot(this.model.queryParams.force, item, { plotId, longitude, latitude }) + }, + async savePlot(force, item, { plotId, longitude, latitude }) { + try { + await postAction('/scenario/resource/save', { + id: plotId, + scenarioId: this.scenarioId, + type: force, + resourceType: item.type, + resourceId: item.id, + lng: longitude, + lat: latitude, + }) + this.getZzbzllTreeData() + } catch (error) { + console.log(error) + } + }, handleSelectZzbzll(selectedKeys, { node }) { this.cesium.setClientByCenter({ longitude: +node.dataRef.lng, latitude: +node.dataRef.lat }) this.blbz.modelData = node.dataRef @@ -442,6 +470,9 @@ export default { overflow: hidden; } ::v-deep { + .distance-legend { + left: 320px; + } .compass { right: 320px; } diff --git a/vue.config.js b/vue.config.js index 5f8bfac..1a67f95 100644 --- a/vue.config.js +++ b/vue.config.js @@ -5,6 +5,7 @@ const GitRevisionPlugin = require('git-revision-webpack-plugin') const GitRevision = new GitRevisionPlugin() const buildDate = JSON.stringify(new Date().toLocaleString()) const createThemeColorReplacerPlugin = require('./config/plugin.config') +const port = process.env.VUE_APP_PORT || 8000 function resolve(dir) { return path.join(__dirname, dir) @@ -108,8 +109,8 @@ const vueConfig = { devServer: { // development server port 8000 - port: 8000, - public: os.networkInterfaces().以太网?.slice(-1)[0].address + ':8000', + port, + public: os.networkInterfaces().以太网?.slice(-1)[0].address + ':' + port, // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11 proxy: { '/api': { @@ -134,7 +135,6 @@ const vueConfig = { // disable source map in production productionSourceMap: false, - lintOnSave: undefined, // babel-loader no-ignore node_modules/* transpileDependencies: ['@cesium/widgets', '@cesium/engine'], }