<template>
    <HcTable ui="no-border" border :column="tableColumn" :datas="tableData" :loading="tableLoading">
        <template #key2="{row}">
            <span class="text-blue text-hover">{{row.key2}}</span>
        </template>
        <template #key3="{row}">
            <el-input v-model="row.key3" placeholder="请输入抽检意见" v-if="row.isEdit"/>
            <span v-else>{{row.key3}}</span>
        </template>
        <template #action="{row}">
            <el-button type="success" size="small" v-if="row.isEdit" @click="saveClick(row)">保存</el-button>
            <el-button type="primary" size="small" v-else @click="editClick(row)">编辑</el-button>
            <el-button type="danger" size="small" @click="delClick(row)">删除</el-button>
        </template>
    </HcTable>
</template>

<script setup>
import {ref, onMounted} from "vue";
import {getArrValue} from "js-fast-way"
import {delMessage} from "~uti/tools";

//参数
const props = defineProps({
    projectId: {
        type: [String,Number],
        default: ''
    },
    contractId: {
        type: [String,Number],
        default: ''
    }
})

//变量
const projectId = ref(props.projectId);
const contractId = ref(props.contractId);

//渲染完成
onMounted(() => {

})

//表格数据
const tableColumn = ref([
    {key:'key1', name: '抽检所属', width: 180},
    {key:'key2', name: '案卷题名'},
    {key:'key3', name: '抽检意见'},
    {key:'action', name: '操作', width: 140, align: 'center'},
])
const tableData = ref([
    {
        id: 1,
        key1: '施工',
        key2: '安康至来凤国家高速公路....',
        key3: '这是专家抽检意见xxxxx'
    },
    {
        id: 2,
        key1: '业主',
        key2: '安康至来凤国家高速公路....',
        key3: '这是专家抽检意见xxxxx'
    }
])

const tableLoading = ref(false)

//编辑
const editClick = (row) => {
    row.isEdit = true
}
//保存
const saveClick = (row) => {
    row.isEdit = false
}
//删除
const delClick = (row) => {
    delMessage(() => {

    })
}
</script>

<style lang="scss" scoped>

</style>
