|
|
@@ -10,28 +10,42 @@
|
|
|
ref="crud"
|
|
|
v-model="form"
|
|
|
:before-open="beforeOpen"
|
|
|
- @row-del="rowDel"
|
|
|
- @row-save="rowSave"
|
|
|
- @row-update="rowUpdate"
|
|
|
- @on-load="onLoad"
|
|
|
>
|
|
|
+ <template #menu-right>
|
|
|
+ <el-button icon="Refresh" circle @click="getDetail"></el-button>
|
|
|
+ </template>
|
|
|
</avue-crud>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import api from '@/api/index.js'
|
|
|
+
|
|
|
export default {
|
|
|
name: 'info',
|
|
|
+ props: {
|
|
|
+ info: {
|
|
|
+ type: Object,
|
|
|
+ default: null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ info: {
|
|
|
+ handler(val) {
|
|
|
+ if (val) {
|
|
|
+ this.detail = val
|
|
|
+ this.fetchData(val.files)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ immediate: true
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
+ detail: null,
|
|
|
form: {},
|
|
|
- data: [
|
|
|
- {
|
|
|
- id: 3,
|
|
|
- prop: 'ooooo'
|
|
|
- }
|
|
|
- ],
|
|
|
+ data: [],
|
|
|
option: {
|
|
|
align: 'center',
|
|
|
menuAlign: 'center',
|
|
|
@@ -39,10 +53,11 @@ export default {
|
|
|
menuBtnTitle: '支付凭证',
|
|
|
size: 'mini',
|
|
|
addBtn: true,
|
|
|
+ delBtn: false,
|
|
|
addBtnText: '上传',
|
|
|
- editBtn: false,
|
|
|
+ editBtn: true,
|
|
|
+ editBtnText: '下载',
|
|
|
viewBtn: true,
|
|
|
- delBtn: true,
|
|
|
refreshBtn: false,
|
|
|
columnBtn: false,
|
|
|
labelWidth: 140,
|
|
|
@@ -50,15 +65,11 @@ export default {
|
|
|
column: [
|
|
|
{
|
|
|
label: '文件名称',
|
|
|
- prop: 'noticeType'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '上传状态',
|
|
|
- prop: 'noticeType'
|
|
|
+ prop: 'title'
|
|
|
},
|
|
|
{
|
|
|
label: '上传时间',
|
|
|
- prop: 'noticeType'
|
|
|
+ prop: 'createTime'
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
@@ -66,17 +77,57 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
beforeOpen(done, type) {
|
|
|
- console.log(type)
|
|
|
if (type === 'add') {
|
|
|
+ this.openFile()
|
|
|
+ } else if (type === 'view') {
|
|
|
+ this.previewFile(this.form)
|
|
|
+ } else if (type === 'edit') {
|
|
|
+ this.downLoad(this.form)
|
|
|
}
|
|
|
},
|
|
|
- openFile(row) {
|
|
|
+ /**
|
|
|
+ * 文件下载
|
|
|
+ * @param row
|
|
|
+ */
|
|
|
+ downLoad(row) {
|
|
|
+ window.open(row.url, '_blank')
|
|
|
+ },
|
|
|
+ previewFile(item) {
|
|
|
+ if (api.offices.includes(item.suffix)) {
|
|
|
+ const routeData = this.$router.resolve({
|
|
|
+ path: '/home/file_detail',
|
|
|
+ query: { id: item.fileId }
|
|
|
+ })
|
|
|
+ window.open(routeData.href, '_blank')
|
|
|
+ } else {
|
|
|
+ this.preList.length = 0
|
|
|
+ this.preList.push(item.url)
|
|
|
+ this.showImage = true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getDetail() {
|
|
|
+ this.$api.contract.detail({ id: this.info.id }).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.detail = res.data
|
|
|
+ this.fetchData(this.detail.files)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fetchData(files) {
|
|
|
+ this.data = files.map(ele => {
|
|
|
+ const file = ele.fileFolder
|
|
|
+ delete file.id
|
|
|
+ return Object.assign(ele, file)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ openFile() {
|
|
|
const routeUrl = this.$router.resolve({
|
|
|
path: '/home/details',
|
|
|
query: {
|
|
|
+ dispatchType: 1,
|
|
|
id: this.info.projectId,
|
|
|
- dispatchType: row,
|
|
|
- type: 4
|
|
|
+ type: 5,
|
|
|
+ contractId: this.info.id
|
|
|
}
|
|
|
})
|
|
|
window.open(routeUrl.href, '_blank')
|