<template>
  <main>
    <div class="bg_white m-20" style="margin-bottom: 70px;">
      <div class="wrap text-black p-t-20 p-b-20 p-l-40 p-r-40">
        <el-form ref="form" :model="form" :rules="rules" label-width="120px" class="m-t-20" label-position="left">
          <div class="basic_info">
            <h3>基础信息</h3>
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form-item label="编码" prop="" required>
                  <el-input v-model="form.id" style="width: 60%;" disabled="true" placeholder=""></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="专利名称" prop="name">
                  <el-input v-model="form.name" placeholder="请输入产品名称及型号" style="width: 60%;"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="申请进度" prop="progress">
                  <el-select v-model="form.progress" placeholder="请选择申请进度" @change="changeProgress">
                    <el-option v-for="(item, index) in progress" :key="index" :label="item.name" :value="item.id"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="10">
                <el-form-item label="项目负责人" prop="" required>
                  <template v-for="(item, index) in adminIds" :key="index">
                    <el-cascader
                      v-model="item.dept"
                      :options="deptData"
                      :props="{
                        expandTrigger: 'hover',
                        value: 'dept_code',
                        label: 'dept_name',
                        children: 'children',
                      }"
                      @change="changeDept"
                    >
                    </el-cascader>
                    <el-select v-model="item.user" multiple placeholder="请选择项目负责人" filterable @change="selAdmin">
                      <el-option v-for="(item1, index1) in item.adminData" :key="index1" :label="item1.staff_name" :value="item1.staff_code"></el-option>
                    </el-select>
                    <i class="el-icon-delete m-l-10" @click="deleteClick(item, index)"></i>
                  </template>
                  <i class="el-icon-circle-plus-outline m-l-10" @click="addAdmin"></i>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="申请人" prop="" required>
                  <template v-for="(item, index) in applyIds" :key="index">
                    <el-cascader
                      v-model="item.dept"
                      :options="deptData1"
                      :props="{
                        expandTrigger: 'hover',
                        value: 'dept_code',
                        label: 'dept_name',
                        children: 'children',
                      }"
                      @change="changeDept1"
                    >
                    </el-cascader>
                    <el-select v-model="item.user" multiple placeholder="请选择申请人" filterable @change="selApply">
                      <el-option v-for="(item1, index1) in item.applyData" :key="index1" :label="item1.staff_name" :value="item1.staff_code"></el-option>
                    </el-select>
                    <i class="el-icon-delete m-l-10" @click="deleteClick1(item, index)"></i>
                  </template>
                  <i class="el-icon-circle-plus-outline m-l-10" @click="addApply"></i>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form-item label="专利类型" prop="patent_type_id">
                  <el-select v-model="form.patent_type_id" placeholder="请选择专利类型" @change="changePatent">
                    <el-option v-for="(item, index) in patentType" :key="index" :label="item.name" :value="item.id"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="价值级别" prop="worth_level">
                  <el-select v-model="form.worth_level" placeholder="请选择价值级别" @change="changeWorth">
                    <el-option v-for="(item, index) in worthLevel" :key="index" :label="item.name" :value="item.id"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="申请主体" prop="org_ids">
                  <el-input v-model="form.org_ids" placeholder="请输入公司名称" style="width: 60%;" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form-item label="是否涉及国外" prop="is_outcountry">
                  <el-select v-model="form.is_outcountry" placeholder="请选择是否涉及国外" @change="changeArea">
                    <el-option v-for="(item, index) in outcountry" :key="index" :label="item.name" :value="item.id"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="申请国家" prop="apply_country">
                  <el-input v-model="form.apply_country" placeholder="多个国家间用“，”隔开" style="width: 60%;" />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="产品简介" prop="production_desc">
                  <el-input maxlength="100" show-word-limit type="textarea" placeholder="请输入产品简介" v-model="form.production_desc" style="width: 60%;"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="产品图片" prop="" required>
                  <el-upload
                      ref="upload"
                      :action="api_upload_url"
                      list-type="picture-card"
                      name="img"
                      :with-credentials = "true"
                      :on-success="handlePhotoSuccess"
                      :on-preview="handlePhotoPreview"
                      :limit="1"
                      :on-remove="handlePhotoRemove"
                      accept=".jpg,.png"
                      :on-exceed="handleExceed"
                      :file-list="imgList"
                  >
                    <el-button size="small" type="text"><i class="el-icon-plus"></i></el-button>
                  </el-upload>
                  <div class="el-upload__tip f_12 l_height_25">支持png、jpg格式, 上限1M</div>
                  <el-dialog v-model="dialogVisible">
                    <el-image width="100%" :src="dialogImageUrl" alt=""></el-image>
                  </el-dialog>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="技术交底书" prop="" required>
                  <el-upload
                    class="upload-demo"
                    :action="api_upload_url"
                    :with-credentials = "true"
                    :on-success="handleSuccess"
                    :on-preview="handlePreview"
                    :on-remove="handleRemove"
                    :before-upload="fileUpload"
                    :limit="1"
                    accept=".pdf, .xlsx, .docx, .doc, .xls"
                    :file-list="fileList"
                  >
                    <el-button size="small" type="primary">上传</el-button>
                    <template #tip>
                      <div class="el-upload__tip">
                        支持PDF、Word、Excel格式，限10M内
                      </div>
                    </template>
                  </el-upload>
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          <div class="others">
            <el-row>
              <el-col :span="12">
                <h3>查询结果</h3>
                <el-radio-group v-model="form.checkout_result" @change="changeSearch">
                  <el-radio v-for="(item, index) in checkData" :key="index" :label="item.id">{{ item.name }}</el-radio>
                </el-radio-group>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <h3>申请结果</h3>
                <el-radio-group v-model="form.apply_result" @change="changeApply">
                  <el-radio v-for="(item, index) in applyData" :key="index" :label="item.id">{{ item.name }}</el-radio>
                </el-radio-group>
              </el-col>
            </el-row>
            <h3>时间进度</h3>
            <el-row>
              <el-col :span="8">
                <el-form-item label="申请时间" prop="apply_time">
                  <el-date-picker 
                    v-model="form.apply_time" 
                    type="date" 
                    placeholder="请选择申请时间" 
                    value-format="YYYY-MM-DD"
                    @change="changeApplyTime">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="公告时间">
                  <el-date-picker 
                    v-model="form.publish_time" 
                    type="date" 
                    placeholder="请选择公告时间" 
                    value-format="YYYY-MM-DD"
                    @change="changePublishTime">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="续费时间">
                  <el-date-picker 
                    v-model="form.renewals_time" 
                    type="date" 
                    placeholder="请选择续费时间"
                    value-format="YYYY-MM-DD"
                    @change="changeRenewalsTime">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <h3>费用信息</h3>
            <el-row>
              <el-col :span="8">
                <el-form-item label="单价" prop="">
                  <el-input v-model="form.price" style="width: 60%;" placeholder="仅限数字，支持小数" @change="changePrice"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="数量" prop="">
                  <el-input v-model="form.num" style="width: 60%;" placeholder="仅限正整数" @change="changeNum"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="总计" prop="">
                  <el-input v-model="form.total_price" style="width: 60%;"  placeholder="" disabled="true"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </div>
        </el-form>
      </div>
    </div>
    <div class="bg_white m-t-10 p-l-20 p-r-20 p-t-10 p-b-10 text-black footer" style="width:100%;">
      <el-button type="primary" class="search_button" @click="submitClick('form')">提交</el-button>
    </div>
  </main>
</template>

<script>
import { reactive } from 'vue';
import { mapActions, mapState } from 'vuex'
export default {
  data() {
    return {
      id: '',
      form: {
        admin_ids: [],
        apply_man: [],
        apply_country: "",
        apply_result: "",
        apply_time: "",
        checkout_result: "",
        is_outcountry: '',
        name: "",
        num: 0,
        org_ids: "",
        patent_type_id: '',
        price: 0,
        production_desc: "",
        production_image: "",
        progress: '',
        publish_time: "",
        renewals_time: "",
        technical_disclosure: "",
        total_price: 0,
        worth_level: '',
      },
      adminIds: [],
      applyIds: [],
      deptData: [],
      deptData1: [],
      deptCodes: '',
      deptCodes1: '',
      rules: {
        name: [
          {
            required: true,
            message: '请输入产品名称及型号',
            trigger: 'blur',
          }
        ],
        progress: [
          {
            required: true,
            message: '请选择申请进度',
            trigger: 'change',
          }
        ],
        patent_type_id: [
          {
            required: true,
            message: '请选择专利类型',
            trigger: 'change',
          }
        ], 
        is_outcountry: [
          {
            required: true,
            message: '请选择是否涉及国外',
            trigger: 'change',
          }
        ],
        apply_country: [
          {
            required: true,
            message: '请选择申请国家',
            trigger: 'change',
          }
        ],
        worth_level: [
          {
            required: true,
            message: '请选择价值级别',
            trigger: 'change',
          }
        ],
        org_ids: [
          {
            required: true,
            message: '请输入公司名称',
            trigger: 'blur',
          }
        ],
        apply_time: [
          {
            type: 'date',
            required: true,
            message: '请选择申请时间',
            trigger: 'change',
          }
        ],
        production_desc: [
          {
            required: true,
            message: '请输入产品简介',
            trigger: 'blur',
          }
        ]
      },
      // adminData: [],
      progress: [],
      patentType: [],
      worthLevel: [],
      checkData: [],
      applyData: [],
      dialogVisible: false,
      dialogImageUrl: '',
      imgList: [],
      fileList: [],
      outcountry: [
        {
          id: 0,
          name: '否'
        },
        {
          id: 1,
          name: '是'
        }
      ],
      edit_params: {
        admin_ids: "",
        apply_man: '',
        apply_country: "",
        apply_result: "",
        apply_time: "",
        checkout_result: "",
        id: '',
        is_outcountry: 1,
        name: "",
        num: 0,
        org_ids: "",
        patent_type_id: '',
        price: "",
        production_desc: "",
        production_image: "",
        progress: 1,
        publish_time: "",
        renewals_time: "",
        technical_disclosure: "",
        total_price: "",
        worth_level: 1,
      }
    }
  },
  computed: {
    api_upload_url() {
      return process.env.VUE_APP_API_BASEURL + '/admin/patent/upload'
    },
    ...mapState({
      // 取出页面标签
      tags: (state) => state.topNavTag.tags
    })
  },
  created() {
    this.getListData()
    this.getAdminData()
  },
  activated() {
    this.id = this.$route.query.id
    this.getDetail()
  },
  beforeRouteUpdate(to,from,next){
    this.id = to.query.id
    if(to.fullPath!=from.fullPath){
      this.getDetail()
      next()
    }
  },
  methods: {
    ...mapActions({
      // 关闭标签及页面
      handleCloseTag: 'topNavTag/removeNavTag'
    }),
    // 获取列表数据
    getListData() {
      this.$http.get('patent/constList').then(res => {
        if (res.status == 200) {
          const data = res.data.data
          this.progress = data.progress
          this.patentType = data.patent_type_id
          this.worthLevel = data.worth_level
          this.checkData = data.checkout_result
          this.applyData = data.apply_result
        }
      })
    },
    // 获取项目负责人数据
    getAdminData() {
      this.$http.get('brand/getAllDeptList').then(res => {
        if (res.status == 200) {
          this.deptData = res.data.data
        }
      })
      this.$http.get('brand/getAllDeptList').then(res => {
        if (res.status == 200) {
          this.deptData1 = res.data.data
        }
      })
    },
    // 设置禁用选项
    setDisabled(data, data1) {
      data.forEach(item => {
        if (item.children) {
          item.children.forEach(item1 => {
            item1.disabled = false
            if (item1.children) {
              item1.children.forEach(item2 => {
                item2.disabled = false
                data1.forEach(ele => {
                  if (ele == item2.dept_code){
                    item2.disabled = true
                  }
                })
              })
            } else {
              data1.forEach(ele => {
                if (ele == item1.dept_code){
                  item1.disabled = true
                }
              })
            }
          })
        }
      })
    },
    //选择项目负责人--部门数据
    changeDept(val) {
      this.deptCodes = val[val.length - 1]
      this.adminIds.forEach((item, index) => {
        item.dept.forEach(item1 => {
          if (this.deptCodes == item1) {
            item.user = []
          }
        })
      })
      this.$http.get('brand/getUserListByDeptCode', { dept_code: this.deptCodes }).then(res => {
        if(res.status == 200) {
          this.adminIds.forEach((item, index) => {
            item.dept.forEach(item1 => {
              if (this.deptCodes == item1) {
                item.adminData = res.data.data
              }
            })
          })
        }
      })
      // 获取需要禁用的项
      let arr = []
      this.adminIds.forEach(item => {
        let dep_len = item.dept.length
        if (dep_len != 0) {
          arr.push(item.dept[dep_len - 1])
        }
      })
      // 调用禁用方法
      this.setDisabled(this.deptData, arr)
    },
    selAdmin(val) {
      console.log(val)
    },
    // 添加负责人
    addAdmin() {
      this.adminIds.push({ dept: [], user: [], adminData: []})
    },
    // 删除
    deleteClick(item, index) {
      console.log(item, index)
      if (this.adminIds.length <= 1) {
        this.$message({
          message: '请勿删除该数据！',
          type: 'warning'
        })
        return false
      }
      this.adminIds.splice(index, 1)
      // 获取需要禁用的项
      let arr = []
      this.adminIds.forEach(item => {
        let dep_len = item.dept.length
        if (dep_len != 0) {
          arr.push(item.dept[dep_len - 1])
        }
      })
      // 调用禁用方法
      this.setDisabled(this.deptData, arr)
    },
    // 申请人 -- 部门数据
    changeDept1(val) {
      console.log(val)
      this.deptCodes1 = val[val.length - 1]
      this.applyIds.forEach((item, index) => {
        item.dept.forEach(item1 => {
          if (this.deptCodes1 == item1) {
            item.user = []
          }
        })
      })
      this.$http.get('brand/getUserListByDeptCode', { dept_code: this.deptCodes1 }).then(res => {
        if(res.status == 200) {
          this.applyIds.forEach((item, index) => {
            item.dept.forEach(item1 => {
              if (this.deptCodes1 == item1) {
                item.applyData = res.data.data
              }
            })
          })
        }
      })
      // 获取需要禁用的项
      let arr1 = []
      this.applyIds.forEach(item => {
        let dep_len = item.dept.length
        if (dep_len != 0) {
          arr1.push(item.dept[dep_len - 1])
        }
      })
      // 调用禁用方法
      this.setDisabled(this.deptData1, arr1)
    },
    selApply(val) {
      console.log(val)
    },
    // 添加申请人
    addApply() {
      this.applyIds.push({ dept: [], user: [], applyData: []})
    },
    // 删除
    deleteClick1(item, index) {
      console.log(item, index)
      if (this.applyIds.length <= 1) {
        this.$message({
          message: '请勿删除该数据！',
          type: 'warning'
        })
        return false
      }
      this.applyIds.splice(index, 1)
      // 获取需要禁用的项
      let arr1 = []
      this.applyIds.forEach(item => {
        let dep_len = item.dept.length
        if (dep_len != 0) {
          arr1.push(item.dept[dep_len - 1])
        }
      })
      // 调用禁用方法
      this.setDisabled(this.deptData1, arr1)
    },
    // 数据回显
    getDepartment(val, type) {
      let deptCodes = ''
      deptCodes = val[val.length - 1]
      this.$http.get('brand/getUserListByDeptCode', { dept_code: deptCodes }).then(res => {
        if(res.status == 200) {
          if (type == 1) {
            this.adminIds.forEach((item, index) => {
              item.dept.forEach(item1 => {
                if (deptCodes == item1) {
                  item.adminData = res.data.data
                }
              })
            })
            this.adminIds = reactive(this.adminIds)
          } else {
            this.applyIds.forEach((item, index) => {
              item.dept.forEach(item1 => {
                if (deptCodes == item1) {
                  item.applyData = res.data.data
                }
              })
            })
            this.applyIds = reactive(this.applyIds)
          }
          // 获取需要禁用的项
          let arr = []
          if (type == 1) {
            this.adminIds.forEach(item => {
              let dep_len = item.dept.length
              if (dep_len != 0) {
                arr.push(item.dept[dep_len - 1])
              }
            })
            this.setDisabled(this.deptData, arr)
          } else {
            this.applyIds.forEach(item => {
              let dep_len = item.dept.length
              if (dep_len != 0) {
                arr.push(item.dept[dep_len - 1])
              }
            })
            this.setDisabled(this.deptData1, arr)
          }
        }
      })
    },
    // 专利详情
    getDetail() {
      this.$http.get('patent/read/id', { id: this.id }).then(res => {
        console.log(res)
        if (res.status == 200) {
          this.form = res.data.data
          this.imgList = [{name: 'logo', url: this.form.production_image}]
          this.fileList = [{name: '技术交底书', url: this.form.technical_disclosure}]
          this.dialogImageUrl = this.form.production_image
          this.form.apply_result = Number(this.form.apply_result)
          this.form.checkout_result = Number(this.form.checkout_result)
          // 处理负责人的数据回显
          const data = this.form.admin_ids
          data.forEach(item => {
            this.getDepartment(item.dept, 1)
          })
          this.adminIds = data
          //申请人的数据回显
          const data1 = this.form.apply_man
          data1.forEach(item => {
            this.getDepartment(item.dept, 2)
          })
          this.applyIds = data1
          // 未做修改直接保存
          let admin_ids = []
          let apply_man = []
          this.adminIds.forEach(item => {
            admin_ids.push({dept: item.dept, user: item.user})
          })
          this.edit_params.admin_ids = JSON.stringify(admin_ids)
          // 申请人
          this.applyIds.forEach(item => {
            apply_man.push({dept: item.dept, user: item.user})
          })
          this.edit_params.apply_man = JSON.stringify(apply_man)
          this.edit_params = {
            admin_ids: this.form.admin_ids,
            apply_country: this.form.apply_country,
            apply_result: this.form.apply_result,
            apply_time: this.form.apply_time,
            checkout_result: this.form.checkout_result,
            id: this.form.id,
            is_outcountry: this.form.is_outcountry,
            name: this.form.name,
            num: this.form.num,
            org_ids: this.form.org_ids,
            patent_type_id: this.form.patent_type_id,
            price: this.form.price,
            production_desc: this.form.production_desc,
            production_image: this.imgList[0].url,
            progress: this.form.progress,
            publish_time: this.form.publish_time,
            renewals_time: this.form.renewals_time,
            technical_disclosure: this.fileList[0].url,
            total_price: this.form.total_price,
            worth_level: this.form.worth_level,
          }
          if (this.edit_params.admin_ids) {
            this.edit_params.admin_ids = this.edit_params.admin_ids.join(',')
          }
        }
      })
    },
    //文件上传成功时
    handlePhotoSuccess(res, file, file_list) {
      if (res.status == 200) {
        this.edit_params.production_image = res.data.data.url
      }
    },
    //logo
    handlePhotoPreview(file) {
      this.dialogImageUrl = file.url
      this.dialogVisible = true
    },
    //文件列表移除
    handlePhotoRemove(file, fileList) {
      this.edit_params.production_image = ''
    },
    //文件超出个数限制
    handleExceed(files, fileList) {
      const fileLen = files.length
      const listLen = fileList.length
      if (fileLen > 1 || listLen >= 1) {
        this.$message({
          message: '只能上传一张产品图片!',
          type: 'warning'
        })
        return false
      }
    },
    fileUpload(file) {
      console.log(file)
      const isLt5M = file.size / 1024 / 1024 < 10
      if (!isLt5M) {
          this.$message({
              message: '上传文件大小不能超过 10MB!',
              type: 'warning'
          })
          return false
      }
      // 文件格式拦截
      const fileType = file.type
      if (fileType != 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' && fileType != 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' &&
      fileType != 'application/pdf' && fileType != 'application/msword') {
          this.$message({
              message: '上传失败,当前文件格式无法上传！',
              type: 'warning'
          })
          return false
      }
    },
    // 进度
    changeProgress(val) {
      this.edit_params.progress = val
    },
    //技术交底书
    handleSuccess(res, file, file_list) {
      if (res.status == 200) {
        this.edit_params.technical_disclosure = res.data.data.url
      }
    },
    handleRemove(file, fileList) {
      this.edit_params.technical_disclosure = ''
    },
    // 修改负责人
    // changeAdmin(val) {
    //   this.edit_params.admin_ids = val.join(',')
    // },
    // 专利类型
    changePatent(val) {
      this.edit_params.patent_type_id = val
    },
    // 是否涉及国外
    changeArea(val) {
      this.edit_params.is_outcountry = Number(val)
    },
    // 价值级别
    changeWorth(val) {
      this.edit_params.worth_level = val
    },
    // 查询结果
    changeSearch(val) {
      this.edit_params.checkout_result = val
    },
    // 申请结果
    changeApply(val) {
      this.edit_params.apply_result = val
    },
    // 申请时间
    changeApplyTime(val) {
      this.edit_params.apply_time = val
    },
    changePublishTime(val) {
      this.edit_params.publish_time = val
    },
    changeRenewalsTime(val) {
      this.edit_params.renewals_time = val
    },
    // 修改价格
    changePrice(val) {
      this.form.price = val
      this.edit_params.price = val
      // 数字，小数验证
      const regu = '^[0-9]+([.]{1}[0-9]+){0,1}$'
      const re = new RegExp(regu)
      if (!re.test(val)) {
          this.$message({
            type: 'error',
            message: '请输入数字/小数！'
          })
          this.form.price = ''
          this.edit_params.price = ''
      }
      this.calculation(this.form.price, this.edit_params.num)
    },
    // 修改数量
    changeNum(val) {
      this.form.num = val
      this.edit_params.num = val
      // 正整数验证
      const regu = '^[0-9]+$'
      const re = new RegExp(regu)
      if (!re.test(val)) {
          this.$message({
            type: 'error',
            message: '请输入正整数！'
          })
          this.form.num = ''
          this.edit_params.num = ''
      }
      this.calculation(this.edit_params.price, this.form.num)
    },
    // 计算合计费用
    calculation(price, num) {
      price = Number(price)
      num = Number(num)
      let total_price = 0
      total_price = (price*num).toFixed(2)
      console.log(total_price)
      this.form.total_price = total_price
      this.edit_params.total_price = total_price
    },
    //提交
    submitClick(form) {
      // 负责人
      let admin_ids = []
      let apply_man = []
      this.adminIds.forEach(item => {
        admin_ids.push({dept: item.dept, user: item.user})
      })
      this.edit_params.admin_ids = JSON.stringify(admin_ids)
      // 申请人
      this.applyIds.forEach(item => {
        apply_man.push({dept: item.dept, user: item.user})
      })
      this.edit_params.apply_man = JSON.stringify(apply_man)
      this.edit_params.name = this.form.name
      this.edit_params.apply_country = this.form.apply_country
      this.edit_params.org_ids = this.form.org_ids
      this.edit_params.production_desc = this.form.production_desc
      console.log(this.edit_params)
      this.$refs[form].validate((valid) => {
        if (!valid) {
          this.$message({
            type: 'error',
            message: '信息填写不完整！'
          })
          return false
        } else {
          this.$http.put('patent/update/id', this.edit_params ).then(res => {
            if (res.status == 200) {
              this.$message({
                type: 'success',
                message: res.message
              })
              this.getDetail()
              this.fileList = []
              this.imgList = []
              const currentPageName = this.$route.name
              const tags = this.tags
              const idx = tags.findIndex(it => it.name === currentPageName)
              if (idx >= 0) {
                this.handleCloseTag(idx)
              }
              this.$router.push({
                path: '/PIP/patent'
              })
            } else {
              this.$message({
                type: 'error',
                message: res.message
              })
            }
          })
        }
      })
    }
  }
}
</script>

<style scoped>
.basic_info{ border-bottom: 1px solid #dcdfe6;}
</style>