2022-09-20 17:31:39 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
<el-card shadow="always" style="width: 55%; margin: 0 auto">
|
|
|
|
|
<el-form
|
|
|
|
|
ref="formRef"
|
|
|
|
|
:model="form"
|
|
|
|
|
:rules="rules"
|
|
|
|
|
:label-width="labelWidth + 'px'"
|
|
|
|
|
>
|
2023-07-11 17:21:34 +08:00
|
|
|
|
<p>
|
|
|
|
|
<b> {{ t("admin.form.basicInfo") }}</b>
|
|
|
|
|
</p>
|
2022-09-20 17:31:39 +08:00
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="24">
|
2023-07-31 15:40:23 +08:00
|
|
|
|
<el-form-item
|
|
|
|
|
:label="
|
|
|
|
|
t('admin.form.name', {
|
|
|
|
|
type: t('routes.company.technicalDemand'),
|
|
|
|
|
})
|
|
|
|
|
"
|
|
|
|
|
prop="title"
|
|
|
|
|
>
|
2022-09-20 17:31:39 +08:00
|
|
|
|
<el-input v-model="form.title"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
2022-11-17 17:29:47 +08:00
|
|
|
|
<!-- <el-row>
|
2022-09-20 17:31:39 +08:00
|
|
|
|
<el-col :span="24">
|
2022-11-17 17:29:47 +08:00
|
|
|
|
// <el-checkbox label="0" @change="handleCheck">其他</el-checkbox>
|
2023-07-11 17:21:34 +08:00
|
|
|
|
<el-form-item :label="t('admin.form.category', {type:t('admin.common.demand')})" prop="kinds">
|
2022-09-20 17:31:39 +08:00
|
|
|
|
<el-checkbox-group v-model="form.kinds">
|
|
|
|
|
<el-checkbox
|
|
|
|
|
v-for="item in checkList"
|
|
|
|
|
:key="item.id"
|
|
|
|
|
:label="item.name"
|
|
|
|
|
>{{ item.name }}</el-checkbox
|
|
|
|
|
>
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="20">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="checkInput"
|
|
|
|
|
placeholder="请输入需求类别"
|
|
|
|
|
></el-input>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="4">
|
|
|
|
|
<el-button type="primary" @click="addCheck">添加</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2022-11-17 17:29:47 +08:00
|
|
|
|
</el-row> -->
|
2022-09-20 17:31:39 +08:00
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="24">
|
2023-07-17 15:47:45 +08:00
|
|
|
|
<el-form-item
|
|
|
|
|
:label="t('webSearch.demandDescription')"
|
|
|
|
|
prop="introduce"
|
|
|
|
|
>
|
2023-07-27 17:31:39 +08:00
|
|
|
|
<!-- <wangEditor
|
|
|
|
|
v-model="form.introduce"
|
|
|
|
|
:placeholder="t('webSearch.pleaseEnterTheContentOfTheTechnicalRequirementsAndTheDetailedTechnicalIndicators')"
|
|
|
|
|
width="100%"
|
|
|
|
|
min-height="150px"
|
|
|
|
|
@blur="formRef.validateField(`introduce`)"
|
|
|
|
|
></wangEditor>-->
|
|
|
|
|
<el-input
|
|
|
|
|
type="textarea"
|
2022-09-20 17:31:39 +08:00
|
|
|
|
v-model="form.introduce"
|
2023-07-27 17:31:39 +08:00
|
|
|
|
:autosize="{ minRows: 6, maxRows: 8 }"
|
|
|
|
|
:placeholder="
|
|
|
|
|
t(
|
|
|
|
|
'webSearch.pleaseEnterTheContentOfTheTechnicalRequirementsAndTheDetailedTechnicalIndicators'
|
|
|
|
|
)
|
|
|
|
|
"
|
|
|
|
|
></el-input>
|
2022-09-20 17:31:39 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
2022-11-22 17:31:02 +08:00
|
|
|
|
<field-options
|
2022-09-20 17:31:39 +08:00
|
|
|
|
v-model="form"
|
|
|
|
|
:labelWidth="labelWidth"
|
|
|
|
|
ref="fieldFormRef"
|
|
|
|
|
/>
|
2023-07-31 15:40:23 +08:00
|
|
|
|
<!--<city-options
|
|
|
|
|
v-model="form"
|
|
|
|
|
:labelWidth="labelWidth"
|
|
|
|
|
ref="cityFormRef"
|
|
|
|
|
></city-options>-->
|
2022-09-20 17:31:39 +08:00
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item
|
2023-07-31 15:40:23 +08:00
|
|
|
|
:label="t('admin.form.achievementDemandBudget')"
|
2022-09-20 17:31:39 +08:00
|
|
|
|
:prop="form.budgetMode == 1 ? 'budget' : ''"
|
|
|
|
|
>
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="form.budget"
|
|
|
|
|
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')"
|
2023-07-31 15:40:23 +08:00
|
|
|
|
:placeholder="
|
|
|
|
|
t('admin.form.placeholder', {
|
|
|
|
|
type: t('admin.form.technicalDemandBudget'),
|
|
|
|
|
})
|
|
|
|
|
"
|
2022-09-20 17:31:39 +08:00
|
|
|
|
>
|
2023-07-31 15:40:23 +08:00
|
|
|
|
<template #append
|
|
|
|
|
>{{ t("admin.table.tenThousandYuan") }}
|
|
|
|
|
</template>
|
2022-09-20 17:31:39 +08:00
|
|
|
|
</el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label-width="50px">
|
|
|
|
|
<el-checkbox
|
|
|
|
|
false-label="1"
|
|
|
|
|
true-label="2"
|
|
|
|
|
v-model="form.budgetMode"
|
2023-07-31 15:40:23 +08:00
|
|
|
|
>{{ t("tips.faceToFace") }}
|
2023-07-27 17:31:39 +08:00
|
|
|
|
</el-checkbox>
|
2022-09-20 17:31:39 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="12">
|
2023-07-19 09:22:11 +08:00
|
|
|
|
<el-form-item :label="t('admin.table.deadline')" prop="deadline">
|
2022-09-20 17:31:39 +08:00
|
|
|
|
<el-date-picker
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
v-model="form.deadline"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="YYYY-MM-DD"
|
2023-07-28 17:28:29 +08:00
|
|
|
|
:placeholder="
|
|
|
|
|
t('admin.form.pleaseSelect', {
|
|
|
|
|
type: t('admin.table.deadline'),
|
|
|
|
|
})
|
|
|
|
|
"
|
2022-09-20 17:31:39 +08:00
|
|
|
|
>
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="12">
|
2023-07-17 15:47:45 +08:00
|
|
|
|
<el-form-item :label="t('admin.form.demandContact')" prop="name">
|
2022-09-20 17:31:39 +08:00
|
|
|
|
<el-input
|
|
|
|
|
v-model="form.name"
|
2023-07-28 17:28:29 +08:00
|
|
|
|
:placeholder="
|
|
|
|
|
t('admin.form.placeholder', {
|
|
|
|
|
type: t('admin.form.demandContact'),
|
|
|
|
|
})
|
|
|
|
|
"
|
2022-09-20 17:31:39 +08:00
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
2023-07-17 15:47:45 +08:00
|
|
|
|
<el-form-item :label="t('admin.form.contactPhone')" prop="mobile">
|
2023-07-28 17:28:29 +08:00
|
|
|
|
<!-- maxlength="11"-->
|
2022-09-20 17:31:39 +08:00
|
|
|
|
<el-input
|
|
|
|
|
v-model="form.mobile"
|
2023-07-28 17:28:29 +08:00
|
|
|
|
:placeholder="
|
|
|
|
|
t('admin.form.placeholder', {
|
|
|
|
|
type: t('admin.form.contactPhone'),
|
|
|
|
|
})
|
|
|
|
|
"
|
2022-09-20 17:31:39 +08:00
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
2022-10-19 00:22:39 +08:00
|
|
|
|
<!-- <el-row>
|
2022-09-20 17:31:39 +08:00
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="需求提交人:" prop="commitUserName">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="form.commitUserName"
|
|
|
|
|
placeholder="请输入需求提交人"
|
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="需求提交人手机号:" prop="commitUserPhone">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="form.commitUserPhone"
|
|
|
|
|
placeholder="请输入需求提交人手机号"
|
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2022-10-19 00:22:39 +08:00
|
|
|
|
</el-row> -->
|
2022-09-20 17:31:39 +08:00
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="24">
|
2022-11-22 17:31:02 +08:00
|
|
|
|
<input-box-add
|
2022-11-17 17:29:47 +08:00
|
|
|
|
class="cooperation-mode"
|
2022-09-20 17:31:39 +08:00
|
|
|
|
:labelWidth="labelWidth"
|
|
|
|
|
v-model="form"
|
2023-07-26 17:24:49 +08:00
|
|
|
|
:title="t('webSearch.cooperationMode')"
|
2023-08-01 17:26:50 +08:00
|
|
|
|
:placeholder="t('admin.table.cooperationType')"
|
2022-09-20 17:31:39 +08:00
|
|
|
|
fieldKey="wants"
|
|
|
|
|
ref="directionsFormRef"
|
|
|
|
|
/>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-form>
|
2022-10-31 17:46:09 +08:00
|
|
|
|
<!-- <div :style="{ marginLeft: labelWidth + 'px' }">
|
2023-07-11 17:21:34 +08:00
|
|
|
|
<el-button @click="router.go(-1)">{{ t("admin.common.cancel") }}</el-button>
|
|
|
|
|
<el-button type="primary" @click="submitForm">{{ t('admin.common.submit') }}</el-button>
|
2022-10-31 17:46:09 +08:00
|
|
|
|
</div> -->
|
|
|
|
|
<div :style="{ marginLeft: labelWidth + 'px' }">
|
2023-07-28 17:28:29 +08:00
|
|
|
|
<el-button type="primary" @click="submitForm(3)"
|
|
|
|
|
>{{ t("admin.form.saveDraft") }}
|
|
|
|
|
</el-button>
|
2023-07-11 17:21:34 +08:00
|
|
|
|
<el-button type="primary" @click="submitForm(1)"
|
2023-07-28 17:28:29 +08:00
|
|
|
|
>{{ t("admin.common.submitAudit") }}
|
2023-07-27 17:31:39 +08:00
|
|
|
|
</el-button>
|
2022-09-20 17:31:39 +08:00
|
|
|
|
</div>
|
|
|
|
|
</el-card>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup>
|
|
|
|
|
// import { expert } from "@/api/identity/index";
|
2023-07-17 15:47:45 +08:00
|
|
|
|
import { insertTechnologyDemand } from "@/api/admin/enterprise";
|
|
|
|
|
import { useI18n } from "vue-i18n";
|
|
|
|
|
import { useRoute, useRouter } from "vue-router";
|
2022-09-20 17:31:39 +08:00
|
|
|
|
import FieldOptions from "@/views/components/FieldOptions";
|
|
|
|
|
import InputBoxAdd from "@/views/components/InputBoxAdd";
|
2023-07-31 15:40:23 +08:00
|
|
|
|
import {
|
|
|
|
|
computed,
|
|
|
|
|
getCurrentInstance,
|
|
|
|
|
onMounted,
|
|
|
|
|
reactive,
|
|
|
|
|
ref,
|
|
|
|
|
toRefs,
|
|
|
|
|
} from "vue";
|
2022-09-20 17:31:39 +08:00
|
|
|
|
import { ElMessage } from "element-plus";
|
2023-07-17 15:47:45 +08:00
|
|
|
|
import { updateCount } from "@/api/admin/count";
|
2022-10-19 00:22:39 +08:00
|
|
|
|
import {
|
|
|
|
|
getTechnologyDemand,
|
|
|
|
|
updateTechnologyDemand,
|
|
|
|
|
} from "@/api/admin/enterprise/demand";
|
2023-07-17 15:47:45 +08:00
|
|
|
|
import tab from "@/plugins/tab";
|
2023-07-27 17:31:39 +08:00
|
|
|
|
|
2023-07-17 15:47:45 +08:00
|
|
|
|
const { t } = useI18n();
|
2022-09-20 17:31:39 +08:00
|
|
|
|
const router = useRouter();
|
2022-10-19 00:22:39 +08:00
|
|
|
|
const route = useRoute();
|
2022-09-20 17:31:39 +08:00
|
|
|
|
const data = reactive({
|
|
|
|
|
form: {
|
|
|
|
|
check: [],
|
|
|
|
|
},
|
|
|
|
|
queryParams: {
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
postCode: undefined,
|
|
|
|
|
},
|
|
|
|
|
rules: {
|
2023-07-31 15:40:23 +08:00
|
|
|
|
title: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
/*"需求名称不能为空"*/
|
|
|
|
|
message: computed(() =>
|
|
|
|
|
t("admin.validation.required", {
|
|
|
|
|
type: t("admin.form.name", {
|
|
|
|
|
type: t("admin.common.demand"),
|
|
|
|
|
}),
|
|
|
|
|
})
|
|
|
|
|
),
|
|
|
|
|
trigger: "blur",
|
|
|
|
|
},
|
|
|
|
|
],
|
2022-09-20 17:31:39 +08:00
|
|
|
|
introduce: [
|
2023-07-31 15:40:23 +08:00
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
/*"需求描述不能为空"*/
|
|
|
|
|
message: computed(() =>
|
|
|
|
|
t("admin.validation.required", {
|
|
|
|
|
type: t("webSearch.demandDescription"),
|
|
|
|
|
})
|
|
|
|
|
),
|
|
|
|
|
trigger: "change",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
name: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
/*"需求联系人不能为空"*/
|
|
|
|
|
message: computed(() =>
|
|
|
|
|
t("admin.validation.required", {
|
|
|
|
|
type: t("admin.form.demandContact"),
|
|
|
|
|
})
|
|
|
|
|
),
|
|
|
|
|
trigger: "blur",
|
|
|
|
|
},
|
2022-09-20 17:31:39 +08:00
|
|
|
|
],
|
|
|
|
|
mobile: [
|
2022-11-22 17:31:02 +08:00
|
|
|
|
{
|
2023-07-28 17:28:29 +08:00
|
|
|
|
required: true,
|
|
|
|
|
/*"联系人手机号不能为空"*/
|
|
|
|
|
message: computed(() =>
|
|
|
|
|
t("admin.validation.required", {
|
2023-07-31 17:27:13 +08:00
|
|
|
|
type: t("admin.form.demandContact"),
|
2023-07-28 17:28:29 +08:00
|
|
|
|
})
|
|
|
|
|
),
|
2022-11-22 17:31:02 +08:00
|
|
|
|
trigger: "blur",
|
|
|
|
|
},
|
2023-07-28 17:28:29 +08:00
|
|
|
|
// {
|
|
|
|
|
// pattern: /^1[3456789]\d{9}$/,
|
|
|
|
|
// message: "手机号格式不正确",
|
|
|
|
|
// trigger: "blur",
|
|
|
|
|
// },
|
2022-09-20 17:31:39 +08:00
|
|
|
|
],
|
|
|
|
|
commitUserName: [
|
2023-07-27 17:31:39 +08:00
|
|
|
|
{
|
|
|
|
|
required: true,
|
2023-07-28 17:28:29 +08:00
|
|
|
|
message: computed(() =>
|
|
|
|
|
t("admin.validation.required", {
|
|
|
|
|
type: t("webContact.demandContact"),
|
|
|
|
|
})
|
|
|
|
|
),
|
2023-07-27 17:31:39 +08:00
|
|
|
|
trigger: "blur",
|
|
|
|
|
},
|
2022-09-20 17:31:39 +08:00
|
|
|
|
],
|
2022-10-31 17:46:09 +08:00
|
|
|
|
kinds: [
|
2023-07-27 17:31:39 +08:00
|
|
|
|
{
|
|
|
|
|
required: true,
|
2023-07-28 17:28:29 +08:00
|
|
|
|
message: computed(() =>
|
|
|
|
|
t("admin.form.pleaseSelect", { type: t("webContact.demandType") })
|
|
|
|
|
),
|
2023-07-27 17:31:39 +08:00
|
|
|
|
trigger: "change",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
budget: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
2023-07-28 17:28:29 +08:00
|
|
|
|
message: computed(() =>
|
|
|
|
|
t("admin.validation.required", { type: t("webContact.demandBudget") })
|
|
|
|
|
),
|
2023-07-27 17:31:39 +08:00
|
|
|
|
trigger: "blur",
|
|
|
|
|
},
|
2022-10-31 17:46:09 +08:00
|
|
|
|
],
|
2022-09-20 17:31:39 +08:00
|
|
|
|
deadline: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
2023-07-28 17:28:29 +08:00
|
|
|
|
message: computed(() =>
|
|
|
|
|
t("admin.form.pleaseSelect", { type: t("admin.table.deadline") })
|
|
|
|
|
),
|
2022-09-20 17:31:39 +08:00
|
|
|
|
trigger: ["change", "blur"],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
commitUserPhone: [
|
2023-07-28 17:28:29 +08:00
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: computed(() =>
|
|
|
|
|
t("admin.validation.required", {
|
|
|
|
|
type: t("admin.form.demandSubmitterPhone"),
|
|
|
|
|
})
|
|
|
|
|
),
|
|
|
|
|
trigger: "blur",
|
|
|
|
|
},
|
2022-09-20 17:31:39 +08:00
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const { queryParams, form, rules } = toRefs(data);
|
|
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
|
|
const labelWidth = 160;
|
|
|
|
|
// const isContainOther = ref(false);
|
|
|
|
|
const checkList = reactive([
|
|
|
|
|
{
|
|
|
|
|
id: 1,
|
|
|
|
|
name: "成果推广",
|
2023-08-01 15:50:13 +08:00
|
|
|
|
nameRu: "Продвижение достижений",
|
2022-09-20 17:31:39 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 2,
|
|
|
|
|
name: "关键成果解决",
|
2023-08-01 15:50:13 +08:00
|
|
|
|
nameRu: "Решение ключевых результатов",
|
2022-09-20 17:31:39 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 3,
|
|
|
|
|
name: "对接专家院士",
|
2023-08-01 15:50:13 +08:00
|
|
|
|
nameRu: "Связь с экспертами и академиками",
|
2022-09-20 17:31:39 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 4,
|
|
|
|
|
name: "上市辅导",
|
2023-08-01 15:50:13 +08:00
|
|
|
|
nameRu: "Помощь в выходе на рынок",
|
2022-09-20 17:31:39 +08:00
|
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
const formRef = ref(null);
|
|
|
|
|
const fieldFormRef = ref(null);
|
|
|
|
|
const directionsFormRef = ref(null);
|
2023-07-31 15:40:23 +08:00
|
|
|
|
// const cityFormRef = ref(null);
|
2022-09-20 17:31:39 +08:00
|
|
|
|
const checkInput = ref("");
|
2022-10-31 17:46:09 +08:00
|
|
|
|
const submitForm = async (status) => {
|
2022-09-20 17:31:39 +08:00
|
|
|
|
let formValid;
|
|
|
|
|
try {
|
|
|
|
|
formValid = await formRef.value.validate();
|
|
|
|
|
} catch (error) {
|
|
|
|
|
formValid = false;
|
|
|
|
|
}
|
2022-10-31 17:46:09 +08:00
|
|
|
|
form.value.status = status;
|
2022-09-20 17:31:39 +08:00
|
|
|
|
const fieldFormValid = await fieldFormRef.value.validateForm();
|
|
|
|
|
const directionsFormValid = await directionsFormRef.value.validateForm();
|
2023-07-31 15:40:23 +08:00
|
|
|
|
// const cityFormValid = await cityFormRef.value.validateForm();
|
2023-07-31 17:27:13 +08:00
|
|
|
|
if (formValid && fieldFormValid && directionsFormValid) {
|
2022-10-19 00:22:39 +08:00
|
|
|
|
if (route.query.id) {
|
|
|
|
|
await updateTechnologyDemand(form.value);
|
2023-07-31 15:40:23 +08:00
|
|
|
|
ElMessage.success(t("admin.common.EditSuccess"));
|
2022-10-19 00:22:39 +08:00
|
|
|
|
} else {
|
|
|
|
|
await insertTechnologyDemand(form.value);
|
2023-07-28 17:28:29 +08:00
|
|
|
|
ElMessage.success(t("admin.common.AddSuccess"));
|
2022-10-19 00:22:39 +08:00
|
|
|
|
}
|
2022-12-07 11:22:32 +08:00
|
|
|
|
updateCount("technology");
|
2022-11-22 17:31:02 +08:00
|
|
|
|
backToList();
|
2022-09-20 17:31:39 +08:00
|
|
|
|
} else {
|
2023-07-28 17:28:29 +08:00
|
|
|
|
console.log("validation failed");
|
2022-09-20 17:31:39 +08:00
|
|
|
|
}
|
|
|
|
|
// formRef.value.validate(async (valid) => {
|
|
|
|
|
// // console.log(valid);
|
|
|
|
|
// if (valid) {
|
|
|
|
|
// form.value.amount = form.value.amount - 0;
|
|
|
|
|
// }
|
|
|
|
|
// form.value.amount = form.value.amount - 0;
|
|
|
|
|
// const cityForm = proxy.$refs.cityForm.submitForm(); // 城市
|
|
|
|
|
// if (valid && cityForm) {
|
|
|
|
|
// console.log(form.value);
|
|
|
|
|
// if (form.value.id != undefined) {
|
|
|
|
|
// // updatePost(form.value).then((response) => {
|
2023-07-19 09:22:11 +08:00
|
|
|
|
// // proxy.$modal.msgSuccess(t('admin.common.editSuccess'));
|
2022-09-20 17:31:39 +08:00
|
|
|
|
// // proxy.$router.go(-1);
|
|
|
|
|
// // });
|
|
|
|
|
// } else {
|
|
|
|
|
// // addPost(form.value).then((response) => {
|
2023-07-27 17:31:39 +08:00
|
|
|
|
// // proxy.$modal.msgSuccess(t('admin.common.addSuccess'));
|
2022-09-20 17:31:39 +08:00
|
|
|
|
// // proxy.$router.go(-1);
|
|
|
|
|
// // });
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
};
|
2022-11-25 17:30:39 +08:00
|
|
|
|
// function addCheck() {
|
|
|
|
|
// if (!checkInput.value.trim().length) return proxy.$modal.msgError("请输入");
|
|
|
|
|
// const flag = checkList.some((item) => {
|
|
|
|
|
// return item.name.trim() == checkInput.value.trim();
|
|
|
|
|
// });
|
|
|
|
|
// if (!flag) {
|
|
|
|
|
// checkList.push({
|
|
|
|
|
// id: checkList.length + 1,
|
|
|
|
|
// name: checkInput.value,
|
|
|
|
|
// });
|
|
|
|
|
// checkInput.value = "";
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2022-11-22 17:31:02 +08:00
|
|
|
|
// 返回技术需求列表
|
|
|
|
|
const backToList = () => {
|
|
|
|
|
tab.closeOpenPage({ path: "/demand/technology" });
|
|
|
|
|
};
|
|
|
|
|
|
2022-10-31 17:46:09 +08:00
|
|
|
|
onMounted(() => {
|
|
|
|
|
formRef.value.resetFields();
|
2022-10-19 00:22:39 +08:00
|
|
|
|
|
2022-10-31 17:46:09 +08:00
|
|
|
|
if (route.query.id) {
|
2023-08-01 15:50:13 +08:00
|
|
|
|
const obj = Object.assign({}, route, {
|
|
|
|
|
title: t("admin.form.edit", {
|
|
|
|
|
type: t("webSearch.technologyDemand"),
|
|
|
|
|
}),
|
|
|
|
|
});
|
2022-11-25 17:30:39 +08:00
|
|
|
|
tab.updatePage(obj);
|
2022-10-31 17:46:09 +08:00
|
|
|
|
getTechnologyDemand({ id: route.query.id }).then((resp) => {
|
|
|
|
|
form.value = resp.data;
|
|
|
|
|
|
|
|
|
|
if (!form.value.kinds) {
|
|
|
|
|
form.value.kinds = resp.data.kind?.split(",") ?? [];
|
|
|
|
|
form.value.kinds.forEach((el, index) => {
|
|
|
|
|
if (!checkList.find((item) => item.name == el)) {
|
|
|
|
|
checkList.push({
|
|
|
|
|
id: index,
|
|
|
|
|
name: el,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (!form.value.wants) {
|
|
|
|
|
form.value.wants = resp.data.want?.split(",") ?? [];
|
|
|
|
|
}
|
|
|
|
|
});
|
2022-11-17 17:29:47 +08:00
|
|
|
|
} else {
|
|
|
|
|
form.value = {
|
|
|
|
|
check: [],
|
|
|
|
|
};
|
|
|
|
|
if (formRef.value) {
|
|
|
|
|
formRef.value.resetFields();
|
|
|
|
|
}
|
2022-10-31 17:46:09 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
2022-09-20 17:31:39 +08:00
|
|
|
|
</script>
|
2022-11-17 17:29:47 +08:00
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
:deep(.cooperation-mode) {
|
|
|
|
|
.input-add-bar {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|