Browse Source

数据采集-数据采集-添加查看、数据预警添加状态

Sanmu8 1 year ago
parent
commit
7d7f31cfa7

+ 21 - 0
src/api/portal/GATHER/GATHER.js

@@ -60,3 +60,24 @@ export function getInfoByColl(id) {
     method: 'get'
   })
 }
+
+
+
+// 上报
+export function approve(data) {
+  return request({
+    url: '/gather/approve/',
+    method: 'post',
+    data: data
+  })
+}
+
+
+// 提交审核
+export function report(data) {
+  return request({
+    url: '/gather/report/',
+    method: 'post',
+    data: data
+  })
+}

+ 19 - 0
src/api/portal/GATHERWARNING/GATHERWARNING.js

@@ -51,3 +51,22 @@ export function delGATHERWARNING(id) {
     method: 'get'
   })
 }
+
+// 处理预警  解除
+export function deal(id) {
+  return request({
+    url: '/gather/WARNING/deal/{id}' + id,
+    method: 'get'
+  })
+}
+
+
+// 取消预警
+export function cancel(id) {
+  return request({
+    url: '/gather/WARNING/cancel/{id}' + id,
+    method: 'get'
+  })
+}
+
+

+ 223 - 86
src/views/GATHER/index.vue

@@ -105,7 +105,7 @@
       :data="GATHERList"
       @selection-change="handleSelectionChange"
     >
-      <el-table-column type="selection" width="55" align="center" />
+      <!-- <el-table-column type="selection" width="55" align="center" /> -->
       <el-table-column label="数据类型" align="center" prop="type">
         <template slot-scope="scope">
           <span v-if="scope.row.type == 0">量化指标数据</span>
@@ -131,7 +131,7 @@
       </el-table-column>
       <el-table-column label="审核状态" align="center" prop="approveStatus">
         <template slot-scope="scope">
-          <span v-if="scope.row.reportStatus == 0">未审核</span>
+          <span v-if="scope.row.reportStatus == 0">未提交审核</span>
           <span v-if="scope.row.reportStatus == 1">审核中</span>
           <span v-if="scope.row.reportStatus == 2">审核通过</span>
           <span v-if="scope.row.reportStatus == 3">审核拒绝</span>
@@ -144,13 +144,48 @@
       >
         <template slot-scope="scope">
           <el-button
+            v-if="scope.row.collStatus == 0"
             size="mini"
             type="text"
-            icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['business:GATHER:edit']"
-            >修改</el-button
+            >录入</el-button
           >
+
+          <el-popconfirm
+            title="确定上报吗?"
+            @confirm="handleApprove(scope.row)"
+          >
+            <el-button
+              v-if="scope.row.reportStatus == 0"
+              size="mini"
+              slot="reference"
+              type="text"
+              v-hasPermi="['business:GATHER:edit']"
+              >上报</el-button
+            >
+          </el-popconfirm>
+
+          <el-popconfirm
+            title="确定提交吗?"
+            @confirm="handleReport(scope.row)"
+          >
+            <el-button
+              v-if="scope.row.reportStatus == 0"
+              size="mini"
+              type="text"
+              slot="reference"
+              v-hasPermi="['business:GATHER:edit']"
+              >提交审核</el-button
+            >
+          </el-popconfirm>
+            <el-button
+            v-if="scope.row.collStatus == 1"
+              size="mini"
+              type="text"
+               @click="handleDetail(scope.row)"
+              >查看</el-button
+            >
         </template>
       </el-table-column>
     </el-table>
@@ -165,14 +200,14 @@
 
     <!-- 添加或修改数据采集对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
-      <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
+      <el-tabs v-if="this.form.type == 0" v-model="activeName" type="border-card" @tab-click="handleClick">
         <el-tab-pane
           v-for="(item, index) in tabList"
           :key="index + 'tabs'"
           :label="item.normName"
           :name="item.normName"
         >
-          <el-form :model="form" label-width="150px">
+          <el-form :model="form" label-width="200px">
             <!-- :rules="rules" ref="form" -->
             <el-form-item
               v-for="(listItem, listIndex) in form.feeLists"
@@ -181,9 +216,9 @@
               v-if="listItem.normId == item.normId"
               :required="true"
             >
-            <!-- 这里科研失败!想动态绑定校验规则的 -->
-            <!-- :prop="listItem.normfeeId" -->
-            <!-- :rules="rules.listItem.normfeeId" -->
+              <!-- 这里科研失败!想动态绑定校验规则的 -->
+              <!-- :prop="listItem.normfeeId" -->
+              <!-- :rules="rules.listItem.normfeeId" -->
               <el-input
                 v-model="listItem.collCalue"
                 :placeholder="'请输入' + listItem.normfeeName"
@@ -192,7 +227,7 @@
           </el-form>
 
           <!-- 这里是第二种写法 -->
-          <!-- <el-form :model="form" label-width="150px">
+          <!-- <el-form :model="form" label-width="300px">
             <el-form-item
               v-for="(listItem, listIndex) in item.list"
               :key="listIndex + 'item.list'"
@@ -206,72 +241,99 @@
           </el-form> -->
         </el-tab-pane>
       </el-tabs>
-      <!-- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="数据类型" prop="type">
-          <el-select
-            v-model="form.type"
-            placeholder="请选择数据类型"
-            filterable
-          >
-            <el-option
-              v-for="dict in typeList"
-              :key="dict.value + 'typeList2'"
-              :label="dict.label"
-              :value="dict.value"
-            />
-          </el-select>
-        </el-form-item>
-        <el-form-item label="采集状态" prop="collStatus">
-          <el-select
-            v-model="form.collStatus"
-            placeholder="请选择采集状态"
-            clearable
-            filterable
-          >
-            <el-option
-              v-for="dict in collStatus"
-              :key="dict.value + 'collStatus2'"
-              :label="dict.label"
-              :value="dict.value"
-            />
-          </el-select>
-        </el-form-item>
-        <el-form-item label="上报状态" prop="reportStatus">
-          <el-select
-            v-model="form.reportStatus"
-            placeholder="请选择上报状态"
-            clearable
-            filterable
-          >
-            <el-option
-              v-for="dict in reportStatus"
-              :key="dict.value + 'reportStatus2'"
-              :label="dict.label"
-              :value="dict.value"
-            />
-          </el-select>
-        </el-form-item>
-        <el-form-item label="审核状态" prop="approveStatus">
-          <el-select
-            v-model="form.approveStatus"
-            placeholder="请选择审核状态"
-            clearable
-            filterable
-          >
-            <el-option
-              v-for="dict in approveStatus"
-              :key="dict.value + 'approveStatus2'"
-              :label="dict.label"
-              :value="dict.value"
-            />
-          </el-select>
-        </el-form-item>
-      </el-form> -->
-      <div slot="footer" class="dialog-footer">
+
+      <el-form :model="form" label-width="200px" v-else-if="this.form.type == 1">
+            <!-- :rules="rules" ref="form" -->
+            <el-form-item
+              v-for="(listItem, listIndex) in form.feeLists"
+              :key="listItem.normfeeId"
+              :label="listItem.normfeeName"
+              :required="true"
+            >
+              <!-- 这里科研失败!想动态绑定校验规则的 -->
+              <!-- :prop="listItem.normfeeId" -->
+              <!-- :rules="rules.listItem.normfeeId" -->
+              <el-input
+                v-model="listItem.collCalue"
+                :placeholder="'请输入' + listItem.normfeeName"
+              ></el-input>
+            </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>
+        <!-- <el-button @click="cancel">取 消</el-button> -->
+      </div>
+    </el-dialog>
+
+    <!-- 查看 -->
+    <el-dialog :title="title" :visible.sync="openDetail" width="80%" append-to-body>
+      <el-tabs v-if="this.form.type == 0" v-model="activeName" type="border-card" @tab-click="handleClick">
+        <el-tab-pane
+          v-for="(item, index) in tabList"
+          :key="index + 'tabs'"
+          :label="item.normName"
+          :name="item.normName"
+        >
+          <el-form :model="form" label-width="200px">
+            <!-- :rules="rules" ref="form" -->
+            <el-form-item
+              v-for="(listItem, listIndex) in form.feeLists"
+              :key="listItem.normfeeId"
+              :label="listItem.normfeeName"
+              v-if="listItem.normId == item.normId"
+              :required="true"
+            >
+              <!-- 这里科研失败!想动态绑定校验规则的 -->
+              <!-- :prop="listItem.normfeeId" -->
+              <!-- :rules="rules.listItem.normfeeId" -->
+              <el-input
+              disabled
+                v-model="listItem.collCalue"
+                :placeholder="'请输入' + listItem.normfeeName"
+              ></el-input>
+            </el-form-item>
+          </el-form>
+
+          <!-- 这里是第二种写法 -->
+          <!-- <el-form :model="form" label-width="150px">
+            <el-form-item
+              v-for="(listItem, listIndex) in item.list"
+              :key="listIndex + 'item.list'"
+              :label="listItem.normfeeName"
+            >
+              <el-input
+                v-model="listItem.collCalue"
+                :placeholder="'请输入' + listItem.normfeeName"
+              ></el-input>
+            </el-form-item>
+          </el-form> -->
+        </el-tab-pane>
+      </el-tabs>
+
+      <el-form :model="form" label-width="200px" v-else-if="this.form.type == 1">
+            <!-- :rules="rules" ref="form" -->
+            <el-form-item
+              v-for="(listItem, listIndex) in form.feeLists"
+              disabled
+              :key="listItem.normfeeId"
+              :label="listItem.normfeeName"
+              :required="true"
+            >
+              <!-- 这里科研失败!想动态绑定校验规则的 -->
+              <!-- :prop="listItem.normfeeId" -->
+              <!-- :rules="rules.listItem.normfeeId" -->
+              <el-input
+                v-model="listItem.collCalue"
+                :placeholder="'请输入' + listItem.normfeeName"
+              ></el-input>
+            </el-form-item>
+          </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="cancel">返 回</el-button>
       </div>
     </el-dialog>
+    
   </div>
 </template>
 
@@ -283,6 +345,8 @@ import {
   addGATHER,
   updateGATHER,
   getInfoByColl,
+  approve,
+  report,
 } from "@/api/portal/GATHER/GATHER.js";
 
 export default {
@@ -334,6 +398,7 @@ export default {
       title: "",
       // 是否显示弹出层
       open: false,
+      openDetail:false,
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -363,6 +428,21 @@ export default {
     this.getList();
   },
   methods: {
+    //上报
+    handleApprove(data) {
+      approve(data).then((res) => {
+        this.$modal.msgSuccess("上报成功");
+        this.getList();
+      });
+    },
+    //提交审核
+    handleReport(data) {
+      this.$modal.msgSuccess("提交审核成功");
+      report(data).then((res) => {
+        this.getList();
+      });
+    },
+
     handleClick(tab, event) {},
     /** 查询数据采集列表 */
     getList() {
@@ -376,6 +456,7 @@ export default {
     // 取消按钮
     cancel() {
       this.open = false;
+      this.openDetail = false
       this.reset();
     },
     // 表单重置
@@ -412,19 +493,20 @@ export default {
     handleAdd() {
       this.reset();
       this.open = true;
+      this.openDetail = true
       this.title = "添加数据采集";
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
       // this.reset();
-      this.tabList = []
-      this.form = []
+      this.tabList = [];
+      this.form = [];
       const id = row.id || this.ids;
       getInfoByColl(id).then((response) => {
         //深拷贝,而不是拷贝地址
         this.form = JSON.parse(JSON.stringify(response.data));
         this.open = true;
-        this.title = "修改数据采集";
+        this.title = "数据录入";
         //深拷贝,而不是拷贝地址
         this.tabList = JSON.parse(JSON.stringify(response.data.feeLists));
         let dataList = response.data.feeLists;
@@ -443,7 +525,6 @@ export default {
             }
           }
         }
-        
 
         // 这里科研失败!想动态绑定校验规则的
         //遍历设置表单校验  我好困
@@ -455,7 +536,57 @@ export default {
 
         // console.log(this.rules);
 
+        //这里是第二种写法
+        //获取分类ID相同的子集
+        // for (let index = 0; index < this.tabList.length; index++) {
+        //   this.$set(this.tabList[index],'list',[])
+        //   for (let i = 0; i < dataList.length; i++) {
+        //     if (dataList[i].normId == this.tabList[index].normId) {
+        //       this.tabList[index].list.push(dataList[i]);
+        //     }
+        //   }
+        // }
+      });
+    },
+    /** 查看按钮操作 */
+    handleDetail(row) {
+      // this.reset();
+      this.tabList = [];
+      this.form = [];
+      const id = row.id || this.ids;
+      getGATHER(id).then((response) => {
+        //深拷贝,而不是拷贝地址
+        this.form = JSON.parse(JSON.stringify(response.data));
+        this.openDetail = true;
+        this.title = "数据查看";
+        //深拷贝,而不是拷贝地址
+        this.tabList = JSON.parse(JSON.stringify(response.data.feeLists));
+        let dataList = response.data.feeLists;
+        //去重获取tab
+        //遍历如果遇到相同的id则删掉
+        for (var i = 0; i < this.tabList.length - 1; i++) {
+          //设置激活的tab
+          if (i == 0) {
+            this.activeName = this.tabList[0].normName;
+          }
+          for (var j = i + 1; j < this.tabList.length; j++) {
+            if (this.tabList[i].normId == this.tabList[j].normId) {
+              this.tabList.splice(j, 1);
+              //因为数组长度减小1,所以直接 j++ 会漏掉一个元素,所以要 j--
+              j--;
+            }
+          }
+        }
+
+        // 这里科研失败!想动态绑定校验规则的
+        //遍历设置表单校验  我好困
+        // for (const i in this.form.feeLists) {
+        //   this.$set(this.rules,this.form.feeLists[i].normfeeId,[
+        //     {  required: true, message: this.form.feeLists[i].normfeeName+"不能为空", trigger: "blur"  }
+        //   ])
+        // }
 
+        // console.log(this.rules);
 
         //这里是第二种写法
         //获取分类ID相同的子集
@@ -472,19 +603,25 @@ export default {
     /** 提交按钮 */
     submitForm() {
       for (const i in this.form.feeLists) {
-        if(this.form.feeLists[i].collCalue == '' || this.form.feeLists[i].collCalue == null){
+        if (
+          this.form.feeLists[i].collCalue == "" ||
+          this.form.feeLists[i].collCalue == null
+        ) {
           return this.$message({
-          message: this.form.feeLists[i].normName+' - '+this.form.feeLists[i].normfeeName+' 未填写!',
-          type: 'warning'
-        });
+            message:
+              this.form.feeLists[i].normName +
+              " - " +
+              this.form.feeLists[i].normfeeName +
+              " 未填写!",
+            type: "warning",
+          });
         }
       }
       addGATHER(this.form).then((response) => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-
+        this.$modal.msgSuccess("新增成功");
+        this.open = false;
+        this.getList();
+      });
 
       // this.$refs["form"].validate((valid) => {
       //   if (valid) {
@@ -495,7 +632,7 @@ export default {
       //         this.getList();
       //       });
       //     } else {
-           
+
       //     }
       //   }
       // });

+ 66 - 16
src/views/GATHERWARNING/index.vue

@@ -23,6 +23,21 @@
           />
         </el-select>
       </el-form-item>
+      <el-form-item label="状态" prop="type">
+        <el-select
+          v-model="queryParams.type"
+          placeholder="请选择状态"
+          clearable
+          filterable
+        >
+          <el-option
+            v-for="dict in statusList"
+            :key="dict.value + 'statusList'"
+            :label="dict.label"
+            :value="dict.value"
+          />
+        </el-select>
+      </el-form-item>
       <el-form-item>
         <el-button
           type="primary"
@@ -49,7 +64,7 @@
       :data="GATHERWARNINGList"
       @selection-change="handleSelectionChange"
     >
-      <el-table-column type="selection" width="55" align="center" />
+      <!-- <el-table-column type="selection" width="55" align="center" /> -->
 
       <el-table-column label="数据类型" align="center" prop="type">
         <template slot-scope="scope">
@@ -72,6 +87,13 @@
           {{ scope.row.dealTime }}
         </template>
       </el-table-column>
+      <el-table-column label="状态" align="center" prop="cancelBy">
+        <template slot-scope="scope">
+          <span v-if="scope.row.status == 0">预警</span>
+          <span v-else-if="scope.row.status == 1">已解除</span>
+          <span v-else-if="scope.row.status == 2">已取消</span>
+        </template>
+      </el-table-column>
       <el-table-column label="取消人" align="center" prop="cancelBy">
         <template slot-scope="scope">
           {{ scope.row.cancelBy }}
@@ -93,22 +115,28 @@
         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="['business:GATHERWARNING:edit']"
-            >处理</el-button
-          >
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['business:GATHERWARNING:remove']"
-            >解除</el-button
+          <el-popconfirm title="确定处理吗?" @confirm="handleDeal(scope.row)">
+            <el-button
+              size="mini"
+              type="text"
+              slot="reference"
+              v-hasPermi="['business:GATHERWARNING:edit']"
+              >处理</el-button
+            >
+          </el-popconfirm>
+
+          <el-popconfirm
+            title="确定取消吗?"
+            @confirm="handleCancel(scope.row)"
           >
+            <el-button
+              size="mini"
+              type="text"
+              slot="reference"
+              v-hasPermi="['business:GATHERWARNING:remove']"
+              >取消</el-button
+            >
+          </el-popconfirm>
         </template>
       </el-table-column>
     </el-table>
@@ -150,6 +178,8 @@ import {
   delGATHERWARNING,
   addGATHERWARNING,
   updateGATHERWARNING,
+  deal,
+  cancel,
 } from "@/api/portal/GATHERWARNING/GATHERWARNING.js";
 
 export default {
@@ -160,6 +190,12 @@ export default {
         { label: "要闻咨量化指标数据询", value: "0" },
         { label: "月报表数据", value: "1" },
       ],
+      //状态(0=预警,1=已解除,2已取消)
+      statusList: [
+        { label: "预警", value: "0" },
+        { label: "已解除", value: "1" },
+        { label: "已取消", value: "2" },
+      ],
       // 根路径
       baseURL: process.env.VUE_APP_BASE_API,
       // 遮罩层
@@ -265,6 +301,20 @@ export default {
         this.loading = false;
       });
     },
+    //处理预警
+    handleDeal(row) {
+      deal(row.id).then((res) => {
+        this.$modal.msgSuccess("处理成功");
+        this.getList();
+      });
+    },
+    //取消预警
+    handleCancel(row) {
+      cancel(row.id).then((res) => {
+        this.$modal.msgSuccess("取消成功");
+        this.getList();
+      });
+    },
     // 取消按钮
     cancel() {
       this.open = false;