gaoshp
2024-06-23 f40836bbcd74b931b332a1c262e6776af1e4cc14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!--
 * @Date: 2024-05-26 21:50:26
 * @LastEditors: Sneed
 * @LastEditTime: 2024-06-12 23:57:38
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/dnc/craft/document/Children.vue
-->
<template>
    <div>
        <el-tabs v-model="activeName" type="card" class="demo-tabs" @tab-click="handleClick">
            <el-tab-pane label="程序" name="1">
                <el-button type="primary" @click="addFile(1)">添加文件</el-button>
                <el-table :data="tableData" style="width: 100%">
                    <el-table-column label="文件名" prop="filename" width=""></el-table-column>
                    <el-table-column label="文件大小" prop="contentLength" width=""></el-table-column>
                    <el-table-column label="文件类型" prop="suffix" width=""></el-table-column>
 
                    <el-table-column label="操作" prop="" width="">
                        <template #default="scope">
                            <el-button-group>
                                <el-popconfirm v-if="!scope.row.isSet" title="确定删除吗?"
                                    @confirm="table_del(scope.row, scope.$index)">
                                    <template #reference>
                                        <el-button text type="primary" size="small">删除</el-button>
                                    </template>
                                </el-popconfirm>
                            </el-button-group>
                        </template>
                    </el-table-column>
                </el-table>
            </el-tab-pane>
            <el-tab-pane label="文档" name="2">
                <el-button type="primary" @click="addFile(2)">添加文件</el-button>
                <el-table :data="tableData1" style="width: 100%">
                    <el-table-column label="文件名" prop="filename" width=""></el-table-column>
                    <el-table-column label="文件大小" prop="contentLength" width=""></el-table-column>
                    <el-table-column label="文件类型" prop="suffix" width=""></el-table-column>
 
                    <el-table-column label="操作" prop="" width="">
                        <template #default="scope">
                            <el-button-group>
                                <el-popconfirm v-if="!scope.row.isSet" title="确定删除吗?"
                                    @confirm="table_del(scope.row, scope.$index)">
                                    <template #reference>
                                        <el-button text type="primary" size="small">删除</el-button>
                                    </template>
                                </el-popconfirm>
                            </el-button-group>
                        </template>
                    </el-table-column>
                </el-table>
            </el-tab-pane>
        </el-tabs>
        <File ref="file" @success="success"></File>
    </div>
 
</template>
 
<script>
import File from './File.vue'
export default {
    components: {
        File
    },
    props: {
        list: {
            type: Array,
            default() {
                return []
            }
        },
        id: {
            type: String,
        }
    },
    computed: {
        tableData() {
            return this.list.filter(v => v.fileType === 1)
        },
        tableData1() {
            return this.list.filter(v => v.fileType === 2)
        }
    },
    data() {
        return {
            activeName: '1',
        }
    },
    methods: {
        addFile(fileType) {
            this.$refs.file.open(fileType, this.id)
        },
        handleClick() {
 
        },
        table_del(row) {
            this.$HTTP.delete(`/api/blade-dnc/dnc-art-file/remove`, {}, { data: [row.id] }).then(res => {
                if (res.success) {
                    this.$emit('delete')
                }
            })
        },
        success() {
            this.$emit('success')
        }
    }
}
</script>
 
<style lang="scss" scoped></style>