Commit ba093436 authored by zhanglw's avatar zhanglw

文件锁

parent 1ae4ae2b
...@@ -3212,6 +3212,28 @@ var HttpReq = function(){ ...@@ -3212,6 +3212,28 @@ var HttpReq = function(){
responseType: 'blob' responseType: 'blob'
}) })
}, },
//开采管理-文件锁
isTheFileLocked: function(params){
return request({
url: '/api/miningManagement/isTheFileLocked?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
//开采管理-文件锁
setFileValidityPeriod: function(params){
return request({
url: '/api/miningManagement/setFileValidityPeriod?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
//开采管理-文件锁
deleteFileEditingTags: function(data){
return request({
url: '/api/miningManagement/deleteFileEditingTags',
method: 'delete',
data: data,
})
},
//开采管理-删除文件 //开采管理-删除文件
deleteExcelOrFbx: function(data){ deleteExcelOrFbx: function(data){
return request({ return request({
...@@ -3220,6 +3242,12 @@ var HttpReq = function(){ ...@@ -3220,6 +3242,12 @@ var HttpReq = function(){
data: data, data: data,
}) })
}, },
scQueryByUrl: function(params){
return request({
url: '/api/fileEditingRecord/queryByUrl?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
//后台首页指标 //后台首页指标
backgroundHomepage: function(params){ backgroundHomepage: function(params){
return request({ return request({
......
...@@ -43,13 +43,10 @@ ...@@ -43,13 +43,10 @@
<el-table-column prop="modificationTime" label="上传时间" align="center"></el-table-column> <el-table-column prop="modificationTime" label="上传时间" align="center"></el-table-column>
<el-table-column label="操作" align="center" fixed="right"> <el-table-column label="操作" align="center" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-if="query.type==='excel'" size="mini" type="text" icon="el-icon-view" <el-button v-if="query.type==='excel'" size="mini" type="text" icon="el-icon-view" @click="viewTable(scope.row)">编辑</el-button>
@click="viewTable(scope.row)">在线预览 <el-button size="mini" type="text" icon="el-icon-download" @click="downloadFile(scope.row)">下载</el-button>
</el-button>
<el-button size="mini" type="text" icon="el-icon-download" @click="downloadFile(scope.row)">下载
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="toDelete(scope.row)">删除</el-button> <el-button size="mini" type="text" icon="el-icon-delete" @click="toDelete(scope.row)">删除</el-button>
<!-- <el-progress type="dashboard" :percentage="scope.row.percentage||20" :color="colors"></el-progress>--> <el-button size="mini" type="text" icon="el-icon-tickets" @click="openLog(scope.row)">记录</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -71,8 +68,7 @@ ...@@ -71,8 +68,7 @@
<el-button type="primary" @click="updataEcxel">保存</el-button> <el-button type="primary" @click="updataEcxel">保存</el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog append-to-body :close-on-click-modal="false" :before-close="cancelForm" :visible.sync="uploadVisible" <el-dialog append-to-body :close-on-click-modal="false" :before-close="cancelForm" :visible.sync="uploadVisible" title="文件上传" width="560px">
title="文件上传" width="560px">
<el-form ref="form" :model="form" size="small" label-width="80px"> <el-form ref="form" :model="form" size="small" label-width="80px">
<!-- 上传文件 --> <!-- 上传文件 -->
<el-form-item label=""> <el-form-item label="">
...@@ -97,7 +93,22 @@ ...@@ -97,7 +93,22 @@
<el-button :loading="loading" type="primary" @click="upload">确认</el-button> <el-button :loading="loading" type="primary" @click="upload">确认</el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog append-to-body :close-on-click-modal="false" :before-close="cancelForm" :visible.sync="logVisible" title="编辑日志" width="800px">
<el-table :data="logData" border style="width:auto">
<el-table-column prop="nickName" label="编辑人" align="center"></el-table-column>
<el-table-column prop="phone" label="联系电话" align="center"></el-table-column>
<el-table-column prop="updateTime" label="编辑时间" align="center"></el-table-column>
<el-table-column prop="status" label="状态" align="center">
<template slot-scope="scope">
<span v-if="scope.row.status==='完成'" style="color:gray">{{scope.row.status}}</span>
<span v-else style="color:forestgreen">{{scope.row.status}}</span>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button @click="cancelForm">关闭</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
...@@ -111,15 +122,13 @@ export default { ...@@ -111,15 +122,13 @@ export default {
name: 'visitPeople', name: 'visitPeople',
data() { data() {
return { return {
colors: [{color: '#f56c6c', percentage: 20}, {color: '#e6a23c', percentage: 40}, { colors: [{color: '#f56c6c', percentage: 20}, {color: '#e6a23c', percentage: 40}, {color: '#5cb87a', percentage: 60}, {color: '#1989fa', percentage: 80}, {color: '#6f7ad3', percentage: 100}],
color: '#5cb87a',
percentage: 60
}, {color: '#1989fa', percentage: 80}, {color: '#6f7ad3', percentage: 100}],
title: '', title: '',
fileUploadApi: '', fileUploadApi: '',
headers: {'Authorization': getToken()}, headers: {'Authorization': getToken()},
visible: false, visible: false,
uploadVisible: false, uploadVisible: false,
logVisible: false,
loading: false, loading: false,
query: { query: {
type: 'excel', type: 'excel',
...@@ -137,7 +146,9 @@ export default { ...@@ -137,7 +146,9 @@ export default {
activeTab: 'Sheet1', activeTab: 'Sheet1',
excelTableData: [], excelTableData: [],
form: {}, form: {},
xs: null xs: null,
fileSocketTimer: null,
logData: []
} }
}, },
mounted() { mounted() {
...@@ -146,6 +157,14 @@ export default { ...@@ -146,6 +157,14 @@ export default {
}) })
}, },
methods: { methods: {
openLog(item) {
this.logVisible = true
HttpReq.truckDispatching.scQueryByUrl({url:item.url}).then((res) => {
if (res.code == 200) {
this.logData = res.data;
}
})
},
stox(wb) { stox(wb) {
var out = []; var out = [];
wb.SheetNames.forEach(function (name) { wb.SheetNames.forEach(function (name) {
...@@ -269,15 +288,21 @@ export default { ...@@ -269,15 +288,21 @@ export default {
}) })
}, },
viewTable(item) { viewTable(item) {
if (item.isLoading) { this.openFile = item
HttpReq.truckDispatching.isTheFileLocked({
url: this.openFile.url
}).then((res) => {
if (res.data) {
return this.$notify({ return this.$notify({
title: '正在下载该文件,请勿操作', title: '文件已被锁定,暂时无法编辑',
type: 'info' type: 'warning'
}) })
} } else {
this.openFile = item
this.visible = true this.visible = true
this.$nextTick(() => { this.reconnect();
this.fileSocketTimer = setInterval(() => {
this.reconnect();
}, 15000);
HttpReq.truckDispatching.downloadExcelOrFbx({url: item.url, type: this.query.type}).then((res) => { HttpReq.truckDispatching.downloadExcelOrFbx({url: item.url, type: this.query.type}).then((res) => {
if(!this.xs){ if(!this.xs){
Spreadsheet.locale('zh-cn'); Spreadsheet.locale('zh-cn');
...@@ -298,8 +323,12 @@ export default { ...@@ -298,8 +323,12 @@ export default {
this.xs.loadData(this.stox(wb)) this.xs.loadData(this.stox(wb))
}) })
}) })
}
}) })
}, },
reconnect() {
HttpReq.truckDispatching.setFileValidityPeriod({url: this.openFile.url}).then((res) => {})
},
toDelete(item) { toDelete(item) {
this.$confirm(`确认删除文件:${item.fileName}?`, '提示', { this.$confirm(`确认删除文件:${item.fileName}?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
...@@ -392,8 +421,17 @@ export default { ...@@ -392,8 +421,17 @@ export default {
}) })
}, },
cancelForm() { cancelForm() {
if (this.fileSocketTimer) {
HttpReq.truckDispatching.deleteFileEditingTags({
url: this.openFile.url
}).then((res) => {
clearInterval(this.fileSocketTimer);
this.fileSocketTimer = null;
})
}
this.visible = false this.visible = false
this.uploadVisible = false this.uploadVisible = false
this.logVisible = false
if (this.$refs.upload) { if (this.$refs.upload) {
this.$refs.upload.clearFiles() this.$refs.upload.clearFiles()
} }
...@@ -419,6 +457,12 @@ export default { ...@@ -419,6 +457,12 @@ export default {
this.loadData() this.loadData()
} }
}, },
beforeDestroy() {
if (this.fileSocketTimer) {
clearInterval(this.fileSocketTimer);
this.fileSocketTimer = null;
}
}
} }
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment