<template>
  <div class="step3">

    <!-- TODO 设定时薪类型 通过站点查接口 接口报错 -->
    <el-form-item label="设定时薪类型" prop="wageId">
      <el-select v-model="currentRow.data.wageId" value-key="" placeholder="" clearable filterable>
        <template v-for="item in wageTypes" :key="item.id">
          <el-option :label="item.name" :value="item.id"> </el-option>
        </template>
      </el-select>
    </el-form-item>
    <el-form-item label="设定标准响应时间">
      <el-input-number v-model="currentRow.data.readyTimingHour" :min="0" :step="1" clearable></el-input-number>
      <span>小时</span>
      <el-input-number v-model="currentRow.data.readyTimingMinute" :min="1" :step="1" clearable></el-input-number>
      <span>分钟</span>
    </el-form-item>
    <el-form-item label="设定标准转场时间">
      <el-input-number v-model="currentRow.data.transitionTimingHour" :min="0" :step="1" clearable></el-input-number>
      <span>小时</span>
      <el-input-number v-model="currentRow.data.transitionTimingMinute" :min="1" :step="1" clearable></el-input-number>
      <span>分钟</span>
    </el-form-item>
    <el-form-item label="设定标准工时">
      <el-input-number v-model="currentRow.data.workingTimingHour" :min="0" :step="1" clearable></el-input-number>
      <span>小时</span>
      <el-input-number v-model="currentRow.data.workingTimingMinute" :min="1" :step="1" clearable></el-input-number>
      <span>分钟</span>
    </el-form-item>
    <el-form-item label="设定超时放宽时间">
      <el-input-number v-model="currentRow.data.redundanceTimingHour" :min="0" :step="1" clearable></el-input-number>
      <span>小时</span>
      <el-input-number v-model="currentRow.data.redundanceTimingMinute" :min="1" :step="1" clearable></el-input-number>
      <span>分钟</span>
    </el-form-item>
    <el-form-item>
      <el-button @click="$emits('update:step', 1)">上一步</el-button>
      <el-button type="primary" @click="save" v-if="currentRow.data.status != 2">提交</el-button>
    </el-form-item>
  </div>
</template>

<script setup>
import { ref, onMounted, computed } from "vue";
import chooseTaskPeople from "@/Components/taskCenter/taskSet/chooseTaskPeopleCom.vue";
import { dropdownService } from "@/ApiService/dropdownService";
import templateHooks from '@/Hooks/templateHooks';
const { $message } = templateHooks();
const props = defineProps({
  currentRow: Object,
  currentButton: Object,
  step: Number,
});
const $emits = defineEmits(["update:step", "save"]);
const sences = ref([]);
const choosePeopleType = [
  {
    key: 0,
    value: "不限人员",
  },
  {
    key: 1,
    value: "选择任务执行人员",
  },
];
const showTaskExecutor = ref(false);
const defaultProps = computed(() => {
  console.log(props);
  return {
    buttonId: props.currentButton.data.buttonId,
    planId: props.currentRow.data.id,
  };
});
const sceneRef = ref();
const options = ref([]);
const scenesProps = {
  expandTrigger: "hover",
  checkStrictly: true,
  children: "childNode",
  label: "name",
  value: "gridId",
  multiple: true,
  disabled: "disable",
};
const taskCreateDateArr = ref([
  {
    timeArr: [],
  },
]);
const wageTypes = ref([])
// 数据定义 end
const save = () => {
  $emits("save", 3);
};
const fetchWageType = () => {
  const { districtId, type, id } = props.currentRow.data
  console.log(id);
  dropdownService.getDistrictWage({ districtId }).then((result) => {
    if (result.code == 0) {
      wageTypes.value = result.data
      if (!id) {
        props.currentRow.data.wageId = wageTypes.value[0].id
      }
    } else {
      $message.error(result.err)
    }
  }).catch((err) => {

  });
}
onMounted(() => {
  fetchWageType()
});
</script>
<script>
export default {
  name: "plan-task-form-step2",
};
</script>
<style lang="scss" scoped>
.custom-date-list {
  width: 100%;

  .date-item {
    display: flex;
    align-content: center;
    align-items: center;
  }
}

.step3 {
  padding-top: 40px;
}
</style>
