diff --git a/hg-monitor-web-base/pom.xml b/hg-monitor-web-base/pom.xml index 8a99d5a..621d94a 100644 --- a/hg-monitor-web-base/pom.xml +++ b/hg-monitor-web-base/pom.xml @@ -29,6 +29,14 @@ </dependencies> <build> + <resources> + <resource> + <directory>src/main/resources</directory> + <includes> + <include>**/**</include> + </includes> + </resource> + </resources> <plugins> <plugin> <groupId>org.springframework.boot</groupId> diff --git a/hg-monitor-web-new/pom.xml b/hg-monitor-web-new/pom.xml index c35866d..fa6f8e3 100644 --- a/hg-monitor-web-new/pom.xml +++ b/hg-monitor-web-new/pom.xml @@ -25,6 +25,14 @@ <build> <finalName>zjweb</finalName> + <resources> + <resource> + <directory>src/main/resources</directory> + <includes> + <include>**/**</include> + </includes> + </resource> + </resources> <plugins> <plugin> <groupId>org.springframework.boot</groupId> diff --git a/hg-monitor-web-new/src/main/resources/application.yml b/hg-monitor-web-new/src/main/resources/application.yml index 62e2625..6f225b9 100644 --- a/hg-monitor-web-new/src/main/resources/application.yml +++ b/hg-monitor-web-new/src/main/resources/application.yml @@ -12,7 +12,7 @@ server: key-store-password: Hg0801.. key-password: Hg0801.. url: - gateway: http://127.0.0.1:8080 + gateway: http://192.168.0.41:8080 inspection_web: http://127.0.0.1:8082 assetsweb: http://127.0.0.1:8082 mxgraph_editor: http://127.0.0.1:8085 diff --git a/hg-monitor-web-new/src/main/resources/static/vue3/src/router/index.js b/hg-monitor-web-new/src/main/resources/static/vue3/src/router/index.js index be6615f..c7d0909 100644 --- a/hg-monitor-web-new/src/main/resources/static/vue3/src/router/index.js +++ b/hg-monitor-web-new/src/main/resources/static/vue3/src/router/index.js @@ -32,6 +32,11 @@ const routes = [{ path: '/res/list', name: 'resList', component: () => myImport('views/res/list/index') + }, + { + path: '/zj/dp', + name: 'resList', + component: () => myImport('views/dp/index') } ]; diff --git a/hg-monitor-web-tj/pom.xml b/hg-monitor-web-tj/pom.xml index ede2706..567ffd0 100644 --- a/hg-monitor-web-tj/pom.xml +++ b/hg-monitor-web-tj/pom.xml @@ -25,6 +25,14 @@ <build> <finalName>tjweb</finalName> + <resources> + <resource> + <directory>src/main/resources</directory> + <includes> + <include>**/**</include> + </includes> + </resource> + </resources> <plugins> <plugin> <groupId>org.springframework.boot</groupId> diff --git a/hg-monitor-web-zj/pom.xml b/hg-monitor-web-zj/pom.xml new file mode 100644 index 0000000..ee67ef0 --- /dev/null +++ b/hg-monitor-web-zj/pom.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.honggroup</groupId> + <artifactId>hg-monitor-web</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <groupId>com.honggroup</groupId> + <artifactId>hg-monitor-web-zj</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>hg-monitor-web-zj</name> + <description>浙江个性化版本</description> + <properties> + <java.version>1.8</java.version> + </properties> + <dependencies> + <dependency> + <groupId>com.honggroup</groupId> + <artifactId>hg-monitor-web-new</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + </dependencies> + + <build> + <finalName>zjweb</finalName> + <resources> + <resource> + <directory>src/main/resources</directory> + <includes> + <include>**/**</include> + </includes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + +</project> diff --git a/hg-monitor-web-zj/src/main/resources/application.yml b/hg-monitor-web-zj/src/main/resources/application.yml new file mode 100644 index 0000000..6f225b9 --- /dev/null +++ b/hg-monitor-web-zj/src/main/resources/application.yml @@ -0,0 +1,33 @@ + +spring: + application: + name: zjweb +server: + port: 8088 + ssl: + enabled: false + key-alias: tomcat_https + key-store: classpath:keystore/tomcat_https.keystore + key-store-type: JKS + key-store-password: Hg0801.. + key-password: Hg0801.. +url: + gateway: http://192.168.0.41:8080 + inspection_web: http://127.0.0.1:8082 + assetsweb: http://127.0.0.1:8082 + mxgraph_editor: http://127.0.0.1:8085 + tingyun: http://127.0.0.1:8088 + bigScreen: http://127.0.0.1:8081 + #流程系统路径,当ssl.enabled=true时,http要改为https,并修改流程nginx的conf文件 + workflow: http://192.168.0.248:8002 + # 积木报表工具 + jimuReport: http://192.168.0.41:8085 +config: + layer: + load: + icon: hg + audio: + mp3: 14039 + tingyun: + api_key: aZipZbC18BhpG5GrjtiFAtThL1I0OUfn + secret_key: nbxay44wx8c3x4n5wcxe63mp87a72xed diff --git a/hg-monitor-web-zj/src/main/resources/static/src/views/dp/home.html b/hg-monitor-web-zj/src/main/resources/static/src/views/dp/home.html new file mode 100644 index 0000000..eeb76bd --- /dev/null +++ b/hg-monitor-web-zj/src/main/resources/static/src/views/dp/home.html @@ -0,0 +1,2 @@ +<title>浙江大屏</title> +<iframe src="/vue3/index.html#/zj/dp" class="layadmin-iframe"/> diff --git a/hg-monitor-web-zj/src/main/resources/static/vue3/src/views/dp/index.html b/hg-monitor-web-zj/src/main/resources/static/vue3/src/views/dp/index.html new file mode 100644 index 0000000..609d373 --- /dev/null +++ b/hg-monitor-web-zj/src/main/resources/static/vue3/src/views/dp/index.html @@ -0,0 +1,130 @@ +<div class="assets-configmanager"> + <el-form :inline="true" :model="formInline" class="demo-form-inline" style="text-align: left;padding-left: 6px;"> + <el-form-item label="" > + <el-input :disabled="initFlag" placeholder="输入关键字" v-model="pageInfo.keyWords" prefix-icon="el-icon-search"> + </el-input> + </el-form-item> + <el-form-item label="" :disabled="initFlga"> + <res-type-tree multiple clearable collapseTags @callback="getResType" /> + </el-form-item> + + <el-form-item label=""> + <machine-room @callback="getMachineRoom"></machine-room> + </el-form-item> + + <el-form-item> + <el-button :disabled="initFlag" type="primary" @click="onBtnSearch()">查询</el-button> + </el-form-item> + </el-form> + <!-- <div style="text-align: right" v-if="loadHead"> + <el-popover placement="bottom" trigger="click"> + <template #reference> + <el-button icon="el-icon-set-up" plain hairline size="small"></el-button> + </template> + <div slot="content" style="width: 100px;"> + <div style="display: flex;flex-direction: column"> + {{checkList}} + <el-checkbox-group v-model="checkList"> + <el-checkbox :label="item.propName" borderv-for="item in columns" + style="margin: 3px;width: 100px;"></el-checkbox> + </el-checkbox-group> + </div> + </div> + </el-popover> + </div> --> + <el-table :max-height="height" v-loading="loading" :data="tableList" border style="width: 100%;" header-row-class-name="tbl-header-class" + :empty-text="emptyText" :stripe="true"> + <el-table-column fixed type="index" v-if="columns.length > 0" :index="(index) => {return index + 1}" label="序号" width="60" align="center"> </el-table-column> + <el-table-column v-for="item in columns" :prop="item.propKey" :label="item.propName" + :width="widths[item.propKey] ? widths[item.propKey] : '120'"> + <template #default="scope" v-if="item.propKey =='resName'"> + <el-link type="primary" @click="openDetailPage(scope.row)">{{scope.row.resName}}</el-link> + </template> + </el-table-column> + </el-table> + <div style="text-align: center"> + <el-pagination @size-change="handleSizeChange" + @prev-click="prePage" + @next-click="nextPage" + @current-change="handleCurrentChange" + :current-page="pageInfo.page" :page-sizes="[50,100, 150, 200]" :page-size="pageInfo.limit" + layout="total, sizes, prev, pager, next, jumper" :total="pageInfo.total" /> + </div> + + + <el-dialog top="2vh" :title="row.title" v-model="centerDialogVisible" custom-class="config-dialog" width="80%" destroy-on-close> + <el-tabs v-model="activeName" @tab-click="handleClick"> + <el-tab-pane label="基本信息" name="jbxx"> + <div class="config-tools"> + <el-button-group> + <el-button size="mini" icon="el-icon-edit-outline" @click="editConfig('jbxx')"></el-button> + <el-button size="mini" v-if="edits['jbxx'] && edits['jbxx'] === true" icon="el-icon-check" @click="saveConfig('jbxx')"></el-button> + <el-button size="mini" v-if="edits['jbxx'] && edits['jbxx'] === true" icon="el-icon-close" @click="cancelConfig('jbxx')"></el-button> + </el-button-group> + </div> + + <div class="config-view"> + <div style="display: flex;flex-direction: row;width: 100%;"> + <div class="config-header-title">属性</div> + <div class="config-header-content">内容</div> + <div class="config-header-title">属性</div> + <div class="config-header-content">内容</div> + </div> + <div v-if="row.detail.jbxx != undefined" v-for="(item,index) in row.detail.jbxx" + style="display: flex;flex-direction: row;width: 50%;"> + <div class="config-content-title"> + {{item.propName}} + <i v-if="editKey[item.propKey] && editKey[item.propKey].edit === true" class="el-icon-edit" style="color: #409eff;" /> + </div> + <div class="config-content-content"> + <property-edit :detail="item" @callback="callback" + :operates="edits['jbxx']"></property-edit> + </div> + </div> + </div> + </el-tab-pane> + <el-tab-pane v-if="row.detail.name != undefined" v-for="(item,index) in row.detail.name" + :label="item.propName" :name="item.parentPropKey"> + <div class="config-tools"> + <el-button-group> + <el-button size="mini" @click="addTabDetail(item.parentPropKey)" icon="el-icon-plus"></el-button> + <el-button size="mini" @click="editConfig(item.parentPropKey)" icon="el-icon-edit-outline"></el-button> + <el-button size="mini" @click="saveTabConfig(item.parentPropKey)" v-if="edits[item.parentPropKey] && edits[item.parentPropKey] === true" icon="el-icon-check"></el-button> + <el-button size="mini" @click="cancelConfig(item.parentPropKey)" v-if="tabDelete[item.parentPropKey] && tabDelete[item.parentPropKey] === true" icon="el-icon-close"></el-button> + </el-button-group> + </div> + <div class="config-view"> + <div style="display: flex;flex-direction: row;width: 100%;"> + <div class="config-header-title" + v-if="row[item.parentPropKey] != undefined && row[item.parentPropKey].name != undefined " + :style="'width:calc(' + 1/row[item.parentPropKey].name.length*100 +'% - ' + 40/row[item.parentPropKey].name.length + 'px)'" + v-for="(propName,index) in row[item.parentPropKey].name" > + {{propName}} + </div> + <div class="config-header-title" style="width: 40px">操作</div> + </div> + <div style="display: flex;flex-direction: row;width: 100%;" + v-if="row[item.parentPropKey] != undefined && row[item.parentPropKey].data != undefined " + v-for="(propList,index) in row[item.parentPropKey].data"> + <div class="config-content-content" + :style="'width:calc(' + 1/row[item.parentPropKey].name.length*100 +'% - ' + 40/row[item.parentPropKey].name.length + 'px)'" + v-for="(propInfo,index2) in propList"> + <property-edit :detail="propInfo" @callback="callback" + :operates="edits[item.parentPropKey]"></property-edit> + <!--<div v-if="index2 == (propList.length -1) && propInfo.addItem && propInfo.addItem == 1" + style="position: absolute;width: 20px;right: 15px;" > + <el-button size="mini" circle icon="el-icon-delete" @click="deleConfigItem(propList,index,item.parentPropKey)"></el-button> + </div>--> + </div> + <div class="config-content-content" style="width: 40px;"> + <el-button size="mini" type="text" icon="el-icon-delete" + v-if="propList[0] && propList[0].addItem && propList[0].addItem == 1" + @click="deleConfigItem(propList,index,item.parentPropKey)"></el-button> + </div> + </div> + </div> + </el-tab-pane> + + </el-tabs> + </el-dialog> +</div> diff --git a/hg-monitor-web-zj/src/main/resources/static/vue3/src/views/dp/index.js b/hg-monitor-web-zj/src/main/resources/static/vue3/src/views/dp/index.js new file mode 100644 index 0000000..ebc27cd --- /dev/null +++ b/hg-monitor-web-zj/src/main/resources/static/vue3/src/views/dp/index.js @@ -0,0 +1,436 @@ +export default { + name: 'configmanager', + template: '', + components: { + 'property-edit': Vue.defineAsyncComponent( + () => myImport('components/page/assets/propertyedit/index') + ), + }, + setup() { + + const { proxy } = Vue.getCurrentInstance() + + let columns = Vue.ref([]); + let tableList = Vue.ref([]); + let emptyText = Vue.ref('数据加载中...'); + let resTypeArr = Vue.ref([]); + let machineRoom = Vue.ref(''); + let centerDialogVisible = Vue.ref(false); + let loadHead = Vue.ref(false); + let initFlag = Vue.ref(false); + + let height = Vue.ref(window.innerHeight - 130); + + + // 分页信息 + const pageInfo = Vue.reactive({ + total: 0, + limit: 50, + page: 1, + keyWords:'' + }) + // 编辑信息 + const row = Vue.ref({}) + let tabDelete = Vue.ref({}); + + // 属性列表属性宽度 + let widths = Vue.ref({ + resName: '350', + admin: "150", + ip: "120", + maintenanceBegin: "180", + maintenanceEnd: "180", + resourceSN: "200", + cabinetPosition: "120", + parentResName:'300', + ULocation: "200" + }); + + // 筛选列选中的 TODO + let checkList = Vue.ref({}) + // 活跃页签 + let activeName = Vue.ref('jbxx'); + let edits = Vue.ref({}) + let editKey = Vue.ref({}) + + + + // 搜索 + let onSearch = () => { + if(initFlag.value){ + return; + } + initFlag.value = true; + // // 加载列表 + // proxy.$http.get("/api-web/home/getUserProperties", { + // resTypes: resTypeArr.value + // }, function (res) { + // if (res && res.data) { + // columns.value = res.data; + // emptyText.value = '数据加载中...' + // loadHead.value = true; + // } + // }); + // + // // 加载数据 + // var params = { + // page: pageInfo.page, + // limit: pageInfo.limit, + // resName: pageInfo.keyWords, + // sortKey: '', + // resType: resTypeArr.value.join(','), + // resPositon: machineRoom.value, + // addr: '', + // maintenanceTimeEnd: '', + // maintenanceTimeStart: '', + // resCategory: 'assets' + // }; + // proxy.$http.get("/api-web/home/assets/page/all", params, function (res) { + // if (res && res.data) { + // tableList.value = res.data; + // emptyText.value = "加载完成"; + // pageInfo.total = res.count; + // } else { + // emptyText.value = "暂无数据"; + // } + // initFlag.value = false; + // }) + // 加载数据 + var params = { + page: pageInfo.page, + limit: pageInfo.limit, + resName: pageInfo.keyWords, + sortKey: '', + resType: resTypeArr.value.join(','), + resPositon: machineRoom.value, + addr: '', + maintenanceTimeEnd: '', + maintenanceTimeStart: '', + resCategory: 'assets' + }; + proxy.$http.get("/api-web/assets/configmanager/list", params, function (res) { + if (res && res.data) { + columns.value = res.map.header; + tableList.value = res.data; + emptyText.value = "加载完成"; + pageInfo.total = res.count; + } else { + emptyText.value = "暂无数据"; + tableList.value = []; + proxy.$global.showMsg('暂无数据!'); + } + initFlag.value = false; + },function (){ + proxy.$global.showMsg('没有查询到记录!'); + initFlag.value = false; + }); + } + + // 点击按钮搜索 + let onBtnSearch = () =>{ + pageInfo.page = 1; + onSearch(); + } + + let getResType = (arr) => { + console.log(arr); + var types = arr.map(function (v) { + return v.id; + }); + resTypeArr.value = types; + + onSearch(); + } + + let getMachineRoom = (code) => { + console.log(code); + machineRoom.value = code; + + onSearch(); + } + + // 每页展示多少条 + let handleSizeChange = (val) => { + console.log(`每页 ${val} 条`) + pageInfo.limit = val; + onSearch(); + } + + // 切换页码 + let handleCurrentChange = (val) => { + console.log(`当前页: ${val}`) + pageInfo.page = val; + onSearch(); + } + + // 切换页码 + let prePage = (val) => { + console.log(`当前页: ${val}`) + pageInfo.page = val - 1; + onSearch(); + } + + // 切换页码 + let nextPage = (val) => { + console.log(`当前页: ${val}`) + pageInfo.page = val + 1; + onSearch(); + } + + // 打开详情页配置 + let openDetailPage = (rowDetail) => { + + edits.value['jbxx'] = false; + + if(row.value.detail && row.value.detail.name){ + row.value.detail.name.forEach(function (v) { + edits.value[v] = false; + }) + } + + let resId = rowDetail.resId; + + // 默认基本信息 + activeName.value = 'jbxx'; + row.value['title'] = rowDetail.resName + '_' + rowDetail.ip; + row.value['resId'] = resId; + + let id = encodeURIComponent(resId); + + // 获取配置信息 + proxy.$http.get(`/api-web/assets/configmanager/resource/assets?resId=${id}`, {}, function (res) { + if (res && res.map) { + row.value['detail'] = res.map; + + // 清空其他页签得数据 + if(res.map.name){ + res.map.name.forEach(function(tab) { + delete row.value[tab.parentPropKey]; + }) + } + centerDialogVisible.value = true; + } + }) + } + + // 加载其他页签数据 + let handleClick = (tab, event) => { + let tabName = tab.props.name; + let resId = row.value['resId']; + + // 已加载 + if (row.value[tabName]) { + return; + } + let id = encodeURIComponent(resId); + // 查询其他页签信息 + proxy.$http.get(`/api-web/assets/configmanager/tab/detail?resId=${id}&parentKey=${tabName}`, {}, function ( + res) { + if (res && res.map) { + edits.value[tabName] = false; + row.value[tabName] = res.map; + } + }) + } + + // 二维表格添加 + let addTabDetail = (tabName) => { + tabDelete.value[tabName] = true; + // // 设置取消状态 + // tabDelete.value[tabName] = false; + // 设置编辑状态 + edits.value[tabName] = false; + let val = row.value[tabName]; + if(val && val.map && val.data){ + let rowData = val.map; + + let keys = Object.keys(rowData); + let propGroup = (new Date()).getTime(); + + let arr = []; + keys.forEach(function (k) { + var newProp = Object.create({}); + Object.assign(newProp,rowData[k]); + newProp.propGroup = propGroup; + newProp.addItem = 1; + arr.push(newProp); + }); + + val.data.push(arr); + } + + console.log(val); + } + + // 点击编辑按钮 + let editConfig = (tabName) => { + edits.value[tabName] = true; + } + + // 点击取消 + let cancelConfig = (tabName) => { + edits.value[tabName] = false; + + // 还原数据 + let detail = row.value.detail[tabName]; + if(detail){ + // 基本信息 + detail.forEach(function (v) { + var e = editKey.value[v.propKey]; + if(e){ + detail.propValue = e.oldValue; + detail.propValueText = e.propValueText; + e.edit = false; + } + }) + } + // 二维列表信息 + detail = row.value[tabName]; + if(detail && detail.data){ + tabDelete.value[tabName] = false; + let newArr = []; + detail.data.forEach(function (v,i) { + let addItem = detail.data[i][0].addItem; + if(addItem && addItem == 1){ + //detail.data.splice(i, 1); + } else { + if(v && v.length > 0){ + v.forEach(function(configItem){ + var e = editKey.value[configItem.propKey]; + if(e){ + configItem.propValue = e.oldValue; + configItem.propValueText = e.propValueText; + e.edit = false; + } + }) + + newArr.push(v); + } + } + }); + detail.data = newArr; + } + } + + // 点击保存 + let saveConfig = (tabName) => { + let resId = row.value['resId']; + let arr = []; + let detail = row.value.detail[tabName]; + if(detail){ + detail.forEach(function (v) { + arr.push({ + resId:resId, + key:v.propKey, + val:v.propValue, + type:v.propType, + parentKey:v.parentPropKey, + parentGroup:v.propGroup, + sort:v.sort + }) + }); + proxy.$http.post(`/api-web/assets/configmanager/saveConfig`, arr, function (res) { + proxy.$global.showMsg('保存成功!'); + editKey.value = {}; + centerDialogVisible.value = false; + onSearch(); + }) + } + } + + // 保存二维属性 + let saveTabConfig = (tabName) => { + let resId = row.value['resId']; + let arr = []; + let detail = row.value[tabName]; + if(detail && detail.data){ + detail.data.forEach(function (v) { + if(v && v.length > 0){ + v.forEach(function(configItem){ + arr.push({ + resId:resId, + key:configItem.propKey, + val:configItem.propValue, + type:configItem.propType, + parentKey:configItem.parentPropKey, + parentGroup:configItem.propGroup, + sort:configItem.sort + }) + }) + } + + }); + proxy.$http.post(`/api-web/assets/configmanager/saveConfig`, arr, function (res) { + proxy.$global.showMsg('保存成功!'); + editKey.value = {}; + centerDialogVisible.value = false; + onSearch(); + }) + } + } + + // 二维删除新增得选项 + let deleConfigItem = (list,index,tabName) =>{ + let detail = row.value[tabName]; + if(detail && detail.data){ + detail.data.splice(index,1); + } + } + + let callback = ( key, propValue,oldValue,propValueText) => { + let resId = row.value['resId']; + console.log("回调", resId, key, propValue,oldValue) + if(propValue == null || propValue == '' || propValue == oldValue){ + return; + } + + editKey.value[key] = { + edit:true, + val:propValue, + oldValue: oldValue, + propValueText:propValueText == undefined ? oldValue : propValueText + }; + } + + // 挂载完 + Vue.onMounted(() => { + onSearch(); + console.log('onMounted'); + }) + + return { + loadHead, + columns, + tableList, + pageInfo, + emptyText, + resTypeArr, + machineRoom, + widths, + onSearch, + getResType, + getMachineRoom, + openDetailPage, + centerDialogVisible, + row, + checkList, + activeName, + handleClick, + edits, + editConfig, + cancelConfig, + saveConfig, + callback, + editKey, + addTabDetail, + deleConfigItem, + saveTabConfig, + tabDelete, + handleSizeChange, + initFlag, + handleCurrentChange, + height, + onBtnSearch + } + } +} diff --git a/hg-monitor-web-zj/src/main/resources/static/说明.txt b/hg-monitor-web-zj/src/main/resources/static/说明.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/hg-monitor-web-zj/src/main/resources/static/说明.txt diff --git a/pom.xml b/pom.xml index f9da327..d26d27a 100644 --- a/pom.xml +++ b/pom.xml @@ -19,6 +19,7 @@ <module>hg-monitor-web-base</module> <module>hg-monitor-web-new</module> <module>hg-monitor-web-tj</module> + <module>hg-monitor-web-zj</module> </modules> <properties> <java.version>1.8</java.version> @@ -49,7 +50,7 @@ <build> <resources> <resource> - <directory>src/main/java</directory> + <directory>src/main/resources</directory> <includes> <include>**/**</include> </includes>