소스 검색

feat: update

Hu Cheng 2 년 전
부모
커밋
04aaf65d64

+ 1 - 11
README.md

@@ -1,14 +1,4 @@
-# vue-project
-
-This template should help get you started developing with Vue 3 in Vite.
-
-## Recommended IDE Setup
-
-[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
-
-## Customize configuration
-
-See [Vite Configuration Reference](https://vitejs.dev/config/).
+# 冷链验证报告2.0
 
 ## Project Setup
 

+ 1 - 0
package.json

@@ -19,6 +19,7 @@
     "highcharts": "^10.3.3",
     "highcharts-vue": "^1.4.0",
     "md5": "^2.3.0",
+    "pinia": "^2.0.32",
     "qiniu-js": "^3.4.1",
     "vue": "^3.2.45",
     "vue-pdf-embed": "^1.1.5",

+ 34 - 0
pnpm-lock.yaml

@@ -13,6 +13,7 @@ specifiers:
   highcharts-vue: ^1.4.0
   md5: ^2.3.0
   naive-ui: ^2.34.3
+  pinia: ^2.0.32
   prettier: ^2.7.1
   qiniu-js: ^3.4.1
   sass: ^1.58.0
@@ -30,6 +31,7 @@ dependencies:
   highcharts: 10.3.3
   highcharts-vue: 1.4.0_x2ttk5sq3pjxzxl7cjqodvt53e
   md5: 2.3.0
+  pinia: 2.0.32_vue@3.2.47
   qiniu-js: 3.4.1
   vue: 3.2.47
   vue-pdf-embed: 1.1.5_vue@3.2.47
@@ -2066,6 +2068,23 @@ packages:
     engines: {node: '>=8.6'}
     dev: true
 
+  /pinia/2.0.32_vue@3.2.47:
+    resolution: {integrity: sha512-8Tw4OrpCSJ028UUyp0gYPP/wyjigLoEceuO/x1G+FlHVf73337e5vLm4uDmrRIoBG1hvaed/eSHnrCFjOc4nkA==}
+    peerDependencies:
+      '@vue/composition-api': ^1.4.0
+      typescript: '>=4.4.4'
+      vue: ^2.6.14 || ^3.2.0
+    peerDependenciesMeta:
+      '@vue/composition-api':
+        optional: true
+      typescript:
+        optional: true
+    dependencies:
+      '@vue/devtools-api': 6.5.0
+      vue: 3.2.47
+      vue-demi: 0.13.11_vue@3.2.47
+    dev: false
+
   /pkg-types/1.0.1:
     resolution: {integrity: sha512-jHv9HB+Ho7dj6ItwppRDDl0iZRYBD0jsakHXtFgoLr+cHSF6xC+QL54sJmWxyGxOLYSHm0afhXhXcQDQqH9z8g==}
     dependencies:
@@ -2574,6 +2593,21 @@ packages:
       vue: 3.2.47
     dev: true
 
+  /vue-demi/0.13.11_vue@3.2.47:
+    resolution: {integrity: sha512-IR8HoEEGM65YY3ZJYAjMlKygDQn25D5ajNFNoKh9RSDMQtlzCxtfQjdQgv9jjK+m3377SsJXY8ysq8kLCZL25A==}
+    engines: {node: '>=12'}
+    hasBin: true
+    requiresBuild: true
+    peerDependencies:
+      '@vue/composition-api': ^1.0.0-rc.1
+      vue: ^3.0.0-0 || ^2.6.0
+    peerDependenciesMeta:
+      '@vue/composition-api':
+        optional: true
+    dependencies:
+      vue: 3.2.47
+    dev: false
+
   /vue-eslint-parser/9.1.0_eslint@8.33.0:
     resolution: {integrity: sha512-NGn/iQy8/Wb7RrRa4aRkokyCZfOUWk19OP5HP6JEozQFX5AoS/t+Z0ZN7FY4LlmWc4FNI922V7cvX28zctN8dQ==}
     engines: {node: ^14.17.0 || >=16.0.0}

+ 2 - 0
src/main.js

@@ -1,4 +1,5 @@
 import { createApp } from "vue";
+import { createPinia } from "pinia";
 import App from "./App.vue";
 import router from "./router";
 import "./plugin/highcharts";
@@ -8,4 +9,5 @@ import "./assets/main.css";
 const app = createApp(App);
 
 app.use(router);
+app.use(createPinia());
 app.mount("#app");

+ 43 - 0
src/stores/fileToken.js

@@ -0,0 +1,43 @@
+import { defineStore } from "pinia";
+import { getUpFileTokenData } from "@/api";
+import * as qiniu from "qiniu-js";
+import { createDiscreteApi } from "naive-ui";
+
+const { message } = createDiscreteApi(["message"]);
+
+export const useFileTokenStore = defineStore("file-token", {
+  state() {
+    return {
+      fileToken: "",
+    };
+  },
+  actions: {
+    async getUpFileToken(T_suffix) {
+      const { data: res } = await getUpFileTokenData({
+        T_suffix,
+      });
+      // const observable = qiniu.upload(
+      //   options.file.file,
+      //   options.file.name,
+      //   token,
+      //   {},
+      //   {
+      //     useCdnDomain: true,
+      //   }
+      // );
+      // observable.subscribe({
+      //   next: (result) => {
+      //     // 主要用来展示进度
+      //     console.warn(result);
+      //   },
+      //   error: () => {
+      //     message.error("上传图片失败");
+      //   },
+      //   complete: (res) => {
+      //     console.log(res);
+      //   },
+      // });
+      console.log(res);
+    },
+  },
+});

+ 42 - 38
src/views/project/certificate/index.vue

@@ -1,9 +1,12 @@
 <template>
   <n-space vertical>
-    <n-breadcrumb>
-      <n-breadcrumb-item>任务管理</n-breadcrumb-item>
-      <n-breadcrumb-item>校准证书</n-breadcrumb-item>
-    </n-breadcrumb>
+    <n-space justify="space-between">
+      <n-breadcrumb>
+        <n-breadcrumb-item>任务管理</n-breadcrumb-item>
+        <n-breadcrumb-item>校准证书</n-breadcrumb-item>
+      </n-breadcrumb>
+      <n-button type="primary" @click="showAddModal">添加</n-button>
+    </n-space>
     <n-descriptions bordered>
       <n-descriptions-item label="报告名称">
         {{ taskInfo.T_name }}
@@ -15,39 +18,19 @@
         {{ taskInfo.UpdateTime }}
       </n-descriptions-item>
     </n-descriptions>
-    <n-grid x-gap="12" :cols="3">
-      <n-gi>
-        <n-list>
-          <n-list-item>
-            <template #suffix>
-              <n-button type="error" size="large">删除</n-button>
-            </template>
-            <n-card
-              embedded
-              :bordered="false"
-              content-style="text-align: center"
-            >
-              123
-            </n-card>
-          </n-list-item>
-        </n-list>
-      </n-gi>
-      <n-gi :span="2">
-        <n-space justify="end">
-          <n-button text style="font-size: 24px" @click="onPrint">
-            <n-icon>
-              <printer-icon />
-            </n-icon>
-          </n-button>
-        </n-space>
-        <n-scrollbar style="max-height: 500px" trigger="none">
-          <vue-pdf-embed
-            ref="pdfRef"
-            source="https://pure-admin.github.io/pure-admin-doc/pdf/Cookie%E5%92%8CSession%E5%8C%BA%E5%88%AB%E7%94%A8%E6%B3%95.pdf"
-          />
-        </n-scrollbar>
-      </n-gi>
-    </n-grid>
+    <n-space justify="end">
+      <n-button text style="font-size: 24px" @click="onPrint">
+        <n-icon>
+          <printer-icon />
+        </n-icon>
+      </n-button>
+    </n-space>
+    <n-scrollbar style="max-height: 550px" trigger="none">
+      <vue-pdf-embed
+        ref="pdfRef"
+        source="https://pure-admin.github.io/pure-admin-doc/pdf/Cookie%E5%92%8CSession%E5%8C%BA%E5%88%AB%E7%94%A8%E6%B3%95.pdf"
+      />
+    </n-scrollbar>
   </n-space>
   <n-modal
     :show-icon="false"
@@ -58,7 +41,13 @@
     negative-text="取消"
     @positive-click="submitCallback"
   >
-    123
+    <n-upload
+      :default-upload="false"
+      :max="1"
+      @change="handleChange"
+    >
+      <n-button>选择文件</n-button>
+    </n-upload>
   </n-modal>
 </template>
 
@@ -66,6 +55,11 @@
 import VuePdfEmbed from "vue-pdf-embed";
 import { PrinterOutlined as PrinterIcon } from "@vicons/antd";
 import { getTask } from "@/api";
+// import { useFileTokenStore } from "@/stores/fileToken";
+
+// const fileTokenStore = useFileTokenStore();
+
+// const message = useMessage();
 
 const pdfRef = ref(null);
 
@@ -96,6 +90,16 @@ const submitCallback = () => {
   }
 };
 
+const handleChange = (options) => {
+  console.log(options);
+};
+
+// 显示添加
+const showAddModal = () => {
+  modal.showModal = true;
+  modal.title = "添加";
+};
+
 // 任务(获取)
 const getTaskInfo = async () => {
   const { data: res } = await getTask({

+ 1 - 1
src/views/project/data/edit/index.vue

@@ -142,7 +142,7 @@
         </n-form-item>
         <n-form-item label="温度" path="value">
           <n-input v-model:value="formValue.value">
-            <template #suffix> C </template>
+            <template #suffix>  </template>
           </n-input>
         </n-form-item>
         <n-form-item label="湿度" path="value">

+ 27 - 44
src/views/project/data/source/index.vue

@@ -50,49 +50,7 @@
 </template>
 
 <script setup>
-import { h } from "vue";
-import { NButton, NSpace } from "naive-ui";
-
-const createColumns = () => {
-  return [
-    {
-      title: "项目名称",
-      key: "no",
-    },
-    {
-      title: "描述",
-      key: "title",
-    },
-    {
-      title: "时间",
-      key: "length",
-    },
-    {
-      title: "操作",
-      key: "actions",
-      render() {
-        return h(
-          NSpace,
-          {},
-          {
-            default: () =>
-              ["删除"].map((item) =>
-                h(
-                  NButton,
-                  {
-                    type: "error",
-                    size: "small",
-                    onClick: () => {},
-                  },
-                  { default: () => item }
-                )
-              ),
-          }
-        );
-      },
-    },
-  ];
-};
+import { NSpace } from "naive-ui";
 
 const data = [
   { no: 3, title: "Wonderwall", length: "4:18" },
@@ -100,7 +58,32 @@ const data = [
   { no: 12, title: "Champagne Supernova", length: "7:27" },
 ];
 
-const columns = createColumns({});
+const columns = [
+  {
+    title: "传感器名称",
+    key: "no",
+  },
+  {
+    title: "温度",
+    key: "title",
+  },
+  {
+    title: "湿度",
+    key: "length",
+  },
+  {
+    title: "温度范围",
+    key: "actions",
+  },
+  {
+    title: "湿度范围",
+    key: "actions",
+  },
+  {
+    title: "记录时间",
+    key: "actions",
+  },
+];
 const pagination = ref(false);
 
 const modal = reactive({

+ 12 - 1
src/views/project/equipment/index.vue

@@ -24,6 +24,7 @@
       :data="data"
       :pagination="pagination"
       :bordered="false"
+      :max-height="550"
     />
   </n-space>
   <n-modal
@@ -162,7 +163,17 @@ const data = ref([]);
 const deviceList = ref([]);
 const deviceOptions = ref([]);
 
-const pagination = ref(false);
+// 分页数据源
+const pagination = reactive({
+  page: queryData.page,
+  pageSize: queryData.page_z,
+  itemCount: 0,
+  onChange: (page) => {
+    pagination.page = page;
+    queryData.page = page;
+    getDeviceClassListDataList();
+  },
+});
 
 // 模态框数据源
 const modal = reactive({

+ 16 - 2
src/views/project/report/audit/index.vue

@@ -19,7 +19,7 @@
       </n-descriptions-item>
     </n-descriptions>
     <n-tabs type="segment" animated size="large">
-      <n-tab-pane name="chap1" tab="验证报告内容">
+      <n-tab-pane name="1" tab="验证方案">
         <n-space justify="end">
           <n-button text style="font-size: 24px" @click="onPrint">
             <n-icon>
@@ -34,7 +34,21 @@
           />
         </n-scrollbar>
       </n-tab-pane>
-      <n-tab-pane name="chap2" tab="验证设备证书">
+      <n-tab-pane name="2" tab="验证报告">
+        “威尔!着火了!快来帮忙!”我听到女朋友大喊。现在一个难题在我面前——是恢复一个重要的
+        Amazon 服务,还是救公寓的火。<br /><br />
+        我的脑海中忽然出现了 Amazon
+        著名的领导力准则”客户至上“,有很多的客户还依赖我们的服务,我不能让他们失望!所以着火也不管了,女朋友喊我也无所谓,我开始
+        debug 这个线上问题。
+      </n-tab-pane>
+      <n-tab-pane name="3" tab="校准证书">
+        “威尔!着火了!快来帮忙!”我听到女朋友大喊。现在一个难题在我面前——是恢复一个重要的
+        Amazon 服务,还是救公寓的火。<br /><br />
+        我的脑海中忽然出现了 Amazon
+        著名的领导力准则”客户至上“,有很多的客户还依赖我们的服务,我不能让他们失望!所以着火也不管了,女朋友喊我也无所谓,我开始
+        debug 这个线上问题。
+      </n-tab-pane>
+      <n-tab-pane name="4" tab="验证数据">
         “威尔!着火了!快来帮忙!”我听到女朋友大喊。现在一个难题在我面前——是恢复一个重要的
         Amazon 服务,还是救公寓的火。<br /><br />
         我的脑海中忽然出现了 Amazon

+ 25 - 26
src/views/project/scheme/index.vue

@@ -1,14 +1,16 @@
 <template>
   <n-space vertical>
-    <n-breadcrumb>
-      <n-breadcrumb-item>任务管理</n-breadcrumb-item>
-      <n-breadcrumb-item>实施方案</n-breadcrumb-item>
-    </n-breadcrumb>
+    <n-space justify="space-between">
+      <n-breadcrumb>
+        <n-breadcrumb-item>任务管理</n-breadcrumb-item>
+        <n-breadcrumb-item>实施方案</n-breadcrumb-item>
+      </n-breadcrumb>
+      <n-button type="primary" @click="handleClick">生成报告</n-button>
+    </n-space>
     <n-scrollbar style="max-height: 650px">
       <div class="w-1/3 mx-auto">
         <n-form
           ref="formRef"
-          :model="formValue"
           :rules="rules"
           label-placement="left"
           label-width="auto"
@@ -24,15 +26,15 @@
               v-if="item.T_label === 3"
             >
               <n-popselect
-                v-model:value="value"
                 multiple
                 :options="options"
                 :render-label="renderLabel"
+                v-model:value="item.T_value"
               >
                 <n-button>
                   {{
-                    Array.isArray(value) && value.length
-                      ? value.join(" | ")
+                    Array.isArray(item.T_value) && item.T_value.length
+                      ? item.T_value.join(" | ")
                       : "选择"
                   }}
                 </n-button>
@@ -52,10 +54,7 @@
               :path="item.T_field"
               v-else-if="item.T_label === 4"
             >
-              <n-select
-                v-model:value="formValue.selectedValue"
-                :options="options"
-              />
+              <n-select :options="options" />
               <n-popover trigger="hover">
                 <template #trigger>
                   <n-icon size="20" class="ml-3">
@@ -73,7 +72,6 @@
               v-else-if="item.T_label === 7"
             >
               <n-date-picker
-                v-model:formatted-value="formValue.formattedValue"
                 value-format="yyyy-MM-dd HH:mm:ss"
                 type="datetime"
                 clearable
@@ -94,9 +92,7 @@
               v-else-if="item.T_label === 9"
             >
               <n-date-picker
-                v-model:formatted-value="formValue.formattedValue"
                 value-format="yyyy-MM-dd HH:mm:ss"
-                v-model:value="formValue.formattedValue"
                 type="datetimerange"
                 clearable
               />
@@ -146,7 +142,7 @@
               </n-popover>
             </n-form-item>
             <n-form-item :label="item.T_name" :path="item.T_field" v-else>
-              <n-input v-model:value="formValue[item.T_field]" />
+              <n-input v-model:value="item.T_value" />
               <n-popover trigger="hover">
                 <template #trigger>
                   <n-icon size="20" class="ml-3">
@@ -181,22 +177,21 @@ import { QuestionCircleOutlined } from "@vicons/antd";
 import { NThing } from "naive-ui";
 
 const renderLabel = () => {
-  return h(NThing, {}, { avatar: () => "avatar", header: () => "title", description: () => "description" });
+  return h(
+    NThing,
+    {},
+    {
+      avatar: () => "avatar",
+      header: () => "title",
+      description: () => "description",
+    }
+  );
 };
 
 const props = defineProps({
   taskId: String,
 });
 
-const value = ref(null);
-
-// 表单信息
-const formValue = reactive({
-  textValue: null,
-  formattedValue: null,
-  selectedValue: null,
-});
-
 // 模板标签数据列表
 const templateDataList = ref([]);
 
@@ -229,6 +224,10 @@ const rules = {
   extent: { required: true, message: "不能为空", trigger: ["blur", "change"] },
 };
 
+const handleClick = () => {
+  console.log(templateDataList.value);
+};
+
 // 执行 positive 时执行的回调函数
 const submitCallback = () => {
   if (modal.title === "添加") {