Browse Source

feat: update

Hu Cheng 1 year ago
parent
commit
5906277e09

File diff suppressed because it is too large
+ 0 - 0
src/assets/data.json


+ 64 - 9
src/views/certificate/index.vue

@@ -5,7 +5,7 @@
     </n-page-header>
     <div class="flex-1 grid grid-cols-2 gap-x-3">
       <n-card>
-        <n-list class="h-full">
+        <!-- <n-list class="h-full">
           <template #header>
             <n-space justify="space-between">
               <h2>校准证书</h2>
@@ -38,7 +38,46 @@
               </n-list-item>
             </template>
           </n-scrollbar>
-        </n-list>
+        </n-list> -->
+        <div class="flex flex-col gap-y-3">
+          <div class="self-end">
+            <n-button type="primary" @click="showAddModal">添加</n-button>
+          </div>
+          <n-table :bordered="false">
+            <thead>
+              <tr>
+                <th>布局编号</th>
+                <th>设备编号</th>
+                <th>证书有效期</th>
+                <th>备注</th>
+                <th>操作</th>
+              </tr>
+            </thead>
+            <tbody>
+              <tr v-for="item of dataList" :key="item">
+                <td>
+                  <n-input v-model:value="item.split('&')[1]" type="text" />
+                </td>
+                <td>{{ item.split('&')[2] }}</td>
+                <td>{{ item.split('&')[3] }}</td>
+                <td>{{ item.split('&')[4] }}</td>
+                <td>
+                  <n-space>
+                    <n-button type="primary" @click="handleView(item)"
+                      >查看</n-button
+                    >
+                    <n-popconfirm @positive-click="handleDelete(item)">
+                      <template #trigger>
+                        <n-button type="error">删除</n-button>
+                      </template>
+                      是否确认删除?
+                    </n-popconfirm>
+                  </n-space>
+                </td>
+              </tr>
+            </tbody>
+          </n-table>
+        </div>
       </n-card>
       <n-card>
         <div class="flex flex-col gap-y-3">
@@ -77,7 +116,7 @@
     :title="modal.title"
     positive-text="确认"
     negative-text="取消"
-    @positive-click="addCertificate"
+    @positive-click="getCertificateInfo"
   >
     <n-form :model="formValue" label-width="auto" show-require-mark>
       <n-form-item label="SN" path="T_sn">
@@ -90,7 +129,7 @@
 <script setup>
 import VuePdfEmbed from 'vue-pdf-embed';
 import { PrinterOutlined as PrinterIcon } from '@vicons/antd';
-import { getCertificate, getTask } from '@/api';
+import { getCertificate, getTask, editTask } from '@/api';
 import { useWindowSize } from '@vueuse/core';
 
 const { height } = useWindowSize();
@@ -121,6 +160,7 @@ const modal = reactive({
 // 表单数据
 const formValue = reactive({
   T_sn: null,
+  T_pdf3: '',
 });
 
 // 打印pdf
@@ -130,14 +170,14 @@ const onPrint = () => {
 
 //
 const handleView = (row) => {
-  source.value = row.slice(0, row.lastIndexOf('-'));
+  source.value = row.split('&')[0];
 };
 
-//
+// 删除
 const handleDelete = async (row) => {
-  const arr = dataList.value.filter((item) => item !== row);
   try {
-    const { data: res } = await getCertificate({
+    const arr = dataList.value.filter((item) => item !== row);
+    const { data: res } = await editTask({
       T_task_id: task.T_task_id,
       T_pdf3: arr.join('|'),
     });
@@ -155,11 +195,24 @@ const showAddModal = () => {
 };
 
 // 添加
-const addCertificate = async () => {
+const getCertificateInfo = async () => {
   try {
     const { data: res } = await getCertificate({
       T_sn: formValue.T_sn,
     });
+    formValue.T_pdf3 = `${res.Data.T_pdf}&${res.Data.Id}&${res.Data.T_Certificate_sn}&${res.Data.T_failure_time}&1|`;
+    editTaskInfo();
+  } catch (e) {
+    console.log(e);
+  }
+};
+
+const editTaskInfo = async () => {
+  try {
+    const { data: res } = await editTask({
+      T_task_id: task.T_task_id,
+      T_pdf3: taskInfo.value.T_pdf3 + formValue.T_pdf3,
+    });
     message.success(res.Msg);
     getTaskInfo();
   } catch (e) {
@@ -173,8 +226,10 @@ const getTaskInfo = async () => {
     const { data: res } = await getTask({
       T_task_id: task.T_task_id,
     });
+    console.log(res);
     taskInfo.value = res.Data || {};
     dataList.value = res.Data.T_pdf3.split('|').filter((item) => item);
+    console.log(dataList.value);
   } catch (e) {
     console.log(e);
   }

+ 48 - 48
src/views/data/edit/index.vue

@@ -38,7 +38,7 @@
                     </n-space>
                   </template>
                   <n-thing>
-                    <template #header> ID:{{ item.T_id }} </template>
+                    <template #header> {{ item.T_id }} </template>
                     <template #description> {{ item.T_sn }} </template>
                   </n-thing>
                 </n-list-item>
@@ -87,6 +87,7 @@
               :options="chartOptions1"
             ></Chart>
             <Chart
+              v-if="checkValues.length !== 0"
               ref="chart2"
               constructor-type="stockChart"
               :options="chartOptions2"
@@ -125,25 +126,25 @@
 </template>
 
 <script setup>
-import { Chart } from "highcharts-vue";
+import { Chart } from 'highcharts-vue';
 import {
   deleteTaskData,
   editTaskData,
   getTaskDataClassList,
   getTaskDataList,
-} from "@/api";
-import AddVue from "./AddVue.vue";
-import ImportVue from "./ImportVue.vue";
-import ImportPlatform from "./ImportPlatform.vue";
-import SetVue from "./SetVue.vue";
-import ExportVue from "./ExportVue.vue";
-import TemplateForm from "./TemplateForm.vue";
-import { useWindowSize } from "@vueuse/core";
-import { useNow, useDateFormat } from "@vueuse/core";
-import EditClass from "./EditTaskClass.vue";
-import DeleteClass from "./DeleteTaskClass.vue";
-
-const formatted = useDateFormat(useNow(), "YYYY-MM-DD HH:mm:ss");
+} from '@/api';
+import AddVue from './AddVue.vue';
+import ImportVue from './ImportVue.vue';
+import ImportPlatform from './ImportPlatform.vue';
+import SetVue from './SetVue.vue';
+import ExportVue from './ExportVue.vue';
+import TemplateForm from './TemplateForm.vue';
+import { useWindowSize } from '@vueuse/core';
+import { useNow, useDateFormat } from '@vueuse/core';
+import EditClass from './EditTaskClass.vue';
+import DeleteClass from './DeleteTaskClass.vue';
+
+const formatted = useDateFormat(useNow(), 'YYYY-MM-DD HH:mm:ss');
 
 const notification = useNotification();
 
@@ -151,8 +152,8 @@ const { height } = useWindowSize();
 
 const message = useMessage();
 
-const task = window.sessionStorage.getItem("task")
-  ? JSON.parse(window.sessionStorage.getItem("task"))
+const task = window.sessionStorage.getItem('task')
+  ? JSON.parse(window.sessionStorage.getItem('task'))
   : {};
 
 const chart1 = ref(null);
@@ -161,14 +162,14 @@ const chart2 = ref(null);
 // Modal 数据源
 const modal = reactive({
   showModal: false,
-  title: "",
+  title: '',
 });
 
 // 查询数据
 const queryData = reactive({
   T_task_id: task.T_task_id,
-  T_sn: "",
-  T_id: "",
+  T_sn: '',
+  T_id: '',
   Time_start: null,
   Time_end: null,
   page: 1,
@@ -206,7 +207,7 @@ const onScroll = (e) => {
 //
 const handleSet = (data) => {
   chart1.value.chart.yAxis[0].addPlotLine({
-    color: "red",
+    color: 'red',
     width: 2,
     value: data.tTop,
     label: {
@@ -214,7 +215,7 @@ const handleSet = (data) => {
     },
   });
   chart1.value.chart.yAxis[0].addPlotLine({
-    color: "red",
+    color: 'red',
     width: 2,
     value: data.tBottom,
     label: {
@@ -222,7 +223,7 @@ const handleSet = (data) => {
     },
   });
   chart2.value.chart.yAxis[0].addPlotLine({
-    color: "red",
+    color: 'red',
     width: 2,
     value: data.hTop,
     label: {
@@ -230,7 +231,7 @@ const handleSet = (data) => {
     },
   });
   chart2.value.chart.yAxis[0].addPlotLine({
-    color: "red",
+    color: 'red',
     width: 2,
     value: data.hBottom,
     label: {
@@ -257,10 +258,10 @@ const handleCheckAll = (checked) => {
         name: item,
         data: data1,
         lineWidth: 1,
-        cursor: "pointer",
+        cursor: 'pointer',
         events: {
           click(e) {
-            modal.title = "温度";
+            modal.title = '温度';
             modal.showModal = true;
             formValue.T_t = e.point.y;
             queryData.T_id = e.point.series.name;
@@ -274,10 +275,10 @@ const handleCheckAll = (checked) => {
         name: item,
         data: data2,
         lineWidth: 1,
-        cursor: "pointer",
+        cursor: 'pointer',
         events: {
           click(e) {
-            modal.title = "湿度";
+            modal.title = '湿度';
             modal.showModal = true;
             formValue.T_rh = e.point.y;
             queryData.T_id = e.point.series.name;
@@ -312,16 +313,16 @@ const onUpdateValues = async (values, meta) => {
   const data2 = dataList.value
     .map((item) => [new Date(item.T_time).getTime(), item.T_rh])
     .sort((a, b) => a[0] - b[0]);
-  if (meta.actionType === "check") {
+  if (meta.actionType === 'check') {
     chart1.value.chart.addSeries({
       id: meta.value,
       name: meta.value,
       data: data1,
       lineWidth: 1,
-      cursor: "pointer",
+      cursor: 'pointer',
       events: {
         click(e) {
-          modal.title = "温度";
+          modal.title = '温度';
           modal.showModal = true;
           formValue.T_t = e.point.y;
           queryData.T_id = e.point.series.name;
@@ -335,10 +336,10 @@ const onUpdateValues = async (values, meta) => {
       name: meta.value,
       data: data2,
       lineWidth: 1,
-      cursor: "pointer",
+      cursor: 'pointer',
       events: {
         click(e) {
-          modal.title = "湿度";
+          modal.title = '湿度';
           modal.showModal = true;
           formValue.T_rh = e.point.y;
           queryData.T_id = e.point.series.name;
@@ -357,7 +358,7 @@ const onUpdateValues = async (values, meta) => {
 const chartOptions1 = {
   xAxis: {
     labels: {
-      format: "{value:%Y-%m-%d}",
+      format: '{value:%Y-%m-%d %H:%M:%S}',
     },
   },
 
@@ -377,7 +378,7 @@ const chartOptions1 = {
   },
 
   chart: {
-    zoomType: "xy",
+    zoomType: 'xy',
   },
 
   boost: {
@@ -386,12 +387,12 @@ const chartOptions1 = {
   },
 
   title: {
-    text: "车载冷藏箱",
+    text: '车载冷藏箱',
   },
 
   subtitle: {
-    align: "left",
-    text: "车载冷藏箱",
+    align: 'left',
+    text: '车载冷藏箱',
   },
 
   tooltip: {
@@ -403,7 +404,7 @@ const chartOptions1 = {
 const chartOptions2 = {
   xAxis: {
     labels: {
-      format: "{value:%Y-%m-%d}",
+      format: '{value:%Y-%m-%d %H:%M:%S}',
     },
   },
 
@@ -422,7 +423,7 @@ const chartOptions2 = {
   },
 
   chart: {
-    zoomType: "xy",
+    zoomType: 'xy',
   },
 
   boost: {
@@ -431,12 +432,12 @@ const chartOptions2 = {
   },
 
   title: {
-    text: "车载冷藏箱",
+    text: '车载冷藏箱',
   },
 
   subtitle: {
-    align: "left",
-    text: "车载冷藏箱",
+    align: 'left',
+    text: '车载冷藏箱',
   },
 
   tooltip: {
@@ -490,7 +491,6 @@ const getDataList = async () => {
     }
   }
   const { data: res } = await getTaskDataList(data);
-  console.log(res);
   dataList.value = res.Data.List || [];
   if (queryData.page_z <= res.Data.Page_size) {
     const arr = classList.value.filter((item) =>
@@ -509,7 +509,7 @@ getClassList();
 if (task.T_collection_state === 0) {
   notification.info({
     closable: false,
-    title: "未完成",
+    title: '未完成',
     meta: `当前时间:${formatted.value}`,
     duration: 2500,
     keepAliveOnHover: true,
@@ -517,7 +517,7 @@ if (task.T_collection_state === 0) {
 } else if (task.T_collection_state === 1) {
   notification.info({
     closable: false,
-    title: "已完成",
+    title: '已完成',
     meta: `当前时间:${formatted.value}`,
     duration: 2500,
     keepAliveOnHover: true,
@@ -525,7 +525,7 @@ if (task.T_collection_state === 0) {
 } else if (task.T_collection_state === 2) {
   notification.info({
     closable: false,
-    title: "处理中",
+    title: '处理中',
     meta: `当前时间:${formatted.value}`,
     duration: 2500,
     keepAliveOnHover: true,
@@ -533,7 +533,7 @@ if (task.T_collection_state === 0) {
 } else if (task.T_collection_state === 3) {
   notification.info({
     closable: false,
-    title: "已采集-无数据",
+    title: '已采集-无数据',
     meta: `当前时间:${formatted.value}`,
     duration: 2500,
     keepAliveOnHover: true,

+ 69 - 39
src/views/equipment/index.vue

@@ -13,11 +13,10 @@
         />
         <n-button type="primary" @click="getDataList"> 搜索 </n-button>
       </n-input-group>
-      <n-button type="primary" @click="showAddModal">添加</n-button>
+      <n-button type="primary" @click="showAddModal">批量导入</n-button>
     </n-space>
     <n-data-table
       remote
-      :key="(row) => row.Id"
       :columns="columns"
       :data="data"
       :pagination="pagination"
@@ -36,7 +35,7 @@
     @positive-click="submitCallback"
   >
     <n-form :model="formValue" label-width="auto" show-require-mark>
-      <template v-if="modal.title === '添加'">
+      <template v-if="modal.title === '批量导入'">
         <n-form-item label="SN-ID" path="T_snid">
           <n-input
             v-model:value="formValue.T_snid"
@@ -53,58 +52,81 @@
           <n-input v-model:value="formValue.T_id" />
         </n-form-item>
       </template>
+      <n-form-item label="备注" path="T_remark">
+        <n-select v-model:value="formValue.T_remark" :options="remarkOptions" />
+      </n-form-item>
     </n-form>
   </n-modal>
 </template>
 
 <script setup>
-import { h } from "vue";
-import { NButton, NSpace, NPopconfirm, NInput } from "naive-ui";
+import { h } from 'vue';
+import { NButton, NSpace, NPopconfirm, NInput } from 'naive-ui';
 import {
   getDeviceClassListList,
   addDeviceClassList,
   editDeviceClassList,
   deleteDeviceClassList,
-} from "@/api";
+} from '@/api';
 
-const task = window.sessionStorage.getItem("task")
-  ? JSON.parse(window.sessionStorage.getItem("task"))
+const task = window.sessionStorage.getItem('task')
+  ? JSON.parse(window.sessionStorage.getItem('task'))
   : {};
 
 const message = useMessage();
 
 // 查询参数
 const queryData = reactive({
-  T_sn: "",
+  T_sn: '',
   T_class: task.T_class,
 });
 
+// 备注选项
+const remarkOptions = [
+  {
+    label: '产品存放区域',
+    value: '产品存放区域',
+  },
+  {
+    label: '其他',
+    value: '其他',
+  },
+];
+
 // 需要展示的列
 const columns = [
   {
-    title: "编号",
-    key: "T_id",
+    title: '编号',
+    key: 'T_id',
   },
   {
-    title: "设备序列号",
-    key: "T_sn",
+    title: '设备编号',
+    key: 'T_sn',
   },
   {
-    title: "操作",
-    key: "actions",
+    title: '证书有效期',
+    key: 'T_failure_time',
+  },
+  {
+    title: '备注',
+    key: 'T_remark',
+  },
+  {
+    title: '操作',
+    key: 'actions',
     render(row) {
       return h(
         NSpace,
         {},
         {
           default: () =>
-            ["修改编号", "删除"].map((item) => {
-              if (item === "修改编号") {
+            ['修改编号', '删除'].map((item) => {
+              if (item === '修改编号') {
                 return h(
                   NButton,
                   {
-                    type: "primary",
-                    size: "small",
+                    type: 'primary',
+                    size: 'small',
                     onClick: () => showEditModal(row),
                   },
                   { default: () => item }
@@ -116,13 +138,13 @@ const columns = [
                     onPositiveClick: () => deleteDeviceClass(row),
                   },
                   {
-                    default: () => "是否确认删除?",
+                    default: () => '是否确认删除?',
                     trigger: () =>
                       h(
                         NButton,
                         {
-                          type: "error",
-                          size: "small",
+                          type: 'error',
+                          size: 'small',
                         },
                         { default: () => item }
                       ),
@@ -153,29 +175,30 @@ const pagination = reactive({
 
 // 模态框数据源
 const modal = reactive({
-  title: "",
+  title: '',
   showModal: false,
 });
 
 // 获取表项中收集到的值的对象
 const formValue = reactive({
-  T_snid: "",
+  T_snid: '',
   T_id: 0,
+  T_remark: '',
 });
 
 // 输入框点击清空按钮时触发
 const handleClear = () => {
-  queryData.T_sn = "";
+  queryData.T_sn = '';
   getDataList();
 };
 
 //
 const submitCallback = () => {
-  if (modal.title === "添加") {
-    const arr = formValue.T_snid.split("\n");
+  if (modal.title === '批量导入') {
+    const arr = formValue.T_snid.split('\n');
     arr.forEach((item) => {
-      const [T_sn, T_id] = item.split("-");
-      addDeviceClass(T_sn, T_id);
+      const [T_sn, T_id] = item.split('-');
+      addDeviceClass(T_sn, T_id, formValue.T_remark);
     });
   } else {
     editDeviceClass();
@@ -184,17 +207,19 @@ const submitCallback = () => {
 
 // 显示编辑
 const showEditModal = (row) => {
-  modal.title = "修改编号";
+  modal.title = '修改编号';
   modal.showModal = true;
   formValue.Id = row.Id;
   formValue.T_id = `${row.T_id}`;
+  formValue.T_remark = row.T_remark;
 };
 
-// 显示添加
+// 显示批量导入
 const showAddModal = () => {
-  modal.title = "添加";
+  modal.title = '批量导入';
   modal.showModal = true;
-  formValue.T_snid = "";
+  formValue.T_snid = '';
+  formValue.T_remark = '产品存放区域';
 };
 
 // 删除
@@ -203,8 +228,10 @@ const deleteDeviceClass = async (row) => {
     const { data: res } = await deleteDeviceClassList({
       Id: row.Id,
     });
-    message.success(res.Msg);
-    getDataList();
+    if (res.Code === 200) {
+      message.success(res.Msg);
+      getDataList();
+    }
   } catch (e) {
     console.log(e);
   }
@@ -216,24 +243,27 @@ const editDeviceClass = async () => {
     const { data: res } = await editDeviceClassList({
       Id: formValue.Id,
       T_id: formValue.T_id,
+      T_remark: formValue.T_remark,
     });
-    message.success(res.Msg);
-    getDataList();
+    if (res.Code === 200) {
+      message.success(res.Msg);
+      getDataList();
+    }
   } catch (e) {
     console.log(e);
   }
 };
 
 // 添加
-const addDeviceClass = async (T_sn, T_id) => {
+const addDeviceClass = async (T_sn, T_id, T_remark) => {
   try {
     const { data: res } = await addDeviceClassList({
       T_class: queryData.T_class,
       T_sn,
       T_id,
+      T_remark,
     });
     if (res.Code === 200) {
-      message.success(res.Msg);
       getDataList();
     }
   } catch (e) {

+ 1 - 2
src/views/project/index.vue

@@ -237,9 +237,8 @@ const columns = [
       return h(NSpace, null, {
         default: () =>
           [
-            '实施方案',
-            '校准证书',
             '设备管理',
+            '实施方案',
             '数据来源',
             '数据编辑',
             '数据校验',

+ 43 - 17
src/views/report/create/index.vue

@@ -18,7 +18,7 @@
         class="w-2/5 mx-auto"
       >
         <template
-          v-for="(item, i) of templateList"
+          v-for="(item, index) of templateList"
           :key="item.T_VerifyTemplateMap_id"
         >
           <n-form-item :label="item.T_name" v-if="item.T_label === 1">
@@ -29,7 +29,7 @@
                   <InformationCircleOutline />
                 </n-icon>
               </template>
-              <n-image width="200" :src="item.T_text" />
+              {{ item.T_text }}
             </n-popover>
           </n-form-item>
           <n-form-item :label="item.T_name" v-else-if="item.T_label === 2">
@@ -40,7 +40,7 @@
                   <InformationCircleOutline />
                 </n-icon>
               </template>
-              <n-image width="200" :src="item.T_text" />
+              {{ item.T_text }}
             </n-popover>
           </n-form-item>
           <n-form-item :label="item.T_name" v-else-if="item.T_label === 3">
@@ -54,13 +54,16 @@
             >
               <template #action>
                 <n-space>
-                  <n-button class="underline" text @click="handleSelectAll(i)"
+                  <n-button
+                    class="underline"
+                    text
+                    @click="handleSelectAll(index)"
                     >全选</n-button
                   >
                   <n-button
                     class="underline"
                     text
-                    @click="handleSelectReverse(i)"
+                    @click="handleSelectReverse(index)"
                     >反选</n-button
                   >
                 </n-space>
@@ -72,7 +75,7 @@
                   <InformationCircleOutline />
                 </n-icon>
               </template>
-              <n-image width="200" :src="item.T_text" />
+              {{ item.T_text }}
             </n-popover>
           </n-form-item>
           <n-form-item :label="item.T_name" v-else-if="item.T_label === 4">
@@ -88,7 +91,7 @@
                   <InformationCircleOutline />
                 </n-icon>
               </template>
-              <n-image width="200" :src="item.T_text" />
+              {{ item.T_text }}
             </n-popover>
           </n-form-item>
           <n-divider v-else-if="item.T_label === 5" />
@@ -106,7 +109,7 @@
                   <InformationCircleOutline />
                 </n-icon>
               </template>
-              <n-image width="200" :src="item.T_text" />
+              {{ item.T_text }}
             </n-popover>
           </n-form-item>
           <n-form-item :label="item.T_name" v-else-if="item.T_label === 9">
@@ -123,7 +126,7 @@
                   <InformationCircleOutline />
                 </n-icon>
               </template>
-              <n-image width="200" :src="item.T_text" />
+              {{ item.T_text }}
             </n-popover>
           </n-form-item>
           <n-form-item :label="item.T_name" v-else-if="item.T_label === 10">
@@ -133,7 +136,7 @@
               :default-upload="false"
               :max="1"
             >
-              <n-button>{{ item.T_value ? '重新上传' : '点击上传' }}</n-button>
+              <n-button>点击上传</n-button>
             </n-upload>
             <n-popover trigger="hover">
               <template #trigger>
@@ -146,13 +149,7 @@
           </n-form-item>
           <n-form-item :label="item.T_name" v-else-if="item.T_label === 11">
             <n-image class="mr-5" width="100" :src="item.T_value" />
-            <n-upload
-              @change="(options) => handleChangeByIndex(options, i)"
-              :default-upload="false"
-              :max="1"
-            >
-              <n-button>{{ item.T_value ? '重新上传' : '点击上传' }}</n-button>
-            </n-upload>
+            <n-button @click="handleEdit(item, index)">编辑</n-button>
             <n-popover trigger="hover">
               <template #trigger>
                 <n-icon size="24" class="ml-3">
@@ -209,9 +206,30 @@ const task = window.sessionStorage.getItem('task')
   ? JSON.parse(window.sessionStorage.getItem('task'))
   : {};
 
+document.addEventListener('visibilitychange', () => {
+  if (document.visibilityState === 'hidden') {
+    // 离开当前tab标签
+    console.log('离开当前tab标签');
+  } else {
+    // 回到当前tab标签
+    console.log('回到当前tab标签');
+    templateList.value[
+      cadIndex.value
+    ].T_value = `http://coldverifylocal.coldbaozhida.com/CAD/download?type=upload&filename=${
+      queryData.T_task_id
+    }_${queryData.T_VerifyTemplate_id}_${
+      templateList.value[cadIndex.value].T_id
+    }.png`;
+    console.log(templateList.value[cadIndex.value].T_value);
+  }
+});
+
 // 获取表项中收集到的值的对象
 const pdf2 = ref('');
 
+// CAD索引
+const cadIndex = ref(0);
+
 // 查询数据
 const queryData = reactive({
   T_source: 2,
@@ -230,6 +248,14 @@ const modal = reactive({
   showModal: false,
 });
 
+// CAD编辑
+const handleEdit = (row, index) => {
+  cadIndex.value = index;
+  window.open(
+    `http://coldverifylocal.coldbaozhida.com/CAD/?task_id=${queryData.T_task_id}&vt_id=${queryData.T_VerifyTemplate_id}&key_id=${row.T_id}`
+  );
+};
+
 const handleChangeByIndex = async ({ file }, i) => {
   const token = await getFileToken(file.name.split('.')[1]);
   const observable = qiniu.upload(

+ 43 - 17
src/views/scheme/index.vue

@@ -18,7 +18,7 @@
         class="w-2/5 mx-auto"
       >
         <template
-          v-for="(item, i) of templateList"
+          v-for="(item, index) of templateList"
           :key="item.T_VerifyTemplateMap_id"
         >
           <n-form-item :label="item.T_name" v-if="item.T_label === 1">
@@ -29,7 +29,7 @@
                   <InformationCircleOutline />
                 </n-icon>
               </template>
-              <n-image width="200" :src="item.T_text" />
+              {{ item.T_text }}
             </n-popover>
           </n-form-item>
           <n-form-item :label="item.T_name" v-else-if="item.T_label === 2">
@@ -40,7 +40,7 @@
                   <InformationCircleOutline />
                 </n-icon>
               </template>
-              <n-image width="200" :src="item.T_text" />
+              {{ item.T_text }}
             </n-popover>
           </n-form-item>
           <n-form-item :label="item.T_name" v-else-if="item.T_label === 3">
@@ -54,13 +54,16 @@
             >
               <template #action>
                 <n-space>
-                  <n-button class="underline" text @click="handleSelectAll(i)"
+                  <n-button
+                    class="underline"
+                    text
+                    @click="handleSelectAll(index)"
                     >全选</n-button
                   >
                   <n-button
                     class="underline"
                     text
-                    @click="handleSelectReverse(i)"
+                    @click="handleSelectReverse(index)"
                     >反选</n-button
                   >
                 </n-space>
@@ -72,7 +75,7 @@
                   <InformationCircleOutline />
                 </n-icon>
               </template>
-              <n-image width="200" :src="item.T_text" />
+              {{ item.T_text }}
             </n-popover>
           </n-form-item>
           <n-form-item :label="item.T_name" v-else-if="item.T_label === 4">
@@ -88,7 +91,7 @@
                   <InformationCircleOutline />
                 </n-icon>
               </template>
-              <n-image width="200" :src="item.T_text" />
+              {{ item.T_text }}
             </n-popover>
           </n-form-item>
           <n-divider v-else-if="item.T_label === 5" />
@@ -106,7 +109,7 @@
                   <InformationCircleOutline />
                 </n-icon>
               </template>
-              <n-image width="200" :src="item.T_text" />
+              {{ item.T_text }}
             </n-popover>
           </n-form-item>
           <n-form-item :label="item.T_name" v-else-if="item.T_label === 9">
@@ -123,7 +126,7 @@
                   <InformationCircleOutline />
                 </n-icon>
               </template>
-              <n-image width="200" :src="item.T_text" />
+              {{ item.T_text }}
             </n-popover>
           </n-form-item>
           <n-form-item :label="item.T_name" v-else-if="item.T_label === 10">
@@ -133,7 +136,7 @@
               :default-upload="false"
               :max="1"
             >
-              <n-button>{{ item.T_value ? '重新上传' : '点击上传' }}</n-button>
+              <n-button>点击上传</n-button>
             </n-upload>
             <n-popover trigger="hover">
               <template #trigger>
@@ -146,13 +149,7 @@
           </n-form-item>
           <n-form-item :label="item.T_name" v-else-if="item.T_label === 11">
             <n-image class="mr-5" width="100" :src="item.T_value" />
-            <n-upload
-              @change="(options) => handleChangeByIndex(options, i)"
-              :default-upload="false"
-              :max="1"
-            >
-              <n-button>{{ item.T_value ? '重新上传' : '点击上传' }}</n-button>
-            </n-upload>
+            <n-button @click="handleEdit(item, index)">编辑</n-button>
             <n-popover trigger="hover">
               <template #trigger>
                 <n-icon size="24" class="ml-3">
@@ -209,9 +206,30 @@ const task = window.sessionStorage.getItem('task')
   ? JSON.parse(window.sessionStorage.getItem('task'))
   : {};
 
+document.addEventListener('visibilitychange', () => {
+  if (document.visibilityState === 'hidden') {
+    // 离开当前tab标签
+    console.log('离开当前tab标签');
+  } else {
+    // 回到当前tab标签
+    console.log('回到当前tab标签');
+    templateList.value[
+      cadIndex.value
+    ].T_value = `http://coldverifylocal.coldbaozhida.com/CAD/download?type=upload&filename=${
+      queryData.T_task_id
+    }_${queryData.T_VerifyTemplate_id}_${
+      templateList.value[cadIndex.value].T_id
+    }.png`;
+    console.log(templateList.value[cadIndex.value].T_value);
+  }
+});
+
 // 获取表项中收集到的值的对象
 const pdf1 = ref('');
 
+// CAD索引
+const cadIndex = ref(0);
+
 // 查询数据
 const queryData = reactive({
   T_source: 1,
@@ -230,6 +248,14 @@ const modal = reactive({
   showModal: false,
 });
 
+// CAD编辑
+const handleEdit = (row, index) => {
+  cadIndex.value = index;
+  window.open(
+    `http://coldverifylocal.coldbaozhida.com/CAD/?task_id=${queryData.T_task_id}&vt_id=${queryData.T_VerifyTemplate_id}&key_id=${row.T_id}`
+  );
+};
+
 const handleChangeByIndex = async ({ file }, i) => {
   const token = await getFileToken(file.name.split('.')[1]);
   const observable = qiniu.upload(

+ 1 - 1
vite.config.js

@@ -21,7 +21,7 @@ export default defineConfig({
   base: './',
   resolve: {
     alias: {
-      '@': fileURLToPath(new URL('src', import.meta.url)),
+      '@': fileURLToPath(new URL('./src', import.meta.url)),
     },
   },
   plugins: [

Some files were not shown because too many files changed in this diff