<template>
    <div class="app-data-card">
        <div class="data-item">
            <div class="item-icon">
                <img v-if="inputData.srficonpath" :src="inputData.srficonpath" class="single-card-img" />
            <img v-else src="/assets/img/noimage.png" class="single-card-img" />
            </div>   
            <div class="item-text">
                <div class="srfmajortext">{{inputData.srfmajortext}}</div>
                <div class="srfdescription" :title="inputData.srfdescription">{{inputData.srfdescription}}</div>
            </div>
        </div>      
        <div class="data-view-item-action" v-if="actionModel">
            <template v-for="(action,index) in Object.keys(actionModel)">
                <button type="info" :key="index" @click="uiAction(inputData, action, $event)">
                    <i :class="actionModel[action].icon" style="margin-right:2px;"></i>
                    <span>{{actionModel[action].caption}}</span>
                </button>
            </template>
        </div>
    </div>
</template>

<script lang="ts">
import { Component, Vue, Prop, Model, Watch } from 'vue-property-decorator';
import { Subject,Subscription } from 'rxjs';
@Component({
})
export default class AppDataCard extends Vue {
    /**
     * 面板数据对象
     *
     * @type {*}
     * @memberof AppDataCard
     */
    @Prop() public inputData?: any;

     /**
     * 操作栏模型
     * 
     * @type {*}
     * @memberof AppDataCard
     */
    @Prop() public actionModel:any;

    /**
     * 操作列界面行为
     *
     * @param {*} data
     * @param {*} tag
     * @param {*} $event
     * @memberof AppDataCard
     */
	public uiAction(data: any, tag: any, $event: any) {
        this.$emit('uiAction',data, tag, $event)
    }
}
</script>
<style lang="less">
    @import './app-data-card.less';
</style>