<template>
  <view class="pageBox">
    <view class="container _test_page">
      <component-form_input
        ref="inputFormRef"
        v-model:controls="inputForm.controls"
        v-model:data="inputForm.data"
      />
    </view>
  </view>
</template>

<script setup lang="ts">
import { ref, reactive, computed, onBeforeMount, onMounted, onUnmounted, watch, nextTick } from 'vue'
import Storage from '@/common/utils/storage/index'
import { onLoad } from '@dcloudio/uni-app'
import EXEC from '@/common/utils/exec';
import { translate } from '@/common/utils/language/index'
import { http } from '@/common/utils/request'



const params = <any>ref({})


onLoad((option:any)=>{
  params.value = JSON.parse(option.params)
  byKey({...params.value})
})

onBeforeMount(async() => {
})
onMounted(()=>{
})
onUnmounted(() => {
})

const inputFormRef = ref(null)
const inputForm = <any>reactive({
  data: {},
  controls:{
    user_id: {
      type: 'input',
    },
    user_name: {
      type: 'input',
    },
    valid: {
      type: 'switch',
    },
    comp_id:{
      type: 'select',
      select: {
        type: 'comp_id',
      },
      params:{},
    },
    user_type:{
      type: 'select',
      select: {
        type: 'user_type',
      },
      params:{},
    },
    operating_post:{
      type: 'select',
      select: {
        type: 'operating_post',
      },
      params:{},
    },
    all_customer:{
      type: 'switch',
    },
    all_org:{
      type: 'switch',
    },
    all_wh:{
      type: 'switch',
    },
    all_project:{
      type: 'switch',
    },
    super_admin:{
      type: 'switch',
    },
  },
  
  buttons:[
    {
      field: 'save',
      label: '保存',
      click: (e:any) => {
      }
    }
  ]
})
const byKey = (e:any) => {
  http.get('/sec/sql_execute/t/query', {
    ...e,
    exec_type:'bykey',
    udf_param_json: {"menuID":"202310131755080562","pageID":"202310152227270140","pageCode":"P2","containerID":"202310152228067607","containerCode":"F2_1","run_id":"202311131754535334","container_id":"202310152228067607"},
  }).then((result:any) => {
    inputForm.data = result['result'][0]
  })
}


</script>

<style lang="scss">
._test_page{
  background: #eaf1f7;
}
</style>
