Browse Source

修改企业选择

zs 8 tháng trước cách đây
mục cha
commit
b761ac0004
2 tập tin đã thay đổi với 69 bổ sung4 xóa
  1. 66 0
      src/views/center/basic.vue
  2. 3 4
      src/views/center/company.vue

+ 66 - 0
src/views/center/basic.vue

@@ -2,6 +2,12 @@
   <div class="index">
     <el-row>
       <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <div class="thr" v-if="companyInfo && companyInfo.id">
+          <el-select size="large" style="width: 350px" clearable v-model="incubator_id" filterable remote reserve-keyword placeholder="请输入想要选择的孵化器" :remote-method="remoteMethod" :loading="searchLoading">
+            <el-option v-for="item in searchList" :key="item.id" :label="item.name" :value="item.id" />
+          </el-select>
+          <el-button class="button" size="large" @click="toSave" type="primary">确定</el-button>
+        </div>
         <el-col :span="24" class="one">基本信息 </el-col>
         <el-col :span="24" class="two">
           <el-form label-position="top" ref="ruleFormRef" :model="form" :rules="rules" label-width="80px" class="form">
@@ -62,6 +68,7 @@
 </template>
 
 <script setup>
+import moment from 'moment'
 import { cloneDeep, get } from 'lodash-es'
 import { UserStore } from '@/store/user'
 const userStore = UserStore()
@@ -69,11 +76,25 @@ const user = computed(() => userStore.user)
 import { UsersStore } from '@/store/api/user/user'
 import { DictDataStore } from '@/store/api/system/dictData'
 import { SectorStore } from '@/store/api/platform/sector'
+// 接口
+import { CompanyStore } from '@/store/api/user/company'
+import { CirelationStore } from '@/store/api/user/cirelation'
+import { IncubatorStore } from '@/store/api/user/incubator'
+const incubatorStore = IncubatorStore()
+const companystore = CompanyStore()
+const cirelationStore = CirelationStore()
 const store = UsersStore()
 const dictDataStore = DictDataStore()
 const sectorStore = SectorStore()
 const $checkRes = inject('$checkRes')
 const form = ref({ industry: [] })
+
+// 加载中
+const searchLoading = ref(false)
+const searchList = ref([])
+const incubator_id = ref('')
+const companyInfo = ref({})
+
 // 表单验证
 const ruleFormRef = ref()
 const validatePhoneNumber = (rule, value, callback) => {
@@ -127,7 +148,15 @@ const searchOther = async () => {
   if ($checkRes(result)) genderList.value = result.data
   // 板块
   result = await sectorStore.query({ is_use: '0' })
+
   if ($checkRes(result)) plateList.value = result.data
+  if (user.value.id) {
+    let res = await companystore.query({ user: user.value.id, status: '1' })
+    if (res.errcode == '0') {
+      if (res.data[0] && !res.data[0].logo) res.data[0].logo = []
+      companyInfo.value = res.data[0] || { logo: [] }
+    }
+  }
 }
 // 保存
 const submitForm = async (ruleFormRef) => {
@@ -142,6 +171,35 @@ const submitForm = async (ruleFormRef) => {
     }
   })
 }
+const remoteMethod = (query) => {
+  if (query) {
+    searchLoading.value = true
+    setTimeout(async () => {
+      searchLoading.value = false
+      const info = { status: '1', name: query }
+      const res = await incubatorStore.query(info)
+      if (res.errcode == '0') searchList.value = res.data
+    }, 200)
+  } else {
+    searchList.value = []
+  }
+}
+const toSave = () => {
+  ElMessageBox.confirm(`您确认选择该数据?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
+    .then(async () => {
+      const data = {
+        user: user.value.id,
+        incubator: incubator_id.value,
+        company: companyInfo.value.id,
+        time: moment().format('YYYY-MM-DD'),
+        status: '0'
+      }
+      const res = await cirelationStore.create(data)
+      if ($checkRes(res, true)) ElMessage({ message: `申请进入孵化器成功等待审核`, type: 'success' })
+      incubator_id.value = ''
+    })
+    .catch(() => {})
+}
 </script>
 <style scoped lang="scss">
 .main {
@@ -156,5 +214,13 @@ const submitForm = async (ruleFormRef) => {
       text-align: center;
     }
   }
+  .thr {
+    display: flex;
+    align-items: center;
+    margin: 0 0 10px 0;
+    .button {
+      margin: 0 0 0 5px;
+    }
+  }
 }
 </style>

+ 3 - 4
src/views/center/company.vue

@@ -3,7 +3,7 @@
     <el-row>
       <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
         <div class="one">
-          <el-select size="large" style="width: 350px" clearable v-model="company_id" filterable remote reserve-keyword placeholder="请输入想要选择的企业搜索的内容" :remote-method="remoteMethod" :loading="searchLoading">
+          <el-select size="large" style="width: 350px" clearable v-model="company_id" filterable remote reserve-keyword placeholder="请输入想要选择的企业" :remote-method="remoteMethod" :loading="searchLoading">
             <el-option v-for="item in searchList" :key="item.id" :label="item.name" :value="item.id" />
           </el-select>
           <el-button class="button" size="large" @click="toSave" type="primary">确定</el-button>
@@ -37,7 +37,7 @@
     <el-dialog v-model="dialog.show" :title="dialog.title" :destroy-on-close="false" @close="toClose">
       <el-row>
         <el-col :span="24" v-if="dialog.type == '1'">
-          <custom-form v-model="examForm" :fields="examFormFields" :rules="examRules" @save="toExamSave">
+          <custom-form v-model="examForm" :fields="examFormFields" :rules="examRules" @save="toExamSave" :DraftSave="false" submitText="提交">
             <template #status>
               <el-option v-for="i in statusList" :key="i.id" :label="i.label" :value="i.value"></el-option>
             </template>
@@ -97,7 +97,7 @@ const searchOther = async () => {
   result = await dictDataStore.query({ code: 'examStatus', is_use: '0' })
   if ($checkRes(result)) statusList.value = result.data
   if (user.value.id) {
-    let res = await incubatorStore.query({ user: user.value.id })
+    let res = await incubatorStore.query({ user: user.value.id, status: '1' })
     if (res.errcode == '0') {
       if (!res.data[0].logo) res.data[0].logo = []
       incubatorInfo.value = res.data[0] || { logo: [] }
@@ -108,7 +108,6 @@ const search = async () => {
   const info = {
     skip: 0,
     limit: 6,
-    user: user.value.id,
     incubator: incubatorInfo.value.id
   }
   const res = await cirelationStore.list(info)