WangRuiLin 1 vuosi sitten
vanhempi
sitoutus
4843972a8a
5 muutettua tiedostoa jossa 820 lisäystä ja 120 poistoa
  1. 4 4
      package-lock.json
  2. 70 0
      src/api/modules/demo/data.ts
  3. 337 0
      src/views/demo/data/index.vue
  4. 1 1
      src/views/system/role/index.vue
  5. 408 115
      yarn.lock

+ 4 - 4
package-lock.json

@@ -1,12 +1,12 @@
 {
-  "name": "taais-web",
-  "version": "1.0.0",
+  "name": "km-admin",
+  "version": "1.2.0",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
-      "name": "taais-web",
-      "version": "1.0.0",
+      "name": "km-admin",
+      "version": "1.2.0",
       "license": "MIT",
       "dependencies": {
         "@element-plus/icons-vue": "^2.3.1",

+ 70 - 0
src/api/modules/demo/data.ts

@@ -0,0 +1,70 @@
+import http from '@/api'
+
+/**
+ * @name 查询数据管理列表
+ * @param query 参数
+ * @returns 返回列表
+ */
+export const listDataApi = (query: any) => {
+  return http.get<any>('/demo/data/list', query, { loading: true })
+}
+
+/**
+ * @name 查询数据管理详细
+ * @param id id
+ * @returns returns
+ */
+export const getDataApi = (id: any) => {
+  return http.get<any>(`/demo/data/${id}`)
+}
+
+/**
+ * @name 新增数据管理
+ * @param data data
+ * @returns returns
+ */
+export const addDataApi = (data: any) => {
+  return http.post<any>('/demo/data', data, { loading: false })
+}
+
+/**
+ * @name 修改数据管理
+ * @param data data
+ * @returns returns
+ */
+export const updateDataApi = (data: any) => {
+  return http.put<any>('/demo/data', data, { loading: false })
+}
+
+/**
+ * @name 删除数据管理
+ * @param id id
+ * @returns returns
+ */
+export const delDataApi = (ids: any) => {
+  return http.post<any>(`/demo/data/remove`, ids, { loading: false })
+}
+
+/**
+ * @name 下载模板
+ * @returns returns
+ */
+export const importTemplateApi = () => {
+  return http.downloadPost('/demo/data/importTemplate', {})
+}
+
+/**
+ * @name 导入数据
+ * @returns returns
+ */
+export const importDataDataApi = (data: any) => {
+  return http.post('/demo/data/importData', data)
+}
+
+/**
+ * @name 导出数据
+ * @returns returns
+ */
+export const exportDataApi = (data: any) => {
+  return http.downloadPost('/demo/data/export', data)
+}

+ 337 - 0
src/views/demo/data/index.vue

@@ -0,0 +1,337 @@
+<template>
+  <div class="table-box">
+    <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listDataApi" :init-param="initParam">
+      <!-- 表格 header 按钮 -->
+      <template #tableHeader="scope">
+        <el-button type="primary" v-auth="['demo:data:add']" :icon="CirclePlus" @click="openDialog(1, '数据新增')">
+          新增
+        </el-button>
+        <el-button type="primary" v-auth="['demo:data:import']" :icon="Upload" plain @click="batchAdd"> 导入 </el-button>
+        <el-button type="primary" v-auth="['demo:data:export']" :icon="Download" plain @click="downloadFile"> 导出 </el-button>
+        <el-button
+          type="danger"
+          v-auth="['demo:data:remove']"
+          :icon="Delete"
+          plain
+          :disabled="!scope.isSelected"
+          @click="batchDelete(scope.selectedListIds)"
+        >
+          批量删除
+        </el-button>
+      </template>
+      <!-- 表格操作 -->
+      <template #operation="scope">
+        <el-button type="primary" link :icon="EditPen" v-auth="['demo:data:edit']" @click="openDialog(2, '数据编辑', scope.row)">
+          编辑
+        </el-button>
+        <el-button type="primary" link :icon="View" v-auth="['demo:data:query']" @click="openDialog(3, '数据查看', scope.row)">
+          查看
+        </el-button>
+        <el-button type="primary" link :icon="Delete" v-auth="['demo:data:remove']" @click="deleteData(scope.row)">
+          删除
+        </el-button>
+      </template>
+    </ProTable>
+    <FormDialog ref="formDialogRef" />
+    <ImportExcel ref="dialogRef" />
+  </div>
+</template>
+
+<script setup lang="tsx" name="Data">
+import { ref, reactive } from 'vue'
+import { useHandleData } from '@/hooks/useHandleData'
+import { useDownload } from '@/hooks/useDownload'
+import { ElMessageBox } from 'element-plus'
+import ProTable from '@/components/ProTable/index.vue'
+import ImportExcel from '@/components/ImportExcel/index.vue'
+import FormDialog from '@/components/FormDialog/index.vue'
+import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
+import { Delete, EditPen, Download, Upload, View, CirclePlus } from '@element-plus/icons-vue'
+import {
+  listDataApi,
+  delDataApi,
+  addDataApi,
+  updateDataApi,
+  importTemplateApi,
+  importDataDataApi,
+  exportDataApi,
+  getDataApi
+} from '@/api/modules/demo/data'
+
+// ProTable 实例
+const proTable = ref<ProTableInstance>()
+
+const initParam = reactive({ type: 1 })
+// 删除数据管理信息
+const deleteData = async (params: any) => {
+  await useHandleData(delDataApi, [params.id], `删除【${params.name}】数据`)
+  proTable.value?.getTableList()
+}
+
+// 批量删除数据管理信息
+const batchDelete = async (ids: string[]) => {
+  await useHandleData(delDataApi, ids, '删除所选数据信息')
+  proTable.value?.clearSelection()
+  proTable.value?.getTableList()
+}
+
+// 导出数据管理列表
+const downloadFile = async () => {
+  ElMessageBox.confirm('确认导出数据管理数据?', '温馨提示', { type: 'warning' }).then(() =>
+    useDownload(exportDataApi, '数据管理列表', proTable.value?.searchParam)
+  )
+}
+
+// 批量添加数据管理
+const dialogRef = ref<InstanceType<typeof ImportExcel> | null>(null)
+const batchAdd = () => {
+  const params = {
+    title: '数据管理',
+    tempApi: importTemplateApi,
+    importApi: importDataDataApi,
+    getTableList: proTable.value?.getTableList
+  }
+  dialogRef.value?.acceptParams(params)
+}
+
+const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
+// 打开弹框的功能
+const openDialog = async (type: number, title: string, row?: any) => {
+  let res = { data: {} }
+  if (row?.id) {
+    res = await getDataApi(row?.id || null)
+  }
+  // 重置表单
+  setFormItems()
+  const params = {
+    title,
+    width: 580,
+    isEdit: type !== 3,
+    itemsOptions: formItems,
+    model: type == 1 ? {} : res.data,
+    api: type == 1 ? addDataApi : updateDataApi,
+    getTableList: proTable.value?.getTableList
+  }
+  formDialogRef.value?.openDialog(params)
+}
+
+// 表格配置项
+const columns = reactive<ColumnProps<any>[]>([
+  { type: 'selection', fixed: 'left', width: 70 },
+
+  {
+    prop: 'name',
+    label: '名称',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'dataType',
+    label: '数据类型',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'fileType',
+    label: '文件类型',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'objectType',
+    label: '目标类型',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'objectSubtype',
+    label: '目标子类型',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'batchNum',
+    label: '批次号',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'scene',
+    label: '场景',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'dataSource',
+    label: '数据源',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'gatherTime',
+    label: '采集时间',
+    search: {
+      el: 'date-picker',
+      props: { type: 'datetimerange', valueFormat: 'YYYY-MM-DD HH:mm:ss' }
+    },
+    width: 120
+  },
+  {
+    prop: 'gatherSpot',
+    label: '采集地点',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'increment',
+    label: '扩增方式',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  {
+    prop: 'labeled',
+    label: '是否标注',
+    search: {
+      el: 'input'
+    },
+    width: 120
+  },
+  { prop: 'operation', label: '操作', width: 230, fixed: 'right' }
+])
+// 表单配置项
+let formItems: ProForm.ItemsOptions[] = []
+const setFormItems = () => {
+  formItems = [
+    {
+      label: '名称',
+      prop: 'name',
+      rules: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入名称'
+      }
+    },
+    {
+      label: '数据类型',
+      prop: 'dataType',
+      rules: [{ required: true, message: '数据类型不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入数据类型'
+      }
+    },
+    {
+      label: '文件类型',
+      prop: 'fileType',
+      rules: [{ required: true, message: '文件类型不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入文件类型'
+      }
+    },
+    {
+      label: '目标类型',
+      prop: 'objectType',
+      rules: [{ required: true, message: '目标类型不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入目标类型'
+      }
+    },
+    {
+      label: '目标子类型',
+      prop: 'objectSubtype',
+      rules: [{ required: true, message: '目标子类型不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入目标子类型'
+      }
+    },
+    {
+      label: '批次号',
+      prop: 'batchNum',
+      rules: [{ required: true, message: '批次号不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入批次号'
+      }
+    },
+    {
+      label: '场景',
+      prop: 'scene',
+      rules: [{ required: true, message: '场景不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入场景'
+      }
+    },
+    {
+      label: '数据源',
+      prop: 'dataSource',
+      rules: [{ required: true, message: '数据源不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入数据源'
+      }
+    },
+    {
+      label: '采集时间',
+      prop: 'gatherTime',
+      rules: [{ required: true, message: '采集时间不能为空', trigger: 'change' }],
+      compOptions: {
+        elTagName: 'date-picker',
+        type: 'datetime',
+        valueFormat: 'YYYY-MM-DD HH:mm:ss',
+        placeholder: '请选择采集时间'
+      }
+    },
+    {
+      label: '采集地点',
+      prop: 'gatherSpot',
+      rules: [{ required: true, message: '采集地点不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入采集地点'
+      }
+    },
+    {
+      label: '扩增方式',
+      prop: 'increment',
+      rules: [{ required: true, message: '扩增方式不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入扩增方式'
+      }
+    },
+    {
+      label: '是否标注',
+      prop: 'labeled',
+      rules: [{ required: true, message: '是否标注不能为空', trigger: 'blur' }],
+      compOptions: {
+        elTagName: 'select',
+        enum: [
+          {
+            value: true,
+            label: 'true'
+          },
+          {
+            value: false,
+            label: 'false'
+          }
+        ],
+        placeholder: '请输入是否标注'
+      }
+    }
+  ]
+}
+</script>

+ 1 - 1
src/views/system/role/index.vue

@@ -385,7 +385,7 @@ const reset = () => {
 // 表格配置项
 const columns = reactive<ColumnProps<any>[]>([
   { type: 'selection', fixed: 'left', width: 70 },
-  { prop: 'roleId', label: '角色编号' },
+
   {
     prop: 'roleName',
     label: '角色名称'

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 408 - 115
yarn.lock


Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä