Authored by 王涛

文档管理

Showing 22 changed files with 748 additions and 60 deletions
# 代码包路径
````
【后端】 hg-platform\business-center\view-center-project\view-center-zj\src\main\java\com\honggroup\manageapi\bdialtestconfig
````
### 说明
````
文档管理是一个组件,文档管理和回收站使用传参的方式,来控制读取数据的接口;
````
## 配置文件修改
**api-gateway**</br>
配置节点security:oauth2:ignored追加配置文件:**,/api-web/manage/bustype/getAllBusId,/api-web/manage/bdialtest/getTaskIdAndBusId**
````
# 增加配置文件
security:
oauth2:
ignored: /test163/** , /api-auth/** , /doc.html ,/test111 ,/api-user/users-anon/login, /api-user/users/save,/api-web/datavis/**,/api-web/bigScreen/**, /user-center/users-anon/login,/document.html,**/v2/api-docs,/oauth/** ,/login.html ,/user/login,/**/**.css ,/**/**.js ,/getVersion,/api-web/manage/bustype/getAllBusId,/api-web/manage/bdialtest/getTaskIdAndBusId
````
## 涉及工程
> 1、view-center
... ...
... ... @@ -2,11 +2,15 @@
[https://hgkj.5upm.com/task-view-73.html](任务地址)
# 代码包路径
````【前端】【组件】hg-monitor-web\hg-monitor-web-base\src\main\resources\static\vue3\src\components\common\document
````
【前端】【组件】hg-monitor-web\hg-monitor-web-base\src\main\resources\static\vue3\src\components\common\document
【前端】【文档管理】hg-monitor-web\hg-monitor-web-zj\src\main\resources\static\vue3\src\views\documentationManagement\index.*
【前端】【回收站】hg-monitor-web\hg-monitor-web-zj\src\main\resources\static\vue3\src\views\documentationManagement\documentRecycle.*
【后端】hg-platform\business-center\inspection-report\src\main\java\com\honggroup\report\controller\FileManageMentController.java
````
### 说明
````
文档管理是一个组件,文档管理和回收站使用传参的方式,来控制读取数据的接口;
````
... ...
... ... @@ -55,6 +55,30 @@
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe615;</span>
<div class="name">资产</div>
<div class="code-name">&amp;#xe615;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe61f;</span>
<div class="name">收藏</div>
<div class="code-name">&amp;#xe61f;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe835;</span>
<div class="name">网络拓扑</div>
<div class="code-name">&amp;#xe835;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe622;</span>
<div class="name">收藏</div>
<div class="code-name">&amp;#xe622;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe613;</span>
<div class="name">虚拟桌面</div>
<div class="code-name">&amp;#xe613;</div>
... ... @@ -564,9 +588,9 @@
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.woff2?t=1635930253141') format('woff2'),
url('iconfont.woff?t=1635930253141') format('woff'),
url('iconfont.ttf?t=1635930253141') format('truetype');
src: url('iconfont.woff2?t=1636448687987') format('woff2'),
url('iconfont.woff?t=1636448687987') format('woff'),
url('iconfont.ttf?t=1636448687987') format('truetype');
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
... ... @@ -593,6 +617,42 @@
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-assets"></span>
<div class="name">
资产
</div>
<div class="code-name">.icon-assets
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-shoucang"></span>
<div class="name">
收藏
</div>
<div class="code-name">.icon-shoucang
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-wangluotuopu"></span>
<div class="name">
网络拓扑
</div>
<div class="code-name">.icon-wangluotuopu
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-shoucang1"></span>
<div class="name">
收藏
</div>
<div class="code-name">.icon-shoucang1
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-xunizhuomian"></span>
<div class="name">
虚拟桌面
... ... @@ -1359,6 +1419,38 @@
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-assets"></use>
</svg>
<div class="name">资产</div>
<div class="code-name">#icon-assets</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-shoucang"></use>
</svg>
<div class="name">收藏</div>
<div class="code-name">#icon-shoucang</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-wangluotuopu"></use>
</svg>
<div class="name">网络拓扑</div>
<div class="code-name">#icon-wangluotuopu</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-shoucang1"></use>
</svg>
<div class="name">收藏</div>
<div class="code-name">#icon-shoucang1</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-xunizhuomian"></use>
</svg>
<div class="name">虚拟桌面</div>
... ...
@font-face {
font-family: "iconfont"; /* Project id 2843738 */
src: url('iconfont.woff2?t=1635930253141') format('woff2'),
url('iconfont.woff?t=1635930253141') format('woff'),
url('iconfont.ttf?t=1635930253141') format('truetype');
src: url('iconfont.woff2?t=1636448687987') format('woff2'),
url('iconfont.woff?t=1636448687987') format('woff'),
url('iconfont.ttf?t=1636448687987') format('truetype');
}
.iconfont {
... ... @@ -13,6 +13,22 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-assets:before {
content: "\e615";
}
.icon-shoucang:before {
content: "\e61f";
}
.icon-wangluotuopu:before {
content: "\e835";
}
.icon-shoucang1:before {
content: "\e622";
}
.icon-xunizhuomian:before {
content: "\e613";
}
... ...
... ... @@ -6,6 +6,34 @@
"description": "",
"glyphs": [
{
"icon_id": "1369418",
"name": "资产",
"font_class": "assets",
"unicode": "e615",
"unicode_decimal": 58901
},
{
"icon_id": "5318188",
"name": "收藏",
"font_class": "shoucang",
"unicode": "e61f",
"unicode_decimal": 58911
},
{
"icon_id": "6510093",
"name": "网络拓扑",
"font_class": "wangluotuopu",
"unicode": "e835",
"unicode_decimal": 59445
},
{
"icon_id": "7588122",
"name": "收藏",
"font_class": "shoucang1",
"unicode": "e622",
"unicode_decimal": 58914
},
{
"icon_id": "4675111",
"name": "虚拟桌面",
"font_class": "xunizhuomian",
... ...
... ... @@ -134,6 +134,28 @@ global.viewer = (path,proxy) =>{
}
/**
* 拓扑
* @param path
*/
global.openGraphEditor = (topoId) =>{
let url = `${sessionStorage.getItem('graphEditorOrigin')}/jgraph/grapheditor/index.html?access_token=${localStorage.getItem('access_token')}&id=${topoId}`;
let height = window.innerHeight;
let width = window.innerWidth;
window.open(url,"_blank",`toolbar=no, location=no, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=no, width=${width}, height=${height}`);
}
/**
* 打开资产列表
* @param topoId
*/
global.openCmdbAssets = (resId) =>{
let url = `${sessionStorage.getItem('graphEditorOrigin')}/jgraph/grapheditor/index.html?access_token=${localStorage.getItem('access_token')}&id=${resId}`;
let height = window.innerHeight;
let width = window.innerWidth;
window.open(url,"_blank",`toolbar=no, location=no, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=no, width=${width}, height=${height}`);
}
/**
* 将文件转成base64
* @param file
* @returns {Promise<String>}
... ...
... ... @@ -8,7 +8,7 @@ let http = {
},
reqErr: function (xhr) {
try{
http.proxy.$global.showMsg("服务异常,请联系管理员!","error");
let isUnauthorized = xhr.statusText == 'Unauthorized'
if (isUnauthorized || (xhr && xhr.responseJSON && xhr.responseJSON.resp_code && xhr.responseJSON.resp_code == '401')) {
// 登录超时,刷新当前页面===>跳转到登录页面
... ...
... ... @@ -28,7 +28,14 @@
width: 300px;
}
.yfyw-user .el-input__inner, .el-textarea__inner {
.yfyw-user .el-input__inner {
border: none;
border-bottom: solid 1px #DCDFE6;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.yfyw-user .el-textarea__inner {
border: none;
border-bottom: solid 1px #DCDFE6;
border-bottom-left-radius: 0;
... ...
<el-progress type="dashboard" :percentage="percentage" :status="status">
<template #default="{ percentage }">
<span class="percentage-value">{{ percentage }}%</span>
<span class="percentage-label">{{percentageText}}</span>
</template>
</el-progress>
<!--
<el-progress
:text-inside="true"
:stroke-width="20"
:percentage="50"
status="exception" >
<span>Content</span>
</el-progress>
-->
... ...
export default {
name: 'resConfigIndex',
template: '',
components: {},
props: {
// 百分比数字,例如:50%,percentage= 50
percentage: {
type: Number,
default: 0
},
// 展示文字
percentageText: {
type: String,
default: ''
},
// 状态 success/exception/warning
status: {
type: String,
default: 'success'
},
},
data() {
return {
}
},
setup(props, {attrs, slots, emit}) {
}
}
... ...
<div>
<el-dropdown>
<span class="el-dropdown-link" @click="openDetail">
{{resName}}
<el-icon class="el-icon--right">
<arrow-down/>
</el-icon>
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item v-if="start" title="收藏" @click="showDialog(true)">
<i class="iconfont icon-shoucang" style="color: #FEB61E"/>
</el-dropdown-item>
<el-dropdown-item v-if="topo" title="拓扑" @click="openTopoPage">
<i class="iconfont icon-wangluotuopu" style="color: #FEB61E"/>
</el-dropdown-item>
<el-dropdown-item v-if="assets" title="资产" @click="openCmdbAssets">
<i class="iconfont icon-assets" style="color: #FEB61E"/>
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<cm-dialog title="收藏" width="500px" :showDialogVisible="dialogFlg" @hidedialog="showDialog" @okfunc="saveStart">
<template v-slot>
<div style="padding: 10px" style="display: flex">
<div v-for="(v,k) in fieldsValueObj[currentRow.id].props" style="width: 50%">
<div style="text-align: left;padding-left: 10px;">{{v}}</div>
<el-select v-model="favIds" multiple placeholder="请选择" style="margin: 3px">
<el-option v-for="(item ,index) in favData"
:key="index"
:label="item.name"
:value="item.value" >
</el-option>
</el-select>
</div>
</div>
</template>
</cm-dialog>
</div>
... ...
export default {
name: 'resConfigIndex',
template: '',
components: {},
props: {
// 资源名称
resName: {
type: String,
default: 0
},
// 展示文字 收藏、拓扑、资产 'start,topo,assets'
start: {
type: Boolean,
default: true
},
topo: {
type: Boolean,
default: true
},
assets: {
type: Boolean,
default: true
},
resId: {
type: String,
default: ''
},
},
data() {
return {}
},
setup(props, {attrs, slots, emit}) {
const {proxy} = Vue.getCurrentInstance();
let dialogFlg = Vue.ref(false);
let favIds = Vue.ref([]);
let favData = Vue.ref([]);
/**
* 展示收藏弹框
* <p>
* 作者: Wang
* 时间:2021/11/9 18:30
*/
let showDialog = (flg) => {
dialogFlg.value = flg;
if (favData.value.length == 0) {
// 加载收藏文件列表
proxy.$http.get(`/api-web/favorites/treeSelectData`, {}, function (res) {
if (res && res.data && res.data.length > 0) {
let arr = [];
let getChilds = (arr) => {
arr.forEach(function (v) {
if (v.children && v.children.length > 0) {
getChilds(v.children);
} else {
arr.push(v);
}
})
}
favData.value = arr;
}
});
}
}
/**
* 保存收藏
* <p>
* 作者: Wang
* 时间:2021/11/9 18:29
*/
let saveStart = () => {
if (props.resId == '') {
proxy.$global.showMsg("资源Id不存在,确认!")
return;
}
let params = {
favIds: favIds,
resId: props.resId
}
proxy.$http.post(`/api-web/favorites/save/fav`, params, function (res) {
if (res && res.success) {
proxy.$global.showMsg("收藏成功!")
}
});
}
let openTopoPage = () => {
if (props.resId == '') {
proxy.$global.showMsg("资源Id不存在,确认!")
return;
}
// 查询topoId
proxy.$http.get(`/api-web/mxgraph/generateByResId`, {resId: props.resId}, function (res) {
if (response && response.success) {
let topoId = response.str;
proxy.$global.openGraphEditor(topoId)
} else {
proxy.$global.showMsg('生成资源拓扑失败!', "error");
}
});
}
let openDetail = () => {
}
let openCmdbAssets = () => {
proxy.$global.openCmdbAssets(props.resId);
}
return {
dialogFlg,
showDialog,
saveStart,
favIds,
favData,
openTopoPage,
openDetail,
openCmdbAssets
}
}
}
... ...
export default {
name: 'resConfigIndex',
template: '',
components: {},
props: {
// 类型 danger success warning
type: {
type: String,
default: 'success'
},
// 文本
text: {
type: String,
default: ''
},
},
data() {
return {
}
},
setup(props, {attrs, slots, emit}) {
}
}
... ...
... ... @@ -5,19 +5,20 @@
<div style="text-align: left;padding-left: 10px;padding-top: 3px;font-weight: bold">
<el-link type="info" :underline="false"><i class="iconfont icon-liebiao"></i> 资源类型</el-link>
</div>
<el-tree :data="treeData" :props="props" >
<el-tree :data="treeData" :props="props" @node-click="handleConfigNodeClick">
<template #default="{ node, data }">
<div style="position: relative;flex-direction: row;width: 100%;">
<!--<div style="display: flex;flex-direction: row;width: 100%;">
<div style="width: calc(100% - 60px);max-width: calc(100% - 60px);overflow: hidden;text-overflow: ellipsis;text-align: left;"
@click="handleConfigNodeClick(data)" :title="node.label">
{{node.label }}
</div>
<div style="width: 60px;float: right">
<div style="width: 60px;">
<a @click="editType(data)" style="margin-right: 10px;">
<i class="el-icon-setting"></i>
</a>
</div>
</div>
</div>-->
{{node.label }}
</template>
</el-tree>
</div>
... ... @@ -39,6 +40,10 @@
</template>
</el-dropdown>
<el-button type="primary" @click="saveConfig" style="margin-left: 10px">保存</el-button>
<el-button type="primary" @click="showTreeNodeDialog(true)" style="margin-left: 10px">
<i class="el-icon-setting"></i>
</el-button>
</div>
<cm-table-page :columns="columns" :dataList="dataList" @loaddata="getPage" :showIndex="true"
... ... @@ -61,6 +66,21 @@
<el-option label="否" :value="1"></el-option>
</el-select>
</div>
<div v-else-if="prop == 'colComponents'">
<!-- 展示下拉选项 -->
<el-select placeholder="请选择" size="small" style="width: 100%"
@change="changeProperty(row,prop,column)" v-model="row.colComponents"
:multiple="false"
collapse-tags clearable filterable placeholder="请选择">
<el-option label="无" :value="''"></el-option>
<el-option label="资源名称" :value="'resNameComponents'"></el-option>
<el-option label="状态组件" :value="'statusComponents'"></el-option>
<el-option label="使用率组件" :value="'rateComponents'"></el-option>
</el-select>
</div>
<div v-else-if="['colType'].indexOf(prop) != -1">
<el-select placeholder="选择类型" size="small" style="width: 100%"
@change="getColType(row)" v-model="row.colType" :multiple="false"
... ... @@ -71,25 +91,27 @@
</el-option>
</el-select>
</div>
<div v-else-if="['colTypeQueryFields'].indexOf(prop) != -1">
<span v-if="Object.keys(fieldsObj).length == 0 || fieldsObj.propertyType == 'INPUT' || row.colType == 'INPUT'"> - </span>
<div v-else-if="['colTypeExtend'].indexOf(prop) != -1">
<span v-if="row.colType == '' || row.colType == null || row.colType == 'INPUT'"> - </span>
<el-select v-else-if="fieldsObj.propertyType == 'LIST'" placeholder="请选择扩展属性"
<el-select v-else-if="fieldsObj[row.colType] && fieldsObj[row.colType].propertyType == 'LIST'" placeholder="请选择扩展属性"
size="small" style="width: 100%"
@change="getColTypeExtVal(row)" v-model="row.colTypeQueryFields"
v-model="row.colTypeExtend"
:multiple="false"
collapse-tags clearable filterable placeholder="请选择">
<el-option v-for="(value,key) in fieldsObj.object" :key="index"
:label="value[fieldsObj.text]"
:value="value[fieldsObj.value]">
<el-option v-for="(value,key) in fieldsObj[row.colType].object" :key="index"
:label="value[fieldsObj[row.colType].text]"
:value="value[fieldsObj[row.colType].value]">
</el-option>
</el-select>
</div>
<div v-else-if="prop == 'colTypeVal'">
<span v-if="fieldsValueObj == undefined || fieldsValueObj[row.id] == undefined || Object.keys(fieldsValueObj) == 0"> - </span>
<el-button v-else icon="el-icon-setting" @click="showSettingCmDialog(true,row)" size="mini"
style="margin-left: 10px"></el-button>
<div v-else-if="prop == 'colTypeExtendProps'">
<span v-if="row.colType == '' || row.colType == null || row.colType == 'INPUT'"> - </span>
<el-button v-else @click="showSettingCmDialog(true,row)" size="mini"
style="margin-left: 10px"> <i class="el-icon-setting"></i></el-button>
</div>
<div v-else>
... ... @@ -109,7 +131,7 @@
<template #tools>
<el-table-column fixed="right" label="操作" width="80" align="center">
<template #default="scope">
<el-button type="text" size="small" @click.prevent="deleteRow(scope.$index)">
<el-button type="text" size="small" @click.prevent="deleteRow(row,scope.$index)">
<i class="el-icon-delete"/>
</el-button>
</template>
... ... @@ -136,4 +158,31 @@
</div>
</template>
</cm-dialog>
<cm-dialog :title="`${currentNode.label}类型属性配置`" width="500px" :showDialogVisible="treeNodeDialogFlg" @hidedialog="showTreeNodeDialog" @okfunc="saveTreeNodeConfig">
<template v-slot>
<el-form
label-width="120px"
ref="ruleForm"
:model="treeNodeForm"
:rules="treeNodeFormRules"
label-position="right"
label-width="120px">
<el-form-item label="配置信息" prop="name">
<el-input :size="$global.elementSize" v-model="treeNodeForm.options" clearable ></el-input>
</el-form-item>
<el-form-item label="详情页配置函数" prop="type">
<el-input :size="$global.elementSize" v-model="treeNodeForm.detailFunc" type="textarea" clearable></el-input>
</el-form-item>
<el-form-item label="查询视图" prop="sort">
<el-input :size="$global.elementSize" v-model="treeNodeForm.veiwName" clearable readonly></el-input>
</el-form-item>
</el-form>
</template>
</cm-dialog>
</div>
... ...
... ... @@ -2,7 +2,7 @@
* 配置页面编辑属性
* @returns {{editColProps: {}}}
*/
let configPageEdit = () => {
let configPageEdit = (columns, currentNode) => {
const {proxy} = Vue.getCurrentInstance();
// 编辑属性
let editColProps = Vue.ref({});
... ... @@ -33,13 +33,24 @@ let configPageEdit = () => {
* 时间:2021/10/27 14:34
*/
let getColType = (row) => {
// 获取属性标识的配置
let code = row.colType;
proxy.$http.get(`/api-web/v32/res/list/detail/col/${code}`, {}, function (res) {
if (res && res.object) {
fieldsObj.value = res.object;
row.colTypeQueryFields = '';
if (fieldsObj.value[code] && Object.keys(fieldsObj.value[code]).length > 0) {
row.colTypeExtend = '';
return;
}
let params = {
resTypeId: currentNode.value.id,
colType: row.colType,
colTypeExtendProps: row.colTypeExtendProps,
colTypeExtend: row.colTypeExtend
}
proxy.$http.get(`/api-web/v32/res/config/detail/colTypes`, params, function (res) {
if (res && res.map) {
fieldsObj.value = res.map;
}
});
}
... ... @@ -50,30 +61,55 @@ let configPageEdit = () => {
* 作者: Wang
* 时间:2021/10/27 14:34
*/
let getColTypeExtVal = (row) => {
let getColTypeExtVal = (flg, row) => {
let colTypeExtend = row.colTypeExtend;
let rowProps = row.colTypeExtendProps;
if(!colTypeExtend || colTypeExtend == '' || colTypeExtend == null){
proxy.$global.showMsg("请选择关联扩展属性!", "warning")
return;
}
if(fieldsValueObj.value[row.id] && Object.keys(fieldsValueObj.value[row.id]).length >0){
return;
}
// 获取属性标识的配置
let params = {
resTypeId: currentNode.value.id,
colType: row.colType,
colTypeQueryFields: row.colTypeQueryFields
colTypeExtendProps: rowProps,
colTypeExtend: colTypeExtend
}
proxy.$http.get(`/api-web/v32/res/list/detail/setting`, params, function (res) {
proxy.$http.get(`/api-web/v32/res/config/detail/setting`, params, function (res) {
if (res && res.object) {
fieldsValueObj.value[row.id] = res.object;
settingVal.value[row.id] = {};
let defVal = JSON.parse(rowProps);
if(defVal){
settingVal.value[row.id] = defVal;
} else {
settingVal.value[row.id] = {};
}
settingCmDialogFlg.value = flg;
} else {
proxy.$global.showMsg("该属性无需配置!", "warning")
}
});
}
let showSettingCmDialog = (flg, row) => {
settingCmDialogFlg.value = flg;
if (flg == true && row) {
currentRow.value = row;
// 记载已配置的属性
if(row.setting && row.setting[row.id]){
// 加载已配置的属性
if (row.setting && row.setting[row.id]) {
settingVal.value[row.id] = row.setting[row.id]
} else {
getColTypeExtVal(flg, row);
return;
}
}
settingCmDialogFlg.value = flg;
}
let getSettingDetail = () => {
... ... @@ -98,12 +134,76 @@ let configPageEdit = () => {
}
}
/**
* 展示配置属性
* <p>
* 作者: Wang
* 时间:2021/11/8 16:30
*/
const treeNodeConfig = (currentNode) => {
const {proxy} = Vue.getCurrentInstance();
let treeNodeDialogFlg = Vue.ref(false);
let treeNodeForm = Vue.ref({
options: '',
detailFunc: '',
veiwName: ''
});
let treeNodeFormRules = Vue.ref({});
/**
* 展示树节点配置
* <p>
* 作者: Wang
* 时间:2021/11/8 16:33
*/
let showTreeNodeDialog = (flg) => {
if (flg && flg == true && currentNode.value.map) {
treeNodeForm.value = {
id: currentNode.value.id,
options: currentNode.value.map.options,
detailFunc: currentNode.value.map.detailFunc,
veiwName: currentNode.value.map.veiwName
}
}
treeNodeDialogFlg.value = flg;
}
/**
* 保存树节点配置
*/
let saveTreeNodeConfig = () => {
proxy.$http.get(`/api-web/v32/res/config/saveTreeConfig`, treeNodeForm.value, function (res) {
if (res && res.success) {
proxy.$global.showMsg("保存成功!")
}
});
}
return {
treeNodeDialogFlg,
showTreeNodeDialog,
saveTreeNodeConfig,
treeNodeForm,
treeNodeFormRules
}
}
export default {
name: 'resConfigIndex',
template: '',
components: {
'property-edit': Vue.defineAsyncComponent(
() => myImport('components/page/assets/propertyedit/index')
'rateComponents': Vue.defineAsyncComponent(
() => myImport('components/page/res/rateComponents/index')
),
'resNameComponents': Vue.defineAsyncComponent(
() => myImport('components/page/res/resNameComponents/index')
),
'statusComponents': Vue.defineAsyncComponent(
() => myImport('components/page/res/statusComponents/index')
),
},
data() {
... ... @@ -114,7 +214,7 @@ export default {
}
}
},
setup() {
setup(props, {attrs, slots, emit}) {
const {proxy} = Vue.getCurrentInstance();
let height = Vue.ref((window.innerHeight - 10) * 0.8);
let currentNode = Vue.ref({});
... ... @@ -139,7 +239,16 @@ export default {
getSettingDetail,
currentRow,
settingVal
} = configPageEdit()
} = configPageEdit(columns, currentNode)
const {
treeNodeDialogFlg,
showTreeNodeDialog,
saveTreeNodeConfig,
treeNodeForm,
treeNodeFormRules
} = treeNodeConfig(currentNode);
// 获取左侧树结构
... ... @@ -147,11 +256,11 @@ export default {
proxy.$http.get("/api-web/v32/res/list/config/tree", {}, function (res) {
if (res && res.data) {
let arr = [];
res.data.forEach(function (v){
res.data.forEach(function (v) {
arr.push({
id:v.id,
label:v.label,
children:v.children
id: v.id,
label: v.label,
children: v.children
});
})
... ... @@ -171,7 +280,7 @@ export default {
treeNodeId: currentNode.value.id,
loadDefault: defList.value.length == 0 ? 1 : 0
}
proxy.$http.get(`/api-web/v32/res/list/config`, params, function (res) {
proxy.$http.get(`/api-web/v32/res/config/list`, params, function (res) {
if (res && res.object) {
columns.value = res.object.columns;
dataList.value = res.object.datas;
... ... @@ -179,6 +288,10 @@ export default {
let arr = res.object.defaultList;
if (arr && arr.length > 0) {
defList.value = arr;
// 加载一个数据的类型
getColType(arr[0]);
}
}
});
... ... @@ -191,8 +304,22 @@ export default {
* 作者: Wang
* 时间:2021/10/28 17:55
*/
let clickIndex = 0;
let handleConfigNodeClick = (data) => {
if (data) {
let isExistArr = dataList.value.filter(function (v) {
if (v.isAdd && v.isAdd == 1) {
return v;
}
})
if (isExistArr.length > 0) {
proxy.$global.confirm("有已添未保存的配置数据,是否清空?", function () {
currentNode.value = data;
getConfigData();
})
return;
}
currentNode.value = data;
getConfigData();
}
... ... @@ -218,6 +345,9 @@ export default {
data['isQuery'] = 1;
data['colIsTd'] = 1;
data['status'] = 0;
data['resListId'] = currentNode.value.id;
// 排序
data['colSort'] = 100;
// 新增状态
data['isAdd'] = 1;
... ... @@ -236,11 +366,56 @@ export default {
return;
}
// 添加
dataList.value.splice(0, 0, item);
let newData = {...item};
newData['resListId'] = currentNode.value.id;
dataList.value.splice(0, 0, newData);
}
// 保存
let saveConfig = () => {
console.log(dataList.value)
let arr = dataList.value;
if (arr.length == 0) {
proxy.$global.showMsg("请添加配置项!", 'warning');
return;
}
let msg = "";
arr.filter(function (v, i) {
if (v.colAlias == '' || v.colKey == '') {
msg += `请填写第${(i + 1)}行的属性名称或者标识!`
} else if (v.colWidth == '' || v.colWidth == null || v.colWidth < 0) {
msg += `第${(i + 1)}行的列宽不能为空或者小于0!`
} else if (v.colWidth == '' || v.colSort == null || v.colSort < 0) {
msg += `请填写第${(i + 1)}行的排序不能为空或者小于0!`
}
})
if (msg != '') {
proxy.$global.showMsg(msg, 'warning');
return;
}
// 保存时,将v['setting']转换为string
arr.forEach(function (v) {
v['setting'] = JSON.stringify(v['setting']);
})
/**
* 保存配置
* <p>
* 作者: Wang
* 时间:2021/11/9 15:19
*/
proxy.$http.post(`/api-web/v32/res/config/saveResTypeConfig/${currentNode.value.id}`, arr, function (res) {
if (res && res.success) {
proxy.$global.showMsg("保存成功!");
// 刷新当前列表数据
getConfigData();
} else {
proxy.$global.showMsg(res.msg && res.msg != '' ? res.msg : "保存成功!", "error");
}
});
}
/**
... ... @@ -249,11 +424,22 @@ export default {
* 作者: Wang
* 时间:2021/10/26 19:47
*/
let deleteRow = (index) => {
proxy.$global.confirm("确认删除该行配置吗?", function () {
dataList.value.splice(index, 1);
proxy.$global.showMsg("删除成功!")
let deleteRow = (row,index) => {
proxy.$global.confirm("确认删除该配置项吗?", function () {
if(row.isAdd && row.isAdd == 1){
proxy.$global.showMsg("删除成功!")
dataList.value.splice(index, 1);
} else {
// 删除配置项
proxy.$http.post(`/api-web/v32/res/config/deleteResTypeConfig/${row.id}`, {}, function (res) {
if (res && res.success) {
proxy.$global.showMsg("删除成功!");
dataList.value.splice(index, 1);
} else {
proxy.$global.showMsg(res.msg && res.msg != '' ? res.msg : "删除失败!", "error");
}
});
}
})
}
... ... @@ -286,7 +472,14 @@ export default {
showSettingCmDialog,
getSettingDetail,
currentRow,
settingVal
settingVal,
// 树节点配置
treeNodeDialogFlg,
showTreeNodeDialog,
saveTreeNodeConfig,
treeNodeForm,
treeNodeFormRules
}
}
}
... ...
... ... @@ -32,8 +32,8 @@
:showBorder="true" :currentPage="currentPage" :total="total" :loading="false"
:showPage="true" :height="(height - 95)">
<template #default="{row,prop,column}">
<a href="javascript:void(0)" v-if="prop == 'resPositon' || prop == 'cabinetNo'" style="border-bottom: solid 1px blue;margin-bottom: 3px;height: 30px;font-size: 15px;" @click="cellClick(row,prop,column)">{{row[prop]}}</a>
<el-link v-else :underline="false" @click="item.click(scope.row)">{{row[prop]}}</el-link>
<a href="javascript:void(0)" v-if="prop == 'resPositon' || prop == 'cabinetNo'" style="border-bottom: solid 1px blue;margin-bottom: 3px;height: 30px;font-size: 15px;" @click="cellClick(row,prop,column)">{{row[prop].value}}</a>
<el-link v-else :underline="false" @click="item.click(scope.row)">{{row[prop].value}}</el-link>
</template>
</cm-table-page>
</div>
... ...
... ... @@ -11,8 +11,6 @@ const configPage = () => {
dialogFlg.value = flg;
}
return {
showConfig: dialogFlg,
configObj:configPage,
... ... @@ -20,7 +18,6 @@ const configPage = () => {
}
}
export default {
name: 'resIndex',
template: '',
... ... @@ -28,6 +25,15 @@ export default {
'res-config': Vue.defineAsyncComponent(
() => myImport('components/page/res/treeconfig/index')
),
'rateComponents': Vue.defineAsyncComponent(
() => myImport('components/page/res/rateComponents/index')
),
'resNameComponents': Vue.defineAsyncComponent(
() => myImport('components/page/res/resNameComponents/index')
),
'statusComponents': Vue.defineAsyncComponent(
() => myImport('components/page/res/statusComponents/index')
),
},
data() {
return {
... ...