<template>
  <a-modal
    :title='title'
    :width='width'
    :visible='visible'
    :confirmLoading='confirmLoading'
    :bodyStyle='bodyStyle'
    @ok='handleOk'
    @cancel='handleCancel'
    :maskClosable='false'
    cancelText='关闭'
    :footer='null'>
    <a-spin :spinning='confirmLoading'>
      <a-form :form='form'>


        <a-row type='flex' justify='space-between'>
          <a-col :span='10'>

            <a-form-item label="发布企业" :labelCol="labelCol" :wrapperCol="wrapperCol" v-has="'require:saas'" :required="true">
              <template v-if="!model.id">
                <a-input-search
                  placeholder="选择发布企业"
                  disabled
                  v-decorator="[ 'companyName', validatorRules.companyId]"
                  @search="onSearch1">
                  <a-button slot="enterButton" icon="search" v-if="!model.id">选择</a-button>
                </a-input-search>
              </template>
              <template v-else>
                <a-input v-decorator="[ 'companyName',{rules: [{ required: true, message: '请选择发布企业' }],initialValue:model.companyName}]"  :disabled="true"></a-input>
              </template>
            </a-form-item>



            <a-form-item label="服务商" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-select type="list" v-decorator="['selectId',validatorRules.selectId]" :trigger-change="true" @change="changeSubcontractor"
                        :options="selectOption.options" placeholder="选择服务商" style="width: 100%"/>
            </a-form-item>

            <a-form-item label='需求名称' :labelCol='labelCol' :wrapperCol='wrapperCol'>
              <a-input v-decorator="[ 'name', validatorRules.name]" placeholder='请输入需求名称' style='width: 100%'></a-input>
            </a-form-item>


            <a-form-item label='所属行业' :labelCol='labelCol' :wrapperCol='wrapperCol'>
              <j-dict-select-tag type='list' v-decorator="['tradeType',validatorRules.tradeType]" :trigger-change='true'
                                 dictCode='trade_type' placeholder='请选择所属行业' style='width: 100%' disabled />
            </a-form-item>

            <a-form-item label='参考单价' :labelCol='labelCol' :wrapperCol='wrapperCol'>
              <a-input-number :min='0.01' v-decorator="[ 'price', validatorRules.price]" placeholder='请输入参考单价'
                              style='width: 100%' />
            </a-form-item>


            <a-form-item label='工作地点' :labelCol='labelCol' :wrapperCol='wrapperCol' :required='true'>
              <a-cascader :options='options' :value='arr' @change='onChange' placeholder='请选择工作地点'
                          changeOnSelect style='width: 100%' />
            </a-form-item>


            <a-form-item label='详细地址' :labelCol='labelCol' :wrapperCol='wrapperCol'>
              <a-input v-decorator="[ 'address', validatorRules.address]" placeholder='请输入详细地址'
                       style='width: 100%'></a-input>
            </a-form-item>


            <a-form-item label='需求时间' :labelCol='labelCol' :wrapperCol='wrapperCol'>
              <a-date-picker :disabled-date='disabledDate' placeholder='请选择需求时间'
                             v-decorator="[ 'requirementTime', validatorRules.requirementTime]" :trigger-change='true'
                             style='width: 100%' />
            </a-form-item>
          </a-col>
          <a-col :span='10'>

            <a-form-item label='需求描述' :labelCol='labelCol' :wrapperCol='wrapperCol'>
              <a-textarea v-decorator="['description', validatorRules.description]" rows='4' placeholder='请输入需求描述'
                          style='width: 100%' />
            </a-form-item>

            <a-form-item label='接单资质' :labelCol='labelCol' :wrapperCol='wrapperCol'>
              <a-textarea v-decorator="['qualification', validatorRules.qualification]" rows='4' placeholder='请输入接单资质'
                          style='width: 100%' />
            </a-form-item>
            <a-form-item label='验收标准' :labelCol='labelCol' :wrapperCol='wrapperCol'>
              <a-textarea v-decorator="['acceptanceCriteria', validatorRules.acceptanceCriteria]" rows='4'
                          placeholder='请输入验收标准' style='width: 100%' />
            </a-form-item>

          </a-col>
        </a-row>


      </a-form>
    </a-spin>
    <div class='drawer-bootom-button' v-show='!disableSubmit'>
      <a-button class='ant-btn' @click='handleCancel'>关闭</a-button>
      <a-button class='ant-btn ant-btn-primary' style='margin-left: 8px' @click='handleOk'>确定</a-button>
    </div>


     <company-select-window ref="companyWindow" @ok="modalFormOk1"></company-select-window>

    <select-part-a-sign-window ref='selectPartASignWindow' @ok='modalFormOk2'></select-part-a-sign-window>
  </a-modal>
</template>

<script>
import { USER_AUTH, SYS_BUTTON_AUTH } from '@/store/mutation-types'
import { httpAction, getAction } from '@/api/manage'
import pick from 'lodash.pick'
import JDate from '@/components/jeecg/JDate'
import JUpload from '@/components/jeecg/JUpload'
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
import data1 from '../../tools/area.json'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import moment from 'moment'
import SelectPartASignWindow from './SelectPartASignWindow'
import CompanySelectWindow from './CompanySelectWindow'

const getCompanyInfo = (params) => getAction('/requiremanager/hwRequirement/getCompanyInfo', params)
const findList = (params) => getAction('/saasmanager/hwPlatformCompany/allList', params)

const FILE_TYPE_ALL = 'all'
const FILE_TYPE_PDF = 'pdf'
const uidGenerator = () => {
  return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
const getFileName = (path) => {
  if (path.lastIndexOf('\\') >= 0) {
    let reg = new RegExp('\\\\', 'g')
    path = path.replace(reg, '/')
  }
  return path.substring(path.lastIndexOf('/') + 1)
}

export default {
  name: 'HwRequirementModal',
  components: {
    CompanySelectWindow,
    SelectPartASignWindow,
    JDate,
    JUpload,
    JSelectDepart,
    JDictSelectTag
  },
  data() {
    return {
      selectOption: {
        options: [

        ]
      },
      bodyStyle: {
        paddingTop: '20px',
        paddingBottom: '50px',
        height: (window.innerHeight * 0.75) + 'px',
        'overflow-y': 'auto'
      },
      allowClear: false,
      disableSubmit: false,
      uploadAction: window._CONFIG['domianURL'] + '/hpSys/common/ossUpload',
      urlDownload: window._CONFIG['domianURL'] + '/hpSys/common/ossDownload',
      headers: {},
      fileList: [],
      arr: [],  //存放回显默认省市区code
      provArray: [], //存放省
      cityArray: [],   //存放市
      countryArray: [],  //存放区
      form: this.$form.createForm(this),
      title: '操作',
      width: 1015,
      visible: false,
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      },
      options: [{
        value: '',
        label: '',
        isLeaf: false
      }],
      confirmDisabled: false,
      confirmLoading: false,
      valueInfo: [],
      selectedDepartKeys: [], //保存用户选择服务商id
      checkedDepartKeys: [],
      selectedDepartKeys1:[], //保存用户选择企业id
      checkedDepartKeys1:[],
      selectedDepartKeys1:[], //保存用户选择企业id
      checkedDepartKeys1:[],
      companyId:0,
      validatorRules: {
        platformCompanyId: { rules: [{ required: true, message: '请输入所属平台企业!' }] },
        code: { rules: [{ required: true, message: '请输入需求单号!' }] },
        name: { rules: [{ required: true, message: '请输入需求名称!' }] },
        tradeType: { rules: [{ required: true, message: '请输入所属行业' }] },
        description: { rules: [{ required: true, message: '请输入需求描述!' }] },
        qualification: {},
        acceptanceCriteria: {},
        number: { rules: [{ required: true, message: '请输入需求人数' }] },
        settlementMethod: { rules: [{ required: true, message: '请输入结算方式' }] },
        stage: { rules: [{ required: true, message: '请输入期数' }] },
        price: { rules: [{ required: true, message: '请输入参考单价' }] },
        address: {},
        companyId:{},
        subcontractorName:{},
        workContractType: { rules: [{ required: true, message: '请请选择合同方式' }] },
        selectId:{rules: [{ required: true, message: '请请选择服务商' }] },
        authenticationStatus: { rules: [{ required: true, message: '请输入认证状态' }] },
        createTime: { rules: [{ required: true, message: '请输入发布时间' }] },
        isOn: { rules: [{ required: true, message: '请输入状态' }] },
        typeEdit: {},
        requirementTime: { rules: [{ required: true, message: '请选择需求时间!' }] }
      },
      url: {
        fileUpload: window._CONFIG['domianURL'] + '/hpSys/common/ossUpload',
        add: '/requiremanager/hwRequirement/add',
        edit: '/requiremanager/hwRequirement/edit'
      }

    }
  },
  props: {
    text: {
      type: String,
      required: false,
      default: '点击上传'
    },
    fileType: {
      type: String,
      required: false,
      default: FILE_TYPE_ALL
    },
    /*这个属性用于控制文件上传的业务路径*/
    bizPath: {
      type: String,
      required: false,
      default: '/hpwork/hwcompany'
    },
    value: {
      type: String,
      required: false
    },
    //此属性被废弃了
    triggerChange: {
      type: Boolean,
      required: false,
      default: false
    }
  },
  watch: {
    value(val) {
      this.initFileList(val)
    }
  },
  created() {
    const token = Vue.ls.get(ACCESS_TOKEN)
    this.headers = { 'X-Access-Token': token }
    //省市区options完全拼接
    for (var i = 0; i < data1.length; i++) {
      this.cityArray = []
      for (let j = 0; j < data1[i].cityList.length; j++) {
        this.countryArray = []
        for (let k = 0; k < data1[i].cityList[j].areaList.length; k++) {
          var country = {
            value: data1[i].cityList[j].areaList[k].code,
            label: data1[i].cityList[j].areaList[k].name
          }
          this.countryArray.push(country)
        }
        var city = {
          value: data1[i].cityList[j].code,
          label: data1[i].cityList[j].name,
          children: this.countryArray
        }
        this.cityArray.push(city)
      }
      var prov = {
        value: data1[i].code,
        label: data1[i].name,
        children: this.cityArray
      }
      this.provArray.push(prov)
      this.options = this.provArray
    }

  },
  methods: {
    add() {
      this.edit({})
    },
    disabledDate(current) {
      // Can not select days before today and today
      return current && current > moment().endOf('day')
    },
    edit(record) {
      this.form = this.$form.createForm(this)
      this.form.resetFields()
      this.model = Object.assign({}, record)
      this.visible = true
      this.$nextTick(() => {
        this.form.setFieldsValue(pick(this.model, 'platformCompanyId', 'companyId', 'requirementTime', 'code', 'name', 'description', 'companyName', 'existEnroll', 'subcontractorName', 'qualification', 'workContractType', 'partASign', 'cpId', 'subcontractorId', 'acceptanceCriteria', 'number', 'stage', 'price', 'provinceCode', 'cityCode', 'countryCode', 'provinceCityCountry', 'address', 'serviceContract', 'authenticationStatus', 'createTime', 'serviceFeeRate', 'isOn', 'typeEdit', 'companyAuthenticationStatus', 'serviceTimeRange'))
        this.form.setFieldsValue({ tradeType: this.model.tradeType != null ? String(this.model.tradeType) : '' })
        this.form.setFieldsValue({ workContractType: this.model.workContractType != null ? String(this.model.workContractType) : '' })
        if(!this.model.requirementTime){
          this.form.setFieldsValue({ requirementTime:  moment(new Date()) })
        }else{
          this.form.setFieldsValue({ requirementTime: moment(this.model.requirementTime) })
        }
        this.selectedDepartKeys = []
        this.checkedDepartKeys = []
        this.selectedDepartKeys1 = [];
        this.checkedDepartKeys1 = [];
        this.valueInfo = []
        this.companyId=0
        if (this.model.isAutoOrder == 1) {
          this.valueInfo.push(1)
        }
        if (this.model.isAutoConfirm == 1) {
          this.valueInfo.push(2)
        }
        if (this.model.workContractType == 2) {
          this.confirmDisabled = true
          if (this.model.isAutoOrder == 1) {
            this.valueInfo = [1]
          } else {
            this.valueInfo = []
          }
        }
      })

      //回显省市区
      this.arr = []
      this.arr.push(String(this.model.provinceCode))
      this.arr.push(String(this.model.cityCode))
      this.arr.push(String(this.model.countryCode))

      //回显文件
      this.editFileList(this.model.serviceContract)
      //没有选择企业权限时componyid（部门id）掷为null
      //获取页面权限
      let authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || "[]");
      var bo=false;
      for (var auth of authList) {
        if(auth.action == 'require:saas') {
          bo=true
        }
      }
      //情况服务商选择数据
      this.selectOption.options=[]
      if(!bo) {
          this.querySubcontratorList(null);
      }
      //再次发布
      if(this.model.typeEdit==1){
        if(this.model.companyId){
          this.querySubcontratorList(this.model.companyId);
        }
      }
      if(!bo){
        this.model.companyId=null
        this.form.setFieldsValue({ companyId:null})
        //查询企业信息赋值
        this.getCompanyInfo()
      }
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    handleOk() {
      if (this.model.typeEdit == 1) {
        this.model.id = null
      }
      if (this.arr.length != 3 || this.arr[0] == 'undefined') {
        this.$message.warning('请选择工作地址')
        return
      }
      var companyName = this.form.getFieldValue('companyName')
      if(!companyName){
        //获取页面权限
        let authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || "[]");
        for (var auth of authList) {
          if(auth.action == 'require:saas') {
            this.$message.warning('请选择企业')
            return;
          }
        }
      }
      const that = this
      // 触发表单验证
      this.form.validateFields((err, values) => {
        if (!err) {
          that.confirmLoading = true
          let httpurl = ''
          let method = ''
          if (!this.model.id) {
            httpurl += this.url.add
            method = 'post'
          } else {
            httpurl += this.url.edit
            method = 'put'
          }

          let formData = Object.assign(this.model, values)
          if(this.selectedDepartKeys1[0]){
            formData.companyId=this.companyId
          }
          if (this.selectedDepartKeys[0]) {
            var cpType = this.selectedDepartKeys[0].substring(2, 3)
            //1:服务商 2：开心
            if (cpType == 1) {
              formData.subcontractorId = this.selectedDepartKeys[0].substring(0, 1)
            } else if (cpType == 2) {
              formData.cpId = this.selectedDepartKeys[0].substring(0, 1)
              formData.subcontractorId = this.selectedDepartKeys[0].substring(4, 5)
            }
          }
          var index = this.model.subcontractorName.lastIndexOf('\-')
          formData.subcontractorName = formData.subcontractorName.substring(index + 1, formData.subcontractorName.length)
          console.log('表单提交数据', formData)
          httpAction(httpurl, formData, method).then((res) => {
            if (res.success) {
              that.$message.success(res.message)
              that.$emit('ok')
              that.close()
            } else {
              this.$error({
                title: '提示',
                content: res.message,
                okText: '确定',
                centered: true,
                onOk: () => {

                }
              })
            }
          }).finally(() => {
            that.confirmLoading = false
          })
        }

      })
    },
    handleCancel() {
      this.close()
    },
    popupCallback(row) {
      this.form.setFieldsValue(pick(row, 'platformCompanyId', 'companyId', 'code', 'name', 'tradeType', 'description', 'qualification', 'acceptanceCriteria', 'number', 'settlementMethod', 'stage', 'price', 'provinceCode', 'cityCode', 'countryCode', 'provinceCityCountry', 'address', 'serviceContractType', 'serviceContract', 'authenticationStatus', 'createTime', 'serviceFeeRate', 'isOn', 'typeEdit', 'companyAuthenticationStatus', 'serviceTimeRange', 'serviceStartDate', 'serviceEndDate'))
    },

    //省市区改变
    onChange(value, label) {
      this.arr = value
      this.model.provinceCode = value[0]
      this.model.cityCode = value[1]
      this.model.countryCode = value[2]
      this.$nextTick(() => {
        this.form.setFieldsValue({ provinceCode: this.model.provinceCode })
        this.form.setFieldsValue({ cityCode: this.model.cityCode })
        this.form.setFieldsValue({ countryCode: this.model.countryCode })
        if (label.length == 3) {
          this.model.provinceCityCountry = label[0].label + '-' + label[1].label + '-' + label[2].label
          this.form.setFieldsValue({ provinceCityCountry: this.model.provinceCityCountry })
        }
      })

    },
    getselmethod(val) {
      this.model.settlementMethod = val
    },
    getcontractType(val) {
      this.model.serviceContractType = val
    },

    //回显文件所用
    editFileList(paths) {
      if (!paths || paths.length == 0) {
        //return [];
        // update-begin- --- author:os_chengtgen ------ date:20190729 ---- for:issues:326,Jupload组件初始化bug
        this.fileList = []
        return
        // update-end- --- author:os_chengtgen ------ date:20190729 ---- for:issues:326,Jupload组件初始化bug
      }
      let fileList = []
      let arr = paths.split(',')
      for (var a = 0; a < arr.length; a++) {
        fileList.push({
          uid: uidGenerator(),
          name: getFileName(arr[a]),
          status: 'done',
          url: this.urlDownload + '?fileName=' + arr[a]
        })
      }
      this.fileList = fileList
    },
    //上传文件所用
    initFileList(paths) {
      if (!paths || paths.length == 0) {
        //return [];
        // update-begin- --- author:os_chengtgen ------ date:20190729 ---- for:issues:326,Jupload组件初始化bug
        this.fileList = []
        return
        // update-end- --- author:os_chengtgen ------ date:20190729 ---- for:issues:326,Jupload组件初始化bug
      }
      let fileList = []
      let arr = paths.split(',')
      for (var a = 0; a < arr.length; a++) {
        fileList.push({
          uid: uidGenerator(),
          name: getFileName(arr[a]),
          status: 'done',
          url: this.urlDownload + arr[a],
          response: {
            status: 'history',
            message: arr[a]
          }
        })
      }
      this.fileList = fileList
    },
    handlePathChange() {
      let uploadFiles = this.fileList
      let path = ''
      if (!uploadFiles || uploadFiles.length == 0) {
        path = ''
      }
      let arr = []

      for (var a = 0; a < uploadFiles.length; a++) {
        arr.push(uploadFiles[a].response.message)
      }
      if (arr.length > 0) {
        path = arr.join(',')
      }
      this.$emit('change', path)
    },
    beforeUpload(file) {

      if (this.fileList.length >= 1) {
        this.$message.warning('只能上传一个文件')
        return false
      }
    },
    handleChange(info) {

      if (info.fileList.length > 1) {
        return false
      }
      var fileType = info.file.type
      if (fileType) {
        if (fileType.indexOf(FILE_TYPE_PDF) < 0) {
          this.$message.warning('请上传pdf文件')
          return false

        }
      }
      console.log('--文件列表改变--')
      let fileList = info.fileList
      if (info.file.status === 'done') {
        if (info.file.response.success) {
          fileList = fileList.map((file) => {
            if (file.response) {
              // file.url = this.urlDownload+file.response.message;
              this.model.serviceContract = file.response.message
            }
            return file
          })
        }
        this.$message.success(`${info.file.name} 上传成功!`)
      } else if (info.file.status === 'error') {
        this.$message.error(`${info.file.name} 上传失败.`)
      } else if (info.file.status === 'removed') {
        this.handleDelete(info.file)
      }
      this.fileList = fileList
      if (info.file.status === 'done' || info.file.status === 'removed') {
        this.handlePathChange()
      }
    },
    handleDelete(file) {
      //如有需要新增 删除逻辑
      console.log(file)
      this.fileList = []
    },
    onDateChange: function(value, dateString) {
      console.log(dateString[0], dateString[1])
      this.model.serviceStartDate = dateString[0] + ' 00:00:00'
      this.model.serviceEndDate = dateString[1] + ' 23:59:59'
    },
    onDateOk(value, dateString) {
      console.log(value)
    },
    viewContract(file) {
      window.open(window._CONFIG['imgDomainOssURL'] + this.model.serviceContract, '_blank', 'toolbar=yes')
    },

    //搜索企业
    onSearch1(){
      this.$refs.companyWindow.add(this.checkedDepartKeys1);
    },
    // 获取用户选择企业提交的返回数据
    modalFormOk1 (formData) {
      this.selectedDepartKeys1 = [];
      for (let i = 0; i < formData.departIdList.length; i++) {
        this.selectedDepartKeys1.push(formData.departIdList[i].key);
        this.form.setFieldsValue({ companyName: formData.departIdList[i].title })
      }
      this.checkedDepartKeys1 = this.selectedDepartKeys1  //更新当前的选择keys
      if(this.selectedDepartKeys1[0]){
        this.companyId = this.selectedDepartKeys1[0];
        //查询企业信息赋值
        this.getCompanyInfo( this.companyId)
        this.querySubcontratorList(this.companyId)
      }
    },
    //搜索服务商
    changeSubcontractor(val) {
      this.selectedDepartKeys=[]
      this.model.partASign=null
      this.selectedDepartKeys.push(this.selectOption.options[val].text)
      this.model.subcontractorName=this.selectOption.options[val].label;
      this.model.partASign=this.selectOption.options[val].subName;
    },

    //查询所有服务商列表
    querySubcontratorList(companyId) {
      findList({companyId:companyId}).then((res) => {
        if (res.success) {
          this.selectOption.options=[]
          this.selectedDepartKeys=[]
          this.model.partASign=null
          this.form.setFieldsValue({selectId:null})
          for(let i = 0;i<res.result.length;i++){
            var name=res.result[i].cpType==1? res.result[i].subcontractorName: res.result[i].cpAbbreviation+'-'+res.result[i].abbreviation;
            var text=res.result[i].cpSubcontractorId ? res.result[i].subcontractorId + ',' + res.result[i].cpType + ',' + res.result[i].cpSubcontractorId :res.result[i].subcontractorId + ',' + res.result[i].cpType
            var subName=res.result[i].cpType==1?res.result[i].subcontractorName:res.result[i].cpSubcontractorName
            this.selectOption.options.push({label: name, value:i,text:text,subName:subName})
            if(res.result.length==1){
              this.form.setFieldsValue({selectId:i})
              this.selectedDepartKeys.push(this.selectOption.options[0].text)
              this.model.subcontractorName=name;
              this.model.partASign=subName
            }
          }
         //如果是再次发布
          if(this.model.subcontractorName){
            //回显服务商
            this.setSub(this.selectOption.options)
          }
        }
      })
    },

   setSub(options){
     for (var i = 0; i < options.length; i++) {
       if (options[i].label.indexOf(this.model.subcontractorName)!=-1) {
         this.form.setFieldsValue({selectId:i})
         this.selectedDepartKeys.push(this.selectOption.options[i].text)
         this.model.subcontractorName=this.selectOption.options[i].label;
         this.model.partASign=this.selectOption.options[i].subName;
       }
     }
   },

    workContractType(e) {
      if (e != null && e != '') {
        this.form.setFieldsValue({ workContractType: e })
      }
      var workContractType = this.form.getFieldValue('workContractType')
      this.model.workContractType = workContractType == '' ? null : workContractType
      if (this.model.workContractType == 1) {
        this.confirmDisabled = true
        if (this.model.isAutoOrder == 1) {
          this.valueInfo = [1]
        } else {
          this.valueInfo = []
        }
        this.model.isAutoConfirm = 0
      } else {
        this.confirmDisabled = false
      }
    },
    onChangeSelect(checkedValues) {
      this.model.isAutoOrder = 0
      this.model.isAutoConfirm = 0
      if (checkedValues.length > 0) {
        for (let i = 0; i < checkedValues.length; i++) {
          if (checkedValues[i] == 1) {
            this.model.isAutoOrder = 1
          }
          if (checkedValues[i] == 2) {
            this.model.isAutoConfirm = 1
          }
        }
      }
    },


    //搜索甲方掐指农行
    onSearch2() {
      var cpType = 1
      if (this.form.getFieldValue('subcontractorName')) {
        //1:服务商 2：开心
        cpType = this.selectedDepartKeys[0].substring(2, 3)
      } else {
        this.$message.warning('请先选择服务商')
        return
      }
      this.$refs.selectPartASignWindow.add(cpType)
    },
    // 获取用户选择甲方签章提交的返回数据
    modalFormOk2(formData) {
      for (let i = 0; i < formData.departIdList.length; i++) {
        this.form.setFieldsValue({ partASign: formData.departIdList[i].title })
      }
    },


    //查询企业信息
    getCompanyInfo(companyId) {
      getCompanyInfo({companyId:companyId}).then((res) => {
        if (res.success) {
          this.$nextTick(() => {
            this.form.setFieldsValue({ tradeType: res.result.tradeType != null ? String(res.result.tradeType) : null })
            this.form.setFieldsValue({ address: res.result.address })
            this.model.provinceCode = res.result.provinceCode
            this.model.cityCode = res.result.cityCode
            this.model.countryCode = res.result.countryCode
            this.model.provinceCityCountry = res.result.provinceCityCountry
            this.model.address = res.result.address
            //回显省市区
            this.arr = []
            this.arr.push(String(this.model.provinceCode))
            this.arr.push(String(this.model.cityCode))
            this.arr.push(String(this.model.countryCode))
          })
        }
      })
    }


  }
}
</script>
<style>
.drawer-bootom-button {
  position: absolute;
  bottom: -8px;
  width: 100%;
  border-top: 1px solid #e8e8e8;
  padding: 10px 16px;
  text-align: right;
  left: 0;
  background: #fff;
  border-radius: 0 0 2px 2px;
}

.ant-upload {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}
</style>