import request from '@/utils/request';
import { UPCLOUD_RDC_TMS_MAINDATA_SERVICE, SERVICES_FILE_MANAGEMENT } from '@/config/serviceSettings.js'
const serviceName = UPCLOUD_RDC_TMS_MAINDATA_SERVICE

//获取证件ID
export const getPaperId = (_this, data, st) => {
  return request({
    url: serviceName + '/paper/getPaperId',
    method: 'post',
    data
  });
};

function startDisabledTime(startValue, form) {
  let endValue = form.getFieldValue('endDate');
  if (!startValue || !endValue) {
    return false;
  }
  return startValue.valueOf() > new Date(endValue).valueOf();
}
function endDisabledTime(endValue, form) {
  let startValue = form.getFieldValue('startDate');
  if (!startValue || !endValue) {
    return false;
  }
  return new Date(startValue).valueOf() >= endValue.valueOf();
}
export const setFormItems = (self, view) => {
  if (self.formItems?.length > 0) {
    return self.formItems
  }

};
function responseThen(response) {
  if (response.success) {
    this.$message.success(response.message);
  } else {
    this.$exception(response);
  }
  setTimeout(() => {
    this.confirmLoading = false;
  }, 1000);
  return response;
}


export const updateImg = (_this, data, st) => {

  return request({
    processData: false,
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    url:SERVICES_FILE_MANAGEMENT +'/file/upload-file/v2',
    method: 'post',
    data
  })
};