<!--排期 -->
<template>
  <div>
    <el-dialog title="任务排期" :model-value="pQshow" width="300px" :before-close="handleClose" :center="false">
      <div class="pq_content">
        <label>预计开始时间</label>
        <el-date-picker type="date" placeholder="选择日期" v-model="theplanStratTime" style="width: 100%;margin-left: -10px;"
          :value-format="formatset" :format="formatset"></el-date-picker>
      </div>
      <div class="pq_content" style="justify-content: right;margin-top: 15px;">
        <div class="l-button pqbt" @click="handleClose">取消</div>
        <div class="l-button" style="margin-right: 0;margin-left: 15px;" @click="makeSure">确认</div>
      </div>
    </el-dialog>
  </div>
</template>
<script setup name= "LDialog">
import { ElMessage } from 'element-plus'
import { defineProps, defineEmits, ref, getCurrentInstance, watch, useAttrs } from 'vue'
/* 数据层 */
const { proxy } = getCurrentInstance()
const formatset = ref('YYYY/MM/DD')
const props = defineProps(['ids', 'pQshow', 'planStratTime'])
let theplanStratTime = ref(JSON.parse(JSON.stringify(props.planStratTime)))
const attrs = useAttrs()
/* 方法 */
const emits = defineEmits(['update:pQshow'])
// 确认
function makeSure () {
  if (props.ids) {
    proxy.$http.showLoading(false).get('project/task/ch_status', { ids: props.ids, type: 0, plan_start_time: theplanStratTime.value }).then(res => {
      // 刷新爷组件详情数据接口
      if (res.errno == 200) {
        attrs.deppgetPageInfo()
        ElMessage({ type: 'success', message: '操作成功' })
      } else {
        ElMessage({
          type: 'error',
          message: res.errmsg
        })
      }
    })
  }
  emits('update:pQshow', false)
}
//关闭的点击事件
function handleClose () {
  emits('update:pQshow', false)
}
</script>
<style  scoped lang="scss">
@import '@/assets/style/lc.scss';

.pq_content {
  display: flex;
  flex-direction: row;
  margin-top: -18px;
  align-items: center;

  label {
    margin-right: 20px;
    font-size: 12px;
  }

  .pqbt {
    margin-right: 0;
    margin-left: 15px;
    color: #409EFF;
    background: #fff;
    border: 1px solid #409EFF;
  }

  ::v-deep(.el-input__icon) {
    line-height: 28px;
  }
}
</style>

