Authored by 王涛

优化记录模板以及文档管理

... ... @@ -44,7 +44,7 @@
<i class="iconfont icon-icon--download"></i>
下载
</el-button>
<el-button :size="$global.elementSize" @click="showFolder(true,true)" v-if="!canAddFolder">
<el-button :size="$global.elementSize" @click="showFolder(true,true)" v-if="canAddFolder">
<i class="iconfont icon-weidaqiadewenjianjia"></i>
新增文件夹
</el-button>
... ... @@ -79,14 +79,6 @@
</div>
<div v-if="activeBtn == 'view'" style="background-color: white" :style="{'height':(height -50) +'px','max-height':(height -50) + 'px','overflow':'auto'}">
<div style="text-align: left;margin: 6px;border-bottom: solid 1px #F2F6FC;padding-bottom: 5px;">
<!--
<span v-for="(item,index) in historyNode">
<el-link type="primary" @click="clickTopNav(item,index)" style="margin-left: 5px">
<i class="el-icon-arrow-right"></i>&nbsp;{{item[props.label]}}
</el-link>
</span>
-->
<el-tag v-for="(item,index) in historyNode" :size="$global.elementSize" :key="item.id" closable
@close="tagHandleClose(index)" @click="clickTopNav(item,index)"
:type="item.id == currentNodeData.id ? 'success' :'info' "
... ... @@ -98,9 +90,6 @@
<div v-for="file in dataList" style="width: 120px;margin: 10px;position: relative">
<div style="position: absolute;right: 5px">
<el-checkbox v-model="file.checked" label="" :size="$global.elementSize"></el-checkbox>
<!--<el-link type="primary" :underline="false" @click="getFile(file)" style="margin-left: 5px">
<i class="iconfont icon-icon&#45;&#45;download"></i>
</el-link>-->
</div>
<el-link type="primary" :underline="false" @click="getFile(file)">
<i class="iconfont "
... ... @@ -108,8 +97,9 @@
style="font-size: 50px;margin-right: 10px;"/>
</el-link>
<br/>
<el-link type="info" :underline="false" @click="getFile(file)">
{{file.fileName}}
<el-link type="info" :underline="false" @click="reNameFile(file,false)" >
<span v-if="!reNameFileFlg[file.id]">{{file.fileName}}</span>
<el-input :autofocus="true" v-if="reNameFileFlg[file.id]" placeholder="输入文件名" v-model="file.fileName" @blur="reNameFile(file,true)"></el-input>
</el-link>
</div>
<div v-if="dataList.length == 0" style=" text-align: center; width: 100%;">
... ... @@ -162,6 +152,6 @@
@hideDialog="showUserDialog"></cm-userright>
<cm-upload :showDialogVisible="showUploadDialogVisible" @callback="uploadCallBack" @hideDialog="showUploadFile"
:type="currentNodeData.docType" :docNo="currentNodeData.docNo"
type="user" :docNo="currentNodeData.docNo"
:category="currentNodeData.id"></cm-upload>
</div>
... ...
... ... @@ -36,6 +36,11 @@ export default {
type: Boolean,
default: true
},
// 是否是回收站
isRecycle: {
type: Boolean,
default: false
},
},
data() {
... ... @@ -190,8 +195,16 @@ export default {
let keyWord = Vue.ref('');
// 左侧树
let getTree = () => {
// 查询条件
let url = `/inspection-report/file/document/tree`;
if(props.isRecycle){
url = `/inspection-report/file/document/tree/recycle`;
}
proxy.$http.get("/inspection-report/file/document/tree", {}, function (res) {
if (res && res.data) {
treeData.value = res.data;
... ... @@ -218,8 +231,12 @@ export default {
types: props.types.join(','),
docIds:docIds
}
let url = `/inspection-report/file/document/list`;
if(props.isRecycle){
url = `/inspection-report/file/document/recycle`;
}
// 加载列表
proxy.$http.get(`/inspection-report/file/document/list`, params, function (res) {
proxy.$http.get(url , params, function (res) {
if (res && res.data) {
dataList.value = res.data;
}
... ... @@ -504,7 +521,7 @@ export default {
* @param index
*/
let clickTopNav = (item,index) =>{
let arr = historyNode.value;
// let arr = historyNode.value;
// // 删除当前节点后面的路径
// arr.filter(function (v,i) {
// if(i > index){
... ... @@ -516,6 +533,42 @@ export default {
getPage(item.id);
}
// 文件更名
let reNameFileFlg = Vue.ref({});
let reNameFile = (item,flg) =>{
let docType = item.docType;
if(!flg){
if(docType == 'user'){
reNameFileFlg.value[item.id] = true;
} else {
proxy.$global.showMsg("节点名称不能修改!","warning");
}
return;
}
if(docType == 'user'){
let type = item.type;
let url = `/inspection-report/file/rename/doc`;
if(type == 'folder'){
url = `/inspection-report/file/rename/user`;
}
// 执行改名
proxy.$http.get(url, {id:item.id,name:item.fileName}, function (res) {
if (res && res.success) {
proxy.$global.showMsg('修改成功!');
} else {
let msg = res.msg;
if(msg){
proxy.$global.showMsg(msg, 'warning');
}
}
})
reNameFileFlg.value[item.id] = false;
}
}
/**
* 挂载完
... ... @@ -581,7 +634,9 @@ export default {
clickTopNav,
tagHandleClose,
isAdmin
isAdmin,
reNameFile,
reNameFileFlg
}
}
... ...
<div>
<div >
<!-- 表格-->
<el-table :border="showBorder" v-loading="loading" :data="dataList" stripe header-row-class-name="tbl-header-class" :height="height"
style="width: 100%;margin: 0px 0px;">
... ...
... ... @@ -21,7 +21,6 @@ Promise.all([
.use(vant.Lazyload) // 加载vant
// 全局注册公共组件
// 下拉列表资源树
.component('cm-res-type-tree-input', Vue.defineAsyncComponent(() => myImport('components/common/inputrestypetree/index')))
// 机房下拉
... ... @@ -39,6 +38,25 @@ Promise.all([
// 文档管理
.component('cm-document',Vue.defineAsyncComponent(() => myImport('components/common/document/index')));
// // 自定义指令
// app.directive('permissions', {
// // 当被绑定的元素插入到 DOM 中时……
// mounted(el, binding, vnode) {
// debugger
// let p = sessionStorage.getItem('permissions')
// let val = binding.value;
// if (p && val) {
// let arr = p.split(',');
//
// if (arr.indexOf(val) == -1) {
// // 删除元素
// el.parentNode && el.parentNode.removeChild(el)
// }
// }
// }
// })
app.config.globalProperties.$global = res[3].default
app.config.globalProperties.$http = res[4].default
app.mount('#app'); // 挂载Vue的app实例
... ...
... ... @@ -6,10 +6,16 @@ let http = {
!obj.length;
return isjson;
},
reqErr: function (status) {
if (status && status == '401') {
// 登录超时,刷新当前页面===>跳转到登录页面
window.location.reload();
reqErr: function (xhr) {
try{
let isUnauthorized = xhr.statusText == 'Unauthorized'
if (isUnauthorized || (xhr && xhr.responseJSON && xhr.responseJSON.resp_code && xhr.responseJSON.resp_code == '401')) {
// 登录超时,刷新当前页面===>跳转到登录页面
// window.location.reload();
window.top.location.href = localStorage.getItem('loginUrl');
}
}catch (e){
}
},
post: function (requestUrl, data, callback, errFunc,showLoadding) {
... ... @@ -47,7 +53,7 @@ let http = {
errFunc();
}
console.log("==>", requestUrl, xhr, textStatus)
http.reqErr(textStatus.status);
http.reqErr(xhr);
},
success: function (data, textStatus, jqXHR) {
if (callback) {
... ... @@ -93,7 +99,7 @@ let http = {
loading.close();
}
console.log("==>", requestUrl, xhr, textStatus)
http.reqErr(textStatus.status);
http.reqErr(xhr);
if (errFunc) {
errFunc();
... ...
<title>文档管理回收</title>
<iframe src="/vue3/index.html#/documentRecycle" class="layadmin-iframe" style="height: 99.5%!important;"/>
... ...
<div class="container tree-config" :style="{'height':height+'px','max-height':height+'px','overflow':'hidden','padding':'0px'}">
<el-row :gutter="5">
<el-col :span="4" >
<div class="card-item">
<div class="filter-view">
<el-input v-model="filterText" size="samll" placeholder="请输入关键字" />
</div>
<div :style="{'height':height+'px','max-height':(height - 54)+'px','overflow':'auto','padding':'0px'}">
<el-tree ref="tree" style="padding:6px;" :props="props" :data="treeData" node-key="id" default-expand-all :expand-on-click-node="false">
<template #default="{ node, data }">
<div class="tree-node">
<div class="tree-node-label">{{ node.label }}</div>
<div class="tree-node-tools">
<a @click="append(data)">
<i class="el-icon-plus"></i>
</a>
<a @click="remove(node, data)">
<i class="el-icon-delete"></i>
</a>
</div>
</div>
</template>
</el-tree>
</div>
</div>
</el-col>
<el-col :span="20" >
<div class="card-item">
<div style="padding: 3px 6px;">
<el-button type="primary" @click="showDialog">添加</el-button>
<span class="iconfont icon-wenjianjia"></span>
</div>
<el-table :data="tableData" style="width: 100%">
<el-table-column fixed prop="date" label="Date" width="150" />
<el-table-column prop="name" label="Name" width="120" />
<el-table-column prop="state" label="State" width="120" />
<el-table-column prop="city" label="City" width="120" />
<el-table-column prop="address" label="Address" width="600" />
<el-table-column prop="zip" label="Zip" width="120" />
<el-table-column fixed="right" label="Operations" width="120">
<template #default>
<el-button type="text" size="small" @click="handleClick">Detail</el-button>
<el-button type="text" size="small">Edit</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-col>
</el-row>
<el-row :gutter="5" >
<el-col :span="3" >
<div class="cm-card" :style="{'min-height':height+'px','height':'100%'}">
<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" :default-expanded-keys="[1]" node-key="id" @node-click="handleConfigNodeClick"/>
</div>
</el-col>
<el-col :span="21" >
<div class="cm-card" :style="{'min-height':height+'px','height':'100%'}" >
<el-dialog top="2vh" :title="dialog.title" v-model="dialogVisible" custom-class="config-dialog" width="80%" destroy-on-close>
<el-tabs v-model="dialog.activeName" @tab-click="handleClick">
<el-tab-pane label="基本信息" name="jbxx">
</el-tab-pane>
<el-tab-pane label="基本信息1" name="jbxx1">
</el-tab-pane>
<el-tab-pane label="基本信息2" name="jbxx2">
</el-tab-pane>
</el-tabs>
</el-dialog>
<cm-table-page :columns="columns" :dataList="dataList" @loaddata="getPage" :showIndex="true"
:showBorder="true" :currentPage="currentPage" :loading="false"
:showPage="false" :height="(height - 20)">
<template #default="{row,prop,column}">
<span v-if="prop == 'resListId'" >{{currentNode.label}}</span>
<div v-else>
<div v-if="['showUsers'].indexOf(prop) != -1">
showUsers
</div>
<div v-else-if="['colSort','colWidth'].indexOf(prop) != -1">
<el-input @blur="changeProperty(row,prop,column)" type="number" size="small" placeholder="请填写"
v-model="row[prop]">
<!--<template #suffix>
<i class="el-icon-edit"/>
</template>-->
</el-input>
</div>
<div v-else-if="['colIsTd','isQuery','isFilter','status'].indexOf(prop) != -1">
<!-- 展示下拉选项 -->
<el-select placeholder="请选择" size="small" style="width: 100%"
@change="changeProperty(row,prop,column)" v-model="row[prop]" :multiple="false"
collapse-tags clearable filterable placeholder="请选择">
<el-option label="是" :value="0"> </el-option>
<el-option label="否" :value="1"> </el-option>
</el-select>
</div>
<div v-else-if="['colType'].indexOf(prop) != -1">
<el-select placeholder="选择类型" size="small" style="width: 100%"
@change="changeProperty(row,prop,column)" v-model="row.colType" :multiple="false"
collapse-tags clearable filterable placeholder="请选择">
<el-option v-for="(value,key) in colTypes" :key="index"
:label="value"
:value="key">
</el-option>
</el-select>
</div>
<div v-else-if="['colTypeQueryFields'].indexOf(prop) != -1">
colTypeQueryFields
</div>
<el-dialog top="2vh" title="添加节点" v-model="addDialogVisible" custom-class="config-dialog" width="80%" destroy-on-close>
{{data}}
</el-dialog>
<div v-else>
<el-input @blur="changeProperty(row,prop,column)" size="small" placeholder="请填写"
prefix-icon="el-icon-edit" v-model="row[prop]">
<!--<template #suffix>
<i class="el-icon-loading"/>
<i class="el-icon-edit"/>
</template>-->
</el-input>
</div>
</div>
</div>
</template>
</cm-table-page>
</div>
</el-col>
</el-row>
... ...
/**
* 配置页面编辑属性
* @returns {{editColProps: {}}}
*/
let configPageEdit = () =>{
// 编辑属性
let editColProps = Vue.ref({});
// 配置行编辑
let changeProperty = (row,prop,column) =>{
}
return {
editColProps,changeProperty
}
}
export default {
name: 'treeconfig',
name: 'resConfigIndex',
template: '',
components: {},
components: {
'property-edit': Vue.defineAsyncComponent(
() => myImport('components/page/assets/propertyedit/index')
),
},
data() {
return {
props : {
label:'title',
children:'children'
props: {
label: 'label',
children: 'children'
}
}
},
setup() {
let height = Vue.ref(window.innerHeight - 130);
const filterText = Vue.ref('');
const {proxy} = Vue.getCurrentInstance();
const treeData = Vue.ref([]);
const tableData = Vue.ref([]);
let treeNodeData = Vue.ref({});
const dialog = Vue.ref({
title: '',
activeName: ''
});
const dialogVisible = Vue.ref(false);
const addDialogVisible = Vue.ref(false);
// 添加树节点
let append = (data) => {
treeNodeData.value = data;
addDialogVisible.value = true;
// const newChild = {
// id: 1111,
// title: 'testtest',
// children: []
// }
// if (!data.children) {
// data.children = []
// }
// data.children.push(newChild)
// this.dataSource = [...this.dataSource]
}
// 删除树节点
let remove = (node, data) => {
const parent = node.parent
const children = parent.data.children || parent.data
const index = children.findIndex((d) => d.id === data.id)
children.splice(index, 1)
this.dataSource = [...this.dataSource]
}
let height = Vue.ref((window.innerHeight - 10) * 0.8);
let currentNode = Vue.ref({});
let treeData = Vue.ref([]);
// 筛选
let filterNode = (value) => {
if (!value) return true
let arr = data.filter(function (v) {
if (v.label.indexOf(value) != -1) {
return v;
}
})
console.log(arr);
return arr;
}
// 弹框
let showDialog = () => {
dialogVisible.value = true;
}
let dataList = Vue.ref([]);
let columns = Vue.ref([]);
let colTypes = Vue.ref({});
// 调用接口
// 获取左侧树结构
let loadTree = () => {
proxy.$http.get("/api-web/home/resType/getTree?notExist=machineroom&table=resources&exist=HOST_MINICOMPUTER_SERVER", {}, function (res) {
proxy.$http.get("/api-web/v32/res/list/config/tree", {}, function (res) {
if (res && res.data) {
treeData.value = res.data
treeData.value = res.data
currentNode.value = res.data[0];
getConfigData();
}
});
}
// 监听编辑状态
Vue.watch(() => filterText.value, (newValue, oldVlaue) => {
proxy.$refs.tree.filter(newValue)
});
let getConfigData = () => {
if (currentNode.value) {
// 查询参数
let params = {
treeNodeId: currentNode.value.id
}
proxy.$http.get(`/api-web/v32/res/list/config`, params, function (res) {
if (res && res.object) {
columns.value = res.object.columns;
dataList.value = res.object.datas;
colTypes.value = res.object.colTypes;
}
});
}
}
let handleConfigNodeClick = (data) => {
if (data) {
currentNode.value = data;
getConfigData();
}
}
// 挂载完
Vue.onMounted(() => {
loadTree();
console.log('onMounted');
})
});
return {
height,
dataList,
columns,
colTypes,
treeData,
append,
remove,
filterText,
filterNode,
showDialog,
dialogVisible,
tableData,
dialog,
treeNodeData
currentNode,
handleConfigNodeClick,
changeProperty
}
}
}
... ...
... ... @@ -44,6 +44,11 @@ const routes = [{
component: () => myImport('views/documentationManagement/index')
},{
path: '/documentRecycle',
name: 'documentRecycle',
component: () => myImport('views/documentationManagement/documentRecycle')
},{
path: '/operationMaintenance',
name: 'operationMaintenance',
component: () => myImport('views/operationMaintenance/index')
... ...
export default {
name: 'documentationManagement',
template: '',
setup(props, {attrs, slots, emit}) {
const { proxy } = Vue.getCurrentInstance()
Vue.onMounted(() => {
})
return {
};
},
}
... ...
... ... @@ -10,23 +10,27 @@
</el-col>
<el-col :span="21" >
<div class="cm-card" :style="{'min-height':height+'px','height':'100%'}" >
<div style="height: 80px;text-align: left;width: 80%;margin-left: 10px;margin-top: 10px;">
<el-form :inline="true" :model="searchForm" class="demo-form-inline">
<el-form-item label="资源名称">
<el-input v-model="searchForm.resName" placeholder="请输入资源名称"></el-input>
</el-form-item>
<div style="height: 50px;text-align: left;margin-left: 10px;margin-top: 10px;display: flex">
<div style="width: calc(100% - 100px)">
<el-form :inline="true" :model="searchForm" class="demo-form-inline">
<el-form-item label="资源名称">
<el-input v-model="searchForm.resName" placeholder="请输入资源名称"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">查询</el-button>
</el-form-item>
</el-form>
</div>
<div style="padding: 3px 6px;text-align: right">
<el-button type="primary" @click="showConfigDialog(true)">配置</el-button>
<el-form-item>
<el-button @click="onSubmit">查询</el-button>
</el-form-item>
</el-form>
</div>
<div style="width: 100px">
<el-button type="primary" @click="showConfigDialog(true)">配置</el-button>
</div>
</div>
<cm-table-page :columns="obj.columns" :dataList="obj.maps" @loaddata="getPage" :showIndex="true"
:showBorder="true" :currentPage="currentPage" :total="total" :loading="false"
:showPage="true" :height="(height - 130)">
: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>
... ... @@ -48,17 +52,12 @@
{{cellDetail.row[cellDetail.prop]}}布局图
</div>
</div>
<!--<img v-if="cellDetail.prop == 'cabinetNo'" :src="cabinetNoSrc" @click="openCabinet(false)" style="width: 80%">
<img v-if="cellDetail.prop == 'resPositon'" src="/vue3/src/assets/images/res/img02.jpg" style="width: 80%">-->
<!--<div v-if="cellDetail.prop == 'cabinetNo'" :style="{'background-image':'url(/vue3/src/assets/images/res/img01.png)'}" > </div>
<div v-if="cellDetail.prop == 'resPositon'" :style="{'background-image':'url(/vue3/src/assets/images/res/img02.png)'}" > </div>-->
</template>
</cm-dialog>
<cm-dialog :title="dialogDetail.title" width="80%" :showDialogVisible="showConfig" :showFooter="false" @hidedialog="showConfigDialog" :showOkBtn="false" cancelText="关闭">
<cm-dialog :title="configObj.title" width="80%" :showDialogVisible="showConfig" :showFooter="false" @hidedialog="showConfigDialog" :showOkBtn="false" cancelText="关闭">
<template v-slot>
<res-config/>
</template>
</cm-dialog>
</div>
... ...
// 获取状态
// 资源配置
const configPage = () => {
// 展示配置弹框
let dialogFlg = Vue.ref(false);
let dialogDetail = Vue.ref({
let configPage = Vue.ref({
title: '资源属性配置',
});
let showConfigDialog = (flg) => {
dialogFlg.value = flg;
}
return {
showConfig: dialogFlg,
showConfigDialog,
dialogDetail
configObj:configPage,
showConfigDialog
}
}
export default {
name: 'resIndex',
template: '',
components: {
'tree-config': Vue.defineAsyncComponent(
'res-config': Vue.defineAsyncComponent(
() => myImport('components/page/res/treeconfig/index')
),
},
... ... @@ -73,7 +77,7 @@ export default {
let params = {
page: 1,
limit: 10,
treeNodId: currentNode.value.id,
treeNodeId: currentNode.value.id,
query: {}
}
proxy.$http.get(`/api-web/v32/res/list`, params, function (res) {
... ... @@ -111,9 +115,11 @@ export default {
} else {
cabinetNoSrc.value = "/vue3/src/assets/images/res/img03.jpg"
}
}
// 配置页面
const {showConfig, configObj, showConfigDialog} = configPage()
// 挂载完
Vue.onMounted(() => {
loadTree();
... ... @@ -122,8 +128,6 @@ export default {
})
// 配置页面
const {showConfig, showConfigDialog, dialogDetail} = configPage()
return {
currentNode,
... ... @@ -143,7 +147,7 @@ export default {
total,
// 配置页面
showConfig, showConfigDialog, dialogDetail,
showConfig, configObj, showConfigDialog
}
}
}
... ...