<script lang="ts" setup name="standardListAdd">
import { ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import type { FormInstance, UploadProps, UploadUserFile } from 'element-plus'
import type { IOptions } from '../standard_interface'
import { getStaffList } from '@/api/measure/person'
import { getTypeSelect } from '@/api/system/price'
import { getStandardListDetail, getUsersDept } from '@/api/device/standard'
import { UploadFile } from '@/api/measure/file'
const props = defineProps({
  infoId: {
    type: String,
    default: '0',
  },
  buttonType: {
    type: String,
    default: '',
  },
  buttonArray: {
    type: Array,
    default: () => [],
  },
})
const emit = defineEmits(['close', 'setData']) // 关闭
const ruleFormRef = ref<FormInstance>()
// 逻辑代码
const formInline = ref({
  assessDate: '',
  assessmentUnit: '',
  category: null,
  categoryName: '',
  constructionStandardProject: '',
  constructionStandardUnitName: '',
  contactInfo: '',
  createTime: null,
  createUser: null,
  id: '',
  isDel: null,
  laboratoryOwner: null,
  laboratoryOwnerContact: null,
  laboratoryOwnerName: null,
  managerState: null,
  managerStateName: '',
  measureMajor: null,
  fileList: [],
  measureMajorName: '',
  mesureRange: '',
  organizeNo: '',
  preparationDate: '',
  projectNo: '',
  remark: '',
  standardHumidity: null,
  standardLaboratory: null,
  standardLaboratoryName: '',
  standardLevel: null,
  standardLevelName: '',
  standardName: '',
  standardNo: '',
  standardOwner: null,
  standardOwnerName: '',
  standardTemperature: null,
  totalInvestment: null,
  transmitRange: null,
  transmitRangeName: '',
  uncertainty: '',
  updateTime: null,
  version: null,
})
const checkTypeOptions = ref<IOptions[]>([])
const standardOwnerOptions = ref<IOptions[]>([]) // 标准负责人
const fileList = ref<UploadUserFile[]>([]) // 文件对象数组
const measureMajorList = ref<IOptions[]>([]) // 计量专业下拉框
const standardManagerStateList = ref<IOptions[]>([]) // 管理状态下拉框
const standardLevelList = ref<IOptions[]>([]) // 标准等级下拉框
const transmitRangeList = ref<IOptions[]>([]) // 传递范围下拉框
// 标准所在部门下拉框
const standardUsersDeptList = ref<IOptions[]>([])
// 获取下拉框
const getSelectList = (code: string) => {
  getTypeSelect(code).then((res) => {
    if (code === 'measureMajor') {
      measureMajorList.value = res.data
    }
    else if (code === 'standardManagerState') {
      standardManagerStateList.value = res.data
    }
    else if (code === 'standardLevel') {
      standardLevelList.value = res.data
    }
    else if (code === 'transmitRange') {
      transmitRangeList.value = res.data
    }
    else if (code === 'standardCategory') {
      checkTypeOptions.value = res.data
    }
  })
}
getSelectList('measureMajor') // 获取计量专业下拉框
getSelectList('standardManagerState') // 获取管理状态下拉框
getSelectList('standardLevel') // 获取标准等级下拉框
getSelectList('transmitRange') // 获取传递范围下拉框
getSelectList('standardCategory') // 获取类别下拉框
// 获取部门信息
getUsersDept({
  createTime: '',
  director: '',
  meterMajor: '',
  organizeName: '',
  organizeNo: '',
  organizeType: '2',
  pdeptId: null,
  offset: 1,
  limit: 999999,
}).then((res) => {
  standardUsersDeptList.value = res.data.rows
})
// 获取到标准负责人数组
const getStandardOwnerOptions = () => {
  const params = {
    staffNo: '', // 人员编号
    name: '', // 姓名
    deptId: '', // 工作部门
    major: '', // 计量专业
    verifierCertificateNo: '', // 证书号
    certificateStatus: '', // 证书状态
    limit: 100000,
    offset: 1,
  }
  getStaffList(params).then((res) => {
    standardOwnerOptions.value = res.data.records
  })
}
// 数据
const list = ref<object[]>([
  { name: '王五' },
])
// 标准配套设备更换表格总数
const total = ref(0)
// 审批弹窗开关
const applyShow = ref(false)
// 审批弹窗信息收集类型
interface applyListType {
  select: string
  epilog: string
  approval: string
  approvalTime: string
}
// 审批弹窗信息收集
const applyList = ref<applyListType>({
  select: '',
  epilog: '',
  approval: '',
  approvalTime: '',
})
// 标准配套设备表头类型
interface columnsType {
  text: string
  value: string
  align: string
}
// 标准配套设备更换表头
const columns = ref<columnsType[]>([
  {
    text: '设备名称',
    value: 'name',
    align: 'center',
  },
  {
    text: '设备编号',
    value: 'bianhao',
    align: 'center',
  },
  {
    text: '型号',
    value: 'xinghao',
    align: 'center',
  },
  {
    text: '测量范围',
    value: 'fanwei',
    align: 'center',
  },
  {
    text: '使用部门',
    value: 'bumen',
    align: 'center',
  },
  {
    text: '检定时间',
    value: 'time',
    align: 'center',
  },
  {
    text: '检定结果',
    value: 'jieguo',
    align: 'center',
  },
  {
    text: '有效日期',
    value: 'riqi',
    align: 'center',
  },
])
// 标准配套设备更换查询条件
const listQuery = ref<object>({
  limit: 10,
  offset: 1,
})
// 标准配套设备更换表格loding
const loadingTable = ref(false)
// 申请文档表头
const columnsFiles = ref<object[]>([
  {
    text: '文件名称',
    value: 'name',
    align: 'center',
  },
  {
    text: '上传时间',
    value: 'name',
    align: 'center',
  },
  {
    text: '文件说明',
    value: 'name',
    align: 'center',
  },
  {
    text: '附件文档',
    value: 'name',
    align: 'center',
  },
])
// 标准配套设备更换表格分页
const changePage = () => {}
getStandardOwnerOptions()
// 添加表格数据对象
const addList = ref({})
// 添加表格弹窗开关
const dialogVisible = ref(false)
// 关闭
const close = () => {
  emit('close')
}
const rules = ref({
  standardName: [{ required: true, message: '标准名称不能为空', trigger: 'blur' }],
  projectNo: [{ required: true, message: '项目编号不能为空', trigger: 'blur' }],
  constructionStandardProject: [{ required: true, message: '建标项目不能为空', trigger: 'blur' }],
  organizeNo: [{ required: true, message: '组织机构代码不能为空', trigger: 'blur' }],
  constructionStandardUnitName: [{ required: true, message: '建标单位名称不能为空', trigger: 'blur' }],
  standardOwner: [{ required: true, message: '标准负责人不能为空', trigger: 'blur' }],
  contactInfo: [{ required: true, message: '联系方式不能为空', trigger: 'blur' }],
  category: [{ required: true, message: '类 别不能为空', trigger: 'blur' }],
  standardLevel: [{ required: true, message: '标准等级不能为空', trigger: 'blur' }],
  transmitRange: [{ required: true, message: '传递范围不能为空', trigger: 'blur' }],
  preparationDate: [{ required: true, message: '筹建日期不能为空', trigger: 'blur' }],
  managerState: [{ required: true, message: '管理状态不能为空', trigger: 'blur' }],
  measureMajor: [{ required: true, message: '计量专业不能为空', trigger: 'blur' }],
  assessmentUnit: [{ required: true, message: '考核单位不能为空', trigger: 'blur' }],
  assessDate: [{ required: true, message: '考核日期不能为空', trigger: 'blur' }],
  uncertainty: [{ required: true, message: '不确定度不能为空', trigger: 'blur' }],
  mesureRange: [{ required: true, message: '测量范围不能为空', trigger: 'blur' }],
  standardTemperature: [{ required: true, message: '标准温度不能为空', trigger: 'blur' },
    { pattern: /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/, message: '标准温度只能为数字', trigger: 'blur' }],
  standardHumidity: [{ required: true, message: '标准湿度不能为空', trigger: 'blur' },
    { pattern: /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/, message: '标准湿度只能为数字', trigger: 'blur' }],
}) // 表单验证规则
// 上传请求
const uploadQuarterlyEvaluateFile = (file: File) => {
  const fd = new FormData()
  fd.append('multipartFile', file.file)
  UploadFile(fd).then((res) => {
    if (res.code === 200) {
      formInline.value.fileList = res.data
      // 重置当前验证
      ElMessage.success('文件上传成功')
    }
  })
}
const handleExceed: UploadProps['onExceed'] = (files, uploadFiles) => {
  ElMessage.warning('只能上传一个文件')
}
// 移除时触发
const beforeRemove: UploadProps['beforeRemove'] = (uploadFile, uploadFiles) => {
  return ElMessageBox.confirm(
    `确认移除${uploadFile.name}文件吗 ?`,
  ).then(
    () => true,
    () => false,

  )
}
// 点击文件预览
const uploadShow = (e: any) => {
  const URL = window.URL || window.webkitURL
  window.open(URL.createObjectURL(e.raw))
}
const testForm = ref({
  fileList: [],
  fileContent: '',
})
const handleFileChange = (files: any, fileList: any) => {
  testForm.value.fileList = fileList
  const reader = new FileReader()
  reader.readAsText(files.raw)
  // reader.onload = (e) => {
  //   testForm.value.fileContent = e.target!.result?.replace(
  //     /\n|\r\n/g,
  //     '<br/>',
  //   )
  // }
}
// 表格选中的数组
const SelectionList = ref<object[]>([])
// 标准实验室发生改变row类型
interface rowReturn {
  phone: string
  director: string
}
// 标准实验室发生改变
const changeDeptList = (row: object) => {
  formInline.value.laboratoryOwnerContact = row.phone
  formInline.value.laboratoryOwner = row.director
}
// 标准实验室清空时
const clearDeptList = () => {
  formInline.value.laboratoryOwnerContact = null
  formInline.value.laboratoryOwner = null
}
// 获取详情信息
const getInfo = () => {
  getStandardListDetail({ id: props.infoId }).then((res) => {
    Object.keys(res.data).map((item) => {
      if (typeof (res.data[item]) === 'number') {
        res.data[item] = res.data[item].toString()
      }
    })
    formInline.value = res.data
  })
}
if (props.buttonType !== '') {
  getInfo()
}

// 提交
const submitForm = () => {
  return ruleFormRef.value
}
defineExpose({ submitForm })

// 点击顶部一排按钮
const getAddList = (item: string) => {
  if (item === '提交' || item === '保存') {
    console.log(item)
  }
  else {
    if (item === '同意') {
      applyList.value.select = '1'
    }
    else if (item === '驳回') {
      applyList.value.select = '2'
    }
    else {
      applyList.value.select = '3'
    }
    applyShow.value = true
  }
}
// 点击增加行
const addRoow = () => {
  Object.keys(addList.value).forEach(key => (addList.value[key] = ''))
  dialogVisible.value = true
}
// 点击关闭
const handleClose = () => {
  dialogVisible.value = false
}
// 点击弹窗的完成追加到表格数组中
const addPushList = () => {
  list.value.push(JSON.parse(JSON.stringify(addList.value)))
  handleClose()
}
// 标准配套设备更换表格删除行
const removeRow = () => {
  if (SelectionList.value.length > 0) {
    ElMessageBox.confirm(
      '确认删除选中的数据吗？',
      '提示',
      {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning',
      },
    ).then(() => {
      // 删除行
      list.value = list.value.filter((item) => {
        return !SelectionList.value.includes(item)
      })
      ElMessage.success('删除成功')
    })
  }
  else {
    ElMessage.warning('请先选择需要删除的数据')
  }
}
// 表格多选框
const handleSelectionChange = (e: any) => {
  SelectionList.value = e
}
watch(() => formInline.value, (newVal) => {
// 变化后存储
  emit('setData', newVal)
},
{ deep: true, immediate: true })
// 审批弹窗的关闭
const applyListClose = () => {
  applyShow.value = false
}
// 审批弹窗的提交
const applyListSubmit = () => {
  console.log(applyList.value)
  if (applyList.value.select == '') {
    return ElMessage.error('必须选择审批意见')
  }
  applyListClose()
}
</script>

<template>
  <app-container>
    <div class="top-info">
      <h4 class="title">
        基本信息
      </h4>
      <div>
        <el-button v-for="(item, index) in buttonArray" :key="index" type="primary" @click="getAddList(item)">
          {{ item }}
        </el-button>
        <el-button type="warning" @click="close">
          关闭
        </el-button>
      </div>
    </div>
    <div class="info-content">
      <el-form
        ref="ruleFormRef"
        :inline="true"
        :model="formInline"
        label-position="left"
        label-width="auto"
        :rules="rules"
      >
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item label="标准代码:">
              <el-input
                v-model.trim="formInline.standardNo"
                placeholder="系统编号，自动生成"
                disabled
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="标准名称:" prop="standardName">
              <el-input
                v-model.trim="formInline.standardName"
                placeholder="标准名称"
                :disabled="buttonType === '查看'"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="项目编号:" prop="projectNo">
              <el-input
                v-model.trim="formInline.projectNo"
                placeholder="项目编号"
                :disabled="buttonType === '查看'"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="建标项目:" prop="constructionStandardProject">
              <el-input
                v-model.trim="formInline.constructionStandardProject"
                placeholder="建标项目"
                :disabled="buttonType === '查看'"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item label="组织机构代码:" prop="organizeNo">
              <el-input
                v-model.trim="formInline.organizeNo"
                placeholder="组织机构代码"
                :disabled="buttonType === '查看'"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item
              label="建标单位名称:"
              prop="constructionStandardUnitName"
            >
              <el-input
                v-model.trim="formInline.constructionStandardUnitName"
                placeholder="建标单位名称"
                :disabled="buttonType === '查看'"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="标准负责人:" prop="standardOwner">
              <el-select
                v-model="formInline.standardOwner"
                clearable
                placeholder="标准负责人"
                size="default"
                :disabled="buttonType === '查看'"
              >
                <el-option
                  v-for="item in standardOwnerOptions"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="联系方式:" prop="contactInfo">
              <el-input
                v-model.trim="formInline.contactInfo"
                placeholder="联系方式"
                :disabled="buttonType === '查看'"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item label="类 别:" prop="category">
              <el-select
                v-model="formInline.category"
                clearable
                placeholder="类别"
                size="default"
                :disabled="buttonType === '查看'"
              >
                <el-option
                  v-for="item in checkTypeOptions"
                  :key="item.id"
                  :label="item.name"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="标准等级:" prop="standardLevel">
              <el-select
                v-model.trim="formInline.standardLevel"
                clearable
                placeholder="标准等级"
                size="default"
                :disabled="buttonType === '查看'"
              >
                <el-option
                  v-for="item in standardLevelList"
                  :key="item.id"
                  :label="item.name"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="传递范围:" prop="transmitRange">
              <el-select
                v-model.trim="formInline.transmitRange"
                clearable
                placeholder="传递范围"
                size="default"
                :disabled="buttonType === '查看'"
              >
                <el-option
                  v-for="item in transmitRangeList"
                  :key="item.id"
                  :label="item.name"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="投资总额:">
              <el-input
                v-model.trim="formInline.totalInvestment"
                placeholder="投资总额"
                :disabled="buttonType === '查看'"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item label="筹建日期:" prop="preparationDate">
              <el-date-picker
                v-model="formInline.preparationDate"
                type="datetime"
                placeholder="请选择筹建日期"
                format="YYYY/MM/DD HH:mm:ss"
                value-format="YYYY-MM-DD h:m:s"
                :disabled="buttonType === '查看'"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="标准所在实验室:">
              <el-select
                v-model.trim="formInline.standardLaboratory"
                clearable
                placeholder="标准所在实验室"
                size="default"
                :disabled="buttonType === '查看'"
                @clear="clearDeptList"
              >
                <el-option
                  v-for="item in standardUsersDeptList"
                  :key="item.id"
                  :label="item.organizeName"
                  :value="item.deptId"
                  @click="changeDeptList(item)"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="实验室负责人:">
              <el-input
                v-model.trim="formInline.laboratoryOwner"
                placeholder="实验室负责人"
                :disabled="buttonType === '查看'"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="联系方式:">
              <el-input
                v-model.trim="formInline.laboratoryOwnerContact"
                placeholder="联系方式"
                :disabled="buttonType === '查看'"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item label="管理状态:" prop="managerState">
              <el-select
                v-model.trim="formInline.managerState"
                clearable
                placeholder="管理状态"
                size="default"
                :disabled="buttonType === '查看'"
              >
                <el-option
                  v-for="item in standardManagerStateList"
                  :key="item.id"
                  :label="item.name"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="计量专业:" prop="measureMajor">
              <el-select
                v-model.trim="formInline.measureMajor"
                clearable
                placeholder="计量专业"
                size="default"
                :disabled="buttonType === '查看'"
              >
                <el-option
                  v-for="item in measureMajorList"
                  :key="item.id"
                  :label="item.name"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="考核单位:" prop="assessmentUnit">
              <el-input
                v-model.trim="formInline.assessmentUnit"
                placeholder="考核单位"
                :disabled="buttonType === '查看'"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="考核日期:" prop="assessDate">
              <el-date-picker
                v-model="formInline.assessDate"
                type="datetime"
                placeholder="请选择考核日期"
                format="YYYY/MM/DD HH:mm:ss"
                value-format="YYYY-MM-DD h:m:s"
                :disabled="buttonType === '查看'"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="不确定度:" prop="uncertainty">
              <el-input
                v-model.trim="formInline.uncertainty"
                style="width: 500px;"
                placeholder="不确定度"
                :disabled="buttonType === '查看'"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="测量范围:" prop="mesureRange">
              <el-input
                v-model.trim="formInline.mesureRange"
                placeholder="测量范围"
                style="width: 500px;"
                :disabled="buttonType === '查看'"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="2">
            <el-form-item label="环境条件" />
          </el-col>
          <el-col :span="6">
            <el-form-item label="标准温度:" prop="standardTemperature">
              <el-input
                v-model.trim="formInline.standardTemperature"
                placeholder="标准温度℃"
                :disabled="buttonType === '查看'"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="标准湿度:" prop="standardHumidity">
              <el-input
                v-model.trim="formInline.standardHumidity"
                placeholder="标准湿度%"
                :disabled="buttonType === '查看'"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item label="有效日期:">
              <el-date-picker
                type="datetime"
                placeholder="请选择有效日期"
                format="YYYY/MM/DD HH:mm:ss"
                value-format="YYYY-MM-DD h:m:s"
                disabled
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="证书编号:">
              <el-select
                clearable
                placeholder="证书编号"
                size="default"
                disabled
              >
                <el-option
                  v-for="item in standardManagerStateList"
                  :key="item.id"
                  :label="item.name"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="发证单位:">
              <el-input placeholder="发证单位" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="发证日期:">
              <el-date-picker
                type="datetime"
                placeholder="请选择发证日期"
                format="YYYY/MM/DD HH:mm:ss"
                value-format="YYYY-MM-DD h:m:s"
                disabled
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="3">
            <el-form-item label="附件:">
              <el-upload
                v-model:file-list="fileList"
                enctype="multipart/form-data"
                :http-request="uploadQuarterlyEvaluateFile"
                :before-remove="beforeRemove"
                :on-exceed="handleExceed"
                :on-preview="uploadShow"
                :on-change="handleFileChange"
                :limit="1"
              >
                <el-button :disabled="buttonType === '查看'">
                  上传
                </el-button>
              </el-upload>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="备注:">
              <el-input
                v-model.trim="formInline.remark"
                style="width: 500px;"
                placeholder="备注"
                :disabled="buttonType === '查看'"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div class="header">
        <div class="title">
          标准配套设备更换
        </div>
        <span class="btns">
          <el-button v-if="buttonType !== '查看'" type="primary">
            批量选择
          </el-button>
          <el-button v-if="buttonType !== '查看'" type="primary" @click="addRoow">
            增加行
          </el-button>
          <el-button v-if="buttonType !== '查看'" type="info" @click="removeRow">
            删除行
          </el-button>
        </span>
      </div>
      <normal-table
        :data="list" :total="total" :columns="columns" :query="listQuery"
        :list-loading="loadingTable" is-showmulti-select @change="changePage" @multiSelect="handleSelectionChange"
      />
      <div class="header">
        <div class="title">
          申请文档
        </div>
        <span class="btns">
          <el-button v-if="buttonType !== '查看'" type="primary">
            增加行
          </el-button>
          <el-button v-if="buttonType !== '查看'" type="info" @click="removeRow">
            删除行
          </el-button>
        </span>
      </div>
      <normal-table
        :data="list" :total="total" :columns="columnsFiles" :query="listQuery"
        :list-loading="loadingTable" is-showmulti-select @change="changePage" @multiSelect="handleSelectionChange"
      />
      <div class="header">
        <div class="title">
          审批流程
        </div>
      </div>
    </div>
  </app-container>
  <el-dialog
    v-model="dialogVisible"
    title="添加人员信息"
    width="30%"
    :before-close="handleClose"
    center
  >
    <el-form
      ref="addPersonListForm"
      label-position="left"
      label-width="100px"
      :model="addList"
      style="max-width: 460px;"
    >
      <el-form-item v-for="column in columns" :key="column.value" :label="column.text" :prop="addList[column.value]">
        <el-input v-model="addList[column.value]" />
      </el-form-item>
    </el-form>
    <el-button type="primary" class="dialog-button" @click="addPushList">
      完成
    </el-button>
  </el-dialog>
  <el-dialog
    v-model="applyShow"
    title="审批操作"
    width="30%"
    :before-close="applyListClose"
    close-on-press-escape
    draggable
    :close-on-click-modal="false"
  >
    <el-form
      ref="addPersonListForm"
      label-position="left"
      label-width="100px"
      inline
      :model="applyList"
      style="max-width: 460px;"
    >
      <el-form-item label="审批意见:">
        <el-radio-group v-model="applyList.select" class="ml-4">
          <el-radio label="1" size="large">
            同意
          </el-radio>
          <el-radio label="2" size="large">
            驳回
          </el-radio>
          <el-radio label="3" size="large">
            拒绝
          </el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="审批结论:">
        <el-input
          v-model="applyList.epilog"
          maxlength="200"
          placeholder="审批结论"
          style="width: 20vw;"
          show-word-limit
          type="textarea"
        />
      </el-form-item>
      <el-form-item label="审批人:">
        <el-input
          v-model="applyList.approval"
          border="none"
          placeholder="审批人"
          style="width: 5vw;"
          disabled
        />
      </el-form-item>
      <el-form-item label="审批时间:">
        <el-input
          v-model="applyList.approvalTime"
          placeholder="审批时间"
          style="width: 5vw;"
          disabled
        />
      </el-form-item>
    </el-form>
    <div class="dialog-buts">
      <el-button type="primary" @click="applyListSubmit">
        提交
      </el-button>
      <el-button type="info" @click="applyListClose">
        取消
      </el-button>
    </div>
  </el-dialog>
</template>

<style lang="scss" scoped>
// 样式
.top-info {
  width: 100%;
  height: 50px;
  padding-right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 10px;
  background-color: #fff;

  .title {
    width: 75%;
    text-align: center;
  }
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px;
  width: 100%;
  height: 6vh;
  background-color: rgb(233 231 231);
}

.info-content {
  padding: 15px;
  border-radius: 10px;
  background-color: #fff;
}

.dialog-buts {
  width: 100%;
  display: flex;
  justify-content: space-around;
}

:deep .el-input .el-input--default .el-input--suffix {
  width: 200px !important;
}
</style>
