This commit is contained in:
cxc
2022-10-31 17:46:09 +08:00
parent 652ce4c9d3
commit c2327f30cb
63 changed files with 1698 additions and 479 deletions

View File

@ -125,6 +125,7 @@ const route = useRoute();
const data = reactive({
form: {
check: [],
status: 0,
},
queryParams: {
pageNum: 1,
@ -202,9 +203,20 @@ function addCheck() {
}
}
onActivated(() => {
onMounted(() => {
formRef.value.resetFields();
if (route.query.id) {
getDemand({ id: route.query.id }).then((resp) => {
if (resp.data.kinds) {
resp.data.kinds.forEach((el, index) => {
if (!checkList.find((item) => item.name == el)) {
checkList.push({
id: index,
name: el,
});
}
});
}
form.value = resp.data;
});
}

View File

@ -20,7 +20,7 @@
<el-row>
<el-col :span="24">
<!-- <el-checkbox label="0" @change="handleCheck">其他</el-checkbox> -->
<el-form-item label="需求类别:">
<el-form-item label="需求类别:" prop="kinds">
<el-checkbox-group v-model="form.kinds">
<el-checkbox
v-for="item in checkList"
@ -47,7 +47,6 @@
<el-row>
<el-col :span="24">
<el-form-item label="需求描述:" prop="introduce">
<!-- <Editor v-model="form.add" :minHeight="150" /> -->
<wangEditor
v-model="form.introduce"
width="100%"
@ -57,11 +56,6 @@
</el-col>
</el-row>
<!-- <CityOptions
v-model="form"
:labelWidth="labelWidth"
ref="cityForm"
/> -->
<FieldOptions
v-model="form"
:labelWidth="labelWidth"
@ -161,9 +155,13 @@
</el-col>
</el-row>
</el-form>
<div :style="{ marginLeft: labelWidth + 'px' }">
<!-- <div :style="{ marginLeft: labelWidth + 'px' }">
<el-button @click="router.go(-1)">取消</el-button>
<el-button type="primary" @click="submitForm">提交</el-button>
</div> -->
<div :style="{ marginLeft: labelWidth + 'px' }">
<el-button type="primary" @click="submitForm(3)">保存草稿</el-button>
<el-button type="primary" @click="submitForm(0)">提交审核</el-button>
</div>
</el-card>
</div>
@ -181,6 +179,7 @@ import {
updateTechnologyDemand,
insertTechnologyDemand,
} from "@/api/admin/enterprise/demand";
import { onMounted } from "vue";
const router = useRouter();
const route = useRoute();
const data = reactive({
@ -204,6 +203,9 @@ const data = reactive({
commitUserName: [
{ required: true, message: "需求提交人不能为空", trigger: "blur" },
],
kinds: [
{ required: true, message: "至少选择一个需求类别", trigger: "change" },
],
budget: [{ required: true, message: "需求预算不能为空", trigger: "blur" }],
deadline: [
{
@ -246,13 +248,14 @@ const formRef = ref(null);
const fieldFormRef = ref(null);
const directionsFormRef = ref(null);
const checkInput = ref("");
const submitForm = async () => {
const submitForm = async (status) => {
let formValid;
try {
formValid = await formRef.value.validate();
} catch (error) {
formValid = false;
}
form.value.status = status;
const fieldFormValid = await fieldFormRef.value.validateForm();
const directionsFormValid = await directionsFormRef.value.validateForm();
if (formValid && fieldFormValid && directionsFormValid) {
@ -303,16 +306,28 @@ function addCheck() {
checkInput.value = "";
}
}
onMounted(() => {
formRef.value.resetFields();
if (route.query.id) {
getTechnologyDemand({ id: route.query.id }).then((resp) => {
form.value = resp.data;
if (!form.value.kinds) {
form.value.kinds = resp.data.kind?.split(",") ?? [];
}
if (!form.value.wants) {
form.value.wants = resp.data.want?.split(",") ?? [];
}
});
}
if (route.query.id) {
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(",") ?? [];
}
});
}
});
</script>

View File

@ -1 +1,147 @@
<template></template>
<template>
<div class="app-container">
<el-radio-group
v-model="queryParams.searchType"
size="small"
@change="handleQuery"
>
<el-badge :value="12" class="count-badge" :hidden="true">
<el-radio-button label="1">企业</el-radio-button>
</el-badge>
<el-radio-button label="2">成果</el-radio-button>
<el-radio-button label="4">专利</el-radio-button>
<el-radio-button label="5">专家</el-radio-button>
<el-radio-button label="6">服务需求</el-radio-button>
<el-radio-button label="7">技术需求</el-radio-button>
<!-- <el-radio-button label="4">实验室</el-radio-button> -->
</el-radio-group>
<div v-if="dataList.length" style="margin-top: 20px" v-loading="loading">
<section v-for="item in dataList" :key="item.id">
<div style="border: 1px solid #dcdcdc; margin-bottom: 10px">
<enterpriseItem
:data="item"
v-if="queryParams.searchType == 1"
></enterpriseItem>
<AchievementItem
:data="item"
v-else-if="queryParams.searchType == 2"
></AchievementItem>
<gainItem
:data="item"
v-else-if="queryParams.searchType == 4"
></gainItem>
<expertItem
:data="item"
v-else-if="queryParams.searchType == 5"
></expertItem>
<serviceDemandItem
:data="item"
v-else-if="queryParams.searchType == 6"
></serviceDemandItem>
<TechnologyDemandItem
:data="item"
v-else-if="queryParams.searchType == 7"
></TechnologyDemandItem>
</div>
</section>
</div>
<el-empty v-else></el-empty>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script setup name="Post">
import { search } from "@/api/website/home/index";
import gainItem from "@/views/website/searchList/components/gainItem.vue";
import expertItem from "@/views/website/searchList/components/expertItem.vue";
import serviceDemandItem from "@/views/website/searchList/components/serviceDemandItem.vue";
import enterpriseItem from "../../components/enterpriseItem.vue";
import TechnologyDemandItem from "@/views/website/searchList/components/technologyDemandItem.vue";
import AchievementItem from "@/views/website/searchList/components/achievementItem.vue";
import { useRoute, useRouter } from "vue-router";
import { watch } from "vue";
const route = useRoute();
const router = useRouter();
const dataList = ref([]);
const loading = ref(true);
const total = ref(0);
const queryType = computed(() => {
if (queryParams.value.searchType == 1) {
return 2;
} else if (queryParams.value.searchType == 2) {
return 1;
} else if (queryParams.value.searchType == 4) {
return 2;
} else if (queryParams.value.searchType == 5) {
return 2;
} else if (queryParams.value.searchType == 6) {
return 1;
} else if (queryParams.value.searchType == 7) {
return 1;
}
});
// router.replace({
// path: "/extension/results",
// query: {
// keyword: route.query.keyword,
// queryType: queryType,
// },
// });
// watch(
// queryType,
// (val) => {
// console.log(val);
// },
// { immediate: true }
// );
const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
query: route.query.keyword,
searchType: "1",
queryType: queryType,
},
});
const { queryParams } = toRefs(data);
/** 查询列表 */
async function getList() {
const resp = await search(queryParams.value);
dataList.value = resp.list;
total.value = resp.total;
loading.value = false;
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
handleQuery();
</script>
<style lang="scss" scoped>
.btn_info {
height: 35px;
line-height: 35px;
text-align: center;
color: #fff;
background-color: #787878;
}
:deep(.count-badge) {
z-index: 99;
}
</style>

View File

@ -17,9 +17,9 @@
size="small"
@change="handleQuery"
>
<el-radio-button :label="1">待受理</el-radio-button>
<el-radio-button :label="2">已受理</el-radio-button>
<el-radio-button :label="3">已结束</el-radio-button>
<el-radio-button :label="0">待受理</el-radio-button>
<el-radio-button :label="1">已受理</el-radio-button>
<el-radio-button :label="2">已结束</el-radio-button>
</el-radio-group>
<el-table v-loading="loading" :data="dataList" style="margin-top: 20px">
@ -45,7 +45,7 @@
>
<template #default="scope">
<el-button
v-if="queryParams.type == 3"
v-if="queryParams.type == 2"
size="small"
type="text"
icon="Delete"
@ -53,7 +53,7 @@
>删除</el-button
>
<el-button
v-if="queryParams.type == 1"
v-if="queryParams.type == 0"
size="small"
type="text"
icon="Close"
@ -61,7 +61,7 @@
>取消发布</el-button
>
<el-button
v-if="queryParams.type != 3"
v-if="queryParams.type != 2"
size="small"
type="text"
icon="View"

View File

@ -13,10 +13,10 @@
size="small"
@change="handleQuery"
>
<el-radio-button :label="1">已发布</el-radio-button>
<el-radio-button :label="0">待审核</el-radio-button>
<el-radio-button :label="1">已发布</el-radio-button>
<el-radio-button :label="2">已驳回</el-radio-button>
<!-- <el-radio-button :label="3">草稿箱</el-radio-button> -->
<el-radio-button :label="3">草稿箱</el-radio-button>
</el-radio-group>
<el-table v-loading="loading" :data="dataList" style="margin-top: 20px">
@ -54,13 +54,13 @@
<template #default="{ row }">
<router-link
:to="{ path: './releaseTechnology', query: { id: row.id } }"
v-if="queryParams.status == 0"
v-if="queryParams.status == 3"
>
<el-button size="small" type="text" icon="Edit">编辑</el-button>
</router-link>
<el-button
v-if="queryParams.status != 1"
v-if="queryParams.status != 0"
size="small"
type="text"
icon="Delete"
@ -68,15 +68,15 @@
>删除</el-button
>
<el-button
v-if="queryParams.status == 2"
v-if="queryParams.status == 1"
size="small"
type="text"
icon="View"
@click="handleResults(row.id)"
@click="handleResults(row)"
>查看匹配结果</el-button
>
<el-button
v-if="queryParams.status == 1"
v-if="queryParams.status == 0"
size="small"
type="text"
icon="Close"
@ -194,8 +194,13 @@ function handleShelf(row) {
})
.catch(() => {});
}
function handleResults(id) {
router.push({ path: "./results" });
function handleResults(row) {
router.push({
path: "./results",
query: {
keyword: row.title,
},
});
}
getList();
</script>