ソースを参照

增加页面,样式修改

chenminghua 2 年 前
コミット
d932b62560

+ 1 - 1
public/static/config/modeConfig.js

@@ -21,7 +21,7 @@ const showModuleName = 0;
 if (localTest) {
     baseURL = "http://192.168.10.5:9002/" // 联机调试 
 } else {
-    baseURL = "http://192.168.1.18:9002/" // 正式环境
+    baseURL = "http://10.155.32.14:9002/" // 正式环境
 }
 
 websocketUrl = (baseURL.replace(/http:\/\/|https:\/\//g, "")) + "gyee-websocket";

+ 4 - 2
src/api/axios.js

@@ -91,9 +91,11 @@ export function requestData(options) {
         resolve(response);
 
       } else { // 其他code
-        BASE.closeLoading();
+        if (options.showLoading) {
+          BASE.closeLoading();
+        }
         BASE.showMsg({
-          msg: (response.data && response.data.msg) || ("请求出错[" + response.data.code + "]")
+          msg: (response.data.msg) || ("请求出错[" + response.data.code + "]")
         });
 
       }

+ 8 - 3
src/router/index.js

@@ -36,14 +36,19 @@ const routes = [
 		name: "知识库",
 		component: () => import("../views/know/router/index.vue"),
 		children: [{
-			path: "station",
-			name: "故障类",
+			path: "fault/category",
+			name: "故障类",
 			component: () => import("../views/know/faultcategory.vue"),
+		},
+		{
+			path: "warning/category",
+			name: "报警类型",
+			component: () => import("../views/know/warncategory.vue"),
 		}]
 	},
 	{
 		icon: "menuIcon el-icon el-icon-info",
-		path: "/info",
+		path: "/basicinfo",
 		name: "基础配置",
 		component: () => import("../views/basicinfo/router/index.vue"),
 		children: [{

+ 2 - 1
src/tools/basicTool.js

@@ -77,7 +77,8 @@ export default {
    * 关闭loading
    */
   closeLoading() {
-    loadingStatus.close();
+    if(loadingStatus)
+      loadingStatus.close();
   },
 
   /**

+ 385 - 4
src/views/basicinfo/station.vue

@@ -1,5 +1,386 @@
 <template>
-     <div>
-          场站
-     </div>
-</template>
+  <div>
+    <div class="query mg-b-8">
+      <div class="query-items">
+        <div class="query-item">
+          <div class="lable">场站名称:</div>
+          <div class="search-input">
+            <el-input
+              v-model="search"
+              size="small"
+              placeholder="输入场站名称"
+              @input="filterStation"
+            />
+          </div>
+        </div>
+      </div>
+      <div class="query-actions" style="margin-left: 50px">
+        <button class="btn" @click="insertItem()">新增</button>
+      </div>
+    </div>
+    <div class="df-table">
+      <el-table :data="tableData" class="custom-table" height="80vh">
+        <el-table-column type="index" label="序号" align="center" width="50" />
+        <el-table-column prop="name" align="center" label="场站名称" />
+        <el-table-column prop="id" align="center" label="场站编码" />
+        <el-table-column prop="capacity" align="center" label="装机容量(MW)" />
+        <el-table-column prop="model" align="center" label="风机型号" />
+        <el-table-column prop="longitude" align="center" label="经度" />
+        <el-table-column prop="latitude" align="center" label="纬度" />
+        <el-table-column prop="manufacturer" align="center" label="风机厂商" />
+        <el-table-column align="center" label="操作">
+          <template v-slot="scope">
+            <el-button type="text" @click="editItem(scope)">编辑</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <el-dialog
+        :title="dialogTitle"
+        v-model="dialogShow"
+        width="50%"
+        top="15vh"
+        custom-class="modal"
+        :close-on-click-modal="true"
+      >
+        <el-form
+          ref="ruleFormRef"
+          :model="ruleForm"
+          :rules="rules"
+          label-width="120px"
+          size="default"
+        >
+          <div class="inlineItem">
+            <el-form-item :label="`${ruleForm['name--name--']}:`" prop="name">
+              <el-input
+                v-model="ruleForm.name"
+                :placeholder="`请输入${ruleForm['name--name--']}`"
+                type="input"
+              />
+            </el-form-item>
+            <el-form-item :label="`${ruleForm['id--name--']}:`" prop="id">
+              <el-input
+                v-model="ruleForm.id"
+                :placeholder="`请输入${ruleForm['id--name--']}`"
+                type="input"
+                :disabled="codedisabled"
+              />
+            </el-form-item>
+          </div>
+          <div class="inlineItem">
+            <el-form-item
+              :label="`${ruleForm['capacity--name--']}:`"
+              prop="capacity"
+            >
+              <el-input
+                v-model="ruleForm.capacity"
+                :placeholder="`请输入${ruleForm['capacity--name--']}`"
+                type="input"
+              />
+            </el-form-item>
+            <el-form-item
+              :label="`${ruleForm['model--name--']}:`"
+              prop="model"
+            >
+              <el-input
+                v-model="ruleForm.model"
+                :placeholder="`请输入${ruleForm['model--name--']}`"
+                type="input"
+              />
+            </el-form-item>
+          </div>
+          <div class="inlineItem">
+            <el-form-item
+              :label="`${ruleForm['longitude--name--']}:`"
+              prop="longitude"
+              type="input"
+            >
+              <el-input
+                v-model="ruleForm.longitude"
+                :placeholder="'请输入风机型号用/隔开'"
+                type="input"
+              />
+            </el-form-item>
+            <el-form-item
+              :label="`${ruleForm['latitude--name--']}:`"
+              prop="latitude"
+            >
+              <el-input
+                v-model="ruleForm.latitude"
+                :placeholder="`请输入${ruleForm['latitude--name--']}`"
+                type="input"
+              />
+            </el-form-item>
+          </div>
+          <div class="inlineItem">
+            <el-form-item
+              :label="`${ruleForm['manufacturer--name--']}:`"
+              prop="manufacturer"
+            >
+              <el-select
+                v-model="ruleForm.manufacturer"
+                :placeholder="`请输入${ruleForm['manufacturer--name--']}`"
+                popper-class="select"
+              >
+                <el-option
+                  v-for="item in manufacturerArray"
+                  :key="item.value"
+                  :value="item.value"
+                  :label="item.label"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </div>
+        </el-form>
+        <template #footer>
+          <span class="dialog-footer">
+            <el-button type="info" size="medium" @click="cancel"
+              >取消</el-button
+            >
+            <el-button
+              type="success"
+              size="medium"
+              @click="submit('ruleFormRef')"
+              >提交</el-button
+            >
+          </span>
+        </template>
+      </el-dialog>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      filterTableData: [],
+      tableData: [],
+      dialogTitle: "",
+      dialogShow: false,
+      codedisabled: false,
+      ruleForm: {
+        name: "",
+        "name--name--": "场站名称",
+        id: "",
+        "id--name--": "场站编码",
+        capacity: "",
+        "capacity--name--": "装机容量",
+        model: "",
+        "model--name--": "风机型号",
+        longitude: "",
+        "longitude--name--": "经度",
+        latitude: "",
+        "latitude--name--": "经度",
+        manufacturer: "",
+        "manufacturer--name--": "风机厂商",
+      },
+      rules: {
+        name: [
+          {
+            required: true,
+            message: "不可为空",
+            trigger: "blur",
+          },
+        ],
+        id: [
+          {
+            required: true,
+            message: "不可为空",
+            trigger: "blur",
+          },
+        ],
+        capacity: [
+          {
+            required: true,
+            message: "不可为空",
+            trigger: "blur",
+          },
+        ],
+        model: [
+          {
+            required: true,
+            message: "不可为空",
+            trigger: "blur",
+          },
+        ],
+        longitude: [
+          {
+            required: true,
+            message: "不可为空",
+            trigger: "blur",
+          },
+        ],
+        latitude: [
+          {
+            required: true,
+            message: "不可为空",
+            trigger: "blur",
+          },
+        ],
+        manufacturer: [
+          {
+            required: true,
+            message: "不可为空",
+            trigger: "blur",
+          },
+        ],
+      },
+      manufacturerArray: [
+        { label: "联合动力", value: "联合动力" },
+        { label: "华创", value: "华创" },
+      ],
+    };
+  },
+
+  created() {
+    this.getStationType();
+    this.renderRules();
+  },
+
+  methods: {
+    filterStation(value) {
+      if (value) {
+        let tableData = [];
+        this.filterTableData.forEach((ele) => {
+          if (ele.name.indexOf(value) !== -1) {
+            tableData.push(ele);
+          }
+        });
+        this.tableData = tableData;
+      } else {
+        this.tableData = this.filterTableData;
+      }
+    },
+    // 获取所有故障类型
+    getStationType() {
+      const that = this;
+      this.API.requestData({
+        subUrl: "basic/station/all",
+        success(res) {
+          that.tableData = res.data;
+          that.filterTableData = res.data;
+        },
+      });
+    },
+
+    // 取消新增或编辑
+    cancel() {
+      this.dialogShow = false;
+    },
+
+    //新增
+    insertItem() {
+      this.resetForm();
+      this.dialogShow = true;
+      this.dialogTitle = "新增";
+      this.codedisabled = false;
+    },
+
+    // 编辑某一条
+    editItem({ row }) {
+      for (let key in row) {
+        if (key !== "time") {
+          this.ruleForm[key] = row[key];
+        }
+      }
+      this.dialogShow = true;
+      this.dialogTitle = "编辑";
+      this.codedisabled = true;
+    },
+
+    // 提交编辑或者新增数据
+    submit(formName = "") {
+      const that = this;
+      that.$refs[formName].validate((valid) => {
+        if (valid) {
+          let data = {};
+          for (let key in that.ruleForm) {
+            if (key.indexOf("--name--") === -1) {
+              data[key] = that.ruleForm[key];
+            }
+          }
+          data.time = new Date().formatDate("yyyy-MM-dd hh:mm:ss");
+          data.category = "GZ";
+          that.API.request({
+            method: "POST",
+            subUrl: "know/fault/type/insert",
+            data,
+            success() {
+              that.BASE.showMsg({
+                type: "success",
+                msg: `${data.id ? "编辑" : "新增"}成功`,
+              });
+              that.dialogShow = false;
+              that.getStationType();
+            },
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+
+    // 渲染 rules 中文描述
+    renderRules() {
+      for (let key in this.rules) {
+        this.rules[key].forEach((ele) => {
+          ele.message = `${this.ruleForm[key + "--name--"]}` + ele.message;
+        });
+      }
+    },
+
+    // 重置表单并且重置表单效验
+    resetForm() {
+      this.dialogTitle = "";
+      this.ruleForm.id && delete this.ruleForm.id;
+      for (let key in this.ruleForm) {
+        if (key.indexOf("--name--") === -1) {
+          this.ruleForm[key] = "";
+        }
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scpoed>
+.el-form {
+  margin-left: 50px;
+}
+.el-form .el-form-item {
+  margin-top: 40px;
+  width: 80%;
+  display: flex;
+  justify-items: center;
+}
+.el-form {
+  display: flex;
+  justify-content: start;
+  align-items: center;
+  flex-wrap: wrap;
+  .inlineItem {
+    width: 100%;
+    display: flex;
+    justify-content: start;
+    align-items: center;
+    height: 80px;
+    .el-form-item {
+      width: 100%;
+      margin-bottom: 40px;
+
+      .el-input__count {
+        background: rgba(83, 98, 104, 0.2);
+        color: #b3bdc0;
+      }
+      .el-input{
+           width: 250px;
+      }
+      .el-select{
+           width: 250px;
+      }
+    }
+  }
+}
+</style>

+ 38 - 18
src/views/fault/diagnosefault.vue

@@ -2,13 +2,14 @@
   <div>
     <div class="query mg-b-8">
       <div class="query-items">
-        <div class="query-item">
+        <div class="query-item" style="width: 230px">
           <div class="lable">场站:</div>
           <div class="search-input">
             <el-select
               v-model="changzhan"
               placeholder="请选择"
               popper-class="select"
+              clearable
               @change="
                 () => {
                   getFengji();
@@ -25,7 +26,7 @@
             </el-select>
           </div>
         </div>
-        <div class="query-item">
+        <div class="query-item" style="width: 230px">
           <div class="lable">风机:</div>
           <div class="search-input">
             <el-select
@@ -50,7 +51,7 @@
             </el-select>
           </div>
         </div>
-        <div class="query-item">
+        <div class="query-item" style="width: 230px">
           <div class="lable">故障类型:</div>
           <div class="search-input">
             <el-select
@@ -74,7 +75,7 @@
             </el-select>
           </div>
         </div>
-        <div class="query-item">
+        <!-- <div class="query-item">
           <div class="lable">算法:</div>
           <div class="search-input">
             <el-select
@@ -97,7 +98,7 @@
               </el-option>
             </el-select>
           </div>
-        </div>
+        </div> -->
         <div class="query-item">
           <div class="lable">日期:</div>
           <div class="search-input">
@@ -118,12 +119,15 @@
             </el-date-picker>
           </div>
         </div>
+        <div class="query-actions">
+          <button class="btn" @click="search">查询</button>
+        </div>
         <div
           class="query-actions"
           :class="selectArray.length ? 'show' : 'hidden'"
-          style="margin-left: 0px"
+          style="margin-left: 20px"
         >
-          <button class="btn green" @click="confirm">批量打标签</button>
+          <button class="btn green" @click="confirm">打标签</button>
         </div>
       </div>
     </div>
@@ -136,9 +140,11 @@
         @selection-change="getSelectArray"
       >
         <el-table-column type="selection" width="50" align="center" />
+        <el-table-column type="index" label="序号" align="center" width="50" />
         <el-table-column prop="stationcn" align="center" label="场站" />
         <el-table-column prop="windturbineid" align="center" label="风机" />
-        <el-table-column align="center" label="故障类型">
+        <el-table-column prop="diagnosetype" align="center" label="诊断故障" />
+        <el-table-column align="center" label="确认故障">
           <template v-slot="scope">
             <el-select
               size="mini"
@@ -164,8 +170,12 @@
         </el-table-column>
         <el-table-column prop="algname" align="center" label="算法名" />
         <el-table-column prop="starttime" align="center" label="故障时间" />
-        <el-table-column prop="confirmName" align="center" label="是否确认" />
-
+        <el-table-column align="center" label="是否确认" >
+          <template v-slot="scope">
+            <span style="color:green" v-if="scope.row.confirm">{{scope.row.confirmName}}</span>
+            <span v-else>{{scope.row.confirmName}}</span>
+          </template>
+        </el-table-column>
         <el-table-column align="center" label="操作">
           <template v-slot="scope">
             <el-button type="text" @click="delItem(scope)">删除</el-button>
@@ -181,6 +191,7 @@ export default {
   components: {},
   data() {
     return {
+      timmer: null,
       changzhan: "",
       changzhanArray: [],
       fengji: "",
@@ -201,8 +212,17 @@ export default {
   },
   created() {
     this.getChangeZhan();
-    this.getFaultType();
+    this.getFaultType()
     this.getMethod();
+
+    this.timmer = setInterval(() => {
+      this.getTableData(false);
+    }, 30000);
+  },
+
+  unmounted() {
+    clearInterval(this.timmer);
+    this.timmer = null;
   },
   methods: {
     getSelectArray(res) {
@@ -243,7 +263,6 @@ export default {
       const that = this;
       that.API.requestData({
         method: "GET",
-        baseURL: "http://192.168.1.18:9002/",
         subUrl: "know/fault/type/all",
         success(res) {
           that.faultArray = res.data;
@@ -264,14 +283,18 @@ export default {
       //  });
     },
 
+    //条件查询
+    search() {
+      this.getTableData();
+    },
+
     // 获取表格数据
-    getTableData() {
+    getTableData(showLoading = true) {
       const that = this;
       that.API.requestData({
         method: "GET",
-        baseURL: "http://192.168.10.5:9002/",
         subUrl: "case/faultalg/list",
-        showLoading: true,
+        showLoading,
         data: {
           station: that.changzhan,
           windturbineid: that.fengji,
@@ -298,7 +321,6 @@ export default {
       data.faulttype = faultItem.name;
       that.API.request({
         method: "POST",
-        baseURL: "http://192.168.10.5:9002/",
         subUrl: "case/faultalg/edit",
         showLoading: true,
         data: Array.isArray(data) ? data : [data],
@@ -324,7 +346,6 @@ export default {
           if (action === "confirm") {
             that.API.requestData({
               method: "GET",
-              baseURL: "http://192.168.10.5:9002/",
               subUrl: "case/faultalg/delete",
               showLoading: true,
               data: {
@@ -368,7 +389,6 @@ export default {
 
               that.API.request({
                 method: "POST",
-                baseURL: "http://192.168.10.5:9002/",
                 subUrl: "case/faultalg/confirm",
                 showLoading: true,
                 data,

+ 23 - 24
src/views/know/faultcategory.vue

@@ -9,7 +9,7 @@
               v-model="search"
               size="small"
               placeholder="输入故障名称"
-              @input="test"
+              @input="filterFault"
             />
           </div>
         </div>
@@ -28,7 +28,7 @@
         <el-table-column align="center" label="操作">
           <template v-slot="scope">
             <el-button type="text" @click="editItem(scope)">编辑</el-button>
-            <el-button type="text" @click="delItem(scope)">删除</el-button>
+            <el-button type="text" @click="delItem(scope)" disabled>删除</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -39,11 +39,6 @@
         top="15vh"
         custom-class="modal"
         :close-on-click-modal="true"
-        @closed="
-          () => {
-            resetForm();
-          }
-        "
       >
         <el-form
           ref="ruleFormRef"
@@ -101,8 +96,7 @@ import { ElMessageBox } from "element-plus";
 export default {
   data() {
     return {
-      search: "",
-      sourceTableData: [],
+      filterTableData: [],
       tableData: [],
       dialogTitle: "",
       dialogShow: false,
@@ -134,22 +128,24 @@ export default {
     };
   },
 
-  computed: {},
-
   created() {
     this.getFaultType();
     this.renderRules();
   },
 
   methods: {
-    test(value) {
-      let tableData = [];
-      this.sourceTableData.forEach((ele) => {
-        if (ele.name.indexOf(value) !== -1) {
-          tableData.push(ele);
-        }
-      });
-      this.tableData = tableData;
+    filterFault(value) {
+      if (value) {
+        let tableData = [];
+        this.filterTableData.forEach((ele) => {
+          if (ele.name.indexOf(value) !== -1) {
+            tableData.push(ele);
+          }
+        });
+        this.tableData = tableData;
+      } else {
+        this.tableData = this.filterTableData;
+      }
     },
     // 获取所有故障类型
     getFaultType() {
@@ -157,8 +153,8 @@ export default {
       this.API.requestData({
         subUrl: "know/fault/type/all",
         success(res) {
-          that.sourceTableData = res.data;
           that.tableData = res.data;
+          that.filterTableData = res.data;
         },
       });
     },
@@ -170,6 +166,7 @@ export default {
 
     //新增
     insertItem() {
+      this.resetForm();
       this.dialogShow = true;
       this.dialogTitle = "新增";
       this.codedisabled = false;
@@ -208,6 +205,7 @@ export default {
                   msg: `删除成功`,
                 });
                 that.dialogShow = false;
+                that.getFaultType();
               },
             });
           }
@@ -227,7 +225,9 @@ export default {
             }
           }
           data.time = new Date().formatDate("yyyy-MM-dd hh:mm:ss");
-          that.API.requestData({
+          data.category = 'GZ';
+          that.API.request({
+            method: 'POST',
             subUrl: "know/fault/type/insert",
             data,
             success() {
@@ -236,6 +236,7 @@ export default {
                 msg: `${data.id ? "编辑" : "新增"}成功`,
               });
               that.dialogShow = false;
+              that.getFaultType();
             },
           });
         } else {
@@ -256,14 +257,12 @@ export default {
     // 重置表单并且重置表单效验
     resetForm() {
       this.dialogTitle = "";
-      this.dialogShow = false;
       this.ruleForm.id && delete this.ruleForm.id;
       for (let key in this.ruleForm) {
         if (key.indexOf("--name--") === -1) {
           this.ruleForm[key] = "";
         }
       }
-      this.$refs.ruleFormRef.resetFields();
     },
   },
 };
@@ -276,7 +275,7 @@ export default {
 }
 .el-form .el-form-item {
   margin-top: 40px;
-  width: 500px;
+  width: 80%;
   display: flex;
   justify-items: center;
 }

+ 267 - 0
src/views/know/station.vue

@@ -0,0 +1,267 @@
+<template>
+  <div>
+    <div class="query mg-b-8">
+      <div class="query-items">
+        <div class="query-item">
+          <div class="lable">故障名称:</div>
+          <div class="search-input">
+            <el-input
+              v-model="search"
+              size="small"
+              placeholder="输入报警分类"
+              @input="filterFault"
+            />
+          </div>
+        </div>
+      </div>
+      <div class="query-actions" style="margin-left: 50px">
+        <button class="btn" @click="insertItem()">新增</button>
+      </div>
+    </div>
+    <div class="df-table">
+      <el-table :data="tableData" class="custom-table" height="80vh">
+        <el-table-column type="index" label="序号" align="center" width="50" />
+        <el-table-column prop="name" align="center" label="报警类别" />
+        <el-table-column prop="code" align="center" label="故障编码" />
+        <el-table-column prop="time" align="center" label="创建时间" />
+
+        <el-table-column align="center" label="操作">
+          <template v-slot="scope">
+            <el-button type="text" @click="editItem(scope)">编辑</el-button>
+            <el-button type="text" @click="delItem(scope)" disabled>删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <el-dialog
+        :title="dialogTitle"
+        v-model="dialogShow"
+        width="50%"
+        top="15vh"
+        custom-class="modal"
+        :close-on-click-modal="true"
+      >
+        <el-form
+          ref="ruleFormRef"
+          :model="ruleForm"
+          :rules="rules"
+          label-width="120px"
+          size="default"
+        >
+          <el-form-item :label="`${ruleForm['name--name--']}:`" prop="name">
+            <el-input
+              v-model="ruleForm.name"
+              :placeholder="`请输入${ruleForm['name--name--']}`"
+              type="input"
+            />
+          </el-form-item>
+          <el-form-item :label="`${ruleForm['code--name--']}:`" prop="code">
+            <el-input
+              v-model="ruleForm.code"
+              :placeholder="`请输入${ruleForm['code--name--']}`"
+              type="input"
+              :disabled="codedisabled"
+            />
+          </el-form-item>
+          <el-form-item
+            :label="`${ruleForm['remark--name--']}:`"
+            prop="remark"
+          >
+            <el-input
+              v-model="ruleForm.remark"
+              :placeholder="`请输入${ruleForm['remark--name--']}`"
+              type="input"
+            />
+          </el-form-item>
+        </el-form>
+        <template #footer>
+          <span class="dialog-footer">
+            <el-button type="info" size="medium" @click="cancel"
+              >取消</el-button
+            >
+            <el-button
+              type="success"
+              size="medium"
+              @click="submit('ruleFormRef')"
+              >提交</el-button
+            >
+          </span>
+        </template>
+      </el-dialog>
+    </div>
+  </div>
+</template>
+
+<script>
+import { ElMessageBox } from "element-plus";
+export default {
+  data() {
+    return {
+      sourceTableData: [],
+      tableData: [],
+      dialogTitle: "",
+      dialogShow: false,
+      codedisabled: false,
+      ruleForm: {
+        name: "",
+        "name--name--": "报警类别",
+        code: "",
+        "code--name--": "编码",
+        remark: "",
+        "remark--name--": "备注",
+      },
+      rules: {
+        name: [
+          {
+            required: true,
+            message: "不可为空",
+            trigger: "blur",
+          },
+        ],
+        code: [
+          {
+            required: true,
+            message: "不可为空",
+            trigger: "blur",
+          },
+        ],
+      },
+    };
+  },
+
+  created() {
+    this.getStationType();
+    this.renderRules();
+  },
+
+  methods: {
+    // 获取所有故障类型
+    getStationType() {
+      const that = this;
+      this.API.requestData({
+        subUrl: "station/all",
+        success(res) {
+          that.tableData = res.data;
+        },
+      });
+    },
+
+    // 取消新增或编辑
+    cancel() {
+      this.dialogShow = false;
+    },
+
+    //新增
+    insertItem() {
+      this.resetForm();
+      this.dialogShow = true;
+      this.dialogTitle = "新增";
+      this.codedisabled = false;
+    },
+
+    // 编辑某一条
+    editItem({ row }) {
+      for (let key in row) {
+        if (key !== "time") {
+          this.ruleForm[key] = row[key];
+        }
+      }
+      this.dialogShow = true;
+      this.dialogTitle = "编辑";
+      this.codedisabled = true;
+    },
+
+    // 删除某一条
+    delItem({ row }) {
+      const that = this;
+      ElMessageBox.alert(`确定删除${row.name}?此操作不可逆!`, "", {
+        showCancelButton: true,
+        showConfirmButton: true,
+        confirmButtonText: "确定",
+        cancelButtonText: "我再想想",
+        callback(action) {
+          if (action === "confirm") {
+            that.API.requestData({
+              subUrl: "know/fault/type/delete",
+              data: {
+                id: row.id,
+              },
+              success() {
+                that.BASE.showMsg({
+                  type: "success",
+                  msg: `删除成功`,
+                });
+                that.dialogShow = false;
+              },
+            });
+          }
+        },
+      });
+    },
+
+    // 提交编辑或者新增数据
+    submit(formName = "") {
+      const that = this;
+      that.$refs[formName].validate((valid) => {
+        if (valid) {
+          let data = {};
+          for (let key in that.ruleForm) {
+            if (key.indexOf("--name--") === -1) {
+              data[key] = that.ruleForm[key];
+            }
+          }
+          data.time = new Date().formatDate("yyyy-MM-dd hh:mm:ss");
+          data.category = 'GZ';
+          that.API.request({
+            method: 'POST',
+            subUrl: "know/fault/type/insert",
+            data,
+            success() {
+              that.BASE.showMsg({
+                type: "success",
+                msg: `${data.id ? "编辑" : "新增"}成功`,
+              });
+              that.dialogShow = false;
+              that.getStationType();
+            },
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+
+    // 渲染 rules 中文描述
+    renderRules() {
+      for (let key in this.rules) {
+        this.rules[key].forEach((ele) => {
+          ele.message = `${this.ruleForm[key + "--name--"]}` + ele.message;
+        });
+      }
+    },
+
+    // 重置表单并且重置表单效验
+    resetForm() {
+      this.dialogTitle = "";
+      this.ruleForm.id && delete this.ruleForm.id;
+      for (let key in this.ruleForm) {
+        if (key.indexOf("--name--") === -1) {
+          this.ruleForm[key] = "";
+        }
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scpoed>
+.el-form {
+  margin-left: 50px;
+}
+.el-form .el-form-item {
+  margin-top: 40px;
+  width: 80%;
+  display: flex;
+  justify-items: center;
+}
+</style>

+ 286 - 0
src/views/know/warncategory.vue

@@ -0,0 +1,286 @@
+<template>
+  <div>
+    <div class="query mg-b-8">
+      <div class="query-items">
+        <div class="query-item">
+          <div class="lable">报警类别:</div>
+          <div class="search-input">
+            <el-input
+              v-model="search"
+              size="small"
+              placeholder="输入报警类别"
+              @input="filterFault"
+            />
+          </div>
+        </div>
+      </div>
+      <div class="query-actions" style="margin-left: 50px">
+        <button class="btn" @click="insertItem()">新增</button>
+      </div>
+    </div>
+    <div class="df-table">
+      <el-table :data="tableData" class="custom-table" height="80vh">
+        <el-table-column type="index" label="序号" align="center" width="50" />
+        <el-table-column prop="name" align="center" label="报警类别" />
+        <el-table-column prop="code" align="center" label="故障编码" />
+        <el-table-column prop="time" align="center" label="创建时间" />
+
+        <el-table-column align="center" label="操作">
+          <template v-slot="scope">
+            <el-button type="text" @click="editItem(scope)">编辑</el-button>
+            <el-button type="text" @click="delItem(scope)" disabled
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <el-dialog
+        :title="dialogTitle"
+        v-model="dialogShow"
+        width="50%"
+        top="15vh"
+        custom-class="modal"
+        :close-on-click-modal="true"
+      >
+        <el-form
+          ref="ruleFormRef"
+          :model="ruleForm"
+          :rules="rules"
+          label-width="120px"
+          size="default"
+        >
+          <el-form-item :label="`${ruleForm['name--name--']}:`" prop="name">
+            <el-input
+              v-model="ruleForm.name"
+              :placeholder="`请输入${ruleForm['name--name--']}`"
+              type="input"
+            />
+          </el-form-item>
+          <el-form-item :label="`${ruleForm['code--name--']}:`" prop="code">
+            <el-input
+              v-model="ruleForm.code"
+              :placeholder="`请输入${ruleForm['code--name--']}`"
+              type="input"
+              :disabled="codedisabled"
+            />
+          </el-form-item>
+          <el-form-item
+            :label="`${ruleForm['remark--name--']}:`"
+            prop="remark"
+          >
+            <el-input
+              v-model="ruleForm.remark"
+              :placeholder="`请输入${ruleForm['remark--name--']}`"
+              type="input"
+            />
+          </el-form-item>
+        </el-form>
+        <template #footer>
+          <span class="dialog-footer">
+            <el-button type="info" size="medium" @click="cancel"
+              >取消</el-button
+            >
+            <el-button
+              type="success"
+              size="medium"
+              @click="submit('ruleFormRef')"
+              >提交</el-button
+            >
+          </span>
+        </template>
+      </el-dialog>
+    </div>
+  </div>
+</template>
+
+<script>
+import { ElMessageBox } from "element-plus";
+export default {
+  data() {
+    return {
+      filterTableData: [],
+      tableData: [],
+      dialogTitle: "",
+      dialogShow: false,
+      codedisabled: false,
+      ruleForm: {
+        name: "",
+        "name--name--": "报警类别",
+        code: "",
+        "code--name--": "编码",
+        remark: "",
+        "remark--name--": "备注",
+      },
+      rules: {
+        name: [
+          {
+            required: true,
+            message: "不可为空",
+            trigger: "blur",
+          },
+        ],
+        code: [
+          {
+            required: true,
+            message: "不可为空",
+            trigger: "blur",
+          },
+        ],
+      },
+    };
+  },
+
+  created() {
+    this.getFaultType();
+    this.renderRules();
+  },
+
+  methods: {
+    filterFault(value) {
+      if (value) {
+        let tableData = [];
+        this.filterTableData.forEach((ele) => {
+          if (ele.name.indexOf(value) !== -1) {
+            tableData.push(ele);
+          }
+        });
+        this.tableData = tableData;
+      } else {
+        this.tableData = this.filterTableData;
+      }
+    },
+    // 获取所有故障类型
+    getFaultType() {
+      const that = this;
+      this.API.requestData({
+        subUrl: "know/fault/type/all",
+        data: {
+          category: "CUSTOMBJ",
+        },
+        success(res) {
+          that.tableData = res.data;
+          that.filterTableData = res.data;
+        },
+      });
+    },
+
+    // 取消新增或编辑
+    cancel() {
+      this.dialogShow = false;
+    },
+
+    //新增
+    insertItem() {
+      this.resetForm();
+      this.dialogShow = true;
+      this.dialogTitle = "新增";
+      this.codedisabled = false;
+    },
+
+    // 编辑某一条
+    editItem({ row }) {
+      for (let key in row) {
+        if (key !== "time") {
+          this.ruleForm[key] = row[key];
+        }
+      }
+      this.dialogShow = true;
+      this.dialogTitle = "编辑";
+      this.codedisabled = true;
+    },
+
+    // 删除某一条
+    delItem({ row }) {
+      const that = this;
+      ElMessageBox.alert(`确定删除${row.name}?此操作不可逆!`, "", {
+        showCancelButton: true,
+        showConfirmButton: true,
+        confirmButtonText: "确定",
+        cancelButtonText: "我再想想",
+        callback(action) {
+          if (action === "confirm") {
+            that.API.requestData({
+              subUrl: "know/fault/type/delete",
+              data: {
+                id: row.id,
+              },
+              success() {
+                that.BASE.showMsg({
+                  type: "success",
+                  msg: `删除成功`,
+                });
+                that.dialogShow = false;
+              },
+            });
+          }
+        },
+      });
+    },
+
+    // 提交编辑或者新增数据
+    submit(formName = "") {
+      const that = this;
+      that.$refs[formName].validate((valid) => {
+        if (valid) {
+          let data = {};
+          for (let key in that.ruleForm) {
+            if (key.indexOf("--name--") === -1) {
+              data[key] = that.ruleForm[key];
+            }
+          }
+          data.time = new Date().formatDate("yyyy-MM-dd hh:mm:ss");
+          data.category = "GZ";
+          that.API.request({
+            method: "POST",
+            subUrl: "know/fault/type/insert",
+            data,
+            success() {
+              that.BASE.showMsg({
+                type: "success",
+                msg: `${data.id ? "编辑" : "新增"}成功`,
+              });
+              that.dialogShow = false;
+              that.getFaultType();
+            },
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+
+    // 渲染 rules 中文描述
+    renderRules() {
+      for (let key in this.rules) {
+        this.rules[key].forEach((ele) => {
+          ele.message = `${this.ruleForm[key + "--name--"]}` + ele.message;
+        });
+      }
+    },
+
+    // 重置表单并且重置表单效验
+    resetForm() {
+      this.dialogTitle = "";
+      this.ruleForm.id && delete this.ruleForm.id;
+      for (let key in this.ruleForm) {
+        if (key.indexOf("--name--") === -1) {
+          this.ruleForm[key] = "";
+        }
+      }
+    },
+  },
+};
+</script>
+
+
+<style lang="less" scpoed>
+.el-form {
+  margin-left: 50px;
+}
+.el-form .el-form-item {
+  margin-top: 40px;
+  width: 80%;
+  display: flex;
+  justify-items: center;
+}
+</style>

+ 0 - 1
src/views/user/login.vue

@@ -57,7 +57,6 @@ export default {
         that.API.requestData({
           isMust: false,
           method: "POST",
-          baseURL: "http://192.168.10.5:9002/",
           subUrl: "sys/login",
           data: {
             username: that.username,