cuiqian2004
2025-07-10 2db331628bbf94deee446d6e172e98f4db474a33
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<template>
    <view class="uni-dataobj-item" @click.prevent.stop="triggerItem">
        <view class="uni-panel-title-info">
            
            <text class="uni-panel-title"><text class="uni-panel-icon fs-attach" v-if="firstLineIsAttach"></text>{{firstLineText}}</text>
        </view>
        <view class="uni-panel-title-info">
            <text class="uni-panel-desc"><text class="uni-panel-icon fs-attach" v-if="secondLineIsAttach"></text>{{secondLineText}}</text>
            <view class="uni-panel-row-buttons" v-if="rowButons">
                <view class="uni-panel-row-button" v-for="(item, index) in rowButons" :key="index"
                    :class="item.Style=='text' ? '':getIco(item)" @click.prevent.stop="clickButton(item)">
                    {{item.Style=='text' ? item.ShowName :''}}
                </view>
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        name: "dataobj-item",
        emits: ['clickItem', 'clickButton'],
        props: {
            rowButons: {
                type: Array,
                default () {
                    return [];
                }
            },
            dataObj: {
                type: Object,
                default () {
                    return {};
                }
            },
        },
        data() {
            return {}
        },
        computed: {
            firstLineIndex() {
                let curIndex = this.dataObj.ObjAttr.findIndex((obj, index, arr2) => {
                    return obj.Hidden != "1" && obj.Hidden != 1;
                })
                return curIndex
            },
            secondLineIndex() {
                let indexF = this.firstLineIndex
                let curIndex = this.dataObj.ObjAttr.findIndex((obj, index, arr2) => {
                    return obj.Hidden != "1" && obj.Hidden != 1 && index > indexF;
                })
                return curIndex
            },
 
            firstLineText() {
                if (this.firstLineIndex > -1) {
                    return this.dataObj.ObjAttr[this.firstLineIndex].Value
                } else {
                    return ""
                }
            },
            secondLineText() {
                if (this.secondLineIndex > -1) {
                    return this.dataObj.ObjAttr[this.secondLineIndex].Value
                } else {
                    return ""
                }
            },
            firstLineIsAttach() {
                if (this.firstLineIndex > -1) {
                    return this.dataObj.ObjAttr[this.firstLineIndex].Name == "SYS_ATTACH"
                } else {
                    return false
                }
            },
            secondLineIsAttach() {
                if (this.secondLineIndex > -1) {
                    return this.dataObj.ObjAttr[this.secondLineIndex].Name == "SYS_ATTACH"
                } else {
                    return false
                }
            },
        },
        methods: {
            triggerItem() {
                console.log("triggerItem", this.dataObj)
                this.$emit('clickItem', this.dataObj)
            },
            clickButton(item) {
                this.$emit('clickButton', {
                    button: item,
                    data: this.dataObj
                })
            },
            getIco(item) {
                if(item.FunCode == "Modify")
                {
                    return "fs-edit"
                }
                else if(item.FunCode == "Delete")
                {
                    return "fs-WindowClose"
                }
                else 
                {
                    return "fs-set"
                }
            },
 
        },
    }
</script>
 
<style lang="scss" scoped>
    .uni-dataobj-item {
        display: flex;
        flex-direction: column !important;
        padding: 6px 0 4px;
        min-height: 48px;
        width: 100%;
 
        .uni-panel-data-info {
            display: flex;
            flex-direction: column !important;
            flex: 1;
        }
 
        .uni-panel-title-info {
            display: flex;
            flex-direction: row !important;
            background-color: transparent;
            margin: 4px 2px;
        }
 
        .uni-panel-title {
            display: -webkit-box;
            flex: 1;
            color: #000;
            font-size: 15px;
            white-space: normal;
            word-wrap: break-word;
            word-break: break-all;
            text-overflow: ellipsis;
            overflow: hidden;
            -webkit-line-clamp: 1; //表明是2行文本显示省略号,换成3则表明是3行文本显示省略号
            -webkit-box-orient: vertical;
        }
 
        .uni-panel-row-buttons {
            display: flex;
            flex-direction: row !important;
            background-color: transparent;
 
            padding: 0 4px;
        }
 
        .uni-panel-row-button {
            display: flex;
            margin-left: 5px;
            padding: 2px 4px;
            line-height: 20px;
            font-size: 14px;
            color: #007aff;
            border: 1px solid #ccc;
            border-radius: 5px;
        }
 
        .uni-panel-desc {
            display: -webkit-box;
            flex: 1;
            color: #808080;
            font-size: 13px;
            line-height: 24px;
            white-space: normal;
            word-wrap: break-word;
            word-break: break-all;
            text-overflow: ellipsis;
            overflow: hidden;
            -webkit-line-clamp: 1; //表明是2行文本显示省略号,换成3则表明是3行文本显示省略号
            -webkit-box-orient: vertical;
        }
        .uni-panel-icon {
            margin: 5px 5px 5px 0;
        }
        .uni-panel-left {
            display: flex;
            font-size: 15px;
            color: #000;
            margin: 12px 8px;
        }
    }
</style>