<template>
  <div>
    <!--    跟进任务-->
    <DkModal v-model="visible" :title="$t('followTask2')" width="800px" ref="modal_followTask"
             @on-cancel="cancelFollowTask"
             :loading="loading"
             @modalOk="submitFollow"
             @modalCancel="cancelFollowTask"
             :saveFlag="true">
      <DkCollapse @on-change="changeCollapse" ref="collapse">
        <DkPanel prop="customerInfo">
          <DkForm slot="content" ref="formFollowTask" style="width:100%;" name="dk-form" v-model="customerInfo6"
                  :label-max-words="6">
            <DkFormItem prop="followUser" :errorMessage="getErrMessage('followUser')">
              <SelectMagnifier v-model="customerInfo6.followUser" searchType="S"
                               :type="this.$config.MagnifierType.user"
                               :other-condition="{orgId: $store.state.user.orgId}"
              ></SelectMagnifier>
            </DkFormItem>
            <!--下次跟进计划-->
            <DkFormItem prop="nextFollowPlan" :errorMessage="getErrMessage('nextFollowPlan')">
              <InputPop textarea-flag v-model="customerInfo6.nextFollowPlan" maxlength="100"/>
            </DkFormItem>
            <!--下次邀约时间（提醒时间）-->
            <DkFormItem :label="$t('nextFollowTime2')" prop="nextFollowTime"
                        :errorMessage="getErrMessage('nextFollowTime')" required>
              <DatePickerPop type="datetime" v-model="customerInfo6.nextFollowTime" transfer
                             format="yyyy-MM-dd HH:mm:ss"/>
            </DkFormItem>
          </DkForm>
        </DkPanel>
      </DkCollapse>
    </DkModal>
  </div>
</template>

<script>
import {formMixin} from '@/mixins/form'

export default {
  components: {},
  mixins: [formMixin],
  name: 'customer-follow-task',
  model: {
    prop: 'value',
    event: 'close'
  },
  watch: {
    value(val) {
      this.visible = val
    },
    visible(val) {
      if (!val) {
        this.$emit('close', false)
      } else {
      }
    },
  },
  props: {
    value: {
      type: Boolean,
      default: false
    },
    customerIds: {
      type: Array
    },
    customerNames: {
      type: Array
    }
  },
  data() {
    return {
      // 客户信息 跟进任务
      customerInfo6: {
        followUser: null,
        nextFollowPlan: null,
        nextFollowTime: null,
      },
      // 错误信息
      errMessage: {},
      rule: {
        nextFollowTime: [
          {required: true, trigger: 'none', type: 'date'},
        ],
      },
      visible: false,
      loading: false,
    }
  },
  methods: {
    /**
     * @desc   : 取消跟进任务
     * @author : 付斌
     * @date   : 2024-02-01 14:32
     */
    cancelFollowTask() {

    },
    /**
     * @desc   : 校验
     * @author : 付斌
     * @date   : 2024-02-01 14:32
     */
    getErrMessage(prop) {
      return this.errMessage[prop]
    },
    /**
     * @desc   : 提交跟进
     * @author : 付斌
     * @date   : 2024-02-01 14:32
     */
    submitFollow() {

    },
  },
  created() {
    this.customerInfo6.followUser = this.$store.state.user.id
  }
}
</script>
