YangJian0701 1 year ago
parent
commit
d38f3a4bcf
3 changed files with 71 additions and 21 deletions
  1. 19 4
      src/views/data/edit/index.vue
  2. 29 8
      src/views/equipment/index.vue
  3. 23 9
      src/views/project/index.vue

+ 19 - 4
src/views/data/edit/index.vue

@@ -2,6 +2,9 @@
   <div class="h-full flex flex-col gap-y-3">
     <n-page-header @back="$router.back">
       <template #title> 数据编辑 </template>
+      <template #extra>
+        <n-button type="primary" @click="CompleteFun">完成编辑</n-button>
+      </template>
     </n-page-header>
     <div class="flex-1 grid grid-cols-4 gap-x-3" style="display: flex;">
       <n-card style="width: 370px;flex-shrink: 0;">
@@ -151,7 +154,7 @@
         </template>
         是否确认删除?
       </n-popconfirm>
-      <n-button type="primary" @click="editTask">确定</n-button>
+      <n-button type="primary" @click="editTaskFun">确定</n-button>
 
     </n-space>
   </n-modal>
@@ -196,7 +199,8 @@ import {
   editTaskDataClass,
   deleteTaskDataClass,
   TaskDatajpg,
-  TaskDatajpgSta
+  TaskDatajpgSta,
+  editTask
 } from '@/api';
 import AddVue from './AddVue.vue';
 import ImportVue from './ImportVue.vue';
@@ -404,7 +408,18 @@ const alldeleteApi = async () => {
 
 const dataList = ref([]);
 
-
+//完成编辑
+const CompleteFun = async ()=>{
+  const {data:resIt} = await editTask({
+    T_task_id: queryData.T_task_id,
+    T_collection_state:4
+  })
+  if(resIt.Code==200 && resIt.Msg=='ok!'){
+    message.success('完成编辑')
+  }else{
+    message.error('编辑失败')
+  }
+}
 
 const formDatas = reactive({
   T_sn: '',
@@ -525,7 +540,7 @@ const deleteTask = async () => {
 };
 
 // 编辑
-const editTask = async () => {
+const editTaskFun = async () => {
   console.log('88', tabValue.value, dataInfo.value, formValue.T_t, formValue.T_rh)
   // return
   const { data: res } = await editTaskData({

+ 29 - 8
src/views/equipment/index.vue

@@ -4,10 +4,13 @@
       <template #title> 设备管理 </template>
     </n-page-header>
     <n-space justify="space-between">
-      <n-input-group>
+      <div style="display: flex;align-items: center;">
         <n-input style="width: 300px" v-model:value="queryData.T_sn" @clear="handleClear" clearable />
-        <n-button type="primary" @click="getDataList"> 搜索 </n-button>
-      </n-input-group>
+        <n-button type="primary" style="margin-left: 10px;" @click="getDataList"> 搜索 </n-button>
+        <div style="padding-left: 20px;font-size: 18px;">
+           数量 / {{total}}
+        </div>
+      </div>
       <n-button type="primary" @click="showAddModal">批量导入</n-button>
     </n-space>
     <n-data-table remote :columns="columns" :data="data" :bordered="false" flex-height class="flex-1" />
@@ -103,7 +106,7 @@
 
 <script setup>
 import { h, reactive, ref, watch } from 'vue';
-import { NButton, NSpace, NPopconfirm, NInput } from 'naive-ui';
+import { NButton, NSpace, NPopconfirm, NInput ,useNotification } from 'naive-ui';
 import {
   getDeviceClassListList,
   addDeviceClassList,
@@ -306,16 +309,32 @@ const handleClear = () => {
   getDataList();
 };
 
+const notification = useNotification();
 //
 const submitCallback = () => {
   if (modal.title === '批量导入') {
     const arr = formValue.T_snid.split('\n');
     arr.forEach(async (item) => {
       const [T_layout_no_list, T_id] = item.split('-');
-      console.log('eee', T_layout_no_list, T_id)
       // return
       const code = await addDeviceClass(T_layout_no_list, T_id);
-      if (code !== 200) {
+      console.log('eee',code)
+
+      if (code.Code == 210) {
+        // message.error(code.Msg,
+        //   {
+        //     closable: true,
+        //     duration: 0
+        //   }
+        // )
+        notification['error']({
+          content: '提示',
+          meta: code.Msg,
+          })
+        return false;
+      }else if(code.Code==200){
+        return true;
+      }else{
         return false;
       }
     });
@@ -389,19 +408,21 @@ const addDeviceClass = async (T_layout_no_list, T_id) => {
       T_id,
       T_remark: formValue.T_remark,
     });
-    return res.Code;
+    return res;
   } catch (e) {
     console.log(e);
   } finally {
     getDataList();
   }
 };
-
+const total = ref(0)
 // 获取列表
 const getDataList = async () => {
   try {
     const { data: res } = await getDeviceClassListList(queryData);
     data.value = res.Data.List || [];
+    total.value = res.Data.Num
+    console.log('数量列表',data.value)
   } catch (e) {
     console.log(e);
   }

+ 23 - 9
src/views/project/index.vue

@@ -1,12 +1,16 @@
 <template>
+   <div style="display: flex;align-items: center;margin-bottom: 10px;">
+    <n-input v-model:value="queryData.T_name" type="text" placeholder="请输入报告名称" style="width: 30%;" clearable  />
+    <n-button type="primary" @click="searchFun" style="margin-left: 10px;">搜索</n-button>
+  </div>
   <n-data-table
     remote
     :columns="columns"
     :data="data"
     :pagination="pagination"
-    :bordered="false"
-    flex-height
-    class="h-full flex flex-col justify-between"
+ 
+    class=" flex flex-col justify-between"
+
   />
 </template>
 
@@ -23,7 +27,7 @@ const queryData = reactive({
   T_uuid: '',
   T_name: '',
   page: 1,
-  page_z: 10,
+  page_z: 8,
 });
 
 // 任务列表
@@ -61,7 +65,7 @@ const columns = [
     title() {
       return renderPopover(
         '流程(?)',
-        [0, 1, 2, 3].map((item) =>
+        [0, 1, 2, 3, 4].map((item) =>
           h(
             NTag,
             {
@@ -70,9 +74,11 @@ const columns = [
                 item === 0
                   ? 'error'
                   : item === 1
-                  ? 'success'
+                  ? 'info'//已完成
                   : item === 2
                   ? 'warning'
+                  : item === 4
+                  ? 'success'
                   : 'default',
             },
             {
@@ -80,9 +86,11 @@ const columns = [
                 if (item === 0) {
                   return '未完成';
                 } else if (item === 1) {
-                  return '已完成';
+                  return '数据来源已完成';
                 } else if (item === 2) {
                   return '处理中';
+                }  else if (item === 4) {
+                  return '数据编辑已完成';
                 } else {
                   return '已采集-无数据';
                 }
@@ -154,9 +162,11 @@ const columns = [
                         row.T_collection_state === 0
                           ? 'error'
                           : row.T_collection_state === 1
-                          ? 'success'
+                          ? 'info'
                           : row.T_collection_state === 2
                           ? 'warning'
+                          : row.T_collection_state === 4
+                          ? 'success'
                           : 'default',
                       bordered: false,
                     },
@@ -282,7 +292,11 @@ const columns = [
     },
   },
 ];
-
+//搜索按钮
+const searchFun = ()=>{
+  queryData.page = 1
+  getDataList();
+}
 // 分页数据源
 const pagination = reactive({
   page: queryData.page,