三维文件管理
This commit is contained in:
parent
c5aeef61bf
commit
74e23774b7
|
|
@ -0,0 +1,55 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询三维文件列表
|
||||
export function get3dFileList(data) {
|
||||
return request({
|
||||
url: '/background/back/area/getSwList',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
// 新增三维文件列表
|
||||
export function add3dFileItem(data) {
|
||||
return request({
|
||||
url: '/background/back/area/addSwFile',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 编辑三维文件列表
|
||||
export function update3dFileItem(data) {
|
||||
return request({
|
||||
url: '/system/sys/pro/editPro',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除三维文件列表
|
||||
export function delete3dFileItem(data) {
|
||||
return request({
|
||||
url: '/background/back/area/deleteSwFile',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 三维文件查看
|
||||
export function view3dFileItem(data) {
|
||||
return request({
|
||||
url: '/background/back/emerge/getFileDetails',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function downloadModelById(data) {
|
||||
return request({
|
||||
url: '/background/back/emerge/downLoadFile',
|
||||
method: 'get',
|
||||
responseType: 'blob',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
|
@ -91,10 +91,10 @@
|
|||
<el-input v-model="temp.areaName" placeholder="区域名称" :maxlength="50" />
|
||||
</el-form-item>
|
||||
<el-form-item label="标段工程:" prop="bidCode">
|
||||
<ProjectSelect :bind-value.sync="temp.bidCode" :bind-type.sync="currentProjectType" />
|
||||
<ProjectSelect :bind-type.sync="currentProjectType" :bind-value.sync="temp.bidCode" @change="handleProjectChange" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="currentProjectType === '线路'" label="杆塔ID:" prop="gtId">
|
||||
<GtSelect :bid-code="temp.bidCode" :bind-value.sync="temp.gtId" />
|
||||
<GtSelect ref="gtSelectRef" :bid-code="temp.bidCode" :bind-value.sync="temp.gtId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注:" prop="remarks">
|
||||
<el-input v-model="temp.remarks" placeholder="备注" :maxlength="200" />
|
||||
|
|
@ -272,6 +272,19 @@ export default {
|
|||
this.$refs['dataForm'].resetFields()
|
||||
this.temp = _.cloneDeep(defaultTmp)
|
||||
this.currentProjectType = ''
|
||||
},
|
||||
handleProjectChange(val) {
|
||||
const gtSelectRef = this.$refs.gtSelectRef
|
||||
this.$nextTick(() => {
|
||||
gtSelectRef.getList(() => {
|
||||
const gtList = gtSelectRef.options
|
||||
if (this.temp.areaId && !gtList.find(item => item.value === this.temp.gtId)) {
|
||||
this.temp.areaId = ''
|
||||
this.bidCode = ''
|
||||
this.gtId = ''
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,284 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<div class="filter-container">
|
||||
<el-input
|
||||
v-model="listQuery.keyWord"
|
||||
placeholder="关键字"
|
||||
style="width: 200px"
|
||||
class="filter-item"
|
||||
:maxlength="30"
|
||||
@keyup.enter.native="handleFilter"
|
||||
/>
|
||||
<el-button
|
||||
style="margin-left: 40px"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
@click="handleFilter"
|
||||
>
|
||||
查询
|
||||
</el-button>
|
||||
<el-button class="filter-item" style="margin-left: 10px" type="primary" @click="handleCreate">
|
||||
上传
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table
|
||||
:key="tableKey"
|
||||
v-loading="listLoading"
|
||||
:data="list"
|
||||
border
|
||||
fit
|
||||
highlight-current-row
|
||||
style="width: 100%"
|
||||
:max-height="tableHeight"
|
||||
>
|
||||
<el-table-column label="序号" align="center" width="80" type="index">
|
||||
<template scope="scope">
|
||||
<span>{{ (listQuery.pageNum - 1) * 10 + scope.$index + 1 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工程名称" align="center" prop="proName" />
|
||||
<el-table-column label="杆塔名称" align="center" prop="gtName" />
|
||||
<el-table-column label="上传日期" align="center" prop="createTime" />
|
||||
<el-table-column label="备注" align="center" prop="remarks" />
|
||||
<el-table-column label="三维文件数量" align="center" prop="fileNum">
|
||||
<template slot-scope="{ row }">
|
||||
<el-button type="text" size="mini" @click="handleView(row)">{{ row.fileNum }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
|
||||
<template slot-scope="{ row, $index }">
|
||||
<!-- <el-button type="text" size="mini" @click="handleView(row, $index)">查看</el-button>-->
|
||||
<el-button type="text" size="mini" @click="handleDelete(row, $index)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.pageNum"
|
||||
:limit.sync="listQuery.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<el-dialog append-to-body :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="600px" @closed="handleClosedModal">
|
||||
<el-form
|
||||
ref="dataForm"
|
||||
:rules="rules"
|
||||
:model="temp"
|
||||
label-position="right"
|
||||
label-width="120px"
|
||||
>
|
||||
<el-form-item label="标段编码:" prop="bidCode">
|
||||
<ProjectSelect :bind-type.sync="currentProjectType" :bind-value.sync="temp.bidCode" @change="handleProjectChange" />
|
||||
</el-form-item>
|
||||
<el-form-item v-show="currentProjectType === '线路'" label="杆塔ID:" prop="gtId">
|
||||
<GtSelect ref="gtSelectRef" :bid-code="temp.bidCode" :bind-value.sync="temp.gtId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注:" prop="remarks">
|
||||
<el-input v-model="temp.remarks" placeholder="备注" :maxlength="200" />
|
||||
</el-form-item>
|
||||
<el-form-item label="附件:" prop="addition">
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
:on-change="handleChangeFile"
|
||||
:on-remove="handleRemoveFile"
|
||||
action="#"
|
||||
multiple
|
||||
:auto-upload="false"
|
||||
:file-list="fileList"
|
||||
>
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false"> 关闭 </el-button>
|
||||
<el-button type="primary" @click="createData">
|
||||
提交
|
||||
</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<FileTable :component-visible.sync="fileModalVisible" :file-list="viewFileList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Pagination from '@/components/Pagination'
|
||||
|
||||
import _ from 'lodash/fp'
|
||||
import { add3dFileItem, delete3dFileItem, get3dFileList, view3dFileItem } from '@/api/basic/3dFile'
|
||||
import GtSelect from '@/views/device/sideband/components/GtSelect.vue'
|
||||
import ProjectSelect from '@/views/device/sideband/components/ProjectSelect.vue'
|
||||
import FileTable from '@/views/risk/emergency/components/FileTable.vue'
|
||||
|
||||
const defaultTmp = {
|
||||
gxId: '',
|
||||
bidCode: '',
|
||||
remarks: ''
|
||||
}
|
||||
export default {
|
||||
components: { FileTable, ProjectSelect, GtSelect, Pagination },
|
||||
data() {
|
||||
return {
|
||||
tableKey: 0,
|
||||
list: [],
|
||||
fileList: [],
|
||||
viewFileList: [],
|
||||
delFiles: [],
|
||||
total: 0,
|
||||
listLoading: false,
|
||||
currentProjectType: '',
|
||||
listQuery: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
keyword: ''
|
||||
},
|
||||
tableHeight: 650,
|
||||
temp: _.cloneDeep(defaultTmp),
|
||||
dialogFormVisible: false,
|
||||
fileModalVisible: false,
|
||||
dialogStatus: '',
|
||||
textMap: {
|
||||
update: '编辑',
|
||||
create: '上传'
|
||||
},
|
||||
rules: {
|
||||
bidCode: [{ required: true, message: '请选择', trigger: 'change' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
visible: {
|
||||
get() {
|
||||
return this.componentVisible
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('update:componentVisible', val)
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
visible(val) {
|
||||
if (val) {
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
this.listQuery.id = this.currentId
|
||||
get3dFileList(this.listQuery).then((response) => {
|
||||
this.list = response.rows
|
||||
this.total = response.total
|
||||
}).finally(() => {
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
// 查询
|
||||
handleFilter() {
|
||||
this.listQuery.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
// 新增
|
||||
handleCreate() {
|
||||
this.dialogStatus = 'create'
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
createData() {
|
||||
const reqData = new FormData()
|
||||
reqData.append('bidCode', this.temp.bidCode)
|
||||
reqData.append('gtId', this.temp.gtId)
|
||||
reqData.append('remarks', this.temp.remarks)
|
||||
this.fileList.forEach(item => {
|
||||
if (item.hasOwnProperty('raw')) {
|
||||
reqData.append('file[]', item.raw)
|
||||
}
|
||||
})
|
||||
add3dFileItem(reqData).then((response) => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: response.msg,
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
this.dialogFormVisible = false
|
||||
})
|
||||
},
|
||||
// 删除数据
|
||||
handleDelete(row, index) {
|
||||
this.$confirm(`确定要删除该数据吗?`, {
|
||||
type: 'warning',
|
||||
title: '操作提示',
|
||||
beforeClose: async(action, instance, done) => {
|
||||
if (action === 'confirm') {
|
||||
delete3dFileItem({ id: row.id }).then((response) => {
|
||||
done()
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: response.msg,
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
done()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
handleClosedModal() {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
this.temp = _.cloneDeep(defaultTmp)
|
||||
this.fileList = []
|
||||
this.delFiles = []
|
||||
},
|
||||
handleChangeFile(file, files) {
|
||||
this.fileList = files
|
||||
},
|
||||
handleRemoveFile(file, files) {
|
||||
if (!file.hasOwnProperty('raw')) {
|
||||
this.delFiles.push(file.fileId)
|
||||
}
|
||||
this.fileList = files
|
||||
},
|
||||
handleView(row) {
|
||||
this.viewFileList = []
|
||||
this.fileModalVisible = true
|
||||
view3dFileItem({ id: row.id, sourceType: '三维文件' }).then(res => {
|
||||
this.viewFileList = res.data.map(item => {
|
||||
const { fileName, fileId } = item
|
||||
return {
|
||||
name: fileName,
|
||||
fileId,
|
||||
url: null
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
handleProjectChange(val) {
|
||||
const gtSelectRef = this.$refs.gtSelectRef
|
||||
this.$nextTick(() => {
|
||||
gtSelectRef.getList(() => {
|
||||
const gtList = gtSelectRef.options
|
||||
if (this.temp.areaId && !gtList.find(item => item.value === this.temp.gtId)) {
|
||||
this.temp.areaId = ''
|
||||
this.bidCode = ''
|
||||
this.gtId = ''
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,229 @@
|
|||
<template>
|
||||
<el-dialog title="三维文件" :visible.sync="visible" width="800px" append-to-body custom-class="custom-modal">
|
||||
<div class="app-container">
|
||||
<div class="filter-container">
|
||||
<el-input
|
||||
v-model="listQuery.keyWord"
|
||||
placeholder="关键字"
|
||||
style="width: 200px"
|
||||
class="filter-item"
|
||||
:maxlength="30"
|
||||
@keyup.enter.native="handleFilter"
|
||||
/>
|
||||
<el-button
|
||||
v-waves
|
||||
style="margin-left: 40px"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
@click="handleFilter"
|
||||
>
|
||||
查询
|
||||
</el-button>
|
||||
<el-button v-waves class="filter-item" style="margin-left: 10px" type="primary" @click="handleCreate">
|
||||
上传
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
:key="tableKey"
|
||||
v-loading="listLoading"
|
||||
:data="list"
|
||||
border
|
||||
fit
|
||||
highlight-current-row
|
||||
style="width: 100%"
|
||||
:max-height="tableHeight"
|
||||
>
|
||||
<el-table-column label="序号" align="center" width="80" type="index">
|
||||
<template scope="scope">
|
||||
<span>{{ (listQuery.pageNum - 1) * 10 + scope.$index + 1 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="文件名称" align="center" prop="name" />
|
||||
<el-table-column label="上传日期" align="center" prop="time" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
|
||||
<template slot-scope="{ row, $index }">
|
||||
<el-button v-waves type="text" size="mini" @click="handleView(row, $index)">查看</el-button>
|
||||
<el-button v-waves type="text" size="mini" @click="handleDelete(row, $index)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.pageNum"
|
||||
:limit.sync="listQuery.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
<el-dialog append-to-body :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="600px" @closed="handleClosedModal">
|
||||
<el-form
|
||||
ref="dataForm"
|
||||
:rules="rules"
|
||||
:model="temp"
|
||||
label-position="right"
|
||||
label-width="120px"
|
||||
>
|
||||
<el-form-item label="附件:" prop="addition">
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
:on-change="handleChangeFile"
|
||||
:on-remove="handleRemoveFile"
|
||||
action="#"
|
||||
:auto-upload="false"
|
||||
:file-list="fileList"
|
||||
>
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button v-waves @click="dialogFormVisible = false"> 关闭 </el-button>
|
||||
<el-button v-waves type="primary" @click="createData">
|
||||
提交
|
||||
</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import waves from '@/directive/waves'
|
||||
import Pagination from '@/components/Pagination'
|
||||
|
||||
import _ from 'lodash/fp'
|
||||
import { add3dFileItem, delete3dFileItem, get3dFileList, update3dFileItem } from '@/api/basic/3dFile'
|
||||
|
||||
const defaultTmp = {
|
||||
gxId: ''
|
||||
}
|
||||
export default {
|
||||
name: '3dFileTable',
|
||||
components: { Pagination },
|
||||
directives: { waves },
|
||||
props: ['currentId', 'componentVisible'],
|
||||
data() {
|
||||
return {
|
||||
tableKey: 0,
|
||||
list: [],
|
||||
fileList: [],
|
||||
total: 0,
|
||||
listLoading: false,
|
||||
listQuery: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
keyword: ''
|
||||
},
|
||||
tableHeight: 650,
|
||||
temp: _.cloneDeep(defaultTmp),
|
||||
dialogFormVisible: false,
|
||||
dialogStatus: '',
|
||||
textMap: {
|
||||
update: '编辑',
|
||||
create: '上传'
|
||||
},
|
||||
rules: {
|
||||
gxName: [{ required: false, message: '请选择', trigger: 'change' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
visible: {
|
||||
get() {
|
||||
return this.componentVisible
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('update:componentVisible', val)
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
visible(val) {
|
||||
if (val) {
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// this.getList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
this.listQuery.id = this.currentId
|
||||
get3dFileList(this.listQuery).then((response) => {
|
||||
this.list = response.rows
|
||||
this.total = response.total
|
||||
}).finally(() => {
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
// 查询
|
||||
handleFilter() {
|
||||
this.listQuery.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
// 新增
|
||||
handleCreate() {
|
||||
this.dialogStatus = 'create'
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
createData() {
|
||||
const reqData = new FormData()
|
||||
this.fileList.forEach(item => {
|
||||
if (item.hasOwnProperty('raw')) {
|
||||
reqData.append('file[]', item.raw)
|
||||
}
|
||||
})
|
||||
add3dFileItem(reqData).then((response) => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: response.msg,
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
this.dialogFormVisible = false
|
||||
})
|
||||
},
|
||||
// 删除数据
|
||||
handleDelete(row, index) {
|
||||
this.$confirm(`确定要删除该数据吗?`, {
|
||||
type: 'warning',
|
||||
title: '操作提示',
|
||||
beforeClose: async(action, instance, done) => {
|
||||
if (action === 'confirm') {
|
||||
delete3dFileItem({ id: row.id }).then((response) => {
|
||||
done()
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: response.msg,
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
done()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
handleClosedModal() {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
this.temp = _.cloneDeep(defaultTmp)
|
||||
this.fileList = []
|
||||
},
|
||||
handleChangeFile(file, files) {
|
||||
this.fileList = files
|
||||
},
|
||||
handleRemoveFile(file, files) {
|
||||
this.fileList = files
|
||||
},
|
||||
handleView(row) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
<el-table
|
||||
:key="tableKey"
|
||||
v-loading="listLoading"
|
||||
:data="list"
|
||||
:data="fileList"
|
||||
border
|
||||
fit
|
||||
highlight-current-row
|
||||
|
|
@ -25,13 +25,13 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.pageNum"
|
||||
:limit.sync="listQuery.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<!-- <pagination-->
|
||||
<!-- v-show="total > 0"-->
|
||||
<!-- :total="total"-->
|
||||
<!-- :page.sync="listQuery.pageNum"-->
|
||||
<!-- :limit.sync="listQuery.pageSize"-->
|
||||
<!-- @pagination="getList"-->
|
||||
<!-- />-->
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
|
@ -40,7 +40,6 @@
|
|||
import Pagination from '@/components/Pagination'
|
||||
|
||||
import { downloadFile } from '@/utils/download'
|
||||
import { exportCarAccessRecord, getCarAccessRecord } from '@/api/car-man/car'
|
||||
import { downloadFileById } from '@/api/risk/emergency'
|
||||
|
||||
export default {
|
||||
|
|
@ -70,17 +69,7 @@ export default {
|
|||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
visible(val) {
|
||||
if (val) {
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.list = this.fileList
|
||||
},
|
||||
// 查询
|
||||
handleFilter() {
|
||||
this.listQuery.pageNum = 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue