| | |
| | | <!-- |
| | | * @Author: 李喆(开发组) lzhe@yxqiche.com |
| | | * @Date: 2025-08-11 09:25:36 |
| | | * @LastEditors: 李喆(开发组) lzhe@yxqiche.com |
| | | * @LastEditTime: 2025-08-12 17:43:58 |
| | | * @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 :props="defaultProps" lazy @node-click="handleNodeClick" :load="treeLoad" node-key="id"/> |
| | | <el-tree :data="treeData" :props="defaultProps" node-key="id" :default-expand-all="false" :default-expanded-keys="defaultKeys" @node-click="handleNodeClick" /> |
| | | </div> |
| | | <div>内容</div> |
| | | <div> |
| | | <el-row> |
| | | <el-col :span="6" style="margin-right: 12px;"> |
| | | <el-input v-model="fileName" clearable 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="fileModifyTime" label="创建日期" /> |
| | | <el-table-column prop="fileModifyTime" label="修改日期" /> |
| | | <el-table-column prop="fileSizeDisplay" 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> |
| | | <el-button type="primary" text size="small" @click.stop="viewHistory(scope.row, scope.index)">修改记录</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div class="paginationTree"> |
| | | <el-pagination layout="prev, pager, next" :total="fileTotal" @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> |
| | | |
| | | <el-dialog title="修改记录" width="900" append-to-body v-model="viewHisModel"> |
| | | <avue-crud :addBtn="false" :option="optionHis" :table-loading="loadingHis" :data="dataHis" ref="crud" |
| | | @current-change="currentChangeHis" v-model:page="pageHis" @search-change="searchChangeHis" @size-change="sizeChangeHis" @refresh-change="refreshChangeHis" @on-load="onLoadHis"> |
| | | |
| | | <template #menu="scope"> |
| | | <!--<el-button type="primary" :disabled="scope.row.processExecuted==true" text size="default" @click.stop="cancelProcess(scope.row, scope.index)">撤销</el-button> --> |
| | | <el-button type="primary" text size="default" @click.stop="hisCompare(scope.row, scope.index)">比对</el-button> |
| | | </template> |
| | | |
| | | </avue-crud> |
| | | </el-dialog> |
| | | </template> |
| | | <script> |
| | | import { |
| | | getFileChangeList |
| | | } from '@/api/wel/changehis'; |
| | | import { pageHeaderEmits } from 'element-plus'; |
| | | export default { |
| | | components: {}, |
| | | data() { |
| | | return { |
| | | defaultKeys: [], |
| | | fileOptionTitle: "", |
| | | fileContent: "", |
| | | fileDialogVisible: false, |
| | | fileName: "", |
| | | treeData: [], |
| | | defaultProps: { |
| | | children: 'children', |
| | | label: 'name', |
| | | isLeaf: (data) => !data.hasChildren |
| | | }, |
| | | treeData: [] |
| | | current: 1, |
| | | size: 10, |
| | | fileTotal: 0, |
| | | treecFileData: [], |
| | | TreeNode: {}, |
| | | fileRow: {}, |
| | | loadingHis:false, |
| | | viewHisModel:false, |
| | | |
| | | queryHis:{}, |
| | | optionHis: { |
| | | addBtn: false, |
| | | editBtn: false, |
| | | delBtn: false, |
| | | columnBtn:false, |
| | | gridBtn:false, |
| | | refreshBtn:false, |
| | | labelWidth: 120, |
| | | emptyBtn: false, |
| | | searchShow: true, |
| | | searchEnter:true, |
| | | searchSpan: 4, |
| | | menu: true, |
| | | // selection: true, |
| | | column: [ |
| | | { |
| | | label: '修改人', |
| | | prop: 'name', |
| | | search: true, |
| | | searchType: 'input', |
| | | searchSpan:6, |
| | | hide: false, |
| | | viewDisplay: true, |
| | | }, |
| | | { |
| | | label: '修改时间', |
| | | prop: 'createTime', |
| | | type: 'datetime', |
| | | format: 'YYYY-MM-DD HH:mm:ss', |
| | | valueFormat: 'YYYY-MM-DD HH:mm:ss', |
| | | search: true, |
| | | searchSpan:12, |
| | | searchRange: true, |
| | | hide: false, |
| | | }, |
| | | ], |
| | | }, |
| | | dataHis:[], |
| | | pageHis: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | }, |
| | | |
| | | } |
| | | }, |
| | | computed: {}, |
| | |
| | | |
| | | }, |
| | | methods: { |
| | | treeLoad (node, resolve) { |
| | | // 如果是根节点(level=0),加载根节点数据 |
| | | const parentId = node.level === 0 ? 0 : node.data.id; |
| | | fileDialogComit() { |
| | | this.loading = true; |
| | | var obj = {parentId} |
| | | axios({ |
| | | url: '/blade-mdm/gkw/node/lazy-list', |
| | | method: 'get', |
| | | params: obj, |
| | | url: '/blade-mdm/gkw/node/file-save', |
| | | method: 'post', |
| | | params: {id:this.fileRow.id,content: this.fileContent}, |
| | | }).then( |
| | | res => { |
| | | resolve(res.data.data); |
| | | this.loading = false; |
| | | this.fileDialogVisible = false; |
| | | this.$message.success("操作成功"); |
| | | } |
| | | ).catch(() => resolve([])); |
| | | ); |
| | | }, |
| | | // getPre() { |
| | | // axios({ |
| | | // url: '/blade-mdm/gkw/node/lazy-list', |
| | | // method: 'get', |
| | | // params: {nodeId: this.nodeId} |
| | | // }).then( |
| | | // res => { |
| | | // this.treeData = res.data.data; }); |
| | | // }, |
| | | handleNodeClick(a,b,c,d) { |
| | | console.og(a,b,c,d) |
| | | } |
| | | fileView(row) { |
| | | this.fileOptionTitle = "查看"; |
| | | this.getFileContent(row); |
| | | }, |
| | | fileEdit(row) { |
| | | this.fileOptionTitle = "编辑"; |
| | | this.fileRow = {...row}; |
| | | this.getFileContent(row); |
| | | }, |
| | | viewHistory(row){ |
| | | console.log(row); |
| | | this.viewHisModel = true; |
| | | this.queryHis.machineFileId = row.id; |
| | | this.onLoadHis(); |
| | | }, |
| | | |
| | | searchChangeHis(params, done) { |
| | | let data = {} |
| | | console.log(params) |
| | | this.pageHis.currentPage = 1; |
| | | let fileId = this.queryHis.machineFileId; |
| | | params.createTimeBegin = params?.createTime?.[0] || ''; |
| | | params.createTimeEnd = params?.createTime?.[1] || ''; |
| | | data = { |
| | | createTimeBegin: params.createTimeBegin || undefined, |
| | | createTimeEnd: params.createTimeEnd || undefined, |
| | | name: params.name || undefined, |
| | | machineFileId:fileId, |
| | | } |
| | | this.queryHis = data |
| | | this.onLoadHis(); |
| | | done(); |
| | | }, |
| | | currentChangeHis(currentPage) { |
| | | this.pageHis.currentPage = currentPage; |
| | | this.onLoadHis(); |
| | | }, |
| | | sizeChangeHis(pageSize) { |
| | | this.pageHis.pageSize = pageSize; |
| | | }, |
| | | refreshChangeHis() { |
| | | this.onLoadHis(); |
| | | }, |
| | | hisCompare(){ |
| | | //文件比对 |
| | | }, |
| | | 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; |
| | | } |
| | | ); |
| | | }, |
| | | 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}; |
| | | |
| | | var obj = { |
| | | name: this.fileName, |
| | | dirType: TreeNode.dirType, |
| | | nodeType: TreeNode.nodeType, |
| | | nodeId: TreeNode.nodeType!='dir'?TreeNode.id:undefined, |
| | | 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.fileTotal = res.data.data.total; |
| | | } |
| | | ) |
| | | |
| | | }, |
| | | treeLoad () { |
| | | axios({ |
| | | url: '/blade-mdm/gkw/node/load-tree', |
| | | method: 'get', |
| | | }).then( |
| | | res => { |
| | | this.treeData = res.data.data; |
| | | var firstIndex = 0; |
| | | res.data.data.forEach((item,index)=> { |
| | | if(item.children.length != 0) { |
| | | firstIndex = index; |
| | | } |
| | | }) |
| | | //defaultKeys.push(item.id); |
| | | this.defaultKeys = [res.data.data[firstIndex].id]; |
| | | } |
| | | ) |
| | | },/* |
| | | sizeChange(size) { |
| | | this.sizeHis = size; |
| | | this.onLoad(); |
| | | },*/ |
| | | onLoadHis() { |
| | | this.loadingHis = true; |
| | | getFileChangeList(this.pageHis.currentPage, this.pageHis.pageSize, this.queryHis).then(res => { |
| | | const data = res.data.data |
| | | |
| | | this.pageHis.total = data.total; |
| | | |
| | | this.dataHis = data.records; |
| | | this.loadingHis = false; |
| | | }, () => { |
| | | this.dataHis = []; |
| | | this.loadingHis = false; |
| | | }).catch(err => { |
| | | console.log(err) |
| | | this.dataHis = []; |
| | | this.loadingHis = false; |
| | | }); |
| | | }, |
| | | }, |
| | | mounted() { |
| | | //this.getPre(); |
| | | //判断版本 0:涉密网,1:工控网; |
| | | // axios({url: '/blade-mdm/system/param/getValue?paramKey=networkType',method: 'get'}).then(res => { |
| | | // if(res.data.data === "0") { |
| | | // this.isSM = true; |
| | | // }else { |
| | | // this.getPre(); |
| | | // } |
| | | // } |
| | | // ); |
| | | this.treeLoad(); |
| | | } |
| | | }; |
| | | </script> |
| | |
| | | .gongkongMain div:nth-child(2) { |
| | | flex: 1; |
| | | } |
| | | .paginationTree { |
| | | margin-top: 12px; |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | } |
| | | </style> |