East 3 gadi atpakaļ
vecāks
revīzija
8dc5b13030

+ 31 - 1
src/utils/chenApi.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-11-18 13:40:39
- * @LastEditTime: 2021-11-29 11:15:18
+ * @LastEditTime: 2021-11-30 16:27:22
  * @LastEditors: Please set LastEditors
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: \hyyfClient\src\utils\chenApi.js
@@ -54,6 +54,16 @@ export function getCarWashVideo(params) {
   })
 }
 
+/* 人员管理 */
+// 档案管理
+export function getPersonFiles(params) {
+  return axios({
+    url: 'http://192.168.1.171:10253/produce/person/ge_person_list',
+    method: 'post',
+    data: params
+  })
+}
+
 /** 生产数据 - ERP 数据分析 - 工作看板 */
 // 汇总信息
 export function getWorkTotal(params) {
@@ -116,3 +126,23 @@ export function getTheSales(params) {
     data: params
   })
 }
+
+/** 违规报警 */
+/* 报警阈值设置 */
+// 常规设置 - list
+export function getRegularList(params) {
+  return axios({
+    url: '/produce/threshold/getThreshold',
+    method: 'get',
+    params: params
+  })
+}
+
+// 常规设置 - 修改
+export function getRegularSet(params) {
+  return axios({
+    url: '/produce/threshold/addThreshold',
+    method: 'post',
+    data: params
+  })
+}

+ 9 - 3
src/views/Alarm/AlarmSet.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-11-29 15:06:41
- * @LastEditTime: 2021-11-29 18:19:28
+ * @LastEditTime: 2021-11-30 16:09:56
  * @LastEditors: Please set LastEditors
  * @Description: 报警阈值设置
  * @FilePath: \hyyfClient\src\views\Alarm\AlarmSet.vue
@@ -18,7 +18,7 @@
       </div>
       <div class="regular-left"></div>
       <div class="right">
-        <regular-form></regular-form>
+        <regular-form ref="regularRef"></regular-form>
       </div>
     </div>
     <div class="regular-set">
@@ -30,7 +30,7 @@
         <alarm-form></alarm-form>
         <alarm-table></alarm-table>
         <div class="submit-btn">
-          <el-button type="primary">提交</el-button>
+          <el-button type="primary" @click="handleSubmit">提交</el-button>
         </div>
       </div>
     </div>
@@ -54,6 +54,12 @@ export default {
       titles: ["常规设置", "报警设置"],
     };
   },
+  methods: {
+    handleSubmit() {
+      console.log("好饿啊,我想去十足买吃的了");
+      this.$refs["regularRef"].actionRegular();
+    },
+  },
 };
 </script>
 <style scoped>

+ 65 - 25
src/views/Alarm/alarm-set/RegularForm.vue

@@ -1,61 +1,69 @@
 <!--
  * @Author: your name
  * @Date: 2021-11-29 15:55:20
- * @LastEditTime: 2021-11-29 16:49:29
+ * @LastEditTime: 2021-11-30 16:36:40
  * @LastEditors: Please set LastEditors
  * @Description: 常规设置的每一项
  * @FilePath: \hyyfClient\src\views\Alarm\alarm-set\RegularForm.vue
 -->
 <template>
   <div class="regular-form">
-    <el-form label-width="140px">
+    <el-form :model="regularForm" label-width="140px">
       <div class="row">
-        <el-form-item label="高温报警阈值:">
-          <el-input style="width: 200px"></el-input>
+        <el-form-item label="高温报警阈值:" prop="maxTem">
+          <el-input style="width: 200px" v-model="regularForm.maxTem">
+          </el-input>
           <span class="margin-left">℃</span>
         </el-form-item>
-        <el-form-item label="化学需氧量阈值:">
-          <el-input style="width: 200px"></el-input>
+        <el-form-item label="化学需氧量阈值:" prop="cod">
+          <el-input style="width: 200px" v-model="regularForm.cod"> </el-input>
           <span class="margin-left">mg/L</span>
         </el-form-item>
       </div>
 
       <div class="row">
-        <el-form-item label="低温报警阈值:">
-          <el-input style="width: 200px"></el-input>
+        <el-form-item label="低温报警阈值:" prop="minTem">
+          <el-input style="width: 200px" v-model="regularForm.minTem">
+          </el-input>
           <span class="margin-left">℃</span>
         </el-form-item>
-        <el-form-item label="氨氮量阈值:">
-          <el-input style="width: 200px"></el-input>
+        <el-form-item label="氨氮量阈值:" prop="ammonia">
+          <el-input style="width: 200px" v-model="regularForm.ammonia">
+          </el-input>
           <span class="margin-left">mg/L</span>
         </el-form-item>
       </div>
 
       <div class="row">
-        <el-form-item label="高湿度报警阈值:">
-          <el-input style="width: 200px"></el-input>
+        <el-form-item label="高湿度报警阈值:" prop="maxHum">
+          <el-input style="width: 200px" v-model="regularForm.maxHum">
+          </el-input>
           <span class="margin-left">%</span>
         </el-form-item>
-        <el-form-item label="总磷量阈值:">
-          <el-input style="width: 200px"></el-input>
+        <el-form-item label="总磷量阈值:" prop="phosphorus">
+          <el-input style="width: 200px" v-model="regularForm.phosphorus">
+          </el-input>
           <span class="margin-left">mg/L</span>
         </el-form-item>
       </div>
 
       <div class="row">
-        <el-form-item label="低湿度报警阈值:">
-          <el-input style="width: 200px"></el-input>
+        <el-form-item label="低湿度报警阈值:" prop="minHum">
+          <el-input style="width: 200px" v-model="regularForm.minHum">
+          </el-input>
           <span class="margin-left">%</span>
         </el-form-item>
-        <el-form-item label="总氮量阈值:">
-          <el-input style="width: 200px"></el-input>
+        <el-form-item label="总氮量阈值:" prop="nitrogen">
+          <el-input style="width: 200px" v-model="regularForm.nitrogen">
+          </el-input>
           <span class="margin-left">mg/L</span>
         </el-form-item>
       </div>
 
       <div class="row">
-        <el-form-item label="累计流量阈值:">
-          <el-input style="width: 200px"></el-input>
+        <el-form-item label="累计流量阈值:" prop="totalFlow">
+          <el-input style="width: 200px" v-model="regularForm.totalFlow">
+          </el-input>
           <span class="margin-left">T/HT</span>
         </el-form-item>
       </div>
@@ -63,22 +71,54 @@
   </div>
 </template>
 <script>
+import { getRegularList, getRegularSet } from "utils/chenApi.js";
 export default {
   data() {
     return {
       regularForm: {
-        highTemp: 30,
-        lowTemp: 15,
-        highHumi: 100,
-        lowHumi: 15,
+        maxTem: 30,
+        minTem: 15,
+        maxHum: 100,
+        minHum: 15,
         totalFlow: 15,
-        oxygen: 15,
+        cod: 15,
         ammonia: 15,
         phosphorus: 15,
         nitrogen: 15,
       },
     };
   },
+  mounted() {
+    this.initRegular();
+  },
+  methods: {
+    initRegular() {
+      getRegularList({}).then(({ code, data }) => {
+        if (code === 10000) {
+          this.regularForm = { ...data };
+          if (!data) {
+            this.regularForm = {
+              maxTem: "未设定",
+              minTem: "未设定",
+              maxHum: "未设定",
+              minHum: "未设定",
+              totalFlow: "未设定",
+              COD: "未设定",
+              ammonia: "未设定",
+              phosphorus: "未设定",
+              nitrogen: "未设定",
+            };
+          }
+        }
+      });
+    },
+    actionRegular() {
+      getRegularSet({ ...this.regularForm }).then((res) => {
+        console.log(res);
+        this.initRegular();
+      });
+    },
+  },
 };
 </script>
 <style scoped>

+ 76 - 15
src/views/BioSafety/PersonAdmin.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-09-16 11:27:35
- * @LastEditTime: 2021-11-28 15:31:59
+ * @LastEditTime: 2021-11-30 14:32:06
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: \hyyfClient\src\views\BioSafety\PersonAdmin.vue
@@ -33,7 +33,7 @@
       :height="475"
     >
       <template v-slot:right>
-        <template v-if="btnSelected === 1">
+        <!-- <template v-if="btnSelected === 1">
           <div>
             <el-button size="mini">添加人员</el-button>
             <el-button size="mini">添加区域</el-button>
@@ -48,11 +48,28 @@
           <div>
             <el-button size="mini">添加赶猪人员</el-button>
           </div>
-        </template>
+        </template> -->
       </template>
+
+      <!-- 人员门禁 -->
       <template v-slot:recordImage="slotProps">
         <img :src="slotProps.row.recordImage" alt="人员门禁" width="100" />
       </template>
+
+      <!-- 档案管理 -->
+      <template v-slot:personBiosignatures="slotProps">
+        <img
+          :src="slotProps.row.personBiosignatures[0].path"
+          alt="人员门禁"
+          width="100"
+        />
+      </template>
+      <template #sex="slotProps">
+        <span>{{ personSex[slotProps.row.sex] }}</span>
+      </template>
+      <template #status="slotProps">
+        <span>{{ personStatus[slotProps.row.status] }}</span>
+      </template>
     </new-table>
     <table-footer
       :totals="total"
@@ -69,11 +86,12 @@ import HeadBtns from "components/bioSafety/Btns";
 import QueryConditions from "components/bioSafety/QueryConditions";
 import NewTable from "components/newTable/NewTable";
 import TableFooter from "../../components/TableFooter";
+import { timeDate } from "../../utils/index";
 
 import { formItems, propFormData } from "./personAdmin/queryCondition.config";
 import { titles, tableItems, tableShows } from "./personAdmin/table.config";
 import { getFaceToken, getFaceGuard } from "../../utils/api";
-import { getFaceGuardTotal } from "../../utils/chenApi";
+import { getFaceGuardTotal, getPersonFiles } from "../../utils/chenApi";
 
 export default {
   name: "PersonAdmin",
@@ -91,7 +109,7 @@ export default {
         { id: 2, name: "人脸门禁" },
         // { id: 3, name: '赶猪监管' }
       ],
-      btnSelected: 2, // 选中的按钮
+      btnSelected: 1, // 选中的按钮
       formItems: [], // 传给 QueryCondition 组件的 formItems
       propFormData: {}, // 传给 QueryCondition 组件的 propFormData
       title: "", // 传给 BioTable 组件的 title
@@ -104,6 +122,8 @@ export default {
       pageNum: 1,
       selectId: "",
       params: {},
+      personStatus: ["已删除", "正常", "冻结"], // 档案管理 - 人员状态
+      personSex: ["未知", "男", "女"], // 档案管理 - 性别
     };
   },
   mounted() {
@@ -112,6 +132,7 @@ export default {
     this.title = titles[this.btnSelected - 1];
     this.tableItems = tableItems[this.btnSelected - 1];
     this.tableShows = tableShows;
+    this.initPersonFiles();
   },
   methods: {
     // 获取选中的按钮情况
@@ -121,28 +142,34 @@ export default {
       this.propFormData = propFormData[id - 1];
       this.title = titles[id - 1];
       this.tableItems = tableItems[id - 1];
+      this.chooseApi();
+    },
+    // 按钮选中情况 --> 对应的 api
+    chooseApi(flag = true) {
+      if (this.btnSelected === 1) {
+        this.initPersonFiles();
+      } else {
+        console.log("******************");
+        this.faceGuard();
+        if (flag) {
+          this.faceGuardTotal();
+        }
+      }
     },
     // 获取查询条件
     handleQuery(params) {
       this.params = params;
-      if (this.btnSelected === 2) {
-        this.faceGuard();
-        this.faceGuardTotal();
-      }
+      this.chooseApi();
     },
     // 修改size
     sizeChange(val) {
       this.size = val;
-      if (this.btnSelected === 2) {
-        this.faceGuard();
-      }
+      this.chooseApi(false);
     },
     // 修改页数
     pageChange(val) {
       this.pageNum = val;
-      if (this.btnSelected === 2) {
-        this.faceGuard();
-      }
+      this.chooseApi(false);
     },
     init() {
       let params = {
@@ -155,6 +182,12 @@ export default {
     },
     // 人脸门禁的查询
     faceGuard() {
+      if (!this.params.time) {
+        this.params.time = [
+          timeDate(new Date().getTime() - 1000 * 60 * 60 * 24),
+          timeDate(new Date().getTime()),
+        ];
+      }
       let queryParams = {
         pageNum: this.pageNum,
         pageSize: this.size,
@@ -176,7 +209,14 @@ export default {
         console.log("token:", token);
       });
     },
+    // 人脸门禁总条数
     faceGuardTotal() {
+      if (!this.params.time) {
+        this.params.time = [
+          timeDate(new Date().getTime() - 1000 * 60 * 60 * 24),
+          timeDate(new Date().getTime()),
+        ];
+      }
       let queryParams = {
         personName: this.params.name || undefined,
         startSwingTime: this.params.time[0] + " 00:00:00",
@@ -188,6 +228,27 @@ export default {
         this.total = JSON.parse(res.result).data;
       });
     },
+    // 档案管理
+    initPersonFiles() {
+      getPersonFiles({
+        searchKey: "",
+        pageNum: this.pageNum,
+        pageSize: this.size,
+        departmentId: this.params.departmentId || 5,
+        isContain: true,
+        statusList: [1, 2],
+      }).then(async ({ success, result }) => {
+        if (success) {
+          const listData = JSON.parse(result);
+          this.listData = listData.data.pageData;
+          this.total = listData.data.totalRows;
+          const { token } = await getFaceToken();
+          this.listData.forEach((item) => {
+            item.personBiosignatures[0].path = `https://36.26.62.70:447/evo-pic/${item.personBiosignatures[0].path}?token=${token}&oss_addr=172.16.3.223:9876`;
+          });
+        }
+      });
+    },
   },
 };
 </script>

+ 19 - 21
src/views/BioSafety/personAdmin/queryCondition.config.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-18 15:19:29
- * @LastEditTime: 2021-11-28 17:20:05
+ * @LastEditTime: 2021-11-30 14:04:46
  * @LastEditors: Please set LastEditors
  * @Description: 筛选条件的 formItems 和 propFormData
  * @FilePath: \hyyfClient\src\views\BioSafety\personAdmin\queryCondition.config.js
@@ -10,31 +10,29 @@ import { timeDate } from '../../../utils/index'
 
 const formItems1 = [
   {
-    type: 'input',
-    label: '输入搜索:',
-    placeholder: '请输入姓名',
-    field: 'name'
-  },
-  {
-    type: 'select',
-    label: '职务:',
-    placeholder: '请选择职务',
-    field: 'role',
-    options: []
-  },
-  {
     type: 'select',
-    label: '区域:',
-    placeholder: '请选择区域',
-    field: 'region',
-    options: []
+    label: '部门:',
+    placeholder: '请选择部门',
+    field: 'departmentId',
+    options: [
+      {
+        value: 4,
+        label: '维修部门'
+      },
+      {
+        value: 2,
+        label: '技术部门'
+      },
+      {
+        value: 5,
+        label: '基层部门'
+      }
+    ]
   }
 ]
 
 const propFormData1 = {
-  name: '',
-  role: '',
-  region: ''
+  departmentId: 5
 }
 
 const formItems2 = [

+ 14 - 31
src/views/BioSafety/personAdmin/table.config.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-18 16:06:51
- * @LastEditTime: 2021-11-18 14:32:36
+ * @LastEditTime: 2021-11-30 10:03:20
  * @LastEditors: Please set LastEditors
  * @Description: 表格的配置
  * @FilePath: \hyyfClient\src\views\BioSafety\personAdmin\table.config.js
@@ -10,16 +10,16 @@ export const titles = ['人员列表', '门禁记录', '人员列表']
 
 const tableItems1 = [
   {
-    prop: 'serialNumber',
+    prop: 'code',
     label: '编号',
     minWidth: '100',
-    slotName: 'serialNumber'
+    slotName: 'code'
   },
   {
-    prop: 'photo',
+    prop: 'personBiosignatures',
     label: '人员图片',
     minWidth: '150',
-    slotName: 'photo'
+    slotName: 'personBiosignatures'
   },
   {
     prop: 'name',
@@ -28,39 +28,22 @@ const tableItems1 = [
     slotName: 'name'
   },
   {
-    prop: 'phone',
-    label: '联系电话',
+    prop: 'sex',
+    label: '性别',
     minWidth: '150',
-    slotName: 'phone'
+    slotName: 'sex'
   },
   {
-    prop: 'region',
-    label: '负责区域',
+    prop: 'departmentName',
+    label: '所属部门',
     minWidth: '150',
-    slotName: 'region'
+    slotName: 'departmentName'
   },
   {
-    prop: 'role',
-    label: '职位',
+    prop: 'status',
+    label: '人员状态',
     minWidth: '100',
-    slotName: 'role'
-  },
-  {
-    prop: 'account',
-    label: '账号',
-    minWidth: '150',
-    slotName: 'account'
-  },
-  {
-    prop: 'password',
-    label: '密码',
-    minWidth: '150',
-    slotName: 'password'
-  },
-  {
-    label: '操作',
-    minWidth: '150',
-    slotName: 'handler'
+    slotName: 'status'
   }
 ]