<template>
  <listTemp ref="list" :param="param" :tableName="'firmwareTable'" keyRouteName="firmwarename" :searchType="searchType" :detailPage="{}" @listData="listData">
    <template #operation>
      <Add @onSuccess="$refs.list.tableData()" :disabled="!utils.hasPermission('insert')"></Add>
    </template>
    <template #tb_cell="{data}">
      <template v-if="data.column.dataIndex === 'operation'">
        <Edit :data="data.record" :disabled="!utils.hasPermission('update')" @onSuccess="$refs.list.tableData()"></Edit>
        <customBtn
          btnName="删 除"
          idName="20230619155402"
          keyName="w_firmwareid"
          :id="data.record.w_firmwareid"
          type="link"
          message="确定删除当前固件吗?"
          @onSuccess="$refs.list.tableData()"
          :disabled="!utils.hasPermission('delete')"
        />
        <Site :data="data.record" :disabled="!utils.hasPermission('site')"></Site>
      </template>
      <template v-else-if="data.column.dataIndex === 'isused'">
        <span :style="{color:utils.statusAndColor(data.record.isused ? '启用' : '停用')}">{{ data.record.isused ? '启用' : '停用' }}</span>
      </template>
    </template>
  </listTemp>
</template>

<script setup>
import listTemp from '@/components/listTemplate/index.vue'
import normalTable from '@/template/normalTable/index.vue'
import customBtn from '@/components/customHandleBtn/index.vue'
import Add from './modules/Add.vue'
import Edit from './modules/Edit.vue'
import Site from './modules/site/index.vue'
import {ref, defineProps, defineEmits, onMounted} from 'vue'
import { useBaseStore } from '@/stores/modules/base'
import Api from '@/api/api'
import utils from '@/utils/utils'

let base = useBaseStore()
let emit = defineEmits([])
let props = defineProps({})
let searchType = ref([
  {label:'搜索',key:'condition',type:'input'},
  {label:'时间范围',key:'dateRange',type:'datepickerRange',objKeys:['begindate','enddate']},
])
let param = ref({
  "id": 20230619155502,
  "content": {
    "pageNumber": 1,
    "pageSize": 25,
    "where": {
        "condition": "",
        "begindate": "",
        "enddate": ""
    }
  },
})

let listData = (res) => {
  res.data.forEach(item => {
    item.attinfos.forEach(item2 => {
      item2.name = item2.document
    })
  })
  console.log(res.data);
}

onMounted(async () => {
 
})
</script>

<style scoped>

</style>
