研究机构入驻
This commit is contained in:
@ -39,4 +39,12 @@ export function expert(data) {
|
||||
method:'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
// 专家入驻
|
||||
export function research(data) {
|
||||
return request({
|
||||
url: '/enterprise/v1/settled/research',
|
||||
method:'post',
|
||||
data
|
||||
});
|
||||
}
|
@ -124,7 +124,23 @@ export default {
|
||||
_value.push(item.value);
|
||||
}
|
||||
newVal.industrys = _key;
|
||||
this.industrysTags = _value;
|
||||
let keyObj = [];
|
||||
for (let i = 0; i < _key.length; i++) {
|
||||
keyObj.push([]);
|
||||
let array = _key[i].split("-");
|
||||
for (let j = 0; j < array.length; j++) {
|
||||
keyObj[i].push({
|
||||
id: array[j],
|
||||
});
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < _value.length; i++) {
|
||||
let array = _value[i].split(">");
|
||||
for (let j = 0; j < array.length; j++) {
|
||||
keyObj[i][j]["name"] = array[j];
|
||||
}
|
||||
}
|
||||
this.industrysTags = keyObj;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
146
src/views/identity/components/FieldSingle/index.vue
Normal file
146
src/views/identity/components/FieldSingle/index.vue
Normal file
@ -0,0 +1,146 @@
|
||||
<template>
|
||||
<el-form
|
||||
ref="form"
|
||||
:model="modelValue"
|
||||
:rules="rules"
|
||||
:label-width="labelWidth + 'px'"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="所属领域:" required>
|
||||
<el-row type="flex" justify="space-between">
|
||||
<el-col :span="6">
|
||||
<el-form-item prop="industrys">
|
||||
<el-select
|
||||
v-model="modelValue.industrys[0]"
|
||||
value-key="id"
|
||||
placeholder="请选择"
|
||||
@change="levelIChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in levelI"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-select
|
||||
v-model="modelValue.industrys[1]"
|
||||
value-key="id"
|
||||
placeholder="请选择"
|
||||
@change="levelIIChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in levelII"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-select
|
||||
v-model="modelValue.industrys[2]"
|
||||
value-key="id"
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in levelIII"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
<script>
|
||||
import { industry } from "@/api/config";
|
||||
export default {
|
||||
props: {
|
||||
modelValue: Object,
|
||||
labelWidth: {
|
||||
type: Number,
|
||||
default: 120,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
levelI: [], // I级数据
|
||||
levelII: [], // II级数据
|
||||
levelIII: [], // III级数据
|
||||
rules: {
|
||||
industrys: [
|
||||
{
|
||||
type: "array",
|
||||
required: true,
|
||||
message: "请选择",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
// modelValue(newVal, oldVal) {
|
||||
// let _key = [];
|
||||
// let _value = [];
|
||||
// for (let i = 0; i < newVal.industrys.length; i++) {
|
||||
// const item = newVal.industrys[i];
|
||||
// _key.push(item.key);
|
||||
// _value.push(item.value);
|
||||
// }
|
||||
// newVal.industrys = _key;
|
||||
// },
|
||||
},
|
||||
methods: {
|
||||
getFieldByParent(id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
industry({ parent_id: id })
|
||||
.then(({ code, msg, data }) => {
|
||||
if (code == 200) {
|
||||
resolve(data);
|
||||
} else {
|
||||
this.$modal.msgError(msg);
|
||||
reject({ msg, code });
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
async levelIChange(id) {
|
||||
delete this.modelValue.industrys[1];
|
||||
delete this.modelValue.industrys[2];
|
||||
this.levelII = await this.getFieldByParent(id);
|
||||
},
|
||||
async levelIIChange(id) {
|
||||
delete this.modelValue.industrys[2];
|
||||
this.levelIII = await this.getFieldByParent(id);
|
||||
},
|
||||
submitForm() {
|
||||
let flag = false;
|
||||
this.$refs["form"].validate((valid) => {
|
||||
flag = valid;
|
||||
});
|
||||
return flag;
|
||||
},
|
||||
},
|
||||
created() {
|
||||
industry().then((res) => {
|
||||
this.levelI = res.data;
|
||||
});
|
||||
},
|
||||
};
|
||||
</script>
|
201
src/views/identity/components/ResearchForm/index.vue
Normal file
201
src/views/identity/components/ResearchForm/index.vue
Normal file
@ -0,0 +1,201 @@
|
||||
<template>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="modelValue"
|
||||
:rules="rules"
|
||||
:label-width="labelWidth + 'px'"
|
||||
>
|
||||
<div class="form_title" v-if="showTitle">基本信息</div>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="机构logo:">
|
||||
<ImageUpload v-model="modelValue.image" :fileSize="2" :limit="1" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="机构名称" prop="name">
|
||||
<el-input v-model="modelValue.name"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="组织机构代码:" prop="code">
|
||||
<el-row type="flex" justify="space-between">
|
||||
<el-col :span="20">
|
||||
<el-input v-model="modelValue.code"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-button type="primary" @click="">查找</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<CityOptions v-model="modelValue" :labelWidth="labelWidth" ref="cityForm" />
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="详细地址:">
|
||||
<el-input v-model="modelValue.address"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<FieldSingle
|
||||
v-model="modelValue"
|
||||
:labelWidth="labelWidth"
|
||||
ref="fieldForm"
|
||||
/>
|
||||
|
||||
<InputBoxAdd
|
||||
:labelWidth="labelWidth"
|
||||
v-model="modelValue"
|
||||
title="研究方向"
|
||||
placeholder="请输入研究方向"
|
||||
fieldKey="researchs"
|
||||
ref="directionsForm"
|
||||
/>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="营业执照:" prop="license">
|
||||
<ImageUpload
|
||||
v-model="modelValue.license"
|
||||
:isShowTip="false"
|
||||
:limit="1"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="机构简介" prop="introduce">
|
||||
<Editor
|
||||
v-model="modelValue.introduce"
|
||||
:minHeight="150"
|
||||
ref="introduceRef"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
<script>
|
||||
import CityOptions from "../CityOptions";
|
||||
import FieldSingle from "../FieldSingle";
|
||||
import InputBoxAdd from "../InputBoxAdd";
|
||||
// import { researchSelect, laboratorySelect } from "@/api/identity/index";
|
||||
export default {
|
||||
components: {
|
||||
CityOptions,
|
||||
FieldSingle,
|
||||
InputBoxAdd,
|
||||
},
|
||||
props: {
|
||||
modelValue: Object,
|
||||
isAdd: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
showTitle: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
labelWidth: {
|
||||
type: Number,
|
||||
default: 120,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
rules: {
|
||||
product: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
name: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
kind: [{ required: true, message: "请选择", trigger: "change" }],
|
||||
code: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
mobile: [
|
||||
{ required: true, message: "请输入", trigger: "blur" },
|
||||
{
|
||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||
message: "请输入正确的手机号码",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
research_id: [{ required: true, message: "请选择", trigger: "change" }],
|
||||
tenant_id: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
],
|
||||
school: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
education: [{ required: true, message: "请选择", trigger: "change" }],
|
||||
major: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
job: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
title: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
work_at: [
|
||||
{
|
||||
required: true,
|
||||
message: "从业时间不能为空",
|
||||
trigger: ["change", "blur"],
|
||||
},
|
||||
],
|
||||
license: [
|
||||
{
|
||||
required: true,
|
||||
message: "请上传",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
],
|
||||
introduce: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入",
|
||||
trigger: ["change", "blur"],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
submitForm() {
|
||||
let flag = false;
|
||||
this.$refs["formRef"].validate((valid) => {
|
||||
const cityForm = this.$refs.cityForm.submitForm(); // 城市
|
||||
const fieldForm = this.$refs.fieldForm.submitForm();
|
||||
const directionsForm = this.$refs.directionsForm.submitForm();
|
||||
if (valid && cityForm && fieldForm && directionsForm) {
|
||||
flag = !flag;
|
||||
}
|
||||
});
|
||||
return flag;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.form_title {
|
||||
font-weight: 700;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
// 上传图片框限制
|
||||
// ::v-deep .el-upload--picture-card {
|
||||
// width: 120px;
|
||||
// height: 120px;
|
||||
// line-height: 120px;
|
||||
// }
|
||||
.el-select,
|
||||
.el-date-editor {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
@ -1,3 +1,35 @@
|
||||
<template>
|
||||
<div>research</div>
|
||||
</template>
|
||||
<div class="app-container">
|
||||
<el-card shadow="always" style="width: 55%; margin: 0 auto">
|
||||
<ResearchForm
|
||||
v-model="form"
|
||||
:isAdd="false"
|
||||
:labelWidth="labelWidth"
|
||||
ref="researchForm"
|
||||
/>
|
||||
<div :style="{ marginLeft: labelWidth + 'px' }">
|
||||
<el-button @click="$router.go(-1)">取消</el-button>
|
||||
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { research } from "@/api/identity/index";
|
||||
import ResearchForm from "./components/ResearchForm";
|
||||
const { proxy } = getCurrentInstance();
|
||||
const labelWidth = 140;
|
||||
const form = reactive({
|
||||
industrys: [],
|
||||
});
|
||||
function submitForm(status) {
|
||||
if (proxy.$refs.researchForm.submitForm()) {
|
||||
research(form).then((res) => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
proxy.$router.go(-1);
|
||||
});
|
||||
} else {
|
||||
console.log("校验未通过");
|
||||
}
|
||||
}
|
||||
</script>
|
Reference in New Issue
Block a user