guhongwei 2 سال پیش
والد
کامیت
f75f064284
2فایلهای تغییر یافته به همراه214 افزوده شده و 31 حذف شده
  1. 107 16
      src/views/project/info/detail.vue
  2. 107 15
      src/views/project/info/index.vue

+ 107 - 16
src/views/project/info/detail.vue

@@ -2,7 +2,22 @@
   <div id="detail">
     <el-row>
       <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_back="true" @toBack="toBack"></cSearch>
+        </el-col>
+        <el-col :span="24" class="two">
+          <cForm :span="24" :fields="fields" :form="form" :rules="rules" :isSave="false" :disabled="true" label-width="auo">
+            <template #techol_stage>
+              <el-option v-for="i in stageList" :key="i.value" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #techol_level>
+              <el-option v-for="i in levelList" :key="i.value" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #field>
+              <el-option v-for="i in fieldList" :key="i.value" :label="i.label" :value="i.value"></el-option>
+            </template>
+          </cForm>
+        </el-col>
       </el-col>
     </el-row>
   </div>
@@ -11,28 +26,104 @@
 <script setup lang="ts">
 // 基础
 import type { Ref } from 'vue';
-// reactive,
-import { onMounted, ref, getCurrentInstance } from 'vue';
+import { ref, reactive, onMounted } from 'vue';
+import { useRoute } from 'vue-router';
+import type { FormRules } from 'element-plus';
 // 接口
-//import { TestStore } from '@common/src/stores/test';
-//import type { IQueryResult } from '@/util/types.util';
-//const testAxios = TestStore();
-const { proxy } = getCurrentInstance() as any;
+import { ProjectInfoStore } from '@common/src/stores/project/projectInfo';
+import { DictDataStore } from '@common/src/stores/system/dictData'; // 字典表
+import type { IQueryResult } from '@/util/types.util';
+const infoAxios = ProjectInfoStore();
+const dictAxios = DictDataStore();
+
+// 路由
+const route = useRoute();
+
 // 加载中
 const loading: Ref<any> = ref(false);
-// 分页数据
-//  const skip = 0;
-//  const limit = proxy.limit;;
+
+// 表单
+let form: Ref<any> = ref({});
+let fields: Ref<any[]> = ref([
+  { label: '年度', model: 'year', options: { disabled: true } },
+  { label: '项目名称', model: 'name' },
+  { label: '项目负责人', model: 'pro_contact' },
+  { label: '项目负责人手机号', model: 'pro_phone' },
+  { label: '技术阶段', model: 'techol_stage', type: 'select' },
+  { label: '技术水平', model: 'techol_level', type: 'select' },
+  { label: '领域分类', model: 'field', type: 'select' },
+  { label: '市场预估(亿元/年)', model: 'scale' },
+  { label: '建议单位名称', model: 'proposal_company' },
+  { label: '建议单位联系人', model: 'proposal_contact' },
+  { label: '建议单位手机号', model: 'proposal_phone' },
+  { label: '合作单位名称', model: 'coopera_company' },
+  { label: '合作单位联系人', model: 'coopera_contact' },
+  { label: '合作单位手机号', model: 'coopera_phone' },
+  { label: '立项背景', model: 'sign', type: 'textarea', options: { maxlength: '500', 'show-word-limit': true, autosize: { minRows: 5, maxRows: 5 } } },
+  { label: '前期基础', model: 'work_basics', type: 'textarea', options: { maxlength: '500', 'show-word-limit': true, autosize: { minRows: 5, maxRows: 5 } } },
+  { label: '研究内容', model: 'content', type: 'textarea', options: { maxlength: '500', 'show-word-limit': true, autosize: { minRows: 5, maxRows: 5 } } },
+  { label: '技术路线', model: 'route', type: 'textarea', options: { maxlength: '500', 'show-word-limit': true, autosize: { minRows: 5, maxRows: 5 } } },
+  { label: '核心指标', model: 'quota', type: 'textarea', options: { maxlength: '500', 'show-word-limit': true, autosize: { minRows: 5, maxRows: 5 } } },
+  { label: '经济效益', model: 'influence', type: 'textarea', options: { maxlength: '500', 'show-word-limit': true, autosize: { minRows: 5, maxRows: 5 } } }
+]);
+const rules = reactive<FormRules>({
+  name: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
+  pro_contact: [{ required: true, message: '请输入项目负责人', trigger: 'blur' }],
+  pro_phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
+  techol_stage: [{ required: true, message: '请选择技术阶段', trigger: 'change' }],
+  techol_level: [{ required: true, message: '请选择技术水平', trigger: 'change' }],
+  field: [{ required: true, message: '请选择领域分类', trigger: 'change' }],
+  scale: [{ required: true, message: '请输入市场预估', trigger: 'blur' }],
+  proposal_company: [{ required: true, message: '请输入建议单位名称', trigger: 'blur' }],
+  proposal_contact: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
+  proposal_phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
+  coopera_company: [{ required: true, message: '请输入合作单位名称', trigger: 'blur' }],
+  coopera_contact: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
+  coopera_phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
+  sign: [{ required: true, message: '请输入立项背景(含解决“卡脖子”技术问题及在行业中所处的地位和作用)', trigger: 'blur' }],
+  work_basics: [{ required: true, message: '请输入前期基础(含知识产权状况)', trigger: 'blur' }],
+  content: [{ required: true, message: '请输入研究内容(含项目创新点)', trigger: 'blur' }],
+  route: [{ required: true, message: '请输入技术路线(含拟解决关键技术)', trigger: 'blur' }],
+  quota: [{ required: true, message: '请输入核心指标(要求可量化、可考核、可检测)', trigger: 'blur' }],
+  influence: [{ required: true, message: '请输入经济效益(含市场分析和产业化预期)', trigger: 'blur' }]
+});
+
+// 字典表
+const levelList: Ref<any> = ref([]);
+const stageList: Ref<any> = ref([]);
+const fieldList: Ref<any> = ref([]);
+
 // 请求
 onMounted(async () => {
   loading.value = true;
-  //  await search({ skip, limit });
+  await searchOther();
+  await search();
   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 () => {
+  if (route.query.id) {
+    let res: IQueryResult = await infoAxios.fetch(route.query.id);
+    if (res.errcode == 0) form.value = res.data as {};
+  } else form.value = { is_use: '0' };
+};
+
+// 查询其他信息
+const searchOther = async () => {
+  let res: IQueryResult;
+  //水平
+  res = await dictAxios.query({ type: 'project_collect_level' });
+  if (res.errcode == 0) levelList.value = res.data;
+  //阶段
+  res = await dictAxios.query({ type: 'project_collect_stage' });
+  if (res.errcode == 0) stageList.value = res.data;
+  //领域
+  res = await dictAxios.query({ type: 'project_collect_field' });
+  if (res.errcode == 0) fieldList.value = res.data;
+};
+
+// 返回上一页
+const toBack = () => {
+  window.history.go(-1);
+};
 </script>
 <style scoped lang="scss"></style>

+ 107 - 15
src/views/project/info/index.vue

@@ -2,7 +2,22 @@
   <div id="index">
     <el-row>
       <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 #techol_stage>
+              <el-option v-for="i in stageList" :key="i.value" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #techol_level>
+              <el-option v-for="i in levelList" :key="i.value" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #field>
+              <el-option v-for="i in fieldList" :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"> </cTable>
+        </el-col>
       </el-col>
     </el-row>
   </div>
@@ -11,28 +26,105 @@
 <script setup lang="ts">
 // 基础
 import type { Ref } from 'vue';
-// reactive,
 import { onMounted, ref, getCurrentInstance } from 'vue';
+import { useRouter } from 'vue-router';
 // 接口
-//import { TestStore } from '@common/src/stores/test';
-//import type { IQueryResult } from '@/util/types.util';
-//const testAxios = TestStore();
+import { ProjectInfoStore } from '@common/src/stores/project/projectInfo';
+import { DictDataStore } from '@common/src/stores/system/dictData'; // 字典表
+import type { IQueryResult } from '@/util/types.util';
+const infoAxios = ProjectInfoStore();
+const dictAxios = DictDataStore();
+
 const { proxy } = getCurrentInstance() as any;
+
+// 路由
+const router = useRouter();
 // 加载中
 const loading: Ref<any> = ref(false);
-// 分页数据
-//  const skip = 0;
-//  const limit = proxy.limit;;
+
+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: 'year', isSearch: true },
+  { label: '项目名称', model: 'name', isSearch: true },
+  { label: '项目负责人', model: 'pro_contact', isSearch: true },
+  { label: '项目负责人手机号', model: 'pro_phone' },
+  { label: '技术阶段', model: 'techol_stage', format: (i: any) => getDict(i, 'techol_stage'), isSearch: true, type: 'select' },
+  { label: '技术水平', model: 'techol_level', format: (i: any) => getDict(i, 'techol_level'), isSearch: true, type: 'select' },
+  { label: '领域分类', model: 'field', format: (i: any) => getDict(i, 'field'), isSearch: true, type: 'select' },
+  { label: '市场预估(亿元/年)', model: 'scale' }
+]);
+// 操作
+let opera: Ref<any[]> = ref([{ label: '查看', method: 'view' }]);
+
+// 查询数据
+let searchForm: Ref<any> = ref({});
+
+// 字典表
+const levelList: Ref<any> = ref([]);
+const stageList: Ref<any> = ref([]);
+const fieldList: Ref<any> = ref([]);
+
 // 请求
 onMounted(async () => {
   loading.value = true;
-  //  await search({ skip, limit });
+  await searchOther();
+  await search({ skip, limit });
   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 info = { skip: e.skip, limit: e.limit, ...searchForm.value };
+  const res: IQueryResult = await infoAxios.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 == 'techol_stage') {
+    let data: any = stageList.value.find((i: any) => i.value == e);
+    if (data) return data.label;
+    else return '暂无';
+  } else if (model == 'techol_level') {
+    let data: any = levelList.value.find((i: any) => i.value == e);
+    if (data) return data.label;
+    else return '暂无';
+  } else if (model == 'field') {
+    let data: any = fieldList.value.find((i: any) => i.value == e);
+    if (data) return data.label;
+    else return '暂无';
+  }
+};
+// 查看
+const toView = (data) => {
+  router.push({ path: '/project/info/detail', query: { id: data._id } });
+};
+
+// 查询其他信息
+const searchOther = async () => {
+  let res: IQueryResult;
+  //水平
+  res = await dictAxios.query({ type: 'project_collect_level' });
+  if (res.errcode == 0) levelList.value = res.data;
+  //阶段
+  res = await dictAxios.query({ type: 'project_collect_stage' });
+  if (res.errcode == 0) stageList.value = res.data;
+  //领域
+  res = await dictAxios.query({ type: 'project_collect_field' });
+  if (res.errcode == 0) fieldList.value = res.data;
+};
 </script>
-<style scoped lang="scss"></style>
+<style scoped lang="scss">
+.main {
+  .two {
+    margin: 0 0 10px 0;
+  }
+}
+</style>