123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- <template>
- <div id="detail">
- <el-row>
- <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
- <el-col :span="24" class="one">
- <cSearch :is_back="true" @toBack="toBack"></cSearch>
- </el-col>
- <el-col :span="24" class="two">
- <cForm :span="24" :fields="formFields" :form="form" :rules="rules" @save="onSubmit" @dataChange="dataChange" :disabled="disabled" :isSave="!disabled">
- <template #messattribute>
- <el-option v-for="(i, index) in product_messattributeList" :key="index" :label="i.label" :value="i.value"></el-option>
- </template>
- <template #achievesource>
- <el-option v-for="(i, index) in product_achievesourceList" :key="index" :label="i.label" :value="i.value"></el-option>
- </template>
- <template #achievestatus>
- <el-option v-for="(i, index) in product_achievestatusList" :key="index" :label="i.label" :value="i.value"></el-option>
- </template>
- <template #cooperation>
- <el-option v-for="(i, index) in product_cooperationList" :key="index" :label="i.label" :value="i.value"></el-option>
- </template>
- <template #field>
- <el-option v-for="(i, index) in product_fieldList" :key="index" :label="i.label" :value="i.value"></el-option>
- </template>
- <template #demand>
- <el-option v-for="(i, index) in product_demandList" :key="index" :label="i.label" :value="i.value"></el-option>
- </template>
- <template #type>
- <el-option v-for="(i, index) in product_typeList" :key="index" :label="i.label" :value="i.value"></el-option>
- </template>
- <template #status>
- <el-option v-for="(i, index) in statusList" :key="index" :label="i.label" :value="i.value"></el-option>
- </template>
- <template #roadshow="{ item }">
- <cUpload :model="item.model" :limit="1" url="/files/zkzx/product/upload" :list="form[item.model]" @change="onUpload"></cUpload>
- </template>
- <template #file="{ item }">
- <cUpload
- :model="item.model"
- :limit="6"
- url="/files/zkzx/product/upload"
- :list="form[item.model]"
- listType="picture-card"
- @change="onUpload"
- ></cUpload>
- </template>
- <template #patent>
- <el-col :span="24" class="logs">
- <el-col :span="24" class="logs_1">
- <el-button type="primary" size="small" @click="add()">添加</el-button>
- </el-col>
- <el-col :span="24">
- <el-table :data="form.patent" style="width: 100%" border>
- <el-table-column type="index" label="序号" width="100" align="center"> </el-table-column>
- <el-table-column label="名称" align="center">
- <template #default="scope">
- <el-input v-model="scope.row.name" placeholder="请输入名称" clearable />
- </template>
- </el-table-column>
- <el-table-column label="状态" align="center">
- <template #default="scope">
- <el-select v-model="scope.row.status" placeholder="请选择">
- <el-option v-for="item in product_patent_statusList" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" width="100">
- <template v-slot="scope">
- <el-button size="mini" type="danger" @click="del(scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-col>
- </el-col>
- </template>
- </cForm>
- </el-col>
- </el-col>
- </el-row>
- </div>
- </template>
- <script setup lang="ts">
- import moment from 'moment';
- import type { Ref } from 'vue';
- import { ref, reactive, onMounted } from 'vue';
- import { useRoute } from 'vue-router';
- import { ElMessage } from 'element-plus';
- import type { FormRules } from 'element-plus';
- import store from '@/stores/counter';
- // 接口
- import { DictDataStore } from '@common/src/stores/system/dictData'; // 字典表
- import { ProductStore } from '@common/src/stores/allAdmin/product';
- import type { IQueryResult } from '@/util/types.util';
- const product = ProductStore();
- const dictData = DictDataStore();
- // 路由
- const route = useRoute();
- // 加载中
- const loading = ref(false);
- let user: Ref<any> = ref({});
- // 表单
- let disabled: Ref<any> = ref(false);
- let form: Ref<any> = ref({});
- let formFields: Ref<any[]> = ref([
- // 公共
- { label: '类型', model: 'type', type: 'select' },
- { label: '企业名称', model: 'company' },
- { label: '联系人', model: 'contact' },
- { label: '手机号', model: 'phone' },
- { label: '电子邮箱', model: 'email' },
- { label: 'qq&微信', model: 'qqwx' },
- { label: '状态', model: 'status', type: 'select' }
- ]);
- const rules = reactive<FormRules>({
- type: [{ required: true, message: '请选择类型' }]
- });
- // 字典表
- let statusList: Ref<any> = ref([]); // 状态
- let product_messattributeList: Ref<any> = ref([]); // 信息属性
- let product_achievesourceList: Ref<any> = ref([]); // 成果来源
- let product_achievestatusList: Ref<any> = ref([]); // 成果状态
- let product_cooperationList: Ref<any> = ref([]); // 合作方式
- let product_fieldList: Ref<any> = ref([]); // 所属领域
- let product_demandList: Ref<any> = ref([]); // 需求紧急程度/需求程度
- let product_typeList: Ref<any> = ref([]); // 类型
- let product_patent_statusList: Ref<any> = ref([]); // 专利信息状态
- onMounted(async () => {
- loading.value = true;
- if (route.query.isdisabled) disabled.value = route.query.isdisabled;
- user.value = store.state.user;
- await searchOther();
- await search();
- loading.value = false;
- });
- const search = async () => {
- if (route.query.id) {
- let res: IQueryResult = await product.fetch(route.query.id);
- if (res.errcode == 0) {
- form.value = res.data as {};
- if (form.value.type == '0') valueOne(); // 科技需求
- else if (form.value.type == '1') valueTwo(); // 技术成果
- else if (form.value.type == '2') valueThr(); // 商务服务
- }
- } else form.value = { status: '0', user_id: user.value._id };
- };
- const dataChange = (e: { model: string; value: any }) => {
- const { model, value } = e;
- if (model == 'type') {
- if (value == '0') valueOne(); // 科技需求
- else if (value == '1') valueTwo(); // 科技成果
- else if (value == '2') valueThr(); // 商务服务
- }
- };
- // 任职记录
- const add = () => {
- form.value.patent.push({ id: moment().valueOf(), name: '', status: '' });
- };
- // 任职记录删除
- const del = (e) => {
- form.value.patent = form.value.patent.filter((i) => i.id != e.id);
- };
- // 科技需求
- const valueOne = () => {
- formFields.value = [
- { label: '类型', model: 'type', type: 'select' },
- { label: '企业名称', model: 'company' },
- { label: '联系人', model: 'contact' },
- { label: '手机号', model: 'phone' },
- { label: '电子邮箱', model: 'email' },
- { label: 'qq&微信', model: 'qqwx' },
- { label: '需求名称', model: 'name' },
- { label: '需求紧急程度', model: 'demand', type: 'select' },
- { label: '所属领域', model: 'field', type: 'select' },
- { label: '投资预算', model: 'budget' },
- { label: '合作方式', model: 'cooperation', type: 'select' },
- { label: '技术说明', model: 'requirementdesc' },
- { label: '预期目标', model: 'expect' },
- { label: '需求现状', model: 'present' },
- { label: '合作条件及要求', model: 'condition' },
- { label: '产品图片(6)', model: 'file', custom: true },
- { label: '状态', model: 'status', type: 'select' }
- ];
- };
- // 技术成果
- const valueTwo = () => {
- formFields.value = [
- { label: '类型', model: 'type', type: 'select' },
- { label: '企业名称', model: 'company' },
- { label: '联系人', model: 'contact' },
- { label: '手机号', model: 'phone' },
- { label: '电子邮箱', model: 'email' },
- { label: 'qq&微信', model: 'qqwx' },
- { label: '成果名称', model: 'name' },
- { label: '所属领域', model: 'field', type: 'select' },
- { label: '合作方式', model: 'cooperation', type: 'select' },
- { label: '成果状态', model: 'achievestatus', type: 'select' },
- { label: '成果权属', model: 'achieveown' },
- { label: '成果来源', model: 'achievesource', type: 'select' },
- { label: '意向价格', model: 'intentionprice' },
- { label: '专利信息', model: 'patent', custom: true }, //Array
- { label: '项目路演', model: 'roadshow', custom: true }, //Array
- { label: '成果简介', model: 'achievebrief', type: 'textarea' },
- { label: '技术特点', model: 'features' },
- { label: '技术团队', model: 'team' },
- { label: '商业预期', model: 'expect' },
- { label: '合作条件及要求', model: 'condition' },
- { label: '产品图片(6)', model: 'file', custom: true },
- { label: '状态', model: 'status', type: 'select' }
- ];
- };
- // 商务服务
- const valueThr = () => {
- formFields.value = [
- { label: '类型', model: 'type', type: 'select' },
- { label: '企业名称', model: 'company' },
- { label: '联系人', model: 'contact' },
- { label: '手机号', model: 'phone' },
- { label: '电子邮箱', model: 'email' },
- { label: 'qq&微信', model: 'qqwx' },
- { label: '信息名称', model: 'name' },
- { label: '信息属性', model: 'messattribute', type: 'select' },
- { label: '需求程度', model: 'demand', type: 'select' },
- { label: '信息描述', model: 'informationdesc', type: 'textarea' },
- { label: '核心要素', model: 'coreelements' },
- { label: '价格信息', model: 'priceinfo' },
- { label: '商业预期', model: 'expect' },
- { label: '状态', model: 'status', type: 'select' }
- ];
- };
- const onUpload = (e: { model: string; value: Array<[]> }) => {
- const { model, value } = e;
- form.value[model] = value;
- };
- // 提交
- const onSubmit = async (data) => {
- let res: IQueryResult;
- if (data._id) res = await product.update(data);
- else res = await product.create(data);
- if (res.errcode == 0) {
- ElMessage({ type: `success`, message: `维护信息成功` });
- toBack();
- }
- };
- // 返回上一页
- const toBack = () => {
- window.history.go(-1);
- };
- const searchOther = async () => {
- let res: IQueryResult;
- // 类型
- res = await dictData.query({ type: 'product_type' });
- if (res.errcode == 0) product_typeList.value = res.data;
- // 状态
- res = await dictData.query({ type: 'product_status' });
- if (res.errcode == 0) statusList.value = res.data;
- // 信息属性
- res = await dictData.query({ type: 'product_messattribute' });
- if (res.errcode == 0) product_messattributeList.value = res.data;
- // 成果来源
- res = await dictData.query({ type: 'product_achievesource' });
- if (res.errcode == 0) product_achievesourceList.value = res.data;
- // 成果状态
- res = await dictData.query({ type: 'product_achievestatus' });
- if (res.errcode == 0) product_achievestatusList.value = res.data;
- // 合作方式
- res = await dictData.query({ type: 'product_cooperation' });
- if (res.errcode == 0) product_cooperationList.value = res.data;
- // 所属领域
- res = await dictData.query({ type: 'product_field' });
- if (res.errcode == 0) product_fieldList.value = res.data;
- // 需求紧急程度/需求程度
- res = await dictData.query({ type: 'product_demand' });
- if (res.errcode == 0) product_demandList.value = res.data;
- // 专利信息状态
- res = await dictData.query({ type: 'product_patent_status' });
- if (res.errcode == 0) product_patent_statusList.value = res.data;
- };
- </script>
- <style scoped lang="scss"></style>
|