瀏覽代碼

增加一個版本

攻心小虫 5 天之前
父節點
當前提交
08ecc5a778

File diff suppressed because it is too large
+ 5 - 0
public/extra/d3.v3.min.js


+ 92 - 0
public/extra/phylotree.css

@@ -0,0 +1,92 @@
+.tree-selection-brush .extent {
+    fill-opacity: .05;
+    stroke: #fff;
+    shape-rendering: crispEdges;
+}
+
+.tree-scale-bar text {
+  font: sans-serif;
+}
+
+.tree-scale-bar line,
+.tree-scale-bar path {
+  fill: none;
+  stroke: #000;
+  shape-rendering: crispEdges;
+}
+
+.node circle, .node ellipse, .node rect {
+fill: steelblue;
+stroke: black;
+stroke-width: 0.5px;
+}
+
+.internal-node circle, .internal-node ellipse, .internal-node rect{
+fill: #CCC;
+stroke: black;
+stroke-width: 0.5px;
+}
+
+.node {
+font: 10px sans-serif;
+}
+
+.node-selected {
+fill: #f00 !important;     
+}
+
+.node-collapsed circle, .node-collapsed ellipse, .node-collapsed rect{
+fill: black !important;     
+}
+
+.node-tagged {
+fill: #00f; 
+}
+
+.branch {
+fill: none;
+stroke: #999;
+stroke-width: 2px;
+}
+
+.clade {
+fill: #1f77b4;
+stroke: #444;
+stroke-width: 2px;
+opacity: 0.5;
+}
+
+.branch-selected {
+stroke: #f00 !important; 
+stroke-width: 3px;
+}
+
+.branch-tagged {
+stroke: #00f;
+stroke-dasharray: 10,5;
+stroke-width: 2px;
+}
+
+.branch-tracer {
+stroke: #bbb;
+stroke-dasharray: 3,4;
+stroke-width: 1px;
+}
+
+
+.branch-multiple {
+stroke-dasharray: 5, 5, 1, 5;
+stroke-width: 3px;
+}
+
+.branch:hover {
+stroke-width: 10px;
+}
+
+.internal-node circle:hover, .internal-node ellipse:hover, .internal-node rect:hover {
+fill: black;
+stroke: #CCC;
+}
+
+.tree-widget {
+}

File diff suppressed because it is too large
+ 9 - 0
public/extra/phylotree.js


File diff suppressed because it is too large
+ 6 - 0
public/extra/underscore-min.js


+ 5 - 0
public/index.html

@@ -7,6 +7,11 @@
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
     <title><%= webpackConfig.name %></title>
+    <link rel="stylesheet" type="text/css" href="<%= BASE_URL %>extra/phylotree.css">
+    <script type="text/javascript" charset="utf8" src="<%= BASE_URL %>extra/d3.v3.min.js"></script>
+    <script type="text/javascript" charset="utf8" src="<%= BASE_URL %>extra/underscore-min.js"></script>
+    <script type="text/javascript" charset="utf8" src="<%= BASE_URL %>extra/phylotree.js"></script>
+    
     <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
 	  <style>
     html,

+ 12 - 0
src/api/data/dataDrugs.js

@@ -42,3 +42,15 @@ export function delDataDrugs(id) {
     method: 'delete'
   })
 }
+
+// 导入病原体管理
+export function importDataDrugs(data) {
+  return request({
+    url: '/data/dataDrugs/importData',
+    method: 'post',
+    data: data,
+    headers: {
+      'Content-Type': 'multipart/form-data'
+    }
+  })
+}

+ 8 - 0
src/api/statistics/report.js

@@ -74,6 +74,14 @@ export function generatezgbytfzzbqkInfo(data) {
   })
 }
 
+export function pathogenConfigGetAll(data) {
+  return request({
+    url: '/system/pathogenConfig/getAll',
+    method: 'get'
+  })
+}
+
+
 // 获取诊断统计设置编号列表
 export async function getConfigList() {
   return request({

+ 44 - 0
src/api/system/pathogenConfig.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询病原体演化树列列表
+export function listPathogenConfig(query) {
+  return request({
+    url: '/system/pathogenConfig/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询病原体演化树列详细
+export function getPathogenConfig(id) {
+  return request({
+    url: '/system/pathogenConfig/' + id,
+    method: 'get'
+  })
+}
+
+// 新增病原体演化树列
+export function addPathogenConfig(data) {
+  return request({
+    url: '/system/pathogenConfig',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改病原体演化树列
+export function updatePathogenConfig(data) {
+  return request({
+    url: '/system/pathogenConfig',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除病原体演化树列
+export function delPathogenConfig(id) {
+  return request({
+    url: '/system/pathogenConfig/' + id,
+    method: 'delete'
+  })
+}

+ 39 - 36
src/views/data/dataDrugs/index.vue

@@ -51,50 +51,21 @@
         >新增</el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button
-          type="success"
-          plain
-          icon="el-icon-edit"
-          size="mini"
-          :disabled="single"
-          @click="handleUpdate"
-          v-hasPermi="['data:dataDrugs:edit']"
-        >修改</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete"
-          size="mini"
-          :disabled="multiple"
-          @click="handleDelete"
-          v-hasPermi="['data:dataDrugs:remove']"
-        >删除</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
+         <el-button
           type="warning"
           plain
-          icon="el-icon-download"
+          icon="el-icon-upload"
           size="mini"
-          @click="handleExport"
-          v-hasPermi="['data:dataDrugs:export']"
-        >导出</el-button>
+          @click="$refs.upload_file.click()"
+        >导入</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
     <el-table v-loading="loading" :data="dataDrugsList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="编号" align="center" prop="id" />
       <el-table-column label="药品名称" align="center" prop="name" />
       <el-table-column label="疾病" align="center" prop="disease" />
-      <el-table-column label="主要用途" align="center" prop="mainUse" width="180">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.mainUse, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
+      <el-table-column label="主要用途" align="center" prop="mainUse" width="180" />
       <el-table-column label="来源" align="center" prop="source" />
       <el-table-column label="备注" align="center" prop="remark" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@@ -154,12 +125,14 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+     <!-- 上传文件  -->
+     <input hidden type="file" ref="upload_file" accept=".xls,.xlsx" class="upload_file" @change="readExcel($event)" />
   </div>
 </template>
 
 <script>
-import { listDataDrugs, getDataDrugs, delDataDrugs, addDataDrugs, updateDataDrugs } from "@/api/data/dataDrugs"
-
+import { listDataDrugs, getDataDrugs, delDataDrugs, addDataDrugs, updateDataDrugs,importDataDrugs } from "@/api/data/dataDrugs"
+import * as XLSX from "xlsx"
 export default {
   name: "DataDrugs",
   data() {
@@ -193,6 +166,7 @@ export default {
       },
       // 表单参数
       form: {},
+      upload_file: "",
       // 表单校验
       rules: {
       }
@@ -202,6 +176,35 @@ export default {
     this.getList()
   },
   methods: {
+    // 读取Excel文件
+    readExcel(e) {
+      console.log("读取Excel文件", e);
+      console.log("读取Excel文件11", XLSX);
+      // 读取表格文件
+      let that = this;
+      const files = e.target.files;
+      if (files.length <= 0) {
+        return false;
+      } else if (!/\.(xls|xlsx)$/.test(files[0].name.toLowerCase())) {
+        this.$message({
+          message: "上传格式不正确,请上传xls或者xlsx格式",
+          type: "warning",
+        });
+        return false;
+      } else {
+        this.uploadFile(files[0]);
+        // 更新获取文件名
+        // that.upload_file = files[0].name;
+      }
+    },
+    uploadFile(file) {
+      const formData = new FormData(); // 创建FormData对象
+      formData.append('file', file); // 将文件添加到FormData对象中,
+      importDataDrugs(formData).then(response => {
+        this.$modal.msgSuccess("导入成功")
+        this.getList()
+      })
+    },
     /** 查询药品数据列表 */
     getList() {
       this.loading = true

+ 34 - 27
src/views/statistics/popularity-prediction/index.vue

@@ -4,24 +4,14 @@
           <!-- 筛选条件 -->
     <el-card class="filter-card">
       <el-form :inline="true" :model="form" size="small">
-        <el-form-item label="病原体名称">
-          <el-input
-            v-model="form.bytName"
-            placeholder="请输入病原体名称"
-            style="width: 180px"
-            @keyup.enter="initData"
-          />
+        
+        <el-form-item label="病原体">
+          <el-select v-model="form.pathogenId" placeholder="请选择病原体">
+            <el-option v-for="item in pathogen" :key="item.id" :label="item.name" :value="item.id"></el-option>
+          </el-select>
         </el-form-item>
         <el-form-item label="时间">
-          <el-date-picker
-            v-model="form.dateRange"
-            type="daterange"
-            range-separator="至"
-            start-placeholder="开始日期"
-            end-placeholder="结束日期"
-            style="width: 240px"
-            value-format="yyyy-MM-dd"
-          />
+          <el-date-picker v-model="form.dateRange" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 240px" value-format="yyyy-MM-dd"/>
         </el-form-item>
         <el-form-item>
           <el-button type="primary" @click="initData">查询</el-button>
@@ -31,16 +21,17 @@
       <!-- <div class="phylo-tree">
         <div id="phyloTree" ref="treeContainer" style="width: 100%; height: 500px;"></div>
       </div> -->
+      <div style="width:100%;height:500px;overflow:auto;">
+        <svg id="tree_display" ></svg>
+      </div>
       <el-row :gutter="20">
         <el-col :span="12">
           <div class="world-map">
-            <h3>世界地图病毒预测图</h3>
             <div id="worldVirusMap" style="width: 100%; height: 500px;"></div>
           </div>
         </el-col>
         <el-col :span="12">
           <div class="china-map">
-            <h3>中国地图病毒预测图</h3>
             <div id="chinaVirusMap" style="width: 100%; height: 500px;"></div>
           </div>
         </el-col>
@@ -53,7 +44,8 @@
 import * as echarts from 'echarts';
 import worldJson from 'echarts/map/json/world.json';
 import chinaJson from 'echarts/map/json/china.json';
-import { generatesjbytfzzbqkInfo, generatezgbytfzzbqkInfo } from '@/api/statistics/report';
+import { generatesjbytfzzbqkInfo, generatezgbytfzzbqkInfo,pathogenConfigGetAll } from '@/api/statistics/report';
+import { getPathogenConfig } from '@/api/system/pathogenConfig';
 
 echarts.registerMap('world', worldJson);
 echarts.registerMap('china', chinaJson);
@@ -71,7 +63,8 @@ export default {
       worldData: [],
       chinaData: [],
       worldMapChart: null,
-      chinaMapChart: null
+      chinaMapChart: null,
+      pathogen:null
     };
   },
   methods: {
@@ -391,24 +384,38 @@ export default {
         this.form.startDate = startDate;
         this.form.endDate = endDate;
       }
-
+      const res0 =await getPathogenConfig(this.form.pathogenId)
+      this.$nextTick(() => {
+        let tree = d3.layout.phylotree().svg(d3.select("#tree_display"))
+        .options({
+          'left-right-spacing': 'fit-to-step'
+        }).font_size(10)
+        .size([1, 900])
+        .node_circle_size(2);
+        tree(res0.data.treeTxt).layout();
+      });
       const res = await generatesjbytfzzbqkInfo(this.form);
       const res2 = await generatezgbytfzzbqkInfo(this.form);
       this.worldData = res.data;
       this.chinaData = res2.data;
       this.renderWorldVirusMap();
       this.renderChinaVirusMap();
+    },
+    async loadPathogen(){
+      const res0 = await pathogenConfigGetAll();
+      this.pathogen = res0.data;
     }
   },
   created() {
-    this.initData();
+    this.loadPathogen();
+    // this.initData();
   },
   mounted() {
-    setTimeout(() => {
-      this.renderWorldVirusMap();
-      this.renderChinaVirusMap();
-      // this.renderPhyloTree();
-    }, 500);
+    // setTimeout(() => {
+    //   this.renderWorldVirusMap();
+    //   this.renderChinaVirusMap();
+    //   // this.renderPhyloTree();
+    // }, 500);
   }
 };
 </script>

+ 254 - 0
src/views/system/pathogenConfig/index.vue

@@ -0,0 +1,254 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
+      <el-form-item label="名称" prop="name">
+        <el-input
+          v-model="queryParams.name"
+          placeholder="请输入名称"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="NCBI基因组序列编号" prop="assemblyAccession">
+        <el-input
+          v-model="queryParams.assemblyAccession"
+          placeholder="请输入NCBI基因组序列编号"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="病原体列表" prop="pathogenList">
+        <el-input
+          v-model="queryParams.pathogenList"
+          placeholder="请输入病原体列表"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['system:pathogenConfig:add']"
+        >新增</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="pathogenConfigList">
+      <el-table-column label="名称" align="center" prop="name" />
+      <el-table-column label="NCBI基因组序列编号" align="center" prop="assemblyAccession"  />
+      <el-table-column label="病原体列表" align="center" prop="pathogenList"  />
+      <!-- <el-table-column label="病原体演化树" align="center" prop="treeTxt" /> -->
+      <el-table-column label="备注" align="center" prop="remark" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['system:pathogenConfig:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['system:pathogenConfig:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改病原体演化树列对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
+        <el-form-item label="名称" prop="name">
+          <el-input v-model="form.name" placeholder="请输入名称" />
+        </el-form-item>
+        <el-form-item label="NCBI基因组序列编号" prop="assemblyAccession">
+          <el-input v-model="form.assemblyAccession" placeholder="请输入NCBI基因组序列编号" />
+        </el-form-item>
+        <el-form-item label="病原体列表" prop="pathogenList">
+          <el-input v-model="form.pathogenList" placeholder="请输入病原体列表" />
+        </el-form-item>
+        <el-form-item label="病原体演化树" prop="treeTxt">
+          <el-input v-model="form.treeTxt" type="textarea" placeholder="请输入内容" :rows="30"/>
+        </el-form-item>
+        <el-form-item label="备注" prop="remark">
+          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listPathogenConfig, getPathogenConfig, delPathogenConfig, addPathogenConfig, updatePathogenConfig } from "@/api/system/pathogenConfig"
+
+export default {
+  name: "PathogenConfig",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 病原体演化树列表格数据
+      pathogenConfigList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        name: null,
+        assemblyAccession: null,
+        pathogenList: null,
+        treeTxt: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    }
+  },
+  created() {
+    this.getList()
+  },
+  methods: {
+    /** 查询病原体演化树列列表 */
+    getList() {
+      this.loading = true
+      listPathogenConfig(this.queryParams).then(response => {
+        this.pathogenConfigList = response.rows
+        this.total = response.total
+        this.loading = false
+      })
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false
+      this.reset()
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        name: null,
+        assemblyAccession: null,
+        pathogenList: null,
+        treeTxt: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null,
+        remark: null
+      }
+      this.resetForm("form")
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1
+      this.getList()
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm")
+      this.handleQuery()
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset()
+      this.open = true
+      this.title = "添加病原体演化树列"
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset()
+      const id = row.id || this.ids
+      getPathogenConfig(id).then(response => {
+        this.form = response.data
+        this.open = true
+        this.title = "修改病原体演化树列"
+      })
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updatePathogenConfig(this.form).then(response => {
+              this.$modal.msgSuccess("修改成功")
+              this.open = false
+              this.getList()
+            })
+          } else {
+            addPathogenConfig(this.form).then(response => {
+              this.$modal.msgSuccess("新增成功")
+              this.open = false
+              this.getList()
+            })
+          }
+        }
+      })
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids
+      this.$modal.confirm('是否确认删除病原体演化树列编号为"' + ids + '"的数据项?').then(function() {
+        return delPathogenConfig(ids)
+      }).then(() => {
+        this.getList()
+        this.$modal.msgSuccess("删除成功")
+      }).catch(() => {})
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download('system/pathogenConfig/export', {
+        ...this.queryParams
+      }, `pathogenConfig_${new Date().getTime()}.xlsx`)
+    }
+  }
+}
+</script>