guhongwei 2 năm trước cách đây
mục cha
commit
2e399acd6c

+ 5 - 0
src/router/module/admin.ts

@@ -4,6 +4,11 @@ export default [
     meta: { title: '产品审核管理' },
     meta: { title: '产品审核管理' },
     component: () => import('@/views/product/index.vue')
     component: () => import('@/views/product/index.vue')
   },
   },
+  {
+    path: '/product/info',
+    meta: { title: '详细信息' },
+    component: () => import('@/views/product/info.vue')
+  },
   {
   {
     path: '/expo/achieve/dock',
     path: '/expo/achieve/dock',
     meta: { title: '信息管理' },
     meta: { title: '信息管理' },

+ 149 - 21
src/views/product/index.vue

@@ -2,37 +2,165 @@
   <div id="index">
   <div id="index">
     <el-row>
     <el-row>
       <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
       <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
-        <el-col :span="24" class="one">系统首页</el-col>
+        <el-col :span="24" class="one">
+          <cSearch :is_title="false" :is_search="true" :fields="fields" @search="toSearch">
+            <template #type>
+              <el-option v-for="i in typeList" :key="i.value" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #status>
+              <el-option v-for="i in statusList" :key="i.value" :label="i.label" :value="i.value"></el-option>
+            </template>
+          </cSearch>
+        </el-col>
+        <el-col :span="24" class="thr">
+          <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @view="toView" @exam="toExam"> </cTable>
+        </el-col>
       </el-col>
       </el-col>
     </el-row>
     </el-row>
+    <cDialog :dialog="dialog" @handleClose="toClose">
+      <template v-slot:info>
+        <cForm v-if="dialog.type == '1'" :span="24" :fields="formFields" :form="form" :rules="{}" @save="toSave">
+          <template #status>
+            <el-option v-for="(i, index) in statusList" :key="index" :label="i.label" :value="i.value"></el-option>
+          </template>
+        </cForm>
+      </template>
+    </cDialog>
   </div>
   </div>
 </template>
 </template>
-
-<script setup lang="ts">
-// 基础
+<script lang="ts" setup>
+import _ from 'lodash';
 import type { Ref } from 'vue';
 import type { Ref } from 'vue';
-// reactive,
-import { onMounted, ref, getCurrentInstance } from 'vue';
+import { ref, onMounted, getCurrentInstance } from 'vue';
+import { useRouter } from 'vue-router';
+import { ElMessage } from 'element-plus';
+
 // 接口
 // 接口
-//import { TestStore } from '@common/src/stores/test';
-//import type { IQueryResult } from '@/util/types.util';
-//const testAxios = TestStore();
+import { DictDataStore } from '@common/src/stores/system/dictData'; // 字典表
+import { ProductStore } from '@common/src/stores/allAdmin/product';
+import type { IQueryResult } from '@/util/types.util';
+const productAxios = ProductStore();
+const dictAxios = DictDataStore();
+
 const { proxy } = getCurrentInstance() as any;
 const { proxy } = getCurrentInstance() as any;
+
+// 路由
+const router = useRouter();
+
 // 加载中
 // 加载中
-const loading: Ref<any> = ref(false);
-// 分页数据
-//  const skip = 0;
-//  const limit = proxy.limit;;
-// 请求
+const loading = ref(false);
+
+let list: Ref<any> = ref([]);
+let total: Ref<number> = ref(0);
+let skip = 0;
+let limit: number = proxy.$limit;
+// 列表
+let fields: Ref<any[]> = ref([
+  { label: '信息类型', model: 'type', format: (i) => getDict(i, 'type'), isSearch: true, type: 'select' },
+  { label: '信息标题', model: 'name', isSearch: true },
+  { label: '企业名称', model: 'company', isSearch: true },
+  { label: '联系人', model: 'contact', isSearch: true },
+  { label: '手机号', model: 'phone', isSearch: true },
+  { label: '电子邮箱', model: 'email' },
+  { label: '状态', model: 'status', format: (i) => getDict(i, 'status'), isSearch: true, type: 'select' }
+]);
+// 操作
+let opera: Ref<any[]> = ref([
+  { label: '查看', method: 'view' },
+  { label: '审核', method: 'exam', type: 'warning', display: (i) => i.status == '1' }
+]);
+// 查询数据
+let searchForm: Ref<any> = ref({});
+// 字典表
+let typeList: Ref<any> = ref([]);
+let statusList: Ref<any> = ref([]);
+
+// 弹框
+const dialog: Ref<any> = ref({ type: '1', show: false, title: '信息管理' });
+let form: Ref<any> = ref({});
+let formFields: Ref<any[]> = ref([{ label: '状态', model: 'status', type: 'select' }]);
+
 onMounted(async () => {
 onMounted(async () => {
   loading.value = true;
   loading.value = true;
-  //  await search({ skip, limit });
+  await searchOther();
+  await search({ skip, limit });
   loading.value = false;
   loading.value = false;
 });
 });
-//const search = async (e: { skip: number; limit: number }) => {
-//  const info = { skip: e.skip, limit: e.limit, ...searchInfo.value  };
-//  const res: IQueryResult = await testAxios.query(info);
-//  console.log(res);
-//};
+// 查询
+const search = async (e: { skip: number; limit: number }) => {
+  const { skip, limit } = e;
+  const condition = _.cloneDeep(searchForm.value);
+  let info = { limit: limit, skip: skip, ...condition };
+  let res: IQueryResult = await productAxios.query(info);
+  if (res.errcode == 0) {
+    list.value = res.data;
+    total.value = res.total;
+  }
+};
+const toSearch = (query) => {
+  searchForm.value = query;
+  search({ skip, limit });
+};
+const getDict = (e, model) => {
+  if (model == 'type') {
+    let data: any = typeList.value.find((i: any) => i.value == e);
+    if (data) return data.label;
+    else return '暂无';
+  } else if (model == 'status') {
+    let data: any = statusList.value.find((i: any) => i.value == e);
+    if (data) return data.label;
+    else return '暂无';
+  }
+};
+// 查看
+const toView = (e) => {
+  router.push({ path: '/product/info', query: { id: e._id } });
+};
+// 审核
+const toExam = async (data) => {
+  let res: IQueryResult = await productAxios.fetch(data._id);
+  if (res.errcode == 0) {
+    form.value = res.data;
+    dialog.value = { title: '信息管理', show: true, type: '1' };
+  }
+};
+// 提交
+const toSave = async (data) => {
+  let res: IQueryResult = await productAxios.update(data);
+  if (res.errcode == 0) {
+    ElMessage({ type: `success`, message: `审核成功` });
+    toClose();
+  } else {
+    ElMessage({ type: `error`, message: `${res.errmsg}` });
+  }
+};
+// 弹框关闭
+const toClose = () => {
+  form.value = {};
+  searchForm.value = {};
+  dialog.value = { title: '信息管理', show: false, type: '1' };
+  search({ skip, limit });
+};
+
+const searchOther = async () => {
+  let res: IQueryResult;
+  // 信息类型
+  res = await dictAxios.query({ type: 'product_type' });
+  if (res.errcode == '0') {
+    typeList.value = res.data;
+  }
+  // 状态
+  res = await dictAxios.query({ type: 'product_status' });
+  if (res.errcode == 0) statusList.value = res.data;
+};
 </script>
 </script>
-<style scoped lang="scss"></style>
+<style lang="scss" scoped>
+.main {
+  .one {
+    margin: 0 0 10px 0;
+  }
+  .two {
+    margin: 0 0 10px 0;
+  }
+}
+</style>

+ 204 - 0
src/views/product/info.vue

@@ -0,0 +1,204 @@
+<template>
+  <div id="info">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-col :span="24" class="one">
+          <cSearch :is_title="false" :is_back="true" @toBack="toBack"></cSearch>
+        </el-col>
+        <el-col :span="24" class="two">
+          <cForm :span="24" :fields="fields" :form="form" :isSave="false" :disabled="true">
+            <template #type>
+              <el-option v-for="(i, index) in typeList" :key="index" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #demand>
+              <el-option v-for="(i, index) in demandList" :key="index" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #field>
+              <el-option v-for="(i, index) in fieldList" :key="index" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #cooperation>
+              <el-option v-for="(i, index) in cooperationList" :key="index" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #achievestatus>
+              <el-option v-for="(i, index) in achievestatusList" :key="index" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #achievesource>
+              <el-option v-for="(i, index) in achievesourceList" :key="index" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #file>
+              <el-image class="image" v-for="i in form.file" :key="i.url" :src="i.url" @click="imgView(i.url)"></el-image>
+            </template>
+            <template #patent>
+              <cTable :fields="patentFields" :opera="[]" :list="form.patent" :usePage="false"> </cTable>
+            </template>
+            <template #roadshow>
+              <el-link :underline="false" v-for="i in form.roadshow" :key="i.url" :href="i.url" blank="_target">{{ i.name }}</el-link>
+            </template>
+            <template #messattribute>
+              <el-option v-for="(i, index) in messattributeList" :key="index" :label="i.label" :value="i.value"></el-option>
+            </template>
+          </cForm>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+// 基础
+import type { Ref } from 'vue';
+import { onMounted, ref } from 'vue';
+import { useRoute } from 'vue-router';
+
+// 接口
+import { ProductStore } from '@common/src/stores/allAdmin/product';
+import { DictDataStore } from '@common/src/stores/system/dictData'; // 字典表
+import type { IQueryResult } from '@/util/types.util';
+const productAxios = ProductStore();
+const dictAxios = DictDataStore();
+// 路由
+const route = useRoute();
+
+// 加载中
+const loading: Ref<any> = ref(false);
+
+const form: Ref<any> = ref({ patent: [] });
+const fields: 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: 'name' }
+]);
+// 专利信息
+const patentFields: Ref<any> = ref([
+  { label: '名称', model: 'name' },
+  { label: '状态', model: 'status', format: (i: any) => getDict(i, 'status') }
+]);
+
+// 字典表
+const typeList: Ref<any> = ref([]);
+const demandList: Ref<any> = ref([]);
+const fieldList: Ref<any> = ref([]);
+const cooperationList: Ref<any> = ref([]);
+const achievestatusList: Ref<any> = ref([]);
+const achievesourceList: Ref<any> = ref([]);
+const patent_statusList: Ref<any> = ref([]);
+const messattributeList: Ref<any> = ref([]);
+// 请求
+onMounted(async () => {
+  loading.value = true;
+  await searchOther();
+  await search();
+  loading.value = false;
+});
+const search = async () => {
+  let id = route.query.id;
+  if (id) {
+    let res: IQueryResult = await productAxios.fetch(id);
+    if (res.errcode == '0') {
+      let data = res.data as any;
+      if (data && data.patent.length <= 0) data.patent = [];
+      form.value = data;
+      // 辨识信息类型
+      getFields(data.type);
+    }
+  }
+};
+const getDict = (e, model) => {
+  if (model == 'status') {
+    let data: any = patent_statusList.value.find((i: any) => i.value == e);
+    if (data) return data.label;
+    else return '暂无';
+  }
+};
+const getFields = (type) => {
+  let list: any = [];
+  if (type == '0') {
+    list = [
+      { label: '需求紧急程度', model: 'demand', type: 'select' },
+      { label: '所属领域', model: 'field', type: 'select' },
+      { label: '投资预算', model: 'budget' },
+      { label: '合作方式', model: 'cooperation', type: 'select' },
+      { label: '技术说明', model: 'requirementdesc', type: 'textarea' },
+      { label: '预期目标', model: 'expect', type: 'textarea' },
+      { label: '需求现状', model: 'present', type: 'textarea' },
+      { label: '合作条件及要求', model: 'condition', type: 'textarea' },
+      { label: '产品图片(6)', model: 'file', custom: true }
+    ];
+  } else if (type == '1') {
+    list = [
+      { 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 },
+      { label: '项目路演', model: 'roadshow', custom: true },
+      { label: '成果简介', model: 'achievebrief', type: 'textarea' },
+      { label: '技术特点', model: 'features', type: 'textarea' },
+      { label: '技术团队', model: 'team', type: 'textarea' },
+      { label: '商业预期', model: 'expect', type: 'textarea' },
+      { label: '合作条件及要求', model: 'condition', type: 'textarea' },
+      { label: '产品图片(6)', model: 'file', custom: true }
+    ];
+  } else if (type == '2') {
+    list = [
+      { label: '信息属性', model: 'messattribute', type: 'select' },
+      { label: '需求程度', model: 'demand', type: 'select' },
+      { label: '信息描述', model: 'informationdesc', type: 'textarea' },
+      { label: '核心要素', model: 'coreelements', type: 'textarea' },
+      { label: '价格信息', model: 'priceinfo', type: 'textarea' },
+      { label: '商业预期', model: 'expect', type: 'textarea' }
+    ];
+  }
+  fields.value = [...fields.value, ...list];
+};
+// 查询其他信息
+const searchOther = async () => {
+  let res: IQueryResult;
+  // 信息类型
+  res = await dictAxios.query({ type: 'product_type' });
+  if (res.errcode == '0') typeList.value = res.data;
+  // 需求紧急程度/需求程度
+  res = await dictAxios.query({ type: 'product_demand' });
+  if (res.errcode == 0) demandList.value = res.data;
+  // 所属领域
+  res = await dictAxios.query({ type: 'product_field' });
+  if (res.errcode == 0) fieldList.value = res.data;
+  // 合作方式
+  res = await dictAxios.query({ type: 'product_cooperation' });
+  if (res.errcode == 0) cooperationList.value = res.data;
+  // 成果状态
+  res = await dictAxios.query({ type: 'product_achievestatus' });
+  if (res.errcode == 0) achievestatusList.value = res.data;
+  // 成果来源
+  res = await dictAxios.query({ type: 'product_achievesource' });
+  if (res.errcode == 0) achievesourceList.value = res.data;
+  // 专利信息状态
+  res = await dictAxios.query({ type: 'product_patent_status' });
+  if (res.errcode == 0) patent_statusList.value = res.data;
+  // 信息属性
+  res = await dictAxios.query({ type: 'product_messattribute' });
+  if (res.errcode == 0) messattributeList.value = res.data;
+};
+// 预览图片
+const imgView = (e) => {
+  window.open(e);
+};
+// 返回上一页
+const toBack = () => {
+  window.history.go(-1);
+};
+</script>
+<style scoped lang="scss">
+.image {
+  width: 120px;
+  height: 120px;
+  overflow: hidden;
+  margin: 0 10px 0 0;
+}
+</style>