<template>
  <div class="data-dictionary h100">
    <common-layout  ref="layoutRef" :table-attrs="{
     'has-operation':true
   }" :form-attrs="{
     'span-attrs':{
       span:4
     }
   }" :table-header="combinedRewardAndPunishmentsMeasureManageHeader" :get-table-list="getTableData" :filter-form="combinedRewardAndPunishmentsMeasureManage">
      <template #plusBtn>
        <el-button  type="primary" :icon="Search" @click="openDialog('add','2')">对应关系</el-button>-->
      </template>
      <template #operation="{data}">
        <el-button  type="info" @click="openDialog('detail','1',data)">查看</el-button>
      </template>
    </common-layout>

    <template v-if="isEditDialogShow && currentDialogType == '1'">
      <combined-reward-and-punishments-measure-manage-case-history-setting-dialog @getTableData="getTableData" :dialog-operation-type="dialogOperationType" :current-dialog-obj="currentDialogOpObj" v-model:dialog-visible="isEditDialogShow"/>
    </template>
    <template v-if="isEditDialogShow && currentDialogType == '2'">
      <combined-reward-and-punishments-measure-manage-matter-rule-connect-setting-dialog  @getTableData="getTableData" :dialog-operation-type="dialogOperationType" :current-dialog-obj="currentDialogOpObj" v-model:dialog-visible="isEditDialogShow"/>
    </template>
  </div>
</template>

<script>
import {ref} from "vue";
import {useRootStore} from "@/pinia/useStore";
import CommonLayout from "@/components/CommonLayout.vue";
import {combinedRewardAndPunishmentsMeasureManageHeader} from "@/data/all-table-header";
import {combinedRewardAndPunishmentsMeasureManage} from "@/data/all-form";
import {Plus, Search} from "@element-plus/icons-vue"
import {useDetailOrEdit} from "@/units/use-method/usePagination";
import {handleMes} from "@/units/element-ui/tip";
import CombinedRewardAndPunishmentsMeasureManageCaseHistorySettingDialog
  from "@/views/main/c-views/combined-rewards-and-punishments/combined-rewards-and-punishments-case-information/CombinedRewardAndPunishmentsMeasureManageCaseHistorySettingDialog.vue";
import CombinedRewardAndPunishmentsMeasureManageMatterRuleConnectSettingDialog
  from "@/views/main/c-views/combined-rewards-and-punishments/combined-rewards-and-punishments-case-information/CombinedRewardAndPunishmentsMeasureManageMatterRuleConnectSettingDialog.vue";
import {
  proSelectXyxxJgfkm
} from "@/service/combined-rewards-and-punishments/combined-rewards-and-punishments-case-information/combined-rewards-and-punishments-case-information";
import {InsertSyslog} from "@/units/use-method/user-log";
export default {
  name: "CombinedRewardAndPunishmentsMeasureManage",
  components:{
    CombinedRewardAndPunishmentsMeasureManageMatterRuleConnectSettingDialog,
    CombinedRewardAndPunishmentsMeasureManageCaseHistorySettingDialog,
    CommonLayout},
  computed: {
    Plus(){
      return Plus
    },
    Search(){
      return Search
    }
  },
  setup(){
    const layoutRef = ref(null);
    const isEditDialogShow = ref(false);
    const currentDialogType = ref('')
    const {changeOperation,currentOpObj:currentDialogOpObj,operationType:dialogOperationType} = useDetailOrEdit()
    const store =useRootStore();
    function getTableData (){
      debugger
      proSelectXyxxJgfkm({
        dxmc:layoutRef.value.form.DXMC,
        dxdm:layoutRef.value.form.DXDM,
        saxx:layoutRef.value.form.SAXX,
        start_time:layoutRef.value.form.START,
        end_time:layoutRef.value.form.END,
        pageIndex:layoutRef.value.pageIndex,
        pageSize:layoutRef.value.pageSize
      }).then(res =>{
        InsertSyslog(localStorage.getItem("xyxx_usercode"),localStorage.getItem("xyxx_unitcode"), "信息查询", "奖惩措施管理查询成功", "联合奖惩案例信息", "")
        layoutRef.value.getResData(res.msg[0].Rows,res.msg[0].TotalRowCount)
      })
    }

    function openDialog(type,dialogType,data){
      isEditDialogShow.value = true;
      currentDialogType.value = dialogType;
      debugger
      changeOperation(type,data)
    }
    return {
      combinedRewardAndPunishmentsMeasureManage,
      combinedRewardAndPunishmentsMeasureManageHeader,
      getTableData,
      openDialog,
      layoutRef,
      isEditDialogShow,
      currentDialogType,
      dialogOperationType,
      currentDialogOpObj
    }

  }
}
</script>

<style scoped>

</style>