|
|
@@ -9,7 +9,12 @@
|
|
|
<div class="flex flex-center flex-justify-between mt-20">
|
|
|
<span class="bold font-18 main-color">进度描述</span>
|
|
|
<div class="flex flex-center">
|
|
|
- <base-button type="0" title="批量导出" icon="upload" />
|
|
|
+ <base-button
|
|
|
+ type="0"
|
|
|
+ title="批量导出"
|
|
|
+ icon="upload"
|
|
|
+ @click="exportFile"
|
|
|
+ />
|
|
|
<base-button
|
|
|
class="ml-10"
|
|
|
:title="btnTitle"
|
|
|
@@ -41,8 +46,8 @@
|
|
|
:option="option"
|
|
|
:table-loading="loading"
|
|
|
class="curd"
|
|
|
+ :before-open="beforeOpen"
|
|
|
@row-del="rowDel"
|
|
|
- @on-load="onLoad"
|
|
|
>
|
|
|
<template #menu="{ row }">
|
|
|
<el-button icon="Upload" type="primary" text @click="openFile(row)">
|
|
|
@@ -52,10 +57,24 @@
|
|
|
text
|
|
|
type="primary"
|
|
|
icon="Download"
|
|
|
- @click="projectReport(row)"
|
|
|
+ @click="fileDownload(row)"
|
|
|
>下载
|
|
|
</el-button>
|
|
|
</template>
|
|
|
+ <template #menu-right>
|
|
|
+ <div class="full-width">
|
|
|
+ <el-button
|
|
|
+ icon="el-icon-refresh"
|
|
|
+ circle
|
|
|
+ @click="detail"
|
|
|
+ ></el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #isuploaded="{ row }">
|
|
|
+ <div>
|
|
|
+ {{ row.isUploaded === 1 ? '已上传' : '' }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</avue-crud>
|
|
|
</div>
|
|
|
<!------现场图片------>
|
|
|
@@ -63,7 +82,16 @@
|
|
|
<div class="flex flex-center flex-justify-between mt-20">
|
|
|
<span class="bold font-18 main-color">施工现场图</span>
|
|
|
<div class="flex flex-center">
|
|
|
- <base-button type="0" title="上传" icon="upload" />
|
|
|
+ <base-button
|
|
|
+ type="0"
|
|
|
+ title="上传"
|
|
|
+ icon="upload"
|
|
|
+ @click="
|
|
|
+ openFile({
|
|
|
+ dispatchType: 4
|
|
|
+ })
|
|
|
+ "
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="mt-20">
|
|
|
@@ -132,11 +160,7 @@ export default {
|
|
|
progress: '',
|
|
|
info: null,
|
|
|
loading: false,
|
|
|
- srcList: [
|
|
|
- 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg',
|
|
|
- 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg',
|
|
|
- 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg'
|
|
|
- ],
|
|
|
+ srcList: [],
|
|
|
data: [
|
|
|
{
|
|
|
fileName: '支付情况表',
|
|
|
@@ -177,11 +201,12 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
label: '上传状态',
|
|
|
- prop: 'year'
|
|
|
+ prop: 'isUploaded',
|
|
|
+ slot: true
|
|
|
},
|
|
|
{
|
|
|
label: '上传时间',
|
|
|
- prop: 'year'
|
|
|
+ prop: 'createTime'
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
@@ -194,6 +219,21 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
detail() {
|
|
|
+ this.data = [
|
|
|
+ {
|
|
|
+ fileName: '支付情况表',
|
|
|
+ dispatchType: 1
|
|
|
+ },
|
|
|
+ {
|
|
|
+ fileName: '工程完工月报表',
|
|
|
+ dispatchType: 2
|
|
|
+ },
|
|
|
+ {
|
|
|
+ fileName: '工程量清单',
|
|
|
+ dispatchType: 3
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ this.srcList.length = 0
|
|
|
const data = {
|
|
|
projectId: this.projectId,
|
|
|
year: this.year,
|
|
|
@@ -209,7 +249,18 @@ export default {
|
|
|
})
|
|
|
this.$api.dispatch.homeFile(data).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
- console.log(res)
|
|
|
+ const tmp = res.data
|
|
|
+ this.data = this.data.map(sub => {
|
|
|
+ const item = tmp.find(ele => ele.type === sub.dispatchType)
|
|
|
+ if (item) {
|
|
|
+ sub = Object.assign(sub, item)
|
|
|
+ }
|
|
|
+ return sub
|
|
|
+ })
|
|
|
+ const img = tmp.find(ele => ele.type === 4)
|
|
|
+ if (img) {
|
|
|
+ this.srcList = img.fileFolders.map(ele => ele.url)
|
|
|
+ }
|
|
|
} else {
|
|
|
this.$message.error(res.msg)
|
|
|
}
|
|
|
@@ -225,7 +276,8 @@ export default {
|
|
|
projectId: this.projectId,
|
|
|
year: this.year,
|
|
|
month: this.month,
|
|
|
- processDescribe: this.progress
|
|
|
+ processDescribe: this.progress,
|
|
|
+ id: this.info ? this.info.id : ''
|
|
|
}
|
|
|
this.$api.dispatch.saveOrUpdate(data).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
@@ -238,25 +290,49 @@ export default {
|
|
|
}
|
|
|
this.btnTitle = this.btnTitle === '编辑' ? '保存' : '编辑'
|
|
|
},
|
|
|
+ beforeOpen(done, type) {
|
|
|
+ if (type === 'view') {
|
|
|
+ this.previewFile(this.form.fileIds)
|
|
|
+ } else if (type === 'edit') {
|
|
|
+ console.log(this.form)
|
|
|
+ this.$router.push({
|
|
|
+ path: '/home/files',
|
|
|
+ query: {
|
|
|
+ id: this.form.fileFolders[0].parentId,
|
|
|
+ projectId: this.projectId
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ done()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ previewFile(id) {
|
|
|
+ if (id.length === 0) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const routeData = this.$router.resolve({
|
|
|
+ path: '/home/file_detail',
|
|
|
+ query: { id }
|
|
|
+ })
|
|
|
+ window.open(routeData.href, '_blank')
|
|
|
+ },
|
|
|
rowDel(row, index, done) {
|
|
|
this.$confirm('确定将选择数据删除?', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- return this.$api.inspect.remove({ ids: row.id })
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '操作成功!'
|
|
|
+ }).then(() => {
|
|
|
+ this.$api.project
|
|
|
+ .fileRemove({ ids: row.fileIds, type: 2 })
|
|
|
+ .then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success(res.msg)
|
|
|
+ this.detail()
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
})
|
|
|
- // 数据回调进行刷新
|
|
|
- done(row)
|
|
|
- this.onLoad()
|
|
|
- })
|
|
|
- .catch(() => {})
|
|
|
+ })
|
|
|
},
|
|
|
openFile(row) {
|
|
|
const routeUrl = this.$router.resolve({
|
|
|
@@ -264,10 +340,45 @@ export default {
|
|
|
query: {
|
|
|
id: this.projectId,
|
|
|
dispatchType: row.dispatchType,
|
|
|
- type: 1
|
|
|
+ type: 2,
|
|
|
+ year: this.year,
|
|
|
+ month: this.month
|
|
|
}
|
|
|
})
|
|
|
window.open(routeUrl.href, '_blank')
|
|
|
+ },
|
|
|
+ fileDownload(res) {
|
|
|
+ window.open(res.fileFolders[0].url)
|
|
|
+ },
|
|
|
+ exportFile() {
|
|
|
+ this.$message.success('开始下载,请稍后...')
|
|
|
+ const data = {
|
|
|
+ projectId: this.projectId,
|
|
|
+ year: this.year,
|
|
|
+ month: this.month
|
|
|
+ }
|
|
|
+ this.$api.dispatch.exportFile(data).then(res => {
|
|
|
+ if (Object.hasOwn(res, 'code')) {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.download(res)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ download(res) {
|
|
|
+ const url = window.URL.createObjectURL(
|
|
|
+ new Blob([res], { type: 'application/octet-stream;charset=UTF-8' })
|
|
|
+ )
|
|
|
+ const link = document.createElement('a')
|
|
|
+ link.style.display = 'none'
|
|
|
+ link.href = url
|
|
|
+ const excelName = this.year + '年' + this.month + '月.zip'
|
|
|
+ link.setAttribute('download', excelName)
|
|
|
+ document.body.appendChild(link)
|
|
|
+ link.click()
|
|
|
+ link.remove()
|
|
|
+ this.diaType = -1
|
|
|
+ this.$message.success('导出成功')
|
|
|
}
|
|
|
}
|
|
|
}
|