<!--
|
* @Author: 李喆(开发组) lzhe@yxqiche.com
|
* @Date: 2025-08-11 09:25:36
|
* @LastEditors: 李喆(开发组) lzhe@yxqiche.com
|
* @LastEditTime: 2025-08-12 17:13:14
|
* @FilePath: /mdmweb/src/views/wel/gongkong.vue
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
-->
|
<template>
|
<div class="gongkongMain">
|
<div>
|
<el-tree :data="treeData" :props="defaultProps" node-key="id" :default-expand-all="true" @node-click="handleNodeClick" />
|
</div>
|
<div>
|
<el-row>
|
<el-col :span="6" style="margin-right: 12px;">
|
<el-input v-model="fileName" placeholder="文件名称"/>
|
</el-col>
|
<el-col :span="12">
|
<el-button type="primary" @click="onQuery">查询</el-button>
|
</el-col>
|
</el-row>
|
<el-table :data="treecFileData" style="width: 100%">
|
<el-table-column prop="name" label="名称" />
|
<el-table-column prop="updateTime" label="修改日期" />
|
<el-table-column prop="status" label="类型" />
|
<el-table-column fixed="right" label="操作" min-width="120">
|
<template #default="scope">
|
<el-button link type="primary" size="small" @click="fileView(scope.row)">查看</el-button>
|
<el-button link type="primary" size="small" @click="fileEdit(scope.row)">编辑</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<div class="paginationTree">
|
<el-pagination layout="prev, pager, next" :total="total" @size-change="sizeChange" @current-change="currentChange" />
|
</div>
|
</div>
|
</div>
|
<el-dialog v-model="fileDialogVisible" :title="fileOptionTitle" width="800">
|
<div><el-input v-model="fileContent" :rows="15" type="textarea" :disabled="fileOptionTitle == '查看'"/></div>
|
<template #footer>
|
<div class="dialog-footer">
|
<el-button @click="fileDialogVisible = false">关闭</el-button>
|
<el-button type="primary" @click="fileDialogComit" v-if="fileOptionTitle != '查看'">提交</el-button>
|
</div>
|
</template>
|
</el-dialog>
|
</template>
|
<script>
|
export default {
|
components: {},
|
data() {
|
return {
|
fileOptionTitle: "",
|
fileContent: "",
|
fileDialogVisible: false,
|
fileName: "",
|
treeData: [],
|
defaultProps: {
|
children: 'children',
|
label: 'name',
|
isLeaf: (data) => !data.hasChildren
|
},
|
treeData: [],
|
current: 1,
|
size: 10,
|
total: 0,
|
treecFileData: [],
|
TreeNode: {},
|
fileRow: {},
|
}
|
},
|
computed: {},
|
watch: {
|
|
},
|
methods: {
|
fileDialogComit() {
|
console.log(this.fileRow);
|
// this.loading = true;
|
// axios({
|
// url: '/blade-mdm/gkw/node/file-content',
|
// method: 'get',
|
// params: {id:row.id},
|
// }).then(
|
// res => {
|
// this.loading = false;
|
// this.fileDialogVisible = true;
|
// this.fileContent = res.data.data.replace(/\n/g, '<br>');
|
// }
|
// );
|
},
|
fileView(row) {
|
this.fileOptionTitle = "查看";
|
this.getFileContent(row);
|
},
|
fileEdit(row) {
|
this.fileOptionTitle = "编辑";
|
this.fileRow = {...row};
|
this.getFileContent(row);
|
},
|
getFileContent(row) {
|
this.loading = true;
|
axios({
|
url: '/blade-mdm/gkw/node/file-content',
|
method: 'get',
|
params: {id:row.id},
|
}).then(
|
res => {
|
this.loading = false;
|
this.fileDialogVisible = true;
|
this.fileContent = res.data.data.replace(/\n/g, '<br>');
|
}
|
);
|
},
|
onQuery() {
|
this.size = 10;
|
this.searchTable(this.TreeNode);
|
},
|
sizeChange(size) {
|
this.size = size;
|
this.treeLoad(this.TreeNode);
|
},
|
currentChange(current) {
|
this.current = current;
|
this.treeLoad();
|
},
|
handleNodeClick(TreeNode,b,c,d) {
|
this.fileName = "";
|
this.searchTable(TreeNode);
|
},
|
searchTable(TreeNode) {
|
this.TreeNode = {...TreeNode};
|
if(TreeNode.dirType == 'SEND' || TreeNode.dirType == 'REC' || TreeNode.dirType == 'TEMP') {
|
var obj = {
|
name: this.fileName,
|
dirType: TreeNode.dirType,
|
machineCode: TreeNode.machineCode,
|
current: this.current,
|
size: this.size
|
}
|
axios({
|
url: '/blade-mdm/gkw/node/file-page',
|
method: 'get',
|
params: obj
|
}).then(
|
res => {
|
this.treecFileData = res.data.data.records;
|
this.total = res.data.data.total;
|
}
|
)
|
}else {
|
return;
|
}
|
},
|
treeLoad () {
|
axios({
|
url: '/blade-mdm/gkw/node/load-tree',
|
method: 'get',
|
}).then(
|
res => {
|
this.treeData = res.data.data;
|
}
|
)
|
}
|
},
|
mounted() {
|
this.treeLoad();
|
}
|
};
|
</script>
|
|
<style lang="scss">
|
.gongkongMain {
|
display: flex;
|
padding: 0px;
|
margin: 0px 7px 10px 7px;
|
background-color: #fff;
|
border-top: 1px solid #ccc;
|
> div {
|
padding: 12px;
|
}
|
}
|
.gongkongMain > div:nth-child(1) {
|
width:25%;
|
border-right: 1px solid #ccc;
|
}
|
.gongkongMain div:nth-child(2) {
|
flex: 1;
|
}
|
.paginationTree {
|
margin-top: 12px;
|
display: flex;
|
justify-content: flex-end;
|
}
|
</style>
|